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
|
|---|---|---|---|---|---|
Question
Consider quadratic Diophantine equations of the form:
For example, when , the minimal solution in is .
It can be assumed that there are no solutions in positive integers when is square.
By finding minimal solutions in for , we obtain the following:
Hence, by considering minimal solutions in for , the largest is obtained when .
Find the value of in minimal solutions of for which the largest value of is obtained.
Haskell
import Data.Function (on) import Data.List (maximumBy) isInteger :: Double -> Bool isInteger f = f - (fromIntegral (floor f)) < 0.0000001 isSquare :: Integer -> Bool isSquare n = isInteger (sqrt $ fromIntegral n) rationalize :: [Integer] -> (Integer, Integer) rationalize = foldr (\x (n, d) -> (x*n + d, n)) (1, 0) convergents :: Integer -> [Integer] convergents s | isSquare s = [] | isSquare (s-1) = (a 0) : repeat (fromIntegral $ 2 * (floor $ sqrt $ fromIntegral (s-1))) | otherwise = map a [0..] where m = (map m' [0..] !!) m' 0 = 0 m' n = (d (n-1))*(a (n-1)) - (m (n-1)) d = (map d' [0..] !!) d' 0 = 1 d' n = (s - (m n)^2) `quot` (d (n-1)) a = (map a' [0..] !!) a' 0 = floor $ sqrt $ fromIntegral s a' n = floor $ (fromIntegral ((a 0) + (m n))) / (fromIntegral (d n)) solve :: Integer -> Integer solve d = head $ [x | n <- [1..], let (x, y) = rationalize $ take n $ convergents d, x^2 - d*y^2 == 1] main :: IO () main = print $ maximumBy (compare `on` solve) $ [1..1000]
$ ghc -O2 -o diophantine diophantine.hs $ time ./diophantine real 0m0.333s user 0m0.332s sys 0m0.000s
|
https://zach.se/project-euler-solutions/66/
|
CC-MAIN-2018-51
|
refinedweb
| 244
| 66.54
|
/* * <string.h> #include <unistd.h> #include <err.h> int checkvfsname __P((const char *, const char **)); const char **makevfslist __P((char *)); static int skipvfs; int checkvfsname(vfsname, vfslist) const char *vfsname; const char **vfslist; { if (vfslist == NULL) return (0); while (*vfslist != NULL) { if (strcmp(vfsname, *vfslist) == 0) return (skipvfs); ++vfslist; } return (!skipvfs); } const char ** makevfslist(fslist) char *fslist; { const char **av; int i; char *nextcp; if (fslist == NULL) return (NULL); if (fslist[0] == 'n' && fslist[1] == 'o') { fslist += 2; skipvfs = 1; } for (i = 0, nextcp = fslist; *nextcp; nextcp++) if (*nextcp == ',') i++; if ((av = malloc((size_t)(i + 2) * sizeof(char *))) == NULL) { warn(NULL); return (NULL); } nextcp = fslist; i = 0; av[i++] = nextcp; while ((nextcp = strchr(nextcp, ',')) != NULL) { *nextcp++ = '\0'; av[i++] = nextcp; } av[i++] = NULL; return (av); }
|
http://opensource.apple.com/source/diskdev_cmds/diskdev_cmds-491.3/disklib/vfslist.c
|
CC-MAIN-2016-30
|
refinedweb
| 125
| 53.41
|
Login Action Class - Struts
Login Action Class Hi
Any one can you please give me example of Struts How Login Action Class Communicate with i-batis
Dispatcher Result Example
Dispatcher Result Example
The Dispatcher Result forwarded the action... the same to the
dispatch the request data to the desired action. To use...;
<action name="login">
< how to solve actionservlet is not found error in dispatch action
Struts Action Chaining
Struts Action Chaining Struts Action Ch
Struts Action Class
Struts Action Class What happens if we do not write execute() in Action class
Struts MappingDispatchAction Example
Struts MappingDispatchAction Example
Struts MappingDispatch Action...
Developing the Action Mapping in the struts-config.xml
Here, we
Struts MappingDispatchAction Example
Struts MappingDispatchAction Example... in this example you will learn more about Struts MappingDispatchAction... that it uses a unique
action corresponding to a new request
, to dispatch
Struts LookupDispatchAction Example
Struts LookupDispatchAction Example
Struts LookupDispatch Action... function. Here in this example you will learn more about Struts LookupDispatchAction... Action example:
Step 1: Create the
struts.xml file and add the following
STRUTS ACTION - AGGREGATING ACTIONS IN STRUTS
STRUTS ACTION - AGGREGATING ACTIONS IN STRUTS... of Action classes for your project. The latest version of struts provides classes... action. In this article we will see how to achieve this. Struts provides four
dynamic method dispatch - Java Beginners
dynamic method dispatch can you give a good example for dynamic method dispatch (run time polymorphism)
Hi Friend,
In dynamic method dispatch,super class refers to subclass object and implements method overriding
Java - Struts
in DispatchAction in Struts.
How can i pass the method name in "action" and how can i map at in struts-config.xml;
when i follow some guidelines... on DispatchAction in Struts visit to :
code - Struts
code How to write the code for multiple actions for many submit buttons. use dispatch action Action interface
Introduction To Struts Action Interface
The Action interface contains the a single method execute(). The business
logic of the action is executed within this method. This method is implemented
by the derived class. For example
Chain Action Result Example
Chain Action Example
Struts2.2.1 provides the feature to chain many actions... to forward a request to
an another action. While propagating the state.
An Example...;
<action
Redirect Action Result Example
Redirect Action Result Example
The Result uses the ActionMapper of the ActionMapperFactory for redirecting
the URL to the specified action. To redirect...;/jsp/home.jsp</result>
</action>
An example of Redirect
Understanding Struts Action Class
Understanding Struts Action Class
In this lesson I will show you how to use Struts Action...
- if the application business logic throws an exception
Adding the Action Mapping in
/understandingstruts_action_class.shtml class? HI, Which is best and why either action class or dispatch class. like that Actionform or Dynactionform . I know usage
Action Tag (Data Tag) Example
Action Tag (Data Tag) Example
In this section, we are going to describe the action
tag. The action tag is a generic tag that is used
to call actions directly from a JSP page by
specifying the action
Struts - Struts
Struts Is Action class is thread safe in struts? if yes, how... explaination and example? thanks in advance. Hi Friend,
It is not thread...://
Thanks Tutorials - Jakarta Struts Tutorial
;
- Struts
Dispatch Action Example
Here in this example you will learn more about Struts Dispatch Action...;
- Struts LookupDispatchAction Example
Struts LookupDispatch
No action instance for path
;
</action-mappings>
</struts-config>... struts@roseindia.net
*/
/**
* Struts File Upload Action Form...No action instance for path <%@ taglib uri="http
struts-- - Struts
struts when the action servlet is invoked in struts? Hi Friend,
Please visit the following link:
Thanks
AsyncContext Interface dispatch method
In this section, you will learn about dispatch method of AsyncContext Interface
attribute in action tag - Java Beginners
attribute in action tag I'm just a beginner to struts.
The name tag(name="bookListForm") is used to define the form used with the action class. But i`m not clear about the attribute tag(attribute
|
Struts
Built-In Actions |
Struts
Dispatch Action |
Struts
Forward Action |
Struts
LookupDispatchAction |
Struts MappingDispatchAction...
Works? |
Struts Controller |
Struts Action Class |
Struts
ActionFrom Class
struts
struts <p>hi here is my code can you please help me to solve...;
<p><html>
<body></p>
<form action="login.do">...*;
import org.apache.struts.action.*;
public class LoginAction extends Action
Implementing Actions in Struts 2
;roseindia" extends="struts-default">
<action name="...Implementing Actions in Struts 2
Package com.opensymphony.xwork2 contains the many Action classes and
interface, if you want to make an action class for
-config.xml
Action Entry:
Difference between Struts-config.xml...struts hi,
what is meant by struts-config.xml and wht are the tags...
2. wht is the difference b/w the web.xml and struts-config.xml
3. what is it correct to pass the form object as arg from action to service
UIButton action example
UIButton action example HI,
How i can capture the Button click action? What to write the .h and .m file?
Thanks
Hi,
Here is the code that you can write in .h file:
(void) buttonPress:(id)sender;
Here
Struts 2.0 - Struts
Struts 2.0 Hi ALL,
I am getting following error when I am trying... not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name}
here is the action:
public class WeekDay
how to forward select query result to jsp page using struts action class
how to forward select query result to jsp page using struts action class how to forward select query result to jsp page using struts action class
Flex dispatch event example
Flex dispatchEvent example
The example below demonstrates the working of flex... mentioned in its constructor.
This method is used to manually dispatch or run away
struts <html:select> - Struts
with the action.
For example, the class attribute might be specified...struts i am new to struts.when i execute the following code i am... :
1. Remove name attribute altogether and specify only an action attribute
Actions - Struts
Action struts 2 Please explain the Action Script in
spring controller V/S stuts Action - Spring
spring controller V/S stuts Action we are going to use spring framework so what is better spring controller or struts action
configuration - Struts
.
Action class:
An Action class in the struts application extends Struts...:// Can you please tell me the clear definition of 2 testing
struts 2 testing can i get an example for struts 2 action class unit test
Advance Struts Action
Advance Struts2 Action
In struts framework Action is responsible... for writing action classes that
provides a lots of flexibility. The most common which is extended by most of the
Action classes is ActionSupport class.
The default
*;
public class UserRegisterForm extends ActionForm{
private String action="add...();
return errors;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public
Java struts variable valu - Struts
.
for example:
If u want to fetch these values in action class...Java struts variable valu Hii..
can u suggest me how to declare a variable in my jsp page and then fetching its value in the action class.. my
What is Action Class?
What is Action Class? What is Action Class? Explain with Example
Struts - Struts
UserRegisterForm extends ActionForm{
private String action="add";
private...() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getAddress.
|
http://www.roseindia.net/tutorialhelp/comment/97219
|
CC-MAIN-2013-20
|
refinedweb
| 1,224
| 57.37
|
detects browsers capabilities and features like css, java, javascript etc.
Project description
pybrowscap is a python port of PHP function get_browser(). It tells what the user browser is capable of. It detects browsers capabilities and features like css, java, javascript etc. It works on top of browscap data file.
Important notice
Version 2.0 and higher of pybrowscap supports csv browscap file version 5000 and higher. If you want to use older version of csv browscap file, use pybrowscap version lower than 2.0.
Requirements
- python 2.6+
- browscap.csv (browscap data file in csv format)
Instalation
Install via pypi or copy this module into your project or into your PYTHON_PATH. Download latest version of browscap.csv file from.
Example
from pybrowscap.loader.csv import load_file browscap = load_file(path_to_browscap_csv) browser = browscap.search(user_agent_string) browser.is_crawler()
Automatic updates
from pybrowscap.loader import Downloader from pybrowscap.loader.csv import URL Downloader(URL).get(save_to_filepath)
Tests
Tested on evnironment
- Xubuntu Linux 12.04 LTS precise 64-bit
- python 2.7.3
- python unitest
- browscap_14_05_2012.csv from Mon, 14 May 2012 22:20:20 -0000
- browscap.21_05_2012.csv from Mon, 21 May 2012 15:48:39 -0000”
Running tests
To run the test run command:
$ python test.py $ python setup.py test
Credits
Special thanks to these projects for inspiration:
Project details
Release history Release notifications
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|
https://pypi.org/project/pybrowscap/
|
CC-MAIN-2018-34
|
refinedweb
| 243
| 62.85
|
Hi all,
I have created a mobile application with .net standard. Right now I wanted to use soap web service for consuming and retrieving results. But for some reason I could not find add web references in common code. So what I did was I have created a web application and added it to existing project. Right now I need to hit the apis that I created in web application which is in different namespace. I could not find a way to do it.Please see highlighted portions in the picture attached.
Is there a way to do it?. Please let me know. Thanks
It is a rest service you can call it with postman to get a response from the service. Post the response in QuickType.io and it generate a class for calling the service.
Hi Kentucker,
. Thank you so much for helping me out.
Thank you for helping me out. What I have thought earlier was that my server for web application1 is up and running when I execute the whole project. In contrast, I have I have found that I need to switch to multiple startup projects inorder for the server to get up and running. When I switched settings I could hit the api from the code. So the point which I did not catch earlier was my server is not running when the application to which I imported is running. I found that later on and switched to multiple startup projects in properties and I could hit api. So this error of mine is resolved
|
https://forums.xamarin.com/discussion/comment/329338
|
CC-MAIN-2021-25
|
refinedweb
| 261
| 83.66
|
»
Swing / AWT / SWT
Author
drawing a curve from points
Raschin Ghanad
Greenhorn
Joined: Jul 28, 2004
Posts: 10
posted
Jul 28, 2004 09:22:00
0
I have a little question about how to make curves out of points.
My function has many points and I have to get them to one curve.
At the moment, it is just necessary to put a line(/path) from point to point.
I thought about using the
GeneralPath
- class, but I don't know how to use it.
Maybe someone can tell me which class to use is the best for this problem?
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24193
34
I like...
posted
Jul 31, 2004 07:14:00
0
This question would get a lot more attention in the Swing/AWT forum, so I'm going to move it there.
[Jess in Action]
[AskingGoodQuestions]
Ryan Smith
Ranch Hand
Joined: Jun 29, 2004
Posts: 40
posted
Jul 31, 2004 18:33:00
0
Hi,
I am a relative newcomer to this sort of stuff, but here's what I'm thinking:
First, I don't know of any class that would do what you want to do.
However, here is what I would start with: You have a collection of points, probably in two arrays, int xPoints[] and int yPoints[], or maybe just in one array, points coords[]. If you want to make a smooth looking curve with this set of points, you need to focus on
what
determines the slope of the curve. That leaves you with two options: (1) you could try to use the drawArc method in Graphics class, fitting it to your points, or (2) you could draw your own curve based on the slope of the curve at the last endpoint and then the slope at the next endpoint.
I think the second strategy would be more precise, yet slower and more tedious to code, whereas the first may be easier to implement, but you won't have as much control.
If you could be more specific, that would be helpful.
Hope I haven't been too rambling.
Ryan Smith
Ranch Hand
Joined: Jun 29, 2004
Posts: 40
posted
Jul 31, 2004 18:40:00
0
Oh, I just re-read your post, and all you need is lines connecting the points! Ignore the above post in that case!
What I would do is use Graphics's drawLine method, implemented in a for loop.
For example:
public class MyClass { private int xCoords[] = {3,4,6,89,9,.....}; private int yCoords[] = {5,6,68,56,54,.....}; //....other code public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(new Color(54,34,56)); for(int i = 1; i < xCoords.length; i++) { g.drawLine(xCoords[i-1], yCoords[i-1], xCoords[i], yCoords[i]); } } }
[ July 31, 2004: Message edited by: Ryan Smith ]
Craig Wood
Ranch Hand
Joined: Jan 14, 2004
Posts: 1535
posted
Aug 01, 2004 14:16:00
0
Here's one way to connect the points with a curve. There may be many other or better ways. This takes five clicks on the drawing surface to get started.
The challenge is to figure out where/how to locate the control point for the
quadTo
method. With
curveTo
you have two control points to figure out.
import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import javax.swing.*; public class FittingACurve { public static void main(String[] args) { FittingPanel fittingPanel = new FittingPanel(); PointWrangler wrangler = fittingPanel.wrangler; JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(wrangler.getUIpanel(), "North"); f.getContentPane().add(fittingPanel); f.setSize(400,400); f.setLocation(200,200); f.setVisible(true); } } class FittingPanel extends JPanel { GeneralPath path; PointWrangler wrangler; Point p1, p2, p3, p4; public FittingPanel() { path = new GeneralPath(); setBackground(Color.white); wrangler = new PointWrangler(this); addMouseListener(wrangler); } protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.draw(path); } private void fitCurve() { Line2D last = new Line2D.Double(p1, p2), current = new Line2D.Double(p3, p4); double p3ToLastLineDist = last.ptLineDist(p3), p2_to_p3 = p2.distance(p3); double currentTheta = Math.atan2(p3.y - p4.y, p3.x - p4.x); int x = (int)(p3.x + p3ToLastLineDist * Math.cos(currentTheta)); int y = (int)(p3.y + p3ToLastLineDist * Math.sin(currentTheta)); Point outerControl = new Point(x,y); x = p2.x + (p3.x - p2.x)/2; y = p2.y + (p3.y - p2.y)/2; Point p2_to_p3MidPoint = new Point(x,y); x = outerControl.x + (p2_to_p3MidPoint.x - outerControl.x)/2; y = outerControl.y + (p2_to_p3MidPoint.y - outerControl.y)/2; Point control = new Point(x,y); path.quadTo(control.x, control.y, p3.x, p3.y); } public void addPoint(Point p) { if(p2 != null) p1 = p2; if(p3 != null) p2 = p3; if(p4 != null) p3 = p4; p4 = p; if(p1 == null) path.moveTo(p.x, p.y); else fitCurve(); repaint(); } public void clear() { path.reset(); p1 = p2 = p3 = p4 = control = null; repaint(); } } class PointWrangler extends MouseAdapter { FittingPanel fittingPanel; public PointWrangler(FittingPanel fp) { fittingPanel = fp; } public void mousePressed(MouseEvent e) { Point p = e.getPoint(); fittingPanel.addPoint(p); } public JPanel getUIpanel() { JButton clear = new JButton("clear"); clear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { fittingPanel.clear(); } }); JPanel panel = new JPanel(); panel.add(clear); return panel; } }
[ August 01, 2004: Message edited by: Craig Wood ]
Raschin Ghanad
Greenhorn
Joined: Jul 28, 2004
Posts: 10
posted
Aug 02, 2004 04:21:00
0
thanks, but I think this is not exactly what I need...
To the first answer from Ryan Smith :
The second post from you could maybe work, if I alter it.
I have already a curve that connects the Points together with
lines. So far is everything fine.
The problem is that you have to switch in the program how to display the curve.
So I have also to display the curve with rounded lines, and also as stairs.
To the answer from Craig Wood :
This seems to be a better idea (to work with a Path and the quadTo/curveTo- method) , but your code does not round the lines in the way I need it.
As I said, the problem is to connect the points in a way, that there is a bended line, that displays the increase/decrease of the data.
I think your curves are something like the Bezier-curves....
If I would know how to get the right control-points for my curve, the problem would be solved, I think...
[ August 02, 2004: Message edited by: Raschin Ghanad ]
I agree. Here's the link:
subject: drawing a curve from points
Similar Threads
Area
Java 2D bezier curves
Urgent help needed
Beizer curve with three points?
Distance between a point and a cubic curve
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
JForum
|
Paul Wheaton
|
http://www.coderanch.com/t/338742/GUI/java/drawing-curve-points
|
CC-MAIN-2015-35
|
refinedweb
| 1,133
| 65.83
|
Hashing is the method by which we can map any length data element to a fixed size key. hashing works as key-value pairs.
Hashing function is the function that does the mapping in a hash map. the data elements that are given as input to the Hash Function may get same hash key. In this case the elements may overlap. To avoid overlapping of elements which have the same hash key the concept of chaining was introduced.
In order to create a hashmap we need hashing function that will define the index value of the data element.
We have a hash table, with n buckets. To insert a node into a hash table, we are given a hash function as
hashIndex = key % noOfBuckets
Now, we will use this hash function and calculate the hashindex of every inserted value to the hashmap.
Insert element and calculate the hashIndex of given key value and then insert the new node to the end of the list.
To delete a node, we will calculate the hash index and in the bucket corresponding to hash Index we will search for the element in the bucket and remove it.
#include<iostream> #include <list> using namespace std; class Hash{ int BUCKET; list < int >*table; public: Hash (int V); void insertItem (int x); void deleteItem (int key); int hashFunction (int x){ return (x % BUCKET); } void displayHash (); }; Hash::Hash (int b){ this->BUCKET = b; table = new list < int >[BUCKET]; } void Hash::insertItem (int key){ int index = hashFunction (key); table[index].push_back (key); } void Hash::deleteItem (int key){ int index = hashFunction (key); list < int >::iterator i; for (i = table[index].begin (); i != table[index].end (); i++){ if (*i == key) break; } if (i != table[index].end ()) table[index].erase (i); } void Hash::displayHash (){ for (int i = 0; i < BUCKET; i++){ cout << i; for (auto x:table[i]) cout << " --> " << x; cout << endl; } } int main (){ int a[] = { 5, 12, 67, 9, 16 }; int n = 5; Hash h (7); for (int i = 0; i < n; i++) h.insertItem (a[i]); h.deleteItem (12); h.displayHash (); return 0; }
0 1 2 --> 9 --> 16 3 4 --> 67 5 --> 5 6
|
https://www.tutorialspoint.com/cplusplus-program-for-hashing-with-chaining
|
CC-MAIN-2022-21
|
refinedweb
| 355
| 69.72
|
Read a file line by line text with Node.js
How to access lines of a document when you can only block of data?
Node's File System module offers many functions to read and write a file. You can load an entire file into a string. Lines can be stored in a text file, one after another. But what we can not do is read a file line by line. When it is large or when you want to limit the reading to a number of lines, this gap becomes annoying.
Several solutions have been proposed to this problem, with or without additional module, but none is satisfactory if one wants to reproduce the functions of PHP or C or any other language: open the file, read a line in a loop, close the file.
Here is a fairly simple algorithm that leads to this result, which requires no external module.
- An associative array FileBuffer is created with the file resource for key and for value, an array containing the lines read.
- FilePtr is another array which has also the file resource as key and the position in the file as value.
- We test whether the table has content. If this is the case, we read the first element, that is deleted by shift.
- Else a data block is read from the file, from pos and to 4096 bytes.
- The actual number of bytes read is returned in br.
- If this number is less than 4096, there will be no other reading, we removes the file entry in filePtr (this will be tested by the eof function).
- The buffer is converted to a string and the string splitted into an array that is assigned to fileBuffer[handle].
- The last item in the array is deleted because the line is truncated in most cases.
- The next position in the file is determined by adding the number of bytes read, minus the size of the last element we have deleted.
- When the table is empty, we start at 4, unless the end of file is detected.
Code source of the module:
var fs = require('fs'); var filePtr = {} var fileBuffer = {} var buffer = new Buffer(4096) exports.fopen = function(path, mode) { var handle = fs.openSync(path, mode) filePtr[handle] = 0 fileBuffer[handle]= [] return handle } exports.fclose = function(handle) { fs.closeSync(handle) if (handle in filePtr) { delete filePtr[handle] delete fileBuffer[handle] } return } exports.fgets = function(handle) { if(fileBuffer[handle].length == 0) { var pos = filePtr[handle] var br = fs.readSync(handle, buffer, 0, 4096, pos) if(br < 4096) { delete filePtr[handle] if(br == 0) return "" } var lst = buffer.slice(0, br).toString().split("\n") var minus = 0 if(lst.length > 1) { var x = lst.pop() minus = x.length } fileBuffer[handle] = lst filePtr[handle] = pos + br - minus } return fileBuffer[handle].shift() } exports.eof = function(handle) { return (handle in filePtr) == false && (fileBuffer[handle].length == 0) }
You can import the module as in the example below or directly integrate the functions in the project by removing the export prefix.
Code source of the demo
In this example, we read a file line by line and copy it into a new file line by line also but through the File System functions.
var fs = require('fs') var readline = require("/scripts/node-readline/node-readline.js") var source="/scripts/node-readline/demosrc.htm" var target="/scripts/node-readline/demotgt.htm" var r=readline.fopen(source,"r") if(r===false) { console.log("Error, can't open ", source) process.exit(1) } var w = fs.openSync(target,"w") var count=0 do { var line=readline.fgets(r) console.log(line) fs.writeSync(w, line + "\n", null, 'utf8') count+=1 } while (!readline.eof(r)) readline.fclose(r) fs.closeSync(w) console.log(count, " lines read.")
Change the name of the source file and the target file to what you want. You can also adjust the buffer size to your needs. If a file contains more than 4096 bytes long lines, the buffer must be increased in proportion.
Download the full source code
|
http://www.scriptol.com/javascript/node-readline.php
|
CC-MAIN-2014-52
|
refinedweb
| 669
| 67.96
|
The all-in-one privacy-focused website/app analytics tool. Confidently ditch Google Analytics and enjoy powerful visualization tools, full developer freedom, and protected users.
Why Symmetrics?
Other tools collect personal information about your users and the content of your website to sell ads. We don’t. You own the data.
Just add our code snippet to your websites. We automatically start collecting the most important metrics. That’s it.
Build completely custom and shareable dashboards to inform your next business decisions — using any data you’ve collected.
Automatically share your data, daily or weekly, to your boss, colleagues, friends, or clients.
Discover tweets about your website and more using our intelligent and growing collection of apps.
Track any non-infringing custom data, metric, goal, or event. You decide.
Interface our APIs, download your dataset, set up webhooks, or quickly query data in the console.
Get our package on npm or connect directly to our APIs using any language to extract the exact data you need, whenever you need it.
import client from 'symmetrics/client'; const symmetrics = client(id, key); symmetrics.query('unique urlHost');
Changing your plan later is quick and simple, and doesn’t cost you extra.
Questions, concerns, or just want to say hello? Get in touch with us!
|
https://getsymmetrics.com/?ref=betalist_launch
|
CC-MAIN-2021-25
|
refinedweb
| 211
| 50.43
|
ungetwc - push wide-character code back into input stream
#include <stdio.h> #include <wchar.h> wint_t ungetwc(wint_t wc, FILE *stream);
The ungetwc() function pushes the character corresponding to the wide-character code specified by wc back onto the input stream pointed to by stream. The pushed-back characters will be returned by subsequent reads on that stream in the reverse order of their pushing. A successful intervening call (with the stream pointed to by stream) to a file-positioning function (.Fn fseek , fsetpos() or rewind()) discards any pushed-back characters for the stream. The external storage corresponding to the stream is unchanged.
One character of push-back is guaranteed. If ungetwc() is called too many times on the same stream without an intervening read or file-positioning operation on that stream, the operation may fail.
If the value of wc equals that of the macro WEOF, the operation fails and the input stream is unchanged.
A successful call to ungetwc() clears the end-of-file indicator for the stream. The value of the file-position indicator for the stream after reading or discarding all pushed-back characters will be the same as it was before the characters were pushed back. The file-position indicator is decremented (by one or more) by each successful call to ungetwc(); if its value was 0 before a call, its value is indeterminate after the call.
Upon successful completion, ungetwc() returns the wide-character code corresponding to the pushed-back character. Otherwise it returns WEOF.
The ungetwc() function may fail if:
- [EILSEQ]
- An invalid character sequence is detected, or a wide-character code does not correspond to a valid character.
None.
None.
None.
fseek(), fsetpos(), read(), rewind(), setbuf(), <stdio.h>, <wchar.h>.
Derived from the MSE working draft.
|
http://pubs.opengroup.org/onlinepubs/007908775/xsh/ungetwc.html
|
CC-MAIN-2013-48
|
refinedweb
| 294
| 56.05
|
0
I am trying to solve a tricky problem involving a sorted array. Say I have an array of sorted integers (8, 6, 4, 1) and given the value x I need to check the array to see if any two numbers add up to x. This needs to be done in linear time. So far I have come up with this:
#include <iostream> using namespace std; bool sum(int arr[], int n, int k) { int temp1(0), temp2(0); while (arr[temp1] + arr[temp1 + 1] <= k); { if (arr[temp1] + arr[temp1 + 1] == k) { return true; } if (arr[temp1] + arr[temp1 + 1] < k) { temp1 += 1; } } temp2 = temp1 + 1; for (temp1; temp1 > 0; --temp1) { if (arr[temp1] + arr[temp1] == k) { return true; } } return false; } int main() { int list[4] = {8, 6, 4, 1}; bool result = true; result = sum2(list, 4, 10); cout << result << endl; return 0; }
It does not work and I am entirely at loss as to how I may go about getting this problem to work. I know how to do it in quadratic time using two loops, but doing it in linear time is getting to be frustratingly difficult.
|
https://www.daniweb.com/programming/software-development/threads/158438/check-array-for-sum-of-two-numbers-in-linear-time
|
CC-MAIN-2017-13
|
refinedweb
| 191
| 52.26
|
I recently upgraded to VDSL, I can't find an option within the NF4v for full bridge mode.
Does the Netcomm "White Genius" support full bridge mode?
tehconz: I managed to get my NF4V working in bridge mode. It’s not super intuitive unfortunately.
First you need to find your PPPoE username and password. The username is your usual Orcon one, but the password is random and set in the modem automatically. The easiest way to get the password is to 'unmask' it from the password field of the NF4V using the firebug addon for firefox. Here's a short video that demonstrates the technique
After you have the password you can put the modem into bridge mode. To do that you actually have to delete the PPPoE WAN interface and then create a new WAN interface, choosing "bridged" rather than PPPoE. When you create the interface it gives you the option of using the PTM or ATM connections, choose PTM. Once that’s done you can plug the WAN port of your router into the LAN1 port of the NF4V and set up the PPPoE connection using the credentials found in the first step.
If it all goes horribly wrong you can start again using the factory reset button.
I've been trying to get one of these into bridge mode to replace an old Thompson ADSL modem. The official NetComm guide can be found at
Has anyone managed to get bridge mode working for ADSL2 rather than VDSL? Ideally I want my public IP address to terminate on my Advanced Tomato based router.
Generally known online as OpenMedia, now working for Red Hat APAC as a Technology Evangelist and Portfolio Architect. Still playing with MythTV and digital media on the side.
For adsl, it would depend on if your provider supports PPPoE over EUBA (many providers do, some don't. Their network has to be built to accept it)
In this situation what you would do is bridge the ATM interface, then dial out over PPPoE VLAN 10.
0/110 is the gold that makes this magic happen.
Your provider will not support this setup FYI.
#include <std_disclaimer>
Any comments made are personal opinion and do not reflect directly on the position my current or past employers may have.
|
https://www.geekzone.co.nz/forums.asp?forumid=81&topicid=141104
|
CC-MAIN-2022-27
|
refinedweb
| 381
| 71.14
|
WDT and deepsleep
Hi
Does the WDT also trigger in deepsleep? And is the WDT cleared after deepsleep wakeup?
@kjm Just to clarify, your code makes the WDT turn on automatically when the device wakes up but it will not trigger a WDT reset while the device is in deep sleep, correct?
You can make the wdt persistent through deepsleep
pycom.wdt_on_boot(True) # enable WDT on boot pycom.wdt_on_boot_timeout(60000) # reboots after a minute if no wdt.feed
which is nice given the gears penchant for reverting to it's default 4s blue flash mode. Be careful though, too short a timeout & you don't get a chance to enter pycom.wdt_on_boot(False) before it reboots again
Quick answer is no and yes.
The code below set the WDT for 8 s and deep sleep for 100 s and my device doesn't wake up after 8 s.
from machine import WDT wdt = WDT(timeout=8000) #WDT for 8 s import machine machine.deepsleep(100*1000) #deep sleep for 100 s
WDT is reset after deep sleep wake up because this wake up resets the board and clears all libraries (WDT can't run if it's library isn't imported). Always best to try some code to test your questions!
|
https://forum.pycom.io/topic/3346/wdt-and-deepsleep/
|
CC-MAIN-2019-39
|
refinedweb
| 211
| 73.37
|
Citrus County chronicle University of Florida Digital Collections Home | Help Citrus County chronicle Permanent Link: Material Information Title: Citrus County chronicle Physical Description: Newspaper Language: English Creator: Citrus County Chronicle Publisher: Scofield Pub. Co. Place of Publication: Inverness, Fla.Inverness, Fla Creation Date: June 24, 2013 Publication Date: September 12,alephbibnum - 366622lccn - sn 87070035 System ID: UF00028315:03231 This item is only available as the following downloads: ( PDF ) Full Text PAGE 1 NANCYKENNEDY Staff writerINVERNESSLace Blue-McLean never met a park she didnt want to protect, body of water she didnt want to preserve, wild animal she wasnt wild about or tree she didnt want to hug. In 2010, she cried with joy when the 57-acre Three Sisters Springs in Crystal River finally became publicly owned. She is passionate about nature in all of its splendor, especially in Citrus County where she spends her time and energy crusading and advocating, from Keep Citrus County Beautiful to Save Our Waters Week. She believes the earth is not ours to keep, but to take care of. Blue-McLean recently met with the Chronicle at Liberty Park in Inverness to talk about Save Our Waters Week, which began Sept. 20 with a fundraising dinner and ends Saturday, Sept. 28, with a Music on the Square event in downtown Inverness.CHRONICLE: Whats Save Our Waters Week all about how did it start? BLUE-MCLEAN: Citrus 20/20s Save Our Waters Week is in conjunction with the countys Adopt-a-Shore coastal cleanup, which is a really great program that the community gets involved in, helping clean up our POLL SEPTEMBER 23, 2013Floridas Best Community Newspaper Serving Floridas Best CommunityVOL. 119 ISSUE 47 50 CITRUS COUNTYRough day: Buccaneers fall to 0-3 with loss to Patriots /B1 ONLINE POLL:Your choice?Two ethics complaints filed by Commissioner Scott Adams have recently been dismissed by the state ethics committee. Is Adams: A. Justified in bringing the claims? B. Wasting taxpayers money on wild goose chases? C. Cleaning up corruption? D. Blindly throwing darts? To vote, visit www. chronicleonline.com. Click on the word Opinion in the menu to see the poll. Results will appear next Monday. Find last weeks online poll results./ Page A3 HIGH87LOW71Heavy rin with a few showers, rain chance 70%.PAGE A4TODAY& next morning MONDAY INDEX Blood Drives . . .Ax Classifieds . . . .B8 Comics . . . . .B7 Crossword . . . .B6 Editorial . . . . .A8 Entertainment . . .A4 Food Programs . .Ax Horoscope . . . .A4 Lottery Numbers . .B3 Lottery Payouts . .B3 Movies . . . . .B7 Obituaries . . . .A6 TV Listings . . . .B6 MONDAY CONVERSATION To hear Lace BlueMcLean s interview, visit online.com. MondayCONVERSATION Assault targets standoff Associated PressNAIROBI, Kenya Helicopters circling overhead, Kenyenyas National Disaster Operation Centre said on Twitter. Real books or e-readers? How do you read? QUESTION OF THE WEEK Shawn Martin I love the smell of books and love the way it sounds when you close a book. Ill stick with the real ones. Kim High Boulerice I love and read both. They both have their ups and downs. Real books make it easier to back track on characters or specific parts. E-books have the wonderful dictionary feature. There are many books available for free through Kindle. Aspasia Luster Who cares, as long as Im reading something I enjoy. I wouldnt take my Kindle to the beach because Im afraid sand would get in it. I usually bring a well-worn paperback to the beach. Patti Griffith Always a BOOK reader, not an e-reader. Example of a recent experience: six of us were at the beach; I had the only real book and the rest had e-readers but were unable to read due to the glare on their e-reader, no matter how much they changed the brightness of their screen. Tricia M. Marble Love my Kindle! I use it every day. E-books are cheaper than when they first came out. That being said, there is no better smell then walking into a bookstore! Bonnie Kohler There is nothing like seeing and feeling a book or magazine. Chris Gangler Real book reader who became an e-reader due to selection and ease of acquiring new material immediately. Got tired of having to find space to store my real books. Contribute! Like us at facebook.com/ citruscounty chronicle and respond to our Question of the Week. See ASSAULT/ Page A7 000G2NF Environmental portrait MATTHEW BECK/ChronicleLace Blue-McLean is actively involved in the protection of Citrus Countys natural resources. This week is Save Our Waters Week and special emphasis is placed on raising public awareness of all the health and wellbeing of the countys lakes, rivers, bays and springs. Lace Blue-McLean advocates for ecological conservancy School board to discuss Common Core ERYNWORTHINGTON Staff writerINVERNESS Citrus County School board members meet Tuesday at a workshop to hear more about a nationwide education initiative. A special meeting and workshop begins at 9 a.m. Tuesday at the district offices, 1007 W. Main St., Inverness to discuss Common Core State Standards. Citrus County District Schools are currently transitioning to Common Core Standards as Floridas State Board of Education adopted the standards in 2010. Florida Department of Education website states that the CCSS provides. Also at the workshop, graduation See MONDAY/ Page A9 See SCHOOL/ Page A7 Landfill seeks ally for future services CHRISVANORMER Staff writerINVERNESS Solid waste and the county landfill feature as several items of business for discussion and potential decision-making at Tuesdays meeting of the Citrus County Board of County Commissioners (BOCC). Staff will present the board two draft letters, one addressed to Inverness City Manager Frank DiGiovanni and the other to Inverness residents, regarding the lapsing of the countys interlocal agreement with the city because Inverness will use a Sumter County landfill instead. The letters set out current disposal fees for Inverness residents, as the interlocal agreement is no longer in effect. See LANDFILL/ Page A7 WHAT: Citrus County Boar d of County Commissioners meeting. WHEN: 1 p .m. Tuesday; public comments and questions will be taken at 1:30. 622 on Bright House and Channel 9 on Comcast. The meeting also can be viewed live online in a small digital format. WHAT: Citrus County Sc hool Board meeting and workshop. WHEN: 9 a.m. T uesday. WHERE: District administr ative offices, corner of State Road 44 and Montgomery Avenue, Inverness. ONLINE: www citrus.k12.fl.us/ Kenyan forces rescue most hostages PAGE 2 Deputy dies from injuries in crash POMPANO BEACH A Broward County deputy has died from injuries he suffered in a crash on his way to work. The sheriffs sheriffs office as a Department of Detention deputy. He transferred to the Department of Law enforcement in May 2012. Funeral arrangements are pending.Man dies after being shotFORT MYERS Deputies in Lee County are investigating a shooting that left one man dead and a woman injured. The sheriffs.Teen struck, killed walking in OrlandoORLANDO A 16-yearold boy is dead after being struck by a car as he walked on a road in Orlando with another teen. The Orlando Police Department said said the driver stopped and rendered aid. The Orlando Fire Department transported Jahkere Isaac to the hospital, where he was later pronounced dead. Traffic homicide investigators said no charges are pending against Johnson and alcohol is not a factor.Cuban travelers get tourism tasteMIAMI At 67, Cuban taxi driver Benito Perez had never been on a plane. For years, friends in Miami had invited him to visit, but he couldnt afford the flight and didnt want to burden his friends. Getting an exit permit from Cuban authorities and permission from the U.S. government seemed daunting. In the past year, however, traveling has gotten slightly easier. The Cuban government eliminated the muchdetested white card needed to leave. And the U.S. government has begun issuing multiple-entry visas good for five years. Perez is one of thousands of Cubans traveling under the new laws, many for the first time. The number of Cubans receiving U.S. nonimmigrant visas jumped by 82 percent from October 2012 to July 2013 compared to the same period a year before.Disney to change access program thats offered to everyone. The current way certainly has been problematic, and we wanted to curb some of the abuse of this system, Disneyland Resort spokeswoman Suzi Brown told the Orange County Register. The change takes effect Oct. 9 for guests with parkissued disability cards. Disney officials said more details will be released after park employees are briefed on the new rules.. Lotto jackpot rises to $9 millionTALLAHASSEE The jackpot in the Florida Lotto game has grown to $9 million after no one matched the six winning numbers in the latest drawing, lottery officials said Sunday. Twenty-one tickets matched five numbers to win $7,714 each; 1,364 tickets matched four numbers for $87 each; and 28,402 tickets matched three numbers for $5.50 each. The winning Florida Lotto numbers selected Wednesday were 8-32-35-46-47-52. Special to the ChronicleStart your Citrus County Outdoor Adventure by attending the first Lake Hernando Dragon Boat Festival on Saturday, Nov. 16. Capping off a week of activities in honor of Americas veterans, this regional festival will raise money for the Wounded Warrior Project, as well as the Chamber of Commerce Scholarship/Outreach Fund and Citrus County Community Youth Programs. Admission is free and there will be fun for all family members with food and crafts booths, a kids zone, and exciting dragon boat racing on the lake. Lake Hernando is centrally located at the junction of U.S. 41 and County Road 486. Described as the fastest-growing watersport in the world, dragon boating features 20 people paddling a 42-foot boat in unison to the beat of a drummer sitting on the bow. A steersperson stands in the stern to guide the boat. Dragon boating can be a purely recreational activity or a highly competitive sport, and began more than 2,000 years ago in ancient China. People of all ages and abilities can participate in dragon boating. Strength, while important, is not the key skill in dragon boating. What moves the boat most effectively is when all team members are repeatedly paddling together as one unit. Synchronous paddling keeps the forward movement smooth and fast. The Lake Hernando Dragon Boat Festival will feature club and community teams competing for prizes and bragging rights. Community teams are forming now. All it takes is 21 people who want to have fun. No prior experience is necessary. Teams may solicit pledges to cover the registration fees and to raise funds for the charities. Sponsorship opportunities are also available. Festival staff will work with corporate or other potential sponsors to help form teams. Practice sessions will be conducted during the week before the festival. Paddles, life vests, boats, drums and steerspersons will be provided for the practice sessions and all of the races. This is an opportunity for churches, veterans organizations/social clubs, schools, businesses, student groups, sports teams, neighborhood associations, or any other interested group of 21 people to challenge themselves and other groups while raising money to support veterans who have been wounded while protecting our freedoms. Spectator admission and parking are free. Food, beer and wine will be sold. Bring blankets and chairs. The event is made possible through a partnership of Citrus County Commission, the Citrus County Chamber of Commerce and High Five Dragon Boat LLC. Official hosts for the festival are Grandmasters Dragon Boat Club of The Villages and Nature Coast Dragon Boat Club of Homosassa. For information about forming a team or becoming a sponsor, go to. com or call 352-400-0960/352-795-3149. A2MONDAY, SEPTEMBER23, 2013CITRUSCOUNTY(FL) CHRONICLE STATE\LOCAL 30-DAY TRIAL IS A STATE LAW STATUTE #484.0512 Everyone Gets It Is Not Limited To A Select Few! PAID ADVERTISEMENT For consumers about to make a hearing aid purchase, and anyone interested in learning about hearing. Just the Lowest Price with th e Best Technology & Service RECHARGEABLE TECHNOLOGY... No Need To Change The Battery On A Weekly Basis WE ACCEPT OVER 40 DIFFERENT INSURANCE PLANS So Call Us And We Will Give You All The Information You Need Before You Come In! Annual Hearing Test: GENIUS Annual Hearing Test: SMART Free GOOD $995 ea. 6 Bands 6 Channels BETTER $1,595 ea. 12 Bands 24 Channels Wireless Bluetooth EXCELLENT $1,995 ea. 16 Bands 32 Channels Wireless Bluetooth THE BEST $2,495 ea. / $2,295 18 Bands 40 Channels Wireless Bluetooth THIS WEEK ONLY! We dont hide our prices. All our prices are here and you WONT be asked or told you need to pay more! Hearing and Hearing Aid Pricing and Technology Disclosed What are Hearing Aid. RECHARGEABLE UPGRADE AVAILABLE ON MOST PRODUCTS FREE Test Dates are available from Sept. 23 -Sept. 30 000FZLX TEXT . CITRUS + Your Tip to 274637 (CRIMES) CLICK . CALL . 1-888-ANY -TIPS (1-888-269-8477) Funded by the Office of the Attorney General, Crime Stoppers Trust Fund of Citrus County, Inc. YOU COULD RECEIVE A REWARD UP TO $ 1,000 000FVD2 CALL TODAY FOR A FREE QUOTE! Accidents Bad Driving Record DUI Youthful Drivers Canceled SR 22, SR 22 S, FR 44 720 N.E. Highway 19, Crystal River (352) 563-1590FYRY Dragon Boat Festival set Nov. 16 ON THE NET Boat.com StateBRIEFS From wire reports PAGE 3 Dont have a library card? Nows the timeAnyone who lives, works or owns property in Citrus County can sign up for a library card in fewer than 10 minutes. All it takes is a photo ID and proof of residency or employment. Visit any of the following library locations to get a card:Central Ridge Library, 425 W. Roosevelt Blvd., Beverly Hills; phone 352746-6622.Coastal Region Library, 8619 W. Crystal St., Crystal River; phone 352-795-3716.Floral City Library, 8360 W. Orange Ave., Floral City; phone 352-726-3671.Homosassa Library, 4100 S. Grandmarch Ave., Homosassa; phone 352628-5626.Lakes Region Library, 1511 Druid Road, Inverness; phone 352-726-2357. Non-residents may purchase a three-year library card for $10. Children younger than 16 may obtain a library card with a parent or guardian signature verifying residency and identify. For more information, call Library Services at 352746-9077. Veterans sought for programThe Veterans Appreciation Week Ad Hoc Coordinating Committee will conduct its annual Veterans in the Classroom program Nov. 1 to 12 as part of its 21st annual Veterans Appreciation Week activities. All interested veterans are encouraged to contact Mac McLeod at 352-7461384, cmcleod670@earth link.net; or Bob Crawford at 352-270-9025, baddogusmc @tampabay.rr.com. Vigil planned for man killed by deputyFriends and family of a Hernando man killed by an off-duty sheriffs office deputy in training is marking his death with a candlelight vigil 8 p.m., Wednesday at the Old Courthouse in Inverness. It was Sept. 26, 2012, when deputy Greg Entrekin shot and killed Derrick Vaccianna, 28, after a struggle in the bedroom of an Inverness woman they both were purportedly dating. According to the Citrus County Sheriffs Office, Entrekin and his girlfriend at the time were confronted by Vaccianna after he entered the residence in Inverness through a bedroom window. Entrekin shot Vaccianna when he reportedly charged at him. Vaccianna died at the scene. The Florida Department of Law Enforcement cleared Entrekin of any wrongdoing in Vacciannas death.Around theCOUNTY Page A3MONDAY, SEPTEMBER 23, 2013 CITRUSCOUNTYCHRONICLE Food Stamps Cuts: The House on Sept. 19 voted, 217-210, to cut spending on food stamps by $4 billion annually over 10 years, to about $75 billion annually. A yes vote was to pass a GOP bill (HR 3102) that would disqualify an estimated four million recipients by allowing states to toughen work requirements and impose drug testing. Rep. Richard Nugent, Yes. Veterans, Pregnant Women: The House on Sept. 19 defeated, 193-230, a Democratic bid to ensure that veterans, seniors, pregnant women and minor children continue to receive food stamps if the U.S. government shuts down or defaults on its debt. A yes vote backed the motion by Democrats. (HR 3102) Nugent, No. Fast-Track Mining Permits: The House on Sept. 18 passed, 246-178, a GOP bill to ease environmental rules and limit lawsuits in order to quicken agency reviews of applications to mine critical and non-critical minerals on federal land in the West. A yes vote was to send the bill to the Senate. (HR 761) Nugent, Yes. Exports to China, Iran: The House on Sept. 18 defeated, 197-229, a bid by Democrats to prohibit critical minerals mined under terms of HR 761 (above) from being exported to China, Iran or any country that has violated U.S. economic sanctions against Iran. A yes vote backed the Democratic motion. Nugent, No. Judge Elaine Kaplan: Senators on Sept. 17 confirmed, 64-35, Elaine D. Kaplan as a judge on the U.S. Court of Federal Claims, which hears monetary claims against the federal government. She has been both general counsel and acting director of the U.S. Office of Personnel Management. Sen. Marco Rubio, No. Sen. Bill Nelson, Yes. Key votes ahead : In the week of Sept. 23, both chambers will debate a continuing resolution to avert a government shutdown Oct. 1, while the Senate will resume work on a bill increasing energy efficiencies in the U.S. economy. 2013 Thomas Reports Inc. Call: 202-667-9760. QUESTION: Should the U.S. launch strategic strikes against Syria? Yes. We cant ignore the atrocity of a government using chemical weapons on its own citizens. 8 percent (29 votes) No. Its not our countrys place to intervene. 64 percent (231 votes) Yes. Given the global economy, it is in our national interest. 2 percent (8 votes) No. Itd be akin to kicking a hornets nest. 26 percent (92 votes) Total votes: 360. ONLINE POLL RESULTSHOW YOUR LAWMAKERS VOTEDKey votes for the week ending Sept. 20 by Voterama in Congress From staff reports Save the date for Save the Radio NANCYKENNEDY Staff writerINVERNESS Back in the day, Shawn Scheller, lead singer/guitar and piano player/songwriter for the Tampa-based band Save the Radio, got his first taste of rock fame when he and some of his high school friends won a few battle of the bands contests in Citrus County. I think we were called something like Pleazant Dreamz with all zs, he said in a recent telephone interview. I have some pictures that I try to keep hidden. That was back in the 1990s, and the Lecanto High School graduate has moved on to a full-time career playing with Save the Radio, the featured band at the free Rock the Block street party in Inverness that begins at 6 p.m. Saturday, Sept. 28. Oddly enough, the guys who were in (Pleazant Dreamz) found out about the show in Inverness, and theyre coming to it, Scheller said. Itll be the first time in nearly 20 years that Ive seen them. Im going to bring them on stage and maybe theyll do a couple songs with us. Save the Radio just began touring the Southeast. Prior to that, they played all over Florida, from Fort Myers to Jacksonville, at the Green Iguanas in Tampa to Downtown Disney. Other band members include Michael MacKewice, lead guitar and vocals; TL Jentgens, drummer and Joe Cosas, keyboard and bass. The band is releasing its third album, Calculating the Sum of Your Life, in Spring 2014. Leading up to it, they will release singles separately, with Add it Up being released to radio stations in a few weeks. As for the bands name, Scheller explained: In 2008 when we were just getting together, FM radios format was becoming so homogenized and dictated by the corporate sponsors, that you would literally hear the same 10 to 15 songs on any given monopoly owned stations every hour. I cant remember how many times I was driven to insanity from hearing the same Nickelback songs over and over again no offense to Nickelback. Mike (MacKewice) and I were like, Somebody please save the radio! So, we decided it would be our job, to Save the Radio, he said. At the Rock the Block, Save the Radio will be playing a mix of cover songs spanning the decades from the s to the present, including the entire side two of the Beatles Abbey Road album, some country, dance and R&B, Top 40 and also their own original music. A lot of our fans who are in their 20s and 30s are just learning about what I refer to as retro rock, like Hall and Oates and Rick Springfield, which I listened to when I was a kid, the retro pop of the s, he said. To them, its cool and thats the music that has influenced our music; thats where we got our sound from. As for the Rock the Block event, Scheller said he hopes their three-hour show will have something for everybody. Were going to hopefully leave that show making sure that everyone got to enjoy it.Contact Chronicle reporter Nancy Kennedy at 352-564-2927 or nkennedy @chronicleonline.com. Special to the ChronicleSave the Radio will be rocking Inverness at the Rock the Block street party beginning at 7 p.m. Saturday, Sept. 28 in downtown Inverness. From left are: Michael MacKewice, Shawn Scheller and TL Jentgens. WHAT: Rock the Block free concert featuring Save the Radio, Tampas No. 1 cover band playing music spanning the decades from the s to current hits, plus original music. WHEN: Event begins at 6 p.m., concert at 7 p.m. Saturday, Sept. 28. WHERE: Downtown Main Street, Inverness. INFO: Bring lawn chairs but leave coolers at home. VIDEO PREVIEW: Visit online at https:// vimeo.com/74988235 Anglers turn out to help charities through fishing tournament ERYNWORTHINGTON Staff writerINVERNESSThirty-one two-angler boats competed Saturday in the inaugural Bass Blasters Fishing Tournament, benefitting the Key Training Center and Rotary Club of Inverness community projects, at Liberty Park in Inverness. About 75 people appeared for the 3 p.m. weigh-in to see which boat would take home the $1,000 grand prize for five living fish for the combined weight in boat. First place was boat No. 19, Robert Glass and Jerry Castellano, who had 18.92 pounds of fish. Second place was boat No. 6, John and J.T. Sarver, with 14.72 pounds of fish. Greg and Don Hughess boat No. 24 took home third place with 13.80 pounds. Glass and Castellano also took home first-place prize of $350 for the Big Fish, weighing 5.20 pounds. Second place was boat No. 6, with Sarver taking home $150 for a fish weighing 4.44 pounds. ERYN WORTHINGTON/ChronicleABOVE: Robert Glass and Jerry Castellano took home the first place price for both the combined weight of 18.92 pounds and the Big Fish weight of 5.20 pounds Saturday. LEFT: Father-and-son team Thomas Sarver Sr. and Thomas T.J. Sarver competed against 30 other boats Saturday in the bass fishing tournament. Bass Blasters PAGE 4 Birthday Everything youve experienced will contribute to how far you go in the year ahead. Focus on making money at your work and through investments. Dont give in to bullying when it comes to something extravagant. Libra (Sept. 23-Oct. 23) Keep life simple and avoid over-the-top expenses or responsibilities that will hinder the ability to take care of your needs. Scorpio (Oct. 24-Nov. 22) Do whatever it takes to improve your living space. Any projects that can enhance the way you look and feel will help you project a better image. Sagittarius (Nov. 23-Dec. 21) A day trip that offers adventure or new experiences could prove advantageous. Let your free spirit take over. Capricorn (Dec. 22-Jan. 19) Dont be shy, and make sure you loudly express your reasons for the decisions you make. Have confidence and show your leadership ability at work. Aquarius (Jan. 20-Feb. 19) Too much self-criticism can be debilitating. Look at your positive qualities and work at perfecting the things you enjoy most and do best. Pisces (Feb. 20-March 20) Youve got what it takes to make a difference. Use your skills and offer people help and suggestions, and you will make an impression that will lead to greater prosperity and stability. Aries (March 21-April 19) Dont allow personal problems to stand between you and your goals. Step outside your situation and establish what you need to do to excel. Taurus (April 20-May 20) Be aware of whats going on around you before you take any irrevocable steps. Sticking to rules and regulations will protect you from dubious encounters. Gemini (May 21-June 20) Play around with ideas and options that could improve your living space. Joining new groups will lead to valuable networking opportunities. Cancer (June 21-July 22) Do your own thing. Dont expect everyone to agree with you or help you. Letting go could be the smartest move youll make. Leo (July 23-Aug. 22) Offer suggestions to people seeking help, but dont take on responsibilities that dont belong to you. A change will do you good. Virgo (Aug. 23-Sept. 22) Focus on participation, be it in your community or in your career. Becoming more involved in a cause will lead to new friends.TodaysHOROSCOPES Today is Monday, Sept. 23, the 266th day of 2013. There are 99 days left in the year. Todays Highlight in History: On Sept. 23, 1952, Sen. Richard M. Nixon, R-Calif., salvaged his vicepresidential nomination by appearing live on television to refute allegations of improper campaign fundraising. On this date: 1912, Mack Sennetts first Keystone short subject, a split-reel of two comedies both starring Mabel Normand and Ford Sterling (Cohen Collects a Debt and The Water Nymph), was released. In 1962, The Jetsons, an animated cartoon series about a Space Age family, premiered as the ABC television networks first color program. Ten years ago: A federal appeals court unanimously put Californias recall election back on the calendar for Oct. 7. Five years ago:. Todays Birthdays: Actor Mickey Rooney is 93. Singer Julio Iglesias is 70. Actor Paul Petersen (The Donna Reed Show) is 68. Actress-singer Mary Kay Place is 66. Rock star Bruce Springsteen is 64. Actress Rosalind Chao is 56. Actor Jason Alexander is 54. Actress Elizabeth Pena is 54. Actor Chi McBride is 52. Actor Erik Todd Dellums is 49. Actor Kip Pardue is 37. Actor Anthony Mackie is 35. Actress Aubrey Dollar is 33. Thought for Today: The only interesting answers are those which destroy the questions. Susan Sontag, American author and critic (1933-2004).Today inHISTORY CITRUSCOUNTY(FL) CHRONICLE HI LO PR 87 73 1.50 HI LO PR 85 73 1.50 HI LO PR 87 73 1.10 HI LO PR 86 73 1.40 HI LO PR NA NA NA HI LO PR 86 72 0.90 YESTERDAYS WEATHER Heavy showers with a few storms, rain chance 70%THREE DAY OUTLOOK Scattered showers and a few storms, rain chance 60% Scattered storms, rain chance 60%High: 87 Low: 71 High: 88 Low: 71 High: 88 Low: 70TODAY & TOMORROW MORNING TUESDAY & WEDNESDAY MORNING WEDNESDAY & THURSDAY MORNING Exclusive daily forecast by: TEMPERATURE* Sunday 87/73 Record 95/63 Normal 90/68 Mean temp. 80 Departure from mean +1 PRECIPITATION* Sunday 1.10 in. Total for the month 6.15 in. Total for the year 47.16 in. Normal for the year 43.43 in.*As of 7 p.m. at InvernessUV INDEX: 6 0-2 minimal, 3-4 low, 5-6 moderate, 7-9 high, 10+ very high BAROMETRIC PRESSURE Sunday at 3 p.m. 29.82 in. DEW POINT Sunday at 3 p.m. 76 HUMIDITY Sunday at 3 p.m. 85% POLLEN COUNT** Grasses and weeds were light and trees were absent.**Light only extreme allergic will show symptoms, moderate most allergic will experience symptoms, heavy all allergic will experience symptoms.AIR QUALITY Sunday was good with pollutants mainly particulates. ALMANAC CELESTIAL OUTLOOK SUNSET TONIGHT ............................7:25 P.M. SUNRISE TOMORROW .....................7:20 A.M. MOONRISE TODAY .........................10:19 P.M. MOONSET TODAY ..........................11:16 A.M. SEPT. 26OCT. 4OCT. 11OCT. 18 WATERING RULES BURN CONDITIONS For more information call Florida Division of Forestry at (352) 754-6777. For more information on drought conditions, please visit the Division of Forestrys Web site: Fire Danger Rating is: MODERATE. There is no burn ban.City H L Fcast Daytona Bch. 85 73 ts Ft. Lauderdale 89 78 ts Fort Myers 89 76 ts Gainesville 85 69 ts Homestead 88 76 ts Jacksonville 82 70 ts Key West 86 78 ts Lakeland 89 74 ts Melbourne 85 73 ts City H L Fcast Miami 89 78 ts Ocala 88 70 ts Orlando 88 73 ts Pensacola 87 74 ts Sarasota 87 77 ts Tallahassee 87 71 ts Tampa 89 75 ts Vero Beach 88 74 ts W. Palm Bch. 89 76 ts FLORIDA TEMPERATURESSoutheast winds around 10 knots. Seas 2 feet. Bay and inland waters will have a light chop. Mostly cloudy with scattered showers and thunderstorms today. Gulf water temperature85 LAKE LEVELSLocation Sat. Sun. Full Withlacoochee at Holder 29.68 29.73 35.52 Tsala Apopka-Hernando 38.12 38.15 39.25 Tsala Apopka-Inverness 39.61 39.62 40.60 Tsala Apopka-Floral City 40.46 40.45 L L L L L L L L L 84/66 67/54 71/45 87/62 74/58 79/64 72/58 77/55 72/44 62/53 67/51 63/52 80/63 89/78 88/71 69/50 THE NATION Albany 64 55 .12 s 60 38 Albuquerque 81 59 s 75 51 Asheville 72 55 .01 s 72 52 Atlanta 73 59 1.72 pc 80 63 Atlantic City 74 55 .35 s 67 49 Austin 84 57 pc 88 66 Baltimore 73 56 s 69 47 Billings 71 58 pc 72 44 Birmingham 81 54 pc 81 65 Boise 68 54 pc 69 49 Boston 73 63 .37 s 63 46 Buffalo 57 48 s 57 40 Burlington, VT 63 52 .28 pc 58 40 Charleston, SC 81 71 .01 pc 81 63 Charleston, WV 68 57 s 70 45 Charlotte 80 60 s 79 57 Chicago 67 50 s 67 54 Cincinnati 69 47 s 70 46 Cleveland 59 55 s 62 44 Columbia, SC 84 66 s 77 58 Columbus, OH 66 52 s 68 46 Concord, N.H. 70 56 .06 s 63 35 Dallas 83 60 s 84 66 Denver 80 56 ts 71 45 Des Moines 79 53 s 77 55 Detroit 62 51 s 63 52 El Paso 85 63 s 87 62 Evansville, IN 74 51 s 74 51 Harrisburg 69 55 .01 s 67 43 Hartford 71 59 .57 s 64 41 Houston 86 63 ts 88 71 Indianapolis 70 48 s 71 50 Jackson 80 59 pc 85 68 Las Vegas 81 64 s 87 67 Little Rock 80 57 s 79 59 Los Angeles 73 61 s 79 64 Louisville 73 53 s 75 55 Memphis 77 59 s 82 64 Milwaukee 60 45 s 64 54 Minneapolis 74 48 s 74 58 Mobile 81 68 .01 pc 87 72 Montgomery 85 64 pc 85 68 Nashville 77 52 s 81 60 New Orleans 81 73 ts 88 77 New York City 69 59 .48 s 67 51 Norfolk 74 64 .02 s 70 53 Oklahoma City 82 53 s 80 59 Omaha 82 55 pc 78 56 Palm Springs 88 69 s 95 72 Philadelphia 71 62 .08 s 69 47 Phoenix 90 82 s 92 70 Pittsburgh 62 52 s 63 43 Portland, ME 71 58 .11 pc 63 41 Portland, Ore 62 57 .11 r 64 54 Providence, R.I. 72 59 .14 s 66 43 Raleigh 77 64 .08 s 74 49 Rapid City 93 48 ts 64 47 Reno 72 42 s 79 47 Rochester, NY 57 51 s 56 39 Sacramento 75 54 s 85 60 St. Louis 79 52 s 76 55 St. Ste. Marie 54 39 s 61 39 Salt Lake City 78 67 s 69 52 San Antonio 89 59 s 89 68 San Diego 74 66 s 81 62 San Francisco 70 55 s 73 58 Savannah 88 73 .18 pc 82 65 Seattle 63 55 .44 r 62 53 Spokane 63 49 pc 63 45 Syracuse 59 52 .01 s 58 39 Topeka 79 53 pc 79 56 Washington 76 60 s 69 50YESTERDAYS NATIONAL HIGH & LOW HIGH 98 Philip, S.D. LOW 27 Crane Lake, Minn. MONDAY CITY H/L/SKY Acapulco 85/76/ts Amsterdam 71/53/pc Athens 78/62/pc Beijing 71/57/sh Berlin 65/59/c Bermuda 83/78/sh Cairo 92/67/s Calgary 61/39/pc Havana 83/77/ts Hong Kong 82/72/r Jerusalem 77/65/pc Lisbon 79/64/pc London 70/50/pc Madrid 86/60/s Mexico City 72/59/ts Montreal 57/45/pc Moscow 53/46/sh Paris 74/49/pc Rio 73/68/sh Rome 74/61/s Sydney 75/49/pc Tokyo 74/70/sh Toronto 63/43/s Warsaw 62/45/pc* 8:07 a/4:08 a 9:14 p/4:47 p 8:40 a/4:39 a 10:00 p/5:28 p Crystal River** 6:28 a/1:30 a 7:35 p/2:09 p 7:01 a/2:01 a 8:21 p/2:50 p Withlacoochee* 4:15 a/11:57 a 5:22 p/11:49 p 4:48 a/12:38 p 6:08 p/ Homosassa*** 7:17 a/3:07 a 8:24 p/3:46 p 7:50 a/3:38 a 9:10 p/4:27/23 MONDAY 9:17 3:05 9:42 3:29 9/24 TUESDAY 10:12 3:59 10:36 4:24 FORECAST FOR 3:00 P.M. MONDAY HI LO PR 86 74 0.70, nettle, grasses Todays count: 0.6/12 Tuesdays count: 4.8 Wednesdays count: Prisoners tops box office with $21.4MNEW, the nearly 2 1/2hour. In limited release, two other adult-oriented films opened well. Ron Howards Formula One tale Rush opened in five theaters with a $40,000 per-screen average. And the romantic comedy Enough Said, which co-stars James Gandolfini in one of his final performances, opened in four theaters with a per-screen average of $60,000. Both films expand next week. Warner Bros.s 3-D conversion of The Wizard of Oz made $3 million, opening on 318 IMAX screens. Estimated ticket sales for Friday through Sunday at U.S. and Canadian theaters, according to Hollywood.com. Final domestic figures will be released Monday. 1. Prisoners, $21.4 million ($500,000 international). 2. Insidious: Chapter 2, $14.5 million ($3.5 million international). 3. The Family, $7 million ($1.5 million international). 4. Instructions Not Included, $5.7 million ($9.6 million international). 5. Battle of the Year, $5 million. 6. Were the Millers, $4.7 million ($9.6 million international). 7. Lee Daniels the Butler, $4.3 million ($2.2 million international). 8. Riddick, $3.7 million ($9.4 million international). 9. Wizard of Oz, $3 million. 10. Planes, $2.9 million ($7 million international).Michigan center opens Frank exhibitFARMINGTON HILLS, Mich. The Holocaust Memorial Center in suburban Detroit has dedicated a permanent exhibit honoring Anne Frank. The exhibit unveiled Sunday at the Farmington Hills center features a sapling from the chestnut tree that consoled Frank as she hid during Nazi occupation in Amsterdam. She talks in her diary about seeing raindrops shining on the trees branches. The exhibit also features photographs and scrolling quotations from her diary. Those speaking at the afternoon ceremony included Holocaust survivor Irene Butter, who met Anne Frank during her internment in Bergen Belsen concentration camp. The center says 10 other sites in the U.S. have saplings from the 150-year-old tree. From wire reports Associated PressDamian Lewis, from left, Matthew C. Blank, Claire Danes and David Nevins arrive Saturday at the Showtime Primetime Emmys Eve Party at the Sunset Tower in Los Angeles. A4MONDAY, SEPTEMBER23, 2013 000FUXL in Todays Citrus County Chronicle LEGAL NOTICESFictitious Name Notices........................B10 Meeting Notices.....................................B10 Lien Notices...........................................B10 Foreclosure Sale/Action Notices.. .......B10 86 70 0.40 PAGE 5 CITRUSCOUNTY(FL) CHRONICLEMONDAY, SEPTEMBER23, 2013 A5 000G5V6.. Nature Coast Ministries 10 a.m. to 2 p.m. Tuesdays and Thursdays, 999 State Road 44, Crystal River. 3525. Crystal River United Methodist Church 9 a.m. to 1. noon the second and fourth Tuesdays monthly. Call 352212-5159. Lester Ely, 99INVERNESSLester Ely, 99, Inverness, Fla., died Friday, Sept. 20, 2013, at his residence. Private arrangements are by Chas. E. Davis Funeral Home, Inverness. Rose Pate, 75INVERNESSRose M. Pate, 75, of Inverness, Fla., died Friday, Sept. 20, 2013, at her residence. Private arrangements are by Chas. E. Davis Funeral Home with Crematory, Inverness. A6MONDAY, SEPTEMBER23, 2013CITRUSCOUNTY(FL) CHRONICLE 000G4IF For Information and costs,call 726-8323 Burial Shipping CremationFuneral HomeWith Crematory000EHVX 000FXJL, Candy Phillips 563-3206 cphillips@chronicleonline.com 000FX8G FoodPROGRAMS SO YOU KNOW The Citrus County Chronicles policy permits. U.S. flags denote military service on local obituaries. Obituaries will be posted at www. chronicleonline.com. Obituaries. 8:30 a.m. to 2 p.m. Saturday, Sept. 28, Business Womens Alliance Womens Health and Fitness Expo, 8551 W. Venable St., Crystal River. 3 to 5 p.m. Saturday, Sept. 28, Walmart Supercenter, 3826 S. Suncoast Blvd., Homosassa. 10 a.m. to 5 p.m. Sunday, Sept. 29, Walmart Supercenter, 2461 W. Gulf-to-Lake Highway, Inverness. 10 a.m. to 4 p.m. Monday, Sept. 30, College of Central Florida, 3800 S. Lecanto Highway, Lecanto. LifeSouth is the sole blood provider for Seven Rivers Regional Medical Center and Citrus Memorial Health System. BloodDRIVES Influential director Richard Sarafian dies at 83 Associated PressLOS ANGELES Richard Sarafian, an influential film director whose 1971 countercultural car-chase thriller Vanishing Point brought him a decadeslong. Sarafian worked primarily in television in his early career, directing episodes of s shows such as Gunsmoke, I Spy, and Sunset Strip. He also directed 1963s Living Doll episode of The Twilight Zone, a chilling tale whose demonic main character Talky Tina terrified children for decades. That included his own kids. Deran Sarafian said as a boy he thought the episode was the most horrible thing Ive ever seen before learning his father had made it. But Richard Sarafian was best known by far for Vanishing Point, a dark story of a drugfueled. Hes considered one of the original Raging Bulls, thats M*A*S*H director Robert Altman, and twice married Altmans sister Helen Joan Altman, who died in 2011. Hes survived by four sons and a daughter. Richard Sarafiandirector died Wednesday at age 83. PAGE 7Shenyas Red Cross said in a statement, citing police, that 49 people had been reported missing. Officials did not make an explicit link but that number could give an indication of the number of people held captive. Kenyas Red Cross said the death toll rose to 68 after nine bodies were recovered Sunday. More than 175 people were injured, including many children, Kenyan officials said. Somalias everybodys sense of right and wrong, and called the attackers ruthless and completely reckless terrorists. Kerry, who was in New York, for meetings at the United Nations, spoke Sunday with Somalias. Wells fiancee in the attack, reiterated his governmentss. Public Works Director Jeff Rogers will present a proposed interlocal agreement for the mutual exchange of emergency solid waste services with Hernando County. According to the draft agreement, in the event of an emergency, Citrus or Hernando may have waste to dispose of in the other countys solid waste disposal system. The agreement would allow the disposal if the county has additional capacity. The Division of Solid Waste also has started talks with Hernando County to issue a joint request for proposal (RFP) for shared information and resources for alternative waste disposal technologies. Rogers will present a draft interlocal agreement to the board regarding the RFP. According to the draft, in 2010, the Florida Legislature passed a law setting a recycling goal of 75 percent by 2020 for Florida counties. The two counties will seek options to process waste materials to meet recycling goals. On the consent agenda, the board will be asked to renew Crystal Rivers 2005 interlocal agreement for disposal of waste in the county landfill at the rate of $45 per ton. According to the county, the estimated revenue, based on 2012 information, is about $22,000 per month. During a public hearing at 5:01 p.m., the board will be asked to review and adopt the final millage rate and final budget for 2013-14 of $226,872,781, excluding disputed tax reserves. At 1:15 p.m., the board will present proclamations. It will declare September as National Recovery Month. Sept. 24 will be declared as STEPS to the College of Central Florida Day. The week of Sept. 20-28 will be declared Save Our Waters Week. The week of Oct. 6-12 will be declared Fire Prevention Week and October will be Crime Prevention Month. Public Hearings will begin at 2 p.m., with the first subject being water restrictions. At 2:15 p.m., a public participation ordinance will be discussed and its adoption will be decided.Contact Chronicle reporter Chris Van Ormer at 352-564-2916 or cvanormer@chronicle online.com. requirements, dual enrollment, Advanced Placement and International Bachelorette courses, Penn Foster and Successmaker will be discussed. Prior to the workshop will be a special meeting to approve a two percent salary increase across the board contract between Citrus County School Board and Citrus County Education Association, a $15 per month increase for the health insurance board match and language changes. An administrative hearing will follow the special meeting and workshop, beginning at 1 p.m. LOCALCITRUSCOUNTY(FL) CHRONICLEMONDAY, SEPTEMBER23, 2013 A 10/31 000FZUL KNIGHTS OF COLUMBUS 352/746-6921 Located County Rd. 486 & Pine Cone Lecanto, FL (1/2 Mile East of County Rd. 491) 000FZQ4 PROGRESSIVE JACKPOT WEDNESDAY & FRIDAY Doors Open 4:30 PM Games Start 6:00 PM ALL PAPER BINGO PRIZES $ 50 TO $ 250 WINNER T AKES ALL POT-O-GOLD Smoke-Free Environment FREE Coffee & Tea TV Monitors for Your Convenience ~ Sandwiches & Snacks ~ Blackshears II Aluminum 795-9722 Free Estimates Licensed & Insured RR 0042388 Years As Your Hometown Dealer 000FWND HWY. 44 CRYSTAL RIVER 2013 2013 2013 2013 Rescreen Seamless Gutters Garage Screens New Screen Room Glass Room Conversions F LORAL C ITY L IONS B INGO at the Community Building 726-5107 Every Wednesday 6:30 pm 25 cent games at 4pm 20 games 000FZO6 Bonanza 4 speed games and 18 regular games with Jackpot $24 in door prizes B 10 I 19 For a Day or Night of Fun and to Meet New Friends. Come and Play! To place your Bingo ads, call 563-5592 9203147FZQC 000FZQE 000G4QF SATURDAY BINGO VFW POST 4252 Hwy 200 HERNANDO, FL Doors open at 9:30 Game starts at 10:00 a.m. You do not have to be a Post Member to participate in Bingo. 352-726-3339 000FYGG LANDFILLContinued from Page A1 SCHOOLContinued from Page A1 ASSAULTContinued from Page A1 CLICK & SAVE Check out local Click & Save deals offered at. Associated PressTrucks of soldiers from the Kenya Defense Forces arrive after dawn Sunday outside the Westgate Mall in Nairobi, Kenya. Islamic extremist gunmen lobbed grenades and fired assault rifles inside Nairobis top mall Saturday, killing dozens and wounding more than 100 in the attack. Early Sunday morning, 12 hours after the attack began, gunmen remained holed up inside the mall with an unknown number of hostages. PAGE 8 Page A8MONDAY, SEPTEMBER 23, 2013 Time to revise state policy on health careFlorida is second in the nation in the rate of uninsured citizens, and yet the state continues to make it more and more difficult for those most in need of health insurance to find coverage. The states refusal to expand Medicaid was already a morally and economically reprehensible decision, leaving nearly a million Floridians without access to affordable health care and depriving the states economy of $51 billion in federal money. Now comes the news that the state Department of Health (DOH) is refusing to allow federal Navigators into county health units. As the country begins the transition into the new health care system, Navigators will help guide citizens through the complex process ... except in county health departments in Florida, where the states poorest citizens often go for health care services. Not only are the citizens most in need of insurance unable to receive health care due to the Florida Houses decision on Medicaid expansion, the state is also now barring other working class Floridians from receiving information about how to enroll in private insurance plans through the online Marketplace. I echo the sentiments of Dr. Marc Yacht, retired Pasco County health director, who called DOHs decision cruel and irresponsible and urge the state to rethink this matter promptly. With the Oct. 1 opening of the online health care marketplace fast approaching, I only hope that the state will reverse its policy immediately.Marie Pettibone president, League of Women Voters of Citrus CountyAn affront to veteransRe: Eye of the beholder, John Read, Letters to the Editor, Sept. 18.I am again taken aback by Mr. John Reads repeated disrespectful and blatant insult to Americas veterans. Politicians and diapers need to be changed often for the same reason. Mr. Read owes a written apology to Mr. Harley Lawrence, me, and the millions of patriot veterans since June 16, 1775, who have served to preserve, protect, and defend the Constitution of the United States of America, along with the Bill of Rights. We provided John the privilege of freedom of speech, of which John is assaultive and abusive without a rightful cause. Socialism, as John claims, is not the reward for veterans that served. The rewards are designated by law of the U.S. Congress (the voice of free people). John, all American citizen patriots, and of late even noncitizens, are privileged to serve and receive like rewards. If you feel the veterans rewards are unfair you can appropriately voice your contempt and petition to change Congressional law or sign up for any of the Armed Forces opportunities and earn the same privileges. Mr. Read, this veteran forgives you of your assault on our patriot veterans, but I may not easily forget. May our Creator richly bless each choice word John may choose to opine hereafter. Robert David Hummel Inverness Editors note: This is the first of three guest columns by Commissioner Dennis Damato that provide an update on current projects to protect Citrus Countys water quality and supply. The columns are part of the Chronicles Save Our Waters Week coverage.In keeping with this years theme for the 18th annual Save Our Waters Week sponsored by Citrus 20/20, Inc., Water: Save It Now Or Lose It Forever, I appreciate the opportunity to update our community about an important water quality project the Brentwood Wastewater Treatment Plant expansion and reclaimed water upgrades project. Located in the Central Ridge section of Citrus County on County Road 486 west of Forest Ridge Boulevard across from Terra Vista, the Brentwood Wastewater Treatment Plant is an important component of the Citrus County Utility System. Keep in mind, the Central Ridge is in a planned service area of the Citrus County Comprehensive Land Use Plan, which is home to over five Developments of Regional Impact (DRIs). Since the mid-1980s, the comprehensive plan has been directing new growth toward the Central Ridge area away from the countys coastal waters and estuaries. The comprehensive plan has had the desired effect with thousands of new homes constructed since it was initiated. Because of this planned growth to our community standards over the years, tens of millions of dollars of public and private funds have been invested in this area of our county. They include: four-lane roadways, multi-use paved trails, trailheads, sidewalks, stormwater drainage and retention areas, central water and sewer lines and wastewater treatment plants. The Brentwood Wastewater Treatment Plant project will expand and upgrade the existing plants current capacity of 500,000 gallons per day to two million gallons per day advanced secondary reuse facility. This will allow for the implementation of enhanced treatment processes that produce reclaimed water thats available for beneficial public use. The proposed project at the Brentwood Wastewater Treatment Plant is similar in nature to the Meadowcrest Wastewater Treatment F acility that was recently upgraded to produce effluent meeting the requirements for public access reuse. This upgrade has afforded the capability to provide reclaimed water to the Black Diamond Golf Course to offset groundwater pumping for golf course irrigation. Upgrading the Brentwood Wastewater Treatment Plants existing wastewater facilities to make additional high-quality reclaimed water available to offset existing groundwater pumping for irrigation in the Kings Bay Springshed is a responsible and sustainable water conservation measure. It will not only help to preserve and improve the quality and quantity of our groundwater resources, but also result in the reduction in groundwater pumping to help preserve groundwater availability for spring flows. The projected budget for the reclaimed water portion of the project is $5,700,000. An application for funding assistance for the reclaimed water upgrades has been submitted by the Southwest Florida Water Management District on the countys behalf to the State of Florida through the Springs Initiative Program. If approved, the state would provide 50 percent of the funding for reclaimed water upgrades ($2,850,000). The expanded capacity of the Meadowcrest and Brentwood wastewater treatment plants will also allow for the further expansion of the wastewater collection systems throughout the Crystal River Springshed. This expansion will make additional reclaimed water available throughout the area and remove existing septic systems from service, which have been identified as a source of nutrient loading to both groundwater and surface water.Dennis Damato has resided in Citrus County for over four decades and is in his third term as the District 1 Citrus County Commissioner. He also chairs the Withlachoochee Regional Planning Council and the Withlachoochee Regional Water Authority and serves as the liaison to the Southwest Florida Water Management District. Give me chastity and continence, but not just now.St. Augustine, Confessions, 5th century Where were using, were re Few apply for fire tax exemption County governments hardship assistance program is nearing its Oct. 1 deadline, and unfortunately only a small portion of residents have applied. County commissioners on July 23 approved a flat fee of $54 for fire protection, which is expected to raise about $4.5 million for fire services in the upcoming budget. As residents who are living on a low income will pay proportionately more tax than they would expect to pay because of the value of their homes, the MSBU resolution included provision for hardship assistance being administered through Citrus County Housing Services. An applicant must own their property, have a homestead exemption and proof of an extremely low income less than or equal to 30 percent of limits established by the U.S. Department of Housing and Urban Development. Perhaps word of the exemption and the impending deadline has not reached the residents who qualify. Government offers many services benefitting low-income residents that are not always fully appreciated. Another impediment might be the eligibility standards. Extremely low income limits start at $10,100 per year for one person. It ranges from $14,400 for a four-person family to $19,050 for an eightperson family. The median family income for Citrus County is $46,500. Using the 30 percent model is the lowest threshold available and sets barrier that excludes a great number of residents who face hardship. The 50 percent level (very low) for a family of four is $24,000. Thats $2,000 a month before taxes to house, feed, clothe, buy gas, pay car loans and insurance and provide utilities for four people. We doubt anyone, except someone at the extremely low threshold, envies the person making a budget for that household. The $54 for fire assessment would be a lot more useful to that family than the county, which is working with a multimilliondollar budget. We hope others will apply but if that number stays low, as of Sept. 14, only 10 had applied, we urge the county to reconsider those standards. THE ISSUE:Ten people apply for MSBU hardship assistance.OUR OPINION:If you qualify, apply. Tailgating no-nosI agree with the person who complained about cars tailgating you. Thats why when theres an accident with one car, five other cars crash into each other because they left no space between themselves and the car in front of them. Theres supposed to be one car between you and the other one in front of you for every 10 mph youre doing. If there isnt, youre going to run right in the rear of the one in front of you if he stops. I used to love driving, but not anymore. Today you have to have eyes in the back of your head to watch some jerk whos tailgating you. Sometimes I feel like slamming my brake on just to watch them try to avoid an accident.Watch for scammersI received a call today from a gentleman claiming to be from the United States Federal Government Grant Department. He would not give any information but said I had a $9,000 grant and wanted a credit card or debit card number so they could deposit it in my account. I asked about getting a check. He said the government does not do this and he would not give me a phone number so I could call him back. So be careful. I know its a scam.Party-line politicianI refuse to go to the town hall meeting by Rich Nugent, our representative, because Ive written him before and I discovered that he has signed the Grover Norquist pledge. He marches the party line. He does not care about the people of Florida. Hes voting to destroy the Affordable Care Act when were second only after Texas in people being uninsured in Florida. I think that Mr. Nugent should have his health insurance taken away from him and he should pay $1,000 or $2,000 a month for his health insurance, like other people have to do. Anything to help the people, hes against it. And no matter what you say to him, he quotes the party lines. All I had to do is look on Fox News and its the same words coming out of Nugents mouth.Praying for lost dogIm calling about the story in todays paper (Aug. 21) about the lost Anatolian dog. My heart goes out to the owners. I am a pet owner. I cant imagine losing my dog. If someone has him, please return him. Find it in your heart to do the right thing. He belongs with his owner. Again, I am praying for you. I hope you find him. Luck to all of APPLY NOW Dennis DamatoGUEST COLUMN PAGE 9 coastal areas and our waterways. Its been going on for 24 years, and Citrus 20/20 and Save Our Waters Week have been involved for 18 of those years. Just a little bit of background 24 years ago the Ocean Conservancy and Citrus County formed a partnership for a coastal cleanup similar to the Adopt-a-Highway program, only its Adopt-aShoreline. The third Saturday in September every year, all across the world, people are out volunteering and cleaning up the waterways, whether its the Atlantic or Pacific or Indian Ocean. I think thats important to know, that its not just a local event. CHRONICLE: Tell me about Citrus 20/20. BLUE-MCLEAN: Citrus 20/20 is an organization that created a vision document in the late 1990s, which came out of a Leadership Citrus class project. CHRONICLE: Was that your class? BLUE-MCLEAN: No, Im 2007 Leadership Citrus class. Anyway, in the vision document that was created through this Leadership Citrus class, they had the idea of saying, What is our county going to look like in the year 2020? From that evolved this document that says: These are the things that we need to be aware of in order to maintain and improve our county up to and beyond 2020. ... The vision document mirrored the countys comp plan, which has seven areas transportation, economics, growth management. Im drawing a blank on the rest of them. Actually, they added three more youth needs, cultural and our seniors, so there are 10 areas. Oh natural resources, of course! How could I forget that one? The way they created that first vision document this was in days before the Internet and email folks in the community came to the Crystal River Mall and they had flip charts out with the categories on them and people would go around with little tabs and put one on the most important area that they thought needed to be the priority to be concentrated on. Protecting our water was always the number one priority. People living in Citrus County realized the importance of protecting our lakes, canals, rivers and springs. It was only until the last vision check in 2007 that the priority shifted and water became second and economic growth became first, just because of how the economy was. CHRONICLE: So, it started with a one-day coastal cleanup BLUE-MCLEAN: For the first couple of years it was just that. Going back to why the county came to Citrus 20/20, it was because in the vision document the number one priority was protecting our waterways, so of course Citrus 20/20 said they would partner with them, and they formed a committee called Save Our Waters and over the years it has expanded to eight days with something going on each day thats going to help folks learn more about the natural resources in our community, as well as where all the waterways are. CHRONICLE: About how many people sign up for the coastal cleanup each year? BLUE-MCLEAN: It varies. Weve had as many as 1,200 a few years ago. Last year we had 600 and this year around 448. CHRONICLE: Why is the number going down? BLUE-MCLEAN: Theres a variety of reasons. The time of year sometimes the snowbirds arent back. Our youth, it depends on whats going on at school. But we have 23 groups this year and weve got some new groups. A lot can be done by a few hands. CHRONICLE: We were talking earlier and I said nobody would be against saving our waters, but saying, Yes, I agree, and actually doing something about it and changing talk to me about that. BLUE-MCLEAN: Thats a very good. Its really just common sense, like turning off the water while youre brushing your teeth or washing dishes. One of the things we do is go into the schools and do programs, and the kids just embrace it, and thats where it begins educating our youth so as they become adults its second nature. CHRONICLE: I was surprised when I learned about the impact of fertilizer too much on a lawn in Lecanto might one day affect the grouper in the gulf, which affects whether or not I get a grouper sandwich. BLUE-MCLEAN: Yes, its not just a problem for people who live on the water, but for everyone because everything floats downstream. People on the east side affect the people on the west side, so were all in this together. The impact of fertilizer into the waterways is huge. As you know, we have a program in the county cleaning up Kings Bay. Trash, too, is a big problem. Keep Citrus County Beautiful, which is one of our partners for Save Our Waters Week, has a snag and bag program for folks out on boats to collect trash while theyre out on the water. Its about being aware that how we impact our water impacts the whole environment. Animals eat the trash and get sick, or those six-pack plastic rings, if theyre not cut up they can get around the neck of a turtle or bird and its a slow death for them. People say, Oh, my gosh! Of course I wouldnt want that to happen. Thats why its important that they understand what one little piece of plastic can do to wildlife, and when the wildlife die it contaminates the water. CHRONICLE: Lace, why are you so passionate about this? BLUE-MCLEAN: Thats a hard question, but an easy one. Its just so much a part of me that I dont know any other way. I grew up in a family that was always outdoors we were tree huggers before tree huggers were popular. CHRONICLE: Do you have a favorite body of water in Citrus County? BLUE-MCLEAN: Were sitting here at Liberty Park and its gorgeous, but Im going to say no. CHRONICLE: Not even Three Sisters Springs? BLUE-MCLEAN: (Laughs.) Well, of course, thats obvious, but I want to be neutral. In all seriousness, our county has some beautiful natural resources, from the Withlacoochee Forest to all of the rivers and the springs. CHRONICLE: One last question. Can you name all seven rivers? BLUE-MCLEAN: I knew youd put me on the spot! What I like to do is start from the south end of the county and work my way north, so theres the Chassahowitzka, the Homosassa, Halls, Crystal River. Um, heres where I start to go blank. The Salt River and theres two more. Five out of seven, thats not too bad.Editors note: the other two rivers are the Withlacoo chee and the St. Martins. Contact Chronicle reporter Nancy Kennedy at 352-564-2927 or nkennedy @chronicleonline.com.LOCALCITRUSCOUNTY(FL) CHRONICLEMONDAY, SEPTEMBER23, 2013 A9 000G4PA6B 000G3QJ Professional Hearing Centers 726-HEAR (4327) 000FYU4 HEAR BETTER NOW, GUARANTEED! 4 Year Warranty FREE Batteries 4 Life Get your tickets at the following locationsSaturday, October 12, 2013 VIP Preview 5-6pm Event 6-9pm Citrus Ave. Crystal River 563-2572 Hwy 44 Inverness 341-4867 Citrus Ave. Crystal River 563-2582 NE 4th St. Crystal River 794-3859 Highland Blvd. Inverness 726-4709 Hwy 19. Crystal River 795-5131 Meadowcrest Blvd. Crystal River 563-6363\divanightFor more information call 352-563-5592 VIP Tickets (limited availability) $42 General Admission $20 000G2M5 000G2M5 MONDAYContinued from Page A1 MONDAY CONVERSATION The Chronicles Monda y Conversation feature sits down prominent members of the community for a short chat about their jobs and their lives. To recommend someone, email Managing Editor Charlie Br ennan at newsdesk@chronicleonline.com or phone the newsroom at 352-563-56. PAGE 10 Suicide attack on Pakistani church kills 78 people Associated PressPESHAWAR, Pakistan A pair of suicide bombers blew themselves up amid hundreds of worshippers at a historic church in northwestern Pakistan on Sunday, killing 78 people in the deadliest-ever attack against the countrys Christian minority. A wing of the Pakistani Taliban claimed responsibility for the bombing, raising new questions about the governmentsistss Christians. If the government shows will, it can control this terrorism, said Hemphray. We have been asking authorities to enhance security, but they havent paid any heed. Rubble Associated PressA series of explosive charges Sunday brings down the landmark former Macys department store building in downtown Houston. Many Houstonians remember the store as Foleys, a homegrown retail chain that started downtown in 1900 and moved into the building in 1947. It was converted to Macys in 2006. Small plane lands on main Chicago roadwayCHICAGO The pilot of a single-engine plane made an emergency landing early Sunday along Chicagos Lake Shore Drive because of mechanical issues. John Pederson. Theres always a risk. I always look for a place to land, said Pederson, wh planes left wing after he landed, but drove off. The plane was later pushed off the roadway into a grassy area. From wire reports Nation BRIEFS NATION& WORLD Page A10MONDAY, SEPTEMBER 23, 2013 CITRUSCOUNTYCHRONICLE Escaping Associated PressVillagers are evacuated Sunday from flooded areas in the town of Tixtla de Guerrero, Mexico. Tropical Storm Manuel and Ingrid affected 24 of Mexicos 31 states. More than 58,000 people were evacuated, with 43,000 taken to shelters. Suicide bomber hits Iraq Sunni funeral, killing 16BAGHDAD A suicide bomber detonated his explosive belt among Sunni mourners attending a funeral in Baghdad on Sunday, killing 16 people and wounding 35 others, officials said, in the latest episode of the countrys near-daily violence. Police officials said the evening attack took place when a suicide bomber detonated his explosive belt inside a tent where the funeral was being held in Baghdads southern neighborhood of Dora. World BRIEFS Associated PressA Pakistani Christian man mourns Sunday over the death of his relative at the site of suicide attack on a church in Peshawar, Pakistan. A suicide bomb attack on a historic church in northwestern Pakistan killed scores of people Sunday, officials said, in one of the worst assaults on the countrys Christian minority in years. For Obama, diplomatic openings on 3 fronts Associated Press hes, which open Monday, as a venue for fiery, antiAmerican its going to break, said Rubin. He said Obamas biggest test now is to recognize if opportunities morph into stalling tactics. Obamas advisers cast the sudden signs of progress as an outgrowth of the presidents long-standing preference for resolving disputes through diplomacy and, in the case of Iran and Syria, with pressure built up through economic sanctions and the threat of military action. He said wed be open to diplomacy, wed pursue engagement, but that there would be pressure if Iran failed to take that opportunity, said Ben Rhodes, Obamas deputy national security adviser. And on Syria, Rhodes said it was the credible threat of a U.S. military strike that opened the door for this diplomacy. Aides say Obama will address developments on Iran, Syria and Middle East peace in his speech to the U.N. on Tuesday. The issues will also be at the forefront of some of the presidents bilateral meetings with world leaders, including a sit-down with Palestinian Authority President Mahmoud Abbas and Lebanese President Michel Suleiman, whose country is burdened by the flow of refugees from neighboring Syria. But Obamashrans disputed nuclear program though bridging differences over Irans right to enrich uranium and maintain those stockpiles will be a far tougher task than arranging a handshake. U.S. president set to speak to the U.N. on Tuesday Obama: Gun law fight ought to obsess us Associated PressWASHINGTON President Barack Obama on Sunday memorialized the victims of the Washington Navy Yard shooting by calling for a transformation in the nations gun laws to address an epidemic of gun violence, saying, Theres nothing inevitable about it. Reprising his role of the nations consoler in chief after yet another mass shooting, Obama said Americans should honor the victims of last Mondays. Whats different in America is its easy to get your hands on a gun, he said. He acknowledged the politics are difficult, a lesson he learned after failing to get expanded background checks for gun buyers through the Democratic-controlled Senate this spring. And thats thats from the American people. Obama joined military leaders in eulogizing the 12 victims killed in last Mondays shooting, speaking from the parade grounds at the Marine barracks. The invitation-only crowd included around 4,000 mourners, with the victims tearful, black-clad family members directly in front of the speakers stage. Authorities say their loved ones lives were taken Monday by shotgunwielding Aaron Alexis, a 34-year-old former Navy reservist and information technology contractor who struggled with mental illness. Police killed Alexis in a gun battle. Associated PressPresident Barack Obama and first lady Michelle Obama stand Sunday at a memorial service for the victims of the Washington Navy Yard shooting at Marine Barracks Washington. PAGE 11 Baseball/ B2 Scoreboard/B3 Auto racing/B3 NFL/B4, B5 Puzzles/ B6 Comics/ B7 Classifieds/ B8 College football/B8 Braves, As and Cardinals clinch playoff berths. / B2 SPORTSSection BMONDAY, SEPTEMBER 23, 2013 CITRUSCOUNTYCHRONICLE Tampa Bay stays on top of wild card race Six Rays pitchers combine on 3-hitter, beat Orioles Associated PressST. PETERSBURG 1/2 games behind Cleveland for the second wild-card spot. Promoted from Triple-A Durham earlier in the day, Romero gave up Manny Machadosencias single and an RBI double by Matt Wieters with two outs in the ninth en route to his 36th save. Dating to the final 11 innings of the Rays 5-4, 18inning. Associated PressTampa Bays Sam Fuld rounds second base Sunday in front of Baltimore shortstop J.J. Hardy as he advances from first to third on a wild pitch during the sixth inning in St. Petersburg. Flanagan, Neumann extend CCS leads SEANARNOLD CorrespondentINVERNESS Track veterans Curtis Flanagan and Herb Neumann Jr. extended their respective division leads with feature wins, and Karlin Ray reclaimed his advantage in the standings while earning $250 in the 50-lap Pure Stock event during Saturdays crashridden action at the Citrus County Speedway. In other races, Lakelands Charlie Brown (Sportsman) and Pinellas Parks Charlie Meyer (Pro Figure 8s) scored their first wins of the year, while Shannon Kennedy, whose Floral City Animal Clinic is the major sponsor for next Saturdays 50-lap Mini Stock event, picked up his third feature and heat wins in Minis. Neumann, of Inverness, got by Troy The Batman Robinson at the very end of lap 19, and held on for his life against Robinson down the stretch of the 40-lapper in notching his third feature win (fourth overall) in the Open Wheel class. I knew I had to get the lead before the second-half, because my car was definitely going away, a relieved Neumann said afterward. Troy (Robinson) was probably getting a little frustrated, because he probably felt a little faster than me. From my vantage point, I was slowing down. Richie Smith, a multi-champion at Citrus, returned for his first race since April and finished third behind Robinson in a No. 22 car that hadnt seen action since wrecking last year. Brown couldnt recall the last time he won, but he made up for the drought with a wire-to-wire victory in his No. 11. He was closely trailed by fellow Lakeland driver Aaron Williamson and division-leader Mike Bell, who moved up nine spots over 22 laps to finish third, behind Williamson. Brown lamented over brake troubles afterward. We didnt have brakes in the heat, either, he said. We dont know whats going with it, but the old girl came through. Its great to be back in the winners circle. Its been a long, long time. Too long. Ray, 16, overcame a penalty to win his seventh feature win of the season. His effort launched him back into the points lead after he was See SPEEDWAY/ Page B3 Stenson wins FedEx Cup Associated Press Henrik Stenson embraces his caddie Gareth Lord after sinking a putt Sunday to win the Tour Championship golf tournament and FedEx Cup at East Lake Golf Club in Atlanta.Associated Press See STENSON/ Page B5 Bucs fall to 0-3 with 23-3 loss to Patriots Associated PressFOXBOROUGH, Mass. Tom Bradysre doing a great job, Brady said. Theyve worked really hard to understand what were trying to do on a weekly basis. That effort didntround draft pick, led the Patriots with his seven catches and 52 yards receiving. I feel good. 3-0. You cant ask for anything better, Patriots defensive tackle Vince Wilfork said. We know our offense, sooner or later, they. Thats Associated PressNew England defensive end Michael Buchanan (99) and defensive back Logan Ryan (26) tackle Tampa Bay running back Doug Martin in the second half Sunday in Foxborough, Mass. The Buccaneers fell to 0-3 on the season with a 23-3 loss. See BUCS/ Page B4 PAGE 12 Associated Pressantas dugout when the Marlins won, and a couple of Braves fans did the tomahawk chop in the stands. Manager Fredi Gonzalez highfived a fan as he made his way to the dugout after a lineup change, and the celebration really picked up when Craig Kimbrel finished for his major league-best 49th save..American League Red Sox 5, Blue Jays 2BOSTON David Ortiz and Jackie Bradley Jr. homered to lead the AL East champion Boston Red Sox to a 5-2 victory over the last-place Toronto Blue Jays.White Sox 6, Tigers 3DETROIT Erik Johnson pitched into the seventh inning in his fourth career start, and the Chicago White Sox beat Detroit 6-3 to end any chance of the Tigers clinching the AL Central title in their home finale. Johnson (2-2) allowed two runs and nine hits in 6 2/3 innings, and Chicago held on a day after blowing a six-run lead in the ninth inning against the Tigers.Athletics 11, Twins 7OAKLAND, Calif. Coco Crisp hit a three-run homer, Daric Barton and Jed Lowrie each had a solo shot and the Oakland Athletics wrapped up their second straight AL West title while overpowering the Minnesota Twins 11-7. The As clinched their 16th division crown and 25th postseason appearance when Texas lost 4-0 at Kansas City earlier.Indians 9, Astros 2CLE over the Houston Astros..Royals 4, Rangers 0, 10 inn.KANSAS CITY, Mo. Justin Maxwell hit a grand slam with two outs in the 10th inning and the Kansas City Royals beat the Texas Rangers 4-0 in a matchup of AL wild-card contenders. The Oakland Athletics clinched the AL West with the Rangers loss.Mariners 3, Angels 2ANAHEIM, Calif. Justin Smoak hit a tiebreaking two-run homer, Felix Hernandez had 10 strikeouts in a fourinning start, and the Seattle Mariners beat the Los Angeles Angels 3-2. C.J. Wilson (17-7) pitched eight-hit ball into the ninth inning but lost for the first time since July 5 against Boston, ending a streak that saw him go 9-0 over 13 starts.National League Marlins 4, Nationals 2 Nationals 5, Marlins 4WASHINGTON Wilson Ramos ninth-inning grounder bounced off a leg of third baseman Chris Coghlan for a game-ending error that allowed pinch-runner Eury Perez to score from third, and Washington beat the Miami Marlins 5-4 for a doubleheader split that left the Nationals five games back in the NL wild-card race with six games left. Giancarlo Stanton and Christian Yelich homered as Miami won the opener 4-2. Rafael Soriano (3-3) pitched a scoreless ninth inning to win Washingtons regular-season home finale, and Denard Span drove in three runs.Mets 4, Phillies 3PHILADELPHIA Wilfredo Tovar produced the winning hit in his majorleague debut and the New York Mets swept the Philadelphia Phillies with a 4-3 win..Reds 11, Pirates 3PITTSBURGH Rookie Billy Hamilton got three hits and stole two more bases, and the Cincinnati Reds routed Pittsburgh 11-3.Dodgers 1, Padres 0SAN DIEGO Adrian Gonzalez scored an unearned run and Zack Greinke combined with three relievers on a two-hitter to lead the Los Angeles Dodgers over the San Diego Padres 1-0. Greinke allowed both hits over five innings, lowering his ERA to 2.67. Kenley Jensen struck out the side in the ninth for his 27th save in 31 chances.Diamondbacks 13, Rockies 9DENVER Matt Davidson hit a three-run homer for the second straight day, and the Arizona Diamondbacks opened an early six-run lead before hanging on to beat the Colorado Rockies 13-9. Rookie Chris Owings doubled, scored twice and drove in two runs for the Diamondbacks, who led 7-1 in the third and 13-5 in the ninth.Brewers 6, Cardinals 4MILWAUKEE Norichika Aoki scored three times and doubled home a run, and the Milwaukee Brewers beat sloppy St. Louis 6-4,.Interleague Giants 2, Yankees 1NEW YORK After honoring Mariano Rivera and celebrating Andy Pettitte, the New York Yankees saw their AL wild-card hopes dim with a crushing 2-1 loss to the San Francisco Giants. Ehire Adrianza tied the score in the sixth with his first career home run. Leaving to standing ovations and a curtain call after Pedro Sandovals. AL Associated PressAtlanta players and coaches celebrate Sunday after the Braves defeated the Chicago Cubs 5-2 in Chicago. The Braves clinched the NL East as the Washington Nationals lost earlier to the Florida Marlins. Postseason tickets punched Braves, As and Cardinals all clinch berths AMERICAN LEAGUESundays Games Cleveland 9, Houston 2 San Francisco 2, N.Y. Yankees 1 Chicago White Sox 6, Detroit 3 Boston 5, Toronto 2 Tampa Bay 3, Baltimore 1 Kansas City 4, Texas 0, 10 innings Seattle 3, L.A. Angels 2 Oakland 11, Minnesota 7 (Maurer 4-8), 10:10 p.m.NATIONAL LEAGUESundays Games San Francisco 2, N.Y. Yankees 1 Cincinnati 11, Pittsburgh 3 Miami 4, Washington 2, 1st game Washington 5, Miami 4, 2nd game N.Y. Mets 4, Philadelphia 3 Atlanta 5, Chicago Cubs 2 Arizona 13, Colorado 9 L.A. Dodgers 1, San Diego 0 Milwaukee 6, St. Louis 4 Today Milwaukee (Estrada 6-4) at Atlanta (Minor 13-7), 7:10 p.m. N.Y. Mets (Harang 0-1). Rays 3, Orioles 1Baltimore Tampa Bay abrhbi abrhbi Machd 3b3010DeJess lf3111 A.Jones cf4000SRdrgz ph-lf1000 C.Davis 1b4000DJnngs cf3020 Valenci dh3110Fuld pr-cf1100 Wieters c4011Zobrist 2b2100 Hardy ss4000Joyce dh2001 Markks rf1000TBckh ph0000 Morse lf3000Scott ph-dh1000 ChDckr lf0000WMyrs rf4020 BRorts 2b3000Loney 1b3011 KJhnsn 3b3000 Longori 3b0000 Loaton c3000 YEscor ss3000 Totals29131Totals29363 Baltimore0000000011 Tampa Bay10000200x3 EKe.Johnson (4). DPTampa Bay 1. LOB Baltimore 5, Tampa Bay 5. 2BWieters (28), De.Jennings (31), W.Myers (19). HRDeJesus (1). SBZobrist (11). CSA.Jones (3). SF Joyce. IPHRERBBSO Baltimore Feldman L,5-561/363327 Matusz 100001 ODay 2/300001 Tampa Bay E.Romero 42/310040 B.Gomes W,3-12/300002 W.Wright H,91/300001 J.Wright H,611/300001 Jo.Peralta H,38100000 Rodney S,36-44121101Red Sox 5, Blue Jays 2Toronto Boston abrhbi abrhbi Reyes ss4000Pedroia 2b4000 RDavis cf3010Victorn rf4000 Lawrie 3b3000D.Ortiz dh4121 Lind 1b4000Carp 1b3000 Sierra lf4010Nava lf3110 DeRosa dh3100Mdlrks 3b3000 Goins 2b4010Drew ss2110 Pillar rf3122Lvrnwy c3111 Thole c3010BrdlyJr cf3113 Totals312 62Totals29565 Toronto0100100002 Boston04000100x5 DPToronto 1, Boston 2. LOBToronto 5, Boston 1. 2BD.Ortiz (37). HRPillar (2), D.Ortiz (29), Bradley Jr. (3). SBR.Davis (45). IPHRERBBSO Toronto Dickey L,13-138655111 Boston Doubront W,11-6742222 F.Morales H,4120011 Uehara S,21-24100001Indians 9, Astros 2Houston Cleveland abrhbi abrhbi Villar ss4010Bourn cf4112 Altuve 2b4010Swisher 1b4001 Krauss dh4120Kipnis 2b5130 Carter 1b3111JRmrz 2b0000 MDmn 3b4020CSantn dh5222 Crowe lf4000Raburn rf4010 Hoes rf3010MCarsn pr-rf1100 Corprn c4010AsCarr ss2210 BBarns cf3000YGoms c3100 Brantly lf4132 Aviles 3b3022 Totals33291Totals359139 Houston0101000002 Cleveland00030411x9 DPCleveland 1. LOBHouston 6, Cleveland 8. 2BKrauss 2 (9), Kipnis (34), C.Santana (34). 3BBourn (5). HRCarter (29), C.Santana (19). CSVillar (8). SAviles. SFSwisher. IPHRERBBSO Houston Bedard L,4-12586628 Humber 242212 De Leon 111101 Cleveland Kluber W,10-551/362216 Rzepczynski010000 Shaw H,11 100011 Allen 2/300002 M.Albers 1/310001 Rapada 1/300000 C.C.Lee 1/300001 Carrasco 110001White Sox 6, Tigers 3Chicago Detroit abrhbi abrhbi De Aza lf4110AJcksn cf4001 AlRmrz ss5010Dirks rf3010 Gillaspi 1b4312TrHntr ph-rf1000 AGarci rf5132Fielder 1b4111 JrDnks cf3000VMrtnz dh4010 Kppngr dh5032D.Kelly 3b3000 GBckh 2b5010HPerez ph-3b1000 Phegly c4000Avila c3130 Semien 3b4110B.Pena ph1110 Infante 2b4010 RSantg ss4011 NCstlns lf4020 Totals396 116Totals363113 Chicago1000302006 Detroit0001001013 EInfante (10). DPChicago 1. LOBChicago 10, Detroit 7. 2BKeppinger (13), G.Beckham (21), Avila (14), B.Pena (11). 3BGillaspie (3). HRFielder (25). SBDe Aza (20), Semien (2). SFA.Jackson. IPHRERBBSO Chicago Er.Johnson W,2-262/392201 Veal H,11 11/311100 Lindstrom 110001 Detroit Ani.Sanchez L,14-8584426 E.Reed 22/332222 D.Downs11/300000Interleague Giants 2, Yankees 1San FranciscoNew York abrhbiabrhbi Pagan cf4000ISuzuki rf3000 J.Perez lf4010ARdrgz dh4010 Belt 1b4000ZAlmnt pr-dh0000 Posey dh4000Cano 2b4030 Pence rf4000ASorin lf3000 Sandovl 3b2010Grndrs cf4000 Noonan pr0100Nunez 3b4020 HSnchz c3000MrRynl 1b4111 Abreu 2b3011Ryan ss4020 Adrianz ss3111CStwrt c2000 Overay ph0000 V.Wells ph1000 JMrphy c1000 Totals31242Totals34191 San Francisco0000010102 New York0010000001 ECano (6). DPNew York 1. LOBSan Francisco 3, New York 8. 2BSandoval (26), Abreu (10), Cano (38), Ryan (12). HRAdrianza (1), Mar.Reynolds (20). CSI.Suzuki (4). IPHRERBBSO San Francisco Petit61/361127 J.Lopez W,4-22/300002 S.Casilla H,21130001 Romo S,36-41100001 New York Pettitte L,10-11722216 D.Robertson1/310000 M.Rivera12/310001 NL Braves 5, Cubs 2Atlanta Chicago abrhbi abrhbi Heywrd cf5110StCastr ss4001 J.Upton rf-lf5020Valuen 3b3000 FFrmn 1b5132DMrph ph-3b1000 CJhnsn 3b4000Rizzo 1b4110 Janish 3b1000DNavrr c4021 McCnn c4120Schrhlt rf4010 Gattis lf3000Bogsvc cf4010 JSchafr rf1000Lake lf4000 Smmns ss4223Barney 2b3120 ElJhns 2b3010EJcksn p1000 Tehern p2000Russell p0000 Constnz ph1010BParkr p0000 Avilan p0000Raley p0000 RJhnsn ph1000Sweeny ph1010 Ayala p0000HRndn p0000 A.Wood p0000 Kimrel p0000 Totals395 125Totals33282 Atlanta2001000205 Chicago1000000102 ESt.Castro (20). DPAtlanta 1, Chicago 1. LOBAtlanta 8, Chicago 5. 2BRizzo (39). HRF.Freeman (23), Simmons 2 (17). CS Constanza (3). SE.Jackson. IPHRERBBSO Atlanta Teheran W,13-8641107 Avilan H,26100001 Ayala 1/321100 A.Wood H,12/300000 Kimbrel S,49-53120003 Chicago E.Jackson L,8-17683306 Russell 2/300001 B.Parker010000 Raley 11/322213 H.Rondon 110002Marlins 4, Nationals 2 First GameMiami Washington abrhbi abrhbi Coghln lf3000Span cf3100 Ruggin cf1000Zmrmn 3b4122 DSolan 2b4021Werth rf4000 Yelich cf-lf5221Harper lf3000 Stanton rf4112Dsmnd ss2000 Morrsn 1b4020AdLRc 1b3010 Polanc 3b4020Lmrdzz 2b3010 Hchvrr ss3020JSolano c2000 Mathis c4000ZWltrs ph1000 Koehler p2000Leon c0000 Pierre ph1110Haren p1000 MDunn p0000CBrwn ph1000 Qualls p0000Matths p0000 Dobbs ph1000XCeden p0000 Cishek p0000Storen p0000 Tracy ph1000 EDavis p0000 Totals364 124Totals28242 Miami 2010001004 Washington0000020002 DPMiami 3, Washington 2. LOBMiami 8, Washington 1. 2BYelich (11). HRYelich (4), Stanton (24), Zimmerman (26). SBPierre (23). SFD.Solano. IPHRERBBSO Miami Koehler W,4-10632210 M.Dunn H,17100001 Qualls H,14110000 Cishek S,32-34100002 Washington Haren L,9-14683315 Mattheus 1/311110 X.Cedeno 2/300000 Storen 120001 E.Davis 110002Nationals 5, Marlins 4 Second GameMiami Washington abrhbi abrhbi DSolan 2b4110Span cf5123 Lucas 1b4010Zmrmn 3b5011 Yelich lf4111Werth rf5020 Stanton rf4121EPerez pr0100 Ruggin cf4111Harper lf5000 Coghln 3b2000Dsmnd ss3010 Hchvrr ss4011WRams c4010 K.Hill c4000TMoore 1b1000 Flynn p1010Koerns pr0100 Pierre ph1000AdLRc 1b0000 R.Webb p0000Rendon 2b4110 DJnngs p0000Strasrg p1000 Caminr p0000Lmrdzz ph1110 Morrsn ph0000Stmmn p0000 ARams p0000Clipprd p0000 Dobbs ph1000Tracy ph1000 SDyson p0000RSorin p0000 Totals33484Totals35594 Miami 1101000104 Washington0020020015 One out when winning run scored. ECoghlan 2 (3). DPWashington 2. LOB Miami 5, Washington 12. 2BD.Solano (13), Yelich (12), Stanton (25), Werth (24), Lombardozzi (15). HRRuggiano (18). SBCoghlan (1), Span (19), E.Perez (1), Desmond 2 (21). SStrasburg. IPHRERBBSO Miami Flynn 442235 R.Webb11/322200 Da.Jennings BS,2-2010000 Caminero 2/300001 A.Ramos 210011 S.Dyson L,0-21/311010 Washington Strasburg 663326 Stammen H,7100010 Clippard BS,3-3121102 R.Soriano W,3-3100001Mets 4, Phillies 3New York Philadelphia abrhbi abrhbi EYong lf5120CHrndz cf5010 Flores 3b5010Rollins ss4110 DnMrp 2b4110Utley 2b4020 ABrwn rf4001Ruiz c4110 Black p0000DBrwn lf2111 Hwkns p0000Ruf rf3001 Duda 1b3000Asche 3b4000 Lagars cf4131Frndsn 1b4021 Recker c4120Berndn pr0000 Tovar ss4021Cl.Lee p2010 CTorrs p2000Orr ph1000 Satin ph1000Rosnrg p0000 Atchisn p0000Papeln p0000 dnDkkr rf1000Galvis ph0000 Totals374 113Totals33393 New York0001002104 Philadelphia0100010103 ED.Brown (5). DPNew York 1, Philadelphia 1. LOBNew York 7, Philadelphia 8. 2B E.Young (26), Flores (5), Lagares (21), Recker (7), Rollins (32), Frandsen (10). SBTovar (1). SGalvis. IPHRERBBSO New York C.Torres W,4-5672236 Atchison H,9100002 Black H,4 111111 Hawkins S,12-15110002 Philadelphia Cl.Lee L,14-7783208 Rosenberg 121111 Papelbon 110002 Rays scheduleSept. 23 vs Baltimore Sept. 24 at N.Y. Yankees Sept. 25 at N.Y. Yankees Sept. 26 at N.Y. Yankees Sept. 27 at Toronto Sept. 28 at Toronto Sept. 29 at Toronto West Division WLPctGBWCL10StrHomeAway x-Oakland9363.5968-2W-452-2941-34 Texas8471.542813-7L-139-3545-36 Los Angeles7679.4901697-3L-137-4139-38 Seattle6888.43625183-7W-133-4235-46 Houston51105.32742351-9L-924-5427-51 East Division WLPctGBWCL10StrHomeAway x-Boston9562.6056-4W-153-2842-34 Tampa Bay8669.55587-3W-350-3036-39 New York8274.5261244-6L-146-3236-42 Baltimore8174.5231344-6L-442-3339-41 Toronto7184.45823144-6L-138-4033-44 East Division WLPctGBWCL10StrHomeAway x-Atlanta9263.5945-5W-152-2240-41 Washington8472.538857-3W-147-3437-38 New York7184.45821177-3W-332-4539-39 Philadelphia7184.45821174-6L-443-3828-46 Miami5799.36535323-7L-131-4426-55 Central Division WLPctGBWCL10StrHomeAway z-St. Louis9165.5836-4L-148-2743-38 Cincinnati8967.57127-3W-148-2641-41 Pittsburgh8967.57124-6L-150-3139-36 Milwaukee6986.44521196-4W-137-4432-42 Chicago6591.41726243-7L-130-4835-43 West Division WLPctGBWCL10StrHomeAway x-LA9066.5774-6W-246-3244-34 Arizona7976.5101096-4W-244-3435-42 San Diego7283.46517166-4L-242-3530-48 San Fran.7284.46218176-4W-138-3834-46 Colorado7186.45219184-6L-244-3527-51 Central Division WLPctGBWCL10StrHomeAway Detroit9165.5837-3L-151-3040-35 Cleveland8670.55158-2W-449-3037-40 Kansas City8273.529836-4W-144-3738-36 Minnesota6590.41925202-8L-431-4334-47 Chicago6194.39429243-7W-135-4126-53 AMERICAN LEAGUE NATIONAL LEAGUE CITRUSCOUNTY(FL) CHRONICLEMAJORLEAGUEBASEBALL B2MONDAY, SEPTEMBER23, 2013 PAGE 13 SCOREBOARDCITRUSCOUNTY(FL) CHRONICLE disqualified for a tire infraction following another first-place finish last Saturday. He now leads James Johnston by 10 points with three races to go. James Holly finished second in the Pure Stock race but was disqualified along with Lecantos Happy Florian after tech inspection, leaving Inverness Jason Waller and Floral Citys Sport Wilson to second and third place, respectively. It was the third and fourth disqualification in the class over the past three weeks. In Street Stocks, Flanagan went low on thenleader Dora Thorne on the fourth turn of lap 12 en route to his track-leading ninth feature win of the season. It was the 46th all-time win for Flanagan in his No. 3. He also won his sixth heat victory of the year. Thorne came in second, one spot ahead of J.D. Goff. Dr. Kennedy mounted a lead for good on lap 4 of the Mini Stock feature after briefly claiming the front moments before a caution on 3. Mark Patterson, who said he was just happy to have enough fuel in his tank to survive an abundance of caution laps, finished second by holding off third-place finisher Tim Sharrone, who was making his first outing of the season in preparation for next weeks multi-prize event. Marks learned a lot over the last couple seasons here, Sharrone said of the 15-year-old Patterson. Hes going to be reckoned with here real shortly. We just kind of stuck this car together to get it ready for next weeks 50-lapper no tires, nothing, just the way we bought it. Thats all we needed this week, and well be ready for next week. Meyer held the front wire-to-wire for his Pro Figure 8 win, but gave the credit to second-place finisher and division-leader Joey Catarelli, a fellow Pinellas Park driver. Ive got to thank Joey Catarelli for all the help, Meyer said. He sets up the car. Largos Justin Meyer took third. SPEEDWAYContinued from Page B1 On the AIRWAVES TODAYS SPORTS TV BASEBALL 3 p.m. (MLB, SUN) Baltimore Orioles at Tampa Bay Rays 7 p.m. (FSNFL) Philadelphia Phillies at Miami Marlins 8 p.m. (MLB) Washington Nationals at St. Louis Cardinals or Houston Astros at Texas Rangers BASKETBALL 5 p.m. (NBA) FIBA EuroBasket 2013, Gold Medal Game: Teams TBA (taped) 7 p.m. (NBA) WNBA Eastern Conference Semifinal Washington Mystics at Atlanta Dream. Game 3. (If necessary) 10 p.m. (ESPN2) WNBA Western Conference Semifinal Phoenix Mercury at Los Angeles Sparks. Game 3. (If necessary) COLLEGE FOOTBALL 6 a.m. (FSNFL) Louisiana-Monroe at Baylor. (taped) 10 a.m. (SUN) Bethune-Cookman at Florida State. (taped) 12:30 p.m. (FS1) Arizona State at Stanford. (taped) 8 p.m. (ESPNU) Teams TBA. (taped) 12 a.m. (ESPNU) San Jose State at Minnesota. (taped) 12 a.m. (SUN) Texas State at Texas Tech. (taped) 4:30 a.m. (ESPN2) Arkansas at Rutgers. (taped) NFL FOOTBALL 8:25 p.m. (ESPN) Oakland Raiders at Denver Broncos NHL PRESEASON HOCKEY 3 p.m. (NHL) Chicago Blackhawks at Detroit Red Wings (taped) 7 p.m. (NHL) Washington Capitals at Boston Bruins 10 p.m. (NHL) Phoenix Coyotes at Vancouver Canucks RADIO 2:30 p.m. (WYKE 104.3 FM) Tampa Bay Rays pregame 3:10 p.m. (WYKE 104.3 FM) Baltimore Orioles at Tampa Bay Rays Note: Times and channels are subject to change at the discretion of the network. If you are unable to locate a game on the listed channel, please contact your cable provider. Prep CALENDAR TODAYS PREP SPORTS VOLLEYBALL 6:30 p.m. St. John Lutheran at Seven Rivers 6:30 p.m. Nature Coast at Citrus 7 p.m. Lecanto at The Villages Citrus County SpeedwayRace finishes for Sept. 21 Open Wheel Mods No.Driver Hometown 01Herb Neumann Jr.Inverness 0Troy RobinsonWesley Chapel 42Richie SmithHernando 2Steven HiseInverness 17Rick Coffin Lutz 18Shane ButlerBushnell 43Gator Hise Inverness 127Kyle MaynardWeirsdale Sportsman No.Driver Hometown 111Charlie BrownLakeland 13Aaron WilliamsonLakeland 17Mike Bell Brooksville 4Jay Witfoth Beverly Hills 21Daniel WebsterBrooksville 51Chris HarveyOcala 66Andy NichollsOrlando 37Kenner BrownJacksonville 78Robert Kuhn Jr.Dunnellon 114John BuzinecSummerfield 01Tom PosavecDunnellon 88Craig CuzzoneLakeland 14Dave ColprittLakeland 20Kyle MaynardWeirsdale 199Brett JenkinsLakeland Street Stocks No.Driver Hometown 3Curtis FlanaganInverness 48Dora ThorneFloral City 16J.D. Goff Brooksville 8Tim Wilson Floral City 99Bubba MartoneFloral City 31Jeff Eberly Spring Hill 25Charles SamplesWebster 01Shannon LengellBrooksville 6Phillip RobinsonWebster Mini Stocks No.Driver Hometown 20Shannon KennedySummerfield 22Mark PattersonWebster 77Tim SharroneBushnell 43Shawn JenkinsLakeland 11Jerry DanielsWeirsdale 98Kevin StoneDade City 73Jason TerryBelleview 21Kevin EdwardsCrystal River 6Chris HennessyBeverly Hills 81Terry JacksonBrooksville 77Kevin Knox Wesley Chapel Pure Stocks No.Driver Hometown 72Karlin Ray Floral City 3Jason WallerInverness 185Sport WilsonFloral City 0Steve StinedufWeeki Wachee 45James JohnstonBrooksville 39Carl Peters Winter Garden 19Bill Ryan Bushnell 15Ray CuzzoneLakeland 44Glen ColyerHomosassa 09James HollyWeirsdale 65Happy FlorianLecanto Pro Figure Eights No.Driver Hometown 94Charlie MeyerPinellas Park 6Joey CatarelliPinellas Park 86Justin MeyerLargo 15William StansburyInverness 01Shannon LengellBrooksville 33Pnut HigginbothamBrooksvilleNASCAR Sprint CupSylvania 300 Sunday.AP Top 25The Top 25 teams in The Associated Press college football poll, with first-place votes in parentheses, records through Sept. 21, total points based on 25 points for a first-place vote through one point for a 25th-place vote, and previous ranking: RecordPtsPv 1. Alabama (56)3-01,4961 2. Oregon (4)3-01,4182 3. Clemson3-01,3403 4. Ohio St.4-01,3204 5. Stanford3-01,2705 6. LSU4-01,1676 7. Louisville4-01,0887 8. Florida St.3-01,0498 9. Georgia 2-11,0299 10. Texas A&M 3-11,01110 11. Oklahoma St.3-084911 12. South Carolina2-182812 13. UCLA 3-079813 14. Oklahoma 3-068914 15. Miami 3-068716 16. Washington3-055917 17. Northwestern4-047718 18. Michigan 4-045015 19. Baylor 3-044120 20. Florida 2-141419 21. Mississippi 3-034221 22. Notre Dame3-125622 23. Wisconsin 3-113024 24. Texas Tech 4-012725 25. Fresno St. 3-0110NR Top 25The USA Today Top 25 football coaches poll, with first-place votes in parentheses, records through Sept. 21, total points based on 25 points for first place through one point for 25th, and previous ranking: RecordPtsPvs 1. Alabama (59)3-01,5471 2. Oregon (3)3-01,4802 3. Ohio St.4-01,3993 4. Clemson3-01,3324 5. Stanford3-01,3125 6. LSU4-01,1617 7. Louisville4-01,1406 8. Florida St.3-01,1218 9. Texas A&M3-11,0449 10. Georgia2-11,02010 11. Oklahoma St.3-090911 12. Oklahoma3-086312 13. South Carolina2-182513 14. UCLA3-073115 15. Miami3-061317 16. Northwestern4-056016 17. Michigan4-053414 18. Baylor3-046519 19. Florida2-144918 20. Washington3-042720 21. Mississippi3-033122 22. Notre Dame3-131721 23. Fresno St.3-015625 24. Wisconsin3-198NR 25. Texas Tech4-092NR.Royals 4, Rangers 0, 10 inn.Texas Kansas City abrhbi abrhbi Kinsler 2b4010AGordn lf4000 Andrus ss4020Bonifac 2b4000 Rios rf4000Hosmer 1b3010 ABeltre 3b4020BButler dh3010 Przyns c4000Getz pr0100 Morlnd 1b4000S.Perez c4110 Gentry lf4010Mostks 3b4000 DvMrp dh3000L.Cain cf3000 JeBakr ph1000Kottars ph1100 LMartn cf2000Maxwll rf4124 AEscor ss2000 Totals34060Totals32454 Texas00000000000 Kansas City00000000044 Two outs when winning run scored. DPTexas 1, Kansas City 1. LOBTexas 5, Kansas City 2. 2BA.Beltre (30), Gentry (11), Hosmer (33). HRMaxwell (7). SBRios (39). CSAndrus (8), L.Martin (9). SA.Escobar. IPHRERBBSO Texas Ogando720015 Scheppers11/300003 Cotts L,5-32/311101 Soria2/323310 Kansas City Shields860012 G.Holland100001 Collins W,3-6100001Reds 11, Pirates 3Cincinnati Pittsburgh abrhbi abrhbi BHmltn cf6230Tabata lf3100 Heisey lf5332NWalkr 2b2121 MParr p0000McCtch cf4000 N.Soto ph1000SMarte cf0000 Ondrsk p0000Mornea 1b2001 Votto 1b4221Byrd rf4000 BPhllps 2b3121JHrrsn rf0000 Bruce rf5124PAlvrz 3b4010 Frazier 3b5112RMartn c2000 Cozart ss5120Buck c2000 Hanign c5000Barmes ss4010 Arroyo p2000Locke p0000 Simon p0000JGomz p0000 DRonsn ph2011Lambo ph1000 Cumptn p0000 Snider ph1111 Pimntl p0000 Pie ph1000 Mazzar p0000 JHughs p0000 GJones ph1000 Totals43111611Totals31353 Cincinnati52000003111 Pittsburgh0010200003 EBarmes 2 (13). LOBCincinnati 9, Pittsburgh 6. 2BB.Hamilton (2), Heisey (11), Votto (30), Bruce (42), Cozart (28), N.Walker (24). HRFrazier (18), N.Walker (13), Snider (5). SBB.Hamilton 2 (12). SArroyo. SF B.Phillips, Morneau. IPHRERBBSO Cincinnati Arroyo W,14-11553323 Simon 200010 M.Parra 100001 Ondrusek 100002 Pittsburgh Locke L,10-7135521 J.Gomez 132200 Cumpton 330003 Pimentel 200001 Mazzaro 2/333301 J.Hughes 11/341100Dodgers 1, Padres 0Los AngelesSan Diego abrhbiabrhbi Puig rf4000Amarst lf2000 Florida LOTTERY Here are the winning numbers selected Sunday in the Florida Lottery: CASH 3 (early) 2 9 6 CASH 3 (late) 6 9 6 PLAY 4 (early) 3 0 9 7 PLAY 4 (late) 2 0 5 5 FANTASY 5 9 13 15 18 26 Players should verify winning numbers by calling 850-487-7777 or at. Saturdays winning numbers and payouts: Powerball: 12 17 45 54 58 Powerball: 13 5-of-5 PBNo winner No Florida winner 5-of-55 winners$1 million 1 Florida winner Lotto: 8 32 35 46 47 52 6-of-6No winner 5-of-621$7,714 4-of-61,364$87 3-of-628,402$5.50 Fantasy 5: 4 7 31 32 35 5-of-51 winner$259,129.62 4-of-5287$145.50 3-of-59,894$11.50MONDAY, SEPTEMBER23, 2013 B3 Crwfrd lf4000Denorfi ph-lf-rf2000 HRmrz ss3010RCeden ss4000 Withrw p0000Venale rf-cf3000 VnSlyk ph0000Gyorko 2b4010 Ethier ph1000Medica 1b3000 Jansen p0000Forsyth 3b3000 AdGnzl 1b4110Fuents cf1000 Kemp cf3000Kotsay ph1000 MYong 3b3010Blanks lf0000 Schmkr 2b3000RRiver c3010 Fdrwcz c3000Cashnr p1000 Greink p1010Vincent p0000 HrstnJr ph1000Headly ph1000 Howell p0000Hynes p0000 Punto ss1000Grgrsn p0000 Totals31140Totals28020 Los Angeles0000001001 San Diego0000000000 EAd.Gonzalez (11), Venable (3). DPLos Angeles 1. LOBLos Angeles 3, San Diego 5. 2BM.Young (25), Greinke (3). SBVenable (22). SCashner. IPHRERBBSO Los Angeles Greinke520013 Howell W,4-1100000 Withrow H,4200022 Jansen S,27-31100003 San Diego Cashner L,10-9741007 Vincent100003 Hynes1/300001 Gregerson2/300002Athletics 11, Twins 7MinnesotaOakland abrhbiabrhbi Presley cf5220Crisp cf4124 Dozier 2b5231Lowrie ss5221 Plouffe 3b4100Dnldsn 3b4011 Arcia lf4136Moss lf4111 Pinto dh5010Cespds dh5000 Parmel 1b4010Reddck rf2101 Mstrnn rf3000Barton 1b3331 Flormn ss3010Vogt c3100 Fryer c3110Sogard 2b3222 Totals367127Totals331111 11 Minnesota1030001027 Oakland06111110x11 EGray (1). DPOakland 2. LOBMinnesota 7, Oakland 6. 2BDozier (33), Fryer (1), Donaldson (37), Moss (22), Barton (2). HRArcia (14), Crisp (22), Lowrie (14), Barton (3). SB Crisp (20), Sogard (9). SFMoss, Reddick. IPHRERBBSO Minnesota De Vries L,0-1246631 Martis222201 Roenicke11/332220 Duensing12/321111 Thielbar100002 Oakland Gray W,4-3574423 Bre.Anderson221103 Cook100033 Scribner132202Mariners 3, Angels 2Seattle Los Angeles abrhbi abrhbi AAlmnt cf4010Shuck lf4000 FGtrrz rf4010Aybar ss5000 Seager 3b4100Trout cf3000 KMorls dh4120JHmltn dh4010 EnChvz pr0000HKndrc 2b5110 Smoak 1b4112Calhon rf-1b4111 Zunino c4011Conger c2000 Frnkln 2b4010ENavrr 1b3011 MSndrs lf2000Cowgill pr-rf0000 Triunfl ss3010AnRmn 3b3010 Totals333 83Totals33252 Seattle0100020003 Los Angeles0100000102 ETriunfel (2). DPLos Angeles 2. LOB Seattle 4, Los Angeles 13. 2BK.Morales (33), Zunino (5), H.Kendrick (19). HRSmoak (18), Calhoun (8). SBSeager (9), Shuck (8), E.Navarro (1). IPHRERBBSO Seattle F.Hernandez4111410 O.Perez W,3-3100003 Capps H,9 110012 Furbush H,202/300020 Medina H,1811/321110 Farquhar S,15-19110000 Los Angeles C.Wilson L,17-781/383319 Kohn 2/300001Diamondbacks 13, Rockies 9Arizona Colorado abrhbi abrhbi Eaton lf5032Blckmn cf6131 Pollock cf5131LeMahi 2b6010 Gldsch 1b4111Tlwtzk ss2210 A.Hill 2b5230Cuddyr rf5031 MMntr c3310Culersn lf5210 Davdsn 3b4124Helton 1b5134 GParra rf5232Arenad 3b5220 Owings ss5222Torreal c4121 Corbin p2000Nicasio p0000 WHarrs p0000Francis p1000 Pnngtn ph1000Rutledg ph1010 Roe p0000Pomrnz p0000 Putz p0000CDckrs ph1000 Campn ph1000WLopez p0000 DHrndz p0000Outmn p0000 Blmqst ph1111Ottavin p0000 Cllmntr p0000RWhelr ph1011 Ziegler p0000Bettis p0000 Corpas p0000 Pachec ph1011 Totals41131913Totals439199 Arizona04300100513 Colorado0011200149 EPollock (2). DPArizona 2, Colorado 2. LOBArizona 7, Colorado 11. 2BPollock (27), Goldschmidt (34), Davidson (4), G.Parra (41), Owings 2 (3), Culberson (5), Helton 2 (21), Arenado (27). 3BBloomquist (1). HRDavidson (3). CSLeMahieu (7). SFEaton. IPHRERBBSO Arizona Corbin 41/3104423 W.Harris W,4-12/300010 Roe 110001 Putz 110000 D.Hernandez121100 Collmenter2/334410 Ziegler 1/320000 Colorado Nicasio L,8-921/377721 Francis 12/330002 Pomeranz100001 W.Lopez 131110 Outman 100011 Ottavino 120000 Bettis 1/345510 Corpas 2/300000Brewers 6, Cardinals 4St. Louis Milwaukee abrhbi abrhbi MCrpnt 2b3221Aoki rf2321 Jay cf5020Gennett 2b4121 Beltran rf3011Lucroy 1b3111 MAdms 1b5000YBtncr 1b0000 YMolin c3110ArRmr 3b4011 Freese 3b3110CGomz cf4011 Descals ss4010LSchfr lf4000 SRonsn lf3001Bianchi ss4010 J.Kelly p2001Maldnd c4100 Axford p0000WPerlt p1000 Chamrs ph1000D.Hand p0000 JFrncs ph1000 Kintzlr p0000 Hndrsn p0000 Totals324 84Totals31685 St. Louis0010020014 Milwaukee22000020x6 EY.Molina (4), Freese (11), J.Kelly (3). DP St. Louis 1, Milwaukee 1. LOBSt. Louis 9, Milwaukee 5. 2BAoki (17), Gennett (11), Lucroy (24). 3BC.Gomez (10). HRM.Carpenter (11). SBC.Gomez (37). SW.Peralta. SF S.Robinson, J.Kelly, Lucroy. IPHRERBBSO St. Louis J.Kelly L,9-5776322 Axford 110001 Milwaukee W.Peralta W,11-15553353 D.Hand H,2200003 Kintzler H,25100001 Henderson S,26-30131102 Kenseth wins second race in the Chase Associated Press hes a two-time winner. He led 29 laps there earlier this year before an engine failure ended his day. For me to win at Loudon, itsve carried over their success into the Chase and are a credible 1-2 threat to give Toyota its first Sprint Cup title. Theres somebody faster so it doesnt matter how fast I am, Busch said. JGR has won five of the last seven races dating to Buschs. Its. Associated PressMatt Kenseth celebrates Sunday after winning the NASCAR Sprint Cup Series race at New Hampshire Motor Speedway in Loudon, N.H. PAGE 14 CITRUSCOUNTY(FL) CHRONICLENATIONALFOOTBALLLEAGUE AMERICAN CONFERENCEEast WLTPctPFPAHomeAwayAFCNFCDiv New England3001.00059342-0-01-0-02-0-01-0-02-0-0 Miami3001.00074531-0-02-0-02-0-01-0-00-0-0 N.Y. Jets210.66755502-0-00-1-01-1-01-0-01-1-0 Buffalo120.33365731-1-00-1-00-2-01-0-00-2-0 South WLTPctPFPAHomeAwayAFCNFCDiv Houston210.66770821-0-01-1-02-1-00-0-01-0-0 Indianapolis210.66768481-1-01-0-01-1-01-0-00-0-0 Tennessee210.66760561-0-01-1-02-1-00-0-00-1-0 Jacksonville030.00028920-1-00-2-00-2-00-1-00-0-0 North WLTPctPFPAHomeAwayAFCNFCDiv Cincinnati210.66775642-0-00-1-01-0-01-1-01-0-0 Baltimore210.66771642-0-00-1-02-1-00-0-01-0-0 Cleveland120.33347640-1-01-1-00-2-01-0-00-1-0 Pittsburgh030.00042760-2-00-1-00-2-00-1-00-1-0 West WLTPctPFPAHomeAwayAFCNFCDiv Kansas City3001.00071341-0-02-0-01-0-02-0-00-0-0 Denver2001.00090501-0-01-0-01-0-01-0-00-0-0 Oakland110.50036301-0-00-1-01-1-00-0-00-0-0 San Diego120.33378810-1-01-1-00-2-01-0-00-0-0NATIONAL CONFERENCEEast WLTPctPFPAHomeAwayNFCAFCDiv Dallas210.66783552-0-00-1-02-0-00-1-01-0-0 Philadelphia120.33379860-2-01-0-01-0-00-2-01-0-0 N.Y. Giants030.000541150-1-00-2-00-2-00-1-00-1-0 Washington030.00067980-2-00-1-00-3-00-0-00-1-0 South WLTPctPFPAHomeAwayNFCAFCDiv New Orleans3001.00070382-0-01-0-03-0-00-0-02-0-0 Carolina120.33368361-1-00-1-01-1-00-1-00-0-0 Atlanta120.33371741-0-00-2-01-1-00-1-00-1-0 Tampa Bay030.00034570-1-00-2-00-1-00-2-00-1-0 North WLTPctPFPAHomeAwayNFCAFCDiv Chicago3001.00095742-0-01-0-01-0-02-0-01-0-0 Detroit210.66782691-0-01-1-02-1-00-0-01-0-0 Green Bay120.33396881-0-00-2-01-1-00-1-00-0-0 Minnesota030.00081960-1-00-2-00-2-00-1-00-2-0 West WLTPctPFPAHomeAwayNFCAFCDiv Seattle3001.00086272-0-01-0-02-0-01-0-01-0-0 St. Louis120.33358861-0-00-2-01-2-00-0-01-0-0 San Francisco120.33344841-1-00-1-01-1-00-1-00-1-0 Arizona120.33356791-0-00-2-01-2-00-0-00-1-0 Patriots 23, Buccaneers 3Tampa Bay 30003 New England0173323 First Quarter TBFG Lindell 30, 1:47. Second Quarter NEThompkins 16 pass from Brady (Gostkowski kick), 7:31. NEThompkins 5 pass from Brady (Gostkowski kick), :47. NEFG Gostkowski 53, :00. Third Quarter NEFG Gostkowski 46, 3:38. Fourth Quarter NEFG Gostkowski 33, 8:19. A,756. TBNE First downs 1821 Total Net Yards323358 Rushes-yards22-9733-156 Passing 226202 Punt Returns1-122-29 Kickoff Returns0-01-24 Interceptions Ret.1-01-0 Comp-Att-Int19-41-125-36-1 Sacked-Yards Lost3-103-23 Punts 3-49.73-42.7 Fumbles-Lost0-00-0 Penalties-Yards4-486-50 Time of Possession26:5933:01 INDIVIDUAL STATISTICS RUSHINGTampa Bay, Martin 20-88, James 1-5, Freeman 1-4. New England, Blount 14-65, Bolden 3-51, Ridley 11-35, Brady 5-5. PASSINGTampa Bay, Freeman 19-41-1236. New England, Brady 25-36-1-225. RECEIVINGTampa Bay, Williams 5-65, Page 3-55, Jackson 3-34, Ogletree 2-35, Martin 2-20, Leonard 1-17, Wright 1-6, Byham 1-3, Lorig 1-1. New England, Dobson 7-52, Edelman 7-44, Bolden 5-49, Thompkins 3-41, Hoomanawanui 2-31, Ridley 1-8. MISSED FIELD GOALSTampa Bay, Lindell 38 (WR).Colts 27, 49ers 7Indianapolis 7331427 San Francisco70007 First Quarter IndRichardson 1 run (Vinatieri kick), 11:20. SFHunter 13 run (Dawson kick), 4:13. Second Quarter IndFG Vinatieri 43, 7:00. Third Quarter IndFG Vinatieri 41, 6:46. Fourth Quarter IndLuck 6 run (Vinatieri kick), 4:13. IndBradshaw 1 run (Vinatieri kick), 2:55. A,732. IndSF First downs 2314 Total Net Yards336254 Rushes-yards39-17923-115 Passing 157139 Punt Returns2-161-14 Kickoff Returns0-03-36 Interceptions Ret.1-10-0 Comp-Att-Int18-27-013-27-1 Sacked-Yards Lost1-73-11 Punts 4-48.07-43.6 Fumbles-Lost0-01-1 Penalties-Yards1-106-48 Time of Possession36:2523:35 INDIVIDUAL STATISTICS RUSHINGIndianapolis, Bradshaw 19-95, Richardson 13-35, D.Brown 3-25, Luck 4-24. San Francisco, Gore 11-82, Kaepernick 7-20, Hunter 4-14, Dixon 1-(minus 1). PASSINGIndianapolis, Luck 18-27-0-164. San Francisco, Kaepernick 13-27-1-150. RECEIVINGIndianapolis, Wayne 5-63, Heyward-Bey 5-59, Bradshaw 3-16, Fleener 2-13, Hilton 2-13, Havili 1-0. San Francisco, Boldin 5-67, Gore 2-21, K.Williams 2-12, Celek 1-30, Miller 1-10, V.McDonald 1-6, Hunter 1-4. MISSED FIELD GOALSIndianapolis, Vinatieri 51 (WL).Cowboys 31, Rams 7St. Louis 00707 Dallas 1077731 First Quarter DalBryant 2 pass from Romo (Bailey kick), 7:06. DalFG Bailey 19, 2:06. Second Quarter DalMurray 2 run (Bailey kick), 9:10. Third Quarter DalEscobar 24 pass from Romo (Bailey kick), 11:39. StLPettis 4 pass from Bradford (Zuerlein kick), 3:20. Fourth Quarter DalHarris 24 pass from Romo (Bailey kick), 11:55. A,848. StLDal First downs 1721 Total Net Yards232396 Rushes-yards12-3534-193 Passing 197203 Punt Returns2-164-16 Kickoff Returns2-460-0 Interceptions Ret.0-00-0 Comp-Att-Int29-49-017-24-0 Sacked-Yards Lost6-431-7 Punts 5-47.64-48.8 Fumbles-Lost1-12-1 Penalties-Yards5-416-72 Time of Possession26:3233:28 INDIVIDUAL STATISTICS RUSHINGSt. Louis, Pead 6-20, Cunningham 4-16, Austin 1-3, Givens 1-(minus 4). Dallas, Murray 26-175, Dunbar 5-19, Tanner 3-(minus 1). PASSINGSt. Louis, Bradford 29-48-0-240, Hekker 0-1-0-0. Dallas, Romo 17-24-0-210. RECEIVINGSt. Louis, Pead 7-43, Austin 630, Cook 5-44, Kendricks 5-36, Givens 2-54, Pettis 2-20, Quick 1-7, Cunningham 1-6. Dallas, Witten 5-67, Bryant 4-38, Murray 3-28, Austin 2-22, Escobar 1-24, Harris 1-24, Beasley 1-7. MISSED FIELD GOALSDallas, Bailey 35 (WR).Seahawks 45, Jaguars 17Jacksonville 0010717 Seattle 71714745 First Quarter SeaMiller 1 pass from Wilson (Hauschka kick), 8:04. Second Quarter SeaMiller 4 pass from Wilson (Hauschka kick), 14:26. SeaFG Hauschka 21, 9:40. SeaRice 11 pass from Wilson (Hauschka kick), :10. Third Quarter SeaRice 23 pass from Wilson (Hauschka kick), 11:41. JaxJones-Drew 2 run (Scobee kick), 6:20. SeaBaldwin 35 pass from Jackson (Hauschka kick), 1:28. JaxFG Scobee 33, :06. Fourth Quarter JaxTodman 3 run (Scobee kick), 9:06. SeaJackson 5 run (Hauschka kick), 6:32. A,087. JaxSea First downs 1728 Total Net Yards265479 Rushes-yards24-5136-156 Passing 214323 Punt Returns2-(-3)4-33 Kickoff Returns2-542-45 Interceptions Ret.1-102-32 Comp-Att-Int18-38-221-29-1 Sacked-Yards Lost4-212-8 Punts 7-42.74-35.0 Fumbles-Lost2-11-1 Penalties-Yards4-454-24 Time of Possession27:2532:35 INDIVIDUAL STATISTICS RUSHINGJacksonville, Jones-Drew 19-43, Henne 2-5, Todman 2-5, Robinson 1-(minus 2). Seattle, Lynch 17-69, Michael 9-37, Tate 2-29, Wilson 2-14, Turbin 3-5, Jackson 3-2. PASSINGJacksonville, Henne 18-38-2235. Seattle, Wilson 14-21-1-202, Jackson 78-0-129. RECEIVINGJacksonville, Shorts 8-143, Burton 5-42, Sanders 2-25, Jones-Drew 219, Taufoou 1-6. Seattle, Tate 5-88, Rice 579, Willson 5-76, Davis 2-31, Miller 2-5, Baldwin 1-35, Kearse 1-17. MISSED FIELD GOALSNone. Dolphins 27, Falcons 23Atlanta 767323 Miami 01010727 First Quarter AtlSnelling 7 pass from Ryan (Bryant kick), 6:12. Second Quarter AtlFG Bryant 52, 13:02. MiaDan.Thomas 5 run (Sturgis kick), 10:06. AtlFG Bryant 20, 2:04. MiaFG Sturgis 46, :00. Third Quarter AtlToilolo 2 pass from Ryan (Bryant kick), 12:40. MiaFG Sturgis 50, 9:12. MiaHartline 18 pass from Tannehill (Sturgis kick), :56. Fourth Quarter AtlFG Bryant 33, 11:39. MiaSims 1 pass from Tannehill (Sturgis kick), :38. A,660. AtlMia First downs 2416 Total Net Yards377285 Rushes-yards30-14615-90 Passing 231195 Punt Returns3-40-0 Kickoff Returns0-02-48 Interceptions Ret.1-191-(-2) Comp-Att-Int23-38-124-35-1 Sacked-Yards Lost0-05-41 Punts 2-33.03-53.0 Fumbles-Lost1-12-1 Penalties-Yards7-592-13 Time of Possession37:0922:51 INDIVIDUAL STATISTICS RUSHINGAtlanta, Rodgers 18-86, Snelling 11-53, Jones 1-7. Miami, Miller 8-62, Dan.Thomas 5-21, Tannehill 2-7. PASSINGAtlanta, Ryan 23-38-1-231. Miami, Tannehill 24-35-1-236. RECEIVINGAtlanta, Jones 9-115, Snelling 4-58, Gonzalez 4-24, White 2-16, Rodgers 27, Douglas 1-9, Toilolo 1-2. Miami, Gibson 649, Hartline 4-56, Matthews 4-42, Clay 4-40, Wallace 2-22, Dan.Thomas 1-16, Egnew 18, Miller 1-2, Sims 1-1. MISSED FIELD GOALSAtlanta, Bryant 35 (WR).Jets 27, Bills 20Buffalo 066820 N.Y. Jets 7103727 First Quarter NYJSmith 8 run (Folk kick), 9:06. Second Quarter BufFG Carpenter 37, 13:45. BufFG Carpenter 23, 9:57. NYJHill 51 pass from Smith (Folk kick), 6:58. NYJFG Folk 47, :00. Third Quarter NYJFG Folk 34, 9:48. BufFG Carpenter 43, 8:18. BufFG Carpenter 26, 5:35. Fourth Quarter BufChandler 33 pass from Manuel (Johnson pass from Manuel), 10:39. NYJHolmes 69 pass from Smith (Folk kick), 9:23. A,957. BufNYJ First downs 1820 Total Net Yards328513 Rushes-yards25-12041-182 Passing 208331 Punt Returns2-43-18 Kickoff Returns1-183-53 Interceptions Ret.2-460-0 Comp-Att-Int19-42-016-29-2 Sacked-Yards Lost8-350-0 Punts 7-51.07-42.0 Fumbles-Lost2-01-0 Penalties-Yards7-8720-168 Time of Possession25:4734:13 INDIVIDUAL STATISTICS RUSHINGBuffalo, Jackson 7-72, Manuel 640, Spiller 10-9, Choice 2-(minus 1). N.Y. Jets, Powell 27-149, Green 5-14, Smith 4-14, Ivory 4-5, Bohanon 1-0. PASSINGBuffalo, Manuel 19-42-0-243. N.Y. Jets, Smith 16-29-2-331. RECEIVINGBuffalo, Johnson 6-86, Chandler 5-79, Jackson 4-37, Woods 2-35, Graham 1-5, Spiller 1-1. N.Y. Jets, Holmes 5-154, Hill 3-108, Cumberland 3-26, Kerley 2-25, Powell 2-9, Bohanon 1-9.Browns 31, Vikings 27Cleveland 7170731 Minnesota 7107327 First Quarter MinPeterson 2 run (Walsh kick), 9:13. CleGordon 47 pass from Hoyer (Cundiff kick), 4:42. Second Quarter CleCameron 19 pass from Hoyer (Cundiff kick), 14:55. MinPonder 6 run (Walsh kick), 10:12. CleFG Cundiff 38, 6:07. CleCameron 11 pass from Lanning (Cundiff kick), 3:39. MinFG Walsh 43, 1:08. Third Quarter MinPonder 8 run (Walsh kick), 2:36. Fourth Quarter MinFG Walsh 30, 10:47. CleCameron 7 pass from Hoyer (Lanning kick), :51. A,672. CleMin First downs 2321 Total Net Yards409329 Rushes-yards17-10331-134 Passing 306195 Punt Returns3-202-2 Kickoff Returns1-263-78 Interceptions Ret.1-133-36 Comp-Att-Int31-55-325-42-1 Sacked-Yards Lost3-266-33 Punts 5-46.87-46.4 Fumbles-Lost1-13-2 Penalties-Yards5-474-35 Time of Possession28:5231:08 INDIVIDUAL STATISTICS RUSHINGCleveland, Aubrey 1-34, Ogbonnaya 2-23, Gordon 1-22, Rainey 4-17, McGahee 8-9, Hoyer 1-(minus 2). Minnesota, Peterson 25-88, Ponder 5-46, Patterson 1-0. PASSINGCleveland, Hoyer 30-54-3-321, Lanning 1-1-0-11. Minnesota, Ponder 25-421-228. RECEIVINGCleveland, Gordon 10-146, Bess 7-67, Cameron 6-66, Ogbonnaya 4-30, Little 3-19, Rainey 1-4. Minnesota, Peterson 6-27, Rudolph 5-28, Jennings 3-43, Wright 335, Simpson 3-29, Patterson 2-49, Gerhart 2-14, Carlson 1-3.Ravens 30, Texans 9Houston 36009 Baltimore 0177630 First Quarter HouFG Bullock 27, 7:06. Second Quarter HouFG Bullock 29, 14:56. BalFG Tucker 28, 4:11. BalD.Smith 37 interception return (Tucker kick), 2:39. BalDoss 82 punt return (Tucker kick), :45. HouFG Bullock 47, :00. Third Quarter BalPierce 1 run (Tucker kick), 11:05. Fourth Quarter BalFG Tucker 45, 9:09. BalFG Tucker 43, 1:08. A,168. HouBal First downs 1816 Total Net Yards264236 Rushes-yards23-9431-75 Passing 170161 Punt Returns2-182-93 Kickoff Returns2-552-53 Interceptions Ret.0-01-37 Comp-Att-Int25-35-116-24-0 Sacked-Yards Lost3-242-10 Punts 5-50.44-48.5 Fumbles-Lost0-01-0 Penalties-Yards14-11310-87 Time of Possession30:3629:24 INDIVIDUAL STATISTICS RUSHINGHouston, Foster 12-54, Tate 936, Wood 2-4. Baltimore, Pierce 24-65, Leach 3-8, Draughn 4-2. PASSINGHouston, Schaub 25-35-1-194. Baltimore, Flacco 16-24-0-171. RECEIVINGHouston, Hopkins 6-60, Johnson 5-36, Daniels 5-29, Posey 3-29, Tate 3-7, Martin 2-35, Foster 1-(minus 2). Baltimore, T.Smith 5-92, Clark 4-46, Leach 2-11, Pierce 2-7, M.Brown 2-6, Stokley 1-9. Dolphins remain perfect Associated PressMIAMI GARDENSant.Colts 27, 49ers 7SAN FRANCISCO Andrew Luck threw for 164 yards and ran for a 6-yard touchdown while facing college coach Jim Harbaugh for the first time, and the Indianapolis Colts defeated the San Francisco 49ers 27-7 win.aepernicks first home loss at Candlestick Park as a starter.Seahawks 45, Jaguars 17SEATTLE Russell Wilson matched his career high with four touchdown passes two each to Sidney Rice and Zach Miller and the Seattle Seahawks dominated as expected in a 45-17 win over the Jacksonville Jaguars. Seattle improved to 3-0 for the first time since 2006, beginning a stretch of four straight games against the AFC South. And none will likely be easier than overwhelming the Jaguars..Cowboys 31, Rams 7ARLINGTON, Texas DeMarco Murray rushed for 175 yards and a touchdown, Tony Romo threw for three scores and the Dallas Cowboys beat the St. Louis Rams 31-7. Murraysrays old teammate at Oklahoma, didnt have nearly as much room to operate. He was sacked six times to end a four-game streak without one dating to last season. DeMarcus Ware had two sacks and broke Harvey Martins 30-year-old franchise record of 114.Jets 27, Bills 20EAST RUTHERFORD, N.J. Geno Smith threw two touchdown passes, including a go-ahead 69-yarder to Santonio Holmes in the fourth quarter, and the New York Jets overcame a teamrecord 20 penalties to hang on and beat the Buffalo Bills 27-20.Browns 31, Vikings 27MINNEAPOLIS Jordan Cameron caught three touchdown passes, including the go-ahead grab in the back of the end zone with 51 seconds left, and the Cleveland Browns kept the Minnesota Vikings winless with a 31-27 victory. Third-stringer Brian Hoyer threw for three scores for the Browns (1-2), the latest team to torch Minnesot. Associated PressMiami cornerback Nolan Carroll tackles Atlanta wide receiver Julio Jones during the second half Sunday in Miami Gardens. The Dolphins defeated the Falcons 27-13.B4MONDAY, SEPTEMBER23, 2013re not going to win in this league that way. The Patriots (3-0) have allowed just 34 points this season but havent. Itsays game much earlier. New England punted on its first three series as it continued to struggle without tight end Rob Gronkowski, who hasadys. BUCSContinued from Page B1 Tannehill TD pass in closing seconds defeats Falcons PAGE 15 Associated PressCINCINNATI Terence Newman returned a fumble 58 yards for a touchdown with 3:47 left Sunday,.Lions 27, Redskins 20LANDOVER, Md. The Detroit Lions took advantage of a pair of fourth-quarter bobbles, including one by Robert Griffin III, in a 27-20 win over the Washington Redskins.ahead field goal on their next drive. The Redskins (0-3) then had a touchdown pass overturned when video replay showed that Aldrick Robinson lost control of the ball.Ravens 30, Texans 9BALTIMORE Daryl Smith scored on a 37-yard interception return, Tandon Doss took a punt 82 yards for a touchdown and the Baltimore Ravens smothered the Houston Texans offense in a 30-9 victory.ubs pass and took it into the end zone with 2:39 left in the first half. Less than two minutes later, Doss eluded several tacklers during his first career punt return for a touchdown. The Baltimore defense did the rest. The Ravens have not allowed a touchdown in eight quarters since their season-opening 49-27 defeat in Denver. Schaub went 25 for 35 for 194 yards and an interception.Titans 20, Chargers 17. It was their first win over the Chargers for the franchise since 1992 when the team was in Houston and Titans coach Mike Munchak still was playing for the thenOilers. The Titans (2-1) had lost nine straight to San Diego in the skid. But Locker ended the slide by completing seven passes to six different receivers for 94 yards on the gamewinning.Panthers 38, Giants 0CHARLOTTE, N.C. Cam Newton threw three touchdown passes and ran for another, and Carolinas defense sacked Eli Manning seven times as the Panthers handed Tom Coughlin his worst defeat as coach of the New York Giants, 38-0. It was the largest margin of victory in Panthers history, and might help save coach Ron River.Saints 31, Cardinals 7NEW ORLEANS Drew Brees passed for three scores and scrambled for New Orleans first touchdown rushing of the season, leading the Saints to a 31-7 victory over the Arizona Cardinals.zon. Bears 40, Steelers 23PITTSBURGH Chicagos defense forced five turnovers and scored twice, and the Bears beat the Pittsburgh Steelers 40-23 to remain unbeaten. Major Wright returned an interception 38 yards for a touchdown in the second quarter, and Julius Peppers picked up Ben Roethlisberg, its been just an incredible run, he said. Im speechless. It was a tough day out there. To hang in there the way I did, Im really satisfied. ... It hasnt quite sunk in yet. I had to fight hard mentally to keep all this aside, and I managed to do that. Its going to feel better as the week goes on. Im didntensons.Tour ChampionshipSunday, At East Lake Golf Club, Atlanta Purse: $8 million, Yardage: 7,307, Par: 70, Final: Henrik Stenson (2,500), $1,440,000 64-66-69-68 267-13 Jordan Spieth (1,250), $708,000 68-67-71-64 270-10 Steve Stricker (1,250), $708,000 66-71-68-65 270-10 Webb Simpson (750), $384,000 68-71-69-63 271-9 Dustin Johnson (550), $320,000 68-68-67-69 272-8 Justin Rose (500), $288,000 68-68-70-67 273-7 Billy Horschel (438), $264,000 66-70-70-68 274-6 Zach Johnson (438), $264,000 69-68-69-68 274-6 Roberto Castro (375), $227,733 67-71-72-65 275-5 Jason Dufner (375), $227,733 74-70-66-65 275-5 Sergio Garcia (375), $227,733 68-71-69-67 275-5 Keegan Bradley (313), $200,000 72-65-72-67 276-4 Phil Mickelson (313), $200,000 71-67-70-68 276-4 Jason Day (278), $173,600 68-74-68-67 277-3 Jim Furyk (278), $173,600 70-68-73-66 277-3 Adam Scott (278), $173,600 65-69-74-69 277-3 Nick Watney (278), $173,600 72-65-70-70 277-3 Brendon de Jonge (263), $158,400 70-72-71-65 278-2 Luke Donald (263), $158,400 70-70-67-71 278-2 Hunter Mahan (253), $152,000 70-69-71-69 279-1 Brandt Snedeker (253), $152,000 69-75-67-68 279-1 Gary Woodland (243), $145,600 70-67-71-72 280E Tiger Woods (243), $145,600 73-71-69-67 280E Bill Haas (233), $139,200 70-69-69-74 282+2 Kevin Streelman (233), $139,200 69-72-74-67 282+2 Matt Kuchar (223), $133,600 69-74-69-71 283+3 D.A. Points (223), $133,600 72-67-70-74 283+3 Graham DeLaet (215), $131,200 68-71-72-73 284+4 Charl Schwartzel (210), $129,600 68-79-77-66 290+10 Boo Weekley (205), $128,000 70-75-73-74 292+12SPORTSCITRUSCOUNTY(FL) CHRONICLEMONDAY, SEPTEMBER23, 2013 B5 STENSONContinued from Page B1 Associated PressCincinnati running back Giovani Bernard dives into the end zone Sunday past Green Bay free safety M.D. Jennings for a 3-yard touchdown run in Cincinnati. Lions 27, Redskins 20Detroit 71001027 Washington 773320 First Quarter WasHall 17 interception return (Potter kick), 9:23. DetBell 12 run (Akers kick), 5:14. Second Quarter DetFauria 5 pass from Stafford (Akers kick), 14:47. WasMorris 30 run (Potter kick), 3:29. DetFG Akers 32, :44. Third Quarter WasFG Potter 43, 12:11. Fourth Quarter DetFG Akers 28, 11:08. DetJohnson 11 pass from Stafford (Akers kick), 3:56. WasFG Potter 21, 1:40. A,111. DetWas First downs 2427 Total Net Yards441420 Rushes-yards23-6322-120 Passing 378300 Punt Returns2-92-11 Kickoff Returns1-154-88 Interceptions Ret.1-41-17 Comp-Att-Int25-42-132-50-1 Sacked-Yards Lost1-72-26 Punts 6-52.55-46.2 Fumbles-Lost0-03-1 Penalties-Yards8-716-45 Time of Possession28:4831:12 INDIVIDUAL STATISTICS RUSHINGDetroit, Bell 20-63, Stafford 1-2, Riddick 2-(minus 2). Washington, Morris 1573, Griffin III 6-37, Garcon 1-10. PASSINGDetroit, Stafford 25-42-1-385. Washington, Griffin III 32-50-1-326. RECEIVINGDetroit, Johnson 7-115, Burleson 6-116, Bell 4-69, Broyles 3-34, Scheffler 2-5, Durham 1-33, Riddick 1-8, Fauria 1-5. Washington, Garcon 8-73, Moss 777, Reed 5-50, Paulsen 4-51, Helu Jr. 3-35, Hankerson 3-21, Morgan 2-19.Saints 31, Cardinals 7Arizona 70007 New Orleans7731431 First Quarter AriSmith 3 run (Feely kick), 9:13. NOMeachem 27 pass from Brees (Hartley kick), 5:28. Second Quarter NOGraham 16 pass from Brees (Hartley kick), 2:52. Third Quarter NOFG Hartley 31, 4:03. Fourth Quarter NOBrees 7 run (Hartley kick), 14:42. NOGraham 7 pass from Brees (Hartley kick), 5:25. A,057. AriNO First downs 1627 Total Net Yards247423 Rushes-yards16-8624-104 Passing 161319 Punt Returns2-153-53 Kickoff Returns3-870-0 Interceptions Ret.1-02-49 Comp-Att-Int18-35-229-46-1 Sacked-Yards Lost4-264-23 Punts 8-40.84-49.5 Fumbles-Lost1-00-0 Penalties-Yards3-184-30 Time of Possession24:2935:31 INDIVIDUAL STATISTICS RUSHINGArizona, Mendenhall 9-29, Smith 3-27, Ellington 3-19, Peterson 1-11. New Orleans, K.Robinson 4-38, Thomas 1128, Brees 6-21, Sproles 3-17. PASSINGArizona, Palmer 18-35-2-187. New Orleans, Brees 29-46-1-342. RECEIVINGArizona, Fitzgerald 5-64, Floyd 4-49, Ellington 3-36, Housler 1-13, Mendenhall 1-12, Smith 1-7, Roberts 1-6, S.Taylor 12, Peterson 1-(minus 2). New Orleans, Graham 9-134, Thomas 6-39, Colston 5-71, Sproles 4-39, Meachem 2-34, Watson 1-14, Moore 1-6, Collins 1-5.Panthers 38, Giants 0N.Y. Giants 00000 Carolina 71014738 First Quarter CarTolbert 2 run (Gano kick), 2:33. Second Quarter CarFG Gano 53, 6:44. CarLaFell 16 pass from Newton (Gano kick), :12. Third Quarter CarLaFell 20 pass from Newton (Gano kick), 11:35. CarNewton 3 run (Gano kick), 6:58. Fourth Quarter CarGinn Jr. 47 pass from Newton (Gano kick), 13:30. A,748. NYGCar First downs 1027 Total Net Yards150402 Rushes-yards16-6046-194 Passing 90208 Punt Returns1-02-12 Kickoff Returns1-240-0 Interceptions Ret.1-92-6 Comp-Att-Int14-27-215-27-1 Sacked-Yards Lost7-451-15 Punts 6-40.82-48.5 Fumbles-Lost1-11-1 Penalties-Yards6-454-32 Time of Possession23:1336:47 INDIVIDUAL STATISTICS RUSHINGN.Y. Giants, Wilson 11-39, Manning 1-14, Scott 1-5, Jacobs 3-2. Carolina, D.Williams 23-120, Newton 7-45, Tolbert 918, Ginn Jr. 1-11, Brockel 1-1, A.Smith 3-0, Anderson 2-(minus 1). PASSINGN.Y. Giants, Manning 12-23-1119, Painter 2-4-1-16. Carolina, Newton 1527-1-223. RECEIVINGN.Y. Giants, Myers 3-33, Cruz 3-25, Randle 2-40, Scott 2-17, Murphy 1-8, Hynoski 1-5, Jernigan 1-5, Pascoe 1-2. Carolina, Olsen 4-54, Ginn Jr. 3-71, LaFell 3-53, S.Smith 3-40, Hixon 1-8, D.Williams 1-(minus 3). MISSED FIELD GOALSN.Y. Giants, J.Brown 38 (WL).Titans 20, Chargers 17San Diego 737017 Tennessee 01001020 First Quarter SDGates 7 pass from Rivers (Novak kick), 9:34. Second Quarter TenFG Bironas 20, 13:00. SDFG Novak 44, 4:47. TenLocker 7 run (Bironas kick), 1:08. Third Quarter SDR.Brown 1 run (Novak kick), 2:42. Fourth Quarter TenFG Bironas 37, 6:07. TenHunter 34 pass from Locker (Bironas kick), :15. A,143. SDTen First downs 1923 Total Net Yards277452 Rushes-yards27-10229-170 Passing 175282 Punt Returns1-72-6 Kickoff Returns1-214-114 Interceptions Ret.0-00-0 Comp-Att-Int20-24-023-37-0 Sacked-Yards Lost2-92-17 Punts 5-42.43-46.7 Fumbles-Lost1-12-0 Penalties-Yards5-4511-116 Time of Possession28:2231:38 INDIVIDUAL STATISTICS RUSHINGSan Diego, Mathews 16-58, Woodhead 5-31, McClain 1-7, R.Brown 5-6. Tennessee, C.Johnson 19-90, Locker 5-68, Battle 4-12, Kern 1-0. PASSINGSan Diego, Rivers 20-24-0-184. Tennessee, Locker 23-37-0-299. RECEIVINGSan Diego, Woodhead 7-55, Gates 5-55, Green 2-48, Royal 2-34, V.Brown 2-11, Allen 1-(minus 4), McClain 1-(minus 6), Rivers 0-(minus 9). Tennessee, Washington 8-131, Wright 6-71, Walker 5-49, Hunter 134, Williams 1-9, Preston 1-4, C.Johnson 11. MISSED FIELD GOALSSan Diego, Novak 38 (BK). Tennessee, Bironas 43 (WR). Bengals 34, Packers 30Green Bay 01614030 Cincinnati 14071334 First Quarter CinBernard 3 run (Nugent kick), 9:20. CinGreen-Ellis 2 run (Nugent kick), 9:08. Second Quarter GBFG Crosby 41, 14:57. GBJennings 24 fumble return (Crosby kick), 11:22. GBFG Crosby 19, 6:32. GBFG Crosby 26, :00. Third Quarter GBFranklin 2 run (Crosby kick), 11:40. GBJ.Jones 7 pass from Rodgers (Crosby kick), 5:30. CinGreen 20 pass from Dalton (Nugent kick), 3:50. Fourth Quarter CinM.Jones 11 pass from Dalton (kick blocked), 10:55. CinNewman 58 offensive fumble return (Nugent kick), 3:47. A,633. GBCin First downs 2719 Total Net Yards399297 Rushes-yards30-18224-82 Passing 217215 Punt Returns0-00-0 Kickoff Returns2-214-111 Interceptions Ret.1-12-9 Comp-Att-Int26-43-220-28-1 Sacked-Yards Lost4-274-20 Punts 3-43.33-43.7 Fumbles-Lost2-25-3 Penalties-Yards4-555-43 Time of Possession31:5128:09 INDIVIDUAL STATISTICS RUSHINGGreen Bay, Franklin 13-103, Starks 14-55, Rodgers 3-24. Cincinnati, Bernard 10-50, Green-Ellis 10-29, Dalton 43. PASSINGGreen Bay, Rodgers 26-43-2244. Cincinnati, Dalton 20-28-1-235. RECEIVINGGreenCincinnati, Nugent 52 (WL).Bears 40, Steelers 23Chicago 17731340 Pittsburgh01010323 First Quarter ChiFG. A,575. ChiPit First downs1521 Total Net Yards258459 Rushes-yards28-10721-80 Passing151379 Punt Returns0-02-4 Kickoff Returns5-732-48 Interceptions Ret.2-510-0 Comp-Att-Int20-30-026-41-2 Sacked-Yards Lost2-83-27 Punts6-47.02-29.5 Fumbles-Lost1-04-3 Penalties-Yards3-256-59 Time of Possession31:3628:24 INDIVIDUAL STATISTICS RUSHINGChicago, Forte 16-87, Cutler 411, Bush 8-9. Pittsburgh, Dwyer 12-39, F.Jones 7-34, Roethlisberger 2-7. PASSINGChicago, Cutler 20-30-0-159. Pittsburgh, Roethlisberger 26-41-2-406. RECEIVINGChicago, Jeffery 7-51, Marshall. Newmans return rallies Bengals over Packers 34-30 NFL schedule and resultsThursdays Game Kansas City 26, Philadelphia 16 Sundays Games Today Oakland at Denver, 8:40 p.m. Thursday, Sep. 26 San Francisco at St. Louis, 8:25 p.m. Sunday, Sep. 29 N.Y. Giants at Kansas City, 1 p.m. Seattle at Houston, 1 p.m. Baltimore at Buffalo, 1 p.m. Arizona at Tampa Bay, 1 p.m. Indianapolis at Jacksonville, 1 p.m. Cincinnati at Cleveland, 1 p.m. Chicago at Detroit, 1 p.m. Pittsburgh vs. Minnesota at London, 1 p.m. N.Y. Jets at Tennessee, 4:05 p.m. Washington at Oakland, 4:25 p.m. Dallas at San Diego, 4:25 p.m. Philadelphia at Denver, 4:25 p.m. New England at Atlanta, 8:30 p.m. Open: Carolina, Green Bay Monday, Sep. 30 Miami at New Orleans, 8:40 p.m. PAGE 16 CITRUSCOUNTY(FL) CHRONICLEENTERTAINMENT B6MONDAY, SEPTEMBER23, 2013 PHILLIPALDER Newspaper Enterprise Assn.W.C. Fields said, After two days in the hospital, I took a turn for the nurse. This deal would put some declarers into the hospital, metaphorically speaking. South is in four hearts. West leads the diamond two. East wins with his ace and returns the diamond eight. After ruffing, how should declarer proceed? Souths three-heart rebid would usually advertise 14-16 high-card points, but this hand has seven clear-cut playing tricks, making it easily strong enough for the jump. Do not be locked into high-card points; always think about winners. North had a borderline raise, but we love to try for a game bonus, especially when vulnerable. South has four potential losers: one spade, one diamond and two clubs. He has only nine immediate winners: one spade, seven hearts and one club. Declarer must get two club tricks. Some players would go that far, draw trumps, cross to dummy with a spade, and play a club to their queen. But when the finesse lost, they would go down one and complain about being unlucky. However, that was only a 50 percent line. There was a 63 percenter available. Along with Easts having the club king, South should also try to find East with the club jack and 10. Declarer should cash his heart ace, play a heart to dummys king, then lead a club to his nine. Here, it pulls out the king, ending Souths problem. But if West could have won the trick with the 10 or jack, declarer would have returned to dummy with a spade and played a club to his queen, losing nothing over finessing the queen on the first round. Alaska State Troopers Alaska State Troopers Alaska State Troopers Manhunt Alaska State Troopers Alaska State Troopers Alaska State Troopers (NICK) 28 36 28 35 25Sponge.Sponge.VictoriousDrakeAwesomeFull HseFull HseFull HseNannyNannyFriendsFriends (OWN) 103 62 103 Ask Oprahs All Stars (In Stereo) Dateline on OWNDateline on OWNDateline on OWNDateline on OWN (OXY) 44 123 Resident Evil: Afterlife (2010) RSnapped PG Snapped PG Snapped PG Snapped PG (SHOW) 340 241 340 4 Gangs of New York (2002) Leonardo DiCaprio. (In Stereo) R Dexter Remember the Monsters? MA Ray Donovan Same Exactly MA Dexter Remember the Monsters? MA Ray Donovan Same Exactly MA (SPIKE) 37 43 37 27 36The Punisher Kick-Ass (2010) Aaron Johnson. An ordinary teen decides to become a superhero. (In Stereo) R Piranha (2010, Horror) Elisabeth Shue, Adam Scott. (In Stereo) R The Punisher (2004) Thomas Jane. (STARZ) 370 271 370 King Arthur (2004) PG-13 Finding Nemo (2003, Comedy) Voices of Albert Brooks. (In Stereo) G XXX: State of the Union (2005) Ice Cube. PG-13 Zero Dark Thirty (2012) Jessica Chastain. R (SUN) 36 31 36 Rays Live! (N) Inside the Rays Golf Destination Swing Clinic (N) Tee It up With Golf America MLB Baseball Baltimore Orioles at Tampa Bay Rays. FOX Sports Live (N) (Live) (SYFY) 31 59 31 26 29Star Trek VI Ghost Rider (2007) Nicolas Cage. A motorcycle stuntman is a supernatural agent of vengeance. PG-13 G.I. Joe: The Rise of Cobra (2009, Action) Channing Tatum, Dennis Quaid. PG-13Star Trek VII (TBS) 49 23 49 16 19SeinfeldSeinfeldSeinfeldFam. GuyFam. GuyFam. GuyFam. GuyFam. GuyBig BangBig BangConan (N) (TCM) 169 53 169 30 35 The Barretts of Wimpole Street (1957, Romance) Jennifer Jones. NR Love Me Tonight (1932, Musical Comedy) Maurice Chevalier. NR The Story of Film: An Odyssey (N) The Public Enemy (1931) NR (TDC) 53 34 53 24 26Fast N Loud (In Stereo) Fast N Loud (In Stereo) Fast N Loud (In Stereo) Fast N Loud: Revved Up (N) Turn & Burn (N) (In Stereo) Fast N Loud: Revved Up (TLC) 50 46 50 29 30Toddlers & TiarasBreaking Amish: LABreaking: LA Breaking: LA Breaking: LA Breaking: LA (TMC) 350 261 350 Vanity Fair (2004) Reese Witherspoon. PG-13 Dark Horse (2011, Drama) Justin Bartha. NR 360 (2011, Drama) Anthony Hopkins, Ben Foster. (In Stereo) R Heavenly Creatures R (TNT) 48 33 48 31 34Castle Cops & Robbers (In Stereo) PGCastle Heartbreak Hotel PG Castle Kill Shot (In Stereo) PG Castle Cuffed (In Stereo) PG Major Crimes False Pretenses CSI: NY Party Down (TOON) 38 58 38 33 RegularRegularAdvenRegularUncle MAD PGKing/HillClevelandBurgersAmericanFam. GuyFam. Guy (TRAV) 9 54 9 44Bizarre FoodsFoodFoodBizarre FoodsBizarre FoodsHotel Impossible (N)Hotel Impossible (truTV) 25 55 25 98 55LizardLizardLizardLizardLizardLizardLizardLizardLizardLizardPawnPawn (TVL) 32 49 32 34 24M*A*S*HM*A*S*HBoston Legal Boston Legal RaymondRaymondRaymondRaymondRaymondKing (USA) 47 32 47 17 18NCIS: Los Angeles LD50 NCIS: Los Angeles The Bank Job WWE Monday Night RAW (N) (In Stereo Live) PG NCIS: Los Angeles Chinatown (WE) 117 69 117 Will & Grace Will & Grace Will & Grace Will & Grace CSI: Miami F-T-F (In Stereo) CSI: Miami Wheels Up CSI: Miami Last Stand CSI: Miami Stoned Cold (WGN-A) 18 18 18 18 20Funny Home VideosFunny Home VideosFunny Home VideosParksParksWGN News at NineMotherRules Dear Annie: Our 19year-old daughter seems to have found a haven from adulthood in our home. She has resisted any effort to achieve anything outside her comfort level, and as a result, its not all that comfortable at home for anyone, including her. She sleeps throughout the day and spends the night burrowed in her room for hours, pursuing who knows what. She no longer has a computer (shes broken two laptops in fits of anger) or access to ours after 10 p.m. She wont get a drivers license or make a meaningful effort to find work. She wont accept advice. She doesnt do drugs. Shes never out all night. Im pretty sure shesve sought counseling, but our daughter wont go. Needless to say, we love her. People might judge that weve simply spoiled her, and they might be right, but we always felt we were doing the best we could without coddling her or helicopter parenting. Regardless, were stuck now and could use some help. Stuck in Neutral Dear Stuck: Your daughters. Ive been to church and other gathering places, to no avail. Also, there are few activities here for people my age. Ive given it my best shot, and I dontve tried. Invite one or two people for coffee. Volunteer somewhere or join a social organization that speaks to your interests. It doesnt have to be limited to senior groups. Friends come in all ages. Dear Annie: Please suggest to Dont Know What To Do in Connecticut to wear gloves if she doesnt want to catch other peoples. To find out more visit the Creators Syndicate Web page at. ANNIES MAILBOX Bridge (Answers tomorrow) RIVER ONION TURKEYAWHILE Saturdays Jumbles: Answer: Construction on the new gym wasnt going well, but everything would WORKUBOS MALAL SIDYAM CHAWES Tribune Content Agency, LLC All Rights Reserved. Jumble puzzle magazines available at pennydellpuzzles.com/jumblemags Print your answer here: MONDAY EVENING SEPTEMBER 23, Vocalists perform. The Blacklist NewsJay Leno # (WEDU) PBS 3 3 14 6World News Nightly Business PBS NewsHour (N) (In Stereo) Antiques Roadshow G Genealogy Roadshow PG POV Best Kept Secret Janet Mino helps autistic boys. PG Visa Dreams % (WUFT) PBS 5 5 5 41JournalBusinessPBS NewsHour (N)Antiques RoadshowGenealogy RdPOV (N) PG WorldT. Smiley ( (WFLA) NBC 8 8 8 8 8NewsNightly NewsNewsChannel 8 Entertainment Ton.The Voice The Blind Auditions, Part 1 (Season Premiere) Vocalists perform. (N) The Blacklist Pilot (In Stereo) NewsJay Leno ) (WFTV) ABC 20 20 20 NewsWorld News Jeopardy! (N) G Wheel of Fortune Dancing With the Stars The couples perform; elimination. (N) PG Castle Valkyrie (In Stereo) PG Eyewit. News Jimmy Kimmel (WTSP) CBS 10 10 10 10 1010 News, 6pm (N) Evening News Wheel of Fortune Jeopardy! (N) G How I MetHow I Met2 Broke Girls Mom Pilot Hostages Pilot (In Stereo) 10 News, 11pm (N) Letterman ` (WTVT) FOX 13 13 13 13FOX13 6:00 News (N) (In Stereo) TMZ (N) PGomg! Insider PGBones The Cheat in the Retreat Sleepy Hollow Blood MoonSoul Purpose Telethone < (WFTS) ABC 11 11 11NewsWorld News The List (N) PG Lets Ask America Dancing With the Stars The couples perform; elimination. (N) PG Castle Valkyrie (In Stereo) PG NewsJimmy Kimmel @ (WMOR) IND 12 12 16Family Guy Family Guy PG Big Bang Theory Big Bang Theory Law & Order: Criminal Intent Law & Order: Criminal Intent How I MetHow I MetThe Office PG The Office PG F (WTTA) MNT 6 6 6 9 9RaymondSeinfeldFamFeudFamFeudLaw & Order: SVULaw & Order: SVUCops Rel.Cops Rel.SeinfeldCommun H (WACX) TBN 21 21 PresentThe 700 Club GTurningChildGive Me the BibleJentezenPaidStudioHealingMinistries L (WTOG) CW 4 4 4 12 12King of Queens King of Queens Two and Half Men Two and Half Men Hart of Dixie On the Road Again PG Whose Line Is It? Whose Line Is It?EngagementEngagementThe Arsenio Hall Show O (WYKE) FAM 16 16 16 15Chamber Chat Citrus Today County Court Casita Big Dog Zorro PGYour Plumber Moving On GCold Squad (DVS) Eye for an Eye Fam Team S (WOGX) FOX 13 7 7SimpsonsSimpsonsBig BangBig BangBones Sleepy Hollow FOX 35 News at 10Simpsons Criminal Minds Criminal Minds Criminal Minds Criminal Minds (A&E) 54 48 54 25 27Storage Wars PG Storage Wars PG Storage Wars PG Storage Wars PG Storage Wars PG Storage Wars PG Storage Wars PG Storage Wars Storage Wars PG Storage Wars Storage Wars PG Storage Wars PG (AMC) 55 64 55 The Italian Job The Shawshank Redemption (1994) Tim Robbins. An innocent man goes to a Maine penitentiary for life in 1947. R The Lord of the Rings: The Two Towers (2002, Fantasy) Elijah Wood, Ian McKellen. PG-13 (ANI) 52 35 52 19 21To Be AnnouncedCallWildman CallWildman Call of Wildman CallWildman Gator Boys Errorboat Captain PG Gator Boys (In Stereo) PG Call of Wildman CallWildman (BET) 96 19 96 106 & Park: BETs Top 10 Live Top 10 Countdown (N) PG The Wash (2001, Comedy) Dr. Dre, Snoop Doggy Dogg. R Higher Learning (1995, Drama) Omar Epps. Racial tensions divide a college campus. R (BRAVO) 254 51 254 MiamiHousewives/NJNeNe--WeddingNeNeReal HousewivesReal HousewivesHappensJersey (CC) 27 61 27 33South Park Tosh.0 Colbert Report Daily ShowSouth Park MA South Park South Park MA South Park MABrickleberrySouth Park MA Daily ShowColbert Report (CMT) 98 45 98 28 37Reba PG Reba PG Reba PG Reba PG Good Will Hunting (1997) Matt Damon. A young Boston man must deal with his genius and emotions. (In Stereo) R Cops Reloaded Cops Reloaded (CNBC) 43 42 43 Mad Money (N)The Kudlow Report The Queen of Versailles (2012 A.N.T. Farm G Austin & Ally G Enchanted (2007, Fantasy) Amy Adams. (In Stereo) PG Austin & Ally G Shake It Up! G Austin & Ally G GoodCharlie (ESPN) 33 27 33 21 17SportCtrMonday Night Countdown (N) (Live) NFL Football Oakland Raiders at Denver Broncos. (Live) SportCtr (ESPN2) 34 28 34 43 49AroundPardonWNBA Basketball SportsNation Baseball Tonight (N)SportCtrOlber. (EWTN) 95 70 95 48FaithAlterDaily Mass The Journey HomeEvangeRosaryWorld Over LiveThe HeartWomen (FAM) 29 52 29 20 28 Pirates of the Caribbean: On Stranger Tides (2011, Adventure) Johnny Depp, Penlope Cruz, Ian McShane. PG-13 The Sorcerers Apprentice (2010, Fantasy) Nicolas Cage. PG The 700 Club (In Stereo) PG (FLIX) 118 170 Twins The Runner (1999) Ron Eldard. (In Stereo) R The Bedroom Window (1987, Suspense) Steve Guttenberg. R 8 Million Ways to Die (1986, Crime Drama) Jeff Bridges. R (FNC) 44 37 44 32Special ReportFOX Report The OReilly FactorHannity (N) Greta Van SusterenThe OReilly Factor (FOOD) 26 56 26 DinersDinersDinersDinersDinersDinersDinersDinersDinersDinersDinersDiners (FS1) 732 112 732 FOX Football DailyFox 1 on MissionThe Ultimate FighterBoxing FOX Sports Live (N) (FSNFL) 35 39 35 ShipMarlinsMLB Baseball Philadelphia Phillies at Miami Marlins. (N) (Live) MarlinsMarlinsFOX Sports Live (N) (FX) 30 60 30 51 Marmaduke (2010, Comedy) Voices of Owen Wilson, Lee Pace. PG Rio (2011, Comedy) Voices of Anne Hathaway, Jesse Eisenberg, Jemaine Clement. G Rio (2011, Comedy) Voices of Anne Hathaway. G (GOLF) 727 67 727 Golf Central (N)The Golf Fix (N)PlayingPlayingFeherty Feherty Golf Central (HALL) 59 68 59 45 54Little House on the Prairie Blizzard G Little House on the Prairie PG Strawberry Summer (2012, Drama) Julie Mond, Trevor Donovan, Shelley Long. Frasier PGFrasier PGFrasier PGFrasier PG (HBO) 302 201 302 2 2SoundThunder We Bought a Zoo (2011) Matt Damon. A man and his family work to renovate and reopen a zoo.First Cousin Once Removed (2012) Franois Berland. NR The Campaign (2012) Will Ferrell. R (HBO2) 303 202 303 Field of Dreams (1989, Fantasy) Kevin Costner. (In Stereo) PG Real Time With Bill Maher MA Boardwalk Empire MA Tinker Tailor Soldier Spy (2011) Gary Oldman. (In Stereo) R (HGTV) 23 57 23 42 52Love It or List It, TooLove It or List It GLove It or List It GLove It or List It GHuntersHunt IntlLove It or List It G (HIST) 51 25 51 32 42Pawn Stars PG Pawn Stars PG Pawn Stars PG Pawn Stars PG Pawn Stars PG Pawn Stars PG Pawn Stars PG Pawn Stars PG Pawn Stars PG Pawn Stars PG Pawn Stars PG Pawn Stars PG (LIFE) 24 38 24 31Wife Swap Pyke/ Smith PG Wife Swap A careerfocused mom. PGMurder on the 13th Floor (2012, Suspense) Sean Patrick Thomas. NR Deadly Spa (2013, Suspense) Amy Pietz, Johnny Whitworth. NR (LMN) 50 119 Fatal Honeymoon (2012, Docudrama) Harvey Keitel, Billy Miller. (In Stereo) Exposed (2010, Suspense) Jodi Lyn OKeefe. (In Stereo) NR Girl, Positive (2007, Drama) Andrea Bowen, Jennie Garth. (In Stereo) NR (MAX) 320 221 320 3 3Brave One The Watch (2012, Comedy) Ben Stiller, Vince Vaughn. (In Stereo) R Journey 2: The Mysterious Island (2012) PG I, Robot (2004, Science Fiction) Will Smith. (In Stereo) PG-13 WANT MORE PUZZLES? Look for Sudoku and Wordy Gurdy puzzles in the Classified pages. PAGE 17 COMICSCITRUSCOUNTY(FL) CHRONICLE MONDAY, SEPTEMBER23, 2013 B7Pickles Crystal River Mall 9; 564-6864 Battle of the Year (PG-13)In3D. 1:50 p.m., 4:50p.m., 7:40p.m. The Family (R) 1:45 p.m., 4:35 p.m., 7:25p.m. Insidious: Chapter 2 (PG-13) 1:15p.m., 4:15p.m., 7:45p.m. Lee Daniels The Butler (PG-13) 1:10p.m., 4:10p.m., 7:10p.m. Planes (PG) 1:10p.m. Planes In 3D. (PG) 4:20p.m. Nopasses. Percy Jackson: Sea of Monsters (PG) 1:20p.m., 7:20p.m. Percy Jackson: Sea of Monsters In3D. (PG) 4p.m. Nopasses. Prisoners (R) 1 p.m., 3:30 p.m., 7p.m. Riddick (R) 1:30p.m., 4:45p.m., 7:50p.m. Were the Millers (R) 1:55p.m., 4:40p.m., 7:35p.m. Citrus Cinemas 6 Inverness; 637-3377 Insidious: Chapter 2 (PG-13) 1:30p.m., 4:30 p.m., 7:30p.m. Prisoners (R) 12:45 p.m., 3:30 p.m., 7p.m. The Family (R) 12:50 p.m., 4:15 p.m., 7:05p.m. One Direction: This Is Us The Extended Cut (PG) 4:40p.m. One Direction: This Is Us The Extended Cut In3D. (PG) 1:40p.m., 7:40p.m. Nopasses. Riddick (R) 1p.m., 4p.m., 7:10p.m. Were the Millers (R) 1:15p.m., 4:10p.m., 7:20 FCMXD JACHF ZCT WI WXDRNM CDP C TXHNDP WNRLXM RN WX. TLX BDTUBMXP XEXMINDX TLX HCWX BD HNDRCHR ZBRL. KGABXRRX AXZBTPrevious Solution: There is something incredibly nostalgic and significant about the annual cascade of autumn leaves. Joe L. Wheeler (c) 2013 by NEA, Inc., dist. by Universal Uclick 9-23 PAGE 18 B8MONDAY, SEPTEMBER23, 2013CITRUSCOUNTY(FL) CHRONICLECOLLEGEFOOTBALL Fax: (352) 563-5665 l Toll Free: (888) 852-2340 l Email: classifieds@chronicleonline.com l website: To place an ad, call563-5966 Chronicle ClassifiedsClassifieds In Print and Online All The Time699184 000FUXP 000FUY2 DINING ROOM HUTCH Large,beautiful high quality, must see. $100. (352)257-4076 DINING ROOM SET Table,Chairs, Server $99.99 352-795-1032 DINING ROOM TABLE Six chairs. Large super excellent. High qual. Must see.$100. (352)257-4076 DRESSER W/ MIRROR Large excellent quality Basset Dovetail drawers. $100. (352)257-4076 END TABLES $45.00 352-795-1032 High End Used Furniture 2NDTIME AROUND RESALES 270-8803,2165 Hy 491 KITCHEN SET, 45 Beveled glass top, white base, 4 swivel cushion chairs, on casters, Excel. Cond. $350. (352) 465-2237 Leave Message KITCHEN TABLE 42 FORMICAPLUS LEAVE 4 chairs. Very usable $20. (352)257-4076 LIVING ROOM CHAIR High quality brown excellent condition. $40. Must see (352)257-4076 LIVING ROOM CHAIRS 2 green high quality excellent condition. Must see. Each $50. (352)257-4076 LOVE SEATBlack Real Leather, not Bonded, Love Seat. Excellent Condition $100.00 352-746-5421 Love Seat, chair, Bedroom suite, oak furn. Priced right! Ask for Diana 352-637-4695 MATTRESS firm, twin size $50 OBO 352 419-8816 SECTIONAL3 PIECE High quality excellent condition. Must see.$100. (352)257-4076 Sectional Couch w/ queen hide a bed and recliner built in Good Condition $175. obo (352) 302-9129 Single Sofa Bed Lazy Boy,very nice tan colored $175; Corner TV and table. $40 (352) 746-6996 Sofa & Loveseat all recline, Brookshire, teal, $250. 4 Kitchen Chairs w/ castors $25 ea (352) 382-3914 AFFORDABLE Top Soil, Mulch, Stone Hauling & Tractor Work (352) 341-2019 BOLENS New Lawn Tractor 13HP, 38, 6 spd. used 3 times, have receipt paid $1,000 first $650. Laurel Ridge BH(352) 634-3806 LAWN SPREADER SCOTTS MEDIUM SIZE $20 352-613-0529 PICNIC TABLE/BENCH WHITE, CONVERTS TO TWO BENCHES $45 352 527-8993 1-TV STAND 36 wide x 26 tall w/ drawer cherry color like new $40 can text pic call Ron 352-746-0401 1-SIDE CHAIR Black & gold wood, green padded seat can text pics $45 Ron 352-746-0401 Bamboo Coffee Table with glass top $55 860-2475 BED FULLSIZE Matress, box spring, Frame Very good condition. Little used. $50. (352)257-4076 BED ROOM SET Queen Size, mattress, boxspring & triple dresser, headboard footboard, night stands & lamps $825 obo (352) 628-3995 BED TWIN Mattress, Box spring, frame. Excellent like new Chiropractor model. $75. (352)257-4076 BEDROOM SET Headboard Dresser,Nite Stand $99.99 352-795-1032 BEDSIDE TABLES (3) Excellent quality, Solid wood, brown. Must see. Each $30. (352)257-4076 BOOK SHELVES $45.00 352-795-1032 BROYHILLSOFAPerfect condition, like new. 3-seat sofa, includes 4 cushions and arm covers. Off-white with floral pattern. Paid $900, sell for $150. 352-503-7125 or 410-227-9152 CHAIRS 5-light oak chairs with padded seats on casters $100 (352) 419-6383 CHANDELIER $25.00 352-795-1032 CHESTOF DRAWER $45.00 352-795-1032 CHESTOF DRAWERS Large Six dovetailed drawers. Brown Excellent condition $100. (352)257-4076 COFFEE & 2 END TABLES Ex qual solid wood, brown. Must see. Coffee $30., Ends $20. each (352)257-4076 COFFEE TABLE WOOD One scratch, but very usable. $10. (352)257-4076 COUCH Brown & Gold, curved, two matching ottermans. 1 yr old $400 (352) 527-4247 Dining Room Set Thomasville, Cherry Table, 6 chairs, 2 ext, new $2900, China Base & Deck w/ glass shelves, new $2595, Moving-Will sacrifice both for $1500 cash, obo (352) 513-4516 REFRIGERATOR SIDE BYSIDE Black Jennaire. Runs Great. Remodeling. $100. 228-4648 REFRIGERATOR W/ ICE MAKER G.E. WHITE SIDE BYSIDE 2DEEP21.5 WIDE 5HIGH $300.00 352-382-0009 SMITTYS APPLIANCE REPAIR. Also W anted Dead or Alive W ashers & Dryers. FREE PICK UP! 352-564-8179 TOASTER OVEN $25.00 352-795-1032 Washer & Dryer Maytag-2 washers, 1 dryer. All in good working cond. $300 for all or $125 ea (304) 544-8398 WASHER Maytag Front Load, 4 yrs. old, $150. firm (352) 634-4259 WASHER OR DRYER $135.00 each. Reliable, Clean, Like New, Excellent Working Condition. Free Delivery, 60 Day Written Guarantee 352 263-7398 Whirlpool Digital Calypso Matching WASHER/DRYER Excel cond. $400. Must See Call (352) 212-1854 ROCKWELLBELT SANDER $100 HEAVY DUTYMETALINVERNESS 419-5981 32 Sharp color TV excellent condition $35. 352-249-1085 or 352-212-5624 CASSETTE DECK Double Deck JVC Cassette with Remote $40.00 352-746-5421 Panasonic TV 42 Plasma Flat screen with remote, TV in excel cond. $225., (908) 616-0620 Homosassa YAMAHASPEAKERS 5 2 16 INCH 140 WATTS 2 9 INCH 60 WATTS & 1 5 INCH 80 WATTS All $80. 352-613-0529 3 DOUBLE ROLLS VINYLPREPASTED WALLCOVERING $25 NEW 165SQ FT 419-5981 CEILING FANS WHITE -FOUR @ $25 EACH 352 527-8993 FORMICACOUNTERTOPS ONE-9LONG ONE 6LONG -$100 352 527-8993 KITCHEN SINK double basin with moen faucet and spray. Good Shape $35.00 Call 613-4279 PVC BLINDS WHITE-TWO SETS-79W X 91H $100 352 527-8993 Diestler Computer New & Used systems repairs. Visa/ MCard 352-637-5469 LAPTOPCART/TABLE Black adjustable tilt&height w/wheels $24 Can email pic 352-382-3650 Patio Recliner Tan La-z-boy, like new $140 (352) 564-8605 School Bus driverPrivate Christian organization needs driver for Citrus County bus route. First pick up 7 AM, only 4 stops. Same PM route. Bus NO a/c. $9.50/hr. 20-25 hours/week plus opportunity for more. 1 yr exp. min. Must be fully licensed/ no accidents/ ready to drive. /2 character references. Family oriented/patience/ki ndness a plus. Email to:Christianbus@ tampabay.rr.com 1971 Baseball cards, 200 cards $40. 1970 Baseball Cards 200 cards $40 (352) 344-9502 Barbie Olympic Gym 1996 $100. Marlin Innaugral Poster 1993 $75. obo (352) 621-0778 APPLIANCES, like new washers/dryers, stoves, fridges 30 day warranty trade-ins, 352-302-3030 GAS RANGE Andora5 black GE selfclean convection oven, griddle, power burner $500 OBO 228-4648 GE Space Saver Microwave very little usage Bisque, $125.(352) 302-9129 GOOD DRYER $100 works perfect. 30 day written warranty call/text 352-364-6504 GOOD WASHER $100 works perfect. 30 day written warranty. call/text 352-364-6504 HOUSEHOLD FREEZE WHITE G.E. UPRIGHT 2DEEP2WIDE 4.5HIGH $250.00 352-382-0009 MAGTAG 2009 white Washing Machine. In good condition $250 obo (352) 422-5579 NEEDEDExperienced,Caring & DependableCNAs/HHAsHourly & Live-in,flex schedule offered LOVING CARE(352) 860-0885 career-opportunities Experienced TelemarketerCrystal River Office call to inquire 352-410-6927 Licensed RealtorCONTACT: yankeetownrealty .com or Call 352-447-0007No Fees. Great Pay out. Weekends req. Earning potential unlimited. Installers HelperPart time help to install window treatments, Hourly pay. Hours will vary. Must have a professional appearance. Apply in person at: 72 Hour Blinds Factory 1657 W Gulf to Lake Hwy, Lecanto Personal/ Commercial CSR220 or 440 LIC. INSURANCE AGENT Email Resume to Tracy Fero at: tfer o@fer oinsurance .com or Call 352-422-2160 ReStor e Manager T ruck Driver Donation Pr ocessor Habitat for Humanity is filling 3 positions in Citrus County E-mail request for detailed job description and instructions for submitting to: H4Hr estor e@ yahoo.com No calls or walk-ins HYGIENISTP/Tcertified dental hygienist, experienced only Fax Resume to 352-795-4606 or Drop of Resume at Christie Dental 6015 W. Nordling Loop, Crystal River DENTAL RECEPTIONIST & SURGICAL ASSISTPart time or Full time For High Quality Oral Surgery Office. Springhill/Lecanto Experience a must. Email Resume To: maryamoli@ yahoo.com Medical Assist.Fulltime & Part time Postions Available at busy Podiatry Practice Call (352) 795-2142 Free to Good Home Hemingway Cat & Kittens kittens are 8 wks old, 2 males, 3 females (352) 563-2125 KITTENS2 Cute kittens Free to good home (352) 344-3927 3 cats missing within several months.One eyed cat,bobtail cat,both black and a black with white spots Palm,Highland,Dixieland. 352-201-4522 CASH REWARD Lost Black Cat, w/ white paws, white on right side of mouth Pine Ridge Estates 430-5959 Found Small Long hair Terrier, white, black head, black tail, Citrus Ave & Turkey Oak (352) 563-0816 Grey Terrier Male, no chip Found off of Gospel Island Maggie rd 9/19. (352) 364-7351 Small Dog near Inglis Dam call to identify (352) 212-1428 Special Occasion? Weddings, memorials, card clubs, banquets. If you need spaceHernando VFW can seat 100+ Call Dan (352) 726-3339 Todays New Ads FREE King Size Mattress pillow top, Almost new (352) 637-6310 No calls before 8am FREE I have a 400 ft. Long strand of barb wire Good Condition Needs to be rolled up (352) 344-1066 FREE MANURE. No shavings, Already bagged, Ready for pick-up at our pasture gate (352) 249-7127 Need a JOB? #1 Employment source is Classifieds To the girl I met in Publixs on 9/18 in Homosassa Springs, wearing a white jacket. I would like to get to know you. Call me anytime. 422-0440.Every Dayvautomotive Classifieds Associated Press didnt.LATE SATURDAY No. 6 LSU 35, Auburn 21BATON ROUGE, La. Jeremy Hill rushed for a careerhigh 184 yards and tied a career high with three touchdowns to help sixth-ranked LSU hand Auburn its first loss of the season, 35-21 on Saturday night. LSUs lead to 28-14. Zach Mettenberger completed his only touchdown pass a 32-yarder to Jarvis Landry early in the fourth quarter as LSU (4-0, 1-0) dimmed Auburns hopes for a comeback. Auburns Nick Marshall was 17-of-33 passing for 224 and was intercepted twice.No. 13 UCLA 59, New Mexico St. 13PASADENA, Calif. Brett Hundley passed for 280 yards and three touchdowns, and No. 13 UCLA honored late receiver Nick Pasquale during its 59-13 sophomores.No. 15 Michigan 24, Connecticut 21EAST HARTFORD, Conn. Fitzgerald Toussaint ran for 120 yards and two touchdowns, Desmond Morgan made a one-handed interception in the fourth quarter that swung the game Michigansgans pick with 9:56 left.No. 25 Texas Tech 33, Texas State 7LUBBOCK, Texas Backup quarterback Davis Webb threw for two touchdowns and 310 yards to lead No. 25s. Tide No. 1 in AP poll after rout-filled weekend PAGE 19 MOND AY ,SEPTEMBER 23, 2013 9 CITRUS COUNTY (FL) CHRONICLE CLASSIFIEDS A TREE SURGEON Lic. & Ins. Lowest Rates Free est. (352)860 -1452 All T ractor & T r ee W ork Land Clear ed, Hauling 1 time Cleanup, Drive ways (352) 302-6955 Bruce Onoday & Son Free Estimates T rim & Removal 352-637-6641 Lic/Ins D & R TREE SER VICE Lawn & Landscape Specialist. Lic. & Ins. Fr ee Est. 352-302-5641 All Major Cr edit Car ds Davies Tree Service Serving Area 15yrs. Free Est. Lic & Ins cell 727-239 -5125 local 352-344-5932 DOUBLE J T ree Service S tump Grinding, bulk mulch, lic/ins 302 -8852 R WRIGHT TREE Service Tr ee Removal & T rimming. Ins. & Lic.# 0256879 352-341-6827 RON ROBBINS Tree Service T rim, Shape & Remve, Lic/Ins. Free est. 352 -628 -2825 StumpGrinding cheap avg cost $25-18stump volume disc. over 5 call Rich 352-586-7178 Painting & W allpaper Removal, Husband & W ife T eam. Excel Ref. Fr ee Est. 352-726-4135 344-2556, Richard W ater Pump Service & Rep airsall makes & models. Call anytime! Attention Consumers!Please make sure you are using a licensed and insured service professional. Many service advertisers are required by st ate law to include their st ate license number in all adver tisement s. If you dont see a license number in the ad, you should inquire about it and be suspicious that you may be contacting an un licensed business. The Citrus County Chronicle want s to ensure that our ads meet the require ment s of the law Beware of any service advertiser that can not provide proof that they are licensed to do business. For questions about business licensing, please call your city or county government of fices. COUNTY WIDE DR Y-W ALL 25 ys exp lic2875,all your drywall needs! Ceiling & W all Rep airs. Pop Corn Removal 352 -302 -6838 TREE REMOV AL & STUMP GRINDING T rim/T r ee Removal, 55ft. Bucket T ruck 352-344-2696 Lic/ins. All phases of T ile Handicap Showers, Safety Bars, Flrs. 422 -2019 Lic. #2713 Home Maintenance Rep airs & Remodels Quality work at afford able prices 20 yrs exp. Ref avail 573-723-2881 Pressure W ashing, Painting, Lawn Mainte nance and Mobile Rep air Lic# 39477 (352) 464 -3748 Renovation/Remodel Kit/Ba/RE listings Lic/Ins. Crc 1327710 S terling 352 220 -3844 ELITE ROOFING Excellence in Roofing! EliteRoofing Inc.com Lic# Ccc1327656 /Ins. ***352 -639 -1024*** MACS MOBILE R V REP AIR & MAINT R VTC Certified T ech 352 -613-01 13, Lic/Ins. NA TURE COAST R V R V service, parts, sales Mobile Repair/Maint. 352-795-7820, Lic/Ins. *ABC P AINTING* 30 + YRS.EXP .LIC./INS for an EXCELLENT job Call Dale and Sons 352-586-8129 CALL STELLAR BLUE All Int./ Ext. Painting Needs. Lic. & Ins. FREE EST (352) 586 -2996 CHRIS SA TCHELL P AINTING ASAP 30 yrs. Exp., Excel. Ref. Insured 352-464-1397 INTERIOR/EXTERIOR & ODD JOBS. 30 yrs J. Hupchick Lic./Ins. (352) 726 -9998 Painting & W allpaper Removal, Husband & W ife T eam. Excel Ref. Fr ee Est. 352-726-4135 Bay Leak Detection for all Pools & Spas Lic#G13000070891 Ins. 352-433-6070 CALL STELLAR BLUE All Int./ Ext. Painting Needs. Lic. & Ins. FREE EST (352) 586 -2996 Lawncare N More Friendly Family Services for over 21 yrs. 352 -726-9570 Floors /walls. T ubs to shower conv. No job too big or small. Ph: 352-613-TILE /lic# 2441 MOBILE HOME rep air & remodeling kitchens, baths, floors, relevels, cc.221 1 (352)257-9056 A-1 Hauling, Cleanup s, garage clean out s, trash, furniture & misc. Mark (352) 287 -0767 JEFFS CLEANUP/HAULING Clean out s/ Dump Runs Brush Removal Lic. 352-584 -5374 Lawncare N More Friendly Family Services f or over 21 yrs. 352 -726 -9570 PIANO LESSONS Study Piano w/ Rick D Beginner to Advanced All styles 352 -344-5131 A Faux Line, LLC Paint, pres-wash, stains 20yrs exp, Cust. Satisfaction Lic/Ins 247-5971 A+ CLEANING Res/Com. 27 yrs exp. Lic/ bonded, client focused 386-717-2929 Anns Cleaning Service 352-601-3174 Home/Of fice Cleaning catered to your needs, reliable & exper .,lic/ins 796 -4645 / 345 -9329 All T ractor & T r ee W ork Land Clear ed, Hauling 1 time Cleanup, Drive ways (352) 302-6955 AllAROUND TRACT OR Landclearing, Hauling Site Prep, Driveways Lic/Ins 352-795-5755 CURB APPEAL Y ardscape, Curbing, Flocrete. River Rock Reseals & Rep airs. Lic. (352) 364-2120 D & R TREE SER VICE Lawn & Landscape Specialist. Lic. & Ins. Fr ee Est. 352-302-5641 All Major Cr edit Car ds Lawncare N More Friendly Family Services for over 21 yrs. 352-726-9570 *ABC P AINTING* 30 + YRS.EXP .LIC./INS for an EXCELLENT job call Dale and Sons 352-586-8129 ANDREW JOEHL HANDYMAN. Gen. Maint/Rep airs Pressure Cleaning. 0256271 352-465-9201 Andersen HandyMan Home Rep airs, Lawn Care. Cheaper Prices 352-453-6005 M & W INTERIORS Y our Dry W all & Home Handyman, Slick finish expert, popcorn removal water & termite damage (352)537 -4144 Pressure W ashing, Painting, Lawn Mainte nance and Mobile Rep air Lic# 39477 (352) 464 -3748 Comfort W orks, Inc. Air Conditioning and Heating Service Res//Com352 400-8361 Mention this ad and get a service call for $19. Exp 9/30/13 Lic# CAC1817447 AFFORDABLE T op Soil, Mulch, Stone Hauling & T ractor W ork (352) 341-2019 AllAROUND TRACT OR Land clearing, Hauling Site Prep, Driveways Lic/Ins 352-795-5755 COUNTY WIDE DR Y-W ALL25 yrs exp. lic.2875, all your drywall needs! Ceiling & W all Rep airs. Pop Corn Removal 352-302-6838 M & W INTERIORS Y our Dry W all & Home Handyman, Slick finish expert, popcorn removal water & termite damage (352)537 -4144 DUN-RITE ELECTRIC Since / Free Est. lic EC 13002699 352726-2907 Estates/Auction Services MAR TINS EST A TE SALES Buy Quality Fur nitur e Non smoking homes. 352-209-4945 ROCKYS FENCINGFREE Est., Lic. & Insur edH H 352 422-7279 H H A 5 ST AR COMP ANY GO OWENS FENCING ALL TYPES. Fr ee Est. Comm/Res. 628-4002 Install, r estr etch, r epair Clean, Sales, V inyl Carpet, Laminent, Lic. #4857 Mitch, 201 -2245 The average home col lect s up to 40 pounds of dust and dirt per year Imagine how much dust and dirt could be resting in your air duct s.Lic/Ins Homeduct s.com of fers duct cleaning at an af fordable rate. Click or call. 352 -362-5187. SMITTYS APPLIANCE REP AIR. Also W anted Dead or Alive W ashers & Dryers. FREE PICK UP! 352-564 -8179 JEFFS CLEANUP/HAULING Clean out s/ Dump Runs Brush Removal. Lic. 352-584 -5374 Diestler Computer New & Used systems rep airs. V isa/ MCard 352-637 -5469 BIANCHI CONCRETE INC.COM ins/lic #2579 Driveways PatiosSidewlk. Pool deck rep air /st ain. 352-257 -0078 CURB APPEAL Y ardscape, Curbing, Flocrete. River Rock Reseals & Rep airs. Lic. (352) 364-2120 ROBS MASONR Y & CONCRETE Driveways tear outs, tractor work, Lic. #1476, 726 -6554 000FUXT W ill haul away unwanted riding lawn mowers for FREE in Inverness area. 726 -7362 2 Professional Nursery Seed or Plant T ables All aluminum $200. W ood Cigar boxes $20 (352) 621 -0778 MENS 2 PIECE SUITS SIZE 34X30 & 36X30 $25 EACH 352-613 -0529 MENS P ANTS CASUAL 3 SIZES 36X30 & 2 CASUAL SHIRTS LARGE $20 352-613 -0529 MENS SPORTS JACKETS 4 SIZE 40R $10 EACH 352 -613-0529 STEAM & V AC Rug Cleaner By Hoover Does A Gr eat Job Cleaning All Rugs Asking $75. (352) 628-2844 4 WHEEL W ALKERseat, hand brakes & wheel locks, folds for storage, Ex., $45 352-628 -0033 30 GALLON AQUARIUM no leaks, includes newer heater and filter light, glass top, gravel $65.00 352 -201-4522 Above Gr ound Pool, 24 ft. up and runningpump, filter ladder very good cond. $500. Y ou must r emove 352-212-6433 APPLIANCES, like new washers/dryers, stoves, fridges 30 day warranty trade-ins, 352 -302 -3030 BOYS BICYCLE SPIDERMAN 16 WITH TRAINING WHEELS $30 352 -613 -0529 CAMCORDER Panasonic Camcorder with case $100.00 352-746 -5421 CHARCOAL GRILL 18.5 ON WHEELS WITH COVER $20 352-613 -0529 Designer Jackets, leather W 2 & 3X, New, $80 ea Ren. Chest Set, Must See $1,200 352-465-3086 FORENZA set of 4 st andard rims $40.00 Call 613 -4279 Kitchen Aid Mixer New $275. T if fany style Lamps 3 lar ge $70 ea. 352-465-3086 Queen size Mattr ess pillow top, very com fortable like new $80. 3 in one Printer Fax/Copier $25. (352) 637-6310 SPEAKERS 2 Optimus S peakers $30.00 352-746 -5421 S tudent desk Lamp Never used $20 613 -2797 T OASTER OVEN, COFFEE MAKER & ELECTRIC MIXER $20 352-613 -0529 V ACUUM CLEANER Hoover W ind tunnel Nearly New, Asking $35. (352) 628-2844 WOMENS RUBBER RIDING BOOTS $15 LIKE NEW SIZE 43L EUR MADE IN ISRAEL 419-5981 Back Packer Chair Lift for V an $200 Jazzi 1100 Electric Scooter $200 (352) 795-0049 Bob Diabetic Shoes, Beige, W omens Size 8, Medium width, never wor n, $80 (352) 522-0107 New Jazzy Electric Chair MUST SELL Cost $5,000 Selling $1,300. obo (352) 795 -7513 ACCORDION Santini 120 Base; Full size, double chamber pr estine $1500 (352) 794-6641 PIANO LESSONS Study Piano w/ Rick D Beginner to Advanced All styles 352-344-5131 NEW BA THTUB 6 f t.call for e-mail picture 40.00 linda 341 -2271 SEWING MACHINE Br other like new, in a 3 drawer wood cabinet. All accessories $125 Cash (352) 344-4070 AB-LOUNGER Used But a Few times, Paid $150. at Sears Asking $25. (352) 628-2844 Pr ofor m Cr osswalk 480 excel. cond. less than 50 mi. walk on it inclines, pr eset ifit trainer workout, built in fan, $225. 352-382-5208 Concealed W eapons Permit Course DANS GUN ROOM (352) 726 -5238 Fear No-Evil Guns Hi-Point & Berett a Concealed Classes 352-447-5595 Nike Sling Shots RH, steel shaft, Gap-thr ough 4 ir on $125. fir m Call (352) 382 -7473 RA YS GUN SHOP S tokes Flea Mkt Cry .Riv Mossberg 715T 22-AR $295. NRA-concealed classes 586-7516 4x8 Heavy Duty Utility T railer15 wheels, new tir es, good cond. $395. (352) 586-3209 Utility T railer 6 x 9 x 2 ft. wood/steel. frame $250. obo (352) 465-3086 I I I I I I I I T ell that special person Happy Birthday with a classi fied ad under Happy Notes. Only $28.50 includes a photo Call our Classified Dept for de t ails352-563-5966 I I I I I I I I W ANT TO BUY HOUSE or MOBILE Any Ar ea, Condition or Situation Fr ed, 352-726-9369 Robin Long Urban Suburban Hair Studio 352-637-0777 From Cutting Edge to Care Free S pecialty: Foils, Color Perms, Cutting, S tyling and Razor Cut s Redken Educator and trained 20+ years experience. W ed-Sat 9a-4p by appointment 4 yr old Umbrella cockatoo & Cockteil. Both hand fed, very t ame, incl. cages, food, toys. Lv Mg (443) 690 -7052 ANNE LISEAnne Lise, a 7-8 y.o. Blue T errier/Bull dog mix, spayed, housebrkn, & homeless. Family had to move so she came to the shelter W eighs about 65 lbs, and is a beautiful dog, sweet, affectionate, gentle, loyal, good w/other dogs, good w/childr en. Playful & full of life. Call Anne @ 352-586-2812. BAILEYBailey, Chespeake Bay hound mix, 2 y.o., HW-negative, wt. 39 lbs. Sits on command, loves tr eats, walks well on leash, good w/other dogs, attentive to human friends. Obeys well, wants to please. # 20731619. Call Joanne @ 352-795-1288 BEAGLE PUPPIES$100 Cryst al River Area 386-344-4218 386-344-4219 COCKER SP ANIELS 4 Males, 2 Females w/ papers. 8 weeks old Blonde & white $800 (352) 287-0519 Dorkie Poos 2 males, 2 females, silver dapple, brown dapple, fur balls .First shot s $300 (352) 464 -2382 Quaker Parakeet male 5-6 months old, gr een w/ gr ey chest. $200 (352) 464-3716 SHIH-TZU PUPS,A vailable Register ed Lot s of Colors Males st art @ $400. Females st art @ $600. Beverly Hills, FL (352) 270-8827 Sweet 3yr old female Lab. Spayed. Possible PTSD dog. Sm adoption fee (352) 794-6314 CYRILCyril, 1 y.o. Hound mix, found as stray, beautiful r ed-br own coat, wt. 42 lbs. Easy to walk, gets along w/other dogs. Appears to be housebr oken, healthy. Af fectionate & friendly. Good companion. # 20807791. Call Joanne @ 352-795-1288 LOKIELokie, a 3-y.o. br own. Petea 1-year-old mostly white terrier/?hound mix, Heartworm negative & housebr oken. Came to the shelter because his family could no longer af for d him. A very gentle, well-behaved dog, walks very well on a leash & gets along with other dogs. W eighs 51 lbs. Call Joanne @ 352-795-1288. SallieSallie, spayed terrier/Dalmation mix, wt. 35 lbs. HW-negative. V ery af fectionate & friendly, sits on command, loves tr eats. Gets along very well w/other dogs, housebrkn, slim & trim in appearance, would like a yar d to run in. Sweet & joyful, has br own polka-dots. Call Joanne @ 352-795-1288. SIMONwell-manner ed r etriever mix, 3 y.o. Sits, gives his paw, goes down for tr eats, takes gently. W alks well on leash, behaves in public places. High ener gy, likes to run & play, plays catch, plays in pool. Good w/most dogs. Call Christina @ 352-464-3908. TOBYT oby, black/white terrier mix, neu ter ed, HW-negative. Housebrkn, wt 45 lbs,. V ery friendly, gets along with other dogs well, also cats. About 6 years old, gr eat shape, intelligent, lively, walks well on leash, likes kids. Gr eat companion-to-be. Call Joanne @ 352-795-1288 ZOEYZoey, a 7-8 y.o. blue/white T errier/ Bulldog mix, spayed and housebrkn. Came to the shelter after her family had to move and could not take her She is sweet & exception ally gentle, af fectionate & beautiful. Likes other dogs & also childr en. V ery playful. W eight about 60 lbs. Call Anne @ 352-586-2812. CHICKENS 10 Laying chickens Make r easonable of fer (352) 382-2350 LM BRING YOUR FISHING POLE! INVERNESS, FL55+ p ark on lake w/5 piers, clubhouse and much more! Rent incl. grass cutting and your waterH 2 bedroom, 1 bath @$500 Pets considered and section 8 is accepted. Call 800-747-4283 For Det ails! CR YST AL RIVER 2/2, inclds H2O, sew, trash. (352) 584-3348 CR YST AL RIVER 3/2, $450.mo., & 4/2 $550. No Dogs 352-795-9738 HOMOSASSAAttractive 2BR, 2BA DW on 1 AC, carport scr n. por completely well furni. $600 mo. $600 dep 352-628-1723 LECANTO2/2, Doublewide $575. (352) 212-9682 7677 W est Chassahowitzka St. 2BD, 2BA, Mobile Detached Garage Scr n. por ch, lease or Sale, $2,000 down $732. mo. 877-499-8065 $11,094, DISCOUNT New Jacobsen, 2085 sq. ft., 4BR/3BA yr W arranty. No down payment, use land or trade in. Payment only, $471.18 P & I, W AC Call 352-621-9182 ABSOLUTEL Y STUNNING NEW 3/2, JACOBSEN HOME 5Yr W arranty $2,650 down, only $297.44/ mo., Fixed rate W .A.C. Come and V iew 352-621-9181 BAD CREDIT? FORECLOSURE? BANKRUPTCY? W ant your own home? I can help!! 35% down cash or land and you ar e appr oved. No gimmick, 386-546-5833 Singing Forest 46 2 Bed 1 Bath. Mobile Home, fixer upper $6000. 352 -344-1365 T ir ed of Renting? Super clean 2004 3BR/2BA, on acr e r eady to move in!!! $3,500 down, $380.03/mo. W .A.C. Call 386-546-5833 for details W ont last! USED HOMESSingle, Double & T riple W ides Starting at $6,500 Call (352) 621 -9183 2011 Live Oak 4BR/2BA $46,900, 28x60 INVERNESS 55+ p ark Enjoy the view! 2 bd, 1 bath Lot rent, car port, water grass cutting included. Call 800-747-4283 for details HOMOSASSAOwner Financing, 3/2, older MH on 2 acres, in side remodeled, fenced yard, $4k down $535 per mo. 352-302 -9217 TA YLOR MADE HOMESLOT MODEL BLOWOUT All Homes Discounted $4,000 to $8,000 Even up to $12.000 off S ticker Price Call 352-621 -3807 Doublewide, 2 BR, 2BA, Recent shingle r oof New AC, MUCH MORE 55+ Park $15,500 (352) 634-0274 WESTWIND VILLAGE 55+ Rent or Bu y $8,000 & Up Mon Fri. 8:30 1 1 am Call for Appointment (352) 628 -2090 FLORAL CITYLAKEFRONT 1 Bedr m. AC, Clean, No Pets (352) 344-1025 ALEXANDER REAL EST A TE (352) 795 -6633 Cryst al River Apt s, 2 BR/ 1 BA $400-$500, ALSO HOMES & MOBILES AV AILABLE CR YST AL RIVER Large 2/2 CHA, W/D hk-up $590/mo.1st Mo. FREE with $600. no dogs. 352-726-9570 HOMOSASSA2/2, clean, quiet, centr location $550., 352 563-2114, 257-6461 INVERNESSBeautifully Remodeled on golf course, 2/2/2 $875 352-895-0744 PELICAN BA Y AP AR TMENTS2 BDRM. APT HOMES Carpet, Appliances, Central Heat & Air Rental assistance available to qualified applicants. If qualified, pay no mor e than 30% of your households adjusted monthly income for r ent and utilities. FOR RENT AL INFO. & APPLICATION 9826 W est Ar ms Dr Crystal River 352-795-7793 TDD#1-800-955-8771 Mon-Fri., 9:00-5:00P Equal Housing Opportunity Pr ovider & Employer CR YST AL RIVER2/1, Unfurn.$550, Furn. $600.+sec clean, quite. Small Pet 828 5th A ve. NE. 727-455 -8998 727 -343 -3965 CR YST AL RIVERBUSINESS. LOC. FOR RENT Hwy 19 Downtown exec. location,1000 sf V ery Clean remodeled 352-634-2528 Sugar mill W oods2/2/1, like new, long T er m, (352) 428-4001 CR YST AL RIVER Large 2/2 CHA, W/D hk-up $590/mo.1st Mo. FREE with $600. no dogs. 352-726-9570 CR YST AL RIVERFully Fur nished Studio ef ficiency w/ equip ped kit. All util., cable, Inter net, & cleaning pr ovided. $599.mo 352-586-1813 HERNANDOAffordable Rent als W at son s Fish Camp (352) 726 -2225 CR YST AL RIVER 2-3 BR $200-$250/mo 552-2637, 527-6566 CR YST AL RIVER3/2 Clean, $800. mo. 352-795-6299 352-364-2073 HERNANDO 3/2/2 Rent or Rent to Own built in $850/mo. www .ricky bobs.com 352-613-5818 INVERNESS3/2/2 St arting @ $750. www .relaxfl.com 352-403-4646 or 352-403-4648 RENT TO OWN!!No Credit Check! 3BD $750 -$825 888-257-9136 JADEMISSION.COM CR YST AL RIVER 1/1, Apt. W ater fr ont $650. mo. 1st sec. Inclds dock, water trash. No pets. 772-240-6180 HERNANDOAffordable Rent als W at son s Fish Camp (352) 726 -2225 INGLISCharming furn or unfurn ef fic/cott age all utilities incld. $595 no smoking 352-422-2994 HERNANDO 3/2/2 Rent or Rent to Own built in $850/mo. www .ricky bobs.com 352-613-5818 PUBLISHERS NOTICE:All real est ate advertising in this newsp aper is subject to Fair Housing Act which makes it illegal to advertise any preference, limit ation or discrimination based on race, color religion, sex, handi cap, familial st atus or national origin, or an intention, to make such preference, limit ation or discrimination. Familial st atus includes children under the age of 18 living with p arent s or legal custodians, pregnant women and people securing custody of children under 18. This newspaper will not knowingly accept any advertising for real estate which is in violation of the law Our readers are hereby informed that all dwellings adver tised in this newsp aper are available on an equal opportunity basis. T o complain of discrimination call HUD toll -free at 1800-669-9777. The toll-free telephone number for the hearing imp aired is 1-800-927-9275. Tweet Tweet Tweet Follow the Chronicle on citruschronicle news as it happens right at your finger tips PAGE 20 10 MOND AY ,SEPTEMBER 23, 2013 CLASSIFIEDS CITRUSCOUNTY( FL ) CHRONICLE 443-0923 MCRN FICTITIOUS NAME NOTICE PUBLIC NOTICE Notice under Fictitious Name Law, pursuant to Section 865 -09, F .S. NOTICE IS HEREBY GIVEN that the undersigned, desiring to engage in sion of Corporations, T allahassee, Florida. DA TED at Inver ness, Florida this 19th day of September 2013. /s/ Craig Kaiser Owner Published one time in the Citrus County Chr onicle, September 23, 2013. business under the ficti tious name of: GO ACTIVE MARKETING located at 104 S. Golf Harbor Path #3 Inver ness, Florida 34450 in the County of Citrus, in tends to r egister said name with Florida De partment of State, Divi 440-0923 MCRN ENTERPRISE ZONE DEVELOPMENT AGENCY BOARD MEETING PUBLIC NOTICE NOTICE OF MEETING ENTERPRISE ZONE DEVELOPMENT AGENCY NOTICE IS HEREBY GIVEN that the Citrus County Enterprise Zone Development Agency Boar d will meet on W ednesday, October 4, 2013, at 10:00 AM at the Lecanto Gover nment Building, 3600 W est Sover eign Path, Room 166, Lecanto, Flor ida, to discuss business of the Enterprise Zone Development Agency Boar d which may pr operly come befor e them. Any person r equiring r easonable accommodation at this meeting because of a disability or physical impair ment should contact the County Administrators Office, 110 North Apopka A venue, Inver ness, FL 34450, (352) 341 -6560, at least two (2) days befor e the meeting. If you ar e hearing or speech impair ed, use the TDD T elephone (352) 341 -6580. If a person decides to appeal any decision made by the Enterprise Zone Devel opment Agency Boar d with r espect to any matter consider ed at this meeting, he/she will need to ensur e that a verbatim r ecor d of the pr oceedings is made which r ecor d shall include the testimony and evidence upon which the appeal is to be based. BY : Jim Faulkner Director Geographic Resour ces and Community Planning Published in the CITRUS COUNTY CHRONICLE September 23, 2013. 442-0926 MCRN 9/26 Meeting PUBLIC NOTICE NOTICE IS HEREBY GIVEN that the Citrus County Sherif fs Of fice of Citrus County, Florida, will begin collective bar gaining talks with The Pr ofessional Fir efighter of Citrus County, Local 4562 on September 26, 2013 at the Operations Center located at 1 Dr Martin Luther King Jr A ve, Room 245, Inver ness, FL 34450 beginning at 2:00 p.m. These discussions ar e open to the public. Any person requiring r easonable accommodation at this meeting because of a disability or physical impair ment should contact the Human Resour ces Of fice, 1 Dr Martin Luther King Jr Ave, Inver ness, Fl 34450, (352)726 -4488 a minimum of two days prior to the meeting. If you ar e hearing or speech impaired, use the TDD telephone. Published in the Citrus County Chr onicle, September 23, 2013. 441-0923 MCRN 10/7 sale PUBLIC NOTICE NOTICE OF PUBLIC SALE: T OW PROS OF OCALA gives Notice of Foreclosure of Lien and intent to sell these vehicles on October 7, 2013, 8:00 am at 1914 N MAGNOLIA A VE OCALA, FL. 3447591 15, pursuant to subsection 713.78 of the Florida S t atutes. T OW PROS OF OCALA reserves the right to accept or reject any and/or all bids. KNAFB121XY5841 142 2000 KIA Septmber 23, 2013. 437-0923 MCRN McCauley, Jason 2009 -CA-004164 NOA PUBLIC NOTICE IN THE CIRCUIT COUR T OF THE FIFTH JUDICIAL CIRCUIT IN AND FOR CITRUS COUNTY FLORIDA CASE NO. 2009 -CA-004164 CITIMOR TGAGE, INC. Plaintif f, vs. JASON NEEL Y MCCAULEY et al Defendant(s). NOTICE OF ACTION TO: THE UNKNOWN SPOUSE, HEIRS, BENEFICIARIES, DEVISEES, GRANTEES, ASSIGNEES, CREDITORS, TRUSTEES AND ALL OTHER P AR TIES CLAIMING AN INTEREST BY THROUGH, UNDER OR AGAINST THE EST A TE OF ETHEL M. MCCAULEY DECEASED RESIDENT : Unknown LAST KNOWN ADDRESS : 10015 WEST MONTYCE COUR T CR YST AL RIVER, FL 34428 YOU ARE HEREBY NOTIFIED that an action to for eclose a mortgage on the following described pr operty located in CITRUS County, Florida: Lot 24 of BASS LAKE EST A TES an unr ecor ded subdivision in the NW 1/4 of Section 10, T ownship 17 South, Range 17 East, Citrus County, Florida being further de scribed as follows: the East 153 feet of the W est 480 feet of the North 286.0 feet of the South 572.0 feet of the NW 1/4 of said Section 10, subject to an ease ment on the South 25 feet ther eof. 438-0923 MCRN Sutherland, W illett 2012 CA 001551 A NOA PUBLIC NOTICE IN THE CIRCUIT COUR T OF THE FIFTH JUDICIAL CIRCUIT IN AND FOR CITRUS COUNTY FLORIDA CASE NO.: 2012 CA 001551 A CITIMOR TGAGE, INC. SUCCESSOR BY MERGER TO ABN AMRO MOR TGAGE GROUP INC. Plaintif f, vs. WILLETT R. SUTHERLAND, et al Defendant(s). NOTICE OF ACTION TO: UNKNOWN SPOUSE, HEIRS, BENEFICIARIES, DEVISEES, GRANTEES, ASSIGNEES, CREDITORS, TRUSTEES AND ALL OTHER P AR TIES CLAIMING AN INTEREST BY THROUGH, UNDER, OR AGAINST THE EST A TE OF WILL WTT R. SUTHERLAND, DE CEASED AS DEFENDANTS RESIDENT : Unknown LAST KNOWN ADDRESS : 714 EAST INVERNESS BOULEVARD, INVERNESS, FL 34452-6804 YOU ARE HEREBY NOTIFIED that an action to for eclose a mortgage on the following described pr operty located in CITRUS County, Florida: Lots 58 and 59, Block 238, Inver ness Highlands South, accor ding to the map or plat ther eof as r ecor ded in Plat Book 3, Page 60, of the Public Recor ds of Citrus County, Florida. 000FUY0 S pecializing in Acreage,Farms Ranches & Commercial Richard (Rick) Couch, Broker Couch Realty & Investment s, Inc. (352) 212 -3559 RCOUCH.com UNIQUE & HISTORIC Homes, Commercial W aterfront & Land Small T own Country Lifestyle OUR SPECIAL TY SINCE 1989LET US FIND YOUA VIEW T O LOVE www crosslandrealty .com(352) 726 -6644Crossland Realty Inc. BEVERL Y HILLS 324 S Monroe. Sunday 12 -3p Completely Remodeled Imperial Exec. 2 br 2 ba, 2 gar NEW: Roof, kitchen w/stainless, baths, flooring etc. $79k. 527-1239 21 1 Northeast 4th S treet, Chiefland, FL BANK OWNED ABSOLUTE AUCTION 6,400+/SF of sp ace in 2 Buildings on 1.16 Acres. One vacant single family home and a sec ond bldg. used as a daycare facility Inspect: Sept. 30th @ 1 1 AM Onsite Auction with W ebcast bidding on October 2nd @ 3 PM Local cont act: Julian Howell, 877 -980 -9565. More info at www .auctionEbid.com FLBKR#CQ1029847 Auction MGMTCorp. Jeb@auctionEbid.com HERNANDO1000+ sf.of of fice space. Heat/Elec incld, ample pkg $750 (352) 726-3339 3/1, fenced yar d, cor ner lot. Needs some r epairs. As is $39,500 Negotiable 2081 W Gar denia Dr (352) 465-0623 Call me to lear n about a Fr ee Home W arranty Plan!!Buying or Selling Realty Connect T eri PaduanoOwner/Broker 15+ Y earsExperience 352-212-1446 Connect.me T imberlane Estates! 3/2/2, w/ scr een pool, Located on 1 AC 2690 W Expr ess Lane $139,000 Call Gwen 795-1520 or 634-1725 Citrus Hills 3/2/2 caged pool, 1 acr e, gr eat neighbor hood, call for details (352) 746-6552 2 BR, 2BA, Den, lanai, Scr nd heated pool, Cen. AC, poll bar n, 1 AC, fenced, well, many extras. By Appt. $129,900 fir m (352) 444-2371 or (352) 586-7602 117 S Lunar T errace2 bedroom. 2 bath. c/h/a,T otally Updated! Block home, Clean, Over-sized Garage, W/Carport. $79,500 Negotiable Call 352-344 -9290 8535 E Gospel Island Rd Inverness 3 bed room. 2 bath. W ater front living and all the luxuries. 30 Ft glass porch, cathedral ceil ings. Extensively rennovated including wood and tile floors. Granite and new roof and kitchen. Over 2000 Sqf t Living area. $139,900 352 -817-5875 or miksh@earthlink.net INVERNESS2002, Custom Built 3/2/2 W ith Extra Lot $1 14.500.352-344-3112 RENT TO OWN!!No Credit Check!3BD $750 -$825 888-257-9136 JADEMISSION.COM HOMOSASSA 5+ DEN, BEDROOMS. 3 BA TH. THIS HUGE AND BEAUTIFUL TWO ST OR Y HOME WITH 3 CAR GARAGE IS OVER 3500 SQ. FT HOME BACKS UP T O A NA TURE PRESER VE HOME IS A FORECLOSURE SHOR TSALE AND THE BANK IS WORKING WITH THE SELLERS. THIS HOME W AS BUIL T IN 2005 dennis_neff @yahoo.com Sugarmill W oods 3/2/2 Den, Fam Rm, W ood Floors, 1 YR W arranty 31 Pine S t, Homosassa $149,000 Realty Connect 212-1446 T AMI SCOTTExit Realty Leaders 352 -257 -2276 exitt ami@gmail.com When it comes to Realest ate ... Im there for you The fishing is great Call me for your new W aterfront Home LOOKING T O SELL ? CALL ME T ODA Y! HOMOSASSA4/2 BLOCK HOME, MOTHER IN LA W APT decking, 1/4 ac, fenced, lot of privacy $65,000 (305) 619 -0282, Cell Your world firstemployment Classifieds ww.chronicleonline.com Need a job or a qualified employee? This areas #1 employment source! Buying or Selling REAL EST A TE, Let Me W ork For Y ou! BETTY HUNTREAL T ORERA KEY 1 Realty, Inc. 352 586 -0139hunt4houses68 @yahoo.comwww .bettyhunt s homes.com. Phyllis StricklandRealtorBest T ime T o Buy! Prices are going up. So is interest. BUY NOW!Owner Financing Foreclosures TROPIC SHORES REAL TY (352) 613 -3503 BETTY J. POWELLRealtorY our Success is my goal.. Making Friends along the way is my r ewar d !BUYING OR SELLING CALL ME 352-422-6417 bjpowell@ netscape.com ERA American Realty & Investments CUSTOM Built LUXUR Y HOME 3/2/3, Family Rm, gour met kit, pool & much mor e! 2,653 LivSF $319K. CanBY ours.com Realty Connect T eri Paduano 352-212-1446 I Buy Houses Cash ANY CONDITION Over Financed ok! call ** 352-503-3245** I NEED HOMES TO SELL DEB INF ANTINERealtor(352) 302 -8046 Real Estate!... it s what I do. ERAAmerican RealtyPhone: 352-726-5855 Cell: 352-302 -8046 Fax: 352-726-7386 Email:debinfantine@ yahoo.com MINI F ARMS AREA 4/2 on 10 ACRES 20 x 40 Pole Bar n Move in Condition $139,900. 352-249-1248 RENT TO OWNno bank, smalldown pmt. 2/1, $53,579k t ake over payment s 352-503-3245 MICHELE ROSE RealtorSimply put I ll work harder 352 -212 -5097 isellcitruscounty@ yahoo.com Craven Realty Inc. 352 -726 -1515 SANDI HAR T RealtorListing and Selling Real Estate Is my Business I put my heart into it!352-476-9649 sandra.hart@ era.com ERA American Realty 352-726-5855 T ony PauelsenRealtor 352-303-0619 ILL T AKE NEW LISTINGS BUYING OR SELLING T OP PERFORMANCEReal est ate Consultant tp auelsen@ hotmail.com Whispering Pines V illa 2/2/1, new carpet, tile, p aint,all appliances including w/d. $69,900. (352) 726 -8712 Bank Appr oved Sale. Smith Lake Alabama. Deep Dockable Home Sites fr om $59,900 (T ake V irtual T our @ LiveLakefr ont.com). 26 Prime Lake fr ont lots or der ed sold October 12th. Buy at pennies on the dollar all must go! Open or wooded level thr oughout to the waters edge. Make an early appointment. Banks loss -Y our gain! Dont miss this. Its unbelievable land at an unbelievable price Call now for early appointment! 1-877-448-6816. FREE Foreclosure and Short Sale List s Desperately Need Rentals Office Open 7 Days a W eekLISA V ANDEBOE Broker (R) Owner Plant ation Realty 352 -634 -0129 www .plant ation realtylistings.com Old Homosassa 3 bed room. 2 bath. Newly renovated: new floors, cabinet s, appliances. 2 car garage/workshop. Large double corner lot in Old Homosassa s best area. Deep water Gulf access with no bridges. Private boat launch ramp, dock with elec. Minutes to The Freezer & McCrea s. Documented $3,000+ monthly vacation rent al income. Owners downsizing. E -mail: docgp ax3@aol.com or call: 352.634.2534 Listed @ $259,500. Y our Worldof garage sales Classifieds ww.chronicleonline.com YOUR High-T ech W ater Fr ont Realtor ROD KENNER 352-436-3531 ERA Suncoast Realty SCAN OR GO TO www. BestNatur eCoast Pr operties.com T o view gr eat water fr ont pr operties Lake Pananosoffke Ready for home, septic, pwr, carport, 2 sheds & fenced bk yard $19,900 obo 352-444-2272 189 SHEARER ST INGLISImproved 1 acre lot, no imp act fees, well (city water available), septic, electric, shaded with oaks & pines, motivated seller asking $9,000 OBO Cell phone 352 -428-0930 Outboard Motor 25HP Evirude with controls, very good cond. $750 obo 476-11 13, 513-5135 ** BUY SELL** & TRADE CLEAN USED BOA TS THREE RIVERS MARINE US 19 Cryst al River **352 -563-5510** 17 KEY WEST2013 Skif f, Y amaha 70 4-stroke, Jack Plate, T rolling Motor Gauges, GPS, Alum T railer T ransferrable W arranty Excellent $19,500 352 503 -6668 BASS TRACKER2005, 50HP Mer cury PT 175 Special Edition, mint cond., Call for info. (352) 400-9490 GALALEO Duck Boat 17f t fiberglass, 25HP Go Devil. long shaf t, new trlr Ready to Hunt, $4,500 352 -586-8946 MERC CRUISER1993, 20ft, Ster n Drive, Sylvan, Bar ely used, but runs gr eat. or g. $12,000 Asking $6,500 obo (352) 228 -1355 PONTOON20 FT 1994 Monar ck new vhf radio & gps fishfinder Gd Cond. $6500. (352) 527 -4247 SWEETW A TER1991, 15 f t., seat s 8, 35HP trailer excellent cond. $3,250 476-11 13, 513-5135 WE HA VE BOA TS GULF T O LK MARINE W e Pay CASH For Used Clean Boat s Pontoon, Deck & Fishing Boat s **(352)527 -0555** boat supercenter .com Phoenix Cruiser 2004, Excellent Cond, low miles, new tir es, with slideout. (352) 270-8084 MACS MOBILE R V REP AIR & MAINT R VTC Certified T ech. 352-613-01 13, Lic/Ins. NA TURE COAST R V R V service, parts, sales Mobile Repair/Maint. 352-795-7820, Lic/Ins. Salem Cruise Lite2011 T ravel T railer 28 ft bunk hse. slideout non-smkers. Exc Cond $10,000. 813-957-8605 SKYLINE 1995, Slide in cab over Camper Fully equip. generator fridge, micr owave, AC, & elect. jacks Loaded. $2,800 obo (352) 422-4548 T ravel T railer2011, 20 Mini Lite. Fully self contained. LRoom Slide out. Many Extras. Exc Cond. $15,400 obo (352) 527-0081 WE BUYR VS, TRA VEL TRAILERS, 5TH WHEELS, MOT OR HOMES Call US 352-201-6945 SOFT TOPPER for Short bed pick -up. Like New $250 obo (352) 422-5579 TOW BAR Roadmaster Falcon T ow Bar All connections $250 (352) 795-5991 **BEST PRICE** For Junk & Unwanted Cars CALL NOW **352 -426-4267** BIG SALE* Come make of fers RENT BUY SELL CAR TRUCK BOA T CONSIGNMENT USA US 19 & US 44, CR 461-4518 & 795-4440 BUYING JUNK CARS H Running or Not H CASH P AID-$300 & UP (352) 771 -6191 CASH BUYERS Buying Used Cars T rucks & V ans, For used car lot, Hwy 19 Larry s Auto Sales 352-564-8333 T aurus Met alRecycling Best Prices for your cars or trucks also biggest U-Pull -It with thousands of vehi cles of fering lowest price for p art s 352-637-2100 BIG SALE* Come make of fers RENT BUY SELL CAR TRUCK BOA T CONSIGNMENT USA US 19 & US 44, CR 461-4518 & 795-4440 BUICK REGAL2001 LS, leather Inter very good cond., 6 cyl. 82k mi. One owner $4,500 352 -746-6708 CADILLAC2004 Seville SLS, full power runs gr eat, like new condition $3800 (352) 795-8986 CHEVROLET 2010 Malibu, L T, 1 owner $11,495 352-341-0018 CHEVY2008, Cobalt, 2 DR, automatic, power windows, power locks, cold A/C, Call for Appointment 352-628-4600 DODGE2000, Intr epid, V ery good cond. 85K miles, $2,000. (352) 527-3188 FIA T Spider 2000 Conv. 58K miles, new r oof, good rubber runs $2,000 (352) 564 -0364 FORD2004, Mustang, Looking for a sports car? Her e it is, 6 cyl. automatic, appointment Only Call 352-628-4600 FORDMustang Convertible, 23,600 miles, gray, black top, $14,400. (352) 503-7237 HONDA2013 Civic LX, Priced to sell, Serious callers only 352-628-9444 MAZDA2005 Mazda 6, 5 -speed, 4door one owner great condition, 141,000 miles $3,500. 352-860-2146 MERCUR Y, Cougar 125k mi., 2 DR, runs gr eat, cold air good tir es, $1,400 (352) 344-0547 TOYOT A2010, Y aris, 3 door , $9,995. 352-341-0018 VOL VO2001,S40, leather clean $4,995. 352-341-0018 CHEVROLET2009 COR VETTE COUPE Z51: Jet stream blue w/ebony int., 2L T Auto w/PS, 340hp LS3 eng., only 9500 mi., car show winner serious inquiries only first $35K/OBO get s it. Let s t alk @ 352 -249-7630 CHEVY1981 Corvette Under 50,000 orig. mi les, Shark Body S tyle, V ery Good Condition, Garage stored 352-400-4704 DA TSON 280ZXAttention Z lovers Datson, Inline6 turbo, eng. & trans good, nds loving restoration $500 (352) 344-3080 FORDRat Rod Project s, 46 Ford PU Roadster Ford Model T Boatt ail speed ster all steel., Inglis 352-949-7874 I I I I I I I I T ell that special person Happy Birthday with a classi fied ad under Happy Notes. Only $28.50 includes a photo Call our Classi fied Dept for de t ails352-563-5966 I I I I I I I I BIG SALE* Come make of fers RENT BUY SELL CAR TRUCK BOA T CONSIGNMENT USA US 19 & US 44, CR 461-4518 & 795-4440 DODGE2500, 01, 6 Spd Qcab, dsl, 5th whl hkup, fully loaded + xtras, 2 new tir es runs gr eat, 33mpg, needs clutch soon 113k, HOT! $8400. obo (352) 465-3086 FORD1992 Flairside 4x4 302, r ed, 4 lift traction bar chr ome brush guar d, steps & bedrail. A beauty in & out. $5,500 (352) 344 -8089 NISSAN FRONTIER CREW CAB SV 20122012 Frontier CC SV : This white Nissan Fron tier Crew Cab SV is in excellent condition with only 8,500 miles. It has cruise control, power windows/door locks/outside mirrors. It has a factory inst alled bed liner and I added a vinyl tri-fold bed cover and trailer hitch. The truck is in perfect condition with a full factory warranty The asking price is $21,900. Phone: 352 -601-1319 CHEVROLET2006, Suburban 4 x 4, $8,995. 352 -341 -0018 FORD2007, Escape $7,995. 352-341-0018 HONDA2007, Element, Har d to find, cold A/C, runs gr eat, Must See, Call (352) 628 -4600 CHEVY2003 V entur e V an, 7 pass. and priced to sell. Call 352 -628-4600 For appointment Harley Davidson2005, 1200 Custom, Extra Chr ome, new tir es, just serv, 16,000 mi. $3700 obo. Poss trade for veh. (352) 220 -8444 Harley Davidson201 1 FL TRU Road Glide Ultra loaded cruise, cd, cb,intercom, abs, anti theif,6 speed, and 103cc motor only 5886 miles $19,000 (352)212 -4101 HARLEY DA VIDSON2012 FLHTCUTG T ri Glide Ultra Classic AMFM/CD/AUX w/speakers; CC, Fairing Full, Alarm, T ravel trunk w/rack, st age 2 screaming eagle high perfor mance exhaust & pipes; ABS brakes, extra chrome accent s. Excellent condition w/only 1250 mi. First $28.5K. Let s t alk @ 352 -249 -7630. HONDA2007 VTX 1300C Original owner purchased brand new low mile age (2,371 miles). Caf windshield, re movable saddlebags, light -bar Black & chrome. Showroom condition (mint). Asking a firm $5,050.00 Please con t act owner\seller via Email: selfor@aol.com Phone: (352)382-4422 KA W ASAKI2002 V ulcan 1500, 7500 mi, Exc Cond $5000 (352) 341 -5263 SNAPPER 2008 Riding 30 inch cut 12.5 HP $500 (352) 341-5263
|
http://ufdc.ufl.edu/UF00028315/03231
|
CC-MAIN-2018-34
|
refinedweb
| 32,395
| 66.03
|
An integral part of any application is the data that flows from one state of our app to another. This data may be static, from the file system, or, as is the case with many dynamic applications, from an external source.
In this tutorial, we’ll go over a few ways to handle data fetching in Next.js. We’ll use Strapi as a data source for the purpose of this tutorial, but there are many other sources you could use to achieve the same result.
All the code written in this tutorial is availalbe in the GitHub repo.
What is Next.js?
In simple terms, Next.js is a React framework for building highly dynamic applications. According to the official website, it comes out of the box with support for the following:
- Prerendering — you can choose to statically generate your pages at build time or server-render them on every request
- Zero configuration — automatic code-splitting, filesystem-based routing, and hot code reloading
The first point is what we’ll focus on in this tutorial. But before we begin, a quick overview of Strapi.
What is Strapi ?
According to the official website, Strapi is an open-source, headless CMS that is “100% Javascript, fully customizable, and developer-first.”
With Strapi, you can build APIs and manage website content easily without sacrificing the flexibility to customize your experience.
Prerequisites
To follow along with this tutorial, you should have the following:
- A basic understanding of asynchronous JavaScript
- A basic understanding of React
- Node.js installed
Installation
To install Strapi globally, run the following.
yarn add global create-strapi-app
Run the command below to install Next.js globally.
yarn add global create-next-app
Scaffolding the backend
To begin, create a new directory for your project.
mkdir nextjs-strapi-data-fetching
cd into the new directory with this snippet:
cd nextjs-strapi-data-fetching
Next, scaffold a new Strapi app into a
backend folder.
create-strapi-app backend --quickstart
This creates a new Strapi app in a folder called
backend. The
--quickstart flag tells Strapi to use SQLite as database of choice. To use a different database, you would omit the flag and select another database whem prompted.
Depending on your network speed, the installation might take a few minutes. Once that’s done, run the following snippet to start Strapi in development mode.
yarn develop
Your browser should automatically open on. If not, manually open it in your browser of choice.
Creating a new user
On this screen, you’ll see a registration form like the one below.
Go ahead and complete the form with your details. This step is required for subsequent logins to the admin dashboard.
The genres endpoint
At this point, your dashboard should look something like this:
Your APIs are listed at the top-left corner of this page. For now, it should only include the Users API.
To create a new Genres endpoint, click “Content-Type Builde” on the sidebar. When redirected, click “Create new collection type” and give it a display name of “genre.” Note the singularity of the word; Strapi automatically pluralizes it.
The modal screen should look like this:
Clicking “Continue” should bring up another screen to select the fields for this collection. Choose the “Text” field from the list and give it name. Click “Advanced settings” and check the “Required field” box to ensure this field is required when creating a new genre.
You’re done creating the genres endpoint. Easy, right? Don’t worry about the Movies field right now; we’ll get to that when we create the movies API.
The movies endpoint
To create movies API, you can follow the same steps you took to create the genres API. Only this time, you’ll need more fields.
The table below explains the fields for the movies API:
For the genres field, after selecting relation as the type, choose the “Movies has and belongs to many Genres” relation as shown below.
Now that you’ve created a relation between movies and genres, when you request for movies, you’ll also get the corresponding genres and vice versa.
Feel free to be as loose or strict with the required fields as you wish.
Adding data
To add data to the database, simply select any of the APIs on the sidebar, click “Add new,” and fill in the details.
The genres screen should look this:
The movies screen should look this this:
Roles and permissions
By default, whenever you create an API, Strapi creates six endpoints from the name given to the API. The endpoints generated for movies should look like this:
By default, they’re all going to restricted from public access. Now you need to tell Strapi that you’re okay with exposing these checked endpoints to the public. Go to Roles and Permissions > Public > Permissions and check
find and
findOne for both genres and movies.
You should have the following endpoints.
- Get all movies:
- Get a single movie:
- Get all genres, and
- Get a single genre:
Below are the genres I created in beforehand.
If you’ve made this far, you’ve completed the backend section of this tutorial. Next, we’ll show you how to consume this data on the frontend.
Scaffolding the frontend
Before we begin, make sure you’re in the project root,
cd into the project root with this snippet:
cd ..
Scaffold a new Next.js app into a
frontend folder
create-next-app frontend
What this snippet does is create a new Next.js app in a folder called
frontend. This may take a few minutes to install depending on your network speed.
Setting up Tailwind CSS
We’ll use Tailwind CSS to style this application. If you haven’t used it before, don’t worry; just follow along or bring your own styles. Thankfully, this is the only dependency you need to install for this tutorial.
To install Tailwind CSS, paste the following snippet.
yarn add tailwindcss
To import Tailwind CSS, open
frontend/pages/_app.js and paste the following import statement at the top.
// frontend/pages/_app.js import 'tailwindcss/dist/tailwind.css'
The above command importa Tailwind CSS directly from
node_modules.
_app.js is a special file in Next.js that controls page initialization. This is suitable for adding global CSS to the entire website.
Run the following to start Next.js in development mode on.
yarn dev
Preparing the environment variables
Next.js has support for loading environment variables into your project. Simply create a
.env.development file at the root of the
frontend folder and paste in this snippet:
NEXT_PUBLIC_BASE_URL=
This will enable you to access this variable with
process.env.NEXT_PUBLIC_BASE_URL. It’s worth noting that this method exposes the variables in Node and the browser environment. Ideally, if you have secrets that do not need end up in the browser, then remove the
NEXT_PUBLIC_ prefix.
Making asynchronous requests
Now is a good time to set up a utility function to handle all your fetch requests. Since you’ll be be using almost identical fetch requests in multiple places, it’d be nice if you could abstract that functionality.
Create a
utils.js file in the
frontend folder and paste in the following snippet.
//frontend/utils.js const baseUrl = process.env.BASE_URL async function fetchQuery(path, params = null) { let url if (params !== null) { url = `${baseUrl}/${path}/${params}` } else { url = `${baseUrl}/${path}` } const response = await fetch(`${url}`) const data = await response.json() return data } export { baseUrl, fetchQuery }
This defines a new
fetchQuery function that accepts a path and optional params. Those arguments are passed to the
fetch function to fetch data from whatever path you specify and, finally, return some data.
Next, export the
fetchQuery function and the base URL defined in the environment variable.
The layout component
In the
Layout component, you want to create an app shell, if you will, to wrap around your pages with a shared header and some meta tags.
Create a
components folder with a
Layout.js file in it and paste the following.
// frontend/components/Layout.js import Link from 'next/link' import Head from 'next/head' export default function Layout({ children, title, description }) { return ( <> <Head> <meta name='description' content={description} /> <title>{title}</title> </Head> <header className='bg-gray-900 border-b border-gray-700'> <div className='container mx-auto px-3 xl:px-20'> <div className='flex h-20 items-center justify-center'> <Link href='/'> <a className='text-red-500 text-4xl font-semibold'>Next Movies</a> </Link> </div> </div> </header> <main className='bg-gray-900 min-h-screen'> <div className='container mx-auto px-3 xl:px-20'>{children}</div> </main> </> ) }
The code above creates a new component that accepts three props. The first prop is used to inject child components and the rest for setting the page title and description. It also returns some JSX that renders a header component with a link to the homepage and children passed in the props.
Server-side rendering on the homepage
Let’s zoom in on the fetching strategies we mentioned earlier. To demonstrate, we’ll use the
getServerSideProps function to enable server-side rendering (SSR) on the homepage.
Start by removing the default content in the
pages/index.js file and replace it with the following.
// frontend/pages/index.js import Layout from '../components/Layout' import { fetchQuery } from '../utils' import { MovieCard } from '../components/MovieCard' export default function Home({ movies }) { return ( <Layout title='Next Movies' description='Watch your next movies'> <section className='grid grid-cols-1 sm:grid-cols-2 py-10 gap-1 sm:gap-6 lg:gap-10 items-stretch md:grid-cols-3 lg:grid-cols-4'> {movies.map((movie) => ( <MovieCard key={movie.title} movie={movie} /> ))} </section> </Layout> ) } export async function getServerSideProps() { const movies = await fetchQuery('movies') return { props: { movies } } }
This imports the
fetchQuery utility function you created earlier. You can see it in action in the
getServerSideProps function. According to the official documentation, exporting an
async function called
getServerSideProps from a page causes Next.js to prerender the page on each request using the data returned by
getServerSideProps.
The data, in this case, is all the movies we added when we built the API. Declaring this function means you must return a
props object with some data, which means you’ll receive a
movies props on the current page.
After receiving the
movies props, loop through all of them and render with the
MoviesCard component.
Here’s what the homepage should like:
The
MoviesCard component
This is a separate component because you’re going to reuse it when you fetch movies by genre.
Create a
MoviesCard file in the
components folder and paste the following.
// frontend/components/MoiesCard.js import Link from 'next/link' import { baseUrl } from '../utils' export function MovieCard({ movie }) { return ( <Link key={movie.title} href={`/movie/${movie.id}`}> <a className='flex flex-col overflow-hidden mt-6'> <img className='block w-full flex-1 rounded-lg' src={`${baseUrl}${movie.cover.url}`} alt={movie.title} /> <h2 className='text-red-500 mt-3 text-center justify-end text-lg'> {movie.title} </h2> </a> </Link> ) }
This renders a link with the movie cover and title. When you click on the link, you should be redirected to a single movie page. So now let’s create it.
Statically rendering the single movie page
During this stage, we’ll explore two prefetching strategies:
getStaticProps and
getStaticPaths.
getStaticProps is similar to the
getServerSideProps function in terms of function definition, but they differ in how they work. If you export an
async function called
getStaticProps from a page, Next.js will prerender this page at build time using the props returned by
getStaticProps.
In addition to using
getStaticProps, if the page is dynamic, you also need to add a
getStaticPaths function to define all the paths that need to be generated at build time.
Create a new page called
[movieId].js in
frontend/pages/movie. Next.js treats any file surrounded by square brackets as a dynamic route. If you navigate to, it will be matched to this page and you can do what we want with the parameter.
Paste the following to get started.
// frontent/pages/movie/[movieId].js import Layout from '../../components/Layout' import Link from 'next/link' import { baseUrl, fetchQuery } from '../../utils' export default function Movie({ movie }) { return ( <Layout title={movie.title} description={movie.overview}> <div className='pt-6'> <Link href='/'> <a className='text-red-500'>← Back to home</a> </Link> </div> <section className='flex flex-col md:flex-row md:space-x-6 py-10'> <div className='w-full md:w-auto'> <img className='rounded-lg w-full sm:w-64' src={`${baseUrl}${movie.cover.url}`} alt={movie.title} /> </div> <div className='w-full md:flex-1 flex flex-col mt-6 md:mt-0'> <div className='flex-1'> <h2 className='text-white text-2xl font-semibold'> {movie.title}{' '} <span className='text-gray-400 font-normal'> ({new Date(movie.release_date).getFullYear()}) </span>{' '} </h2> <span className='text-sm text-gray-400 block mt-1'> {movie.tagline ?? ''} </span> {movie.genres.map((genre) => ( <Link key={genre.name} href={`/genre/${genre.id}`}> <a className='rounded-lg inline-block mt-3 text-xs py-1 uppercase tracking wide px-2 bg-red-500 text-white mr-2'> {genre.name} </a> </Link> ))} <p className='text-white text-lg mt-5'>{movie.overview}</p> </div> <div className='flex sm:items-center flex-col sm:flex-row sm:space-x-6 mt-6 md:mt-0'> <div className='flex items-end'> <p className='text-white uppercase text-sm tracking-whide'> Released on: </p>{' '} <time className='pl-2 text-sm uppercase tracking-wide text-gray-400' dateTime={movie.release_date}> {new Date(movie.release_date).toDateString()} </time> </div> <div className='flex items-end mt-3 sm:mt-0'> <p className='text-white uppercase text-sm tracking-whide'> Runtime: </p> <span className='pl-2 tracking-wide uppercase text-xs text-gray-400'> {movie.runtime} mins </span> </div> </div> </div> </section> </Layout> ) } export async function getStaticProps({ params }) { const movie = await fetchQuery('movies', `${params.movieId}`) return { props: { movie } } } export async function getStaticPaths() { const movies = await fetchQuery('movies') const paths = movies.map((movie) => { return { params: { movieId: String(movie.id) } } }) return { paths, fallback: false } }
Let’s break down this code snippet.
We first fetched a single movie and returned it as props using the
movieId passed in the URL in the
getStaticProps function.
We fetched all the movies in the
getStaticPaths and returned a
paths array of objects containing the
movieId for each movie. This means Next.js will generate the paths
/movie/1,
movie/2, …
/movie/n .
It should look something like this (note that the param must be the same name as the file):
paths: [ { params: { movieId: 1 } }, { params: { movieId: 2 } } ]
The
fallback key is required. If it’s set to
false, Next.js will return a
404 for any page that was not statically generated at build time. On the other hand, if set to
true, Next.js will statically generate the raw HTML for that page.
Note: If you do this on the fly, there might be some delay since that page was not statically generated at build time. It’s advisable to check whether the requested path is served by a fallback version. Learn more about handling fallback pages.
Finally, we rendered the single movie on the page with all the information about that movie.
Here’s what the single movie page looks like:
Building the genres page
This should be straightforward because we’re going to repeat what we did on the Home page and the single Movie page; Fetch all, then render.
To begin, create a new page in the pages folder called
genres.js , then paste this snippet:
// frontend/pages/genres.js import Layout from '../components/Layout' import { fetchQuery } from '../utils' import Link from 'next/link' export default function Genres({ genres }) { return ( <> <Layout title='Movies Genres' description={`Watch your next movies from ${genres.length} genres`}> <div className='pt-6 flex items-center space-x-3'> <Link href='/'> <a className='text-red-500'>← Back to home</a> </Link> </div> <section className='grid grid-cols-1 space-y-6 sm:space-y-0 sm:grid-cols-2 py-10 gap-1 sm:gap-6 lg:gap-10 items-stretch md:grid-cols-3 lg:grid-cols-4'> {genres.map((genre) => ( <div key={genre.name} <Link href={`/genre/${genre.id}`}> <a className='rounded-lg shadow-lg bg-gray-800 px-3 py-10 flex items-center justify-center text-center text-red-500 text-3xl'> {genre.name} <br />({genre.movies.length}) </a> </Link> </div> ))} </section> </Layout> </> ) } export async function getStaticProps() { const genres = await fetchQuery('genres') return { props: { genres } } }
In this snippet, we’re doing something similar to what we did with
getServerSideProps on the homepage. This difference is that this time the goal is not to SSR the page but to generate all the HTML for the genres at build time.
Here’s what the genres page should look like:
Statically rendering the single genre page
Like with the single movie page, you need to export not just the
getStaticProps function, but also the
getStaticPaths function.
Create a
[genreId].js file in
frontend/pages/genre and paste the following snippet.
// frontend/pages/genre/[genreId].js import Layout from '../../components/Layout' import Link from 'next/link' import { fetchQuery } from '../../utils' import { MovieCard } from '../../components/MovieCard' export default function Genre({ genre }) { return ( <Layout title={`${genre.name} movies`} description={`Watch ${genre.name} movies`}> <div className='pt-6 flex items-center space-x-3'> <Link href='/'> <a className='text-red-500'>Home ></a> </Link> <Link href='/genres'> <a className='text-red-500'>genres ></a> </Link> <Link href={`/genres/${genre.id}`}> <a className='text-red-500'>{genre.name}</a> </Link> </div> <section className='grid grid-cols-1 sm:grid-cols-2 py-10 gap-1 sm:gap-6 lg:gap-10 items-stretch md:grid-cols-3 lg:grid-cols-4'> {genre.movies.map((movie) => ( <MovieCard key={movie.title} movie={movie} /> ))} </section> </Layout> ) } export async function getStaticProps({ params }) { const genre = await fetchQuery('genres', `${params.genreId}`) return { props: { genre } } } export async function getStaticPaths() { const genres = await fetchQuery('genres') const paths = genres.map((genre) => { return { params: { genreId: String(genre.id) } } }) return { paths, fallback: false } }
To recap, we fetched a single genre with the param passed in the URL inside the
getStaticProps, which returns the genre with that ID.
Then, we informed Next.js about all the paths to be generated at build time in the
getStaticPaths function and passed a fallback option of
false because we know we have a finite amount of data that doesn’t change very often.
Here are all the movies that have a genre of comedy:
Conclusion
In this tutorial, we demonstrated how to build APIs with Strapi, how to manage the content of those APIs, and how to handle roles and permissions. We then looked at the different data fetching strategies for both server-side rendering (SSR) and static site generation (SSG).
In closing, I challenge you to go a step further by adding other fields to the API and enabling the fallback option to see how it works when new data is added on the backend.
LogRocket: Full visibility into your web apps
>>IMAGE “Data fetching with Next.js and Strapi CMS”
Great tutorial. Can you continue with setup sign up, sign in, and login (authentication) and separate user’s authorization using next js and strapi, please.
Thank you Alfie. I like your suggestion and I may look into it in the future. For now, I have a WIP article where I talk about authentication with Next.js(no Strapi though). Stay tuned.
|
http://blog.logrocket.com/introduction-to-data-fetching-with-next-js-and-strapi-cms/
|
CC-MAIN-2020-40
|
refinedweb
| 3,265
| 57.37
|
Hacker Rank Problem for Leap Year
- Refer Here for the solution
Inner Functions
- We can define a function within another function
def outer(a, b): def inner(c,d): return c+d return inner(c,d)
- Lets try to use inner function to print the prime numbers from 100 to 10000
- An inner function can be useful when performing complex task more than once within a function, To avoid code loops or duplication we can use inner functions
- Refer Here
Other Aspects of functions for future
- Closures
- Lambda
- Decorators
- Generators
Relook at investment Calculator
Write a python program which accepts
- principal from the user
- time in years
- Support the following investments
- Fixed Deposit:
- State Bank of India: 5.15%
- HDFC: 4.75
- Mutual Funds:
- Try to accommodate at least 3 mutual funds from Refer Here
- SBI Contra Fund: 14.79%
- Quant Tax Plan: 24.11 %
- Canara Robeco Bluechip Equity: 18.11 %
- Gold:
- Ornament: 7.4%
- ETF: 7.5%
Refer Here for the code written in the class
|
https://learningthoughts.academy/2021/06/05/python-classroom-series-05-jun-2021/
|
CC-MAIN-2022-05
|
refinedweb
| 167
| 60.35
|
Hello!
How can I import external libraries into Rhino-Python (or it impossible)?
Ex:
import requests
import postgrsql
etc…
pip install don’t work(
Thank U.
Hello!
How can I import external libraries into Rhino-Python (or it impossible)?
Ex:
import requests
import postgrsql
etc…
pip install don’t work(
Thank U.
Hi Andrey,
Some people have managed to use an external installation of IronPython with Rhino, though it is not recommended, I think, and can break your python installation. Any pure python (i.e. with no compiled dependences) may work if you just put them in your script folder and import them.
No problem if you use standalone (no installation just zip) version.
But regarding the modules I have created a thread asking the same question. I’ll try to dig it up.
You can generally import what IronPython can import. Some CPython-type libraries may work, but YMMV.
Where did you learn these abbreviations
Mitch used
IIRC
I had to google these
I am an irssi (IRC client) user. I typed a lot in IRC channels. The answer to your question is: I learned them in IRC (mostly #blendercoders chat). On code licensing questions (GPL etc) I like to give my opinion and and with “, but IANAL”.
I’m an old guy… I used to hang out on Usenet - at alt.machines.cnc… Flame wars.
Many jargon terms now in common use on the Internet originated or were popularized on Usenet.[48] Likewise, many conflicts which later spread to the rest of the Internet, such as the ongoing difficulties over spamming, began on Usenet.[49]
Learn all of these and you’ll be good to go…
People not my age may never have seen the original source of this expression… First used in car commercials in the US in the 70’s when they first started posting gas mileage figures - that was the disclaimer line.
|
https://discourse.mcneel.com/t/llibraries-of-pyython/81958
|
CC-MAIN-2021-43
|
refinedweb
| 317
| 73.78
|
First of all, please forgive me for my bad English if it annoys you. Few months ago, I came to know about CPP Unit which is a unit testing framework for C++ application. I am a fresh guy out of college last year and was unaware about testing frameworks, so it was a very good experience for me to work with CPP Unit. As I was also programming on Windows CE, there was a need to write test cases for those applications also. But the problem with CPP Unit is that I was not able to compile for Windows CE as it used some features of C++ which are not supported by eVC++ compiler. I tried to search a similar test framework for Windows CE but I didn't find it. So after prolonged searching, I thought to write my own unit testing framework for Windows CE based applications. And this is what I came up with and I want to share with all.
This is a unit testing framework for applications written for Windows CE in particular. It provides GUI to select and run test cases, and to show results. It also stores the results of tests run to a file, if user wants.
Programming in C++ for WinCE is very restrictive. It does not support templates, RTTI and other stuff of C++. CPP Unit uses templates and RTTI, but in eVC++ it's not available. That's why I have used lots of member function pointers and call backs to implement it.
Compile the WCEUnit project to make WCEUnit.dll file for a particular platform. In order to use the testing framework, the test case project must be linked with the WCEUnit.dll. Write your test cases and link the project to WCEUnit.dll. Following topics discuss how to write test cases.
When you write a test class, it should be derived from CTestSuite class defined in the framework. The CTestSuite class holds all the information about the test cases written for that particular suite. The individual test cases should be added to the test suite as show in the following example. The macros which are used in the following example are defined in the WCEMacros.h header file. These macros wrap the test case addition mechanism. The below code shows a test suite class written for testing CComplex class. The CComplex class is very simple, and does primary implementation of complex numbers, and I will not go into the details of that one.
CTestSuite
CComplex
//TestComplex.h
#ifndef __TEST_COMPLEX_INCLUDED__
#define __TEST_COMPLEX_INCLUDED__
#include "..\WCEUnit\TestSuite.h"
#include "..\WCEUnit\WCEUnitMacros.h"
#include "Complex.h"
class CTestComplex : public CTestSuite
{
public:
//Pass the name of the test class as parameter.
WCEUNIT_TESTSUITE_INIT(CTestComplex);
//Pass the name of the test case function as parameter.
WCEUNIT_ADD_TESTCASE(testAdd);
WCEUNIT_ADD_TESTCASE(testEqual);
WCEUNIT_ADD_TESTCASE_EXCEPTION(testExcp, CUserException);
WCEUNIT_TESTSUITE_END();
public:
/***********************************************************
The signature of test case function should be void (func)();
***********************************************************/
void testAdd();
void testEqual();
void testException();
void CleanUpTest();
void InitializeTest();
private:
CComplex* m_p1;
Ccomples* m_p2;
CComplex* m_p3;
};
#endif //__TEST_COMPLEX_INCLUDED__
WCEUNIT_TESTSUITE_INIT(testSuite)
Pass test suite class name to it. This function defines the starting of a CreateTestSuite() function. This function is defined as pure virtual in the CTestSuite class and is used to create the test case lists.
CreateTestSuite()
WCEUNIT_ADD_TESTCASE(testCase)
This macro adds the code to the CreateTestSuite() function to add a test case function.
WCEUNIT_ADD_TESTCASE_EXCEPTION(testCase, testException)
This macro is used to add a special type of test case function which should be tested for a particular type of exception. If the test case does not throw the exception then it is considered to fail.
WCEUNIT_TESTSUITE_END()
This macro ends the CreteTestSuite() function.
CreteTestSuite()
You can see functions InitializeTest() and CleanUpTest() in the definition of the class. These functions are called before and after every test case execution. From the UI, you can select the behavior about these functions, i.e., whether you want those functions to be called for every test case or only once for all the test cases for a particular test suite class. You can specify your choice by checking or un-checking the Init Once check box on the main dialog.
InitializeTest()
CleanUpTest()
While writing test cases, use macros defined in the WCEUnitMacros.h for writing the test conditions. Following are the macros used to write test conditions:
WCEUNIT_ASSERT(condition)
If the condition is evaluated to false then it asserts and marks the test as failed.
condition
WCEUNIT_ASSERT_FAIL(condition)
This is reverse of above macro. If you want that the condition must return false then use this macro to test the condition.
WCEUNIT_ASSERT_EQUALS(testValue, compValue)
This macro asserts if the testValue and compValue are not equal. If the two values are not equal then it marks the test case as failed. If you are using some user defined class objects to compare then the class must have '==' operator overloaded.
testValue
compValue
==
WCEUNIT_DOUBLE_EQUALS(testValue, compValue)
This macro is similar to the above one but it assumes that the testValue and compValue are convertible to a double value. It type casts the results into a double value and then compares.
double
WCEUNIT_DOUBLE_BETWEEN(testValue, minValue, maxValue)
This macro tests weather the testValue is less than maxValue and greater than minValue. It is assumed that the three values of expressions are evaluated to double. The following code shows the usage of the above macros.
maxValue
minValue
Following code shows the use of above macros in test cases for CComplex class.
void CTestComplex::testAdd()
{
CComplex temp;
temp = *m_p1 + *m_p2;
WCEUNIT_ASSERT(CComplex(30, 70) == temp);
}
void CTestComplex::testEqual()
{
CComplex temp2; //Below test should fail.
WCEUNIT_ASSERT_FAIL(temp2 == *m_p3);
CComplex temp1; //Below test should pass.
temp1 = *m_p1 + *m_p2;
WCEUNIT_ASSERT_EQUALS(temp1, *m_p3);
//To check the equality of the real and imaginary members.
WCEUNIT_DOUBLE_EQUALS(temp1.GetReal(), m_p3->GetReal());
WCEUNIT_DOUBLE_EQUALS(temp1.GetImaginary(), m_p3->GetImaginary());
}
void CTestComplex::testException()
{
//This fuction is only to demonstrate the exception test.
//It throws CUserException. This test will fail as the expected exception
//is CFileException.
CUserException e;
THROW(&e);
}
void CTestComplex::InitializeTest()
{
m_p1 = new CComplex(10, 20);
m_p2 = new CComplex(20, 50);
m_p3 = new CComplex(30, 70);
}
void CTestComplex::CleanUpTest()
{
delete m_p1;
delete m_p2;
delete m_p3;
}
The CTestRunner class is responsible for running the test cases and getting the test results. To run the test cases you have written, create an instance of CTestRunner class. Also create the instance of all the test suite classes, and pass the address of each in the AddTestSuite() function of CTestRunner class. Then call Start() function of CTestRunner. The following code shows how to run test cases:
CTestRunner
AddTestSuite()
Start()
BOOL CTestComplexApp::InitInstance()
{
//Create the instance of CTestRunner class.
CTestRunner obj;
//Create the instance of CTestComplex test suite class.
CTestComplex test1;
//Pass the address of CTestComplex instance to the AddTestSuite() function.
obj.AddTestSuite(&test1);
//Sart the WCEUnit dialog to run the test cases.
obj.Start();
return FALSE;
}
The above image shows the main dialog. To select a test case to run, click the Select button, a new dialog will appear with the tree view of the test cases written by you. You can either select single test case or a test suite or All Tests. If you want to run all the test cases for a particular test suite then select that test suite, or if you want to run all the test cases of all the test suites then select the root node All Tests. The check box Init once is given for the option when the InitializeTest() and CleanUpTest() will be called. If it is checked then for each test suite, the IntializeTest() and CleanUpTest() is called only once respectively, before and after all the test cases are executed. If it is unchecked then for each and every test case, these two functions are called. Click the Run button to run the selected test cases. The results are displayed in the list box. If you want to see more information then just click the result item, you will be shown the detailed result. If you want to store the test results in a text file then check the Make log check box, a file \\WCEUnitLog.txt is created with the detailed test result information.
IntializeTest()
During the development of this project, I learned a lot about the pointer to member functions in C++. They are amazing things and do a lot more than what you can imagine. May be next time, I will try to post some thing about pointer to member.
|
http://www.codeproject.com/Articles/8586/Unit-Testing-Framework-for-eVC-Applications?fid=119032&df=90&mpp=10&noise=1&prof=True&sort=Position&view=Expanded&spc=None&fr=11
|
CC-MAIN-2015-32
|
refinedweb
| 1,398
| 64.61
|
Java Regular Expression
January 9, 2007 Leave a comment
Some of the requests from the client could be weird but they seem to serve their purpose. We have been using WebSphere portal and we were given the task of filtering the output rendered by the Portal. So I created a custom
HttpServletResponseWrapper and took a copy of the HTML before sending it to the browser. This part was easy.
A filter can be configured in the web.xml of wps.war since the Portal code itself is a WAR deployed on WAS. Stripping the HTML of certain tags and filtering it was more difficult.
I tried to use Java Regex. It worked for some cases but it was very hard to use it to massage nested HTML.
Regex is cool. The following code actually closes the ‘img’ tag. Regex can be used to close HTML tags easily if they are not nested too deeply and there no newlines .Nested HTML tags broken into separate lines are pretty hard to manipulate using Regex.
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegularExpression{
private String";
public static void main( String[] argv ){
RegularExpression regex = new RegularExpression();
regex.changePattern();
}
public void changePattern(){
String content = source.replaceAll("<img[^>]+[>]", "$0</img> ");
System.out.println( content );
}
}
|
https://branetheory.org/2007/01/09/java-regular-expression/
|
CC-MAIN-2019-47
|
refinedweb
| 213
| 68.67
|
ETS contains a lot of nice features which don’t get any press, many of which aren’t event well known in the Enthought office. Today I thought I’d show off the ProgressDialog class I wrote more than a year ago.
The ProgressDialog class is intended to have an API similar to QT and Java’s progress dialogs has many of the same features:
- Optionally show estimated time remaining
- Supports indeterminate progress where the total number of steps is not known
- Cancel and skip buttons
- Automatically closes for determinate instances
This is all the code needed to do a dialog while doing a simple loop (the entire example can be found here):
[sourcecode language=python]
def task_func(t):
progress = ProgressDialog(title=”progress”, message=”counting to %d”%t,
max=t, show_time=True, can_cancel=True)
progress.open()
for i in range(0,t+1):
time.sleep(1)
print i
(cont, skip) = progress.update(i)
if not cont or skip:
break
progress.update(t)
[/sourcecode]
Here’s what the progress dialog looks like using the WX backend (yes, there is a QT4 backend too)
This is great! Could it be easily factored out so that I don’t need the entire ETS to use it?
That is very nice. One quick question though. What is the rational for the using progress.update(t) on line 13 of your snippet? It seems like it would be clearer to use progress.close() to match the earlier progress.open().
Gabriel, it could be refactored pretty easily, as long as you only want the WX or QT4 version. Traits is only used to declare attributes with default values. Have a look at the source for the WX version if you’re interested
Jed,
This example uses the auto-close feature, line 13 isn’t necessary at all, but is there as a safety precaution. What is nice about this approach is the progress bar will always reach 100% before closing.
You can manually close the window as well, though you should check to ensure it is open before making the call to close it.
Nice, but I found a bug. In my version (Canopy 1.0.3 Pyface 4.3.0) it crashes at line 302 of progress_dialog.py. The problem is wx.NullColor, which should be NullColour with a u.
|
http://blog.enthought.com/enthought-tool-suite/little-known-ets-features-progress-dialog/
|
CC-MAIN-2017-22
|
refinedweb
| 385
| 74.29
|
Struts Projects
ASAP.
These Struts Project will help you jump the hurdle of learning complex... learning easy
Using Spring framework in your application
Project in STRUTS Framework using MYSQL database as back end
Struts Projects are supported be fully
project with myeclipse - Struts
project with myeclipse Hi,
i want to develop a simple web application using struts and jsp in MyEclipse 5.5.1A.
Pleas help me
Struts,JSP - Struts
Struts,JSP I'm facing problem while using logic:iterate to render the data in the jsp from the Array list. javax.servlet.ServletException: Cannot find...("uname",employees); In the jsp... classes and which they i should create??
My application wil be using database so... palling of project like UI planning, classes and interface creation, POJ,jsp - JSP-Servlet
Struts, JSP get records from database how can i get single record from database in tabular form in struts as well as in jsp
struts
struts Hi,... please help me out how to store image in database(mysql) using struts doing validations by using DynaVAlidatorForm
in that have different fields
struts 2 project samples
struts 2 project samples please forward struts 2 sample projects like hotel management system.
i've done with general login application and all.
Ur answers are appreciated.
Thanks in advance
Raneesh Articles
) framework, and has proven itself in thousands of projects. Struts was ground-breaking... can be implemented in many ways using Struts and having many developers working... experience using Struts in a Servlet environment and that you want to take advantage Tutorial: Struts 2 Tutorial for Web application development, Jakarta Struts Tutorial
Struts 1 is reached end of life of the project. So, if you are still
using... Framework with the help of examples and projects.
This site also contains... of Jakarta Struts shows you how to develop Struts applications using ant and deploy
Library Management in Struts. - Struts
Library Management in Struts. Hi can you give me the application related to Library Management using Struts
struts please send me a program that clearly shows the use of struts with jsp
struts - JSP-Servlet
struts Hello
My question is
How can I pass the values into jsp... Servlet to JSP :
"MyServlet.java"
import java.io.*;
import javax.servlet...."
For Bean in JSP visit to :
http How to retrive data from database by using Struts
What is Struts - Struts Architecturec
.
Struts is famous for its robust Architecture and it is being used for
developing small and big software projects.
Struts is an open source framework used...
What is Struts - Struts Architecture
Error - Struts
. If you can please send me a small Struts application developed using eclips.
My...Error Hi,
I downloaded the roseindia first struts example... create the url for that action then
"Struts Problem Report
Struts has detected 2.2.1 - Struts 2.2.1 Tutorial
Struts 2 hello world application using annotation
Running...
About Struts 2.2.1 Login application
Create JSP file
Create... in Struts 2.2.1
How to implement aspects using interceptors
How
help required in coding
help required in coding hi.....
I want to display output in graphical format . Can u tell me how it can be done? using for project java swings.
plzzzzzz helpp project in RAD
Struts project in RAD How to create a struts project in RAD
Struts Tutorials
.
Using the Struts Validator
Follow along as Web development expert Brett... libraries introduced in Struts made JSP pages more readable and maintainable... application development using Struts. I will address issues with designing Action
struts database program
struts database program Can u show me 1 example of Struts jsp using oracle 10g as database! with struts config 1 Tutorial and example programs
struts ActionFrom class and jsp page.
Using... Struts project. We will be using Hibernate Struts
plug-in to write... framework then these struts 1 tutorials will help you in
learning the Struts 1
struts code - Struts
struts code Hi all,
i am writing one simple application using struts framework. In this application i thought to bring the different menus of my... help me
use of Struts - Struts
of sturts? why we are using it?
Hitendra Hi,
I am sending a link. This link will help you.
Please visit for more information with running example.
Thanks
HELP: Xin's Popup Calendar with Struts
HELP: Xin's Popup Calendar with Struts HI,
I am designing a website using "Struts" framework, but am not able to populate my html form date field... help me because i don't want to use normal html tags inside struts
How Struts Works
made by the client or by web browsers. In struts JavaServerPages
(JSP) are used...()
method on the ActionForm by the help of the Struts system. The client
sends... components.
The view we use in the struts can be either Jsp
struts - Struts
struts get records in Tabular format How do i get result in tabular format using JSP in struts
coding for railway reservation project
coding for railway reservation project i want to help for creating coding in visual basic for railway reservation first example - Struts
the version of struts is used struts1/struts 2.
Thanks
Hi!
I am using struts 2 for work.
Thanks. Hi friend,
Please visit...Struts first example Hi!
I have field price.
I want to check <p>hi here is my code can you please help me to solve...;
<h1></h1>
<p>struts-config.xml</p>
<p>...;<struts-config>
<form-beans>
<form-bean name
.....if i am using hibernet with struts any database pkg is required or not.....without any database package using maintain data in struts+hiebernet....please help... will help you.
Please visit for more information:
Drill down in Struts 2.0.14
Drill down in Struts 2.0.14 Hello Tutor,
I am developing my project... it can minimize the effort in using DOJO...If so, is DOJO compatible with Struts 2.0.14)I am very new to Struts and your help is much appreciated.
Thanks
struts
struts <p>hi here is my code in struts i want to validate my...
}//execute
}//class
struts-config.xml
<struts..."/>
</plug-in>
</struts-config>
validator how to display data from database on jsp using struts1
using struts in flex.plese help me Hi Friend,
Please visit the following links:
help - Struts
help Dear friends
I visit to this web site first time.When studying on struts2.0 ,i have a error which can't solve by myself. Please give me help, thans!
information:
struts.xml
HelloWorld.jsp
|
http://roseindia.net/tutorialhelp/comment/81520
|
CC-MAIN-2014-42
|
refinedweb
| 1,081
| 67.35
|
- 08 Jun, 2015 1 commit
- Pavel Tvrdík authored
-
- 10 May, 2015 1 commit
- 02 Oct, 2014 1 commit
- 01 Dec, 2013 1 commit
Fixes some bugs and uses generic hash implementation.
- 02 Oct, 2013 1 commit
Thanks to Sergey Popovich for original patches.
-.
- 15 Aug, 2011 1 commit
They unintentionally disappeared in 1.3.2.
- 14 Aug, 2011 1 commit
- 03 Jul, 2011 1 commit
- 26 Jun, 2011 1 commit
- 07 Dec, 2010 1 commit
- 02 Aug, 2010 1 commit
- 31 Jul, 2010 1 commit
- 05 Jul, 2010 1 commit
Hostcache is a structure for monitoring changes in a routing table that is used for routes with dynamic/recursive next hops. This is needed for proper iBGP next hop handling.
- 02 Jun, 2010 1 commit
- 17 Mar, 2010 1 commit
- 26 Feb, 2010 1 commit
- 25 Aug, 2009 1 commit
- 21 Aug, 2009 2 commits
- 23 Jul, 2009 1 commit
- 22 May, 2009 1 commit
ea_same() sometimes returns true for different route attributes, which caused that hash table in BGP does not work correctly and some routes were sent with different attributes.
- 08 Nov, 2008
- 11 Jun, 2004 1 commit
- 31 May, 2004 3 commits
#include "alloca.h" -> #include "lib/alloca.h"
- 07 Jun, 2000 1 commit
- 02 Jun, 2000 1 commit
- 19 May, 2000 1 commit
- 10 May, 2000 1 commit
- Pavel Machek authored
What is special about int default;? Compiler chokes on that!
- 08 May,.
- 04 May, 2000 1 commit
- 26 Apr, 2000 1 commit
- 17 Apr, 2000 1 commit
|
https://gitlab.nic.cz/labs/bird/-/commits/ae80a2de95d3d3c153ce20b90c9d8757d02cb33d/nest/rt-attr.c
|
CC-MAIN-2020-45
|
refinedweb
| 252
| 74.12
|
drawing 3D primitives.
In OpenGL this matches
glBegin; on other graphics APIs the same
functionality is emulated. Between GL.Begin and GL.End it is valid to
call GL.Vertex, GL.Color, GL.TexCoord and other immediate mode drawing
functions.
You should be careful about culling when drawing primitives yourself. The culling rules may be different depending on which graphics API the game is running. In most cases the safest way is to use
Cull Off command in the shader.
See Also: GL.End.
using UnityEngine;
public class Example : MonoBehaviour { // Draws a Triangle, a Quad and a line // with different colors
Material mat;
void OnPostRender() { if (!mat) { Debug.LogError("Please Assign a material on the inspector"); return; } GL.PushMatrix(); mat.SetPass(0); GL.LoadOrtho();
GL.Begin(GL.TRIANGLES); // Triangle GL.Color(new Color(1, 1, 1, 1)); GL.Vertex3(0.50f, 0.25f, 0); GL.Vertex3(0.25f, 0.25f, 0); GL.Vertex3(0.375f, 0.5f, 0); GL.End();
GL.Begin(GL.QUADS); // Quad GL.Color(new Color(0.5f, 0.5f, 0.5f, 1)); GL.Vertex3(0.5f, 0.5f, 0); GL.Vertex3(0.5f, 0.75f, 0); GL.Vertex3(0.75f, 0.75f, 0); GL.Vertex3(0.75f, 0.5f, 0); GL.End();
GL.Begin(GL.LINES); // Line GL.Color(new Color(0, 0, 0, 1)); GL.Vertex3(0, 0, 0); GL.Vertex3(0.75f, 0.75f, 0); GL.End(); GL.PopMatrix(); } }
Did you find this page useful? Please give it a rating:
|
https://docs.unity3d.com/2018.3/Documentation/ScriptReference/GL.Begin.html
|
CC-MAIN-2022-40
|
refinedweb
| 246
| 65.08
|
Three-dimensional normal data structure. More...
#include <mitsuba/mitsuba.h>
Three-dimensional normal data structure.
Internally represented using floating point numbers of the chosen compile-time precision. The main difference of this data structure when compared to TVector3<Float> is in how instances of Normal are treated by linear transformations.
Construct a new normal without initializing it.
This construtor is useful when the normal will either not be used at all (it might be part of a larger data structure) or initialized at a later point in time. Always make sure that one of the two is the case! Otherwise your program will do computations involving uninitialized memory, which will probably lead to a difficult-to-find bug.
Initialize the vector with the specified X and Z components.
Initialize all components of the the normal with the specified value.
Unserialize a normal from a binary data stream.
Construct a normal from a vector data structure.
Assign a vector to this normal.
|
http://mitsuba-renderer.org/api/structmitsuba_1_1_normal.html
|
CC-MAIN-2020-29
|
refinedweb
| 161
| 51.04
|
Your API is wide open
If you read part 1, you know now what a JWT is and how to issue one.
We’ve provided a convenient way for clients to gain access to restricted areas of our API…
… but, we haven’t actually restricted anything.
If you leave your API open like this, your SPA can make requests to it, but so can anyone else.
As a minimum we want to ensure the client making a request to our API has a valid token (which they got by calling our JWT-issuing action, with a valid username and password).
The plan
Our plan of attack:
- Require authentication for our API controllers
- Test that anonymous requests are rejected
- Configure JWT auth in startup.cs
- Test that requests with a valid JWT are accepted
Require Authentication
With the
[Authorize] attribute you can easily lock down your API to authorized users only.
[Authorize] [Route("api")] public class ApiController : Controller { [HttpGet("Test")] public IActionResult Test() { return Ok("Super secret content, I hope you've got clearance for this..."); } // rest of controller goes here }
Now, unless otherwise specified, every action in this controller will require the request to be authenticated.
Test anonymous requests
Try navigating to your and you’ll get a
401 Unauthorized response.
Check your work
Whilst it’s become a little bloated in recent times, Postman is still a handy tool for testing your site.
In this case, if you want to try hitting your API, you can easily create a GET request, run it, then check what status code comes back (401 hopefully).
So our API is definitely secure, but now we have the opposite problem to before, no one can get past this barrier.
Authenticate JWTs
In ASP.NET Core 2.0, configuring JWT auth is pretty straightforward.
In most cases, you just need to configure it in
startup.cs.
public void ConfigureServices(IServiceCollection services) { services.AddAuthentication = "yourdomain.com", ValidAudience = "yourdomain.com", IssuerSigningKey = new SymmetricSecurityKey( Encoding.UTF8.GetBytes(_configuration["SecurityKey"])) }; }); services.AddMvc(); }
These are the basic options for configuring JWT auth for your site.
This code configures ASP.NET Core so that requests to API actions (which require authentication) will check for a token meeting these requirements:
- issued with the correct issuer and audience details
- signed with the same secret key that we’re using (from configuration)
- hasn’t expired
If you’re wondering where
_configuration came from (it may be missing in your
startup.cs file), you can easily bring it in via the constructor and let ASP.NET Core wire it up for you.
public Startup(IConfiguration configuration) { _configuration = configuration; }
Whilst you’re here you’ll also need to add one line to the
Configure method in startup.cs.
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseAuthentication(); app.UseMvc(); app.UseStaticFiles(); }
Your
Configure method may vary but the key part is adding
app.UseAuthentication();.
This needs to be one of the first lines (and definitely before UseMvc) so it takes effect early in the pipeline and stops ASP.NET Core from serving the request as soon as possible if the user isn’t authorised.
Test valid requests
Now to the final hurdle, can we get to our test API method if we pass a valid token?
First up, we can hit the API action we created in part 1, to get a JWT.
Then modify the headers for our API GET request, to pass that token in the Authorization header.
Authorization: Bearer <token goes here>
So now what?
You can issue a JWT and validate it. Your app is now protected from meddling by anonymous users.
This approach is known as Bearer Token Authentication where your app issues a token and then gives access to the bearer of that token.
If you have a valid token, you’re in.
Photo Credits:
Jez B Fairly pointless… via photopin (license)
Theo Crazzolara Stop, it’s winter via photopin (license)
All posts in the
Secure your ASP.NET Core Web API series.
|
https://jonhilton.net/security/apis/secure-your-asp.net-core-2.0-api-part-2-jwt-bearer-authentication/
|
CC-MAIN-2020-40
|
refinedweb
| 668
| 55.24
|
This.
Return the number of attributes in this list.
The SAX parser may provide attributes in any arbitrary order, regardless of the order in which they were declared or specified. The number of attributes may be zero..
getLength()
Return the type of an attribute in the list (by name).
The return value is the same as the return value for getType(int).
If the attribute name has a namespace prefix in the document, the application must include the prefix here.
getType(int)Length()
getType(java.lang.String)
Return the value of an attribute in the list (by name).
The return value is the same as the return value for getValue(int).
If the attribute name has a namespace prefix in the document, the application must include the prefix here.
getValue(int)
Return the value of an attribute in the list (by position).
If the attribute value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens will be concatenated into a single string separated by whitespace.
|
http://developer.android.com/reference/org/xml/sax/AttributeList.html
|
CC-MAIN-2015-35
|
refinedweb
| 167
| 65.22
|
Join devRant
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
Search - "cold"
-
-
-
-
- Me (5 days ago): A major, life-threatening hurricane is coming. I need to prepare. I know you have a need to launch so I will do my best to finish your project.
Client: Ok, stay safe.
Client (today): I know you're not done. You're late actually. To provoke you into further action, we went ahead and announced the launch and people will begin using the website now.
Me (at the store buying food for the next two week): What in the actual ... Here is your code. Finish it yourself. May God have mercy on your cold, dark soul
-
-
-
- *Me and my workmates laughing and having fun before going home*
Me: Hey, do you want to hear a joke?
Workmate 1: What is it?
Me: Look at your code.
...
...
...
Other workmates: BURRRRRNNNN!!!!4
- You say they are looking for me, but when i contact them they pretend like they dont even know me.5
- *Male devs dying of heat, air quality almost requires a rebreather*
*opens window*
2 seconds later
Female dev: "I am cold"
😑🔫
[some cunt decided the gun emoji had to be removed. with all my heart, fuck you and your family]31
- My old laptop had an ear bud warmer right here. This new one is defective, those ear buds are still cold.6
- really love my job these cold, rainy autumn days with yellow trees, where I can work from home having a nice fire going in the fireplace and the dog sleeping on my feet :-)9
- That moment that you have a job interview the next day and your voice just disappeared due to a cold.
This is going to be great 😅17
-
-
- Whoever is responsible for the responsible for the refund process on airbnb can eat a bunch of dicks, watch me spill all of the fluids over his keyboard and then watch me break every single one of his/her fingers.
How the fuck do you dare to keep all of my money in some kind of internal wallet while I clearly need it to get a hotel after your starrated host left me hanging, autoaccepting but then telling me via phone that he using vacation till Friday... Half a goddamned fucking hour after I tried to call him. I want to report the shit out of this asshole, but no I can't because I cancelled my stay.
For the love of God and his creation is it this hard to punish assholes for ruining my new year and making me freeze my hand and ears of?2
-
-
- How to make a cold cup of coffee:-
1-make a normal cup of coffee
2-start coding
3-after coding you'll forget that you made coffee
4-drink it cold
5-feel bad for not drinking it while it's hot4
-
- Yo.
His palms are sweaty
Knees weak arms are heavy
Bugs littering his code already
Cold spaghetti 🍝
He’s nervous but on the surface he looks calm and ready to git push
(Hit a blank with thinking of code-related lyrics, anyone got ideas?)18
- Slept terrible the entire week due to a fucking annoying cold.
My turn of being the on call server engineer for a week starts tomorrow.
😭11
-3
- It was a cold monday evening.
I was alone in my room.
Many hours of coding had passed.
Windows offered me two options:
"Shutdown"
"Shutdown with update"
Anoyed by the update but thankful for the first option i decided to go with number one.
Windows started its shuting down process when all of a sudden...
"Please don't turn off your machine! Your updates are being konfigured!
It was that evening...
That one speciall evening...
I decided...
To finally...
Do nothing about this problem and cry myself to sleep...18
- Got cold hands in class. So I decided to test the meme.
I put my hands under my laptop's vent and installed Android studio.
My hands are no longer cold.4
- Me: buys a cold bottle of Sprite™ to freshen me up on a hot day
Me: drinks from said beverage
Sprite™: is cucumber flavoured
Me: ...
My inner slav: oy cyka it is good15
-
-
- Assembly...
Do I really need to say more? Okay, it's low level so there is no abstraction. All you deal with is cold naked mathematical truth and physical limitations.
It's still
-17
-
- my laptop was outside in my back yard during the whole night
damn its cold
no problem ill just fucking open 30 chrome tabs and android studio, like always thats enough for overheat3
- Without you, the world falls silent. It feels cold and desloate, and there's nothing to fill the void. You've been my faithful companion for many thousands of hours. Your passing pains my heart.
Rest in peace, my friend.7
-
-
- Today was the first time I received a donation for one of my git repositories. Good feeling. Gonna buy me a beer for it.3
-
- Fuck public transportation. Seriously. It's usually disgusting, too hot, too cold, to expensive and not customer Friendly.7
- !dev
Honestly I love the summer (hate the cold) but motherfucker, hyperhidrosis is a fucking bitch (not diagnosed but one doesn't need to be a genius to figure this one out in my case)
😥11
- #include <stdio.h>
#include <birthday.h>
#include <date.h>
int main() {
If (Today() == Birthday()) {
Age++;
If (Age == 18) {
printf("Just another normal day");
}
else {
printf("Its just a normal day, nothing special");
}
}
}
//Well its normal day for me but having flu and cold isn't exactly what I like to have.17
- Sometimes I lie awake in a cold sweat, unable to decide if I'm still building my AI, or if it has begun using me to build itself...2
-
-
- @dfox you said there'd be sweatshirts...it's cold as fuck here...I need a sweatshirt
*Insert some witty joke about devs never making deadlines*4
- Reciepe for cold coffee:
1. Make Coffee
2. Start Coding
3. Forget you made coffee
4. Drink it cold
- Him : Your tea is cold
Me : if the tea/coffe is full and cold ... developer is working hard.
Manager : well said ha ha ha 😅13
- If some yampy bloke ask me bout the origin of my username again imma shove a can of ice cold monster™ energy drink up em ass (: Is it hard to look it up?? (Dont look it up tho, it porn)
So it a funky ass breakbeat/chiptune kinda album. Sod off.16
- That one cunt who keeps turning the air con off because he came to work in shorts and sandals and now he feels cold.
-
-
- How fucking amazing is it that finally I had enough money to buy a new monitor and chair and get cold and get stuck in bed for two days. Haven't even openned the chair 🤧4
- > Take girlfriend to Starbucks
Me: I'll ask for a cold brewed coffee, what would you like?
She: I don't like coffee..
- Left my laptop at work... :/ how can I sleep knowing my dear laptop is alone and cold.. feeling sad :(1
- Morning Ritual
1. Start all devices
2. Check headset status
3. Check emails
4. COFFEE <3
5. First call...
6. 20 annoying minutes of two people talk to each other without a result
7. COFFEE <3 ... cold2
- Tonight, my long-time friend died. He was living in the basement for years, always reliable, always at my service, keeping my files, watching for my git repos, being my private cloud, and so many things more.
He wrote his last syslog entry at 0:21 a.m., passed away and never woke up.
I found him cold and motionless this afternoon, but could not do anything. Any attempt of reanimation failed.
Goodbye, little BananaPi, fare thee well, and if for ever.
I promise you, your legacy on SD card will live on with a new board.1
- Fuuuuuck!! Fuckin mosquito(s)!!
It's still too cold to not wear hoodies in the morning/evening, yet those fuckers are up & about..
Stop sucking!!18
- If your room is a bit cold, simply initialize a node project in a Dropbox directory and let the node_modules folder syncing be your personal heater2
- We have reached the -1°Celsius mark over here in Germany. Too cold to go outside. What about your countries?51
- Privacy is going bust
We're robots now
Chewing on our politians delicate ARSE
Fuck this shit
I'm going underground
Cold War Two awaits us.
The net shall be our shelter.
They blew it. We dig deeper.
Jesus Christ are we assraped5
- Caught cold badly.
The worst part is that must finish the android project so I don't even have time for sleep.
I can't concentrate 😭
-
- *coding*
*notices coffee is cold, puts it on stove with flame burner on low, to warm up*
*sits back down, goes back to coding*
*hears fizzing popping sounds... coffee overflows and boils*
FUCK - every other day for the past month ,every single time... lol3
-
- So when I'm so into what I'm doing that my coffee gets cold before I've taken the first sip... I know it's going to be a good day3
- The temperature in the office because of that one guy who always has cold and turns the heater to the max.4
- Let's work on my my side project after work.
Oh, a cold beer
Oh, Netflix
Oh, it's past dinner time.
Fuck.
-
-
- I Love coding in The Sun with some Ice-Cold drinks, but if the Notebook-Screen wouldn't reflect The Sunlight so brutal...4
- Being a dev tends to make me make cold calculated decisions. I hope I haven't made a mistake because of that.4
-
- So I pulled an OLD ibm out of a trailer, that is literally falling down, today. Anyway, this cpu had been rained on and been in extremes of heat, and cold, so much so that there was moss growing on it.
I pulled it out and plugged it in, with the original plug *that was rusted in*, and.. it worked. The screen and everything worked perfectly! The floppy disk that hadn't been used in over 14 years and was stuck inside the reader, worked...
Mind blown!
As the old saying goes, they don't make 'em like they used to.3
-
-
-
- It is 109° F / 39° C outside and I still hear people saying that they are glad the "cold days"(which meant 10° C AT MOST) are out.
Fuck this weather man. My house cold as fuck and my coding fresh af.
I hate this weather... about the only thing that sucks about Texas14
- It’s now day 4 into handing in my notice. Here's a recap of day 1&2. Here's the recap of day 0:
I handed in my notice on Wednesday with a leaving date of 10/27/17:
> format_date('27/10/17', 'short', 'muurcan');
Thursday, I had an appointment outside of the office... I was called by a marketing guy at [popular graph database company] to try and wiggle his way into my org. I forget his name, so we'll call him Derek:
Derek: 'Hi James, it’s marketer at [graph co] here; I know you downloaded our free book two months ago and we reserved the right to call you constantly since. I just wanted to...'
Me: 'Hol up Derek! I don’t want to waste your time, thank you guys for the book.
I’d have happily paid to avoid these phone calls.
I’ve resigned from [company] before getting a chance to introduce [most popular graph database platform on google, for real, go check now].
Again thanks, but I’m no longer a useful lead.'
Life lesson learned: free doesn’t mean free, free books aren’t worth shit. Marketing people are lovely... but have an job to do so they’re also basically all cunts.
If you want to learn graph DB best practices from oreilly, pay the £7 and be done with it.
Don’t download that book! Derek will take your number and use it like you’re a young naive college girl with a golden pička.
Aside: I’ve met a new girl! I’ve rapidly learned Slovenian swear words. She’s a beautiful Slovenian girl and has the mouth of a sailor. Peace out to any of my eastern euro buddies on here. Privyet, serbus, stay frigging awesome.
I'll be following up on the tag 'jct resigns' for anyone interested.4
- I try to cold email a business about redoing their website, and i dont get a reply for 3 days and i was a little dissapointed. Then i get this email 😑6
- Got a missed call from a recruitment company today. Called the number back and dude said he didn't know me so I told him the name of this dude that looked at my LinkedIn today. Turns out it's him, lmfao. How many people does this guy cold call on a daily basis.
-
-
- A co-worker on a gigantic PR i made:
"the worst thing about this pr is that while i was reviewing it, I forgot about my coffee and it turned cold. Otherwise good job!"1
-
-
- With the winter months fast approaching I am putting serious consideration into smuggling a blanket into my desk drawer after hours so that when it gets really cold due to the a/c, I can just whip out the blanket and code at work wrapped up like a burrito.
Yes, for sure, there will be looks, but I don't much care and it'll also be the day remembered as the day someone brought blankets into work.3
-
-
-
- When you are waiting in the cold for first robotics with a bunch of devrant users and one of them complains about being cold.10
- An enormous government project that leaves the tax office's database along with all backups exposed to SQL injection.
I know for a fact that the tax office database in at least one country only got a cold backup a few years ago, so it's more likely than you think.
Although around that time someone hacked the public transport company and bought a 12 month ticket for free as PoC and he got jail for it so the risk is quite high.5
- You can tell if you work at a real startup by looking at the coat hanger on the first cold day of the year.12
- It's so cold in the office that I want to work under my desk, next to my foot heater. Can't see the monitor from there, though.3
- I am having a real brutal cold, but I will go to work tomorrow anyway because wife is angry about stuff I dont know1
-
- Hey! First post on rant by saying merry Xmass!
This is my Christmas tree made from JavaScript ! I can change the height of the foliage and the wood part follow !
For those like me who live in a country where you only have the cold but not the snow 😅❄️11
-
- I hate coming into the office! It's cold, people microwave smelly food, and I can't break up my work sessions with some gaming or anime. I wish remote work wasn't seen as such a scary thing for companies.2
-
-
- When you suddenly got a cold after long hours of coding/gaming and your mom says blames your computer and its "viruses" 😐😐😐1
- Last night I had a panic attack and woke up in cold sweats because in the dream I had I was constantly using the wrong variables in the wrong
- That feeling when you're working with production data and you get a cold feeling running down your spine, telling yourself: you could really fuck up now.3
-9
- Coding in sick mode...
I mean real sickness. Specifically, cold.
God help the ones that suffers from the same situation.6
- Progress since my last post - quite like where the iterations since the cold design got me, next is the actual rant view and then will implement all sort of auth things like posting comments.
Have also figured out a way to have style and script plugins, haven't tried it yet though, especially with storage rulesets it might not be as smooth as I imagine it to be.
Another screenshot in the comments.2
-
-
-
- One of my coworker insists to take of shoes and socks while coding. He say that cold feet helps him concentrate.
This reminds me one of the Japanese anime about Mahjong, if you know what I am talking about.2
-)25
- Nobody's fault. It's just my naiveness.
Meeting time is at 1pm.
2 guys from 2 different companies and me.
Guy A and Guy B offices are a bit closer.
Meeting venue is Guy B office.
Guy A confirmed and reminded me about the meeting around 12.
I had my lunch early and left my office at 1230.
Got a call from Guy A while I'm on route.
Guy B forgot the appointment, went out and they have rescheduled it to 530pm.
In the end I had to pay a round trip ride for a taxi.
Well at least it's cold inside the taxi while outside temperature is 38°.3
- How many of you drink (too much) or having a drinking problem? And did you try to fix that?
I'm sober for three months and the consequences are huge.
Some say Whiskey officially was a medicine. I believe in that.
All what i have learned: stopping cold turkey was and is not the way for me.13
-
- Stressed? Of course not
I just got in the lobby of the company that I have a job interview in, I was making a cup of tea for myself and accidentally added carbonated water instead of cold water
A "different" taste sure2
- Thanksgiving dinner:
"What are you doing these days"
"I'm a programmer"
"Ah"
*Cold silence*
"... Who watched football"
mfw4
-
- Today we learned:
Don't run a backup integrity check on terabytes of data in multiple jobs your cpu can't handle.
And i cannot abort the process...
Guess i have to go outside, in the cold, brrrr.1
- Bought a new 1TB ssd from Intel for my laptop. The installation of the drive itself went perfectly, it works like a charm. But then I had to do a clean install of windows and ubuntu, and that's where things went wrong. The drive still works perfectly, but everything else has fallen apart. I've been fighting with them the whole working day and haven't got anything work related done. Well, a few more hours and I can head home and continue the installation with a few cold beers, that should help getting it done ;)1
- Weee both projects from yesterday went perfect...
Usual most of my projects end up fucked up because I want to do stuff I don't know how to... (well, I'm learning so I don't get frustrated, just pick up another idea).
Air cooler for power people V 1.1 works perfect. Today we will get almost 40 C and I feel the cold air in my face.2
- Over the frozen river and through the woods, to work I go...because working remotely isn’t good enough for the sorry fucks I work for.1
- When you start adding alarms to ring just 5min after you start coding in the morning, to remind you that drinking cold coffee is annoying...1
- Coffee vs black tea?
I'm walking to my school and It's just freezing out here so I was thinking about if it should be coffee or some tea today.
Happy friday xd12
-
-
-
-
- Balls deep into some convolutional network because the results "could be better", at 8 PM while my food is getting cold.
... Somebody murder my inner bitch, thanks and appreciated. She's been an absolute pain lately.
P.S. does anybody get annoyed with themselves so often or should I book a psychotherapist?6
- Ever had that meeting where it's expected that you will solve cold fusion, catch rainbows and violate the laws of thermodynamics? Just because you are an expert in your field?
Also beautifully demonstrated here:
- So working from home today... With the heater set to low, I realized something...
Being sorta cold seems to make me more awake and productive than the warm office6
-
- ITS FUCKING COLD IN THIS HOTEL!!!! I’M FREEZING TO DEATH!!!
I really am in a coding mood right now but I’m tired anyway and the lack of warmth doesn’t make it better..
Gotta find an internet coffee shop or something like that..5
- TIL cats get cold fur when asleep even when warm sometimes. I went to pet my cat and she was cold, I thought she was dead, and suddenly she springs up, trilling in surprise, as I woke her up.4
- A colleague currently has a cold and takes a deep, wet sniff every 10 seconds or so rather than just blowing his fucking nose - he even (politely) refused a tissue I offered him WTF?!
All concentration is lost when you're perpetually awaiting the next sniff.4
- Am i the only one annoyed that at first the coffee is too hot, so you have to take small sips. But when its at the right temperature, you have to drink it fast so that it doesnt go cold.1
-
- When you make a coffee, get in the zone, forget about its existence, take a drink it and find that it's gone cold.. Then chug it and go make yourself another.4
- Fucking common cold I just fucking hate it.
I feel terribly.
Hopefully that medicine will help.
And I had beautiful plans:
Reinstall tablet.
Reinstall PC.
Btrfs on both with compression enabled.
Setup SElinux into it. (Archlinux ahhhhhhh imnot happy about that).
Anybody have any non medicine stuff that you use when you have cold
- The older i get the more i understand why people smoke do drugs and alcohol... this shitty life is cold blooded and heartless as fuck.....6
-
- There are 2 types of developers. The hot drink ones ☕️ and the cold drink ones(CocaCola, Redbull...). Which one are you?15
-
- The split second feeling of EXECUTE an UPDATE and SET value without putting WHERE clause.
I froze for a moment with cold sweat that I don't know what to do. My mind went blank.
Thank God it is just the entire list of customer details that is not relate to money issue.
Anyone can suggest the best practice for this type of accident UPDATE / DELETE?
Does using BEGIN TRANS ROLLBACK is safer way to execute?5
- Me: I am feeling pretty good. I am at home where it's cold, watching tv with my kid and gonna wait for my wife to get here so that I can go to the gym!
My stomach: FUCK U NIUKKA *PAIN/NAUSEA/MOREFUCKING PAIN*
If organs would just grow on trees i would have snapped this fucking asshole from my stomach a longass fucking time ago.1
- My hands are always freezing my office. Any devs here have a good way to keep their hands warm while working.
A note. I keep my core warm. I will often wear 2-3 layers and a beanie, so I keep warm, but my appendages will get freezing cold.27
- Being forced to migrate an application written to to run on Solaris 9, which uses Sun ONE Webserver, Netscape LDAP Server and Cold fusion and migrate it to RHEL 7.3 ppc64le before the 3rd of January (I was only told about the project this morning), and I'm told I *have* to use the exact same technologies and versions. I'm on leave for Xmas from the 22 until the 5th of Jan. I know exactly where they can put their arbitrary management deadlines.2
-
- Let’s play a game of find the introvert....... (me) lmao merry Christmas to all me devs in the cold this Christmas ☺️3
-.
- Got a cold and accidentally forgot to screw the water bottle then the water went into my computer.
All these good things.7
- code is emotional because it represents ideas, collaboration, and hard work. On the other hand, code is completely cold, instructional, and meaningless.
I think both of these are true.2
- I picture a large, ice cold, crystal pint filled with bubbling ruby red ale straight from the draft... Its majesty overflows as I stare some human shape walk that marvel at my table...
I take a sip. Fuck it, it's not enough and I'm not feeling like manners... I straight up bottom down that bitter odd amount of beer while my hand feels the cold liquid handshake of this heavenly brewed product... It was a shit day at the office, but right now I'm at the top...1
- Is your office too cold? Centralized aircon and you can't control the temperature? 🙄 hard to type when it is too cold6
- The copious amounts of alcohol I can consume after spending 3.5 hours finding where the missing } should be. Not to mention the mini-fridge stocked up with cans/bottles of lager and a fresh, nice cold bottle of Jäger 👍😛3
-
-
-
-
- I've caught cold yesterday and I've slept for more than 6hr today :/
Going to sleep agsin just wanted to tell it to someone
-
-
-
- Nothing destroys an ego quite like the cold, ruthless testing of your software by the QA team. I humble once more.
- Reciepe for cold coffee:
1. Make Coffee
2. Start Coding
3. Forget you made coffee
4. Drink it cold8
- Freshly failed gloriously my degree in interaction design. Now I stumbled into a new job, doing a fullscale company advertisment campaign on cybersecurity for 6500 employees. Alone. Writing concept, gathering stakeholder, requirements and shit. I'm scared.4
-...5
- Ugh.
I got a common cold and was operating on half a brain the last days - today, it took me about half an hour to find the option/flag to set when resizing a shape in the CAD-Tool. Dm
Programming is impossible atm. I hate this feeling.2
- Decided to work from home as full of cold, keeping the germs out of the office. Emailed the team.
2mins later a scaffolding truck arrives to start covering the block I live in...
*bang*bang*bang*bang
-
- I feel like coffee.
*Goes to make coffee.
I'll code a little more while it's pouring.
*Cold coffee needs heating up2
- Every time I read the abbreviation for Cold Fusion Markup Language, my brain translates it to this:
CFML -> C?! F*ck my life!!
- Suffering from concentration, meaning my coffee is cold. I can’t drink cold coffee, it makes me retch. That’s the second cup today I’ve let die on me. It’s pissing me off now.6
- Me: aah finally the best in the morning MY COFFEE
Also me a half hour later: Uhm fuck my coffee is cold.1
-
-
-
- I was cozy at home, coding and talking trash with my duck, then "real" life called and now I'm out in the cold. Nothing new here, just wanted to complain about something 😓
-
- How tell me apart from the other departments?
It's so cold inside my office it creates fucking WIND when you open my door
-
-
- I'm always sitting at a corner because it's 90 degrees there. I don't understand why offices have to be so cold.1
-
- When you're so focused on your work that you forget that you started brewing coffee and now it's cold.... 😲😣4
- Sometimes I feel like moving to the equator for the temperature. Winter is pretty and all but programming with cold fingers is just such a pain7
- Cold Turkey is the best distraction blocker I have used so far for Windows and macOS.
- Recruiter
[ri-kroot-urr]
noun
1. an individual who attracts interest to a cause through evangelism and enthusiastic promotion.
2. an occupation in which knowledgeable specialists seek out qualified individuals to fill technical positions on behalf of another organization.
3. an unholy union of the worst qualities of both an ignorant cold call salesperson with those of an apathetic human resources employee. See 'chimera'.
-
- been about two weeks since my rust journey begin, and i've got to say, i love it. web frameworks with static type checking; amazing, standardised package manager; what a breeze, and macros; despite stating that i don't really see them as useful in earlier posts, they are really helpful. as well, in response to the slow "cold-start" build times, it's the price to pay for top-of-the-line compilation-time error checking. rust is amazing)4
- Fight? I always have cold wars with my fellow developers and mostly with that senior ass who takes all the fucking credits and presentations..
- I didn’t know Python so they made me go into the (cold) server room and fiddle and plug in wires to boxes. Don’t think I actually learned much.2
- Revenge is best served cold
It had been over 7 weaks since Microsoft was prompting me to restart my system to update Windows.
Today, they took over.
30 mins and still I'm looking at screen waiting to finish updates.9
- Getting a lot of headaches? Try replacing coffee/energy drinks with ice cold H2O first thing in the morning. It works after a week and it shocks your body into waking up faster.2
- Covered on the helpdesk at my new job yesterday. The only tickets that came in were for me anyways so all I learned is that the back room gets pretty cold.
- Third (or fourth) AI winter coming in despite global warming. Cold war level shit cyber warfare.
C/C++ not dead, Java zombie still in the businesses.
Still no usable IDE (on Linux)5
- I think work is finally getting to me, I had crazy dreams last night full of stack traces. Woke in a cold sweat...
- Sitting inside on a 3 degree day, wondering why I haven’t moved yet. Anyone in Seattle? How do you like it
-
- The code life is a cold life, but I love it. And, I can't get enough of this video! "I am a different bug. I'm the last bug you see before you die."...
- Image you fire 10 resumes each day. No reply. Image you do 2 interviews each day. Got rejected. Image you cold email 10 companies. No reply. Life is meaningless and useless. Looking for job atm, pm me if you have one. The thing I can do is do side projects and keep applying. Life is sucked.3
-
- Spontaneity: suddenly deciding to get away from my PC and go out for a walk and some shopping because the sun came out.
It's still fucking windy and cold tough...
Maybe I should try taking a virtual summer vacation around the world again..!
- You know it is going to be a bad morning when your coffee goes cold before you get a chance to drink it.2
- GPT3 to Hacker News:
.”1
- ....
- Why do companies pile on the work in the Summer and have less in the Winter? I want to do shit in the Summer. Let's bust balls in the Winter when it's too damn cold to do anything!1
-
-
-.
-.
- Cold-brewed yerba mate, iced brewed crio bru, Adderall, duck.
I believe I have everything that I need to hit those deadlines before break.1
-
- My professor said that he cold booted the pc.
It took me around a minute to realise that he meant he turned off and switched it back on.1
- One of the top annoying behaviors of interested hiring parties is recruitment agencies cold-calling you, as if you're a disposable packet of Skittles! It's outrageous!3
The weather is nice and a bit cold like I love, and we have an opened window.
I'm falling asleep.
Help.2
- Not feeling well (plus cold office) but still extending time after work hours (OTY) because of a big task with a quick deadline (already have a short deadline set before the task was given to me)
Oh well. Grind, hustle and push!
Listening to this while working 👊 :...!
-
- woke up in a cold sweat and all i can remember from my nightmare is "there's a party in ring -2 and no one's
-
- It's funny.
When you are underpaid, you boss treats you well. Grants you everything you wish, etc.
After one year, when you request a raise, and asking to be paid NEAR the salary you deserve, and after you agree, he starts to act cold.
- Self Study of new technology while the task is already running and the deadline is tomorrow in a cold office.
"When you find your why, you find a way to make it happen!" - ET 💪
- Intern, ran out of work to do, everyone that can help me is either perpetually busy or out of office. Freezing to death because office is cold. Don't wanna be a douche playing on my phone though. Send help I'm dying. The boredom is relentless.3
- When you've been pair programming to help solve a collegue's problem, only to come back to a cold chair again.2
- The small company I work for has FINALLY decided to start moving towards the MEAN stack, in which I was overly thrilled! However they have started to regress because "cold fusion is so much easier to write"
- Shot scared if my roommate brought in some corona.
He had few coughs and seems to have caught cold.8
- Listen to some really good and fast music, take a (cold) shower and let the motivation kick back in while singing aloud.
Worked as expected yesterday whole learning maths for a exam tomorrow
-
- I hate myself. I’m trying to grow my client base by proactively cold-calling and cold-emailing and cold-visiting dozens of likely prospects. There just appears to be no other way to do this in my area. I don’t have the thousands of dollars per month required to get traction in online ads. Why do I hate myself? Because I have to stoop as low as the sales bros I can’t stand to be around. Feeling like a car salesman in a cheap pinstriped suit. I got into tech so I wouldn’t have to do this crap. But how am I supposed to get clients without the shuck and jive of being a salesman? Ugh.2
- I just had an Indian guy cold call me. He said his name was "Steve Jones." I mean, I suppose he could be a reverse Aziz Ansari, but somehow I doubt it.
- Finished my job, now making a WordPress theme for a freelance project.. Ahhhh.. A good horror and a cold beer awaits me this evening..1
- Any ColdFusion devs in here? I've been plying with it for a while; Nice Java framework, quick to deploy. Feels like it could struggle under high request volumes though..?2
- And here i am. Waiting outside, with a literally freezing weather, for my boss, to work on a freaking saturday. Halp!6
- Day 6 of my hiking holiday with the kids and suffering real coding cold turkey. First break in ages.
(Admittedly I did pull an all nighter chasing a bug in a dependency after 3 days
- !rant
Can't believe it!
I've been bitten 6 times by a mysterious bug two nights ago while I was asleep and when I saw my face in the mirror this morning...
Omg! All I see is huge herps on my upper lip although I haven't caught cold recently :/
Never knew a bug could cause this ! Cause it's the first time I'm infected herpes simplex in my life.3
-
- I LOVED cold fusion. However because of the yearly cost associated with it no one uses it anymore so it's hard to find resources when I run into issues.2
- Serial downvoters who love to suck joy out of souls and knock little kids ice cream cones onto the cold, hard, pavement that is life.
- @LoveBytes inspired this post: What's your favorite coffee brewing technique? Cold brew? French press? Pour over?5
- Completion of vacation: 90%
Completion of TODO list: 20%
Reason: got sick... FML, maybe covid... or just a bad cold6
- Bonus semi dev related sin:
Unless it's piping hot I'll leave my coffee to get cold and then drink it.
-
- Why the fuck doesn't anything work anymore? I signed up for a service the other day and paid for it, and now I can't even log in. And the support is fucking useless. And now I have a cold. Fucking great.
-
- Getting cold-feeted and didn't join a coding group in high school. I ended up stopping coding for a good 3 years, which could have been spent for so much learning... :/
- Bribing sysadmin with an ice cold Coke hoping he will deploy my latest tag sort of in a hurry since I fudged up last one :/1
- Someone posted here something about Macbook’s touch being too cold and being the reason of their cold.
Just came here to say: I second that opinion. It does get too cold at times. Sends a chilly wave through the body on first touch.
#ModernProblems4
-
- Death by a thousand mother flippin cuts. Oh well, it is FRI, have a cold one and some calamari or something. <- talking to myself there...but it will probably be nachos. it's FRI.
- "As a graphic designer, I like to collaborate. I don’t want to be in a cold garret somewhere smoking unfiltered Camels all by myself with paint all over my body." - Carin Goldberg8
- I had %1 of charge before going to sleep last night. My phone was turned off and not charging all night (~10 hours). I woke up and I turned on my phone as usual.
And I have %19 of charge. How is this possible? Does anyone have an explanation?
(This is probably my second time facing this.)
(P.S: Nights are cold here)5
- !rant
Have deployed wordpress site to MS Azure App service with Mysql (in app purchase - from ClearDb). Problem is that TTFB is very high ( 30-50 sec) even site is not cold.
Note: - Always Available is ON
Please suggest me anything I am missing here.4
- I shake my head at companies who think sending me unsolicited emails/texts is going to encourage me to do business with them. :P3
- When a recruiter makes an unsolicited call. Becomes all chummy and then when you tell them that you’re not looking, they have the cheek to ask you for references for *insert common buzzword here* and expect me to divulge information about contacts
- Just moved into a new dorm. Good lord what a fucking cold place. Unless I carry every frickin' conversation with these guys, they won't even look at me, let alone you know.. smile and say hi like normal persons.1
- I know liquid-nitrogen-powered air cans heat up after getting cold during use, and boil in the process, extending use time, but do they really need to make disturbing noises that sound like a clicking creature in a horror movie???
- ISTQB tutorial (testing) with cold dead syntetic voice.... brain liquifying under unreleting bordom! KILL ME NOW!!!1
-
- how is the big sur for mb pro ? all stuff working fine?
And also how do you work with those ice cold pieces of apple metals in these frosty morning? i have caught cold and i seriously suspect this macbook 🥶🥶🥶5
- Anyone knows the logic behind recruiters calling you cold turkey instead of sending you an email with the job details?
I always wait for the voicemail but...
It is so annoying!
- Guys, do you feel some evil presence around this worldcup? like a cold environment?
Idk,... maybe its me, or the FUCKING SITUATION that i am involved AT MY JOB!
- !dev
This is a follow-up to a previous rant:
I found out that when I turn on the sink faucet on hot and let that running for a minute, I can shower with decent-ish temperatures again 🤔
... meanwhile even the cold water setting yields hot water because of the temperatures outside.
Top Tags
|
https://devrant.com/search?term=cold
|
CC-MAIN-2021-17
|
refinedweb
| 6,843
| 82.54
|
OCX or .h +.lib + .dll?
Hi guys, I need to stablish a communication with a Fiscal Printer. For that i have the following files downloaded from the official website of the printer:
winfis32.dll Winfis.h winfis.lib
To my surprise the header file included throws some extrange error when trying to compile: the sentence FAR PASCAL is not recognised. So i looked what was this and as I read is an old convention to especify parameters and size of pointers. (Precise and concise information here:).
My question is: do i need to delete that part of the code? how can i make this work on QT? If i delete FAR_PASCAL from all the methods i get the error that no library was found so..
The drivers also include a way to communicate via OCX but as shown in the examples of the drivers documentation is recommended to use them when programming with Visual Basic. Should i change and work with OCX? how can i integrate OCX with QT?
here is the code of the header:
@
#ifndef _WINFIS_H
#define _WINFIS_H
#ifdef __cplusplus extern "C" { #endif #define VERSION 427 #ifdef WIN32 #define _export typedef void (*PFV)(int Reason, int Port); typedef void (__stdcall *PFVSTDCALL)(int Reason, int Port); #endif int FAR PASCAL _export OpenComFiscal (int Com, int Mode); int FAR PASCAL _export OpenTcpFiscal (char *HostName, int Socket, long TimeoutMilisecs, int Mode); #ifdef WIN32 int FAR PASCAL _export ReOpenComFiscal (int Com); #endif void FAR PASCAL _export CloseComFiscal (int Handler); int FAR PASCAL _export MandaPaqueteFiscal (int Handler, char *Buffer); int FAR PASCAL _export UltimaRespuesta (int Handler, char *Buffer); int FAR PASCAL _export UltimoStatus (int Handler, short *FiscalStatus, short *PrinterStatus); int FAR PASCAL _export VersionDLLFiscal (void); int FAR PASCAL _export InitFiscal (int Handler); void FAR PASCAL _export BusyWaitingMode (int Mode); int FAR PASCAL _export CambiarVelocidad(int Handler, long NewSpeed); void FAR PASCAL _export ProtocolMode(int Mode); long FAR PASCAL _export SearchPrn (int Handler); int FAR PASCAL _export ObtenerNumeroDePaquetes (int Handler, int *Enviado, int *Recibido, int *CmdRecibido); #ifdef WIN32 void FAR PASCAL _export SetKeepAliveHandler(PFV Handler); void FAR PASCAL _export SetKeepAliveHandlerStdCall(PFVSTDCALL Handler); void FAR PASCAL _export Abort(int Handler); #endif int FAR PASCAL _export SetCmdRetries (int Retries); int FAR PASCAL _export SetSndRetries (int Retries); int FAR PASCAL _export SetRcvRetries (int Retries); int FAR PASCAL _export SetModoEpson (int Modo); #define SIZEANSWER 1024 #define MODE_ASCII 0 #define MODE_ANSI 1 #define BUSYWAITING_OFF 0 #define BUSYWAITING_ON 1 #define OLD_PROTOCOL 0 #define NEW_PROTOCOL 1 #ifdef __cplusplus } #endif #endif // _WINFIS_H@
thank you all in advance
[Moved this to the C++ gurus forum, it's a pure C/C++ issue and completely unrelated to Qt libs.]
FAR PASCAL, as explained in the link you posted, are some leftovers from 16 bit days. Nowadays these are defined as macros that expand to nothing, so you might give this a try:
@
#define FAR
#define PASCAL
#include <winfis.h>
@
But be warned, depending on the actual build of that DLLs that could fail miserably and lead to a crash of your application. You will have to try.
I tried your approach but i get the following error when i try to do this
@ int x = OpenComFiscal (1, 1);
qDebug () << x;
@
the function is recognised by the editor and I have the DLL inside the folder that contains my app .exe
I also included the path to the source (the header) and added to the LIBS variable of my .pro file the library. It`s like the DLL is not functioning
//----------------------------------------------
Added
@#include "windows.h"@
and compiles. The thing is that im concerned about what you said. Whats are the risks of using this lib? how can I be sure it wont brake?
|
https://forum.qt.io/topic/13662/ocx-or-h-lib-dll-63
|
CC-MAIN-2018-05
|
refinedweb
| 608
| 54.86
|
Pure Python external libs
Hi!
In order to save space in device (iPhone), can I delete freely from Pythonista some pure python external libraries that I never use (like sympy version 0.7.4.1: I use always the last one, 1.0.0 downloaded via pip)?
If it is not possibile, could Pythonista author kindly report here a list of pure python libraries implemented inside his great app Pythonista that don't require a specific compilation to be implemented in iOS system?
No problem for pre-compiled libraries like numpy, because these libreries are not pure python based and even if user doesn't use them, these libraries are deliberately implemented (suitably compiled) in Pythonista.
Maybe Pythonista, without some pure python external libraries, could become smaller in size, and we know that user can download pure python external libraries when he wants using "pip install" command provided by the pure python script StaSh.
What do you think?
Thanks for your kind reply.
Matteo
It's not possible to delete anything (binaries, libraries, graphics, sound, etc.) that comes preinstalled with Pythonista - all of it is inside the app bundle, which is read-only. The app can only write to its data folder, and that only contains your own code, and a few settings files and caches that are only a few kilobytes or so in size.
@Matteo Does that work to pip install a new version of sympy over the top of a read-only version??
What do you see in Pythonista when you:
import sympy print(sympy.__version__)
Related:
Installing with
pip installdoes work over the packages that come with Pythonista. Packages in your Documents/site-packages folder take precedence. In the example above, the sympy version returned is 1.0
Hi! After the downloading of last version of sympy I see version 1.0.0 ( so I can use the last version) but after the removing of the lib via "pip remove sympy" I see again 0.7.4.1, the built-in version: so no overwrite operation performed by pip. Maybe the builtin 0.7.4.1 version is only hidden by Pythonista and not overwritten? If so, the old version of a lib is unused, undeletable and consumes device internal memory. Any idea to solve this?
Thanks!
Matteo
OK... Help me understand...
- I get a brand new iPad and install Pythonista on it.
- If I do
import sympy ; print(sympy.__version__)then I get 0.7.4.1
- I install StaSH
- In StaSH, I do
pip install sympy.
- If I do
import sympy ; print(sympy.__version__)then I get 1.0.0
- This means that pip installed packages take precedence over builtin packages with the same name.
- In StaSH, I do
pip uninstall sympy.
- If I do
import sympy ; print(sympy.__version__)then I get 0.7.4.1
Do I have all of that correct?
So, would it be a good idea for Pythonista author to put all pure python libraries inside Pythonista in a user read-write external folder to allow user to delete or overwrite them?
Thanks
In order to save space in device (iPhone), can I delete freely from Pythonista some pure python external libraries that I never use [...]
Hm, pythonista is taking about 450 MB with some installed extra libraries for me. Sympy 1.0 is is about 4 MB big. I do not want to be rude, but I somehow fail to see how this going to make any impact on a device that measures its storage space in GB.
Hi, sympy 1.0.0 unpacked is about 15 mb, not 4 mb, but I don't know how many builtin pure python libraries there are inside Pythonista, Only sympy, some others, how much MBytes all the pure python libraries are?
Don't forget that someone like me has old iPhone with about 1.5 G free of about 16 GB total, with a great % of the internal space dedicated to multimedia, offline maps, music,...
😉
Hi,
just to be clear again, I do not want to be rude 🤓. You can look up all the installed packages under
Standard Library (X.X)\site-packages. The folder also contains the pythonista modules and some undocumetend estoteric stuff like
werkzeug. You are absolutely right about the unpacked size of sympy but this still doesn't seem to have any significance. I would be suprised if you could shave of more than 50 MB after some heavy pruning. You have to consider that sympy, matplotlib and numpy are the heavy weights in the installed packages. The rest is measured in KB. If you really have to shrink pythonistas footprint, ditching either 2.7 or 3.5 all together seems to be a more effective idea as both do not only include a full python but also most of the packages.
Hi, ok now I understand. Previously I took it for granted that main size of Pythonista was due to several external libraries in it and not due to executable app (Pythonista's python interpreter and his powerful IDE).
Could you suggest me a script to query Pythonista about how many MBytes is every library inside the site-packages read only folder?
Thanks
I cannot recommend anything fancy as there is no way of figuring out what is what without building some path and file type blacklists by hand. Just peek into
__file__of a core module and then walk through the base path and look for
site-packages. I do wind up with about 100 MB but I haven't really checked what is what. You will have to take a closer look on how the actual file structure of pythonista is.
import os _base = os.__file__.split('Frameworks')[0] _target = 'site-packages' _mb = 10 ** -6 def walk(path, res=0): for path, n, fls in os.walk(path): if _target in path: sze = sum([os.path.getsize(os.path.join(path, f)) for f in fls]) * _mb print('{} ({} MB)'.format(path[len(_base):], sze)) res += sze return res size = walk(_base) print('{}\nSum : {} MB'.format('-' * 79, size))
Thank you so much for your code! I've about 100 MB like you inside site-packages. You are right, 100 MB is a little % of all.
However it is an interesting thing for me and, as a exercise, I will try to modify your code to report size of entire libraries, that is the size of the entire folder of any library and not only single file, maybe in a list from biggest to most little library.
Thanks!
|
https://forum.omz-software.com/topic/4030/pure-python-external-libs
|
CC-MAIN-2022-27
|
refinedweb
| 1,092
| 73.98
|
:
I haven’t found any proposed solutions to allow unique indexes on embedded documents. After digging into this, I’ve come up with two:.
This would allow a user to define the path to a field using a
$ as an identifier representing embedded documents.
The previous statement would add the same type of index as the previous solution, but using a different notation.:
Well, let’s get to it!
First, I setup a folder in my Applications called Browsers (
/Applications/Browsers). I will explain later why we place all of our browsers in the Browsers folder. Now, let’s install each browser individually..]]>
To keep things rolling, I’ve released another project called Reserved Word Search. With Reserved Word Search you can instantly find reserved words as you type. This is extremely useful when doing database design and/or designing an API.
So go ahead and check out Reserved Word Search @.]]>.
IMPORTANT: When using multiple
TIMESTAMP fields in a table, there can be only one
TIMESTAMP column with
CURRENT_TIMESTAMP in
DEFAULT or
ON UPDATE clause. This is why we need to use a
TRIGGER to update one of the fields values.
In our case, we will set the
date_modified field to contain the
DEFAULT of
CURRENT_TIMESTAMP and also set the
ON UPDATE clause to
CURRENT_TIMESTAMP.
If you noticed in the
CREATE TABLE snippet above we use the
TIMESTAMP features on the
date_modified field, but set our
date_created field to
NULL by default. We do this because our
TRIGGER will populate the value before the insert.
In our trigger, we simply set the
date_created value to the
CURRENT_TIMESTAMP.
Now you will be able to insert and update rows in your table without having to specify the
date_created or
date_modified values.
Another approach that can be used is by setting the
date_created value to
NULL when inserting a row. This involves a different
CREATE TABLE syntax.
Notice our
date_created field is now set to
NOT NULL with a default value of
0000-00-00 00:00:00. Here’s an important note from the documentation:
TIMESTAMP columns are NOT NULL by default, cannot contain NULL values, and assigning NULL assigns the current timestamp.
In other words, when we insert and set the value to
NULL on a
TIMESTAMP field, it will insert the current timestamp.
An example insert/update statement would look like:
This approach allows us to avoid using triggers, however requires you to specify the
NULL value when the query is executed.
For the past couple of months, I’ve been working on a mashup service between gist.github.com and ideone.com. The service allows someone to execute a gist and view the results.
For more information, please check out GistDoIt! @.]]>
For the second part of my Zend Framework Best Practices series, I’d like to show you what I’ve found to be a simple and solid implementation of internationalizing your website.
Zend Framework already contains components like Zend_Locale and Zend_Translate to assist in internationalizing your website. You use the
Zend_Locale instance in conjunction with the
Zend_Translate to know what current locale is being used and how to translate the content. I’m going to show you how to implement these into your website.
If you haven’t read the first part of this series, I would recommend it as all my examples here will be based on that structure.
To start off, let’s talk about how we are going to allow our website to know what locale to use. What I’ve found to be a common practice to switch locales is based off of the URL. For example, a sample format may look like
mysite.com/:locale/controller/action. Locales are usually represented with a
language_REGION combination. However, locales in our case are specified by only the
language code. You can find a list of language codes here. If you wanted your site to be in Japanese, you would use the language code of
ja. An example of the URL might look something like
mysite.com/ja/controller/action. On top of specifying the locale in the path of the URL, I’ve also provided a way to determine the locale based off of the TLD in the URL. For example, let’s say our
mysite.com also has a Japanese TLD like
mysite.jp. When a request comes in and we find a supported TLD, we set the localed based on it.
Enough talk, let’s look at some code.
Let’s start by setting up our
Zend_Locale. In the
application.ini, we use the
Zend_Application_Resource_Locale to setup the locale component and set our default locale. In our case here, I’m setting the default locale to English.
application.ini:
... # Locale resources.locale.default = "en" ...
Next, we need to tell our application which locales are supported and also specify our TLD mappings. We do this by specifying front controller parameters in the
application.ini.
application.ini:
... # Front Controller Params resources.frontController.params.locales[] = "en" resources.frontController.params.locales[] = "ja" resources.frontController.params.tldLocales.jp = "ja" ...
If you notice from the configuration above, I’ve added English and Japanese as my supported locales and I also mapped the
jp TLD to use the
ja language code. More on how we use those later.
Before I show the rest of the configuration needed, let me explain how the process works.
In order for your application to recognize when a locale is specified in the URL, you need to create special routes to parse out the locale. The approach I took was to override the existing
Zend_Application_Resource_Router and implement the ability to automatically add locale routes to the application when enabled.
The process in which I added routes to my application was done previously in my
Bootstrap.php with the
_initRoutes() method. I’ve removed that code and moved the routes to be configured in the
application.ini. Now that the routes are specified in the
application.ini, it allows us to easily add/edit/remove routes from our application. There is also a benefit to doing this in regards to caching, which I will explain in a future article.
First, let’s take a look at how we will load the custom router application resource and override the existing application resource.
application.ini
... # Custom Resource Plugins pluginPaths.My_Application_Resource = APPLICATION_PATH "/../lib/My/Application/Resource/" ...
Now the application is setup to load custom application resources for the namespace specified. Since I am overriding the
Zend_Application_Resource_Router, let’s look at
My_Application_Resource_Router:
My/Application/Resource/Router.php:
In order for this custom application resource to override the existing one, the key is
public $_explicitType = 'router';. Now when routes are setup in the
application.ini for the router resource it won’t use the
Zend_Application_Resource_Router, but rather
My_Application_Resource_Router.
This application resource sets up the
Zend_Controller_Router_Rewrite by parsing the specified options parsed from the
application.ini. Notice this custom application resource extends from the original
Zend_Application_Resource_Router which allows us to have the application resource perform the default actions if the locale option is not enabled in the configuration. By default, the custom router application resource will perform the default actions to the routes. You need to explicitly specify in the
application.ini that the router is locale aware.
My_Application_Resource_Router simply takes in the specified routes from the
application.ini and adds locale routes automatically so you don’t have to chain/duplicate routes in the configuration.
Let’s look at our
application.ini to see how we are setting up the router to be locale aware and adding a route.
application.ini:
... # Router/Routes resources.router.locale.enabled = true resources.router.routes.action_index.route = ":action/*" resources.router.routes.action_index.defaults.controller = "index" resources.router.routes.action_index.defaults.action = "index" ...
In the previous configuration snippet, we enable our router application resource to be locale aware and add a basic
Zend_Controller_Router_Route which is the same as specified previously in our
Bootstrap.php. When the router application resource is finished adding the routes to the router, there will be two:
:action/*
:locale/:action/*
Currently the
My_Application_Resource_Router supports
Zend_Controller_Router_Route,
Zend_Controller_Router_Route_Regex and
Zend_Controller_Router_Static routes. When these routes are specified and the router application resource is locale aware, it will automatically create routes for the supported locales.
We’ve covered a lot already, but there are still a few more steps involved. We are almost finished, I promise!
At this point, we have specified our default and supported locales and setup our routes using our custom router application resource. Now we need to do one more thing and that is to determine which locale to load and create our
Zend_Translate instance.
In order for us to determine which locale, if any, has been specified in the request, we use a controller plugin to parse the request and set the correct locale and setup our translation component.
First, we need to enable the controller plugin in our
application.ini.
application.ini:
... # Front Controller Plugins resources.frontController.plugins.I18n = "My_Controller_Plugin_I18n" ...
Next, let’s look at the controller plugin source:
My/Controller/Plugin/I18n.php:
To start, notice this plugin listens on the
routeShutdown() method. We use this because our request has gone through our router and the request is now setup and ready to be processed. In the
routeShutdown() method, we first load our
Zend_Locale instance from the registry where it was set up in our
application.ini. Next, we need to determine which locale, if any, needs to be set. By default, we’ve set our locale to use English (en) in our
application.ini. We will parse out the TLD from the host and see if it maps to one of our specified TLD locales. If that doesn’t exist, then we will look in the request to see if the locale param was set. If both of the checks can’t find a specified locale, we then simply use the default.
Since our locale is now setup, we need to load a translation file. In my example provided, I use
gettext translation files. I place these files in the
app/data/i18n folder. The file naming scheme looks like
source-{locale}.mo. Another example would be if we had a Japanese translation file, it would look something like
source-ja.mo. The plugin will try to load the translation file based on the locale language specified and add it to our
Zend_Registry and tell our
Zend_Form it’s default translator.
Finally, our plugin uses the specified locale language to determine if we need to update our base URL in the front controller. We want to set the base URL to the specified locale which allows other components like
Zend_Navigation to persist the locale in the links produced.
There you have it! You’re site is now internationalized and ready for it’s content to be translated.
But wait, that’s not all! I’ve also provided a view helper which produces a locale switcher. This view helper simply creates elements that contain images of the specified locale and shows the enabled/disabled locale while allowing you to click on the image and switch the current locale.
app/views/helpers/LocaleSwitcher.php:
I’ve included an updated Zend Framework Best Practices zip file which contains all of the files/directory structure we’ve discussed so far in the series.
The original gist of this process can be found here:.
That’s it for now. Until next time!]]>
Welcome:
My_from our lib directory
Zend_Navigation.
Over the past year, I’ve been using the Prototype javascript framework. I like it because of it’s simplicity, documentation and speed. I’ve also been keeping an eye on the progression of jQuery. I’ve noticed one very big thing that I just can’t seem to find with Prototype … The jQuery community is booming!
To back my comment, take a look at the jQuery plugins repository. It is chock-full of useful plugins that use the jQuery framework. Granted, there are a good amount of plugins for the Prototype framework, but where’s the wiki/community site for them? Or is there a site, but I just have not come across it yet?
Here’s a great start to a few of the notable plugins for Prototype that I’ve found are:
script.aculo.us - The most famous plugin/add-on using the Prototype framework. This adds animation, drag & drop, AJAX controls, DOM utilities and unit testing
Prototype Window Class (PWC) - A great class that allows you to add floating/modal skinnable windows to your page.
TableKit (Dexagogo) - Dexagogo provides many scripts based on the Prototype framework. The most notable is the TableKit. This provides an easy way to add sorting, column resizing, row striping and inline cell editing.
LivePipe Projects - Ryan Johnson also has a few scripts that use the Prototype framework. His Control Suite and Prototype.Tidbits are great add-ons and definitely worth looking into.
LightWindow 2.0 - I am really impressed with this plugin. This is the cats meow when it comes to any type of lightbox. I really like the Flash Paper example.
When it comes down to it, maybe I shouldn’t be basing the community involvement by just a plugins repository, but jQuery’s repository shows me how many different people are writing plugins and how often. It’s provides me a central location to possibly come up with new ideas for plugins or just a way for me to find something so I don’t have to recreate the wheel.
I’ve also noticed more and more articles being published on “How to do X with jQueryâ€. I try to keep up with my blogroll and feeds as much as I can, and I see an overabundance of jQuery focused articles.
Am I the only one who notices this? Please, let me know if I am wrong with this observation.
Update: John Resig (creator of jQuery) posted a great article on the jQuery and open source community today.]]>
|
http://feeds.feedburner.com/jgornick
|
CC-MAIN-2018-30
|
refinedweb
| 2,325
| 56.86
|
> On 18/10/2016, at 16:49, Victor Shoup <sh...@cs.nyu.edu> wrote: > > Interesting. Looks like the singular code is using internal, undocumented NTL > interfaces. I work very hard to keep the documented interfaces stable and > reliable, but I can't guarantee anything for undocumented interfaces. If > singular is going to do that, they will have to use ifdefs or something to > work around the issue. Or ask me to provide an interface for some > functionality that they need and that I can maintain. My guess is that this > is related to changes I made in the transition to v10. >
And you should make life difficult for abuser of undocumented or internal interfaces. There is a special place for such people… They already do ifdef, this is a larger extract than the error message: const long * rep = #if NTL_MAJOR_VERSION <= 6 static_cast<long *>( a.rep ); #else static_cast<long *>( a.rep.rep ); // what about NTL7? #endif Franço.
|
https://www.mail-archive.com/sage-devel@googlegroups.com/msg87219.html
|
CC-MAIN-2017-51
|
refinedweb
| 156
| 58.18
|
We have a speed boost powerup created in the last article, and I think our player would also benefit from a shield powerup. In this article, we'll create a new shield powerup prefab, based on the work we've already done for the speed boost.
Let's get started.
The Prefab
We'll need a way to represent this new type, so I'll add it to the
CollectableType enumeration.
public enum CollectableType { Boost, Shield, }
I'll duplicate the powerup prefab and update the type to
Shield. For now, I'll leave the effect duration as is.
Absorbing Damage
We now need to decide how the shield will work for our prototype. I want a way for designers (well, just myself for this project) to be able to quickly and easily update the shield strength.
In the player script, I'll add a new Serialize Field called
shieldsRemaining, which will be initialized to 0 by default.
public class Player : MonoBehaviour { ... private int lives = 3; private int shieldsRemaining = 0; ... }
Because the shield powerup is tagged as
Collectable, we don't need to do anything inside of the
OnTriggerEnter method. We can make our changes inside of
ActivateCollectable instead. Here we will add a switch section to account for the shield, where we will assign a constant shield strength value to our
shieldsRemaining field.
private void ActivateCollectable(Collectable collectable) { Destroy(collectable.gameObject); switch (collectable.Type) { case CollectableType.Boost: speed *= Constants.Collectable.BoostMultiplier; StartCoroutine(CollectablePowerdownRoutine(collectable.Duration, UndoBoost)); break; case CollectableType.Shield: shieldsRemaining = Constants.Collectable.ShieldStrength; break; default: break; } }
I have that constant currently set to 3.
public static class Collectable { public static int ShieldStrength = 3; public static float BoostMultiplier = 2; }
Here's the result. After picking up the shield powerup, it now takes 6 hits before our player is destroyed.
Summary
I believe that's all the powerups we need for now. If we have another idea for one, it will be quick and easy to add it with this small system in place. If our needs require a bit more complexity, we can expand what we have to meet that need.
Keep your systems as simple as possible until you absolutely need to add more abstraction and complexity.
Take care.
Stay awesome.
|
https://blog.justinhhorner.com/adding-a-shield-pickup
|
CC-MAIN-2022-27
|
refinedweb
| 372
| 66.84
|
Radio buttons
Posted on March 1st, 2001
The concept of a radio button in GUI programming comes from pre-electronic car radios with mechanical buttons: when you push one in, any other button that was pressed pops out. Thus it allows you to force a single choice among many.
The AWT does not have a separate class to represent the radio button; instead it reuses the Checkbox. However, to put the Checkbox in a radio button group (and to change its shape so it’s visually different from an ordinary Checkbox) you must use a special constructor that takes a CheckboxGroup object as an argument. (You can also call setCheckboxGroup( ) after the Checkbox has been created.)
A CheckboxGroup has no constructor argument; its sole reason for existence is to collect some Checkboxes into a group of radio buttons. One of the Checkbox objects must have its state set to true before you try to display the group of radio buttons; otherwise you’ll get an exception at run time. If you try to set more than one radio button to true then only the final one set will be true.
Here’s a simple example of the use of radio buttons. Note that you capture radio button events like all others:
//: RadioButton1.java // Using radio buttons import java.awt.*; import java.applet.*; public class RadioButton1 extends Applet { TextField t = new TextField("Radio button 2", 30); CheckboxGroup g = new CheckboxGroup(); Checkbox cb1 = new Checkbox("one", g, false), cb2 = new Checkbox("two", g, true), cb3 = new Checkbox("three", g, false); public void init() { t.setEditable(false); add(t); add(cb1); add(cb2); add(cb3); } public boolean action (Event evt, Object arg) { if(evt.target.equals(cb1)) t.setText("Radio button 1"); else if(evt.target.equals(cb2)) t.setText("Radio button 2"); else if(evt.target.equals(cb3)) t.setText("Radio button 3"); else return super.action(evt, arg); return true; } } ///:~
To display the state, an text field is used. This field is set to non-editable because it’s used only to display data, not to collect it. This is shown as an alternative to using a Label. Notice the text in the field is initialized to “Radio button 2” since that’s the initial selected radio button.
There are no comments yet. Be the first to comment!
|
http://www.codeguru.com/java/tij/tij0141.shtml
|
CC-MAIN-2016-50
|
refinedweb
| 387
| 63.9
|
Making a Command-line Ruby Gem — Write, Build, and Push
Anyone who has used Ruby before knows that gems are the spice of life. They are easy to install and distribute, even easier to use, and most importantly, they provide useful functionality. It’s not uncommon to see entire software projects centered around a single well-made gem. Take any Ruby on Rails project, and you’ll see this in practice.
Gems are, in a nutshell, Ruby code packaged for easy distribution and use. It’s easy to make your first gem, and even easier to reuse someone else’s! Thousands upon thousands of gems are available on RubyGems.org, ready to solve your problems.
In this article, we’re going to do two things. First, we’ll get started by creating our first gem and pushing it to RubyGems. This way, everyone in the world will be able to install and use it with the
gem install command. Not bad!
After that, we’re going to modify the gem so that you can use it anywhere on your computer, just by typing its name into the console. Sweet!
Requirements
In order to complete this tutorial, you’ll need a version of Ruby installed on your computer. If you don’t already have it, consider first installing RVM (Ruby Version Manager), and then selecting the version of Ruby you want via RVM. This will save you countless headaches in the future should you need to switch Ruby versions for any reason.
For the record, I used Ruby version
2.3.3p200 in the creation of this tutorial. As long what you use is at least somewhat recent, you should be fine.
Note that this tutorial was created using Ubuntu Linux (on Windows). I’m sure there’s a way to accomplish this using only Windows, but I have to leave that for you to figure out.
Setting Up the Gem
Let’s start by creating the initial file structure of our gem. Create an empty directory and
cd to it. For this tutorial, I’ll be creating the
pagekey gem. When you make yours, be sure to use a unique name that’s not already taken on RubyGems.org.
mkdir pagekey
cd pagekey
The skeleton of our gem will consist of a
.gemspec file to specify the gem configuration, a
lib folder to hold our source, and of course our first source file. I’ll create these now:
touch pagekey.gemspec
mkdir lib
touch lib/pagekey.rb
mkdir bin
Our file structure should look like this:
pagekey
|-- pagekey.gemspec
|-- bin
|-- lib
|-- pagekey.rb
Now I’ll edit
pagekey.gemspec and include some information about our gem. Remember to update this with information specific to your own gem.
Gem::Specification.new do |s|
s.name = 'pagekey'
s.version = '0.0.0'
s.platform = Gem::Platform::RUBY
s.summary = 'PageKey Solutions tutorial gem'
s.description = "Created in a tutorial found on PageKeySolutions.com/blog. Doesn't do too much!"
s.authors = ['Steve Grice']
s.email = ['steve@pagekeysolutions.com']
s.homepage = ''
s.license = 'MIT'
s.files = Dir.glob("{lib,bin}/**/*") # This includes all files under the lib directory recursively, so we don't have to add each one individually.
s.require_path = 'lib'
end
Perfect. Now that the gem is configured, let’s add some really basic code and test it out. To accomplish this, I’ll edit
lib/pagekey.rb:
module PageKey
def self.hello_world
"Good morning world and all who inhabit it!"
end
end
Excellent. We’re all set up as far as code goes. Now we can leverage Ruby’s wonderfully streamlined gem workflow to build and test our creation. Watch how easy it is.
Building and Testing
To package everything up, we will provide our
.gemspec file as the only input:
gem build pagekey.gemspec
If all goes well, you’ll see:
Successfully built RubyGem
Name: pagekey
Version: 0.0.0
File: pagekey-0.0.0.gem
Now we will install it so that it will be accessible from our code.
gem install ./pagekey-0.0.0.gem
For projects that use your gem, you may want to include it in your
Gemfile and run
bundle install:
# Inside Gemfile:
gem 'pagekey', '~> 0.0.0'
Time for the moment of truth. We can test it on
irb, the interactive ruby console. Type
irb and it will start the interpreter.
> require 'pagekey'
=> true
> PageKey::hello_world
=> "Good morning world and all who inhabit it!"
Wonderful. It works as expected.
Adding the CLI
Right now, if I type
pagekey, I’ll get an angry message from my console, like:
pagekey: command not found. This isn’t good - I want to use my gem just like
ls,
cat,
awk, or any other useful program!
In order to make this gem available under a specific terminal command, we’ll have to create an executable and link to it in our
.gemspec file.
The executable will basically be a short Ruby script that accepts command line arguments and routes them to the gem’s code in
./lib.
Create a directory to hold the file with
mkdir bin and edit the
bin/pagekey file:
#!/usr/bin/env ruby
require 'pagekey'
puts PageKey::hello_world
Ensure that the file is executable by running
chmod +x bin/pagekey. Our next step is to specify this executable in
pagekey.gemspec so that it will be added to the system PATH variable when the gem is installed. Add the following line:
s.executables = ['pagekey']
Now the gem will look in the
bin directory for the
pagekey executable when you type
pagekey on the command line.
Pushing and Publishing
After these efforts, our beautiful gem is ready to go. But, until it’s in the open air, I’d it’s nothing but a diamond in the rough (how pun-tastic!). Let’s get this thing out there in the real world.
Make sure that you build your gem as described above with
gem build pagekey.gemspec. Then, create an account at rubygems.org. Replace
USERNAME with your RubyGems username in the following snippet, and run it:
curl -u USERNAME >
~/.gem/credentials; chmod 0600 ~/.gem/credentials
This will set up your system with the proper credentials to publish gems to your RubyGems account. The final step is very simple: Just push it!
gem push pagekey-0.0.0.gem
The gem will upload, and it will become available for the world to see and download!
Bonus: Useful Rake Automation
One more tool that may be helpful as you get into the flow of gem development is
rake, which allows you to automate processes using the Ruby programming language. In the base directory for your gem, add a
Rakefile to hold your scripts. I’ve included an example that proved very helpful as I pursued my own little gem project:
GEM_NAME = "pagekey"
GEM_VERSION = "0.0.0"
task :default => :build
task :build do
system "gem build " + GEM_NAME + ".gemspec"
end
task :install => :build do
system "gem install " + GEM_NAME + "-" + GEM_VERSION + ".gem"
end
task :publish => :build do
system 'gem push ' + GEM_NAME + "-" + GEM_VERSION + ".gem"
end
task :clean do
system "rm *.gem"
end
To run these commands, just type
rake,
rake build,
rake install,
rake publish, or
rake clean and see what happens.
The outcome of each task is fairly self-explanatory. The build command just builds the gem for you. The install command builds the gem and installs it, so that you can
require it and try it out. The publish command also builds the gem, after which it takes care of pushing the gem for you.
The arrow
=> indicates a dependency of tasks. For example,
task :install => :build indicates that
:install depends on
:build, and so every time that
rake install runs, the commands under the
:build task run beforehand.
This
Rakefile relies heavily on the
system command, which utilizes the shell interpreter of the system you’re runnning on. This means that the file is OS specific. All of these tasks can likely be performed in pure Ruby, but I found it much easier, especially for simple, small projects, to write everything as a
system command. As you grow, however, it may be best to move away from OS-specific code.
As a challenge, I’ll suggest to you one way to greatly improve this
Rakefile.
Right now, you’d have to update the
.gemspec file and your
Rakefile if you wanted to change the version from
0.0.0 to
0.0.1. This is not ideal. Modify your gem’s code such that it references the
GEM_VERSION in only one place within the application. Since everything is written in Ruby, you would be able to
require a configuration file that contains the version as a variable and use that. Perhaps it would also be helpful to include a task in your
Rakefile called
:increment, which updates your gem version by incrementing the last number (moving
0.0.0 to
0.0.1 automatically).
Wrapping Up
Thanks for reading. I hope this article will help you get started writing your first Ruby gem, so that you can contribute to the large and impressive open-source Ruby community. Best of luck!
Do you enjoy learning about programming and computer engineering? If so, the PageKey Solutions Blog is the place for you! Click here to visit.
Originally published at linebylinecode.com on April 4, 2018.
|
https://stephenagrice.medium.com/making-a-command-line-ruby-gem-write-build-and-push-aec24c6c49eb?source=post_page-----aec24c6c49eb--------------------------------
|
CC-MAIN-2021-21
|
refinedweb
| 1,556
| 76.01
|
Dealing with large changes in Open-Source projects
A few weeks back, I was approached by Asmir about some changes he wanted to make to the Doctrine Migrations library. The changes sounded simple enough: to add support for multiple migration namespaces. This has been on our wishlist for a while, but we’ve never managed to get to it and also didn’t have contributors do the work. Since he has a few customers where this is a repeated pain point, he decided to invest the time to work on this. We talked a little bit about how to approach this, and when I assured him that this is definitely something we want to have in the library, he started working on it.
Since this feature would touch some of the most basic concepts in the library, it became clear relatively soon that it couldn’t just be added in without refactoring a good portion of the code base. This was when he approached me again, saying that it’s going to be a large pull request, because splitting up the work into multiple pull requests wasn’t feasible. One of the reasons for the large number of changes is that the architecture of the library is quite old, with a few core classes handling things they shouldn’t be handling. So before he could add the feature he wanted, Asmir needed to refactor the configuration system, version handling, and some of the classes that track executed migrations.
Now, in an ideal work environment, these changes would be extracted to a separate, smaller pull request for easier reviewing. Once the pull request has been merged, the next changes can be made, again in a smaller pull request, and so on. However, our Open-Source world is far from ideal: maintainers often don’t have the time to quickly review pull requests, so dealing with changes that build on several pull requests can be a tedious, time consuming process. This slows down development and can be a big source of frustration for the contributor.
Together, we decided to not do that, and instead keep changes in a single pull request to avoid unnecessary friction when splitting changes into multiple pull requests, reviewing them, getting them merged, and then repeating that process multiple times until the feature we wanted to build was done. When everything was said and done, we ended up with a single pull request consisting of more than 100 commits and a combined diff of almost 20000 lines.
Dealing with large pull requests is a difficult endeavour in any setting: it takes more time to review them and reviewers tend to get sloppy, sometimes reducing the review to skipping over files, just catching a quick glimpse at the changes without thoroughly reviewing the code and thinking about its impact. The resulting large number of comments in such a pull request can also be very demotivating to a contributor.
In this specific instance, Asmir and I were able to meet up at a conference in Berlin and took some time to go through the changes face to face. Instead of just looking at the code and trying to figure out the reason for some changes, we sat down and went over the architecture without looking at the existing code. Asmir explained the idea behind the new classes and the new architecture, and highlighted the reason for some changes that I didn’t think were necessary. This is something that we often forget when working on Open-Source software: talking to the people you work with is a lot more productive than just writing comments on a pull request. You don’t even need to be in the same place to do this: working via video chat and screen sharing will do just fine and helps resolving issues quickly.
Even then, at some point in time the pull request will have to be reviewed. This is where GitHub shines, as they have introduced features to make large pull requests easier to review. When Asmir gave me the go-ahead to review the code, I started going through the PR from top to bottom. As I got done with a file, I marked it as “viewed”, which collapses the file so I no longer see it. That way, when reviewing the code review over multiple sessions, I don’t have to think about where I left off, but I can just scroll down to the first uncollapsed file and go from there. Using the “Jump to file” box at the top allows you to quickly jump to other files to cross-reference code or double-check something you may already have reviewed. It isn’t optimal, but it makes such large-scale changes to projects easier to handle for both contributors and maintainers.
Looking past this specific example, there are some things both contributors and maintainers can do to make working with large pull requests easier and more enjoyable for everyone involved. Let’s start with the contributors’ perspective.
For one, I wouldn’t suggest taking a project, rewriting large portions of it, and then presenting the maintainers with a large pull request: chances are it will either be closed without merging, or outright being ignored, which is even worse. Instead, create an issue in the project talking about the changes you want to make and discuss it with maintainers and users of the library alike. This will help judge interest in the changes you want to make, while also opening a discussion channel around how to make the changes and to gather feedback.
Discussion doesn’t necessarily have to happen in the open, it can also be done in a closed setting like Slack, Discord, or any other tool the project may be using. Be careful though as different maintainers of a project might have different opinions, so you may want to talk to more than just one maintainer. In the example above, Asmir and I talked through our 1-on-1 chat on the Doctrine Slack, which lead to loss of information when communicating with other maintainers. Thus, I would always recommend to discuss this in an open channel to allow others to join the conversation. If possible, try to have video chats or a face-to-face sessions with one or more maintainers to discuss your changes, explain the architecture, or get general feedback.
When creating your pull request, don’t be afraid to create it while you’re still working on your code. Mark it as a work in progress, and let maintainers know when you want to have feedback. This can be extremely valuable to maintainers to see where the work is heading and to let you know when you’re taking a wrong turn before a lot of work goes to waste.
When you are done with your pull request, do a code review on it yourself. Add comments for any complex or controversial changes, explain complicated sections, or highlight key areas of the code. Besides making it easier for others to understand your changes, this can help you spot errors that you may have missed while writing the code, improving the review experience for yourself and others.
An important part of your pull request are going to be tests. If you make a large number of changes, make sure they are backed up by tests and other code quality tools. This is the best way to avoid future issues, and to ensure that future changes don’t break the functionality you’ve provided. It also gives maintainers a sense of security if they see that you’ve thought about testing your changes. It’s important that you try to cover all new functionality, even if the project previously didn’t have good test coverage. This greatly contributes to the project’s stability.
From a maintainers perspective, it’s important to be available to a contributor that makes such large changes. This means keeping a feedback channel open, checking in on the contributor, and asking them if they need help with anything. Be open to the contributor about the time you’re able to invest in helping them or reviewing code. There’s no worse feeling for a contributor to make large amounts of changes, then waiting for a long time to get the code reviewed.
When reviewing, don’t focus too much on code style. This is true for any pull request, but the larger a pull request is, the more likely people are to engage in bike shedding. You don’t want to leave tens of comments asking contributors to change names of classes or their members, while only leaving a handful of comments on the architecture or algorithms involved. Whenever possible, use the “suggested change” functionality to suggest new code. This allows the contributor to quickly apply review feedback to the code.
When reviewing the pull request over multiple days, consider submitting the review in batches or keep the contributor informed via other means. It’s important that you take your time to review the changes in detail, but a contributor won’t know if you’re actually reviewing their code or if you’re busy doing other things and won’t get to their PR for a while.
Last but not least, keep in mind that a pull request isn’t a gift from a contributor to a project. As a contributor, you are providing the project with your most valuable resource: time. At the same time, you’re asking maintainers to invest their future time to maintain your code, making sure it keeps working, and fixing bugs in the process. If you are contributing large amounts of code to a project, talk about future maintenance. For contributors, this means staying active in the project to help out with any issues involving your code, or even joining the project team. For maintainers, don’t be afraid to ask past contributors for help if you can’t figure out an issue with code they provided.
The suggestions I’ve made above won’t work for every project, every person, or every time. In our day jobs, we have meetings, discussions, a regular feedback about the work we do and problems we face. It is important to remember this when working on Open-Source, because it may not seem obvious due to geographical separation or time constraints. Communication between contributors and maintainers is key in making sure that working on Open-Source is productive and rewarding for everyone involved.
|
https://alcaeus.medium.com/dealing-with-large-changes-in-open-source-projects-26a4aad87803
|
CC-MAIN-2022-27
|
refinedweb
| 1,755
| 64.34
|
Many users these days expect instant feedback in form validation. How do you achieve this level of interactivity when you’re building a small static site or a server-rendered Rails or Laravel app? Alpine.js and Iodine.js are two minimal JavaScript libraries we can use to create highly interactive forms with little technical debt and a negligible hit to our page-load time. Libraries like these prevent you from having to pull in build-step heavy JavaScript tooling which can complicate your architecture.
I‘m going to iterate through a few versions of form validation to explain the APIs of these two libraries. If you want to copy and paste the finished product here‘s what we’re going to build. Try playing around with missing or invalid inputs and see how the form reacts:
A quick look at the libraries
Before we really dig in, it’s a good idea to get acquainted with the tooling we’re using.
Alpine is designed to be pulled into your project from a CDN. No build step, no bundler config, and no dependencies. It only needs a short GitHub
README for its documentation. At only 8.36 kilobytes minfied and gzipped, it’s about a fifth of the size of a create-react-app hello world. Hugo Di Fracesco offers a complete and thorough overview of what it is an how it works. His initial description of it is pretty great:
Alpine.js is a Vue template-flavored replacement for jQuery and vanilla JavaScript rather than a React/Vue/Svelte/WhateverFramework competitor.
Iodine, on the other hand, is a micro form validation library, created by Matt Kingshott who works in the Laravel/Vue/Tailwind world. Iodine can be used with any front-end-framework as a form validation helper. It allows us to validate a single piece of data with multiple rules. Iodine also returns sensible error messages when validation fails. You can read more in Matt’s blog post explaining the reasoning behind Iodine.
A quick look at how Iodine works
Here’s a very basic client side form validation using Iodine. We‘ll write some vanilla JavaScript to listen for when the form is submitted, then use DOM methods to map through the inputs to check each of the input values. If it‘s incorrect, we’ll add an “invalid” class to the invalid inputs and prevent the form from submitting.
We’ll pull in Iodine from this CDN link for this example:
<script src="" defer></script>
Or we can import it into a project with Skypack:
import kingshottIodine from "";
We need to import
kingshottIodine when importing Iodine from Skypack. This still adds
Iodine to our global/window scope. In your user code, you can continue to refer to the library as
Iodine, but make sure to import
kingshottIodine if you’re grabbing it from Skypack.
To check each input, we call the
is method on Iodine. We pass the value of the input as the first parameter, and an array of strings as the second parameter. These strings are the rules the input needs to follow to be valid. A list of built-in rules can be found in the Iodine documentation.
Iodine’s
is method either returns
true if the value is valid, or a string that indicates the failed rule if the check fails. This means we‘ll need to use a strict comparison when reacting to the output of the function; otherwise, JavaScript assesses the string as
true. What we can do is store an array of strings for the rules for each input as JSON in HTML data attributes. This isn’t built into either Alpine or Iodine, but I find it a nice way to co-locate inputs with their constraints. Note that if you do this you’ll need to surround the JSON with single quotes and use double quotes inside the attribute to follow the JSON spec.
Here’s how this looks in our HTML:
<input name="email" type="email" id="email" data-
When we‘re mapping through the DOM to check the validity of each input, we call the
Iodine function with the element‘s input value, then the
JSON.encode() result of the input’s
dataset.rules. This is what this looks like using vanilla JavaScript DOM methods:
let form = document.getElementById("form"); // This is a nice way of getting a list of checkable input elements // And converting them into an array so we can use map/filter/reduce functions: let inputs = [...form.querySelectorAll("input[data-rules]")]; function onSubmit(event) { inputs.map((input) => { if (Iodine.is(input.value, JSON.parse(input.dataset.rules)) !== true) { event.preventDefault(); input.classList.add("invalid"); } }); } form.addEventListener("submit", onSubmit);
Here’s what this very basic implementation looks like:
As you can tell this is not a great user experience. Most importantly, we aren’t telling the user what is wrong with the submission. The user also has to wait until the form is submitted before finding out anything is wrong. And frustratingly, all of the inputs keep the “invalid” class even after the user has corrected them to follow our validation rules.
This is where Alpine comes into play
Let’s pull it in and use it to provide nice user feedback while interacting with the form.
A good option for form validation is to validate an input when it’s blurred or on any changes after it has been blurred. This makes sure we‘re not yelling at the user before they’ve finished writing, but still give them instant feedback if they leave an invalid input or go back and correct an input value.
We’ll pull Alpine in from the CDN:
<script src="" defer></script>
Or we can import it into a project with Skypack:
import alpinejs from "";
Now there’s only two pieces of state we need to hold for each input:
- Whether the input has been blurred
- The error message (the absence of this will mean we have a valid input)
The validation that we show in the form is going to be a function of these two pieces of state.
Alpine lets us hold this state in a component by declaring a plain JavaScript object in an
x-data attribute on a parent element. This state can be accessed and mutated by its children elements to create interactivity. To keep our HTML clean, we can declare a JavaScript function that returns all the data and/or functions the form would need. Alpine will look for the this function in the global/window scope of our JavaScript code if we add this function to the
x-data attribute. This also provides a reusable way to share logic as we can use the same function in multiple components or even multiple projects.
Let’s initialize the form data to hold objects for each input field with two properties: an empty string for the
errorMessage and a boolean called blurred. We’ll use the name attribute of each element as their keys.
<form id="form" x- <h1>Log In</h1> <label for="username">Username</label> <input name="username" id="username" type="text" data- <label for="email">Email</label> <input name="email" type="email" id="email" data- <label for="password">Password</label> <input name="password" type="password" id="password" data- <label for="passwordConf">Confirm Password</label> <input name="passwordConf" type="password" id="passwordConf" data- <input type="submit"> </form>
And here’s our function to set up the data. Note that the keys match the
name attribute of our inputs:
window.form = () => { return { username: {errorMessage:'', blurred:false}, email: {errorMessage:'', blurred:false}, password: {errorMessage:'', blurred:false}, passwordConf: {errorMessage:'', blurred:false}, } }
Now we can use Alpine’s
x-bind:class attribute on our inputs to add the “invalid” class if the input has blurred and a message exists for the element in our component data. Here’s how this looks in our username input:
<input name="username" id="username" type="text" x-bind:
Responding to input changes
Now we need our form to respond to input changes and on blurring input states. We can do this by adding event listeners. Alpine gives a concise API to do this either using
x-on or, similar to Vue, we can use an
@ symbol. Both ways of declaring these act the same way.
On the input event we need to change the
errorMessage in the component data to an error message if the value is invalid; otherwise, we’ll make it an empty string.
On the
blur event we need to set the
blurred property as
true on the object with a key matching the name of the blurred element. We also need to recalculate the error message to make sure it doesn’t use the blank string we initialized as the error message.
So we’re going to add two more functions to our form to react to blurring and input changes, and use the
name value of the event target to find what part of our component data to change. We can declare these functions as properties in the object returned by the
form() function.
Here’s our HTML for the username input with the event listeners attached:
<input name="username" id="username" type="text" x-bind:
And our JavaScript with the functions responding to the event listeners:
window.form = () => { return { username: {errorMessage:'', blurred:false}, email: {errorMessage:'', blurred:false}, password:{ errorMessage:'', blurred:false}, passwordConf: {errorMessage:'', blurred:false}, blur: function(event) { let ele = event.target; this[ele.name].blurred = true; let rules = JSON.parse(ele.dataset.rules) this[ele.name].errorMessage = this.getErrorMessage(ele.value, rules); }, input: function(event) { let ele = event.target; let rules = JSON.parse(ele.dataset.rules) this[ele.name].errorMessage = this.getErrorMessage(ele.value, rules); }, getErrorMessage: function() { // to be completed } } }
Getting and showing errors
Next up, we need to write our
getErrorMessage function.
If the Iodine check returns
true, we‘ll set the
errorMessage property to an empty string. Otherwise, we’ll pass the rule that has broken to another Iodine method:
getErrorMessage. This will return a human-readable message. Here’s what this looks like:
getErrorMessage:function(value, rules){ let isValid = Iodine.is(value, rules); if (isValid !== true) { return Iodine.getErrorMessage(isValid); } return ''; }
Now we also need to show our error messages to the user.
Let’s add
<p> tags with an
error-message class below each input. We can use another Alpine attribute called
x-show on these elements to only show them when their error message exists. The
x-show attribute causes Alpine to toggle
display: none; on the element based on whether a JavaScript expression resolves to
true. We can use the same expression we used in the the
show-invalid class on the input.
To display the text, we can connect our error message with
x-text. This will automatically bind the
innertext to a JavaScript expression where we can use our component state. Here’s what this looks like:
<p x-</p>
One last thing we can do is re-use the
onsubmit code from before we pulled in Alpine, but this time we can add the event listener to the form element with
@submit and use a
submit function in our component data. Alpine lets us use
$ el to refer to the parent element holding our component state. This means we don’t have to write lengthier DOM methods:
<form id="form" x- <!-- inputs... --> </form>
submit: function (event) { let inputs = [...this.$ el.querySelectorAll("input[data-rules]")]; inputs.map((input) => { if (Iodine.is(input.value, JSON.parse(input.dataset.rules)) !== true) { event.preventDefault(); } }); }
This is getting there:
- We have real-time feedback when the input is corrected.
- Our form tells the user about any issues before they submit the form, and only after they’ve blurred the inputs.
- Our form does not submit when there are invalid properties.
Validating on the client side of a server-side rendered app
There are still some problems with this version, though some won‘t be immediately obvious in the Pen as they‘re related to the server. For example, it‘s difficult to validate all errors on the client side in a server-side rendered app. What if the email address is already in use? Or a complicated database record needs to be checked? Our form needs to have a way to show errors found on the server. There are ways to do this with AJAX, but we’ll look at a more lightweight solution.
We can store the server side errors in another JSON array data attribute on each input. Most back-end frameworks will provide a reasonably easy way to do this. We can use another Alpine attribute called
x-init to run a function when the component initializes. In this function we can pull the server-side errors from the DOM into each input’s component data. Then we can update the
getErrorMessage function to check whether there are server errors and return these first. If none exist, then we can check for client-side errors.
<input name="username" id="username" type="text" x-bind:
And to make sure the server side errors don’t show the whole time, even after the user starts correcting them, we’ll replace them with an empty array whenever their input gets changed.
Here’s what our init function looks like now:
init: function () { this.inputElements = [...this.$ el.querySelectorAll("input[data-rules]")]; this.initDomData(); }, initDomData: function () { this.inputElements.map((ele) => { this[ele.name] = { serverErrors: JSON.parse(ele.dataset.serverErrors), blurred: false }; }); }
Handling interdependent inputs
Some of the form inputs may depend on others for their validity. For example, a password confirmation input would depend on the password it is confirming. Or a date you started a job field would need to hold a value later than your date-of-birth field. This means it’s a good idea to check all the inputs of the form every time an input gets changed.
We can map through all of the input elements and set their state on every input and blur event. This way, we know that inputs that rely on each other will not be using stale data.
To test this out, let’s add a
matchingPassword rule for our password confirmation. Iodine lets us add new custom rules with an
addRule method.
Iodine.addRule( "matchingPassword", value => value === document.getElementById("password").value );
Now we can set a custom error message by adding a key to the
messages property in Iodine:
Iodine.messages.matchingPassword="Password confirmation needs to match password";
We can add both of these calls in our
init function to set up this rule.
In our previous implementation, we could have changed the “password” field and it wouldn’t have made the “password confirmation” field invalid. But now that we’re mapping through all the inputs on every change, our form will always make sure the password and the password confirmation match.
Some finishing touches
One little refactor we can do is to make the
getErrorMessage function only return a message if the input has been blurred — this can make out HTML slightly shorter by only needing to check one value before deciding whether to invalidate an input. This means our
x-bind attribute can be as short as this:
x-bind:class="{'invalid':username.errorMessage}"
Here’s what our functions look like to map through the inputs and set the
errorMessage data now:
updateErrorMessages: function () { // Map through the input elements and set the 'errorMessage' this.inputElements.map((ele) => { this[ele.name].errorMessage = this.getErrorMessage(ele); }); }, getErrorMessage: function (ele) { // Return any server errors if they're present if (this[ele.name].serverErrors.length > 0) { return input.serverErrors[0]; } // Check using Iodine and return the error message only if the element has not been blurred const error = Iodine.is(ele.value, JSON.parse(ele.dataset.rules)); if (error !== true && this[ele.name].blurred) { return Iodine.getErrorMessage(error); } // Return empty string if there are no errors return ""; },
We can also remove the
@blur and
@input events from all of our inputs by listening for these events in the parent form element. However, there is a problem with this: the
blur event does not bubble (parent elements listening for this event will not be passed it when it fires on their children). Luckily, we can replace blur with the
focusout event, which is basically the same event, but this one bubbles, so we can listen for it in our form parent element.
Finally, our code is growing a lot of boilerplate. If we were to change any input names we would have to rewrite the data in our function every time and add new event listeners. To prevent rewriting the component data every time, we can map through the form’s inputs that have a
data-rules attribute to generate our initial component data in the
init function. This makes the code more reusable for additional forms. All we’d need to do is include the JavaScript and add the rules as a data attribute and we’re good to go.
Oh, and hey, just because it’s so easy to do with Alpine, let’s add a fade-in transition that brings attention to the error messaging:
<p class="error-message" x-show.transition.</p>
And here’s the end result. Reactive, reusable form validation at a minimal page-load cost.
If you want to use this in your own application, you can copy the
form function to reuse all the logic we’ve written. All you’d need to do is configure your HTML attributes and you’d be ready to go.
The post Lightweight Form Validation with Alpine.js and Iodine.js appeared first on CSS-Tricks.
You can support CSS-Tricks by being an MVP Supporter.
|
http://design-lance.com/tag/lightweight/
|
CC-MAIN-2021-10
|
refinedweb
| 2,958
| 61.97
|
Hi everyone! I’m a bit stuck with this exercise. Whenever I run the code, I get ‘Error’ for ‘Magic 8-Ball’s Answer’ and not any of the randomly generated answers. I’ve looked at the code carefully and am not quite sure where I’m going wrong. Any help would be greatly appreciated!
Here is my code:
import random name = "Rachael" question = "Will it rain on Monday?" answer = "" random_number = random.randint(1,9) if random_number == "1": answer = "Yes - definitely." elif random_number == "2": answer = "It is decidedly so." elif random_number == "3": answer = "Without a doubt." elif random_number == "4": answer = "Reply hazy, try again." elif random_number == "5": answer = "Ask again later." elif random_number == "6": answer = "Better not tell you now." elif random_number == "7": answer = "My sources say no." elif random_number == "8": answer = "Outlook not so good." elif random_number == "9": answer = "Very doubtful." else: answer = "Error" print(name + " asks: " + question) print("Magic 8-Ball's answer: " + answer)
Here is the link to the exercise: Magic 8-Ball.
Thanks in advance!
|
https://discuss.codecademy.com/t/magic-8-ball/653662
|
CC-MAIN-2022-21
|
refinedweb
| 169
| 70.6
|
Topic Listener MDB problemsKaroy Bandai Oct 19, 2009 7:56 PM
MDB doesn't seem to connect to JMS Topic, message posted by j2se client to JMS Topic doesn't seem to show in Topic stats.
Setup: WinXP, JBoss 5.1, Eclipse Galileo, JDK 1.6.
JBoss setup seems to be functioning, as an EJB app has deployed and was tested just fine.
@MessageDriven(activationConfig = {
@ActivationConfigProperty(
propertyName = "destinationType",
propertyValue = "javax.jms.Topic") },
mappedName = "JMSTopic1",
name="TopicMDB1")
public class TopicMDB1 implements MessageDrivenBean, MessageListener {...}
Using Eclipse JEE plugin, the MDB is added to an EAR proj, which is then "deployed" {Run} on JBoss.
The deployment seems to conclude without errors, but there are no signs of the bean anywhere.
A j2se test client puts a simple text msg to the Topic, but there's no sign of that msg either in the JMS system, nor is it being consumed by anybody {obviously}.
I am a noob to JBoss, but have done this in Weblogic many times, if that counts for anything.
Any suggestions would be welcome.
karoy
1. Re: Topic Listener MDB problemsKaroy Bandai Oct 19, 2009 8:27 PM (in response to Karoy Bandai)
By this bit:
"I" wrote:I meant that while the server console log shows all kinds of stuff being done, as the JSM tracing is turned on, using these instructions:.
...there's no sign of that msg either in the JMS system...
I just don't see it the Topic's statistics that a message passed through or something.
2. Re: Topic Listener MDB problemsYong Hao Gao Oct 19, 2009 10:44 PM (in response to Karoy Bandai)
Hi,
It seems like a MDB config issue, can you post the question to EJB team? Also JBM has some good examples for users to get started. You can download them from JBoss.org. Especially there is an example ejb3mdb that may be of some interest to you.
Howard
3. Re: Topic Listener MDB problemsKaroy Bandai Oct 20, 2009 2:20 PM (in response to Karoy Bandai)
So, indeed, the fix seems to have been related to a missing Activation Property: @ActivationConfigProperty(propertyName = "destination", propertyValue = "JMSTopic1").
This is kinda strange, since the setting mappedName, already names the Topic.
The bean wasn't deploying properly, but the error was swallowed until the JBoss log4j settings were set to TRACE, which ended up spelling out the details.
|
https://developer.jboss.org/thread/129709
|
CC-MAIN-2018-13
|
refinedweb
| 396
| 61.77
|
#include <wx/protocol/protocol.h>
Represents a protocol for use with wxURL.
Note that you may want to change the default time-out for HTTP/FTP connections and network operations (using SetDefaultTimeout()) since the default time-out value is quite long (60 seconds).
Detach the existing logger without deleting it.
The caller is responsible for deleting the returned pointer if it's non-
NULL.
Returns the type of the content of the last opened stream.
It is a mime-type. May be an empty string if the content-type is unknown.
Returns the last occurred error.
Creates a new input stream on the specified path.
You can use all but seek() functionality of wxStream. Seek() isn't available on all streams. For example, HTTP or FTP streams don't deal with it. Other functions like StreamSize() and Tell() aren't available for the moment for this sort of stream. You will be notified when the EOF is reached by an error.
Implemented in wxFTP, and wxHTTP.
Return the current logger, may be NULL.
Call wxProtocolLog::LogRequest() if we have a valid logger or do nothing otherwise.
Call wxProtocolLog::LogResponse() if we have a valid logger or do nothing otherwise.
Tries to reestablish a previous opened connection (close and renegotiate connection).
Sets a new default timeout for the network operations.
The default timeout is 60 seconds.
Set the logger, deleting the old one and taking ownership of this one.
|
http://docs.wxwidgets.org/trunk/classwx_protocol.html
|
CC-MAIN-2017-43
|
refinedweb
| 238
| 61.12
|
Movable Python: The Portable Python Distribution
Contents
The pywin32 extensions [1]
present a particular challenge for use with Movable Python. This is because
they detect the presence of sys.frozen and behave differently when working
in a frozen environment. Unfortunately this fix doesn't work when used with
Movable Python.
A lot of the work of getting this extension to function has already been done
for you. However there is one more thing you may need to do.
If you have difficulties with the Python windows extensions then try adding
the following line to the start of your code :
del sys.frozen
If you want this to be done automatically for you, you can add this line to the
customize.py Special File. This
shouldn't cause you any other problems [2].
The main GUI uses the win32 extension to help with
windows 98 compatibility [3]. It uses a slightly different trick to do this :
temp = sys.frozen
del sys.frozen
import win32api
sys.frozen = temp
del temp
This leaves sys.frozen in place after the import has taken place.
Note
This solution was discovered by Brian Beck who created a utility called
fix_shortcuts.py, for use with Movable Python.
A summary of his efforts is included below, in case it is useful for any
other extensions that do similar magic.
A Movable Python user, Brian Beck, has been working on a small program that
allows you to keep shortcuts to applications on a flash card, along with
Movable Python. His program fix_shortcuts.py is currently located at. Because windows shortcuts must
contain an absolute path, they need to be edited every time the drive letter
changes. With portable flash devices it is likely that the drive letter will
change on every machine they are plugged into. fix_shortcuts.py uses the
pywin32 extensions, by Mark Hammond, to change the location pointed to by the
shortcuts. Most libraries can be used just by copying the whole package from
'site-packages' into the 'lib/' directory. This approach didn't work
with pywin32, due to a peculiarity with pywin32. (Note this problem might also
affect other libraries that dynamically adjust their __path__ attribute, or
use sys.frozen to do any other magic).
A summary of the technique needed to make it work :
For an explanation of why this was necessary, read the following description
from Brian.
First off it should be noted that pywin32 makes the following directories in a
normal distribution's site-packages directory:
It also adds a few files to the root of site-packages (pythoncom.py,
PyWin32.chm, pywin32.pth).
After moving the above files & directories to the appropriate location in
Movable Python (into the 'lib/' directory), I added the paths in pywin32.pth to
Movable Python's syspaths.pth.
Now, it won't let me import pythoncom just yet -- it complains that 'pythoncom
isn't in frozen sys.path.' Moving pythoncom24.dll from the pywin32_system32
directory to MovPy's root lib directory (to join the existing pywintypes24.dll)
fixes this. Now it's okay to get rid of the pywin32_system32 directory (so it
seems).
Now I can import pythoncom and win32com -- but this is where the trouble
starts! win32com itself has modules such as shell, ifilter, internet, and
mapi to name a few. Instead of keeping these in its own (win32com) directory,
it puts them in the separate win32comext directory. To find out about this
separate directory, it seems to consult the registry. As I said, I can import
win32com, but trying to import, for example, win32com.shell fails (no module
named shell).
I find this (that it fails) odd because after looking at the code, it looks
like after failing to find the appropriate registry key it defaults to the
'win32comext' directory, so shouldn't it find 'shell'? Also, I do actually
have the entries in my registry because I have pywin32 installed (and working)
on my standard Python distribution. So even if the paths stored in the registry
are absolute instead of relative, it should be able to load the win32com
extensions.
However it doesn't find it. The reason for this is that pywin32 knows about
sys.frozen. If an application is frozen (using py2exe) it expects a
different directory structure to a normal python distribution. With Movable
Python we had basically copied the directory structure straight from
site-packages. Now we still need to make the above changes (moving the dlls,
adding the relevant lines to syspaths.pth), but we also need to tell pywin32
that the script wasn't built using py2exe. This means that we need to add the
line del sys.frozen to our script before importing anything from pywin32.
A convenient place to do this might be in the customize.py file.
So why don't we just delete the sys.frozen attribute by default ? Well... the
rub is that if Movable Python is built with the pywin32 extensions included,
then they will need sys.frozen. For this reason it seems better to leave things
as they are. It is possible that this problem might affect other modules as
well. If you have problems importing from a module you have added into the
'lib/' directory, then try adding del sys.frozen to your script and see if
this makes any difference.
A user (Jim C) has also reported a problem with using win32api..
Please note the additional instructions on using the extensions with
py2exe/Movable Python.
From : (dlls available for
download here).
Download these files and save them to your Windows System32 directory.
Alternatively in the same directory as the script being run or elsewhere in
windows PATH (not sys.path !).
The problems with win32com are not unique to Movable Python, they apply to
every application built using py2exe. See the note
on the py2exe wiki,
for a general solution for use with py2exe.
Return to Top
Part of the Movable Python Docs
Page last modified Wed Jul 16 02:31:30 2008.
Download Movable Python
|
http://www.voidspace.org.uk/python/movpy/reference/win32ext.html
|
CC-MAIN-2016-40
|
refinedweb
| 996
| 66.33
|
See also: IRC log
<trackbot> Date: 06 November 2009
<Bob> scribe: Wu
bob: email sent to mailing list to update the issues
gil: we ask time to Friday next week to finish the review
bob: any objection to extend the deadline to close on 11/13/09?
RESOLUTION: no objection. New Issue Moratorium will begin at COB on 2009-11-13
asir: we need more time
... to settle use cases with my team
gil: point 2 of 7728 is already
addressed.
... point 1 of issue 7728 is the one to address
<gpilz>
gil: this is the attachment for point 1 of issue 7728
tom: likes it.
asir: we had some discussion on this issue over mailing list.
<asir> Here it is
asir: there are two assumptions.
First assumption - policy at EPR applies to all
... second - consumer knows almost everything
... thinking points: who defines it, what is the relation between policy sitting in EPR and out-of-band agreement,
... what is the policy subject
gil: i think may not need to address since it is quite common.
regarding your point A. point B needs to explore.
gil: we need to more clear for point C.
asir: regarding point A, it may not be common for other people.
<trutt> The ability to attach a policy expression pertaining to the endpoint as a whole to an epr, would be used in cases where there are not concerns about policy conflicts at a more granular level.
<Zakim> asir, you wanted to ask a question
asir: this proposal is out for long
time, anyone has implemented it?
... it has been there for 2 1/2 years.
<gpilz> The policies attached to an EPR in this matter apply to all bindings, portTypes, operations, and messages associated with the endpoint referenced by the EPR.
bob: the WG has its own charter. We
should be regard of our own charter/interest.
... there seems point C can be crisper.
<gpilz> The policies attached to an EPR in this manner apply to all bindings, portTypes, operations, and messages associated with the endpoint referenced by the EPR.
gil: the posted text is trying to address point C
asir: it is o.k. to say these
assumptions are made.
... for example in section 8 of MEX that assuptions are positively documented.
bob: AI on Gil/Asir to work on a refresh version of proposal for issue 7728
dug:
... I don't see to split the namespace for policy
... I don't see real benefit of it.
ram: is there a value to change value in policy space which is isolated?
dug: it might cause more confusion.
gil: the chance to change policy only peice is small.
bob: it seems a coin flap choice in
this case.
... we have examples that go both ways.
... the proposal is to consolidate the namespace.
asir: what is the harm of having two separate docs?
dug: cann't see real benefit.
asir: separate data and meta data is one benefit.
jeff: physically separation does not mean much.
dug: it is easy to read.
bob: any objection to proposal?
RESOLUTION: no objection. issue 8124 is resolved with single namespace proposal
<Bob>
Yves: my point to put a warning in the text, that people should be aware the possible descripency with some warning text.
<gpilz> {some combo of specs} allows receivers to dispatch on either the [Action] property or the QName of the [Body] child. Implementations that authorize requests based on the requested operation are advised to ensure that the property values used for such authorization decisions are consistent with the property values that are used for dispatching.
gil: adding the above sentence in security section should do the trick.
ram: why just limit to two options,
there may be other ways.
... If there are multiple ways, the first sentence can be dropped.
Yves: first sentence is to describe the issue and non-binding
asir: confused from a different view about the proposal
bob: any text change proposal?
asir: needs to think about it.
bob: any objection to resolve this issue as Gil's text?
asir: needs more time.
bob: Gil puts this proposal into bug proposal and discuss in future meeting
<dug> Event Source : A Web service that accepts requests to create subscriptions for the subscriber to receive certain type of notifications.
<dug>
<asir> Asir mentioned that MSFT needed more time to work on 7911 because we have so many WS-RA work items scheduled for the next WG meeting
<dug>
bob: please post the consolidated proposal of issue 7970
<dug>
ram: why sending notifications is not
mentioned in event source
... if we may add event source may send notifications
dug: proposal to move "notifications may be sent by any ..." to the definition of event source
bob: remove term "notification"
dug: i am o.k. but it should be raised as a separate issue.
<dug> (if there's any push-back)
bob: propose to remove "one-way" in notification to "a" message.
gil: "one-way" in the definition of notification is not clear.
bob: any objection to accept comment #8 as resolving issue 7970?
RESOLUTION: no objection. Issue 7970 is resolved with the latest comment in the bugzilla.
gil: what happens if a subscriber
request to event source, and the policy in that Notify EPR does not
match the policy this proposal advertising?
... we might need adding a new fault for this.
dug: that is fine
asir: if there is descripency, it is caused by the provider, right?
<asir> Our comments are here
gil: this is not my concern. what happens policy in subscribe does not match the policy being published by provider.
asir: when you get back notification
wsdl, it may be able to stay alone and maynot.
... we would like to have a method to get all meta data, not just wsdl.
dug: if you want to get missing meta information, why just ask for it specifically.
gil: ask schema should get all schemas the endpoint knows about.
asir: this is point, why we need to add new dialect if this is the case.
dug: if metadata is optional, implies imcomplete metadata (e.g. has policy but not wsdl)
can happen. Do we need to solve the problem to get policy where is no wsdl?
dug: asking notification policy is something of interest and special.
<jeffm> +q
gil: all metadata are optional. There is a use case that event notification type does not have wsdl.
dug: it might solve this issue by
putting this policy in endpoint.
... it applies to event sink endpoint.
jeffm: optional is not helpful.
asir: there are two kinds of metadata: service metadata and notification metadata. If they separate, the problem might be solved.
<jeffm> what i said was that repeating the "its optional mantra" is not helpful,because we are writing a MetaDATA spec which says what to do and how to specify the metadata when it is there
dug: why we just create a new dialect
"notification policy"?
... if using separate dialect, it will separate different cases.
asir: you are heading to the design pattern using dialect to do division.
gil: in mex, two class uris can use, e.g. generic (all), and specific (schema).
bob: two choices i.e. notification wsdl is wsdl or not.
dug: similar problem as discussed yesterday, implicit wsdl or real application wsdl. we need a flag to tell.
bob: one alternative to call these dialects collection uri
dug: it means using a list of qualifiers
bob: you can have three categories dilects, collection identifiers, and qualifiers.
AI: Asir/Doug come back with new solution proposal.
<dug> Gil too
<asir> s/"Asir/Doug"/Asir, Doug and Gil/
ram: i would be fine to be the owner
of this issue.
... the problem is: people wants to link wsdl at the design time, and if there is a mechnism on it.
dug: may just pass the meta data
document, one with notification wsdl and one with event
notification. would that work?
... i am poking what solution will solve this problem.
gil: mex meta data document contains both. The linkage is they are in the same meta data document.
asir: the mex you can infer is "collection". Any inference to be drawn is out of band.
<Bob> recessed until 13:00 pacific
<Bob> scribenick: trutt
<Bob>
<gpilz> +1
Dug: some people would like to see the Event Description section (A.1) pulled out into a separate document/spec.
Ram: what would be title of he new little spec?
Dug: we have to decide on that
<dug>
Dug: there would be a reference from ws-eventing to this "little" spec
Asir: what is the use case. Are there other specs which want to use it?
Martin: SCA eventing might want to use it
<asir> Here is a sentence that won't make sense in a separate doc
<asir> The /soap:Envelope/soap:Body/wse:Notify element has a single child element
RESOLUTION: No objection to a directional resolution to have editors to proceed with pulling out the Event Description (A.1/A.1.1) as a separate small specification
<gpilz>
we expect a new version of the state table to appear at a future meeting.
Consistent Policy applied to a set of resources
Dug: I would prefer to give Paul an email explaining that if he does not provide a proposal, the issue would close with no action
Ownership assigned to Asir
Asir to urge Paul to provide a proposal for resolution
Gil: this seems to want to introduce
yet another scope selector (or axis) on the resource metadata to be
returned.
... any proposal needs to take into consideration the other proposals regarding meta data scope, like app vs implicit wsdl, notification vs regular wsdl, etc.
Asir: so Paul needs to motivate the need, and relate to the other issues on metadata scope which we are working on.
<asir> and provide a concrete proposal
Clarify required and optional operations
Ram: I suggest that all WG members look at my characterizations of the optionality of each operation, and comment on them so we can come to resolution.
Dug: I have a concern about why getStatus should not just be required.
Ram: if there is a general requirement for this feature, we can make it mandatory. I want to ensure there is a valid use case for requiring get status operation always.
<Bob> scribenick: trutt
Wu: I am happy with the general idea, but we need to agree on the actual set of mandatory operations.
Dug: ws frag does not need to say anything about get or put, because they are inherited from ws transfer.
<Bob> scribenick: trutt
Bob: what should we do about get status? Should it be required?
Wu: I need time to check on the need for get status before I decide
<scribe> ACTION: Ram to produce a concrete proposal based on his email. [recorded in]
<trackbot> Created ACTION-119 - Produce a concrete proposal based on his email. [on Ram Jeyaraman - due 2009-11-13].
s/proposal based on/proposal for operations being required/optional, based on/
Dug: I suggest Ram pick a spec, and do an exemplar of how to specify the optionality. Perhaps eventing would be best to do it.
@mode in ws-frag is harmful
Yves: Get rid of '@mode' and use Create(Frag) Delete(Frag), like it's done for
Put(Frag).
Yves: could Dug explain the reason for this @mode
Gil: ws frag is extending ws-transfer. verbs in ws-t have a context. a ws-t put is on resource as a whole. The insert is creating a new bit of fragment, however from view of ws-t it is acting on the resource as whole. It is changing the resource even though it is removing a piece of the resource.
Yves: what is fragment identifying. Is the verb on the whole resource of just the fragment.
Dug: with put you may delete a bit,
but it is still an instruction to update the resource. that is why
put is the best verb rather than a delete.
... the dialogue URI could be used to accomplish your patch example.
... I would like to think more about whether we could get rid of remove mode and instead use an empty value with a put.
... may need to distinguish missing value and empty value
Defer resolution until after further email discussions.
Fragment: clarify behavior of optional xml
Dug: Add the following sentence to the end of the paragraph referenced above:
When @Mode is 'Insert' or 'Replace', any optional values (element or
attributes)
within this subset that are not specified in the wsf:Value element will be set
to a resource-specific default value.
RESOLUTION: No objection to resolve issue 7969 with proposal in issue
<Bob>
serialization of fragment Put input is underspecified
<gpilz>
Gil: In the descriptions of the "XPath Level 1" and "XPath 1.0" expression
languages, WS-Fragment describes some important serialization rules for text and attribute nodes, however it does not say if or how such rules should be applied to /wst:Put/wsf:Fragment/wsf:Value's.
Gil: does the spec require to wrap text values for an attribute as in a get, or can the value be used on its own.
Dug: If there are more than one value
returned, the wrapper may not be needed. Xpath level 1 does not
return more than one value, so the wrapping might not be
needed.
... You might not need it for a put if there is no need to send more than one value on the request. I see no need for such a separator on the input side of a put.
<gpilz> <wsf:Value>1</wsf:Value> or <wsf:Value><wsf:TextNode>1</wsf:TextNode></wsf:Value> ??
Gil: if I am trying to replace a text
node with ws-frag put, do I use the first form or the second form
in the example above. The spec needs to be clear on this.
... how to serialize attribute node and text node values on the ws-frag put.
<asir> Gil wants clarity nothing is broken tho
Dug: we need to go off and think about this. I expect you do not need it on the input of the put operation.
Gil: If I use the response from a get operation to later use in a subsequent put, it might be beneficial to not require a change in the way the value is wrapped.
Dug: I do not see a need to put a sequence of values.
Bob: a streaming processor can deliver a text node as a sequence of text rather than as a whole.
Asir: Xquery serialization deals with this already. We should look at that.
<asir> here it is
Agreed to leave this issue open to further investigation and discussion.
<Bob>
Define an EmptyFilter fault like we did for eventing
per
Gil: it seems like a good idea to me
Ram: I would like to defer resolution until later.
In example 3.1 proposal:
change (20) to be:
(20) <wsen:Expires PT10M </wsen:Expires>
RESOLUTION: No objection to resolve 8158 with proposal.
check to see if all "required" uses are meant to be RFC2119 uses
Asir: it is not a global change of "required" to "REQUIRED". eg accountabiliy in security section should not be a keyword.
Dug: this applies to enumeration as well.
Agreed to defer resolution until all the uses of the word "required" are examined individually.
Agreed to change "needed" to "used" in the two exceptions that are listed in the issue proposal.
RESOLUTION: No objection to resolve issue 8163 as proposed.
RESOLUTION: No objection to resolve Issue 8166 with change from: "The term "subscription manager" in this specification refers to" to "The term "subscription manager" is used in this specification to refer to".
Asir: reconsider, since we have to edit the paragraph to remove rfc 1119 terminology.
Agreed editor to remove rfc 2119 keywords from the paragraph cited in the bug.
RESOLUTION: No objection to resolve 8167 with amended proposal to remove rfc 2119 keywords from paragraph.
RESOLUTION: No objection to resolve issue 8168 as proposed.
<gpilz> However, if a subscriber wishes to have notifications annotated with unique SOAP header blocks then it MAY include reference parameters within the wse:NotifyTo element. These reference parameters will be processed as specified by WS-Addressing 1.0 - SOAP Binding.
RESOLUTION: No objection to resolve issue 8169 with proposed change in comment #1 from bugzilla.
Martin: change "demarshalling" to "unmarshalling"
RESOLUTION: No objection to resolve issue 8170 with proposed change in comment #2 from bugzilla
Tom: change "and MUST" to "which MUST" in the proposal
RESOLUTION: No objection to resolve issue 8172 with proposed change in comment #1 from bugzilla
RESOLUTION: No objection to resolve Issue 8177 as proposed.
RESOLUTION: No objection to resolve Issue 8179 as proposed.
RESOLUTION: No objection to resolve Issue 8184 as proposed.
<Bob> Issue 8186
<Bob> RESOLUTION: 8186 resolved as proposed
RESOLUTION: No objection to resolve issue 8162 as proposed
RESOLUTION: No objection to resolve issue 8199 as proposed.
RESOLUTION: No objection to resolve Issue 8213 as proposed
Dug: Katy meant for them to be
siblings.
... I say make the text agree with the schema.
RESOLUTION: No objection to resolve Issue 8214 as proposed
RESOLUTION: No objection to resolve Issue 8204 as proposed.
Dug: this is superceded by Issue 8201.
RESOLUTION: No objection to close as supercedec by Issue 8201
Bob: It is time to get another snapshot. Can the changes get into the editor's drafts before the snapshot.
Yves: monday morning would be a good time for the snapshot.
Dug: I can do it by Monday morning EST.
Bob: Dug should tell Yves when he has incorporated the changes.
Asir: I recall that this is reconsidering an issue from Hursley that we resolved.
Agreed to leave open to allow investigation of Hursley discussion
s/7555/7554/
agreed to defer discussion since it is not editorial.
Dug: mex-all IRI can never appear in a metadata section. So the table is misleading.
Asir: I need more time to invistigate why it was put in originally.
Dug: I think it was just a copy from the request table.
Agreed to keep issue open for more time
|
http://www.w3.org/2002/ws/ra/9/11/2009-11-06.html
|
CC-MAIN-2015-48
|
refinedweb
| 3,031
| 64.81
|
LinuxQuestions.org
(
/questions/
)
-
Amigo
(
)
- -
GCC not installling..also yahoo messenger,grub &linmodem
(
)
liny1984
06-15-2006 01:36 PM
GCC not installling..also yahoo messenger,grub &linmodem
1.Could someone please point me to a version of gcc that installs correctly.i tried installing from the pkg(.tgz) given in amigo main downld area (2.95/3.1/3.2.3)..all install correctly but when i try to compile even 1 line c programs ,it says 'cc1 executable not found'..same with c++ progs.Are there any other pkgs reqd? i installed binutils ,glibc still no effect...some times when compiling it fills the screen with errors in stdio.h like namespace errors etc & then finds an error in my test.c program.i tried installing on amigo9.1 with a system that has windowsXP in c: and amigo in f:\Linux folder...please help me out as i am unable to program anything in linux.KDE installs perfectly!..
2.also is grub available for amigo as tgz pkg? for lilo i chose 800*600 mode for initial display yet i get the command line (text mode) menu. no penguin :(
3.also how do i install tar.gz pkgs yahoo messenger for example is available as tar.gz
4.also can anyone point me to a stable driver for linmodems i got a" SoftV92 Data Fax Modem" card from D-Link
liny1984
06-15-2006 01:41 PM
Some help on AmigoXP too
Could someone also tell me which version of amigo xp to downld & is stable
amigoxprc1
or amigoxprc2
..also has all the forums been shifted here??
this is still the home page right??
amigolinux.org
gnashley
06-16-2006 01:12 AM
Are you using the wrapper to run gcc-2.95? You'll find it in the sources directory:
It just does this:
#!/bin/sh
export PATH=/opt/gcc-2.95/bin:$PATH
export LD_LIBRARY_PATH=/opt/gcc-2.95/lib
exec "$@"
Or you can just do
export PATH=/opt/gcc-2.95/bin:$PATH
from the command line, then 'make'. This puts the gcc binary in your path before your regular compiler.
I don't have GRUB packaged yet, though I've been working on some custom versions the last few days and will make packages soon.
If you are seeing tar.gz packages then you are in the Sources area. Look for the same program name under Packages:
I don't recommend that you use amigoxprc1 or rc2. You'll notice that they are not on my site anymore, only on some sites that mirror mine and don't refresh their content.
gnashley
06-16-2006 04:50 PM
The tar.gz from yahoo messenger is probably a tarball with an install script, like for opera or other progs like that -usually non-open-source.
tar xvf yayhue.tar.gz will unpack it. Then look for a README or install script to run
liny1984
06-18-2006 02:26 PM
amigoXP link
could u plz give me the xact link for d/l amigoxp ..its done right ??
gnashley
06-18-2006 04:21 PM
There is no dowload for AmigoXP.
liny1984
06-19-2006 04:53 AM
Ok i am facing more problems:-
1.i ran gcc with wrapper as
sh wrap cc test.c
'wrap' is the wrapper u mentioned:-
#!/bin/sh
export PATH=/opt/gcc-2.95.3/bin:$PATH
export LD_LIBRARY_PATH=/opt/gcc-2.95.3/lib
exec "$@"
test.c is as follows:-
#include <stdio.h>
int main(int argc,char *argv[])
{
printf("hello");
return 0;
}
result:-
test.c:1:stdio.h: No such file or directory
So i installed the kernel headers and kernel sources...no change.Also stdio.h is
not present inside the include directory of gcc.So fine i changed the 1st line
to #include<stddef.h> so now it compiles but stops asking for 'as'....so i
install binutils now it assembles(i guess) & n ow it says:-
/usr/bin/ld:cannot open crt1.o:No such file or directory
so i go hav a look at /dev & there is no crt1.o .Is the output device
incorrectly mentioned somewhere. I tried compiling with -o option as
sh wrap cc -o a.o test.c
(i think i am using the -o option incorrectly...but i
am not sure....newbie here :) )
still same reply .....cant open crt1.o
collect2:ld returned 1 exit status
So now i try c++
sh wrap cc test.cpp
test.cpp:-
#include <iostream.h>
int main(int argc,char *argv[])
{
cout<<"hello";
return 0;
}
result: big error basically it says
cant find libio.h which is #included in streambuf.h which in turn is #included in
iostream.h
2.Is there a way to startx automatically just before or after login....this would
then display the login screen if kde is installed or automatically start kde after
logging in at cmd line
i tried to modify some scripts in rc.d but there is no script for run level 3 rc.3
there are scripts only for rc.4 & rc.6...buts its mentioned that run level 3 is
default....how do i automatically start programs just before or after login??
3.u mentioned 'make' after exporting the PATH ...make what...could you please be slightly more detailed here...i am a relative noob
liny1984
06-19-2006 04:54 AM
Isnt amigoXP ready for release yet...and which is tthe main site you are maintaining from where amigoXP is available?
gnashley
06-19-2006 06:53 AM
If you downloaded the binary package for gcc, then you also need to install the cxx32-libs package. These are the kernel libraries.
You might try commenting out the line for LD_LIBRARY_PATH or change it to this:
export LD_LIBRARY_PATH=/opt/gcc-2.95.3/lib:$LD_LIBRARY_PATH
which will include the regular lib directories.
Unless your code is really old, you'll find it easier to use the gcc-3.1 (or 3.2.3)version as it links to the smae libs as your regular compiler.
Your question 2 is a Slackware question, actually. You need to edit /etc/inittab.
Change this:
id:3:initdefault:
to this:
id:4:initdefault:
#3 The way I use the wrappers is to make them executable and put them in /usr/local/bin and execute them by name with calling 'sh'. This line: exec "$@" simply tells it to do whatever the rest of the command is. I give the example of using the command 'make' since most people use Makefiles to control their builds. Sounds like you are learning from the ground up which is great. Dig around through the directories there on my site and read the notes and README'S. I keep it short usually, but I've been told I lay a treasure around sometimes...
About AmigoXP. Perhaps there won't be a release by that name. As you notice, the site changed completely. As stated there, the only thing I offer or support is what's there and all of the content is new -lotta GB'2 there.
On the way to making the next distro, I needed to do several things, like get my sources better organized, with repeatable build scripts, get more GPL conformant by only distributing packages for stuff that I compile and with the sources available locally. Better documentation for both packages and sources which I have modified.
The new amigolinux.org site is the result of these policies and practices.More than 300 prgrams and adding stuff everyday.
When I get back to creating the next Amigo distro, it'll be something refreshing for several groups of users -probably under 256MB base size and still windows friendly.
Actually I nearly have something nearly ready especially made for running from external devices like mp3 players and iPods, etc. I've released some pretty good distros before. The next should be even better, but I'm still making decisions about what to push for. It's a *big* responsablility and lot's of work.
liny1984
06-21-2006 03:22 PM
sorry double post...removing this
liny1984
06-21-2006 03:24 PM
Close but no!!
1.ok installed gcc3.2.3 & set up the paths as u said.the readme.AMIGO file instrucs were followed & i set up the compiler for
strict compiling against the libraries. i also chked the path using 'gcc which' and its setup ok. So after setting up for strict compilation it locates stdio.h (it couldn't before) and tries to compile.Then it spews up a whole set of errors in stdio.h!! something like
'BEGIN_NAMESPACE'.....& 'THROWS...'
i think i am close but so many syntax errors in stdio.h in gcc323 folder that i just installed is not possible
my program is absolutely correct right...no namespace std or anything specific reqd??
test.c
#include <stdio.h>
int main(int argc,char *argv[])
{
printf("hello");
return 0;
}
2.the system starts up xdm automatically now after i modified inittab...thanks for that....now i know i should be knowing this but could you please tell me if there is file explorer like the one you provide with the default rox-filler....i saw just xterm when i logged in graphically with xdm(and some other stuff)
gnashley
06-23-2006 03:58 PM
xdm is just a login manager which by default starts the famous TWM desktop!
If you want to build a desktop and use the same filer or desktop stuff that I use, look around the site, especially in GUIcomponents and in the
AmigoProjects area.
As far as the gcc problem, as I said you should probably *not* alter the LD_LIBRARY_PATH at all, just the PATH.
All times are GMT -5. The time now is
05:32 AM
.
|
http://www.linuxquestions.org/questions/amigo-56/gcc-not-installling-also-yahoo-messenger-grub-and-linmodem-455115-print/
|
CC-MAIN-2015-22
|
refinedweb
| 1,637
| 77.33
|
This is what I want to do:
I want to dynamically load a class from an extenal assembly into my application. (using Silverlight 2.0 and Visual Studio 2008).
The class which I want to load is called MyAssembly.MyClass; It is derived from Canvas; It resides in an assembly called MyAssembly.dll. I amually deployed the DLL in the ClientBin directory of my Web-Project.
Her is what have tried:
I have tried to load the assembly using Assembly.Load("MyAssembly"). It failed with File not found. (Are there any good working examples for 'Assembly.Load()'?).
Now I am trying to solve the problem with AssemblyPart.Load(...). I am able to load the assembly, but nw I am not able to create instances of objects within that assembly. Can you help?
Here is the code I am working on:
using
I found the solution. I hope this helps other people....
When loading the DLL as a Stream into the AssemblyPart, you can create an Assembly at the same time:
AssemblyPart ap = new AssemblyPart(); Assembly a = ap.Load(s);
The Assembly will then allow you to create an object:
Canvas can = (Canvas)a.CreateInstance("MyAssembly.MyClass");
Here is the entire method loadAssembly(). All other parts of the source code (above) remain unchanged.
Thank you for this. Your code works great. I made an adaption using my resizable window control. I placed it here:
SilverlightDesktop.net
With source code of course and even a credit for you.
SilverlightDesktop.net A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
Well, thanks for your comment. And thanks for putting it up. It is always good to know that someone finds this usefull
Thank you for this, I had tried to follow the instructions of the MSDN page (See Here) but it wasn't working.
I followed your advice but loading seems not to work if one uses application ressources ? My load fails on this line
<TextBox Grid.
with error "TextBoxDescription" not found, TextBoxDescription is in App.xaml of the control to load NOT on the loader (of course).
So this looks to me as even byndmaically loaded componets try to look up ressources in the PARENT application not the loaded dll. I would say this is a bug or ?
Joe Robe
joer00:
I followed your advice but loading seems not to work if one uses application ressources ?
I followed your advice but loading seems not to work if one uses application ressources ?
You can either put the resources in the control that is being dynamically loaded or pass the resources to the control through it's ".Tag" property.
This thread explains exactly what I need to do. Looking at SilverlightDesktop.net makes me realise how similar my project is... but I just can't get it working.
I can get the WebClient object to retrieve the assembly and feed the stream into an AssemblyPart object's Load method. The assembly is loaded correctly and stored in the Assembly object and I can even create an instance of the class I need (checked that it is not null with the debugger), but when I try to assign the Content property of a TabItem with the created instance (which is actually a subclass of UserControl), it just comes up blank and not the test text that is actually in the UserControl. No errors, nothing. It's like the UserControl loses everything it contains. Here's what I'm currently working with. = a.CreateInstance("Project.Modules.ProjectsModule") as UserControl;
}
ProjectsModule.xaml
<UserControl x:Class="Project.Modules.ProjectsModule"
xmlns=""
xmlns:
<Grid x:
<TextBlock>Test String</TextBlock>
</Grid>
</UserControl>
namespace Project.Modules
{
public partial class ProjectsModule : UserControl
{
public ProjectsModule()
{
InitializeComponent();
}
}
}
Hopefully one of you guys can see someone obvious that I'm doing wrong ;) I can't understand why I'm just getting blank content even when the debugger shows a ProjectsModule object being created from the CreateInstance method.
Thanks in advance!
You may need to just call the UpdateLayout method on the containing control to fix this.
Also SilverlightDesktop.net adds a control to a window control then adds the window control to the main canvas, so 3 things are happening:
SilverlightWindowControl objSilverlightWindowControl = new SilverlightWindowControl(objSilverlightDesktopModule.WindowSize);
objSilverlightWindowControl.Window.Content = objUserControl;
objSilverlightWindowControl.WindowName.Text = objSilverlightDesktopModule.ModuleName;
Canvas.SetLeft(objSilverlightWindowControl, (double)intWindowLocationLeft);
Canvas.SetTop(objSilverlightWindowControl, (double)intWindowLocationTop);
this.LayoutRoot.Children.Add(objSilverlightWindowControl);
UpdateLayout does nothing :(
I've had a little play and tried to add the content to a new TabItem then add that TabItem to the TabControl with the following code: =
TabItem tab = new TabItem();
Random random = new Random();
tab.Header = String.Format("Tab{0}", random.Next(100));
tab.Content = a.CreateInstance("Project.Modules.ProjectsModule") as UserControl;
tabs.Items.Add(tab);
}
|
http://silverlight.net/forums/t/14941.aspx
|
crawl-002
|
refinedweb
| 789
| 50.23
|
Le Fri, Mar 14, 2008 at 05:19:46PM -0700, Asheesh Laroia a écrit : > > I actually don't know about another program that provides a > /usr/bin/license, even not in Debian. I honestly don't think this is a > conflict. For Debian, apt-file can help. Otherwise, I googled for /usr/bin/license, and found only your project. Nevertheless, maybe some more experience programmer can comment on the use of dictionnary words. In the Debian-Med packaging team, we often have problems of namespace collision. Be careful that from the Debian point of view, there is not guarantee of `first arrived, first served': in the future, if later somebody wants to package a program using /usr/bin/license for another purpose, both will have to be renamed if no agreement is found (Policy 10.1). Have a nice day, -- Charles
|
https://lists.debian.org/debian-mentors/2008/03/msg00197.html
|
CC-MAIN-2015-18
|
refinedweb
| 141
| 63.7
|
Hello,
I'm following a tutorial here: ArcGIS Help 10.1
I have added the code to the .py file and installed the add-in in using the makeaddin.py file and Test001.esriaddin file yet when I press the button, nothing happens. It's supposed to zoom to the selected features. I have ArcMap 10.2 and indicated so in the Python Add-In Wizard provided by ESRI. Attached is the .py file, . Here is the code:
import arcpy
import pythonaddins
class ZoomToSelectedFeatures(object):
"""Implementation for Test001_addin.btn1 (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
#()
Thank you in advance for taking the time to help.
|
https://community.esri.com/thread/117611-arcgis-help-101-creating-a-python-add-in-button-this-is-not-working-for-me-please-help
|
CC-MAIN-2018-43
|
refinedweb
| 109
| 72.42
|
We’ve released an alpha of “WebJobs SDK”, a simple framework that makes it crazy easy to write code that runs on Azure and binds against azure storage. (The project was internally codenamed “SimpleBatch” and also known amongst a few as “Project Awesome”). Scott Hanselman has a great blog about SimpleBatch, and there’s also an excellent getting started tutorial.
The basic idea is that you can write normal C# functions and then add some bindings that connect their parameters to Azure storage (notably blobs, tables, and queues). We then have a dashboard that provides free diagnostics into your functions execution.
Simple code…
Consider an example where we want to resize an image and then stamp it with a water mark. We may write a Resize() and ApplyWaterMark() function like this:
public class ImageFuncs { // Given an image stored in blob, resize it and save the output back to a blob. // Use WebImage class from System.Web.Helpers. public static void Resize( [BlobInput(@"images-input/{name}")] Stream inputStream, [BlobOutput(@"images-output/{name}")] Stream outputStream) { WebImage input = new WebImage(inputStream); var width = 80; var height = 80; WebImage output = input.Resize(width, height); output.Save(outputStream); } // Take the resulting image from Resize() and stamp a watermark onto it. // The watermark is the filename minus the extension. public static void ApplyWaterMark( [BlobInput(@"images-output/{name}")] Stream inputStream, string name, [BlobOutput(@"images-watermarks/{name}")] Stream outputStream) { WebImage image = new WebImage(inputStream); image.AddTextWatermark(name, fontSize: 20, fontColor: "red"); image.Save(outputStream); } }
static class WebImageExtensions { public static void Save(this WebImage image, Stream output) { var bytes = image.GetBytes(); output.Write(bytes, 0, bytes.Length); } }
First thing to note is that these functions are using regular FX types and so can be easily unit tested running in-memory or against the local file system. This can really be just a normal console application – there’s nothing about it that needs to be azure aware.
Bindings and Triggers
The magic above is the BlobInput / BlobOutput attributes. Those are pulled in via the Microsoft.WindowsAzure.Jobs nuget package. These bind the Stream parameters directly to azure blobs. The string to these attributes is a blob path meaning “Container/BlobName”, and the {name} is like a Route parameter that uses basic pattern matching rules. So “images-input/{name}” matches any blob in container “images-input”, and the blob name is captured in the {name} route parameter.
As you see in the ApplyWaterMark() function, you can directly capture the route parameters via a parameter. Eg, the ‘string name’ parameter captures the {name} route parameter. This can be useful if you need programmatic access to part of the blob’s name.
The route parameters from the [BlobInput] are then passed to the [BlobOutput]. So Resize() would execute when a new blob “images-input/fruit.jpg” is detected, and it would produce an output blob “images-output/fruit.jpg”
You may notice that the output from Resize() maps nicely to the input of ApplyWaterMark(). That provides a defacto way that one function can chain execution to another.
This example demonstrates bindings for blobs, but there are also bindings for queues and tables.
Hosting and executing .
So what actually reads the bindings, listens on the triggers, and invokes the functions? That’s the JobHost object (which lives in Microsoft.WindowsAzure.Jobs.Host ). Here’s a canonical main function:
static void Main() { JobHost h = new JobHost(); h.RunAndBlock(); }
Short and sweet! With the default JobHost ctor, the azure connection strings are pulled from the app.config:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="AzureJobsRuntime" connectionString="DefaultEndpointsProtocol=https;AccountName=???;AccountKey=???"/> <add name="AzureJobsData" connectionString="DefaultEndpointsProtocol=https;AccountName=???;AccountKey=???"/> </connectionStrings> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> </configuration>
AzureJobsData is the connection string that the BlobInput/BlobOuput attributes will bind against.
AzureJobsRuntime is where the logging data goes. Both connection strings can point to the same account.
JobHost lives in Microsoft.WindowsAzure.Jobs.Host and it will:
-.
The Dashboard
As functions execute, you’ll see the logs in the SimpleBatch Dashboard. The dashboard runs as an Azure Websites Site Extension and getting to the dashboard is detailed in the tutorial above.
Here’s what the dashboard homepage looks like. You’ll notice it lists the function invocation history on the right.
We can see that Resize() and ApplyWaterMark() each ran twice. We can click on an instance to see details about a specific execution:
Every function instance gets a unique GUID and a permalink showing it’s execution history. In this case, the dashboard is showing us:
- basic information like when the function ran, how long, and any console output
- any exceptions thrown.
- an explanation as to why this function was run in the first place (in this case, a new blob input was detected)
- parameter information, including how many bytes each read, and even how long it spent in IO.
- Any children function triggered by this function. IE, Resize() will create a blob that causes ApplyWaterMark() to run.
There are additional navigation options, such as seeing which function instance wrote each of the input blobs.
Note that you get all of this diagnostic logging for free, without any additional instrumentation or configuration in your code. As Scott Hanselman said, “Minimal ceremony for maximum results”.
In summary
SimpleBatch makes it very easy to write code in azure and it provides excellent diagnostics. It has two parts:
- Client-side dlls, available via the Microsoft.WindowsAzure.Jobs.Host nuget package.
- A dashboard for viewing function result. The dashboard runs as an Azure Websites Site Extension.
Here are some more links to other resources
- Scott Hanselman’s introduction to WebJobs
- WebJobs SDK Getting Started Tutorial
- WebJobs SDK Samples on CodePlex (see under Samples/AzureWebJobs)
- NuGet packages: Microsoft.WindowsAzure.Jobs, Microsoft.WindowsAzure.Jobs.Host
Mike,
Thank you for a good example. WebImage is the only thing that is not clear. Where does it come from? What Nuget package needs to be pulled down to be able to use this sample?
Thank you,
Sean
Sean – The nugget package is "microsoft-web-helpers" It's an ASP package that includes other things.
The current version of "microsoft-web-helpers" on nuget doesn't seem to allow WebImages to be saved as streams. I had to use:
var bytes = output.GetBytes();
outputStream.Write(bytes, 0, bytes.Length);
rather than
output.Save(outputStream);
|
https://blogs.msdn.microsoft.com/jmstall/2014/01/24/webjobs-sdk/
|
CC-MAIN-2017-13
|
refinedweb
| 1,056
| 50.12
|
The openpgp package
This is an OpenPGP library inspired by my work on OpenPGP libraries in Ruby, PHP, and Python.
It defines types to represent OpenPGP messages as a series of packets and then defines instances of Data.Binary for each to facilitate encoding/decoding.
For performing cryptography, see or
For dealing with ASCII armor, see
It is intended that you use qualified imports with this library.
import qualified Data.OpenPGP as OpenPGP
- No changelog available
Properties
Modules
- Data
Downloads
- openpgp-0.6.tar.gz [browse] (Cabal source package)
- Package description (included in the package)
Maintainers' corner
For package maintainers and hackage trustees
|
http://hackage.haskell.org/package/openpgp-0.6
|
CC-MAIN-2014-52
|
refinedweb
| 103
| 57.57
|
Whatever the reason, you need printf(). Just remember to call it fprintf(stderr,...), so your log isn't on a buffered stream.
#include <stdio.h>
main() { printf("hello world\n"); }
#include <iostream.h>
main() { cout << "Hello World\n"; }
Quick and dirty? Well, certainly quick, hardly dirty. I must admit
it has gotten better... it used to include libcurses when iostream
was used. But still, what does it need libm for?
And still, the thought of trying to do this with iostreams scares me.
sprintf(format,"%%.%ds\n",(ptr>=end_tape)?ptr+1:end_tape);
printf(format,tape);
I once told my boss "I'll give up printf() when you pry my cold dead fingers from it". Well, he was happy to oblige.
Now I'm not saying that coding without the use of both hands is easy but not having printf() really hurts.
The injury first occured when I started programming on embedded systems. I thought I would never be able to cope. Embedded systems usually = no debugger, which is when I would use printf(). I soon learned that there are ways to get around the problem and get some work done.
printf()
Alternatives to printf():
None of the above will ever replace a fully functioning printf() statement so I will remain a printf() amputee for the forseeable future.
Log in or registerto write something here or to contact authors.
Need help? accounthelp@everything2.com
|
http://everything2.com/title/I%2527ll+give+up+printf%2528%2529+when+you+pry+my+cold+dead+fingers+from+it
|
CC-MAIN-2017-04
|
refinedweb
| 233
| 77.03
|
i =0;
while (true) {
fgets (oneline, 255, filein);
if (!(strchr(oneline, '}') != NULL)
break;
char* p;
while (1) {
p = strchr (oneline, ')');
if (p == NULL)
break;
sscanf (oneline, "%f%f%f", &vtemp[i].x, &vtemp[i].y, &vtemp[i].z)
++i;
}
}
Experts Exchange Solution brought to you by
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.Start your 7-day free trial
while (1) {
p = strchr (oneline, ')');
if (p == NULL)
break;
sscanf (oneline, "(%f%f%f", &vtemp[i].x, &vtemp[i].y, &vtemp[i].z)
++i;
oneline = p+1; // just increment oneline to point after ).
}
on one line you have 4 elements, and on the other you only have 2
so on the first you'll list the 4th element, and the next one you'll only have 2 points.
another method would be read the entire file into memory and then parse it in memory, the logic would be different but it may be easier to apply to a Class that you create.
int Points::LoadFromFile( fName )
void Points::OutputToScreen()
etc... just an idea
This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.
In that case before scanning one has to check for the next ')'. Reading from serial port/network etc requires this approach since it could always be that a single read doesn't get the terminating char which only follows with the next read or even later.
remove newlines in area, created char ** to each point, divide by three to make sure we have semi-accurate data...
Then you have something like
char *
line*
line*
using atoi or strtol...but I have a vector class that I wrote to do this kind of stuff...I usually read entire file into memory and perform all my operations in memory, but I'm also used to dealing with larger sets where you would see some performance increase.....but at this size it would be overkill...
Just offereing another point of view.
#include <fstream>
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
using namespace std;
struct Point { float a, b, c; };
template <typename IS>
IS & operator>> (IS & is, Point & p)
{
char c; // opening and closing brackets
is >> c >> p.a >> p.b >> p.c >> c;
return is;
}
int main ()
{
vector<Point> points;
ifstream f ("data.txt");
string s;
while (getline(f, s))
if (s == "points {")
{
cout << "a\n";
while (getline(f, s))
{
if (s == "}") break;
istringstream iss (s);
Point p;
while (iss >> p) points.push_back(p);
}
}
return 0;
}
I will leave the following recommendation for this question in the Cleanup topic area:
Split: SteH {http:#9746083} & g0rath {http:#9747792}
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Tinchos
EE Cleanup Volunteer
|
https://www.experts-exchange.com/questions/20797827/Parsing-out-text-files.html
|
CC-MAIN-2018-30
|
refinedweb
| 490
| 70.94
|
Completed • Knowledge • 578 teams
Bag of Words Meets Bags of Popcorn
Dashboard
Forum (69 topics)
- 13 hours ago
- 13 days ago
- 26 days ago
- 36 days ago
- IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices50 days ago
- 2 months ago
Part 2: Word Vectors
Code
The tutorial code for Part 2 lives here.
Introducing Distributed Word Vectors
This part of the tutorial will focus on using distributed word vectors created by the Word2Vec algorithm. (For an overview of deep learning, as well as pointers to some additional tutorials, see the "What is Deep Learning?" page).
Parts 2 and 3 assume more familiarity with Python than Part 1. We developed the following code on a dual-core Macbook Pro, however, we have not yet run the code successfully on Windows. If you are a Windows user and you get it working, please leave a note on how you did it in the forum! For more detail, see the "Setting Up Your System" page.
Word2vec, published by Google in 2013, is a neural network implementation that learns distributed representations for words. Other deep or recurrent neural network architectures had been proposed for learning word representations prior to this, but the major problem with these was the long time required to train the models. Word2vec learns quickly relative to other models.
Word2Vec does not need labels in order to create meaningful representations. This is useful, since most data in the real world is unlabeled. If the network is given enough training data (tens of billions of words), it produces word vectors with intriguing characteristics. Words with similar meanings appear in clusters, and clusters are spaced such that some word relationships, such as analogies, can be reproduced using vector math. The famous example is that, with highly trained word vectors, "king - man + woman = queen."
Check out Google's code, writeup, and the accompanying papers. This presentation is also helpful. The original code is in C, but it has since been ported to other languages, including Python. We encourage you to play with the original C tool, but be warned that it is not user-friendly if you are a beginning programmer (we had to manually edit the header files to compile it).
Recent work out of Stanford has also applied deep learning to sentiment analysis; their code is available in Java. However, their approach, which relies on sentence parsing, cannot be applied in a straightforward way to paragraphs of arbitrary length.
Distributed word vectors are powerful and can be used for many applications, particularly word prediction and translation. Here, we will try to apply them to sentiment analysis.
Using word2vec in Python
In Python, we will use the excellent implementation of word2vec from the
gensim package. If you don't already have gensim installed, you'll need to install it. There is an excellent tutorial that accompanies the Python Word2Vec implementation, here.
Although Word2Vec does not require graphics processing units (GPUs) like many deep learning algorithms, it is compute intensive. Both Google's version and the Python version rely on multi-threading (running multiple processes in parallel on your computer to save time). ln order to train your model in a reasonable amount of time, you will need to install
cython (instructions here). Word2Vec will run without cython installed, but it will take days to run instead of minutes.
Preparing to Train a Model
Now down to the nitty-gritty! First, we read in the data with pandas, as we did in Part 1. Unlike Part 1, we now use unlabeledTrain.tsv, which contains 50,000 additional reviews with no labels. When we built the Bag of Words model in Part 1, extra unlabeled training reviews were not useful. However, since Word2Vec can learn from unlabeled data, these extra 50,000 reviews can now be used.
import pandas as pd
# Read data from files
train = pd.read_csv( "labeledTrainData.tsv", header=0,
delimiter="\t", quoting=3 )
test = pd.read_csv( "testData.tsv", header=0, delimiter="\t", quoting=3 )
unlabeled_train = pd.read_csv( "unlabeledTrainData.tsv", header=0,
delimiter="\t", quoting=3 )
# Verify the number of reviews that were read (100,000 in total)
print "Read %d labeled train reviews, %d labeled test reviews, " \
"and %d unlabeled reviews\n" % (train["review"].size,
test["review"].size, unlabeled_train["review"].size )
The functions we write to clean the data are also similar to Part 1, although now there are a couple of differences. First, to train Word2Vec it is better not to remove stop words because the algorithm relies on the broader context of the sentence in order to produce high-quality word vectors. For this reason, we will make stop word removal optional in the functions below. It also might be better not to remove numbers, but we leave that as an exercise for the reader.
# Import various modules for string cleaning
from bs4 import BeautifulSoup
import re
from nltk.corpus import stopwords
def review_to_wordlist( review, remove_stopwords=False ):
# Function to convert a document to a sequence of words,
# optionally removing stop words. Returns a list of words.
#
# 1. Remove HTML
review_text = BeautifulSoup(review).get_text()
#
# 2. Remove non-letters
review_text = re.sub("[^a-zA-Z]"," ", review_text)
#
# 3. Convert words to lower case and split them
words = review_text.lower().split()
#
# 4. Optionally remove stop words (false by default)
if remove_stopwords:
stops = set(stopwords.words("english"))
words = [w for w in words if not w in stops]
#
# 5. Return a list of words
return(words)
Next, we want a specific input format. Word2Vec expects single sentences, each one as a list of words. In other words, the input format is a list of lists.
It is not at all straightforward how to split a paragraph into sentences. There are all kinds of gotchas in natural language. English sentences can end with "?", "!", """, or ".", among other things, and spacing and capitalization are not reliable guides either. For this reason, we'll use NLTK's punkt tokenizer for sentence splitting. In order to use this, you will need to install NLTK and use nltk.download() to download the relevant training file for punkt.
# Download the punkt tokenizer for sentence splitting
import nltk.data
nltk.download()
# Load the punkt tokenizer
tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
# Define a function to split a review into parsed sentences
def review_to_sentences( review, tokenizer, remove_stopwords=False ):
# Function to split a review into parsed sentences. Returns a
# list of sentences, where each sentence is a list of words
#
# 1. Use the NLTK tokenizer to split the paragraph into sentences
raw_sentences = tokenizer.tokenize(review.strip())
#
# 2. Loop over each sentence
sentences = []
for raw_sentence in raw_sentences:
# If a sentence is empty, skip it
if len(raw_sentence) > 0:
# Otherwise, call review_to_wordlist to get a list of words
sentences.append( review_to_wordlist( raw_sentence, \
remove_stopwords ))
#
# Return the list of sentences (each sentence is a list of words,
# so this returns a list of lists
return sentences
Now we can apply this function to prepare our data for input to Word2Vec (this will take a couple minutes):
sentences = [] # Initialize an empty list of sentences
print "Parsing sentences from training set" for review in train["review"]: sentences += review_to_sentences(review, tokenizer) print "Parsing sentences from unlabeled set" for review in unlabeled_train["review"]: sentences += review_to_sentences(review, tokenizer)
You may get a few warnings from BeautifulSoup about URLs in the sentences. These are nothing to worry about (although you may want to consider removing URLs when cleaning the text).
We can take a look at the output to see how this differs from Part 1:
>>> # Check how many sentences we have in total - should be around 850,000+
... print len(sentences)
857234
>>> print sentences[0]
[u'with', u'all', u'this', u'stuff', u'going', u'down', u'at', u'the', u'moment', u'with', u'mj', u'i', u've', u'started', u'listening', u'to', u'his', u'music', u'watching', u'the', u'odd', u'documentary', u'here', u'and', u'there', u'watched', u'the', u'wiz', u'and', u'watched', u'moonwalker', u'again']
>>> print sentences[1]
[u'maybe', u'i', u'just', u'want', u'to', u'get', u'a', u'certain', u'insight', u'into', u'this', u'guy', u'who', u'i', u'thought', u'was', u'really', u'cool', u'in', u'the', u'eighties', u'just', u'to', u'maybe', u'make', u'up', u'my', u'mind', u'whether', u'he', u'is', u'guilty', u'or', u'innocent']
A minor detail to note is the difference between the "+=" and "append" when it comes to Python lists. In many applications the two are interchangeable, but here they are not. If you are appending a list of lists to another list of lists, "append" will only append the first list; you need to use "+=" in order to join all of the lists at once.
Training and Saving Your Model
With the list of nicely parsed sentences, we're ready to train the model. There are a number of parameter choices that affect the run time and the quality of the final model that is produced. For details on the algorithms below, see the word2vec API documentation as well as the Google documentation.
- Architecture: Architecture options are skip-gram (default) or continuous bag of words. We found that skip-gram was very slightly slower but produced better results.
- Training algorithm: Hierarchical softmax (default) or negative sampling. For us, the default worked well.
- Downsampling of frequent words: The Google documentation recommends values between .00001 and .001. For us, values closer 0.001 seemed to improve the accuracy of the final model.
- Word vector dimensionality: More features result in longer runtimes, and often, but not always, result in better models. Reasonable values can be in the tens to hundreds; we used 300.
- Context / window size: How many words of context should the training algorithm take into account? 10 seems to work well for hierarchical softmax (more is better, up to a point).
- Worker threads: Number of parallel processes to run. This is computer-specific, but between 4 and 6 should work on most systems.
- Minimum word count: This helps limit the size of the vocabulary to meaningful words. Any word that does not occur at least this many times across all documents is ignored. Reasonable values could be between 10 and 100. In this case, since each movie occurs 30 times, we set the minimum word count to 40, to avoid attaching too much importance to individual movie titles. This resulted in an overall vocabulary size of around 15,000 words. Higher values also help limit run time.
Choosing parameters is not easy, but once we have chosen our parameters, creating a Word2Vec model is straightforward:
# Import the built-in logging module and configure it so that Word2Vec
# creates nice output messages
import logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s',\
level=logging.INFO)
# Set values for various parameters num_features = 300 # Word vector dimensionality min_word_count = 40 # Minimum word count num_workers = 4 # Number of threads to run in parallel context = 10 # Context window size downsampling = 1e-3 # Downsample setting for frequent words
# Initialize and train the model (this will take some time)
from gensim.models import word2vec_40minwords_10context" model.save(model_name)
On a dual-core Macbook Pro, this took less than 15 minutes to run using 4 worker threads. However, it will vary depending on your computer. Fortunately, the logging functionality prints informative messages.
If you are on a Mac or Linux system, you can use the "top" command from within Terminal (not from within Python) to see if your system is successfully parallelizing while the model is training. Type
> top -o cpu
into a terminal window while the model is training. With 4 workers, the first process in the list should be Python, and it should show 300-400% CPU usage.
If your CPU usage is lower, it may be that cython is not working correctly on your machine.
Exploring the Model Results
Congratulations on making it successfully through everything so far! Let's take a look at the model we created out of our 75,000 training reviews.
The "doesnt_match" function will try to deduce which word in a set is most dissimilar from the others:
>>> model.doesnt_match("man woman child kitchen".split())
'kitchen'
Our model is capable of distinguishing differences in meaning! It knows that men, women and children are more similar to each other than they are to kitchens. More exploration shows that the model is sensitive to more subtle differences in meaning, such as differences between countries and cities:
>>> model.doesnt_match("france england germany berlin".split())
'berlin'
... although with the relatively small training set we used, it's certainly not perfect:
>>> model.doesnt_match("paris berlin london austria".split())
'paris'
We can also use the "most_similar" function to get insight into the model's word clusters:
>>> model.most_similar("man")
[(u'woman', 0.6056041121482849), (u'guy', 0.4935004413127899), (u'boy', 0.48933547735214233), (u'men', 0.4632953703403473), (u'person', 0.45742249488830566), (u'lady', 0.4487500488758087), (u'himself', 0.4288588762283325), (u'girl', 0.4166809320449829), (u'his', 0.3853422999382019), (u'he', 0.38293731212615967)]
>>> model.most_similar("queen")
[(u'princess', 0.519856333732605), (u'latifah', 0.47644317150115967), (u'prince', 0.45914226770401), (u'king', 0.4466976821422577), (u'elizabeth', 0.4134873151779175), (u'antoinette', 0.41033703088760376), (u'marie', 0.4061327874660492), (u'stepmother', 0.4040161967277527), (u'belle', 0.38827288150787354), (u'lovely', 0.38668593764305115)]
Given our particular training set, it's not surprising that "Latifah" is a top hit for similarity with "Queen".
Or, more relevant for sentiment analysis:
>>> model.most_similar("awful")
[(u'terrible', 0.6812670230865479), (u'horrible', 0.62867271900177), (u'dreadful', 0.5879652500152588), (u'laughable', 0.5469599962234497), (u'horrendous', 0.5167273283004761), (u'atrocious', 0.5115568041801453), (u'ridiculous', 0.5104714632034302), (u'abysmal', 0.5015234351158142), (u'pathetic', 0.4880446791648865), (u'embarrassing', 0.48272213339805603)]
So it seems we have a reasonably good model for semantic meaning - at least as good as Bag of Words. But how can we use these fancy distributed word vectors for supervised learning? The next section takes a stab at that.
with —
|
https://www.kaggle.com/c/word2vec-nlp-tutorial/details/part-2-word-vectors
|
CC-MAIN-2017-34
|
refinedweb
| 2,329
| 57.77
|
So Carlos/SP
Janeiro/2011
Resumo
Este texto foi elaborado para a participao do autor no Concurso Pblico de Professor Livre Docente junto ao Departamento de Sistemas de Computao do Instituto de Cincias Matemticas e de Computao da Universidade de So Paulo
(SSC/ICMC/USP). No texto, apresentada uma sistematizao das pesquisas e
trabalhos realizados pelo autor, delineando seu foco de pesquisa em Teste de Software. Primeiramente, so descritas as contribuies na rea de Teste Baseado em
Mquinas de Estados Finitos, o qual concentra os principais esforos do autor e
as publicaes mais recentes. Em seguida, so apresentadas as contribuies na
rea de Teste de Programas Paralelos que caracteriza a segunda linha de atuao do
autor. Por m, so descritas as outras linhas de pesquisa nas quais o autor tem
atuado.
Neste documento, so descritos os fundamentos e os pressupostos com as
quais as abordagens tm sido exploradas pelo autor, destacando as contribuies
e os desenvolvimentos realizados nos ltimos seis anos de trabalho acadmico,
correspondendo ao perodo posterior concluso do doutorado. Nesse perodo,
o autor publicou oito artigos completos em revistas, incluindo publicaes na
IEEE Transactions on Computers, Oxford Computer Journal, IET Software e Computer
Languages, Systems and Structures, com Qualis A1, B1, B2 e B2, respectivamente.
Publicou tambm 24 artigos em congressos da rea, sendo 13 em eventos internacionais e 11 em eventos nacionais.
Abstract
This document was elaborated to fulll the requirements of the authors application for a position of Associate Professor in Software Engineering, at the Computer Systems Department of the Institute of Mathematical Sciences and Computing, University of So Paulo (SSC/ICMC/USP). The text systematizes the
authors research contribution, focused on studies about Software Testing. First,
it presents the contributions on software testing based on Finite State Machines,
which represents the core of the authors contributions and publications in recent
years. Then, it presents the contributions on Parallel Program Testing, which represents his second main topic of investigation. Finally, it describes other research
topics which the author has investigated.
This text describes the background and the assumptions which are the basis
for the research done by the author, highlighting the contributions and developments accomplished in the last six years, i.e. after the conclusion of the Doctoral
Thesis. In this period, the author published eight papers in journals, including
IEEE Transactions on Computers, Oxford Computer Journal, IET Software e Computer
Languages, Systems and Structures, evaluated as Qualis A1, B1, B2 e B2, respectively. He also published 24 papers in conferences, whereof 13 in international
events and 11 in national ones.
ii
Sumrio
1.1
Contexto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2
2
Introduo
Organizao do Texto Sistematizado . . . . . . . . . . . . . . . . . .
2.1
2.2
24
2.3
Outras Linhas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
2.3.1
Teste de Mutao . . . . . . . . . . . . . . . . . . . . . . . . .
29
2.3.2
Teste de Regresso . . . . . . . . . . . . . . . . . . . . . . . .
30
2.3.3
Teste Funcional . . . . . . . . . . . . . . . . . . . . . . . . . .
31
Consideraes Finais . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
2.4
3
Concluses
36
3.1
Discusso e Reexes . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
3.2
37
49
52
53
53
54
64
iii
iv
B Teste de Programas Paralelos: Denies e Exemplos
B.1 Critrios de Teste . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
66
69
C Checking Completeness of Tests for Finite State Machines. IEEE Transactions on Computers, 2010
72
83
99
F Structural Testing Criteria for Message-Passing Parallel Programs. Concurrency and Computation. Practice & Experience, 2008
115
G A Transformational Language for Mutant Description. Computer Languages, Systems & Structures, 2009
140
Generating Reduced Tests for FSMs with Extra States. 21st IFIP Int.
Conference on Testing of Communicating Systems, 2009
159
180
A Generalized Model-based Test Generation Method. The 6th IEEE International Conferences on Software Engineering and Formal Methods,
2008
198
Lista de Figuras
2.1
Arquitetura da Plavis/FSM. . . . . . . . . . . . . . . . . . . . . . . .
13
2.2
Condies de Sucincia. . . . . . . . . . . . . . . . . . . . . . . . .
17
2.3
26
2.4
33
2.5
35
55
A.2 Grafo-Xd .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
58
70
Captulo 1
Introduo
Neste captulo, apresentado o contexto das linhas de pesquisa em que se inserem os trabalhos desenvolvidos pelo autor, bem como as motivaes das atividades e pesquisas realizadas (Seo 1.1). Na Seo 1.2 apresentada a organizao
do presente texto.
1.1
Contexto
1.2
Neste texto sistematizado apresentada uma descrio das principais contribuies resultantes das atividades de pesquisa realizadas pelo autor. No Captulo 2
so descritos os trabalhos desenvolvidos nas linhas de pesquisa, dando nfase ao
relacionamento entre as pesquisas realizadas. Na Seo 2.1 so apresentados os
trabalhos relacionados ao teste baseado em mquinas de estados nitos, ao passo
que na Seo 2.2 so apresentados os resultados relacionados ao teste de programas paralelos. Na Seo 2.3 so apresentados os trabalhos desenvolvidos na rea
de teste de software, mas que no se enquadram nas duas linhas anteriores, tais
5
Captulo 2
Contribuies ao Teste de
Software
A seguir, so resumidos os trabalhos desenvolvidos pelo autor ou sob sua orientao aps a concluso do doutorado. Os trabalhos sero classicados de acordo
com o enfoque principal. As publicaes relacionadas sero indicadas ao longo
do texto e sumarizadas ao nal. Os trabalhos foram divididos em trs grupos,
correspondentes s subsees desse captulo. Primeiramente, so apresentados
os trabalhos relacionados ao teste baseado em mquinas de estados nitos, que
representa a maior parte dos trabalhos desenvolvidos pelo autor. Em seguida,
apresenta-se o teste de programas paralelos, que representa uma rea de investigao que o autor tem desenvolvido, podendo ser considerada como sua segunda
principal rea de atuao. Por m, so apresentados trabalhos que so relevantes
desenvolvidos em outras linhas, todas relacionadas a diferentes aspectos do teste
de software.
Os trabalhos so apresentados de forma resumida. Apenas os conceitos principais so apresentados, assim como os aspectos que distinguem os trabalhos e
caracterizam sua contribuio principal. Informaes adicionais sobre os trabalhos so includas nos apndices; denies formais, exemplos e detalhes podem
ser l encontrados. A referncia de cada publicao includa em uma nota de
rodap, usando a seguinte conven.
2.1
m (M )
denota o
domnio de defeitos denido pelo conjunto de todas as MEFs com o mesmo alfabeto de entrada e no mximo m estados, utilizado por grande parte dos mtodos
de gerao, como por exemplo, os mtodos W (Chow, 1978), Wp (Fujiwara et al.,
1991), HSI (Petrenko et al., 1993; Luo et al., 1994), H (Dorofeeva et al., 2005a),
entre outros. De acordo com Chow (1978), os defeitos so classicados em:
Defeito de transferncia: transio atinge estado incorreto.
Defeito de sada: transio gera uma sada incorreta.
Estados faltantes: os estados da implementao devem ser aumentados para
torn-la equivalente especicao.
Estados extras: os estados da implementao devem ser reduzidos para torn-la
equivalente especicao.
Todos esses defeitos podem ser modelados por MEFs pertencentes a
m (M ),
, foi utilizado
12
Test Case
Generation
Adapter
Wrapper
Test Case
Manager
Proteum/FSM
Wrapper
Test Case
Adequacy
Adapter
Condado
Wrapper
Web server
MGASet
Plavis/FSM Database
13
14
15
Condies de Sucincia
Os trabalhos de Mello Neto (em nvel de mestrado), Stuchi (em nvel de iniciao
cientca) e de Junqueira (em nvel de concluso de curso) motivaram o estudo
de condies de sucincia para completude de conjuntos de casos de teste gerados a partir de MEFs. Observou-se que melhorias nessas condies podem
ser utilizadas em diversos contexto. Por exemplo, as condies propostas por
Dorofeeva et al. (2005a) foram a base para a proposio de um novo mtodo (especicamente, o Mtodo H, que foi estudado por Stuchi) e para implementar o
algoritmo de minimizao no trabalho de mestrado de Mello Neto. Assim, melhorias adicionais nas condies poderiam resultar em mtodos mais ecazes.
Um conjunto separado de condies de suciente apresentado em (Ural
et al., 1997). Essas condies aplicam-se para sequncias de vericao, que correspondem a conjuntos completos formados por uma nica sequncia. Sequncias de vericao so relevantes, pois no utilizam a operao de reset, a qual em
algumas situaes pode ser custosa de ser utilizada.
As condies de sucincia propostas em (Dorofeeva et al., 2005a) e (Ural
et al., 1997) so ortogonais: umas no podem ser derivadas das outras. Por outro lado, todas as demais condies (por exemplo, (Petrenko et al., 1996) e (Aho
et al., 1991)) propostas na literatura podem ser derivadas de um ou outro conjunto. Em (Simo and Petrenko, 2010a)
16
, em mdia
80%.
J. F. Cutigi, P. H. Ribeiro, A. S. Simo, S. R. S. Souza. Reduo do Nmero de Sequncias
no Teste de Conformidade de Protocolos. In: XI Workshop de Testes e Tolerncia a Falhas, p.
105-117, 2010, Gramado, RS. (Qualis B5)
17
com algoritmos encontrados na literatura. Observou-se o que, por um lado, os resultados eram comparveis ao mtodo que apresentavam os melhores resultados
enquanto que, por outro lado, o tempo gasto para a reduo foi consideravelmente menor.
Sequncias de Vericao
A gerao de sequncias de vericao um tpico que vem sendo investigado
desde os trabalhos seminais de Hennie (Hennie, 1964). O objetivo produzir uma
sequncia de entrada que forme um conjunto completo unitrio. Em (Hennie,
1964) foi demonstrado que se a MEF possui uma sequncia de distino, possvel gerar uma sequncia de vericao. Contudo, no foi apresentado nenhum
mtodo sistemtico. Em (Gonenc, 1970), um algoritmo baseado em grafos proposto, o qual procura sistematizar o mtodo proposto por Hennie. O interesse na
gerao de sequncias foi retomado a partir dos trabalhos de (Ural et al., 1997).
Em essncia, esse trabalho baseado no trabalho de (Gonenc, 1970), modelandoo como um problema de otimizao em grafo, a saber o problema do Carteiro
Rural Chins (Aho et al., 1991). Diversos trabalhos seguiram a mesma linha, tais
como (Hierons and Ural, 2002; Chen et al., 2005; Ural and Zhang, 2006; Hierons
and Ural, 2006).
Apesar de diversos trabalhos terem sido desenvolvidos com base no trabalho
de (Ural et al., 1997), os ganhos na reduo no tamanho das sequncias de veA. D. B. Alberto, A. S. Simo. Minimization of Incompletely Specied Finite State Machines Based on Distinction Graphs. In: The 10th Latin-American Test Workshop. p. 1-6, , Buzios,
RJ, 2009. (Qualis B3)
18
. Diferentemente dos
19
generalizam tambm as condies propostas por (Ural et al., 1997), elas podem
ser utilizadas para identicar quando uma sequncia uma sequncia de vericao. Foi proposto ento um mtodo que, por meio de vrias iteraes e da
seleo das sequncias mais aptas, busca produzir a menor sequncia possvel.
Apesar de realmente obter sequncias de vericao menores, observou-se que o
custo de aplicao alto e os ganhos so relativamente pequenos. Dessa forma,
outras estratgias de gerao devem ser desenvolvidas. Ainda assim, pde-se observar que as condies propostas em (Simo and Petrenko, 2010a) so realmente
melhores do que as de (Ural et al., 1997), uma vez que quando o mtodo foi alterado para utilizar estas condies no lugar daquelas, obteve-se sequncias 12,7%
maiores.
Melhorias em Mtodos de Gerao Existentes
Foram investigados tambm possveis generalizaes e melhorias dos mtodos
clssicos de gerao. A investigao tinha como objetivo aumentar a aplicabilidade dos mtodos (ou seja, permitir que fossem aplicados a uma classe maior de
MEFs) ou reduzir o tamanho dos conjuntos gerados.
Em (Bonifcio et al., 2008a)
20
, foi
desenvolvido uma abordagem que permite que diversos prexos sejam eliminados. Foi proposto ento o mtodo SPY, que uma generalizao do mtodo HSI
no caso de implementaes com estados extras. Foi demonstrado experimentalmente que o mtodo SPY gera conjuntos em geral 40% menores que o mtodo
HSI.
O trabalho publicado em (Simo and Petrenko, 2010b)
es principais. Primeiramente, investigou-se o domnio de defeitos correspondentes ao caso no qual a implementao pode ter no mximo um nmero menor
de estados do que a especicao. Apesar de ser um domnio relativamente simples, trata-se do primeiro mtodo que capaz de gerar conjuntos completos para
tal domnio. Em segundo lugar, a gerao no precisa necessariamente comear
do zero; pode-se iniciar a gerao a partir de um conjunto j existente. Dessa
forma, os conjuntos podem ser gerados incrementalmente. Observe que isso somente possvel devido combinao com a contribuio anterior. Por m, as
condies propostas em (Simo and Petrenko, 2010a) foram generalizadas, de
forma a poderem ser aplicadas a outros domnios. Apesar de apenas o domnio
formado por implementaes com no mximo um nmero menor de estados do
que a especicao, as condies apresentadas nesse trabalho podem ser futuraA. S. Simo, A. Petrenko, N. Yevtushenko. Generating Reduced Tests for FSMs with Extra
States. In: The 21st IFIP Int. Conference on Testing of Communicating Systems (TESTCOM). p.
129-147, Eindhoven, Holanda, 2009. (Qualis B3)
A. S. Simo, A. Petrenko. Fault Coverage-Driven Incremental Test Generation. Computer Journal, v. 53, p. 1508-1522, 2010. (Qualis B1)
21
ser utilizadas para orientar a gerao de casos de teste a partir de MEFEs adicionadas com informaes de tempo. Em geral, muitos problemas relacionados
atividade de teste, tais como a distino entre dois estados da MEFEs ou mesmo
se um determinado estado alcanvel, so indecidveis. Dessa forma, a aplicao de tcnicas de teste utilizadas em MEFs no so facilmente aplicveis a
MEFEs. As tcnicas de vericao de modelos so utilizadas para vericar se
uma determinada propriedade, especicada por meio de uma lgica temporal,
vlida para um determinado modelo. Caso no seja vlida, um contraexemplo
produzido. Se a propriedade a ser vericada cuidadosamente denida para
reetir uma propriedade indesejada do sistema, o contraexemplo pode ser utilizado como base para a construo de casos de teste para testar a presena dessa
propriedade no sistema. Uma verso estendida desse trabalho foi publicado em
(Bonifcio et al., 2008b)
22
Estudos Experimentais
Em alguns casos, possvel identicar que um mtodo de gerao produz conjuntos que so comprovadamente menores do que outros mtodos. Contudo,
em vrias situaes, os mtodos so teoricamente incomparveis: no possvel determinar qual mtodo gera os menores conjuntos. Nesses casos, estudos
experimentais so importantes (Dorofeeva et al., 2005b).
, foi investigado qual o comportamento tpico de
No trabalho de mestrado de Flvio Dusse (co-orientado pelo autor), foi investigado como a comparao do critrios de cobertura poderia ser melhorada com a
incluso da Anlise de Mutantes. A concluso principal desse trabalho foi de que
o escore de mutao de um critrio diretamente relacionado ao tamanho mdio
dos conjuntos adequados (Dusse et al., 2009)
23
2.2
Nesta seo, so descritos os trabalhos desenvolvidos pelo autor na rea de pesquisa relacionada ao teste de programas paralelos. Foram desenvolvidos critrios, estratgias e ferramentas para o teste de programas paralelos.
O teste estrutural, ou teste caixa branca, utiliza a estrutura do programa para
denir critrios de teste. Um critrio de teste estabelece requisitos que um conjunto de teste deve atender, servindo tanto para avaliar a adequao de um conjunto quanto para guiar a gerao de conjuntos adequados. Os critrios de teste
so algumas vezes chamados de critrios de cobertura, pois em geral exige-se que
elementos especcos do programa sejam cobertos, ou seja, sejam executados
sob determinadas condies. Em geral, a estrutura do programa abstrada na
forma de um grafo de uxo de controle (GFC), no qual cada n representa um
bloco de comandos sem desvio de controle (ou seja, ou todos os comandos de
um bloco so executados, ou nenhum o ), e cada aresta representa o desvio de
controle entre dois blocos.
24
de modo a ser aplicado para programas paralelos. Um programa paralelo foi modelado com um conjunto de processos concorrentes, que se comunicam pela troca
de mensagens. Foram includos arestas de sincronizao/comunicao, que representam o envio de uma mensagem de um processo a outro, denindo um GFC
paralelo. Mais especicamente, se o n n1 do GFC de um processo possui um comando que envia uma mensagem que pode ser recebida por um comando de um
n2 do GFC de outro processo, uma aresta inter-processo entre os ns n1 e n2
criada. Ento, foram denidos critrios de cobertura que levam em considerao
tais arestas.
Os critrios propostos complementam os critrios estruturais introduzidos
por (Rapps and Weyuker, 1985) para programas sequenciais. Foi desenvolvida
a ferramenta ValiPar, que apoia o teste estrutural de programas paralelos baseados nos critrios denidos (Souza et al., 2005)
25
26
lham as variveis e como isso impacta no uxo de dados do programa. A sincronizao entre as linhas realizadas por meio de semforos (Sarmanho et al.,
2008)
27
pal faz chamadas sncronas e assncronas a outros servios. Dessa forma, uma
composio de servios web pode ser encarada como um sistema paralelo. Essa
perspectiva foi explorada no trabalho de mestrado de Andre Takeshi Endo (Endo
et al., 2007)
Observou-se que em algumas situaes o modelo baseado em GFC no suciente para representar adequadamente todos os aspectos de uma composio
de servios. Assim, em (Endo et al., 2010)
combina duas abordagens: a abordagem baseada em cobertura, como as dos trabalhos citados acima, e a abordagem baseada em eventos, proposta por (Belli
et al., 2006).
Resumo
Os trabalhos nessa linha contaram com a colaborao ativa dos alunos de mestrado e iniciao cientca, e tambm com diversos pesquisadores, em especial,
Simone do Rocio Senger de Souza, Paulo Srgio Lopes de Souza e Silvia R. Verglio. Foram orientados um trabalho de mestrado e um trabalho de iniciao
cientca. Foram publicados um artigo em revista internacional, seis artigos em
eventos internacionais e dois artigos em eventos nacionais.
2.3
Outras Linhas
Nesta seo, so apresentadas as contribuies que no se encaixam nas linhas principal e secundria apresentadas nas sees anteriores. De modo geral,
tratam-se de linhas que ainda esto se desenvolvendo ou que representam uma
A. T. Endo, A. S. Simo, S. R. S. Souza, P. S. L. Souza. Aplicao de Teste Estrutural
para Composio de Web Services. In: The 1st Brazilian Workshop on Systematic and Automated
Software Testing. p. 13-20, Joo Pessoa, PB, 2007.
A. T. Endo, A. S. Simo, S. R. S. Souza and P. S. L. Souza. Web Services Composition Testing: A Strategy Based on Structural Testing of Parallel Programs. In: TaicPart: Testing Academic
& Industrial Conference - Practice and Research Techniques. p. 3-12, Windsor, UK, 2008.
A. T. Endo, M. Lindshulte, A. S. Simo, S. R. S. Souza. Event- and Coverage-Based Testing
of Web Services. In: 2nd Workshop on Model-Based Verication & Validation From Research to
Practice (MVV). p. 1-8, Cingapura, 2010.
28
2.3.1
Teste de Mutao
referentes ao teste de mutao e como os problemas encontrados podem ser resolvidos com diversas contribuies encontradas na literatura.
A qualidade do teste de mutao est diretamente relacionada qualidade
dos mutantes utilizados. A primeira tarefa a ser realizada quando o teste de mutao vai ser aplicado em um novo contexto, tais como uma nova linguagem de
programao ou tcnica de especicao, denir um conjunto de operadores de
mutao. Um operador de mutao uma funo que, dado o artefato original,
A. M. R. Vincenzi, M. E. Delamaro, A. S. Simo, J. C. Maldonado. Muta-Pro: Towards the
Denition of a Mutation Testing Process. In: The 6th LAtin-American Test Workshop. p. 149-154,
Salvador, BA, 2005. (Qualis B3)
A. M. R. Vincenzi, M. E. Delamaro, A. S. Simo, J. C. Maldonado. Muta-Pro: Towards
the Denition of a Mutation Testing Process. Journal of the Brazilian Computer Society, v. 12, p.
47-61, 2006. (Qualis B2)
29
Prolog (Bratko, 1990)) para denir operadores de mutao. Com base na gramtica livre de contexto da linguagem alvo, so criados diversos mdulos que manipulam um artefato produzido nessa linguagem. Inicialmente, a rvore sinttica
obtida. Em seguida, com base nos comandos do operador de mutao escritos em
MuDeL, a rvore sinttica alterada, dando origem a diversas rvores mutan-
2.3.2
Teste de Regresso
30
de teste para o teste de regresso que baseado em redes neurais. Para cada
caso de teste, extrada uma assinatura que representa a execuo do caso de
teste. A assinatura foi denida como sendo a quantidade de vezes que um n foi
exercitado durante a execuo. Em seguida, a rede neural particiona os casos de
teste em blocos que continham casos de teste com assinaturas semelhantes. Um
caso de teste de cada bloco ento selecionado. A premissa que casos de teste
com assinaturas semelhantes exercitam caractersticas semelhantes do software e,
portanto, durante o teste de regresso, deve-se priorizar os testes mais distintos
possveis.
Em (Simo et al., 2008)
2.3.3
Teste Funcional
31
2.4
Consideraes Finais
Na Figura 2.4, so apresentadas as publicaes obtidas aps a concluso do doutorado, separadas por ano e por linha de pesquisa. A numerao corresponde
ao nmero da nota de rodap utilizada para introduzir a referncia no decorrer
deste Captulo 2. Como mencionado anteriorment.
Pode-se observar que o volume de publicaes se manteve adequado ao longo
de todo o perodo. Inicialmente, os trabalhos estavam mais dispersos entre as
diversas linhas de pesquisa, sendo que a maioria dos trabalhos eram publicados
em conferncias nacionais. O perl se altera a partir de 2008, coincidindo com
o perodo de ps-doutorado; mais publicaes em conferncias internacionais e
em revistas foram obtidas, concentrando-se principalmente no teste baseado em
MEFs, tema do ps-doutorado.
A. D. Rocha, A. S. Simo, J. C. Maldonado, P. C. Masiero. Uma ferramenta baseada em
aspectos para o teste funcional de programas Java. In: Simpsio Brasileiro de Engenharia de
Software. p. 263-278, Uberlandia, MG, 2005. (Qualis B3)
32
6
8
4
9
1
15
10
11
13
14
12
16
17
21
27
20
22
23
24
19
18
25
26
28
29
Teste de Mutacao
Teste de Regressao
31
30
Teste Funcional
32
2005
2006
2007
2009
2008
2010
33
Outro ponto a se destacar que o autor atuou nas trs tcnicas de teste, a saber,
estrutural (no teste de programas paralelos), funcional (incluindo o teste baseado
em modelos) e baseada em defeitos (no teste de mutao). Portanto, obteve-se
uma viso ampla da rea de pesquisa. Vale lembrar que apesar de estar dividido
em cinco linhas distintas de pesquisa, os trabalhos esto todos relacionadas ao
teste de software, que uma subrea da engenharia de software.
As contribuies para a rea de teste de software podem ser classicadas em:
estudos tericos, estudos experimentais e automatizao. Na Figura 2.5, apresentado como as publicaes obtidas podem ser mapeadas nessas trs categorias.
Pode-se observar que o autor tem atuado nas trs categorias, com maior destaque nos estudos tericos. Em geral, estudos tericos podem abrir novas linhas
de investigao nas duas outras categorias. Assim, espera-se que futuramente
trabalhos envolvendo estudos experimentais e automatizao possam ser desenvolvidos.
34
Estudos Teoricos
Estudos Experimentais
2
11
4
25
7
14
10
23
16
17
12
6
24
3
15
26
18
13
22
31
29
27
28
20
32
19
30
1
21
Automatizacao
Figura 2.5: Distribuio das Publicaes: Contribuies.
35
Captulo 3
Concluses
3.1
Discusso e Reexes
36
3.2
tituto Nacional de Cincia e Tecnologia em Sistemas Embarcados Crticos (INCTSEC). Um dos objetivos do trabalho de Pinheiro identicar uma aplicao real
que possa ser testada com os mtodos de gerao baseados em MEFs. Eventualmente, a ferramenta Plavis/FSM poder ser reestruturada para se adequar a esse
contexto.
Alm disso, foi recentemente aprovado um projeto de pesquisa pelo Edital
Universal do CNPq, que tem como tema a continuidade dos trabalhos de investigao sobre mtodos de gerao de conjuntos completos para MEFs. Dessa
forma, pode-se destacar como trabalhos futuros nessa linhas o estudo dos seguintes itens:
Gerao de testes para MEFs no determinsticas; todos os trabalhos desenvolvidos pelo autor at o momento tratam de MEFs determinstica. Contudo, existem domnios que podem ser melhores descritos com a incluso
de no determinismo.
Gerao de sequncias de vericao a partir de MEFs sem sequncias de
distino.
Consolidao de aplicaes prticas de teste baseado em MEFs para domnios especcos, tais como sistemas embarcados e arquiteturas orientadas a
servio.
Agradecimentos
Os pesquisadores e alunos aqui citados tiveram participao fundamental nas
atividades de pesquisas desenvolvidas. Em especial, agradeo aos professores do
ICMC Jos Carlos Maldonado, Simone do Rocio Senger de Souza e Paulo Srgio
Lopes de Souza, e ao pesquisador Alexandre Petrenko.
Agradeo aos professores e funcionrios do ICMC, muitos dos quais me
apoiam desde que eu ainda era aluno de ps-graduao.
Agradeo ao suporte nanceiro da FAPESP, CAPES e CNPq.
Agradeo aos meus pais, Geraldo e Olivia, por sempre me apoiarem.
38
39
Referncias Bibliogrcas
Aho, A. V., Dahbura, A. T., Lee, D., and Uyar, M. U. (1991). An optimization technique for protocol conformance test generation based on UIO sequences and
rural chinese postman tours. IEEE Transactions on Communications, 39(11):1604
1615.
Alberto, A. and Simo, A. (2009). Minimization of incompletely specied nite
state machines based on distinction graphs. In Latin-American Test Workshop,
pages 16, Buzios, RJ.
Andrews, A., Offutt, J., and Alexander, R. (2005). Testing web applications by
modeling with fsms. Software Systems and Modeling, 4(3):326345.
Beizer, B. (1990). Software testing techniques (2nd ed.). Van Nostrand Reinhold Co.,
New York, NY, USA.
Belli, F., Budnik, C. J., and White, L. (2006). Event-based modelling, analysis
and testing of user interactions: approach and case study: Research articles.
Software Testing, Verication & Reliability, 16(1):332.
Binder, R. V. (1999). Testing Object-Oriented Systems: Models, Patterns, and Tools.
Addison Wesley Longman, Inc., 1 edition.
Bonifcio, A., Moura, A., and Simo, A. (2008a). A generalized model-based
test generation method. In Proceedings of 6th IEEE International Conferences on
Software Engineering and Formal Methods, pages 139148, Cape Town, Africa do
Sul.
40
Bonifcio, A. L., Moura, A., Simo, A., and Maldonado, J. C. (2008b). Towards
deriving test sequences by model checking. Electronic Notes in Theoretical Computer Science, 195:2140.
Bonifcio, A. L., Simo, A., Moura, A., and Maldonado, J. C. (2006). Conformance
testing by model checking timed extended nite state machines. In Simpsio
Brasileiro de Mtodos Formais, pages 4358, Natal, RN.
Bratko, I. (1990). Prolog Programming for Articial Intelligence. Addison-Wesley,
Wokingham, England ; Reading, Mass., 2 edition.
Candolo, M. A., Simao, A. S., and Maldonado, J. C. (2001). Mgaset - uma ferramenta para apoiar o teste e validao de especicaes baseadas em mquinas
de estado nito. In Anais do XV Simpsio Brasileiro de Engenharia de Software,
pages 386391.
Chen, J., Hierons, R. M., Ural, H., and Yenigun, H. (2005). Eliminating redundant
tests in a checking sequence. In TestCom 2005, number 3502 in Lecture Notes
on Computer Science, pages 146158.
Chow, T. S. (1978). Testing software design modeled by nite-state-machines.
IEEE Transactions on Software Engineering, 4(3):178186.
Cordy, J. R., Halpen, C. D., and Promislow, E. (1988). TXL: A rapid prototyping
system for programming language dialects. In IEEE International Conference on
Computer Languages, Maimi.
Cutigi, J. F., Ribeiro, P. H., Simo, A., and Souza, S. R. S. (2010). Reduo do
nmero de seqncias no teste de conformidade de protocolos. In XI Workshop
de Testes e Tolerncia a Falhas, volume 1, pages 105117, Gramado, RS.
Davis, A. M. (1988). A comparison of techniques for the specication of external
system behavior. Communications of the ACM, 31(9).
de Mello Neto, L. F. (2008). Minimizao de conjuntos de casos de teste para
mquinas de estados nitos.
41
42
43
44
45
Rothermel, G., Untch, R. H., Chu, C., and Harrold, M. J. (2001). Prioritizing
test cases for regression testing.
27(10):929948.
Sabnani, K. K. and Dahbura, A. (1988). A protocol test generation procedure.
Computer NetWorks and ISDN Systems, 15(4):285297.
Sarmanho, F. S., Souza, P. S. L., Souza, S. R. S., and Simo, A. (2007). Aplicao
de teste estrutural para programas multithreads baseados em semforos. In 1st
Workshop on Languages and Tools for Parallel and Distributed Programing (LTPD),
pages 1821, Granado, RS.
Sarmanho, F. S., Souza, P. S. L., Souza, S. R. S., and Simo, A. (2008). Structural
testing for semaphore-based multithread programs. In Proceedings of International Conference on Computer Science, pages 337346, Krakw, Poland.
Sidhu, D. P. and Leung, T. K. (1989). Formal methods for protocol testing: A
detailed study. IEEE Transactions on Software Engineering, 15(4):413426.
Simo, A. (2007). Teste baseado em modelos.
Simo, A., Ambrosio, A. M., Fabbri, S. C. P. F., Amaral, A. S., Martins, E., and
Maldonado, J. C. (2005). Plavis/fsm: an environment to integrate fsm-based
testing tools. In Sesso de Ferramentas do Simpsio Brasileiro de Engenharia de
Software, pages 16, Uberlndia, MG.
Simo, A., Maldonado, J. C., and Bigonha, R. S. (2009a). A transformational
language for mutant description. Computer Languages, Systems & Structures,
35:322339.
Simo, A., Mello, R. F., and Senger, L. J. (2006). A technique to reduce the test case
suites for regression testing based on a self-organizing neural network architecture. In 30th Annual International Computer Software and Applications Conference,
pages 14, Chicago, USA.
Simo, A., Mello, R. F., Senger, L. J., and Yang, L. T. (2008). Improving regression
testing performance using the adaptive resonance theory-2a self-organising
46
Ural, H., Wu, X., and Zhang, F. (1997). On minimizing the lengths of checking
sequences. IEEE Transactions on Computers, 46(1):9399.
Ural, H. and Zhang, F. (2006). Reducing the lengths of checking sequences by
overlapping. Lecture Notes on Computer Science, (3964):274288.
Utting, M. and Legeard, B. (2006). Practical Model-Based Testing: A Tools Approach.
Morgan Kaufmann Publishers Inc., San Francisco, CA, USA.
Utting, M., Pretschner, A., and Legeard, B. (2006). A taxonomy of model-based
testing. Technical report, Hamilton, New Zealand.
Vincenzi, A. M. R., Delamaro, M. E., Simo, A., and Maldonado, J. C. (2005).
Muta-pro: Towards the denition of a mutation testing process. In 6th Latinamerican test workshop (LATW), pages 149154, Salvador, BA.
Vincenzi, A. M. R., Delamaro, M. E., Simo, A., and Maldonado, J. C. (2006).
Muta-pro: Towards the denition of a mutation testing process. Journal of the
Brazilian Computer Society, 12:4761.
Weyuker, E. J. (1996). Using failure cost information for testing and reliability
assessment. ACM Trans. Softw. Eng. Methodol., 5(2):8798.
Yannakakis, M. and Lee, D. (1995). Testing nite state machines: Fault detection.
J. Computer and System Science, 50(2):209227.
Yao, M. Y., Petrenko, A., and von Bochmann, G. (1994). Fault coverage analysis in
respect to an fsm specication. In IEEE INFOCOM94, pages 768775, Toronto,
Canad.
48
Apndice A
Teste baseado em Mquinas
de Estados Finitos:
Denies e Exemplos
Neste apndice, so apresentados os principais conceitos do teste baseado em
Mquinas de Estados Finitos, bem como as denies formais dos conceitos discutidos na Seo 2.1. Este apndice baseado no captulo de livro (Simo, 2007),
e no Captulo 3 da dissertao de mestrado de de Mello Neto (2008).
A.1
Uma
Denies
MEF
pode
ser
representada
formalmente
por
uma
tupla
50
Uma sequncia de distino (distinguishing sequence) uma sequncia de entrada d em que a sequncia de sada produzida pela MEF M , em resposta entrada d, identica o estado da mquina M , ou seja, para todo si , sj S, si =
51
A implementao I est em conformidade com a especicao M se, e somente se para todo M (s0 ) M (t0 ), tem-se que (s0 , ) = (t0 , ). Isso
signica que, para cada sequncia de entrada onde um comportamento de M
A.2
Propriedades de MEFs
Diversos mtodos de gerao requerem que as MEFs possuam determinadas propriedades para serem aplicados. As principais propriedades so apresentadas a
seguir. Uma MEF completamente especicada (ou completa) se existem transies
denidas para todos os smbolos de entrada em cada estado da MEF. Caso contrrio, a MEF parcialmente especicada (ou parcial). Formalmente, uma MEF
completa se DA = S X. Uma MEF fortemente conexa se para cada par de esta-
dos (si e sj S) existe uma sequncia que leva a MEF M do estado si ao estado
sj . Uma MEF dita ser inicialmente conexa se para cada estado s S existe uma
sequncia que leva a MEF do estado inicial s0 ao estado s. De uma forma geral,
somente as MEFs inicialmente conectadas so consideradas nos estudos realizados, pois de acordo com Yannakakis and Lee (1995) qualquer estado inatingvel a
partir do estado inicial no afeta o comportamento da MEF. Uma MEF parcial reduzida se seus estados, tomados par-a-par, so distinguveis. Uma MEF completa
minimal se no possui par de estados equivalentes. Neste trabalho os termos reduzida e minimal so utilizados como sinnimos. Uma MEF determinstica se em
cada estado, dada uma entrada, h somente uma nica transio denida para
um prximo estado caso contrrio, a MEF no determinstica.
52
A.3
Domnio de Defeitos
Para um conjunto de sequncias de teste gerado a partir de uma MEF, uma questo importante refere-se em como avaliar a efetividade (ou qualidade) do mesmo,
ou seja, avaliar sua cobertura em relao aos defeitos revelados. Como, por um
lado, innitos defeitos so possveis e, por outro, o conjunto de casos de teste deve
ser nito, dene-se um domnio de defeitos, representando o conjunto de possveis defeitos que o teste deve revelar. Domnios de falha diferentes podem ser
denidos para reetir caractersticas particulares de uma congurao de teste.
No teste baseado em MEFs, domnios de defeitos so denidos em funo do
nmero mximo de estados que a implementao pode ter. Assim, dado um nmero m, o domnio de defeitos o conjunto de todas as MEFs com no mximo m
estados. Note-se que em geral o domnio de defeitos, apesar de nito, possui um
nmero muito grande de MEFs. Como a implementao considerada uma caixa
preta, esse nmero mximo no conhecido, sendo que assume-se um valor que
baseado em heursticas. Trata-se de uma hiptese de teste (Chow, 1978; Petrenko
and Yevtushenko, 2005; Hierons and Ural, 2006)
O conjunto de teste m-completo se para qualquer implementao I do domnio de defeitos, I vai passar pelo teste, se e somente se, I estiver em conformidade
com a especicao M .
Alguns mtodos garantem a gerao de conjuntos de teste m-completos, para
qualquer m n pr-denido, sendo n o nmero de estados da especicao.
Outros mtodos apenas garantem para o caso de m = n, onde n o nmero de
A.4
tempo necessrio para gerar deve ser de ordem polinomial no tamanho da MEF.
Por outro lado, tem-se o custo da execuo das sequncias de teste. Cada sequncia de teste deve ser traduzida em entradas concretas para a implementao, a
qual deve ser executada com essas entradas. Normalmente, o custo de execuo
o principal fator na avaliao do custo da aplicao de um mtodo, uma vez
que normalmente aceitvel um mtodo que demande mais tempo para gerao
das sequncias de teste, se ele conseguir gerar um conjunto menor. Dessa forma,
o custo de aplicao de um mtodo medido em termos do tamanho do conjunto
de teste gerado, tanto no caso mdio como no pior caso.
A forma usual de medir o custo pela quantidade de smbolos de entrada
presentes no conjunto, tambm conhecido como comprimento do conjunto. As
sequncias que so prexos de outras sequncias do conjunto no so contadas,
pois ao se aplicar uma sequncia, todos os seus prexos j so necessariamente
aplicados. Alm disso, assume-se que para levar a implementao ao estado inicial, deve-se utilizar uma entrada adicional de reset. Assim, dado uma sequncia
de teste t, dene-se o custo de t como sendo o comprimento de t mais 1. Dado
um conjunto de sequncias de teste T , dene-se o comprimento como sendo a
soma dos comprimentos de todas as sequncias que no so prexos de outras
sequncias em T .
A.5
Mtodos de Gerao
54
S1
x/1
S2
x/0
x/1
y/1
y/0
y/0
x/1
S3
S4
55
5. Aplique a mensagem de status e verique se o estado nal est em conformidade com a especicao M s, ou seja, igual S (s, ).
A checking sequence produzida pelo algoritmo uma concatenao das sequncias reset, set(s), e status repetida para cada estado do conjunto de estados S e
para cada smbolo de entrada do conjunto de smbolos de entrada X. Esse algoritmo capaz de revelar qualquer defeito de sada e de transferncia. No entanto,
o algoritmo baseia-se na mensagem set, que por sua vez, pode no existir.
Para evitar o uso de mensagens set, uma sequncia transition tour (TT) pode
ser construda. Essa sequncia percorre a mquina visitando cada estado e cada
transio ao menos uma vez sem que ela precise ser reiniciada aps a execuo
de cada teste. Pela aplicao do mtodo TT, juntamente com uma mensagem de
status (inserida aps cada entrada da sequncia TT), uma checking sequence obtida. Essa sequncia de entrada consegue descobrir os defeitos de transferncia
e de sada. No entanto o mtodo TT, proposto originalmente por Naito and Tsunoyama (1981), no utiliza a mensagem de status e obtm somente uma cobertura
das transies. Dessa forma, o mtodo TT no garante a deteco de defeitos de
transferncia.
As mensagens de status raramente esto disponveis. Diversos mtodos de
gerao de casos de teste utilizam algumas sequncias de separao, ao invs
da mensagem de status, para identicar os estados de uma MEF. Para a MEF da
Figura A.1, o conjunto de casos de teste, gerado pelo mtodo TT, composto pelas
sequncias que realizam a cobertura das transies. O conjunto de teste obtido
poderia ser T ST T = {ryxyyxyxxyxy} de tamanho 12.
Mtodo DS O mtodo DS, proposto por Gonenc (1970), baseia-se na sequncia
de distino, ou seja, para a sua utilizao necessria que a MEF possua essa
sequncia. No entanto, segundo Gill (1962), tal sequncia pode no existir mesmo
para MEFs minimais.
importante selecionar a menor sequncia de distino para que, consequentemente, se obtenha um conjunto menor de casos de teste. Seja Xd a sequncia de
distino escolhida. O mtodo resulta na gerao de uma checking sequence pela
composio de duas subsequncias:
56
S2
S1
Xd
Xd
Xd
S3
Xd
S4
S4 . A partir de S4 aplica-se x que leva a MEF ao novo estado origem S3 . Estando no estado S3 , repete-se o procedimento anterior. A sequncia- obtida :
{yyy yyy yyy x yyy yyy xx yyy yyy}.
x.Xd
S4
x.Xd
S4
x.Xd
x.Xd
y.Xd
y.Xd
S1
y.Xd
y.Xd
x.Xd
S1
S3
S3
x.Xd
y.Xd
S2
S2
(a)
(b)
{yyy yyy yyy x yyy yyy xx yyy yyy xyyy xy yyyy xx xyyy x yyyy} de tamanho 45.
58
mn
i=0
As sequncias desse conjunto so executadas uma a uma na mquina, gerando as sadas que so analisadas posteriormente.
59
concatenao
de
com
obtm-se
as
sequncias
{x, y, yy, xx, xy, xyy, yx, yy, yyy, xxx, xxy, xxyy, xyx, xyy, xyyy, yyx, yyy, yyyy,
yxx, yxy, yxyy, yyyx, yyyy, yyyyy, yyxx, yyxy, yyxyy}.
Com a retirada das sequncias que so prexos de outras, a aplicao do mtodo W na MEF da Figura A.1 resulta no conjunto T SW
{rxxx, rxxyy, rxyx, rxyyy, ryxx, ryxyy, ryyxx, ryyxyy, ryyyx, ryyyyy} de tamanho 49.
identicao Wi , que distingue o estado si de todos os demais. A unio de todos os conjuntos Wi resulta no conjunto W e diferentes casos de testes podem ser
gerados dependendo da escolha dos conjuntos P , Q e Wi .
Na primeira fase, os casos de teste resultam da concatenao dos conjuntos Q
e W . Se o teste obtiver sucesso signica que o nmero de estados da implementao igual ao nmero de estados da especicao.
Na segunda fase, os casos de teste so gerados a partir da concatenao das
sequncias do conjunto P , menos as sequncias do conjunto Q, com o conjunto
Wi correspondente ao estado atingido aps a execuo de cada sequncia, ou
seja, R = P Q e R W =
pR
{ , x, y, xx, xy, yy, yx, yyy, yyx}, as sequncias so geradas pela concatenao
do conjunto P , menos o conjunto Q, com o conjunto Wi de cada estado Si atingido. Tem-se R = P Q = {xx, xy, yyy, yyx, yx}. Realizando a operao R W
61
as
substituies
necessrias,
as
sequncias
obtidas
so:
62
ambas as fases, pode-se considerar que ela est em conformidade com sua especicao.
Para a MEF da Figura A.1, a aplicao do mtodo HIS ilustrado a seguir,
considerando o conjunto state cover Q e as famlias de separao H1 , H2 , H3 , H4 .
Na primeira fase (Identicao de Estados) as sequncias geradas
so da forma:
{ .H1 ,
y.H2 ,
forma:
.x.H3 ,
{xx, xy, yx, yy, yxx, yxy, yyx, yyyy, xxx, xxy, xyx, xyyy, yyxx, yyyx, yyyyy}.
Com a retirada das sequncias que so prexos de outras, o mtodo HIS gera o
conjunto T SHIS = {rxxx, rxxy, rxyx, rxyyy, ryxx, ryxy, ryyxx, ryyyx, ryyyyy}
de tamanho 41.
A.5.1
64
conexas, completas e minimais. Dessa forma, na Tabela A.1 so apresentadas outras caractersticas das MEFs em que alguns mtodos ainda podem ser aplicados.
Tabela A.1: Comparao entre os mtodos de gerao.
TT
DS
Wp
SC
HSI
SPY
12
45
49
29
39
39
25
25
No-minimal
Parcial
No-determinstica
Cobertura Completa
Tamanho do Conjunto
65
Apndice B
Teste de Programas Paralelos:
Denies e Exemplos
A seguir so apresentados os conceitos do teste de programas paralelos. Primeiramente, apresenta-se o modelo Parallel Control Flow Graph (PCFG) (Souza et al.,
2008) e em seguida, os critrios denidos so ilustrados. Este apndice foi baseado na Seo 5.2 da dissertao de mestrado de Endo (2008).
O modelo PCFG foi denido para capturar o uxo de controle, dados e comunicao em programas paralelos baseados em passagem de mensagens. O
modelo considera um nmero n xo e conhecido de processos dado pelo conjunto P rog = {p0 , p1 , . . . pn1 }. A comunicao entre esses processos feita por
meio das primitivas send e receive. Cada processo p possui seu prprio grafo de
uxo de controle CF Gp (Rapps and Weyuker, 1985).
O PCFG composto pelos GFCs dos processos e pela representao da co-
66
67
Um s-p-uso denido por (np1 , (np1 , np2 ), (np2 , np2 ), xp1 , xp2 ),
i
j
m
k
l
onde
existe uma associao s-uso (np1 , (np1 , np2 ), xp1 ) e uma associao p-uso
i
j
k
(np2 , (np2 , np2 ), xp2 ).
m
k
l
Para ilustrar o modelo, a seguir apresentado o exemplo GCD. Esse exemplo implementado usando a biblioteca PVM (Listagem B.1 e Listagem B.2). O
programa utiliza quatro processos (pm , p0 , p1 , p2 ) para calcular o mximo divisor
comum entre trs nmeros. O processo mestre pm cria os processos escravos
p0 , p1 and p2 , que executam o cdigo gcd.c. Cada escravo espera o recebimento
de dois valores enviados pelo processo pm e calculam o mximo divisor comum
para esses valores. Ao nal, os processos escravos enviam o valor calculado para
o processo mestre.
Listing B.1: Programa GCD em PVM - processo mestre.
/* Master program GCD - mgcd.c */
#include<stdio.h>
#include "pvm3.h"
extern void pack(int);
extern int unpack();
int main(){
/*1*/ int x,y,z, S[3];
/*1*/
scanf("%d%d%d",&x,&y,&z);
/*1*/
pvm_spawn("gcd",(char**)0,0,"",3,S);
/*2*/
pack(&x);
/*2*/
pack(&y);
/*2*/
pvm_send(S[0],1);
/*3*/
pack(&y);
/*3*/
pack(&z);
/*3*/
pvm_send(S[1],1);
/*4*/
pvm_recv(-1,2);
/*4*/
x = unpack();
/*5*/
pvm_recv(-1,2);
/*5*/
y = unpack();
/*6*/
if ((x>1)&&(y>1))
/*7*/
pack(&x);
/*7*/
pack(&y);
/*7*/
pvm_send(S[2],1);
68
/*8*/
pvm_recv(-1,2);
/*8*/
z = unpack();
/*9*/
else { pvm_kill(S[2]);
/*9*/
z = 1;
/*10*/
printf("%d", z);
/*10*/
pvm_exit();
int tid,x,y;
/*1*/
tid = pvm_parent();
/*2*/
pvm_recv(tid,-1);
/*2*/
x = unpack();
/*2*/
y = unpack();
/*3*/
while (x != y){
/*4*/
if (x<y)
/*5*/
y = y-x;
/*6*/
else
/*6*/
x = x-y;
/*7*/
/*8*/
pack(&x);
/*8*/
pvm_send(tid,2);
/*9*/
pvm_exit();}
B.1
Critrios de Teste
p0
p1
s-use(x, y)
s-use(y, z)
16
pm
3
s-use(x)
s-use(x)
4
s-use(x)
s-use(x)
p2
1
s-use(x, y)
9
4
10
s-use(x)
8
9
70
Todos-Arcos: os casos de teste devem executar todos os desvios de execuo e comunicao entre processos.
71
Apndice C
A. S. Simo, A. Petrenko. Checking Completeness of
Tests for Finite State Machines. IEEE Transactions
on Computers, v. 59, p. 1023-1032, 2010
72
AUGUST 2010
1023
Checking Completeness of
Tests for Finite State Machines
Adenilso Simao and Alexandre Petrenko
AbstractIn testing from a Finite State Machine (FSM), the generation of test suites which guarantee full fault detection, known as
complete test suites, has been a long-standing research topic. In this paper, we present conditions that are sufficient for a test suite to
be complete. We demonstrate that the existing conditions are special cases of the proposed ones. An algorithm that checks whether a
given test suite is complete is given. The experimental results show that the algorithm can be used for relatively large FSMs and test
suites.
Index TermsFinite State Machine, test analysis, fault coverage, test completeness conditions, test generation.
INTRODUCTION
EST
1024
DEFINITIONS
VOL. 59,
NO. 8,
AUGUST 2010
SIMAO AND PETRENKO: CHECKING COMPLETENESS OF TESTS FOR FINITE STATE MACHINES
" 2 K.
For each s; x 2 D, there exist ; x 2 K, such that
s0 ; s.
1025
u
t
1026
b.
3.
VOL. 59,
NO. 8,
AUGUST 2010
SIMAO AND PETRENKO: CHECKING COMPLETENESS OF TESTS FOR FINITE STATE MACHINES
1027
1028
1.
2.
3.
VOL. 59,
NO. 8,
AUGUST 2010
EXPERIMENTAL RESULTS
SIMAO AND PETRENKO: CHECKING COMPLETENESS OF TESTS FOR FINITE STATE MACHINES
1029
TABLE 1
Number of Minimal Confirmed Sets and Size
of the First Found Largest Confirmed Sets
1030
Fig. 4. Average execution time for checking the proposed conditions and
the conditions from [2] for complete test suites.
none of them occurred for FSMs with fewer than 200 states
or for test suites with length smaller than 80,000.
To see how execution time depends on the number of
states of the FSMs, we randomly generated 500 reduced
complete FSMs with 10 inputs, 10 outputs, and states
ranging from 3 to 500, as well as test suites with 20,000 tests.
We consider only the runs that were not ended by a timeout.
As seen in the previous experiment, the probability of a run
ending by timeout for this setting is negligible, since
timeouts only occurred with larger test suites. The average
time was 61.046 seconds and the standard deviation was
3.451 seconds. Thus, all things being equal, the execution
time varies only slightly with the number of states. Actually,
we observed that the parameter with the greatest impact on
execution time is the test suite length, as discussed next.
Fig. 3 shows how the execution time grows as the test
suite length increases. We generated 500 complete FSMs
with 10 inputs, 10 outputs, and the number of states ranging
from 3 to 500. The length of the test suites ranges from 1 to
300,000. Since the number of edges in the distinguishability
graph and, consequently, the time for constructing it, grows
quadratically with the test suite length, the overall execution time increases in the same way. We notice that even for
test suites of length as big as 300,000 and for FSMs with up
to 500 states, the tool was able to produce a result in less
than 1,500 seconds. In this experiment, we also excluded the
runs in which the tool was terminated by timeout. For
larger test suites, the tool runs out of memory, since the
amount of memory required for data structures used to
build and represent the distinguishability graph also grows
quadratically with the length of the test suite.
VOL. 59,
NO. 8,
AUGUST 2010
SIMAO AND PETRENKO: CHECKING COMPLETENESS OF TESTS FOR FINITE STATE MACHINES
1031
CONCLUSIONS
ACKNOWLEDGMENTS
This work was in part supported by the Natural Sciences
and Engineering Research Council of Canada under
discovery grant OGP0194381 and by Brazilian Funding
Agency CNPq under grant 200032/2008-9. The authors
wish to thank the reviewers for their useful comments.
REFERENCES
[1]
[2]
[3]
[4]
[5]
[6]
[7]
1032
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
[18]
[19]
[20]
F.C. Hennie, Fault-Detecting Experiments for Sequential Circuits, Proc. Fifth Ann. Symp. Circuit Theory and Logical Design,
pp. 95-110, 1964.
R.M. Hierons and H. Ural, Reduced Length Checking Sequences, IEEE Trans. Computers, vol. 51, no. 9, pp. 1111-1117,
Sept. 2002.
R.M. Hierons and H. Ural, Optimizing the Length of Checking
Sequences, IEEE Trans. Computers, vol. 55, no. 6, pp. 618-629, May
2006.
R.M. Karp, Reducibility Among Combinatorial Problems,
Complexity of Computer Computations, R.E. Miller and
J.W. Thatcher, eds., pp. 85-103, Springer,
1972.
E.P. Moore, Gedanken-Experiments, Automata Studies,
C. Shannon and J. McCarthy, eds., Princeton Univ. Press, 1956.
J.M. Pena and A.L. Oliveira, A New Algorithm for Exact
Reduction of Incompletely Specified Finite State Machines, IEEE
Trans. Computer-Aided Design of Integrated Circuits and Systems,
vol. 18, no. 11, pp. 1619-1632, Nov. 1999.
A. Petrenko, G.v. Bochmann, and M. Yao, On Fault Coverage of
Tests for Finite State Specifications, Computer Networks and ISDN
Systems, special issue on protocol testing, vol. 29, pp. 81-106, 1996.
A. Petrenko and N. Yevtushenko, Testing from Partial Deterministic FSM Specifications, IEEE Trans. Computers, vol. 54, no. 9,
pp. 1154-1165, Sept. 2005.
J.F. Poage and E.J. McCluskey Jr., Derivation of Optimal Test
Sequences for Sequential Machines, Proc. IEEE Fifth Symp.
Switching Circuits Theory and Logical Design, pp. 121-132, 1964.
M.P. Vasilevskii, Failure Diagnosis of Automata, Cybernetics,
vol. 4, pp. 653-665, 1973.
H. Ural, X. Wu, and F. Zhang, On Minimizing the Lengths of
Checking Sequences, IEEE Trans. Computers, vol. 46, no. 1, pp. 9399, Jan. 1997.
M. Yao, A. Petrenko, and G.v. Bochmann, Fault Coverage
Analysis in Respect to an FSM Specification, Proc. IEEE
INFOCOM 94, pp. 768-775, 1994.
N. Yevtushenko and A. Petrenko, Synthesis of Test Experiments
in Some Classes of Automata, Automatic Control and Computer
Sciences, vol. 24, no. 4, pp. 50-55, 1990.
VOL. 59,
NO. 8,
AUGUST 2010
Apndice D
A. S. Simo, A. Petrenko. Fault Coverage-Driven
Incremental Test Generation. Computer Journal, v.
53, p. 1508-1522, 2010
83
The Author 2009. Published by Oxford University Press on behalf of The British Computer Society. All rights reserved.
For Permissions, please email: journals.permissions@oxfordjournals.org
Advance Access publication on August 12, 2009
doi:10.1093/comjnl/bxp073
In this paper, we consider a classical problem of complete test generation for deterministic nitestate machines (FSMs) in a more general setting. The rst generalization is that the number of states
in implementation FSMs can even be smaller than that of the specication FSM. Previous work
deals only with the case when the implementation FSMs are allowed to have the same number of
states as the specication FSM. This generalization provides more options to the test designer: when
traditional methods trigger a test explosion for large specication machines, tests with a lower, but
yet guaranteed, fault coverage can still be generated. The second generalization is that tests can
be generated starting with a user-dened test suite, by incrementally extending it until the desired
fault coverage is achieved. Solving the generalized test derivation problem, we formulate sufcient
conditions for test suite completeness weaker than the existing ones and use them to elaborate an
algorithm that can be used both for extending user-dened test suites to achieve the desired fault
coverage and for test generation. We present the experimental results that indicate that the proposed
algorithm allows obtaining a trade-off between the length and fault coverage of test suites.
Keywords: software testing; nite-state machines; test generation
Received 3 February 2009; revised 28 May 2009
Handling editor: Iain Stewart
1. INTRODUCTION
The problem of generating tests with guaranteed fault coverage,
called n-complete tests, for a specication FSM with n
states, aka checking experiments and checking sequences,
has traditionally been investigated only for the fault domain
containing all implementation FSMs with at most n states or
even higher; see, e.g. [16]. An n-complete test suite guarantees
to the test designer exhaustive fault coverage with respect to the
given upper bound n on the number of states in implementation
machines [7]. The length of n-complete tests is proportional
to n3 [2]; thus their size can become unacceptably large for
complex specications. The test designer may resort to less
exhaustive coverage criteria used in FSM-based testing such
as state, transition and path coverage; see, e.g. [8, 9]. Indeed,
tests that satisfy these criteria scale much better that n-complete
tests, but they offer no guaranteed fault coverage in terms of the
number of states in faulty implementation FSMs.
We believe that the test designer may want to be able to
generate tests while retaining a (reduced) guaranteed fault
1509
2.
DEFINITIONS
a/0
a/1
2
b/1
b/0
b/1
a/1
1510
3. TEST PROPERTIES
In this section, we discuss various properties of FSM tests used
to formulate a test generation method. First, we formalize the
notion of test suite completeness with respect to a given fault
domain.
Throughout this paper, we assume that M = (S, s0 ,
I, O, D, , ) and N = (Q, q0 , I, O , D , , ) are a
specication FSM and an implementation FSM, respectively.
Moreover, n is the number of states of M. We denote by the
set of all deterministic FSMs with the same input alphabet as M
for which all sequences in M are dened, i.e. for each N
it holds that M N . The set is called a fault domain for
M. Given p n, let p be the FSMs of with at most p states,
i.e. the set p is the fault domain for M which represents all
faults that can occur in an implementation of M with no more
than p states. Faults can be detected by tests, which are input
sequences dened in the specication FSM M.
Definition 2. A dened input sequence of FSM M is called
a test case (or simply a test) of M. A test suite of M is a nite
prex-closed set of tests of M. A given test suite T of FSM M is
p-complete, p n, if for each FSM, N p , distinguishable
from M, there exists a test in T that distinguishes them.
Since the distinguishability of FSMs is dened as the
corresponding relation of their initial states, tests are assumed to
be applied in the initial state. Similarly, FSMs are T -equivalent,
for a test suite T , if their initial states are T -equivalent. A trivial
test suite contains only the empty sequence.
The p-completeness of a test suite provides full fault coverage
for the fault domain dened by the input alphabet of the
specication FSM and maximal number of states p.
The rest of the paper is devoted to the problem of extending
a given test suite until it becomes p-complete for a given
1 Test
a/0
2
b/1
b/0
a/1
a/1
3
b/1
one state of the FSM M, these two tests must also converge in a
same state in any FSM in the fault domain that is T -equivalent
to M. Given a test suite T , let n (T ) = n (T ), i.e. the set
of FSMs in which are T -equivalent to M and have at most
n states. Below we consider only n (T )-convergence, instead
of (T )-convergence. In particular, we show how the n (T )convergence of tests can be established based on the existence
of an n (T )-divergent set with n tests. Note that, while (T )divergent tests are also n (T )-divergent, the converse does not
hold, i.e. there are n (T )-divergent tests that are not (T )divergent. For instance, Lemma 1 can be used to establish
the n (T )-divergence of tests from the n (T )-divergence and
n (T )-convergence of other tests, but cannot determine their
(T )-divergence, which requires that the tests in question are
T -separated.
Lemma 3. Given a test suite T and T , let K be an n (T )divergent set with n tests and K be a test M-convergent
with . If is n (T )-divergent with each test in K\{}, then
and are n (T )-convergent.
Proof. Let K = K\{}. The set K is an n (T )-divergent set
and thus it reaches n 1 states of M. As both and are
n (T )-divergent with each test in K , in any FSM of n (T ),
both and reach a state that is not reached by the tests in
K . As K reaches n 1 states and any FSM in n (T ) has at
most n states, and must reach the same state, i.e. they are
n (T )-convergent.
Consider the FSM M1 in Fig. 1 and the test suite T =
pref({aaa, baa}). We have that the tests and aa are n (T )convergent, since the set {, a, b} is n (T )-divergent and the
test aa is n (T )-divergent with a and b.
In the next section, we use test divergence and convergence
properties to formulate conditions that ensure p-completeness
of test suites.
4.
1511
1512
1513
Step 2
Condition 1
|K| min(p + 1, n)?
No
Yes
Condition 2
Yes
|K| p + 1?
No
Condition 3
Is C(K) an initialized
Yes
transition cover?
No
Condition 4
M-convergent
tests j T \ C(K), c K,
s.t. u K \ {c},
(j, u) D?
Step 3
C := C {(j, c)}
Apply Rules 110
j, c
Yes
Step 4
No
Condition 5
e C(K)?
Yes
p-complete
test suite T
j, c
j := e
No
Step 5
j := ax
Select a K
s.t. K {a} is M-divergent
For each b K, s.t. a and b are Mdivergent, (a, b) D, select
a sequence g distinguishing
d (s0, a) and d (s0, b)
T := T pref({ag, bg})
D := D {(a, b)}
Update C and D for T
Apply Rules 110
K := K {a}
1514
1515
1516
EXAMPLES
Incremental generation
aa
baa
a
aaa
(a)
6.2.
Conrming p-completeness
baa
ba
ba
(b)
We have that (C) = {{, ab}, {b, abb}, {ba}, {a}, {aa},
{aaa}, {bab}, {baba}, {bb}, {bba}, {bbab}}. Figure 5b presents
the updated divergence graph. We represent the tests in
C (K) in bold type and the edges added to the graph are
dashed.
As Condition 4 holds for = ba and = a, Step 4 is
executed. Then, (ba, a) is added to C and Rules 110 are applied.
The following relationships are determined:
(i) (ab, bab) is added to C (Rule 2);
(ii) (, bab) is added to C (Rule 1);
1517
1518
aa
ab
abb
bbab
bab
bab
bb
6.3.
aa
bb
bbab
a
baba aaa bba
ba
(a)
ba
(b)
aa
bbab
bb
bbab
ba
bba
ba
(d)
(iii) (ba, bab), (ba, aa), (bba, aa), (bab, bba) are added to
D (Rule 4);
(iv) (bb, a) is added to D (Rule 3);
(v) (bb, ba) is added to D (Rule 5).
In Fig. 5c, we present the updated divergence graph.
We have that (C) = {{, ab, bab}, {ba, a}, {b, abb}, {aa},
{aaa}, {baba}, {bb}, {bba}, {bbab}}.
Now, Condition 4 holds for = and = aa. The execution
of Step 4 adds (, aa) to C and Rules 110 are applied, resulting
in the following additional relationships:
(i)
(ii)
(iii)
(iv)
We now illustrate how the algorithm can be used to extend a userdened test suite, obtaining a p-complete test suite. Consider
again the FSM M1 in Fig. 1 and p = 1, 2, 3. In this example,
we use a test suite Ttour = pref(bbabaa), which is derived from
a transition tour for M1 . Figure 6a presents the corresponding
divergence graphs of Ttour . Note that the set {, b, bba} is n (T )divergent. Thus, when the algorithm is executed with Ttour and
p = 1 or p = 2, no test is added, since the test suite T already
satises the conditions for 1- and 2-completeness of Theorem 1.
Let T = Ttour . The set K = {, b, bba} is the only maximal 3-clique in the divergence graph. Step 5 is executed,
selecting the transition (3, b) and = b. Then, Step 4 is
executed for = bb and = b. For = , we add the
test a to T . For = bba, we add bbba to T . After applying
Rules 110, we obtain the following partition (C) = {{},
{b, bb, bbb}, {bba, bbba}, {a}, {bbab}, {bbaba}, {bbabaa}}.
The resulting divergence graph is presented in Fig. 6b.
As C (K) is initialized but is not a transition cover, Step 5 is
executed. We select the transition (2, b) and the test = bba.
Then, we execute Steps 3 and 4 for = bbab and = . For
= bba, we may add test bbaa, so that bba and bbab become
T -separated. However, as (bba, bbba) C, we instead add
bbbaa, which ensure the T -separability of bbbaa and bbab.
After applying Rules 110 (specically, Rule 5), (bba, bbab)
is added to D, as required. This choice is motivated by the
fact that adding bbbaa instead of bbaa would not require an
additional reset. After applying Rules 110, we obtain (C) =
{{, bbab}, {b, bb, bbb}, {bba, bbba}, {a, bbaba}, {bbabaa},
{bbbaa}}. Figure 6c presents the resulting graph.
bbab
bbabaa
bbab
bbabaa
bb
b
bbaba
bba
bbaba
(a)
bba
(b)
bbabaa
bbbaa
bbbaa
b
bba
(c)
bba
(d)
bb
7.
EXPERIMENTAL RESULTS
1519
1520
9.
CONCLUSION
In this paper, we considered a problem of incrementally generating tests until the desired level of fault coverage is reached.
Solving this problem, we presented sufcient conditions for test
suite completeness that are weaker than the ones known in the
literature. Based on these conditions, we proposed an algorithm
that generates a test suite with complete fault coverage starting
with a given set of initial tests, if it is available. The algorithm
determines whether the initial test suite already satises the
sufcient conditions and, thus, can also be used for test suite
analysis. The possibility of augmenting the fault coverage of
test suites also demonstrates the fact that the algorithm allows
one to generate tests using specication coverage as well as
fault coverage criteria. Note that these two criteria are often
considered as alternatives, where specication coverage criteria
are presumed to be more practical. Finally, we experimentally
compared both the length and fault coverage of p-complete test
suites, for p < n, with those of n-complete ones; the results
suggest that a trade-off between the test length and the fault
coverage can be obtained by selecting a proper value of p.
As a forthcoming step in this work, it is interesting to
investigate how the results in this paper can be extended to other
fault domains, e.g. to deal with cases when the implementations
may have more states than the specication.
FUNDING
The authors acknowledge nancial supports of the Natural
Sciences and Engineering Research Council of Canada (Grant
ACKNOWLEDGEMENTS
The authors would like to thank the anonymous reviewers for
their useful comments.
REFERENCES
[1] Hennie, F.C. (1965) Fault-Detecting Experiments for Sequential
Circuits. Proc. Fifth Annual Symp. Circuit Theory and Logical
Design, Princeton, USA, November 1113, pp. 95110.
[2] Vasilevskii, M.P. (1973) Failure diagnosis of automata.
Cybernetics, 4, 653665.
[3] Chow, T.S. (1978) Testing software design modeled by nite-state
machines. IEEE Trans. Softw. Eng., 4, 178187.
[4] Fujiwara, S., von Bochmann, G., Khendek, F., Amalou, M. and
Ghedamsi, A. (1991) Test selection based on nite state models.
IEEE Trans. Softw. Eng., 17, 591603.
[5] Lee, D. and Yannakakis, M. (1996) Principles and methods of
testing nite state machinesa survey. Proc. IEEE, 84, 1090
1123.
[6] Petrenko, A. and Yevtushenko, N. (2005) Testing from partial
deterministic FSM specications. IEEE Trans. Comput., 54,
11541165.
[7] Petrenko, A., Bochmann, G.v. and Yao, M. (1996) On fault
coverage of tests for nite state specications. Comput. Netw.
ISDN Syst., 29, 81106.
[8] Binder, R. (2000) Testing Object-Oriented Systems. AddisonWesley, Reading, MA.
[9] Simo, A. and Petrenko, A. (2009) Comparing FSM test coverage
criteria. IET Softw., 3, 91105.
[10] Nebut, C., Fleurey, F., Traon,Y. and Jezequel, J. (2006) Automatic
test generation: a use case driven approach. IEEE Trans. Softw.
Eng., 32, 140155.
[11] Fraser, G., Weiglhofer, M. and Wotawa, F. (2008) Coverage
Based Testing with Test Purposes. Proc. Eighth Int. Conf.
Quality Software, Oxford, UK, August 1213, pp. 199208. IEEE
Computer Society.
[12] Dorofeeva, R., El-Fakih, K. and Yevtushenko, N. (2005) An
Improved Conformance Testing Method. Formal Techniques for
Networked and Distributed Systems, Taipei, Taiwan, October 25,
pp. 204218. Lecture Notes in Computer Science 3731. Springer,
Berlin.
[13] Karp, R.M. (1976) The Probabilistic Analysis of Some
Combinatorial Search Algorithms. In Traub J.F. (ed.), Algorithms
and Complexity: New Directions and Recent Results. Academic
Press, New York. pp. 119.
[14] Griggs, J.R. (1983) Lower bounds on the independence number
in terms of the degrees. J. Comb. Theory B, 34, 2239.
[15] Jagota, A. and Sanchis, L.A. (2001) Adaptive, restart, randomized
greedy heuristics for maximum clique. J. Heuristics, 7,
565585.
its length. Moreover, since the reset input is not necessarily used
each time a given state is to be reached, the number of tests in
a test suite, i.e. the number of reset inputs, can thus become
a subject for optimization. Examples in Section 6 illustrate a
potential saving which the proposed method can achieve.
Fourth, the proposed algorithm improves the state-of-theart in fault coverage analysis. The sufcient conditions for the
p-completeness proposed in this paper generalize the existing
ones, such as [7, 8, 12, 21], by allowing p < n and further relax
them for the case p = n. In our recent work [18], we elaborated
sufcient conditions for the case of p = n and showed
that they are weaker than the sufcient conditions in [12] for
checking experiments and those in [24] for checking sequences.
Besides being applicable when p < n, the conditions
proposed in this paper require the existence of an initialized
convergence-preserving transition cover, while in [18], not
only the convergence, but also divergence is considered for
the tests in the initialized transition cover. Moreover, the
conditions rely on new possibilities for determining divergence
and convergence of tests, which are not used in the previous
work. Thus, the formulated sufcient conditions are weaker than
the existing ones.
1521
1522
Apndice E
A. S. Simo, A. Petrenko. and Maldonado, J. C.
Comparing Finite State Machine Test Coverage
Criteria. IET Software, v. 3, p. 91-105, 2009
99
Published in IET Software
Received on 27th February 2008
Revised on 19th November 2008
doi: 10.1049/iet-sen.2008.0018
ISSN 1751-8806
Instituto de Ciencias Matematicas e de Computacao, Universidade de Sao Paulo, Sao Carlos, Sao Paulo, Brazil
Abstract: nite state machines (FSMs) are presented, namely,
state and transition coverage; initialisation fault and transition fault coverage. The rst two criteria focus on
FSM structure, whereas the other two on potential faults in FSM implementations. The authors elaborate a
comparison approach that includes random generation of FSM, construction of an adequate test suite and
test minimisation for each criterion to ensure that tests are obtained in a uniform way. The last step uses an
improved greedy algorithm.
Introduction
Moore lock FSMs that require the longest sequence to reach
and identify a certain state [4]. Thus, the usage of upper
bounds for various coverage criteria can be misleading. It is
important to have at least some indications on the average
lengths of adequate test suites. Based on these indications,
a test engineer can plan a testing strategy that better ts the
constraints of a testing project. Concerning the
subsumption relation [3], which indicates when a test suite
adequate to one criterion is also adequate to another, it can
be established for some criteria; however, not all of them
are comparable with respect to this relation. Then, it is
important to have other means of comparing such criteria.
In this context, experimental data are useful for choosing
coverage criteria and dening effective testing strategies.
Experimental data characterising the average lengths of test
suites adequate for various criteria help in assessing the
applicability of a particular criterion. Furthermore,
assuming the tester has chosen a given criterion, an
important question is how the test suites adequate for this
criterion relate to others in order to know how the cost
would change if the tester decides to generate a test suite
that is adequate according to another stronger criterion.
Despite the importance of experimental data, there is a lack of
work in the literature that provides those concerning FSM tests.
The monograph [2] refers to just the worst-case test lengths. We
are aware of only the work of Dorofeeva et al. [5], which reports
the results of an experiment comparing various test generation
methods. However, no experimental comparison among
coverage criteria for FSMs is available. In this paper, we
address the experimental comparison of test coverage criteria
for FSMs. The contributions of this paper are 2-fold. First, we
consider four criteria, namely, state coverage (SC), transition
coverage (TC), initialisation fault (IF) coverage and transition
fault (TF) coverage criteria, and provide experimental data on
the length of tests generated from an FSM specication to
satisfy these coverage criteria. We investigate the impacts of
FSM parameters on the cost associated with the usage of
those criteria. Although the cost of test suites adequate for
various criteria can be estimated in various ways, we use the
length of test suites as a measure of the cost since it is an
objective measure which can easily be obtained for a large
number of FSMs, as required in our experiments, and
provides a good approximation of the real cost: all things
being equal, longer test suites are likely more expensive. Thus,
we are interested in comparing the average length of the test
suites for those criteria, both to each other and to the
theoretical upper limits. We also investigate how the test suites
adequate for these criteria are related to the notion of ncompleteness [6], which plays an important role in the
comparison of test generation methods. The experiments
involve random generation of FSM specications and tests in
order to provide experimental characterisation of how the test
length depends on FSM parameters and coverage criteria.
Secondly, we elaborate the approach for comparing
criteria, which ensures that tests are generated in a uniform
way. This is achieved by rst constructing a test suite
92
set of tests of M, such that no test is a proper prex of another
test.
To model implementation faults, we use the notion of a
mutant of a given specication FSM.
Partial FSM
Initialisation fault mutant
Output fault mutant
Transfer fault mutant
0
A mutant N (S, s 0 , I, O, DN , D, L) is distinguishable
from M, denoted N M, if there exists g [ VM > VN
0
such that l(s0 , g) = L(s 0 , g). We say that g kills N. N has
a transfer fault in the transition (s, x) [ D with respect to
M, if d(s, x) = D(s, x). N has an output fault in the
transition (s, x) [ D with respect to M, if l(s, x) = L(s,
0
x). N has an IF with respect to M, if s0 = s 0 . N has a TF
in (s, x) [ D with respect to M, if it has an output or
transfer fault or both. Fig. 1 shows examples of mutants
with each of these faults. The mutant in N has an IF, since
the initial state is changed to state 4. The mutant in Fig. 1c
has an output fault in the transition (2, b), since the output
was changed from 1 to 0. The mutant in Fig. 1d has a
transfer fault in the transition (4, a), since the tail state of
the transition was changed from state 4 to state 1.
If TSK(M, T ) TRK(M), it is said that T is K-adequate
for M. A criterion K subsumes another criterion K 0 , if any
K-adequate test suite is also K 0 -adequate.
Test coverage criteria are usually dened with specication
or fault coverage in mind. When an FSM is the specication
for testing, tests covering an FSM specication target one or
several elements such as inputs, outputs, states and fragments
of its transition graph. Covering inputs and outputs is usually
considered as extremely weak requirement for FSM testing
and hence, we will not consider them in this paper. Paths
are typical fragments of the transition graph considered for
coverage. However, path coverage has to be selective, as the
number of paths is innite in the presence of cycles. One
of the most cited criteria is the TC, which we consider in
this paper. It is a special case of an x-switch coverage
criterion, proposed in [7], which denes a testing
requirement as a tuple of transitions to cover by a test; for
simplicity, we concentrate only on the traditional TC
criterion dened below.
Testing with fault coverage in mind relies on fault models.
Fault models represent the kind of faults the tester is
interested in at a particular moment. They are important to
make the test activity more manageable, aiding with
focusing the testing efforts in the particular kind of faults
they embody. Among simple FSM fault models, we should
mention the IFs and TFs considered in this paper. The
former states that the only possible faults in FSM
implementations are related to a wrong initial state of a
specication FSM, whereas the latter assumes that
implementation faults occur in transitions.
Thus, we choose the following four FSM test coverage
criteria: (i) SC, (ii) TC, (iii) IF coverage and (iv) TF
coverage. These criteria are dened in the next sections.
pair of a transition, represented by the pair (s, x), and a state
from which the tail state of the transition should be
distinguished. To satisfy such a requirement, a test suite
should not only cover a transition as in the case of the TC
criterion, but also have corresponding separating sequences
applied in both concerned states. TSTF(M, T ) is dened
by the requirements that are satised
TSTF(M, T ) f(s, x, s 0 ) [ D S j d(s, x) s 0 , 9 p,
x [ T, axg p, bg x, d(s0 , a) s, d(s0 , b) s 0 ,
l(d(s0 , ax), g) = l(s 0 , g)g.
Thus, CTF(M, T ) jTSTF(M, T )j/jTRTF(M )j. For the
example FSM (Fig. 1a), the test suite faaaaa, abaaa, baa,
bbaaag is TF-adequate. Consider, for instance, the
transition (2, b), whose tail state is 4. Test bb covers this
transition. States 4 and 1 are distinguished by a, which
follows bb and the empty sequence; states 4 and 2 are
distinguished by aa, which follows bb and b; and states 4
and 3 are distinguished by aaa, which follows bb and ab.
Thus, all requirements related to transition (2, b) are
satised. One can check that the other requirements are
also satised.
We note that the idea of this criterion is similar to the one
proposed in [6], where the fault coverage of a given test suite
is dened as the percentage of states that are distinguished
from the tail state of each transition by the test suite.
For reduced FSMs, if a test suite is TF-adequate, then it is
also TC-adequate, since the test suite must cover each
transition in order to reveal each transfer fault. Therefore,
the criterion TF subsumes the criterion TC, and
consequently, SC, for reduced FSMs, as shown in Fig. 2.
The criterion TF also subsumes the criterion IF, once the
former is augmented with the requirement that all the
sequences separating the initial state from a tail state of
each transition are appended to the empty sequence.
(n 2 1)(n 2 1 2d). Then, complete FSMs may require up
to (n 2 1)(n 2 1 2n 2) 3(n 2 1)2, whereas partial
FSMs (n 2 1)(n 2 1 2n(n 2 1)/2) (n 1)(n 2 1)2.
For the TF coverage, a single transition may require at
most two tests, each of which does not exceed the value
r 1 d; hence, kn transitions need 2kn(r
1 d ) 2kn(n d ) inputs. Thus, the length of the TFadequate test suite does not exceed 2kn(2n 2 1) for
complete FSMs and kn 2(n 1) for partial ones.
In addition to the above characterisation of worst cases,
one may also consider asymptotic characterisation of FSM
parameters for almost all FSMs. Indeed, the monograph
[8] indicates that the accessibility degree r is asymptotically
equal to logk n and the distinguishability degree d is
asymptotically equal to logk logl n for a complete FSM
with n states, k inputs and l outputs. These formulae give
the values expected to be valid for almost all FSMs. We
use them to derive the expected length of the test suites for
the four criteria. For the SC-criterion, the expected length
is rn n logk n. For the TC-criterion, the length is
kn(r 1) kn(logk n 1). The IF-criterion yields (for
complete FSMs) d(n 2 1) (n 2 1)(r d) (n 2 1)
(logk n 2 logk logl n). Finally, for the TF-criterion, the
expected length is 2kn(r 1 d) 2kn(1 logk n logk
logl n).
At the same time, given a specication FSM and a
coverage criterion, it is not clear how close to these bounds
the test length might be. Since currently it does not seem
plausible to gather sufcient data about actual specications
and tests adequate for various criteria, experiments
involving random generation of specications and tests may
provide experimental characterisation of how the test length
depends on FSM parameters and coverage criteria. The
remaining part of this paper is devoted to the experiments
addressing the following questions:
How does the average length of an adequate test suite
compare with the upper bound?
How do test suites adequate for various criteria relate in
terms of the length?
If a test suite is adequate for one criterion, how adequate
would it be for another criterion?
Which of the FSM parameters contribute more to test
explosion and for which of the four criteria?
How probable is the condition that test suites adequate for
various criteria are n-complete?
Comparison approach
For a given specication FSM M (S, s0 , I, O, D, d, l), a
test suite which is SC-, TC-, IF- and TF-adequate is
generated in the following manner. For each pair of states s
and s 0 , we determine a shortest distinguishing input
sequence, gs,s 0 . Note that, as non-reduced FSMs can also be
generated, there may be some state pairs for which no such
sequence exists. Then, we determine a minimal transition
cover T by building a spanning tree of M and augmenting it
with missing transitions. We add the empty sequence to T.
The test suite is initialised with T. Finally, for each a [ T,
d(s0 , a) s and each s 0 [ S, such that d(s0 , a) is
distinguishable from s 0 , we include ags,s 0 in T. The resulting
test suite is n-complete for any reduced FSM M, since the
adopted test generation algorithm is in fact the HSI-method
[9] developed for reduced FSMs, and the test suite is what
we need for our experiments: it is SC-TC-IF-TF-adequate.
97
the reduction ratio and the execution. We randomly generate
100 FSMs with two inputs, two outputs, the number of states
ranging from 3 to 20 and the degrees of completeness of 0.4,
0.6, 0.8, 0.9 and 1.0. The degree of completeness is the ratio
between the dened transitions and the number of possible
transitions in a deterministic FSM, that is, kn. Note that the
degree 1.0 corresponds to complete FSMs. Note also that at
least n 2 1 transitions are required for the FSM to be
initially connected. Therefore we subtract n 2 1, both from
the number of dened transitions and the number of
possible transitions. Thus, given the number of transitions t,
the degree of completeness m is calculated as m (t
n 1)/(kn n 1) (t n 1)/(k(n 2 1) 1). For
instance, for an FSM with k 4 and n 20 and with 55
transitions, the degree of completeness is 0.59. To obtain an
FSM with a given degree of completeness m, we calculate
the number of transitions that is necessary to guarantee that
the degree of completeness is at least m. An SC-TC-IFTF-adequate test suite is obtained for each FSM and then
minimised with respect to the transfer fault coverage
criterion. Note that state and TC criteria would not be
useful for this comparison, since they require only a single
sequence to cover a testing requirement. An IF coverage
criterion could be used as well. Fig. 3a shows the average
time required to execute the algorithms. The execution time
for FSMs with up to ten states is comparable for both
algorithms. However, for larger FSMs, the execution time of
the original algorithm increases quicker than that for the
proposed algorithm. In Fig. 3b, we present the loss of
reduction efciency. Let to and tn be the length of the test
suite obtained by the original algorithm and the proposed
one, respectively. Then, the reduction efciency loss is
determined as (tn 2 to)/to , that is, the percentage of the
additional length of the test suites produced by the proposed
algorithm with respect to the original algorithm. We can
observe that, although for FSMs with three states the
reduction loss is about 3%, for FSMs with at least ve states,
the reduction loss is about 1%. Therefore considering the
reduction of the execution time, the decrease in the
efciency in the proposed algorithm is rather low.
sequences in T, the complexity of determining TSTF(M, T ) is
of the order O(t 2n 2kl 2), where l is the maximum length of
sequences a and b.
Note that if a given test suite contains just one sequence, the
algorithm cannot remove it, but can still shorten it if we use the
set of prexes of all tests as the input to the algorithm. Thus, to
further minimise a test suite T with multiple tests, we should
extend it with the set of all prexes of its sequences, denoted
by pref(T ). This extension increases the complexity of the
input to the algorithm and all computations. In the worst
case, the number of elements to be considered now is of the
order of w(T ), since jpref(T )j is close to w(T ), when the test
sequences in T do not share many common prexes. Note
that jpref(fag)j w(a) and jpref(fa, bg)j w(a) w(b)
w(g), where g is the longest common prex of both a and b.
It is easy to see that jpref(T )j w(T ). If the computational
cost of including all the test prexes is too high, a
compromise option may be including a subset of them,
preferably with those that are proper prexes of several tests,
since in this way the number of sequences to be considered
can be smaller. Note that in the step in Line 25, not only the
sequences that are chosen but also all their prexes are
removed from R. This can be done because of the fact that
for any test coverage criterion K and any test suite T, if
a [ pref(T ), we have that TSK(M, T ) TSK(M, T < fag).
Experimental results
Table 1 Formulae for the test length for state, transition, IF and TF coverage criteria
Coverage criterion
SC
n(n 2 1)
n logk n
TC
kn 2
kn logk n
2
IF
CFSMs: 3(n 2 1)
PFSMs: (n 1)(n2 1)2
TF
CFSMs: 2kn(2n 2 1)
PFSMs: kn 2(n 1)
99
Figure 5 Maximum, expected and average lengths of adequate test suites with respect to the number of states for:
a
b
c
d
State coverage
Transition coverage
Initialisation fault coverage
Transition fault coverage
Table 2 Fitted formulae and ratios for the test length for state, transition, IF and TF coverage criteria
Coverage criterion
Fitted formulae
1.07
2 0.23
Ratios
SC
1.31n
TC
IF
TF
100
& The Institution of Engineering and Technology 2009
Table 3 Relative strength of FSM coverage criteria
SC
TC
IF
TF
SC
1.000/0.000
0.970/0.064
0.994/0.034
TC
0.679/0.132
0.772/0.107
0.989/0.047
IF
0.645/0.248
0.928/0.122
0.993/0.053
TF
0.299/0.182
0.691/0.134
0.478/0.171
test length for state and IF coverage criteria does not vary,
whereas that for transition and TF coverage criteria grows
quasi-linearly.
Dorofeeva et al. [5] point out that the length of test suites
generated by Wp, HSI, UIOv and H methods is of the order
4n 2. These methods generate n-complete test suites. In our
experiment, we generated SC-TC-IF-TF-adequate test
suites, which are also n-complete for reduced FSMs. We
expected that the test suite lengths for the SC-TC-IF-TFadequate test suites were also of the same order. In Fig. 6d,
we present the average length of SC-TC-IF-TF-adequate
test suites and the curve 4n 2. For each value of n, the
average is computed over test suites generated for 900
complete reduced FSMs with four inputs and four outputs,
totalling 16 200 FSMs. In the experiments of Dorofeeva
et al. 1100 complete reduced FSMs are generated with the
FSM parameters different from ours, in particular, the
number of states ranges from 30 to 100 and the number of
inputs and outputs from six to ten. Although the different
settings hinder the comparison of obtained data, we
observe that our experimental data do not conrm the
conclusion of Dorofeeva et al. We tted the data to the
f (n) a n b c with NLLS and obtained 13.01 n 1.418
3.697. The data suggest that the length of n-complete test
suites in our experiments grows slower than O(n 2).
However, this observation must be checked with more
experiments.
Figure 6 Average length of adequate test suites for each coverage criteria with respect to
a
b
c
d
Number of inputs
Number of outputs
Number of transitions
Average length of SC-TC-IF-TF-adequate test suites against the curve 4n 2
102
& The Institution of Engineering and Technology 2009
states and number of transitions ranging from 13 to 20. An
adequate test suite is obtained for each FSM and each
criterion. The n-completeness of the adequate test suite is
then checked. Fig. 8 shows the variation of the percentage
of the n-complete test suites with respect to the number of
transitions. We observe that the percentage of n-complete
adequate test suites increases as the number of transitions
decreases, that is, the less dened the FSM, the more likely
a test suite adequate for this criterion is n-complete.
Considering the TF coverage criterion, we observe that for
FSMs with 13 transitions (degree of completeness 0.363),
more than 80% of the test suites are n-complete. As the
number of transitions increases, the percentage of ncomplete test suites decreases rapidly. When the FSM has
18 states or more (degree of completeness of at least
0.818), the percentage of n-complete test suites is lower
than 5%.
The above experiments indicate that the chances of
obtaining test suites with high fault detection power using
less powerful criteria are small. One of possible practical
implications is that the actual fault detection power of test
suites adequate for the coverage criteria considered in this
paper is not high. More precise characterisation of the
relative fault detection power of the criteria needs
experiments with exhaustive enumeration of complete
mutants within a given number of states. On the other
hand, the latter can hardly be implemented for FSMs
bigger than the ones considered in our experiments.
Threats to validity
violate them. Thus, our experiments report conservative
values for the n-completeness probability, since the actual
value may be even higher.
Conclusion
Acknowledgments
10
References
[3] FRANKL P.R., WEYUKER E.J.: A formal analysis of the faultdetecting ability of testing methods, IEEE Trans. Softw.
Eng., 1993, 19, (3), pp. 202 213
[11] HASSIN R., SEGEV D.: The set cover with pairs problem. Proc.
25th Annual Conf. Foundations Software Technology and
Theoretical Computer Science, 2005, pp. 164176
105
Apndice F
S. R. S. Souza, S. R. Verglio, P. S. L. Souza, A. S.
Simo, A. Hausen. Structural Testing Criteria for
Message-Passing Parallel Programs. Concurrency
and Computation. Practice & Experience, v. 20, p.
1893-1916, 2008.
115
a
2 Departamento de Inform tica, UFPR, Curitiba, PR, Brazil
a
SUMMARY
Parallel programs present some features such as concurrency, communication and synchronization that
make the test a challenging activity. Because of these characteristics, the direct application of traditional
testing is not always possible and adequate testing criteria and tools are necessary. In this paper we
investigate the challenges of validating message-passing parallel programs and present a set of specic
testing criteria. We introduce a family of structural testing criteria based on a test model. The model
captures control and data ow of the message-passing programs, by considering their sequential and
parallel aspects. The criteria provide a coverage measure that can be used for evaluating the progress
of the testing activity and also provide guidelines for the generation of test data. We also describe a
tool, called ValiPar, which supports the application of the proposed testing criteria. Currently, ValiPar
is congured for parallel virtual machine (PVM) and message-passing interface (MPI). Results of the
application of the proposed criteria to MPI programs are also presented and analyzed. Copyright 2008
John Wiley & Sons, Ltd.
Received 22 March 2007; Revised 25 November 2007; Accepted 3 December 2007
KEY WORDS:
1. INTRODUCTION
Parallel computing is essential to reduce the execution time in many different applications, such as
weather forecast, dynamic molecular simulation, bio-informatics and image processing. According
to Almasi and Gottlieb [1], there are three basic approaches to build parallel software: (i) automatic
Correspondence to: S. R. S. Souza, Instituto de Ci ncias Matem ticas e de Computacao, USP Av. Trabalhador S o-carlense,
e
a
1894
S. R. S. SOUZA ET AL.
environments that generate parallel code from sequential algorithms; (ii) concurrent programming
languages such as CSP and ADA; and (iii) extensions for traditional languages, such as C and
Fortran, implemented by message-passing environments. These environments include a function
library that allows the creation and communication of different processes and, consequently, the
development of parallel programs, usually running in a cluster of computers. The most known and
used message-passing environments are parallel virtual machine (PVM) [2] and message-passing
interface (MPI) [3]. Such environments have gained importance in the last decade and they are the
focus of our work.
Parallel software applications are usually more complex than sequential ones and, in many
cases, require high reliability levels. Thus, the validation and test of such applications are crucial
activities. However, parallel programs present some features that make the testing activity more
complex, such as non-determinism, concurrence, synchronization and communication. In addition,
the testing teams are usually not trained for testing this class of applications, which makes the
test of parallel programs very expensive. For sequential programs, many of the testing problems
were reduced with the introduction of testing criteria and the implementation of supporting tools.
A testing criterion is a predicate to be satised by a set of test cases and can be used as a guideline
for the generation of test data. Structural criteria utilize the code, the implementation and structural
aspects of the program to select test cases. They are usually based on a control-ow graph (CFG)
and denitions and uses of variables in the program [4].
Yang [5] describes some challenges to test parallel programs: (1) developing static analysis;
(2) detecting unintentional races and deadlock situations in non-deterministic programs; (3) forcing
a path to be executed when non-determinism might exist; (4) reproducing a test execution using
the same input data; (5) generating the CFG of non-deterministic programs; (6) providing a testing
framework as a theoretical base for applying sequential testing criteria to parallel programs; (7) investigating the applicability of sequential testing criteria to parallel program testing; and (8) dening
test coverage criteria based on control and data ows.
There have been some initiatives to dene testing criteria for shared memory parallel programs [611]. Other works have investigated the detection of race conditions [1214] and mechanisms to replay testing for non-deterministic programs [15,16]. However, few works are found
that investigate the application of the testing coverage criteria and supporting tools in the context
of message-passing parallel programs. For these programs, new aspects need to be considered. For
instance, data-ow information must consider that an association between one variable denition
and one use can occur in different addressing spaces. Because of this different paradigm, the investigation of challenges mentioned above, in the context of message-passing parallel programs,
is not a trivial task and presents some difculties. To overcome these difculties, we present a
family of structural testing criteria for this kind of programs, based on a test model, which includes
their main features, such as synchronization, communication, parallelism and concurrency. Testing
criteria were dened to exploit the control and data ows of these programs, considering their
sequential and parallel aspects. The main contribution of the testing criteria proposed in this paper
is to provide a coverage measure that can be used for evaluating the progress of the testing activity.
This is important to evaluate the quality of test cases as well as to consider that a program has been
tested enough.
The practical application of a testing criterion is possible only if a tool is available. Most existent tools for message-passing parallel programs aid only the simulation, visualization and
1895
debugging [1621]. They do not support the application of testing criteria. To fulll the demand
for tools to support the application of testing criteria in message-passing parallel programming
and to evaluate the proposed criteria, we implemented a tool, called ValiPar, which supports
the application of the proposed testing criteria and offers two basic functionalities: the selection and evaluation of test data. ValiPar is independent of the message-passing environment and
can be congured to different environments and languages. Currently, ValiPar is congured for
PVM and MPI programs, in C language. ValiPar was used in an experiment with MPI programs to evaluate the applicability of the proposed criteria, whose results are presented in this
paper.
The remainder of this paper is organized as follows. In Section 2, we present the basic concepts and
the test model adopted for the denition of the testing criteria. We also introduce the specic criteria
for message-passing programs and show an example of usage. In Section 3, the main functionalities
of ValiPar are presented and some implementation aspects are discussed. In Section 4, the results
of the testing criteria application are presented. In Section 5, related work is presented. Concluding
remarks are presented in Section 6.
1896
S. R. S. SOUZA ET AL.
or receive). The communication primitives are associated with separate nodes and are represented
by the notations send(p,k,t) (respectively, receive(p,k,t)), meaning that the process p
sends (respectively, receives) a message with tag t to (respectively, from) the process k. Note that
the model considers blocking and non-blocking receives, such that all possible interleaving between
sendreceive pairs are represented. The path analysis, described next, permits one to capture the
sendreceive matching during the parallel program execution.
Each CFG p has two special nodes: the entry and exit nodes, which correspond to the rst and
last statements in p, respectively. An edge links a node to another one.
A parallel program Prog is associated with a parallel control-ow graph (PCFG), which is
composed of CFG p (for p = 0 . . . n 1) and of the representation of the communication between
the processes. N and E represent the set of nodes and edges of the PCFG, respectively.
Two subsets of N are dened: Ns and Nr , composed of nodes that are associated with send and
p
p
receive primitives, respectively. With each n i Ns , a set Ri is associated, such that
p
i.e. Ri contains the nodes that can receive a message sent by node n i .
Using the above denitions, we also dene the following sets:
set of inter-processes edges (E s ): contains edges that represent the communication between
two processes, such that
p1
p2
p1
p2
p1
E s = {(n j , n k ) | n j Ns , n k R j }
set of edges (E): contains all edges, such that
E = Es
n1
Ep
p=0
p1
p1
p2
p1
p2
p2
p1
p2
1897
A variable x is dened when a value is stored in the corresponding memory position. Typical
denition statements are assignment and input commands. A variable is also dened when it
is passed as an output parameter (reference) to a function. In the context of message-passing
environments, we need to consider the communication primitives. For instance, the primitive receive
sets one or more variables with the value t received in the message; thus, this is considered a
denition. Therefore, we dene:
def(n p ) = {x | x is dened inn p }
The use of variable x occurs when the value associated with x is referred. The uses can be:
1. a computational use (c-use): occurs in a computation statement, related to a node n p in the
PCFG;
2. a predicate use (p-use): occurs in a condition (predicate) associated with control-ow statements, related to an intra-processes edge (n p , m p ) in the PCFG; and
3. a communication use (s-use): occurs in a communication statement (communication primitives), related to an inter-processes edge (n p1 , m p2 ) E s .
A path = (n 1 , n 2 , . . . , n j , n k ) is denition clear with respect to (w.r.t.) a variable x from node
n 1 to node n k or edge (n j , n k ), if x def(n 1 ) and x def(n i ), for i = 2 . . . j.
/
Similar to traditional testing, we establish pairs composed of denitions and uses of the same
variables to be tested [4]. Three kinds of associations are introduced:
c-use association is dened by a triple (n p , m p , x), such that x def(n p ), m p has a c-use of x
and there is a denition-clear path w.r.t. x from n p to m p .
p-use association is dened by a triple (n p , (m p , k p ), x), such that x def(n p ), (m p , k p ) has a
p-use of x and there is a denition-clear path w.r.t. x from n p to (m p , k p ).
s-use association is dened by a triple (n p1 , (m p1 , k p2 ), x), such that x def(n p1 ), (m p1 , k p2 )
has an s-use of x and there is a denition-clear path w.r.t. x from n p1 to (m p1 , k p2 ).
Note that p-use and c-use associations are intra-processes, i.e. the denition and the use of
x occur in the same process p. These associations are usually required if we apply the traditional testing criteria to each process separately. An s-use association supposes the existence of a
second process and it is an inter-processes association; s-use associations allow the detection of
communication faults (in the use of send and receive primitives). Considering this context, we propose another kind of inter-processes associations to discover communication and synchronization
faults:
sc-use association is given by (n p1 , (m p1 , k p2 ), l p2 , x p1 , x p2 ), where there is an s-use association (n p1 , (m p1 , k p2 ), x p1 ) and a c-use association (k p2 , l p2 , x p2 ).
sp-use association is given by (n p1 , (m p1 , k p2 ), (n p2 , m p2 ), x p1 , x p2 ), where there is an s-use
association (n p1 , (m p1 , k p2 ), x p1 ) and a p-use association (k p2 , (n p2 , m p2 ), x p2 ).
2.2. Structural testing criteria
In this section, we propose two sets of structural testing criteria for message-passing parallel
programs, based on test model and denitions presented in previous section. These criteria allow
the testing of sequential and parallel aspects of the programs.
1898
S. R. S. SOUZA ET AL.
all-nodes-s criterion: The test sets must execute paths that cover all the nodes n i Ns.
p
all-nodes-r criterion: The test sets must execute paths that cover all the nodes n i Nr.
p
all-nodes criterion: The test sets must execute paths that cover all the nodes n i N .
p1
p2
all-edges-s criterion: The test sets must execute paths that cover all the edges (n j , n k ) Es.
all-edges criterion the test sets must execute paths that cover all the edges (n j , n k ) E.
Other criteria could be proposed such as all-paths in the CFG p and in the PCFG (intra- and
inter-processes paths). These criteria generally require an innite number of elements, due to loops
in the program. Thus, in such cases, only loop-free paths should be required or selected.
2.2.2. Testing criteria based on data and message-passing ows
These criteria require associations between denitions and uses of variables. The objective is to
validate the data ow between the processes when a message is passed.
p
all-defs criterion: For each node n i and each x def(n i ), the test set must execute a path that
covers an association (c-use, p-use or s-use) w.r.t. x.
p
p
all-defs-s criterion: For each node n i and each x def(n i ), the test set must execute a path
that covers an inter-processes association (sc-use or s p-use) w.r.t. x. In the case where such
association does not exist, another one should be selected to exercise the denition of x.
all-c-uses criterion: The test set must execute paths that cover all the c-use associations.
all-p-uses criterion: The test set must execute paths that cover all the p-use associations.
all-s-uses criterion: The test set must execute paths that cover all the s-use associations.
all-sc-uses criterion: The test set must execute paths that cover all the sc-use associations.
all-sp-uses criterion: The test set must execute paths that cover all the s p-use associations.
Required elements are the minimal information that must be covered to satisfy a testing criterion.
For instance, the required elements for the criterion all-edges-s are all possible synchronization
between parallel processes. However, satisfying a testing criterion is not always possible, due to
infeasible elements. An element required by a criterion is infeasible if there is no set of values for
the parameters, the input and global variables of the program that executes a path that cover that
element. The determination of infeasible paths is an undecidable problem [22].
Non-determinism is another issue that makes the testing activity difcult. An example is presented
in Figure 1. Suppose that the nodes 81 and 91 in p 1 have non-deterministic receives and in the nodes
20 ( p 0 ) and 22 ( p 2 ) have sends to p 1 . The gure illustrates the possible synchronizations between
these processes. These synchronizations represent correct behavior of the application. Therefore,
during the testing activity it is essential to guarantee that these synchronizations are executed.
p0
p1
p2
1899
p0
p1
Controlled execution is a mechanism used to achieve deterministic execution, i.e. two executions
of the program with the same input are guaranteed to execute the same instruction sequence [15]
(and the same synchronization sequence). This mechanism is implemented in ValiPar tool and is
described in Section 3.
Figure 2 illustrates an example with non-blocking receive. Suppose that the nodes 31 and 71 in p 1
have non-blocking receive. Two synchronization edges are possible, but only one is exercised in each
execution. During the path analysis, it is possible to determine the edges that were covered. This
information is available in path , which is obtained by instrumentation of the parallel program.
This instrumentation is described in Section 3.
2.3. An example
In order to illustrate the introduced denitions, consider the GCD program in PVM (Figure 3),
described in [23]. This program uses four parallel processes ( p m , p 0 , p 1 , p 2 ) to calculate the
maximum common divisor of three numbers. The master process p m (Figure 3(a)) creates the
1900
S. R. S. SOUZA ET AL.
(a)
(b)
Figure 3. GCD program in PVM: (a) master process and (b) slave process.
slave processes p 0 , p 1 and p 2 , which run gcd.c (Figure 3(b)). Each slave waits (blocked receive)
two values sent by p m and calculates the maximum divisor for these values. To nish, the slaves
send the calculated values to p m and terminate their executions. The computation can involve p 0 , p 1
and p 2 or only p 0 and p 1 , depending on the input values. In p m , the receive commands (nodes 4m ,
5m and 8m ) are non-deterministic; thus which message will be received in each receive command
depends on the execution time of each process.
The PCFG is presented in Figure 4. The numbers on the left of the source code (Figure 3) represent
the nodes in the graph. Inter-processes edges are represented by dotted lines. For simplication
reasons, in this gure, only some inter-processes edges (and related s-use) are represented. Table I
p
presents the sets def(n i ). Table II contains the values of all sets introduced in Section 2.1.
In Table III, we present some elements required by the structural testing criteria introduced in
Section 2.2. Test inputs must be generated in order to exercise each possible required element. For
example, considering the test input {x = 1, y = 2, z = 1}, the execution path is = ( m , 0 , 1 , S),
where m = {1m , 2m , 3m , 4m , 5m , 6m , 9m , 10m }, 0 = {10 , 20 , 30 , 40 , 50 , 70 , 30 , 80 , 90 }, 1 ={11 , 21 ,
31 , 41 , 61 , 71 , 31 , 81 , 91 }, S = {(2m , 20 ), (3m , 21 ), (80 , 4m ), (81 , 5m )}. Note that p 2 does not execute
any path because the result has been already produced by p 0 and p 1 . Owing to the receive nondeterministic in nodes 4m and 5m , four synchronization edges will be possible: (80 , 4m ), (80 , 5m ),
(81 , 4m ), (81 , 5m ) and only two of them are exercised for each execution of path
depending
on the execution time ((80 , 4m ) or (80 , 5m ), (81 , 4m ) or (81 , 5m )). In each program execution, it
is necessary to determine the inter-processes edges that were executed. This aspect is related to
the evaluation of the test cases and was considered in the implementation of ValiPar, described in
Section 3.
p0
p1
pm
1
suse(x,y)
3
4
4
suse(x)
suse(y,z)
suse(x)
suse(x)
5
7
suse(x)
1901
p2
suse(x,y)
10
3
suse(x)
4
6
5
7
8
9
def(10 ) = {tid}
def(20 ) = {x, y}
def(50 ) = {y}
def(60 ) = {x}
def(11 ) = {tid}
def(21 ) = {x, y}
def(51 ) = {y}
def(61 ) = {x}
def(12 ) = {tid}
def(22 ) = {x, y}
def(52 ) = {y}
def(62 ) = {x}
1902
S. R. S. SOUZA ET AL.
E = Ei Es
E im = {(1m , 2m ), (2m , 3m ), (3m , 4m ), (4m , 5m ), (5m , 6m ), (6m , 7m ),
(7m , 8m ), (8m , 10m ), (6m , 9m ), (9m , 10m )}
E i0 = {(10 , 20 ), (20 , 30 ), (30 , 40 ), (40 , 50 ), (40 , 60 ), (50 , 70 ), (60 , 70 ),
(70 , 30 ), (30 , 80 ), (80 , 90 )}
E i1 = {(11 , 21 ), (21 , 31 ), (31 , 41 ), (41 , 51 ), (41 , 61 ), (51 , 71 ), (61 , 71 ),
(71 , 31 ), (31 , 81 ), (81 , 91 )}
E i2 = {(12 , 22 ), (22 , 32 ), (32 , 42 ), (42 , 52 ), (42 , 62 ), (52 , 72 ), (62 , 72 ),
(72 , 32 ), (32 , 82 ), (82 , 92 )}
E s = {(2m , 20 ), (2m , 21 ), (2m , 22 ), (3m , 20 ), (3m , 21 ), (3m , 22 ), (7m , 20 ),
(7m , 21 ), (7m , 22 ), (80 , 4m ), (80 , 5m ), (80 , 8m ), (81 , 4m ), (81 , 5m ), (81 , 8m ),
(82 , 4m ), (82 , 5m ), (82 , 8m )}
Krawczyk and Wiszniewski [23], which describe typical faults in traditional and parallel programs,
respectively.
Howden [24] introduces two types of faults in traditional programs: computation and domain
faults. The rst one occurs when the result of a computation for an input of the program domain
is different from the expected result. The second one occurs when a path that is different from
the expected one is executed. For example, in the process slave (gcd.c), replacing the command of
node 51 y = y x by the incorrect command y = y + x corresponds to a computation fault. A
domain fault can be illustrated by changing the predicate (x<y) in edge (41 , 51 ) by the incorrect
predicate (x>y), taking a different path during the execution. These faults are revealed by applying
traditional criteria, all-edges, all-nodes, etc., and testing each CFG separately. Executing the test
input {x = 1, y = 2, z = 1} the node 51 is covered and the rst fault is revealed. Considering the
second fault, the test input {x = 2, y = 3, z = 2} executes a path that covers the edge (41 , 51 ) and
reveals the fault. For both inputs, the program executes the loop of node 3 (gcd.c) forever, and a
failure is produced. These situations illustrate the importance of investigating the application of
criteria for sequential testing in parallel software.
In the context of parallel programs, a computation fault can be related to a communication fault.
To illustrate this fact, consider that in slave process (Figure 3(b)) the variable y is mistakenly
1903
Table III. Some elements required by the proposed testing criteria for GCD program.
all-nodes-s
all-nodes-r
all-nodes
all-edges-s
all-edges
all-defs
all-defs-s
all-c-uses
all- p-uses
all-s-uses
all-sc-uses
all-s p-uses
2m , 3 m , 7 m , 8 0 , 8 1 , 8 2
4m , 5 m , 8 m , 2 0 , 2 1 , 2 2
1 m , 2m , 3m , 4m , 5m , 6m , 7m , 8m , 9m , . . . , 10 , 20 , 30 , . . . , 11 , 21 , 31 , . . .
(2m , 20 ), (2m , 21 ), (2m , 22 ), (3m , 20 ), (3m , 21 ), (3m , 22 ), (7m , 22 ), (80 , 4m ), (80 , 5m ),
(80 , 8m ), (81 , 4m ), (81 , 5m ), (81 , 8m ), 82 , 4m ), (82 , 5m ), (82 , 8m ) . . .
(1m , 2m ), (2m , 3m ), . . . , (10 , 20 ), (20 , 30 ), . . . , (11 , 21 ), (21 , 31 ), . . . (2m , 20 ), (2m , 21 ) . . .
(8m , 10m , z), (20 , 50 , x), (20 , 60 , x), (20 , (30 , 40 ), x), (20 , 60 , y) . . .
(1m , (2m , 20 ), 50 , x, x), (1m , (2m , 20 ), 60 , y, y),
(1m , (2m , 20 ), (40 , 50 ), y, y), (1m , (3m , 20 ), 50 , z, y), . . .
(1m , 10m , z), (8m , 10m , z), (20 , 80 , x) . . .
(4m , (6m , 7m ), x), (4m , (6m , 9m ), x), (5m , (6m , 7m ), y),
(5m , (6m , 9m ), y), (20 , (30 , 40 ), x), (20 , (30 , 80 ), y) . . .
(1m , (2m , 20 ), x, y), (1m , (2m , 21 ), x, y), (1m , (3m , 20 ), y, z),
(4m , (7m , 22 ), x), (5m , (7m , 20 ), y), (5m , (7m , 21 ), y), . . .
(1m , (2m , 20 ), 50 , x, x), (1m , (2m , 20 ), 60 , x, x), (1m , (2m , 20 ), 50 , y, y),
(1m , (2m , 20 ), 60 , y, y), (1m , (2m , 21 ), 61 , x, x),
(1m , (3m , 21 ), 61 , x, x), (20 , (80 , 8m ), 10m , x, z), . . .
(1m , (2m , 20 ), (30 , 40 ), x, x), (1m , (2m , 20 ), (30 , 80 ), x, x),
(1m , (2m , 20 ), (40 , 50 ), x, x), (1m , (3m , 20 ), (30 , 40 ), z, y),
(5m , (7m , 20 ), (30 , 40 ), y, x), (20 , (80 , 4m ), (6m , 7m ), x, y), . . .
1904
S. R. S. SOUZA ET AL.
from p 1 . However, this fault makes the node 8m to receive the message from 81 instead of the
message from 82 . This fault can be revealed by the all-s-uses criterion. To cover the s-use association (62 , (82 , 8m ), x), the tester has to provide a test input that executes the slave process
p 2 , for instance, {x = 3, y = 9, z = 4}. The expected output (1) is obtained, but the s-use association is not covered (due to the fault related to the non-blocking receive). This test case did not
reveal the fault, but it indicated an unexpected path. The tester must try to select a test input
that covers the s-use association. The test input {x = 7, y = 14, z = 28} covers the association and
also produces an unexpected output. The tester can conclude that the program has a fault. ValiPar (discussed in Section 3) provides support in this case, allowing the analysis of the execution
trace. By analyzing the execution trace, the tester can observe that a wrong matching point was
reached.
This fault is related to non-determinism and the occurrence of the illustrated matching points is
not guaranteed. For example, if the slave process p 1 is fast enough to execute, the sent message
reaches the node 5m and the fault will not be observed. Notwithstanding, the synchronizations
illustrated previously are more probable, considering the order of the processes creation.
A special type of the locking error is deadlock [25], a classical problem in parallel programs.
Ideally, it must be detected before the parallel program execution. It is not the focus of the testing
criteria proposed in this work; nonetheless, the information extracted from the parallel programs
during the application of the coverage criteria may be used to statically detect deadlock situations.
1905
Parallel
Program
Test Output
Test Data
Selected Test
Criterion
ValiInst
Instrumented
Program
Executed
Path
ValiExec
ValiEval
Required
Elements
Data Flow
Information
ValiElem
Descriptors
Coverage
Results
PCFG
graph(i)
Reduced graphs
be instanced for different languages. In the context of this work, the instantiation of IDeL for C
language was used and it was extended to treat specic aspects of PVM and MPI.
The PCFG is generated with information about nodes, edges, denitions and uses of variables
in the nodes, as well as the presence of send and receive primitives . In this version of ValiPar the
primitives for collective communication were not implemented. They need to be mapped in terms
of send and receive basics.
This information set is generated for each process. The idelgen accomplishes the syntactic
and semantic analysis of the program, according to the grammar of a given language, extracting
the necessary information for instrumentation. The instrumented program is obtained by inserting
check-point statements in the program being tested. These statements do not change the program
semantics. They only write necessary information in a trace le, by registering the node and the
process identier in the send and receive commands. The instrumented program will produce the
paths executed in each process, as well as the synchronization sequence produced within a test
case.
The following primitives were considered. For MPI: MPI send(), MPI Isend(), MPI recv() and MPI Irecv(); for PVM:
1906
S. R. S. SOUZA ET AL.
3.2. ValiElem
The ValiElem module generates the required elements by the coverage testing criteria dened in
this paper. These elements are generated from PCFGs and data-ow information, generated by
ValiInst. For that purpose, two other graphs are used: the heirs reduced graph, proposed by Chusho
[28], and the graph(i), used by the testing tool Poketool [29].
In a reduced graph of heirs, all the branches are primitive. The algorithm is based on the fact that
there are edges inside a PCFG, which are always executed when another one is executed. If each
complete path that includes the edge a also includes the edge b, then b is called heir of a, and a is
called ancestral of b, because b inherits information about execution of a. In other words, an edge
that is always executed when another one is executed is called heir edge. An edge is called primitive,
if it is not heir of any other one. ValiPar adapted the algorithm for the parallel programs context.
The concept of synchronization edge was included to the concept of primitive edge. Minimizing
the number of edges required by ValiPar is possible by the use of both concepts.
A graph(i) is built for each node that contains a variable denition. The purpose of this is to
p
obtain all denition-clear paths w.r.t. a variable x def(n i ). Hence, a given node k will belong to a
graph(i) if at least one path from i to k exists and this path does not redene at least one variable x,
dened in i. A node k can generate several different images in the graph because just one graph(i)
is built for all dened variables in node i. However, the paths in the graph(i) are simple. To do this
and to avoid innite paths, caused by the existence of loops in the CFG, in the same path of the
graph(i) only a node can contain more than one image, and its image is the last node of the path.
The graph(i) is used to establish associations between denitions and uses of variables, generating
the elements required by the data-ow testing criteria introduced in Section 2.
For each required element, ValiElem also produces a descriptor, which is a regular expression
that describes a path that exercises a required element. For instance, the descriptor for the elements
required by all-nodes criterion is given by the expression:
p
N ni N
p
where N is the set of nodes in CFG p . A required node n i will be exercised by the path p , if
p includes n . In the same way, a regular expression is dened for each element required by all
i
testing criteria.
The descriptor describes all the paths in the graph that exercise the corresponding element and
is used by ValiEval module. Figure 6 shows the required elements generated for the all-edges-s
criterion, considering the program in Figure 3
Note that, in this section, we follow the notation that is adopted in the tool. For instance, 20
means node 2 in process 0. Moreover, the master process is always represented by process 0 and
the slave processes are appropriately named 1, 2, 3, . . . and so on.
3.3. ValiExec
ValiExec executes the instrumented program with the test data provided by the user. A script is
used to initialize the message-passing environment before parallel program execution. ValiExec
stores the test case, the execution parameters and the respective execution trace. The execution
1907
trace includes the executed path of each parallel process, as well as the synchronization sequences.
It will be used by ValiEval to determine the elements that were covered.
After the execution, the tester can visualize the outputs and the execution trace to determine
whether the obtained output is the same as that expected. If it is not, a fault was identied and may
be corrected before continuing the test.
A trace of a parallel process is represented by a sequence of nodes executed in this process. A
a
synchronization from n i to m b is represented at the trace of the sender process of the message
j
a
a
a a
by the sequence n i1 n i m b n i n i+1 . Note that process a is unable to know to which node j
j
of process b the message was sent. The same synchronization is represented at the trace of the
a
receiver process by the sequence m b m b n i m b m b . In this way, it is possible to determine
j
j
j1
j+1
a , m b ) was covered. The produced traces are used to evaluate
whether the inter-processes edge (n i
j
the test cases and they provide a way for debugging the program. To illustrate, Figure 7 shows the
traces generated for GCD program, executed with the test input: {x = 1, y = 3, z = 5}. For this test,
process 3 was not executed.
ValiExec also enables the controlled execution of the parallel program under test. This feature
is useful for replaying the test activity. Controlled execution guarantees that two executions of the
parallel program with the same input will produce the same paths and the same synchronization
sequences. The implementation of controlled execution is based on the work of Carver and Tai [15],
adapted to message-passing programs. Synchronization sequences of each process are gathered in
runtime by the instrumented check-points of blocking and non-blocking sends and receives. The
latter is also subject to non-determinism; hence, each request is associated with the number of
times it has been evaluated. This information and other program inputs are used to achieve the
deterministic execution and, thus, to allow test case replay.
1908
S. R. S. SOUZA ET AL.
3.4. ValiEval
ValiEval evaluates the coverage obtained by a test case set w.r.t. a given criterion. ValiEval uses
the descriptors, the required elements generated by ValiElem and the paths executed by the test
cases to verify which elements required for a given testing criterion are exercised. The module
implements the automata associated with the descriptors. Thus, a required element is covered if
an executed path is recognized by its corresponding automaton. The coverage score (percentage of
covered elements) and the list of covered and not covered elements for the selected test criterion
is provided as output. Figure 8 shows this information considering the all-edges-s criterion and
the GCD program (Figure 3). These results were generated after the execution of test inputs in
Figure 9.
1909
In some cases, the existence of infeasible elements does not allow a 100% coverage of a criterion.
The determination of infeasible elements is an undecidable problem [22]. Because of this, the tester
has to manually determine the infeasibility of the paths and required elements.
2. Test data evaluation with ValiPar: Suppose that the tester has a test set T and wishes to know
how good it is, considering a particular testing criterion. Another possible scenario is that the tester
wishes to compare two test sets T1 and T2 . The coverage w.r.t. a testing criterion can be used in
both cases. The tester can use ValiPar in the following way:
(a) Execute the program with all test cases of T (or T1 and T2 ) to generate the execution traces
or executed paths.
(b) Select a testing criterion and evaluate the coverage of T (or the coverage of T1 and T2 ).
(c) If the coverage obtained is not the expected, the tester can improve this coverage by generating
new test data.
(d) To compare sets T1 and T2 , the tester can proceed as before, creating a test session for each
test set and then comparing the coverage obtained. The greater the coverage obtained, the
better the test set.
Note that these procedures are not exclusive. If an ad hoc test set is available, it can be evaluated
according to Procedure 2. If the obtained coverage is not adequate, this set can be improved by
using Procedure 1. The use of such an initial test set allows effort reduction in the application of the
criteria. In this way, our criteria can be considered complementary to ad hoc approaches. They can
improve the efcacy of the test cases generated by ad hoc strategies and offer a coverage measure
to evaluate them. This measure can be used to know whether a program has been tested enough
and to stop testing.
1910
S. R. S. SOUZA ET AL.
number of required elements. Although this issue would need a broader range of studies to achieve
statistically signicant results, the current work provides evidences of the applicability of the testing
criteria proposed herein.
Five programs implemented in MPI were used: (1) gcd, which calculates the greatest common divisor of three numbers (example used in Figure 4); (2) phil, which implements the dining
philosophers problem (ve philosophers); (3) prod-cons, which implements a multiple-producer
single-consumer problem; (4) matrix, which implements multiplication of matrix; (5) jacobi, which
implements the iterative method of the GaussJacobi for solving a linear system of equations. These
programs represent concurrent-programming classical problems. Table IV shows the complexity
of the programs, in terms of the number of parallel processes and the number of receive and send
commands.
For each program, an initial test set (Ti ) was randomly generated. Then, Ti was submitted to
ValiPar (version MPI) and an initial coverage was obtained for all the criteria. After this, additional
test cases (Ta ) were generated to cover the elements required by each criterion and not covered
by Ti . The nal coverage was then obtained. In this step, the infeasible elements were detected
with support of the controlled execution. Table V presents the number of covered and infeasible
elements for the testing criteria. The adequate set was obtained from Ti Ta by taking only the test
cases that really contributed to cover elements in the executed order. The size of the adequate sets
is presented in Table VI.
Processes
Sends
Receives
gcd
phil
prod-cons
matrix
jacobi
4
6
4
4
4
7
36
3
36
23
7
11
2
36
31
Table V. Number of covered and infeasible elements for the case studies.
Covered elements/infeasible elements
Testing criteria
all-nodes
all-nodes-r
all-nodes-s
all-edges
all-edges-s
all-c-uses
all- p-uses
all-s-uses
gcd
phil
prod-cons
matrix
jacobi
62/0
7/0
7/0
41/20
30/20
29/0
40/0
66/47
176/0
11/0
36/0
356/280
325/280
50/0
148/27
335/280
60/0
2/0
3/0
21/0
6/0
43/2
42/2
6/0
368/200
36/15
36/21
1032/982
972/945
572/337
304/206
1404/1375
499/19
31/2
23/2
652/499
531/492
608/77
514/118
768/729
1911
gcd
phil
prod-cons
matrix
jacobi
all-nodes
all-nodes-r
all-nodes-s
all-edges
all-edges-s
all-c-uses
all- p-uses
all-s-uses
6
2
2
3
3
6
9
10
2
1
2
2
2
2
4
2
2
2
1
2
2
2
3
2
2
1
1
2
1
2
2
3
7
3
3
7
3
9
9
6
By analyzing the results, we observe that the criteria are applicable. In spite of the great number
of required elements for the programs phil, matrix and jacobi, the number of test cases does not
grow proportionally. The size of the adequate test sets is small.
In fact, some effort is necessary to identify infeasible elements. In this study, the controlled
execution was used to aid in the identication of the infeasible elements. A good strategy is to
analyze the required elements to decide infeasibility only when the addition of new test cases does
not contribute to improve coverage. In this case, paths are identied to cover the remaining elements
and, if possible, specic test cases are generated. Other strategy is to use infeasible patterns for
classication of the paths. Infeasible patterns are structures composed of sequence of nodes with
inconsistent conditions [30]. The use of patterns is an important mechanism to identify infeasibility
in traditional programs. If a path contains such patterns it will be infeasible. In order to reduce
the problem of infeasible paths, we intend to implement in ValiPar a mechanism for automatically
discarding infeasible paths according to a pattern provided by the tester.
We observed, in the results of the experiment, that many infeasible elements are related to the
s-uses (all-edges-s and all-s-uses criteria). This situation occurs because we adopted a conservative
position by generating all the possible inter-processes edges, even when the communication may
not be possible in the practice. This was adopted with the objective of revealing faults related to
missing communications. We are now implementing a mechanism to disable the generation of all
the combinations, if desired by the tester. Another idea is to generate all possible communication
uses (s-uses) during the static analysis and, during the program execution, to obtain which s-uses
tried to synchronize (race situation). These s-uses that participate in the race have high probability
of being feasible; otherwise, s-uses have major probability of being infeasible. This investigation
is inspired on the work of Damodaran-Kamal and Francioni [16].
5. RELATED WORK
Motivated by the fact that traditional testing techniques are not adequate for testing features of
concurrent/parallel programming, such as non-determinism and concurrency, many researchers
have developed specic testing techniques addressing these issues.
1912
S. R. S. SOUZA ET AL.
Lei and Carver [14] present a method that guarantees that every partially ordered synchronization will be exercised exactly once without saving any sequences that have already been
exercised. The method is based on the reachability testing. By denition, the approach avoids
generation of unreachable testing requirements. Their method is complementary to our approach.
On the one hand, the authors employ a reachability schema to calculate the synchronization sequence automatically. They do not address how to select the test case which will be used for
the rst run. On the other hand, we use the static analysis of the program to indicate the test
cases that are worth selecting. Therefore, the coverage metrics we proposed can be used to
derive the test case suite that will be input to the reachability-based testing, as argued by the
authors.
Wong et al. [31] propose a set of methods to generate test sequences for structural testing of
concurrent programs. The reachability graph is used to represent the concurrent program and to
select test sequences to the all-node and all-edge criteria. The methods aim the generation of a
small test sequences set that covers all the nodes and the edges in a reachability graph. For this,
the methods provide information about which parts of the program should be covered rst to
effectively increase the coverage of these criteria. The authors stress that the major advantage of the
reachability graph is that only feasible paths are generated. However, the authors do not explain how
to generate the reachability graph from the concurrent program or how to deal with the state space
explosion.
Yang and Chung [11] introduce the path analysis testing of concurrent programs. Given a program,
two models are proposed: (1) task ow graph, which corresponds to the syntactical view of the task
execution behavior and models the task control ow, and (2) rendezvous graph, which corresponds
to the runtime view and models the possible rendezvous sequences among tasks. An execution of
the program will traverse one concurrent path of the rendezvous graph (C-route) and one concurrent
path of the ow graph (C-path). A method called controlled execution to support the debugging
activity of concurrent programs is presented. They pointed out three research issues to be addressed
to make their approach practical: C-path selection, test generation and test execution.
Taylor et al. [8] propose a set of structural coverage criteria for concurrent programs based
on the notion of concurrent states and on the concurrency graph. Five criteria are dened: allconcurrency-paths, all-proper-cc-histories, all-edges-between-cc-states, all-cc-states and allpossible-rendezvous. The hierarchy (subsumption relation) among these criteria is analyzed. They
stress that every approach based on reachability analysis would be limited in practice by state space
explosion. They mentioned some alternatives to overcome the associated constraints.
In the same vein of Taylor and colleagues work, Chung et al. [6] propose four testing criteria
for Ada programs: all-entry-call, all-possible-entry-acceptance, all-entry-call-permutation and allentry-call-dependency-permutation. These criteria focus the rendezvous among tasks. They also
present the hierarchy among these criteria.
Edelstein et al. [12,13] present a multi-threaded bug detection architecture called ConTest for
Java programs. This architecture combines a replay algorithm with a seeding technique, where
the coverage is specic to race conditions. The seeding technique seeds the program with sleep
statements at shared memory access and synchronization events and heuristics are used to decide
when a sleep statement must be activated. The replay algorithm is used to re-execute a test when
race conditions are detected, ensuring that all accesses in race will be executed. The focus of the
work is the non-determinism problem, not dealing with code coverage and testing criteria.
1913
Yang et al. [9,10] extend the data-ow criteria [4] to shared memory parallel programs. The
parallel program model used consists of multiple threads of control that can be executed simultaneously. A parallel program-ow graph is constructed and is traversed to obtain the paths, variable
denitions and uses. All paths that have denition and use of variables related with parallelism of
threads constitute test requirements to be exercised. The Della Pasta Tool (Delaware Parallel Software Testing Aid) automates their approach. The authors presented the foundations and theoretical
results for structural testing of parallel programs, with denition of the all-du-path and all-uses criteria for shared memory programs. This work inspired the test model denition for message-passing
parallel programs, described in Section 2.
The previous works stress the relevance of providing coverage measures for concurrent and
parallel programs, considering essentially shared memory parallel programs. They do not address
coverage criteria that consider the main features of the message-passing programs. Our work is
based on the works mentioned above, but differently we explore control and data-ow concepts to
introduce criteria specic for the message-passing environment paradigm and describe a supporting
tool.
A related, but orthogonal, approach to testing is the use of model checking methods to provide
evidences of the correctness of an algorithm, by suitably exploring the state space of all possible executions [32]. Improvements in model checking theory and algorithms allow handling huge
state space. When effectively done, model checking can provide a slightly stronger assertion on
the correctness of parallel programs than testing with selected test cases. There exist some initiatives of model checking of parallel programs [3336]. These approaches suffer from several
drawbacks, though. Firstly, the program cannot usually be model-checked directly, requiring instead the conversion into a suitable model. This conversion is rarely automated and must be made
manually [36]. However, in this case, it is the correction of the model that is analyzed, not of
the actual program. It remains to be demonstrated that the model correctly represents the program. Sometimes, the model is difcult to obtain, since important primitives of parallel program
may not be directly represented in the model. This problem has been recently tackled in [34],
where an extension to the model checker SPIN, called MPI-SPIN, is proposed. Although the gap
between the program and the model is reduced, a direct translation is far from being feasible.
Another drawback of model checking is the awkward handling of user inputs. There exist some
approaches that use symbolic execution in order to represent all possible user inputs symbolically,
e.g. [33]. Nonetheless, symbolic execution is a long-term research topic and brings its own problems, since the expression obtained along the paths grows intractable. Then, even if model checking
is used in the verication of some model of the program, the testing of the program is still important, and the problem of measuring the quality of the test cases used to test the program still
remains.
In relation to parallel testing tools, most tools available aid only the simulation, visualization and
debugging; they do not support the application of testing criteria. Examples of these tools are TDC
Ada [20] and ConAn [19], respectively, for ADA and Java. For message-passing environments,
we can mention Xab [17], Visit [18] and MDB [16] for PVM, and XMPI [37] and Umpire [21]
for MPI.
When we consider testing criteria support, we can mention the tool Della Pasta [9], based on
threads, and the tool STEPS [38]. This last one works with PVM programs and generates paths
to cover some elements in the control-ow graphs of PVM programs. We could not nd in the
1914
S. R. S. SOUZA ET AL.
Data ow
TDC Ada
ConAn
Della Pasta
Xab
Visit
MDB
STEPS
Astral
XMPI
Umpire
ValiPar
Control ow
Test replay
Debug
Language
Ada
Java
C
PVM
PVM
PVM
PVM
PVM
MPI
MPI
PVM and MPI
literature a tool, which implements criteria based on control, data and communication ows, as
the one presented in this paper. Table VII shows the main facilities of ValiPar, compared with the
existing tools.
6. CONCLUDING REMARKS
Testing parallel programs is not a trivial task. As mentioned previously, to perform this activity
some problems need to be investigated. This paper contributes in this direction by addressing some
of them in the context of message-passing programs: denition of a model to capture relevant
control and data-ow information and to statically generate the corresponding graph; proposition
of specic testing coverage criteria; development of a tool to support the proposed criteria, as well
as, sequential testing; implementation of mechanisms to reproduce a test execution and to force the
execution of a given path in the presence of non-determinism; and evaluation of the criteria and
investigation of the applicability of the criteria.
The proposed testing criteria are based on models of control and data ows and include the
main features of the most used message-passing environments. The model considers communication, concurrency and synchronization faults between parallel processes and also fault related to
sequential aspects of each process.
The use of the proposed criteria contributes to improve the quality of the test cases. The criteria
offer a coverage measure that can be used in two testing procedures. The rst one for the generation
of test cases, where these criteria can be used as guideline for test data selection. The second one
is related to the evaluation of a test set. The criteria can be used to determine when the testing
activity can be ended and also to compare test sets. This work also showed that the testing criteria
can contribute to reveal important faults related with parallel programs.
The paper described ValiPar, a tool that supports the proposed criteria. ValiPar is independent
of the message-passing environment and is currently congured for PVM (ValiPVM) and MPI
(ValiMPI). These versions are congured for language C. We intend to congure other versions of
ValiPar, considering others languages used for message-passing parallel programs, e.g. Fortran.
1915
Non-determinism is very common in parallel programs and causes problems for validation
activity. To minimize these problems, we implemented in ValiPar mechanisms to permit controlled execution of parallel programs. With these mechanisms, synchronization sequences can be
re-executed, repeating the test and, thus, contributing for the revalidation and regression testing of
the parallel programs.
Using the MPI version of ValiPar, we carried out a case study that showed the applicability
of the proposed criteria. The results showed a great number of required elements mainly for the
communication-ow-based criteria. This should be evaluated in future experiments and some renements may be proposed to the criteria. We intend to conduct other experiments to explore efcacy
aspects to propose changes in the way of generating the required elements and to avoid a large
number of infeasible ones.
The advantage of our coverage criteria, comparing with another techniques for testing parallel
programs, is to systematize the testing activity. In fact, there exists an amount of cost and time
associated with the application of the coverage criteria. However, the criteria provide a coverage
measure that can be used to assess the quality of the tests conducted. In the case of critical applications, this evaluation is fundamental. In addition, ValiPar reduces this cost, by automating most
of the activities related on parallel program testing.
The evolution of our work on this subject is directed to several lines of research: (1) development
of experiments to rene and evaluate the testing criteria; (2) use of ValiPar for real and more
complex parallel programs; (3) implementation of mechanisms to validate parallel programs that
dynamically create processes and other ones to help the tester in identifying infeasible elements;
(4) conduction of an experiment to evaluate the efcacy of the generated test data against ad hoc
test sets; and (5) denition of a strategy that synergistically combines model checking methods and
the testing criteria.
ACKNOWLEDGEMENTS
The authors would like to thank the anonymous referees for their helpful comments and Felipe Santos Sarmanho
for his assistance in the experiments. This work was supported by Brazilian funding agency CNPq, under Process
number 552213/2002-0.
REFERENCES
1. Almasi GS, Gottlieb A. Highly Parallel Computing (2nd edn). The Benjamin Cummings Publishing Company: Menlo
Park, CA, 1994.
2. Geist GA, Kohl JA, Papadopoulos PM, Scott SL. Beyond PVM 3.4: What weve learned whats next, and why. Fourth
European PVMMPI ConferenceEuro PVM/MPI97, Cracow, Poland, 1997; 116126.
3. Snir M, Otto S, Steven H, Walker D, Dongarra J. MPI: The complete reference. Technical Report, MIT Press, Cambridge,
MA, 1996.
4. Rapps S, Weyuker EJ. Selecting software test data using data ow information. IEEE Transactions on Software Engineering
1985; 11(4):367375.
5. Yang C-SD. Program-based, structural testing of shared memory parallel programs. PhD Thesis, University of Delaware,
1999.
6. Chung C-M, Shih TK, Wang Y-H, Lin W-C, Kou Y-F. Task decomposition testing and metrics for concurrent programs.
Fifth International Symposium on Software Reliability Engineering (ISSRE96), 1996; 122130.
7. Koppol PV, Carver RH, Tai K-C. Incremental integration testing of concurrent programs. IEEE Transactions on Software
Engineering 2002; 28(6):607623.
1916
S. R. S. SOUZA ET AL.
8. Taylor RN, Levine DL, Kelly C. Structural testing of concurrent programs. IEEE Transactions on Software Engineering
1992; 18(3):206215.
9. Yang C-S, Souter AL, Pollock LL. All-du-path coverage for parallel programs. International Symposium on Software
Testing and Analysis (ISSTA98), ACM-Software Engineering Notes, 1998; 153162.
10. Yang C-SD, Pollock LL. All-uses testing of shared memory parallel programs. Software Testing, Verication and
Reliability (STVR) 2003; 13(1):324.
11. Yang R-D, Chung C-G. Path analysis testing of concurrent programs. Information and Software Technology 1992; 34(1).
12. Edelstein O, Farchi E, Goldin E, Nir Y, Ratsaby G, Ur S. Framework for testing multi-threaded java programs.
Concurrency and Computation: Practice and Experience 2003; 15(35):485499.
13. Edelstein O, Farchi E, Nir Y, Ratsaby G, Ur S. Multithreaded java program test generation. IBM System Journal 2002;
41(1):111125.
14. Lei Y, Carver RH. Reachability testing of concurrent programs. IEEE Transactions on Software Engineering 2006;
32(6):382403.
15. Carver RH, Tai K-C. Replay sand testing for concurrent programs. IEEE Software 1991; 6674.
16. Damodaran-Kamal SK, Francioni JM. Nondeterminacy: Testing and debugging in message passing parallel programs.
Third ACM/ONR Workshop on Parallel and Distributed Debugging. ACM Press: New York, 1993; 118128.
17. Beguelin AL. XAB: A tool for monitoring PVM programs. Workshop on Heterogeneous ProcessingWHP03. IEEE
Press: New York, April 1993; 9297.
18. Ilmberger H, Th rmel S, Wiedemann CP. Visit: A visualization and control environment for parallel program debugging.
u
Proceedings of the 3rd ACM/ONR Workshop on Parallel and Distributed Debugging, May 1993; 199201.
19. Long B, Hoffman D, Strooper P. Tool support for testing concurrent java components. IEEE Transactions on Software
Engineering 2003; 29(6):555565.
20. Tai KX, Carver RH, Obaid EE. Debugging concurrent ada programs by deterministic execution. IEEE Transactions on
Software Engineering 1991; 17(1):4563.
21. Vetter JS, Supinski BR. Dynamic software testing of MPI applications with Umpire. Proceedings of the 2000 ACM/IEEE
Conference on Supercomputing. IEEE Press (electronic publication): New York, 2000.
22. Frankl FG, Weyuker EJ. Data ow testing in the presence of unexecutable paths. Workshop on Software Testing, Banff,
Canada, July 1986; 413.
23. Krawczyk H, Wiszniewski B. Classication of software defects in parallel programs. Technical Report 2, Faculty of
Electronics, Technical University of Gdansk, Poland, 1994.
24. Howden WE. Reliability of the path analysis testing strategy. IEEE Transactions on Software Engineering 1976;
2:208215.
25. Tanenbaum AS. Modern Operating Systems (2nd edn). Prentice-Hall: Englewood Cliffs, NJ, 2001.
26. Souza SRS, Vergilio SR, Souza PSL, Sim o AS, Bliscosque TG, Lima AM, Hausen AC. Valipar: A testing tool
a
for message-passing parallel programs. International Conference on Software Knowledge and Software Engineering
(SEKE05), Taipei, Taiwan, 2005; 386391.
27. Sim o AS, Vincenzi AMR, Maldonado JC, Santana ACL. A language for the description of program instrumentation
a
and the automatic generation of instrumenters. CLEI Electronic Journal 2003; 6(1).
28. Chusho T. Test data selection and quality estimation based on concept of essential branches for path testing. IEEE
Transactions on Software Engineering 1987; 13(5):509517.
29. Chaim MJ. Poketooluma ferramenta para suporte ao teste estrutural de programas baseados em anlise de uxo de
dados. Masters Thesis, DCA/FEE/UNICAMP, Campinas, SP, 1991.
30. Vergilio SR, Maldonado JC, Jino M. Infeasible paths in the context of data ow based testing criteria: Identication,
classication and prediction. Journal of the Brazilian Computer Society 2006; 12(1).
31. Wong WE, Lei Y, Ma X. Effective generation of test sequences for structural testing of concurrent programs. Tenth
IEEE International Conference on Engineering of Complex Systems (ICECCS05), 2005; 539548.
32. Clarke EM, Emerson EA, Sistla AP. Automatic verication of nite-state concurrent systems using temporal logic
specications. ACM Transactions on Programming Languages and Systems 1986; 8(2):244263.
33. Siegel SF, Mironova A, Avrunin GS, Clarke LA. Using model checking with symbolic execution to verify parallel
numerical program. International Symposium on Software Testing and Analysis, 2006; 157167.
34. Siegel SF. Model checking nonblocking MPI programs. Verication, Model Checking and Abstract Interpretation (Lecture
Notes in Computer Science, vol. 4349). Springer: Berlin, 2007; 4458.
35. Matlin OS, Lusk E, McCune W. Spinning parallel systems software. SPIN (Lecture Notes in Computer Science, vol. 2318).
Springer: Berlin, 2002; 213220.
36. Pervez S, Gopalakrisman G, Kirby RM, Thakur R, Gropp W. Formal verication of programs that use mpi one-sided
communication. PVM/MPI (Lecture Notes in Computer Science, vol. 4192). Springer: Berlin, 2006; 3039.
37. The LAM/MPI Team. XMPI. Open Systems Laboratory, Indiana University, Bloomington, IN.
38. Krawczyk H, Kuzora P, Neyman M, Procz J, Wiszniewski B. STEPSA tool for testing PVM programs. Third SEIHPC
Workshop, January 1998. Available at:.
Apndice G
A. S. Simo, J. C. Maldonado and R. S. Bigonha. A
Transformational Language for Mutant Description.
Computer Languages, Systems & Structures, v. 35,
p. 322-339, 2009.
140
Departamento de Sistemas de Computao, Instituto de Cincias Matemticas e de Computao, Universidade de So Paulo, Av. Trabalhador So-carlense, 400 - Centro,
P.O. Box: 668, ZIP: 13560-970 So Carlos, SP, Brazil
b
Departamento de Computao, Universidade Federal de Minas Gerais, Brazil
A R T I C L E
I N F O
Article history:
Received 9 December 2006
Accepted 29 October 2008
Keywords:
Mutation testing
Transformation languages
Logical languages
Software testing
Prototyping
A B S T R A C languagenamed MuD MuDeL language. We also describe
a systemnamed mudelgendeveloped.
1. Introduction
Originally, mutation testing [1,2] is a testing approach to assess the quality of a test case suite in revealing some specific
classes of faults, and can be classified as a fault-based testing technique. Although it was originally proposed for program testing
[2], several researchers have applied its underlying concepts in a variety of other contexts, testing different kinds of artifacts,
e.g., specifications [37], protocols testing [8] and network security models [9]. Moreover, mutation testing has been employed
as a useful mechanism to improve statistical validity when testing criteria are compared, such as in [10].
The main idea behind mutation testing is to use a set of alternative artifacts (the so-called mutants) of the artifact under
testing (the original artifact) to evaluate test case sets. These mutants are generated from the original artifact by introducing
simple syntactical changes and, thus, inducing specific faults. Usually, only a simple modification is made in the original artifact.
The resulting mutants are the so-called 1-order mutants [11]. A k-order mutant can be thought of as a mutant in which several
1-order mutations were applied [12]. The ability of a test case suite in revealing these faults is checked by running the mutants
and comparing their results against the result of the original artifact for the same test cases.
The faults considered to generate the mutants are based upon knowledge about errors that typically occur during software
development and can be associated to a fault model. In the mutation testing approach, the fault model is embedded in the mutant
operators [13]. A mutant operator can be thought of as a function that takes an artifact as input and produces a set of mutants,
Corresponding author. Tel.: +55 16 3373 9700; fax: +55 16 3371 2238.
1477-8424/$ - see front matter 2008 Elsevier Ltd. All rights reserved.
doi:10.1016/j.cl.2008.10.001
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
323
in which the fault modeled by that particular operator is injected. The fault model has great impact in the mutation testing cost
and effectiveness, and, hence, so does the mutant operator set. In general, when the mutation testing is proposed for a particular
artifact, one of the first steps is to describe the fault model and a mutant operator set.
Considering the important role of mutant operators to the mutation testing, their definition and implementation are basic issues for its efficient and effective application. The mutant operator set has to be assessed and evolved to improve its
accuracy w.r.t. the language in question. This is usually made by theoretical and/or empirical analysis. Specifically for empirical analysis, it is necessary to design and construct a prototype or a supporting tool, because manual mutant generation
is very costly and error-prone. However, the tool design and construction are also costly and time-consuming tasks. An approach that can be used to tackle this problem is to establish prototyping mechanisms that provide a low-cost alternative,
making easier the evaluation and evolution of the mutant operators without requiring too much effort to be expended in
developing tools. At the very end, the produced mutant generator module may be incorporated into a specific mutant tool/
environment.
Another important issue to be considered is that, given the already mentioned impact on the mutation testing effectiveness,
mutant operators must be described in a way as rigorous as possible, in order to avoid ambiguities and inconsistencies. This
is similar to what happens to other artifacts of software engineering. Several initiatives towards defining mutant operators for
different programming languages can be found in the literature [1419]. Although we can identify some approaches in which
the operators are formally defined (e.g., [20]), in most of the cases, the definition is informal and based on a textual description
of the changes that are required in order to generate the mutants (see, e.g., [14]).
From these works, we can observe that there are common conceptual mutations amongst different languages, such as Fortran,
C, C + +, Statecharts, FSMs and so on, although this point has not been explicitly explored by the authors. This fact motivated
us to investigate mechanisms to design and validate mutation operators as independent as possible of the target language. This
same scenario leads to opportunities to reuse the knowledge underlying the mutations (i.e., effectiveness, costs related to the
generation of mutants, to determination of equivalent mutants, to the number of test cases required to obtain an adequate test
case set) of particular mutations, and of the related operators [21,22].
In this paper, we present a languagecalled MuDeL (MUtant DEfinition Language)for the definition of mutant operators,
a tool to support the language and case studies that show how these mechanisms have been employed in several different
contexts. The language was designed with concepts from transformational [23] and logical [24] paradigms. Its motivation is
threefold. Firstly, MuDeL provides a way to precisely and unambiguously describe the operators. In this respect, MuDeL is
an alternative for sharing mutant descriptions. We employed denotational semantics [25,26] to formally define the semantics of
MuDeL language [27]. Observe that the description of the mutant are syntax driven and the semantics of the mutant itself are not
taken into consideration. Secondly, the mutant operator description can be compiled into an actual mutant operator, enabling
the mutant operator designer to validate the description and potentially to improve it. With this purpose, we have implemented
the mudelgen system. Given a mutant operator defined in MuDeL and the original artifact, the mudelgen compiles the
definition and generates the mutants, based on a given context-free grammar of the original artifact. The denotational semantics
of MuDeL was used as a pseudo-oracle (in the sense discussed by Weyuker [28]) in the validation of the mudelgen [27]. And
finally, by providing an abstract view of the mutations, MuDeL eases the reuse of mutant operators defined for syntactically
similar languages. For example, although the actual grammars of, say, C and Java are quite different, they both share several similar
constructions, and, by carefully designing their grammars and the mutant operators, one can reuse the mutant operators that
operate on the same construction, e.g., deleting statements, swapping expressions, and so on, on both languages. We have applied
MuDeL and mudelgen with the languages C, C + + and Java and with the specification languages FSMs and CPNs. In particular,
we used them in the context of Plavis project, which involves Brazilian National Space Agency. We observe that for languages
with similar grammar, we could reuse not only the conceptual framework behind the mutation, but also the MuDeL mutant
operators themselves.
Mutation testing demands several functionalities other than just generating mutants, e.g., test cases handling, mutant execution and output checking. Both MuDeL and mudelgen are to be used as a piece in a complete mutation tool, either in a tool
specifically tailored to a particular language or in a generic toola tool that could be used to support mutation testing application
having the most used languages as target languages. In fact, MuDeL and mudelgen are steps towards the implementation of
such generic tools.
This paper is organized as follows. In Section 2 we discuss some related work and summarize the main features of mutant operators, highlighting the requirements for a description language for this specific domain. In Section 3 we present the
MuDeL language and illustrate its main features. In Section 4 we show results from the application of the language we have
made up to now, emphasizing the cases where we could effectively reuse mutant operator descriptions in different languages.
In Section 5 we discuss relevant implementation aspects of the mudelgen system and depict its overall architecture. Finally, in
Section 6 we make concluding remarks and point to further work.
2. Mutant operators
Mutation testing has been applied in several context, for several different languages. Therefore, mutant operators have been
defined for those applications. The definitions are usually made in an ad hoc way, ranging from textual descriptions to formal
324
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
definitions. Notwithstanding, to the best of our knowledge, MuDeL is the first proposal to provide a precise language to describe
mutant operators.
Mutation testing was first applied for the FORTRAN language [15]. DeMillo designed 22 mutant operators and developed the
MOTHRA tool. The mutant operator descriptions were textual and heavily based on examples. Although the examples are very
useful to illustrate the mutant operator, describing it by these means is ambiguous, and does not promote reuse.
Agrawal [14] proposed 77 mutant operators for the C language. The definition were based on the FORTRAN mutant operators.
Most C mutant operators are basically a translation of the respective FORTRAN mutant operators. However, since the C language
has a much richer set of arithmetic and logical operators, there are more mutant operators for the C language. These operators were
implemented in the Proteum tool [29]. (Actually the mutant operators implemented by Delamaro et al. [29] are adapted versions
of the Agrawal's ones.) Afterwards, Delamaro et al. [18] proposed mutant operators for testing the interfaces between modules in
the C language, named interface mutation. The Proteum tool was extended with these operators, deriving the Proteum/IM [18].
Fabbri [30] investigated mutation testing concepts in the context of specification techniques for reactive systems. Mutant
operators were designed for Petri nets, Statecharts and finite state machines (FSMs). Differently from the above approaches, those
mutant operators were formally defined, using the same formalism of the corresponding technique.
Kim et al. [16] have proposed a technique named hazard and operability studies (HAZOP) [31] to systematically derive
mutant operators. The technique is based on two main concepts. It first identifies in the grammar of the target language where
mutation may occur and then defines the mutations guided by Guide Words. They applied their technique to the Java language.
Although the resulting operators do not significantly differ from previous works, the proposed methodology is an important step
towards a more rigorous discipline in the definition of mutant operators.
From these examples, we can summarize the characteristics of mutant operators used in different context. Usually, from a
single original artifact, a mutant operator will generate several mutants. For example, a mutant operator that exchanges a while
statement into a dowhile statement will generate as many mutants as the number of while statements in the artifact. In each
mutant, a single while will be replaced by a dowhile.
The number of mutants that can be generated from a particular artifact is very large. Considering an original artifact, any
other artifact in the same language could be considered as a mutant, due to the informal and broad definition of syntactical
change necessary to generate a mutant. To keep the number of mutants at a tractable level, only mutants with simple changes
are considered. Roughly speaking, a change is considered simple when it cannot be decomposed into smaller, simpler changes.
For that reason, to describe a mutant operator, usually only one change should be defined.
An important point that should be highlighted is that a change being simple does not mean it is straightforward. The syntax
of the artifact should be taken into account, in order to generate syntactically valid mutants. Concerning this point, a mechanism
based on simple text replacement is not enough. It is necessary to embody some mechanisms to guarantee that the mutants
are also valid artifacts in the original language. The pattern replacement, which is typical in transformational languages, is more
suitable in this context.
Sometimes the single logical change implies in changing more than one place in the artifact. For example, a mutant operator
for exchanging two constants must indicate that two different but related changes, one in each place where the exchanging
constants appear. Moreover, in some cases, although being treated as a single entity, the mutant operator involves different
changes in different places. Therefore, it is necessary to be able to relate these different changes into the mutant operator.
Mutations can be classified into two major groups: context-free mutations and context-sensitive ones. Context-free mutations
are those that can be carried out regardless the syntactical context in which the mutated part occurs. Conversely, context-sensitive
mutations depend upon the context, e.g., the variables visible in a specific scope. Most mutant operators in literature [3,6,14,17]
involve context-free mutations. Even for a context-sensitive language, there can be context-free mutations. An example of
context-free mutations is the change of x = 1 by x + = 1, since wherever the first expression is valid, so is the second.
However, the change of x = 1 by y = 1 is context-sensitive, since the second expression will not be valid unless y has
the same declaration status as does x. To tackle this difficult problem, a language for describing mutants should either embody
features to specify context-sensitive grammar or provide some way to gather information from the context in some kind of
lookup table.
3. MuDeL language
Based on the characteristics of mutants, we designed a language to allow the definition of mutants in a way as easy, languageindependent and natural as possible. However, due to pragmatical issues, we have taken some design decisions that trades off
between the goals listed above and the possibility of implementing of an efficient supporting tool. Therefore, MuDeL does
not provide a completely language-neutral mechanism for describing and implementing mutant operator. Indeed, the syntax of
the target language should be somewhat embodied in the mutant definition. MuDeL language is, thus, a mixed language that
brings together concepts of both the transformational and the logical paradigms. From the transformational paradigm it employs
the concept of pattern matching and replacement. The transformational language that is closest to MuDeL is TXL [32,33]. TXL
has both matching and replacement operations. However, TXL works in a one-to-one basis and has a imperative-like control flow,
making unnatural to describe mutant operators. Instead, the control flow of MuDeL is inspired in Prolog's. The most important
similarity of MuDeL and Prolog's is, however, the way a mutant operator definition is interpreted. Like a Prolog clause,
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
325
Fig. 1. The pattern tree for `( :a ) * :b'. The types of `:a' and `:b' have been declared as A and B , respectively.
a MuDeL definition can be thought of as a predicate. A mutant should satisfy the predicate of a mutant operator definition
in order to be a mutant of this operator w.r.t. the respective original artifact. However, like a findall predicate in Prolog, the
MuDeL definition can be used to enumerate all mutants that satisfy it. This is made by the mudelgen system, described in
Section 5.
3.1. Basic notations
In order to be able to handle different kinds of artifacts, we should choose an intermediate format to which every artifact
can be mapped. Assuming that most artifacts can be thought of as elements of a language defined by a context-free grammar,
the use of syntax tree has an immediate appeal [34]. Therefore, in the MuDeL language, every artifact, either a program or a
specification, is mapped into a syntax tree. The mapping is carried out by parsing the artifact based on a context-free grammar
of the language. The syntax tree can be handled and modified in order to represent the mutations. It is thus necessary a way to
describe how the syntax tree must be handled.
We define a set M of meta-variables1 and extend the syntax tree to allow for leaves to be meta-variables as well as terminal
symbols. Moreover, in this extension, the root node can be any non-terminal symbol (not only the initial one, as in the syntax
trees). We call these extended syntax trees pattern trees, or, if it is unambiguous from the context, just patterns. Each metavariable has an associated non-terminal symbol, which is called its type. A meta-variable can be either free or bound. Every bound
meta-variable is associated to a sub tree that can be generated from its type. Therefore, a syntax tree is just a special kind of
pattern tree; a kind where every meta-variable (if any) is bound. Fig. 1 shows an example of a pattern tree. As a way to distinguish
from ordinary identifiers, we prefix the meta-variables with a colon (:). Even in the presence of meta-variables, the children of a
node must be in accordance with its artifact, i.e., a meta-variable can only occur where a non-terminal of its type also could.
To specify patterns we use the following notation. The simplest pattern is formed by an anonymous meta-variable, as its root
node. This pattern is expressed just by the non-terminal symbol that is its root node enclosed in squared brackets. For example,
[A] is a pattern whose root node is an anonymous meta-variable of type A . In most cases, such a simple notation will not be
enough to specify pattern trees. One can use a more elaborated pattern notation, instead. The non-terminal root symbol is placed
in squared brackets, as before, but following it, in angle brackets, a sequence of terminal symbols and meta-variables is included.
For example, the pattern tree in Fig. 1 is denoted by [S<( :a )* :b>]. Note that inside the angle brackets the grammar of the
artifact, rather than the MuDeL's grammar, is to be respected. Nonetheless, meta-variables come from MuDeL itself and, thus,
the previous pattern will only be valid if the meta-variables :a and :b are declared with proper types. Therefore, instead of being
just a language, MuDeL is indeed a meta-language, in that a MuDeL's definition is valid or not w.r.t. a given source grammar.
In other words, given a source grammar of an artifact language, we can instantiate MuDeL language for that grammar. The
source grammar determines the form and the syntax of the pattern trees.
The unification of a tree and a pattern is in the kernel of any transformational system. In the unification, two pattern trees c and
m are taken and an attempt to unify them is done. The unification can either fail or succeed. In case of success, the meta-variables
in the pattern trees are accordingly bound to respective tree nodes, in a way that makes them unrestrictly interchangeable. In
case of failure, no meta-variable binding occurs. The unification algorithm is similar to Prolog's one [24]. Fig. 2 shows an example
of a successful unification. The dashed line indicates the meta-variable bindings.
3.2. Operator structure
A mutant operator definition has three main parts: operator name, meta-variable declarations and body. The operator name
declaration comes first. This name is just for documentation purposes and has no impact in the remaining parts of the definition.
Next, there is the optional section of meta-variable declarations. If present, this section is started by the keyword var followed
by a list of one or more meta-variable declarations. A meta-variable declaration is a meta-variable name followed by a pattern
tree, which is its type. The last section, enclosed by the keywords begin and end operator, is the body of the operator, which
We chose the term meta-variable instead of the term variable, which has a particular meaning in most language to which MuDeL can be applied.
326
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
Fig. 3. A simple mutant operator. For every statement in the program, a mutant is generated by deleting the statement.
is a compound mutation operation (explained later). This operation will be executed w.r.t. the syntax tree of the original artifact.
Fig. 3 presents a mutant operator definition, illustrating its overall structure. This mutant operator, whose name is STDL,
declares the meta-variable :s with the type statement , and has a simple operation as its body, that, as will be clarified later,
generates mutants replacing nodes with type statement by a semi-colon (the null statement), according to the grammar of the C
programming language. Observe that there is no explicit indication of which node should be considered by the replace operation,
which, in this case, implies that the whole tree should be used.
The body of a mutant definition written in MuDeL is composed by a combination of operations. The syntax of MuDeL's
body part can be divided into operations, combiners and modifiers. An operation can be thought of as a predicate that either
modify the syntax tree or control the way the remain operations act. The operations can be joined by combiners. The behavior of
an operation can be altered by modifiers.
If a set of operations must be used in several different points in a mutant operator, it is possible to declare a rule with
these operations and invoke the rule wherever necessary. Rules can be thought of as procedures of conventional programming
languages. In this way, mutant operators can be defined in a modular way. Rules can be defined in a separated file and imported
in the mutant operator, allowing to reuse similar operations among a set of related mutant operators.
3.3. Operations
An operation is a particular statement about how to proceed in the generation of a particular mutant. An operation takes place
in a particular state, which is formed by the current syntax tree. Every operation, being it simple or compound, can result in zero
or more alternative syntax trees. If it results in zero alternative syntax tree, we say that the operation result in failure, i.e., that it
fails.
3.3.1. Replace operation
The replace operation is the most important one in MuDeL language, since it is responsible for altering the original syntax
tree into the mutated one. It requires three arguments: the tree c to be altered, the pattern tree r, that is to be unified with c, and
the pattern tree b, that will replace c in the case of a successful unification of c and r. Both r and b can contain meta-variables that
allow to use parts of c in the replacement.
The syntax of a replace operation is
c @@ replace r by b
where c must be a meta-variable.
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
:C
327
type(z, int)
:B
(x, float)
:A
type(x, int)
328
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
The abort operation will ignore any alternative state. It always results in failure and, therefore, can be used (in conjunction
with the combiners) to avoid generated some mutants. It is similar to the false predicate of Prolog.
The cut operation will prune the set of alternative states, in such a way that only the first alternative state will be considered.
It is similar to, and was inspired by, the ! of Prolog.
3.5. MuDeL combiners
Two or more operations can be combined into a compound operation using the combiners ;; and ||. They were inspired in
the Prolog operators comma (,) and semi-colon (;).
The first combiner is the sequence one, which is represented by ;; in the MuDeL syntax. The compound operation a;;b
incorporates the effects of both a and b. Every time the operation a results in success, the operation b is applied. As a side-effects,
if the operation a does not succeed, the operation b will be ignored.
The second combiner is the alternative one, which is represented by || in the MuDeL syntax. The compound operation a||b
indicates that both a and b are alternative operations for the same purpose. Therefore, the results of either one can appear in a
mutant. Actually, the compound operation succeeds every time the operation a does and every time the operation b does.
The combiners can be used with more than two operations. For instance, we can join three operations as in a;;b;;c. Moreover,
both combiners can be used together. In this case, the combiner ;; has a higher precedence than the combiner ||. The operations
can be grouped with double parenthesis to overpass the precedence. For instance, in the compound operation ((a||b));;c, the
operation c will be applied to the alternative syntax trees resulting from the operations a and b.
3.6. MuDeL modifiers
There are two modifiers that can be applied to an operation. The negation modifier is used to invert the result of an operation.
It is syntactically represented by a placed in front of the modified operation. Every operation in MuDeL can result in either
a failure or a success. The precise meaning depends on the specific operation on which it is applied. For instance, the match
operation results in a success if it can unify its operands, and results in failure otherwise. When modified with , a unification
will be considered a failure, while the inability to unify will be considered successful.
The in depth modifier is used to indicate that the modifier operation should be applied not only to the context tree, but also
to every of its subtrees. For instance, when applied to a match operation, the unification will be tried with the context tree and
with each of its subtrees. Whenever a unification is successful, the match operation will result in success and a mutant will be
generated. For the replace operation, the effects of the modifier is similar. The replacement will be made not only in the context
tree, but also in every of its subtrees, in turn. It is important to note that each replacement will take place in the original tree, i.e.,
after each replacement, the tree is restored to the original one before the next replacement be searched.
3.7. Usage examples
In this section, we illustrate the usage of elements of MuDeL syntax. We present only the operator body, not including the
operators name and the meta-variable declaration sections, once they can be inferred from the operations. Moreover, we give
only an informal definition of the semantics of each operation. A formal definition can be found elsewhere [27]. All the examples
describe mutant operators for the C language.
An example of a replace operation is presented in Fig. 5, that replaces a while statement (matched in Line 1) by a dowhile
one (Line 2). This is the objective of the SWDW mutant operator defined by Agrawal [14].
Assuming that :p is bound to the syntax tree of the fragment of C code in Fig. 6(a), after the application the operation in
Fig. 5, the code will be replaced by that in Fig. 6(b).
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
329
Fig. 7. An example of while statements that will not be replaced by the operation in Fig. 5.
1
Fig. 10. An example of the matching operation.
1
2
3
4
Fig. 11. A usage example of the combiner ;;.
Suppose now that :p is bound to the C code in Fig. 7(a). In this case the operation in Fig. 5 will not be applicable, since the
while statement will form a sub-tree of the whole statement, and, thus, the pattern of the replace operation will not unify to it.
Another situation that should be dealt with is illustrated in the C code in Fig. 7. In this case, we have three while statements.
To properly deal with this situation, we can modify the replace operation with the modifier *. The meaning of a replace
operation with the modifier * is that every successful matching of b with c itself or any of its subtrees will produce a mutated
tree. Indeed, we can think of this modified operation as producing alternative states, and each of such states will have its own
execution flow and eventually producing a mutant. Therefore, a more adequate mutant for the SWDW is the one presented in
Fig. 8.
Suppose that the meta-variable :f is bound to the code in Fig. 9. Then, after the application of the matching operation in Fig. 10,
the meta-variable :s will be bound to the body of the function. Observe that the pattern will match a function with no arguments
that returns an int value.
The compound operation in Fig. 11 will replace every variable in the control expression of a while statement to 0. It is important
to note that, for every such a control expression, the matching will produce an alternative state and the replace operation in
Line 3 will be applied to each one, possibly generating more alternative states by itself. This example illustrates the usage of the
match operation to constrain the context in which the replacement should be applied. In this case, the operator was designed to
be applicable only to while statement control expressions. Suppose now that one wants the replacement to be applied to control
expression of every iterate statement, i.e., every while, dowhile or for statement. In other words, we want to join the set of
330
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
1
2
3
4
5
6
7
8
9
10
Fig. 12. A usage example of the combiner ||.
Fig. 13. An example of the usage of parenthesis to factor out common modifiers.
Fig. 15. Example of operations that exchanges an identifier by every other identifier.
alternative states of three matching operations. This can be done with the alternative combiner, which is represented by || in
the MuDeL syntax. For instance, the compound operation in Fig. 12 will achieve the objective. (The parenthesis are necessary
because ;; has a higher precedence than ||.)
The parenthesis can also be used to avoid explicitly declaring the context tree in every operation, as well as the * modifier.
Therefore, the compound operation in Fig. 12 is equivalent to the compound operation in Fig. 13. There is, however, a small
difference between both w.r.t. the efficiency and the order in which the alternative states (and, hence, the eventual mutants) are
produced. While in Fig. 12 :f is traversed three times, since for each match operation starts from the root node of the :f syntax, in
Fig. 13 :f is traversed only once.
The other two basic operations (namely, assert and consult) are related to context-sensitive mutants. The consult operation
in Fig. 14 is used to ensure that only identifiers with the int attribute is mutated to 0.
To illustrate the use of the assert operation, consider a mutant operator that exchanges each identifier by each distinct
identifier in the artifact. (For sake of simplicity, we assume that this mutation can be carried out without taking context into
consideration.) Firstly, consider the operator in Fig. 15, which will exchange each identifier matched in Line 3 by the identifier
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
331
Fig. 16. Example of usage of consult and assert operations to avoid employing the same identifier more than once.
matched in Line 1 that are not equal to each other (ensured by the negated matching in Line 6). If the same identifier occurs in
more than one location, the match in Line 1 will produce an alternative state for each one, and the replacement will generate
several identical mutants. We canavoid this situation with the usage of consult and assert operations, as illustrated in Fig. 16.
In this way, the consult operation in Line 3 ensures that there is no tuple for the used attribute with the :id1 value. Then, if so,
the assert operation stores such a tuple in the root node (since no context pattern was furnished).
The cut operation can be used to prune the set of alternative states that the previous operations might have generated. It was
introduced in MuDeL language for sake of completeness, since the other operations are inspired in Prolog, and this language
has the cut operator (!), whose purpose is similar. An example of the usage of cut is presented in Fig. 17, which equals the example
in Fig. 13, expect for the cut operation added in the end. The effect is that after the cut operation is executed, any pending
alternative states are forgotten, i.e., at most one mutant will be generated.
In Fig. 18 we present the SDWE operator that is meant to change every while statement into a dowhile and also change the
control expression into 0 and 1. This kind of mutant is usually necessary when branch coverage is required. Observe that, in a C
program, changing the control expression into 0 has the effect of iterating the body of the while statement exactly once, whereas
changing the control expression into 1 converts the dowhile into an infinite loop. Fig. 19(a) presents a simple C program and
Figs. 19(b)(e) present the mutants that will be generated for this program with the SDWE operator.
The replacing operation in Lines 5 and 6 changes every while statement into a dowhile statement, in any depth. The metavariable :e stands for the control expression of the while. The group of operations in Lines 820 makes changes in this control
expression. Observe that the context pattern declaration in Line 8 affects the whole group, and, consequently, every operation
therein.
The (negated) matching in Line 9 makes sure that the context pattern (:e, in this case) is not equal to 0. If so, the context
pattern is changed to 0, by the replacement in Lines 11 and 12, and a mutant is generated. Note that these two operations compose
a sequence, which is part of an alternative list. Then, the next alternative is tried, in this turn w.r.t. the expression 1. Finally, the
operation in Line 19 is tried and a mutant is generated only with the replacement of Line 5.
Analyzing how the mutants are generated in this example illustrates the way MuDeL processes a mutant operator definition.
The replacing operation (Lines 5 and 6) is marked with the in depth modifier and, therefore, the whole program syntax tree will
be scanned, looking for nodes that match the respectivepattern and changing them accordingly. The replacing operation and
the group of operations in Lines 820 compose a sequence, i.e., every mutant should include the effects of the replacing and the
effects (if any) of the group. This group, by its turn, is composed by a list of three alternatives: the first alternative is in Lines 912;
the second one is in Lines 1417; and the last one is in Line 19. Only the effects (if any) of one of these alternatives will be included
332
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
in a particular mutant. For instance, Mutants #1 and #2 in Figs. 19(b)(c) are generated by replacing the outermost while of the
program in Fig. 19(a) and applying the first and the third alternatives, respectively. (Observe that the second alternative does
not generate a mutant, since the operation in line 14 does not succeed.) On the other hand, Mutants #3#5 in Figs. 19(d)(f) are
generated by replacing the innermost while and applying each of the alternatives, respectively.
4. Applying MuDeL
The usefulness of MuDeL can be measured by its suitability in defining mutants, which is its primary goal; in allowing
the reuse of mutant operators in different languages; and in generating a mutant generator prototype module that can be
evolved and incorporated into a mutation-testing environment. Currently, we have already described mutant operators for (i)
specifications written in colored Petri nets (CPNs) and FSMs, (ii) for the functional language standard meta-language (SML), and
(iii) for traditional languages such as C, C + + and Java.
In this section, we present our experience using MuDeL, and bring some evidence of its usefulness. However, more studies
are necessary in order to soundly validate the language. Moreover, there is a lack of feedback from other research groups, and a
thorough validation would involve the use of the language by others.
FSM, CPN and SML mutant operators: We used MuDeL to define mutants for specifications written in FSMs [36] and CPNs
[37]. In the case of FSMs, we use MuDeL to describe the nine mutant operators defined by Fabbri et al. [38]. Using the
mudelgen system (described in the next section), we were able to use the mutant operators within the Plavis/FSM environment,
which are being used in experiments in Brazilian National Space Agency, in the scope of a project supported by CNPq and CAPESCoffecub.2 In the case of CPNs, we observed that the language was useful to allow a rapid prototyping and experimentation with
different kinds of mutants. In the whole, 29 mutant operators were defined and used in Proteum/CPN tool [37]. It is important
to mention that CPNs annotation language is based on SML and we could reuse some common parts of the mutant operator
descriptions in both languages [39].
C and C + + mutant operators: For C language, we described the 77 mutant operators proposed by Agrawal [14], which are
implemented in Proteum/C tool. Next, we adapted these operators and described similar mutant operators for C + +. We realized
that, by carefully designed the grammar and the MuDeL definition, we could reuse 65 operators, nearly 85% of them. To
illustrate how this was possible, consider again the operator in Fig. 5. Examining the definition, we can observe that the only
relation between the operator and the language of the artifact is in the patterns. Even in the patterns, only the types of the patterns
and of the meta-variables and the sequence of terminal symbols are relevant. Therefore, the same definition can be applied both
for C and C + +, provided that the respective grammars agree in these points: (i) the name of the relevant non-terminal symbols.
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
333
Fig. 19. (a) Original program. (b)(e) Mutants generated by operator in Fig. 18. The mutated parts of the code are highlighted.
(that define the types available) and (ii) the sequence of terminal symbols that appear in the relevant non-terminal productions.
Observe that not the whole sequence of terminal symbols should be the same. Rather, only the terminal symbols that are relevant
to the MuDeL definition. In the SDWD example, for the mutant definition to be applicable, it is necessary that both grammars
have a non-terminal symbol S and that there is a derivation from S to `while' `(' E `)' S and to `do' S `while' `(' E `)' `;'.
Java mutants: We have also carried out a study, in which we try to apply the mutant descriptions for C and C + + to the Java
language. Since the grammar of these languages are similar, we could observe that 31 mutant operators could be reused for Java.
The results of the application to C, C + + and Java are summarized in Fig. 20.
We have investigated how MuDeL can be used with mutant operators that are more semantic-driven. We have described
the class mutant proposed by Kim et al. [40,41]. Some of those operators are related to the semantics of inheritance, overloading
and overriding concepts, which varies from one OO language to another. Those complex operators can only be described with
complex MuDeL code. Indeed, the complexity is inherent to the operators and, to our knowledge, their definition could only
made simpler if we hide the complexity in a more complex operation of the language. The same situation occurs with any
language. There is a trade-off between the simplicity of the operations and its ability to handle complex mutants. The complexity
of these kinds of mutants comes from the underlying semantics of those languages. For instance, let us consider CM operators
defined by Kim et al. [41]. From the 20 mutant operators, we could describe easily 10 of them, since they require only syntax
driven changes. Other five could be described, provided that some semantic information is collected and is available to consult
operations. However, this semantic should be coded, anyway, and to adequately capture the semantics of OO languages is not
an easy task and is still open issue in the programming language semantics research. Unfortunately, we could not find an easy
way to tackle this problem, either. The remaining five ones might be described, depending on what exactly the authors mean.
For instance, FAR operator is defined as Replace a field access expression with other field expressions of the same field name.
Unfortunately, it is not clear what a field access expression exactly means. Other example of ambiguity is the definition of
AOC operator. In Kim et al. [41], the authors defined it as Change a method argument order in method invocation expressions.
334
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
It is not clear how many mutants can be generated from a method with more than two arguments. The possibilities are: (i) one
mutant for each permutation of the arguments (i.e., exponentially many mutants); (ii) one mutant for every shift, in the same
vein as Agrawal's SSOM mutation operator. In Kim et al. [40], the authors give a little bit more explanation about the operator
and provide an example, neither of which clarify the point. These ambiguities evidence the necessity of a formal definition of
mutant operator.
5. mudelgen
In order to be able to process the MuDeL descriptions, we implemented the mudelgen system. In this section we discuss
its main implementation aspects. Suppose that we are interested in describing mutant operators for a language L. The first step
is to obtain a grammar G for L. When mudelgen is input with G, it produces a program mudel.G. This program can then be run
with a mutant operator definition OD and an artifact P. After checking whether both OD and P are syntactically correct w.r.t. the
input grammar G, a mutant set M is generated.
To manipulate the mudelgen input grammar, we use bison and flex, which are open source programs similar to, respectively,
yacc and lex [42]. Although these tools ease the task of manipulating grammars, they, on the other hand, restrict the set of
grammars that mudelgen can currently deal with to LALR(1) grammars [34,35,42]. The grammar input to mudelgen is provided
in two files: the .y and the .l. The .y file is the context-free grammar, written in a subset of yacc syntax [42]. The .l file is a
lexical analyzer and gives the actual form of the terminal symbols of the grammar and it is encoded in a subset of the lex syntax
[42]. The attribute values are attached to the tree nodes with special C functions put in the semantic action of the productions of
.y. For instance, the function assertFact can be used to store an attribute value in a way similar to the assert operation.
The mudelgen is divided into two parts: one part with the elements that depend on the input grammar and the other one
with elements that do not. Fig. 21 depicts how these parts interact and illustrates the overall execution schema of mudelgen. The
grammar-dependent part is actually composed by three modules, which are executable programs: treegen, opdescgen and
linker. The grammar-independent part is embodied in the Object Library. The major portion of the Object Library is
devoted to the so-called MuDeL Kernel, which is responsible for interpreting the mutant operator definition and manipulating
the syntax tree accordingly. The remaining units in the Object Library allow the communication between the MuDeL Kernel
and the external modules MuDeL Animator and DS Oracle, described later.
The units that depend on the grammar are built either by treegen or by opdescgen. Module treegen analyzes G and
generates the units: (i) STP (syntax tree processor), which is responsible to syntactically analyze a source product P into a syntax
tree and (ii) Unparse, which is responsible to convert the mutated syntax trees into the actual mutants. Module opdescgen
analyzes G and generates the unit ODP (operator description processor), which analyzes a mutant operator description OD w.r.t.
G and generates an abstract representation of how to manipulate the syntax tree in order to produce the mutants. Finally, the
linker module will link all these grammar-depending units and the appropriate portion of the Object Library and generate
the program mudel.G.
The program mudel.G is input with a source product P and a mutant operator definition OD. These input data are processed
by STP and ODP, respectively, and handled by MuDeL Kernel. During its execution, MuDeL Kernel will generate one or more
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
335
mudelgen
nk
li
Unparse
MuDeL Kernel
Oracle Interface
Animator Interface
MuDeL Kernel
Oracle Interface
Object Library
n
ge
ee
tr
STP ODP
Animator Interface
er
.l
Unparse
mudel.G
STP
.y
ODP
cg
es
d
op
mudel.G
MuDeL Kernel
Unparse
OD
STP ODP
Animator Interface
M1
M2
Oracle Interface
DS Oracle
mutated syntax trees, which are processed by Unparse in order to generate the actual mutants. Unparse can output the generated
mutants in several formats. Currently, the mutants can be (i) sent to standard output; (ii) restored in SQL databases (e.g., MySQL);
or (iii) written to ordinary files (each mutant in a separate file). Optionally, the DS Oracle can be used to check whether the
mutants were correctly generated (see Section 5.1). The execution of the program mudel.G can be visually inspected with the
MuDeL Animator (see Section 5.2). The overall execution schema of mudel.G is depicted in Fig. 22.
5.1. Denotational semantics-based oracle
The number of mutants generated is often very large and manually checking them is very costly and error-prone. Therefore,
the validation of mudelgen is a hard task, mainly due to the amount of output which is produced. To cope with this problem,
we adopted an approach that can be summarized in two steps. Firstly, we employed denotational semantics [25] to formally
define the semantics of MuDeL language [27]. Secondly, supported by the fact that denotational semantics is primarily based
on lambda calculus, we used the language SML [43], which is also based on lambda calculus, to code and run the denotational
semantics of MuDeL. We implemented an external module DS Oracle that can be run in parallel with mudel.G through the
Oracle Interface in a validation mode. When invoked, the DS Oracle receives the information about a mutant operator OD
336
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
and derives a denotational function (in the mathematical sense) that formally defines the semantics of OD. Then, the DS Oracle
reads the information about the source product P and the set of generated mutants M. The mutants in M are compared with the
mutants defined by . Any identified difference is reported in the discrepancy report D.
It is important to remark that the validation mode has no usefulness for users interested in mudelgen's functionalities, since
it brings no apparent benefit. However, it is very useful for validation purpose, since it improves the confidence that the mutants
are generated in the right way. Nonetheless, from a theoretical viewpoint, there is a possibility that a fault in the implementation
be not discovered, due to the fact that the SML implementation may also possess a fault that makes it produces the same
incorrect outputs. However, the probability that this occurs in practice is very small. Both languages (i.e., C + + and SML) are
very different from one another. Moreover, the algorithms and overall architectures of both implementations are very distinct.
While we employed an imperative stack-based approach in C + +, we extensively used continuation and mappings [25] in SML.
Consequently, it is not trivial to induce the same kind of misbehavior in both implementations. In other words, although none of
them is fault free, the kind of faults they are likely to include is very distinct. With this consideration, we conclude that the use
of denotational semantics and SML was a powerful validation mechanism for mudelgen.
5.2. MuDeL animator
We have also implemented a prototyping graphical interfacecalled MuDeL Animatorfor easing the visualization of the
execution of a mutant operator. MuDeL Animator was implemented in Perl/Tk and currently has some limited features that
allows inspecting the log of execution, without, however, being able to interfere in the process. Since MuDeL Animator enables
us to observe the execution of a mutant operator definition, it is very useful not only for obtaining a better understanding of the
MuDeL's mechanisms, but also for (passively) debugging a mutant operator.
Fig. 23 presents the main window of MuDeL Animator, where the example of Fig. 18 was loaded and is being executed. At
the top of the window are the buttons that control the execution of the animator, such as Step, Exit, etc. The remaining of the
window is divided up into four areas:
MuDeL description: In the left bottom area, MuDeL Animator presents the mutant operator definition. A rectangle indicates which line is currently executing. Every meta-variable is highlighted with a specific color. The same color is used in
whichever occurrence of the same meta-variable throughout all the other areas.
Mutant tree: In the left top area, the animator shows the syntax tree of the product, reflecting any change so far accomplished
by the execution. An arrow indicates which node is currently the context tree. Meta-variable bindings are presented by including
the names of the meta-variable above the respective tree nodes.
Current product: In the right bottom area, the current state of the product, obtained by traversing the current state of the
mutant tree, is presented. The parts in the mutant that correspond to the nodes bound to meta-variables are highlighted with
the respective color.
Pattern tree: In the right top area, MuDeL Animator shows the tree of the pattern currently active (i.e., in the current line)
in the MuDeL description area.
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
337
Since MuDeL Animator enables us to observe the execution of a mutant operator description, it is very useful not only for
obtaining a better understanding of the MuDeL's mechanisms, but also for (passively) debugging a mutant operator.
6. Concluding remarks
The efficacy of mutation testing is heavily related to the quality of the mutants employed. Mutant operators, therefore, play
a fundamental role in this scenario, because they are used to generate the mutants. Due to their importance, mutant operators
should be precisely defined. Moreover, they should be experimented with and improved. However, implementing tools to
support experimentation and validation of the mutant operators before delivering a mutant environment is very costly and
time-consuming.
In this paper we presented the MuDeL language as a device for describing mutant operators and generating a mutant
generator prototyping module. The language is based on the transformational paradigm and also uses some concepts from logical
programming. Being defined in MuDeL, an operator can be compiled and the respective mutants can be generated using
the mudelgen system. MuDeL and mudelgen together form a powerful mechanism to develop mutant operators. The mutant
operators can be validated either formally (with the facilities of DS Oracle) or manually (with the facilities of MuDeL Animator).
The design decisions we have taken lead us one step further towards the achievement of our goals. There are some points
that need to be further investigated. For instance, MuDeL was mainly designed to deal with context-free mutations. With
this decision, we keep the language quite simple, yet considerably expressive. However, there are some important kinds of
mutants that are inherently context-sensitive. For example, some program mutant operators might need knowledge that are not
readily available, such as the set of variables defined prior to a specific point in the program, or whether a method overrides the
method of a parent class. Although, these situations can be dealt with assert and consult operations, we realize that these
mutant operators are not easy to write nor are the definition easy to follow. Indeed, the problem of dealing with context aware
transformation is a hard problem for any transformational language [33]. We are still investigating how these situations can be
more suitably handled. For instance, we observe some idioms in the mutant operators that might be candidates to be included in
the language as primary operations.
The experiments we have carried out with MuDeL involved languages for which there were supporting tools, namely Petri
nets and C programs. Although fully useful in demonstrating its potential usage, these experiments are not a complete validation.
Right now, we are working on a project where Java mutant operators are being described, what will further contribute towards
the validation of the ideas presented herein.
There are tasks that are hard, cumbersome or even impossible to be carried out only with the construction MuDeL embodies.
As example, we can cite arithmetics and string manipulation. To tackle this problem, we are currently developing an API
(application programming interface) to allow the implementation and inclusion of built-in rules written in a conventional
programming language, namely, in C + +. We, then, keep the kernel of MuDeL tiny, whereas built-in rules can be provided for
any further need we have to take care of.
338
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
A. Simo et al. / Computer Languages, Systems & Structures 35 (2009) 322 -- 339
339
[37] Simo AS. Mutation analysis application in the context of testing and validation of coloured petri nets. PhD thesis, ICMC/USP, So Carlos, SP; 2004.
[38] Fabbri SCPF. A anlise de mutantes no contexto de sistemas reativos: Uma contribuio para o estabelecimento de estratgias de teste e validao. PhD
thesis, IFSC/USP, So Carlos, SP; 1996.
[39] Yano T, Simo AS, Maldonado JC. Estudo do teste de mutao para a linguagem standard ML. In: Solar M, Fernandez-Baca D, Cuadros-Vargas E, editors, 30ma
Conferencia Latinoamericana de Informatica (CLEI2004). Sociedad Peruana de Computacion, 2004. p. 73444, iSBN 9972-9876-2-0.
[40] Kim S, Clark JA, Mcdermid JA. Class mutation: mutation testing for object-oriented programs. In: Object-oriented software systems, Net.ObjectDays'2000,
Erfurt, Germany, 2000.
[41] Kim S, Clark JA, Mcdermid JA. Object-oriented testing strategies using the mutation testing. Software Testing Verification and Reliability 2001;11:20725.
[42] Mason T, Brown D. Lex & Yacc. O'Reilly; 1990.
[43] Hansen MR, Rischel H. Introduction to programming using SML. Reading, MA: Addison-Wesley; 1999.
[44] Wong E, Maldonado JC, Delamaro ME, Mathur AP. Constrained mutation for C programs. In: 8 Simposio Brasileiro de Engenharia de Software, Curitiba,
Brasil, 1994. p. 43952.
[45] Untch R, Harrold MJ, Offutt J. Mutation analysis using mutant schemata. In: International symposium on software testing and analysis, Cambridge, MA, 1993.
p. 13948.
Apndice H
A. L. Bonifacio, A. Moura, A. S. Simo, J. C.
Maldonado. Towards Deriving Test Sequences by
Model Checking. Electronic Notes in Theoretical
Computer Science, v. 195, p. 21-40, 2008.
159
Abstract
Model-based testing automatically generates test cases from a model describing the behavior of the system
under test. Although there exist several model-based formal testing methods, they usually do not address
time constraints, mainly due to the fact that some supporting formalisms do not allow a suitable representation of time. In this paper, we consider such constraints in a framework of Timed Extended Finite State
Machines (TEFSMs), which augment the Extended Finite State Machine (EFSM) model by including a
notion of explicit and implicit time advancement. We use this extension to address conformance testing by
reducing the conrming conguration problem to the problem of nding a path in a TEFSM product.
Keywords: Model Checking, Timed EFSM, Conformance testing, Suspicious Conguration.
Introduction
Model-based testing comprises the automatic generation of ecient test cases using
models of system requirements, usually based on formally specied system functionalities. It involves the (i) construction of a suitable formal model, (ii) derivation
of test inputs, (iii) calculation of test outputs, (iv) execution of test inputs over
implementations, (v) comparison of the results from the calculated test outputs
and the implementation executions, and (vi) decision of whether the testing should
be stopped. All these tasks are tightly related to each other. For instance, the
1
2
3
4
adilson@ic.unicamp.br
arnaldo@ic.unicamp.br
adenilso@icmc.usp.br
jcmaldon@icmc.usp.br
doi:10.1016/j.entcs.2007.08.025
22
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
way the model is written impacts on how test inputs can be generated. Moreover,
the decision of whether the implementation has already been tested enough depends on ones ability to determine how many undiscovered faults may remain in
it. Usually the purpose of testing is not to demonstrate that the implementation is
equivalent to its specication, since this goal is infeasible for most practical applications. Instead, this ideal equivalence is relaxed into a conformance relation [13,15].
The so-called conformance testing aims at demonstrating that the implementation
behavior conforms (in some sense) to the behavior dictated by the specication [29].
The problem of generating test cases for conformance testing based on Finite
State Machines (FSMs) has already been investigated [7,21,28,8,14,12]. However,
there are many situations in which the modeling of the system as a FSM is cumbersome, due to the state explosion problem, or even impossible, due to the fact
that there are some relevant aspects that can not be properly expressed, e.g., the
passage of time. Some extensions to the FSM model have been proposed in order
to overcome these problems [33,6,1]. Other extensions incorporate notions like context variables and input/output parameters, allowing the succinct representation of
many dierent congurations [27]. Still others incorporate notions of time, allowing
the model to capture the evolution of time [24,4,36].
An Extended Finite State Machine (EFSM) can be thought of as a folded FSM
[27]. Given an EFSM, and assuming that domains are nite, it is possible to unfold it into a pure FSM by expanding the values of its parameters and variables.
The resulting FSM can be used with FSM-based methods for test derivation with
complete fault coverage, which means that all fault possibilities can be exhausted.
Nonetheless, in most practical situations, this approach is unfeasible, mainly due to
the state explosion eect [22,27].
Time plays an important role in determining the acceptability of system behavior
in many system categories since not only the input/output relationship can be
relevant, but also the period of time when those events occur may be important. In
such cases, it is mandatory to be able to represent time constraints of the system,
and to test whether a given implementation conforms to these constraints. There
are some formalisms that allow the representation of various time related concepts,
such as Timed Petri Nets [19] and Timed Automata [2,1,32,11]. Nonetheless, there
are few, if any, methods that allow a satisfactory derivation of adequate test cases
from those models.
We are interested in model-based methods for testing systems with time constraints. In particular, we are addressing the problem posed in tasks (i)-(iii) alluded
to above, namely the construction of an adequate formalism for modeling systems
and the automatic generation of test cases, as well as the determination of the expected outputs. These tasks are closely related, and should be considered together.
To this end, we dene Timed EFSMs [5], or TEFSMs, by including the notion
of explicit and implicit time advancement in the EFSM formalism. Then, we can
adapt some well-established results, derived for FSMs and EFSMs, to the context
of systems that require time constraints. In particular, we address the problem
of conguration conrmation for TEFSMs in the same vein as done by Petrenko
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
23
et al. for EFSMs [27]. In that work, it is shown how the problem of conguration conrmation for EFSMs can be reduced to the problem of nding a path in
an EFSM product. By dening a property that states when no such a path exists, model-checking techniques can be used to generate a conrming sequence. We
show how the notion of product machines and conrming sequences can be applied
to the extended formalism of TEFSMs. Given a conguration and a set of suspicious congurations, a conrming sequence is a sequence of (parameterized) inputs
that allows us to distinguish the given conguration from suspicious congurations
by comparing outputs and, possibly, observing the time indicated in each of the
outputs. Finding a conrming sequence can also be seen as an extension of the
state identication problem [20,16].
This paper is organized as follows. In Section 2 we present the concepts of
EFSMs and Extended Timed Transition Systems [7]. In Section 3 we introduce
the Timed Extended FSMs. The product of TEFSMs is presented in Section 4. In
Section 5 we describe how the TEFSM product can be used in a model-checking
set-up, and illustrate this process with a simple example in Section 6. Finally, in
Section 7, we draw some concluding remarks and indicate possible directions for
future research.
In this section, we give a brief overview of the formal concepts that are involved in
this work. First, we present EFSMs which are used to specify system requirements.
Next, important aspects of extended timed transition systems are introduced.
2.1
s, s S are the source and the target states of the transition, respectively;
x X is the input symbol of the transition;
24
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
P , op and up are functions dened over valuations of the input parameters and
context variables V , thus:
P : Dx DV {T rue, F alse} is the predicate of the transition;
op : Dx DV Dy is the output parameter function of the transition;
up : Dx DV DV is the context update function of the transition.
Input complete: for each pair (s, x) S X, there exists at least one transition
leaving state s with input x;
Deterministic: any two transitions leaving the same state and with the same input
have mutually exclusive predicates;
Observable: for each state s and each input x, every outgoing transition from s
on x has a distinct output symbol.
2.2
We can extend the original timed transition system (TTS) notion of [7] by associating a set of clocks and invariant conditions with each state. All clocks in the
model increase in an uniform way, according to a global time frame [1,2], and the
corresponding invariant condition must hold in the current state of the model.
First, we say how clocks behave during system evolution [1]. Let C be the set
of clock names (or clocks, for short), (C) is the set of clock constraints in the
form,
:= c | c | | 1 2 ,
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
25
symbol xi occurs at time i . Given two congurations, (s1 , 1 ) and (s2 , 2 ), a time
delay 0 and an input x, we say that (s2 , 2 ) evolves from (s1 , 1 ) over and x,
x
denoted by (s1 , 1 ) (s2 , 2 ), i there is a transition (s1 , x, K, , s2 ) such that:
(i) 1 +
(ii) 1 +
Inv(s2 ).
i
i1 i , where i = i i1 , i 1.
x
Note that, in a timed sequence (, ), time evolves by (i i1 ) units from the
x
moment when xi1 occurred until xi occurs (for i > 1). Intuitively a run captures
the system evolution, as follows:
(i) it starts at state s0 , with all clocks set to zero;
(ii) time evolves by 1 0 = 1 units;
(iii) at instant 1 the system changes to state s1 on input x1 while resetting clocks
in K1 to zero;
26
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
a change of state can only occur when the transition (s, x, K, , s ) is enabled, i.e.,
when is satised in the present conguration;
any clock reading is the elapsed time since the last instant it was reset to zero;
and
In the previous sections, we have presented two formalisms: EFSMs and ETTSs.
While EFSMs capture the relationships between inputs, outputs and context variables, ETTSs oer a treatment of time evolution and its constraints. We observe
that there are several methods and techniques for deriving tests from (E)FSM models (e.g., [27,17,8,26]). However, the derivation of test cases from (E)TTSs is less
established, although some works have considered it (e.g., [30,7,18]). It is worth
combining both ETTSs and EFSMs formalisms in order to benet from the power
of both models in terms of expressiveness. This section redenes the EFSM model
in order to capture real-time. We use the ETTS denition as inspiration for this
purpose.
3.1
op, y, and up are as dened in the EFSM formalism; see Section 2.1;
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
27
It can be seen that the TEFSM model comprises the EFSM formalism. That is,
given a EFSM M over X, Y, R, V and some valuation domains, as dened in Sec
tion 2.1, we can construct a TEFSM model M over the same sets X, Y, R, V and the
corresponding domains, by letting the clock set C be simply {c}. For each transition
op maps (px , v ) to po ;
Here, the set of invariant conditions Inv for M is the same for M . The initial state
Considering the dynamic behavior of ETTS models and the data and control ow
of EFSM models, we dene the operational semantics of a TEFSM M as follows.
Denition 3.1 Let i = (si , i , i ) , i = 1, 2, be two congurations of M .
There is an implicit move from 1 to 2 i
(i) s1 = s2 ,
(ii) 1 = 2 ,
(iii) 2 = 1 + , for some Q>0 , and
(iv) 2 +
28
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
(ii) 2
Inv(s2 ),
= (x, px ) e = (y, py ), then we say that there is a move from 1 to 3 and indicate
/
this by 1 3 .
Some of the decorations over and under may be dropped if they are clear
from the context.
A parameterized input sequence is any sequence = 1 2 . . . where each i is
i /i
We say that the run is over the timed input (, ) and produces the timed output
(, ). We also say that (, ), or , is produced by M from 0 in response to (, ).
Some notions from the EFSM and ETTS models are extended to the TEFSM
model:
The TEFSM M is complete if, for each state s there is a transition leaving s on
any input symbol x.
We say M is deterministic if, for any conguration (s, , ), any parameterized input (x, p), and any time instant , there are no two dierent transitions
(s, x, Q1 , K1 , op1 , y1 , up1 , s1 ) and (s, x, Q2 , K2 , op2 , y2 , up2 , s2 ) such that both Q1
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
29
And, we say M is observable if, for any conguration (p, , ), any parameterized input (x, p) there are no two transitions (s, x, Q1 , K1 , op1 , y1 , up1 , s1 ) and
(s, x, Q2 , K2 , op2 , y2 , up2 , s2 ) with y1 = y2 and with Q1 and Q2 both evaluating
(p, , ) to T rue.
3.3
30
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
TEFSMs. This guarantees that the system evolution is maintained during implicit
transitions.
i
Let M i = (S i , Inv i , T i ), i = 1, 2, and i = (si , 0 , i ), i = 1, 2, be two TEFSMs
0
0
and their corresponding initial congurations. The product machine is denoted by
M 1 M 2 . We will use superscript 1 to denote elements of M 1 , like R1 is the set
of parameters for M 1 . Likewise, superscript 2 will indicate objects associated with
M 2 , like V 2 is the set of context variables of M 2 . The superscript 1, 2 is reserved
for the product machine M 1 M 2 .
The set of input symbols of M 1,2 is X 1,2 = X 1 X 2 . Likewise, Y 1,2 = Y 1 Y 2 .
The set of parameters of M 1,2 is given by R1,2 = R1 R2 , with the proviso that for
all z R1 R2 , the valuations of z in M 1 and M 2 have a common domain. It is
clear that we are using the same parameter domains in M 1,2 as they were in M 1 and
1,2
1
2
M 2 . For any z X 1,2 Y 1,2 , we let Rz = Rz Rz . Note that, given a valuation
1,2
1,2
1,2
1,2
1
1
2
2
rz for elements in Rz we can get valuations rz = rz Rz and rz = rz Rz , for
1,2
1
2
machines M 1 and M 2 , respectively, and, moreover, rz = rz rz . Similarly for clock
interpretations and context variable valuations. We assume that clocks and context
variables are disjoint, i.e., C 1,2 = C 1 C 2 , with C 1 C 2 = , and V 1,2 = V 1 V 2 ,
with V 1 V 2 = . As for the valuation domains, they are the same as in M 1 as in
M 2 . The set of states of M 1,2 is given by S 1,2 = S 1 (S 2 {f ail}), where fail is a
new state. The set of invariant conditions Inv 1,2 of M 1,2 maps S 1,2 to (C 1,2 ), and
it is given by Inv 1,2 (s1 , s2 ) = Inv 1 (s1 ) Inv 2 (s2 ), for all (s1 , s2 ) S 1,2 . Moreover,
Inv 1,2 (s1 , f ail) = Inv 1 (s1 ), for all s1 S 1 .
1,2
1,2
The initial conguration of M 1,2 will be given by 0 = ((s1 , s2 ), (0 , 1,2 )),
0 0
0
1,2
1
2
where 0 = 0 0 and 1,2 = 1 2 . Note that we can take unions here, since
0
0
0
clock and context variables are disjoint in M 1 and M 2 .
It remains to specify the transitions of M 1,2 . Let (si , x, Qi , K i , opi , y i , upi , si ),
1
2
1 and M 2 , both with the same input x. In the following
i = 1, 2, be transitions of M
denition we will be considering a parameterized input (x, p1,2 ), a clock interprex
1,2 and a context variable valuation 1,2 , all for the machine M 1,2 . We
tation
1
2
also let p1 = p1,2 Rx and p2 = p1,2 Rx . Likewise, we let 1 = 1,2 C 1 and
x
x
x
x
2 = 1,2 C 2 , and also 1 = 1,2 V 1 and 2 = 1,2 V 2 . There are two cases:
case 1: y 1 = y 2 and op1 (p, ) R1,2 = op2 (p, ) R1,2 , for all (p, ) Dx DV
1
2
where R1,2 = Ry1 Ry2 . That is, the output symbol is the same and the output
valuations of both transitions are the same on each common output parameter.
We add two transitions to T 1,2 ,
(i) ((s1 , s2 ), x, Q, K, op, y 1 , up, (s1 , s2 )), where:
1 1
2 2
(a) Q(p1,2 , 1,2 , 1,2 ) = Q1 (p1 , 1 , 1 ) Q2 (p2 , 2 , 2 )
x
x
x
1 K2
(b) K = K
(c) op(p1,2 , 1,2 ) = op1 (p1 , 1 ) op2 (p2 , 2 ). Recall that op1 and op2 coincide on
x
x
x
common output parameters and so we can safely take the union.
(d) up(p1,2 , 1,2 ) = up1 (p1 , 1 ) up2 (p2 , 2 ). Recall that V 1 V 2 = .
x
x
x
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
31
x
Consider congurations i = (si , i , i ) of machine M i , i = 1, 2. Let = (, px )
1 M 2 , and let = (, ) is a timed input
be a parameterized input sequence for M
1 M 2 . Note that, M 1 and M 2 can be the same machine with dierent initial
for M
congurations. We say that is a separating sequence for 1 and 2 i there is a
run = 0 1 . . . of M
0
1,2 whose state is (s1 , f ail) for some s1 S 1 .
i 1, i is a conguration of M
j
j
The problem of determining a separating sequence for two congurations of a
32
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
given TEFSM M can be reduced to a reachability problem. The reachability analysis is tractable but hard for EFSMs [23]. Indeed, for TEFSMs it is intractable. This
is due to the temporal aspect within the new model. Another diculty is the combinatorial explosion in the number of states in product machines. Some approaches
try to overcome this diculty by relaxing their restrictions. Approximation algorithms are also used when doing reachability analysis. Other approaches adapted
known algorithms in order to manipulate symbolic data structures [34,9,35].
Other simpler contexts [25,3] present algorithms to obtain separating sequences.
We postulate that these ideas can be adapted and extended in order to obtain
separating sequences in the TEFSM formalism. Such separating sequences would
be the result of the test case generation procedure. Moreover, we have been working
with the notion of automata discretization in order to overcome the problem of
innite time instants. In addition, it is possible to modify conventional algorithms
to reduce the state space generated by the product machine. Another alternative to
obtain tractability in a timed approach for nding separating sequences is through
the use of suspicious congurations [5]. In this case, we can choose a set of suspicious
states, representing a important class fault, based on the expertise of test designers
and on assumptions of implementations faults, as seen in [13,31].
Test Generation
This section outlines the main concepts for test case generation. First, we present
some discussion on the main rationale of conformance testing. Second, we discuss
the notion of conrming congurations, and how it is applied. At last, we discuss
deriving test sequences by model-checking for TEFSMs.
5.1
Conformance Testing
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
33
5.2
34
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
path would run from the initial state to a fail state. If the fail state can not be
reached, then the suspicious conguration is equivalent to the original conguration.
However, if a fail state is reachable, the model-checking algorithm will produce a
counter-example, as a sequence of transitions that leads to this fail state [10]. This
sequence would make a test case for the suspicious conguration. However, it is
still necessary to identify in which moment each transition was taken, as well as the
valuation of the input parameters associated with each input symbol. Gathering of
this information forms a set of test cases. The test case is then used to exercise a real
implementation, and the outputs are compared with the outputs produced by the
specication over the same data. If a disagreement is found between corresponding
outputs, then a fault has been identied.
5.3
Model-checking
Design errors frequently occur when conventional simulation and testing techniques
are used to check safety systems. Model checking is a set of techniques for the
automatic analysis of reactive and real-time systems. Some model checking algorithms have been modied to discover such errors, thus providing more quality and
accuracy in system verications. In general, given a transition system and a property, the model checking problem is to decide whether the property holds or not in
the model represented by the transition system. If not, the model checking algorithm provides a counterexample, i.e. an execution over the model that violates the
property [23].
Reachability analysis is a special kind of model-checking method that can be
applied in a formal model. In general, given a special state to be found in a model,
the reachability analysis decides if it is possible to move from the initial state to the
nal special state.
To summarize, to automatically test implementations based on a specication
represented by a machine M , the following steps are performed:
(i) An empty set T C of test cases is dened.
(ii) Given a conguration of M , a set of suspicious congurations is dened,
based on test hypotheses, fault models and some specic test engineers objectives.
(iii) For each suspicious conguration s , the product of M with itself is constructed, having as the initial conguration of the rst instance of M in the
product, and having s as the initial conguration of the second instance.
(iv) Reachability analysis is carried out, in order to nd a path to a fail state in
the product machine. If such a path is found, it is added to T C.
(v) For each tc T C, a time and an input parameter valuation sequences are
derived so as to satisfy the predicates along the path specied by tc.
(vi) Each path in T C, with its associated data, is applied to the real implementation
under testing.
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
35
An Example
:=
d,
w
{x
},
4,
>
w
16
y>
a,
}, c )
,y
w
, { x } , e(
17
,y
y<
, {x
1 17
x> y
1
b, x
a,
s2
a, x 5, {x, y}, c
s1
a, x 4 w 4, {x}, c, w := w + 1
s3
It has three states and seven transitions. The input set is {a, b} and the output
set is {c, d, e}. Furthermore, M has two clock variables, x and y, and one context
variable w. There are no parameters associated with the input symbols, i.e. Ra =
Rb = . Likewise, Rc = Rd = . For each state s in M , the control remains in s
whenever its invariant condition is satised. The output e has only one associated
parameter. In this case, it is not necessary to name the parameter. Instead, in
Figure 1 and in the sequel we write e(w) to indicate that the current value of the
context variable w is to be attributed to the parameter associated with e. In the
gure, each arrow is labeled by a sequence of items. The rst three are always
the input symbol, the predicate function and the set of clocks to be reset in the
transition, respectively. Next, comes the output symbols, either c or d, and we write
directly e(w) to indicate both the output symbol and the value of its parameter.
Finally, if the value of the context variable w is altered by the transition, this is
indicated by the attribution that appears at the end of the label; if the value of w
is not altered by the transition we simply omit the trivial expression w := w.
A conguration of M is given by a state, a clock interpretation and a context
36
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
variable valuation. Hence, a conguration of M will be denoted by (s, (n, m), k) indicating that the machine is in state s, n and m are the values for the clock variables
x and y, respectively, and k is the value for the context variable w. The integers
are selected as a common valuation domain. In the conguration (s1 , (3, 2), 4) the
transition a, x 4 w 4, {x}, c, w := w + 1, from s1 to itself, is enabled. Likewise,
the transition b, y 16, {x, y}, e(w), from s1 to s3 , is also enabled.
For the product, let M 0 designate M with the initial conguration (s1 , (0, 0), 2),
and let M 1 designate M with initial conguration (s1 , (4, 2), 5). The TEFSM product of M 0 M 1 is shown in Figure 2. To simplify the notation in the example, we
will use subscript i to denote items of machine M i , for i = 0, 1, e.g. x1 represents
the clock variable x of M1 , while w0 denotes the variable w in M 0 .
The initial conguration of M 0 M 1 is denoted by ((s1 , s1 ), (0, 0, 2, 4), (2, 5)),
where we list rst the items corresponding to M 0 , followed by the items associated
with M 1 . Note that, in the gure, states are represented by subscripts, e.g., the
state (s1 , s1 ) in the product is named s11 .
By inspection of the product, we can see that the input b enables the transition to re, since clock conditions on y0 and y1 are satised for the initial conguration. After that the transition is taken, the new conguration is given by
((s3 , s3 ), (0, 0, 2, 0), (0, 5)). It is easy to see that neither input a nor input b will
enable transitions to re so as to reach, directly, a fail state. Note that, every clock
variable was reset to zero, and transition guards are excluding for clock variables
x0 and x1 . If the input b occurs within less than 5 time units, the conguration
becomes ((s1 , s1 ), (0, 0, 2, 0), (0, 5)). Otherwise, if the time evolves for more than 5
time units, only the input a could stimulate the machine to change congurations.
The new conguration would still be ((s1 , s1 ), (0, 0, 2, 0), (0, 5)). Both transitions
would drive the control back to the initial state, where the transition stimulated by
input b is the unique one enabled to re. This cycle would be executed repeatedly
and a fail state would not be reached.
Another possibility is to take the transition on the input a. It is easy to see
that the input a separates the congurations (0, 0, 2) from (4, 2, 5). The nal conguration reached is ((s1 , f ail), (0, 0, 3, 4), (2, 5)). On the other hand, the control
can be kept within the state (s1 , s1 ), by a continuous time evolution. After that,
the stimulation by input a enables the transition to re, and the conguration
((s1 , s1 ), (1, 1, 2, 5), (3, 5)) can be reached. Then, the transition from state (s1 , s1 ),
on input a and with associated predicate x0 4 w0 4 (w1 > 4 x1 > 4)
is enabled and takes the machine to the fail state (s1 , f ail). Here, only the clock
variable x0 is reset, and the context variable w0 is updated by one unit. The new
conguration will be ((s1 , f ail), (0, 1, 3, 5), (3, 5)). From here, we see that input a
separates the conguration (0, 0, 2) from (4, 2, 5), after some time passes. The new
conguration that can be reached in this case is ((s1 , f ail), (0, 1, 3, 5), (3, 5)).
If we consider another situation, where the initial congurations of M 0 and M 1 ,
respectively, are given by (0, 0, 2) and (4, 2, 4), another run of M 0 M 1 will also
reach the fail state. In this case, a reachability analysis shows that the fail state of
M 0 M 1 can only be reached when a sequence of one or two consecutive inputs a
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
s2f ail
s1f ail
4)
,{
x0
>
},
c
d
},
, y0
{x 0 0}, c
5),
,y
x0
5){
(x 1
<
5
<
(x 1
0
5
b, x
x0
a,
,w
w0
:=
16
>
0
a, y
>
(y 1
0
a,
x
:=
0
s33
s11
b, x0 < 5 x1 < 5), {x0 , y0 , x1 , y1 }, d
b, x
{x 0 1
0, y
x
0, x
a, x
1, y 1 1
1 },
{x 0 >
e(w y0
1
0, y
0 ),
x1
0, x
e(w 17
>1
1, y
y1
1)
1 },
1
c y0
7),
<1
7
y1
<1
7),
a, x0 5 x1 5), {x0 , y0 , x1 , y1 }, c
4
>
w0 0
:=
16 w 1
>
,
y 1 := 0
16 w 0
> , d,
}
y0
a, 0, x 1
{x
w1
a, x
{x 0 4
0, x
x
b, y
1 },
0
c, w 1 4
16
0 := w
(
y1
w0 0
>1
+1 4
6),
,w
w
{x
1 := 1
0,y
w1 4),
0 },
+1
e(w
0)
w0
, d,
0}
{x
4),
(x
1
w1
>
16
>
,
4)
s3f ail
37
s22
is applied.
In the example, M 0 represents the specication, M 1 represents a suspicious implementation, and the product M 0 M 1 is used to nd sequences of congurations
that show non conformance between a suspicious implementation and the specication. We can derive traces from the reachability analysis of M 0 M 1 . The resulting
traces are runs that reach the fail state in the product machine, starting from the
initial congurations of the participating TEFSMs.
38
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
Concluding Remarks
The ability to derive test cases from formal models opens the possibility that we
can construct more rigorous and dependable systems, by providing a sound basis for
the validation of the systems behaviors. There is a direct relationship between the
kinds of systems that a given model can deal with and the availability of methods
for deriving test cases. The FSM and EFSM models are well-established and have
been intensively investigated. One important feature they both lack is the ability to
deal with time. In this paper we dene TEFSMs as a model that extends the EFSM
model with the notion of time. From that, we discussed an extended method for
deriving conguration conrming sequences for TEFSMs, a step toward automating
the generation of test cases from these models.
Although we can argue that both the model and the generation method can be
used, we do not have answers for pragmatic questions, such as (i) how dicult is
it to describe a system using TEFSMs and (ii) how large are the models we can
handle. To answer these questions, it is necessary to deepen the investigations and
implement adequate supporting software tools. We are currently working in this
direction.
Other aspects that can be investigated include how to allow time constraint to
be dened over outputs. We note that our denition does not deal with constraints
that may reect output response that is not instantaneous. The input and output
occur in the same time instant. We are considering how this extension might impact
the test case generation methods.
References
[1] Alur, R., Timed automata, in: CAV, number 1633 in LNCS, 1999, pp. 822.
[2] Alur, R. and D. L. Dill, A theory of timed automata, Theoretical Computer Science 126 (1994), pp. 183
235.
URL citeseer.ist.psu.edu/alur94theory.html
[3] Alur, R., M. McDougall and Z. Yang, Exploiting behavioral hierarchy for ecient model checking., in:
CAV, 2002, pp. 338342.
[4] Behrmann, G., K. G. Larsen, J. Pearson, C. Weise and W. Yi, Ecient timed reachability analysis
using clock dierence diagrams, in: Computer Aided Verication, 1999, pp. 341353.
URL citeseer.ist.psu.edu/article/behrmann99efficient.html
[5] Bonifcio, A. L., A. V. Moura, A. d. S. Simo and J. C. Maldonado, Conformance Testing by
a
a
Model Checking Timed Extended Finite State Machines, in: Brazilian Symposium on Formal Methods
(SBMF06), Natal, 2006, pp. 4358.
[6] Campos, S. V., M. Minea, W. Marrero, E. M. Clarke and H. Hiraishi, Computing quantitative
characteristics of nite-state real-time systems, in: Proc. 15th IEEE Real-Time Systems Symp. (1994),
pp. 266270, san Juan, Porto Rico.
[7] Cardell-Oliver, R., Conformance tests for real-time systems with timed automata specications, Formal
Aspects of Computing 12 (2000), pp. 350371.
URL citeseer.ist.psu.edu/385816.html
[8] Chow, T. S., Testing software design modeled by nite-state machines, IEEE Transactions on Software
Engineering 4 (1978), pp. 178187.
[9] Cimatti, A., E. Giunchiglia, M. Pistore, M. Roveri, R. Sebastiani and A. Tacchella, Integrating bdd-based
and sat-based symbolic model checking., in: FroCos, 2002, pp. 4956.
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
39
[10] da Silva, D. A. and P. D. L. Machado, Towards test purpose generation from ctl properties for reactive
systems., Electr. Notes Theor. Comput. Sci. 164 (2006), pp. 2940.
[11] Dickhfer, M. and T. Wilke, Timed alternating tree automata: the automata-theoretic solution to the
o
tctl model checking problem, in: 26th ICALP, LNCS 1644, 1999, pp. 281290.
URL citeseer.ist.psu.edu/article/dickhfer99timed.html
[12] Dorofeeva, R., K. El-Fakih and N. Yevtushenko, An improved conformance testing method, in: Formal
Techniques for Networked and Distributed Systems, Lecture Notes in Computer Science 3731 (2005),
pp. 204218.
[13] En-Nouaary, A., R. Dssouli and F. Khendek, Timed wp-method: Testing real-time systems, IEEE Trans.
Softw. Eng. 28 (2002), pp. 10231038.
[14] Fujiwara, S., G. V. Bochmann, F. Khendek, M. Amalou and A. Ghedamsi, Test selection based on
nite state models, IEEE Transaction on Software Engineering 17 (1991).
[15] Gargantini, A., Conformance testing, in: M. Broy, B. Jonsson, J.-P. Katoen, M. Leucker and
A. Pretschner, editors, Model-Based Testing of Reactive Systems: Advanced Lectures, Lecture Notes in
Computer Science 3472 (2005), pp. 87111.
[16] Gill, A., Introduction to the theory of nite-state machines, McGraw-Hill, New York, 1962.
[17] Gonnenc, G., A method for the design of fault detection experiments, IEEE Transactions on Computing
19 (1970), pp. 551558.
[18] Higashino, T., A. Nakata, K. Taniguchi and A. R. Cavalli, Generating test cases for a timed
i/o automaton model, in: Proceedings of the IFIP TC6 12th International Workshop on Testing
Communicating Systems (1999), pp. 197214.
[19] Hirai, T., An application of temporal linear logic to Timed Petri Nets, in: Proceedings of the Petri
Nets99 Workshop on Applications of Petri Nets to Intelligent System Development, 1999, pp. 213.
[20] Krichen, M., State identication, in: M. Broy, B. Jonsson, J.-P. Katoen, M. Leucker and A. Pretschner,
editors, Model-Based Testing of Reactive Systems: Advanced Lectures, Lecture Notes in Computer
Science 3472 (2005), pp. 87111.
[21] Krichen, M. and S. Tripakis, Black-box conformance testing for real-time systems, in: Model Checking
Software: 11th International SPIN Workshop, number 2989 in Lecture Notes in Computer Science,
Barcelona, Spain, 2004, pp. 109126.
[22] McMillan, K. L., Symbolic Model Checking: An Approach to the State Explosion Problem, Kluwer
Academic, 1993.
[23] Merz, S., Model checking: A tutorial overview, in: F. C. et al., editor, Modeling and Verication of
Parallel Processes, Lecture Notes in Computer Science 2067, Springer-Verlag, Berlin, 2001 pp. 338.
[24] Mller, J. B., Simplifying xpoint computations in verication of real-time systems (2002).
URL
[25] Nr, B., M. Dickhofer and T. Wilke, The automata-theoretic method works for TCTL model checking
(1998).
URL
[26] Outt, A. J., Y. Xiong and S. Liu, Criteria for generating specication-based tests, in: Fifth IEEE
International Conference on Engineering of Complex Computer Systems (ICECCS 99), Las Vegas,
NV, 1999, pp. 4150.
[27] Petrenko, A., S. Boroday and R. Groz, Conrming congurations in efsm testing, IEEE Trans. Softw.
Eng. 30 (2004), pp. 2942.
[28] Petrenko, A. and N. Yevtushenko, Testing from partial deterministic fsm specications, IEEE
Transactions on Computers 54 (2005).
[29] Tretmans, J., Test generation with inputs, outputs, and quiescence., in: T. Margaria and B. Steen,
editors, Tools and Algorithms for Construction and Analysis of Systems, Second International
Workshop, TACAS 96, Passau, Germany, March 27-29, 1996, Proceedings, Lecture Notes in Computer
Science 1055 (1996), pp. 127146.
[30] Tretmans, J., Testing concurrent systems: A formal approach, in: J. Baeten and S. Mauw, editors,
CONCUR99 10th Int. Conference on Concurrency Theory, Lecture Notes in Computer Science
1664 (1999), pp. 4665.
40
A.L. Bonifcio et al. / Electronic Notes in Theoretical Computer Science 195 (2008) 2140
[31] Wang, C.-J. and M. T. Liu, Generating test cases for efsm with given fault models., in: INFOCOM,
1993, pp. 774781.
[32] Wang, F., Ecient verication of timed automata with bdd-like data structures., STTT 6 (2004),
pp. 7797.
[33] Wang, F., Formal verication of timed systems: A survey and perspective., Proceedings of the IEEE
92 (2004), pp. 12831307.
[34] Wang, F., Symbolic parametric safety analysis of linear hybrid systems with bdd-like data-structures,
Software Engineering, IEEE Transactions on 31 (2005), pp. 3851.
[35] Wang, F., Under-approximation of the Greatest Fixpoints in Real-Time System Verication, ArXiv
Computer Science e-prints (2005), pp. 1060+.
[36] Wang, F., G.-D. Hwang and F. Yu, Tctl inevitability analysis of dense-time systems., in: CIAA, 2003,
pp. 176187.
Apndice I
A. S. Simo, A. Petrenko, N. Yevtushenko.
Generating Reduced Tests for FSMs with Extra
States. In: 21st IFIP Int. Conference on Testing of
Communicating Systems and the 9th Int. Workshop
on Formal Approaches to Testing of Software, 2009.
p. 129-147, Eindhoven, Holanda.
180
1 Introduction
Finite State Machines (FSMs) have been used to model systems in many areas, such as
hardware design, formal language recognition, conformance testing of protocols [1]
and object-oriented software testing [2]. Regarding test generation, one of the main
advantages of using FSMs is the existence of generation methods which guarantee full
fault coverage: given a specification FSM with n states and any black-box
implementation which can be modelled as an FSM with at most m states, m n, the
methods generate a test suite, often called m-complete test suite, which has the ability
to detect all faults in any such implementations. In the particular case of m = n, there
are many efficient methods which generate complete test suites [7] [3] [5] [10] [4].
However, on the other hand, in spite of the fact that the problem of generating mcomplete test suites for m > n is a longstanding one which can be traced back to the
work of Moore [11] and Hennie [9], it has received much less attention compared to
the problem of constructing n-complete test suites. One of the main reasons might be
the fact that test generation becomes more challenging in the case of extra states. It is
known that an m-complete test suite should include each sequence in the so-called
M. Nez et al. (Eds.): TESTCOM/FATES 2009, LNCS 5826, pp. 129145, 2009.
IFIP International Federation for Information Processing 2009
130
traversal set, which contains all input sequences with m n + 1 inputs [13]. Moreover,
the traversal set should be applied to each state of the specification. Not surprisingly,
all, not numerous, existing methods for generating m-complete test suites [13] [3] [5]
[14] [4] [8] [12] do exactly this and differ only in a type of state identification
sequences they add to traversal sequences.
Driven by this observation and the obvious absence of significant progress in
solving the longstanding problem of generating m-complete test suite, we revisit it in
this paper and aim at answering the question whether m-complete test suite is
irreducible due to the inevitability of the traversal set.
We observe that a considerable part of an m-complete test suite is not related to the
traversal set itself, but to the test branching when a test has to be repeatedly executed
to apply all the sequences of the traversal set. Apparently, the test length reduction
can only be achieved by reducing the test branching, which in turn can be obtained by
distributing the traversal set over several tests. The caveat is that an arbitrary
distribution of the traversal set may break the m-completeness of a resulting test suite.
Thus, we need first to establish conditions for a distribution of the traversal set such
that the m-completeness of a test suite is preserved. The main idea developed in this
paper is to distribute it among those tests in a test suite which are convergent, i.e.,
transfer to the same state, in all FSMs of the fault domain which pass the test suite.
The approach we elaborate is based on properties of FSM tests, namely their
convergence and divergence. We investigate when the convergence and divergence of
tests in the specification (which can be easily checked) can be safely assumed to also
hold in the implementation under test. The divergence of two tests can be witnessed
by different outputs produced by the tests. On the other hand, although convergence
of two tests cannot be directly ascertained by considering only the two tests, we show
that the knowledge of the maximum number of states of FSMs in the fault domain can
be used to formulate conditions for the convergence of tests. We then use the notion
of convergence and divergence to state necessary and sufficient conditions for a test
suite to be m-complete.
Based on these conditions, we elaborate a method, called SPY-method, for mcomplete test suite generation. The method distributes the sequences of the traversal
set over several tests in order to reduce test branching and generate shorter test suites.
To assess the potential saving which can be obtained with the approach proposed in
this paper, we experimentally compare it with the HSI method [14]. The results
suggest that SPY-method can generate test suites up to 40% shorter, on average.
The rest of the paper is organized as follows. In Section 2, we provide the
necessary basic definitions. In Section 3, we formally state the problem of generating
m-complete test suites and discuss existing methods. In Section 4, we investigate test
properties and formulate conditions for guaranteeing the m-completeness of test
suites. In Section 5, we develop a generation method based on the proposed
conditions. In Section 6, the method is illustrated on an example. Experimental results
are reported in Section 7 and Section 8 concludes the paper.
2 Definitions
A Finite State Machine is a (complete) deterministic Mealy machine, which can be
defined as follows.
131
Definition 1. A Finite State Machine (FSM) S is a 6-tuple (S, s0, X, Y, S, S), where
132
133
b/0
b/0
a/1
2
1
a/0
Fig. 1. FSM S0
b/0
a/1
a/0
2
1
a/0
b/0
2'
a/0
1'
b/0
b/0
Fig. 2. FSM S1
domain 4, any 4-complete test suite for S0 should include all input sequences of
length three, applied to all states of S0. In the general case, an m-complete test suite
for an FSM with n states should include all input sequences of length + 1, applied to
each state. An early work of Moore [11] uses such sequences to establish a lower
bound for sequences identifying combination lock machines. In fact, the lower
bound for the length of an m-complete test suite for an FSM with n states and p inputs
is O(n3p+1), i.e., it is exponential on the number of extra states [13].
Existing methods, such as W [13] [3], Wp [5], HSI [14] and H [4], which generate
an m-complete test suite T for a given minimal deterministic FSM S can be
summarized as follows.
Step 1: Determine a minimal initialized state cover K for S.
Step 2: Extend the sequences in K by the (traversal) set X+1.
Step 3: Extend the sequences in K.X+1 in such a way that any two divergent
sequences, i.e., reaching distinct states in S, are T-separable.
Existing methods differ mainly in the sequences they use to ensure T-separability in
+1
Step 3. In the W method, all sequences in K.X are extended by a characterization
set. The Wp method uses a characterization set for sequences in K. X and state
identifiers for the other sequences. The HSI method uses the harmonized state
+1
identifiers for all sequences in K.X . The H method determines on-the-fly a
distinguishing sequence for states reached by each pair of divergent sequences in K.
+1
X .
We illustrate the generation of a 3-complete test suite for the 2-state FSM in Figure 1
following the strategy used by the existing methods. For this machine, the
134
a
1
a
2
a
1
1
a
2
a
1
If, in Step 1, shortest transfer sequences are included into a state cover and, in Step 3,
shortest distinguishing sequences are used, tests in a resulting m-complete test suite
cannot be shortened and if we want to reduce the total length of a test suite we need to
find a way of reducing test branching. Indeed, once a test of length l branches into k
tests, the test prefix of l inputs contributes kl inputs to the total length of a test suite.
For instance, each of tests aa, ab and b branches into two tests in T1, thus contributing
twice to its total length. In the existing methods, test branching occurs mainly in Step 2,
where each test in a minimal state cover is extended by the sequences in the traversal
+1
+1
set X . As a result of this, such a test branches into at least |X| tests. Apparently,
the test length reduction could be achieved by reducing the test branching, which in
+1
turn can be performed by distributing the traversal set X over several tests. As
soon as one of these tests is a proper prefix of another the overall test branching and
thus the test length are reduced. This key observation is illustrated in Figure 4.
Assume that test should be extended by the sequences aa and ba. In Figure 4(a)
both sequences extend , branching the test. Consequently, contributes twice to the
length of the test suite. Suppose that tests and b are convergent, and, instead of ,
the test b is extended by aa, as shown in Figure 4(b). We note that this results in a
test suite which is, all things being equal, || 1 inputs shorter than before. The
problem is that an arbitrary distribution of the traversal set may break the mcompleteness of a resulting test suite. Thus, we need first to establish conditions for a
+1
distribution of the traversal set X such that the m-completeness of a test suite is
s0
b
s
135
a
a
(a)
(b)
preserved. The main idea developed in this paper is to distribute it among those tests
in a test suite which are convergent, i.e., transfer to the same state, in all FSMs of the
fault domain which pass the test suite, reducing test branching.
4 Test Properties
The approach elaborated in this paper is based on properties of FSM tests, namely
their convergence and divergence. Recall that two defined input sequences of an FSM
converge or diverge if they are transfer sequences for the same state or for different
ones, respectively. We generalize these notions to sets of FSMs. Given a non-empty
set of FSMs and two tests , X*, we say that and are -convergent, if
they converge in each FSM of the set . Similarly, we say that and are divergent, if they diverge in each FSM of . Two tests are S-convergent (S-divergent)
if they are {S}-convergent ({S}-divergent). Moreover, when it is clear from the
context, we will drop the set in which tests are convergent or divergent.
Test convergence and divergence with respect to a single FSM are complementary,
i.e., any two tests are either convergent or divergent. However, when a set of FSMs
is considered, some tests are neither -convergent nor -divergent. Notice that the convergence relation is reflexive, symmetric, and transitive, i.e., it is an equivalence
relation over the set of tests. Given a test , let [] be the corresponding equivalence
class in a non-empty set of FSMs with the same input alphabet. The test
convergence and divergence possess the following properties.
Lemma 1. Given tests , , such that [] = [], the following properties hold:
(i)
(ii)
An important property of T-separable tests is that they are divergent in all FSMs
which are T-equivalent to S. Given a test suite T, let (T) be the set of all Q ,
136
such that Q and S are T-equivalent, i.e., (T) is the set of all FSMs in which pass
the test suite T.
Lemma 2. Given a test suite T of an FSM S, T-separable tests are (T)-divergent.
Proof. Let tests and be T-separable. Thus, there exist a sequence such that ,
T and S(S(s0, ), ) S(S(s0, ), ). Let Q be an FSM T-equivalent to S; thus,
we have that S(S(s0, ), ) = Q(Q(q0, ), ) and S(S(s0, ), ) = Q(Q(q0, ), ). It
follows that Q(Q(q0, ), ) Q(Q(q0, ), ). Thus, Q(q0, ) Q(q0, ).
Existing methods for test generation ensure that two tests are divergent by extending
them with an appropriate distinguishing sequence. However, Lemmas 1 and 2 indicate
that the convergence and divergence of tests also applies to their equivalence classes.
It is thus important to identify under which conditions tests are guaranteed to be
convergent, i.e., belong to the same equivalence class.
Ensuring convergence is more involved than ensuring divergence; divergence of
two tests can be witnessed by different outputs produced in response to a common
suffix sequence. The two tests are thus divergent in any FSM T-equivalent to S.
However, convergence of two tests cannot be directly ascertained by considering only
the two tests. It turns out that the knowledge of the maximum number of states of
FSMs in the fault domain allows us to formulate conditions for the convergence of
tests. Given a test suite T and a natural number m n, let m(T) = m (T), i.e., the
set of FSMs in which are T-equivalent to S and have at most m states.
As S is in the fault domain m(T), tests which are m(T)-convergent are also Sconvergent. Thus, two tests can be m(T)-convergent only if they are S-convergent.
Definition 3. A set of tests is m(T)-convergence-preserving if all its S-convergent
tests are m(T)-convergent. Similarly, a set of tests is m(T)-divergence-preserving if
all its S-divergent tests are m(T)-divergent.
In other words, a set of tests is m(T)-convergence-preserving if the convergence in
the specification FSM is preserved in each FSM which passes the test suite T.
Similarly, a set of tests is m(T)-divergence-preserving if the divergence in the
specification FSM is preserved in each FSM which passes the test suite T.
In the following lemma, the m(T)-convergence relation is considered; thus, [] is
the subset of tests of T which are m(T)-convergent with test .
Lemma 3. Given a test suite T for an FSM S and = m - n 0, let and be Sconvergent tests in T, such that, for any sequence of length , there exist tests
[], [], and an m(T)-divergence-preserving state cover for S in T containing
{, }.pref(). Then, and are m(T)-convergent.
Proof. Suppose that and are not m(T)-convergent. Thus, there exists Q m(T),
such that and are Q-divergent. As and are S-convergent, the FSM Q is not
equivalent to S and there must exist an input sequence such that S and Q are {,
}-distinguishable. Assume that is a shortest input sequence with this property.
Thus,
S and Q are (([] []).')-equivalent, for all ', such that |'| < ||.
(1)
137
We have that || > , since otherwise there would exist ' [] and ' [] such
that {', '} T, implying that S and Q are T-distinguishable.
Let [] and [] be such that there exists an m(T)-divergence-preserving
state cover for S in T containing the set {, }.pref(), where i is the prefix of of
length i. Without loss of generality, we assume that S and Q are {}-distinguishable,
i.e., Q(q0, ) S(s0, ). Let Ai = {, }.pref(i), 0 i . The tests i and i are
Q-divergent and, moreover, Ai is m(T)-divergence-preserving. We show by
induction that, for all 0 i , |Q(q0, Ai)| i + |S(s0, Ai)| + 1.
Base case: For i = 0, we have that A0 = {, }. As and are S-convergent and Qdivergent, the result follows, since |Q(q0, A0)| = 2 and |S(s0, A0)| = 1.
Inductive Step: Suppose that the result holds i, 0 i < , i.e.,
|Q(q0, Ai)| i + |S(s0, Ai)| + 1.
(2)
We show that the result holds for i + 1. Let j i. Suppose that i+1 and j are Sdivergent; then i+1 is Q-divergent with j and j, since Ai+1 is m(T)-divergencepreserving. Suppose now that i+1 and j are S-convergent. Let be the suffix
which extends i+1 in , i.e., = i+1. If i+1 is Q-convergent with j, then j
distinguishes S and Q, since Q(q0, j) = Q(q0, i+1) = Q(q0, ) S(s0, ) =
S(s0, i+1) = S(s0, j). As |j| < |i+1| = ||, it follows that i+1 should be Qdivergent with j and j, since otherwise we have a contradiction to (1). By the
same token, the test i+1 is Q-divergent with j. Thus, i+1 is Q-divergent with j,
j i, i.e., with all tests in Ai and reaches a state in Q which is not reached by the tests
in Ai. Hence,
|Q(q0, Ai+1)| |Q(q0, Ai)| + |Q(q0, i+1)| |Q(q0, Ai)| + 1.
(3)
(4)
On the other hand, if i+1 is S-divergent with all tests in Ai, then
|S(s0, Ai+1)| = |S(s0, Ai)| + 1
(5)
In this case, i+1 is also Q-divergent with all tests in Ai, since Ai+1 is m(T)divergence-preserving. Moreover, i+1 is Q-divergent with i+1. Thus, we have that
|Q(q0, Ai+1)| = |Q(q0, Ai)| + |Q(q0, {j, j})| |Q(q0, Ai)| + 2
The induction also applies, since
|Q(q0, Ai)| i + |S(s0, Ai)| + 1
(inductive hypothesis (2))
|Q(q0, Ai)| + 2 (i + 1) + (|S(s0, Ai)| + 1) + 1
|Q(q0, Ai+1)| (i + 1) + |S(s0, Ai+1)| + 1
(due to (5) and (6))
(6)
138
This concludes the induction proof. Then, for all 0 i , it holds that |Q(q0, Ai)| i
+ |S(s0, Ai)| + 1. In particular, the set of tests A reaches at least + |S(s0, A)| + 1
states in Q.
Consider now a smallest set K, such that K A is an m(T)-divergence-preserving
state cover for S in T; thus, |K| = n |S(s0, A)|, since and are S-convergent. As K
A is m(T)-divergence-preserving, the tests of the set K reach exactly n |S(s0,
A)| states in Q, and each of them is distinct from all states reached by A. Thus, the
tests in K A reach at least n |S(s0, A)| + + |S(s0, A)| + 1 = n + m n + 1 = m
+ 1 states in Q, contradicting the fact that Q has at most m states.
The importance of Lemma 3 for test generation is that it shows how to ensure the
m(T)-convergence of two S-convergent tests. This in turn, allows including these
tests into the same equivalence class. Then, Lemma 1 can be applied, which indicates
that if a test should be extended by given sequences, e.g., from the traversal set, any
tests of its equivalence class can be chosen, distributing these sequences over several
tests. Lemma 3 also leads to the necessary and sufficient conditions for test
completeness with respect to the fault domain m, where each FSM has at most m
states, m n.
Theorem 1. Let T be a test suite for an FSM S with n states and m n. Then, the
following statements are equivalent:
(i) T is an m-complete test suite for S
(ii) T contains an m(T)-convergence-preserving initialized transition cover for S.
Proof
(ii) (i) Let T contain an m(T)-convergence-preserving initialized transition
cover A for S, and Q m(T). Define the relation h S Q as follows:
(s, q) h there exists A, such that S(s0, ) = s and Q(q0, ) = q.
As A is a transition cover for S, for each s S there exists q Q such that (s, q) h.
Moreover, as A is m(T)-convergence-preserving, for each s S, there exists only one
q Q such that (s, q) h; thus, h is a mapping. As A,
h(s0) = q0.
Let s S and x X. As A is a transition cover for S,
there exists x A such that S(s0, ) = s.
Correspondingly,
h(S(s0, ), x) = h(S(s0, x)) = Q(q0, x) = Q(Q(q0, ), x) = Q(h(S(s0, )), x)
and
S(S(s0, ), x) = Q(Q(q0, ), x) = Q(h(S(s0, )), x),
as Q m(T).
Thus, h is an isomorphism and, as h(s0) = q0, it follows that Q is equivalent to S.
(i) (ii) Let T be an m-complete test suite. First, notice that any m-complete test
suite is a transition cover for the FSM S. Otherwise, there exists a transition of S
which is not traversed by the test suite; an FSM that is T-equivalent to, but
139
140
Then, the tests in K are extended by the appropriate state identifiers. Each block in the
initial partition is a singleton, since no convergence is initially known. The method
iterates until the set of tests which are m(T)-convergent with the tests in K becomes a
transition cover for S.
During the execution of the method, it is necessary to extend two tests in T to
ensure their divergence. As the divergence of tests also applies to other tests in their
blocks, when more than one test is available in a given block, the one which will
result in a shorter test suite is selected. This is achieved as follows. Suppose that test
T should be added to T. Let be the longest prefix of which is in T. If is not a
proper prefix of another test in T, we have that len(T {}) = len(T) + || - ||, i.e.,
adding to T results only in extending the test by || - || input symbols. On the
other hand, if is a proper prefix of some other test in T, it holds that len(T {}) =
len(T) + || + 1, as it results in an additional testing branching. Thus, selection of a
test which has to be extended by some input sequence, e.g., a state distinguishing
sequence, should result, whenever possible, in extending some test in T that is not a
proper prefix of another test.
After adding new tests two blocks containing tests that are m(T)-convergent, are
merged, i.e., replaced by their union, iteratively. The merge of blocks can result in a
new partition for which the m(T)-convergence of other tests can be concluded, due to
the application of Lemma 1(i) and thus, the procedure of merging should be repeated.
We denote by closure() the partition obtained after merging the blocks of as
much as possible, by applying subset merging and Lemma 1(i).
We now present SPY-method.
Input: An FSM S with n states, a family of harmonized state identifiers H and a
natural number m n.
Output: An m-complete test suite.
Determine a minimal initialized state cover K.
T := pref({.H() | K})
:= {{}| T}
While there exists a transition (s, x) not covered by the set of tests in T which are
m(T)-convergent with some test in K
Let , K be such that S(s0, ) = s and S(s0, ) = S(s, x)
For each X, each H()
Select ' [], such that len(T {'x}) is minimal
T := T pref('x)
Select ' [], such that len(T {'}) is minimal
T := T pref(')
:= closure( {{} | {'x, '}.pref()})
End for
:= closure( {[x] []})
End while
Return T
141
In each iteration the proposed method deals with the set X, while the theoretical
results indicate that an m-complete test suite should include all sequences in the
traversal set X+1 [11] [8]. Notice, however, that to obtain a transition cover as
required by Theorem 1, the tests of a state cover has to be extended by X, which is in
its turn extended by X. Therefore, all sequences in the traversal set X+1 are indeed
present in the resulting test suite. Nevertheless, the distribution of the traversal set
over several tests usually results in shorter test suites, as demonstrated by the example
and the experimental results on the next sections.
Compared with the existing methods for m-complete test suite generation, SPYmethod requires the additional operations of handling the partitions of tests and selecting
the tests in a partition which lead to a minimal length increase. We discuss the overhead
imposed by these operations. The partitions used in the method can be efficiently handled
using a union-find structure [6]. The operation of merging blocks and determining to
which block a test belongs can be performed in O(Ack-1(l, l)), where Ack-1(l, l) is the
inverse of the extremely quickly-growing Ackermann function [6]. For any reasonable
value of l, Ack-1(l, l) is less than five, i.e., the running time of these operations is
effectively a small constant. In order to efficiently calculate a length increase caused by
new tests, test suites can be represented by trees. Then it is possible to identify when a
test will create a new test (branching at a non-leaf node) or extend an existing one
(extending a leaf node) by retrieving the information about nodes in the tree. As the size
of the tree is proportional to the length of the test suite, the overhead imposed by the
additional operations required by the method, i.e., maintaining the partitions and
determining the length increase, is polynomial in the length of the test suite.
6 Example
In this section, we illustrate the execution of the method. Consider the FSM in Figure 1.
We generate a 3-complete test suite, using the family of harmonized state identifiers as
in Section 3, H1 = H2 = {a}. Note that as before, n = 2 and m = 3.
142
The method determines a minimal initialized state cover K = {, a}. The test suite
is initialized with T := {.H() | K} = pref(aa) and the partition := {{}, {a},
{aa}}. Notice that the tests in K already cover the transition (1, a). Then, the method
iterates until all the other transitions are also covered by the tests which are m(T)convergent with either or a. Notice that in this example, both H1 and H2 contain only
the sequence a. Therefore, each state identifier used in the method is always equal to
{a}, i.e., = a throughout this example.
The method selects the transition (s, x) = (1, b); thus = = . At this stage each
block is a singleton; thus, selecting the empty sequence is the only option in the first
iteration. For each X = {, a, b}, the test is extended by x and ; namely,
the empty sequence is extended by the sequences ba, a, baa, aa, bba, and ba. The test
suite becomes T = pref({aa, baa, bba}) and the partition is updated to include the
new tests (each of them also becomes a singleton block in the partition). According to
Lemma 3, and b are now m(T)-convergent, thus, blocks {} and {b} should be
merged. After updating the partition and determining its closure, the partition =
{{, b, bb}, {a, ba, bba}, {aa, baa}} is obtained. The resulting test suite is
represented in Figure 4. The nodes with the same color are in the same block of the
partition .
1
b
a
2
2
a
a
1
The methods selects the transition (s, x) = (2, a). Then = a and = . In this
iteration, the blocks of the partition contain several tests; thus, there are choices when
selecting the test which is extended by the state identifier. For each X = {, a,
b}, some test in [] = [a] should be extended by x and some test in [] = []
should be extended by . For = some test in [a] = {a, ba, bba} has to be
extended by x = aa; the test suites resulting from extending a, ba and bba by aa
have lengths 12, 12 and 13, respectively. Thus, the test a is selected and aaa is added
to T. Then, some test in [] = {, b, bb} should be extended by a. As a T, no
additional test is included. For = a, some test in [a] has to be extended by x =
aaa and some test in [] by = aa. A test suite of shorter length can be obtained by
extending either a or ba. The test a is selected and aaaa is added to T. There is no
need to extend any sequence in [] by = aa, since aa T. For = b, = a, some
test in [a] should be extended by x = aba and some test in [] by = ba.
143
Extending tests a, ba and bba by aba results in test suites of lengths 17, 15 and 16,
respectively. The test ba is, then, selected and baaba is added to T. Again, there is no
need to extend any sequence in [] by = ba. The test suite becomes T =
pref({aaaa, baaba, bba}). The tests and aa are now m(T)-convergent and thus,
blocks {, b, bb} and {aa, baa} should be merged. After merging these blocks and
deriving the closure, the partition = {{, aa, aaaa, b, baa, baab, bb}, {a, aaa, ba,
baaba, bba}} is obtained. Figure 5 represents the resulting test suite.
1
b
a
2
a
1
a
2
a
a
a
1
a
1
1
a
2
It remains to cover the transition (s, x) = (2, b); thus = = a. For = , some test in
[a] = {a, aaa, ba, baaba, bba} should be extended by x = ba and = a. The test
suites obtained by extending either test baaba or bba by ba have the same length; the
test bba is then selected and bbaba is added to T. Some test in [a] has to be extended
by = a, which does not need any additional test, since aa T. For = a, some test in
[a] should be extended by x = baa and = aa. The test suite of a shorter length is
obtained by extending bba by baa and the test bbabaa is added to T. There is no need to
extend any test in [a] by aa, since aaa T. For = b, some test in [a] should be
extended by x = bba and = ba. The test suite of a shorter length is obtained by
extending baaba by bba and the test baababba is added to T. To extend some test in
[a] by = ba, no additional test is required, since baaba T and baa [a]. The
resulting test suite is T = pref({aaaa, baababba, bbabaa}) of length 21. Recall that the
test suite T1 obtained by the existing methods for the machine in Figure 1 has length 28.
7 Experimental Results
In this section, we present the results of an experiment with the HSI method and the
proposed method, comparing the length of the test suites they generate. We randomly
generate minimal FSMs with five inputs, five outputs and the number of states n
ranging from five to 50. We executed both the HSI method and the proposed method
144
for generating m-complete test suites, for n m n + 3 and calculated the ratio of
reduction, i.e., the average ratio of the length of the test suite generated by SPYmethod and the length of the test suite generated by the HSI method. For each setting
(values of n and m), we generated 30 FSMs and the respective test suites, totalling
5520 FSMs. In Figure 6, we plot the variation of the average ratio with respect to the
number of states. We notice that the test suites generated by our method are on
average up to 40% shorter than the test suites obtained by the HSI method; moreover,
the larger the number of states in the specification FSM and the number of extra states
in implementations, the bigger the reduction.
8 Conclusions
In this paper we investigated the problem of generating m-complete test suites for an
FSM with n states, when implementation FSMs may have extra states.
The main contributions of this paper are as follows. Firstly, although we have not
refuted the inevitability of including the sequences of a traversal set in an m-complete
test suite, we showed that these sequences can be arranged in such a way that test
branching is significantly reduced. Secondly, we stated conditions which guarantee
that the resulting test suite is indeed m-complete and elaborated a test generation
method based on these conditions. Differently from all existing methods, the proposed
method distributes the sequences in the traversal set over several tests avoiding as
much as possible test branching and thus leading to shortening of the resulting test
suite. Finally, we experimentally compared the proposed method with the HSImethod. The experimental results indicate that obtained tests are on average up to
40% shorter.
145
Acknowledgements
The authors acknowledge financial supports of NSERC (Grant OGP0194381),
Brazilian Funding Agency CNPq (Grant 200032/2008-9), and FCP Russian program
(contract 02.514.12.4002).
References
1. Bochmann, G.v., Petrenko, A.: Protocol testing: review of methods and relevance for
software testing. In: ACM International Symposium on Software Testing and Analysis
(ISSTA 1994), pp. 109124. ACM Press, New York (1994)
2. Binder, R.: Testing Object-Oriented Systems. Addison-Wesley, Inc., Reading (2000)
3. Chow, T.S.: Testing software design modeled by finite-state machines. IEEE Trans. Softw.
Eng. 4(3), 178187 (1978)
4. Dorofeeva, R., El-Fakih, K., Yevtushenko, N.: An improved conformance testing method.
In: Wang, F. (ed.) FORTE 2005. LNCS, vol. 3731, pp. 204218. Springer, Heidelberg
(2005)
5. Fujiwara, S., von Bochmann, G., Khendek, F., Amalou, M., Ghedamsi, A.: Test selection
based on finite state models. IEEE Trans. Softw. Eng. 17(6), 591603 (1991)
6. Galil, Z., Italiano, G.F.: Data structures and algorithms for disjoint set union problems.
ACM Comput. Surv. 23(3), 319344 (1991)
7. Gonenc, G.: A method for the design of fault detection experiments. IEEE Trans. on
Comput. 19(6), 551558 (1970)
8. Lee, D., Yannakakis, M.: Principles and methods of testing finite state machines - a
survey. Proceedings of the IEEE. 84(8), 10901123 (1996)
9. Hennie, F.C.: Fault-detecting experiments for sequential circuits. In: Proceedings of Fifth
Annual Symposium on Circuit Theory and Logical Design, Princeton, New Jersey, pp. 95
110 (1965)
10. Hierons, R.M., Ural, H.: Optimizing the length of checking sequences. IEEE Trans. on
Comput. 55(5), 618629 (2006)
11. Moore, E.F.: Gedanken-experiments on sequential machines. Automata Studies, Annals of
Mathematical Studies (34), 129153 (1956)
12. Petrenko, A., Higashino, T., Kaji, T.: Handling redundant and additional states in protocol
testing. In: IFIP 8th Inter. Workshop on Protocol Test Systems, pp. 307322. Chapman &
Hall, Boca Raton (1995)
13. Vasilevskii, M.P.: Failure diagnosis of automata. Cybernetics 4, 653665 (1973)
14. Yevtushenko, N., Petrenko, A.: Synthesis of test experiments in some classes of automata.
Automatic Control and Computer Sciences 24(4), 5055 (1990)
Apndice J
A. L. Bonifcio, A. Moura, A. S. Simo. A Generalized
Model-based Test Generation Method. In: The 6th
IEEE International Conferences on Software
Engineering and Formal Methods, p. 139-148, Cape
Town, Africa do Sul, 2008.
198
2008 Sixth IEEE International Conference on Software Engineering and Formal Methods
Abstract
coverage[17], while considering deterministic FSM implementations with up to m states. In fact, our method can
generate test suites using only subsets of any characterization set. We discuss how to rene the generalization in order
to arrive at the original W-method, demonstrating that the
latter is a particular case of our method. Proofs of correctness are presented in a clear form, including the correctness
for the original W-method.
This paper is organized as follows. In Section 2 we describe some work related to our proposal, and we review
some basic concepts. The concept of transition covers for
FSMs is presented in Section 3. In Section 4 we introduce
equivalence in FSMs, and stratied families of sets. The
generation of a complete test suite is presented in Section 5.
In Section 6 we reconsider characterization sets. How to
rene our method in order to obtain the original W-method
is described in Section 7. In Section 8 we present the algorithm for the generalized method, and illustrate its usefulness with an example in Section 9. Finally, in Section 10,
we give some concluding remarks.
In this paper we present a generalization to the Wmethod [3], which can be used for automatically generating
test cases. In contrast to the W-method, this generalization allows for test case generation even in the absence of
characterization sets for the specication. We give proofs of
correctness for this generalization, and show how to derive
the original W-method from it as a particular case. Proofs
of correctness for the W-method, not given in the original
paper, are also presented in a clear and detailed way.
1 Introduction
Conformance testing aims at demonstrating that the implementation behavior conforms to the behavior dictated by
the specication [7, 20, 21]. In the literature, there are many
model-based test derivation methods for conformance testing of critical and reactive systems [4, 14, 22]. The problem
of generating test cases for conformance testing has been
intensively studied, specially for models based on Finite
State Machines (FSMs) [5, 9, 10, 11, 19, 23]. One of the
most well-known of these test generation methods is the Wmethod [3], which uses the notion of characterization sets.
The W-method was proposed for deterministic FSMs and
it has been widely investigated, and many variations have
been developed around its main ideas [11, 12, 13, 18].
In this paper we present a generalization of the Wmethod. This generalization allows us to derive a mcomplete test suite without using a characterization set. A
test suite is m-complete if it guarantees a complete fault
2 Related Works
This section reviews the FSM model and some important
related notions. We also present more details about the Wmethod and other variant model-based test generation methods, such as the Wp and HSI methods.
2.1
Supported
139
s,
(, (a, s)), where a X and X .
The Wp -method A related technique, the so called Wp method [6], can potentially reduce the total length of the
test sequences generated by the basic W-method. Again, let
W be a characterization set for the specication model, M .
For each state si of M , an identication subset Wi W
is obtained. The idea is that for each state sj of M , with
si = sj , there exists an input sequence j Wi such that
si and sj are distinguishable by j , and no other proper
subset of Wi has this property.
Then, a checking sequence for each state is prexed to all
sequences in the corresponding identication set. A checking sequence for a given state is simply an input sequence
reaching that state, when starting at the initial state. It is
proven [6] that the length of the resulting test sequences
may be shorter, compared to those sequences obtained using the complete P Z concatenation of the basic W-method.
(, s1 ) = s2 we also write s1 s2 .
We extend to : X S Y thus
( , s)
= ,
(a, s) = (a, s)(, (a, s)), with a X, X .
Henceforth, unless mention to the contrary, we will assume that M and M denote FSMs in the form M =
(X, Y, S, s0 , , ) and M = (X, Y , S , s0 , , ). Note
that M and M have the same input alphabet.
The reachability notion expresses the idea of starting at
the initial state, traversing some transitions, and reaching a
target state.
Denition 1 A state s in a FSM M is reachable if and only
if there exists X such that (, s0 ) = s.
2.2
FSM-based testing
3 Transition Covers
The W-method The objective is to verify whether implementation models conform to a specication model, as characterized by the behavior responses generated by external
stimuli [3].
140
This section deals with state equivalence relations induced by the transition functions of the extended machines.
The next denition exposes those notions in a general context.
141
Let M be a FSM and let Z X be a set of input sequences. We indicate by [Z] the partition induced by Z
(see observation after Denition 7) over the states of M ,
i.e, s Z r if and only if s, r w, for some w [Z]. Let
[Z1 ] and [Z2 ] be two partitions over S. Then we say that
[Z2 ] renes [Z1 ] if and only if for all w2 [Z2 ] there exists
some w1 [Z1 ] such that w2 w1 .
The next result expresses properties of these partitions.
Lemma 13 Let {Zi }i0 be a stratied family over the alphabet X of a FSM M . Then
1. [Zi+1 ] renes [Zi ], for every i 0; and
Proof Trivial.
In the sequel, we will be considering specic sets of input sequences.
Denition 10 Let Zi X , i 0, where X is an alphabet. We say that {Zi }i0 is a stratied family over X if
1. Z0 = ; and
2. (X { })Zi = Zi+1 , for every i 0.
It is easy to see that these properties are independent of each
other.
Another characterization for stratication is given as follows.
Proposition 11 Let Zi X , i 0, where X is an alphabet and with Z0 = . Then, the family {Zi }i0 is stratied
k
if and only if Zk = j=0 X j Z0 for every k 0.
Proof Details can be found in [2].
(a, s) =
(a, s)(, s1 )
(a, r)
(a, r)(, r1 ).
Then we have (a, s) = (a, r), thus forcing the contradiction s Zk+1 r. We conclude that s1 Zk+1 r1 .
Since Zk+1 , we deduce s1 r1 . Again,
(a, s)
142
(a, s)(, s1 )
(a, r)
(a, r)(, r1 ),
143
(, s0 )(, r)
(, s0 ) =
(, s0 ) (, r ).
and
= (, s0 )(a, r)(, s)
(a, s0 )
(2 , s0 ) =
(2 , s0 )(, s2 )
(2 , s0 ) =
(2 , s0 ) (, s2 )
= (, s0 ) (a, r )
and
= (, s0 ) (a, r )
(1 , s0 )
= (1 , s0 ) (, s1 ),
= (1 , s0 )(, s1 )
(1 , s0 )
= (, s0 ) (a, r ) (, s ).
(1 , s0 )
= (1 , s0 )(, s1 )
(1 , s0 )
= (1 , s0 ) (, s1 ).
Proof Let Zk =
X R, k 0. From Proposition 11
we have that such family {Zk }k0 is stratied. From Corollary 16 we conclude that Z distinguishes every pair of
nonequivalent states of M . Then the result follows directly
from Theorem 18.
(2 , s0 )
(2 , s0 )
6 Characterization Sets
= (2 , s0 )(, s2 )
= (2 , s0 ) (, s2 ),
and then (, s2 ) = (, s2 ). However, since we already know that s1 s2 and this leads to the contradiction
(, s1 ) = (, s2 ). This shows that the initial hypothesis
was false. Hence, whenever s1 s2 holds we must also
have s1 Z s2 , establishing the result.
144
Denition 21 Let M be a FSM and W a set of input sequences. W is a characterization set for M if W distinguishes any pair of nonequivalent states of M .
The required relation between M and Z says that Z is a
characterization set of M , under certain hypothesis.
Theorem 22 Let M and M be two FSMs operating over
the same input alphabet, X. Assume that M has index
m and that P is a cover set for M . Assume also that
W X is nonempty and partitions the states of M in
at least n m equivalence classes. If s0 P Z s0 then
mn
Z = i=0 X i W is a characterization set for M .
The same result indicates that when the relation induces a different number of equivalence classes in two
FSMs, these machines can not be equivalent to each other
(under the weak hypothesis of Theorem 23). On the other
hand, it is simple to obtain two nonequivalent FSMs, in a
such way that the relation induces the same number of
equivalence classes in both machines. For details, see [2].
Proof From Proposition 11 and from Corollary 16 we conclude that Z distinguishes every pair of nonequivalent states
of M . Since P is cover set for M , we conclude that every state of M is reachable. From s0 P Z s0 , together
with Corollary 19, we deduce s0 s0 . Now we can use
Lemma 20 and obtain that Z distinguishes every pair of
nonequivalent states of M . From Denition 21, Z is a characterization set for M .
It is also easy to see that the reverse does not hold. For
that, let M and M be two FSMs. It is clear that W = X
partitions the states of M and M in the maximum number
of equivalence classes. In this case, we will have Z = W =
X and, obviously, Z is a characterization set for M and
M . But it is not the case that we will always have s0 s0 ,
as it is easy to construct a counter-example.
Next result shows that, under relaxed conditions, when
two FSMs are equivalents both must have the same index.
When W is a characterization set for M we can guarantee the partitioning of M in a number of classes at least
equal to the index of M , if the machines are to be P Zequivalent.
Proof For the sake of contradiction, and without loss generality, we will assume n < n .
Let si S , 1 i n , be states from each one of n
equivalence classes induced by in S . Since all states of
M are reachable, we obtain i X with (i , s0 ) = si ,
1 i n . In M , we will have some si S such that
(i , s0 ) = si , 1 i n . Since n < n , without loss
generality, we can say that s1 s2 .
Take any z X . We have
(1 z, s0 ) =
(1 , s0 )(z, s1 )
(1 z, s0 ) =
(1 , s0 ) (z, s1 ).
and
145
s0
c/1
b/1
a/0
s1
s3
a, b, c/0
s2
a, b, c/1
a, b, c/0
Figure 1. Specication M .
s0
a/0
The next result is the main postulate of the basic Wmethod, as given in [3].
s1
b, c/1
s2
a, b, c/1
a, b, c/0
s3
s4
a, b, c/1
a, b, c/1
146
9 An Example
We apply the generalized algorithm to a simple example.
Example 29 Let a specication M be given as in Figure 3.
Then M has k = 4 states, its input alphabet is X = {a, b},
its output alphabet is Y = {0, 1}, and its transition function
is as depicted in the gure.
As we can see, some transitions over the input a produce
either the output 0 or the output 1. Hence, there are at least
two distinct classes. Now, if we use the sequences aa and ba
there is a good chance that such sequences can distinguish
other states as well. Therefore, we take R = {aa, ba} and
assume that R partitions M , an implementation candidate,
in at least n = 3 equivalence classes. If we accept m = 5
as a maximum on the number of states in M , we have all
input conditions for Algorithm 1 secured. Note that R is not
a/0
s0
s1
a/1
b/0
b/0
a/0
s2
a/0
s3
b/0
b/0
10 Concluding Remarks
The Finite State Machine (FSM) model is well established and has been intensively investigated as a foundation
147
[11] R. M. Hierons. Separating sequence overlap for automated test sequence generation. Automated Software Engg.,
13(2):283301, 2006.
[12] M. Krichen. State identication. In M. Broy, B. Jonsson,
J.-P. Katoen, M. Leucker, and A. Pretschner, editors, ModelBased Testing of Reactive Systems: Advanced Lectures, volume 3472 of Lecture Notes in Computer Science, pages 87
111. Springer-Verlag, 2005.
[13] G. Luo, G. von Bochmann, and A. Petrenko. Test selection based on communicating nondeterministic nite-state
ma chines using a generalized wp-method. IEEE Trans.
Softw. Eng., 20(2):149162, 1994.
[14] B. Nielsen and A. Skou. Test generation for time critical
systems: Tool and case study. ecrts, 00:0155, 2001.
[15] A. Petrenko, S. Boroday, and R. Groz. Conrming congurations in efsm testing. IEEE Trans. Softw. Eng., 30(1):29
42, 2004.
[16] A. Petrenko and G. v. Bochmann. Selecting test sequences for partially-specied nondeterministic nite state machines. In G. Luo, editor, IWPTS 94: 7th IFIP WG 6.1
international workshop on Protocol test systems, pages 95
110, London, UK, UK, 1995. Chapman & Hall, Ltd.
[17] A. Petrenko and N. Yevtushenko. Testing from partial
deterministic fsm specications. IEEE Trans. Comput.,
54(9):11541165, 2005.
[18] A. Rezaki and H. Ural. Construction of checking sequences
based on characterization sets. Computer Communications,
18(12):911920, 1995.
[19] D. Sidhu and T. Leung. Experience with test generation for
real protocols. In SIGCOMM 88: Symposium proceedings
on Communications architectures and protocols, pages 257
261, New York, NY, USA, 1988. ACM.
[20] D. P. Sidhu and T. kau Leung. Formal methods for protocol testing: A detailed study. IEEE Trans. Softw. Eng.,
15(4):413426, 1989.
[21] J. Tretmans. Test generation with inputs, outputs, and quiescence. In T. Margaria and B. Steffen, editors, Tools and
Algorithms for Construction and Analysis of Systems, Second International Workshop, TACAS 96, Passau, Germany,
March 27-29, 1996, Proceedings, volume 1055 of Lecture
Notes in Computer Science, pages 127146. Springer, 1996.
[22] J. Tretmans. Testing concurrent systems: A formal approach. In J. Baeten and S. Mauw, editors, CONCUR 99:
Proceedings of the 10th International Conference on Co
ncurrency Theory, volume 1664 of Lecture Notes in Computer Science, pages 4665, London, UK, 1999. SpringerVerlag.
[23] H. Ural, X. Wu, and F. Zhang. On minimizing the lengths
of checking sequences. IEEE Trans. Comput., 46(1):9399,
1997.
References
[1] A. L. Bonif cio, A. V. Moura, A. da Silva Sim o, and J. C.
a
a
Maldonado. Towards deriving test sequences by model
checking. Electron. Notes Theor. Comput. Sci., 195:2140,
2008.
[2] A. L. Bonif cio, A. V. Moura, and A. d. S. Sim o. A generala
a
ized model-based test generation method. Technical Report
IC-08-014, Instituto de Computacao, Universidade Estadual
148
|
https://pt.scribd.com/document/172590516/LD-Adenilso
|
CC-MAIN-2019-22
|
refinedweb
| 48,569
| 54.83
|
React applications are being composed of small components that can be used individually and in best case scenario can be reused across multiple applications. But what about the CSS that they need for layouting elements inside them?
Often you end up inventing a system for it, something like that: you group CSS rules by a class name for each component and everything that is specific to a component goes in there. It's a start but it's not perfect. Soon you start renaming stuff or you want to apply styles from a global perspective.
Coming from the Vue.js world, I especially liked the approach of Single File Components - everything that belongs to that component goes into one file, CSS, HTML and JavaScript or TypeScript and I wanted to have this in React too, so I took of into the world of CSS-in-JS.
CSS Modules
I came to React, looking for Single File Components all over the place and as it turns out, it's not that easy 😔 What I did find though, is CSS Modules 🥳
It works like this: you import the CSS as a JavaScript module , which have been mapped from your CSS class names and assign those as
className properties in the JSX. I used the npm package
typescript-plugin-css-modules for this. This is how a Component styled with it looks like:
import styles from "./foo.css"; const FooComponent = () => { return <div className={styles.myClassName}>Hello, World!</div>; };
I still wasn't satisfied with this approach as there were still two files to edit when the component needs to be modified. Then I learned about Emotion in Jason Lengstorf's Introduction to Gatsby course on Frontend Masters and it was exactly what I was looking for. I was intruiged 😁
Emotion to the rescue
To style React components with emotion, there are several options to choose from depending on your preferences and what you want to achieve. The one I like most as a starting point, is using the
css-template string helper that lets you write CSS like you would in a CSS file. This is a sample component using it to set a
width,
height and
background-color:
/** @jsxImportSource @emotion/react */ import { css } from "@emotion/react"; import React from "react"; function Card() { return ( <div css={css` width: 100px; height: 100px; background-color: red; `} > using the css template string helper </div> ); } export default Card;
Really simple, huh? The first line
/** @jsxImportSource @emotion/react */ tells the TypeScript compiler, how to resolve the css helper and it took me quite a while to figure it out!
But it can get quite messy when the component grows and contains more tags than just this one div. For this occasion, you can refactor the component and use styled components like this:
import styled from "@emotion/styled"; const ListItem = styled("li")` font-weight: bold; `; interface ListProps { items: Array<string>; } function List({ items }: ListProps) { return ( <ul> {items.map((item) => ( <ListItem key={item}>{item}</ListItem> ))} </ul> ); } export default List;
As you can see,
ListItem uses the
styled function to create a styled component that only adds CSS to a
li element and automatically renders its children in it.
Now I got to the point where I was satisfied. At least until I realized that I wanted to have kind of like a theming, where I would store colors, definitions of borders and such things that I would need over and over again in a central location. Emotion provides a Theming API, why not try that?
Theming
To start with the theme, I implemented a new class for it and created a new instance of it:
class Theme { readonly primaryColor: string = "green"; } const theme = new Theme();
Theming then works like this: you provide the Theme to your components using a
<ThemeProvider> and access the theme in the actual component using the
useTheme hook provided by
@emotion/react. Here's my App, that does exactly that:
import { ThemeProvider } from "@emotion/react"; function App() { return ( <div> <ThemeProvider theme={theme}> <MyComponentWithTheme /> </ThemeProvider> </div> ); }
And here is
MyComponentWithTheme, which uses both the Theme and the
css template string helper:
/** @jsxImportSource @emotion/react */ import { css } from "@emotion/react"; import { useTheme } from "@emotion/react"; import { Theme } from "../App"; function ComponentWithTheme() { const theme = useTheme() as Theme; return ( <div css={css` width: 100px; height: 100px; background: ${theme.primaryColor}; `} > Component using the Theme provided in App </div> ); } export default ComponentWithTheme;
Using that, I found a way to write the CSS I need for my components directly in the components. I still need to figure out what parts of the style sheets go into a component or into a global style sheet, but it's a start.
Of course emotion does a lot more than that (like adding vendor prefixes and stuff) but I am still learning about it and find it very interesting and fun. I am looking forward for your tips and tricks around emotion and CSS-in-JS in common!
Discussion (3)
In a bigger project over time you don't want to have your CSS mixed with JavaScript. There are two big reasons for this:
Maintenance and code readability suffer: the components become too big and verbose. When dealing with styles you want to focus on styles, when dealing with code you want to only see the relevant code. You could solve it by making style-only components and logic-only components, but if working with a team it is hard to keep the discipline.
Performance becomes an issue. And it isn't only the executional performance, but code size and duplication. On client browser with CSS-in-JS you have the actual CSS, you have the JS building CSS, and you have the code that converts the JS interpretation to CSS.
CSS Modules don't have either of the issues, because CSS remains in it's own file, only relevant CSS gets bundled, and there is no runtime interpretation. Themes: use CSS variables.
Thanks for your input! I am still a learner in frontend tech and haven't worked on large projects (yet). So would you advise to start with CSS Modules or go for CSS-in-JS only when the project won't become large anyways?
CSS-in-JS only if it won't become large. On large projects it is a constant struggle of fighting to have less JavaScript executing on client's browser, because you want to have a site that is fast to serve and fast to execute. Good metrics on these are good for both user experience and search engine ranking. And this is why building everything through JS is a bad idea.
|
https://practicaldev-herokuapp-com.global.ssl.fastly.net/domnikl/scoped-css-for-react-components-with-typescript-31a4
|
CC-MAIN-2021-43
|
refinedweb
| 1,102
| 56.89
|
I am trying write a program that has three sets with points defined by
Set A = {{x1, y1}, {x2, y2},{x3, y3} ...}
Set B = {{x1, y1}, {x2, y2}}
Set C = {{x2,y2},{x3,y3},{x4,y4},....}
I need to get the elements of the set such that ((A-B)intersection(C))
I have written the following program
public class sample {
HashSet<int[][]> shapeA = new HashSet<int[][]>();
HashSet<int[][]> shapeB = new HashSet<int[][]>();
HashSet<int[][]> shapeC = new HashSet<int[][]>();
int arrayA[][] = {{0,0},{100,50},{300,500}, {50, 100}, {0,0}};
int arrayB[][] = {{0,0},{100,50}};
int arrayC[][] = {{40,40},{50,100},{300,500}, {50, 100}, {40,40}};
int resultant[][] ;
Iterator<int[][]> resultantarray ;
public static void main(String args[]){
sample sam = new sample();
sam.logic();
}
public void logic(){
shapeA.add(arrayA);
shapeB.add(arrayB);
shapeC.add(arrayC);
shapeA.removeAll(shapeB);
shapeC.retainAll(shapeA);
resultantarray = shapeC.iterator();
while (resultantarray.hasNext())
{
resultant = resultantarray.next();
}
for (int i = 0 ; i < resultant.length; i ++)
{
System.out.println(resultant[i][0]);
}
}
}
But when I inspect (am using Eclipse) the variables in this line :
shapeA.removeAll(shapeB);
The HashSet shapeA does not seem to remove the points in HashSet shapeB. I see all the variables in shapeA as it is. Please let me know what I am doing wrong here.
Thanks for your help,
Vinay
Sheriff
HashSet uses the equals() method to determine whether two objects are the same and should be removed. And int[] has equals() implemented to check if two objects are pointing to the same int[]. It does not check that the values in the int[] are the same.
Since shapeA and shapeB have references to different physical int[]'s, they are not considered the same and are therefore not removed.
You can write your own comparator with the desired implementation and pass it to the HashSet to get the desired functionality.
[OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Originally posted by Jeanne Boyarsky:
You can write your own comparator with the desired implementation and pass it to the HashSet to get the desired functionality.
Aren't you confusing HashSet with TreeSet? HashSet can only use the object's hashCode() and equals() methods.
What of course is also possible is create a wrapper class:
You would need to define your sets and add elements as following:
Set<int[]> shapeA = new HashSet<int[]>();
Set<int[]> shapeB = new HashSet<int[]>();
Set<int[]> shapeC = new HashSet<int[]>();
...
shapeA.addAll(Arrays.asList(arrayA));
shapeB.addAll(Arrays.asList(arrayB));
shapeC.addAll(Arrays.asList(arrayC));
However this will not solve your problem because of the reason Jeanne explains.
Author of <a href="" target="_blank" rel="nofollow">NewsInjector</a>
My code puts a list of arrays (int[] arrays) into each of sets. There is no need to autobox from int[] to Integer[] in my code.
The best solution would probably be to define a Point class containing x and y fields as well as equals() method.
BTW, is the order of points important? If so, simple Set will not suffice. You may then create Point class with x, y and n, where n would point to Point's position in a SortedSet. Then you need to write custom Comparator to sort points by n.
Author of <a href="" target="_blank" rel="nofollow">NewsInjector</a>
The first adds one int[] to the HashSet<int[]>.
The second takes that same int[], puts it in a List<int[]> of size 1, then adds each element of that List<int[]> to the HashSet<int[]>. In other words, it still adds the one int[] to the HashSet<int[]>, but it takes some steps to do it.
If you would use add instead of addAll, then you would be adding a List<int[]> to the HashSet<int[]>. Which of course fails to compile due to incompatible types.
I do like your idea of using a Point class though. However, instead of creating a new class, use java.awt.Point instead. Sure, it's not Comparable, but you can use a Comparator<Point> if needed.
Yes, I need to create something like a point class. And the order of the elements in each of the points is also important. Let me post the actual problem and the solution I came up with. But it is not complete because It still fails with respect to the order. i.e. The points {10,50} and {50,10} are treated same in my code, which is wrong.
Problem :
===================
Shape A defined by a set of (x,y) points in the cartesian xy - plane.
Shape B defined by a set of (x,y) points in the cartesian xy -plane which creates a hollow hole inside of shape A.
Shape C defined by a set of (x,y) points in the cartesian xy-plane.
Write a JAVA console or windows program to find Shape E. E is the intersection of shape C with shape A where A has a hole shape B.
E is a set of (x,y) points in the cartesian xy - plane.
Input of program:
Input for A e.g. (Ax1,Ay1), (Ax2,Ay2), (Ax3,Ay3)�
Input for B e.g. (Bx1,By1), (Bx2,By2), (Bx3,By3)�
Input for C e.g. (Cx1,Cy1), (Cx2,Cy2), (Cx3,Cy3)�
Ouput of program :
Output for E e.g. (Ex1,Ey1), (Ex2,Ey2), (Ex3,Ey3)�
Please provide all code.
===================================
Solution code , which I am still working on. Also bear with me for the mistakes. Please feel free to correct it.
=====================================
import java.util.ArrayList;
public class programone
{
String Shape;
ArrayList<Integer> shapeA = new ArrayList<Integer>();
ArrayList<Integer> shapeB = new ArrayList<Integer>();
ArrayList<Integer> shapeC = new ArrayList<Integer>();
int arrayA[][] = {{100,50},{300,500}, {25, 45},{0,0}};
int arrayB[][] = {{100,50}};
int arrayC[][] = {{40,40},{100,50},{300,500}, {50, 100}, {0,0}};
int k=0;
int l=0;
int m=0;
public static void main(String args[]){
programone p1 = new programone();
p1.logic();
}
public void logic(){
for (int i = 0 ; i < arrayA.length ;i ++ )
{
for (int j =0 ; j <2 ; j ++,k++)
{
shapeA.add(k,arrayA[i][j]);
}
}
for (int i = 0 ; i < arrayB.length ;i ++ )
{
for (int j =0 ; j <2 ; j ++,l++)
{
shapeB.add(l,arrayB[i][j]);
}
}
for (int i = 0 ; i < arrayC.length ;i ++ )
{
for (int j =0 ; j <2 ; j ++,m++)
{
shapeC.add(m,arrayC[i][j]);
}
}
shapeA.removeAll(shapeB);
shapeC.retainAll(shapeA);
System.out.println("ShapeC has a resultant set : " + "{");
for (int y=0; y < shapeC.size(); y ++ )
{
if (y % 2 ==0)
{
System.out.println("{" + shapeC.get(y)
+","+ shapeC.get(y +1)+"}," );
}
}
System.out.println("}");
}
}
|
https://coderanch.com/t/385582/java/HashSet
|
CC-MAIN-2018-22
|
refinedweb
| 1,118
| 74.19
|
I know I haven't provided much in the way of useful information for you to attempt to troubleshoot this but thought I would bring it up and perhaps you will have Related 89SHARESShareTweet To leave a comment for the author, please follow the link and comment on their blog: TRinker's R Blog » R. For example (contrived, I know, but): > mod <- prcomp(USArrests, scale = TRUE) > plot.prcomp(mod) Error: could not find function "plot.prcomp" Firstly, you shouldn't be calling S3 methods directly, but lets Roxygen2 will automatically update the namespace to export all functions that need exporting. –Joris Meys Aug 29 '13 at 9:11 1 Joris - I really appreciate you taking the time have a peek at this web-site
Otherwise use the original paste(), like this: paste(year(datacfs_date$FeedbackDate), "-M", month(datacfs_date$FeedbackDate), sep="") As Richie Cotton points out, you can also define your own paste0 function: paste0 <- function(..., collapse = NULL) { This is akin to build testing or unit testing, except it's more like a smoke test to make sure that the very basic stuff works. aggregate74Error: could not find function “unit”271How can I view the source code for a function?1Error: could not find function0Error: could not find function “sqldf” using R to run SQL3How to trap Learn R R jobs Submit a new job (it's free) Browse latest jobs (also free) Contact us Welcome!
I found adding exportPattern(".") to the NAMESPACE file did the trick. As a result, R could not find a matching function for the correct name but an incorrect number of arguments. require(thePackage) or library(thePackage) (this should be done every time you start a new R session) If you're not sure in which package that function is situated, you can do a few Validate Random Die Tippers I want to become a living god!
Is the form "double Dutch" still used? be killed in the war vs be killed by the war Why did Sansa refuse to leave with Sandor Cleagane (Hound) during the Battle of Blackwater? find and getAnywhere can also be used to locate functions. R For Loop Having encountered this quite a bit, some of these steps become fairly routine.
Join them; it only takes a minute: Sign up error message could not find function “paste0” – up vote 0 down vote favorite I am getting an error message when I Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count). Kindly assist r share|improve this question edited Jan 20 '14 at 9:44 Backlin 9,97911951 asked Jan 20 '14 at 9:32 user3201733 817 No package required, paste is from base. look at this site I googled around and see it might have something to do with the version of R, but again the underlying version of R is unchanged between installs and the scripts run
You also need to know the namespace in which the function is found. Dplyr The package itself seems to want to use an internal method that isn't defined because presumably the author didn't do the above. –Andre Luus Jun 23 '15 at 10:02 add a Why is credit card information not stolen more often? Recent popular posts Learning how to extend #RStudio by reading books So, about that penis data… ggtree version of plotTree Evidence for a limit to effective peer review Most visited articles
Not the answer you're looking for? Just use the %s marker to denote that some element goes here and then feed it in as a vector after the character string. Paste0 R If you set a non-missing level on parallelStart the same argument should be passed to parallelExport, else you get the same error. Assign R Check that the package was installed by the admin and available for use by the appropriate user.
Why did it take longer to go to Rivendell in The Hobbit than in The Fellowship of the Ring? Not the answer you're looking for? I am unable to try to run on an updated version of R as I have some legacy code for ggplots2 that needs to be updated. Is it bad form to write mysterious proofs without explaining what one intends to do? Function In R
If you got this far, why not subscribe for updates from the site? Did you install the package that contains the function? What's the difference between ls and la? Source Also be aware the sprintf is even cooler than I demonstrated here. *Created using the reports package References Tyler Rinker, (2013) reports: Package to assist in report writing.
Why is the electric field due to a charged infinite cylinder identical to that produced by an infinite line of charge? Join them; it only takes a minute: Sign up error message could not find function “paste0” – up vote 0 down vote favorite I am getting an error message when I It appeared that optionnal arguments from the C++ were seen as mandatory by R.
Advice will be greatly appreciated! –Aleksandr Blekh Apr 30 '14 at 9:29 add a comment| 9 Answers 9 active oldest votes up vote 67 down vote accepted There are a few i am gettig an error message > datacfs_date$FeedbackMonth<-paste(year(datacfs_date$FeedbackDate), "-M", month(datacfs_date$FeedbackDate),sep="") Error in paste(year(datacfs_date$FeedbackDate), "-M", month(datacfs_date$FeedbackDate), : could not find function "year" –user3201733 Jan 21 '14 at 1:36 AFAIK, there This catches the package issue as early as possible in the workflow. Try something simple like paste(1:4, "a"); paste0(1:4, "a"); Will that work?
When hiking, why is the right of way given to people going up? This is meant to be a FAQ question, so please be as complete as possible. Did Donald Trump say that "global warming was a hoax invented by the Chinese"? have a peek here Would you like to answer one of these unanswered questions instead?
Choose your flavor: e-mail, twitter, RSS, or facebook... Copyright © 2016 R-bloggers. asked 2 years ago viewed 2060 times active 2 years ago Related 177How to find out which package version is loaded in R?4Error: could not find function “Lag”3Error: could not find Browse other questions tagged r function error-handling r-faq or ask your own question.
If they cannot, is there a way to ensure consistent versions across the machines? (This may seem OT, but correct package installation includes availability of the right version.) Is the package Although #7 might seem like a good starting point, these are listed in approximate order of the frequency that I use them. For some applications sprintf is a superior choice over paste/paste0. This goes back to step 5.
Are zipped EXE files harmless for Linux servers? Is this behaviour of GPIO pins normal? Check ldd results for R, to be sure about shared libraries It's good to periodically run a script that just loads every package needed and does some little test. Appreciate your help.
As a sidenote, I had initially configured RStudio to use ROxygen to make the documentation -- and selected the configuration where ROxygen would write my NAMESPACE file for me, which kept I would like to use the "cosvol" function in the "celestial" package from command-line. Do I need to import some package? How would people living in eternal day learn that stars exist?
asked 5 years ago viewed 148570 times active 1 month ago Linked 7 R - could not find function 'melt()' -3 R ggplot2 functions do not work 3 Error: could not My R version is unchanged from install to install - 2.14.0. A typical take may look like this: person <-"Grover" action <-"flying" message(paste0("On ", Sys.Date(), " I realized ", person, " was...\n", action, " by the street")) ## On 2013-09-14 I realized I'm lazy so I use paste0 a lot.
paste (..., sep = " ", collapse = NULL) The ... I got this in an Rcpp context, where I wrote a C++ function with optionnal arguments, and did not provided those arguments in R.
|
http://gsbook.org/error-could/error-could-not-find-function-paste0.php
|
CC-MAIN-2018-39
|
refinedweb
| 1,365
| 68.2
|
Libec uses channels to implement secure communication between two entities. Data is encrypted and protected with a MAC.
`void ec_channel_clean(ec_channel_t *ch);
Clean a previously used channel for reuse or free. Unlocks locked memory and zeros entire structure. Should be run once a channel is no longer required, before disposing of the channel.
#include <ec.h> ... ec_channel_clean(ch); ...
ec_err_t ec_channel_init(ec_channel_t *ch, ec_cert_t *c, ec_ctx_t *ctx, unsigned char *dh);
Initialise a channel and generate a signed Diffie-Hellman packet to pass to the remote endpoint. Returns zero on success, a nonzero error code otherwise. Once the channel is no longer required, it should be scrubbed using
ec_channel_clean().
ctx should point to a context where the remote certificate can be found, and will be used for validation purposes - if trust chain checks are performed, then those certificates will also need to be available.
c is the certificate used as the local endpoint. This certificate does not need to be available in
ctx.
Data to be passed to the remote endpoint (the negotiation packet) will be stored in
dh, which should be a buffer of at least
EC_CHANNEL_DH_BYTES bytes. The contents of this buffer should be provided to
ec_channel_start() on the remote end.
#include <ec.h> ... ec_channel_t *ch; unsigned char dh[EC_CHANNEL_DH_BYTES]; if(ec_channel_init(ch, c, ctx, dh) != 0) { //init failed } ...
ec_err_t ec_channel_start(ec_channel_t *ch, unsigned char *dh, int checks);
Finish Diffie-Hellman negotiation and finalise channel setup. Returns zero on success, a nonzero error code otherwise.
dh should contain the negotiation packet generated by
ec_channel_init() on the remote end.
checks is a bitfield determining which checks should be run on the remote certificate. All checks must pass for channel setup to complete successfully.
EC_CHECK_CERT and
EC_CHECK_SIGN will always be tested, whether or not they are set.
#include <ec.h> ... if(ec_channel_start(ch, dh, EC_CHECK_ALL) != 0) { //negotiation failed } ...
ec_err_t ec_channel_encrypt(ec_channel_t *ch, unsigned char *buf, size_t len,
unsigned char *mac, uint64_t *ctr);
Encrypt a buffer, for later decryption by the other end of a channel. Returns zero on success, a nonzero error code otherwise.
A MAC (
EC_CHANNEL_MAC_BYTES bytes) for the message will be stored in
*mac, and the message sequence number will be stored in
*ctr if
ctr is not NULL.
#include <ec.h> ... unsigned char mac[EC_CHANNEL_MAC_BYTES]; uint64_t ctr; if(ec_channel_encrypt(ch, buf, buf_length, mac, &ctr) != 0) { //encryption failed } ...
ec_err_t ec_channel_decrypt(ec_channel_t *ch, unsigned char *buf, size_t len,
unsigned char *mac, uint64_t ctr);
Decrypt a buffer previously encrypted by the other end of the channel. Returns zero on success, a nonzero error code otherwise.
mac should be the MAC generated by the other end of the channel using
ec_channel_encrypt().
If messages are not decrypted in linear order, then
ctr should be set to the sequence number of the message being decrypted. Otherwise, this can be left at zero, and it will be set automatically.
#include <ec.h> ... if(ec_cert_decrypt(ch, buf, buf_length, mac, 0) != 0) { //decryption failed } ...
ec_cert_t *ec_channel_remote(ec_channel_t *ch);
Get the certificate for the remote channel endpoint. Returns NULL on failure.
#include <ec.h> ... ec_cert_t *c = ec_channel_remote(ch); if(c == NULL) { //unable to get remote certificate } ...
|
https://libec.erayd.net/chapters/channels.html
|
CC-MAIN-2019-09
|
refinedweb
| 517
| 58.38
|
Important: Please read the Qt Code of Conduct -
Static cast other then int, char and boolean not possible?
Hi all,
I recon this might be a stupid question, but ok.
I want to have an qicon to be cast static in a class, because i will never change its value.
When i try:
@
static const int x = 1; //everything is working as expected here.
//static const QIcon fileicon = ":/icon/pic4"; //doesnt work.
//static const QIcon fileicon(":/icon/pic4"); //doesnt work.
static const char y = 'd'; //everything working as expected.
@
I understand this is standard knowledge, but i clearly dont have that and cant find it. So mayby someone can post a link with the info im looking for?
- leon.anavi last edited by
Try to define it outside the class body. It should be something like:
@
class Example
{
private:
static const int x = 1; //everything is working as expected here.
static const QIcon fileicon;
static const char y = 'd'; //everything working as expected.
//..
};
const QIcon Example::fileicon(":/icon/pic4");
@
P.S.
This is a pseudo code and I have tried it myself.
Hi leon.anavi,
thanks for your reply.
I tried your suggestion to define outside the class, but i was not able to get it working.
For me its not really needed to get it working, but i just want to learn why its not possible with an icon but without problem with an int.
What exactly does not work?
Dioes the compiler complain about it? does it get no initial value?
You cannot assign a const char * (= ":/icon/pic4") to a QIcon object, there is no operator overload. Use proper object initialization syntax:
@
// this works
static QIcon myIcon(":/abc.png");
// this gives an error
static QIcon myFalseIcon = ":/def.png";
@!
Hi Gerolf and Volker,
Thanks both for your reply.
Sorry for reacting so late, but i was doing things wich i shouldnt have done :)
Gerolf: Yes my compiler complains in the way it dont compile.
At the end of this post i show you what the output is.
Volker:
Your line 2 gives me an error.
[quote author="Volker" date="1306623835"]![/quote]
Do you mean that i cannot use a resource file item in a class, because its creation order is not clear/defined? So i have to use the complete path?
To be clear i want to define a static QIcon in a class.
If i write:
@
static QIcon myIcon(":/icon/pic4"); //like Volker suggested,
//Gives error../TestAll/testlistview.h:20: error: expected identifier before string constant
// ../TestAll/testlistview.h:20: error: expected ‘,’ or ‘...’ before string constant
in class:
static QIcon myIcon;
in constructor:
myIcon(":/icon/pic4");
//Gives error: ../TestAll/testlistview.cpp:14: error: no match for call to ‘(QIcon) (const char [12])’
myIcon.addfile(":/icon/pic4");.
//Gives error: /home/koster/QtApps/TestAll-build/../TestAll/testlistview.cpp:14: undefined reference to
testlistview::fileIcon' //home/koster/QtApps/TestAll-build/../TestAll/testlistview.cpp:17: undefined reference totestlistview::fileIcon'
If i try leon.anavi 's suggestion:
in class:
static QIcon myIcon;
somewhere in .cpp file
QIcon testlistview::myIcon(":/icon/pic4");
Gives a crash with the words:
//QPixmap: Must construct a QApplication before a QPaintDevice
//The program has unexpectedly finished.
//Is this what you meant Volker?
@
I hope this output makes it clearer for you, for me it didnt.
Can you provide the complete file that produces the error, please. It's hard to analyze without knowing the details.
The second try is just leon's without acutally defining the variable in a .cpp file. So it's failing at compile time.
The third approach (leon's suggestion) is trapped by the undefined initialization order of static members (the QIcon is initializize - via a QPixmap - before QApplication has started), that's the reason for the bail out.
I would suggest to make a private static pointer variable; initialize this to null (that works always), and have a static const method return the dereferenced pointer (and initialize it once).
The following sample code is not tested, but should give you a clue how it works:
-------- myiconproviderclass.h --------
class QIcon;
@
class MyIconProviderClass {
public:
// your other public stuff goes here
static const QIcon &myIcon();
private: static QIcon *myIconPtr;
@
-------- myiconproviderclass.cpp --------
@
#include "myiconproviderclass.h"
#include <QIcon>
QIcon* MyIconProviderClass::myIconPtr = 0;
const QIcon& MyIconProviderClass::myIcon()
{
if(!myIconPtr)
myIconPtr = new QIcon(":/path/to/the/icon");
return *myIconPtr;
}
@
|
https://forum.qt.io/topic/6196/static-cast-other-then-int-char-and-boolean-not-possible
|
CC-MAIN-2021-49
|
refinedweb
| 719
| 59.3
|
#include <sys/stream.h> int canputnext(queue_t *q);
int bcanputnext(queue_t *q, unsigned char pri);
Architecture independent level 1 (DDI/DKI).
Pointer to a message queue belonging to the invoking module.
Minimum priority level.
The invocation canputnext(q ); is an atomic equivalent of the canput( q→q_next); routine. That is, the STREAMS framework provides whatever mutual exclusion is necessary to insure that dereferencing q through its q_next field and then invoking canput(9F) proceeds without interference from other threads.
bcanputnext(q, pri); is the equivalent of the bcanput( q→q_next, pri); routine.
canputnext(q); and bcanputnext(q, pri); should always be used in preference to canput(q→q_next); and bcanput(q→q_next, pri); respectively.
See canput(9F) and bcanput(9F) for further details.
If the message queue is not full.
If the queue is full.
The canputnext() and bcanputnext() functions can be called from user, interrupt, or kernel context.
Drivers are responsible for both testing a queue with canputnext () or bcanputnext() and refraining from placing a message on the queue if the queue is full.
Writing Device Drivers for Oracle Solaris 11.2
STREAMS Programming Guide
|
http://docs.oracle.com/cd/E36784_01/html/E36886/canputnext-9f.html
|
CC-MAIN-2015-22
|
refinedweb
| 186
| 50.94
|
Download presentation
Presentation is loading. Please wait.
Published byMyles Harris Modified about 1 year ago
1
Coupon collector’s problem CS658 Po-Ching Liu
2
Question A person trying to collect each of b different coupons must acquire approximately x randomly obtained coupons in order to succeed. find x
3
Balls and bins 1 st question: If n identical balls are tossed randomly into b bins, then how many balls will fall in a given bin? Ans:
4
Second Second question: Find the expected number of balls we need to toss (one ball for each toss) until a given bin contains a ball. The number of bins = b Ans: E = b
5
proof p=pro(success) = 1/b=1-q q=pro( without success)=1-1/b=1- p E[# of tosses until a given bin contains a ball]
6
Third the third question: Find the expected number of balls we need to toss (one ball for each toss) until every bin contains at least one ball? The number of bins = b Ans: E = b(lnb+O(1))
7
proof There are b stages The ith stage consists of the tosses after the (i-1)th hit until the ith hit. how many balls do we have to toss in order to move from the (i-1) th stage to the ith stage there are (i-1) bins that contain balls and b-(i-1) empty bins. for each toss in the ith stage, the probability of obtaining a hit is (b-i+1)/b.
8
proof E[# of tosses in the ith stage]= E[total # of tosses in the 1 st to the bth stage] =
9
proof We find the two following questions are the same: Q:Find the expected number x of balls we need to toss (one ball for each toss) until every bin contains at least one ball? The number of bins = b Q: A person trying to collect each of b different coupons must acquire approximately x randomly obtained coupons in order to succeed.
10
Code by java compile: javac CouponCollector.java Run: java CouponCollector public class CouponCollector { public static void main(String[] args) { int N = 50; // number of different card types boolean[] found = new boolean[N]; // found[i] = true ==> if card i has been collected, false ==> the new type of card int cardcnt = 0; // total number of cards collected int valcnt = 0; // number of distinct cards // repeatedly choose a random card and check whether it's a new one while (valcnt < N) { int val = (int) (Math.random() * N); // random card between 0 and N-1 cardcnt++; // we collected one more card ==>total number +1 if (!found[val]) valcnt++; // it's a new card type found[val] = true; // update found[] } // print the total number of cards collected System.out.println(cardcnt); }
11
references Thomas H. Cormen,Charles E. Leiserson, Ronald L. Rivest, Clifford Stein(1990), Introduction to Algorithms, The MIT Press, Cambridge, Massachusetts London, England, pp stat.stanford.edu/~susan/surprise/Collector.ht ml stat.stanford.edu/~susan/surprise/Collector.ht ml
Similar presentations
© 2016 SlidePlayer.com Inc.
|
http://slideplayer.com/slide/4387018/
|
CC-MAIN-2016-50
|
refinedweb
| 513
| 55.37
|
0 replies on
1 page..
java.util.Arrays
int
Comparable
Comparator
Quicksort is faster in both cases. Mergesort is stable in both cases. But for primitive types quicksort is stable too! That’s because primitive types in Java are like elementary particles in quantum mechanics. You can’t tell the difference between one 7 and another 7. Their value is all that defines them. Sort the array such [7, 6, 6, 7, 6, 5, 4, 6, 0] into [0, 4, 5, 6, 6, 6, 6, 7, 7]. Not only do you not care which 6 ended up in which position. It’s a meaningless question. The array positions don’t hold pointers to the objects. They hold the actual values of the objects. We might as well say that all the original values were thrown away and replaced with new ones. Or not. It just doesn’t matter at all. There is no possible way you can tell the difference between the output of a stable and unstable sorting algorithm when all that’s sorted are primitive types. Stability is irrelevant with primitive types in Java.
By contrast when sorting objects, including sorting objects by a key of primitive type, you’re sorting pointers. The objects themselves do have an independent nature separate from their key values. Sometimes this may not matter all that much–e.g. if you’re sorting java.lang.Strings–but sometimes it matters a great deal. To borrow an example from Sedgewick’s Algorithms I class, suppose you’re sorting student records by section:
java.lang.Strings
public class Student {
String lastname;
String firstName;
int section;
}
Suppose you start with a list sorted by last name and then first name:
When you sort this again by section, if the sort is stable then it will still be sorted by last name and first name within each section:
However if you use quicksort, you’ll end up with something like this and have to resort each section by name to maintain the sorting by name:
That’s why stable sorts make sense for object types, especially mutable object types and object types with more data than just the sort key, and mergesort is such a sort. But for primitive types stability is not only irrelevant. It’s meaningless.
Read: Why java.util.Arrays uses Two Sorting Algorithms
|
http://www.artima.com/forums/flat.jsp?forum=121&thread=350286
|
CC-MAIN-2017-13
|
refinedweb
| 391
| 65.62
|
Lesson 5 of 16By SimplilearnLast updated on Apr 28, 202020666
With the growing volumes of data being generated, the storage capacity of a machine may often not be enough to store all of it. However, this can be resolved if you store the data across a network of machines. And these networks of filesystems are called distributed filesystems.
This is where Hadoop comes into play and provides a reliable filesystem, commonly known as HDFS (Hadoop Distributed File System). HDFS is a unique design that provides storage for extremely large files.
In this HDFS tutorial, you’ll learn:
Now, let us begin our HDFS tutorial by understanding what is HDFS.
HDFS is a distributed file system that provides access to data across Hadoop clusters. A cluster is a group of computers that work together. Like other Hadoop-related technologies, HDFS is a key tool that manages and supports analysis of very large volumes; petabytes and zettabytes of data.
Before 2011, storing and retrieving petabytes or zettabytes of data had the following three major challenges: Cost, Speed, Reliability. Traditional file system approximately costs $10,000 to $14,000, per terabyte. Searching and analyzing data was time-consuming and expensive. Also, if search components were saved on different servers, fetching data was difficult. Here’s how HDFS resolves all the three major issues of traditional file systems:
HDFS is open-source software so that it can be used with zero licensing and support costs. It is designed to run on a regular computer.
Large Hadoop clusters can read or write more than a terabyte of data per second. A cluster comprises multiple systems logically interconnected in the same network.
HDFS can easily deliver more than two gigabytes of data per second, per computer to MapReduce, which is a data processing framework of Hadoop.
HDFS copies the data multiple times and distributes the copies to individual nodes. A node is a commodity server which is interconnected through a network device.
HDFS then places at least one copy of data on a different server. In case, any of the data is deleted from any of the nodes; it can be found within the cluster.
A regular file system, like a Linux file system, is different from HDFS with respect to the size of the data. In a regular file system, each block of data is small, usually about 51 bytes. However, in HDFS, each block is 128 Megabytes by default.
A regular file system provides access to large data but may suffer from disk input/output problems mainly due to multiple seek operations.
On the other hand, HDFS can read large quantities of data sequentially after a single seek operation. This makes HDFS unique since all of these operations are performed in a distributed mode.
Let us list the characteristics of HDFS.
Below are some characteristics of HDFS:
Similar to the example explained in the previous section, HDFS stores files in a number of blocks. Each block is replicated to a few separate computers. The count of replication can be modified by the administrator. Data is divided into 128 Megabytes per block and replicated across local disks of cluster nodes. Metadata controls the physical location of a block and its replication within the cluster. It is stored in NameNode. HDFS is the storage system for both input/output of MapReduce jobs. Let’s understand how HDFS stores files with an example.
Here’s how HDFS stores files. Example - A patron gifted a collection of popular books to a college library. The librarian decided to arrange the books on a small rack and then distribute multiple copies of each book on other racks. This way the students could easily pick up a book from any of the racks.
Similarly, HDFS creates multiple copies of a data block and keeps them in separate systems for easy access.
Let’s discuss the HDFS Architecture and Components in the next section.
Broadly, HDFS architecture is known as the master and slave architecture which is shown below.
A master node, that is the NameNode, is responsible for accepting jobs from the clients. Its task is to ensure that the data required for the operation is loaded and segregated into chunks of data blocks.
HDFS exposes a file system namespace and allows user data to be stored in files. A file is split into one or more blocks, stored, and replicated in the slave nodes known as the DataNodes as shown in the section below.
The data blocks are then distributed to the DataNode systems within the cluster. This ensures that the replicas of the data are maintained. DataNode serves to read or write requests. It also creates, deletes, and replicates blocks on the instructions from the NameNode. We discussed in the previous topic that it is the metadata that stores the block location and its replication. It is explained in the below diagram.
There is a Secondary NameNode which performs tasks for NameNode and is also considered as a master node. Prior to Hadoop 2.0.0, the NameNode was a Single Point of Failure, or SPOF, in an HDFS cluster.
Each cluster had a single NameNode. In case of an unplanned event, such as a system failure, the cluster would be unavailable until an operator restarted the NameNode.
Also, planned maintenance events, such as software or hardware upgrades on the NameNode system, would result in cluster downtime.
The HDFS High Availability, or HA, feature addresses these problems by providing the option of running two redundant NameNodes in the same cluster in an Active/Passive configuration with a hot standby.
This allows a fast failover to a new NameNode in case a system crashes or an administrator initiates a failover for the purpose of a planned maintenance.
In an HA cluster, two separate systems are configured as NameNodes. At any instance, one of the NameNodes is in an Active state, and the other is in a Standby state.
The Active NameNode is responsible for all client operations in the cluster, while the Standby simply acts as a slave, maintaining enough state to provide a fast failover if necessary.
An HDFS cluster can be managed using the following features:
The main components of HDFS are:
The NameNode server is the core component of an HDFS cluster. There can be only one NameNode server in an entire cluster. Namenode maintains and executes the file system namespace operation such as opening, closing, and renaming of files and directories, which are present in HDFS.
The namespace image and the edit log stores information of the data and the metadata. NameNode also determines the linking of blocks to DataNodes. Furthermore, the NameNode is a single point of failure. The DataNode is a multiple instance server. There can be several numbers of DataNode servers. The number depends on the type of network and the storage system.
The DataNode servers, stores, and maintains the data blocks. The NameNode Server provisions the data blocks on the basis of the type of job submitted by the client.
DataNode also stores and retrieves the blocks when asked by clients or the NameNode. Furthermore, it reads/writes requests and performs block creation, deletion, and replication of instruction from the NameNode. There can be only one Secondary NameNode server in a cluster. Note that you cannot treat the Secondary NameNode server as a disaster recovery server. However, it partially restores the NameNode server in case of a failure.
The Secondary NameNode server maintains the edit log and namespace image information in sync with the NameNode server. At times, the namespace images from the NameNode server are not updated; therefore, you cannot totally rely on the Secondary NameNode server for the recovery process.
HDFS exposes a file system namespace and allows user data to be stored in files. HDFS has a hierarchical file system with directories and files. The NameNode manages the file system namespace, allowing clients to work with files and directories.
A file system supports operations like create, remove, move, and rename. The NameNode, apart from maintaining the file system namespace, records any change to metadata information.
Now that we have learned about HDFS components, let us see how NameNode works along with other components.
NameNode maintains two persistent files; one a transaction log called an Edit Log and the other, a namespace image called a FsImage. The Edit Log records every change that occurs in the file system metadata such as creating a new file.
The NameNode is a local filesystem that stores the Edit Log. The entire file system namespace including mapping of blocks, files, and file system properties is stored in FsImage. This is also stored in the NameNode local file system.
When new DataNodes join a cluster, metadata loads the blocks that reside on a specific DataNode into its memory at startup. Metadata then periodically loads the data at user-defined or default intervals.
When the NameNode starts up, it retrieves the Edit Log and FsImage from its local file system. It then updates the FsImage with Edit Log information and stores a copy of the FsImage on the file system as a checkpoint.
The metadata size is limited to the RAM available on the NameNode. A large number of small files would require more metadata than a small number of large files. Hence, the in-memory metadata management issue explains why HDFS favors a small number of large files.
If a NameNode runs out of RAM, it will crash, and the applications will not be able to use HDFS until the NameNode is operational again.
Data block split is an important process of HDFS architecture. As discussed earlier, each file is split into one or more blocks stored and replicated in DataNodes.
DataNodes manage names and locations of file blocks. By default, each file block is 128 Megabytes. However, this potentially reduces the amount of parallelism that can be achieved as the number of blocks per file decreases.
Each map task operates on one block, so if tasks are fewer than nodes in the cluster, the jobs will run slowly. However, this issue is lesser when the average MapReduce job involves more files or larger individual files.
Let us look at some of the benefits of the data block approach.
The data block approach provides:
It also helps by shielding users from storage sub-system details.
Block replication refers to creating copies of a block in multiple data nodes. Usually, the data is split into the forms of parts such as part and part one.
HDFS performs block replication on multiple data nodes so that if an error exists on one of the data nodes servers. The job tracker service resubmits the job to another data node server. The job tracker service is present in the name node server.
In the replication method, each file is split into a sequence of blocks. All blocks except the last one in the file are of the same size. Blocks are replicated for fault tolerance.
The block replication factor is usually configured at the cluster level but it can also be configured at the file level.
The name node receives a heartbeat and a block report from each data node in the cluster. The heartbeat denotes that the data node is functioning properly. A block report lists the blocks on a data node.
The topology of the replicas is critical to ensure the reliability of HDFS. Usually, each data is replicated thrice where the suggested replication topology is as follows.
Place the first replica on the same node as that of the client. Place the second replica on a different rack from that of the first replica. Place the third replica on the same rack as that of the second one but on a different node. Let's understand data replication through a simple example.
The diagram illustrates a Hadoop cluster with three racks. A diagram for Replication and Rack Awareness in Hadoop is given below.
Each rack consists of multiple nodes. R1N1 represents node 1 on rack 1. Suppose each rack has eight nodes. The name node decides which data node belongs to which rack. Block 1 which is B1 is first written to node 4 on rack 1.
A copy is then written to a different node on a different rack which is node 5 on rack 2. The third and final copy of the block is written to the same rack of the second copy but to a different node which is rack 2 node 1.
And now that you have learned about data replication topology or placement, let's discuss how a file is stored in HDFS.
Let's say we have a large data file that is divided into four blocks. Each block is replicated three times as shown in the diagram.
You might recall that the default size of each block is 128 megabytes.
The name node then carries metadata information of all blocks and its distribution. Let's work on an example of HDFS which gives a deep understanding of all the points discussed so far.
Suppose you have 2 log files that you want to save from a local file system to the HDFS cluster.
The cluster has 5 data nodes: node A, node B, node C, node D, and node E.
Now the first log is divided into three blocks: b1 b2 and b3 and the other log is divided into two blocks: b4 and b5.
Now the blocks b1 b2 b3 b4 and b5 are distributed to the node A, node B, node C, and no D respectively as shown in the diagram.
Each block will also be replicated three times on the five data nodes. All of the information related to the list of blocks and the replication known as the metadata information of the five blocks will be stored in namenode.
Now suppose the client asks for one log that you have stored. The inquiry goes to the namenode and the client gets the information about this log file as shown in the diagram.
Based on the information from the namenode, the client receives the file information from the respective data nodes. HDFS provides various access mechanisms. A Java API can be used for applications. There is also a Python and AC language wrapper for non-java applications. A web GUI can also be utilized through an HTTP browser. An FS shell is available for executing commands on HDFS.
Let's look at the commands for HDFS in the command-line interface.
Following are a few basic command lines of HDFS:
To copy the file simplilearn.txt from the local disk to the user's directory, type the command line:
$ hdfs dfs -put
simplilearn.txt
simplilearn.txt
This will copy the file to /user/username/simplilearn.txt
To get a directory listing of the user's home directory, type the command line:
$hdfs dfs –ls
To create a directory called testing under the user's home directory, type the command line:
$hdfs dfs –mkdir
To delete the directory testing and all of its components, type the command line:
hdfs dfs -rm -r
The file browser in Hue lets you view and manage your HDFS directories and files. Additionally, you can create, move, rename, modify, upload, download, and delete directories and files. You can also view the file contents.
To learn more and get an in-depth understanding of Hadoop and you can enroll in the Big Data Hadoop Administrator Certification Training. This course provides online training on the popular skills required for a successful career in data engineering. In addition to this, you can enroll for the Big Data Engineer Program and
Hive Tutorial: Working with Data in Hadoop
Hadoop Interview Guide
What Is a Hadoop Cluster?
Hadoop Ecosystem
What is Hadoop?: Understanding Hadoop and Its Components
Free eBook: 8 Essential Concepts of Big Data and Hadoop
|
https://www.simplilearn.com/tutorials/hadoop-tutorial/hdfs?source=sl_frs_nav_playlist_video_clicked
|
CC-MAIN-2021-17
|
refinedweb
| 2,640
| 64.41
|
network-builder
Linux NetworkNameSpace Builder
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
network-builder : Linux Network NameSpace Builder for test
network-builder makes network using Linux Network NameSpaces and tunnels.
Getting started
Install this from Hackage.
cabal update && cabal install network-builder
Usage
When you create network, put network-builder.yml on current directory. The yaml format is below.
nss: - - ip: 192.168.10.1/24 name: br1 - - - ip: 192.168.10.2/24 name: veth-2 - name: server2 nss: - - ip: 192.168.11.1/24 name: br1 - - - ip: 192.168.11.4/24 name: veth-3 - name: server3 - - ip: 192.168.10.3/24 name: veth-4 - name: server4 nss: - - ip: 192.168.12.1/24 name: br1 - - - ip: 192.168.12.4/24 name: veth-5 - name: server5
When you create tunnel for server2 of namespace put yaml file(just example) below.
- name: server2 - tag: gretunnel Name: gre2 LocalIp: 192.168.10.2 RemoteIp: 192.168.10.3 RemoteNetwork: 192.168.12.0/24 GreDeviceIp: 192.168.11.254/24
Commands
create network
network-builder create
destroy network
network-builder destroy
create tunnel
network-builder create-tunnel "yaml-file"
destroy tunnel
network-builder destroy-tunnel "yaml-file"
Changes
0.1.0
- First Release
Depends on:
Used by 1 package:
|
https://www.stackage.org/package/network-builder
|
CC-MAIN-2017-17
|
refinedweb
| 241
| 63.66
|
5 Tips for Sphinx Indexing
Web applications often have the need to do text searches against data stored in a database. While the built in MySQL and PostgresSQL functions for full text searching work, they are often not the best solutions for fast and complex full text searching.
This is where dedicated search engines come into play, and Sphinx is our favorite tool for the job. Written in C++ by Andrew Aksyonoff, and originally released to open source in 2001, Sphinx is a blazing fast search engine. Considering that fast and complex full-text searching is a somewhat frequent need, I've put together this post with my top five tips for implementing Sphinx.
1) Use
thinking_sphinx
There are several plugins out there for Sphinx integration into Rails. UltraSphinx, ThinkingSphinx, and
acts_as_sphinx (no longer under active development) are the most commonly used plugins.
We recommend ThinkingSphinx over UltraSphinx for several reasons. Ultrasphinx, unfortunately, can throw cryptic errors because of the way it preloads your indexed model. If you have patches that are in your lib directory, they must be explicitly required. And while the UltraSphinx way of defining blocks is simpler for simple cases, in more advanced cases it can become far less readable, and you'll hit those advanced cases before you know it.
2) Know When to Index, and How Often
This next tip is really three tips all bundled into one (because who wants to read seven tips for anything? ;) )
- Know your requirements What's an acceptable lag between the data being updated and becoming available in search results? Does it need to be instantaneous, or is it acceptable to wait 5, 10, 15 or even 30 minutes?__ __The longer you wait between index updates, the less resources (and CPU time) your search engine consumes.
- Know how long your indexing takes If it takes three minutes to complete an index run, but you kick off a full re-index every 60 seconds, that's not going to work out well. If you absolutely need an updated index every 60 seconds, then you need to consider alternatives like a bigger instance for your search engine or other strategies like delta indexing (below).
- Test your new indexes or new data in staging When making changes to data being indexed or adding new indexes, do a test run of your indexing in a staging environment with snapshot of production data. Sometimes small changes to data or indexing result in an enormous increase in index size. If your changes create gigantic indexes, it's best to learn that on staging, instead of running out of space in your production environment.
3) Use Delta Indexes (When You Need To)
Without a reindex, your search won't be up to date; the question is when to reindex.
When indexing small data-sets, a full reindex can be done frequently. But as size grows, so does the index, and with it the time it takes to index. This is when delta indexing comes into play. A delta index is nothing more than a second index containing indexes for only the documents that changed since your last index. There are three main methods of delta indexing built into ThinkingSphinx: the default behavior, timestamped deltas, and
delayed_job integration.
The first method—the default behavior of
thinking_sphinx—is big on convenience. On every save it fires off the delta indexer and you get near instantaneous index updating. However, while this works great on development environments, and most staging environments, in production this can be problematic.
One problem is that the indexer is now part of the request cycle, which means that with each save comes a reindex. This method will cause scaling problems—with increased traffic, the indexer will fire more frequently. This puts increased load on the database as well as the filesystem.
Another problem is that in a production environment with many instances, the delta index is only created on the instance that handles the request. This results in instances with out of date information until the next full index. We deal with this by adding a cron entry to run the delta index cron task on all machines that run the search daemon. This has the effect of keeping your indexes in sync to the interval that the cron job runs at.
The second method—the timestamped version—works by adding a time threshold to the define_index block e.g.
set_property :delta => :datetime, :threshold => 1.hour
This is the frequency with which you run your rake task to reindex the delta. This means your deltas are updated every hour (in this example). While a nice improvement to the built-in default, this means that your indexes are out of date until the next rake tasks run, so you need to set the frequency according to user expectations (or reset expectations).
The third method uses the
delayed_job gem and pushes a job onto the
delayed_job queue that tells the indexer to run as needed. This is more immediate than the threshold option, while still running outside of the request cycle. This is the most promising setup, although it lends itself to a single searchd server setup. Specifically, a single machine running the indexer and search daemon with each instance sending reindex tasks to the queue when needed.
The drawbacks to this third approach are:
- You lose availability. If the
searchdserver goes down, your search goes down. Allowing each instance to have its own instance of
searchdbuilds redundancy into the setup.
- As mentioned in the official documentation,"because the delta indexing requests are queued, they will not be processed immediately—and so your search results will not not be accurate straight after a change. Delayed_Job is pretty fast at getting through the queue though, so it shouldn't take too long."
4) Know Your Bottleneck: Database or Filesystem
When maintaining your indexes, you have a choice of merging delta indexes into your main index or doing a full reindex. Merging can save you a database hit, but require twice the I/O of the two indexes to be merged, and hits the filesystem hard. On the other hand, reindexing hits the database hard. So you have to know your bottleneck. Most Rails developers are acutely aware of their database load. We optimize queries, we index tables, and we even use methods to read exclusively from the replica and write only to the master. So, instinctively, most developers select to merge their delta index into the main, rather than perform a full reindex, in order to take load off the database. But this isn't always right.
If your application processes a lot of uploads or your application has poor cacheability (and you're serving direct from filesystem a lot) then you probably want to avoid putting more load on the filesystem. In these cases, reindexing will make more sense then merging delta indexes.
5) If you're on
ultrasphinx, switch to
thinking_sphinx
Rein Henrichs wrote a great blog post which included the steps to make the switch. I'll expand on those here, and include some real world code samples.
Switching is actually relatively simple and in these four steps you can convert an Ultrasphinx application to a ThinkingSphinx one.
_1. Uninstall UltraSphinx and install ThinkingSphinx: _
Run:
script/plugin remove ultrasphinx
and add this line to you environment.rb:
config.gem('freelancing-god-thinking-sphinx', :lib => 'thinking_sphinx')
2. Translate your
is_indexed declaration into a
define_index block and change your search actions to use the ThinkingSphinx API:
Your old search task might look like:
Ultrasphinx::Search.new(:query => params[:query])
Where your new one would look like (assuming you've indexed the model Post):
Post.search(params[:query])
3. Rewrite your deployment tasks to run the ThinkingSphinx rake tasks:
namespace :sphinx do desc "Stop the sphinx server" task :stop, :roles => [:app], :only => {:sphinx => true} do run "cd #{latest_release} && RAILS_ENV=#{rails_env} rake thinking_sphinx:stop" end desc "Reindex the sphinx server" task :index, :roles => [:app], :only => {:sphinx => true} do run "cd #{latest_release} && RAILS_ENV=#{rails_env} rake thinking_sphinx:index" end desc "Configure the sphinx server" task :configure, :roles => [:app], :only => {:sphinx => true} do run "cd #{latest_release} && RAILS_ENV=#{rails_env} rake thinking_sphinx:configure" end desc "Start the sphinx server" task :start, :roles => [:app], :only => {:sphinx => true} do run "cd #{latest_release} && RAILS_ENV=#{rails_env} rake thinking_sphinx:start" end desc "Restart the sphinx server" task :restart, :roles => [:app], :only => {:sphinx => true} do run "cd #{latest_release} && RAILS_ENV=#{rails_env} rake thinking_sphinx:running_start" end end
and you'll probably want to add these as well to automate the reindexing and starting on deploy:
after "deploy:symlink_configs", "new_sphinx:configure" after "sphinx:configure", "sphinx:index" after "sphinx:index", "sphinx:restart"
If you're not running on Engine Yard Slices, you can still get the benefit of prewritten Capistrano tasks by adding:
require "vendor/plugins/thinking-sphinx/lib/thinking_sphinx/deploy/capistrano"
to the top of your deploy.rb file. If you're running on the latest release from GitHub, as a plugin, the tasks should be included automatically. This is of course assuming that you are running Capistrano from a working repository and by itself (a non-developer deploying code for example—thanks for the tip, commenter Josh!)
Because of a custom script that exists on Engine Yard Slices, if you are using our eycap gem, these tasks are included for you as:
sphinx:configure sphinx:reindex sphinx:restart sphinx:start sphinx:stop thinking_sphinx:configure thinking_sphinx:reindex
4. Stop
searchd and then run your new
configure,
index and
start start tasks:
cap sphinx:stop && cap sphinx:configure && cap sphinx:index && cap sphinx:start
Solid searching is key in numerous applications; Sphinx is a great tool for many cases, and I hope this post helped convince you!
Share your thoughts with @engineyard on Twitter
|
https://blog.engineyard.com/2009/5-tips-for-sphinx-indexing
|
CC-MAIN-2015-32
|
refinedweb
| 1,623
| 58.52
|
Haskell/Understanding monads
From Wikibooks, the open-content textbooks collection
[edit] Notes and TODOs].
[edit] Introduction
[edit] What is a Monad?
Definition: a monad is a triple
consisting of a type constructor M and two polymorphic functions
![ \begin{array}{lcl}\mathit{return} &::& a \to M\,a \\
(\mathit{\gg\!\!=}) &::& M\,a \to (a \to M\,b) \to M\,b\end{array}]()
that obey the following three laws
The operator
is commonly called "bind". Often, one simply refers to the type constructor M as the monad.
In other words, a monad is a kind of abstract data type like a queue or a finite map with two operations bind and return that are supposed to fulfill three properties. One peculiarity is that a monad M is not a type, but a type constructor, i.e. more like a function from types to types. Also, monad is a rather abstract concept; as we will see, many different meanings of bind are possible.
In Haskell, we can capture this definition as a type class
class Monad m where return :: a -> m a (>>=) :: m a -> (a -> m b) -> m b
Any instance of
Monad is assumed to fulfill the three laws stated above. This class is, slightly expanded, part of the Haskell Prelude and defined in the standard library module Control.Monad.
[edit] What use are Monads? f and g into a compound computation
by first "executing" f and "then" binding, i.e. feeding the result to next section.
[edit] Stateful Computations".
[edit] Random Number Generation single roll of original
Seed. Note that
randomNext than just an
Int and is closely linked to the function that generates new pseudo-random numbers. In any case, the module exports a convenient random number generator.
[edit] Threading the State with bind
>>
(>>)
result1 in the following ones, it's simply ignored. In other words, the above expression
a that varies randomly. So,
rollDie can be interpreted as a number between 1 and 6 that "fidgets" and is sometimes "here" and sometimes "there" when asked about its value. We will explore this idea further, but for now, let's stick to our initial goal that
Random a is a simple shortcut for a state transformer. Just take a mental note about the observation that our aim of explicitly removing the state from our functions naturally asks for removing the state from our types, too.
>>
(>>=) m g = \seed0 -> let (result1, seed1) =)
(This is equivalent to
rollDie >>= addToDie).)
That's the same as
addToDie die1 = rollDie >>= (\die2 -> (\seed2 -> (die1 + die2, seed2)) )
which is almost
addToDie die1 = rollDie >>= (\die2 -> (die1 + die2) ).
[edit] Input/Output needs bind
IO
get[4] ((), world consciously).
[edit] Programming with bind and return.
[edit] Nuclear Waste Containers parentheses.), everything expects
In other words, we can describe the operation of
>>= as
m >>= g = join (fmap g m)
i.e. it lifts a waste-producing computation into the container and flattens the resulting nested containers.
We will explore this further program to outside world is the function
main :: IO ()
which will be run by the operating system. In other words, the Haskell program itself ultimately produces nuclear waste, so there is no need to extract
IO a -> a.
[edit]
do-Notation
A common way to write the composition of multiple monadic computations is
sumTwoDice = do die1 <- rollDie die2 <- rollDie return (die1 + die2)
[edit] Control Structures
Needs a better title. Introduce
sequence, fmap, liftMn, forM, mapM and friends.
[edit] The three Monad Laws).
[edit] Monads as containers.
[edit] Lists
concatMap and
sequence..
[edit] Maybe
Maybe
Either, too?
[edit] References
-.
|
http://en.wikibooks.org/wiki/Programming:Haskell_monads
|
crawl-002
|
refinedweb
| 587
| 65.32
|
The D Language Foundation is pleased to present version 2.084.0 of DMD, the reference D compiler. It’s available for download at dlang.org, where you can also find the full changelog. There are a few changes and new features to be found, as usual, along with 100 closed Bugzilla issues this time around.
Finer Control Over Run-time Checks
The new compiler flag
-check is a feature that grew out of DIP 1006 and some internal discussions around its content. The flag allows overriding the default behavior of six specific categories of run-time checks by specifically turning them
on or
off:
assert– assertion checks
bounds– bounds checks
in–
incontracts
invariant– class and struct invariants
out–
outcontracts
switch– default switch cases
For example, when compiling without
-release, all run-time checks are enabled by default. To disable only assertion checks:
dmd -check=assert=off foo.d
This can be further refined with the new
-checkaction flag, which determines how the program will respond when an assertion, bounds, or switch check fails. There are four options:
D,
C, and
halt.
D– the default D behavior, which is to throw an
Errorto indicate an unrecoverable condition.
C– behave as a C program by calling the assertion failure function in the C runtime.
halt– execute a halt instruction to terminate the program.
Listed in the language documentation is a fourth option:
context. This causes failed checks to throw an
Error to indicate an unrecoverable condition, and also print the error context. It isn’t present in this release, but is coming in DMD 2.085 (the online documentation is generated from the DMD master branch).
Save Your Mixins
One of D’s most popular and powerful features is the
mixin statement, commonly referred to as string mixins to avoid confusion with template mixins. Unfortunately, given that string mixins can be composed from multiple compile-time function calls, they are also notoriously painful to debug as they grow in complexity. The new
-mixin compiler option aims to do away with that pain.
Consider the following simple (contrived) example, which attempts to generate a function call with a string mixin:
import std.stdio; void hello() { writeln("Hello!"); } void main() { mixin(hello.stringof ~ "();"); }
Save as
hello.d, compile with
dmd hello, and you’ll see an error along these lines:
hello.d-mixin-6(6): Error: function expected before (), not hello() of type void
The error does say exactly what the problem is, but even in this simple case it may require re-reading the message a few times before working out what it’s actually saying. So let’s recompile with the
-mixin flag. It requires a file name. I’ve selected
mixed.txt:
dmd -mixin=mixed.txt hello.d
Now we see this output:
mixed.txt(110): Error: function expected before (), not hello() of type void
See the difference? The error now refers to a line number in a file with the name we provided, rather than a line in the autogenerated
hello.d-mixin-6 to which we couldn’t refer. Open
mixed.txt and navigate to line 110 to find the generated code, along with a comment at line 109:
// expansion at foo.d(6) hello()();
And now the error is quite clear. Invoking
.stringof on a function provides you with the function name including the parentheses, so there’s no need to append parentheses to the result. We can now change the example so that it will compile:
void main() { mixin(hello.stringof ~ ";"); }
Anyone making significant use of string mixins to generate code will undoubtedly find this feature useful. It will be particularly helpful for the maintainers of D-friendly IDEs and plugins to make the user experience more convenient.
New DUB features
DMD 2.084.0 ships with version 1.13.0 of DUB, the D build tool and package manager. It gets some new goodies with this release.
The new
add command is a convenience to add dependencies to a project’s package recipe. No need to worry about the syntax and whether the recipe is written using JSON or SDLang. Simply run dub with the
add command, specifying one or more dub packages, and the recipe will be modified accordingly. For example, to add the BindBC bindings for the GLFW and OpenGL C libraries:
dub add bindbc-glfw bindbc-opengl
This will add the latest version of each library. This can be restricted to a specific version by appending
= to the package name along with the normal DUB syntax for version specifications. This can also be used to change the version specification of an existing dependency.
For those unfamiliar with DUB, executing
dub run, or simply
dub, in a directory containing a dub recipe will build a project according to the recipe and, if the project is an executable, run it once the build completes. Now, there are two new recipe directives that can be used to achieve more specialized goals.
preRunCommands specifies commands to execute before the DUB target is run, and
postRunCommands specifies commands to execute when the run is complete. See the DUB package recipe documentation for the JSON syntax or the SDLang syntax, under “Build Settings” in each, to see what they look like.
That’s Not All
Regarding the 100 closed Bugzilla issues, two points should be made.
First is that among many of the Pull Request merges that closed those issues, you’ll find Nicholas Wilson’s GitHub handle. Nicholas is, of course, the community member the D Language Foundation asked to serve as PR Manager, to be paid through a fundraising campaign. He’s been reviving old PRs and making sure new ones don’t go stale. This release is evidence that the initiative is paying off. And the icing on the cake is that the D community enabled us to meet our fundraising target well before our February 14th deadline. Thanks!
Second, a point relevant to the #dbugfix campaign. While I was disappointed that participation in nominating Bugzilla issues on Twitter and in the Forums dwindled to near zero, the previous nominations were not forgotten. The original goal was to fix at least two nominated issues per cycle, so several nominated bugs were never selected. However, thanks to Eduard Staniloiu and Razvan Nitu, two among that group are now closed and fixed in this release:
- #13300 – pure function ‘std.array.Appender!(T[]).Appender.ensureAddable’ cannot call impure function ‘test.T.__fieldPostBlit’,
- #18572 – AliasSeq default arguments are broken
I’m still happy to take #dbugfix nominations. If you’ve got a Bugzilla issue that’s bugging you, tweet a link to it with #dbugfix in the text, or start a thread in the General forum with #dbugfix in the title. I’ll make a note of it and, rather than counting votes and selecting two of the top five, see if I can find someone to do something about it.
|
https://dlang.org/blog/2019/01/05/dmd-2-084-0-has-arrived/
|
CC-MAIN-2020-10
|
refinedweb
| 1,152
| 63.8
|
Caution
Buildbot no longer supports Python 2.7 on the Buildbot master.
Caution
This page documents the latest, unreleased version of Buildbot. For documentation for released versions, see.
2.5.8. Build Factories¶
Each Builder is equipped with a
build factory, which defines the steps used to perform a particular type of build.
This factory is created in the configuration file, and attached to a Builder through the
factory element of its dictionary.
The steps used by these builds are defined in the next section, Build Steps.
Note
Build factories are used with builders, and are not added directly to the buildmaster configuration dictionary.
2.5.8.1. Defining a Build Factory¶
A
BuildFactory defines the steps that every build will follow.
Think of it as a glorified script.
For example, a build factory which consists of an SVN checkout followed by a
make build would be configured as follows:
from buildbot.plugins import util, steps f = util.BuildFactory() f.addStep(steps.SVN(repourl="http://..", mode="incremental")) f.addStep(steps.Compile(command=["make", "build"]))
This factory would then be attached to one builder (or several, if desired):
c['builders'].append( BuilderConfig(name='quick', workernames=['bot1', 'bot2'], factory=f))
It is also possible to pass a list of steps into the
BuildFactory when it is created.
Using
addStep is usually simpler, but there are cases where it is more convenient to create the list of steps ahead of time, perhaps using some Python tricks to generate the steps.
from buildbot.plugins import steps, util all_steps = [ steps.CVS(cvsroot=CVSROOT, cvsmodule="project", mode="update"), steps.Compile(command=["make", "build"]), ] f = util.BuildFactory(all_steps)
Finally, you can also add a sequence of steps all at once:
f.addSteps(all_steps)
Attributes¶
The following attributes can be set on a build factory after it is created, e.g.,
f = util.BuildFactory() f.useProgress = False
useProgress
(defaults to
True): if
True, the buildmaster keeps track of how long each step takes, so it can provide estimates of how long future builds will take. If builds are not expected to take a consistent amount of time (such as incremental builds in which a random set of files are recompiled or tested each time), this should be set to
Falseto inhibit progress-tracking.
workdir
(defaults to ‘build’): workdir given to every build step created by this factory as default. The workdir can be overridden in a build step definition.
If this attribute is set to a string, that string will be used for constructing the workdir (worker base + builder builddir + workdir). The attribute can also be a Python callable, for more complex cases, as described in Factory Workdir Functions.
2.5.8.2. Dynamic Build Factories¶
In some cases you may not know what commands to run until after you checkout the source tree. For those cases, you can dynamically add steps during a build from other steps.
The
Build object provides 2 functions to do this:
addStepsAfterCurrentStep(self, step_factories)
This adds the steps after the step that is currently executing.
addStepsAfterLastStep(self, step_factories)
This adds the steps onto the end of the build.
Both functions only accept as an argument a list of steps to add to the build.
For example, let’s say you have a script checked in into your source tree called build.sh.
When this script is called with the argument
--list-stages it outputs a newline separated list of stage names.
This can be used to generate at runtime a step for each stage in the build.
Each stage is then run in this example using
./build.sh --run-stage <stage name>.
from buildbot.plugins import util, steps from buildbot.process import buildstep, logobserver from twisted.internet import defer class GenerateStagesCommand(buildstep.ShellMixin, steps.BuildStep): def __init__(self, **kwargs): kwargs = self.setupShellMixin(kwargs) super().__init__(**kwargs) self.observer = logobserver.BufferLogObserver() self.addLogObserver('stdio', self.observer) def extract_stages(self, stdout): stages = [] for line in stdout.split('\n'): stage = str(line.strip()) if stage: stages.append(stage) return stages @defer.inlineCallbacks def run(self): # run './build.sh --list-stages' to generate the list of stages cmd = yield self.makeRemoteShellCommand() yield self.runCommand(cmd) # if the command passes extract the list of stages result = cmd.results() if result == util.SUCCESS: # create a ShellCommand for each stage and add them to the build self.build.addStepsAfterCurrentStep([ steps.ShellCommand(name=stage, command=["./build.sh", "--run-stage", stage]) for stage in self.extract_stages(self.observer.getStdout()) ]) return result f = util.BuildFactory() f.addStep(steps.Git(repourl=repourl)) f.addStep(GenerateStagesCommand( name="Generate build stages", command=["./build.sh", "--list-stages"], haltOnFailure=True))
2.5.8.3. Predefined Build Factories¶
Buildbot includes a few predefined build factories that perform common build sequences. In practice, these are rarely used, as every site has slightly different requirements, but the source for these factories may provide examples for implementation of those requirements.
GNUAutoconf¶, from Buildbot, which:
f = util.GNUAutoconf(source=source.SVN(repourl=URL, mode="copy"), flags=["--disable-nls"])
Required Arguments:
source
This argument must be a step specification tuple that provides a BuildStep to generate the source tree.
Optional Arguments:
configure
The command used to configure the tree. Defaults to ./configure. Accepts either a string or a list of shell argv elements.
configureEnv
The environment used for the initial configuration step. This accepts a dictionary which will be merged into the worker’s normal environment. This is commonly used to provide things like
CFLAGS="-O2 -g"(to turn off debug symbols during the compile). Defaults to an empty dictionary.
configureFlags
A list of flags to be appended to the argument list of the configure command. This is commonly used to enable or disable specific features of the autoconf-controlled package, like
["--without-x"]to disable windowing support. Defaults to an empty list.
reconf
use autoreconf to generate the ./configure file, set to True to use a buildbot default autoreconf command, or define the command for the ShellCommand.
compile
this is a shell command or list of argv values which is used to actually compile the tree. It defaults to
make all. If set to
None, the compile step is skipped.
test
this is a shell command or list of argv values which is used to run the tree’s self-tests. It defaults to
make check. If set to None, the test step is skipped.
distcheck
this is a shell command or list of argv values which is used to run the packaging test. It defaults to
make distcheck. If set to None, the test step is skipped.
BasicBuildFactory¶
This is a subclass of
GNUAutoconf which assumes the source is in CVS, and uses
mode='full' and
method='clobber' to always build from a clean working copy.
QuickBuildFactory¶
The
QuickBuildFactory class is a subclass of
GNUAutoconf which assumes the source is in CVS, and uses
mode='incremental' to get incremental updates.
The difference between a full build and a quick build is that quick builds are generally done incrementally, starting with the tree where the previous build was performed.
That simply means that the source-checkout step should be given a
mode='incremental' flag, to do the source update in-place.
In addition to that, this class sets the.
BasicSVN¶
This class is similar to
QuickBuildFactory, but uses SVN instead of CVS.
CPAN¶
(required): A step specification tuple, like that used by
GNUAutoconf.
perl
A string which specifies the perl executable to use. Defaults to just perl.
Distutils¶
(required): A step specification tuple, like that used by
GNUAutoconf.
python
A string which specifies the python executable to use. Defaults to just python.
test
Provides a shell command which runs unit tests. This accepts either a string or a list. The default value is
None, which disables the test step (since there is no common default command to run unit tests in distutils modules).
Trial¶
Provides a directory to add to
PYTHONPATHwhen running the unit tests, if tests are being run. Defaults to
.to include the project files in-place. The generated build library is frequently architecture-dependent, but may simply be
build/libfor pure-Python modules.
python
Which Python executable to use. This list will form the start of the argv array that will launch trial. If you use this, you should set
trialto an explicit path (like
/usr/bin/trialor
./bin/trial). The parameter defaults to
None, which leaves it out entirely (running
trial argsinstead of
python ./bin/trial args). Likely values are
['python'],
['python2.2'], or
['python', '-Wall'].
trial
Provides the name of the trial command. It is occasionally useful to use an alternate executable, such as trial2.2 which might run the tests under an older version of Python. Defaults to trial.
trialMode
A list of arguments to pass to trial, specifically to set the reporting mode. This defaults to
['--reporter=bwverbose'], which only works for Twisted-2.1.0 and later.
trialArgs
A list of arguments to pass to trial, available to turn on any extra flags you like. Defaults to
[].
tests
Provides a module name or names which contain the unit tests for this project. Accepts a string, typically
PROJECTNAME.test, or a list of strings. Defaults to
None, indicating that no tests should be run. You must either set this or
testChanges.
testChanges
If
True, ignore the
testsparameter and instead ask the Build for all the files that make up the Changes going into this build. Pass these filenames to trial and ask it to look for test-case-name tags, running just the tests necessary to cover the changes.
recurse
If
True, tells Trial (with the
--recurseargument) to look in all subdirectories for additional test cases.
reactor
which reactor to use, like ‘gtk’ or ‘java’. If not provided, the Twisted’s usual platform-dependent default is used.
randomly
If.
|
https://docs.buildbot.net/latest/manual/configuration/buildfactories.html
|
CC-MAIN-2021-39
|
refinedweb
| 1,624
| 58.99
|
Date: Sun, 18 Mar 2001 12:15:00 +1100 From: Andrew Morton <andrewm@uow.edu.au> To: lkml <linux-kernel@vger.kernel.org> Subject: [patch] Secure Attention Key handling The do_SAK() function is called from within interrupt context. It acquires several process-level spinlocks. This can deadlock. It is fairly trivial for an unprivileged user to deliberately deadlock the kernel of a system which has SAK enabled. So this patch moves do_SAK() into process context. It does a few other things: - Creates some missing tq_struct initialisation macros - In alloc_tty_struct(): once upon a time this function used get_free_page() to allocate the tty_struct. Then Russell King made it use kmalloc() on achines with 16k and 32k page sizes to save a bit of RAM. This patch makes it always use kmalloc(). - The tty_[un]register_devfs() functions are using several kbytes of kernel stack. Jeff has fixed this in UML, so this patch merges those changes in. - The locking rules for task_struct->files.file_lock, task_struct.alloc_lock and tasklist_lock are undocumented and unclear. It is also unclear what some of these locks are actually intended to protect. So I have reviewed the use of these locks and have defined and documented both their locking order, and the things which they are protecting. - The patch instantiates Documentation/SAK.txt, and initialises it with semi-accurate mortonbabble. Comments on the accuracy and completeness of this document would be appreciated. Now, it's pretty obvious that nobody has been testing SAK. It breaks lots of stuff. Pressing the SAK key when using a recent distribution from $(PROMINENT_DISRIBUTOR) instantly kills little things like sshd, httpd, crond, inetd, lpd and sendmail. It also exposes bugs in gpm and vixie cron. Workarounds are described in SAK.txt. My recommendation to distributors is: 1: Test SAK. 2: When launching daemons from within your initscripts, ensure that the daemon's standard input is redirected to /dev/null. 3: Test SAK. Can anyone tell me *why* our SAK implementation doesn't meet C2 requirements? Patch is against 2.4.2-ac20 --- linux-2.4.2-ac20/Documentation/SAK.txt Thu Jan 1 00:00:00 1970 +++ ac/Documentation/SAK.txt Sun Mar 18 11:52:13 2001 @@ -0,0 +1,87 @@ +Linux 2.4.2 Secure Attention Key (SAK) handling +18 March 2001, Andrew Morton <andrewm@uow.edu.au> + . + + +NOTES +===== + +1: Linux SAK is said to be not a "true SAK" as is required by + systems which implement C2 level security. This author does not + know why. + + +2: On the PC keyboard, SAK kills all applications which have + /dev/console opened. + + Unfortunately this includes a number of things which you don't + actually want killed. This is because these appliccaitons' will. You may simply delete these + lines. + --- linux-2.4.2-ac20/include/linux/tty.h Tue Jan 30 18:24:56 2001 +++ ac/include/linux/tty.h Sun Mar 18 11:57:25 2001 @@ -307,6 +307,8 @@ struct semaphore atomic_read; struct semaphore atomic_write; spinlock_t read_lock; + /* If the tty has a pending do_SAK, queue it here - akpm */ + struct tq_struct SAK_tq; }; /* tty magic number */ --- linux-2.4.2-ac20/include/linux/tqueue.h Tue Jan 30 18:24:56 2001 +++ ac/include/linux/tqueue.h Sun Mar 18 11:52:13 2001 @@ -42,6 +42,25 @@ void *data; /* argument to function */ }; +/* + * Emit code to initialise a tq_struct's routine and data pointers + */ +#define PREPARE_TQUEUE(_tq, _routine, _data) \ + do { \ + (_tq)->routine = _routine; \ + (_tq)->data = _data; \ + } while (0) + +/* + * Emit code to initialise all of a tq_struct + */ +#define INIT_TQUEUE(_tq, _routine, _data) \ + do { \ + INIT_LIST_HEAD(&(_tq)->list); \ + (_tq)->sync = 0; \ + PREPARE_TQUEUE((_tq), (_routine), (_data)); \ + } while (0) + typedef struct list_head task_queue; #define DECLARE_TASK_QUEUE(q) LIST_HEAD(q) --- linux-2.4.2-ac20/drivers/char/tty_io.c Tue Mar 13 20:29:22 2001 +++ ac/drivers/char/tty_io.c Sun Mar 18 12:10:28 2001 @@ -63,6 +63,9 @@ * * Don't call close after a failed open. * -- Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 21-Jan-2001 + * + * Move do_SAK() into process context. Less stack use in devfs functions. + * alloc_tty_struct() always uses kmalloc() -- Andrew Morton <andrewm@uow.edu.eu> 17Mar01 */ #include <linux/config.h> @@ -169,26 +172,19 @@ #define MAX(a,b) ((a) < (b) ? (b) : (a)) #endif -static inline struct tty_struct *alloc_tty_struct(void) +static struct tty_struct *alloc_tty_struct(void) { struct tty_struct *tty; - if (PAGE_SIZE > 8192) { - tty = kmalloc(sizeof(struct tty_struct), GFP_KERNEL); - if (tty) - memset(tty, 0, sizeof(struct tty_struct)); - } else - tty = (struct tty_struct *)get_zeroed_page(GFP_KERNEL); - + tty = kmalloc(sizeof(struct tty_struct), GFP_KERNEL); + if (tty) + memset(tty, 0, sizeof(struct tty_struct)); return tty; } static inline void free_tty_struct(struct tty_struct *tty) { - if (PAGE_SIZE > 8192) - kfree(tty); - else - free_page((unsigned long) tty); + kfree(tty); } /* @@ -1827,12 +1823,16 @@ * Now, if it would be correct ;-/ The current code has a nasty hole - * it doesn't catch files in flight. We may send the descriptor to ourselves * via AF_UNIX socket, close it and later fetch from socket. FIXME. + * + * Nasty bug: do_SAK is being called in interrupt context. This can + * deadlock. We punt it up to process context. AKPM - 16Mar2001 */ -void do_SAK( struct tty_struct *tty) +static void __do_SAK(void *arg) { #ifdef TTY_SOFT_SAK tty_hangup(tty); #else + struct tty_struct *tty = arg; struct task_struct *p; int session; int i; @@ -1855,7 +1855,6 @@ task_lock(p); if (p->files) { read_lock(&p->files->file_lock); - /* FIXME: p->files could change */ for (i=0; i < p->files->max_fds; i++) { filp = fcheck_files(p->files, i); if (filp && (filp->f_op == &tty_fops) && @@ -1873,6 +1872,19 @@ } /* + * The tq handling here is a little racy - tty->SAK_tq may already be queued. + * But there's no mechanism to fix that without futzing with tqueue_lock. + * Fortunately we don't need to worry, because if ->SAK_tq is already queued, + * the values which we write to it will be identical to the values which it + * already has. --akpm + */ +void do_SAK(struct tty_struct *tty) +{ + PREPARE_TQUEUE(&tty->SAK_tq, __do_SAK, tty); + schedule_task(&tty->SAK_tq); +} + +/* * This routine is called out of the software interrupt to flush data * from the flip buffer to the line discipline. */ @@ -1986,6 +1998,7 @@ sema_init(&tty->atomic_write, 1); spin_lock_init(&tty->read_lock); INIT_LIST_HEAD(&tty->tty_files); + INIT_TQUEUE(&tty->SAK_tq, 0, 0); } /* @@ -1999,17 +2012,15 @@ /* * Register a tty device described by <driver>, with minor number <minor>. */ -void tty_register_devfs (struct tty_driver *driver, unsigned int flags, - unsigned int minor) +void tty_register_devfs (struct tty_driver *driver, unsigned int flags, unsigned minor) { #ifdef CONFIG_DEVFS_FS umode_t mode = S_IFCHR | S_IRUSR | S_IWUSR; - struct tty_struct tty; + kdev_t device = MKDEV (driver->major, minor); + int idx = minor - driver->minor_start; char buf[32]; - tty.driver = *driver; - tty.device = MKDEV (driver->major, minor); - switch (tty.device) { + switch (device) { case TTY_DEV: case PTMX_DEV: mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; @@ -2030,7 +2041,8 @@ (driver->major < UNIX98_PTY_SLAVE_MAJOR + UNIX98_NR_MAJORS) ) flags |= DEVFS_FL_CURRENT_OWNER; # endif - devfs_register (NULL, tty_name (&tty, buf), flags | DEVFS_FL_DEFAULT, + sprintf(buf, driver->name, idx + driver->name_base); + devfs_register (NULL, buf, flags | DEVFS_FL_DEFAULT, driver->major, minor, mode, &tty_fops, NULL); #endif /* CONFIG_DEVFS_FS */ } @@ -2039,14 +2051,11 @@ { #ifdef CONFIG_DEVFS_FS void * handle; - struct tty_struct tty; + int idx = minor - driver->minor_start; char buf[32]; - tty.driver = *driver; - tty.device = MKDEV(driver->major, minor); - - handle = devfs_find_handle (NULL, tty_name (&tty, buf), - driver->major, minor, + sprintf(buf, driver->name, idx + driver->name_base); + handle = devfs_find_handle (NULL, buf, driver->major, minor, DEVFS_SPECIAL_CHR, 0); devfs_unregister (handle); #endif /* CONFIG_DEVFS_FS */ @@ -2239,9 +2248,6 @@ */ void __init tty_init(void) { - if (sizeof(struct tty_struct) > PAGE_SIZE) - panic("size of tty structure > PAGE_SIZE!"); - /* * dev_tty_driver and dev_console_driver are actually magic * devices which get redirected at open time. Nevertheless, --- linux-2.4.2-ac20/include/linux/sched.h Tue Mar 13 20:29:29 2001 +++ ac/include/linux/sched.h Sun Mar 18 11:57:31 2001 @@ -167,7 +167,7 @@ */ struct files_struct { atomic_t count; - rwlock_t file_lock; + rwlock_t file_lock; /* Protects all the below members. Nests inside tsk->alloc_lock */ int max_fds; int max_fdset; int next_fd; @@ -861,6 +861,7 @@ write_unlock_irq(&tasklist_lock); } +/* Protects ->fs, ->files, ->mm, and synchronises with wait4(). Nests inside tasklist_lock */ static inline void task_lock(struct task_struct *p) { spin_lock(&p->alloc_lock); --- linux-2.4.2-ac20/kernel/sched.c Tue Mar 13 20:29:30 2001 +++ ac/kernel/sched.c Sun Mar 18 11:52:13 2001 @@ -84,6 +84,8 @@ * * If both locks are to be concurrently held, the runqueue_lock * nests inside the tasklist_lock. + * + * task->alloc_lock nests inside tasklist_lock. */ spinlock_t runqueue_lock __cacheline_aligned = SPIN_LOCK_UNLOCKED; /* inner */ rwlock_t tasklist_lock __cacheline_aligned = RW_LOCK_UNLOCKED; /* outer */ --- linux-2.4.2-ac20/Documentation/sysrq.txt Tue Mar 13 20:29:20 2001 +++ ac/Documentation/sysrq.txt Sun Mar 18 11:52:13 2001 @@ -30,6 +30,8 @@ You send a BREAK, then within 5 seconds a command key. Sending BREAK twice is interpreted as a normal BREAK. +On Mac - Press 'Keypad+-F13-<command key>' + On other - If you know of the key combos for other architectures, please let me know so I can add them to this section. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at Please read the FAQ at
|
http://lwn.net/2001/0322/a/SAK.php3
|
crawl-002
|
refinedweb
| 1,472
| 56.35
|
Sorry, please disregard my earlier reply. I didn't read your original
carefully enough. Mario has provided one workaround. I would suggest that
VFS should be enhanced to take advantage of this little-known capability of
Commons-Net. I have had it in the back of my mind to do the same for Ant but
have not found the time yet.
On Sunday 19 September 2004 9:53 am, Steve Cohen wrote:
> On Friday 17 September 2004 1:01 pm, Michael D. Hirsch wrote:
> > Hello,
> >
> >
>
> You are missing something in the API.
> Here is the source for
> DefaultFTPFileEntryParserFactory.createFileEntryParser():
>
> Note that the first thing it tries to do is resolve the key parameter as a
> fully qualified class name of a class derived from FTPFileEntryParser.
> Only when that fails, does the behavior of parsing key as a SYST return
> value kick in.
>
> public FTPFileEntryParser createFileEntryParser(String key)
> {
> Class parserClass = null;
> try
> {
> parserClass = Class.forName(key);
> return (FTPFileEntryParser) parserClass.newInstance();
> }
> catch (ClassNotFoundException e)
> {
> String ukey = null;
> if (null != key)
> {
> ukey = key.toUpperCase();
> }
> if (ukey.indexOf("UNIX") >= 0)
> {
> return createUnixFTPEntryParser();
> }
> else if (ukey.indexOf("VMS") >= 0)
> {
> return createVMSVersioningFTPEntryParser();
> }
> ...
>
> So how would you use this to create and use your own parser?
> The easiest way is to call
> FTPClient.listFiles(String parserKey, String pathname) passing in the fully
> qualified name of your class as the first parameter.
>
>
>
> ---------------------------------------------------------------------
>
|
http://mail-archives.apache.org/mod_mbox/commons-dev/200409.mbox/%3C200409190957.09900.scohen@javactivity.org%3E
|
CC-MAIN-2015-27
|
refinedweb
| 224
| 52.46
|
#include <curses.h> #include <term.h> int setupterm(const char *term, int fildes, int *errret); int setterm(const char *term); TERMINAL *set_curterm(TERMINAL *nterm); int del_curterm(TERMINAL *oterm); int restartterm(const char *term, int fildes, int *errret); char *tparm(const char *str, ...); int tputs(const char *str, int affcnt, int (*putc)(int)); int putp(const char *str); int vidputs(chtype attrs, int (*putc)(char)); int vidattr(chtype attrs); int mvcur(int oldrow, int oldcol, int newrow, int newcol); int tigetflag(const char *capname); int tigetnum(const char *capname); char *tigetstr(const char *capname); DESCRIPTION These low-level routines must be called by programs that have to deal directly with the terminfo database to handle certain terminal capabil‐ ities, such as programming function keys. For all other functionality, curses routines are more suitable and their use is recommended. Initially, setupterm should be called. Note that setupterm is automat‐ ically called by initscr and newterm. This defines the set of termi‐ nal-dependent variables [listed in terminfo(5)]. The terminfo vari‐ ables lines and columns are initialized by setupterm as follows: If use_env(FALSE) has been called, values for lines and columns specified in terminfo are used. Otherwise, if the environment variables LINES and COLUMNS exist, their values are used. If these environment vari‐ ables do not exist and the program is running in a window, the current window size is used. Otherwise, if the environment variables do not exist, the values for lines and columns specified in the terminfo data‐ base are used. The header files curses.h and term.h should be included (in this order) to get the definitions for these strings, numbers, and flags. Parame‐ ter‐ put is to file descriptor fildes which is initialized for output. If errret is not null, then setupterm returns OK or ERR and stores a sta‐ tus val‐ ues from nterm. It returns the old value of cur_term. The del_curterm routine frees the space pointed to by oterm and makes it available for further use. If oterm is the same as cur_term, refer‐ ences exam‐ ple, when reloading a game saved as a core image dump). It assumes that the windows and the input and output options are the same as when memory was saved, but the terminal type and baud rate may be different. Accordingly, it saves various tty state bits, does a setupterm, and then restores the bits.. The tigetnum routine returns the value -2 if capname is not a numeric capability. The tigetstr routine returns the value (char *)-1 if capname is not a string capability. The capname for each capability is given in the table column entitled capname code in the capabilities section of terminfo(5). char *boolnames, *boolcodes, *boolfnames char *numnames, *numcodes, *numfnames char *strnames, *strcodes, *strfnames These null-terminated arrays contain the capnames, the termcap codes, and the full C names, for each of the terminfo variables. RETURN VALUE Routines that return an integer return ERR upon failure and OK (SVr4 only specifies "an integer value other than ERR") upon successful com‐ pletion, unless otherwise noted in the preceding routine descriptions. Routines that return pointers always return NULL on error. NOTES The setupterm routine should be used in place of setterm. It may be useful when you want to test for terminal capabilities without commit‐ ting to the allocation of storage involved in initscr. Note that vidattr and vidputs may be macros. PORTABILITY parame‐ ters, rather than a variable argument list. SEE ALSO curses(3X), curs_initscr(3X), curs_kernel(3X), curs_termcap(3X), putc(3S), terminfo(5) curs_terminfo(3X)[top]
|
http://www.polarhome.com/service/man/?qf=curs_terminfo&tf=2&of=Ultrix&sf=3x
|
CC-MAIN-2017-51
|
refinedweb
| 592
| 53.81
|
Hi, Designing an ATM machine program for college work.
I have this function, which requires the user to enter their 4-digit pin number. (Code below)
I then have an option in the menu called ''Change PIN''.
I've tried using global pin, but not sure if I am using it correctly.
Total newbie to programming.
I have quit a large program and this is the only thing that i just can't seem to solve. Working on it for hours now and I just can't get it but I feel I'm close.
Hopefully when I gain some more knowledge I can give back to these forums cause they've helped me in the past.
Take care guys, thank you v much.
At the moment i just have the pin of this account as 9999 and the program will break after 3 incorrect attempts.
PIN Function:
def validatePIN():
global pin
pin=input("Please enter your 4-digit PIN: ")
count=1
while (pin!="9999") and (count<3):
pin=input("Please enter your 4-digit PIN: ")
count=count+1
if(pin!="9999"):
print("Invalid PIN - Account Blocked")
return False
else:
return True
Then further down, I have a function to change the PIN but I'm just confused about it and it's not valid at all.
Current Change PIN function:
def CP():
currentPin=input("Please enter your current PIN:")
if (currentPin != "9999"):
print("That is not your current PIN")
currentPin=input("Please enter your current PIN:")
elif (currentPin == "9999"):
newPin=input("Please enter your new PIN: ")
print("Thank you. Your new PIN is: ",newPin)
return newPin
The problem with this is that it is not global and if I choose to display the pin, it still says 9999.
I would like this new pin to go in place of the old pin.
Sorry I'm just very confused!
Any help is truly appreciated.
|
http://forums.devshed.com/python-programming/934986-update-change-value-function-last-post.html
|
CC-MAIN-2016-44
|
refinedweb
| 314
| 73.27
|
Hello,
After wine upgrade 5.10 -> 5.11 Windows x64 applications report missing files errors (files should be readed from relative paths to main folder).
I wrote small app in C# (on Win10 PC)
using System; using System.IO; class Test { public static void Main() { string path = Directory.GetCurrentDirectory(); Console.WriteLine("The current directory is {0}", path); } }
compiled 3 times with Any, x86 and x64 and run them under wine on Arch PC
Any and x86 app reports correctly "C:\app"
x64 app reports "Z:\" (which is linked to root folder)
Downgrade to wine 5.10 ... all is OK again
Is there any setting, which must be done or is it wine problem?
Offline
just discovered:
if run
wine explorer
and then double click on app, then it works OK
Offline
I have the same problem, this seems to be a regression in wine 5.11, possibly caused by the following commit: … 73bc034e48
Offline
|
https://bbs.archlinux.org/viewtopic.php?pid=1913089
|
CC-MAIN-2020-29
|
refinedweb
| 154
| 70.02
|
In this tutorial, we'll show how you can capture SMS Messages sent to your own Nexmo number and log those into a Google spreadsheet using an AWS Lambda written in Python. This can be used for capturing feedback, registration for further information, recording votes, or any form of data collection. What's great about this is that you don't need your own dedicated server, just a small chunk of code hosted on AWS Lambda and a Nexmo.We'll cover: * [Why Lambda?](#why-lambda) * [Logging Incoming SMS with AWS Lambda](#sms-lambda) * [Setting Up Google Sheets](#google-sheets) * [Adding SMS Messages to a Google Sheet](#sms-sheets) If you just want to dive in, you can always [Grab the Code](#grab-code)! ## Why Lambda? Serverless technologies are a rapidly emerging trend. Closely related to the concept of microservices, the idea is that instead of building a monolithic application that does everything your business wants you to build a number of discrete smaller applications that each does a single function and then tie those together. One challenge of building these microservices is that the overhead of running a full server stack (OS, Web Server, Database, Application etc) can add a large amount of work and costs. This is where we are seeing a new trend in cloud computing towards serverless technologies, one of the most interesting of these is [AWS Lambda]( from Amazon. You can now write a simple function in either Python, Java or Javascript and have that invoked by either an external API call or another part of AWS like a file being uploaded to S3. As well as removing the requirements to run your own servers you can also keep the costs down; you are only charged for the time your code is executing, in 100ms intervals. This means that for simple functions that handle small amounts of data with very bursty traffic it can work out quite affordable while still having the capacity to handle spikes in traffic. This model makes Lambda an ideal platform to build an application for receiving SMS messages.
Logging Incoming SMS with AWS Lambda
For our demo, we will be writing the application in Python. Lambda allows you to use whatever third-party libraries you wish as part of your application bundle. For the first version, we are simply going to receive an SMS sent to a Nexmo number and log that message in the Lambda logs. The video below will walk you through creating your first Lambda application and setting it up to receive [webhooks]( from the Nexmo API. You will also need a [Nexmo account]( and you will need to buy a number for this.
You can find out more about getting started with AWS Lambda in their getting started guide.
Here's a walk-through of the key points from the video:
import json print('Loading function') def lambda_handler(event, context): print("Received SMS: " + json.dumps(event, indent=2)) return "OK"
Lambda is configured to call a function named
lambda_handler and passes it an object called event. This event contains the parameters that we will map through on the API Gateway Integrations Request
{ "type" : "$input.params('type')", "to" : "$input.params('to')", "msisdn" : "$input.params('msisdn')", "messageId" : "$input.params('messageId')", "message-timestamp" : "$input.params('message-timestamp')", "text" : "$input.params('text')" }
The
lambda_handler will simply take that event data and print it to the log as a JSON object, then it will return an
OK string which will pass through the API gateway and be returned to Nexmo.
Setting Up Google Sheets
The example above is pretty basic, all we are doing is logging the message to the Lambda logfiles, for a real world example we need to do something a bit more useful.
Let’s take a scenario of an event where you want attendees to be able to provide feedback quickly via SMS. A great way to store and share that information is in Google Sheets and lucky for us there’s an API that will allow us to write directly to the sheet.
In the previous video, we start in the Google developers console (get an account here) where you need to create a new project, enable the Drive API for that project and then setup a Service Account Key. This type of access is designed for server to server applications. This is what we'll be using as the Lambda application will connect to Google Docs.
Once that service account key is created you will be provided with a set of credentials downloaded in a JSON file. One of the parameters in there is called
client_email, this will be in the form of an email address. Make a note of this address.
Login to your Google Drive and create a new spreadsheet called
nexmosms. You need to share it with the address related to the Service Account Key and give edit permissions. Now Lambda is acting like another user that is collaborating on the doc with you.
Adding SMS Messages to a Google Sheet
Now that we are working with some external API’s our Lambda code needs to be little more complex. We'll now be using some 3rd party libraries which means that we can no longer just write our code in the browser. Instead we need to create a zipped bundle of our code and the additional libraries we are using.
We skip the video for these coding steps. Instead the detailed steps are below. We'll start off with an empty directory and create a file in there called
lambda_function.py
mkdir nexmosms cd nexmosms touch lambda_function.py
We can install the libraries that we're going to use in our bundle from the command line using the pip package manager. We need to install them to the local folder rather than the regular system path using the
-t flag and can specify the current directory
pwd in backticks. So to add the
nexmo library to the package use the command:
pip install nexmo -t `pwd`
We’ll need to repeat that command for the other libraries we want to use:
pip install oauth2client -t `pwd` pip install gspread -t `pwd` pip install nexmo -t `pwd`
Now that we have a folder with our libraries in it we just need to use them in our
lambda_function.py file:
Our lambda function code is now a little more detailed:
import json import requests from time import strftime as timestamp from oauth2client.service_account import ServiceAccountCredentials import gspread import nexmo from creds import *
The first part imports the libraries we need, but you’ll also notice that there is some stuff in there like
time which we didn’t include in our bundle with pip. This is because Lambda provides everything from Python 2.7 standard runtime.
Next we need to set up access to Google Sheets and also put our Nexmo API Key and API Secret into the file. In the code below replace the X's with your details in the example below.
# Setup access to Google sheets scopes = [' credentials = ServiceAccountCredentials.from_json_keyfile_name('creds.json', scopes=scopes) #Nexmo Credentials nexmo_key = 'XXXXXX' nexmo_secret = 'XXXXXX"
The credentials file that you downloaded when setting up the Google Service Account key should be renamed to
creds.json and included in the bundle.
And add a function called
addrow to our bundle that lets us add a row to our Google Sheet:
def addrow(sender, text): gc = gspread.authorize(credentials) sheet = gc.open('nexmosms').worksheet("Sheet1") sheet.append_row([timestamp('%Y-%m-%d %H:%M:%S'), sender, text])
This function is passed 2 values,
sender which will be the mobile number (MSISDN) that sent the message and
text which is the body of the message. The function creates a
gc object to represent the connection to Google Sheets, a
sheet object which will open a doc in that account called
nexmosms and select the sheet called
Sheet1. Finally we append a new row to that sheet adding a
timestamp as the first column, followed by the sender and message text.
We can then update our original Lambda handler to make use of our new function:
def lambda_handler(event, context): print("Received SMS: " + json.dumps(event, indent=2)) addrow(event['msisdn'], event['text']) client = nexmo.Client(key=nexmo_key, secret=nexmo_secret) client.send_message({'from': event['to'], 'to': event['msisdn'], 'text': 'Thanks for your feedback!'}) return "OK"
In the above code we still print the received data to the log to help with debugging, but we now also invoke the
addrow function we just created.
We then use the official Nexmo Python library (that we released just in time for PyCon 2016) to send back a response to the originator of the message from the Lambda function. We create a
nexmo.Client instance and call
client.send_message setting our
from number to be the Nexmo number that the user sent the message to. The ‘to’ is the user’s phone number that they sent the message from (MSISDN) and the body of the message
text just says
Thanks for your feedback!. Finally we return an
"OK" to the Nexmo API to clear down the request.
That's it! You can now send an SMS to a Nexmo registered number, and have that text message sent to an AWS Lambda function via a Nexmo webhook. Lambda will log the message contents to a Google Sheet and send a reply.
The following video shows uploading the bundle and a demonstration of the code in action:
Grab the Code!
You can download a bundle of all the code from my GitHub. Please let me know what you think, I'm @sammachin on Twitter.
|
https://developer.vonage.com/blog/2016/05/31/building-sms-google-sheets-application-aws-lambda-dr
|
CC-MAIN-2022-21
|
refinedweb
| 1,608
| 69.21
|
2.7 Linking with external libraries
A library is a collection of precompiled object files which can be
linked into programs. The most common use of libraries is to provide
system functions, such as the square root function
sqrt found in
the C math library.
Libraries are typically stored in special archive files with the
extension ‘.
The standard system libraries are usually found in the directories ‘/usr/lib’ and ‘/lib’.(5) For example, the C math library is typically stored in the file ‘/usr/lib/libm.a’ on Unix-like systems. The corresponding prototype declarations for the functions in this library are given in the header file ‘/usr/include/math.h’. The C standard library itself is stored in ‘/usr/lib/libc.a’ and contains functions specified in the ANSI/ISO C standard, such as ‘printf’---this library is linked by default for every C program.
Here is an example program which makes a call to the external function
sqrt in the math library ‘libm.a’:
#include <math.h> #include <stdio.h> int main (void) { double x = sqrt (2.0); printf ("The square root of 2.0
resolved without the external math library ‘libm.a’. The function
sqrt is not defined in the program or the default library
‘libc.a’, and the compiler does not link to the file ‘libm.a’
unless it is explicitly selected.
Incidentally, the file mentioned in the error message
‘/tmp/ccbR60jm.o’ is a temporary object file created by the
compiler from ‘calc.c’, in order to carry out the linking process.
To enable the compiler to link the
sqrt function to the main
program ‘calc.c’ we need to supply the library ‘libm.a’. One
obvious but cumbersome way to do this is to specify it explicitly on the
command line:
$ gcc -Wall calc.c /usr/lib/libm.a -o calc
The library ‘libm.a’ contains object files for all the mathematical
functions, such as
sin,
cos,
exp,
log and
sqrt. The linker searches through these to find the object
file containing the
sqrt function. ‘libm.a’.
To avoid the need to specify long paths on the command line, the compiler provides a short-cut option ‘-l’ for linking against libraries. For example, the following command,
$ gcc -Wall calc.c -lm -o calc
is equivalent to the original command above using the full library name ‘/usr/lib/libm.a’.
In general, the compiler option
-lNAME will attempt to
link object files with a library file ‘libNAME.a’ in the
standard library directories. Additional directories can specified with
command-line options and environment variables, to be discussed shortly.
A large program will typically use many
-l options to link
libraries such as the math library, graphics libraries and networking
libraries.
|
http://www.network-theory.co.uk/docs/gccintro/gccintro_17.html
|
CC-MAIN-2013-20
|
refinedweb
| 455
| 59.09
|
See also: IRC log
<trackbot> Date: 24 June 2015
Comparison of approaches:
rdf: rest / rdf:rest / rdf:rest / rdf:first
<ericP> +1 +0 -1
Who prefers which option?
option 1
<Lloyd> +1 +0 -1
<Marc> +1 -1 -1
paul: +1 0 -1
<Tony> +1 -1 -1
rob: option 1? (abstain)
+1 +0 -1
AGREED: Option 1 for ordering
tony: what namespace to use for fhirRdf:index ?
marc: good to have one namespace
ISSUE: What namespace to use for fhirRdf:index ?
<trackbot> Created ISSUE-13 - What namespace to use for fhirrdf:index ?. Please complete additional details at <>.
lloyd: within repeating elements,
the structure definition allows repetition, and round tripping
must retain ordering.
... suggest fhirRdf:_index , because we might have the word "index" in several places.
... also calls out that this is a special beast.
AGREED: Start fhirRdf:index with 1
lloyd: everything else would have
a class prefix on the local name, like fhir:Observation.code ,
whereas this would not have a class first.
... We could say this is a property of Element.
... there's a certain appeal to saying fhir:index
eric: when we start relating property names between classes, when two properties have the same meaning, how would we name them?
dbooth: My initial thought is that we wouldn't rename properties that are in common -- the ont would just indicate that they are the same.
AGREED: Use fhir:index (and change later if we need to)
lines 459 and 464-465
dbooth: on line 459, if you're using FHIR XML and you do an HTTP GET of , what are you supposed to receive? FHIR XML?
tony: you get back a patient resource, in FHIR XML or whatever format you requested
dbooth: on line 463, where did fhir:Reference.display come from? It isn't in the FHIR XML?
<ericP> <element> <path value="AllergyIntolerance.recorder"/> <min value="0"/> <max value="1"/> <type><code value="Reference"/><profile value=""/></type> <type><code value="Reference"/><profile value=""/></type>
<ericP> </element>
tony: I'll add that after line 459
<ericP> <element>
<ericP> <path value="AllergyIntolerance.recorder"/> <min value="0"/> <max value="1"/>
<ericP> <type><code value="Reference"/><profile value=""/></type>
dbooth: When you GET ,
does the FHIR RDF that you get back identify the patient using
that same URI? We need to nail that down.
... At the moment on line 465 it looks like you are assuming that the patient will NOT be identified using the same URI.
<ericP>
eric: What if you get back a
bundle?
... How do we know if a bundle is permitted?
tony: Don't know. Haven't got to bundles yet.
eric: There's raging debate in
the RDF world about whether to distinguish between a document
URI and the thing it describes.
... The people who care about making a distinction do it in two ways: 1. frag ID (with media type). 2. Use a 303 redirect.
tony: Recommendation?
eric: we should be able to compose the RDF URI for the patient from the info in the FHIR XML
tony: why would the resource ID in the document be different from the document ID?
eric: When there is some logic in the object model, and that logic allows you to deref a URI, then we need to emulate those semantics in RDF.
tony: agreed
eric: If I get RDF for a patient
problem, I think there's some glue in the protocol that says
that if I do a GET on a URI, the FHIR data you get back is that
thing at the top of the XML hierarchy.
... If we say that FHIR RDF is isomorphic with FHIR XML, then we need a way to identify the starting node, analogous to the top level node in XML.
... If I get some FHIR XML, with a reference, I need to be able to compose the URI for Peter Patient from it.
... That link needs to point to either something in the graph or something that's created by the conversion process.
dbooth: When <patient> has a <reference> to , the system that does a GET is expecting a Patient to be returned. That expectation is what allows the system to look for a Patient in the data that's returned.
eric: what if there are two
patients in the data returned?
... The FHIR RDF will need to contain a pointer to its root element.
... I believe a resource ID can also be served from multiple URLs.
... With FHIR XML, when you get back FHIR XML you know what the root element is.
... Normally the URL at which you GET some RDF is not a URL in the returned document.
Paul: Suggest unpacking the GET problem in to a small example, as specific as possible and grounded in some content. Hard to follow.
eric: I'll implement it in the translator and show you.
ADJOURNED
This is scribe.perl Revision: 1.140 of Date: 2014-11-06 18:16:30 Check for newer version at Guessing input format: RRSAgent_Text_Format (score 1.00) No ScribeNick specified. Guessing ScribeNick: dbooth Inferring Scribes: dbooth Present: David_Booth EricP Lloyd_McKenzie MarcT Paul_Courtney Rob_Hausam Tony_Mallia Found Date: 24 Jun 2015 Guessing minutes URL: People with action items:[End of scribe.perl diagnostic output]
|
http://www.w3.org/2015/06/24-hcls-minutes.html
|
CC-MAIN-2019-51
|
refinedweb
| 868
| 72.87
|
Hi,
Is there a way I can run OpenCL programs in emulation mode on CPU itself without having to install driver or graphics card.
Thanks
Hi,
Is there a way I can run OpenCL programs in emulation mode on CPU itself without having to install driver or graphics card.
Thanks
Actually there is no need to install the driver. OpenCL runtime is shipped with both driver and SDK as AMD's opencl implementation is meant for both CPU & GPU.
Hi,
So is the code generated by the OpenCL compiler same when it runs in emulation mode or it is diffirent.
Thanks
No, the code is not the same. OpenCL compiler creates architecture (x86, x86_64) dependant SSE binary on the CPU, and ISA code for the GPUs. However, is by "same" you meant same functionality, then sort of.
First of all one clarification: compiling OpenCL onto the CPU is NOT emulation. It does not emulate anything. It is paralell code being compiled onto a multi-core HW, namely a CPU.
As for being the "same", well written code will work the same on CPU and GPU. Not-well written code will work on one, but fail on the other. Such cases are born when synchronization bugs are left in the code, but it accidently works on one of the two, but fails on the other. These are 99% of the times due to faulty programming. This is the reason why running on CPU is not fully the same as running on a GPU, since architectures differ greatly, and sync issues arise differently.
Originally posted by: himanshu.gautam Actually there is no need to install the driver. OpenCL runtime is shipped with both driver and SDK as AMD's opencl implementation is meant for both CPU & GPU.
Hi,
Could you please tell me the additional linker options or against which library I should link in my code so that I am able to use the emulation mode.
I had a side question. I couldn't find the appropriate forum so I am posting it here.
I tried to download the driver for ATI R5770 Hawk. The webppage
() takes me to a scanner software which looks for the list of devices installed and sugegsts the appropriate driver. I do not have the hardware right now but wished to install the software before hand. Could you please let me know where can I get hold of the drivers for the above mentioned card.
Thanks
Hi shankha,
As meteorhead already told, running on CPU is not an emulation.OpenCL compiler creates binaries for all devices you want to.
You don't need any specific library other than opencl.lib to run opencl programs.
I think you should be able to find driver for any AMD device on AMD site. But AFAIK, it would not be possible to install a driver without the hardware. And why would you need to do that. You can run opencl on CPU without installing the driver at all.
Hi Himanshu,
I tried compiling my OpenCL code. My program fails when I call clGetPlatformIDs.
My copying my code and command line. Please do let me know if you find the options incorrect or I should be using any additional options.
====================================================================================================
SRC :
I have attached code to this message.
Compilation Comamnd :
Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
cl /Feexample.exe -I"C:\Program Files (x86)\AMD APP"\include -I"C:\Users\shankhab\Documents\AMD APP"\include example.c -DATI_OS_WIN /link /LIBPATH:"C:\Program Files (x86)\AMD APP"\lib\x86 /LIBPATH:"C:\Users\shankhab\Documents\AMD APP"\lib\x86 OpenCl.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
example.c
Microsoft (R) Incremental Linker Version 9.00.21022.08
/out:example.exe
"/LIBPATH:C:\Program Files (x86)\AMD APP\lib\x86"
"/LIBPATH:C:\Users\shankhab\Documents\AMD APP\lib\x86"
OpenCl.lib
example.obj
Please note, I am not trying to run the Kernel.
====================================================================================================
I do understand the call to clGetPlatformIDs( 1, &platform, NULL ) and clGetDeviceIDs would fail since I do not have the card installed.
The question is then how I make these calls succed so that the correct set of parametres are passed to clCreateProgramWithSource and
the call succeds.
Thanks for your help.
Thanks
Shankha
#include <CL/cl.h> #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <winbase.h> #include <time.h> #define NWITEMS 512 const char *source = "__kernel void memset( __global uint *dst ) \n" "{ \n" " dst[get_global_id(0)] = get_global_id(0); \n" "} \n"; #define CL_ERROR(func) \ do { \ if (cl_ret != CL_SUCCESS) \ { \ printf ("%s Failed\n", \ func); \ exit (EXIT_FAILURE); \ } \ cl_ret = CL_SUCCESS; \ } while(0) int main(int argc, const char ** argv) { cl_platform_id platform; cl_device_id device; cl_context context; cl_command_queue queue; cl_program program; cl_int cl_ret; cl_ret = clGetPlatformIDs( 1, &platform, NULL ); CL_ERROR("clGetPlatformIDs"); // 2. Find a gpu device. cl_ret = clGetDeviceIDs( platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL); CL_ERROR("clGetDeviceIDs"); // 3. Create a context and command queue on that device. context = clCreateContext(NULL, 1, &device, NULL, NULL, &cl_ret); CL_ERROR("clCreateContext"); queue = clCreateCommandQueue(context, device, 0, &cl_ret); CL_ERROR("clCreateCommandQueue"); program = clCreateProgramWithSource( context, 1, &source, NULL, &cl_ret); CL_ERROR("clCreateProgramWithSource"); cl_ret = clBuildProgram( program, 1, &device, NULL, NULL, NULL ); CL_ERROR("clBuildProgram"); printf ("Done...\n"); return 0; }.
Thanks
Originally posted by: shankha.
To clarify some. The same application can use the CPU and GPU devices. So the code generation is the same *until you call clBuildProgram*. clBuildProgram is when the driver compiles the OpenCL kernel for the particular device(s) you pass in. All the host code is identical, really.
That said, you may wish to change the flow of your application depending on whether you are running on a CPU or GPU device. For example, GPU devices might work more efficiently by moving data to the device, but the CPU doesn't have this issue.
Jeff
Originally posted by: MicahVillmow Shanka, Please use the --offline-devices platform extension. This will allow you to do so.
Thanks.
Found a excellent example here ().
AMD provide a CPU based OpenCL implementation (certainly for Windows) as do the other well known chip maker.
However in both cases, you will need to install the driver (OpenCL runtime), just as you need to install the c/c++ runtime libraries.
Steve.
|
https://community.amd.com/thread/151759
|
CC-MAIN-2020-45
|
refinedweb
| 1,034
| 67.45
|
Hi
I'm a very new Sharepoint Admin and I'm only just starting out on the long road to understanding this massive product. The question I've been asked by my boss is this. He understands and very much likes how you can use metadata and view filters to narrow
down a long doclib to just the documents you want. He wants to know if theres a way to do this across multiple doclibs instead of just searching. For example if you had several seperate doclibs containing files pertaining to particular clients (one doclib
per client), and you have a metadata tag such as "Quotes" can you get a view containing all documents with the "Quotes" tag from all doclibs? I understand this cannot be done out-of-the-box but would need some kind of script or other customisation, can anyone
advise on what would be required or where I could find something to do this?
Thanks
Scott working on an ASP.NET MVC 2 project with some business entities
that have metadata dataannotations attributes applied to them
(Validation attributes, Display attributes, etc.).
Something like:
//User entitypublic class User{ [DisplayName("Vorname")] [Required(ErrorMessage = "Vorname fehlt")] [StringLength(MaxNameLength, ErrorMessage = "Vorname ist zu lang")] public string FirstName { get; set; }.
we are implementing out own instance store. Besides the property InstanceData, the class SaveWorkflowCommand also contains a property called InstanceMetadataChanges. What is instance metadata and in which situations do changes to the instance metadata occur?
Do we have to take care about changes in the instance metadata in our custom instance store? Right now we are storing the initial metadata changes when an instance is created, but ignore any further changes since we would probably somehow have to merge the
old changes with the new changes. As far as I can see, the "PurchaseProcess" example does not not save any instance metadata. The documentation of SaveWorkflowCommand isn't relly helpful in this case either. Can anyone tell me what instance metadata
is and if we have to take care of changes to instance metadata in our custom InstanceStore?
Thanks,
David
Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend
|
http://www.dotnetspark.com/links/66279-custom-views-using-metadata.aspx
|
CC-MAIN-2017-13
|
refinedweb
| 364
| 60.04
|
What Does It Take To Win The Euro 2016?
A tale of goals, passes, web scraping, and being the only German who is not into Soccer.
Usually, I’m a proud member of the small club of Germans who don’t care too much for soccer and make up for this by at least following the national selection on big competitions, like this year’s Euro. After Germany has been kicked out by the host France in the semi-finals, it’s time for some soul searching and many a discussion was had about whether the German style of playing (focusing on ball control and short, safe passing) is as good as it seemed in the aftermath of the last world cup, won by Germany.
Not being the biggest Soccer enthusiast, I don’t feel to qualified to enter this discussion, but maybe we can find interesting data we can crunch to give us some insights.
Web Scraping 201 - What About JavaScript?
It’s about time I talked about web scraping. Writing a spider that follows links and extracts useful information is an important way for any data scientist worth his or her salt to gather interesting data. Now there are very nice frameworks around for this task. If you like Python, you should look into scrapy. Scala/Java users have with JSoup a powerful tool at their hands to extract entities from HTML pages (similar to beautifulsoup for Python).
An important thing to keep in mind is that you should have a look at the
robots.txt
page of the URL you want to extract information from to make sure they are okay with your spider grabbing data from their servers. Luckily, the UEFA does allow crawling their statistics on the Euro 2016 at the time of writing.
There is one more possible challenge though. Many pages are not static, but built at the time of viewing using JavaScript. This means that we cannot simply use a tool like scrapy to extract data since it doesn’t execute JavaScript. I had to write a set of Scala scripts using Selenium to get around this problem. Selenium is actually a web testing tool, but very suitable for jobs like this. Go check it out and play around with it. It’s really easy to use and a very handy tool to know.
import collection.JavaConversions._ import org.openqa.selenium.WebDriver import org.openqa.selenium.By object Crawl { def getUrls(driver: WebDriver) = { for (link <- driver.findElements(By.tagname("a"))) yield link.getAttribute("href") } def crawl(url: String, driver: WebDriver): Unit = { driver.get(url) println(getUrls.mkString("\n")) for (newUrl <- urls) craw(newUrl, driver) // might run a long time! } }
Do Passes Matter?.
.
But what about goals? You can pass the ball around all you want, but you won’t win unless you score some goals. So let’s repeat the last plot, but with the attempts to score per minute (APM) instead of the PPM.
>>IMAGE.
I guess this is what makes soccer exciting. You can play very successful with a number of strategies, passing a lot or very little, making many or few attempts to score. To some degree it’s randomness that keeps us at the edge of our seats.
Nerd Zone: Ordinal Logistic Regression
Sometimes it’s just not enough to look at bar charts, but you have to quantify what you see. And since Germans take their soccer serious, I have all intention to back my ramblings with some numbers.
Let’s make sure that there is really not connection between APM, PPM, and at what stage you get kicked out. In order to do so, we use Ordinal Logistic Regression, using the MASS R package (check the tutorial here). The model we build using gives as expected a really bad AIC score.
So what does the null model say?!
|
http://data-adventures.com/2016/07/10/what-does-it-take-to-win-the-euro-2016.html
|
CC-MAIN-2018-43
|
refinedweb
| 643
| 73.07
|
Lightning Process Builder has arrived, GA in Spring ’15! The newest Salesforce addition to workflow automation, Process Builder has already been a hot topic of conversation, exploration, and education in the Salesforce Admin and Developer community. There are a number of community blog posts detailing Process Builder use cases and a thriving list of ideas for what the community wants to see in the roadmap. Shelly Erceg, Salesforce Product Manager addresses a number of the Process Builder hot topics with us here. Follow Shelly and the Workflow Automation group in the Success Community for the latest and greatest updates and answers around Salesforce Workflow Automation tools.
Working on it! We are actively working on plans to cover bulk use cases in the Process Builder. It is, however, a complex problem. The context here is that these are Platform limitations that have always governed Flow and Apex as well. By offering the flexibility to operate across objects that Process Builder brings, we are subject to limits that Workflow Rules are not. The difference is that Flow and Apex provide technically sophisticated users methods to do effective workarounds to manage their way through the limits with code or pseudo-code.
For Process Builder our goal is to abstract away this type of complexity, and solve as many types of Bulk use cases behind the scenes as we can. The solution will be multi-layered and one we will be iterating on. It won’t likely come all at once. We are going to iterate and meanwhile WF Rules, Flow or Apex are still in place. In the meantime we are going to step up our educational efforts to help users determine if PB is appropriate for their use cases.
We will continue to iterate on the power available in Process Builder and, just as critically, we will continue to iterate on the user experience and usability of PB with a goal of providing power in a simplified, transparent way.
Whether or not you encounter bulk handling issues today depends on your org shape. In general, the more complicated your environment — the more triggers you have deployed, the more API interactions you do in batch and the more interesting your process actions are — the greater the possibility you have of encountering a bulk handling issue.
For example, in the recent Button Click Admin podcast on How Salesforce Built Process Builder, one example of a powerful process they shared is keeping Account and Contact address changes in sync. In a simple org with limited triggers and no batch API interactions, you will not encounter any issues. However, if you import and update data in batch, it is possible you will encounter a bulk handling issue. For example, if you import and then update 500 Accounts and Contacts in an org without triggers on either object, you will see the following behavior:
Another example is what happens when you create a process that attempts to update a related record. For example, maybe your process looks for an External Id on the Lead object. When it encounters that Id, it attempts to look up another record, and update a field. This simple Apex testmethod will succeed or fail depending on how many Leads you decide to work with.
@IsTest public class ProcessTest { //exercises bulk handling issue public static testmethod void testLeads() { List newLeads = new List(); //x <= 100 succeeds, x >= 101 fails for (Integer x = 0; x < 100; x++) { Lead me = new Lead(); me.Company = 'SampleCo'; me.LastName = 'MyName'; me.MyLeadId__c = 'Apex' + x; // process entry criteria me.Status = 'Open - Not Contacted'; newLeads.add(me); } insert newLeads; } }
In general, as you get started with Process Builder, you can easily test whether it’s an appropriate tool for your use case by considering your org shape. If you aren’t sure, you can easily create a test in Apex or using sample data to be sure it works for you.
You can use Change Sets to move Processes from your Sandbox to Production org or Packaging to move between Production orgs. Processes are a type of Flow underneath, so you’ll see them listed as Flows. Below are some things to consider…
We are working on this one as well! Currently you need to wait 12 hours to delete an active process, but soon you will be able to immediately delete active processes that do not have any waiting scheduled actions
We are going to be incrementing on formula robustness over the next few releases to increase the breadth of formula functionality in Process Builder. Your use cases are very helpful to us in testing to make sure can provide the functionality you need. Please share those with us in the Success Group
Great Question! Salesforce now has a number of automation tools, Flow, Approvals, Workflow, Process Builder. A rudimentary guideline to follow is:
–Complex branching logic (i.e. if certain conditions are true, evaluate for further conditions) –Sort through, iterate over, and operate on batches of records –Bulk cases – use Flow or Apex Here is a matrix that provides more detail around use cases and specific limitations.
Yes! You create a task or event in a Process Action by using the Create Record Action type and selecting Tasks or Event as the object type.
Hope this answers some of the pressing questions in the community, stay tuned for more news, articles, and documentation around Lightning Process Builder!
|
https://developer.salesforce.com/blogs/developer-relations/2015/04/lightning-process-builder-tips.html
|
CC-MAIN-2018-09
|
refinedweb
| 899
| 59.53
|
2. Installing MPFR
The MPFR library is already installed on some GNU/Linux distributions,
but the development files necessary to the compilation such as
‘mpfr.h’ are not always present. To check that MPFR is fully
installed on your computer, you can check the presence of the file
‘mpfr.h’ in ‘/usr/include’, or try to compile a small program
having
#include <mpfr.h> (since ‘mpfr.h’ may be installed
somewhere else). For instance, you can try to compile:
with
and if you get errors whose first line looks like
then MPFR is probably not installed. Running this program will give you the MPFR version.
If MPFR is not installed on your computer, or if you want to install a different version, please follow the steps below.
|
http://www.manpagez.com/info/mpfr/mpfr-3.0.1/mpfr_4.php
|
CC-MAIN-2018-30
|
refinedweb
| 127
| 74.79
|
Version: 1.2.0.6
Getting Started¶
This page gives an introduction to python-stix and how to use it.
Note
This page is being actively worked on; feedback is always welcome.
Prerequisites¶
The python-stix library provides an API for creating or processing STIX content. As such, it is a developer tool that can be leveraged by those who know Python 2.7/3.3+ and are familiar with object-oriented programming practices, Python package layouts, and are comfortable with the installation of Python libraries. To contribute code to the python-stix repository, users must be familiar with git and GitHub pull request methodologies. Understanding XML, XML Schema, and the STIX language is also incredibly helpful when using python-stix in an application.
Your First STIX Application¶
Once you have installed python-stix, you can begin writing Python applications that consume or create STIX content!
Note
The python-stix library provides bindings and APIs, both of which can be used to parse and write STIX XML files. For in-depth description of the APIs, bindings, and the differences between the two, please refer to APIs or bindings?
Creating a STIX Package¶
from stix.core import STIXPackage # Import the STIX Package API from stix.report import Report # Import the STIX Report API from stix.report.header import Header # Import the STIX Report Header API stix_package = STIXPackage() # Create an instance of STIXPackage stix_report = Report() # Create a Report instance stix_report.header = Header() # Create a header for the report stix_report.header.description = "Getting Started!" # Set the description stix_package.add(stix_report) # Add the report to our STIX Package print(stix_package.to_xml()) # Print the XML for this STIX Package
Examples¶
The python-stix GitHub repository contains several example scripts that help illustrate the capabilities of the APIs. These examples can be found here. Accompanying walkthrough slides are available. These scripts are simple command line utilities that can be executed by passing the name of the script to a Python interpreter.
Example: $ python ex_01.py
Note
You must install python-stix before running these example scripts.
|
https://stix.readthedocs.io/en/latest/getting_started.html
|
CC-MAIN-2018-39
|
refinedweb
| 340
| 58.28
|
Java - For Loop
Java.
public class MyClass { public static void main(String[] args) { for (int i = 1; i <= 5; i++){ System.out.println(i); } } }.
public class MyClass { public static void main(String[] args) { for (int i = 1, j = 100; i <= 5 || j <= 800; i++, j = j + 100){ System.out.println("i="+i+", j="+j); } } }
The output of the above code will be:
i=1, j=100 i=2, j=200 i=3, j=300 i=4, j=400 i=5, j=500 i=6, j=600 i=7, j=700 i=8, j=800
Java for-each Loop
Java for-each loop is used to traverse an array or a collection. In each iteration of the loop, current element is assigned to a user defined variable and array/collection pointer is moved to next element which is processed in the next iteration. Please note that it works on element basis (not index basis).
Syntax
for(variable: array/collection){ statements; }
In the below example, the foreach loop is used on array called Arr which is further used to print each element of the array in each iteration.
public class MyClass { public static void main(String[] args) { int Arr[]={10, 20, 30, 40 ,50}; System.out.println("The Arr contains:"); for(int i: Arr) System.out.println(i); } }
The output of the above code will be:
The Arr contains: 10 20 30 40 50
|
https://www.alphacodingskills.com/java/java-for-loop.php
|
CC-MAIN-2021-04
|
refinedweb
| 232
| 60.45
|
0
Hi! i'm a bit new in c++ so i'v got some question wish you to answer me...!
first of all i want my program to show the specific group of line of my file so i use this code for it:
using namespace std; int main() { ifstream myfile; myfile.open("test.txt"); cout<<"which line to start showing?"; string showline; cin>>showline; string line; while(getline(myfile,line)) { if(line==showline) { do { cout<<line<<endl; }while(line!="javad"); } } myfile.close(); }
what is the problem of this code? can anyone give the correct one of this or another one for my question?
2.after that i want my program to delete specific lines of my file... i don't have any idea what to do... can anyone give the code?
thanks so much!
|
https://www.daniweb.com/programming/software-development/threads/443602/need-some-help-in-files
|
CC-MAIN-2015-40
|
refinedweb
| 135
| 85.08
|
QNX Developer Support
getw()
Get a word from a stream
Synopsis:
#include <stdio.h> int getw( FILE* stream );
Arguments:
- stream
- The stream that you want to read a word from.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The getw() function returns the next word (i.e. integer) from the named input stream. This function increments the associated file pointer, if defined, to point to the next word. The size of a word is the size of an integer, and varies from machine to machine. The getw() function assumes no special alignment in the file.
Returns:
The next word, or the constant EOF at the end-of-file or on an error; it sets the EOF or error indicator of the stream.
Errors:
- EOVERFLOW
- The file is a regular file, and an attempt was made to read at or beyond the offset maximum associated with the corresponding stream.
Classification:
Caveats:
Because of possible differences in word length and byte ordering, files written using putw() are implementation-dependent, and might not be read correctly using getw() on a different processor.
See also:
fclose(), feof(), ferror(), fgetc(), flockfile(), fopen(), fread(), getc(), getc_unlocked(), getchar(), getchar_unlocked(), gets(), putc(), putw(), scanf(), ungetc(),
|
http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/lib_ref/g/getw.html
|
CC-MAIN-2013-20
|
refinedweb
| 210
| 63.9
|
Next Chapter: Dealing with NaN
Reading and Writing Data
All the powerful data structures like the Series and the DataFrames would avail to nothing, if the Pandas module wouldn't provide powerful functionalities for reading in and writing out data. It is not only a matter of having a functions for interacting with files. To be useful to data scientists it also needs functions which support the most important data formats like
- Delimiter-separated files, like e.g. csv
- Microsoft Excel files
- HTML
- XML
- JSON
Delimiter-separated Values
Most people take csv files as a synonym for delimter-separated values files. They leave the fact out of account that csv is an acronym for "comma separated values", which is not the case in many situations. Pandas also uses "csv" and contexts, in which "dsv" would be more appropriate.
Delimiter-separated values (DSV) are defined and stored two-dimensional arrays (for example strings) of data by separating the values in each row with delimiter characters defined for this purpose. This way of implementing data is often used in combination of spreadsheet programs, which can read in and write out data as DSV. They are also used as a general data exchange format.
We call a text file a "delimited text file" if it contains text in DSV format.
For example, the file dollar_euro.txt is a delimited text file and uses tabs (\t) as delimiters.
Reading CSV and DSV Files
Pandas offers two ways to read in CSV or DSV files to be precise:
- DataFrame.from_csv
- read_csv
There is no big difference between those two functions, e.g. they have different default values in some cases and read_csv has more paramters. We will focus on read_csv, because DataFrame.from_csv is kept inside Pandas for reasons of backwards compatibility.
import pandas as pd exchange_rates = pd.read_csv("data1/dollar_euro.txt", sep="\t") print(exchange_rates)
Year Average Min USD/EUR Max USD/EUR Working days 0 2016 0.901696 0.864379 0.959785 247 1 2015 0.901896 0.830358 0.947688 256 2 2014 0.753941 0.716692 0.823655 255 3 2013 0.753234 0.723903 0.783208 255 4 2012 0.778848 0.743273 0.827198 256 5 2011 0.719219 0.671953 0.775855 257 6 2010 0.755883 0.686672 0.837381 258 7 2009 0.718968 0.661376 0.796495 256 8 2008 0.683499 0.625391 0.802568 256 9 2007 0.730754 0.672314 0.775615 255 10 2006 0.797153 0.750131 0.845594 255 11 2005 0.805097 0.740357 0.857118 257 12 2004 0.804828 0.733514 0.847314 259 13 2003 0.885766 0.791766 0.963670 255 14 2002 1.060945 0.953562 1.165773 255 15 2001 1.117587 1.047669 1.192748 255 16 2000 1.085899 0.962649 1.211827 255 17 1999 0.939475 0.848176 0.998502 261
As we can see, read_csv used automatically the first line as the names for the columns. It is possible to give other names to the columns. For this purpose, we have to skip the first line by setting the parameter "header" to 0 and we have to assign a list with the column names to the parameter "names":
import pandas as pd exchange_rates = pd.read_csv("data1/dollar_euro.txt", sep="\t", header=0, names=["year", "min", "max", "days"]) print(exchange_rates)
year min max days 2016 0.901696 0.864379 0.959785 247 2015 0.901896 0.830358 0.947688 256 2014 0.753941 0.716692 0.823655 255 2013 0.753234 0.723903 0.783208 255 2012 0.778848 0.743273 0.827198 256 2011 0.719219 0.671953 0.775855 257 2010 0.755883 0.686672 0.837381 258 2009 0.718968 0.661376 0.796495 256 2008 0.683499 0.625391 0.802568 256 2007 0.730754 0.672314 0.775615 255 2006 0.797153 0.750131 0.845594 255 2005 0.805097 0.740357 0.857118 257 2004 0.804828 0.733514 0.847314 259 2003 0.885766 0.791766 0.963670 255 2002 1.060945 0.953562 1.165773 255 2001 1.117587 1.047669 1.192748 255 2000 1.085899 0.962649 1.211827 255 1999 0.939475 0.848176 0.998502 261
Exercise
The file "countries_population.csv" is a csv file, containing the population numbers of all countries (July 2014). The delimiter of the file is a space and commas are used to separate groups of thousands in the numbers. The method 'head(n)' of a DataFrame can be used to give out only the first n rows or lines. Read the file into a DataFrame.
Solution:
pop = pd.read_csv("data1/countries_population.csv", header=None, names=["Country", "Population"], index_col=0, quotechar="'", sep=" ", thousands=",") print(pop.head(5))
Population Country China 1355692576 India 1236344631 European Union 511434812 United States 318892103 Indonesia 253609643
Writing csv Files
We can create csv (or dsv) files with the method "to_csv". Before we do this, we will prepare some data to output, which we will write to a file. We have two csv files with population data for various countries. countries_male_population.csv contains the figures of the male populations and countries_female_population.csv correspondingly the numbers for the female populations. We will create a new csv file with the sum:
column_names = ["Country"] + list(range(2002, 2013)) male_pop = pd.read_csv("data1/countries_male_population.csv", header=None, index_col=0, names=column_names) female_pop = pd.read_csv("data1/countries_female_population.csv", header=None, index_col=0, names=column_names) population = male_pop + female_pop
population
population.to_csv("data1/countries_total_population.csv")
We want to create a new DataFrame with all the information, i.e. female, male and complete population. This means that we have to introduce an hierarchical index. Before we do it on our DataFrame, we will introduce this problem in a simple example:
import pandas as pd shop1 = {"foo":{2010:23, 2011:25}, "bar":{2010:13, 2011:29}} shop2 = {"foo":{2010:223, 2011:225}, "bar":{2010:213, 2011:229}} shop1 = pd.DataFrame(shop1) shop2 = pd.DataFrame(shop2) both_shops = shop1 + shop2 print("Sales of shop1:\n", shop1) print("\nSales of both shops\n", both_shops)
Sales of shop1: foo bar 2010 23 13 2011 25 29 Sales of both shops foo bar 2010 246 226 2011 250 258
shops = pd.concat([shop1, shop2], keys=["one", "two"]) shops
We want to swap the hierarchical indices. For this we will use 'swaplevel':
shops.swaplevel() shops.sort_index(inplace=True) shops
We will go back to our initial problem with the population figures. We will apply the same steps to those DataFrames:
pop_complete = pd.concat([population.T, male_pop.T, female_pop.T], keys=["total", "male", "female"]) df = pop_complete.swaplevel() df.sort_index(inplace=True) df[["Austria", "Australia", "France"]]
df.to_csv("data1/countries_total_population.csv")
Exercise
- Read in the dsv file (csv) bundeslaender.txt. Create a new file with the columns 'land', 'area', 'female', 'male', 'population' and 'density' (inhabitants per square kilometres.
- print out the rows where the area is greater than 30000 and the population is greater than 10000
- Print the rows where the density is greater than 300
lands = pd.read_csv('data1/bundeslaender.txt', sep=" ") print(lands.columns.values)
['land' 'area' 'male' 'female']
# swap the columns of our DataFrame: lands = lands.reindex(columns=['land', 'area', 'female', 'male']) lands[:2]
lands.insert(loc=len(lands.columns), column='population', value=lands['female'] + lands['male'])
lands[:3]
lands.insert(loc=len(lands.columns), column='density', value=(lands['population'] * 1000 / lands['area']).round(0)) lands[:4]
print(lands.loc[(lands.area>30000) & (lands.population>10000)])
land area female male population density 0 Baden-Württemberg 35751.65 5465 5271 10736 300.0 1 Bayern 70551.57 6366 6103 12469 177.0 9 Nordrhein-Westfalen 34085.29 9261 8797 18058 530.0
Reading and Writing Excel Files
It is also possible to read and write Microsoft Excel files. The Pandas functionalities to read and write Excel files use the modules 'xlrd' and 'openpyxl'. These modules are not automatically installed by Pandas, so you may have to install them manually!
We will use a simple Excel document to demonstrate the reading capabilities of Pandas. The document sales.xls contains two sheets, one called 'week1' and the other one 'week2'.
An Excel file can be read in with the Pandas function "read_excel". This is demonstrated in the following example Python code:
excel_file = pd.ExcelFile("data1/sales.xls") sheet = pd.read_excel(excel_file) sheet
The document "sales.xls" contains two sheets, but we only have been able to read in the first one with "read_excel". A complete Excel document, which can consist of an arbitrary number of sheets, can be completely read in like this:
docu = {} for sheet_name in excel_file.sheet_names: docu[sheet_name] = excel_file.parse(sheet_name) for sheet_name in docu: print("\n" + sheet_name + ":\n", docu[sheet_name])
week1: Weekday Sales 0 Monday 123432.980000 1 Tuesday 122198.650200 2 Wednesday 134418.515220 3 Thursday 131730.144916 4 Friday 128173.431003 week2: Weekday Sales 0 Monday 223277.980000 1 Tuesday 234441.879000 2 Wednesday 246163.972950 3 Thursday 241240.693491 4 Friday 230143.621590
We will calculate now the avarage sales numbers of the two weeks:
average = docu["week1"].copy() average["Sales"] = (docu["week1"]["Sales"] + docu["week2"]["Sales"]) / 2 print(average)
Weekday Sales 0 Monday 173355.480000 1 Tuesday 178320.264600 2 Wednesday 190291.244085 3 Thursday 186485.419203 4 Friday 179158.526297
We will save the DataFrame 'average' in a new document with 'week1' and 'week2' as additional sheets as well:
writer = pd.ExcelWriter('data1/sales_average.xlsx') document['week1'].to_excel(writer,'week1') document['week2'].to_excel(writer,'week2') average.to_excel(writer,'average') writer.save() writer.close()
Next Chapter: Dealing with NaN
|
https://python-course.eu/pandas_data_files.php
|
CC-MAIN-2020-29
|
refinedweb
| 1,592
| 69.99
|
API Reference¶
fyrd.queue¶
The core class in this file is the
Queue() class which does most of the queue
management. In addition,
get_cluster_environment() attempts to autodetect the
cluster type (torque, slurm, normal) and sets the global cluster type for
the whole file. Finally, the
wait() function accepts a list of jobs and will
block until those jobs are complete.
The Queue class relies on a few simple queue parsers defined by the
torque_queue_parser and
slurm_queue_parser functions. These call
qstat -x
or
squeue and
sacct to get job information, and yield a simple tuple of
that data with the following members:
job_id, name, userid, partition, state, node-list, node-count, cpu-per-node, exit-code
The Queue class then converts this information into a
Queue.QueueJob object and
adds it to the internal
jobs dictionary within the Queue class. This list is
now the basis for all of the other functionality encoded by the Queue class. It
can be accessed directly, or sliced by accessing the
completed,
queued, and
running attributes of the Queue class, these are used to simply divide up the
jobs dictionary to make finding information easy.
fyrd.queue.Queue¶
- class
fyrd.queue.
Queue(user=None, partition=None, qtype=None)[source]¶
A wrapper for all defined batch systems.
active_job_count
A count of all jobs that are either pending or running in the current queue
can_submit
True if total active jobs is less than max_jobs
job_states
A set of all current job states
wait_to_submit(max_jobs=None)[source]¶
Block until fewer running/pending jobs in queue than max_jobs.
Can filter by user, queue type or partition on initialization.
Methods¶
Queue.
wait(jobs, return_disp=False, notify=True)[source]
Block until all jobs in jobs are complete.
Update time is dependant upon the queue_update parameter in your ~/.fyrd/config.txt file.
Queue.
wait_to_submit(max_jobs=None)[source]
Block until fewer running/queued jobs in queue than max_jobs.
Queue.
test_job_in_queue(job_id, array_id=None)[source]¶
Check to make sure job is in self.
Tries 12 times with 1 second between each. If found returns True, else False.
fyrd.queue Jobs¶
Hold information about individual jobs,
QueueJob about primary jobs,
QueueChild about individual array jobs (which are stored in the
children
attribute of
QueueJob objects.
- class
fyrd.queue.
QueueJob[source]¶
A very simple class to store info about jobs in the queue.
Only used for torque and slurm queues.
Initialize.
- class
fyrd.queue.
QueueChild(parent)[source]¶
A very simple class to store info about child jobs in the queue.
Only used for torque and slurm queues.
Initialize with a parent.
fyrd.job¶
Job management is handled by the
Job() class. This is a very large class
that defines all the methods required to build and submit a job to the cluster.
It accepts keyword arguments defined in fyrd.options on initialization, which are then fleshed out using profile information from the config files defined by fyrd.conf.
The primary argument on initialization is the function or script to submit.
Examples:
Job('ls -lah | grep myfile') Job(print, ('hi',)) Job('echo hostname', profile='tiny') Job(huge_function, args=(1,2) kwargs={'hi': 'there'}, profile='long', cores=28, mem='200GB')
fyrd.job.Job¶
- class
fyrd.
Job(command, args=None, kwargs=None, name=None, qtype=None, profile=None, queue=None, **kwds)[source]¶
Information about a single job on the cluster.
Holds information about submit time, number of cores, the job script, and more.
Below are the core attributes and methods required to use this class, note that this is an incomplete list.
state¶
- A slurm-style one word description of the state of the job, one of:
- Not_Submitted
- queued
- running
- completed
- failed
kwds¶
Keyword arguments to the batch system (e.g. mem, cores, walltime), this is initialized by taking every additional keyword argument to the Job. e.g. Job(‘echo hi’, profile=large, walltime=‘00:20:00’, mem=‘2GB’) will result in kwds containing {walltime: ‘00:20:00’, mem: ‘2GB’}. There is no need to alter this manually.
submit_args¶
List of parsed submit arguments that will be passed at runtime to the submit function. Generated within the Job object, no need to set manually, use the kwds attribute instead.
submit(wait_on_max_queue=True)[source]¶
Submit the job if it is ready and the queue is sufficiently open.
get()[source]¶
Block until the job is done and then return the output (stdout if job is a script), by default saves all outputs to self (i.e. .out, .stdout, .stderr) and deletes all intermediate files before returning. If save argument is False, does not delete the output files by default.
Notes
Printing or reproducing the class will display detailed job information.
Both wait() and get() will update the queue every few seconds (defined by the queue_update item in the config) and add queue information to the job as they go.
If the job disappears from the queue with no information, it will be listed as ‘completed’.
All jobs have a .submission attribute, which is a Script object containing the submission script for the job and the file name, plus a ‘written’ bool that checks if the file exists.
In addition, some batch systems (e.g. SLURM) have an .exec_script attribute, which is a Script object containing the shell command to run. This difference is due to the fact that some SLURM systems execute multiple lines of the submission file at the same time.
Finally, if the job command is a function, this object will also contain a .function attribute, which contains the script to run the function.
Initialization function arguments.
Methods¶
Job.
clean(delete_outputs=None, get_outputs=True)[source]¶
Delete all scripts created by this module, if they were written.
Job.
submit(wait_on_max_queue=True, additional_keywords=None, max_jobs=None)[source]¶
Submit this job.
To disable max_queue_len, set it to 0. None will allow override by the default settings in the config file, and any positive integer will be interpretted to be the maximum queue length.
Job.
resubmit(wait_on_max_queue=True, cancel_running=None)[source]¶
Attempt to auto resubmit, deletes prior files.
Job.
get(save=True, cleanup=None, delete_outfiles=None, del_no_save=None, raise_on_error=True)[source]¶
Block until job completed and return output of script/function.
By default saves all outputs to this class and deletes all intermediate files.
Job.
get_output(save=True, delete_file=None, update=True, raise_on_error=True)[source]¶
Get output of function or script.
This is the same as stdout for a script, or the function output for a function.
By default, output file is kept unless delete_file is True or self.clean_files is True.
Job.
get_stdout(save=True, delete_file=None, update=True)[source]¶
Get stdout of function or script, same for both.
By default, output file is kept unless delete_file is True or self.clean_files is True.
Also sets self.start and self.end from the contents of STDOUT if possible.
Job.
get_stderr(save=True, delete_file=None, update=True)[source]¶
Get stderr of function or script, same for both.
By default, output file is kept unless delete_file is True or self.clean_files is True.
Job.
get_times(update=True, stdout=None)[source]¶
Get stdout of function or script, same for both.
Sets self.start and self.end from the contents of STDOUT if possible.
fyrd.submission_scripts¶
This module defines to classes that are used to build the actual jobs for submission,
including writing the files.
Function is actually a child class of
Script.
- class
fyrd.submission_scripts.
Script(file_name, script)[source]¶
A script string plus a file name.
Initialize the script and file name.
- class
fyrd.submission_scripts.
Function(file_name, function, args=None, kwargs=None, imports=None, syspaths=None, pickle_file=None, outfile=None)[source]¶
Bases:
fyrd.submission_scripts.Script
A special Script used to run a function.
Create a function wrapper.
NOTE: Function submission will fail if the parent file’s code is not wrapped in an if __main__ wrapper.
fyrd.batch_systems¶
All batch systems are defined here.
fyrd.batch_systems functions¶
fyrd.batch_systems.
get_cluster_environment(overwrite=False)[source]¶
Detect the local cluster environment and set MODE globally.
Detect the current batch system by looking for command line utilities. Order is important here, so we hard code the batch system lookups.
Paths to files can also be set in the config file.
fyrd.batch_systems.
check_queue(qtype=None)[source]¶
Check if both MODE and qtype are valid.
First checks the MODE global and autodetects its value, if that fails, no other tests are done, the qtype argument is ignored.
After MODE is found to be a reasonable value, the queried queue is tested for functionality. If qtype is defined, this queue is tested, else the queue in MODE is tested.
Tests are defined per batch system.
See also
get_cluster_environment()
- Auto detect the batch environment
get_batch_system()
- Return the batch system module
fyrd.batch_systems.options¶
All keyword arguments are defined in dictionaries in the
options.py file, alongside function to manage those dictionaries. Of
particular importance is
option_help(), which can display all of the keyword
arguments as a string or a table.
check_arguments() checks a dictionary to
make sure that the arguments are allowed (i.e. defined), it is called on all
keyword arguments in the package.
To see keywords, run
fyrd keywords from the console or
fyrd.option_help()
from a python session.
The way that option handling works in general, is that all hard-coded keyword
arguments must contain a dictionary entry for ‘torque’ and ‘slurm’, as well as a
type declaration. If the type is NoneType, then the option is assumed to be a
boolean option. If it has a type though,
check_argument() attempts to cast the
type and specific idiosyncrasies are handled in this step, e.g. memory is converted
into an integer of MB. Once the arguments are sanitized
format() is called on
the string held in either the ‘torque’ or the ‘slurm’ values, and the formatted
string is then used as an option. If the type is a list/tuple, the ‘sjoin’ and
‘tjoin’ dictionary keys must exist, and are used to handle joining.
The following two functions are used to manage this formatting step.
option_to_string() will take an option/value pair and return an appropriate
string that can be used in the current queue mode. If the option is not
implemented in the current mode, a debug message is printed to the console and
an empty string is returned.
options_to_string() is a wrapper around
option_to_string() and can handle a
whole dictionary of arguments, it explicitly handle arguments that cannot be
managed using a simple string format.
fyrd.batch_systems.options.
option_help(mode='string', qtype=None, tablefmt='simple')[source]¶
Print a sting to stdout displaying information on all options.
The possible run modes for this extension are:
fyrd.batch_systems.options.
sanitize_arguments(kwds)[source]¶
Run check_arguments, but return unmatched keywords as is.
fyrd.batch_systems.options.
split_keywords(kwargs)[source]¶
Split a dictionary of keyword arguments into two dictionaries.
The first dictionary will contain valid arguments for fyrd, the second will contain all others.
fyrd.batch_systems.options.
check_arguments(kwargs)[source]¶
Make sure all keywords are allowed.
Raises OptionsError on error, returns sanitized dictionary on success.
- Note: Checks in SYNONYMS if argument is not recognized, raises OptionsError
- if it is not found there either.
fyrd.batch_systems.options.
options_to_string(option_dict, qtype=None)[source]¶
Return a multi-line string for job submission.
This function pre-parses options and then passes them to the parse_strange_options function of each batch system, before using the option_to_string function to parse the remaining options.
fyrd.conf¶
fyrd.conf handles the config (
~/.fyrd/config.txt) file and the profiles
(
~/.fyrd/profiles.txt) file.
Profiles are combinations of keyword arguments
that can be called in any of the submission functions. Both the config and profiles
are just ConfigParser
objects,
conf.py merely adds an abstraction layer on top of this to maintain
the integrity of the files.
config¶
The config has three sections (and no defaults):
- queue — sets options for handling the queue
- jobs — sets options for submitting jobs
- jobqueue — local option handling, will be removed in the future
For a complete reference, see the config documentation : Configuration
Options can be managed with the
get_option() and
set_option() functions, but
it is actually easier to use the console script:
fyrd conf list fyrd conf edit max_jobs 3000
fyrd.conf.
get_option(section=None, key=None, default=None)[source]¶
Get a single key or section.
All args are optional, if they are missing, the parent section or entire config will be returned.
See also
set_option()
- Set an option
get_config()
- Get the entire config
fyrd.conf.
load_config()[source]¶
Load config from the config file.
If any section or key from DEFAULTS is not present in the config, it is added back, enforcing a minimal configuration.
fyrd.conf.
create_config(cnf=None, def_queue=None)[source]¶
Create an initial config file.
Gets all information from the file-wide DEFAULTS constant and overwrites specific keys using the values in cnf.
This means that any records in the cnf dict that are not present in DEFAULTS will be ignored, and any records that are absent will be populated from DEFAULTS.
profiles¶
Profiles are wrapped in a
Profile() class to make attribute access easy, but
they are fundamentally just dictionaries of keyword arguments. They can be
created with
cluster.conf.Profile(name, {keywds}) and then written to a file
with the
write() method.
The easiest way to interact with profiles is not with class but with the
get_profile(),
set_profile(), and
del_profile() functions. These make it
very easy to go from a dictionary of keywords to a profile.
Profiles can then be called with the
profile= keyword in any submission
function or Job class.
As with the config, profile management is the easiest and most stable when using the console script:
fyrd profile list fyrd profile add very_long walltime:120:00:00 fyrd profile edit default partition:normal cores:4 mem:10GB fyrd profile delete small
fyrd.conf.Profile¶
- class
fyrd.conf.
Profile(name, kwds)[source]¶
A job submission profile. Just a thin wrapper around a dict.
write : Write self to config file
Set up bare minimum attributes.
fyrd.helpers¶
The helpers are all high level functions that are not required for the library but make difficult jobs easy to assist in the goal of trivially easy cluster submission.
The functions in fyrd.basic below are different in that they
provide simple job submission and management, while the functions in
fyrd.helpers allow the submission of many jobs.
fyrd.helpers.
jobify(name=None, profile=None, qtype=None, submit=True, **kwds)[source]¶
Decorator to make any function a job.
Will make any function return a Job object that will execute the function on the cluster.
If submit is True, the job will be submitted when it is returned.
Usage:
@fyrd.jobify(name='my_job', profile='small', mem='8GB', time='00:10:00', imports=['from time import sleep']) def do_something(file_path, iteration_count=24): for i in range(iteration_count): print(file_path + i) sleep(1) return file_path job = do_something('my_file.txt') out = job.get()
Examples
>>> import fyrd >>> @fyrd.jobify(name='test_job', mem='1GB') ... def test(string, iterations=4): ... """This does basically nothing!""" ... outstring = "" ... for i in range(iterations): ... outstring += "Version {0}: {1}".format(i, string) ... return outstring >>> j = test('hi') >>> j.get() 'Version 0: hiVersion 1: hiVersion 2: hiVersion 3: hiVersion 4: hi'
fyrd.helpers.
parapply(jobs, df, func, args=(), profile=None, applymap=False, merge_axis=0, merge_apply=False, name='parapply', imports=None, direct=True, **kwds)[source]¶
Split a dataframe, run apply in parallel, return result.
This function will split a dataframe into however many pieces are requested with the jobs argument, run apply in parallel by submitting the jobs to the cluster, and then recombine the outputs.
If the ‘clean_files’ and ‘clean_outputs’ arguments are not passed, we delete all intermediate files and output files by default.
This function will take any keyword arguments accepted by Job, which can be found by running fyrd.options.option_help(). It also accepts any of the keywords accepted by by pandas.DataFrame.apply(), found here
Example
>>> import numpy >>> import pandas >>> import fyrd >>> df = pandas.DataFrame([[0, 1], [2, 6], [9, 24], [13, 76], [4, 12]]) >>> df['sum'] = fyrd.helpers.parapply(2, df, lambda x: x[0]+x[1], axis=1) >>> df 0 1 sum 0 0 1 1 1 2 6 8 2 9 24 33 3 13 76 89 4 4 12 16
See also
parapply_summary()
- Merge results of parapply using applied function
splitrun()
- Run a command in parallel on a split file
fyrd.helpers.
parapply_summary(jobs, df, func, args=(), profile=None, applymap=False, name='parapply', imports=None, direct=True, **kwds)[source]¶
Run parapply for a function with summary stats.
Instead of returning the concatenated result, merge the result using the same function as was used during apply.
This works best for summary functions like .mean(), which do a linear operation on a whole dataframe or series.
Example
>>> import numpy >>> import pandas >>> import fyrd >>> df = pandas.DataFrame([[0, 1], [2, 6], [9, 24], [13, 76], [4, 12]]) >>> df = fyrd.helpers.parapply_summary(2, df, numpy.mean) >>> df 0 6.083333 1 27.166667 dtype: float64
See also
parapply()
- Run a command in parallel on a DataFrame without merging the
result()
fyrd.helpers.
splitrun(jobs, infile, inheader, command, args=None, kwargs=None, name=None, qtype=None, profile=None, outfile=None, outheader=False, merge_func=None, direct=True, **kwds)[source]¶
Split a file, run command in parallel, return result.
This function will split a file into however many pieces are requested with the jobs argument, and run command on each.
Accepts exactly the same arguments as the Job class, with the exception of the first three and last four arguments, which are:
- the number of jobs
- the file to work on
- whether the input file has a header
- an optional output file
- whether the output file has a header
- an optional function to use to merge the resulting list, only used if there is no outfile.
- whether to run directly or to return a Job. If direct is True, this function will just run and thus block until complete, if direct is False, the function will submit as a Job and return that Job.
Note: If command is a string, .format(file={file}) will be called on it, where file is each split file. If command is a function, the there must be an argument in either args or kwargs that contains {file}. It will be replaced with the path to the file, again by the format command.
If outfile is specified, there must also be an ‘{outfile}’ line in any script or an ‘{outfile}’ argument in either args or kwargs. When this function completes, the file at outfile will contain the concatenated output files of all of the jobs.
If the ‘clean_files’ and ‘clean_outputs’ arguments are not passed, we delete all intermediate files and output files by default.
The intermediate files will be stored in the ‘scriptpath’ directory.
Any header line is kept at the top of the file.
Primary return value varies and is decided in this order:
- If outfile:
- the absolute path to that file
- If merge_func:
- the result of merge_func(list), where list is the list of outputs.
- Else:
- a list of results
If direct is False, this function returns a fyrd.job.Job object which will return the results described above on get().
fyrd.basic¶
This module holds high level functions to make job submission easy, allowing the user
to skip multiple steps and to avoid using the
Job class directly.
submit(),
make_job(), and
make_job_file() all create
Job objects in the
background and allow users to submit jobs. All of these functions accept the exact
same arguments as the
Job class does, and all of them return a
Job object.
submit_file() is different, it simply submits a pre-formed job file, either one that
has been written by this software or by any other method. The function makes no attempt
to fix arguments to allow submission on multiple clusters, it just submits the file.
clean() takes a list of job objects and runs the
clean() method on all of them,
clean_dir() uses known directory and suffix information to clean out all job files
from any directory.
fyrd.basic.
submit_file()[source]¶
Submit an existing job file to the cluster.
This function is independent of the Job object and just submits a file using a cluster appropriate method.
fyrd.basic.
clean_dir()[source]¶
Delete all files made by this module in directory.
- CAUTION: The clean() function will delete EVERY file with
- extensions matching those these::
- .<suffix>.err .<suffix>.out .<suffix>.out.func.pickle .<suffix>.sbatch & .<suffix>.script for slurm mode .<suffix>.qsub for torque mode .<suffix>.job for local mode _func.<suffix>.py _func.<suffix>.py.pickle.in _func.<suffix>.py.pickle.out
Note
This function will change in the future to use batch system defined paths.
fyrd.run¶
A library of useful functions used throughout the fyrd package.
These include functions to handle data, format outputs, handle file opening, run commands, check file extensions, get user input, and search and format imports.
These functions are not intended to be accessed directly and so documentation is limited.
- class
fyrd.run.
CustomFormatter(prog, indent_increment=2, max_help_position=24, width=None)[source]¶
Bases:
argparse.ArgumentDefaultsHelpFormatter,
argparse.RawDescriptionHelpFormatter
Custom argparse formatting.
fyrd.run.
cmd(command, args=None, stdout=None, stderr=None, tries=1)[source]¶
Run command and return status, output, stderr.
fyrd.run.
cmd_or_file(string)[source]¶
If string is a file, return the contents, else return the string.
fyrd.run.
count_lines(infile, force_blocks=False)[source]¶
Return the line count of a file as quickly as possible.
Uses wc if avaialable, otherwise does a rapid read.
fyrd.run.
export_imports(function, kwds)[source]¶
Get imports from a function and from kwds.
Also sets globals and adds path to module to sys path.
fyrd.run.
export_run(function, args, kwargs)[source]¶
Execute a function after first exporting all imports.
fyrd.run.
file_getter(file_strings, variables, extra_vars=None, max_count=None)[source]¶
Get a list of files and variable values using the search string.
The file strings can contain standard unix glob (like *) and variable containing strings in the form {name}.
For example, a file_string of {dir}/*.txt will match every file that ends in .txt in every directory relative to the current path.
The result for a directory name test with two files named 1.txt and 2.txt is a list of:
[(('dir/1.txt'), {'dir': 'test'}), (('dir/2.txt'), {'dir': 'test'})]
This is repeated for every file_string in file_strings, and the following tests are done:
- All file_strings must result in identical numbers of files
- All variables must have only a single value in every file string
If there are multiple file_strings, they are added to the result x in order, but the dictionary remains the same as variables must be shared. If multiple file_strings are provided the results are combined by alphabetical order.
fyrd.run.
get_all_imports(function, kwds, prot=False)[source]¶
Get all imports from a function and from kwds.
fyrd.run.
get_function_path(function)[source]¶
Return path to module defining a function if it exists.
fyrd.run.
get_imports(function, mode='string')[source]¶
Build a list of potentially useful imports from a function handle.
Gets:
- All modules from globals()
- All modules from the function’s globals()
- All functions from the function’s globals()
Modes:
- string:
- Return a list of strings formatted as unprotected import calls
- prot:
- Similar to string, but with try..except blocks
- list:
- Return two lists: (import name, module name) for modules and (import name, function name, module name) for functions
fyrd.run.
get_input(message, valid_answers=None, default=None)[source]¶
Get input from the command line and check answers.
Allows input to work with python 2/3
fyrd.run.
get_pbar(iterable, name=None, unit=None, **kwargs)[source]¶
Return a tqdm progress bar iterable.
If progressbar is set to False in the config, will not be shown.
fyrd.run.
import_function(function, mode='string')[source]¶
Return an import string for the function.
Attempts to resolve the parent module also, if the parent module is a file, ie it isn’t __main__, the import string will include a call to sys.path.append to ensure the module is importable.
If this function isn’t defined by a module, returns an empty string.
fyrd.run.
normalize_imports(imports, prot=True)[source]¶
Take a heterogenous list of imports and normalize it.
fyrd.run.
open_zipped(infile, mode='r')[source]¶
Open a regular, gzipped, or bz2 file.
If infile is a file handle or text device, it is returned without changes.
fyrd.run.
opt_split(opt, split_on)[source]¶
Split options by chars in split_on, merge all into single list.
fyrd.run.
parse_glob(string, get_vars=None)[source]¶
Return a list of files that match a simple regex glob.
fyrd.run.
replace_argument(args, find_string, replace_string, error=True)[source]¶
Replace find_string with replace string in a tuple or dict.
If dict, the values are replaced, not the keys.
Note: args can also be a list, in which case the first item is assumed to be a tuple, and the second a dictionary
fyrd.run.
split_file(infile, parts, outpath='', keep_header=False)[source]¶
Split a file in parts and return a list of paths.
Note
Linux specific (uses wc).
If has_header is True, the top line is stripped off the infile prior to splitting and assumed to be the header.
fyrd.run.
syspath_fmt(syspaths)[source]¶
Take a list of paths and return a sys of sys.path.append strings.
fyrd.run.
which(program)[source]¶
Replicate the UNIX which command.
- Taken verbatim from:
- stackoverflow.com/questions/377017/test-if-executable-exists-in-python
fyrd.logme¶
This is a package I wrote myself and keep using because I like it. It provides syslog style leveled logging (e.g. ‘debug’->’info’->’warn’->’error’->’critical’) and it implements colors and timestamped messages.
The minimum print level can be set module wide at runtime by changing
cluster.logme.MIN_LEVEL.
fyrd.logme.
log(message, level='info', logfile=None, also_write=None, min_level=None, kind=None)[source]¶
Print a string to logfile.
Levels display as:
verbose: <timestamp> VERBOSE --> debug: <timestamp> DEBUG --> info: <timestamp> INFO --> warn: <timestamp> WARNING --> error: <timestamp> ERROR --> critical: <timestamp> CRITICAL -->
Logging with timestamps and optional log files.
Print a timestamped message to a logfile, STDERR, or STDOUT.
If STDERR or STDOUT are used, colored flags are added. Colored flags are INFO, WARNINING, ERROR, or CRITICAL.
It is possible to write to both logfile and STDOUT/STDERR using the also_write argument.
If level is ‘error’ or ‘critical’, error is written to STDERR unless also_write == -1
MIN_LEVEL can also be provided, logs will only print if vlevel > MIN_LEVEL. Level order: critical>error>warn>info>debug>verbose
Usage:
import logme as lm lm.log("Screw up!", <outfile>, level='debug'|'info'|'warn'|'error'|'normal', also_write='stderr'|'stdout')
Example:
lm.log('Hi') Prints: 20160223 11:46:24.969 | INFO --> Hi lm.log('Hi', level='debug') Prints nothing lm.MIN_LEVEL = 'debug' lm.log('Hi', level='debug') Prints: 20160223 11:46:24.969 | DEBUG --> Hi
Note: Uses terminal colors and STDERR, not compatible with non-unix systems
fyrd.logme.
log(message, level='info', logfile=None, also_write=None, min_level=None, kind=None)[source]
Print a string to logfile.
Levels display as:
verbose: <timestamp> VERBOSE --> debug: <timestamp> DEBUG --> info: <timestamp> INFO --> warn: <timestamp> WARNING --> error: <timestamp> ERROR --> critical: <timestamp> CRITICAL -->
|
https://fyrd.readthedocs.io/en/latest/api.html
|
CC-MAIN-2019-09
|
refinedweb
| 4,500
| 57.47
|
A TShape is a topological structure describing a set of points in a 2D or 3D space. More...
#include <TopoDS_TShape.hxx>
A TShape is a topological structure describing a set of points in a 2D or 3D space.
A topological shape is a structure made from other shapes. This is a deferred class used to support topological objects.
TShapes are defined by their optional domain (geometry) and their components (other TShapes with Locations and Orientations). The components are stored in a List of Shapes.
A TShape contains the following boolean flags :
Users have no direct access to the classes derived from TShape. They handle them with the classes derived from Shape.
Constructs an empty TShape. Free : True Modified : True Checked : False Orientable : True Closed : False Infinite : False Convex : False.
Returns the checked flag.
Sets the checked flag.
Returns the closedness flag.
Sets the closedness flag.
Returns the convexness flag.
Sets the convexness flag.
Dumps the content of me into the stream.
Reimplemented in BRep_TVertex, BRep_TFace, and BRep_TEdge.
Returns a copy of the TShape with no sub-shapes.
Implemented in TopoDS_TWire, TopoDS_TSolid, TopoDS_TShell, TopoDS_TFace, TopoDS_TCompSolid, TopoDS_TCompound, BRep_TVertex, BRep_TFace, and BRep_TEdge.
Returns the free flag.
Sets the free flag.
Returns the infinity flag.
Sets the infinity flag.
Returns the locked flag.
Sets the locked flag.
Returns the modification flag.
Sets the modification flag.
Returns the number of direct sub-shapes (children).
Returns the orientability flag.
Sets the orientability flag.
Returns the type as a term of the ShapeEnum enum : VERTEX, EDGE, WIRE, FACE, ....
Implemented in TopoDS_TWire, TopoDS_TVertex, TopoDS_TSolid, TopoDS_TShell, TopoDS_TFace, TopoDS_TEdge, TopoDS_TCompSolid, and TopoDS_TCompound.
|
https://dev.opencascade.org/doc/occt-7.6.0/refman/html/class_topo_d_s___t_shape.html
|
CC-MAIN-2022-27
|
refinedweb
| 262
| 63.56
|
hey all I am a beginner to programming with no prior knowledge whatsoever. I recently got myself ythe hello world book on programming and got to the guessing game problem is everytime I run it i get the high and low answer like your supposed to get but It gives away the answer before 6 turns is up. Just curious if i missed anything. anyway here's the code:
import random
secret = random.randint (1, 99)
guess = 0
tries = 0
print "Ahoy! I'm the Dreaded Pirate Roberts, and I have a secret!"
print "It is a number from 1 to 99. I'll give you 6 tries."
while guess != secret and tries < 6:
guess = int(input("what's yer guess?"))
if guess < secret:
print "Too low, ye scurvy dog!"
elif guess > secret:
print "Too high, landlubber!"
tries = tries + 1
if guess == secret:
print "Avast! Ye got it! Found my secret, ye did!"
else:
print "No more guesses! Better luck next time!"
print "The secret was", secret
any help would be greatly appreciated
|
http://forums.devshed.com/python-programming/937946-python-guessing-game-last-post.html
|
CC-MAIN-2017-26
|
refinedweb
| 173
| 86.91
|
here is gcc -v:
Reading specs from /exp/opt/gcc3/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/specs
Configured with: ../gcc-3.3.3/configure --prefix=/exp/opt/gcc3
Thread model: posix
gcc version 3.3.3
here is the source code big.cc:
#include <cstdio>
int main() {
#ifdef SINGLE
long long a = 8000000000000000000ll, b = a + 1;
#else
long long p = 2000000ll, a = p * p * p, b = a + 1;
#endif
double x = a, y = b;
#ifdef PRINT
printf("%lld %lld\n", a, b);
#endif
printf("%s %s\n", a == b ? "yes" : "no", x == y ? "yes" : "no");
}
note:
a and b are 8 byte long long differ by 1 with magnitude of 63 bits. x and y are
8 byte double with only 53 bits resolution. When x and y are assigned the value
of a and b, they should have same value, and the last line should print no yes.
If I compile with (gcc -Wall -O big.cc), the program prints (unexpected) no no.
If I compile with (gcc -Wall big.cc) or (gcc -Wall -O -DSINGLE big.cc) or (gcc
-Wall -O -DPRINT big.cc), I get the expected "no yes". I am puzzled by the fact
that -DSINGLE or -DPRINT made a difference.
on solaris, it works as expected, everything prints no yes.
here is gcc -v:
Reading specs from
/net/mars/exp/opt/gcc/lib/gcc-lib/sparc-sun-solaris2.8/3.3.3/specs
Configured with: ../gcc-3.3.3/configure --prefix=/net/mars/exp/opt/gcc
Thread model: posix
gcc version 3.3.3
This is a dup of bug 323, read that bug and see why it is considered a non-bug.
*** This bug has been marked as a duplicate of 323 ***
*** This bug has been marked as a duplicate of 323 ***
|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14989
|
CC-MAIN-2018-43
|
refinedweb
| 302
| 77.13
|
Douglas Russell wrote:
> I've got some XML with namespaces and I just can't find a way to set the
> namespace in my query.
<snip>
> The XPATH '/' gets all the XML in Definition, that works. If I try and search
> for '//Name' however, I get nothing. Presumably this is because Name is
> actually in a namespace. How do I construct my XPATH to look for this?
I think that in order to get this to work you have to query for "Name" as the
*local* name, i.e. search for elements named "Name" in any namespace. One way
to do this is with an XPath expression like:
//child::*[local-name()="Name"]
which should (I think?) return all Name elements. If you want to restrict the
Name elements to a specific namespace, then you could do something like:
//child::*[local-name()="Name" and
namespace::*[string()=""]]
I realize this is pretty (very) ugly, but I can't think of any better way at the
moment. It is of course very possible that there *is* a better way and I just
don't know about it...
> I've tried:
> '//myns:Name' and that would seem to be correct, but I can find no way of
> setting myns to resolve to "" in
> Derby. When I do that I just get the error:
>
> Caused by: org.apache.derby.client.am.SqlException: Encountered error while
> evaluating XML query expression for XMLQUERY operator: Prefix must resolve to
> a namespace: myns SQLSTATE: XJ001: Java exception: 'Prefix must resolve to a
> namespace: myns: org.apache.xpath.domapi.XPathStylesheetDOM3Exception'.
This error comes from the underlying Xalan engine, so perhaps you can find a way
around this by searching Xalan documentation and/or help files? If it is
possible to set namespaces within an XPath query in Xalan, then hopefully it is
documented somewhere. And if it is, then feeding that into Derby as part of the
query should (hopefully) return the desired results, since Derby ultimately just
passes the query on to Xalan for evaluation...
Army
|
http://mail-archives.apache.org/mod_mbox/db-derby-user/200706.mbox/%3C467A9AB2.6040802@gmail.com%3E
|
CC-MAIN-2016-30
|
refinedweb
| 337
| 61.26
|
Code. Collaborate. Organize.
No Limits. Try it Today.
This is another article about reducing flicker in the ListView. The original article I wrote only works in Windows XP (with manifest file to use Common Controls version 6). You can view it by clicking on this link ListViewXP
This article will focus on two other techniques. Neither of which require Windows XP. Please note that the focus of this article is to dynamically add multiple items with a well-sized image-list without flicker.
The first technique involves catching and manipulating messages. As I mentioned in my previous article, every time you add an item to the ListView, the entire control becomes invalidated. When adding multiple items in a loop, the control only paints when the loop ends unless you add Update() or Refresh() (or other various methods) to the end of the loop. Using Update(), Refresh() etc, will cause flickering because the control is constantly invalidated and repainting itself. One way to observe this is to override the WndProc method, and store all messages inside an ArrayList, or another structure. Then when you view the ArrayList, you will see the numbers corresponding to WM_ERASEBKGND and WM_PAINT. We can use this knowledge to help us.
ListView
Update()
Refresh()
Update(), Refresh()
WndProc
ArrayList
WM_ERASEBKGND
WM_PAINT
Part of our design of this new class is to allow the programmer to specify that he/she is adding a new item. We create a new method called UpdateItem(int iIndex). The programmer can call this, and it will draw the newly created item only.
UpdateItem(int iIndex)
public void UpdateItem(int iIndex)
{
updating = true;
itemnumber = iIndex;
this.Update();
updating = false;
}
First we have a bool private member variable called updating. This will be used in the WndProc method below. When it is set to true, the WndProc method will catch messages. When false, WndProc does nothing except to call base.WndProc(). itemnumber is another newly added private member. It holds the index of the newly added item. Update() is used to redraw invalidated regions of the control (which we play with in WndProc), and finally it sets updating to be false so that messages are no longer being caught by our code. Now we override WndProc in order to make our adjustments.
bool
false
base.WndProc()
itemnumber
Update()
protected override void WndProc(ref Message messg)
{
if (updating)
{
// We do not want to erase the background,
// turn this message into a null-message
if ((int)WM.WM_ERASEBKGND == messg.Msg)
messg.Msg = (int) WM.WM_NULL;
else if ((int)WM.WM_PAINT == messg.Msg)
{
RECT vrect = this.GetWindowRECT();
// validate the entire window
ValidateRect(this.Handle, ref vrect);
//Invalidate only the new item
Invalidate(this.Items[itemnumber].Bounds);
}
}
base.WndProc(ref messg);
}
As you can see, we capture the WM_ERASEBKGND message, and we convert it to a NULL message. This will stop the ListView from being erased. WM_PAINT is used to redraw an invalidated area. Since the entire control is invalidated, we need to do a little work. First we Validate the entire viewable area. Doing this will cause WM_PAINT to do nothing, so we follow up by invalidating only the bounds of the new item. Now when painting occurs, it will only occur for the new item because the rest of the control has been validated.
NULL
WM_ERASEBKGND, and WM_PAINT are enum'd types representing the int values of the Window messages. You can view these in the code. ValidateRect is a Win32 function that allows us to validate a certain region. Since there is no equivalent in .NET, we import this from user32.dll (see code). RECT is a structure similar to Rectangle, but is needed for the ValidateRect function. When we call ValidateRect, it validates the entire window area of the ListView. We then follow by using the control's Invalidate method to invalidate the bounds of the new item. Now only the new item's bounds are invalidated. This means that only the new item will be painted. Since we captured WM_ERASEBKGND and validated the rest of the control, each item will be drawn as it is added (provided that you use the newly added UpdateItem(index) function). If you don't use UpdateItem(), WndProc will do nothing because "updating" variable will always be false.
int
ValidateRect
RECT
Rectangle
UpdateItem(index)
UpdateItem()
NOTE - I'd like to give credit to Carlos H Perez. He does something similar in his ListViewEx control, and part of this idea is based on that work.
ListViewEx
Now we can do this (in our main application)
for (int i=0; i < 500; i++)
{
ListViewItem lvi =
new ListViewItem("Item #" + i.ToString(), indexOfImage);
listViewFF.Items.Add(lvi);
listViewFF.UpdateItem(i);
}
Now the items will be painted as they are added to the list view without flicker.
This next technique is pure .NET and you do not need to extend the ListView class. This technique does not draw the items as they are being added, but describes an alternative way to stop the user from waiting for a long time.
If we do not associate an ImageIndex with a listView item (use -1 as ImageIndex), we can add items to the ListView pretty quickly:
ImageIndex
for (int i=0; i < 500; i++)
{
ListViewItem lvi =
new ListViewItem("Item #" + i.ToString(), -1);
this.listView.Items.Add(lvi);
}
Since we are not calling Update() or Refresh(), we will not see the items as they are being added, but this will be done pretty fast since no images are associated with the ListView.
Refresh()
Now all of the items will be added, so we need to associate an Image with them.
for (int i=0; i < 500; i++)
{
ListViewItem lvi = this.listView.Items[i] ;
// get the already existing item
lvi.ImageIndex = someNumber ;
// Now we associate the item with an image in the imagelist;
this.listView.Invalidate(lvi.Bounds);
// Invalidate the already-existing item
this.Update();
// Will force the invalidated region to be redrawn
}
Before this loop begins, all items will be there without an image. Now we simply associate the image, and invalidate the region of the item. Calling Update() will only redraw the invalidated region. In this case, only the bounds of the item will be invalidated, so the image will be drawn to the screen without affecting the other ListView items.
Update()
This is good for a thumbnail program. You can add the names of the thumbnails in the first loop, and in the second loop, you can load the bitmaps into the imagelist, associate the already created item with the image index of the newly added image, and now each image will be painted as it's being loaded. What makes it even better is that you can throw this second loop inside of a thread. This will allow the user to scroll the listview while images are being painted.
You should use each technique depending on what you need. The WndProc technique allows you to see items as they are being added. If you are adding thousands of items, it may be slower overall, but at least the user can see what's going on. The pure .NET technique will cause the listview to be blank for a few seconds if you try to add (let's say) 5000 items in the first loop, but if the second loop is in a thread, you do not stop the user from doing other things while the images are being drawn.
One thing to note about the WndProc technique. For some reason, it doesn't work very well if you have a manifest file to use the new XP Themes. I'm not sure why, but some items get erased while others are being drawn. I did find a fix for this (and it is used in source code). Before the loop begins set AutoArrange = false for the listview. When the loop ends, you can set it back to true. Of Course, if you're using Windows XP only, you can use the double buffering technique I described in my previous article (See Intro for link to that). If you have no plans to support XP themes, you do not need to mess with the AutoArrange property.
AutoArrange = false
true
AutoArrange
You will need MS Visual Studio .NET to view this project. After unzipping all the files, there will be two directories, ListViewX and TestListViewFF. Open the solution file in ListViewX folder, and after it loads, set the TestListViewFF project to be the startup project. Then when you compile it should be fine.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
public class ListView2 : ListView
{
bool updating;
protected override void WndProc(ref Message m)
{
if(!updating || m.Msg != 0x14) //WM_ERASEBKGND
base.WndProc(ref m);
}
public void BeginUpdateItems()
{
updating = true;
}
public void EndUpdateItems()
{
updating = false;
}
}
class CustomListView : ListView
{
public CustomListView()
: base()
{
this.DoubleBuffered = true;
}
}
rshearer wrote:But, if you are updating the listview every second with 25-30 items, you indeed will see a flickering of the listview as it is updated. Even with Begin/End Update.
rshearer wrote:I have a solution (the solution here didn't meet my needs unfort) that removes ALL flickering. I use it in a application with taskmanager functionality -- which has about 15 columns and 50+ rows of data. My listview even has no flickering with column sorting (cpu usage column will cause many rows to change over and over). And Being/End update didn't cut it.
R.Bischoff | C++
.NET, Kommst du mit?
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
C# 6: First reactions
|
http://www.codeproject.com/Articles/3617/Flicker-free-ListView-in-NET-Part-2
|
CC-MAIN-2014-15
|
refinedweb
| 1,645
| 73.68
|
Before.
One of the nicest features of the Visual Basic Upgrade Companion version 2.0 is the support for Migration Profiles. These profiles give you control over which translations to use for a particular migration, improving the quality of the generated code and applying only the conversions desired (for example, for specific third party components). Profiles are managed through the Profile Maintenance screen, as shown here:
If look at the screen in some detail, you will see some of the features included with the tool. Here you can select, for example, to convert the MAPI (Mail API) library to the Microsoft.Office.Interop.Outlook component. And it shows that this particular conversion has a coverage of 80%. This particular library shows why Migration Profiles are important. If the application you are migrating is an end-user application that is locally installed in the user's desktop inside your enterprise, and MS Outlook is part of your standard installation on these desktops, then it should save you quite a bit of work to let the VBUC perform this transformation. If, however, it is a server-side application where MS Office is very rarely installed, then having this option selected will only cause you additional work later on, as you will have to go through the code and remove the references.
Other good examples are the ADODB and ADOCOMMON plug-ins. Both of them convert code that uses ADO into ADO.NET. How they do it, however, is completely different. The first plug-in, ADODB, converts ADO into ADO.NET using the SqlClient libraries, so it only works with SQL Server. The ADOCOMMON plug-in, however, generates code that uses the interfaces introduced with version 2.0 of the .NET Framework in the System.Data.Common namespace. This allows the application to connect to any database using an ADO.NET data provider that complies with this interfaces - most major database vendors now have providers that meet that specification. So you can use either transformation depending on your target database!
The previous two examples illustrate the importance of Migration Profiles. As you can see in the screenshot above, the tool currently has a large amount of plug-in with specific transformations. This number is expected to grow over time. I will be covering some of these plug-ins in later posts. Stay tuned!
I was expecting the annoucement near the end of the week, but here it is - The Visual Basic Upgrade Companion version 2.0 was released today! Just in time to attend that other tool's funeral ;)
I am still waiting for the official press release, but at least the press here in Costa Rica is already talking about it (link in spanish). So you know, the VBUC2.0 is a considerable improvement over previous versions of the Companion. Some of the most interesting new features are:
As you probably know, eye candy sells. And it makes your life easier, too. So the VBUC2.0 includes a new Graphical User Interface called the Upgrade Manager, that incorporates all the features and concepts described above into one easy to use environment:
If you have been thinking about upgrading your VB6 applications to the .NET framework, think no more. With this new version of the VBUC you will be able to have your .NET application up and running in no time!
I may be a little late to the obituary, but VB6 support is finally, officially, irrefutably gone. The IDE, as stated in Microsoft's Product Life-Cycle guidelines, "... will no longer be supported starting March 2008". Even though VB6 (or Basic for that matter) didn't enjoy the best reputation as a programming language (best illustrated by the famous Edsger W. Dijkstra quote), you can't deny the huge influence it's had over the past 15 years. The easy-to-use paradigm followed by VB IDEs lent itself to be used by both amateur programmers, that caused many headaches during the years, and professional developers that were really able to harness the power and ease of use to create impressively robust solutions that are still running to this day.
So if you are thinking of moving away form VB6, obviously I'm going to steer you in the direction of the Visual Basic Upgrade Companion. There is, however, another reason for this as well... pretty soon we are going to release a completely updated version 2.0 of the tool, which has some very interesting new features and does an incredible job of converting your VB6 code into the .NET language. Watch this space, as I will be writing about this new version soon!!. :)
This tip isn't really migration-related, but I've used it so many times these past few days that I think it is worth sharing. We work with virtual machines A LOT, using Virtual Server 2005 R2 SP1. Every once in a while you need to log into a server using Terminal Services to delete old VHDs to make room for a new one, opr just for any other miscelaneous task that can't be done through the web administration client. And, unfortunately, sometimes there are two terminal services sessions open already, so you get the following error:
"Terminal server has exceeded maximum number of allowed connection"
"Terminal server has exceeded maximum number of allowed connection"
You then stare at your monitor in frustration for a few seconds. After that, you figure out who the culprit is and ask him politely to "PLEASE LOG OFF".
Well, after discovering this tip, there is no longer a need to stare at your monitor or to ruin your relationship with your coworkers. Turns out there are a couple of command line tools you can use to close remote Terminal Services sessions. They are available in both Windows XP and 2003. The first one, qwinsta, lists all the open sessions on a particular server:
c:\>qwinsta /server:192.168.123.123 SESSIONNAME USERNAME ID STATE TYPE DEVICE console 0 Conn wdcon rdp-tcp 65536 Listen rdpwd jpena 1 Disc rdpwd administrator 3 Disc rdpwd
c:\>qwinsta /server:192.168.123.123 SESSIONNAME USERNAME ID STATE TYPE DEVICE console 0 Conn wdcon rdp-tcp 65536 Listen rdpwd jpena 1 Disc rdpwd
In this case, you can see that Juan Peña (user jpena) has an open session in the disconnected state. In order to close his session, you need to use the second tool, rwinsta:
rwinsta /server:12.12.12.12 3
rwinsta /server:12.12.12.12 3
This command will kill the session with ID 3 (jpena's). And voilà! After this, I'm able to connect to the server. :-)
Credit goes to Scott Forsyth's WebLog..
|
http://blogs.artinsoft.net/jose_aguilar_blog/default.aspx/?page=6
|
CC-MAIN-2015-18
|
refinedweb
| 1,117
| 62.88
|
DefaultThreshold</code> instance requests to unset the28 * default threshold value of a given server.29 */30 public class UnsetDefaultThreshold extends AdminRequest {31 private static final long serialVersionUID = -208749696977909718L;32 33 /** Identifier of the server which threshold is unset. */34 private int serverId;35 36 /**37 * Constructs a <code>UnsetDefaultThreshold</code> instance.38 *39 * @param serverId Identifier of the server which threshold is unset.40 */41 public UnsetDefaultThreshold(int serverId) {42 this.serverId = serverId;43 }44 45 46 /** Returns the identifier of the server which threshold is unset. */47 public int getServerId() {48 return serverId;49 }50 }51
Java API By Example, From Geeks To Geeks. | Our Blog | Conditions of Use | About Us_ |
|
http://kickjava.com/src/org/objectweb/joram/shared/admin/UnsetDefaultThreshold.java.htm
|
CC-MAIN-2018-05
|
refinedweb
| 112
| 50.33
|
TDD is often mentioned for its benefits in code quality such as following DRY, YAGNI or other clean code standards. Today I want to talk about one overlooked benefit that has helped me countless times.
Working in an open office has a few benefits but many downsides as engineers. Tips such as pair programming or listening to music help a little but even then there are always distractions. In addition to distractions, there are always times in your workday when you need to stop working for some amount of time. We all have to eat at some point.
With the constant problem of starting and stopping at least a handful of times a day, how does TDD help?
Bookmarks
TDD offers one very powerful advantage, a bookmark. You see, TDD is split between 3 phases usually referred to as red, green, refactor. Each of these three states can be easily discovered by running your test suite. By making our feedback loop as small as possible it also reduces the amount of information we have to keep in our heads at once.
Now generally, TDD expects you to write your test just before it fails. This is so that you do not preemptively write code for a later feature. However, we can take notes on what tests we will probably want to write later. That is, a comment or a test case that has no code but a failing assertion. We can use the name of the method to know what we need to write when we get there. This acts sort of like chapter titles.
Before we begin we do have to do some setup work. Depending on your preferences and test runners you can choose between;
- Writing empty test methods that fail
- Only recommended if you can stop your test runner on the first fail ( for python and pytest you can add the
-xflag )
- If you can not stop on the first failure you will have to keep scrolling up to get the error logs and it's not fun
- Writing notes in code or on paper for your next tests
- If using this method I like to write the method how it would look but just comment it out so I can pull it in later.
Note that I recommend configuring your test runner to re-run your suite on file change. For python I use pytest-watch, karma has a configuration for it, I believe jest does as well.
Take a break at any time
Now that I have a set of test cases written down I have a few benefits. The first is, until all these test cases are done I know exactly what I am doing. And at any point, I can take a break and come back and know exactly what I need to work on next.
This plays out in two ways depending on your choice of commented test case notes or failing empty test cases.
Failing empty test cases
This is my preferred approach.
We start by writing test methods with descriptive names and just a single failing assertion.
def test_missing_user_auth_raises_401(): assert 0
An example that has a clear description but no code. We can write as many of these that we come up with ahead of time. Noting that we may change our mind later but that is fine.
Now, if we come back from a break and our tests fail because 0 is not true ( or the equivalent for your language ) then we know we are in the green or refactor phase and we can choose to refactor or write our test.
If we come back and our test is failing for any other reason. We know we are in the red phase and we need to add code to get our test to pass.
Finally, if all our tests pass it means we have finished all our existing test cases. At this point, we can probably make a pull request. ( or add docs and that good stuff )
Test comments
If you go the route of just writing comments the flow is similar but has a few differences.
If we come back from a break and our tests all pass then we are in the green or refactor phase and can pull the next comment out and write a test case.
If we come back and our test is failing, then we are in the red phase.
Finally, if our tests pass and we have no more comments we make that pull request.
With this, I have been able to work quite efficiently despite the many distractions of an open office.
Thanks for reading.
Discussion (0)
|
https://practicaldev-herokuapp-com.global.ssl.fastly.net/miniscruff/hidden-tdd-benefit-bookmarks-hl5
|
CC-MAIN-2021-31
|
refinedweb
| 776
| 77.67
|
Next: Class Methods, Up: Object Oriented Programming [Contents][Index]
This chapter illustrates user-defined classes and object oriented programming through a custom class designed for polynomials. This class was chosen for its simplicity which does not distract unnecessarily from the discussion of the programming features of Octave. Even so, a bit of background on the goals of the polynomial class is necessary before the syntax and techniques of Octave object oriented programming are introduced.
The polynomial class is used to represent polynomials of the form
a0 + a1 * x + a2 * x^2 + … + an * x^n
where a0, a1, etc. are real scalars. Thus the polynomial can be represented by a vector
a = [a0, a1, a2, …, an];
This is a sufficient specification to begin writing the constructor for the polynomial class. All object oriented classes in Octave must be located in a directory that is the name of the class prepended with the ‘@’ symbol. For example, the polynomial class will have all of its methods defined in the @polynomial directory.
The constructor for the class must be the name of the class itself; in this example the constructor resides in the file @polynomial/polynomial.m. Ideally, even when the constructor is called with no arguments it should return a valid object. A constructor for the polynomial class might look like
## -*- texinfo -*- ## @deftypefn {} {} polynomial () ## @deftypefnx {} {} > 1) print_usage (); endif if (nargin == 0) p.poly = 0; p = class (p, "polynomial"); else if (isa (a, "polynomial")) p = a; elseif (isreal (a) && isvector (a)) p.poly = a(:).'; # force row vector p = class (p, "polynomial"); else error ("@polynomial: A must be a real vector"); endif endif endfunction
Note that the return value of the constructor must be the output of the
class function. The first argument to the
class function is a
structure and the second is the name of the class itself. An example of
calling the class constructor to create an instance is
p = polynomial ([1, 0, 1]);
Methods are defined by m-files in the class directory and can have embedded
documentation the same as any other m-file. The help for the constructor can
be obtained by using the constructor name alone, that is, for the polynomial
constructor
help polynomial will return the help string. Help can be
restricted to a particular class by using the class directory name followed
by the method. For example,
help @polynomial/polynomial is another
way of displaying the help string for the polynomial constructor. This second
means is the only way to obtain help for the overloaded methods and functions
of a class.
The same specification mechanism can be used wherever Octave expects a function
name. For example
type @polynomial/disp will print the code of the
disp method of the polynomial class to the screen, and
dbstop @polynomial/disp will set a breakpoint at the first executable
line of the
disp method of the polynomial class.
To check whether a variable belongs to a user class, the
isobject and
isa functions can be used. For example:
p = polynomial ([1, 0, 1]); isobject (p) ⇒ 1 isa (p, "polynomial") ⇒ 1
Return true if x is a class object.
See also: class, typeinfo, isa, ismethod, isprop.
The available methods of a class can be displayed with the
methods
function.
List the names of the public methods for the object obj or the named class classname.
obj may be an Octave class object or a Java object. classname may be the name of an Octave class or a Java class.
When called with no output arguments,
methods prints the list of
method names to the screen. Otherwise, the output argument mtds
contains the list in a cell array of strings.
See also: fieldnames.
To inquire whether a particular method exists for a user class, the
ismethod function can be used.
Return true if the string method is a valid method of the object obj or of the class clsname.
See also: isprop, isobject.
For example:
p = polynomial ([1, 0, 1]); ismethod (p, "roots") ⇒ 1
Next: Class Methods, Up: Object Oriented Programming [Contents][Index]
|
https://docs.octave.org/v4.4.0/Creating-a-Class.html
|
CC-MAIN-2022-40
|
refinedweb
| 672
| 60.85
|
Best of both worlds? Udash combines forces of Scala & JavaScript
Udash is a Scala framework that promises to make web developing as safe as possible. Here, we have a look at some advantages and disadvantages of Udash.
Udash is a type-safe, open source framework that uses a shared Scala code and interfaces between front end and back end. The framework also offers the ability to compile Scala to JavaScript as well as use it with JavaScript libraries like Twitter Bootstrap or jQuery.
“A framework for building beautiful and maintainable Web Applications”
According to the official website, Udash offers type-safe layer over HTML, CSS and JS with powerful data binding into DOM templates, thanks to the cooperation with Scalatags and ScalaCSS libraries. The list of advantages and useful features goes as follows:
- Reactive Data Bindings – Automatically synchronise user interface with your data model.
- Type-safe RPC & REST – A client↔server communication based on typed interfaces. Bidirectional RPC via WebSockets out of the box.
- User Interface Components – Twitter Bootstrap components enriched by Udash features.
- CSS – Type-safe CSS definition in your Scala code with minimal JavaScript size footprint and server-side rendering.
- i18n – Translations served by the backend or compiled into JavaScript.
- Generator – Generate a customized application, compile and try it out in 5 minutes.
- Open Source – The whole framework code is available on GitHub under Apache v2 license.
- Backend independent – Udash provides a complete support for your web application and the communication with the server but does not influence your backend implementation.
- IDE support – With any IDE supporting the Scala language. No extra plugin needed.
SEE ALSO: Clojure and Scala are less bug-prone, Python induces more defects, study shows
According to a Hacker News entry, Udash is the perfect choice for developing rich single page apps and big complex websites where you have to “share models and validations between front and back end”.
Let’s have a look at the classic Hello World example.
import io.udash._ import io.udash.css.CssView._ import io.udash.bootstrap._ import io.udash.bootstrap.alert._ import io.udash.bootstrap.button._ import io.udash.bootstrap.form._ import io.udash.bootstrap.modal._ import io.udash.bootstrap.utils._ import org.scalajs.dom val name = Property("Udash") UdashJumbotron( div(BootstrapStyles.container)( UdashBootstrap.loadBootstrapStyles(), h1("Welcome to Udash!"), UdashForm( UdashForm.textInput()("Type your name: ")(name), UdashAlert.success("Hello, ", b(bind(name)), "!").render ).render ) ).render
Verbose and inefficient?
Nonetheless, there are some drawbacks in using Udash for your project. To begin with, there has been much criticism that Scala is not an efficient language for web developing in the first place. However, it is not the scope of this article to criticize Scala.
SEE ALSO: How well do you know your Scala trivia?
Concerning Udash in particular, a lot of feedback was given under the same Hacker News entry. According to the comments, apparent flaws of Udash are the following:
- Runtime errors – it is difficult to avoid them, at least to the extent that Elm does (by design).
- Complexity – designers should be proficient in Scala at least to the extent that they can fix compile errors in the page code, otherwise, it would be simply impossible to share a template.
- Too much code? – some comments suggested that “It looks really verbose only to render simple html”.
Udash is a new framework so there is still a lot of room for review and improvement. The fact that it is an open source framework makes it a promising asset since users’ contributions and remarks can offer valuable insight for further and faster development and improvement.
asap
Be the First to Comment!
|
https://jaxenter.com/udash-scala-compile-javascript-141319.html
|
CC-MAIN-2018-39
|
refinedweb
| 609
| 58.28
|
public boolean isReflected(int[][] points) { int max = Integer.MIN_VALUE; int min = Integer.MAX_VALUE; HashSet<String> set = new HashSet<>(); for(int[] p:points){ max = Math.max(max,p[0]); min = Math.min(min,p[0]); String str = p[0] + "a" + p[1]; set.add(str); } int sum = max+min; for(int[] p:points){ //int[] arr = {sum-p[0],p[1]}; String str = (sum-p[0]) + "a" + p[1]; if( !set.contains(str)) return false; } return true; }
Very clean and easy understanding!
May I ask what is the time and space complexity of your solution?
Same solution without using the String trick.
public class Solution { public boolean isReflected(int[][] points) { int max, min, sum; HashSet<Point> set = new HashSet<>(); if(points.length == 0) return true; max = points[0][0]; min = max; for(int[] point: points) { int x = point[0]; if(x > max) max = x; if(x < min) min = x; set.add(new Point(point[0], point[1])); } sum = (max + min); for(int[] point: points) { Point ref = new Point(sum - point[0], point[1]); if(set.contains(ref)) set.remove(ref); } return set.isEmpty(); } private class Point { int x; int y; Point(int xx, int yy) {x = xx; y = yy;} @Override public boolean equals(Object obj){ Point p = (Point) obj; return (this.x == p.x && this.y == p.y); } @Override public int hashCode(){ return x * 31 + y * 17; } } }
@MintMen the hashCode method in Point class may introduce collisions, though possibility is low. Not sure what can be done here to override the hashCode method during an interview
@a08805436 Maybe we still need to overwrite the hashCode() like what @juanren did to avoid conflict..
@whoops said in Simple java hashset solution:
@juanren The test cases do not have duplicated points. If they have, your code cannot handle them.
The test cases do have duplicate points, e.g.
[[-16,1],[16,1],[16,1]], and the result should return true in this case.
Dups didn't crash the code, since HashSet simply won't insert them.
in my understanding, duplicate points in the array are duplicate; but in 2D plane, actually they are the same ONE point.
Slightly optimized by replacing string concatenation with
long concatenation:
public boolean isReflected(int[][] points) { int max = Integer.MIN_VALUE; int min = Integer.MAX_VALUE; Map<Integer, Set<Long>> entries = new HashMap<>(); for (int[] point : points) { max = Math.max(max, point[0]); min = Math.min(min, point[0]); entries.computeIfAbsent(point[1], x -> new HashSet<>()) .add(keyed(point[0], point[1])); } int end = min + max; for (int[] point : points) { if (!entries.get(point[1]).contains(keyed(end - point[0], point[1]))) { return false; } } return true; } long keyed(long x, long y) { return x << 32 | y; }
It looks like the code doesn't work when points overlap, right?
I did not see the problem mentioned that points can't be overlapped.
Anyone have any idea?
@xxxxxxxxxxy Probably we could override hashCode() like:
@Override public int hashCode() { return Objects.hash(x, y); }
so that collision would be eliminated.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.
|
https://discuss.leetcode.com/topic/48172/simple-java-hashset-solution
|
CC-MAIN-2017-39
|
refinedweb
| 511
| 68.06
|
Prerequisite: Basic knowledge about React and Refs and the dom in React
This post is going to talk about what is useRef hook and when we can use it.
The first time I learned Hooks, I have so many questions that I need to look for the answers. One of those questions is how I can compare the current state/props with the previous one or handle deep object comparison in useEffect Hook. I would only figure it out when I learned about useRef Hook then every pieces fall into place.
💪 Let's get started!
1. What is useRef hook?
Refs provide a way to access DOM nodes or React elements created in the render method.
Our example is about managing the focus of an input when the user clicks on the button. To do that, we will use the createRef API
• createRef API
import {createRef} from 'react' const FocusInput = () => { const inputEl = createRef() const focusInput = () => { inputEl.current.focus() } return ( <> <input ref={inputEl} <button onClick={focusInput}>Focus input</button> </div> ) }
We can achieve exactly the same result with useRef hook
• useRef Hook
const FocusInput = () => { const inputEl = React.useRef() const focusInput = () => { inputEl.current.focus() } return ( <> <input ref={inputEl} <button onClick={focusInput}>Focus input</button> </> ) }
🤔 Wait! What's the difference?
I asked the same question when I first read about useRef. Why do we need to use useRef hook when we can use createRef API to manage the focus of an input? Does the React team just want to make the code look consistent by creating a doppelganger when they introduced Hooks in React 16.8?
Well, the difference is that createRef will return a new ref on every render while useRef will return the same ref each time.
useRef returns a mutable ref object whose .current property is initialized to the passed argument (initialValue). The returned object will persist for the full lifetime of the component.
const Test = () => { const [renderIndex, setRenderIndex] = React.useState(1) const refFromUseRef = React.useRef() const refFromCreateRef = createRef() if (!refFromUseRef.current) { refFromUseRef.current = renderIndex } if (!refFromCreateRef.current) { refFromCreateRef.current = renderIndex } return ( <> <p>Current render index: {renderIndex}</p> <p> <b>refFromUseRef</b> value: {refFromUseRef.current} </p> <p> <b>refFromCreateRef</b> value:{refFromCreateRef.current} </p> <button onClick={() => setRenderIndex(prev => prev + 1)}> Cause re-render </button> </> ) }
As you can see,
refFromUseRef persists its value even when the component rerenders while
refFromCreateRef does not
You can find this comparation of useRef and createRef in Ryan Cogswell's answer on stackoverflow
👏 Interesting! useRef can hold a value in its
.current property and it can persist after the component rerenders. Therefore, useRef is useful more than just managing the component ref
2. Beyond the Ref attribute
Apart from ref attribute, we can use useRef hook to make a custom comparison instead of using the default shallow comparison in useEffect hook. Take a look at our example 😇
const Profile = () => { const [user, setUser] = React.useState({name: 'Alex', weight: 40}) React.useEffect(() => { console.log('You need to do exercise!') }, [user]) const gainWeight = () => { const newWeight = Math.random() >= 0.5 ? user.weight : user.weight + 1 setUser(user => ({...user, weight: newWeight})) } return ( <> <p>Current weight: {user.weight}</p> <button onClick={gainWeight}>Eat burger</button> </> ) } export default Profile
Provided that the user's name will always unchanged. Our expectation is that the effect will output the warning text only when user has gained weight. However, if you test the code above, you can see that our effect run every time the user clicks on the button, even when the
weight property stays the same. That is because useEffect Hook use shallow comparison by default while our
userState is an object. 🐛🐛🐛
🔧 To fix this bug, we need to write our own comparison instead of using the default one.
👉 Step 1: use lodash
isEqual method for deep comparision
const Profile = () => { const [user, setUser] = React.useState({name: 'Alex', weight: 40}) React.useEffect(() => { if (!_.isEqual(previousUser, user) { console.log('You need to do exercise!') } }) ... } export default Profile
We have just removed the dependency array in our effect and use the lodash
isEqual method instead to make a deep comparison. Unfortunately, we run into a new issue because of the missing
previousUser value. If we do the same thing with a class component in ComponentDidUpdate lifecycle, we can easily have the previous state value.
🔥 useRef comes to rescue
👉 Step 2: useRef for saving the previous state
const Profile = () => { const [user, setUser] = React.useState({name: 'Alex', weight: 20}) React.useEffect(() => { const previousUser = previousUserRef.current if (!_.isEqual(previousUser, user) { console.log('You need to do exercise!') } }) const previousUserRef = React.useRef() React.useEffect(() => { previousUserRef.current = user }) ... } export default Profile
To keep track of the
previousUser value, we save it to the
.current property of useRef hook because it can survive even when the component rerenders. To do that another effect will be used to update the
previousUserRef.current value after every renders. Finally, we can extract the
previousUser value from
previousUserRef.current, then we deep compare the previous value with the new one to make sure our effect only run when those values are different
👉 Step 3: extract effects to the custom Hooks
If you want to reuse the code, we can make a new custom hook. I just extract the code above to a function called usePrevious
const usePrevious = (value) => { const previousUserRef = React.useRef() React.useEffect(() => { previousUserRef.current = value }, [value]) return previousUserRef.current }
And to make it more generic, I will rename
previousUserRef to
ref
const usePrevious = (value) => { const ref = React.useRef() React.useEffect(() => { ref.current = value }, [value]) return ref.current }
Let's apply our custom usePrevious hook to the code
const Profile = () => { const initialValue = {name: 'Alex', weight: 20} const [user, setUser] = React.useState(initialValue) const previousUser = usePrevious(user) React.useEffect(() => { if (!_.isEqual(previousUser, user) { console.log('You need to do exercise!') } }) const gainWeight = () => { const newWeight = Math.random() >= 0.5 ? user.weight : user.weight + 1 setUser(user => ({...user, weight: newWeight})) } return ( <> <p>Current weight: {user.weight}</p> <button onClick={gainWeight}>Eat burger</button> </> ) } export default Profile
💪 How cool is that! You can also extract the deep comparison logic to a new custom Hook too. Check use-deep-compare-effect by Kent C. Dodds
3. Conclusion:
🚀 useRef Hook is more than just to manage DOM ref and it is definitely not createRef doppelganger. useRef can persist a value for a full lifetime of the component. However, note that the component will not rerender when the current value of useRef changes, if you want that effect, use useState hook instead 👏👏👏
Here are some good resources for you:
- Reacts createRef API
- React useRef documentation
- Handle Deep Object Comparison in React's useEffect hook
🙏 💪 Thanks for reading!
I would love to hear your ideas and feedback. Feel free to comment below!
✍️ Written by
Huy Trinh 🔥 🎩 ♥️ ♠️ ♦️ ♣️ 🤓
Software developer | Magic lover
Say Hello 👋 on
Discussion
Great article, a lot of things suddenly make sense to me now!
Just one minor observation - should the effect have the value as a dependency so that it doesn't run on every re-render?
Yes, it should. Thankss, I updated the article
Hey hey!
Thank you for this awesome article. This combined with React docs made it clear what refs are. The article was actually so good I references you in my own article:
dev.to/kethmars/today-i-learned-re...
I hope it's okay to borrow your animation(again, referenced).
Thank you for sharing
What if for instance I have multiple buttons and I want to add a component when a particular button is clicked, eg sorting by title, author ..., each of these have a sort button and I want to show an up or down arrow next to each ACTIVE one not all of them, how can I use useRef to achieve that?
Very useful article.
But in this case goal achieved by more simply way.
Just add [user.weight] to dependencies of useEffect.
Nice article. Very easy for me to understand useRef. Thanks.
I learned other way to use ref hook except ref for component or dom element. Thank you a lot!
|
https://practicaldev-herokuapp-com.global.ssl.fastly.net/dinhhuyams/introduction-to-useref-hook-3m7n
|
CC-MAIN-2020-50
|
refinedweb
| 1,330
| 50.33
|
Delta3D/Page3
Delta3D, Ground Floor[edit]
A Quick Scapegoat
Delta3D is a work in progress. There are several very smart people constantly adding, changing, and improving the library for us. They are all marines and work at an aquarium apparently. : )
This means, somewhat unfortunately, that the "ground floor" can shift a bit here and there as new, cool ideas are implemented.
So, I'd like to say "the following is how ALL Delta3D applications work" but that's skipping the fact that there are now various ways to structure a Delta3D app depending on what you're trying to build.
So, the following is one of the most basic ground floors for Delta3D, but not the only one.
The Ground Floor
In order to have a game you need a game loop. This is some kind of timed, cycling if-then code block that is checking for mouse movement, updating zombies positions, making plasma shots inch slightly closer to the zombies, etc.
Do you program your own loop? NEVER! That would so old-school.
Delta3D takes care of this when you create an instance of the Application class. The Application class has a game loop built into it along with other functions to make useful stuff happen inside the game loop.
So one of the first things you'll see is a variable getting initialized as an Application? NO!
What?! Why?!
Because the Application class has virtual functions, which means its got functions that it really, really wants to make real but doesn't know what their internals should look like. This means you have to provide the internals. Which means you have to "derive" your own class from the Application class, THEN you can create a new variable to store this game instance. So chances are, most Delta3D code you've looked at (or will), will have something like this:
class MainApp : public dtABC::Application
Here our MainApp is OUR class that's derived from the Application class (that is stored in the dtABC 'namespace')
And then somewhere in the main block something like
RefPtr<MainApp> app = new MainApp("config.xml");
Which creates a new variable app to store our MainApp object. Inside app now lives our game loop which can be started with
app->Config(); app->Run();
|
https://en.wikibooks.org/wiki/Delta3D/Page3
|
CC-MAIN-2017-09
|
refinedweb
| 379
| 69.01
|
Subclass can make use of super class methods straight away by virtue of inheritnace. If the subclass does not satisfy about the functionality (output) of the super class method, the subclass can rewrite with its own functionality with the same method name. This concept is known as "method overriding", supported by OOP languages like C++/Java. In method overriding, super class and subclass have the method with the same signature – same parameters and same return type.
Let us discuss rules of method overriding with the following example.
class Aves { public void nature() { System.out.println("Aves fly"); } } public class Vulture extends Aves { public void nature() { System.out.println("Flies very high altitudes"); } public static void main(String args[]) { Vulture v1 = new Vulture(); v1.nature(); } }
In the above program, Aves and Vulture classes have the same method nature() with their own functionalities (outputs).
If the super class and subclass have the same method, the subclass calls its own method. By this rule, the subclass object, v1, calls its own overridden method.
The method overloading and method overriding sounds similar; but they differ completely.
Method Overloading vs Method Overriding
Table: Differences: Overloading vs Overriding
Java Static Inheritance
Here, one rule to remember in inheritance is "static members of a class cannot be overridden".
Why the static members cannot be overridden?
Generally, any member (variable or method) when overridden by the subclass, the subclass can call the super class member with "super" keyword. But "static member" cannot be called as with static members "this" reference cannot be used because static members can be called without the help of an object. When static members are overridden, the compiler does not raise error as compiler treats both are different belonging to their own class.
The above explanation will be clearer with the following program.
class Test { public static void display() { System.out.println("Hello 1"); } } public class Demo extends Test { public static void display() { // super.display(); // raises compilation error System.out.println("Hello 2"); } public static void main(String args[]) { display(); Test.display(); } }
The display() method is static in the super class Test and also in subclass Demo. Compiler does not treat it as method overriding as it feels each display() method belong to it's own class.
// super.display();
"super" cannot be used with static members and raises compilation error.
display();
Test.display();
The display() declared in Demo class calls its own and Test.display() calls Test class display() method. No ambiguity in understanding by the compiler.
Final conclusion: Static members of a class cannot be overridden and "super" keyword cannot be used with static members (say, to call super class static method from subclass static method).
Note: Private members of a class cannot be overridden. But public, protected and default members can be overridden.
15 thoughts on “Method Overriding Java”
Hai sir, i want to know
how the memory is allocated for overriden method ?
i mean whether the method in super class and overriden method in subclass points to same memory location or A new memory is created for overriden method ??
thank you in advance : )
sir, Recently I was asked this question “why should one override a method? ”
I replied, if I have a class with 10 methods and I want to use all of its functionality except one method, then I will override that method to have my own functionality.
Then the interviewer replied in that case why cant we write a new method with a different name and use that method instead.
Yes this is also right. Now I am confused. What is the real objective in overriding a method?
Can anyone please tell me? Thank you all in advance.
Well Sunita, it’s useful when we want to update the class, whic can be done in child class in inheritance concept. ope this clears your doubt.
code re-usability might be one of the reason .
sir,in method overriding,after inheritance,the the derived class have access to members of base class.So, new memory locations will be created for base class members which have been inherited in derived class?.
Hi Sir,
I am a big fan of your site.
I think Method overloading happens in super class and sub class relation also.
If I am correct,Please correct the first point.
package org.oops;
class Aves
{
public void nature()
{
System.out.println(“Aves fly”);
}
}
public class Vulture extends Aves
{
public void nature(String name)
{
System.out.println(“Flies very high altitudes”);
}
public static void main(String args[])
{
Vulture v1 = new Vulture();
v1.nature();
}
}
Method overloading happens within the same class. But your doubt is related to method overriding occurring between super and subclasses.
Aves a1 = new Vulture();
a1.nature();
Now you get the output you like the one in your mind.
Aves a1 = new Vulture();
a1.nature();
This code should call the Overridden method(sub class method).
But its calling the super class method.
In my above code No method Overridden happened.
instead of its overloaded the method between the sub and super classes.
Yes Sir You always Rock…
Your point is correct!!!
excellent sir….u r site content.
Do like this:
public void game()
{
super.game();
System.out.println(“in Playerpiece game()”);
}
good website
thank you
hat’s off 2 u sir…!!
thank you. Tell your friends also to derive knowledge of this site.
good website
|
https://way2java.com/oops-concepts/method-overriding/
|
CC-MAIN-2020-50
|
refinedweb
| 888
| 67.04
|
Many modern programming tasks involve the integration of things that happen [asynchronous]ly; they do not happen at precisely controlled times and the computer has to be prepared to deal with whatever happens in the order that it happens.For example, in a GUI you don't want to force a user to press a button between each move of the mouse, and in a network server with two clients connected you definitely do not want to force one client to wait for the other to do something (unless you're doing something collaborative of course! :^)The most commonly used technique for doing this is called event-based programming, and it is such a good coding idiom that it is used in nearly every practical programming language in use today. Of course, some languages offer better support for it than others...The basic idea is that you have a queue of possible events, and as the environment (i.e. the world outside the program) does things, so events are generated and added to the queue. Meanwhile, the program sits there, grabbing events off the queue and doing whatever it takes to deal with them, usually by way of a gigantic [switch] statement (or whatever that language's equivalent is.)Luckily, Tcl comes with all this support built in already. All it takes to turn it on is to set up some event handlers and to start accepting events using the [vwait] command. In Tk, things are even easier as the library sets up a load of handlers anyway, and also starts up the event loop once it has evaluated your startup script.People who aren't used to event-driven programming often have a hard time getting started. See Countdown program for a simple example of converting a loop-based program to an event-driven one.
Major classes of events in Tcl/Tk
- GUI events - Tk's raison d'etre. Note that this includes send and various wm subcommands as well as bind and the -command options to various widgets...
- File events - These occur when it becomes possible to either read from or write to a channel (especially to a pipe, socket or serial port.)
- Timer events - Great for scheduling things for happening later, and brilliant for use with periodic activity.
- Idle events - Useful for when you wish to put something off until there is nothing to do except wait for events (mainly used in the management of display updates...)
- Virtual events - Comes in handy when a certain program state which is reached should call a proc at a higher abstraction level of the application program. It is not good practice to call a high level proc from a lower level. event generate is helpful because (a) the programmer specifies a name for the virtual event (hence a low level software module is consistent in having defined names for ALL internal resources which can be used by apps) and (b) the event can simply be ignored when not needed.
- Variable accesses — see Traces
- Background error handling (Lars H, 2008-09-15: AFAICT this really goes through the event loop nowadays.) — see bgerror and interp bgerror.
- Unrecognized command handling — see unknown and namespace unknown..
User defined events for Tcl can be had in the uevent package from tcllib. It provides support similar to the Tk event command.
|
http://wiki.tcl.tk/489
|
CC-MAIN-2015-48
|
refinedweb
| 556
| 58.11
|
wcsncpy man page
Prolog
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
wcpncpy, wcsncpy — copy a fixed-size wide-character string, returning a pointer to its end
Synopsis
#include <wchar.h> wchar_t *wcpncpy(wchar_t restrict *ws1, const wchar_t *restrict ws2, size_t n); wchar_t *wcsncpy(wchar_t *restrict ws1, const wchar_t *restrict ws2, size_t n);
Description
For wcsncpy(): The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of POSIX.1-2008 defers to the ISO C standard.
The wcpncpy() and wcsncpy() functions
If any null wide-character codes were written into the destination, the wcpncpy() function shall return the address of the first such null wide-character code. Otherwise, it shall return &ws1[n].
The wcsncpy() function shall return ws1.
No return values are reserved to indicate an error.
Errors
No errors are defined.
The following sections are informative.
Examples
None.
Application Usage
If there is no null wide-character code in the first n wide-character codes of the array pointed to by ws2, the result is not null-terminated.
Rationale
None.
Future Directions
None.
See Also
strncpy(), wcscpy()
The Base Definitions volume of POSIX.1-2008,
strncpy(3p), wchar.h(0p), wcscpy(3p).
|
https://www.mankier.com/3p/wcsncpy
|
CC-MAIN-2017-39
|
refinedweb
| 245
| 58.08
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.