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 |
|---|---|---|---|---|---|
exe file creation - JDBC
exe file creation hi
i have done a project in java swings.project name is format migrator.means db migrator. now my aim is create EXE FILE for my project.
pls do consider
creating an .exe file - Java Beginners
creating an .exe file how to create an .exe file in java?
thanks in advance
java - Java Interview Questions
/interviewquestions/
Here you will get lot of interview questions...java hello sir this is suraj .i wanna ask u regarding interview questins in java .wat normally v see in interviews (tech apptitude)is one line
java - Servlet Interview Questions
java servlet interview questions Hi friend,
For Servlet interview Questions visit to :
Thanks
exe set up software - Java Server Faces Questions
exe set up software hi i want a exe file creator software. i am doing a project in swings. now i need exe converter. pls send
java bits 4 - Java Interview Questions
java bits 4 Given:
31. // some code here
32. try {
33. // some code here
34. } catch (SomeException se) {
35. // some code here
36. } finally {
37. // some code here
38. }
Under which three circumstances will the code.... = 10240;
protected void createJarArchive(File jarFile, File[] listFiles
To make java exe or runnable file
To make java exe or runnable file Helo sir
i make a java application.I need to help how run application direct in pc i.e how it packaged, .exe file or setup file
java questions - Java Interview Questions
java questions HI ALL ,
how are all of u??
Plz send me the paths of java core questions and answers pdfs or interview questions pdfs or ebooks :)
please favor me best books of interviews questions for craking
Run a .exe from a class
Run a .exe from a class how to lauch a .exe file from a class in Java and to check the success ful execution of the same
file packaging tool etc..
java language is very flexible language... java...java what is java? hi ,
java is a programming....
java is similar to c++ syntax(not exactly equal to c++ syntax),using
Collection of Large Number of Java Interview Questions!
Interview Questions - Large Number of Java Interview Questions
Here you....
The Core Java Interview Questions
More interview questions on core Java.. Read
java - Java Interview Questions
the ".java" file and converted into .class file which is byte code.
This byte have...java how java is platform independent? hai friend....
the platform independence of java is juz bcoz of THE BYTECODE,can be called
java - Java Interview Questions
{
public static void main(String args[])
{
try{
// Create file... out = new BufferedWriter(fstream);
out.write("Hello Java");
interview question - Servlet Interview Questions
interview question What is Servlet? Need interview questions on Java Servlet Servlet is one of the Java technologies which is used... according to your experience.And for collection of Java Servlet Interview Question you
Java Interview - Java Interview Questions
Java Interview Please provide some probable Java interviewe Question.
Thanking you.
Pabitra kr debanth. Hi friend,
I am sending....
Thanks
Corejava Interview,Corejava questions,Corejava Interview Questions,Corejava
Core Java Interview Questions Page3
... : The
class java.io.File class contains
several methods which create abstract file... ?
Ans :
Generally Java sandbox does not allow to obtain this reference so
Corejava Interview,Corejava questions,Corejava Interview Questions,Corejava
Core Java Interview Questions Page2
...
we cannot create objects of an interface. Typically, an interface in java...
than an interface ?
Ans : A Java interface is an abstract data type like
object - Java Interview Questions
.
Thankx
Hi Friend,
Yes we can create an object in the following... constructor. We can create the object in the
following manner...("packagename.ClassName").newInstance();
4. Using clone() method
We can use
Corejava - Java Interview Questions
it in an ArrayList or Vector and display them in a console.
4. Divide one BigDecimal from another BigDecimal
5. Read an input file and find the occurences of lines having only numeric values by using Pattern class.
Hi Friend,
4
Convert Zip To EXE
of this file into a byte array.
Create
another file with .exe extension...;
Create FileOutputStream object pass the
name of file with .exe...;
In this example we are going to convert a zipped file
into exe
java, - JSP-Interview Questions
the internet resource.
3) It is not a specific file location.
4)It is preferred...java, hi..
define URI?
wht is difference b/w URL and URI
wht... that defines the route to a file on an Internet server (Web server, FTP server Interview,Corejava questions,Corejava Interview Questions,Corejava
Core Java Interview Questions Page1
Q 1 : How should I create an immutable class ?
Ans... be assigned in the constructor. As per the specification
declared in java document
interview - Java Interview Questions
interview kindly guide me some interview questions of Java
java methods - Java Interview Questions
are as follows:
* Write Java code
* Compile Java code
* Create C header (.h file)
* Create C stubs file
* Write C code
* Create shared code library (or DLL...java methods what are native methods? how and when they are use
interview questions - Java Interview Questions
interview questions for Java Hi Any one can u please post the interview point of questions.Warm Regards, Satish
JAVA - Java Interview Questions
JAVA i need objective Questions and answers ( with 4 or 5 choice) in JAVA. Can anyone help me?
H1!!
pl. mail your email id to
asciimails@gmail.com.
I will send you within 2-3 days.
Krishna
objects create at run time - Java Interview Questions
objects create at run time how to create objects at runtime,other than instantiation. Hi friend,
Object : Objects are the basic run time entity or in other words object is a instance of a class . An object
java servlet - Servlet Interview Questions
in server log file ( context.log method to log entry) but could not see the log file kindly tell me where i look for the entry and how create external log file...java servlet i use tomcat server and eclipse as ide for j2ee
java - Java Interview Questions
Helpful Java Interview questions Need Helpful Java Interview questions
uploading a file - JSP-Interview Questions
uploading a file uploading a file and storing in database using clog and blog?
java code in swing for that i want Hi Friend,
Try...;
public File currentDir;
public DropTarget target;
JButton addButton
Core java Interview Questions
Here are the Core Java Interview Questions that can be asked to you by interviewers. These frequently asked Core Java Interview Questions will be beneficial... file.
JRE executes Java files.
JDK stands for Java Development Kit that has
Insert element into an existing xml file - Java Interview Questions
have the following method, and each time when i call the method this will create... = "firstName";
final String lName = "lastName";
FileWriter file = new FileWriter("contact.xml",true);
PrintWriter print = new PrintWriter(file
Java interview questions
Java interview questions Plz answer the following questions...:
(A) int a = 13, a>>2 = 3
(B) int b = -8, b>>1 = -4
(C) int a = 13, a>>>2 = 3
(D) int b = -8, b>>>1 = -4
a. (A), (B), (C) & (D)
b
java- jdbc with type 4 driver
java- jdbc with type 4 driver My program code is-----
import java.sql.*;
import java.lang.* ;
import java .io.*;
import java.util.*;
import...; Follow these steps:
1) Import the following packages in your java file
java - Java Interview Questions
java how to create object in garbage collection? Hi Friend,
Please visit the following links:
java - Java Interview Questions
Programming language.
4)Java does not allocate direct pointers to memory...java what is the deffirence between java language and other language ?
Hi Friend,
Differences:
1)Java is more secure than any other
Interview Question - Java Interview Questions
Interview Question I need Interview Questions on Java,J2EE
Pls help me
java - Java Interview Questions
java how can we create private constructor? what is its... instantiated by other classes
We can create private default constructors so that other classes cannot create a new instance.
We can create this by using singletons
java - Java Interview Questions
java Hello Sir,
Can u please explain me different types of file... InputStreamReader(System.in));
System.out.println("Please enter the file name!");
String st = buff.readLine();
File f=new File(st);
FileOutputStream file - Java Interview Questions
record and go to file txt.Thank's
import java.io.*;
public class... database record
File file = new File("write.txt");
output = new BufferedWriter(new FileWriter(file));
output.write(text);
output.close
Java Interview Questions
Java Interview Questions Hi,
Can anyone tell the urls of Java Interview Questions on roseindia.net?
Thanks
java - Java Interview Questions
Java factorial program I wanted to know ..how to create a factorial program in Java using recursive method.Thanks in Advance! Hi friend...://
java 1. Can constructers be declared as PRIVATE in a java file???
2. What is the major difference between classpath and path envirounmental...:
Thanks
Struts - Java Interview Questions
Struts Interview Questions I need Java Struts Interview Questions and examples
questions
minimum of 3 nos using nested if else.
4. write a program to check whether...
2. write a program to find gcd and lcm of 2 positive integers
Q. 4... recursive function
4. write a program to concatenate two strings entered by user
Java - Java Interview Questions
on web servers.
3)An applet have GUI whereas servlets don't.
4)Applets... the following links:
http
Java - Java Interview Questions
that the Java version is not stored in a header file, because Java doesn't support..., the .java source file.
The Java ball class.
class ball...Java How to use C++ code in Java Program? Hi friend
Java - Java Interview Questions
(); )
if (((String) i.next()).length() == 4)
i.remove();
}
Generics...(); i.hasNext(); )
if (i.next().length() == 4)
i.remove
java - JSP-Interview Questions
.
These are all fairly fundamental questions, try purchasing any introduction to Java...java whats meant by the following terms as applied in java... context (class or package)
4. protected means means that the object
java - Java Interview Questions
java can i create a constructor of an abstract class Hi friend,
Abstract class's can have a constructor.
You cannot access it through... create a sub class and extend
the abstract class which is having
java - Java Interview Questions
that called include() method.This method includes another file in the current file
java - Java Interview Questions
javax.imageio.ImageIO;
public class UploadText extends JPanel {
static File file=null;
int...){
if(returnVal == JFileChooser.APPROVE_OPTION) {
file = chooser.getSelectedFile... {
public boolean accept(File file) {
if (file.isDirectory()) return false
java - Java Interview Questions
types and could create objects of classes but could not inherit from base classes.While Object Oriented language uses all the features of OOPS and could create
java - Java Interview Questions
or deleting an element is fast in comparison to ArrayList and Vector.
4
java - Java Interview Questions
singleton class means,We have to create one object for one class.
By using private... can get singleton java class.That mean that java class will allow one object to access that class.
With this we can avoid multithreading.This Singleton java
java - Java Interview Questions
java All the wrapper classes (Integer, Boolean, Float, Short, Long...
4. extend java.lang.Number
5. are final
Hi friend,
Wrapper... be represented as a
Boolean class instance. All of the primitive wrapper classes in Java
java - Java Interview Questions
, it can be called/used without having to create an object first.
For more information, visit the following links:
java - Java Interview Questions
java can you write a java pro with out using static infront of main....
If this is the case, what would create the instance of the class? What if your class did not have a public constructor?
For more information on java visit
java - Java Interview Questions
java - Java Interview Questions
and that contains data and codes with behavior.
In Java everything happens within... classes in languages like C++ and Pascal.
But in Java one can define his/her own...()
{
System.out.println("Hello World!");
}
}
Print the Output "Hello World".
Create
java - Java Interview Questions
java what is meant by the following fundamentals as used in java..., member variables and methods. Java provides some access modifiers like: public....
4. default : Its not a keyword. When we don't write any access modifier
java - Java Interview Questions
may contain non-public members.
4)Interface can be used to achieve multiple
Corejava Interview,Corejava questions,Corejava Interview Questions,Corejava
Java Interview Questions
Core java Interview Question
page1
An immutable... in the constructor.
Core
java Interview Question Page2
A Java
calculator - Java Interview Questions
calculator create calculator by java code Hi Friend,
Please visit the following link:
Thanks
Java - Java Interview Questions
. You can create a prettier app. They look the same on all platforms. AWT apps tend....
-----------------------------------------------------
Read for more information.
how to run a .exe file in jsp
how to run a .exe file in jsp i want code for to run a .exe file in jsp
JSF Interview Questions
JSF Interview Questions
Collection of JSF (Java Server Faces) Interview Questions... for web based Java applications.
JSF Interview
Question
PHP MYSQL Interview Questions
PHP MYSQL Interview Questions What kind of questions can be asked in an PHP, MYSQL interview? Can anyone post the PHP interviews questions with well explained answers?
PHP, MYSQL Interview Questions
Please tell me
urgent - Java Interview Questions
://
Thanks... website and we want to store in a file. when we open that file it should display the url one by one.using core java technology
(e.g)when am requesting
HTMLParserText - Java Interview Questions
HTMLParserText Thanks for the file that you send me. But my problem, i want to convert it from HTML to TXT file. This means I have to remove all...{
public static void main(String[]args){
try{
File file = new File("applet.html
Java Interview Questions - Page 4
Java Interview Questions - Page 4
Question: What are synchronized methods and synchronized statements?
Answer:
Synchronized methods
java - JSP-Interview Questions
file, another JSP file, or a servlet. It should be noted that the target file must be in the same application context as the forwarding JSP file
java - JSP-Interview Questions
Java database connectivity and accessing the database Please explain, what is Java database connectivity and how to access the database? Java Database Connectivity in short JDBC is an interface used to access database
Java - Java Interview Questions
Java Questions on Java | http://www.roseindia.net/tutorialhelp/comment/81731 | CC-MAIN-2014-52 | refinedweb | 2,396 | 59.19 |
An attribute is a property of an element used to provide access to additional data required for that specific element to process the output. Each element in HTML consists of several attributes that act as a property for that element, followed by the appropriate value.
An attribute with a custom value is required when you want to alter the behavior of an element; hence, in React, you can use an in-built attribute of a component or create a custom attribute for the child component.
In this guide, you will learn how to pass static and dynamic values to the attribute and create a custom attribute for the child components.
Any attribute associated with the UI element needs the value to make it work. Thhe value can be anything, that is, static or dynamic.
If you have a fixed value for an element, then it calls static values that are stored in variables, and once you need to use that value, it consumes directly.
For example, say you have the
<img> element in your React component, and the URL is stored in a state variable, as shown below.
1constructor() { 2 super(); 3 this.state = { 4 imageUrl: "your_image_url", 5 }; 6}
You need to place one state variable inside the local state of the component
imageUrl3, where you can put an appropriate path or URL of the image.
The state variable can be consumed directly with the element, as shown below.
1render() { 2 console.log(this.props) 3 return ( 4 <div> 5 <img src={this.state.imageUrl} /> 6 </div> 7 ); 8}
As you can see,
this.state.imageUrl is accessed from the local state; hence, it’s called dynamic value to the
src attribute and the
imageUrl as a static value.
In the same way, it can also be applied to different elements, and a few examples are shown below.
1render() { 2 console.log(this.props) 3 return ( 4 <div> 5 <a href={this.state.linkUrl} 6 Hit me to reach Google 7 </a> 8 <input type="text" value={this.state.inputValue} /> 9 </div> 10 ); 11}
Along with the
<a> attribute, the static value used is
this.state.linkUrl, and with the
<input> control,
this.state.inputValue is used as a static value to the attribute.
So far in this guide, you have learned how to pass static values to an attribute. But that may require you to use frequently changed values along with the attribute.
For example, you may have one text input, and its element’s value updates as you change its value. The example below demonstrates this.
Create one state variable with a default value.
1constructor() { 2 super(); 3 this.state = { 4 fullName: "test" 5 }; 6}
Now create the
<input> element along with the required attributes.
1render() { 2 return ( 3 <div> 4 Enter full name :{" "} 5 <input 6 type="text" 7 value={this.state.fullName} 8 onChange={this.onValueChange} 9 /> 10 </div> 11 ); 12}
In the above example, the game-changer props are
onChange(), used to update the existing value with the updated value.
1onValueChange = event => { 2 this.setState({ fullName: event.target.value }); 3};
So, once you update the existing value in input control, it will be updated into the state, and the same value will appear in input control using the props, as shown below.
1value={this.state.fullName}
By consuming and updating the different state values, you can provide dynamic values to the element’s attribute.
Events are handy when user interaction is required in the existing page; thus, values can also be passed to an event attribute as with the in-built attributes of the elements, such as
src,
href,
value,
height,
width, and so on.
You can define the values anywhere, such as the local state in the components, to pass the values to the event attribute. See below.
1constructor() { 2 super(); 3 this.state = { 4 student: { 5 name: "heyfoo", 6 age: "18" 7 } 8 }; 9}
Inside the state object of the component,
student is a custom object created along with the key-value pair.
The next step is to implement an event attribute, such as
onClick().
1render() { 2 return ( 3 <div> 4 <span onClick={() => this.setObjectValue(this.state.student)}> 5 Send object 6 </span> 7 </div> 8 ); 9}
Inside the
<div>, there is one element created,
<span>, along with the event attribute, called
onClick, which triggers the event when the user clicks on the span element.
Once the user clicks on the element, you can pass any custom values as a function argument.
1onClick={() => this.setObjectValue(this.state.student)}
this.setObjectValue is a custom function that accepts one argument, and the static argument given is
this.state.student.
To access the object from the event function, see below.
1setObjectValue(obj) { 2 console.log(obj); 3}
You can pass any static or dynamic values along with the event function, just like in the above example.
Attributes play an essential role when using HTML elements with static or dynamic values to achieve interactive results.
I hope this guide helps you to implement various ways to provide value to an attribute. | https://www.pluralsight.com/guides/how-to-pass-values-inside-attributes | CC-MAIN-2022-40 | refinedweb | 844 | 64 |
Unanswered: How to display a list of values in a Grid cell
Hello all,
I have a question about data display in a GXT grid. I need to display a list of values separated by newline in a grid cell. For example, if I have
public class FooModel extends BaseModel{
}
that contains a list of BarProxy (that extends the GWT EntityProxy). I'm not sure how to implement a rendered so that all FooModel.BarProxy.name are displayed in that cell one under the other.
Thank you in advance,
Anda P
Try rendering the cell adding this css. This would help you to fire word wrap the cells in the grid.
Code:
.grid .x-grid3-cell-inner { white-space: normal !important; } | https://www.sencha.com/forum/showthread.php?162244-How-to-display-a-list-of-values-in-a-Grid-cell | CC-MAIN-2016-30 | refinedweb | 121 | 73.88 |
:
As you can see, there are different types of nodes::
1 /* Helper function to generate a DOM Element for the given DOM document 2 and append it to the children of the given node. */ 3 QDomElement addElement( QDomDocument &doc, QDomNode &node, 4 const QString &tag, 5 const QString &value = QString::null ) 6 { 7 QDomElement el = doc.createElement( tag ); 8 node.appendChild( el ); 9 if ( !value.isNull() ) { 10 QDomText txt = doc.createTextNode( value ); 11 el.appendChild( txt ); 12 } 13 return el; 14 } 15 16 17 QString holidaySetToXML( const HolidaySet &hs ) 18 { 19 QDomDocument doc; 20 QDomProcessingInstruction instr = doc.createProcessingInstruction( 21 "xml", "version='1.0' encoding='UTF-8'"); 22 doc.appendChild(instr); 23 24 // generate holidayset tag as root, add country attribute if needed 25 QDomElement holidaySetElement = addElement( doc, doc, "holidayset" ); 26 if ( !hs.mCountry.isEmpty() ) 27 holidaySetElement.setAttribute( "country", hs.mCountry ); 28 29 // Add the <name> and <comment> elements to the holidayset 30 if ( !hs.mName.isEmpty() ) 31 addElement( doc, holidaySetElement, "name", hs.mName ); 32 33 // Add each holiday as a <holiday>..</holiday> element 34 QList<Holiday>::iterator i; 35 for ( i = hs.mHolidays.begin(); i != hs.mHolidays.end(); ++i) { 36 QDomElement h = addElement( doc, holidaySetElement, "holiday" ); 37 addElement( doc, h, "name", (*i).mName ); 38 addElement( doc, h, "date", (*i).mDate.toString( Qt::ISODate ) ); 39 } 40 41 return doc.toString(); 42 }
One thing to notice is that all DOM nodes are passed by value (since some programming languages do not define pointers, the DOM API cannot use any pointer-based functionality!). The..
In this chapter we will now look at how we can parse the XML holiday set into the HolidaySet structure using the DOM method. The parsing using a SAX parser will be treated in a later chapter.
The usual way to parse an XML document into a DOM tree is to use the method QDomDocument::setContent. If this method is successful, the QDomDocument object contains the DOM tree in the usual DOM structure. If an error occurs, the error message and the exact position of the error is stored into the parameters of the call:
1 QFile f( argv[1] ); 2 QDomDocument doc; 3 QString errorMsg; 4 int errorLine, errorColumn; 5 if ( doc.setContent( &f, &errorMsg, &errorLine, &errorColumn ) ) { 6 result = parseXMLwithDOM( doc ); 7 }
The resulting QDomDocument now contains the whole DOM tree, similar to the one that we created in the previous section. The DOM tree represents the hierarchical structure as shown in the image above. To obtain an element with a given tag name, one can use the QDomNode::namedItem( "tagname" ) method of the parent node object, which returns a QDomNode (this class is the base type to describe any of the DOM nodes). As we are interested in the element, we have to convert it to a DOM element by the toElement() method. You might find this to be quite awkward to use, in particular since C++ usually offers better ways to work with derived classes. However, the DOM API was designed to work with various different languages, so typical C++-isms cannot be part of the DOM API.
To extract the holiday data from the DOM tree, we write the function parseXMLwithDOM:
HolidaySet parseXMLwithDOM( QDomDocument &domTree ) { HolidaySet hs( QString::null );
We first obtain the DOM element that represents the <holidayset>...</holidayset> element using the namedItem and toElement methods. If no child node named "holidayset" exists or it is not an element (e.g. because it is a processing instruction or an attribute), a null element is returned:
QDomElement set = domTree.namedItem("holidayset").toElement(); if ( set.isNull() ) { qWarning() << "No <holidayset> element found at the top-level " << "of the XML file!"; return hs; // no holiday set found }
This element possibly has an attribute named "country". This can be checked using the QDomNode::hasAttribute method and the attribute can be obtained using the QDomNode::attribute method:
if ( set.hasAttribute("country") ) { hs.mCountry = set.attribute("country"); }
We can also have a <name>...</name> child element, which can be obtained similar to the holidayset element. We retrieve the text of the element between the enclosing tags by a call to QDomElement::text():
// Search for a given element (only the first matching is returned): QDomElement name = set.namedItem("name").toElement(); if ( !name.isNull() ) { // We have a <name>..</name> element in the set hs.mName = name.text(); }
The namedItem method will always return the first child that matches the given name. While this might be fine for the <name> child element, we cannot use this for the <holiday>...</holiday> elements, which will appear more than once. For this reason, there are iterator-like calls firstChild() and and nextSibling() to walk through all child nodes and firstChildElement("tagname") and nextSiblingElement("tagname") to walk only through all child elements with the given tag name. If no further child can be found, a null node is returned:
// Way 1: Loop through all child nodes with a given tag name. QDomElement e = set.firstChildElement( "holiday" ); for ( ; !e.isNull(); e = e.nextSiblingElement( "holiday" ) ) { Holiday h; // e is the <holiday>...</holiday> element.... // Load the contents of e into h hs.mHolidays.append( h ); } // Way 2: Loop through all child nodes and check if it is an element // with one of the wanted tagnames QDomNode nd = set.firstChild(); for ( ; !nd.isNull(); nd = nd.nextSibling() ) { if ( nd.isElement() && nd.toElement().tagName() == "holiday" ) { QDomElement e = nd.toElement(); Holiday h; // Same code as above... // e is the <holiday>...</holiday> element.... // Load the contents of e into h hs.mHolidays.append( h ); } }
The first method is of course the better and simpler choice in our example. However, if the <holidayset> element can have various different child elements, it's often easier and faster to loop through all children only once and condition the code on the name of the tag, which is done in the second example.
If one looks at the API documentation of the QDomElement class, one will also find a method elementsByTagName, which returns a QDomNodeList that can be traversed using iterators. The problem with this method is that it is recursive, i.e. it will return all child elements with the given name at any level (in a well-defined canonical order). We, however, only want the immediate children of the <holidayset> element, but not sub- or subsubchildren.
Now that we have the QDomElement of the <holiday>...</holiday> element, we can easily load its contents into the Holiday structure, using only methods that we have already seen:
Holiday h; QDomElement v = e.namedItem("name").toElement(); if ( !v.isNull() ) h.mName = v.text(); v = e.namedItem("date").toElement(); if ( !v.isNull() ) { h.mDate = QDate::fromString( v.text(), Qt::ISODate ); } hs.mHolidays.append( h );
This concludes our method for loading the holiday set data from the DOM tree representation into the HolidaySet data structure. The whole parseXMLwithDOM function thus reads:
1 HolidaySet parseXMLwithDOM( QDomDocument &domTree ) 2 { 3 HolidaySet hs( QString::null ); 4 5 QDomElement set = domTree.namedItem("holidayset").toElement(); 6 if ( set.isNull() ) { 7 qWarning() << "No <holidayset> element found at the top-level " 8 << "of the XML file!"; 9 return hs; // no holiday set found 10 } 11 12 if ( set.hasAttribute("country") ) { 13 hs.mCountry = set.attribute("country"); 14 } 15 16 // Way 1: Explicitly search for a given element: 17 QDomElement name = set.namedItem("name").toElement(); 18 if ( !name.isNull() ) { // We have a <name>..</name> element in the set 19 hs.mName = name.text(); 20 } 21 22 // Way 2: Loop through all child nodes with a given tag name. 23 QDomElement n = set.firstChildElement( "holiday" ); 24 for ( ; !n.isNull(); n = n.nextSiblingElement( "holiday" ) ) { 25 Holiday h; 26 QDomElement e = n.toElement(); 27 QDomElement v = e.namedItem("name").toElement(); 28 if ( !v.isNull() ) h.mName = v.text(); 29 v = e.namedItem("date").toElement(); 30 if ( !v.isNull() ) { 31 h.mDate = QDate::fromString( v.text(), Qt::ISODate ); 32 } 33 hs.mHolidays.append( h ); 34 } 35 36 // Way 3: Loop through all child nodes and check if it is an element 37 // with one of the wanted tagnames 38 QDomNode nd = set.firstChild(); 39 for ( ; !nd.isNull(); nd = nd.nextSibling() ) { 40 if ( nd.isElement() && nd.toElement().tagName() == "holiday" ) { 41 QDomElement n = nd.toElement(); 42 // Same code as above... 43 } 44 } 45 46 return hs; 47 }
If you are working with complex XML files, sooner or later you will realize that you are using tags and attributes that can be categorized according to their meaning. Even worse, you might encounter tags with the same named used for completely different things. For example, if you are managing a large document describing books and their authors, you might use a <title> element to denote the title of the book, as well as the job title of the author.
So, clearly there should be a way to distinguish these two elements with the same name, but different usages. This can be done via XML namespaces, using prefixes to the elements. A namespace is a unique URI (not necessarily a URL!), e.g. "" or "urn:kde:developer:tutorials:QtDom:holidays". Rathern than using these long and awkward URIs with each element, you have to define a prefix for each of the namespaces. This is done via an
xmlns:yourprefix="your:namespace:uri"
attribute to the element or any of its parents. This defines the "yourprefix" prefix as a shortcut to the full namespace URI "your:namespace:uri". Usually, the namespace declaration is added to the root element of hte XML file. To use an element from this namespace, you can simply prepend the prefix to the tag name: <yourprefix:tag>. This tag name together with the prefix is called the "qualified name" (or in short qName) or the element. The various parts of the element (which you will find in the Qt DOM API, too), are:
(As a side note: If an element does not use any namespaces and thus also no prefix, e.g. <tag>, all these parts of the qName are empty and only the "tag name" is set to "tag".)
Using this new knowledge about namespaces, of course, we want to generate and process holiday files with proper namespaces. For example, we could define all the tags to be in the namespace "urn:kde:developer:tutorials:QtDom:holidays", indicated by the prefix "h". A typical XML file would then look like:
<>
So far, we created elements (without namespaces) using the QDomDocument:createElement(...) method. Qt, or rather DOM, offers a simply way to generate elements with a namespace attached:
QDomDocument::createElementNS( const QString &nsURI, const QString &qName )
doc.createElement( "holiday" );
with
doc.createElementNS( "urn:kde:developer:tutorials:QtDom:holidays", "h:holiday" );
Again, we can write our own helper method "addElementNS":
/*(); } }
Unfortunately, the correct way laid out above does not produce valid XML with Qt versions at least up to 4.2.0:
<(); }
The output now becomes the correct XML code:
<>
Of course, noone forces you to use Qt's DOM classes to generate the XML code. After all, the resulting XML is only a simple text! The most straight-forward approach would thus be to directly generate the text that contains the XML.; }
Of course, this approach works fine if your only goal is to create the XML for outputting it to a file or piping it into another application, library or web service.
QDomNodeList elementsByTagNameNS ( const QString & nsURI, const QString & localName ) const!):
1 QDomElement namedItemNS( const QDomNode& node, const char* nsURI, const char* localName ) 2 { 3 QDomElement n = node.firstChildElement(); 4 for ( ; !n.isNull(); n = n.nextSiblingElement() ) { 5 if ( n.localName() == localName && n.namespaceURI() == nsURI ) { 6 return n; 7 } 8 } 9 return QDomElement(); 10 }:
QDomElement e = parent.firstChildElement( "holiday" ); while ( !e.isNull() ) { if ( e.namespaceURI() == nsURI ) { // Do whatever we need to do with the holiday } e = e.nextSiblingElement( "holiday" ); }.
class HolidayHandler : public QXmlDefaultHandler { public: HolidayHandler() : QXmlDefaultHandler(), holiday(0), holidayset(QString::null) {} bool startElement( const QString &/*namespaceURI*/, const QString &localName, const QString &/*qName*/, const QXmlAttributes & atts ) { if ( localName == "holidayset" ) { QString country = atts.value("value"); if ( !country.isEmpty() ) holidayset.mCountry = country; } else if ( localName == "holiday" ) { if ( !holiday ) holiday = new Holiday; } content.clear(); return true; } virtual bool endElement ( const QString &/*namespaceURI*/, const QString & localName, const QString &/*qName*/ ) { if ( localName == "name" ) { if ( holiday ) holiday->mName = content; else holidayset.mName = content; } else if ( localName == "date" ) { QDate d = QDate::fromString( content, Qt::ISODate ); if ( d.isValid() && holiday ) holiday->mDate = d; } else if ( localName == "holiday" ) { holidayset.mHolidays.append( *holiday ); holiday = 0; } content.clear(); return true; } bool characters(const QString &str) { content += str; return true; } bool fatalError(const QXmlParseException &exception) { qDebug() << "Parse error at line " << exception.lineNumber() << ", column " << exception.columnNumber() << ":\n" << exception.message(); return false; } HolidaySet holidaySet() { return holidayset; } protected: Holiday *holiday; HolidaySet holidayset; QString content; }; int main(int argc, char *argv[]) { if ( argc < 2 ) { qWarning() << "Please give the XML file as argument!"<<endl << "Usage: qtdom_parse_dom filename.xml"<<endl; return EXIT_FAILURE; } HolidaySet result( QString::null ); HolidayHandler handler; QXmlSimpleReader reader; reader.setContentHandler(&handler); reader.setErrorHandler(&handler); QFile file(argv[1]); if (!file.open(QFile::ReadOnly | QFile::Text)) { QMessageBox::warning(0, "QtDOM SAX example", QString("Cannot read file %1:\n%2.") .arg(argv[1]) .arg(file.errorString())); return EXIT_FAILURE; } QXmlInputSource xmlInputSource(&file); if ( reader.parse(xmlInputSource) ) { result = handler.holidaySet(); } else { return EXIT_FAILURE; }>
Initial Author: Reinhold Kainhofer | https://techbase.kde.org/index.php?title=Development/Tutorials/QtDOM_Tutorial&diff=60725&oldid=7391 | CC-MAIN-2017-22 | refinedweb | 2,179 | 50.02 |
Extras/SteeringCommittee/Meeting-20060511
From FedoraProject
Summary
Present from FESco -- scop, warren, mschwendt, skvidal, jpo, skvidal
- Weekly sponsorship nomination
- we need more reviewers.
- "Education" is key to getting more reviewers.
- tibbs and warren will improve the docs in the wiki
- Incompatible package upgrade policy
- that's a old item in the schedule -- we didn't talk about this for months. See full log for details (19:21 - 19:47). But the problem isn't that big, so we don't need to hurry (this was before the directfb update happened)
- Define rules how SIGs should work
- also on the schedule for a long time already. It was agreed on that we don't want to define anything ATM. Just let them work as they like. We can revisit this later if we want/have to.
- other discussions (see full log for details):
- 19:02 permissions problems with the extras-push scripts should be fixed (mostly)
- 19:51 what do people think about multiple maintainers for a single package?; lack of a proposal how to do it exactly
- 19:52 emacsen/muse
- 19:58 it is not possible to CC the fedora-security mailing list from bugzilla
- 20:00 thl, as far as the voting system goes... i have yet to hear anything back from Sopwith
Full log
19:00 --- | thl has changed the topic to: FESCo meeting in progress 19:00 * | thl looks around 19:00 * | jima scurries away again 19:00 --- | Users 70 nicks 19:00 < mschwendt> | Note to all: FE repodata for 3|4|5|development has been recreated on the master server. Sync happening right now. -- The next push will break again, though, unless the remaining permission problems get fixed. ;) 19:01 < jpo> | thanks Michael 19:01 * | jima applauds mschwendt 19:01 * | thl sees scop, warren, mschwendt, skvidal, jpo -- anyone else from FESCo around? 19:02 < thl> | seems not 19:02 --- | thl has changed the topic to: FESCo meeting in progress - Broken deps report 19:02 < thl> | mschwendt, skvidal that's the status? does it run on buigl64 already? 19:03 < mschwendt> | no 19:03 < warren> | mschwendt, remaining permission problems? 19:03 < thl> | well, is there anything new that needs to be discussed? 19:04 < mschwendt> | warren: not for repoclosure script, but for the extras-push scripts 19:04 < thl> | mschwendt, or do we simply wait until you and skvidal find time for it 19:04 * | warren looks at extras64 19:05 < warren> | mschwendt, I fixed this again 2 days ago, who owned files that had wrong permissions today? 19:05 < mschwendt> | you and scop 19:05 < warren> | 644 and 755 permission? 19:05 < mschwendt> | extras-repobuild.py terminates with a bad shell exit code, which is not recognised by the push script 19:06 < mschwendt> | I've fixed this in CVS already and up'ped the scripts on the server 19:06 < mschwendt> | warren: see /tmp/repomd-cache 19:06 < warren> | mschwendt, btw, what do you use to upload scripts to the server? 19:06 < warren> | mschwendt, do you sync it from cvs, or just upload manually 19:06 < mschwendt> | I sync them 19:06 < warren> | how? 19:06 < scop> | FWIW, my last login to buildsys was two days ago, and IIRC I didn't even do a push back then 19:06 < mschwendt> | warren: cvs up from within extras_signers group 19:07 < warren> | ah 19:07 < mschwendt> | scop: these files are from May 7th and older! 19:07 < mschwendt> | repodata has NOT been created since then 19:09 < thl> | do you guys want to dicuss this further? 19:09 < thl> | or can we move on? 19:09 < mschwendt> | let's move 19:09 < mschwendt> | we have a separate list for this 19:09 < thl> | k 19:09 --- | thl has changed the topic to: FESCo meeting in progress -- Weekly sponsorship nomination 19:09 < thl> | any new nominations? 19:09 < thl> | while on the topic: 19:10 < thl> | did evereyone notice the fedora-music-list and the plans to get lots of stuiff from Planet CCRMA into extras? 19:10 < thl> | that will probably a lot of reviewing work 19:10 < che> | thl, awesome though 19:11 < tibbs> | Yes, we need more reviewers. 19:11 < warren> | did we have any resolution on the alternative kernel thing? 19:11 < thl> | warren, that's more on the fab list currently 19:11 < warren> | And is he submitting everything through the review process like normal? 19:11 < noa> | thl, yup.. I'm wondering.. how is that intitiative related to what monty talked about over at fudcon? 19:11 < thl> | warren, it seems jack currently is the bottleneck 19:11 < warren> | who is jack? 19:12 * | skvidal just got back 19:12 < mschwendt> | a package in the queue 19:12 < noa> | jack is a real time audio pipeline 19:12 < thl> | jack-audio-connction-foo 19:12 < warren> | oh 19:12 < warren> | noa, Noa Resare? 19:12 < tibbs> | 19:12 < noa> | warren, yup :) 19:12 < noa> | warren, long time 19:12 < warren> | noa, welcome back! You were one of our original contributors. 19:12 * | noa remembers setting up a bugzilla for fedora in the early days :) 19:13 < warren> | noa, still running with no security updates! =) 19:13 < thl> | noa, btw, I don't know "what monty talked about over at fudcon" 19:13 < noa> | unfortunatly I was sucked up in work and family life for a months 19:13 < thl> | noa, did I miss anything important? 19:14 < noa> | thl, it was one of the videos, it seems like he has gotten the task to design an audio daemon that will try to fix many of the problems with audio on linux 19:14 < warren> | noa, you came to Boston? 19:14 < warren> | thl, noa: I suspect this has nothing to do with what monty talked about. 19:14 < noa> | warren, no, i saw the videos over here in sweden 19:14 < warren> | ah 19:15 < thl> | noa, k 19:15 < thl> | anyway, back to the topic 19:15 < noa> | sorry :) 19:15 < thl> | tibbs> | Yes, we need more reviewers. 19:15 < thl> | that's IMHO one crucial point 19:15 < tibbs> | I'm trying to do at least two a day, but lately the list has been growing. 19:15 < che> | thl, what are the requirements for a reviewer? 19:15 < mschwendt> | thl: the problem with jack is not that we need more reviewers, but that it is not ready. Fernando has commented on the package already. 19:15 < thl> | and related to " Encourage Extras reviews " -- that's still on the schedule 19:16 < warren> | thl, adn again I say, "Education" is key to getting more reviewers. 19:16 < bpepple> | warren: +1 19:16 < thl> | warren, that's why I brought " Encourage Extras reviews " onto the table 19:16 < thl> | that's assigned to you warren 19:16 < thl> | you had plans to update the docs in the wiki 19:16 < tibbs> | che: you need cvsextras membership, which means package maintainership, which means sponsorship. 19:17 < warren> | unfortunately I've been unable to prioritize the necessary work to rewrite that entirely myself 19:17 < tibbs> | Well, fedorabugs membership, but cvsextras is the prerequisite for that. 19:17 < mschwendt> | tibbs: in short "you need a sponsor" -- package maintainership is not needed 19:17 < cweyl> | well, "anyone can review", if I recall correctly... it's the _approving_ part that requires cvsextras 19:17 < thl> | warren, any timeframe when to get this done? 19:17 < thl> | or is anyone else interested in improving our docs? 19:18 < warren> | I think it will be an incremental process, and I will need help. 19:19 < thl> | warren, could you find time to lay down a small and rough plan and ask for help on f-extrs-list? 19:19 < tibbs> | I'd like to help 19:19 < warren> | How about I work with tibbs. 19:19 < thl> | tibbs, can you take care of that together with warren? 19:19 < warren> | and we create a plan, and ask the list 19:19 < thl> | warren, tibbs, thx 19:20 < tibbs> | Sure. Email OK? 19:20 < warren> | okk 19:20 < thl> | k, then let's move on 19:20 < thl> | we'll see if we later if we need more reviews and/or sponsors for the stuff from Planet CCRMA 19:21 --- | thl has changed the topic to: FESCO Meeting -- Incompatible package upgrade policy 19:21 < thl> | warren, that's still on the schedule and assigned to you 19:21 < warren> | Have we really had problems with this? 19:21 < scop> | yes 19:22 < scop> | not recently AFAIK, though 19:22 < tibbs> | One came up last week. Let me think... 19:22 < warren> | I think "do the right thing" and improved tools to tell us when things break gives us a nice balance between freedom and control. 19:22 < thl> | improved tools sound like a good idea 19:22 < tibbs> | I think it was "pan", the newsreader. 19:23 * | mschwendt must leave for a few mins 19:23 < warren> | We need the ability to upgrade stuff, because that is the easiest way to fix problems sometimes. At the same time we need the tools to support this, and enforce rebuilding deps when you make such changes. 19:23 < thl> | I also dislike the plague part in each of the broken deps report for FC3 19:23 < scop> | tools tend to help within FE only 19:23 < scop> | thl, so poke the maintainer to do something about it? 19:23 < thl> | dcbw build plague for FC3 but the dep "createrepo >= foo" is not resolvable 19:24 < thl> | scop, such packages probably shouldn't even hit the repo 19:24 < thl> | (in an ideal world) 19:24 < scop> | right, but if something's broken, it needs to be fixed 19:25 < warren> | Idea 19:25 < scop> | "not liking" seeing someting in breakage reports doesn't help alone ;) 19:25 < thl> | scop, in the case of plague it would require a updated createrepo released as update from core 19:25 < thl> | scop, sure ;-) 19:25 < scop> | thl, I know, 19:25 < warren> | Should the package sign & push process resolve deps and exclude things that break deps? 19:25 < thl> | warren, yeah, maybe 19:27 < thl> | scop, thx, didn#t know there was a bug for it open 19:27 < thl> | warren, would that be possible and easy to do? 19:27 < noa> | warren, if there is a good mechanism for notifying the affected maintainers I think that would be good 19:28 < skvidal> | thl: no, it wouldn't be 19:28 < warren> | per-package CC lists that people can subscribe to would help 19:28 * | warren files that idea... 19:28 < scop> | but that's no substitute for a policy 19:29 < mschwendt> | thl: there is no way to withdraw a built package as it was made available to the build system already 19:29 < thl> | mschwendt, also true 19:30 < thl> | maye plague could check if all deps are resolved before pushing a package to the needsign repo 19:30 < thl> | or does that sound completely silly ? 19:30 < skvidal> | how about make the pkg owner check for closure before they push out a package 19:30 < tibbs> | You couldn't rebuild a dependency chain that way, could you? 19:31 < thl> | and is the problem big enough to discuss it? 19:31 < scop> | not completely silly, but something that could cause problems in complex build dependency chains 19:31 < thl> | scop, true 19:31 < mschwendt> | sounds like we need a QA Checklist again :) 19:32 < thl> | anyway, back to the original topic: Incompatible package upgrade policy 19:32 < scop> | no, we need that policy :) 19:32 < thl> | that what is written in the wiki: 19:32 < thl> | Seems like we need tools that will allows packagers to 1. notify others when the packager breaks something that others depend on; 2. notify the packager when he's about to break somwthing that others depend on. Warren is working on a proposal. 19:32 < thl> | anyone any idea how this could be done? 19:33 * | scop brb 19:33 < mschwendt> | if you are aware of your package's deps, why not mail the other package owners? 19:33 < warren> | Combination of written process and automated detection 19:34 < thl> | "automated detection" seems crucial 19:34 < jima> | mschwendt: i thought the problem was more not being aware of the dependency problem. 19:34 < jima> | thl: exactly. 19:34 < skvidal> | the problem will be two people submitting at the same time 19:34 < warren> | although skvidal has a good point 19:34 < skvidal> | you could make them both check for closure 19:35 < skvidal> | but due to their two pkgs coming out at the same time 19:35 < skvidal> | they'd have no way of knowing about new deps 19:35 < skvidal> | or the removal, thereof 19:36 < thl> | :-/ 19:36 < thl> | so what do we do? we ignored it for months already 19:36 < thl> | do we want to continue so? 19:37 < thl> | and try to fix the things one by one when they show up the next time? 19:37 < warren> | it hasn't been as much of a problem lately 19:37 < thl> | agreed 19:37 < tibbs> | Is it possible to track dependencies and alert maintainers when something new depends on their packages? 19:37 < jima> | oooo. 19:37 < mschwendt> | probably with a front-end for repoquery 19:38 < XulChris> | heya tibbs got your comments on my package, thanks 19:38 < warren> | basic building blocks like: per package CC list would allow otehr infrastructure to build on top of it. 19:38 < skvidal> | tibbs: and display it where? 19:38 < tibbs> | Email? Or just a command-line tool to list stuff that depends on me. 19:38 < tibbs> | It would at least tell me who I need to keep updated. 19:38 < skvidal> | tibbs: just add a command to the makefile system to look for what depends on their package 19:38 < jima> | i'd think email; there's probably no incentive/reminder to run the command. 19:39 < skvidal> | then they maybe could do: make whatrequires 19:39 < skvidal> | jima: right, b/c MORE email makes people pay attention 19:39 < skvidal> | </sarcasm> 19:39 < tibbs> | Imagine you're Rex. All kinds of stuff is going to depend on Qt4 once it gets in, plus he has like 50 other packages. 19:39 < XulChris> | tibbs: your comments said my package didnt have a %check section, but it does 19:40 < tibbs> | XulChris: I'm prone to idiocy. Shoot me the bug #. 19:40 < thl> | well, I'll mention this discussion in the summary 19:40 < thl> | maybe some other people have an idea 19:40 < mschwendt> | Does repoquery have an option to examine _all_ dependencies? 19:41 < thl> | I'll leave it on the schedule for now 19:41 < |Jef|> | mschwendt: --alldeps 19:41 < mschwendt> | And this doesn't suffice? 19:41 < mschwendt> | Sure, one could evaluate owners.list, too, but why? 19:43 * | thl waits 15 more seconds for further input and will move on if nothing shows up 19:43 < |Jef|> | mschwendt: hmmm alldeps might not be what you want... "check non-explicit dependencies as well" may not mean "walk the dep tree" 19:43 --> | Eva42 (Unknown) has joined #fedora-extras 19:43 * | thl waits 20 seconds before moving on 19:43 < mschwendt> | Walking the entire dep tree is not needed 19:44 < mschwendt> | Just a beautified display of "my package is used by: A B C D" possibly with owners' email addr in brackets 19:44 < thl> | mschwendt, maybe we can have that in the planed web-interface 19:44 * | scop wants to note that no tool the packager can run will help with locally installed stuff or unconfigured 3rd party repos 19:44 < jima> | no, because the non-explicit deps should be handled when checking the explicit deps' dependencies. 19:44 < jima> | 12:43 < mschwendt> Walking the entire dep tree is not needed 19:44 < thl> | awjb had plans for one but didn#t work on it yet (afaik) 19:44 < jima> | irt that 19:45 < thl> | k, guys, let's forget about this topic for today and let's move on 19:46 < jima> | forget about what topic? 19:46 < thl> | jima, the "Incompatible package upgrade policy" 19:46 < jima> | thl: _what topic?_ (sorry...) 19:46 < warren> | It is a bit more complicated and difficult to fix than we can figure out during this meeting. 19:46 < thl> | warren, exactly 19:47 --- | thl has changed the topic to: FESCO meeting -- Define how SIGs should work 19:47 < thl> | that's still on the schedule 19:47 < tibbs> | The games SIG is running nicely. 19:47 < XulChris> | what does that mean? 19:47 < thl> | do we still want do to that or do we just proceed as currrently? 19:47 < XulChris> | ya i was just gonna say.. 19:48 < warren> | Aren't SIG's working fine now? 19:48 * | _wart_ thinks so 19:48 < XulChris> | well there is some confusion between the music SIG and "sound" SIG 19:48 < thl> | warren, they are, but we have no real "rules" how they should wroks 19:48 < thl> | work 19:48 < jima> | isn't "how do we start up a new SIG?" more the issue? :| 19:48 < thl> | the question is: do we need such rules? 19:49 < tibbs> | SIGs may start to overlap or conflict as more of them appear. 19:49 < _wart_> | thl: I don't think rules are necessary at this point. Things seem to be working fine without strict rules for now. 19:49 < warren> | thl, I've kind of been handling that. I've been demanding that each group write their Wiki page with goals and such before they get their mailing list. Games went through this. 19:49 < warren> | thl, so I could just write that down on the wiki. 19:49 < jima> | s/rules/guidelines/ ? 19:49 < tibbs> | FESCO may be asked to step in for conflicts, but without rules any decision will be treated as arbitrary. 19:50 * | thl needs to leave soon 19:50 < jima> | the process should probably be listed someplace (as warren said) 19:50 < warren> | I'll just write it down. 19:50 < thl> | warren, thx 19:50 < warren> | It is pretty clear to me, and it worked more than once. 19:50 * | jima stops interfering with the swift passage of the meeting. 19:50 --- | thl has changed the topic to: FESCO meeting -- Free discussion 19:50 <-- | Foolish has quit (Read error: 104 (Connection reset by peer)) 19:51 < thl> | anything else the needs to be discussed? 19:51 < jima> | thl: crap. now you're never gonna get out of here. ;) 19:51 < nirik> | anyone have thoughts on the muse/emacs namespace issues? 19:51 < XulChris> | when can we vote for fesco members? 19:51 < XulChris> | sorry if this was already discussed 19:51 < skvidal> | what do people think about multiple maintainers for a single package? 19:51 < skvidal> | either per-branch or just in general? 19:51 < thl> | XulChris, when the voting system is ready 19:51 < thl> | skvidal, we need co-maintainership 19:51 < skvidal> | ie: maintainer1 takes care of fc4 and f3, maintainer2 takes care of fc5 19:51 < che> | skvidal, good idea 19:51 < skvidal> | thl: is there anything stopping it? 19:52 < skvidal> | thl: any roadblocks we need to clear? 19:52 < thl> | skvidal, lack of a proposal how to do it exactly 19:52 < thl> | and support in owners.list 19:52 < thl> | guys, sorry, I have to leave now 19:52 < scop> | just use initial cc in owners.list 19:52 < nirik> | in reguards to emacsen/muse, proposal from jonathan: 19:52 < thl> | warren, can you handle the rest of the meeting please? 19:52 < che> | skvidal, id even say that it should be mandatory to have atleast 2 19:52 < tibbs> | Sponsorship needed for co-maintainers? 19:52 < skvidal> | okay so we need a mutliple-maintainers porposal and owner's list needs to be less crappy 19:52 < jwb> | skvidal, scop and i are already doing it 19:52 < che> | skvidal, what if one goes on holidays? 19:52 < jpo> | warren: can we still access the fedora.us tickets? 19:52 < skvidal> | che: I like holidays 19:53 < jima> | tibbs: err, they're contributors, so i'd think they'd need to be sponsored. 19:53 < che> | skvidal, me too... but what about updates/security patches etc 19:53 < skvidal> | I like holidays 19:53 < jima> | thl: have fun/good luck/whatever. :) 19:53 < jima> | i think everyone likes holidays. 19:53 < warren> | jpo, I'm wanting to archive the fedora.us tickets in static pages at the same URL, I need some help to do this. 19:53 < warren> | hoping noa will help, because he originally setup fedora.us bugzilla =) 19:53 < che> | skvidal, also you got a 4 eyes principle then for new builds 19:53 < che> | skvidal, cant hurt either 19:54 < jpo> | I was trying to find a couple of perl-Net-SSLeay tickets 19:54 * | thl afk now 19:54 < noa> | warren, I'll have a look at that that in a few days 19:54 < ixs> | warren: the bugzilla system is still running? small shellscript with wget and sed should be able to mirror that. Friend of mine did this many months back... 19:54 < jpo> | Help needed? 19:55 < skvidal> | che: I don't disagree - but I think requiring it for every package would be onerous 19:56 < che> | skvidal, well for every small packaged script it would be overhead probably. 19:56 < ixs> | skvidal: not to mention that it would probably mean too much work. 19:56 < che> | skvidal, for complex things -> defnitely. 19:57 < jpo> | warren: mail me if you need help to export the tickets 19:57 < che> | skvidal, also what if someone stops maintaining it... because of time reasons e.g. 19:57 --> | cwickert (Christoph Wickert) has joined #fedora-extras 19:57 < skvidal> | che: then they orphan it 19:57 < warren> | jpo, ok, I'll mail you and noa 19:57 < che> | skvidal, it would take some time for someone else to get into it etc... it would take time to find a new maintainer etc. 19:57 --> | Foolish (Sindre Pedersen Bjordal) has joined #fedora-extras 19:57 < che> | skvidal, yeah... means its hanging around without updates and still gets built... 19:57 < che> | skvidal, dont think thats a really good approach though 19:57 < skvidal> | che: but nevertheless - I'd like to work to remove the roadblocks to multiple pkg owners 19:57 < skvidal> | so I'll see what I can do to get us a proposal and layout for owners.list 19:58 < scop> | can anyone identify those roadblocks? 19:58 < jpo> | warren: another problem 19:58 < jpo> | it is not possible to CC the fedora-security mailing list from bugzilla 19:58 < jwb> | skvidal, scop and i are already doing it 19:58 < che> | skvidal, good luck on it. i basically only see "pro" 19:58 < jwb> | skvidal, so what roadblocks? 19:58 < skvidal> | jwb: making it official 19:58 < warren> | jpo, who has admin access to the list? 19:59 < tibbs> | jpo: I asked about that yesterday on fedora-security-list but haven't seen a response yet. 19:59 < warren> | jpo, the list admin can create a bugzilla account without that admin mail hitting the list. He can read it in the moderation queue. 19:59 < warren> | jpo, only after the account is created can the list be added CC. 19:59 < jpo> | tibbs: I saw the archives a couple of minutes ago 19:59 < jpo> | warren: thks 20:00 < jwb> | thl, as far as the voting system goes... i have yet to hear anything back from Sopwith 20:00 < tibbs> | Anyone interested in writing PHP/PEAR packaging guidelines? 20:00 < jwb> | step 1) don't do it 20:00 * | jwb kids 20:01 < scop> | :) 20:01 < tibbs> | Several modules up for review, but lack of guidelines makes it tough to do a reasonable review. 20:01 * | jima doesn't volunteer 20:01 < XulChris> | php-pear > perl-* ;-) 20:01 < jima> | mainly because i don't especially care for php. :P 20:01 <-- | Anvil has quit (Remote closed the connection) 20:01 < XulChris> | maybe send an email to f-e-l about it? 20:01 < warren> | I move that we close this meeting. 20:01 < jwb> | seconded 20:01 < tibbs> | Nothing for me to add. 20:01 < ixs> | tibbs: php-review is a bitch. I tried doing a review of php-pear-mailparse but gave up as there are way too many different opinions of "ho to do it right"(tm) 20:02 --> | Anvil (Dona Nobis Pacem E Dona Eis Requiem) has joined #fedora-extras 20:02 < abadger1999> | (10:52:27) nirik: in reguards to emacsen/muse, proposal from jonathan: 20:02 < RemiFedora> | hi tibbs, i'm the "remi.collet" who submit this php-pear*.rpm 20:02 < abadger1999> | Did anyone have any comments on this? 20:02 < warren> | Meeting End. 20:02 < nirik> | abadger1999: we can possibly get it on the adgenda for next week? 20:02 < ixs> | tibbs: there are several possible ways of packaging the php stuff, I'd volunteer to work on guidelines if I'm supported by some other people. 20:02 < abadger1999> | nirik: Sounds god. 20:02 < tibbs> | emacsen-* seems distasteful, but I don't see how any proposal could be much better. 20:03 < jima> | ...and so Typo Hour in #fedora-extras begins. 20:03 < tibbs> | ixs: I'm willing to help a bit, but I'm no PHP expert. 20:03 < nirik> | yeah, I think emacsen is the best we can do... 20:03 < cweyl> | ixs: I'll be happy to lend a hand 20:03 < abadger1999> | tibbs: yeah... Debian has an emacsen-common for files shared between xemacs and emacs.... 20:03 < XulChris> | is there a php SIG? 20:03 < ixs> | tibbs: Great. Then I'll just put on the php-expert hat. ;-D 20:03 < ixs> | tibbs: anyone else? 20:03 < jpo> | scop: if you have a couple of minutes could you browse ticket #191351 20:04 < nirik> | of course that doesn't solve the muse issue... since there are potentially 2 other projects called that that could be packaged. 20:04 < nirik> | but it gets the emacsen one out of the way at least. :) 20:04 < scop> | jpo, will take a look tonight 20:04 < ixs> | XulChris: no php sig yet. 20:04 < jpo> | scop: thanks 20:04 --> | blippie (Noa Resare) has joined #fedora-extras 20:05 < scop> | I wonder if the bugzilla component name == srpm name rule is carved in stone 20:05 < ixs> | scop: it's been that way in the past. changing it sounds like a bad idea. 20:05 < ixs> | how else is one supposed to gather the component name from the rpm? 20:06 < ixs> | rpm -qi foo gives you the souce rpm name aka the component. 20:06 < scop> | I was more like thinking there could be both emacs-muse and xemacs-muse components in bugzilla 20:07 < scop> | if people are worried that xemacs-muse users can't find the emacs-muse component 20:07 < |Jef|> | scop: ill let you do that.. if we also have a component for each -devel subpackage too! 20:07 < warren> | We had talked about sub-package names being components in Bugzilla before. 20:07 < warren> | But I don't think it is a good idea. 20:07 < scop> | |Jef|, *I* am not worried about that 20:08 < warren> | |Jef|, each debuginfo package too =) 20:08 < |Jef|> | warren: sweet 20:08 < |Jef|> | warren: i wonder what bugzilla's limit is for component list length? 20:09 < |Jef|> | scop: i think its pretty silly to break that rule for xemacs subpackages... if it doesn't make sense to break that rule more generally 20:09 < scop> | what I find odd is that "emacs-muse" wouldn't work just fine as the component (and SRPM) name, but yet another one, emacsen-muse has to be invented 20:09 < scop> | |Jef|, I agree 20:09 < warren> | |Jef|, I'm not sure we want to make bugzilla go slower than it already does =) 20:10 < |Jef|> | warren: can it? 20:10 < blippie> | no, the low speed limit has been reached 20:10 < warren> | scop, I supported emacs-muse personally. 20:10 < nirik> | the name 'emacs' is kinda overloaded tho... most people think of gnu-emacs then... or at least I do... not the generic emacs term... 20:10 < ixs> | personally, I think emacsen sounds stupid. 20:10 < ixs> | why not name it foomacsfoo-muse. ;-D 20:11 <-- | has quit (Remote closed the connection) 20:13 < tibbs> | ixs: we can just start a wiki page for packaging guidelines. 20:13 < ixs> | tibbs: wiki/extras/PHPPackagingGuidelines 20:14 < ixs> | something like that? 20:14 < tibbs> | Probably wiki/Packaging/PHP to match Packaging/Perl and Packaging/Python 20:15 < ixs> | hmmm. sounds reasonable. 20:17 < ixs> | done 20:17 < RemiFedora> | if i can. I think a great job have already be done on php-* rpm 20:17 --> | che_ (Che Guevara) has joined #fedora-extras 20:18 <-- | che has quit (Nick collision from services.) 20:18 < ixs> | RemiFedora: Your input would be greatly appreciated. Problem is, as I said above, there are way too many opinions on packaging php stuff, as can be seen on your review bugs. 20:18 --- | che_ is now known as che 20:18 < RemiFedora> | On bug 19066, 190252, 183359, 185423 20:19 < RemiFedora> | yes, i agree for the need of a guidelines. Buf for example, the use of /usr/share/pear/.pkgxml is now in the "core" php-pear. 20:22 < scop> | jpo, still here? 20:22 < jpo> | yes 20:22 < scop> | I'm wondering what kind of input are you looking for for the Net-SSLeay issue? 20:23 < dgilmore> | jpo i was wondering that also 20:23 < jpo> | A second opinion 20:24 < jpo> | if I should apply the patch to 1.26 20:24 < tibbs> | Is the patch destabilizing in some way, or does it break compatibility? 20:24 < jpo> | I don't think so (but have to look again) 20:25 < dgilmore> | jpo: do you have a bug# or the patch somewhere? 20:25 < scop> | 20:25 < jpo> | in the FC-5 and devel SRPM 20:27 < dgilmore> | jpo: cool i had only seen the email posted about it to fedora-security 20:28 < jpo> | I will try to ping the current module maintainer about it 20:28 < scop> | so the issue is that if $EGD_PATH is not defined in the environment, SSLeay reads some "entropy" from /tmp/entropy 20:28 <-- | noa has quit ("Leaving") 20:28 --- | blippie is now known as noa 20:28 < scop> | ...which can be created by anyone, thus injecting some known data into the seeding process 20:29 < scop> | ...right? 20:29 < jpo> | yep 20:29 < dgilmore> | scop: thats what it looks like to me 20:30 < scop> | see man RAND_egd (if you have openssl installed) 20:30 --> | Belegdol (Julian Sikorski) has joined #fedora-extras 20:30 < scop> | "On systems without /dev/*random devices providing entropy from the kernel, the EGD entropy gathering daemon can be used to collect entropy." 20:30 < scop> | also openssl FAQ: 20:31 <-- | Belegdol has quit (Read error: 104 (Connection reset by peer)) 20:31 --> | Belegdol (Julian Sikorski) has joined #fedora-extras 20:31 < scop> | "On systems without /dev/urandom and /dev/random, it is a good idea to use the Entropy Gathering Demon (EGD) ..." 20:31 < scop> | so the patch looks innocent enough to me 20:34 < jpo> | I will try to apply it to the FC-3 and FC-4 branches 20:34 < Belegdol> | hi. what rpm targets can be installed in i386 fedora? 20:35 < Belegdol> | i was able to install i686, but unable to install pentium4 20:35 < jpo> | sould I worry about old fedora.us FC-1 and FC-2 branches? 20:35 < jpo> | s/sould/should/ 20:35 < che> | Belegdol, rpm --eval %configure 20:35 < dgilmore> | jpo: looks ok to me the only othere way to do it would be to start the egd daemon with its socket at /tmp/entropy 20:36 < che> | Belegdol, thats what happens if you dont specify a target 20:36 < dgilmore> | jpo: ask warren but i dont think there is anyway to build and get the updates out 20:36 < jpo> | ok 20:36 --> | homeas (Thomas Vander Stichele) has joined #fedora-extras 20:36 < dgilmore> | skvidal: does the extras build system handle fc1 and fc2? 20:37 < scop> | dgilmore, ne 20:37 < skvidal> | nope 20:37 < scop> | s/ne/no/ 20:37 < warren> | jpo, don't worry about FC-1 and FC-2 20:37 < jpo> | thanks. | http://fedoraproject.org/wiki/Extras/SteeringCommittee/Meeting-20060511 | CC-MAIN-2014-42 | refinedweb | 5,484 | 76.25 |
Download presentation
1
Ch 6 Project Analysis Under Certainty
Methods of evaluating projects when the future is assumed to be certain.
2
Ch 6 Project Analysis Under Certainty
Study objectives After studying this chapter the reader should be able to: Use the NPV model to evaluate projects under certainty Apply the net present value, internal rate of return, payback period and accounting rate of return criteria for investment decision- making under certainty Understand the reasons why the NPV criterion is generally the method of choice for project evaluation Apply the NPV criterion for ranking mutually exclusive projects and project retirement and replacement decisions Use the NPV model to evaluate replacement chain decisions.
3
Certainty Assumption Certainty means that although future flows must be forecast or estimated, the estimated amounts will be received at the times they are expected to occur. Certainty makes the decision simple to model, and the outcome easy to accept. Under the assumption of certainty, future cash flows are to be discounted at a rate which represents the time value of money Returns on risky assets such as stock-market investments contain not only a rate for the time value of money but also a component (a risk premium) to compensate for the risk (or uncertainty) of the expected return. Rates of return on ‘risk-free assets’ are expected to reflect only the time value of money.
4
Certainty Assumption For example:
Project Alpha requires an initial outlay of $900, will have cash inflows of $300 in year 1, $400 in year 2 and $600 in year 3. The discount rate is 8% per annum. The calculation is:
5
Certainty Assumption This positive result means that, by undertaking the project, the firm’s wealth will increase by $ Based on the NPV decision rule, the project should be undertaken. We have made several assumptions in formulating and using this NPV model and decision: the amounts of the initial cash outflow and all future cash flows are known with certainty. the discount rate is constant and known with certainty the initial capital outlay occurs at the beginning of year 1 and all operating cash flows occur at year end cash outflows from the firm are treated as negative; cash inflows are treated as positive there are no constraints on the supply of capital, or on other resources the firm will accept all positive NPV projects.
6
Net Present Value. The ideal investment decision making technique is Net Present Value. N P V measures the equivalent present wealth contributed by the investment. NPV is given in NPV -- relates directly to the firm’s goal of wealth maximization -- employs the time value of money -- can be used in all types of investments -- can be adjusted to incorporate risk.
7
Net Present Value. The NPV is calculated by discounting a project’s net cash flows at a specified rate. This rate – often called the discount rate, opportunity cost or cost of capital – refers to the minimum return that must be earned on a project in order to leave the firm’s market value unchanged.
8
Net Present Value. Delta Project
The NPV of this project can be computed by evaluating the cash flows. They begin with the initial outlay of $1,002,000 at EOY 0 and continue until EOY 8, at which time the asset salvage value is included. The NPV computation is:
9
Net Present Value. Delta Project
With this positive NPV, the project is acceptable. We have used the risk-free rate of 5% per annum as the required rate of return here, as the cash flows are assumed to be certain.
10
Other project appraisal methods
While the NPV criterion is the most appropriate method in most cases, the other discounted cash flow technique, the internal rate of return (IRR), is also frequently used, sometimes as a supplementary measure to NPV.
11
Survey Data on CFO Use of Investment Evaluation Techniques
CFO Decision Tools Survey Data on CFO Use of Investment Evaluation Techniques SOURCE: Graham and Harvey, “The Theory and Practice of Finance: Evidence from the Field,” Journal of Financial Economics 61 (2001), pp
12
Other project appraisal methods
Non-discounted cash flow methods such as payback period (PP) and accounting rate of return (ARR) have a number of serious defects but are still being used in practice in some situations. Sometimes PP is used in conjunction with NPV, particularly in making risky investment decisions. It is useful to understand these methods and their drawbacks so that the most appropriate method can be used for investment evaluation.
13
Other Project Evaluation Techniques:
Discounted Cash Flow Techniques Internal Rate of Return – calculates the discount rate that gives the project an NPV of $0. If the IRR is greater than the required rate, the project is accepted. IRR is given as % pa.
14
Internal rate of return Delta Project
Using i to represent the IRR, the equation for the IRR calculation using the same cash flows as employed in the NPV calculation (Table 6.1) is: The solution for i, calculated by the Excel IRR function, is 19.80%. Since this rate is above the required rate of 5%, the project is acceptable
15
Internal rate of return
The IRR remains in use because decision-makers are used to dealing in ‘rates of return’ rather than the more esoteric NPV. The IRR measure is useful for easily comparing the rate of return from the project being considered with various alternative returns.
16
Other Project Evaluation Techniques:
Modified Internal Rate of Return – calculates the discount rate that gives the project an NPV of $0, when future cash flows can be re-invested at the Re-Investment Rate, a rate different from the IRR. If the MIRR is greater that the required rate, the project is accepted. MIRR is given as % pa.
17
Other Project Evaluation Techniques:
Non-Discounted Cash Flow Techniques Accounting Rate of Return- measures the ratio of annual average accounting income to an asset base value. ARR is given as % pa. Accounting income is different from cash flow. = % pa. For example, an outlay of $1,000 may earn $200, $500 and $700 as accounting income over three years. The ARR is calculated as: ARR = [ ( ) / 3] / 1000 = 46.66%
18
Other Project Evaluation Techniques:
Non-Discounted Cash Flow Techniques Accounting Rate of Return Now the merits of an investment project do not depend on how accountants classify the cash flows and few companies these days make investment decisions just on the basis of the Accounting rate of return
19
Other Project Evaluation Techniques:
Payback Period– measures the length of time required to retrieve the initial cash outlay. PB is given as number of years. For example, an outlay of $1,200 may generate cash inflows of $820, $450 and $300 over three years. The total cash inflow to the end of year 2 is $1,270, so the payback period would be within two years. There is no objective time criterion associated with payback, but a period of two to three years would be generally acceptable Payback Period :- Some companies require that the initial outlay on any project should be recoverable within a specified period.
20
Other Project Evaluation Techniques:
Payback Period : There are several problems with this measure: The cash flows are not discounted. As the time value of money is not taken into account, the future cash flows cannot be related to the initial outlay. The data outcome is not a decision variable. It does not relate to the firm’s goal of wealth maximization. There is no objective measure of what constitutes an acceptable payback period. Management may set an arbitrary target of say three years, but this value is not objectively related to the firm’s goal. Cash flows occurring after the payback period are ignored. In the case where large outflows may occur on the termination of the project, such as the cost of rehabilitation of a mine site, a project may be erroneously accepted on the basis of a short payback term. Payback is a very unsophisticated and misleading measure, and it is not recommended as a criterion for accepting or rejecting projects
21
Internal Rate of Return
Example You can purchase a turbo powered machine tool gadget for $4,000. The investment will generate $2,000 and $4,000 in cash flows for two years, respectively. What is the IRR on this investment? 21
22
Internal Rate of Return
Example You can purchase a turbo powered machine tool gadget for $4,000. The investment will generate $2,000 and $4,000 in cash flows for two years, respectively. What is the IRR on this investment? 22
23
Internal Rate of Return
IRR=28% 23
24
Internal Rate of Return
Pitfall 1 - Lending or Borrowing? With some cash flows (as noted below) the NPV of the project increases s the discount rate increases. This is contrary to the normal relationship between NPV and discount rates. 24
25
Internal Rate of Return
Pitfall 2 - Multiple Rates of Return Certain cash flows can generate NPV=0 at two different discount rates. The following cash flow generates NPV=$0 at both IRR% of 8.49% and 31%. Cash Flows (millions of Australian dollars) 25
26
Internal Rate of Return
Pitfall 2 - Multiple Rates of Return Certain cash flows can generate NPV=0 at two different discount rates. The following cash flow generates NPV=$A 3.3 million at both IRR% of (-44%) and +11.6%. Cash Flows (millions of Australian dollars) 26
27
Internal Rate of Return
Pitfall 2 - Multiple Rates of Return Certain cash flows can generate NPV=0 at two different discount rates. The following cash flow generates NPV=$A 3.3 million at both IRR% of (-44%) and +11.6%. NPV 600 IRR=11.6% 300 Discount Rate -30 IRR=-44% -600 27
28
Internal Rate of Return
Pitfall 3 – No Internal Rate of Return It is possible to have a zero IRR and a positive NPV #NUM! -210 455 -270 #NUM! 28
29
Internal Rate of Return
Pitfall 4 - Mutually Exclusive Projects IRR sometimes ignores the magnitude of the project. The following two projects illustrate that problem. 29
30
Internal Rate of Return
Pitfall 4 - Mutually Exclusive Projects 30
31
Internal Rate of Return
Pitfall 5 - Term Structure Assumption We assume that discount rates are stable during the term of the project. This assumption implies that all funds are reinvested at the IRR. This is a false assumption. 31
Similar presentations
© 2019 SlidePlayer.com Inc. | http://slideplayer.com/slide/4582588/ | CC-MAIN-2019-35 | refinedweb | 1,752 | 50.57 |
Is there any way to export an Excel file to a single multi-page TIFF, ie. with each worksheet on a page of the multi-page TIFF?
Hi,<?xml:namespace prefix = o
Thank you for considering Aspose.
Well, your requested feature is not supported at the moment. We have registered your feature requirement in our internal issue tracking system with issue id CELLSNET-13694. We will look into the feasibility of this feature and see if we can support it in our future release.
You may check the following documentation link for Sheet2Image feature and Sheet2ImageByPage feature and see if it fits your need.
Thank You & Best Regards,
Thanks for your reply. I guess I’ll have to use sheetToImage for now, but I’m having trouble getting all the worksheets output to a TIFF. I can get the first worksheet output fine, but the next worksheet throws an exception. I saw example code somewhere for getting all the worksheets in a workbook output to tiff somewhere, but I can’t find it anymore.
I’ve determined that the problem is with Sheet2, I get an error that says “Object reference not set to an instance of an object”
I’ve attached the file that causes the error.
Hi,
Thanks for providing us the template file.
We found your mentioned issue for SheetToImage method.
We will figure it out soon.
Your issue has been logged into our issue tracking system with an issue id: CELLSNET-13787.
Thank you.
Hi,
Please try the fix 4.8.2.3 (attached) with the following code:
Workbook workbook = new Workbook();
workbook.Open(@"F:\FileTemp\new_fangled_spreadsheet.xls");
workbook.Worksheets["Sheet2"].AutoFitRows(true);
workbook.Worksheets["Sheet2"].SheetToImage(@"F:\FileTemp\dest.tiff",true);
If you still have any problem, please feel free to contact us.
Thank you.
The issues you have found earlier (filed as 13787) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
That’s great! Thanks for handling this issue. I’ll test it out as soon as I can. | https://forum.aspose.com/t/export-excel-file-to-multi-page-tiff/141340 | CC-MAIN-2022-33 | refinedweb | 345 | 66.23 |
airfs: A Python library for cloud and remote file Systems¶
airfs brings standard Python I/O to cloud objects by providing:
- Abstract classes of Cloud objects with the complete
io.RawIOBaseand
io.BufferedIOBasestandard interfaces.
- Features equivalent to the standard library (
io,
os,
os.path,
shutil) for seamlessly managing cloud objects and local files.
These functions are source agnostic and always provide the same interface for all files from cloud storage or local file systems.
Buffered cloud objects also support the following features:
- Buffered asynchronous writing of any object size.
- Buffered asynchronous preloading in reading mode.
- Write or read lock depending on memory usage limitation.
- Maximization of bandwidth using parallels connections.
Example of code:
import airfs # Open an object on AWS S3 as text for reading with airfs.open('s3://my_bucket/my_object.txt', 'rt') as file: text = file.read() # Open an object on AWS S3 as binary for writing with airfs.open('s3://my_bucket/my_object.bin', 'wb') as file: file.write(b'binary_data') # Copy file from the local file system to OpenStack Swift airfs.copy( 'my_file', '') # Get size of a file over internet airfs.getsize('') >>> 956
Supported Cloud storage¶
airfs is compatible with the following cloud objects storage services:
- Alibaba Cloud OSS
- Amazon Web Services S3
- Microsoft Azure Blobs Storage
- Microsoft Azure Files Storage
- OpenStack Swift
airfs can also access any publicly accessible file via HTTP/HTTPS (Read only).
Limitations¶
Cloud object storage is not file systems and has the following limitations:
- Cloud objects are not seekable in write mode.
- Cloud objects must be written entirely at once.
- Cloud objects are not locked when accessed.
- The cloud object attributes available are more limited.
User Documentation
Links | https://airfs.readthedocs.io/en/latest/ | CC-MAIN-2020-16 | refinedweb | 275 | 50.12 |
i forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for newcomers.
Show some code. What classes do you have? How are cards dealt?
import java.util.Scanner;
public class Deck {
public static void main(String[] args) {
int deal=(int)(11*Math.random()+1);
Scanner input = new Scanner(System.in);
int player;
int dealer;
// deal two cards to each player
System.out.println(player=deal);
System.out.println(player=deal);
System.out.println(dealer=deal);
System.out.println(dealer=deal);
// variables for when each player is finished hitting
boolean iamdone = false;
boolean dealerDone = false;
String answer;
while(!iamdone || !dealerDone) {
// player's turn
if(!iamdone){
System.out.print("Hit or Stay? (Enter H or S): ");
answer = input.nextLine();
// if the player hits
if(answer.equals("H")) {
// add next card and store whether we've busted
System.out.println(player=deal);
}
else{
iamdone = true;
}
}
// dealer's turn
if(!dealerDone) {
System.out.println("The Dealer hits");
System.out.println(dealer=deal);
}
else {
System.out.println("The Dealer stays");
dealerDone = true;
}
}
}
}
do you have to deal correct cards like 2-10, J, Q, K, A? if so youll need to set the jqka to values and show them as J Q K A and also think about the Ace can be 1 or 11 and you can split with 2 of the same cards...how in depth are you supposed to get with this program?
You do not have to go in depth. I just have to continue dealing numbers to the player and dealer if they hit if they pass 21 it's a bust.
Please post your code correctly. You can edit your post.Please post your code correctly. You can edit your post. | http://www.javaprogrammingforums.com/whats-wrong-my-code/35680-black-jack-dr-java.html | CC-MAIN-2015-48 | refinedweb | 293 | 70.39 |
Hi,
Im creating a screenscraper app that takes a users search term, scrapes
several 3rd party sites and returns the aggregated results after a few
seconds.
Rather than wait for all the sites scraping to be completed before
showing the results, I want to show the results as they are scraped, ie.
when one sites results have been scraped and prepared, they are shown
immediately whilst the next set are being done.
Initially I thought id just make a scraper function like so
def scrape_sites
sites.each do |a_site|
a_sites_results = scrape_and_parse_this_site(a_site)
yield a_sites_results
end
end
Then in my controllers js response I could take the results and render
them
but then i found out htat you cant make multiple render calls in one go.
How do i go about doing this? Does this behaviour have a name like say
“live search” etc | https://www.ruby-forum.com/t/update-page-with-results-as-they-are-scraped/165005 | CC-MAIN-2022-27 | refinedweb | 143 | 76.45 |
Have+. ) — Create multiple insertion points via Ctrl + Alt + Click or add new carets and selections that match the current selection with Shift + Alt + . .
- button to request productivity features you need to code with ease and confidence. We are here to help you upgrade!
Reason 13: The VS2017 Nuget Package Manager will suck away all happiness in the world, and make developers old and grey, so they forget why they even became developers or why they need salary. Please fix this GUI-nightmare. When having 1 project, then it is okay. When having 3 projects then it gets slow. When having 50 projects then it is like having your hand gnawed off. It constantly re-downloads the entire nuget-repository for every change. It constantly recalculates all dependencies for all projects for every change. Ticking / Unticking all projects for a single nuget-package takes forever without actually requested to install the nuget-package.
Hey Rolf,
We have been making consistent improvements to NuGet perf with Visual Studio 2017 and are looking at various scenarios we need to make perf gains. Can you help us by sharing more details? You can either use the Send Feedback option on Visual Studio (see for instructions) or send us an email at feedback@nuget.org with the details.
Thanks!
Should be very easy to reproduce. Just open any solution with more than 10 nuget-packages. It takes forever to display the current nuget packages. It takes forever to show the available updates. The same pattern happens across all solutions and all Visual Studio installations. The first step to make things better would be that it could display all already installed nuget-packages across projects in solution within100 ms and just show the current versions selected in the projects (Without locking the GUI while getting available updates from nuget-sources).
Rolf, if you right click on a solution in solution explorer and select ‘Manage NuGet Packages for Solution…’, you can see the currently installed packages (including version numbers) across all projects in a solution. Is this part of what you were looking for?
Let me guess, your project(s) are source control -enabled? Somehow Nuget starts bombarding TFS with every single dependency check and if you have a lot of nuget references, updating them can easily take like 10 minutes. And somehow the amount of references seem to exponentially increase the amount of these checks. Doing it without being connected to source control or telling nuget not to care about dependencies solves the problem (not saying that you should).
Hi Rolf,
While I am aware that updating NuGet packages across the solution takes some time, I haven’t seen the kind of delays you have mentioned here. It would be great if you can provide us with more info and/or a repro to investigate this further as there might be something specific at play here.
Thanks,
Anand Gaurav
I actually dont have that specific problem. I’ve got a about a dozen 50-150 project solutions using public and private nuget packages from multiple repos and its not blazing, but it updates the larger solutions in 2-3 minutes.
I do have the problem where nuget pm ui will crash VS in the middle of one of those updates and leave my solution and projects only half updated, and by half updated I mean references removed, but not all re-added back. I end up spending a few hours fixing that because there are other changes pending and I cant just revert to latest.
Do you have the problem where it adds app.config files to every project?
Or the one where it marks files as pending edits but it does nothing to them?
Or the one where it reformats entire .config files but didn’t need to add an assembly binding redirect?
Or the one where it cant get along with MSTest and makes MSTest silently skip tests?
Or the one where you depend on install.ps1 to cover a gap in nuget’s installation process, or you need to create nuget packages with modifiable content like css or T4, or you want to apply an xdt config transform to add a WCF behavior, only to find those things are all not available with package reference?
Or the one where nuget pack changes the version number you specifically put on the package? And a specific nuget team member sees that although 20 people complain on a thread about it, and instead of recognizing it as something that was recently broken and needs to be fixed effectively says “if you want it fixed, fix it yourself”.
Or the one where the same nuget team member decides they cannot be bothered to read a thread in another MSFT GH repo to get the repro info needed, and instead demands the user re-enter all the data in the current repo?
You have every right to complain and should, but I would take slow and correct over any of the problems I have with nuget.
Yes, there are some good new features. Unfortunately, the quality and performance is worse than in VS 2015. The new update policy keeps our developer live thrilling – you never know what the latest update broke this time. There is no way to get back. Quite a lot time needs to be spend finding workarounds for all the VS 2017 bugs :-(.
Hey Mike — Can you please use the Send Feedback icon in Visual Studio to share your quality and performance issues? You can find instructions here:. Thanks!
Kasey, you cannot be serious. Developer community is even more frustrating than VS itself.
exactly but it’s way less embarrassing, they want to pretend it’s all great and anyone struggling with
all the bugs must be and anomaly , I’m surprised they haven’t closed comments on this thread yet, if I had an easy way to take my millions of lines of code and many years of effort elsewhere I do it in a heartbeat, it’s would take to an all out war on the incompetence , but it’s never going to happen, the entrenched politically correct and “very nice” yet clueless management isn’t going anywhere, @ M$ everything is awesome, everyone is so nice, UWP is the future, resistance is futile. one of the vunderkids made a post a while back about the GREAT NEW UWP designer and had the audacity to say when it’s mature they will polyfill WPF support, ROLF, can you imagine awesome that going to be? , I’m sure they will be very excited when they it’s released to manufacturing, maybe they can even have a 36 hr hackfest to celebrate!
> I’m surprised they haven’t closed comments on this thread yet,
The ones that kill me are when folks with fancy titles like Principal Program Manager post about how great VS 15.x preview is going to be, but that never open the comments to begin with. They have to know it will be a justified flame session.
I just dont get why they wont acknowledge its been awful for so many, apologize (optional). and address the problems so we can all move on. Instead they keep adding more features (with bugs) and dont go back to fix the existing bugs. I dont have need for most of the new features, There is ~10MM LOC of .net full framework code I need to be able to support for the next 10 years – and I need the bugs in netfx and its tooling to be fixed for that duration. (Industrial/pharmaceutical customers will try to stretch that to 20+ years to save on regulatory related costs)
I agree completely. I’ve used VS since the version 6.0 in 1998, and used every version since. I’ve always loved using VS. VS 2017 has had more bugs than 2012, 2013 and 2015 combined. Most of the major updates to 2017 (.1.0, .2.0, .3.0, etc.) had some severe breaking of things. I’m personally on 2017 release 15.5.6 and scared to go to the latest update because I just don’t have time right now to deal with any horrific bugs.
It has some neat things, bug quality has gone way down.
And just as bad, is the closing of bugs in the Devcommunity site with this answer: “low priority: we don’t have time to fix this right now.” What a horrible answer.
Hi @Dean J., I’m really sorry to hear that you’ve had so many issues or bugs with VS2017 through the updates, especially if these are ‘severely breaking’ you. I’d like to try and follow up on these with you, if possible to see if these are known issues we are looking at, or that they have been addressed or are being resolved by the teams here. My email alias at microsoft.com is simoncal, and I’d love to get some specifics from you. Best regards.
Preview versions can be installed side-by-side, giving you a way to test new versions before updating your normal version.
Here’s one reason not to upgrade, SSDT SSIS is broken in VS2017. From installation woes to packages getting corrupted. We’ll be skipping VS2017 where I work due to this. Hopefully VS2019 will work better and we can upgrade to that instead, but until VS2019 has had a few months to prove that SSIS works consistently we’ll hold off on that upgrade too.
Hi, can you help us by sharing the details of the specific issues you have encountered? You can report the issue following this link:.
Agree here. Every time I do a version update to VS2017, it breaks SSDT, forcing me to reinstall it. The full version SSDT installer does not work with VS2017 so, you need to install the pieces in a particular order (This is a blog documented process) one at a time and remove things like Analysis services and Reporting services, even though they are reinstalled with an upgrade.
Another reason. Who pays for it? The company I work for will not upgrade development software unless we have a contract that pays for it. Until 3 years ago, we were still using VS2005 and 2008. Then we got VS2013 in a contract. We do not qualify to use the community edition of anything. It’s the nature of our business. So, no negative comments please.
For what it’s worth, I believe they fixed that finally with the latest SSDT releases, around 15.7.2. Check on the thread here:
That said, we’re still sticking on VS 2015 for now specifically because of these problems. I’m hoping we’ll move to VSTS and VS2017 next year.
The new features in VS2017 are quite nice, but fast it isn’t. It may well be that the solutions load faster, but this is useful only when I have to restart VS due to its background processes consuming gigabytes of memory or hanging. On the other hand, the editor itself is at times so slow that it’s confusing to type in… Possibly because of intellisense which is also slower – and buggier (misses some possible suggestions, usually the ones in the same namespace as the source I’m typing in). Also, it’s much easier to confuse the syntax highlighting (painting most of your source in red squiggles if you mismatch your parentheses) than in VS2015. And so on… To conclude, it would be very nice if the quality of VS2017 was improved – and it should have been much higher after seven updates – instead of optimizing solution load. Just get it to work right and the management won’t need so much convincing.
Hey @bdrajer — Can you please use the Send Feedback icon in Visual Studio to capture your specific problems and performance traces? You can find instructions here:. Thanks, we appreciate your feedback and help!
The most difficult argument when convincing the managers is that it’s safe to upgrade – to assure them that no part of the 50.000-line-of-code, 1 mil $ project will no break after re-compiling the code with the new compiler version bundled with the new VS version, and that no breaking changes stay hidden in the new .NET version that also happens to come with the new VS version (especially since MS abandoned side-by-side deployments for full .NET Framework in GAC).
Giving a time and money estimate for handling all these risks and running the regression tests across the entire product, this is the most difficult, not convincing them that there are shiny new features. 🙂
What makes running regression tests difficult?
I can’t even convince myself to try it again after the last debacle, the only positive thing I can say Is
At least your taking comments again, the “closed for comment” posts make it impossible to find out if
safe for full time use, the cognitive dissonance on the part of the VS is concerning and make long term planning difficult
to say the least , not to mention post like the one stating that the WPF design will be UWP based in the future, all the
other relevant Eco-systems are evolving whist VS/.Net remains in a state of MS induced chaos after years of the
failed Metro/Modern/Store/Xamarin/Core focused strategy, the title of the post would be humorous and probably is to our competition
for the rest of us it’s indication of the sad sad state of affairs .Net/VS world.
Sure. Do this if you want to lose your job. VS 2017 is by far the least stable, and most problematic release of VS ever, with (at a point) too many intrusive updates, with regressions.
The feedback forum is a joke – because they reject all the issues they cannot reproduce with some simple sample code solution with projects created for the first time. After all these years in product development, these companies do not even know how to reproduce an issue from a customer. We have to “talk” to people who have no technical skills when we log these issues. By now, one would have thought we would have developed tools to automatically get telemetry from a machine which has a customer reported VS issue. Turn this flag on, just keep working and whenever the problem happens, press a button and we will auto send the telemetry to MS. Instead… we are still living in the stone ages, because nobody cares anymore – they get their salary, create 100x new features which PM tells them to do. Why bother with things like getting telemetry when your product is iterating faster than you are capable of iterating it? These people then hire more people like themselves, and after 20 years, you wonder how it got this way.
They remove important features from “enterprise” cloud products like Service Fabric without informing anyone – out of the blue – come to the office in the morning, update and see that you cannot create a project within SF you could do the day before.
What a joke! I have been using Visual Studio since 1998 – that version back then when the first few versions of VS were released were the best, most stable and reliable. It all went downhill I think since 2010.
Nobody should upgrade to this version of VS. Use the one before this, atleast it does not crash and burn like this one all the time.
On a side note, this comments feature does not work on the Edge Browser, which MS keeps nagging users to use on Windows.
Hey Vijay,
Can you elaborate on what you mean by “this comments feature does not work on the Edge Browser”?
Hi Vijay,
As you might already know, reporting feedback from Visual Studio comes with the ability to record repro and automatically include collected logs. I’m including a couple of links for convenient reference. We are definitely looking for ways to make it easier to include more relevant data with feedback. It will help even further if you are able to share specific cases where the feedback process could have served your needs better. Please reach out to me directly at seiyer at microsoft dot com. We are committed to improving feedback experience and making it productive. Thanks for sharing your thoughts.
Our team was using VS 2015 earlier for a LOB UWP app and had to switch to VS 2017 to use the newer UWP features. Here’s what happened after we switched to VS 2017:
1. Our solution build time went from approx. 1 minute to over 2 minutes. I have detailed procmon.exe logs if anyone from Microsoft is interested to look into this.
2. VS 2017 randomly crashes while typing, restarts automatically and then asks if I want to restore the files I was working on !
3. XAML designer is so unstable that all of us disabled the XAML designer. Instead, we run the app and make changes in the XAML to see how it looks. This mostly works fine when VS 2017 is in a good mood, otherwise not.
4. VS 2017 freezes randomly and shows the finger icon !
5. Copy/paste keyboard shortcut randomly stops working. Then, I have to do copy/paste using the mouse right click context menu.
6. VS 2017 memory usage goes from under 1 GB to over 2.5 GB in a couple of hours and becomes very slow.
7. Sometimes VS 2017 shows a message that “some advanced features are disabled to improve performance”, but is still slow anyway.
Even when I filed a bug report, the response was that the issue could not be reproduced and eventually the ticket was closed.
The only advantage with VS 2017 is getting to use the newer UWP SDKs and also the newer C# 7 language features.
So I would really recommend anyone who has to use VS 2017 to stick with VS 2015 if possible and spare the trouble.
Hi Koshy,
Which UWP features did you need that required you to upgrade to visual Studio 2017?
For the logs, can you please share with me at dajaco at Microsoft dot com? I’d also love to follow up with you on XAML designer stability related issues.
Sincerely,
Daniel
I just made the mistake of upgrading my Visual Studio 2017 to 15.7.6. Now none of my XAML will work in the designer. Previously it all worked. What happened. Why did you kill the Designer? On all of the 10+ XAML files that I have tried, I get “The XAML Designer has exited unexpectedly.” This is not helpful.
Can I go back?
There is a setting in Tools -> Options to disable/enable the designer. You may want to toggle it off, close and reopen VS, and try toggling it on again. Or run a repair installation. I had to do the latter when every web form designer I opened did the same.
Also if you use R#, it will mess with your XAML settings. Try disabling it if you have it.
Thank you for the help. disable/enable of Designer did not help but the Repair fixed the problem. I have a Designer once again.
Hi Dick,
I’m really curious to understand how you got into the state where the XAML designer stopped working. Could you reach out to me at dajaco at Microsoft dot com so we can dig a little deeper into this issue?
Thanks,
Daniel
I had the same problem. what can I do?
if someone using VS 2017 mistakenly migrate to package-reference it means they broke the whole project, now only VS 2017 people can use it.
Xamarin team sitting at microsoft (or maybe it’s VS team) are not going to help anything. They just say “give me money, we are developer”, On the another side I never pay a single coin for android studio and it’s work awesome (with hot reload on state).
Where are Microsoft think they are going ?
ASP.NET MVC to Core, No thanks I will better made it in React and node.js
Bot framework, There is plenty of alternative, Luis doesn’t support Hindi, just check github repoistory, LUIS become a joke if you are not using it in English.
Blazor (naah, it’s in development)
Xamarin, running xamarin like hogging my machine (sound like I am testing processsor for IO, CPU) Load, Same time React native and flutter run smoonthly.
Making thing open source was a clever move, but there is better tooling come from outside Microsoft. God know when Microsoft kill thing, Xna, SL, Webmatrix and many other are great example.
Even yesterday I was reading about terrible windows update. I was the person who install the update and I see how much creativity microsoft put in making people’s life terrible.
If you are serious, Just open Dev essential, I have reported a bug at the time of VS 2017 RC. It’s still in green (pending for release). Few days ago I say what is about that on Github, We will make it release in 2019.
very good, I know other company does same but there is something called community and source is all open source internet. Maybe I should call it
partially open sourced or totally open sourced. I am using Microsoft think from almost decade but when I using Microsoft tooling , tooling eat all the learning curve and all we seen people doing drag and drop.
and a nice joke, Hey john, my xamarin project is not working, Did you tried re-installing nuget package ?, Oh yeah, it’s working, thanks
Is this not look creepy. Making thing more complicate is opposite of what Apple CEO say. Breaking thing every day, Just look at the bottom of page, someone saying I just broke my XAML debugger after upgrading to 15.7.6
re: the Xamarin issue resolved by reinstalling the NuGet package, that’s very interesting. We have been working on improving the experience of updating/installing Xamarin NuGets and building. Please help us isolate this issue if this occurs again by using the VS Feedback tool to send us a report that we can dig in to. Thanks!
I would recommend everyone who is fed up of VS 2017 and forced to use it daily at work to write an email to the CEO of Microsoft (Satya Nadella) so that he is aware of how bad the quality of the Visual Studio product has degraded. There needs to be more accountability from Microsoft for a paid product like Visual Studio and the team should be answerable to the developers who have to work everyday with this terrible software product. Is there a QA team at Microsoft who tested VS 2017 before releasing it ? Is anyone looking at the hundreds of complaints about VS 2017 that are posted by developers ?
We have upgraded Visual Studio to the next major version about the time the next major version is released, making our projects 1 major version behind at all times.
Trending with the versions over the last 10 years since 2010, I’ve reduced the tools in VS and add-ons I use due to the breakage, bugs, slow editor, etc.
We skipped Silverlight, Lightswitch, UWP, Metro and mobile JavaScript in a browser control technologies because of the high likely hood that they will last 2 to 3 years and then be abandoned by MS (Silverlight).
Our current practice is to install a minimal set of NuGet packages for the same reason; namely that over 3 years in the future, quite a few of them will be abandoned or have unfixed critical bugs.
It may require a bit more code, though no-one has made a decent business case that library X will save more time in initial production development and the first 5 years of production.
Cloud is good, we host basic asp.net MVC c# front-end web sites and c# webAPI sites connecting to a cloud hosted SQL Server. We do not do more in the cloud for the technology longevity risk.
Focusing on only the first developer to work on a project and not the cost/effort for post production maintenance is less than helpful.
JohnP, you almost don’t need to make the comment, I never bought into such
regressive thinking myself, until now that is, beginning to wonder if anyone at Dev Div will
ever create anything useful again, UWP can KMA
@JohnP,
Recently in build 2018, Microsoft was in a way too hurry to release 15.7, 15.6 got too many preview and than released. in 15.7 after 4 preview it’s got in public (maybe to show fake glory of VS 2017 15.7) goes in public with the bugs that I was reported from last few day(s).
I have wasted my time reporting bugs and hearing we are working on it, God know what’s going on, In my last comment I am saying I have hold thing from 2017 RC. Now 2019 RC will come in few days. 700 days are much for fixing a release.
forget SL, Let’s talk about Windows phone.
John, Hey andrew I have windows phone 7, I am interested in Windows phone development,
Andew : Buddy, you can’t do that, you need windows 8 and windows 8 phone.
John: Oh Andrew I bought a windows 8 phone, now can we got started.
Andrew : Sorry, Microsoft released windows 10 , you need windows 10.
John, Andrew, See I bought a windows 10 phone, Can we develop windows phone apps now.
Andrew, Sorry again, Microsoft is killed windows phone 10, It’s not supported in 2017 as it’s not exist anymore.
John, Andrew, What do you suggest now ?
Andrew, We can go with xamarin.
John, Are development going ok with xamarin.
Andrew: I wish we go with flutter or react native.
This is the problem with Microsoft, I have revamp 20+ apps in winforms and 1 in WPF (working 6 days in office and 7th in home) in last few month with writing bugs to Microsoft, If I spent my time writing s*** on internet I may become Microsoft MVP. I am not blaming the MVP now, no! I am talking about Quality.
I can throw my Android studio and able to write the app that support android 2.2, I have some tablet that is 7-8 years old and have some HW parts working in it, It can be still used for something but Windows phone, God know Where is Microsoft going.
I was once bought Lumia 520, fixing a little button cost me 10$, I was sitting at the shop and few days ago Microsoft acquire Nokia, The guard say something to everyone, I don’t clearly remembered but it’s totally stupid to charge someone 10$ for a small thing. fixing a android phone ( for parts) cost less than WP. again I am not blaming WP but what Microsoft did is pathetic.
As you can guess from both comment, Like WP god knows when Microsoft shut down UWP, Where is the fluent design?, I have used Material design for web and android but I never seen someone talking about Microsoft fluent for using it in simple html,css website.
you’ve got it all wrong, PWA /.core/UWP/XAML Standard, XAML and the Web, the way they
where really always meant to be (sound of hip hop inspire background music begins to swell
as the stage goes dark , except a lone spotlight on The Man Himself Tech God Joe Belfoire,
he begins on a hush almost somber tone , as the stage begin to lighten,
“it’s a new day
now all your dreams of world domination can come true
and with turbo holographic AI now you can just tell Contana what your app is and Machine learning Azure
Kubernetees Goodness will write /test and deploy your app to the store, so fast, build times in the nanoseconds, write once run everywhere is yesterdays new, welcome to the bold bold bold new
world, we are soooooooooo excited, we can’t what to see all the magical thing you will
do with it!”
the Build fanishpere erupts in a cheer, “Developers!,Developers!,Developers!”
Mature software management for a long lived product like VS should include the following in each release
– Adding new features
– Fixing bugs
– Removing features
Removing features has been left off. Therefore, slow, buggy, bloated product with lots of unused features
Please post usage metrics on VS features especially the less used ones.
Duplicate Line sounds as frustrating as copying and pasting blank lines is. Ctrl+D seems like a good idea for mnemonic shortcut, but Ctrl+D is too close to Ctrl + S or (Ctrl+K, Ctrl + D) for reformatting a document. Isn’t copy paste coding supposed to be “bad”?
Quite a bit “borrowed” from R#.
How great would it be if it didn’t take 10 minutes to load debugging symbols after you hit F5? That would be so great.
Hi Maud, I would like to investigate by it is taking 10 minutes to load debugging symbols for you. Can you email me at vssolutionload at microsoft dot com?
Buy new version? What for? I don’t know the world where are you living, but in my world less and less projects are started on .NET stack, and one of the reasons is monstrous tooling which costs $$ every 2-3 years, while there are great platforms with great community which free IDEs which works faster.
Hi @AK, I understand your comments about costs and performance speed. I’m curious of your thoughts about whether you’ve considered Visual Studio 2017 Community (a free IDE for students, open source or individual developers), that also allows you to target other stacks, or perhaps Visual Studio Code too? Are these tools not applicable for you or your app app types?
Wow, there are some very down comments here. That’s understandable – Engineers are very detail-oriented folks, and if something specific doesn’t work just as specified, it keeps them from doing their jobs. The smallest things cause utter failure. The devil is in the details.
I don’t have too much negative to say, though… We have significant portion of a million lines of code in C++ projects and solutions, and if I’m being honest Visual Studio, including the latest 2017, has been pretty good to us in developing it. When VS updates come out we do rebuilds and basic testing in VMs to verify that we can take the updates, and looking back we’ve been able to take almost every update offered. I like that we have the option to choose whether and when to update. Don’t ever think that “automatic” updates would be acceptable.
Sure, there have been a few VS bugs but having reported those that are important to us then seeing them fixed in a later release it seems to me the process largely works. That being said, one thing I’ve found frustrating is that the VS developers at Microsoft seem to want to be handed a cut and dried solution showing off the bug. I’ve done that a few times, but you have to understand it’s not trivial to make up something like that. I believe the VS developers should be encouraged to work a little harder when a problem is reported. That would go a long way toward earning respect from the problem submitters. Many of us engineers have good, well setup computer systems that run for months without faults; please take our reports seriously.
My one big piece of advice to Microsoft: Slow down! Churning through version after version at breakneck speed means that things never seem to get stabilized. Remember, you’re not producing an end-user application here, you’re producing a TOOL to be used by people to produce applications, and it needs to work perfectly. Not only that, but you need to be able to build your new versions on a solid foundation. Drawing a parallel between being a good software engineer and, say, being a good machinist, weekly releases of Visual Studio would be like loosening the bolts and replacing parts, throwing the alignment of the lathe out of whack constantly. A machinist trying to work in that environment would never manage to get anything done right. QUALITY, not quantity, is going to win the long game.
> Sure, there have been a few VS bugs but having reported those that are important to us then seeing them fixed in a later release it seems to me the process largely works.
@Noel – Before my developer community account was suspended about 6 months ago*, I had logged close to 225 issues since Dec 2016**. Out of those issues, only 54 were closed satisfactorily, out of those closures, 12 were questionable but I didn’t feel like arguing over. That puts the Satisfactory Closure Rate between 18% and 24% which I think you would agree is not the hallmark of a process that is largely working. The rest of what you said is spot on about the repro cases () and the tool vendor analogy.
*I had used the acronym for “Work Time Fun” (or its more common variation) as a tag in the title of issues like this one to flag the ridiculously awful handling of those issues, but I’m not above suspecting that suspending my account was just the fastest way to rid MSFT of a bunch of bugs.
** Despite the suspension, I can still record issues and interact on them using the feedback reporting tool or crafting HTTP Posts w/ fiddler, but the issues no longer get linked to my followed items list so I cant run my report against them to follow up or manage them anymore. I have opened about 50 more issues in this intervening 6 months and the SCR has sadly only decreased.
Hi Noel,
Thanks for sharing your positive experience around upgrading to newer versions. I was happy to see that. Regarding repro, it will help even further if you are able to share specific instances when it was not trivial. Please reach out to me directly at seiyer at Microsoft dot com and we look forward to learning from those instances and making the feedback experience better going forward.
I left VS2017 for VSCode and never to return. That’s actually “Faster than ever”. I won’t develop a Xamarin application ever again. I switched to PWA’s, instead.
Hi Moreno,
PWA’s can get you really far, quickly, and VS Code is great. I’m glad to hear you’ve found that combination working well for you.
I’m curious to learn more about your Xamarin experience. If you have a moment to help us improve the product, please shoot me an email david.ortinau@microsoft.com.
I think this is nice design language comparison between the operating systems. See how the new Android is the best? It is very clean but still use colors. W10 is a good second, but has some ugly details like those silly strong borders on search box
Nice roll-up article 👍, thanks!
So many features in VS 😊
@VS Team – keep up the good work 🚀!!
Thanks for the feedback Mike – glad to hear it! 😃
Thank for your solution sharing, I’m done ! Keep going up.
Hi All,
I really want to see the code & design of their applications (if possible) who are criticizing Visual Studio and Microsoft. I am just thinking how much an individual is technically sound who is commenting so badly on Microsoft’s iconic product.
There is always way to overcome the every single problem. Ex – If the solution is not loading for 50 projects then better you split the projects into multiple solution files, do we need to work on all 50 projects in the same solution on daily basis ? Mad person !!
I am using Visual Studio from VB 6 onwards, I am very much happy with the Visual Studio IDE & Dot Net framework. It is super easy to design screen, write and debug code. Great technology like MVC, Entity Framework, LINQ, etc and Asp.net core is even great. Over period of time things will change, improve, new things will come. As part of this few things will break which is acceptable to some extent. Why I respect so much Visual Studio because, I find it easy, robust, intelligent. I have seen other IDE also (Swift), really struggled to design simple UI.
VS Team, don’t get demotivated by such kind of comments. You guys are great and keep doing good work..
Thank you.
If you were a carpenter and bought your tools from the same tool store all of your life, and then the hammers started snapping off at the head and screws disintegrated at random times, would you expect that to be addressed?
Would you be upset when the shopkeeper ignored your complaint in favor of a newer potential customer, that is only making a purchase so they can use the restroom?
Would you be angry when the shopkeeper pretends like there isnt even a problem?
Microsoft is a program authoring tool vendor. Its not about who can make a better program, its about buying a tool that no longer does the job expected of it.
> If the solution is not loading for 50 projects then better you split the projects into multiple solution files, do we need to work on all 50 projects in the same solution on daily basis ? Mad person !!
50 projects is a moderate sized solution. I have a few that sized for different products or customer projects, and one in that was 200+ that I’ve trimmed to ~ 150. VS 2015 had no issues with loading any of these. VS 2017 has been fine in regards to solution loading since Lightweight solution load was removed.
If you haven’t had to have that much in a single solution, you really arent using enough of the program to see both its best parts as well as the warts.
Kid, before you call others mad persons, you better stop calling Swift am IDE and change from your freebie VS to an Enterprise license.
Thank you for the positive feedback, glad to hear the tools and frameworks are working well for you.
I wish the Visual Studio debugger would let me view variable values in both decimal and hexadecimal simultaneously. When I compute the value of a variable which will serve as an index into a large array, I want to see it in decimal. But occasionally, I store byte values into an array which themselves will be used to index into another array. So I need to dereference the first array and then use the stored value to index into the other array. In that instance, I want to see hex values in the first array. Having to turn hex representation on and off is an annoyance.
Another thing: I often find that when I have a breakpoint set, then I remove it by hitting F9, Visual Studio fails to persist that choice for subsequent invocations of the program. Even when I specify File\Save All, I often find that the breakpoint remains set.
Thanks for your feedback Robert. Can you please share your idea about showing a variable’s decimal and hexadecimal forms simultaneously at the Visual Studio User Voice site ()? To address your second issue regarding breakpoints, can you please post your concern at the Developer Community site ()?
Dang! I’m just switching computers, and I thought it would be a good time to upgrade from VS2015 to VS2017. What am I getting myself into?
I’ve been using Visual Studio since 1997, going through VS6, VS2010, VS2015. It’s been pretty reliable, only locking up a couple of times in twenty years. I manage and develop a 500 KLOC C++ old school Win32 “Petzold” style app. I’d rather focus on new features for customers, than new technology.
I can’t seem to get the user-defined Intellisense to work.
If I ever have to convert, there is a long list of technologies I will consider before UWP (Qt, Javascript).
I do want to say in fairness that VS has always been a rock-solid app. It’s my home, it’s where I live, it’s been my companion for twenty years. It’s how I feed my family. Long live VS.
@Sprezzatura, you mentioned that you’re having an issue with IntelliSense in VS 2017? Can you give us a few more details on what is the issue you’re seeing? Please follow up at mluparu at Microsoft dot com
Btw, this blogpost has a series of tips how to diagnose the issue: but if the issue you’re seeing is a new one, this is likely something we would want to investigate asap.
thanks,
Marian
Shiny Glitter Blah. I actually didn’t read past: “””
May be that the setup is usable when I want to install it fresh on my personal machine over the internet. But we needed to automatically deploy it to 30 developer machines, and that was *way* more hassle than it should have been. And if something is broken, good luck fixing it, my VS2017 Setup was just hanging and hanging forever on several attempts to do a repair, apparently trying to download gobs of data again.
Why you make the offline install for a professional developer tool such a hassle is really beyond me.
As usual, the comments section is more informative than the actual post.
If there is one single thing wrong with the XAML designer (as there appears to have been in every single “version” of VS 2017), then upgrading is a non-starter. I need a stable XAML designer or I cannot get work done.
What’s with all the versions of the Windows 10 SDK? I assume these map to all the useless updates that MS keeps pushing out which just infuriate my users. Computerworld did a survey on user satisfaction with W10. The comments are most illuminating.
At this point, I’ve given up on VS 2017, and am hoping there will be better news with VS 2019.
Each version of the Windows 10 SDK installs a different Candy Crush game.
Hi ThirtyYearsAnMsDeveloper,
Do you have any more specifics on the issues with the XAML designer that you have been encountering? I’d love to take a look and understand which issues you’ve been encountering.
Each new Windows 10 SDK maps to a new update to the Windows 10 OS – it comes with new APIs and features available to developers that are new in each release.
Sincerely,
Daniel
Hi Daniel
What about this:
Hundreds of entries, most of them “closed – lower priority” or “closed – not enough information”
And the existence of a plugin is Visual Studio Market place solely to kill XAML designer process without restarting Visual Studio is also telling something:
Daniel,
I installed latest VS 2017 today into a VM running a clean version of Windows 7, and opened one of my current projects, and played around with it. Here’s what happened:
1) At first the designer complained about any element, for example a Window: “Window is not supported in WPF project”. This went away after a while.
2) I opened the toolbox to drop something onto the page, and got the warning: “The Visual C++ Resource Editor Package did not load correctly”.
3) I could not search in the property page (this is actually a bug from VS 2015 that I was really hoping you would have fixed by now).
4) The designer crashed:
System.NullReferenceException
Object reference not set to an instance of an object.
at Microsoft.VisualStudio.DesignTools.Designer.Metadata.MetadataStore.GetTypeConverter(Type type)
at Microsoft.VisualStudio.DesignTools.WpfDesigner.Metadata.WpfDesignTimeProperties.RegisterProperty(IPropertyId neutralPropertyKey, IType declaringType, FrameworkPropertyMetadataOptions options, PropertyChangedCallback callback)
at Microsoft.VisualStudio.DesignTools.WpfDesigner.Metadata.WpfCommonDesignTimeProperties.Initialize(WpfDesignTimeProperties designTimeProperties)
at Microsoft.VisualStudio.DesignTools.WpfDesigner.Metadata.WpfDesignTimeProperties..ctor(RuntimePlatformMetadata platformMetadata)
at Microsoft.VisualStudio.DesignTools.WpfDesigner.Metadata.WpfPlatformMetadata.Initialize()
at Microsoft.VisualStudio.DesignTools.WpfDesigner.WpfPlatform.get_Metadata()
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Metadata.XamlProjectMetadata..ctor(XamlProjectContext projectContext, ProjectAssemblyResolver projectAssemblyResolver, IUnbuiltTypeDescriptionProvider unbuiltTypeDescriptionProvider)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Documents.XamlProjectContext.CreateRuntimeProjectMetadata()
at Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextBase.InitializeProject()
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Documents.XamlProjectContext.InitializeProject()
at Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextBase.Initialize(IHostProject project, Action cancelCallback)
at Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextManager.GetProjectContext(IHostProject project, IPlatform platform, Boolean create)
at Microsoft.VisualStudio.DesignTools.Designer.Documents.Project.ProjectContextManager.d__94.MoveNext()
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Commands.ReplaceStyleTemplateCommand.ResolveDefaultStyle(SceneNode targetElement, Object defaultStyleKey, Boolean allowDefaultStyle, DocumentNode& currentStyle, Boolean& isThemeStyle, IList`1& auxiliaryResources)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Commands.ReplaceStyleTemplateCommand.ProvideCurrentStyle(SceneNode targetElement, IType targetType, PropertyReference targetPropertyReference, Boolean allowDefaultStyle, IList`1& auxiliaryResources)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Commands.EditCopyOfStyleCommand.get_IsEnabled()
at Microsoft.VisualStudio.DesignTools.Utility.Commands.Command.GetProperty(String propertyName, Object defaultValue)
at Microsoft.VisualStudio.DesignTools.XamlDesigner.Commands.ReplaceStyleTemplateCommand.GetProperty(String propertyName)
at Microsoft.VisualStudio.DesignTools.Utility.Commands.CommandTarget.c__DisplayClass21_0.b__0()
at Microsoft.VisualStudio.DesignTools.Utility.ProtectionZone.DummyProtectionZone.Execute[T](Func`1 func)
at Microsoft.VisualStudio.DesignTools.Utility.Commands.CommandTarget.GetCommandProperty(String commandName, String propertyName)
at Microsoft.VisualStudio.DesignTools.Designer.Views.SceneView.UpdateCommandState(IEnumerable`1 commandNames, Boolean forceRefresh)
at Microsoft.VisualStudio.DesignTools.Designer.Views.SceneView.SelectionManager_LateActiveSceneUpdatePhase(Object sender, SceneUpdatePhaseEventArgs args)
at Microsoft.VisualStudio.DesignTools.Designer.ViewModel.SceneUpdatePhaseEventHandler.Invoke(Object sender, SceneUpdatePhaseEventArgs e)
at Microsoft.VisualStudio.DesignTools.Designer.ViewModel.Selection.SelectionManager.FireLateActiveSceneUpdatePhase(SceneUpdatePhaseEventArgs args)
at Microsoft.VisualStudio.DesignTools.Designer.Views.SceneViewUpdateScheduleTask.UpdateLate()
at Microsoft.VisualStudio.DesignTools.Utility.Scheduler.ScheduleTask.Update()
at Microsoft.VisualStudio.DesignTools.Utility.Scheduler.SchedulingService.DispatchTasksAtPriority(DispatcherPriority priority)
at Microsoft.VisualStudio.DesignTools.Utility.Scheduler.SchedulingService.DispatcherToken.Dispatch(Object arg).Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess.RunApplication()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess.c__DisplayClass3_0.b_()
My entire evaluation has lasted less than 20 minutes.
If you want convince us to upgrade >300 dev seats, lets start with the basics:
Provide a usable installer to deploy VS automated to hundreds of machines. The existing one is a mess and we gave up after 3 days of trying to get a fully automated offline installation using /layout et al. Yes, we reported it, yes its on user voice, and no, MSFT does not care.
TEST YOUR STUFF before shipping it. And I’m not talking about running some artificial unit tests to have pretty green colors in your dashboards. I’m talking about actually using the XAML designer and see it crashing all the times. I’m talking about using the C++ debugger and see it blocking for 5 seconds after hitting F5. I’m talking about 15.7.5 introducing C++ compiler optimization bugs causing obscure crashes. I’m talking about using the Forms Designer on a highDPI screen and not only having it’s UI falling apart, but also messing up generated C# code with wrong UI element sizes.
We don’t have the budgets to pay our devs to use uncountable hours the fiddle with VS instead of getting actual work done. The install updates every 10 day and figure out what broke this time. And especially not to find and report bugs in your expensive VS product on our expense.
I’d gladly switch to 2017, but I have projects with silverlight and they won’t load. Our clients are on windows 7 and I hear the editor has been gimped for WPF. VS 2017 was the first version that we weren’t able to use due to the removal of legacy support. After 20 years, we are planing to cancel our VS Enterprise subscriptions because we have spent thousands and haven’t been able to use it. Microsoft hasn’t inspired people to upgrade or has made windows 10 a poor investment for enterprises. Native windows developers are like me are in a difficult situation.
luck you being able to just move on.
Just a current example:
VS15.8 broke the VC++ resource editor completely on Windows 7. It does not even start. So customer like us, having a lot of MFC application still in maintenance, can’t work anymore. We develop on Windows 7 Enterprise, because that’s what about 2/3 of our customers use. Of course one can argue they should migrate to Windows 10. But convincing Windows customers to upgrade to Win10 is MSFT’s job. We can’t. Our SW has to work on what the customers are using. Or we’re out.
Having that sad, the root cause of this bug () is nothing to convince any management to use VS2017:
With an 15.8 early preview, a dependency to an API introduced with Windows 8 was added to the VS2017 VC++ resource editor. And this obviously was unnoticed and made it into the official release.
Win7 is still an officially supported platform for VS2017. But MSFT developers add dependencies to APIs not available on Win7 and obviously during testing of VS2017 15.8 the VC++ resource editor was not started a single time on Win7.
That’s not acceptable.
Think You for your great blogs. Happy to read it.
Hello and thank you for visiting the Blog, “sharing community passion.” Where readers understand the information useful, diverse. The place combines many different areas such as sharing experience, knowledge of technology and computer tricks. Make it easy to find the most useful content on the internet today. | https://blogs.msdn.microsoft.com/visualstudio/2018/07/31/how-to-convince-your-management-to-upgrade-to-visual-studio-2017-for-c-and-cpp-developers/ | CC-MAIN-2018-51 | refinedweb | 8,293 | 62.98 |
how to play audio track in java applat
how to play audio track in java applat Sir,i took help of coding in how to play audio track in java applet....nd i found perfect code ..but when i run same code on net beans then it shows error that could not found main class
Play Audio in Java Applet
Play Audio in Java Applet
... the sound file. This program will show
you how to play a audio clip in your java applet... is used to
play the sound while stop() method is used for stop the running audio
audio file to play automatically
audio file to play automatically I want to get an audio file to play automatically when someone visits my site
J2ME Audio Record
J2ME Audio Record
This example is used to record the audio sound and play the recorded... we try to show recording and playing of the
audio, To play the audio sound we
Audio MIDlet Example
Audio MIDlet Example
This example illustrates how to play audio songs in your... a player for an audio
song by using of javax.microedition.media
API. As you
Audio Level Meter
Audio Level Meter Hello
I'm new to programming and I'm trying... I can see the difference on the sound levels.I got this code and I added... JButton play = new JButton("Play");
capture.setEnabled(true
converter code for audio file
converter code for audio file how can i convert a audio file to a another file format like mp3
HTML5 audio reference
HTML5 audio reference Hi,
Tell me the best url to learn HTML5 audio tags with examples.
Thanks
Hi,
Learn how to use HTML5 audio tags to play the audio on web page. The HTML5 audio tag is used to play the video
HTML audio tag
HTML audio tag Hi,
I have written a simple html page to play audio file, I m using audio tag as shown below:
Your browser does not support the audio tag.
when I open the page using Chrome, it works fine(plays audio
how to stop audio (mp3)
how to stop audio (mp3)
if(e.getActionCommand().
equals("Stop")){
player.stop();
}
i am making an audio player in which i... stopping it. how should i stop the song keeping in mind i have to play another song
iPhone play, pause and stop playing music
iPhone play, pause and stop playing music
This is the small iPhone SDK example that will show you how to play, pause and stop the music on button... that just drag and paste the music or audio file into the resources folder, which
Java how to stop audio
Java how to stop audio hello
i have this code in the main:
try {
AudioInputStream audio = AudioSystem.getAudioInputStream(new File...(audio);
clip.start();
}
catch
NoughtsAndCrossesGame play button doesn't work
NoughtsAndCrossesGame play button doesn't work /*
* To change... main(String[] args) {
// TODO code application logic here...("Play");
playButton.addActionListener(playHandler
how to play video in website using jsp
how to play video in website using jsp please help me friend how to play a video in webiste by using jsp which playres are used and how to play video please give me code
HTML5 audio loop, Use of loop attribute of audio tag in HTML5.
HTML5 audio loop, Use of loop attribute of audio tag in
HTML5.
Introduction:Loop attribute is used for
reputation of audio or music. It repeats audio file again, until you do not
click any controls. It supports only Boolean
java code to display in audio - Java Beginners
java code to display in audio Is their any java code,
When i enterd text in text field , and when i press submit button,the text i entered should come in voice Hi friend,
Code to help in solving the problem
HTML5 audio autoplay, Use of autoplay attribute in audio tag.
HTML5 audio autoplay, Use of autoplay attribute in
audio tag.
Introduction:The autoplay is an
audio tag attribute. It is only supported by HTML5.
When it is present in audio tag, the music file will begin itself.
or
After loading
HTML5 audio tag example, Use of audio tag in HTML5.
of audio is case_ insensitive.
Example of <audio> in HTML5:
Code...HTML5 audio tag example, Use of audio tag
in HTML5.
Introduction:In this section, you will see the use and
implementation of audio tag
HTML5 audio autobuffer, Use of autobuffer attribute in audio tag.
HTML5 audio autobuffer, Use of autobuffer attribute in
audio tag.
Introduction:The autobuffer attribute has
Boolean value. It is available in audio tag... in audio tag file; music will start buffering
automatically .
Declaration
HTML5 audio controls, Discuss the controls attribute of audio tag.
HTML5 audio controls, Discuss the controls attribute of
audio tag.
Introduction:The controls is attribute of audio. which is
used for showing media player on browser. It supports only Boolean value. If it
is present in audio tag
how to run audio files in net beans using j2me
how to run audio files in net beans using j2me i am running the audioMidlet in net beans. Now where should i place the .wav files inorder to play them
code - Java Beginners
code sir i want to design a audio and video player in java
can you please give me instructions to do that project..
i want some sample code play audio and video in java
please help me sir
struts
struts how to generate bar code for continuous numbers in a loop using struts ... or atleast for a given number
Car Music Streaming via iPhone Bluetooth, iphone Bluetooth Audio Streaming
the iPhone to the Car audio using Bluetooth. If
your car has a supported Bluetooth... the play button.
Now no need for cumbersome pairing and tangled wires. Just
STRUTS
STRUTS 1) Difference between Action form and DynaActionForm?
2) How the Client request was mapped to the Action file? Write the code and explain
Audio
low CPU usage.
There are slightly different ways of playing audio from an
applet and from an application.
Where to learn about Java audio
A good way to learn about audio is to read the "Sound" section
of the Java Tutorial (see Other
struts
struts i have one textbox for date field.when i selected date from datecalendar then the corresponding date will appear in textbox.i want code for this in struts.plz help me
Audio Processing
Audio Processing Sir, I want implement an audio recognition system by using java.. Is it possible? and tell me the process...
thank you
struts
the checkbox.i want code in struts
Code Problem - Struts
Code Problem Sir, am using struts for my application.i want to uses session variable value in action class to send that values as parameter to function.ex.when i login into page,i will welcome with corresponding user homepage
Implementing JSP and embedding Windows Media Player(wmp)
component in your page so that you can play the audio and video files
in your JSP page...:
By clicking on Play, media file will open
Download Source code...;
Example code for implementing JSP and also embedding wmp in JSP page
Struts - Struts
Struts Hello
I like to make a registration form in struts inwhich... compelete code.
thanks Hi friend,
Please give details with full source code to solve the problem.
Mention the technology you have used
Play Lyrics on media player
Play Lyrics on media player how to play lyrics on media player(MIDlet) while song is playing in background..its bit urgent...
Thanks
uploading audio file iphone
uploading audio file iphone uploading audio file iphone
Struts - Struts
Struts hi
can anyone tell me how can i implement session tracking in struts?
please it,s urgent........... session tracking? you mean session management?
we can maintain using class HttpSession.
the code follows
play videos - Java Beginners
play videos How to play videos on line.how to embed the video player in the browser.If you can give some basic idea about this i would be thankful to you. Thanks
No matter what i do, eclipse applet WON'T PLAY SOUND - Java Beginners
No matter what i do, eclipse applet WON'T PLAY SOUND OK, so I tried the code in
online, and it worked, but after i transfer the code EXACTLY to my pc
pause play NSTimer
pause play NSTimer How to pause or play NSTimer?
NSTimer *myTimer = [NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(myMethod:)
userInfo:nil
repeats:YES];
- (void
ffmpeg audio from video
ffmpeg audio from video Hi,
How to extract audio from a video file?
pls review my code - Struts
pls review my code Hello friends,
This is the code in struts. when i click on the submit button.
It is showing the blank page. Pls respond soon its urgent.
Thanks in advance.
public class LOGINAction extends Action
program code for login page in struts by using eclipse
program code for login page in struts by using eclipse I want program code for login page in struts by using eclipse
How to play radio station on iPhone
How to play radio station on iPhone how to play radio station on iphone
audio video conferencing
audio video conferencing how to develop a chat application in peer to peer setup
struts 3.1 - Struts
struts 3.1 how to use struts 3.1.x version in our code as i am creating a project.
please reply as soon as possible
Play framework dynamic form generation
Play framework dynamic form generation I want to generate dynamic forms using play framework can any one give me some idea about dynamic form generation using play framework
Broadcasting audio.. - JSP-Servlet
Broadcasting audio.. i am doing a project on Internet radio. I embeded windows media player,but doesnt know how to broadcast...i need to stream the audio. can anyone give a solution for this. Its very urgent
playing an audio file
playing an audio file In playing an audio file we have to take one method getAudioClip(getCodeBase(), "TestSnd.wav") inside that getCodeBase... how to solve this problem and also tell me where i should pass my audio clip
pls review my code - Struts code in struts for 3 Failed Login attempts - Struts
How to code in struts for 3 Failed Login attempts Hi,
I require help.
I am doing one application in struts where i have to incorporate...;Hi friend,
Read for more information.
retail invoice and billing source code in struts
retail invoice and billing source code in struts Hi.
I need source code for "retail invoice and billing source code in struts", Please help me in doing so. Please It's important and urgent
java code for design a auido and vidoe player - Java Beginners
java code for design a auido and vidoe player sir i want to develop an application, in that application i want to play audio songs and video songs for all formats.. can you please send me the guidelines for doing that project
JFrame Button click to start play
JFrame Button click to start play i made a game and and i add a button in new jframe and i want when i click it it start to play...can anyone titles - Struts
Use Struts Titles in Web Applications hi i want to use titles in my web project please help me . in my project i have four titles such as banner, menu , content and footer . please provide any first example - Struts
Struts first example Hi!
I have field price.
I want to check require and input data type is int.
can you give me an example code... the version of struts is used struts1/struts 2.
Thanks
Hi | http://roseindia.net/tutorialhelp/comment/89307 | CC-MAIN-2014-15 | refinedweb | 1,942 | 71.24 |
I've had fun developing this control and believe it will be useful for many reasons. The first and foremost reason is to get a good peer review. The second is to help share ideas, coding, and of course the code itself. I've been interested in chess for about 7 years now and you can say I'm quite addicted. The positive note is my wife would rather see me out playing chess on a Friday night vs drinking in a bar. I was about 80% done with my code when I noticed that Chris R. Chapman had put out his version of a control, using the famous Bitboards (Good job Chris!). So any one interested should check out his control as well. There are two main differences that you will note: Chris pre generates his attack boards where as I generate mine on the fly, I draw the chess board in an offscreen buffer then splash it to the screen, and finally I trap the mouse clicks and locate the corresponding squares.
In regards to the Bitboards I've always been curious to the differences in speed between the two approaches. There has been some arguments in the online 'chess' groups that the pre-generated versions are no faster than the build as you go, I personally have not tested this but now maybe I can. I've found my code to execute very nicely and do not see any performance problems. I believe if I change anything in performance it would be the mouse click / square location routines. I think simply dividing the board into quarters and associating each quarter with the underlying squares should speed things up some, but to be honest it runs pretty fast now so I may be lazy and skip this part. I have successfully validated quite a few different and weird checks, mates, and stalemates so I believe the move validation is pretty solid. If you find any problems let me know, email me FEN strings. You can find some of the FEN strings in the header for StandardValidation.isKingCheckedMatedStaled method.
StandardValidation.isKingCheckedMatedStaled
I draw the chess board in the background and then splashed to the screen and this gives me pretty smooth piece movement. The intentions here were to give the drawing code the ability to be called from a web server for display on an HTML page. That's why it's hooked up to the FEN events, pass the string and generate the graphics. See below discussion on events.
There is also a PGN brute force parser that has example code in the demo program that converts the PGN to XML. It will save the file into the same location as the PGN but with the .XML extension. The intent here was to use the XML for the format in the background for displaying, navigating, and annotating chess games. It can also be used to display an annotated game in HTML with a little XSL processing (if anyone writes one let me know). I have some example pgn files saved in the directory with the control for testing, a couple with multiple variations and comments. The game navigation is the next thing I'm going to work on finishing. Please be aware that I'm unsure how the XML parser will work with a totally junked file and I have not tested it 100% as I'm just starting to working on the game navigation control.
Note the VCR buttons do not move through a game yet. I'm working on that in my spare time utilizing the XML generated above.
There is some cleanup I still need to perform so don't be too critical of the code.
I would recommend that you read articles on Bitboards and their use in chess computer. Crafty source code is an insane place to look if you enjoy reading C code. But the easiest method is to perform a simple search on the topic. But beware, you may get redirected to this very column where you will find yourself in a never ending do/while loop.
Seriously though I hope to show a use of interfaces and events in my first attempt and this article. In regards to interfaces and events, I find that they go very well together. I first think of the events I want a particular object to implement, then I group these event methods into an interface. I then define a bare minimum interface for the object itself in which I declare two methods: addEvents(ievents) and removeEvents(ievents) where the parameter ievents would be the event methods/interface I previously created. The body of the methods addEvents() and removeEvents() simply hook/detach up all of the methods defined in the interface to the object producing the events.
addEvents(ievents)
removeEvents(ievents)
ievents
addEvents()
removeEvents()
To better understand my point look at the code in the file ChessInterfaces.cs. In particular find the IPosition and IPositionEvents interfaces. The IPosition defines the methods that a class must implement to allow the events defined in IPoisitionEvents to be hooked up and ready for action. Thus in the interface IPosition we have the two methods named: IPosition.removeEvents(IPositionEvents ievents) and IPosition.addEvents(IPositionEvents ievents). Now open up the file FenNotation.cs. Here you will find public class FenNotation : IPosition which wants other classes to be aware of his ability to parse a FEN string. Now open up the two files ChessBitmap.cs and StandardValidation.cs to reveal the following: public class ChessBitmap : IPositionEvents and public class StandardValidation: IPositionEvents, IValidation . Making sense yet? Ok just a little more to go. Once you've studied the aforementioned code, mainly the addEvents / removeEvents, open the file: ChessBoard.cs and find the code in the constructor:
IPosition
IPositionEvents
IPoisitionEvents
IPosition.removeEvents(IPositionEvents ievents)
IPosition.addEvents(IPositionEvents ievents)
public class FenNotation : IPosition
public class ChessBitmap : IPositionEvents
public class StandardValidation: IPositionEvents, IValidation
addEvents
removeEvents
coFen = new FenNotation();
// Assign our graphical and bit board to
// the FEN class so that we can
// capture the events.
coFen.addEvents(coChessBitmap);
coFen.addEvents(coBitBoard);
Now you should be able to see what we've accomplished here: First with a little bit of extra work I've made it very simple for others to use the events of my object, Second I've made it very easy for me to use the events of my object. To create another object that listens to the events I simply declare an object and have it implement the interface for the events that I am interested in receiving. Remember VS will ask you if you want the interface skeleton code generated, simply say yes and write the body of the code to handle the events. Then it is a simple function call to hook that object up to receive events. For another example look at the PGN parser and the XML conversion that takes place in the sample applications.
Couldn't get any easier: Compile the projects and let em rip....
Seriously though it is that easy. Just open the solution in the ChessBoardCtrl directory named: ChessBoardCtrl.sln. This solution has references to the demo applications that hosts the control and implements some of the features. By looking at the demo program you can get a good understanding of how the control works, play with that first then try it your self. I'll update this more at a later time (when I have a little more time). Until then let me know what you guys think!
CHEERS!
If there is any particular area you want me to discuss, just post a | http://www.codeproject.com/Articles/6117/Yet-Another-Chess-Board-Control | CC-MAIN-2013-48 | refinedweb | 1,270 | 61.97 |
Issues with setting checkboxes in QSqlTableModel
I have subclassed QSqlTableModel so I can add checkboxes to a QTableView. I've done this by overriding the flags(), data() and setData() methods. When the tableview loads the data from SQL it seems to work fine and does set the checkboxes accordingly. But when I click on the checkboxes nothing happens to either the data in the database, or the checkbox in the view.
Here's what I'm doing currently in my setData method:
def setData(self, index, value, role=Qt.EditRole): if role == Qt.CheckStateRole\ and self.headerData(index.column(), Qt.Horizontal) in \ ("Game", "Console", "Accessory", "Box", "Manual"): data = "Yes" if value == Qt.Checked else "No" return QSqlTableModel.setData(self, index, data, Qt.EditRole) else: return QSqlTableModel.setData(self, index, value, role)
Basically I'm checking if the role is CheckStateRole and if the column is in the column I have the checkboxes in. Then checking the value and passing the correct data to the database based on it.
It does enter the if statement, and checking the value of data seems like it does set it correctly. So the part that doesn't work is the call to QSqlTableModel.setData() in the return statement. It doesn't seem to do anything.
Editing columns that don't have checkboxes works fine.
Am I doing something obviously wrong here?
- VRonin Qt Champions 2018 last edited by
I'm not a python expert but
QSqlTableModel.setData(self, index, data, Qt.EditRole)looks wrong. To call the base class implementation you should call something like
super(QSqlTableModel,self).setData(self, index, data, Qt.EditRole)
@VRonin I'm pretty new to python myself, as well as QT, so I'm admittedly a bit unsure as to the difference between what I was doing and using super like that. Thanks for pointing it out. I should look into it more.
I changed the whole subclass to use super() but it still has the same behavior unfortunately. :(
Edit:
Actually now I can't edit any other column either. I guess that makes it consistent at least. But it doesn't make sense. Reading up on super() the way I was doing it is simply how you do it without using the super function, and the way it was done before super was introduced in Python. The behavior should be identical if I'm reading it correctly. But obviously something changed. Maybe someone can chime in on that.
Edit²: Ok never mind the previous edit. Changing super(QSqlTableModel, self) into just super() everywhere (for example super().setData(index, data, Qt.EditRole) made the behavior exactly as when I used QSqlTableModel to call the base implementation. That is, I can edit the columns that don't have checkboxes but the checkboxes are still not co-operating.
So I took a look at the QSqlTableModel C++ source code, and I noticed that there's an if statement in there that checks if the index has the flag ItemIsEditable set. If it isn't, then it returns false.
Now in the example I was adapting from (Which was this one that is subclassing a QSortFilterProxyModel rather than QSqlTableModel, and was using boolean values and doing other things as well) did NOT set that flag in the overridden flags() method! I assume that's done somewhere else, but I only adapted what I needed. I didn't even know it was a flag you could set since I've never really done this before. Should've looked more carefully at the example I guess...
Anyway, after setting that flag in the flags method it now works as expected. Here's what the method is looking like now if anyone is interested:
def flags(self, index): if self.headerData(index.column(), Qt.Horizontal) in ("Game", "Console", "Accessory", "Box", "Manual"): return Qt.ItemIsUserCheckable | Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable else: return super().flags(index)
You can also set the return statement to simply:
return super().flags(index) | Qt.ItemIsUserCheckable
And it'll work just the same. That's actually probably a better/cleaner way of doing it now that I think about it. | https://forum.qt.io/topic/98007/issues-with-setting-checkboxes-in-qsqltablemodel | CC-MAIN-2019-43 | refinedweb | 689 | 59.3 |
Hi,
I'm trying to get into C++, but i tend to learn stuff better in my own strange way ;)
[using vc++ 6]
i had a simple program that was like
if i've made an obvious mistakes it's cos i'm writing it from memory. (it did work)if i've made an obvious mistakes it's cos i'm writing it from memory. (it did work)Code:
#include <iostream.h>
void main
{
char thisisyourname[30];
cout << "What is your name?";
cin >> thisisyourname;
cout << endl << "Your name is " << thisisyourname;
}
And then i wondered about iostream.h, couldnt I take some stuff out of there and write it in the program and do away with the #include
and after looking at webpages from i came up with
which has lots of errors likewhich has lots of errors likeCode:
// #include <iostream.h>
void main()
{
char thisisyourname[30];
istream::write "what is your name?";
istream::getline (thisisyourname,30);
ostream::write "You are " && thisisyourname;
}
istream' : is not a class or namespace name
and 'write' : undeclared identifier
in fact one set for every line.
i expect '&&' is wrong as well, i just guessed.
question is. can this work? differently?
cheers | http://cboard.cprogramming.com/cplusplus-programming/37232-decontructing-cplusplus-printable-thread.html | CC-MAIN-2015-11 | refinedweb | 197 | 70.23 |
36 /** 37 * Output stream that writes data without any transformation. The end of 38 * the content entity is demarcated by closing the underlying connection 39 * (EOF condition). Entities transferred using this input stream can be of 40 * unlimited length. 41 * <p> 42 * Note that this class NEVER closes the underlying stream, even when close 43 * gets called. Instead, the stream will be marked as closed and no further 44 * output will be permitted. 45 * 46 * @since 4.0 47 */ 48 @NotThreadSafe 49 public class IdentityOutputStream extends OutputStream { 50 51 /** 52 * Wrapped session output buffer. 53 */ 54 private final SessionOutputBuffer out; 55 56 /** True if the stream is closed. */ 57 private boolean closed = false; 58 59 public IdentityOutputStream(final SessionOutputBuffer out) { 60 super(); 61 if (out == null) { 62 throw new IllegalArgumentException("Session output buffer may not be null"); 63 } 64 this.out = out; 65 } 66 67 /** 68 * <p>Does not close the underlying socket output.</p> 69 * 70 * @throws IOException If an I/O problem occurs. 71 */ 72 @Override 73 public void close() throws IOException { 74 if (!this.closed) { 75 this.closed = true; 76 this.out.flush(); 77 } 78 } 79 80 @Override 81 public void flush() throws IOException { 82 this.out.flush(); 83 } 84 85 @Override 86 public void write(byte[] b, int off, int len) throws IOException { 87 if (this.closed) { 88 throw new IOException("Attempted write to closed stream."); 89 } 90 this.out.write(b, off, len); 91 } 92 93 @Override 94 public void write(byte[] b) throws IOException { 95 write(b, 0, b.length); 96 } 97 98 @Override 99 public void write(int b) throws IOException { 100 if (this.closed) { 101 throw new IOException("Attempted write to closed stream."); 102 } 103 this.out.write(b); 104 } 105 106 } | http://hc.apache.org/httpcomponents-core-4.2.x/httpcore/xref/org/apache/http/impl/io/IdentityOutputStream.html | CC-MAIN-2015-11 | refinedweb | 290 | 68.36 |
ETK + Enhance, quick and dirty
ETK is a gui toolkit similar to gtk and is a part of Enlightenment Foundation Libraries or EFL. The syntax is very similar to GTK with only minor differences. Infact you could even use Glade to design GUI with ETK. For this you need a small but nifty tools called ‘enhance’ also part of E. Glade btw is a tool which removes the need of manipulating each and every widget manually. It does all these in an efficient manner leaving the developer to concentrate only on callbacks.
I am very new to ETK+Enhance and dont know which is better. EWL or ETK. If someone could shed light on this, I would be grateful. Myself, being a novice found the lack of documentation for enhance a bit unnerving. But still I managed to get hold of the concepts. So here is a short tutorial about using ‘enhance’ to parse your .glade files and use them in your etk source codes. Comments are welcome.
I assume some knowledge in ETK or atleast GTK…Lets dig in..
Now create a glade file with the name of project1.glade. Create a simple window with a single button in it. Now in the property window of the button in the Signal tab, add the following information Signal->Clicked, Handler->
, in our case “button_callback”
The following code is the famous hello world program using ETK and glade for creating the GUI..
#include "Etk.h"
#include "Enhance.h"
Enhance *en;
void button_callback(Etk_Object *obj, void *data)
{
printf("Whee THis works\n");
}
int main(int argc, char *argv[])
{
enhance_init();
etk_init(&argc, &argv);
en=enhance_new();
enhance_file_load(en, "window1", "project1.glade");
etk_main();
enhance_free(en);
enhance_shutdown();
etk_shutdown();
return 0;
}
Ok now a step by step description of whats up
#include "Etk.h"
#include "Enhance.h"
Enhance *en;
We are just including header files that is required for our program..duh! Anyway the third line, we are creating a pointer for the Enhance datatype. ‘en’ will be used while loading our .glade file
void button_callback(Etk_Object *obj, void *data)
{
printf("Whee THis works\n");
}
The above function is the callback function. When we click the “button” of our program the line within the printf would output to the console. If you dont understand what I am tallking about visit the gtk website and download the tutorial to get an idea of what callbacks and widgets are.
enhance_init();
etk_init(&argc, &argv);
We are initialising enhance and etk..
en=enhance_new();
Remember the pointer ‘en’ of datatype Enhance. en now becomes a new instance of enhance..
enhance_file_load(en, "window1", "project1.glade");
The above line will load the widget “window1″ from the “project1.glade” file and “en” will point th them. You should load each widget, for example, you may have more than one window in your .glade file.
The remaining lines are self-explainatory..:D
Save the file as hello.c, in the directory containing project1.glade..and compile the program
gcc -g hello.c -o hello `enhance-config --libs --cflags` `pkg-config --libs --cflags`
If all went well, you will be left with the executable called “hello”..
run it
./hello
You will get a small window with the button with E17 theming containing the label you had specified while creating the gui with glade. Click on the button and you will see the text “Whee THis works” output on the console everytime it is clicked.
Reference:
E Developers Portal
Glade and GTK+
If you find something wrong, which is mostly likely, please comment about them. I am learning ETK/enhance myself.
Filed under: FOSS and Linux, Tips | 7 Comments
It depends on preference. ETK is similar to GTK. So, if you like GTK you’ll probably like ETK.
If, like the EWL developers, you don’t like the GTK API that much you might want to look at EWL. With EWL we started from a blank slate and are attempting to make a simple and consistent API. EWL makes extensive use of inheritance and callback methods to reduce code duplication inside the core code.
You can get some info on EWL at wiki.edevelop.org/index.php/EWL there are a set of introductory tutorials to get people started.
(Note, as disclaimer, I’m an EWL developer.)
cool
gcc -g hello.c -o hello `enhance-config –libs –cflags` `etk-config –libs –cflags`
etk-config doesn’t exist, now the right command with etk-config is:
gcc -g hello.c -o hello `enhance-config –libs –cflags` `pkg-config –libs –cflags etk`
@arcano: thanks, updated the post
hello,
since i’m studying C/C++/Enlightenment programming and also build systems too(cmake in that case), i’ve made the smallest possible (i presume) CMakeLists.txt able to compile that example:
# CMakeLists.txt
project(helloEtk)
include_directories(/usr/include/etk)
add_executable(helloEtk helloEtk.c)
target_link_libraries(helloEtk exml etk ecore_file edje ecore_x ecore_fb curl evas ecore enhance)
but i have a question: if i modify the source to call all that free/shutdown stud inside the callback my console don’t returs to me; why the process don’t quit?
i’m using SlackE17, any idea if it’s a bug?
@Sombriks:
Yo, I haven’t been really following changes to EFL for a while, maybe the post is too outdated…However you could hop onto #edevelop at freenode if you haven’t already…its a pretty friendly channel…:D
If you are having problems loading dynamic callbacks, use the -rdynamic flag for gcc | http://sudharsh.wordpress.com/2006/11/10/etk-enhance-quick-and-dirty/ | crawl-002 | refinedweb | 911 | 66.03 |
This is not the current version. View the latest documentation
Realm Java enables you to efficiently write your app’s model layer in a safe, persisted and fast way. Here’s what it looks like:
// Define you model class by extending the RealmObject public class Dog extends RealmObject { @Required // Name cannot be null private String name; private int age; // ... Generated getters and setters ... } public class Person extends RealmObject { @Required // Name is not nullable private String name; private String imageUrl; // imageUrl is an optional field private RealmList<Dog> dogs; // ... Generated getters and setters ... } // Use them like regular java objects Dog dog = new Dog(); dog.setName("Rex"); Log.v(TAG, "Name of the dog: " + dog.getName()); // Get a Realm instance for this thread Realm realm = Realm.getInstance(context); // Persist your data easily realm.beginTransaction(); realm.copyToRealm(dog); realm.commitTransaction(); // Query and use the result in another thread Thread thread = new Thread(new Runnable() { @Override public void run() { // Get a Realm instance for this thread Realm realm = Realm.getInstance(context); Dog dog = realm.where(Dog.class).equalTo("name", "Rex").findFirst(); Log.v(TAG, "Age of the dog: " + dog.getAge()); realm.close(); } }); thread.start();
Getting started
Download Realm for Android or see the source for realm-java on GitHub.
Prerequisites
- We do not support Java outside of Android at the moment.
-.84.1'to the dependencies of your project
- In the Android Studio menu: Tools->Android->Sync Project with Gradle Files
Jar
- Download the release package and unzip.
- Copy the jar file and folders (containing the
librealm.
ProGuard
Realm generates a proxy class for each RealmObject at compile time. To ensure that these classes can be found after running an obfuscation and static analysis tool like ProGuard add the configuration below to your ProGuard configuration file. Your Realm version needs to be 0.84.1 or higher.
-keep class io.realm.annotations.RealmModule -keep @io.realm.annotations.RealmModule class * -keep class io.realm.internal.Keep -keep @io.realm.internal.Keep class * { *; } -dontwarn javax.** -dontwarn io.realm.**
Realm Browser
The Realm Browser is only available on Mac OS X at the moment.
We are working on Windows & Linux versions.. If you’ve already updated to Realm Java 0.83, there is a compatible pre-release version of the Browser on the Realm Browser GitHub page.
API Reference
You can consult our full API reference for all classes, methods & more.ThreadExample is a simple app that shows how to use Realm in a multithreaded environment.
The
RealmAdapterExample shows how to use the RealmBaseAdapter to bind RealmResults to Android lists in a convenient way.
The
RealmJsonExample illustrates how to use the new Realm JSON facilities.
The
RealmEncryptionExample shows you how to work with encrypted Realms. by implementing something very similar to a traditional Java Bean. Simply extend our RealmObject class and let the Realm annotations processor generate proxy classes. overridden by the generated proxy class used in the back by RealmObjects, so any custom logic you add to the getters & setters will not actually be executed.
Field types
Realm supports the following field types:
boolean,
byte,
short,
int,
long,
float,
double,
String,
Date and
byte[]. The integer types
byte,
short,
int, and
long are all mapped to the same type (
long actually) within Realm. Moreover, subclasses of
RealmObject and
RealmList<? extends RealmObject> are supported to model relationships.
The boxed types
Boolean,
Byte,
Short,
Integer,
Long,
Float and
Double can also be used in model classes. Using these types, it is possible to set the value of a field to
null.
Required fields and null values
In some cases,
null is not an appropriate value of a field. The
@Required annotation can be used to tell Realm to enforce checks to disallow
null values. You don’t have to add
@Required to fields of primitive types as these cannot be
null.
Ignoring properties
The annotation
@Ignore implies that a field should not be persisted to disk. Ignored fields are useful if your input contains more fields than your model, and you don’t wish to have many special cases for handling these unused data fields.
Indexing properties
The annotation
@Index will add a search index to the field. This will make inserts slower and the data file larger but queries will be faster. So it’s recommended to only add index when optimizing specific situations for read performance. We support indexing:
String,
byte,
short,
int,
long,
boolean and
Date fields.
Primary keys
To promote a field to primary key, you use the annotation
@PrimaryKey, and the field type has to be either string or integer (
short,
int or
long). It is not possible to use multiple fields (compound key) as a primary key. Using a string field as a primary key implies that the field is indexed (the annotation
@PrimaryKey implicitly sets the annotation
@Index).
Using primary keys makes it possible to use the
createOrUpdate() method, which will look for an existing object with this primary key, and update it if one is found; if none is found, it will create a new object instead.
Using primary keys has an effect on the performance. Creating and updating object will be a little slower while querying is expected to be a bit faster. It is hard to give numbers as the changes in performance depend on the size of your dataset.
When calling
Realm.createObject(), it will return a new object with all fields set to the default value. In this case, there might be a conflict with an existing object whose primary key field is the default value. To avoid this, it is suggested to create a standalone object, set values of the fields, and then copy it to Realm by
copyToRealm() method.
MyObject obj = new MyObject(); obj.setId(42); obj.setName("Fish"); realm.beginTransaction(); // This will create a new one in Realm // realm.copyToRealm(obj); // This will update a existing one with the same id or create a new one instead realm.copyToRealmOrUpdate(obj); realm.commitTransaction();
Primary keys cannot have the value
null, and the
@PrimaryKey annotation has the
@Required annotation implicitly.
Limitations
Due to how the proxy classes override getters and setters in the model classes there are some restrictions to what is allowed in a model class.();
While working with your RealmObjects inside a write transaction, you might end up in a situation where you wish to discard the change. Instead of committing it, and then reverting it, you can simply cancel the write transaction:
realm.beginTransaction(); User user = realm.createObject(User.class); // ... realm.cancelTransaction();
Please note that writes block each other, and will block the thread they are made on if other writes are in progress. This can cause ANR errors if you are doing writes from the UI thread while also doing writes from a background thread. To avoid this, first create objects in memory first outside a transaction, and only perform a simple Realm.copyToRealm() inside the transaction, which will keep blocking times to a minimum.
Thanks to Realm’s MVCC architecture, reads are not blocked while a write transaction is open! This means that unless you need to make simultaneous writes from many threads at once, you can favor larger write transactions that do more work over many fine-grained write transactions. When you commit a write transaction to a Realm, all other instances of that Realm will be notified, and the read implicit transactions will refresh your Realm objects automatically.
Please note read & write access in Realm is ACID.
Creating objects
Because RealmObjects are strongly tied to a Realm, they should be instantiated through the Realm directly:
realm.beginTransaction(); User user = realm.createObject(User.class); // Create a new object user.setName("John"); user.setEmail("[email protected]"); realm.commitTransaction();
Alternatively you can create an instance of an object first and add it later using realm.copyToRealm().();
When using
realm.copyToRealm() it is important to remember that only the returned object is managed by Realm, so any futher changes to the original object will not be persisted.
Transaction blocks
Instead of manually keeping track of
realm.beginTransaction(),
realm.commitTransaction(), and
realm.cancelTransaction() you can use the realm.executeTransaction() method, which will automatically handle begin/commit, and cancel if an error happens.
realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { User user = realm.createObject(User.class); user.setName("John"); user.setEmail("[email protected]"); } });
Asynchronous Transactions
As transactions are blocked by other transactions it can be an advantage to do all writes on a background thread in order to avoid blocking the UI thread. By using an asynchronous transaction, Realm will run that transaction on a background thread and report back when the transaction is done.
To switch from a synchronous transaction to an asynchronous transaction, add the
Realm.Transaction.Callback parameter.
realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm bgRealm) { User user = bgRealm.createObject(User.class); user.setName("John"); user.setEmail("[email protected]"); } }, new Realm.Transaction.Callback() { @Override public void onSuccess() { } @Override public void onError(Exception e) { // transaction is automatically rolled-back, do any cleanup here } });
The callback is optional, but if provided it will be called when the transaction completes or fails. Callbacks are controlled by the
Looper, so only
null callbacks are allowed on non-looper threads.
RealmAsyncTask transaction = realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm bgRealm) { User user = bgRealm.createObject(User.class); user.setName("John"); user.setEmail("[email protected]"); } }, null);
An asynchronous transaction is represented by the
RealmAsyncTask object. This object can be used to cancel any pending transaction if you are quitting the Activity/Fragment before the transaction is completed. Forgetting to cancel a transaction can crash the app if the callback updates the UI.
public void onStop () { if (transaction != null && !transaction.isCancelled()) { transaction.cancel(); } }. Objects are not copied - you get a list of references to the matching objects, and you work directly with the original objects that matches your query. The RealmResults inherits from Java’s AbstractList, and behaves in similar ways. For example, RealmResults are ordered, and you can access the individual objects through an index.
When a query does not have any matches, the returned RealmResults object will not be
null, but the
size() method will return 0.
If you wish modify or delete any of the objects in a RealmResults, you must do so in a write transaction.
Retrieving objects by type
The most basic method for retrieving objects from a Realm is
realm.allObjects(), which returns a RealmResults of all instances of the model class being queried.
There are specialized versions of
allObjects() which offer sorting functionality i.e., you can specify sorting order per field. See
realm.allObjectsSorted() for details.();
Futhermore, it is possible to negate a condition with
not(). The
not() operator can be used with
beginGroup()/
endGroup() to negate subconditions only.
Sorting
Once you have done your query, you can sort the results like this:
RealmResults<User> result = realm.where(User.class).findAll(); result.sort("age"); // Sort ascending result.sort("age", RealmResults.SORT_ORDER_DESCENDING);()
Asynchronous Queries
Queries can be performed on a background thread.
Most queries in Realm are fast enough to be run synchronously - even on the UI thread. However for either very complex queries or queries on large data sets it can be an advantage to run the query on a background thread.
Example: finding users with name “John” or “Peter”
Create the query
RealmResults<User> result = realm.where(User.class) .equalTo("name", "John") .or() .equalTo("name", "Peter") .findAllAsync();
Note that the query is not blocking and immediately returns a
RealmResults<User>. This is a promise similar to the concept of Future in standard Java. The query will continue to run in a background thread, and once it completes it will update the returned instance of
RealmResults.
If you want to be notified when the query completes and the
RealmResults is updated, you can register a
RealmChangeListener. This listener will be called every time the
RealmResults is updated to reflect the latest changes in the Realm (usually after a commit).
Register a callback
public void onStart() { RealmResults<User> result = realm.where(User.class).findAllAsync(); result.addChangeListener( new RealmChangeListener() { @Override public void onChange() { // called once the query complete and on every update // use the result } }); }
Remember to unregister any listeners when exiting an Activity or Fragment to avoid memory leaks.
public void onStop () { result.removeChangeListener(callback); // remove a particular listener // or result.removeChangeListeners(); // remove all registered listeners }
Check if the query has completed
if (result.isLoaded()) { // Results are now available }
Calling isLoaded on a RealmResults obtained synchronously will always return true.
Force load an asynchronous query
Optionally you can wait until the query completes. This will block the current thread, making the query synchronous again (same concept as in Future.get()).
result.load() // be careful, this will block the current thread until it returns
Non-Looper threads.
Realms
Realms are our equivalent of a database: they contain different kinds of objects, and map to one file on disk.
The Default Realm
You may have noticed so far that we have always initialized our realm variable by calling
Realm.getInstance(Context context). This static constructor will return a Realm instance for your thread, that maps to a file called
default.realm located in
Context.getFilesDir(). always possible to obtain the absolute path of a realm by using the
realm.getPath() method.
It is important to note that Realm instances are thread singletons, meaning that the static constructor will return the same instance for every thread.
Configuring a Realm
Calling
Realm.getInstance(context) makes it easy to get started with Realm. For more fine-grained control, it is possible to create a
RealmConfiguration object that controls all aspects of how a Realm is created.
// The RealmConfiguration is created using the builder pattern. RealmConfiguration config = new RealmConfiguration.Builder(context) .name("myrealm.realm") .encryptionKey(getKey()) .schemaVersion(42) .setModules(new MySchemaModule()) .migration(new MyMigration()) .build(); // These two are equivalent Realm realm = Realm.getInstance(context); Realm realm = Realm.getInstance(new RealmConfiguration.Builder(context).build());
The
RealmConfiguration can be saved as a default configuration. Setting a default configuration in your custom Application class, will ensure that it is available in the rest of your code.
public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); RealmConfiguration config = new RealmConfiguration.Builder(context).build(); Realm.setDefaultConfiguration(config); } } public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Realm realm = Realm.getDefaultInstance(); } }
It is also possible to have multiple RealmConfigurations. In this way you can control the version, schema and location of each Realm independently.
RealmConfiguration myConfig = new RealmConfiguration.Builder(context) .name("myrealm.realm"). .schemaVersion(2) .setModules(new MyCustomSchema()) .build(); RealmConfiguration otherConfig = new RealmConfiguration.Builder(context) .name("otherrealm.realm") .schemaVersion(5) .setModules(new MyOtherSchema()) .build(); Realm myRealm = Realm.getInstance(myConfig); Realm otherRealm = Realm.getInstance(otherConfig);
In-Memory Realm
Define an instance for an un-persisted in-memory Realm:
RealmConfiguration myConfig = new RealmConfiguration.Builder(context) .name("myrealm.realm") .inMemory() .build();
Setting this will create an in-memory Realm instead of saving it to disk. In-memory Realms might still use disk space if memory is running low, but all files created by an in-memory Realm will be deleted when the Realm is closed.
Please note that creating an in-memory Realm with the same name as a regular (persisted) Realm is not allowed.
When all in-memory Realm instances with a particular name go out of scope with no references, all data is freed for that Realm. It is recommended that you hold onto a reference to any created in-memory Realms for the duration of your App.
Using a Realm across Threads
The only rule to using Realm across threads is to remember that Realm, RealmObject or RealmResults instances cannot be passed across threads. However, you can use an asynchronous query or asynchrounous.
Finding a Realm File
If you need help finding your app’s Realm file, check this StackOverflow answer for detailed instructions.
Schemas
The default schema for a Realm is defined as all the Realm model classes in a project. It is possible to change this behavior, e.g. if you want to restrict a Realm to only contain a subset of classes. This is done by creating a custom RealmModule.
// Create the module @RealmModule(classes = { Person.class, Dog.class }) public class MyModule { } // Set the module in the RealmConfiguration to allow only classes defined by the module. RealmConfiguration config = new RealmConfiguration.Builder(context) .setModules(new MyModule()) .build(); // It is possible to combine multiple modules to one schema. RealmConfiguration config = new RealmConfiguration.Builder(context) .setModules(new MyModule(), new MyOtherModule()) .build();
Sharing schemas
For library developers: Libraries that include Realm must expose and use their schema through a RealmModule.
Doing so prevents the default
RealmModule from being generated for the library project, which would otherwise conflict with the default
RealmModule being generated by the app. The library’s
RealmModule is also how the library exposes its Realm classes to the app.
//(context) .name("library.realm") .setModules(new MyLibraryModule()) .build(); // Apps can add the library RealmModule to their own schema. RealmConfiguration config = new RealmConfiguration.Builder(context) .name("app.realm") .setModules(Realm.getDefaultModule(), new MyLibraryModule()) .build();
See a complete example of how RealmModules work between library and app projects here.
Setting the
RealmObject field to
null will clear the reference but the object will not be deleted from the Realm..
Setting the value to
null for a
RealmList field will clear the list. That is, the list will be empty (length zero), but no objects have been deleted. The getter for a
RealmList will never return
null. The returned object is always a list but the length might be zero..
Moreover, each condition in a link query is evaluated separately. The final result is the intersection of the results of the link queries. This implies that the following query will give you all contacts with at least one active and at least one inactive email addresses:
RealmResults<Contact> contacts = realm.where(Contact.class).equalTo("emails.active", true).equalTo("emails.active", false).findAll();(); }
Parsing JSON with Realm is subject to the following rules.
- Creating object with JSON which has the field with a null value:
- For a not-required field, set it to
nullwhich is the default value.
- For a required field, throw an exception.
- Updating object with JSON which has the field with a
nullvalue:
- For a not-required field, set it to
null.
- For a required field, throw an exception.
- JSON doesn’t have the field:
- Leave the value unchanged for both required and not-required fields.
Notifications
Since 0.80.3, the
RealmChangeListener is managed as a weak reference internally to avoid potential leaks. So DO NOT use anonymous
RealmChangeListener when calling
addListener. Instead, always maintain the reference to your listeners until you don’t need them anymore.
If you have a background thread adding data to a Realm, your UI or other threads can get notified of changes in a realm by adding a listener, which is executed when the Realm is changed (by another thread or process):
public class MyActivity extends Activity { private Realm realm; // A reference to RealmChangeListener needs to be held to avoid being // removed by the garbage collector. private RealmChangeListener realmListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); realm = Realm.getDefaultInstance(); reamlListener = new RealmChangeListener() { @Override public void onChange() { // ... do something with the updates (UI, etc.) ... %>; realm.addChangeListener(realmListener); } @Override protected void onDestroy() { super.onDestroy(); // Remove the listener. realm.removeChangeListener(realmListener); // Close the realm instance. realm.close(); } } models (i.e. your database schema) database schema. But if you do, there will be a mismatch between what Realm sees defined in code & the data Realm sees on disk, so an exception will be thrown.
We provide built-in methods so you can upgrade your schema on disk, and the data you stored for previous versions of the schema. See our migrationSample app for details.
If there is no file on disk when Realm launches, no migration is needed, and Realm will just create a new .realm file & schema based on the latest models defined in your code. This means that if you are in the middle of development and changing your schema very often, and you are OK with losing all your data, you can delete your .realm file on disk (and the entire dataset it contained!) instead of having to write a migration. This can be helpful when tinkering with models early in the development cycle of your app.
Encryption
Please take note of the Export Compliance section of our LICENSE, as it places restrictions against the usage of Realm if you are located in countries with an export restriction or embargo from the United States.
The Realm file can be stored encrypted on disk by passing a 512-bit encryption key to
Realm.getInstance():
byte[] key = new byte[64]; new SecureRandom().nextBytes(key); Realm realm = Realm.getInstance; } }
Other libraries
This section describes how you can integrate Realm with other commonly used libraries for Android.
GSON
GSON is a library created by Google for deserializing and serializing JSON. When using Realm with GSON 2.3.1 (latest version), you have to specify an ExclusionStrategy.
// Using the User class public class User extends RealmObject { private String name; private String email; // getters and setters left out ... }.
Otto
Otto is an event bus from Square. Otto works with Realm out of the box, but there are some timing and thread issues to be aware of.
Otto normally receives an event on the same thread it was sent. This means that it is possible to add a RealmObject to an event and read its data in the receiver method without any problems. However if you are using the hack described here to always post on the main thread, you cannot have RealmObjects as part of your event data unless you always send events from the UI thread also. This is normally done to be able to manipulate UI elements in response to an event which is only possible from the main thread.
When a RealmObject is changed in one thread, Realm schedules a refresh of Realm data on other threads using a Handler.
Otto.post(event) on the other hand, dispatch events immediately. So if you post an event to another thread to notify about changes to Realm data, you will have to manually call
realm.refresh() to get the latest data.
@Subscribe public void handleEvent(OttoEvent event) { realm.refresh(); // Continue working with Realm data loaded in this thread }. 1) If your model contains a
RealmList you need to register a special adapter and 2) Once an object has been parcelled, it becomes detached from Realm and at this point behaves like a standalone object containing a snapshot of the data. Further changes to this object will not be persisted in Realm.
Retrofit
Retrofit is a library from Square that makes it easy to work with a REST API in a typesafe manner.
As Retrofit uses GSON internally, it also needs a properly configured GsonConverter if you want to deserialize network JSON data to RealmObjects.(); // Configure Retrofit to use the proper GSON converter RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint("") .setConverter(new GsonConverter(gson)) .build(); GitHubService service = restAdapter.create(GitHubService.class);
Retrofit does not automatically add objects to Realm, instead you must manually add them using the
realm.copyToRealm() or
realm.copyToRealmOrUpdate() method.:
Next Steps
Take a look at our examples to see Realm used in practice in an app.
Happy hacking! You can always talk to a live human developer on realm-java.:
- The upper limit of class names is 57 characters. Realm for Android prepend
class_to all names, and the browser will show it as part of the name.
- The length of field names has a upper limit of 63 character.
- The dates are truncated with a precision of one second.
- Nested transactions are not supported, and an exception is throw if it is detected.
- Strings and byte arrays (
byte[]) cannot be larger than 16 MB.
- Case insensitive string matches in queries are only supported for character sets in ‘Latin Basic’, ‘Latin Supplement’, ‘Latin Extended A’, ‘Latin Extended B’ (UTF-8 range 0-591).
Objects
Due to how the proxy classes override getters and setters in the model classes there are some restrictions to what is allowed in a model class:
- Only private instance fields.
- Only default getter and setter methods.
- Static fields, both public and private.
- Static methods.
- Implementing interfaces with no methods.
This means that it is currently not possible to extend anything else than
RealmObject or to override methods like
toString() or
equals(). Also it is only possible to implement interfaces. We are working on lifting these restrictions.
Sorting
Sorting is currently limited to character sets in ‘Latin Basic’, ‘Latin Supplement’, ‘Latin Extended A’, ‘Latin Extended B’ (UTF-8 range 0-591). For other charsets, sorting will not change the RealmResults object.
Case insensitive queries
Setting the caseSensitive flag when using
equalTo,
contain,
endsWith or
beginsWith will only work on characters from the English locale. Read more about these limitations here.
Threads
Although Realm files can be accessed by multiple threads concurrently, you cannot hand over Realms, Realm objects, queries, and results between threads. The thread example shows how to use Realm in a multithreading environment.
Migration
The migration support has not matured yet, and you have to rely on a number of internal classes. We plan to have easy-to-use migration support in the future but currently the best option is to look at the migration example.
Realm files cannot be accessed by concurrent processes
Although Realm files can be accessed by multiple threads concurrently, they can only be accessed by a single process at a time. Different processes should either copy Realm files or create their own. Multi-process support is coming soon.
How can find and view the content of my Realm file(s)?
This SO question describes where to find your Realm file. You can then view the content with our Realm Studio.
How big is the Realm a “core” in the code, what is that?
The core or Realm Core is our AP.
A consequence of proxy classes overriding setters and getters is that you cannot create customised versions of setters and getters. A workaround is to use an ignored field (the
@Ignore annotation), and use its setter and getter to add your customisation to. A model class found look like:
package io.realm.entities; import io.realm.RealmObject; import io.realm.annotations.Ignore; public class StringOnly extends RealmObject { private String name; @Ignore private String kingName; // custom setter public void setKingName(String kingName) { setName("King " + kingName); } // custom getter public String getKingName() { return getName(); } // setter and getter for 'name' }
You can then use the
setKingName() as a custom setter instead of
setName(). Please note that the custom setter uses
setName() and does not assign directly to the field..
What to do about out-of-memory exceptions?
Realm for Android is built upon an embedded storage engine. The storage engine does not allocate memory on the JVM heap but in ‘native’ memory. When the storage engine cannot allocate ‘native’ memory or the file system is full, Realm will throw an
io.realm.internal.OutOfMemoryError exception, and your app has run out of memory. It is important not to ignore this exception by having an empty
catch block or a too broad
catch. If your app does continue running, acessing the Realm file might leave your Realm file in a corrupted or inconsistent state. In the case of
io.realm.internal.OutOfMemoryError,File.)
What does the exception ‘Annotation processor may not have been executed.’ mean?
During compilation of your app, the model classes are processed and proxy classes are generated. If this annotation process fails, the proxy classes or their methods cannot be found. When your app begins running, it Realm will throw exception with message ‘Annotation processor may not have been executed.’. You may see this in case you use Java 6 as it doesn’t support inheriting annotations. You then have to add
@RealmClass before your models. Otherwise it can often be solved by removing/cleaning all generated or intermediate files and rebuild.
Android Chromium WebView
Note: This bug has been fixed with v43 of the WebView.
Starting with 5.0 Lollipop, Android began shipping a Chromium WebView that can be installed and updated through the Play Store. Unfortunately there is a bug in the latest version of this webview (v40), that can cause encrypted Realms to crash if used together.
The current work around is to either downgrade the WebView to v39, or to make sure to call CookieManager.getInstance() before opening the encrypted Realm.
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_webview); CookieManager.getInstance(); // Prevent Realm from crashing Realm realm = Realm.getInstance(this, getKey()) }
Details can be found here
Encryption is not supported on this device Exception
A few older devices (HTC One X for example) does not work correctly with signal handlers. Realm encryption currently relies on the signal handler which means encryption of Realm doesn’t work on those devices. The same problem on HTC One X happened to Firefox for Android as well. See On-demand decompression startup failure with Firefox on the HTC One X (Android 4.2.2) for more details.
From
v0.82.2 Realm tries to detect if the device has this problem when the encrypted Realm is opened, and throws a
RealmEncryptionNotSupportedException on those devices.
Please consider catching the
RealmEncryptionNotSupportedException and use Realm without encryption on those devices instead for now.
We are working on an alternative solution for encryption which will support those devices as well in the future.
I see a network call to Mixpanel when I run my app, what is that?
Realm collects anonymous analytics when you run the Realm annotation processor on your source code. source code is annotated.+. | https://realm.io/docs/java/0.84.1/ | CC-MAIN-2018-51 | refinedweb | 4,953 | 57.16 |
Recently Browsing 0 members
No registered users viewing this page.
Similar Content
- By rudi
Hello,
<edit>
In this posting below you will find a script to get an Active Directory User's Group Memberships including nested Group Memberships:
</edit>
quite a while ago I started this thread:
#include <AD.au3> _AD_Open() $user=_AD_SamAccountNameToFQDN("ASP") $group=_AD_SamAccountNameToFQDN("daten-Bestellung-QS_lesen") $result=_AD_IsMemberOf($group,$user,false,True) ; $Group is the 1st, $User the 2nd param ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Error code: ' & @error & @CRLF) ;### Debug Console _AD_Close() this works fine, thanks for the help in the other thread.
Howto to get the "chain" of groups for nested group memberships?
In AD.AU3 I found the function _AD_RecursiveGetMemberOf(), which might be an approach, (get all the group content then sort out what's needed), just wondering if there is another function that I've overlooked, that directly would give me the "nested membership chain" *ONLY*?
Regards, Rudi.
- Blois
Hey Guys,
Good?
I'm ned help to consult in other domain. My three domain contains any domains.
How do I get this query done?
Tks for the Help!
-??
- | https://www.autoitscript.com/forum/topic/193984-ad-member-of-group-in-group/?do=showReactionsComment&comment=1391300&reaction=1 | CC-MAIN-2022-40 | refinedweb | 182 | 63.19 |
The of the master bedroom into the next available room, which is my office, and because the dog is intensely curious about the carpet layers, and at least one of the carpet layers is terrified of the dog, and the dog gets neurotic if left alone behind a closed door, I need to be in a room with a door I can close while the carpet dudes do their work. Thus: Daughter’s room. Said daughter is out of the house until this afternoon, which helps.
On the other hand, the carpet in here in new, and I think I may be getting a contact high on the venting plastic gases. I may have to crack open a window. Also, Edward from Twilight is staring down at me moodily from above my daughter’s desk, which is unsettling. The interests of an eleven-year-old girl are really not my own, I have to say.
Anyway, exiled as I am in a pink-purple, carpet-fumed room with a large neurotic dog while people pound away at the floor just down the hall, I’m expecting not to get a whole lot done today. Time for a good book, of which, fortunately, I have several.
41 thoughts on “In Exile”
But…you have EDWARD to keep you company. Is he sparkling?
I predict some weird dreams for you tonight.
It’s so… PURPLE
I’d be so tempted to draw a Sharpie marker mustache on Edward.
“But honey, the fumes told me to… Kodi was there, he’ll tell you…”
Good book, eh? Does that mean it’s time to RELEASE THE KRAKEN? It’s not gonna release itself, you know.
I actually like the color on the walls although it seems a bit dark. I would have chosen something a little lighter. In a slightly related note, it seems the actor who played Jacob in the Twilight movies will be in Pittsburgh to film a movie in July. I’m hoping that I don’t have to be anywhere near where he is filming.
If you’re feeling a contact high, imagine what the puppy is going through.
My god, it’s full of purple!
That is a good size book collection for a little girl.
I think that shot was staged. There’s no way an eleven year old’s room is that clean.
Terrified of the dog? But Kodi’s such a cute widdle puppy!
@Joe M, #9: Heck, even _my_ room isn’t that clean.
Wow, what a perfect room for an 11 year old. Isn’t amazing how very noisy carpet laying is? And how long it takes, too. You did tell the carpet layer that Kodi isn’t really an anteater, didn’t you? And that Kodi is just as scared of the carpet layers as they are leery of him. Anyway, crack open a window, ignore Edward, and have a semi-productive day.
Count your blessings. Athena could be part of Team Jacob instead.
I like seeing full bookshelves in any youngster’s room. It’s a good thing.
Oh, that kind of lavender. (Understands facebook post now.)
It’s nice that you’ll let the fair Athena pick her room colors. My parents let us do that too as long as the color was off-white.
Joe M. @ 9:
If one of my parents needed to temporarily use my room for an office when I was eleven, my room would have been spotless.
(Also, while I’m generally a bit of a slob, my younger brother never has been. His room would’ve looked almost that clean most days.)
Having to look at a big poster of Edward? Don’t they make the inmates at Gitmo do that? That should be classified as Cruel and Unusual Punishment!! I like the colors of Athena’s room.
Edward? Oh god no. Well at least you have a dog and a book. =)
“I predict some weird dreams for you tonight.” – #1
If you do have dreams about Edward, you have to tell us about them.
The dog seems to be taking it all in stride…
I saw a poster pic on Reddit requesting Buffy’s return (to kill Edward of course). Made me laugh.
Apparently there is also a Youtube of Buffy vs. Edward, but I haven’t seen that one yet.
I should send in a good picture of our dog soon – we have a giant schnauzer who LOVES sleeping on my bed. But only when I’m also sleeping on it.
Most likely the adhesives. Shoulda requested low VOC adhesives. That stuff will be leeching out at you for years. Sorry dude. Seriously, do open an window. It truly is toxic.
I had every single window open in my house when we recarpeted the upstairs. It really didn’t take that long to go away. Carpet is so much better than it used to be.
Poor doggie. Poor writer. All that purple.
The schnauzer: an object case in how we rearrange reality to suit ourselves. Our schnauzer is not miniature; yours is giant! (The “giant” schnauzer used to be simply the schnauzer; the current schnauzer used to be the miniature and the current miniature used to be the toy. Soon they’ll have a toy the size of a shrew. Then the schnauzer will be the giant schnauzer and the giant schnauzer will be the dino-schnauzer.) When will you tape a whole pheasant to Codi and get rid of that silly cat meme? That’s what the (giant) people want.
On cleanliness: when I was eleven, my room was that neat. Most of the time. Also, I would have been salivating over the bookshelves. I had that many books, but not that much space to keep them. (And it looks like she, like me, does not have enough room on the shelf for all of them!)
I miss my books. It simply wouldn’t be practical to bring them all to college. They wouldn’t all fit in my *room*, never mind shelves.
Oh . . . and TomG: Buffy v. Edward:
Awww. Kodi just clearly wants to be friends.
Preteen girls unite! That appears to be pretty near the exact shade of carpeting I asked for and got in my room when I was ten.
No lavender paint on the walls, but we did put up wallpaper with purple flowers all over it. And these windowshades with giant bunches of African violets.
My parents were pretty indulgent, I must say.
I love Athena’s room! I would have loved that carpet in my room when I was her age. Heck, I wouldn’t mind it now!
Have a great time relaxing with the dog and your book.
#26 Brynne, thanks! I needed that!
Looks like Diary of a Wimpy Kid: The Last Straw is in the top of that pile of books on the floor.
Are Akitas ever NOT neurotic? If I wear a different hair style or hat, mine gives me a wary look. Mine seems to watch (always facing the door) and be hyper sensitive about anything different, which makes her very good at what she does (protect, guard, and alarm).
the dog is intensely curious about the carpet layers, and at least one of the carpet layers is terrified of the dog
My brain insists on reading ‘carpet layers’ as in ‘layer cake’ as in ‘differentiated strata of the carpet’ — possibly the carpet and the carpet pad.
This creates a subsequent image of either the carpet itself, or the carpet pad, being terrified of the dog. Poor carpet pad.
@31 You beat me to that comment by about 5 minutes. I did the same thing.
When I read that Edward from Twilight was staring down at you, for one brief moment (before I read on) I thought that perhaps the fumes HAD gotten to you…although if that were the case, perhaps Athena would be happier to keep the fumes…
I’m skeptical about the dog’s neuroses. In every photo that -I- have ever seen of this dog, it appears to be unconscious.
Meanwhile–just wanted to say, I got my copy of YYOUR HATE MAIL WILL BE GRADED YESTERDAY, and crawled into bed in a state of exhaustion last night (trying to finish overdue book that frantic editor is asking after daily), and thought I’d barely have the concentration or energy to get through a couple of essays before falling asleep. Fifteen compulsively-read essays later, I was appalled to realize how much much-needed sleep I would lose, thanks to you. Damn you, sir!
that room is so full of win. :) your daughter just gets cooler and cooler.
Oh Carpet High.. how I love thee.
My grandfather has been a Flooring Installer (not Carpet Layer, bah!) for 44 years, and needless to say I’ve helped him with a lot of jobs since I was a little kid. Haven’t done it in a while with him, but every time I smell new carpet somewhere it gets me all excited. Feels good to remember childhood.
Oh… oh god. I’ve been on the internet too log. I saw that photo and my first thought was “Looks ‘shopped.” *commits seppuku and dies with honor*
Condolences on having to play musical rooms — it’s been decades since I did that, but then *I* was doing the decorating (in that “copious spare time” we all know & love), so it lasted longer and was more traumatic.
Did Athena get her purple room before or after the kid in the Home Depot ad? and does she want to dye her hair purple too? It’s coming, you know. I had an 18 year old blonde daughter who is now a 19 year old redhead.
Sounds like a certain young lady needs to be reminded: “Real vampires DIE in sunlight.”
I love the paint. I hate white rooms. | http://whatever.scalzi.com/2010/03/31/in-exile/ | CC-MAIN-2017-09 | refinedweb | 1,655 | 84.27 |
Hi,
I`ve started writing an annotation based couchdb Document Object Mapper
called jBeanbag.
The approach I`ve taken is to use 100% annotations so the users domain model
does not have to derive from the api. I`m also trying to make it CouchDB
focused rather
then JSON focused which a few of the other apis seem to be. The aim is to
enable easy mapping to and from CouchDB documents to Java classes and also
provide some infrastructure support
for example @Linked annotation could be above a field meaning the field
should be a linked document and handling conflicts by returning Java objects
of the different versions in an exception.
I`d also like to put in more annotations for other kinds of relationships
like bi-directional.
An example Java annotated class is at the bottom of this mail.
I`m using the ASM library
to create a Meta model of the Java classes ,including all the CouchDB
configuration for that class, is then cached in ehcache and can be reused
for serializing to/from the JSON. The JSON parsing I`m using the the Jackson
JSON Streaming/Mapping apis.
ASM helps by making it easy to analyze the class structure in advance ,using
its visitor pattern, as well as giving access to Generics information.
So I`m looking to the community for any CouchDB patterns they keep repeating
in code which could be included in the framework as well as anyone else who
could be interested in contributing to the code base.
Going forward I`d also like to provide wrappers for Groovy to make it a bit
more ,well Groovier and Scala wrappers.
At the moment theres not a released version but I`m hoping to have a 0.01
version soon. But I have done most of the simple conversion to/from JSON for
primitives,arrays,maps,lists,
sets,Objects, Wrapper Objects e.g Integer class,enums and Dates. Currently
it`ll struggle with things like Arrays of Maps or Lists of Lists but that
should be fixed soon. I`m currently working on the HTTP client side of
things.
Thoughts,comments and especially help all appreciated.
regards
Darran
@Document(location="people")
public class Person{
@Id
private String id;
@Revision
private String revision
//Will be a list of embedded pet objects in the person document
//not really needed as embedded is the default
@Embedded
@NotNullable
private List<Pet> pets;
//List will be parsed and written as linked documents to this class
@Linked
private List<Car> cars;
private String name;//Will be written as name:<value> in document
@Ignore
private String dontWriteToDocument; //Won`t be written to the document
...... | http://mail-archives.apache.org/mod_mbox/couchdb-user/201004.mbox/%3Cm2jeba3d3df1004130018kb8267b2cxca90e8ec509efcfa@mail.gmail.com%3E | CC-MAIN-2015-48 | refinedweb | 443 | 57.91 |
/*This program will allow the user to search for a particular file he/she desires and count the number of times a particular substring occurs in the file. */ import java.util.Scanner; import java.io.*; public class Assignment4 { public static void main(String[] args) throws IOException { int count = 0; Scanner keyboard = new Scanner(System.in); System.out.println("Enter the name of the file you would like" + " to search."); String fileName = keyboard.nextLine(); File file = new File(fileName); if(!file.exists()) { System.out.println("The file " + fileName + "is not found."); System.exit(0); } Scanner inputFile = new Scanner(file); System.out.print("Enter the substring you would like to find" + " the occurance of: "); String userSearch = keyboard.nextLine(); int stringSize = userSearch.length(); int stringStart = userSearch.charAt(stringSize); while(stringStart != -1 && stringSize != -1) { count++; } System.out.print(count + "occurences of the substring " + "\"" + userSearch + "\" were found in " + fileName + "."); inputFile.close(); } }
so there is my code, the object of this program is to count the number of occurrences of a particular sub string in a file.
My teacher said it can be done with the charAt and length methods of a String.
My while loop is messed up, which is the main problem with my program. | http://www.javaprogrammingforums.com/whats-wrong-my-code/12420-how-do-i-fix-my-program.html | CC-MAIN-2015-40 | refinedweb | 201 | 60.72 |
Computer Science Archive: Questions from February 14, 2009
- Gentleman askedcorrespon... Show more
Let G be a graph whose vertices are the points of an(m+1)×(n+1) grid, i.e., vertex (i, j)
corresponds to the point in the grid at row i and column j,0 <= i <= m and 0 <= j <= n.
A vertex (i, j) with 0 <= i <= m and 0 <=j <= n has the following edges coming into it in G:
(i) If i > 0 then there is a vertical edge of costD(ai) coming from the vertex (i − 1, j);
(ii) if j > 0 then there is a horizontal edge of costI(bj) coming from the vertex (i, j − 1);
(iii) If i > 0 and j > 0 then there is a diagonal edge comingfrom the vertex (i − 1, j − 1).
1) What is the graph-theoretic interpretation of the quantity C(i,j) in terms of paths in the graph G ?
2) What is the graph-theoretic interpretation of the quantity H(i,j) in terms of paths in the graph G ?----------------Background andNotation-------------------------------------------Recall that this is theproblem of finding a minimumcost sequence of operations on agiven
string A = a1a2 . . . am thattransforms it into another given string B =b1b2 . . . bn.
The symbols in A and B are from an alphabet of constant size
(e.g., for lowercase English, the alphabet size is 26). The allowedtypes of operations are
(i) inserting a symbol x into A, whose cost is denoted by I(x);
(ii) deleting a symbol x from A, whose cost is denoted byD(x);
(iii) substituting in A a symbol y for a symbol x, whose cost isdenoted by S(x, y).
The I, D and S cost tables are given as part of the input, alongwith the two input strings A and B.The O(mn) time algorithm relies oncomputing the entries of an (m+1) × (n + 1) table C in whichC(i, j), for 1<= i <=m and 1<=j<=n, is the minimum costof transforming a1 . . . ai intob1 . . . bj .
C(0, j) is the minimum cost of transforming the empty string intob1 . . . bj , and C(i, 0) is the minimum
cost of transforming a1 . . . ai into theempty string. The crucial observations that made the O(mn) time
algorithm possible were the following equations. Equations forC
1. C(0, j) = I(b1) + I(b2) + ·· · + I(bj)
2. C(i, 0) = D(a1) + D(a2) + ·· · + D(ai)
3. C(i, j) = min{C(i, j − 1) + I(bj),C(i −1, j) + D(ai),C(i − 1, j − 1) +S(ai, bj)}• Show less
computing C(m, n) can be done in O(mn) time and O(m+n) space. Wealso explained how,
if we use O(mn) space, we can compute in O(mn) time not only C(m,n) but also
the optimal sequence of operations that achieves that C(m, n)cost.
The purpose of this homework is to explore an O(m+n) spacealgorithm for finding the
optimal sequence of operations in O(mn) time0 answers
- Anonymous askedNeed help finding out why this wont compile. Let me know ifyou need the MyGenLL class too. Keep gett... Show moreNeed help finding out why this wont compile. Let me know ifyou need the MyGenLL class too. Keep getting the same error:type parameter T is not within its bound
public class MyGenQueue<T> extends MyGenLL<T>
public class MyGenQueue<T> extends MyGenLL<T>
{
public MyGenQueue()
{
head = null;
tail = null;
}
public void enqueue(Telement)
{
super.addTail(element);
}
public T dequeue()
{
super.removeHead();
}
public booleancontains(T element)
{
if(super.contains(element))
return true;
else
return false;
}
public booleanisEmpty()
{
if(super.isEmpty())
return true;
else
return false;
}
}
• Show less0 answers
- Anonymous askedWrite a program that accepts a phrase of... Show morePlease help me with this program using posix threads and C
Write a program that accepts a phrase of unspecified length onthe command line. For example:
prompt% letterprint Operating Systems Class at Kent-State
The main() in this program has to create two threadsrunning functions (vow and cons). The threads should take turnsprinting the respective words of the phrase supplied on the commandline. The vow thread should print all the words that start with avowel and the cons thread should print all words starting with aconsonant. Note that the main thread (running main()) should notprint anything itself – the output should be supplied by thethreads that it creates. The order of words in the phrase shouldnot be
changed in the printout. Your program should work for any phraseof any reasonable length, not just the
one given in the example. The output of you rprogram shouldlooks similar to the following
prompt% letterprint Operating Systems Class at Kent-State
vow: Operating
cons: Systems
cons: Class
vow: at
cons: Kent-State
In this part you are not allowed to use synchronizationprimitives such as mutexes for thread coordination. You can usesched_yield() torelinquish control of the CPU.• Show less1 answer
- Anonymous askedAn asynchrous device, such as a teletype, transmits charactersone at a time with unpredictable delay... Show more
An asynchrous device, such as a teletype, transmits charactersone at a time with unpredictable delays between characters. Whatproblems, if any, do you foresee if such a device os cinnected toLAN and allowed to transmit at will (subject to gaining access tothe medium)? How such problems be resolved?• Show less1 answer
- Anonymous asked1(A)- write a function called mult() that accepts two floatingpoint numbers as parameters, multiplie2 answers
- Anonymous askedIs the difference basically that acti... Show moreWhat is the difference between an ActionEvent and aMouseEvent?Is the difference basically that action event covers allevents and only processes 1 event a time, whereas mouse eventscover all the mouse events and can process multiple mouse events ata time?Please tell me if I'm right or wrong and if i'm wrong pleaseexplain why. I promise i'll rate lifesaver within 24 hrs.• Show less1 answer
- Anonymous asked1.Design an 8-bit Square-root unit. Show the datapath and thecontrol unit. Estimate the number of cl0 answers
- Anonymous askedDesign a computer.Add an instruction ADD2 150H,151H,152H that stores result in memory.Find Max 200H.... More »0 answers
- Anonymous askedIF (DI) = $ FFFFFFFF, the instruction CLR.B D1yields.....Please show how you solved it step by step... Show moreIF (DI) = $ FFFFFFFF, the instruction CLR.B D1yields.....Please show how you solved it step by stepa)$0000000b)$FFFFFF00c)$FFFF0000• Show less1 answer
- Anonymous askedLet (D2) = $0FFF0105 and (D1) = $10000001. The result of ADD.WD2, D1 is ....Please show step by step... Show moreLet (D2) = $0FFF0105 and (D1) = $10000001. The result of ADD.WD2, D1 is ....Please show step by step how youget the answer thanks...(a)$1000 0006(b)$1000 0106c) $0FFF 0106• Show less1 answer
- Anonymous askedThe addressing mode for the source operand in the instructionMOVE.W (A1)+, D1 is ....Please explain... Show moreThe addressing mode for the source operand in the instructionMOVE.W (A1)+, D1 is ....Please explain why withmore details..thanks.a) postincrementb) register indirectc) stack addressing• Show less1 answer
- Anonymous askedi... Show more
Consider the followingprogram:
// Simple mutual exclusion algorithm
boolean blocked[2];
int turn;
void P(int id)
{
while(true)
{
blocked[id] = true;
while(turn != id)
{
while(blocked[1-id])
;
turn = id;
}
/* critical section */
blocked[id] = false;
/* remainder */
}
}
void main()
{
blocked[0] = false;
blocked[1] = false;
turn = 0;
parbegin(P(0), P(1));
}This is a software solution to the mutual exclusion program. Find acounterexample that demonstrates that this solution isincorrect. • Show less1 answer
- G3nghis askedLet CO = A • B + A • CI + B • CIand S = A ⊕ B ⊕ CI.
Use switching algebra to prove CI ⊕ CO = (A ⊕ B)... Show moreLet CO = A • B + A • CI + B • CIand S = A ⊕ B ⊕ CI.
Use switching algebra to prove CI ⊕ CO = (A ⊕ B)′ • (A ⊕ S).
I am confused. Can anyone help me? You will definitely getlifesaver if you get this.
• Show less1 answer
- Anonymous asked1.Write a program to add two large integers with up to 300digits.... Show moreAnswer the following two problems:
1.Write a program to add two large integers with up to 300digits. One approach is to treat each number as a list, each ofwhose elements is a block of digits of that number. For example,the integer 179,534,672,198 might be stored with block [0]=198,block [1]= 672, block [2]= 534, block [3]= 179. Then add twointegers (lists), element by element, carrying from one element tothe next when necessary.
2.Write a program for the prime number-finder problem in Problem1, but use a dynamically allocated array.• Show less1 answer
- Anonymous askedYour company's internal studies show that a single-core system issufficient for the demand on your p... Show moreYour company's internal studies show that a single-core system issufficient for the demand on your processing power. You areexploring, howerever, where you could save power using twocores.
Assume your application is 70% parallelizable. By how much couldyou decrease the frequency and get the same perfomance? Please givesome explanation.
• Show less3 answers
- Anonymous askedHow do you read strings and characters in ARM assembly language? Also, after reading them, how would... More »2 answers
- Anonymous asked0 answers
- Anonymous asked0 answers
- Anonymous askedd.... Show morea. find the 16's complement of B2FA
b. covert B2FA to binary
c. find 2s complement of result of b
d. convert result of c to hexadecimal.
thank you
• Show less2 answers
- Anonymous askedb.125-... Show morepeform subtraction on given unsigned numbers using 10s complementof the subrhend.
a. 6428-3409
b.125-1800
c. 2043-6152
c. 1632-745
thank you very much
• Show less1 answer
- Anonymous asked73 F4 E5 76 E5 4A EF 62 73 the leftmost part of the ascii (73) is a parity bit. theremaining bits ar1 answer
- Anonymous askedpeform subtraction using 2s complement of the subtrhend
a. 10011-10001
b.100010-100011
c. 1001-101000... Show morepeform subtraction using 2s complement of the subtrhend
a. 10011-10001
b.100010-100011
c. 1001-101000
d. 110000-1010
tyvm • Show less1 answer
- Anonymous askedFind all the prime immplicants for the following booleanfunctions and determine which are essential:... Show moreFind all the prime immplicants for the following booleanfunctions and determine which are essential:F(A,B,C,D) = Σm(0,2,3,5,7,8,10,11,14,15)How get it and Show me and explain. I trying understand ornot.• Show less2 answers
- Meagghan askedMy program has a pointer arraywith class type( name *array[300] ) , and I need to sortthe ID... Show moreHi,My program has a pointer arraywith class type( name *array[300] ) , and I need to sortthe IDs in this array with a classfunction, how do I call the function withall variables in the array.class name{int ID;void sort();};(here is what I mean if what I said above is notclear,when you have this array " int a[8] " you can passthe whole array into a function by doing this sort(a);but my array is like this " name *array[300]" and how I do pass this whole array into a classfunction?)Thanks.• Show less1 answer
- tejdhar askedFive jobs are waiting to run. their expected run times are9,6,3,5,X. In what order should they minim... Show moreFive jobs are waiting to run. their expected run times are9,6,3,5,X. In what order should they minimize average responsetime? (Your answer will depend on X.)
• Show less1 answer
- tejdhar askedWhat is the biggest advantage of implementing threads in userspace? What is the biggest disadvantage... Show moreWhat is the biggest advantage of implementing threads in userspace? What is the biggest disadvantage?
• Show less1 answer
- Anonymous askedpublic XClass(int a, doub... Show morepublic class XClass{private int u;private double w;public XClass(){}public XClass(int a, double b){}public void func(){}public void print(){}}XClass x = new XClass(10, 20.75);a. How many members does class XClasshave?b. How many private members does class XClasshave?c. How many constructors does class XClasshave?d. Write the definition of the member func so thatu is set to 10 and w is set to15.3.e. Write the definition of the member printthat prints the contents of u andw.f. Write the definition of the default constructor of theclassXClass so that the instance variables areinitialized to 0.g. Write the definition of the constructor with the parametersof the classXClass so that the instance variableu is initialized to the value ofa and the instance variable w isinitialized to the value of b.h. Write a Java statement that prints the values of theinstance variables of x.i. Write a Java statement that creates the XClass object t and initializes theinstance variables of t to 20 and 35.0respectively.• Show less1 answer
- Anonymous askedi5e is my problem that I need help answering from this chapter I have just finished. Please help!... Show morex.øi5e is my problem that I need help answering from this chapter I have just finished. Please help!Assume that the method toString is defined for the class Clock as given in this chapter What is the output of the following statements?Clock firstClock;Clock secondClock = new Clock(6, 23, 17);firstClock = secondClock.getCopy( );System.out.println(firstClock);********************************************************************toString listed in Chapter 8 below********************************************************************import java.util.*;public class TestProgClock{static Scanner console = new Scanner(System.in);public static void main(String[] args){Clock myClock = new Clock(5,4,30); //Line 1Clock yourClock = new Clock(); //Line 2int hours; //Line 3int minutes; //Line 4int seconds; //Line 5System.out.println("Line 6: myClock: "+ myClock); //Line 6System.out.println("Line 7: yourClock: "+ yourClock); //Line 7yourClock.setTime(5,45,16); //Line 8System.out.println("Line 13: After setting the "+ "time, yourClock: "+ yourClock); //Line 9if (myClock.equals(yourClock)) //Line 10System.out.println("Line 11: Both times "+ "are equal."); //Line 11else //Line 12System.out.println("Line 13: The two times "+ "are not equal"); //Line 13System.out.print("Line 14: Enter the hours, "+ "minutes, and seconds: "); //Line 14hours = console.nextInt(); //Line 15minutes = console.nextInt(); //Line 16seconds = console.nextInt(); //Line 17System.out.println(); //Line 18myClock.setTime(hours,minutes,seconds); //Line 19System.out.println("Line 20: New myClock: "+ myClock); //Line 20myClock.incrementSeconds(); //Line 21System.out.printf("Line 22: After incrementing "+ "the clock by one second, "+ "myClock: %s%n", myClock); //Line 22yourClock.makeCopy(myClock); //Line 23System.out.println("Line 24: After copying "+ "myClock into yourClock, "+ "yourClock: " + yourClock); //Line 24}//end main}1 answer
- Anonymous asked(BC' + A'D) (AB'... Show more
Simplify the following expressions using Booleanalgebra
a. A'B + ABC' + ABC
b. (BC' + A'D) (AB' + CD')• Show less1 answer | http://www.chegg.com/homework-help/questions-and-answers/computer-science-archive-2009-february-14 | CC-MAIN-2014-52 | refinedweb | 2,414 | 66.84 |
indicates the rec'bles quality &
the success of the co. in
collecting o/s rec'bles. Faster
Remember TSA - turnover gives credibility to
Turnover =
the current & acid test ratios
Sales(numerator
) divided by Ave
(denominator)
Accts Rec'bles
Turnover
reducing A/R wud improve TO ratio
numerator is sales
except for AP &
Inventory (COGS)
denominator is
average of the
name of the
formula
this measures of how
quickly inventory is sold is
an indicator of co.
performance. The higher the
turnover in gen, the better
the performance
a high ratio indicates effecive
assets use to generate sales
Inventory
Turnover
Total Assets
Turnover
A/P Turnover
Compute COGS if not given
Net Cr Sales
COGS
Net Sales
COGS
Ave Net Receivables
Ave Inventory
Ave Total Assets
Ave Net A/P
AVERAGE TURNOVER IN DAYS -just reverse the turnover ratio and divide the deno
indicates the ave. no. of days
required to collect A/R; the
more he sales are o/s. the
longer the rec'bles are o/s
A/R Turnover in
days aka Days
Sales O/S
numerator is
average of the
name of the ratio
denominator of
turnover ratio
divided by 365
days
indicates the average no. of
days required to senn
inventory
indicates the no. of days bet.
Acq'n of inventory and
realization of cash fr selling of
inventory
Inventory
+ Turnover in days = Operating Cycle
Inventory
Conversion Period
same result as days
of COS in Inventory
= Ave Inventory
over (COGS/365)
Ave Net Receivables
Ave Inventory
365
Net Cr Sales/365
COGS/365
Inventory Turnover
Measures the time from cash outlay to cash collection in days. The CCC can be shortened in
increasing inv. turnover, collecting Rec'bles more quickly or deferring remitances on payables for a
longer period o time. Can be calculated by simply adding the results of 365/INV TO ; 365/A/R TO
and 365/ A/P TO. Use to evaluate co. liquidity - the ability of the co meet its obligation as they
become due.
Cash Conversion Cycle (CCC)
.
Annual Percentage Rate (APR) o
quick paymt discount
.
how long does it take for a co to buy inventory on credit fr a vendor, sell that inventory on credit, collect cash for the sale
and use the proceeds to pay the vendor for the purchase
Inventory Conversion
+
Period
Receivables
Collection Period
Payables Deferral
Period
.
365
Pay period less Discount
x
Period
RETURN - same formula as "TURNOVER" but instead of sales in the numerator, use
is the profitability ratio that
Remember RNA produces a % output making it
- Return = easy to campare companies
that differ in sizes
NI(numerator)
divided by
Average(denomi
nator)
Return of Total
Assets (ROA)
measures co.'s % return
relative to its capital
investment risk without
regard to the method of
financing (Income over
Invested Capital)
Return on
Investment
(ROI)
a critical measure for determining a co.'s effectiveness; measure of
the rate of return earned by a company on the equity component of
its capital structure. Shows how well a co. is using its funds to
generate earnings.
Return on Equity
(ROE)
Return on Common
Equity
evaluates profitability of a firm
Numerator is Net
Income
Net Income (NI)
NI + Int (1-Tax Rate)
Net Income
NI-Preferred Dividends
Denominator is
average of name of
the ratio
Ave Total Assets
Ave Invested Capital
(LT Liab + Equity)
Total Equity
Ave Common Equity
indicates profit rate & used
when used with the asset
turnover ratio, indicates rate
of return on assets
Profit Margin
OR
Profit Margin
x Investment Turnover
**Assets valuation can
impact ROI and ROA results
result RATIOS involves managing CA (esp cash) & CL so that a co. Adequate Working capital (WC) reserves mitigates risk. High leverage means higher risk but greater possible returns Operating leverage A co. with high operating leverage must produce sufficient sales sales revenue to over its high fixed operating costs but will be highly profitable once those fixed costs are met. Labor-inensive industries generaaly have low opearating leverage. down risk up Conservative WC mgt increase the ratio of CA to non CA (nore CA financed by non CL : WC up. current ratio up . Firms hat rely more heavily on fixed costs as opposed to variable costs will have higher levarage. risk down WC risks less WC inreases risks by exposing a co to the likelihood of a possible failure to meet current obligations and increases risks bec. current ratio. can meet its current obligations in an efficient manner. retains profit after paying taxes Net Income (NI) Pretax income Interest burden Pretax Income x EBIT x after crossing out.. ability to meet current obligation w/o liquidating its inventory = .Net Income (NI) Sales invested capital capital can also be computed as ave working capital plus ave PPE Ideal to invest in SBUs with higher ROI or ROE measures the effect on a firm's proftability caused by a change in sales. potemtially reduce returns and thereby increase profitability Aggressive WC mgt increae the ratio of CL to nonCL (more CA financed with CL : WC down. measures the extent to w/c co uses debt in its capital structure (must be w/in risk appetitie Financial Leverage Ave Total Assets Equity Extended Dupont Retu Tax burden x x reflects how much in pretax inc a co retains after paying interest to debt holders extent to w/c a co. The current and quick r Working Capital (WC) Managementwealth. Capital intensive industries often have high operating leverage. It Quick (Acid Test) Ratio used in working capital analysis to evaluate firm's short-term liquidity.
liquidity and safet Dsiadvantage of high cash levels = ROA down Either speeding up cash inflows or slowing down cash outflows increases cash balances Method to speed collection Customer screening and credit policy . higher current ratio is better.are bank requirement related to a loan . concern of treasurer . drafts (increases payable float) .Current ratio or WC ratio measures the no. the % of customers avaling disc & rest do not avail disc to meet payments arising fr ordinary vourse of buisiness cash maybe needed to take advatange of temporary opportunities to maintain safety cushion to meet unexpected needs. improving ratio an inc ability to pay off CL. dec in CA or combination of both.is the difference bet the balance of checks o/s which have not cleared in the bank and deposits made b .use of draft delays a cash disbursement and increases payable float Overdraft protection . = = if only terms of discount is given. of times CA exceed CL and way of measuring short-term solvency and also shows ability of the firn to generate cash to meets its short-term obligations. line of credit & zero balance account Tools for Cash Management Float . increase in short-term debt.OD loans is activated when an OD occurs and maybe automatically paid with next deposits compensating balances . decline in of ratio implies a reduced ability to generate cash. and attributable to using LT borrowing to repay shot-term debt cost of credit discount aka cost of not taking discount aka memorize Annual Percentage Rate (APR) of quick paymt discount Average collection period in days Motives for holding cash Transaction motive Speculative motive Precautionary motive .bank requires a certain balance to be maintain Interest paid to compute effective int rate with a compensating balance ex loan of $200k @ 12% w/ 20 % compensating balance Net proceeds . prompt billing and payment discount Expedite deposits Electronic Fund Transfer & Lockbox systems Methods to delay disbursements defer payment.
the lower the ratio .A/R Management balancing credit and collection policies to optimize ave colletion period and numbre of days' sales in receivables factor (sell) its receivables to get more quicly but its costly therefore this shld be the last resort sale of A/R to a fac lockbox system . position.is used to accelerate the inflow of funds Trade credit is the primary source of short-term credit for small firms Debt-to-Equity ratio indicates the degree of protection to creditors in case of solvency. = Asset base = Hurdle Income = Total target income = . the > the level of solvency and the greater the presumed ability to pay debts = Operating Cash flow to total debt Time Interest earned = the ratio reflects the ability of a company to cover interest charges. The lower this ration the better the co. = Debt ratio aka Debt-to-Assets ratio the ratio indicates how much of the total assets are financed by the creditors = Debt-to-total-capital ratio measure of financial leverage. The next annual dividend is expected to be $4. the ratio provides indication related to org's LT debt-paying ability.25 and is expected to grow at a rate of 7%. The corporate tax rate is 30%. It uses income bef interest and taxes to reflect the amt of income available to cover interest expense = cost of factoring = Cost of equity capital = Using DCF.estimate the cost of equity capital of a firm with the stock of $85.
THERE IS TRADE-OFF BT CARRYING COSTS (THE COSTS OF HOLDING INVENOTRY) AND ORDERING COSTS (C OR ORDERING ADDITIONAL INV). but inventory must be rrdered more frequently. w/c increases ordering costs. The model can be applied to mgt of any exchangeable goods. if lead time becomes more variable. which will have a direct impact on inventory cost the cost of placing an order impacts order frquency.Inventory management- inventory depends on sales forecasts. lack of inventory can result in lost of sales and excessive inventory can result in burdensome invenotry investments and lost invenotry due to obsolescence or spoilage balancing the cost of carrying inventory against the cost of "stocking out" inventory turnover & no. then carrying costs are low. Levels are low. . the amt of stock needed to reduce the risk of stock outs will increase inventory level at w/c a co should order or manufacture additional inventory to meet demand and to avert incurring stockout costs = = Economic Order Quantity (EOQ) it anticipates orders at the point where carrying costs are nearest to restocking costs in order to minimize total inventory costs. WH MANAGING INVENToRY. The method assumes the periodic demand is known and annual sales volume isc a crucial variabl EOQ formula. . which affects order sizw and optimal inventory levels Tools or Inventory models and systems used in determination of the optimal level of inventory or Method of invnetory c Inventory turnover COGS / Ave Inventory Safety stock Reorder point co maintains safety stock to ensure mftg or customer supply requirements are met. If inv. For ex. of days' sales in inventory used to control inventory quanti Optimal level of inventory is affected by: usage rate of inventory per period of time the time required to receive the inventory the cost per unit of inventory. EOQ sttempts to minimize both ordering and carrying costs.
both DIRECT (the effect when co. the on-going periodic cash flows generated by the project and project Steps in Calculating a Capital Budgeting project's annual cash Flows: 1) Estimate net cash inflows 2) Subtract non cash tax deductible expenses to arrive at pretax income (ex depreciation and amorization 3) Compute income tax expense based on the tax rate 4) Subtract tax expense from net cash inflows to derive after-tax cash flows Example: Cash inflow Less: Cash outflow Sales Cost 1000000 900000 . with a capital project or represent a noncash activity that p Stages of cash flows ina capital investment project include inception of the project (at time period zero). It prevents oversupply or interruption of the enti OTHER FORMULA Capital Budgeting process after-tax cash flows over life of the rproject. It maintains a smaller level of inventorym hence it in Kanban Inventory Control gives visual signals that a component required in production must be replenished. The method is used to create a precise schedules of which item just-in-time (JIT) model was developed to reduce the lag time bet inventory arrival and inventory use. received cash. of units is needed. JIT ties delivery of components to the speed of assem requires a considerable degree of coordination bet manufacturer and supplier. pays out cash. or makes a cas (indirect cash flow effects included transactions that are indirectly asso. MRP systems are generally computer-based and a determines the inventory req't when a given no.materials req't planning (MR extends the idea of computreized inventory control to manufacturing operations.
the higher the PV factor. aka Time-adjusted Rate of Return = or = . rate of return that producesan NPV of 0. produces.investment should not be made (IRR > NPV required rate of return) Factor of Internal Rate of Return (IRR) = require multiple trial & error computations.000 not deducted since there is no cash involved in depreciation but depreciation Depreciation tax shield DDCF valuation method = determine the present value of all expected future cash flows using a predetermine discount After-tax cash flows = After-tax cost of debt (kdx) = Cost of preferred stock = Cost of preferred stock (kps) = Where: Present value of 1 or a lump sum Dps = Preferred stock cash dividiends n = number of years Present value of an annuity Net Present Value (NPV) = Positive NPV . it is evaluated in relation to mgt's req'd hurdle rate after the computation. the lower the computed rate (IRR).investment should be made (IRR > NPV required rate of return) Negative NPV .Pre-tax Income (Net Inflow) (1-tax rate) After-tax Cash Flow Add: depreciation tax shield (21000 x 40%) After-tax cash flow 40% tax rate 100000 60% 60000 8400 68400 * depreciation of $21.
Payback Period-even cash flows(CF) time required to recover cost of an investment. or = = = + EVA = perforamce meeting stds Stock up : . the lower the computed rate (IRR). performance objectives have been met Required return for Residual Income hurdle rate = target rate or discount rate in computing NPV Economic Value added (EVA) is a residual income technique used for capital budgeting & perofrmance evaluation. where : = = % in capital structure = If P/S is given in the problem.0 which means that the PV of the inflows is > PV of the outflows Residual Income income in excess of desired minimum return historical weighted ave. hence. It measures actual dolars that an invetment earns hence high return invetment will not be rejected by hig-return divisions. breakup equity as to PS and CS. Cost of equity associated with invested capital. if the anount of the income fr investment exceeds the computed required return.EVA = not meeting stock down Required Return for EVA = Profit before interest but after tax Increase stock value/firm value Weighted Average Cost of Capital (WACC) is the average cost of debt and equity financing associated with the firm's existing assets and operations. IRR < hurdle rate = reject = Profitability Index = is also referred to as the "excess present value index" or simply PV index. = Discounted Payback Period same formula with payback period. just multiply the figures by the PV factor = Present Value Factor The higher the PV factor. Increases to the invetment or decreases to the cash flows serve to increase the PV factor = IRR -= discount rate at which NPV of the investment is equal to zero (0) IRR = discount rate at which NPV of the investment = zero (0) IRR > Hurdle rate (accept . ofen used in risky investmentm focuses on liquidity and risks. cost of capital is usually used as the target or hurdle rate. neglects total project profitability. It represents the residual (excess) income of project earnings in excess of cost of capital (incld. % in capital . Company hope that this ratioi will be over 1.
Cost of Retained Earnings (kre) Method 1: Capital Assets Pricing Model (CAPM) Cost of Retained Earnings (Kre)Method 2 : Discounted Cash Flow (DCF) Cost of Retained Earnings (kre)Method 3: Bond Yield Plus risk premium (BYRP) Market rate of interest = = = Risk-free rate + Risk-free rate + Risk-free rate + D=1 current + g Mrket value or price of the P0 outstanding common P Where: 0 stock D1 = the dividend pe share expected at the e g = the constant rate of growth in dividends = Pretax cost of long-term debt + market risk = risk-free rate of interet + inflation premium Lockbox systems expedites cash inflows (minimize collection float) Concentration banking is the method by w/c a single bank is designated as a central bank as a means of controllng zero balance account banking represents an account that maintains a zero bal and accompanied by a master or parent account the the availability of of idle cash Opportunity cost is the potential benefit lost by selecting a particular course of action ex revenue that will not Relevant cost those costs that will change in reponse to the selection of different courses of action Incremental Cost represent the change on cost associated with different alternatives Differential Cost represent the change in costs associated with 2 separate courses of action Avoidable costs represents the costs that can be averted by selecting different courses of action operating leverage the degree to which a firm used fixed operating costs as opposed to variable operating costs high operating leverage = high fixed operating costs & low variable operating costs .
000.00 = $ 44.555 x 3.000.000.5700) 3.300.60 = $ 12.57 Answer: PV cash savings/inflows annual savings x 3.00 900.306.300.00 PV of annuity of $1 @ 12% for 5 yearas 3.(10000 x .00 TO prove: 12305.00 PRE-TAX and AFTER-TAX CASH FLOWS : Cash Inflow Less:Cash Outflow Net Cash Inflow 40% Tax rate (Sales) (Cost) Pre-tax Cash Flows 1.000.000. It is also referred to as time-adjusted rate o NPV as discounted based upon a predetermined rate (discount or hurdle rate) & compared to investment on t Payback measures return of capital in years on either a discounted or undiscounted basus Acctg Rate of Return .00 100.financial leverage as the degree to which a firm uses debt to to finance the company combined (total) leverage results from use of both fixed operating costs and fixed financing costs tomagnify retuns to t Capital Budgeting techniques (use WACC as the hurdle rate) IRR utilize PV concepts to value both investments & the related cash flows.000.60 annual savings Annual savings need to make the I nvestment realize 12% = PV net cash outflows = 50000 .60 PV of $1 in 5 years at 12% 0.used GAAP basis of income Annual Savings needed to make the invetment realize a 12% yield where PV of cash savings inflows = PV of he net cash Given: Cost $ 50.60 = 50000 .00 Residual value at the end of 5 years $ 10.57) = (50000 .00 x (1-40%) = .5700 $ 44.
000.00 54.is the discount % used in NPV calculation Rate of return of the project > hurdle rate = Positive NPV ( > 0 ) = make investment Rate of return of the project .000.000.000.00 5.000 x 40%) + x Hurdle rate .00 36.00 90. 0 ) = do not make investment Internal Rate of Return = NPV = 0 Discounted Cash Flow models NPV use time value concepts IRR use time value concepts PI required detailed LT forecasts of projects cash flows for longer term projects.00 (10. hurdle rate = Negative NPV ( .Less: Non-cash tax deductibe Depreciation Amortizatiomn Pre-tax income Taxable Income Tax rate 40% Net Income 5.000. cash flow projection migh b .
e and divided by 2) indicates how effectively working capital is used Investment Turnover Working Capital (WC)Turnover Net Sales Net Sales Ave Invested Capital (LT Liab + Equity) Ave Working Capital divide the denominator by 365 A/R Collection Period Accounts Payable Deferral Period 365 365 A/R Turnover A/P Turnover .
use net income this ratio allows for increased analysis of changes in the percentages. 100 less Discount % numerator. The net profit margin inidcates the percent return on each sale while the asset turnover indicates the effective use of assets in generating that sale Dupont Return on Assets Profit Margin measure operating efficiency x Total Assets Turnover measure of the degree of effciency w/ w/c a co. is using its assets is defined as the degree to w/c a firm's use of debt to finance the firm magnifies th effects of a given % change in EBIT on the % change in EPS Dupont Return on Equity . Working Capital Discount Current Assets less Current Liabilities .ratio indicates how effectively working capital is used entage Rate (APR) of scount .
risk down ations and increases risks bec.Profit Margin x Asset Turnover x Financial Leverage or Return on Assets (ROA) Net Income (NI) Sales x or x Financial Leverage Net Sales Ave Total Assets x Ave Total Assets Equity Extended Dupont Return on Equity Operating Income margin x Asset Turnover x Financial Leverage is a measure of firm profits earned on sales after paying operating costs EBIT Sales Sales x Ave total assets er crossing out.results to NI / Equity Ave total assets x Equity t manner. TH goal is maximize the shareholder ereby increase profitability own risk up up . It may reduce a firms ability to obtain addional shor-term financing (Cash + Marketable Securities + Net Rec'bles) / Current Liab . The current and quick ratios are used in working capital analysis.
000 15% 160.Current Assets / Current Liabilities 360 or 365 (Total pay period . 2/10 = 70% customers avail & n/30 = 30% customers avail 10 x 70% = 7 30 x 30% = 9 7 + 9 = 16 ave collec surer .liquidity and safety ment discount alance account k and deposits made but which have not yet cleared in the bank aid with next deposits alance to be maintained in cash & cannoat be used as WC 200000 x 12% 24.Discount%) Ex.Discount period) Discount % x (100% .000 = Effective interest rate 200000x (100%-20%) .
' sales in receivables sale of A/R to a factor usuallt a bank Total Liabilities / Common stockholders equity Total Liabilities /Total Assets Total debt / Total Capital (Debt + Equity) Operating Cash Flow / Total Debt Earnings befor interest and taxed (EBIT) / Interest expense Net cost/average amount invested (Expected dividend / Current share price) + Growth rate ($4.07 0.12 working capital + PPE Asset base x Imputed interest rate Hurdle income + Residual income target (given) .25 / $85) + 0.
insurance cost. WHEN NOTRY) AND ORDERING COSTS (COSTS entory must be rrdered more osts. opportunity costs of ocking out" ntrol inventory quantities ventory levels Method of invnetory control ecomes more variable.ventory can result in burdensome carrying costs. The model can be applied to the sales volume isc a crucial variable n the . the amt of safety safety stock + (Lead time x Sales during lead time) Safety stock + (Lead time x Safe during lead time) minimize total inventory costs. incldng storage costs.
components to the speed of assembly line. It a precise schedules of which items will be needed and what times they will be needed. It reduces the need of manufacutrers to carry large inventories. rsupply or interruption of the entire manufacturing process as the result of lacking a componemt sh. depreciation tax shield) are analyzed generated by the project and the terminal value associated with the disposal or winding down of a amorization .e generally computer-based and are designed to control the use of raw materials in the production process. or makes a cash commnitment that is directly related to capital investment) and INDIRECT epresent a noncash activity that produces cash benefits or obligations ex. received cash. but ler level of inventorym hence it increases Inventory turnover and decreases invenotry as a % of total assets.
original cost of the asset or investment Net Incrememtal investment (investment required Net Annual Cash Flow .PV cash outflows = 0 PV of cash inflows . depreciation x tax rate a predetermine discount rate (ex.ion but depreciation tax shield was added since it is a tax savings.. required rate of return) Pretax cash flow x pretax cost of debt x (1-tax rate) (1-tax rate) Preferred stock dividends / net proceeds of Preferred stock Dps / Nps Nps = Net proceeds of preferred stock Future value / (1 + interest rate)n [ 1 Payment x 1 _ (1 + interest rate)n ] Interest Rate PV of future flows cash inflows . WACC.
Required return or Actual income earned by an investment .Net Initial Investment / Increase in annual net after-tax cash flow PV Initial Investment / PV of Increase in annual net after-tax CF Investment / Cash Flows Net incremental investment (investment required) / Annual CF PV of net future cash inflow / PV of net initial investment Annual after-tax cash flows / PV of net initial investment Net Income . % in capital structure for DEBT. hence. P/S & C/S would be computed .Required Return Investment (Debt and Equity) x $WACC Cost of equity x % equity in capital structure Weighted ave after-tax cost of debt x % debt in x capital structure Debt has tax savings when debt is used in financing a project debt / (debt + equity (Preferred stock and Common Stock) equity / (debt + equity (Preferred stock and Common Stock) CS.required return Net Book Value x Hurdle Rate Net operating profit after taxes (NOPAT) .
Risk-free rate) share expected at the end of one year te of growth in dividends -term debt + market risk premium eret + inflation premium as a means of controllng receipts ster or parent account the serves to fund any negative bal and is designed to maximize ex revenue that will not occur courses of action ses of action variable operating costs operating costs .Risk premium (Beta x Market Risk premium) Beta ( Market return .
NPV ws = PV of he net cash outflows After-tax Cash Flows 60.sts tomagnify retuns to the firm owners o as time-adjusted rate of return (PV of Cash Inflow = PV of Cash Outflow red to investment on the project to arrive at + or .000.00 Net Cash Inflow after tax of 40% .
00 3.00 64.560.4.000.00 240.000.79 242.00 2.560.00 Tax shield (dep or amort x tax rate) After-tax cash flow PV value of an annuity (series of inflow amt pv OF Future cash flow Initial Cash outflow or Investment NET PRESENT VALUE flow projection migh be either unavailable or unrealizable-limitation .000. | https://www.scribd.com/doc/301719823/CPA-BEC-Financial-Ratios | CC-MAIN-2018-39 | refinedweb | 4,347 | 50.57 |
Same problem here. After 6-7 hours of working, DHT11 sensor stops. Then I reboot and again it is working some time and then again goes in offline mode.
I seem to be having a similar issue. I will test and see if I can find the problem. @doerek @ognqn.chikov are you able to run the python script in the terminal to see if you get any errors?
Hello,I was run the python script in terminal and more than 10 hours it is working. I will wait 10 more hours to confirm that it is working without issues.
Same issue with termination after some hours..
I believe the problem is related the the growing memory bug here Hopefully there is a fix pushed sooner rather than later. If the memory fix does not solve the problem I will investigate further.
Hi @adamThe last 48h my DHT22 stayed Online. (No changes on my side)Was there a fix?
GreetingsDoerek
EDIT:Sry, false Alarm ...my browser was loading the Dashboard from cache...
Hi @doerek,
No changes to the Raspberry Pi agent software just yet, I'll say that's probably just better luck on your side. When we do make a change I'll post it in a pinned thread on this forum.
Nevermind...my browser was loading the Dashboard from cache...
Thanks very much.
I have several issues.
When I registered with cayenne , I only filled name surname, password and email.
No specific question for username. I was not given the client I'd talked about in the code.
How do I resolve these issues. Because I couldn't just continue since I really don't know what specific is required in those spaces.
Finally, to get the unique channel talked about in your direction, do you mean I should run this command on my terminal : cd /sys/bus/w1/devices
And then copy the unique code? If yes, is it all the code or the first 8 digit.
Please, I would appreciate if your directory is a little more detail, many of us here are new bies.
Thanks
Anticipating your positive reply.
Ajiri
The username, password, and client ID are all generated when you go to the dashboard and click Add new>Device/widget then click the blue Bring Your Own Thing button. This username/password is not your Cayenne username/password.
As far as the channel, you just need to make sure you aren't using the same channel for anything else. Generally I start at 1 and just work my way up. There is no limit in the docs for the channel value so I'm assuming you can pretty much use any number you can think of.
Thank you for your code but shouldn't it be:
Your code will probably work fine as it is. But my problem was the following:If you send a sensor value first as channel 3, then channel 1 and last channel 2. Then the sensor at channel 2 won't show after a while. This might be a beginners problem (second day here)...
Now it works fine:)
You are correct, typo on my part. I just fixed it.
I didn't loop the sensor with a waittime for 5 sec. Instead I run the script every minute. So if things go south (program error) I'll get another shot (crontab value is set to 1 min).Is it possible to pass some kind of timestamp or avoiding the offline message that I haven't update my sensor since the dinosaurs was walking on earth?
Except for the message it works fine!
Maybe I will try to do your approach, but instead of running the script everyminute, I will try to send everyminute the real data, and then every other frame to be some fake data stream, zeros or empty stream.
What do you think?
Please give it a shoot.If I understand you. You should use the 5 second loop, but only the 20th time (5 sec X 20 = 1 min), you'll get sensor data and send it. All other times (19) you just send the last measured data.
Its interesting to know if it's the sensor that makes it crash. However my solution works so far, execept for the ugly offline message.
I did NOT try it yet, because I have another problem.
When I open the device, the measurements looks ok:
But after that the measurements are showing:
and when I refresh again, they looks normal. Any Ideas?UPDATE:
Here is the graphic chart. Sometime it is normal, and most of the time the measurements are unreal:
I get the same insane numbers sometimes and also before I started with Cayenne.I believe the problem is the cheap DHT11 sensor (I bought mine from china).If I manufactured a humidity sensor I would put a maximum limit for output to 100%...
I've now ordered a DHT22 and I hope to get better result
Sorry for my miscalculation before: 5 sec X 20 IS NOT 1 min. I ment 12x5...
I try everything, and it seems to work when I test it. Now I just solder the wires and put it on place. I hate the cheap china shits..
I will try in the weekend with the script, no matter what kind of result I get, I will try and post here if I have interesting solution.
Thank you!
Thanks Adams,
Everything working fine now
My problem is that i have done the thing all correctly but when i run my code nothing show nor the widgets nor the readings.. code
import paho.mqtt.client as mqtt
import time
import sys
import Adafruit_DHT
time.sleep(30) #Sleep to allow wireless to connect before starting MQTT
mqttc = mqtt.Client(client_id="")
mqttc.username_pw_set("", password="")
mqttc.connect("mqtt.mydevices.com", port=1883, keepalive=60)
topic_dht11_temp = "v1//things//data/1"
topic_dht11_humidity = "v1//things//data/2"
while True:
try:
humidity11, temp11 = Adafruit_DHT.read_retry(11, 27) #11 is the sensor type, 27 is the GPIO pin number
if temp11 is not None:
temp11 = "temp,c=" + str(temp11)
mqttc.publish(topic_dht11_temp, payload=temp11, retain=True)
if humidity11 is not None:
humidity11 = "rel_hum,rel_hum=" + str(humidity11)
mqttc.publish(topic_dht11_humidity, payload=humidity11, retain=True)
time.sleep(5)
except (EOFError, SystemExit, KeyboardInterrupt):
mqttc.disconnect()
sys.exit() | http://community.mydevices.com/t/dht11-dht22-with-raspberry-pi/2015?page=2 | CC-MAIN-2017-39 | refinedweb | 1,052 | 75.1 |
ArchWiki talk:Requests
Is the wiki missing documentation for a popular software package or coverage of an important topic? Or, is existing content in need of correction, updating, or expansion? Write your requests below and share your ideas...
Contents
- 1 Creation requests
- 2 Modification requests
- Localization)
- Localization#Input methods Section is cleaned up a little. Should we move it into Category:Input methods instead? -- Fengchao (talk) 03:53, 8 May 2020 )
Missing redirects
- machinectl
- Linux namespaces
- MIME, closest article is Default applications
- sysfs
- devfs, closest article is Device file
- strace, closest article is Step-by-step debugging guide
- lspci and lsusb
- pacstrap and genfstab
- curl
- stty
- terminfo (termcap)
- LPD, LPR
- JSON, XML, CSV, JS, CSS
- Exif
- Maven
- CGI
- SQL
- JDBC, closest article is JDBC and MySQL
- glibc, GNU C Library
- YAML, TOML
- Chromecast
- OpenGL
--Larivact (talk) 15:35, 21 October 2018 (UTC)
- I've created some redirects before. I really don't know where other redirects should go. -- Blackteahamburger (talk)
A Podman page
I've been playing around with podman for a while and found it to be really good. I was thinking of creating an archwiki page for it. There isnt much content related to it available for it online and Arch Wiki seems to be a good place for it.
-- Tonybenoy (talk) 11:03, 18 April 2019 (UTC)
I would also like to assist with such a page since I have written some notes of it. Stefnix (talk) 01:25, 5 January 2020 )
This could be implemented soon as a solution to an unrelated issue. It seems that the wiki's robots.txt is not very good, because the standard has only the notion of "directories" so we can't effectively block "dumb" crawlers who may not support complex matching like "/index.php?diff=". This may have lead to enabling the Lockdown extension [5][6] which prevents public access to archived pages etc. If we use short URLs, e.g. with "/wiki/" as $wgArticlePath and "/w/" as mw:$wgScriptPath as recommended in Manual:Short URL, robots.txt would be as simple as
User-agent: * Disallow: /w/ Disallow: /index.php Disallow: /skins/
But this assumes that MediaWiki is installed to "/w/" rather than the webroot ("/") which is the case now, so it would have to be moved. It would be simpler to keep it in the webroot, keep
$wgScriptPath empty ("") and explicitly allow the path for
$wgArticlePath:
User-agent: * Allow: /wiki/ Disallow: /
Note that the Allow directive is non-standard, but bots who don't support it would be simply unlucky :-)
So, the main question is what do we use as the
$wgArticlePath? To summarize some options:
/wiki/(used on Wikipedia, but duplicates our "wiki" subdomain)
/w/(shorter, used as
$wgScriptPathon Wikipedia)
/title/(my personal favourite after re-reading the discussion above)
/t/
/article/
/page/
-- Lahwaacz (talk) 16:04, 19 April 2020 [7] for a case where users are not aware of this. -- Alad (talk) 22:55, 18 September 2015 (UTC)
- +1, but I'd place it into General troubleshooting. -- Lahwaacz (talk) 07:52, 19 September 2015 )
-)
Update Apache and Oracle links
The Apache and Oracle redirects were changed to point to Category:Apache/Category:Oracle instead of the web server/database: [9], [10]. Hence, the links to Apache and Oracle should be checked and if they were meant to refer to the web server/database, they should be updated to point to Apache HTTP Server/Oracle Database. -- Lahwaacz (talk) 09:17, 22 May 2020 (UTC)
- I have changed all English pages. -- Blackteahamburger (talk) 01:22, 23 May 2020 ) | https://wiki.archlinux.org/index.php?title=ArchWiki:Reports&diff=497122&oldid=497077 | CC-MAIN-2020-24 | refinedweb | 590 | 58.62 |
Hi;
i want to change page size in my project. Instead of A4 i want to use A3 and my specific sizes.
i search and find some topics about it but they said only "you can not change the paper size".
is there anyway to do this?
only this problem i have to move my project to java.
thanks and regards
umuthan
You could use flash.printing.printJob.supportsPageSetupDialog to display the operating system's Page Setup dialog if the current environment supports it. Use the
supportsPageSetupDialog property to use A3 size.
Such as the following---
import flash.printing.PrintJob; var myPrintJob:PrintJob = new PrintJob(); if (myPrintJob.supportsPageSetupDialog) { myPrintJob.showPageSetupDialog(); } | https://forums.adobe.com/thread/768443 | CC-MAIN-2018-34 | refinedweb | 110 | 52.76 |
Ah, thanks Paul & Dinko! That makes sense. I actually hadn't used
withInstance() before. Aren't closures amazing? Makes me really want to go
back and learn some JavaScript.
Anyway, here's my connection time-out test code now:
/* Example Code */
import groovy.sql.Sql
String query = "select count(*) cnt from spriden where
upper(spriden_last_name) = 'STURGILL'"
int minuteDelay = 0
Sql.withInstance("jdbc:oracle:thin:@SOMESERVER:15215:SOMETNS",
"henson", "PASSWORD", "oracle.jdbc.driver.OracleDriver")
{
while (minuteDelay <= 120) {
// Sleep increasing number of minutes
Thread.sleep(1000 * 60 * minuteDelay)
Date date = new Date()
it.eachRow(query) {
println "After ${minuteDelay} minutes -
${it.cnt} (${date})"
}
minuteDelay += 5
}
}
/* End Example */
On Fri, May 1, 2015 at 8:17 AM Paul King <paulk@asert.com.au> wrote:
>
> Yes, what Dinko said ... the second time! :-)
>
> In summary, if you create your Sql instance using the DataSource
> constructor, then a new connection will be obtained from the
> datasource (frequently a pool) for each operation and closed
> after each operation. There are cacheConnection(Closure) and
> withTransaction(Closure) methods which retain the connection
> across the scope of the closure call before closing it.
>
> If you use any of the withInstance(*args, Closure) methods then the
> connection will be created at the start of the withInstance closure
> block and closed automatically at the end of the block.
>
> Otherwise, it is up to you to manually close the connection.
>
> Cheers, Paul.
>
> On 1/05/2015 8:49 PM, Dinko Srkoč wrote:
> > Henson, sorry! It seems that I was wrong. If you made an Sql instance
> > by calling newInstance() then there would be only one JDBC connection
> > and it would be alive until close() is called explicitly, either
> > directly on the connection or on the Sql object itself, or when the
> > program terminates.
> >
> > So, calling eachRow() actually uses existing connection, it does not
> > create another one. What gets closed is the ResultSet and Statement
> > objects.
> >
> > When I answered your question it was 5 am in my time zone, and that is
> > my excuse. ;-)
> >
> > Cheers,
> > Dinko
> >
> > On 30 April 2015 at 21:46, Owen Rubel <orubel@gmail.com> wrote:
> >> That was why I asked about a connection pool. With a connection pool, it
> >> won't get dropped as long as it is active. but inactive connections go
> back
> >> into the pool. You can use a connection pool without having the
> overhead of
> >> having to create a connection everytime you need to make a call and
> without
> >> having to manage the connections yourself.
> >>
> >> Owen Rubel
> >> 415-971-0976
> >> orubel@gmail.com
> >>
> >> On Thu, Apr 30, 2015 at 10:56 AM, Henson Sturgill <
> henson.reset@gmail.com>
> >> wrote:
> >>>
> >>> Thanks Owen, and Dinko.
> >>>
> >>> I was just asking how connections were made. My goal was to keep a
> single
> >>> connection open and test it, a growing number of minutes between
> tries, to
> >>> see when/if the connection was being dropped. But since the connection
> is
> >>> made on each execution, my code will most likely never fail.
> >>>
> >>> Thanks so much,
> >>> Henson
> >>>
> >>> On Thu, Apr 30, 2015 at 1:04 AM Owen Rubel <orubel@gmail.com> wrote:
> >>>>
> >>>> Just in case you are asking about connection pools, you can use grails
> >>>> datasource for defining the pool.
> >>>>
> >>>> here's a good thread on that...
> >>>>
> >>>>
> >>>>
>
> >>>>
> >>>>
> >>>> On Wed, Apr 29, 2015 at 8:22 PM, Dinko Srkoč <dinko.srkoc@gmail.com>
> >>>> wrote:
> >>>>>
> >>>>>
> >>>>> On 29 Apr 2015 23:10, "Henson Sturgill" <henson.reset@gmail.com>
> wrote:
> >>>>>>
> >>>>>> Been playing around with a hosted Oracle database that *seems*
to be
> >>>>>> dropping connections. I made the following script to test (call
to
> >>>>>> Sql.newInstance() not shown) but I'm curious -- does Groovy
create
> the
> >>>>>> connection to the database on newInstance(), or every time
> eachRow() is
> >>>>>> called?
> >>>>>>
> >>>>>
> >>>>> Every time eachRow is called, and the connection is closed upon
> >>>>> consuming the dataset.
> >>>>>
> >>>>> Cheers,
> >>>>> Dinko
> >>>>>
> >>>>>> --- Example Code ---
> >>>>>>
> >>>>>> String query = "select count(*) cnt from spriden where
> >>>>>> upper(spriden_last_name) = 'STURGILL'"
> >>>>>> int minuteDelay = 0
> >>>>>>
> >>>>>> while (minuteDelay <= 120) {
> >>>>>> Thread.sleep(1000 * 60 * minuteDelay); // Sleep increasing
> number
> >>>>>> of minutes
> >>>>>> Date date = new Date();
> >>>>>> sql.eachRow(query) {
> >>>>>> println "After ${minuteDelay} minutes - ${it.cnt}
> (${date})"
> >>>>>> }
> >>>>>> minuteDelay += 5;
> >>>>>> }
> >>>>>>
> >>>>>> --- End Example ---
> >>>>>>
> >>>>>> Thanks so much you wonderful programmers!
> >>
> >>
> >
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
>
>
> | http://mail-archives.apache.org/mod_mbox/groovy-users/201505.mbox/%3CCAEZ0KPHAue--d04LPvLzHsndU4iHt+f=ur_DwqjoHb59h0b6QQ@mail.gmail.com%3E | CC-MAIN-2018-05 | refinedweb | 687 | 67.04 |
Solve Word Break Problem using Backtracking in Python
In this tutorial, we are going to solve the Word Break Problem using Backtracking and the programming language we’re using is Python. Here the problem is that we are given a long string of words without any spaces and a dictionary of words with the help of Python programming. We are supposed to break the string or sentence into the possible words present in the dictionary.
Using backtracking to solve the problem
The idea is that we will select a word from the dictionary and search for that word in the string, if any substring matches with the word then we print it otherwise we move ahead and search for the next word in the dictionary.
For every word selected we search for the first letter of the word in the string, if it is present then we move to the next letter of the word and so on.
We will keep two pointers namely “i” and “j” to keep track of the letters in the word and the string respectively that we have already seen.
Now we will go through the string only once for every word in the dictionary by incrementing the pointer “j”. But we will keep backtracking through the word that has been selected, with the help of the pointer “i”.
Once the first letter of the word is found we will increment “i” till there is a mismatch, in that case, we will set back the value of “i” to 0, and again start searching for the first letter in the rest of the string.
Implementation of the solution
In this example is the string we have taken is
string="iwantindependence"
And the dictionary is
word_dict={0: 'i', 1:"like", 2:"ali",3: "want",4: "pancake",5: "mobile",6: "independence", 7: "tin" ,8: "icecream",9: "ant", 10:"pen",11: "fNow
Now we will create a function ” break_string” which will take the word and the string and print the word if it is present in the string. Below is our Python code:
def break_string(word,string): # initiliasing pointer pointing to the string to 0 j=0 while(j<len(string)): # initialising pointer pointing to the word to 0 i=0 while(i<len(word)): if word[i]==string[j]: # if i==length of word, then the word selected has been seen till the end # hence the word matched with the substring if(i==(len(word)-1)): print(word) break # otherwise we will carry on the search else: i+=1 j+=1 # if letters or alphabets don't match else: # and string is seen till the end --> break if(j==len(string)-1): break else: # keep increamenting the string i=0 j+=1 # Once the word is found --> stop incrementing the string break
Once we get a letter match we increment both “i” and “j” and continue. If after matching some letters of the word and the rest of the letters don’t match then we come out of the second while loop and put the pointer of the word back to 0.
In case the letters are not matching we keep the pointer of the word “i” =0 only and keep incrementing the pointer “j” of the string.
Pointer “i” is only incremented in case of a match, otherwise is always kept at the start of the word(i=0), while pointer “j” keeps moving ahead.
When “i” is equal to the length of the word, we have matched the entire word, hence the word is found. We print it and come out of the loop.
To call the function we give the string and the words by iterating through the dictionary.
for word in word_dict.values(): break_string(word,string)
The output is
i want independence tin ant pen | https://www.codespeedy.com/solve-word-break-problem-using-backtracking-in-python/ | CC-MAIN-2021-10 | refinedweb | 632 | 65.59 |
Calling function within other files and order of loading..
- misterlisty
I have created different py files for different functions eg bluetooth.py wifi.py etc
When boot.py and main.py load...do the other files get loaded if not when do they get loaded? From boot.py i'm trying to load a function within bluetooth.py but i get error NameError: name '_bluetooth_scan' is not defined
- misterlisty
thanks, i'm reading the python resource online
@misterlisty Modules are loaded with the "import name_of_module" statement. After that, functions and classes arfe added to the namespace and can be used. You can issue the import statement at the REPL prompt interactively, of in your main script and use it then.
This is the typical Python behaviour. I recommend getting lessons or reading a suitable book on Python. | https://forum.pycom.io/topic/2144/calling-function-within-other-files-and-order-of-loading | CC-MAIN-2018-17 | refinedweb | 137 | 68.16 |
Sizes
You can set the
width and
height of widgets in guizero.
Widgets are sized by either pixels or characters depending on the widget and what it contains.
Some widgets size can also be set to
"fill" where it will use up all of the available space.
from guizero import App, PushButton, Slider, ListBox app = App() # A PushButton's size is noted in characters button = PushButton(app, width=30, height=5) # A Slider's size is noted in pixels slider = Slider(app, width=300, height=30) # Some widgets such as ListBox can also be told to fill all the available space listbox = ListBox(app, width="fill", height="fill") app.display() | https://lawsie.github.io/guizero/size/ | CC-MAIN-2019-30 | refinedweb | 110 | 55.07 |
: Since caching is built into the public BitSet bits(IndexReader reader)
: method, I don't see a way to deprecate that, which means I'll just cut
: it out and document it in CHANGES.txt. Anyone who wants QueryFilter
: caching will be able to get the caching back by wrapping the QueryFilter
: in your CachingWrapperFilter.
this seems like a potentially big surprise for people when upgrading ...
old code will continue to work fine without warning, just get a lot less
efficient.
If the concern is duplicated code, perhaps QueryFilter should be
deprecated and changed to be a subclass of CachingWrapperFilter, with a
constructor that takes in the Query and wraps it in some new class
(QueryWrapperFilter perhaps?) that does the meaty part (collecting the
matches) ...
@deprecated use CachingWrapperFilter and QueryWrapperFilter directly
public class QueryFilter extends CachingWrapperFilter {
public QueryFilter(Query query) {
super(new QueryWrapperFilter(query));
}
}
public class QueryWrapperFilter extends Filter {
private Query query;
public QueryWrapperFilter(Query query) {
this.query = query;
}
public BitSet bits(IndexReader reader) throws IOException {
final BitSet bits = new BitSet(reader.maxDoc());
new IndexSearcher(reader).search(query, new HitCollector() {
public final void collect(int doc, float score) {
bits.set(doc); // set bit for hit
}
});
return bits;
}
}
(obviously we need some toString, equals, and hashCode methods in here as well)
:
:
: Otis
: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
: Simpy -- - Tag - Search - Share
:
: ----- Original Message ----
: From: Erik Hatcher <erik@ehatchersolutions.com>
: To: java-dev@lucene.apache.org
: Sent: Wednesday, April 4, 2007 7:38:00 PM
: Subject: Re: Caching in QueryFilter - why?
:
: CachingWrapperFilter came along after QueryFilter. I think I added
: CachingWrapperFilter when I realized that every Filter should have
: the capability to be cached without having to implement it. So, the
: only reason is "legacy". I'm perfectly fine with removing the
: caching from QueryFilter in a future major release.
:
: Erik
:
: On Apr 4, 2007, at 5:57 PM, Otis Gospodnetic wrote:
:
: > Hi,
: >
: > I'm looking at LUCENE-853, so I also looked at CachingWrapperFilter
: > and then at QueryFilter. I noticed QueryFilter does its own BitSet
: > caching, and the caching part of its code is nearly identical to
: > the code in CachingWrapperFilter.
: >
: > Why is that? Is there a good reason for that?
: >
: > Thanks,
: > Otis
: > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
: > Simpy -- - Tag - Search - | http://mail-archives.apache.org/mod_mbox/lucene-dev/200704.mbox/%3CPine.LNX.4.58.0704051418140.1304@hal.rescomp.berkeley.edu%3E | CC-MAIN-2015-18 | refinedweb | 360 | 56.96 |
This is one of the frequent requirement in visual studio either adding new namespaces corresponding to a class or resolving the namespaces. If you are adding a new class in your code then you may need to add the correspondence namespaces. To do it, you may either manually type the Using Namespace or you just right click on the class name and select Resolve > Namespace. But using “Ctrl+.” you can automatically add the namespace in your code. Lets consider you want to add DataTable in your code, so for that you right click on that class and select resolve to resolve the namespace.
Using “Ctrl+.” you can also automatically add the using statement as shown in below
Fig : Add namespace using Shortcut key
Pingback: Dew Drop – January 26, 2011 | Alvin Ashcraft's Morning Dew | https://dailydotnettips.com/adding-and-resolving-namespaces-using-shortcut-key-in-visual-studio/ | CC-MAIN-2018-30 | refinedweb | 134 | 69.11 |
Hello World from Boost::Python12 Oct 2005
I just created a “Hello World” application in Boost::Python. I’m comparing the Boost and SWIG options for embedding Python and making PN code available to it so this is the first step for the Boost implementation.
Here’s the code:
#include <boost /python.hpp> int main(int argc, char* argv[]) { Py_Initialize(); object main_module(( handle<>(borrowed(PyImport_AddModule("__main__"))) )); object main_namespace = main_module.attr("__dict__"); // Run some python! handle<> ignored((PyRun_String( "print \"Hello World from Python!\"" , Py_file_input , main_namespace.ptr() , main_namespace.ptr()) )); Py_Finalize(); return 0; }
Not very much code at all to get going! boost_python.dll (required to use Boost::Python) comes in at 180kb. The initial test app (as coded above) in Release configuration takes 40kb.
The differences between this and the SWIG embedding version will be minimal, boost doesn’t hide much of the embedding code for you. The real differences will be in creating wrappers for functions and classes. With boost I have to write wrappers, SWIG will automatically generate them. The interesting bit will be the size of the code created. | http://untidy.net/blog/2005/10/12/hello-world-from-boostpython/ | CC-MAIN-2019-47 | refinedweb | 180 | 58.79 |
"Michael Ju. Tokarev" wrote: > [] > I see in linux/include/linux/lvm.h : > > [...] > #ifdef BLOCK_SIZE > #undef BLOCK_SIZE > #endif > > #ifdef CONFIG_ARCH_S390 > #define BLOCK_SIZE 4096 > #else > #define BLOCK_SIZE 1024 <<<<<<<<<======== > #endif > > #ifndef SECTOR_SIZE > #define SECTOR_SIZE 512 > #endif > [...] Hm. The same definitions are in 2.4-pre kernel patch... So 2.4 lvm should also *not* work for 512-byte i/o size. But Jorg de Jong claims that he successefully created tablespace on raw dev with 2.4-pre11 kernel... I'm confused... And for S390 -- is smallest i/o size 4K ?! [] > Little *strong* suggestion. Please rename BLOCK_SIZE > and SECTOR_SIZE to LVM_BLOCK_SIZE and LVM_SECTOR_SIZE > in lvm.h -- currently used names are very common to > be a source of namespace collisions. The same for 2.4. Let's change those definitions while it isn't *too* late... Regards, Michael. | https://www.redhat.com/archives/linux-lvm/2000-December/msg00021.html | CC-MAIN-2015-22 | refinedweb | 134 | 69.99 |
These are chat archives for Nethereum/Nethereum
var electionType = await contract.GetFunction("electionType").CallAsync<string>().Result
I get the same errors if I run npm run compile from the root folder.
As stated I am no great expert in this, but Juan has taken me through it once before so something might come back to me.
Are you able to start a debugging session in visual studio code? I run "Launch Extension" which is configured in the .vscode folder. I am guessing there's path magic required for the compilation to work.
@Nufflee - well npm run compile now works for me. I had to change a few typescript files in the node_modules\nethereum-codegen to fix the namespace issue. It's a workaround, like I said, these typescript files are code generated, so I haven't fixed the core issue yet. I'll need to discuss this with Juan when he returns - I'd imagine what we're doing here may not actually be necessary. But it may unblock you for the time being.
To get you going - you could download the nethereum-codegen folder below and replace your current folder (within ./node_modules).
The files I changed (from memory!):
AbiDeserialiser.ts
Nethereum.Generators.DuoCode.d.ts
app.ts | https://gitter.im/Nethereum/Nethereum/archives/2018/08/19 | CC-MAIN-2019-43 | refinedweb | 208 | 65.32 |
FileInfo Class
Provides instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects.
For a list of all members of this type, see FileInfo Members.
System.Object
System.MarshalByRefObject
System.IO.FileSystemInfo
System.IO.FileInfo
[Visual Basic] <Serializable> NotInheritable Public Class FileInfo Inherits FileSystemInfo [C#] [Serializable] public sealed class FileInfo : FileSystemInfo [C++] [Serializable] public __gc __sealed class FileInfo : public FileSystemInfo [JScript] public Serializable class FileInfo extends FileSystemInfo
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
Use the FileInfo class for typical operations such as copying, moving, renaming, creating, opening, deleting, and appending to files.
Many of the FileInfo methods return other I/O types when you create or open files. You can use these other types to futher.
.NET Compact Framework Platform Note: The .NET Compact Framework does not support getting or setting directory attributes.
Example
[Visual Basic, C#, C++] The following example demonstrates some of the main members of the FileInfo class.
[Visual Basic] Imports System Imports System.IO Public Class Test Public Shared Sub Main() Dim path As String = "c:\temp\MyTest.txt" Dim path2 As String = path + "temp" Dim fi As FileInfo = New FileInfo(path) If fi.Exists = False Then 'Create a file to write to. Dim sw As StreamWriter = fi.CreateText() sw.WriteLine("Hello") sw.WriteLine("And") sw.WriteLine("Welcome") sw.Flush() sw.Close() End If, path2) 'Delete the newly created file. fi2.Delete() Console.WriteLine("{0} was successfully deleted.", path2) Catch e As Exception Console.WriteLine("The process failed: {0}.", e.ToString()) End Try End Sub End Class [C#]()); } } } [C++] #using <mscorlib.dll> using namespace System; using namespace System::IO; int main() { String* path = S"c:\\temp\\MyTest.txt"; FileInfo* fi1 = new FileInfo(path); if (!fi1->Exists) { //Create a file to write to. StreamWriter* sw = fi1->CreateText(); try { sw->WriteLine(S"Hello"); sw->WriteLine(S"And"); sw->WriteLine(S"Welcome"); } __finally { if (sw) __try_cast<IDisposable*>(sw)->Dispose(); } } //Open the file to read from. StreamReader* sr = fi1->OpenText(); try { String* s = S""; while (s = sr->ReadLine()) { Console::WriteLine(s); } } __finally { if (sr) __try_cast<IDisposable*>(sr)->Dispose(); } try { String* path2 = String::Concat(path, S"temp"); FileInfo* fi2 = new FileInfo(path2); //Ensure that the target does not exist. fi2->Delete(); //Copy the file. fi1->CopyTo(path2); Console::WriteLine(S"{0} was copied to {1}.", path, path2); //Delete the newly created file. fi2->Delete();Info Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File | Basic File I/O | Reading and Writing to a Newly Created Data File | https://msdn.microsoft.com/EN-US/library/akth6b1k(v=vs.71) | CC-MAIN-2015-32 | refinedweb | 446 | 50.33 |
Forking a project is, in most cases, a two-step process.
On the project’s home page, in the top right, click the Fork button.
Click a namespace to fork to. Only namespaces you have Developer and higher permissions for are shown.Note: The project path must be unique within the namespace.
The fork is created. The permissions you have in the namespace are the permissions you will have in the fork.
Repository click Submit merge request to conclude the process. When successfully merged, your changes are added to the repository and branch you’re merging into.
Removing a fork relationship
You can unlink your fork from its upstream project in the advanced settings. | https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html | CC-MAIN-2020-50 | refinedweb | 114 | 77.23 |
Zero.
First we need to load the petlib Elliptic Curve module petlib.ec and the genzkp functions used to define and verify proofs. We then define an EC group G, and its order. As it happens group 713 is OpenSSL’s “NIST/SECG curve over a 224 bit prime field“.
from petlib.ec import EcGroup from genzkp import ZKProof, ZKEnv, ConstGen, Sec
# Define an EC group G = EcGroup(713) print (EcGroup.list_curves()[713]) order = G.order()
Next we need to define the proof statement using an instance of ZKProof, namely zk. The proof variables and constants are defined using zk.get() (or zk.get_list()). This function takes the type of variables defines, either a constant generator ConstGen, a secret Sec or a generator Gen that is used internally by the proof. It also takes the names of the variables, as they are going to be used later to bind values to them during the construction and verification of the proof. After defining all variables one or more linear statements can be associated with the proof, such as Cxo = x*g+o*h, using the add_proof method.
## Define the Zero-Knowledge proof statement zk = ZKProof(G) g, h = zk.get(ConstGen, ["g", "h"]) x, o = zk.get(Sec, ["x", "o"]) Cxo = zk.get(ConstGen, "Cxo") zk.add_proof(Cxo, x*g + o*h)
For debugging or other visualization purposes the proof statement can be printed out in Latex using the render_proof_statement method. When compiled in a Latex document this renders to:
## Render the proof statement in Latex print(zk.render_proof_statement())
Using standard petlib math function, we can build a concrete Pedersen commitment using random h, x an o, an define Cxo = x*g+o*h.
# A concrete Pedersen commitment ec_g = G.generator() ec_h = order.random() * ec_g bn_x = order.random() bn_o = order.random() ec_Cxo = bn_x * ec_g + bn_o * ec_h
The concrete secrets, EC points and commitment then need to be bound to the variables of the zero-knowledge proof. We can do this by defining an environment, using ZKEnv, and binding the values to the proof variable names. For example, env.x = bn_x binds the value bn_x to the proof variable x. Since we are first to prove the statement, all secrets need to be defined.
## Bind the concrete variables to the Proof env = ZKEnv(zk) env.g, env.h = ec_g, ec_h env.Cxo = ec_Cxo env.x = bn_x env.o = bn_o
Finally, on the prover size, we construct the signature (or NIZK) using the build_proof function. This can be serialized and deserialized using the petlib.pack functions if necessary.
# Create the Non-Interactive Zero-Knowledge (NIZK) proof sig = zk.build_proof(env.get())
On the verification side, the exact same statement needs to be defines, as zk. An environment is then created binding values to all public variables (g, h and Cxo), but not to the secrets.
# Execute the verification on the proof 'sig' env = ZKEnv(zk) env.g, env.h = ec_g, ec_h env.Cxo = ec_Cxo
The verification is then performed to ensure the signature and the environment may be used to verify the statement of the NIZK.
assert zk.verify_proof(env.get(), sig)
The genzkp library has been used to implement all proofs of the examples/amacscreds.py anonymous credential system. The proofs of these scheme are elaborate and illustrate how to define lists of secrets or lists of public generators, parametrically.
The full source code of the running example is also available. | https://conspicuouschatter.wordpress.com/2016/01/23/zero-knowledge-proofs-library-in-petlib/ | CC-MAIN-2019-35 | refinedweb | 569 | 68.36 |
Hi Tillmann, That's worked a treat -- thanks ever so much :) Will On Wed, Aug 11, 2010 at 7:50 PM, Tillmann Rendel < rendel at mathematik.uni-marburg.de> wrote: > Will Jones wrote: > >> > f :: Int -> IO () >> > f = undefined >> >> > g :: Int -> Int -> IO () >> > g = undefined >> >> > h :: Int -> Int -> Int -> IO () >> > h = undefined >> >> vtuple f :: IO (Int -> (Int, ())) >> vtuple g :: IO (Int -> Int -> (Int, (Int, ()))) >> >> I've tried to type vtuple using a type class; [...] >> >> >> I've thought about it and it seems impossible to solve this problem >> -- you keep needing to ``split'' the function type one arrow further on. >> > > So you need to use recursion to handle the arbitrary deeply nested > arrows in the type of vtuple's argument. I tried it with type families, > but I don't see a reason why functional dependencies should not work. > > {-# LANGUAGE FlexibleInstances, TypeFamilies #-} > module VTupleWithTypeFamilies where > > We use two type families to handle the two places where the result type > of vtuple changes for different argument types. > > type family F a > type family G a r > > So the intention is that the type of vtuple is as follows. > > class VTuple a where > vtuple :: a -> IO (G a (F a)) > > The base case: > > type instance F (IO ()) = () > type instance G (IO ()) r = r > > instance VTuple (IO ()) where > vtuple = undefined > > And the step case: > > type instance F (a -> b) = (a, F b) > type instance G (a -> b) r = a -> G b r > > instance VTuple b => VTuple (a -> b) where > vtuple = undefined > > A test case: > > f :: Int -> Bool -> Char -> Double -> IO () > f = undefined > > test = do > vt <- vtuple f > return (vt 5 True 'x' 1.3) > > Testing it with ghci yields the following type for test, which looks > good to me. > > test :: IO (Int, (Bool, (Char, (Double, ())))) > > HTH, Tillmann > > -------------- next part -------------- An HTML attachment was scrubbed... URL: | http://www.haskell.org/pipermail/haskell-cafe/2010-August/081838.html | CC-MAIN-2014-41 | refinedweb | 300 | 58.96 |
As a dad of 2 young kids, a non-trivial portion of my day is devoted to poop. Lots and lots of poop.
When my oldest began potty training, they would wake up in the middle of the night needing to use the bathroom. And while toddlers’ lungs make a great alarm, we needed to find a solution that wouldn’t disturb the younger one sleeping 10 feet away.
I’m always on the lookout for how I can win my kids’ cooperation in novel and fun ways. Bonus points if it involves getting to tinker on an engineering project myself.
Enter the Poop Button..
Before we start: IoT poop button prerequisites
Let’s walk through setting one up – here’s what you’ll need to build your very own poop button.
Buy a AWS IoT Button
The hardware behind the IoT Poop Button is the 2nd Generation AWS IoT Button. You can purchase your own through this link.
Set up a local dev environment
To write the code for the Lambda, you’ll need a computer with Python 3.6 installed. If you’re on a Mac that came with Python 2, I recommend installing 3.6 via Homebrew:
brew install python
If you have Python 2 installed as well, make sure nothing on your PYTHONPATH
points to your Python 2 packages:
if [ $(echo $PYTHONPATH | grep python2) ]; then export PYTHONPATH=; fi
If you don’t have an account already, sign up for Twilio. After you’ve signed up, buy a number. Make a note of the phone number you’ve bought, your Account SID, and your Auth Token. You’ll need them all later.
Now, go to the list of Verified Caller IDs and make sure the number you want the poop button to call is listed. If not, add it.
Sign up for AWS if you haven’t already. Note, an AWS account is not the same as an Amazon account, so even if you have an Amazon account already, you’ll need a separate AWS account.
Make a phone call with Twilio in Python
All set? Ok, time to get down to the code!
Project directory and dependencies
Because Lambdas have no way to manage code dependencies, we have to vendor all of our dependencies into our project directly. Then once everything’s ready, we create a zip file that we can upload to AWS when configuring our Lambda function.
For this function, our only Python dependency is Twilio’s client library. Let’s configure our project directory and install it:
mkdir twilio_poop_button cd twilio_poop_button printf "[install]nprefix=" > setup.cfg pip3 install twilio --target .
You should now see a bunch of subdirectories and Python files in your project directory. Remember,
twilio has its own dependencies, so don’t be surprised to see things like
requests and
pytz.
(The setup.cfg bit is only required if you installed python 3 via Homebrew. It circumvents a nasty bug in Homebrew’s python.)
Python phone call source code
Now, create a file called index.py and paste this code into it:
import os from urllib.parse import urlencode from twilio.rest import Client def handler(event, context): client = Client( os.environ['TWILIO_ACCOUNT'], os.environ['TWILIO_TOKEN'], ) call = client.calls.create( to=os.environ['ALERT_PHONE'], from_=os.environ['TWILIO_PHONE'], url='?{}'.format(urlencode({ 'Message[0]': "Baby needs to go potty", })), ) print(call.sid)
The astute reader will notice 4 variables taken from the environment:
- TWILIO_ACCOUNT: The Account SID you copied from your Twilio account dashboard
- TWILIO_TOKEN: The Auth Token you copied from the same place
- TWILIO_PHONE: The phone number you purchased (In E.164 Format)
- ALERT_PHONE: The phone number you want the button to call (Also in E.164 format)
The script instantiates a Twilio client and creates a new call using these environment variables. For the content of the call, we’re using a Simple Message Twimlet, a URL that takes a list of messages in its query string and returns a TwiML document. Twilio reads that document and generates a voice message from it.
Try out a phone call with Python and the Twimlet
Let’s give our code a shot locally to make sure it’s working. Remember to substitute the fake values below with your real ones:
TWILIO_ACCOUNT=xxxx TWILIO_TOKEN=xxxx ALERT_PHONE= 15017122661 TWILIO_PHONE= 15555555555 python3 -c 'import index; index.handler(None, None)'
Did your phone ring? If not, double check that the environment variables are correct and take a look at your Twilio phone number’s call logs to see if the call showed up. If you’re using a Twilio trial account, make sure the alert phone number is listed in your Verified Caller IDs.
If it did congratulations, you have a working Twilio integration! The only remaining step on the code side is to prepare the zip file to upload to AWS:
zip -r ~/poop-button.zip .
AWS IoT and Lambda integration
If you haven’t already, open up your shiny new Amazon IoT button. Take note of the DSN printed on the back. (It probably starts with “G030”.) This is your button’s identifier, and you’ll see the number on a lot of the auto-generated resources AWS creates for you.
Set up the button using a native phone app
Next, install and launch the AWS IoT Button Dev iOS or Android app to configure your AWS IoT button. I have an iPhone, so the screenshots you see are from the iOS app. Here’s how to connect your button using the app:
- Click the button to Set Up AWS IoT Button
- Enter the button DSN and give it a name (or, if available, you can scan the box barcode)
- Hold the button for 6 seconds until the light starts flashing blue
- Tap the “copy password and go to settings” link, connect to the SSID that was displayed in the app, and paste the password it put in your clipboard to connect to the button’s wifi network
- Go back to the app. It should recognize that you’re on the button’s wifi and switch to asking you for your home wifi network’s SSID and password.
- After that, you’ll set the button’s action. Since we haven’t created our Lambda function yet, let’s start by creating one of their boilerplate functions. Choose “Send Email (python)” and hit “Set action”.
- Enter your email address in the box, and you should be all set.
Give it a whirl. Push the button. You should see the light blink white and then turn green after the request succeeds. The first time through, you’ll probably get an email from AWS asking you to verify your email. Even that email is proof enough that the button worked, but if you click through the verification link and push the button again you should receive an email with the subject “Hello from your IoT button”.
Create a new Lambda function
Log into your AWS console and search for the Lambda service.
You should see the function we just created in the phone app. Click on the “Create function” button.
Choose “Author from scratch”, name your function, choose Python 3.6 as the runtime, and “Create new role from template(s)” for role. Then name your role and choose “AWS IoT Button Permissions” from the Policy templates dropdown. Finally, click “Create function”. A loading indicator will spin for a bit, and then you’ll be taken to your new function.
Configure the function’s trigger
In the designer, choose AWS IoT from the list of triggers on the left.
Below, configure the trigger. Choose “Custom IoT rule” as IoT type and find the rule created when we created our initial function. (You should see the DSN in the rule name.) Make sure “Enable trigger” is checked and click “Add”.
Upload the source code archive
Back up in the designer, click on the Lambda function and you should see a “Function code” section show up blow the designer. Change “Code entry type” to “Upload a .ZIP file”, make sure the runtime is set to Python 3.6, and enter “index.handler” as the Handler path. Then click the “Upload” button and select the zip file we created earlier. (~/poop-button.zip)
Configure environment variables
Below the “Function code” section, you should see an “Environment Variables” section. Fill this section out with the same 4 variable names and values we used earlier for local testing. Encrypting the variables with a KMS key is recommended but beyond the scope of this post.
Now, save all of your changes by scrolling to the top of the window and clicking the “Save” button.
Configure and run a test event
At the top of the window, click the “Select a test event” drop-down and choose “Configure test events”. We don’t care about the test input, so the default “Hello world” event will work just fine. Name it and click “Create”.
Now click the “Test” button. You should see an execution result. (Hopefully a successful one which includes a phone call.) If your phone didn’t ring, check to make sure the code was actually uploaded and your environment variables are copied correctly using the same values you used to test locally.
Try out the button!
At this point, you should have a fully configured button. Go ahead and give it a push!
Did your phone ring? If not, check to make sure the AWS IoT trigger doesn’t say it needs configuration, its identifier contains the DSN on the back of your button, and it’s enabled.
If it rang – congratulations. You have a poop button!
You may have noticed that you received both a phone call and an email. IoT buttons can trigger multiple Lambda functions at once. If you’d like to disable the email, either delete the original Lambda function or disable its AWS IoT trigger.
Troubleshooting a toddler
The great thing about this approach is all of the technology is built and operated by 3rd parties, and pretty reliable ones. In months of daily use, I haven’t yet seen the hardware or software fail. But any parent knows that kids are tough QAers, so let me propose some tips for common failure modes you’re likely to experience.
My kid had the button when they went to sleep, but now it’s [lost in the blanket | tossed across the room | stuck between the mattress and the bed]. They have to pee and are freaking out because they can’t find it!
Adhesive velcro strips work wonders. Stick one to side to the back of the button and the other side to the wall or a part of the bed they’re not likely to knock it off. Make sure it’s close enough to easily reach but far enough away to avoid accidental presses.
My kid pushes the button after being in bed for 15 minutes as an excuse to get out of bed.
Yeah, mine wised up to this one pretty fast. Now we’re very intentional about giving them multiple chances to go to the bathroom right before bed, but we keep the button with us until they’re asleep. Then one of us sneaks in and puts it in its place. They’ve since learned to use the opportunity to go before bed.
My kid refuses to push the button. When we ask them why, they respond “I chose not to.”
Believe it or not, we initially had slow button adoption. We normalized button use by requiring our kid to push the button in order to get out of bed in the morning. Of course, this hastened the realization that it was a “get out of bed” pass, which led to the issue above.
Poop is as poop does: living with the poop button
Our poop button is a life saver. Kid 1 is pretty consistently waking with a dry pull-up, and kid 2 is getting more continuous sleep in the absence of a sibling yelling for Mom and Dad. It’s amazing the difference a small hack can make.
On Twitter, I’ve been encouraged to do everything from apply to be on Shark Tank to start a Kickstarter, but I think if anyone is going to make a business out of a button with a poop emoji on it, it’s going to be @internetofshit:
I’m sorry yes, where can I order 150,000 of these?
— Internet of Shit (@internetofshit) February 26, 2018
As for AWS, whether they’re chagrined or awed at the crappy repurposing of their technology, I think it’s fair to say they didn’t see it coming:
1) create building blocks. 2) let unexpected innovation happen. #AWS /via @dens
— Werner Vogels (@Werner) February 24, 2018
For my part, I’ll continue to try to apply practical (ok, and sometimes not so practical) engineering to dad-problems. Whether that’s using Python, Twilio, AWS IoT and Lambda to prevent night-time emergencies or using InfluxDB and a Raspberry Pi to monitor temperature with a Grafana front end I’ve always got multiple projects going. If you have any bright ideas, drop me a line – maybe we can work on something together!
David has been developing web applications in python for over a decade. Originally from Texas, he’s been living in San Francisco for the past 6 years working in the tech startup scene. David currently works at Clara Labs on Clara, a scheduling service that combines the precision of machine intelligence and the judgement of an expert team. You can find him on Twitter, on Github, or on his bicycle. | https://www.twilio.com/blog/2018/03/iot-poop-button-python-twilio-aws.html | CC-MAIN-2021-10 | refinedweb | 2,276 | 72.36 |
table of contents
NAME¶
tep_print_field, tep_print_fields, tep_print_num_field, tep_print_func_field - Print the field content.
SYNOPSIS¶
#include <event-parse.h> #include <trace-seq.h> void tep_print_field(struct trace_seq *s, void *data, struct tep_format_field *field); void tep_print_fields(struct trace_seq *s, void *data, int size, struct tep_event *event); int tep_print_num_field(struct trace_seq *s, const char *fmt, struct tep_event *event, const char *name, struct tep_record *record, int err); int tep_print_func_field(struct trace_seq *s, const char *fmt, struct tep_event *event, const char *name, struct tep_record *record, int err);
DESCRIPTION¶
These functions print recorded field’s data, according to the field’s type.
The tep_print_field() function extracts from the recorded raw data value of the field and prints it into s, according to the field type.
The tep_print_fields() prints each field name followed by the record’s field value according to the field’s type:
"field1_name=field1_value field2_name=field2_value ..."
It iterates all fields of the event, and calls tep_print_field() for each of them.
The tep_print_num_field() function prints a numeric field with given format string. A search is performed in the event for a field with name. If such field is found, its value is extracted from the record and is printed in the s, according to the given format string fmt. If the argument err is non-zero, and an error occures - it is printed in the s.
The tep_print_func_field() function prints a function field with given format string. A search is performed in the event for a field with name. If such field is found, its value is extracted from the record. The value is assumed to be a function address, and a search is perform to find the name of this function. The function name (if found) and its address are printed in the s, according to the given format string fmt. If the argument err is non-zero, and an error occures - it is printed in s.
RETURN VALUE¶
The tep_print_num_field() and tep_print_func_field() functions return 1 on success, -1 in case of an error or 0 if the print buffer s is full.
EXAMPLE¶
#include <event-parse.h> #include <trace-seq.h> ... struct tep_handle *tep = tep_alloc(); ... struct trace_seq seq; trace_seq_init(&seq); struct tep_event *event = tep_find_event_by_name(tep, "timer", "hrtimer_start"); ... void process_record(struct tep_record *record) {
struct tep_format_field *field_pid = tep_find_common_field(event, "common_pid");
trace_seq_reset(&seq);
/* Print the value of "common_pid" */
tep_print_field(&seq, record->data, field_pid);
/* Print all fields of the "hrtimer_start" event */
tep_print_fields(&seq, record->data, record->size, event);
/* Print the value of "expires" field with custom format string */
tep_print_num_field(&seq, " timer expires in %llu ", event, "expires", record, 0);
/* Print the address and the name of "function" field with custom format string */
tep_print_func_field(&seq, " timer function is %s ", event, "function", record, 0);
}
...
FILES¶
event-parse.h
Header file to include in order to have access to the library APIs. trace-seq.h
Header file to include in order to have access to trace sequences related APIs.
Trace sequences are used to allow a function to call several other functions
to create a string of data to use. | https://manpages.debian.org/bullseye/libtraceevent-doc/tep_print_num_field.3.en.html | CC-MAIN-2022-40 | refinedweb | 498 | 61.87 |
problem with from win32com.client import Dispatch
- From: muttu2244@xxxxxxxxx
- Date: 14 Nov 2005 04:27:57 -0800
Hi all
Am trying to read an html page using win32com in the following way.
from win32com.client import Dispatch
ie = Dispatch("InternetExplorer.Application")
ie.Navigate("")
doc =ie.Document
print doc.body.innerHTML
with this code am easily able to read the mentioned page from the
pythonwin interactive window, but the same code if I write it in some
*.py file, am not able to read the page.
The following error it throws when I compile the file.
Traceback (most recent call last):
File
"C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\Python23\Lib\site-packages\Script1.py", line 14, in ?
ie.Quit()
File "C:\Python23\Lib\site-packages\win32com\client\__init__.py",
line 456, in __getattr__
return self._ApplyTypes_(*args)
File "C:\Python23\Lib\site-packages\win32com\client\__init__.py",
line 446, in _ApplyTypes_
return self._get_good_object_(
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None,
0, -2147467259), None)
if any body has the answer for this please help me in this.
Thanks and regards
Yogi
.
- Follow-Ups:
- Re: problem with from win32com.client import Dispatch
- From: calfdog@xxxxxxxxx
- Prev by Date: Re: PySizer 0.1
- Next by Date: multiple inharitance super() question
- Previous by thread: Re: HOW do you stop a print???
- Next by thread: Re: problem with from win32com.client import Dispatch
- Index(es): | http://coding.derkeiler.com/Archive/Python/comp.lang.python/2005-11/msg01665.html | crawl-002 | refinedweb | 247 | 63.25 |
By default, your top level devenv/bin directory will contain a script called openmdao that has a subcommand called “test” that uses a Python package called nose to run all of the unit tests for any package that you specify. For example, to run the full set of openmdao unit tests, type:
openmdao test
which should generate output something like this:
........................................................................ ........................................................................ ..................................................................... ---------------------------------------------------------------------- Ran 293 tests in 142.846s OK
To run unit tests for a package only, for example openmdao.main, type:
openmdao test openmdao.main
To get a list of options available with openmdao test, type openmdao test --help from the devenv directory. Since the openmdao test command uses the nose testing framework internally, all options available when running nosetests should also be available when using openmdao test.
Note that when you run the openmdao test script, some tests might fail if you do not have Internet access.
A Python package called coverage, which is accessible through openmdao test, makes it easy to determine if your tests cover every line of code in your source files. To get a coverage report for the openmdao package, go to the devenv directory and type the following:
openmdao test openmdao --with-coverage --cover-package=openmdao
The report should look something like this:
................................................................................ .. Name Stmts Exec Cover Missing ----------------------------------------------------------------- openmdao 5 0 0% 2-6 openmdao.lib 0 0 100% openmdao.lib.components 0 0 100% openmdao.lib.drivers 0 0 100% openmdao.lib.drivers.conmindriver 183 179 97% 149, 233-234, 271 openmdao.lib.factories 0 0 100% openmdao.lib.variables 0 0 100% openmdao.main 6 3 50% 5-7 openmdao.main.arrayvar 48 47 97% 32 openmdao.main.assembly 103 101 98% 95, 129 openmdao.main.component 47 41 87% 58, 92, 99, 106, 121, 142 openmdao.main.constants 4 4 100% openmdao.main.constraint 44 43 97% 24 openmdao.main.container 201 185 92% 22-24, 138, 156, 166, 253-254, 276-277, 337, 340, 356, 359, 367-368 openmdao.main.containervar 50 29 58% 29, 38-43, 49-55, 66-72, 82 openmdao.main.driver 18 15 83% 35, 40-41 openmdao.main.exceptions 5 5 100% openmdao.main.expreval 122 115 94% 27, 32, 36, 40, 85, 177, 222 openmdao.main.factory 6 5 83% 25 openmdao.main.factorymanager 21 16 76% 28, 33-37 openmdao.main.float 70 54 77% 38-41, 49-53, 58-61, 69-73, 105, 120 openmdao.main.hierarchy 49 46 93% 34, 40, 59 openmdao.main.importfactory 28 25 89% 47-49 openmdao.main.int 42 24 57% 31-34, 39-46, 51-54, 59-66 openmdao.main.interfaces 54 54 100% openmdao.main.logger 9 9 100% openmdao.main.pkg_res_factory 61 59 96% 88, 114 openmdao.main.string 42 28 66% 31-34, 42-46, 51-54, 62-66 openmdao.main.stringlist 56 40 71% 31-34, 42-46, 51-54, 62-66, 92, 95 openmdao.main.tarjan 58 26 44% 52-71, 78-96, 100 openmdao.main.variable 138 113 81% 22, 54, 65, 73, 101-104, 112, 117, 129, 141, 184, 202, 227, 263, 265-270, 276, 282-285, 289-290 openmdao.main.vartypemap 19 17 89% 42-45 openmdao.main.workflow 56 35 62% 30, 43, 56, 61-75, 79, 86-88, 92 ----------------------------------------------------------------- TOTAL 1545 1318 85% ---------------------------------------------------------------------- Ran 82 tests in 5.678s OK
The numbers in the Missing column indicate lines or ranges of lines that are not covered by the current set of tests.
If you edit source code, the coverage data may become inaccurate, so you should clear the coverage database by issuing the following command:
openmdao test openmdao --cover-erase
Note that the coverage package is not included with openmdao, so to use it you’ll have to install it in your openmdao environment like this:
easy_install coverage
Generally, you should write your tests using Python’s unittest framework if possible, although the nose package is able to find and run tests that do not use unittest.
The following is a simple example of a unit test written using the unittest framework.
import unittest class TestSomeFunctions(unittest.TestCase): def setUp(self): # put setup code here. It will run at the beginning of each # test function (function with name that starts with 'test') def tearDown(self): # put code here that you want to be run after each test function # is completed def testfunct1(self): # a test function def test_some_stuff(self): # another test function if __name__ == '__main__': unittest.main()
The unittest.TestCase class provides a number of functions to test output during a test function. For example:
Often in a test you will want to make sure that a specific exception is raised when a certain thing happens, and usually you want to verify that the error message contains certain information. The unittest framework provides an assertRaises function that does part of this job, but it does not allow you to check the error message. So the preferred way to test exceptions is shown in the code below. In this example, we will assume that the exception we are interested in is a ValueError. Note that we would place our test function inside of our unittest.TestCase derived class.
def test_myexception(self): try: # perform action here that should raise exception except ValueError, err: self.assertEqual(str(err), "this should be my expected error message") else: self.fail('expected a ValueError')
Note that the else block after the except is important because we want the test to fail if no exception is raised. Without the else block, the test would pass if no exception were raised.
The OpenMDAO documentation includes quite a few examples of Python code. These examples illustrate how to use features of the OpenMDAO API as well as how to develop new components and plugins. Thus, it is imperative that any code examples included in the documentation (particularly the tutorials and the Developer Guide) be tested to ensure that the code is error-free.
Fortunately, there are tools built into the Sphinx reStructuredText processor that make the process of testing code samples much easier. Sphinx includes a builder called doctest as a plugin in its standard library. Instead of building a readable document as is done by the HTML builder, the doctest builder scans the documentation files for code blocks and tests them.
Two types of code examples are found in the documentation. The first type is a block of code as would be found in a Python script:
from openmdao.examples.enginedesign.engine import Engine my_engine = Engine("new_engine")
The second type of code example is a copy of an interactive shell session:
>>> print "Hello!" Hello!
Both of these types of code samples must be tested, although the way to accomplish this differs slightly in each case. Unlike the doctest module built into Python, which can handle only shell session blocks, the doctest builder included with Sphinx can handle both of these code sample types.
The doctest builder in Sphinx provides a flexible environment to easily and effectively test blocks of code using a set of directives. The test code directive is used to mark a block of text that should be tested and treated as Python code. It is not always possible to execute a standalone block of Python code without first executing some preliminary code containing any prerequisites (e.g., imports.) The testsetup block makes it possible to run the preliminary code. This block is hidden by default, so it does not show up in the generated HTML documentation. Additionally, the testoutput block should include any output that is generated by the testcode block so that it can be tested.
A simple example of how to implement these three blocks is shown here:
.. testsetup:: Group1 # Put any preliminary code that needs to run before the sample code. # This block does not show up when Sphinx builds the HTML .. testcode:: Group1 # This is the sample code that shows up in your docs .. testoutput:: Group1 # If your code block outputs anything when executed, then that output # needs to go in this block.
Group1 is a label that we’ve given this set of blocks. You can have multiple labels in your documents. Also, the testsetup and testoutput blocks are both optional. Some code examples don’t need either. You can have multiple testcode blocks for a single testsetup block. The environment is preserved across all of the testcode blocks in a given group, so that the code executed in the first testcode block in Group1 affects all later blocks in Group1.
The label is optional; when not explicitly defined, default is used.
The doctest directive is used to specify blocks of interactive shell Python code. If the directive is omitted, the doctest builder can often find the Python blocks by itself, but it is still a good idea to include it so that you can control the environment.
.. doctest:: Group2 >>> # This code is tested
The doctest blocks share their workspace in a similar manner as the testcode blocks. Other options can be enabled for the doctest blocks, but so far the default ones have been fine.
More details on using the doctest builder can be found here:
At times it is more efficient to directly include code from a source file. The built-in Sphinx directive that enables this is called the literalinclude block:
.. literalinclude:: ../../openmdao.examples/openmdao/examples/enginedesign/engine_wrap_c.py :start-after: engine_weight = 0.0 :end-before: # end engine.py :language: python
The first line contains the relative path location of the file that is to be included. Since you rarely want to include an entire file, the options start-after and end-before can be used to define the bookends that bound the block of text to be included.
Sometimes, it makes more sense to grab specific lines from a file. This can also be done with the lines option.
.. literalinclude:: ../../openmdao.examples/openmdao/examples/enginedesign/engine_wrap_c.py :lines: 3,7-12,45 :language: python
More details on the literalinclude directive can be found at.
Tracebacks don’t have to be accurately reproduced (and they can’t be anyway). Handle these by replacing the traceback with ellipses:
>>> my_engine.set("throttle",3.0) Traceback (most recent call last): ... ValueError: Variable 'RPM' must be a float in the range [0.01, 1.0] but a value of 3.0 <type 'float'> was specified.
Indentation is not preserved between code blocks in the same group. This means that all functions and class definitions effectively close when the block ends. If you need to show code from the middle of a function class, you may have to get creative in what you place in your testsetup block (e.g., defining self as something.)
Take care to assure that each block of code is being tested. One way to do this is to purposefully introduce an error into a block to verify that it is caught.
Be wary of including code by line number. If the source file is changed and lines are added or removed, then the included code might not be what was intended.
To include a numerical example in a doctest block, you can use ellipses to match the output to a specific tolerance. For example, this block of text passes:
>>> import numpy >>> numpy.pi 3.14...
Sphinx automatically generates syntax highlighting for the code block, but it can get confused if you mix tabs and spaces.
The doctests are automatically run whenever you run openmdao test, but you can also run them separately. In an active openmdao virtual environment, type:
openmdao test_docs
This command builds the documents and then runs the doctests. If the test was successful, you should see output similar to the following:
Doctest summary =============== 156 tests 0 failures in tests 0 failures in setup code build succeeded.
If any tests fail, they will be noted in this summary, and specific tracebacks will be given for each failure earlier in the output.
Note
If you change the docs, rebuild the documentation by running openmdao build_docs and display them by typing openmdao docs. | http://openmdao.org/releases/0.2.5/docs/dev-guide/testing.html | CC-MAIN-2019-43 | refinedweb | 2,001 | 65.01 |
green 0.9 with vertically-aligned status indicators
- FAST -- tests can be run in independent subprocesses
- Auto-discovery of tests in a directory, package, or module
- No new objects to learn -- just use normal `unittest` classes.
- Four verbosity levels
- Built-in, optional integration with
[coverage]
- Supports Python 2.7, 3.3, 3.4, and [PyPy])
- Completely supports OS X and Linux, most likely BSDs (and maybe Windows,
someone want to try it and let me know?)
- Optional HTML output
Basic Usage
-----------
The simplest way is to just run `green.:
```python
def answer():
return 42
class School():
def food(self):
return 'awful'
def age(self):
return 300
```
Here's a possible version of `test_foo.py` you could have.
```python
#:):
- 243 downloads in the last day
- 1568 downloads in the last week
- 5741 downloads in the last month
-.9.6.xml | https://pypi.python.org/pypi/green/0.9.9.9.6 | CC-MAIN-2015-14 | refinedweb | 139 | 61.67 |
I have 5 classes
class 1- main (basically controlls everything except recognizing where the letters are located in the word and printing the hangman picture)
class 2- char_array (sees if the letter is in the word multiple times, and prints the letters the operator has figured out (ex: bumb-e) )
class 3 - graphics (just full of methods that print the hangman on the screen depending on how many letters you have gotten wrong)
class 4 - numbers (just has one method to decide what hangman picture to display)
class 5 - wordlist - a class that chooses a word from a list of many)
Where I am stuck is that the variables in the char_array class reset each time the init() or some_function() that gets called. Therefore, if i have a word with two of the same letter, the count gets messed up AND the the word with the dashes that the user sees (ex: G--gle) gets reset every time, so only the letter that you just entered will show up(ex: i enter g: G--g--, then i enter o: -oo---)
Here is the main class
import java.lang.reflect.Array; import java.util.Scanner; import java.util.Random; import java.util.Arrays; import java.util.HashMap; import java.io.*; public class main{ public static void main(String[] args){ graphics graphics = new graphics(); numbers numbers = new numbers(); WordList words = new WordList(); main main = new main(); Scanner input = new Scanner(System.in); //String word[] = {"h", "i"}; String word = new String(words.getword()); String guessed_letters = new String(""); int guesses_right = 0; int guesses_wrong = 0; int length = word.length(); System.out.println("Hello, this is a hangman game. Good luck!"); System.out.println(word); while(guesses_right != length && guesses_wrong != 6){ System.out.println("Please enter a letter: "); String x = input.nextLine(); if(isAlpha(x) && !(x.length() >1)){ x = x.toLowerCase(); if(word.contains(x) && !(guessed_letters.contains(x))){ System.out.println("------------------------------"); System.out.println("Good job, that is in the word"); char_array char_array = new char_array(); guessed_letters = guessed_letters + x; char_array.init(word, x); char_array.some_function(); System.out.println("DEBUG" + char_array.counter); guesses_right = guesses_right + char_array.counter; guesses_right++; numbers.display_hangman(guesses_wrong); System.out.println("Guessed_letters:" + guessed_letters); } else if (guessed_letters.contains(x)){ System.out.println("------------------------------"); System.out.println("I'm sorry, but you have already entered that number"); } else if (!word.contains(x)){ //guessed_letters = guessed_letters + x; if (guessed_letters.contains(x)){ System.out.println("------------------------------"); System.out.println("I'm sorry, but you have already entered that number."); } else{ System.out.println("------------------------------"); System.out.println("Sorry, that is not in the word"); guesses_wrong++; numbers.display_hangman(guesses_wrong); } guessed_letters = guessed_letters + x; } }else{ System.out.println("I'm sorry, but it appears you have entered something that is invalid"); } } if( guesses_wrong == 6){ System.out.println("I'm sorry but it appears that you have lost. The word was " + word + ". Maybe try again?"); } else{ System.out.println("Congratulations!! You have won. The word was " + word + ". Maybe try again?"); } } public static boolean isAlpha(String name){ return name.matches("[a-zA-Z]+"); } }
-------------------------------------------------------------------------------
here is the char_array class
import java.lang.String; public class char_array { public void init(String a, String B)/>{ word = a; x = b; } main main = new main(); graphics graphics = new graphics(); public String word; public String x; public int counter = 0; public void some_function() { //variable to increase in case of double letter char what_user_sees[] = new char[word.length()]; char charArray[]=word.toCharArray(); for(int i = 0; i <word.length(); i++){ what_user_sees[i] = '-'; } for(int h=0;h<word.length();h++){ if (charArray[h] == x.charAt(0)){ what_user_sees[h] = x.charAt(0); counter++; //System.out.println(what_user_sees); } } System.out.println(what_user_sees); //print the thing with the hash marks } }
These classes seem to be the ones that are causing the trouble. Could you guys modify the code for me so that the variables don't get reset every time?
Thanks in advance,
Brady
I would post the other classes, but they will just take up space, and i really don't think you will need them.
PS - if you guys could give me some better coding styles, that would be great. I'm just a beginner, So I'll take any advice that I can get. | http://www.dreamincode.net/forums/topic/317592-variables-reset-after-each-method-call/ | CC-MAIN-2018-09 | refinedweb | 687 | 58.69 |
I guess one of the reasons a lot of C programmers could not digest Java was
because Java didn't let them manipulate pointers. Anyway C# supports pointers.
You can use the
unsafe keyword to inform the compiler that the following function
or block is unsafe. And once you do that you can use pointers in that unsafe
area.
using System; class nish { unsafe static void Increment(int* p) { //increment the int pointed to by p *p=*p+1; } public static void Main() { int i = 1; //we pass the address of the int to the function as it expects a pointer unsafe { Increment(&i); } //now we print out the value of i Console.WriteLine (i); } }
When you run the program, you'll see 2 printed on screen. This is because you have passed the address of the variable i to the function Increment. Variable i is created on the stack. &i gives its address on the stack. Thus when within the function Increment, p is pointing to i's address. Thus when we add 1 to *p we are actually incrementing i;
The following program should make things clearer to you.
using System; class nish { unsafe public static int Main() { int j=100; int k=100; Console.WriteLine("address of j={0} and address of k={1}",(int)&j,(int)&k); Console.WriteLine("j={0} k={1}",j,k); int *p; p=&j; Console.WriteLine("p now points to {0}",(int)p); *p=200; Console.WriteLine("j={0} k={1}",j,k); p=&k; Console.WriteLine("p now points to {0}",(int)p); *p=300; Console.WriteLine("j={0} k={1}",j,k); return 0; } }
When I ran it I got the below output. You would get something similar. The output will clearly give an idea of what's going on.
address of j=1244312 and address of k=1244308 j=100 k=100 p now points to 1244312 j=200 k=100 p now points to 1244308 j=200 k=300
First we assign the address of j to p. Thus when we change *p we automatically change j. Then we change p to point to k's address and thus when we change *p we are actually changing k
Also remember than the pointer variable p itself has an address. This following program will make that clear.
using System; class nish { public static void Main() { unsafe { int a=100; int *p; p=&a; Console.WriteLine("address of a is {0}",(int)&a); Console.WriteLine("p now points to {0}",(int)p); Console.WriteLine("address of the pointer variable p is {0}",(int)&p); } } }
On running it I got the below output. You'll get similar output too. Notice
the alternate use of the
unsafe keyword
address of a is 1244312 p now points to 1244312 address of the pointer variable p is 1244308
In my case 1244308 is the address of the pointer variable p. The contents of that address is 1244312 which is an address. Thus when we take *p we are referring to the address 1244312. Try printing out *p and it will print out the contents of 1244312 which happens to be 100 in the above case. I hope things are clearer now.
Okay. In this final program I'll show you how to use pointers to manipulate a character string. In this program there is a function that takes a string and encodes or decodes it using XOR. If you pass a string to it it will encode it and if you pass the encoded string to it, it will decode it. Of course this is by no way a safe or practical encryption method. I am using it merely to demonstrate the use of pointers.
using System; class nish { public static void Main() { string s="Code Project is cool"; Console.Write("the original string : "); Console.WriteLine("{0}\r\n",s); char[] b = new char[100]; s.CopyTo(0,b,0,20); Console.Write("the encoded string : "); unsafe { fixed(char *p=b)NEncodeDecode(p); } for(int t=0;t<20;t++) Console.Write(b[t]); Console.WriteLine("\r\n"); Console.Write("the decoded string : "); unsafe { fixed(char *p=b)NEncodeDecode(p); } for(int t=0;t<20;t++) Console.Write(b[t]); Console.WriteLine(); } unsafe public static void NEncodeDecode(char *s) { int w; for(int y=0;y<20;y++) { w=(int)*(s+y); w=w^5; *(s+y)=(char)w; } } }
This is the output I got. You should get this too.
the original string : Code Project is cool the encoded string : Fja`%Uwjo`fq%lv%fjji the decoded string : Code Project is cool
You will notice a new keyword here called
fixed. When you
precede a statement or a function with
fixed you are
instructing the .Net garbage collector not to relocate that variable till
the statement or function has finished. The
fixed keyword is only
allowed in an unsafe context. If we don't use
fixed there is little point in
using pointers as the results would be unpredictable if the garbage collector
keeps relocating the managed variables. Luckily the compiler won't let you point
to managed variables unless you specify the
fixed keyword.
In the function you can see that I use the expression *(s+y). s is the address pointing to the string. y is incremented starting from 0 and ending upto 19. Thus when I give *(s+y) I get the pointers to characters in those locations. Lets assume s points to 1000. Thus *(s) will give me the contents of location 1000. Now if I give *(s+1) I get the contents of 1002, and for *(s+2) I get 1004 and so on. The compiler knows I am pointing to a character array and thus each increment jumps 2 bytes as char is a 16 bit value. C# actually maps char to the .Net type System.Char.
Sometimes, you might need to call the Win32 API. And there are API functions, quite a good number of them to be precise, that take pointers as arguments and often return data via pointers. The following program is an example where such a call is made. Of course, there are other means to obtain the Windows folder from .NET, but the point of the program is to demonstrate the use of unsafe blocks in such a scenario where we need to call an API function that expects pointers.
using System; using System.Text; using System.Runtime.InteropServices; class Class1 { [DllImport("kernel32", SetLastError=true)] static extern unsafe uint GetWindowsDirectory(byte* lpBuffer,uint uSize); static void Main(string[] args) { byte[] buff = new byte[512]; unsafe { fixed(byte *pbuff=buff)GetWindowsDirectory(pbuff,512); } ASCIIEncoding ae = new ASCIIEncoding(); System.Console.WriteLine(ae.GetString(buff)); } }
Please be careful when writing unsafe code. Any small error, even a silly typing mistake, might crash your program randomly and unpredictably. The error might also be a rarely occurring one and thus harder to debug. But those of you who had used pointers in C/C++ and want to use them in C# may do so at their leisure. Thank You.
General
News
Question
Answer
Joke
Rant
Admin | http://www.codeproject.com/KB/cs/csunsafeintro01.aspx | crawl-002 | refinedweb | 1,190 | 74.49 |
City of Vancouver’s short term accommodation bylaw fully came into force today. There was much talk of “2,000” Airbnb units being deactivated. But did it really happen?
It appears that Airbnb has deactivated approximately 5% of the listings that were active on August 31.
I took a random sample 832 of City of Vancouver hosts on Airbnb August 31 between 4pm and 6pm Pacific Time.
218 out of the 832 (27%) of them were without licences and facing deactivation. I ran a follow up today between 1pm and 2pm. Here’s what I found
Table1: What happened to the listings without licenses on Aug 31
That means approximately 5% of Airbnb listings that were active in my sample have been delisted. If we go by Jens von Bergmann’s figure of 4,700 total listings1), that works out to about 250 listings being taken off the platform.
But the number of people who are cheating the system far exceed the number of listings yanked from the platform. I’m currently collecting data post-purge, and here’s what I have found with my fresh sample of 1,634 listings collected so far today.
Table 2: Summary of problems with licences
459 listings, or 28%, share a licence with one or more other listings. This means that Airbnb and City have done nothing to crackdown on commercial operators.
Licences for 152, or 9%, did not appear in the City of Vancouver business license database.
73 out of the 832 listings in my sample, or 4%, claimed to be “Exempt” even though they were for less than 30 days. Further 17 listings, or 1%, had obviously fake license numbers such as 00-0000. This means 11% of the listings are either fake or are claiming to be exempt when they probably aren’t.
In summary, the “great purge” did not happen. Even amongst the listings with licences, 43% are problematic.
A lot of these problems can be solved by introducing license auto-verification2).
Data
I’m happy to share my SQL database if anyone wants to play around with it. Just get in touch with me.
Bonus
Here’s a nify two-liner to extract City of Vancouver short term rental licences from the Open Data portal Json file.
import json stral = [f['properties']['LicenceNumber'] for f in json.load(open("/path/to/Politics/business_licences.json"))['features'] if f['properties']["BusinessType"] is not None and 'Short-Term Rental' in f['properties']["BusinessType"]] | https://rezel.ca/2018/09/only-5-of-vancouver-airbnb-listings-deactivated/ | CC-MAIN-2020-10 | refinedweb | 412 | 64.41 |
Warning: You probably shouldn’t be using jQuery any more, this is an old article. Please tread with caution when referencing this article.
Here is a simple and effective way to pass different jQuery contexts around for manipulation in client packages. Recently I was presented with the issue of instantiating multiple iframes within a single page, all of which would have a small package loaded inside them to run and manipulate itself. These packaged units needed a handle on their own iframe as well as the parent document.
$ is setup to work off the current
document. When no context is provided to the
jQuery() selector method then the context of
document is used. I could have manipulated the selector or used other
jQuery helper methods to get a handle on the parent document, but that would get messy very fast and could make the packaged code difficult to read.
A cleaner solution is to have two seperate selector handles, one on the unit iframe document and one on the
top.document. This approach can be used to limit the selector for anything but for my case I needed
top.document.
import $unit from 'jquery' import $top from 'utils/jquery-top'
In the above example
jquery is just the defacto
jquery installed as a dependency via
npm. The second
import statement is a custom abstraction to the defacto
jquery library which allows me to override the seletor method and limit the context to
top.document.
import jQuery from 'jquery' jQuery.noConflict() let bling = function(selector, context = top.document) { return new jQuery.fn.init(selector, context) } bling.fn = bling.prototype = jQuery.fn jQuery.extend(bling, jQuery) export default bling
Now when I’m in the unit packaged code I can have a handle on both the
top.document as well as the individual unit iframe
document.
$unit('.content-body').text('This is an example') $top('.unit-iframe').addClass('showing') | https://hbrysiewicz.com/2016-02-17-jquery-scope.html | CC-MAIN-2021-43 | refinedweb | 317 | 55.95 |
�StdAfx� files yet as these are needed.
The point in this step is to simply copy and paste your class (�foo�) into the header and source files created. It should be a simple concept to grasp, but if you are skeptical you can alternatively just add your �foo� �Export�. When it is being included in another project that does not use the source code, you will need to �Import�. This is probably the harder part of understanding the DLL as it is not necessarily implemented for you and requires a little effort before understanding. As a side note, the �resource.h� is only required by DLLs that have dialogs in them. In this case, you will have to remember that you may have several �resource.h� files then and will have to include a full path statement to each �resource.h� file. This article will show in the following example what is probably the best method (keeping in mind that if a project needs this resource file it must manually be added to the project including the full path to it).
StdAfx.h // // MSVS included headers, definitions, etc. // // Somewhere near the bottom //This is the project macro preprocessor definition //you will be adding shortly. #ifdef DLL_EXPORTS //This is to be used for the class header file. #define DLL_BUILD_MACRO __declspec(dllexport) #else #define DLL_BUILD_MACRO __declspec(dllimport) #endif #ifndef _DLL_BUILD_ //Why do this? Is it necessary? Yes. #define _DLL_BUILD_ DLL_BUILD_MACRO #endif //make sure resources are included here, if desired, //to prevent ambiguous //callings to different resource.h files. #include �resource.h� // // Rest of file //
foo.h #ifndef _FOO_H_ #define _FOO_H_ // // Miscellanous here // /*This part automatically includes any libraries when called. When this file is built within the DLL project, it will not be called because of our preprocessor macro definition �_FOO_DLL_�. However, when this file is called from another project, not part of this build, it appropriately chooses the correct library and includes them for you. WHAT this means is that you will not have to add the library to the project link settings for a project that requires this DLL. This helps to avoid the tedious task of linking to several custom DLLs. Note there are two different libraries here and probably not necessary but give you an idea of how to separate debug versions from release versions.*/ #ifndef _FOO_DLL_ #ifdef _DEBUG //You will be building a debug program that //uses this file, so in this case we //want the debug library. #pragma comment( lib, �food.lib� ) #else //You will be building a release program that //uses this file, so in this case we //want the release library. #pragma comment( lib, �foo.lib� ) #endif #endif #ifndef _DLL_BUILD_ #define _DLL_BUILD_ //Makes sure there are no compiler errors. #endif class _DLL_BUILD_ foo private: // // Your members // public: // // Your functions // }; #endif
foo.cpp #include �stdafx.h� //place first #include �foo.h� // //Your code //
_FOO_DLL_� and �
DLL_EXPORTS� at the end of the list of other macro definitions. Be sure to separate each new MACRO with a coma (�,�). Make sure to do this for the release version too, as you will have to redo these next steps for each type of build. Make sure to build with any �debug info� and/or �browse info� if this is a debug version and if you want to debug the DLL later using the MSVS debugger.
Debug.bat Copy �Debug\foo.lib� �c:\<libraries dir>\food.lib� REM copy the dll file to the windows system32 REM directory to make the DLL easily REM accessible. Note that you will have to install or include the REM dll file in your distribution package for the program that uses it. Copy �Debug\foo.dll� �c:\%system dir%\system32� Copy �foo.h� �c:\<headers dir>� Release.bat Copy �Release\foo.lib� �c:\<libraries dir>� �Release\foo.dll� �c:\%system dir%\system32� Copy �foo.h� �c:\<headers dir>� �c:\windows\system32� �Debug.bat� and �Release.bat� files and then rebuild the project to have them copied.
Also note that in MSVS it is easy to add custom directories for new header directories to search, but unfortunately not DLL directories. Go under �Tools->Options� in the menu bar and then under the �Directories� tab button. Where �<libraries dir>� above in the batch file should be included under �Library files� in the �Show directories for� combo box and �<headers dir>� in the �Include files�. Windows.
General
News
Question
Answer
Joke
Rant
Admin | http://www.codeproject.com/KB/DLL/DLL_EZ_Build_EZ_Usage.aspx | crawl-002 | refinedweb | 736 | 66.13 |
Zipping Lists in Python
If you need to work with multiple lists at once the
zip builtin is the tool you are looking for.
The
zip function is a Python builtin that aggregates its arguments into a list of tuples.
What is the
zip function and how does it work?
zip takes an iterable (with zero or more elements) and aggregates them into a single list. This list will contain tuples, where the tuples contain an element from each list.
Typically it is used with two lists, like so:
for i in zip([1,2,3], ['a','b','c']): print(i)
Output:
(1, 'a') (2, 'b') (3, 'c')
Type of the return value
In Python version 2 zip returns a list, while in Python 3, the return value is an iterator:
Python 2
print(zip([1,2,3], ['a','b','c']))
output:
[(1, 'a'), (2, 'b'), (3, 'c')]
Python 3
print(zip([1,2,3], ['a','b','c']))
output:
<zip object at 0x7f0b1bce7500>
How to import
zip
zip is a python builtin, it can be used to work with lists in parallel, no need to import, it should be accessible by default as it is defined in the builtin namespace.
What happens if the lists are not of equal length?
If you pass lists of different lengths, the return value will have the length of the shortest list:
print(zip([1,2,3], ['a','b'])) <zip object at 0x7f0b1bce7500>
output:
[(1, 'a'), (2, 'b')]
Advanced use cases - tricks using zip
zip is can be surprisingly powerful tool, here are some nice patterns to showcase what you can do with it:
Zipping multiples lists
As I’ve already mentioned,
zip is not limited to zipping only two lists, in fact, you can pass it any number of arguments. The result will create tuples which have the length equal to the number of arguments passed to
zip. This pattern is used quite often in Python:
for i in zip([1,2,3], ['a','b','c'], [0.1, 0.2, 0.3]): print(i)
output:
(1, 'a', 0.1) (2, 'b', 0.2) (3, 'c', 0.3)
Iterating two lists in parallel
Python has a feature called tuple unpacking, which means that you can assign values to multiple variables in a single expression:
a, b, c = (1, 2, 3) print(a) print(b) print(c)
output:
1 2 3
This can be used in combination with zip to iterate on two (or more) lists in parallel:
for i, j, k in zip([1,2,3], ['a','b','c'], [0.1, 0.2, 0.3]): print("{}, {}, {}".format(i, j, k))
output:
1, 'a', 0.1 2, 'b', 0.2 3, 'c', 0.3
Combining two lists into a dictionary (keys+values)
A dictionary can be defined using a list of 2-long tuples (pairs), so you can easily zip together two lists.
keys = ['a','b','c'] values = [1, 2, 3] print(dict(zip(keys, values)))
output:
{'a': 1, 'b': 2, 'c': 3}
Zipping a list of lists
If you have a list of lists (in other words: a variable number of lists), you can zip them together as well, you only need to unpack them using the
*operator:
l=[[1,2,3], ['a','b','c'], [0.1, 0.2, 0.3]] for i in zip(*l): print(i)
output:
(1, 'a', 0.1) (2, 'b', 0.2) (3, 'c', 0.3)
The inverse of
zip - unzipping a list of tuples into multiple lists
The above pattern can be used to revert zipping a list of lists as well.
zipped_list = [ (1, 'a', 0.1) (2, 'b', 0.2) (3, 'c', 0.3) ] first_elements, second_elements, third_elements = zip(*zipped_list) print(first_elements)
output:
[1, 2, 3]
Transposing a matrix
Generalizing this means that pattern shown above (unpack+zip) can be used to transpose martixes:
matrix=[[1,2,3],[4,5,6],[7,8,9]] print(list(zip(*matrix)))
output:
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]
Returning a list of lists instead of a list of tuples
There is a slight issue with the example above, as the list of list turned into a list of tuples. It can be easily fixed though, you can turn lists into tuples in a list comprehension:
matrix=[[1,2,3],[4,5,6],[7,8,9]] print([list(row) for row in zip(*matrix)])
output:
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]
Zip longest
I’ve already mentioned, that
zip will return a list that is equal in length with the shortest of its arguments. There is very similar function defined in the
itertools module, called
zip_longest, which behaves exactly like
zip, but pads the resulting tuples to the length of the longest of its arguments.
from itertools import zip_longest list(zip_longest(['a', 'b', 'c'], [1]))
output:
[('a', 1), ('b', None), ('c', None)]
You can also set a different padding value instead of
None using the
fillvalue keyword argument:
from itertools import zip_longest list(zip_longest(['a', 'b', 'c'], [1], fillvalue='X'))
output:
[('a', 1), ('b', 'X'), ('c', 'X')] | https://pythonin1minute.com/zipping-lists-in-python/ | CC-MAIN-2022-21 | refinedweb | 841 | 63.53 |
# include <stdio.h> # include <string.h> # include <time.h> # include <stdlib.h> char * construct(); void main() { int filesize = 50000; int bufflen = 50 * 1024; int strsize; char * buffer = new char[bufflen]; char *randstr = construct(); *buffer = '\0'; strsize = strlen(randstr); int actual; while (bufflen >= 0) { strcat(buffer, randstr); actual = bufflen; bufflen -= strsize; if(bufflen <= 0) break; } bufflen = actual; FILE *pfile = fopen("bigfile.txt","wt"); for(int i=0; i < filesize/bufflen;i++) { fwrite(buffer, 1, bufflen, pfile); } fclose(pfile); } char randCharacter() { char randChar = ' '; int counter = 0; int randNum = 0; // Provide seed for the random number // generator. srand(time(NULL)); //for (counter = 0; counter < 10; counter++) { // First, pick a number between 0 and // 25. randNum = 26 * (rand() / (RAND_MAX + 1.0)); // The ASCII code for 'A' is 65, so // add 97 to the random number to get // a lower case letter. randNum = randNum + 65; // Type cast to character to convert // it to a char type. randChar = (char) randNum; } //printf ("Random char: %s\n", randChar); return randChar; } char * construct() { char randstr[20] = "ABCDEFGHIJ"; strcat(randstr, "X"); //Actually planning to append a char first, from randCharacter function printf("Rand:%s\n", randstr); printf("Len: %d\n", strlen(randstr)); printf("ten: %c\n", randstr[10]); //Outputs correctly in console but writes the first 6 to the file. //strcat(randstr, "12 1.5\n"); Int and double values are actually dynamically generated //strcat(randstr, "43 1.8\n"); return randstr; }
From novice to tech pro — start learning today.
to avoid undefined behaviour, you should make randstr static, or else allocate it.
Open in new window
Other than that - not sure where it is failing - what does it do that it shouldn't or not do that it should
try changing
char * buffer = malloc(bufflen);
static char randstr[20] = "ABCDEFGHIJ";
Pinal Dave will teach you tricks to help identify the real root cause of database problems rather than red herrings. Attendees will learn scripts that they can use in their environment to immediately figure out their performance Blame Shifters and fix them quickly.
i am using strcat to concatanate "ABCDEFGHIJ". i cannot concatanate a char 'X', so i think i need to convert and concat.
char c = (char)((rand() % 26) + 65); //credit to : julianH.
strcat(randstr, "X"); //Actually planning to append a char---> not a string char.
My other actual problem is in the comments:
//strcat(randstr, "12 1.5\n"); Int and double values are actually dynamically generated
//strcat(randstr, "43 1.8\n");
randstr has an original value, now added a character and now I need expand the randstr more to add the int and float looking values. What is the elegant way of doing this?
Regards.
But after those are fixed,
You subtract a strsize of 11 from a bufflen of 51200
4654 times, leaving a bufflen = actual of 6,
so each
fwrite(buffer, 1, bufflen, pfile);
only writes 6 bytes at a time.
I am trying to form a big file with a pattern. I really don't get an error in new part, but failed to concat a char as a char to a string since randstr[20] is fixed, it should be expanding as I am not only planning to concat a char but also other strings to form the file content but failed.
Open in new window
Regards.
Here is my finalized code. I have stuck currently in the idea of outer loop of construct() function. If I don't use a loop I can print out but I need loop over alphabet letters.
I also tried to call the function in a loop, but then the buffer construction is lost. Following is the final complete code:
Open in new window
I made the code finally working but I am afraid the code quality sucks..Can anyone inform me what to do to make this code better?
My aim is to populate the file to a huge size within the
Open in new windowloop. This is also related with the question link in this question.
Open in new window
Regards.
And what's the purpose of
int m = 65;
or of
bufflen = strsize;
and why is bufflen passed to construct?
I asked similar questions in the other post - hence the suggestion the two be combined - duplicating effort here.
Terribly sorry, actually i didn't mean to duplicate but it really looks like a duplication.
Ok I grade the most of points to you for other question, and most of points here to Ozo.
Regards.
Regards. | https://www.experts-exchange.com/questions/28016182/Trying-to-add-a-character-and-strings-to-a-char-array-or-char-in-C-but-failing.html | CC-MAIN-2018-09 | refinedweb | 743 | 62.88 |
Hi Dmirty,On Sat, 1 Apr 2017 10:54:35 -0700, Dmitry Torokhov wrote:> There is theoretical possibility that i2c_master_send() and> i2c_master_recv() may return non-negative result on error: we pass> return values from i2c_xfer() unmodified to the caller, unless we> transferred exactly 1 message. Let's ensure we always return negative on> error.> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>> ---> drivers/i2c/i2c-core.c | 10 ++++++++--> 1 file changed, 8 insertions(+), 2 deletions(-)> > diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c> index 6efeba42d10b..34b0482333f4 100644> --- a/drivers/i2c/i2c-core.c> +++ b/drivers/i2c/i2c-core.c> @@ -2835,7 +2835,10 @@ int i2c_master_send(const struct i2c_client *client, const void *buf, int count)> * If everything went ok (i.e. 1 msg transmitted), return #bytes> * transmitted, else error code.> */> - return (ret == 1) ? count : ret;> + if (likely(ret == 1))> + return count;> +> + return ret < 0 ? ret : -EIO;> }> EXPORT_SYMBOL(i2c_master_send);> > @@ -2865,7 +2868,10 @@ int i2c_master_recv(const struct i2c_client *client, void *buf, int count)> * If everything went ok (i.e. 1 msg received), return #bytes received,> * else error code.> */> - return (ret == 1) ? count : ret;> + if (likely(ret == 1))> + return count;> +> + return ret < 0 ? ret : -EIO;> }> EXPORT_SYMBOL(i2c_master_recv);> I'm not convinced.Firstly, that would be a device driver bug, and I can't see howsilently working around it here helps. If a driver is broken, it should befixed. So I would expect a log message.Secondly, I believe i2c_master_send() and i2c_master_recv() should beable to trust the return value of i2c_transfer(), which in turn shouldbe able to trust the return value of __i2c_transfer(). If you reallywant to check the value returned by i2c_algo->master_xfer() forvalidity, this should be done in __i2c_transfer(). But then again, Ifind it hard to justify the run-time overhead for working drivers, somaybe it should only be done if CONFIG_I2C_DEBUG_BUS is enabled.-- Jean DelvareSUSE L3 Support-- Jean DelvareSUSE L3 Support-- Jean DelvareSUSE L3 Support | http://lkml.org/lkml/2017/4/20/343 | CC-MAIN-2017-51 | refinedweb | 321 | 59.09 |
Hello, i'd like to make a program which reads input until end of file on standard input and when i press ctrl-d (or i'm not sure how to end it) it writes out the lines which contain a string.
so if i start with :
./a.out cond
First line
Second line
Third line
it should write out:
Second line
and if i just do ./a.out it should write out all lines.
What i could do so far:
#include <iostream> #include <string> using namespace std; int main() { string str; char Char; while (!cin.eof()) { cin.get(Char); str += Char; } cout << str; return 0; } | https://www.daniweb.com/programming/software-development/threads/352990/finding-string | CC-MAIN-2017-34 | refinedweb | 106 | 88.77 |
The Microsoft Dynamics CRM Team Blog
News and views from the Microsoft Dynamics CRM Team
You may have noticed that the Microsoft Dynamics CRM 4.0 SDK contains Web services, assemblies and helper code that have LOTS of the same classes. Which should you use, when and why? It depends on what you are creating:
A plug-in is an assembly that it registered to run before or after CRM does it’s processing for an action.
Use:
Use the SDK assembly because contains the IPlguin and IPluginExecutionContext. It also contains the helper classes you can use for building queries, instantiating types and enumerations you can use to make your code more readable and maintainable.
Use the SDK type proxy assembly because it contains the messages (request and response classes). This assembly also includes all the entity classes but do not use them! In other words, do not use the account or contact classes; instead use the DynamicEntity class, which provides a property bag to access the attributes of an entity instance (record). This is better for you anyway, since the entity classes included in this DLL will not contain any of your customizations. The entity classes are deprecated and will be removed from this assembly in a future version.
Custom workflow activities are assemblies that can be called from a workflow.
Use the SDK assembly because it contains the Workflow namespace which includes all the classes you need to create custom workflow activities.
You can use the messages (request and response classes) contained in the SDK type proxy in your custom workflow activities. The same warning against using the entity classes applies here.
If you are adding new functionality to the CRM Web application or to the Outlook client, you should use the Web services. This includes adding custom ASPX pages or adding ISV menu items that calls your custom code. Remember that if you customize your entities, you need to recompile any code that uses those customized entity classes.
Use:
There is another Web service covered in the CRM Deployment SDK but this is not used in this sort of custom code.
If you are adding functionally to the CRM Outlook client, use the Outlook SDK assembly because it contains methods to detect whether the client is online or offline, to make the client go online or offline or to synchronize the data after going online.
You can also use the helper classes by adding the C# files from CrmHelpers. These classes can be used for easier type instantiation, for building queries and contains enumerations you can use to write more readable and maintainable code.
You can also get the identical helper classes by adding the Microsoft.Crm.Sdk.dll assembly. Adding this DLL requires a bit more care because the SDK assembly contains the classes for the metadata Web service so this may be confusing if you are also using the MetadataService.
Do not include Microsoft.Crm.SdkTypeProxy.dll to these types of projects. The Web services contain the entity classes and the message classes so this assembly is not needed.
Read about these topics in the SDK:
Amy Langlois
PingBack from
Can I use CrmService (custom entities and customized entities) in Plugins? Plugins can be parts of ISV solution code too! In other words, I don't understand, why I should use dynamic entity only in Plugins.
Okay, so I'll give you a baker's dozen of some really good stuff from the perspective of a Microsoft | http://blogs.msdn.com/b/crm/archive/2008/06/23/web-services-dlls-or-what-s-up-with-all-the-duplicate-classes.aspx | CC-MAIN-2015-48 | refinedweb | 582 | 61.26 |
STAT 19000: Project 6 — Spring 2022
Motivation: We will pause in our series of pandas and numpy projects to learn one of the most important parts of writing programs — functions! Functions allow us to reuse snippets of code effectively. Functions are a great way to reduce the repetition of code and also keep the code organized and readable.
Context: We are focusing on learning about writing functions in Python.
Scope: python, functions, pandas, matplotlib
Dataset(s)
The following questions will use the following dataset(s):
/depot/datamine/data/whin/190/combined.csv
/depot/datamine/data/flights/subset/*.csv
Questions
Question 1
In project 5, you read in two separate, but related datasets, and used the
pandas
merge method to combine them. In this project, we’ve provided you with a combined dataset already, called
combined.csv.
Read in
combined.csv into a data frame called
dat.
Your friend shared the following code with you.
import plotly.express as px def plot_stations(df, *ids): df = df.groupby("station_id").head(1).loc[df['station_id'].isin(ids), ('station_id', 'latitude', 'longitude')] fig = px.scatter_geo(df, lat="latitude", lon="longitude", scope="usa", hover_name="station_id") fig.update_layout(geo = dict(projection_scale=7, center=dict(lat=df['latitude'].iloc[0], lon=df['longitude'].iloc[0]))) fig.show(renderer="jpg")
Please do the following:
Give a 1-2 sentence explanation of what this function does.
Use the function to plot 2 or more stations, BUT, use the function in two different ways (with the same result). Use tuple unpacking in 1 call of the
plot_stationsfunction, and do not in the other.
Code used to solve this problem.
Output from running the code.
Question 2
In project 5, question 5, you wrote a function called
plot_stations that given a data frame, would plot the locations of the stations on the map.
Modify your
plot_stations function so that it has an argument called
weighted that defaults to
False. If
weighted is
True, then the stations will be plotted with a size proportional to the number observations at each station.
plot_stations(df) # plots all stations same size plot_stations(df, weighted=False) # plots all stations same size plot_stations(df, weighted=True) # plots all stations with size proportional to the number of observations for the station
Code used to solve this problem.
Output from running the code.
Question 3
There are many columns in our data frame with numeric data. Some examples are:
temperature_high,
temperature_low,
barometric_pressure,
wind_speed_high, etc. Wouldn’t it be (kind of) cool to have an option in our
plot_stations function that would weight the size of the points on the map based on those values instead of the number of observations?
Modify the function so that it has another argument called
weight_by that defaults to
None. If
weight_by is
None (and
weighted is
True), the points on the plot should be sized by number of observations (like in question 2). Otherwise,
weight_by can accept a string with the name of the column to base the point sizes on. For example:
plot_stations(dat, weighted=True, weight_by="temperature_high" would create a plot where the size of the points are based on the median value of
temperature_high by station.
Of course, not all of the columns in our dataset are appropriate to weight by. Please demonstrate your function works by running the following calls to
plot_stations.
plot_stations(dat, weighted=True, weight_by="temperature_high") plot_stations(dat, weighted=True, weight_by="temperature_low") plot_stations(dat, weighted=True, weight_by="wind_speed_high") plot_stations(dat, weighted=False, weight_by="barometric_pressure") plot_stations(dat, weighted=True, weight_by=None)
Code used to solve this problem.
Output from running the code.
Question 4
You’ve learned a lot about plotting maps in plotly, the
groupby method (most likely), and hopefully functions as well!
/depot/datamine/data/flights/subset directory. Write a function that creates any new plot using some or all of the data in the
subset directory. The plots could be maps, other plots, anything you want! The goal should be to make the function useful for exploring flight data in the provided format. Take advantage of the tuple packing and unpacking, default arguments, etc. You could even have a function inside another function (a helper function). Do you best to challenge yourself and have fun. Any solid effort will receive full credit.
Code used to solve this problem.
Output from running the code.
Question 5 (optional, 0 pts)
Write a function that accepts the WHIN weather dataset (as a data frame), and an argument n. This function should plot the largest n distances between stations on a map. See here for examples of plotting lines on a map.
If you are feeling very adventurous, there is a data structure called a kdtree that you can use to very efficiently find the n closest or furthest points, however, this is probably not necessary as there are not that many distances to calculate for this dataset.
Code used to solve this problem.
Output from running the code. | https://the-examples-book.com/projects/current-projects/19000-s2022-project06 | CC-MAIN-2022-33 | refinedweb | 819 | 56.76 |
.
Code
Well, the main target was to get started with Python, the best way for doing so (once you know atleast another language) is to struggle through. Here is the github link for the source:
Read the comments at the beginning of the file to get the parameters.
Commandline arguments --id <apikey> : Specifies the API Key --blog <blogurl> : Specifies the blog URL --noplot : If this switch is present, on-screen plots will not be shown --noget : If this switch is present, the files will not be downloaded from web API, and local copy will be used. The local copy should be in the same directory as the script.
Note that the --id and --blog is mandatory. Others take default values. The script plots on the screen by default and stores the plots as pdfs, and fetches the stats every time the script is run. An example run is as follows.
./wp_stats_demo.py --id abcdef012345 --blog
Also, make sure to run the script in Python3.
The main logic to fetch the blog information is in the initialize function. If you invoke the script without the --noget (default), then for each type of stat type of the API, wp_stats_fetch is called. The wp_stats_fetch function makes a URL according to the wordpress.com API’s manual by using the make_wp_url function, which it then uses to fetch the specific stat. The format can be csv, json and xml which is also configurable through the wp_api_args parameter. The wp_stats_fetch is the main function which should interest you.
I posting the current state of only the portion of the code below, which fetches the information using the wordpress.com API.
def wp_stats_fetch (wp_api_args, file_save): wp_url = None; try: wp_url = make_wp_url (wp_api_args["api_key"], wp_api_args["blog_id_uri"], wp_api_args["table"], wp_api_args["post_id"], wp_api_args["end"], wp_api_args["days"], wp_api_args["period"], wp_api_args["limit"], wp_api_args["summarize"], wp_api_args["form"] ); response = urllib.request.urlopen (wp_url); file_ext = None; if wp_api_args["form"]: file_ext = "." + wp_api_args["form"]; else: file_ext = ".csv"; text = response.read().decode("utf-8"); m = re.search ("Error:", text); if m: raise WPStatsFetchError ("Incorrect url arguments, Error returned"); return (-1); fp = open (file_save + file_ext, "w"); fp.write (text); fp.close (); except ArgError as e: print (e); return (wp_url); except Exception as e: print (e); return (wp_url); return 0; def initialize (my_api, my_blog, fetch_data = False): if (my_api is None) or (my_blog is None): raise ArgError ("An API key and a blog URL is mandatory"); return (-1); table_list = ["views", "postviews", "referrers", "searchterms", "clicks"]; post_id = None; end = None; days = -1; period = None; limit = -1; summarize = None; form = "csv"; req_url = None; fileprefix = "stats_"; if fetch_data is True: print ("\tDownloading data from web API. Overwriting local (if any)"); try: wp_api_args = { "api_key" : my_api, "blog_id_uri" : my_blog, "table" : None, "post_id" : post_id, "end" : end, "days" : days, "period" : period, "limit" : limit, "summarize" : summarize, "form" : form }; feedback_str = ""; for table in table_list: feedback_str = "Fetching " + table + " stats"; wp_api_args["table"] = table; sys.stdout.write (feedback_str), sys.stdout.flush (); retval = wp_stats_fetch (wp_api_args, fileprefix + table); if retval == 0: #feedback_str += " [SUCCESS]"; print (" [SUCCESS]"); else: #feedback_str += " [FAILED]"; print (" [FAILED]"); sys.stdout.flush (); #print (feedback_str); except Exception as e: print ("Exception: " + str (e)); else: print ("\tNot fetching data from web API. Using local"); return (True);
The API key
Replace the API key with your API key and the blog URL with your blog URL. Previously you could get API key from the Settings -> General, but now to get your API key, visit. Sign into, and select the Akismet basic subscription, which costs 0$, which is free. This should show you the API key. Or if you already have it subscribed, you can visit to get the API key in your mailbox.
Some plots
These are just a few different ways to view the stats, most of the plots have no real meaning, but this code can be extended to get the results one wants.
So what now?
Nothing much actually. As these APIs do not expose country information and some other information you cannot plot the maps. Although for busy blogs the postwise stats, search terms, clicks and referrers stats can get some good insight.
Chances are I am not going to work on the script anymore, but if anyone is working or has worked on the wordpress.com stats API, I would be interested to check it out.
This piece of code was extended and enhanced to make a dashboard in a web interface using Django, during the Hackathon organized at The Insight Centre for Data Analytics on August 2016. We made a team and enhanced this in 36 hours non-stop marathon. The team members were Siobhán Grayson and Gevorg Poghosyan, both researchers at The Insight Centre for Data Analytics, and ofcourse myself. We were able to do a pretty good work and had a lot of fun during that period.
UPDATE
- 01.01.2017: Added relevant portion of the code in the post. Added a little description for the relevant part of the code.
- 16.01.2017: Added enhancement information.
11 thoughts on “Using WordPress.com stats API”
Hi, it’s me again, i’ve looked through the post but not what i really want, there still no code for visitor
Do you mean the visitor count or by country or other details per visitor? WordPress.com Stats API does not have any more details about the visitor information except the count actually. The country information you see the the dashboard is not accessible by this API, as far as I know.
Just overall country is fine..but where can I get that?
I think there is no way you can get country specific information from this API.
Oh noi mos type it.. i mean over all visitor per day is fine.sorry
You can do that by pulling daily visors, as I have demonstrated in the other post.
I’ve tried it..but it’s only show views per day, could you advise which step did i miss?
What you exactly mean by “overall visitors per day” is it just the count? Or also details like geographic locations?
You can find per day post visits by doing some computation though.
In wordpress stat there are views and visitor information, i can get views count by the method you provided but the visitor count, i cant find a way to get that information.
Oh okay, like unique visitors which might generate more than one views per visitor. I think you still cannot get it through the API.
Oh..okay, thank you for your help | https://phoxis.org/2016/12/30/using-wordpress-com-stats-api/?shared=email&msg=fail&replytocom=23680 | CC-MAIN-2020-10 | refinedweb | 1,070 | 72.66 |
This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Hi Guys, I am applying the patch below to add a definition of ATTRIBUTE_PACKED to ansidecl.h along the lines of the other attributes defined in this file. This definition is now needed by the binutils sources. Does anyone know when the packed attribute was actually introduced into gcc ? I have not put a version number check into the patch because as far as I could tell it came in when support for __attribute__ was added. Cheers Nick include/ChangeLog 2006-12-06 Nick Clifton <nickc@redhat.com> * ansidecl.h (ATTRIBUTE_PACKED): Define. Index: include/ansidecl.h =================================================================== --- include/ansidecl.h (revision 119579) +++ include/ansidecl.h (working copy) @@ -361,6 +361,12 @@ So instead we use the macro below and te # endif /* GNUC >= 3.0 */ #endif /* ATTRIBUTE_ALIGNED_ALIGNOF */ +/* Useful for structures whoes layout must much some binary specification + regardless of the alignment and padding qualities of the compiler. */ +#ifndef ATTRIBUTE_PACKED +# define ATTRIBUTE_PACKED __attribute__ ((packed)) +#endif + /* We use __extension__ in some places to suppress -pedantic warnings about GCC extensions. This feature didn't work properly before gcc 2.8. */ | http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00414.html | CC-MAIN-2015-06 | refinedweb | 193 | 59.09 |
Opened 4 years ago
Closed 4 years ago
Last modified 4 years ago
#23063 closed Bug (fixed)
send email 1.6.5 OK, 1.7c1 malformed packet in wireshark
Description
Hello,
I'm working on a 1.7c1 application with Django, and my emails are not sent.
My settings are:
I tested my account with telnet, and smtplib, and everything goes smooth.
The code I run:
mail.send_mail('susu', 'body body', from_email, [to_email])
Under 1.6.5, the email is sent. Under wireshark, the data package is good.
Under 1.7c1, the email is not sent. I open my wireshark, and look at the data packet. It shows that the packet is malformed.
If I dump via filebased backend, there's no difference except the timestamp and message-id between the two versions.
I copy you my packet dump from wireshark:
Attachments (4)
Change History (50)
Changed 4 years ago by
Changed 4 years ago by
Dump of package malformed sniffing from Django 1.7 c1
comment:1 Changed 4 years ago by
comment:2 Changed 4 years ago by
Could you bisect to determine the commit that introduced the regression?
comment:3 Changed 4 years ago by
I upgraded my packages via pip and aptitude, and I always have malformed packet on every version of django if the body message = "test body".
If I add some \n in the message, for example: msg = "test message body \n\n " , I dont have anymore the malformed packet, but the SMTP refuse my message.
I'm gonna check again on my other computer if I still can send email with django, and then bisect.
comment:4 Changed 4 years ago by
I had a quick look at the dumps.
Any chance you could provide us with the TCP conversation only, without the lower layers included?
I doubt the problem is caused by something lower than TCP. Even though unlikely, if that's the case, the problem might not be related to Django at all.
Also, the files the file backend generated might be useful as well.
Changed 4 years ago by
Changed 4 years ago by
Dump pcapng malformed packet smtp
comment:5 Changed 4 years ago by
I just attached a dump pcapng and the dump email in file type from the file backend.
I tried to change of version of django to the 1.6.5 but still bugging on my setup.
Python 3.2 or 3.4. smtplib builtin python I assume.
comment:6 Changed 4 years ago by
I just changed of smtp server, going to google and not OVH, and the malformed packet is not here anymore.
It works like a charm.
Thanks anyway
comment:7 Changed 4 years ago by
Hello,
First it is the first time I use this tool, so I'm really sorry if I don't use it properly.
Secondly, English is not my natural language, so sorry for the errors.
I reopen this thread because I have exactly the same problem.
OVH is a professional provider massively used is europe and I can't use an other one as google to send my emails.
So changing for gmail is not a well solution that correct the problem.
I have not tested with the 1.6.5 version of django, but I can compare a mail sended with python and the other one sended with django.
There is a problem with django.
I send you here the content of the well formed (sended with python) and the not well formed IMF packet
Well formed :
0000 f4 ca e5 4a a8 1f 9c 4e 36 b6 4f 24 08 00 45 00 ...J...N6.O$..E. 0010 00 fb 4a 28 40 00 80 06 f7 49 c0 a8 01 14 d5 ba ..J(@....I...... 0020 21 14 e9 1b 02 4b 7e 07 0a 74 7e 22 d6 7d 50 18 !....K~..t~".}P. 0030 f9 d1 33 ea 00 00 43 6f 6e 74 65 6e 74 2d 54 79 ..3...Content-Ty 0040 70 65 3a 20 74 65 78 74 2f 70 6c 61 69 6e 3b 20 pe: text/plain; 0050 63 68 61 72 73 65 74 3d 22 75 73 2d 61 73 63 69 charset="us-asci 0060 69 22 0d 0a 4d 49 4d 45 2d 56 65 72 73 69 6f 6e i"..MIME-Version 0070 3a 20 31 2e 30 0d 0a 43 6f 6e 74 65 6e 74 2d 54 : 1.0..Content-T 0080 72 61 6e 73 66 65 72 2d 45 6e 63 6f 64 69 6e 67 ransfer-Encoding 0090 3a 20 37 62 69 74 0d 0a 53 75 62 6a 65 63 74 3a : 7bit..Subject: 00a0 20 48 65 6c 6c 6f 0d 0a 46 72 6f 6d 3a 20 77 65 Hello..From: we 00b0 62 6d 61 73 74 65 72 40 xx xx xx xx xx xx xx xx bmaster@xxxxxxxx 00c0 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xxxxxxxxxxxxxxxx 00d0 xx xx xx xx 0d 0a 54 6f 3a 20 xx xx xx xx xx xx xxxx..To: xxxxxx 00e0 xx xx xx xx xx xx xx xx 40 67 6d 61 69 6c 2e 63 xxxxxxxx@gmail.c 00f0 6f 6d 0d 0a 0d 0a 42 6f 64 79 20 67 6f 65 73 20 om....Body goes 0100 68 65 72 65 0d 0a 2e 0d 0a here.....
TEXT ONLY :
JN6O$EJ(@I!K~ t~"}P3Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Hello From: webmaster@xxxxxxxxxxxxxxxxxxxxxxxxxxxx To: xxxxxxxxxxxxxx@gmail.com Body goes here .
Malformed :
0000 f4 ca e5 4a a8 1f 9c 4e 36 b6 4f 24 08 00 45 00 ...J...N6.O$..E. 0010 01 46 49 e9 40 00 80 06 f7 3d c0 a8 01 14 d5 ba .FI.@....=...... 0020 21 14 e9 14 02 4b 58 c0 97 78 2e c3 40 84 50 18 !....KX..x..@.P. 0030 f9 d1 4a a3 00 00 4d 49 4d 45 2d 56 65 72 73 69 ..J...MIME-Versi 0040 6f 6e 3a 20 31 2e 30 0a 43 6f 6e 74 65 6e 74 2d on: 1.0.Content- 0050 54 79 70 65 3a 20 74 65 78 74 2f 70 6c 61 69 6e Type: text/plain 0060 3b 20 63 68 61 72 73 65 74 3d 22 75 74 66 2d 38 ; charset="utf-8 0070 22 0a 43 6f 6e 74 65 6e 74 2d 54 72 61 6e 73 66 ".Content-Transf 0080 65 72 2d 45 6e 63 6f 64 69 6e 67 3a 20 37 62 69 er-Encoding: 7bi 0090 74 0a 53 75 62 6a 65 63 74 3a 20 48 65 6c 6c 6f t.Subject: Hello 00a0 0a 46 72 6f 6d 3a 20 77 65 62 6d 61 73 74 65 72 .From: webmaster 00b0 40 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx @xxxxxxxxxxxxxxx 00c0 xx xx xx xx xx xx xx xx xx xx xx xx xx 0a 54 6f xxxxxxxxxxxxx.To 00d0 3a 20 xx xx xx xx xx xx xx xx xx xx xx xx xx xx : xxxxxxxxxxxxxx 00e0 40 67 6d 61 69 6c 2e 63 6f 6d 0a 44 61 74 65 3a @gmail.com.Date: 00f0 20 57 65 64 2c 20 30 38 20 4f 63 74 20 32 30 31 Wed, 08 Oct 201 0100 34 20 31 36 3a 33 30 3a 32 30 20 2d 30 30 30 30 4 16:30:20 -0000 0110 0a 4d 65 73 73 61 67 65 2d 49 44 3a 20 3c 32 30 .Message-ID: <20 0120 31 34 31 30 30 38 31 36 33 30 32 30 2e 38 34 32 141008163020.842 0130 34 2e 31 38 35 36 35 40 4a 41 58 32 33 30 3e 0a 4.18565@JAX230>. 0140 0a 42 6f 64 79 20 67 6f 65 73 20 68 65 72 65 0d .Body goes here. 0150 0a 2e 0d 0a ....
TEXT ONLY :
JN6O$EFI@=!KXx.@PJMIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: Hello From: webmaster@xxxxxxxxxxxxxxxxxxxxxxxxxxxx To: xxxxxxxxxxxxxx@gmail.com Date: Wed, 08 Oct 2014 16:30:20 -0000 Message-ID: <20141008163020.8424.18565@JAX230> Body goes here .
Thanks !!
comment:8 Changed 4 years ago by
Could you bisect to determine the commit that introduced the issue?
comment:9 Changed 4 years ago by
Ok, can you tell me how?
I tried this :
pip uninstall django
pip install django=1.6.5
but I get an error in the brother when I load a http page...
do you have a list of other version I can try whith this method?
comment:10 Changed 4 years ago by
It's look like there is a probleme with the end of line :
well formed : endline = 0D0A
malformed : endline = 0A only
...
comment:11 Changed 4 years ago by
I tryed pip install django==1.6.7 but I have an error.
python manage.py runserver is ok
but on my brother, I get : "A server error occurred. Please contact the administrator."
comment:12 Changed 4 years ago by
Trying 1.6.7, I get this in the console :
Quit the server with CTRL-BREAK. Traceback (most recent call last): File "C:\JA\dev\bin\Python34-win32\lib\site-packages\django\utils\module_loadi ng.py", line 28, in import_by_path attr = getattr(module, class_name) AttributeError: 'module' object has no attribute 'SessionAuthenticationMiddlewar e' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\JA\dev\bin\Python34-win32\lib\wsgiref\handlers.py", line 137, in run self.result = application(self.environ, self.start_response) File "C:\JA\dev\bin\Python34-win32\lib\site-packages\django\contrib\staticfile s\handlers.py", line 67, in __call__ return self.application(environ, start_response) File "C:\JA\dev\bin\Python34-win32\lib\site-packages\django\core\handlers\wsgi .py", line 187, in __call__ self.load_middleware() File "C:\JA\dev\bin\Python34-win32\lib\site-packages\django\core\handlers\base .py", line 45, in load_middleware mw_class = import_by_path(middleware_path) File "C:\JA\dev\bin\Python34-win32\lib\site-packages\django\utils\module_loadi ng.py", line 31, in import_by_path error_prefix, module_path, class_name)) django.core.exceptions.ImproperlyConfigured: Module "django.contrib.auth.middlew are" does not define a "SessionAuthenticationMiddleware" attribute/class [09/Oct/2014 00:14:26] "POST /signup/ HTTP/1.1" 500 59
comment:13 Changed 4 years ago by
SessionAuthenticationMiddleware is new in Django 1.7. You will need to remove it from your settings file when testing on Django 1.6.
To bisect, first install the development version of Django, then follow a tutorial on using git bisect.
comment:14 Changed 4 years ago by
ok
I have the same problem with 1.6.7, 1.6.5, 1.6 and 1.5...
An idea why the endline is 0A with django and 0D0A with python?
comment:15 Changed 4 years ago by
Editing django\core\mail\backends\smtp.py line 115 :
message.as_bytes() -> message.as_string()
solved the problem.
Now the message seems to respect the "IMF" (internet message format) standards. Wireshark doesn't tag the packet as Malformed and the provider ovh accepts the message and the message is well sended.
In the doc of python, as_string() is used as well..
(see )
Is there a reason why using as_bytes() here?
comment:16 Changed 4 years ago by
The last commit for that code is [5dfd824d].
comment:17 Changed 4 years ago by
Yes, I found the same :
So, what do you think? which one is good?
It is sure that here on my local machine, this version using as_bytes() introduces a bug and as_string() corrects it..
comment:18 Changed 4 years ago by
Not sure, but looking at that commit it seems like there's some backwards compatibility concerns to switching from bytes to string. I'll add Florian to CC.
comment:19 Changed 4 years ago by
message.as_string is broken beyond repair, so we can't use that. Interestingly in my tests both variants produce LF instead of CRLF, so I have yet to figure out where the CRLF is coming from. That said if Google accepts the mail it can't be that bad, so OVH should get their stuff together :þ
comment:20 Changed 4 years ago by
comment:21 Changed 4 years ago by
Does this fix it:
diff --git a/django/core/mail/message.py b/django/core/mail/message.py index da9891f..961d1a8 100644 --- a/django/core/mail/message.py +++ b/django/core/mail/message.py @@ -149,7 +149,7 @@ class MIMEMixin(): """ fp = six.BytesIO() g = generator.BytesGenerator(fp, mangle_from_=False) - g.flatten(self, unixfrom=unixfrom) + g.flatten(self, unixfrom=unixfrom, linesep='\r\n') return fp.getvalue()
comment:22 Changed 4 years ago by
What I don't understand is why this is only an issue with Python3, this should be a problem on every Python version -- or did I missread that report somehow.
comment:23 Changed 4 years ago by
@augustin:
The easiest way is to inject it when we instanciate the Generator. But I'm wondering if it wouldn't be safer to set it on the message, to avoid the same kind of bugs in other code paths.
Yes, but policy objects are relatively new (as is the linesep argument), so this would only work on python 3.3 onwards. So essentially we'd have to fix it in both instances.
comment:24 Changed 4 years ago by
Oh, I found something else: -- so for a sendmail backend we should probably use LF instead of CRLF? If that is indeed the case, this might get a bit ugly.
comment:25 Changed 4 years ago by
@apollo13 > I can't make the test for the moment (probably in about 10 hours)
Everybody :
It's look like IMF packet require CRLF and only US-ASCII in the header and in the body.
I found an clear explaination of IMF format here :
and the full documentation is here :
I don't really understand what you have to do if you want send utf8 chars in the body, but anyway, it is not the real issue here.. (the issue is about CRLF not sended)
comment:26 Changed 4 years ago by
@appollo13 : can you tell more about this assertion ? :
message.as_string is broken beyond repair
comment:27 Changed 4 years ago by
as_string implies text/unicode on python 3. There is no way to know how this should get encoded for wire transfers (especially if you have multipart mime messages). This is also the reason why it broke on python 3 in the first place cause it produced quoted printable mails.
comment:28 Changed 4 years ago by
about the "fix" I have to try (comment:21) adding linesep='\r\n' to flatten
The doc of flatten says :
Optional linesep specifies the line separator character used to terminate lines in the output. If specified it overrides the value specified by the Generatoror msg‘s policy.
In the doc of email.message, I see the reference to the policy, and in the doc of policy, I can read there is a specific (and new?) policy for SMTP email.policy.SMTP including linesep set to \r\n
Using Python without Django, the msg looks well formated (so with the good policy, or with a good policy hook?), but not with django. I can't really figure out why..
comment:29 Changed 4 years ago by
Using Python without Django, the msg looks well formated (so with the good policy, or with a good policy hook?), but not with django. I can't really figure out why..
Can you provide the exact python code you are using? Cause by default the compat policy is used which certainly produces newlines and not CRLF.
comment:30 Changed 4 years ago by
comment:31 Changed 4 years ago by
Sure, here is the code :
import smtplib from email.mime.text import MIMEText msg = MIMEText('Body goes here') msg['Subject'] = 'Hello' msg['From'] = 'webmaster@xxxxxxxxxxxxxxxxxxxxxxxxxxxx' msg['To'] = 'xxxxxxxxxxxxxx@gmail.com' s = smtplib.SMTP('SSL0.OVH.NET', 587, timeout = 4000) s.login('webmaster@xxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'xxxxxxxx') s.sendmail('webmaster@xxxxxxxxxxxxxxxxxxxxxxxxxxxx', ['xxxxxxxxxxxxxx@gmail.com'], msg.as_string()) s.quit()
It seems, I could not use as_string() nor as_byte() as shown in this official exemple :
import smtplib from email.mime.text import MIMEText fp = open(textfile, 'rb') msg = MIMEText(fp.read()) fp.close() msg['Subject'] = 'The contents of %s' % textfile msg['From'] = me msg['To'] = you s = smtplib.SMTP('localhost') s.send_message(msg) s.quit()
-> Anyway the SMTP.sendmail part of the doc seems to be the most important to explain our issue :
SMTP.sendmail(from_addr, to_addrs, msg, ...) The required arguments are ..., and a message string. msg may be a string containing characters in the ASCII range, or a byte string. A string is encoded to bytes using the ascii codec, and lone \r and \n characters are converted to \r\n characters. A byte string is not modified.
-> A byte string is not modified.
That seems to expain why it works with python and not with the Django code.
So it seems to be not because of the policy but because of the "byte string" transmitted to the sendmail function.
comment:32 Changed 4 years ago by
Good catch, I found the relevant snippets in the python 2.7 codebase too, so all we need is to fix bytes on Python3.x for SMTP. Reading the php bug I linked, I think the best solution is to fix this just for the SMTP backend.
comment:33 Changed 4 years ago by
New patch:
diff --git a/django/core/mail/backends/smtp.py b/django/core/mail/backends/smtp.py index 4c41eb8..620168e 100644 --- a/django/core/mail/backends/smtp.py +++ b/django/core/mail/backends/smtp.py @@ -120,7 +120,7 @@ class EmailBackend(BaseEmailBackend): for addr in email_message.recipients()] message = email_message.message() try: - self.connection.sendmail(from_email, recipients, message.as_bytes()) + self.connection.sendmail(from_email, recipients, message.as_bytes(linesep='\r\n')) except smtplib.SMTPException: if not self.fail_silently: raise diff --git a/django/core/mail/message.py b/django/core/mail/message.py index da9891f..63b0014 100644 --- a/django/core/mail/message.py +++ b/django/core/mail/message.py @@ -123,7 +123,7 @@ def sanitize_address(addr, encoding): class MIMEMixin(): - def as_string(self, unixfrom=False): + def as_string(self, unixfrom=False, linesep='\n'): """Return the entire formatted message as a string. Optional `unixfrom' when True, means include the Unix From_ envelope header. @@ -133,13 +133,16 @@ class MIMEMixin(): """ fp = six.StringIO() g = generator.Generator(fp, mangle_from_=False) - g.flatten(self, unixfrom=unixfrom) + if six.PY2: + g.flatten(self, unixfrom=unixfrom) + else: + g.flatten(self, unixfrom=unixfrom, linesep=linesep) return fp.getvalue() if six.PY2: as_bytes = as_string else: - def as_bytes(self, unixfrom=False): + def as_bytes(self, unixfrom=False, linesep='\n'): """Return the entire formatted message as bytes. Optional `unixfrom' when True, means include the Unix From_ envelope header. @@ -149,7 +152,7 @@ class MIMEMixin(): """ fp = six.BytesIO() g = generator.BytesGenerator(fp, mangle_from_=False) - g.flatten(self, unixfrom=unixfrom) + g.flatten(self, unixfrom=unixfrom, linesep=linesep) return fp.getvalue()
This is the most backwardscompatible approach I could come up with.
comment:34 Changed 4 years ago by
Attached a PR -- let's see what jenkins says.
comment:35 Changed 4 years ago by
Is Jenkins the bot?
comment:36 Changed 4 years ago by
Do you think it is necessary to add a test and test that the packet is well formed?
I can then try to send a message with a \n in the body.
Normaly this is not a well formed packet.
comment:37 Changed 4 years ago by
Thanks for the patch @apollo13, it seems OK to me.
@ainslied: Jenkins is the CI (continuous integration tests platform)
comment:38 Changed 4 years ago by
Thank you for the patch.
I'll try in few hours
comment:39 Changed 4 years ago by
Ok, well done, it works fine.. !
sending "Body \n goes here" works well too.. :
both python and django send "0d 0a" for this "\n" in the body
I tried also this : "äâùèBody \n goes here"
and it works well.
Thank you !!!
comment:40 Changed 4 years ago by
comment:41 Changed 4 years ago by
In answer to your question earlier, I bet a test would be much appreciated.
comment:42 Changed 4 years ago by
Hi collinanderson.
You mean a method in a test.py ?
I just begin in python and django but it is something I can think about for a bit later yes (when I ll be a little more experimented)..
comment:43 Changed 4 years ago by
I updated the PR with a test, but it is a bit ugly -- the whole smtplib module is a bit annoying ;)
Good dump of package sniffing from Django 1.6.5 | https://code.djangoproject.com/ticket/23063 | CC-MAIN-2018-43 | refinedweb | 3,523 | 74.49 |
I know what I need to do but I don't know how to incorporate the writing.
This is what I have so far...
#include<iostream> #include<iomanip> #define MAX_STUDENTS = 20 using namespace std; int getStudentCount() // Ask for and store the number of students from user { cout<<"processing has started in getStudentCount()"<<endl; cout<<"Number of students in class; "<<endl; getStudentCount(); return 0; } I know that I have to use something like this to store the number of students into an array. ex. -- for (index = 0; index < 10; index++) cin >> list[index] = 0.0;
Is this correct.??? Now I think that I'm just overthinking this but could you just clear my head please..
Thank You.. | http://www.dreamincode.net/forums/topic/185884-need-help-to-with-initializing/ | CC-MAIN-2017-30 | refinedweb | 116 | 70.33 |
How to manage language and region (Windows Store apps using JavaScript and HTML)
You can control how Windows selects UI resources, and formats the UI elements of the app. To control these features, use the various language and region settings provided by Windows.
For a sample app that demonstrates how to manage language and region settings, see Application resources and localization sample.
A Windows user doesn't need to choose just one language from a limited set of languages. Instead, the user can tell Windows that they speak any language in the world, even if Windows itself isn't translated into that language. The user can even specify that they can speak multiple languages.
A Windows user can specify their location, which can be anywhere in the world. Also, the user can specify that they speak any language in any location. The location and language do not limit each other. Just because the user speaks French doesn't mean they are located in France, or just because the user is in France doesn't mean they prefer to speak French.
A Windows user can run apps in a completely different language than Windows. For example, the user can run an app in Spanish while Windows is running in English.
For Windows Store apps, a language is represented as a BCP-47 language tag. Most APIs in the Windows Runtime, HTML, and XAML can return or accept string representations of these BCP-47 language tags. See also the IANA list of languages.
To see a list of the language tags specifically supported by the Windows Store, see Choosing your languages.
Instructions
Step 1: Set the user language preferences.
The user language preferences list is an ordered list of languages that describe the user's languages in the order that they prefer them. The user sets the list in Control Panel > Clock, Language, and Region > Language. The user's language preferences list can contain multiple languages and regional or otherwise specific variants. For example, the user might prefer fr-CA, but can also understand en-GB.
Step 2: Specify the supported languages in the app's manifest.
An app developer specifies the list of supported languages in the Resources element of the app's manifest file (typically Package.appxmanifest), or Visual Studio automatically generates the list of languages in the manifest file based on the languages found in the project. The manifest should accurately describe the supported languages at the appropriate level of granularity. The languages listed in the manifest are the languages displayed to users in the Windows Store.
Step 3: Specify the default language.
An app uses the default language when it doesn't support any of the languages that the user has chosen in the Languages control panel. MSBuild and MakePRI.exe use the default language to add metadata to assets marked in that language, enabling the appropriate assets to be chosen at runtime.
To use Visual Studio to set the default language in a Windows Store app using JavaScript project:
- Open package.appxmanifest in Visual Studio, go to the Application UI tab, and set your default language to the language you are using to author your application.
The default language property must also be set as the first language in the manifest to appropriately set the application language (described in the step "Create the application language list", below). Resources in the default language must still be qualified with their language (for example, en-US/logo.png). The default language does not specify the implicit language of unqualified assets. To learn more, see How to name resources using qualifiers.
Step 4: Qualify resources with their language.
Consider your audience carefully and the language and location of users you want to target. Many people who live in a region don't prefer the primary language of that region. For example, there are millions of households in the United States in which the primary language is Spanish.
When you qualify resources with language:
- Include script when there is no suppress script value defined for the language. See the IANA subtag registry for language tag details. For example, use zh-Hant, zh-Hant-TW, or zh-Hans, and not zh-CN or zh-TW.
- Mark all linguistic content with a language. The default language project property is not the language of unmarked resources (that is, neutral language); it specifies which marked language resource should be chosen if no other marked language resource matches the user.
Mark assets with an accurate representation of the content
- Windows does complex matching, including across regional variants (such as en-US to en-GB), so applications are free to mark assets with an accurate representation of the content and let Windows match appropriately for each user.
- The Windows Store displays what's in the manifest to users looking at the application.
- Be aware that some tools and other components such as machine translators may find specific language tags, such as regional dialect info, helpful in understanding the data.
- Be sure to mark assets with full details, especially when multiple variants are available. For example, mark en-GB and en-US if both are specific to that region.
- For languages that have a single standard dialect, there is no need to add region. General tagging is reasonable in some situations, such as marking assets with ja instead of ja-JP.
Sometimes there are situations where not all resources need to be localized.
- For resources such as UI strings that come in all languages, mark them with the appropriate language they are in and make sure to have all of these resources in the default language. There is no need to specify a neutral resource (one not marked with a language).
- For resources that come in a subset of the entire application's set of languages (partial localization), specify the set of the languages the assets do come in and make sure to have all of these resources in the default language. Windows picks the best language possible for the user by looking at all the languages the user speaks in their preference order. For example, not all of an app's UI may be localized into Catalan if the app has a full set of resources in Spanish. For users who speak Catalan and then Spanish, the resources not available in Catalan appear in Spanish.
- For resources that have specific exceptions in some languages and all other languages map to a common resource, the resource that should be used for all languages should be marked with the undetermined language tag 'und'. Windows interprets the 'und' language tag in a manner similar to '*', in that it matches the top application language after any other specific match. For example, if a few resources (such as the width of an element) are different for Finnish, but the rest of the resources are the same for all languages, the Finnish resource should be marked with the Finnish language tag, and the rest should be marked with 'und'.
- For resources that are based on a language's script instead of the language, such as a font or height of text, use the undetermined language tag with a specified script: 'und-<script>'. For example, for Latin fonts use und-Latn\fonts.css and for Cyrillic fonts use und-Cryl\fonts.css.
Step 5: Create the application language list.
At runtime, the system determines the user language preferences that the app declares support for in its manifest, and creates an application language list. It uses this list to determine the language(s) that the application should be in. The list determines the language(s) that is used for app and system resources, dates, times, and numbers, and other components. For example, the Resource Management System (Windows.ApplicationModel.Resources, Windows.ApplicationModel.Resources.Core and WinJS.Resources Namespace) loads UI resources according to the application language. Windows.Globalization also chooses formats based on the application language list. The application language list is available using Windows.Globalization.ApplicationLanguages.languages.
The matching of languages to resources is difficult. We recommend that you let Windows handle the matching because there are many optional components to a language tag that influence priority of match, and these can be encountered in practice.
Examples of optional components in a language tag are:
- Script for suppress script languages. For example, en-Latn-US matches en-US.
- Region. For example, en-US matches en.
- Variants. For example, de-DE-1996 matches de-DE.
- -x and other extensions. For example, en-US-x-Pirate matches en-US.
There are also many components to a language tag that are not of the form xx or xx-yy, and not all match.
- zh-Hant does not match zh-Hans.
Windows prioritizes matching of languages in a standard well-understood way. For example, en-US matches, in priority order, en-US, en, en-GB, and so forth.
- Windows does cross regional matching. For example, en-US matches en-US, then en, and then en-*.
- Windows has additional data for affinity matching within a region, such as the primary region for a language. For example, fr-FR is a better match for fr-BE than is fr-CA.
- Any future improvements in language matching in Windows will be obtained for free when you depend on Windows APIs.
Matching for the first language in a list occurs before matching of the second language in a list, even for other regional variants. For example, a resource for en-GB is chosen over an fr-CA resource if the application language is en-US. Only if there are no resources for a form of en is a resource for fr-CA chosen.
The application language list is set to the user's regional variant, even if it is different than the regional variant that the app provided. For example, if the user speaks en-GB but the app supports en-US, the application language list would include en-GB. This ensures that dates, times, and numbers are formatted more closely to the user's expectations (en-GB), but the UI resources are still loaded (due to language matching) in the app's supported language (en-US).
The application language list is made up of the following items:
- (Optional) Primary Language Override The PrimaryLanguageOverride is a simple override setting for apps that give users their own independent language choice, or apps that have some strong reason to override the default language choices. To learn more, see the Application resources and localization sample.
- The user's languages supported by the app This is a list of the user's language preferences, in order of language preference. It is filtered by the list of supported languages in the app's manifest. Filtering the user's languages by those supported by the app maintains consistency among software development kits (SDKs), class libraries, dependent framework packages, and the app.
- If 1 and 2 are empty, the default or first language supported by the app If the user doesn't speak any languages that the app supports, the chosen application language is the first language supported by the app.
See the Remarks section below for examples.
Step 6: Set the HTTP Accept Language header.
HTTP requests made from Windows Store apps and Desktop apps in typical web requests and XMLHttpRequest (XHR), use the standard HTTP Accept-Language header. By default, the HTTP header is set to the user's language preferences, in the user's preferred order, as specified in Control Panel > Clock, Language, and Region > Language. Each language in the list is further expanded to include neutrals of the language and a weighting (q). For example, a user's language list of fr-FR and en-US results in an HTTP Accept-Language header of fr-FR, fr, en-US, en ("fr-FR,fr;q=0.8,en-US;q=0.5,en;q=0.3").
Step 7: Use the APIs in the Windows.Globalization namespace.
Typically, the API elements in the Windows.Globalization namespace use the application language list to determine the language. If none of the languages has a matching format, the user locale is used. This is the same locale that is used for the system clock. The user locale is available from the Control Panel > Clock, Language, and Region > Region: Change date, time, or number formats. The Windows.Globalization APIs also accept an override to specify a list of languages to use, instead of the application language list.
Windows.Globalization also has a Language object that is provided as a helper object. It lets apps inspect details about the language, such as the script of the language, the display name, and the native name.
Step 8: Use geographic region when appropriate.
Instead of language, you should use the user's home geographic region setting for choosing what content to display to the user. For example, a news app might default to displaying content from a user's home location, which is set when Windows is installed and is available in the Region Control Panel. You can retrieve the current user's home region setting by using Windows.System.UserProfile.GlobalizationPreferences.HomeGeographicRegion.
Windows.Globalization also has a GeographicRegion object that is provided as a helper object. It lets apps inspect details about a particular region, such as its display name, native name, and currencies in use.
Remarks
The following table contains examples of what the user would see in the app's UI under various language and region settings. | http://msdn.microsoft.com/en-us/library/hh967758.aspx | CC-MAIN-2014-10 | refinedweb | 2,244 | 54.32 |
Details
Description
If.
Activity
Created reviewboard
Thanks for patch v7. A couple of more comments.
70. There is a long standing bug in ProducerRequest.handleError(). If ack=0, we shouldn't send a response when the broker hits an unexpected error. We should either close the socket connection or send no response. Not sure which one is better.
71. A minor issue. The following comment in RequestChannel is a bit confusing. It sounds like that it needs to read more data from network to complete this request, but it is not.
/** No operation to take for the request, need to read more over the network */
def noOperation(processor: Int, request: RequestChannel.Request) {
Committed patch v7 to 0.8 after making the logging fix described above
This is great. +1. One improvement on logging -
info(("Send the close connection response due to error handling produce request " +
"[clientId = %s, correlationId = %s, topicAndPartition = %s] with Ack=0")
.format(produceRequest.clientId, produceRequest.correlationId, produceRequest.topicPartitionMessageSizeMap.mkString("[",",","]")))
Here we only want to print the topic and partition, so it seems that we should be printing the keys of the map, not the entire map ?
produceRequest.topicPartitionMessageSizeMap.keySet.mkString(",")
I can make this change on checkin.
Thanks for the comments, Neha, Jay.
Neha:
1. Done.
2. Incorporated with Jay's comments.
Jay:
1. Done.
2. Done. I ended up using trait and objects, and let requestChannel.close and requestChannel.noOperation (I changed the name from noResponse here since it matches the noOpAction better) create new responses themselves.
3. Done.
4. Done.
5. Done.
Regarding your question, the message loss is depending on the producer throughput and queue size. Since the first message will always be silently dropped, and once the producer noticed the socket closure, it will stop producing and refresh new metadata, and if during this time the producer queue is full then it will drop more messages. So the answer would be the range between [1, produce-throughput / time-taken-to-refresh-metadata - queue-size].
Great fix. A few minor comments, mostly stylistic.
RequestChannel.scala:
1. This usage exposes a bit much:
requestChannel.sendResponse(new RequestChannel.Response(request.processor, request, null, RequestChannel.CloseSocket))
I think it might be nicer to have this instead:
requestChannel.close(request.processor, request)
and
requestChannel.noResponse(req.processor, request)
Implementation would be the same, it just would just be a little more clear for the user and the response codes can be private.
Likewise in the response object I should be able to
2. These are a little confusing:
val SendResponse: Short = 0
val NoResponse: Short = 1
val CloseSocket: Short = 9
Why is it 0, 1, and 9?
What is the relationship between these and ErrorMapping? It should be clear from reading.
Is there a reason we can't use a case class
case class ResponseAction
case object SendAction extends ResponseAction
case object NoOpAction extends ResponseAction
case object CloseConnectionAction extends ResponseAction
Then to use it
response.action match{ case SendAction => do send case NoOpAction => read more case CloseConnectionAction => something }
This seems clearer to me and I don't think it is significantly more expensive.
Can we also standardize the usage so that we no longer have the user EITHER give null or NoResponse? It should be one or the other.
3. This logging "Cancelling the request key to notify socket server close the connection due to error handling produce request " is not informative to the user. What does it mean to cancel a key? What broke? What should they do? I also think this should be info unless we want the server admin to take some action (I don't think so, right? This is a normal occurance).
SocketServer.scala
4. The comment "a null response send object" is retained but we are no longer using null to indicate this we are using RequestChannel.NoResponse. I think this comment is actually a little verbose given that we now have a nicely named response action.
ProducerTest.scala:
5. org.scalatest.TestFailedException: Is there a reason you are giving the full path here instead of importing it
Question on testing, what is the message loss rate with acks=0 under moderate load if we do something like a controlled shutdown with other replicas available?
I like the way the responseCode is generalized. Patch v6 looks good, few minor comments before checkin -
1. Remove unused variable allBrokers from KafkaApis
2. This comment needs to be changed according to the new response code logic -
// a null response send object indicates
Maybe we should wait for review from Jay Kreps since he has most context on the socket server.
After talking around with people I now proposed an approach similar to v4 but generalized with a responseCode instead of just a close socket flag. And on SocketServer the processor would act based on the code instead of checking if the responseSend is null or not.
Also change aliveBrokers in KafkaApis from var to val since it is not overwritten in lifetime.
Thanks for the comments Neha.
1.1. Great point. The only concern is that now KafkaApis need to know that requestKey is actually java.nio.channels.SelectionKey. But I think this is fine.
1.2. Done.
Thanks for the patches, Guozhang. I reviewed patch v4 and here are some comments -
KafkaApis and SocketServer
1.1 One way to allow the socket server to close the channel is to just mark the request's key cancelled in the Response object. This way when the socket server is handling the response, it will throw a CancelledKeyException and we close the key in this case. One advantage of this approach is we can avoid introducing the close socket flag, just to handle this case. To make sure the request metrics are always updated, we can move curr.request.updateRequestMetrics to the first statement in the (curr.responseSend == null) block.
1.2 I think the below warn message can be improved -
Sending the close socket signal due to error handling produce request [%s] with Ack=0
Let's include the client id, correlation id and list of topics and partitions that this request had. This is probably more useful than printing the entire produce request as is, since that attempts to print things like ByteBufferMessageSet and is unreadable.
Thanks for the comments Jun.
30. Done.
31. After a second thought I realized that we do not need to sleep since the second message size is large enough to cause the socket buffer to flush immediately, and by then the socket close should have been triggered by the server. This has been verified in the unit test.
Made some minor changes on comments and rebased on 0.8
Magnus, thanks for your comment. What you suggested is interesting and could be a more effective way of communicating between the producer and the broker. It does require that the producer be able to receive requests initiated at the broker. We do plan to make the producer side processing selector based for efficiency reason. However, this will be a post 0.8 item. We could consider your suggestion then. Regarding your concern about dropped messages, my take is the following. If a client chooses not to receive an ack, it probably means that losing a few batch of messages is not that important. If a client does care about data loss, it can choose ack with 1 or -1. The throughout will be less. However, there are other ways to improve the throughput (e.g., using a larger batch size and/or more instances of producers).
Guozhang, patch v3 looks good to me overall. A few more comments:
30. SyncProducerTest.testMessagesizeTooLargeWithAckZero(): You hardcoded the sleep to 500ms. Could you change it to the waitUntil style wait such that the test can finish early if the conditions have been met?
31. KafkaApi.handleProducerRequest(): The logging should probably be at debug level since this doesn't indicate an error at the broker. It's really an error for the client.
Hi Guozhang,
I understand that you might not want to introduce a new message semantic at this point of the 0.8 beta, but it wont get easier after the release.
My proposal is a change of the protocol definition to allow unsolicited metadata response messages to be sent from the broker, this would of course require changes in most clients, but a very small one for those that are not interested in keeping their leader cache up to date.
Consider a producer forwarding >100kmsgs/s for a number of topics to a broker that suddenly drops the connection because one of those topics changed leader, the producer message queue will quickly build up and might start dropping messages (for topics that didnt loose their leader) due to local queue thresholds or very slowly recover if the current rate of messages is close to the maximum thruput.
In my mind closing the socket because one top+par changed leader is a very intrusive way to signal an event for sub-set of the communication, and it should instead be fixed properly with an unsoliticed metadata response message.
The unsolicited metadata response message is useful for other scenarios aswell, new brokers and topics being added, for instance.
My two cents on the topic, thank you.
Hello Magnus,
1. Under Ack=0, the producer does not expect any responses for produce request, and it does not listen to any possible connections from the producer either. So actively sending MetadataResponse would not work: producers are only expecting MetadataResponse when they send MetadataRequest.
2. When we close the socket, producer would be notified and try to refresh their Metadata and retry. Since by default each produce request will be retried multiple times before it is got dropped, the current approach would not cause lost messages.
If the producer is sending messages through the same broker for other topic+partitions that did not have a leader change they will also be affected by the close of the socket, resulting in lost messages.
It would be better if the broker would notify all connected clients of broker changes (leader change, broker add/delete, topic add/delete)
by sending an unsolicited MetadataResponse message (with corrid 0) (or by some other mean).
This would propogate topology changes in a faster and less intrusive way.
Add the testMessageSizeTooLargeWithAckZero to syncProducerTest, which:
1. First send a large message that will cause the MessageSizeTooLarge exception, and hence close the socket. But this message will be silently dropped and lost.
2. Then send another large message, but just to make sure its size exceeds the buffer size so the socket buffer will be flushed immediately; this send should fail since the socket has been closed.
Sorry for the name misleading, I did not shut down the broker but instead send a large message to it to trigger the MessageSizeTooLargeException. The name of the test should be testSendTooLargeMessageWithAckZero.
I will use SyncProducer instead of Producer in this test, and send a normal message to the broker after this message, and expecting it to fail due to socket IO exception.
Thanks for patch v2. Some more comments.
20. testSendWithAckZeroDeadBroker(): I am not sure if the unit test does what you want. First of all, setup() will always start brokers for each test unless you explicitly shut them down. So, in this test, the brokers are not dead. Second, the test doesn't really test that the socket is closed after error. I suggest that we add a new test in SyncProducerTest. We send a request with ack=0 with a large message. After that, we can try to send a new request again and we should hit a socket I/O exception. We may have to wait for some time between the two requests.
Thanks for the comments Jun.
1,2,3. Done.
Thanks for the patch. Some comments:
1. SocketServer: We should call updateRequestMetrics even when we close the socket. Otherwise, total time will be broken for that request.
2. ProducerTest: Let's add a new unit test instead of piggybacking on the existing one. What we can do is to create a sync producer and send a produce request with ack=0 that will introduce an error (e.g., a message larger than max size). After that, we can verified that the underlying socket is closed.
3. KafkaApi: In the debug logging, why not log the whole producer request?
Add one case for ack=0 in testSendWithDeadBroker, passed.
Following the close-socket approach, I propose the following change:
1. Add a closeSocket: Boolean field in Response class.
2. In KafkaApi.handleProducerRequest, if requireAck == 0 check if numPartitionsInError != 0. If yes set closeSocket to true in the returning response.
3. SocketServer.Processor.processNewResponses, if curr.responseSend == null, check if closeSocket == true. If yes, log the closing socket info and close the key.
It seems there are various ways that can cause this to happen. (a) In the above scenario, after the leaders fail over, topicX causes new sockets to be established. Then topicY uses the newly established socket without realizing that the leader for topic Y has changed. (b) When we fetch the metadata for a topic, we fetch the metadata for all partitions. Let's say that we never get to send any data to a particular partition. The socket for this partition is not established since SyncProducer make socket connections lazily on first send. Then the leader for the partition changes. Finally, the producer sends a message to that partition. Now a socket is established to the wrong leader without the producer realizing it.
In general, if we hit any error for produce requests with ack=0, currently the producer won't notice it. For example, if the broker hits a MessageTooLargeException or if the broker hits any other unexpected exceptions. In those cases, forwarding the requests will not help. Also, forwarding requests will complicate the logic in the broker since we have to figure out the broker's host and port, and potentially cache the socket connection to other brokers.
An alternative solution is to simply close the socket connection when we hit any error for produce requests with ack=0. This way, the producer will realize the error on next send.
Here's a related scenario, that I see after a rolling restart of my brokers (using ack=0).
looking back at my logs, I'm wondering if a producer will reuse the same socket to send data to the same broker, for multiple topics (I'm guessing yes). In which case, it looks like I'm seeing this scenario:
1. producer1 is happily sending messages for topicX and topicY to serverA (serverA is the leader for both topics, only 1 partition for each topic for simplicity).
2. serverA is restarted, and in the process, serverB becomes the new leader for both topicX and topicY.
3. producer1 decides to send a new message to topicX to serverA.
3a. this results in an exception ("Connection reset by peer"). producer1's connection to serverA is invalidated.
3b. producer1 makes a new metadata request for topicX, and learns that serverB is now the leader for topicX.
3c. producer1 resends the message to topicX, on serverB.
4. producer1 decides to send a new message to topicY to serverA.
4a. producer1 notes that it's socket to serverA is invalid, so it creates a new connection to serverA.
4b. producer1 successfully sends it's message to serverA (without realizing that serverA is no longer the leader for topicY).
4c. serverA logs to it's console:
2013-06-23 08:28:46,770 WARN [kafka-request-handler-2] server.KafkaApis - [KafkaApi-508818741] Produce request with correlation id 7136261 from client on partition [mytopic,0] failed due to Leader not local for partition [mytopic,0] on broker 508818741
5. producer1 continues to send messages for topicY to serverA, and serverA continues to log the same messages.
6. 10 minutes later, producer1 decides to update it's metadata for topicY, and learns that serverB is now the leader for topidY.
7. the warning messages finally stop in the console for serverA.
I am pretty sure this scenario, or one very close to it, is what I'm seeing in my logs, after doing a rolling restart, with controlled shutdown.
I think this scenario makes the issue more severe than just a problem with controlled restart and ack=0.
Thanks for the followup patch. +1 and committed to 0.8. | https://issues.apache.org/jira/browse/KAFKA-955?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel | CC-MAIN-2014-15 | refinedweb | 2,740 | 64.71 |
HTML 5 Takes Aim At Flash and Silverlight 500
snydeq writes "While Adobe, Microsoft, and Sun duke it out with proprietary technologies for implementing multimedia on the Web, HTML 5 has the potential to eat these vendors' lunches, offering Web experiences based on an industry standard. In fact, one expressed goal of the standard is to move the Web away from proprietary technologies such as Flash, Silverlight, and JavaFX. 'It would be a terrible step backward if humanity's major development platform [the Web] was controlled by a single vendor the way that previous platforms such as Windows have been,' says HTML 5 co-editor Ian Hickson, a Google employee. But whether HTML 5 and its Canvas technology will displace proprietary plug-ins 'really depends on what developers do,' says Firefox technical lead Vlad Vukicevic. It also depends on Microsoft, the only company involved in the HTML 5 effort that is both a browser developer and an RIA tool developer. 'That's a big elephant in the room for them because you can imagine the Silverlight team [whose] whole existence is to add [this] functionality in. [But] if Internet Explorer puts it already in there, why do we have Silverlight?' asks Mozilla's Dion Almaer." The RIA guys are quoted as saying they're not worried, because HTML 5 + CSS 3 is 10 years out. Are they just whistling in the dark?
It's the tools stupid (Score:5, Insightful)
If graphics artist types can't make the kind of pointless crap that they do now with Flash, we won't see uptake of HTML 5.
Re:It's the tools stupid (Score:5, Interesting).
Re:It's the tools stupid (Score:4, Insightful)
If by "people" you mean "javascript programmers", yes, it will.
But Flash is popular because artist types can do it.
Re:It's the tools stupid (Score:5, Interesting)
Re:It's the tools stupid (Score:5, Insightful)
The irony is that the most popular WYSIWYG editors are produced by Adobe and Microsoft.
Re: (Score:2, Interesting)
once this is built into the browsers it could be used to created an editor such as this without the need to reverse engineer or license junk
Re:It's the tools stupid (Score:4, Informative)
but can there editors be used from within the web browser embedded into a site so that it can be modified from any computer the owner is working at?
Sure. Just use Javascript + *Pick/build your favorite CMS app*, and voila. HTML 5, while having more capability, is still HTML.
Re: (Score:3, Funny)
Visual Studio for other uses (C++/C#) is kind of neat though.
You're right - the tools are stupid. (Score:5, Insightful)
And yet those tools produce more crap code than Microsoft had market share for its Windows operating system and Internet Explorer browser in the first few years of this decade.
Seriously - there's a huge problem when someone can create a Web page with a WISIWYG editor that breaks when a new browser, browser version or rendering engine comes out and is generally inaccessible to people with disabilities while leaving search engines guessing which content is the most important; yet I can create the exact same page by hand using nothing more than a plain text editor and a decent graphics program (like Paint Shop Pro or Photoshop Elements) that works just as well in Internet Explorer 5, IE6, IE7, IE8, Firefox 2, Firefox 3, Opera, Safari, Chrome and other browsers without having to update them whenever a new browser, browser version or layout engine is released - without hacks about 90% of the time for any browser. And that's just for GUI capable desktop clients.
While using only 25% of the code the WYSIWYG editor barfs up, making the site accessible to everyone (not just the disabled), search engine friendly, and able to support up to three times as many people due to lower code weights, fewer HTTP requests needed with every page view, and optimized images (CSS sprites anyone?) - and that's just off the top of my head.
If I can learn how to do that, anybody can. And my high school counselors (not to mention my family and their friends) thought I would never amount to anything.
Apples vs. Oranges; but you've got a point (Score:3, Interesting)
Sure,
/if/ your content is the type that can be presented in a text-oriented, page-by-page manner, then creating simple, barebones HTML pages is smart coding.
But every design has its limits. Try pushing at the edges of HTML, and it gets painful, fast. On one project I audited, we were spending 75% of our coding time on browser workarounds. Switching to a RIA was a huge time-saver. At the edges of user interface design, HTML compatibility is thoroughly broken.
However, your instinct that the simplest desi
Re: (Score:3, Insightful)
You haven't said whether they have been proven right or not.
Considering his argument is undoubtedly true -- WYSIWYG editors do produce crap code, and handwritten code is smaller and more compatible -- if he was a failure it would only add more punch to his final point, that if he can everybody can. Consider that the guy whose counsellors, friends and family all thought would amount to nothing is doing it. Accept for a moment it's true. If that guy can write proper HTML, why can't a freaking professional web designer do it?
Of course, life throws curveballs, and it se
Re:It's the tools stupid (Score:4, Interesting)
While I don't agree with how the grandparent phrased it; I'd say it's spot on. Canvas tag or not, the editing tool has to allow artists, hobbiest, etc... to easilly create content and publish to the web for others to see.
Flash's biggest win over Silverlight is:
1) Install base
2) Defacto web animation tool
If enough browser pentration occurs for the install base then the editing tool is the last big hurdle.
My predictions (as a C++, Flash developer):
1. Silverlight takes a larger market share than Flash in 3 years (in 2013)
2. HTML5 overtakes both in 5 years (2015) if a "killer app" for editing comes into existance by 2012.
Re:It's the tools stupid (Score:5, Informative)
You have to be kidding about Silverlight overtaking Flash. Not only has Silverlight failed to take any notable market share to date, many projects that started with Silverlight have switched to Flash (or even Java and JavaScript).
Even Microsoft Popfly itself is so unpopular you can go for months at a time without hearing about it, and I bet you hadn't heard about it for months until just now.
Re:It's the tools stupid (Score:5, Insightful)
Microsoft wins market share, not by innovating, but by making a product, and quickly iterating up-to and past the leader.
Adobe has more baggage to deal with (e.g., [adobe.com] ) which hurts the speed they can push ahead with new features. I've tried Silverlight 1 and 2; both show promise but neither seemed as mature as Flash CS3. Now CS4 is out as-is Silverlight 3. Silverlight 3 compared to 2 offers many times newer features than what Flash CS4 offered over CS3.
For example, I'd love an integrated code editor in Flash with decent editing, syntax highlighting, and intellisense capabilities; I've been waiting for this since MX2004. Silverlight 3 now has a built-in code editor, I wonder how well it stacks up to what Adobe offers.
Overall I'm glad Silverlight exists as it will push Adobe to keep making Flash a better technology, but historically Microsoft has come out on top. It took Microsoft 6 years from IE1.0 to make this happen in the browser marked ( [wikipedia.org] ) With 3D it took Microsoft until 6 years, from DirectX 1.0 to DirectX 8.1, to overtake OpenGL in the AAA PC gaming market.
Unless there is a shake-up in Microsoft I predict it will happen with this RIA tech too.
Re:It's the tools stupid (Score:5, Insightful)
Re:It's the tools stupid (Score:4, Insightful)
Y've never heard of the doc format? Sure it is technically inferior but I'm sure more people use it than pdf. I'm still trying to convince my plebes that if the wish to share information, they should use pdf. They just complain that they don't understand what PDFCreator is.
:s So I repeat myself, yet again.
Re:It's the tools stupid (Score:5, Funny)
What is Popfly?
A guaranteed out?
Re:It's the tools stupid (Score:5, Funny)
Not for the Mets...
Re:400M Silverlight installs (Score:4, Insightful)
Comparing downloads with market share is bogus; for many reasons there have been FAR more Firefox downloads than current daily users. Why don't you tell us the actual market share of Silverlight-enabled browsers?
You lost MLB and NYT after pouring resources into them. I'm less worried about Silverlight than I used to be.
Re:400M Silverlight installs (Score:5, Interesting)
Major League Baseball Advanced Media totally botched the transition not once, but twice. When switching from Flash to Silverlight last year their new Silverlight-based streaming player didn't work, leaving paying customers without service for days. This year they decided to switched back to a Flash-based player ON OPENING DAY. Unfortunately, the new player doesn't work either, and in many ways was worse than the silverlight player, requiring additional installation plugins for HD capabilities, and left these same paying customers without the opening day experience they're paying for two years in a row.
New York Times Reader was a different case. It worked fairly well, but NYT got thoroughly flamed for introducing the reader for windows only, basing it on WPF's FlowDocument capabilities which aren't available for the Mac. Similar text features are eventually going to make it into Silverlight, but things like Printing are a much higher priority for the SL guys. The silverlight version of the reader used a complicated templating system rather than true adaptive text layout. Adobe's Text Layout Framework may not have been the first to market, but that + Flex + AIR are the first to bring it to a wider audience and may ultimately resonate more.
Also I'm sure politics played a prevalent role in both cases, especially in the case of NYT where the Mac User's vitriol for anything microsoft played out.
MLB 2008 [pcworld.com]
MLB 2009 [huffingtonpost.com]
NYT: [itwriting.com]
Re: (Score:3, Interesting)
Why would you have to worry in the first place?
It's perfectly natural to see projects switch technologies periodically. MLB has bounced between technologies for years and they may again based on their experiences this year. [cnet.com]
Most of the big companies who have done Silverlight continue to do it, and we're certainly seeing plenty of media companies switching from Flash to Silverlight, and a bunch more once Silverlight 3 is launched with compatibility with F4V (F
Re:400M Silverlight installs (Score:4, Insightful)
There have been 400M downloads of Silverlight so far.
That's more than the total market share of Firefox + Safari + Chrome (+ Linux + Mac + iPhone + Android if you're thinking platforms). So Silverlight's already a bigger audience than every browser NOT IE running on Windows.
First, downloads != daily usage. Second, {browser,phone,operating system} != plugin. If you want to use such a wide definition of platform, we might as well include Facebook, since it has an app platform. Facebook has 100M users active daily; Compared to 400M users ever for Silverlight. It seems that Facebook is very likely to be a bigger "platform" than Silverlight.
As for flash, youtube has 100M videos watched per day, and 300M accounts. All of those presumably would have flash, yet that would only be a percentage of the total. It's safe to say flash is in more common usage than Silverlight -- Many people (such as myself) downloaded it for the Olympics and haven't used it since.
In the USA, the highest profile Silverlight projects have probably been Netflix and the Olympics (Beijing and soon Vancouver), with the Masters and NCAA March Madness as recent big ones.
IOW, Silverlight's success up to now stems from exclusive content deals Microsoft has managed to strike with content providers, by way of generous contracts. If Chrome were the only way to see the 2012 Olympics, I would expect a lot of downloads of Chrome, and likely a lawsuit from Microsoft. It's funny how the shoe feels on the other foot.
Re: (Score:3, Interesting)
There have been 400M downloads of Silverlight so far.
Silverlight is included in many updates to Windows XP. At a company I worked for fairly recently, the windows admin ticked the box to install silverlight on some 100+ PCs. No one at that company ever used it while employed there (the company has since gone bust). With Silverlight being included in basic Windows XP upgrades, I'd say it's very likely the vast majority of the 400M "downloads" you cite has absolutely nothing whatsoever to do with Silverlig
Re: (Score:3, Informative)
"Does this situation indicate that the market is no longer receptive to proprietary standards (at least in areas such as the web, where open standards are the norm)?" I definitly think so and a lot of other webdevelopers certainly think so too.
Re: (Score:3, Informative)
Moonlight is the open source Linux version.
-Rick
Re: (Score:3, Insightful)
I will (or would) take Silverlight serious if they release 64/32bit plugins AND design tools for Linux, OS X (PPC too!), Symbian, Google thing, FreeBSD.
Not that one coded by that MS trojan. The real thing, with ALL codecs, ALL functionality, releases in sync.
They have to code the design tool, plug into XCode on OS X, plug into Adobe tools, plug into Quicktime and guarantee there will be never, ever any missing updates for any of these non Microsoft operating systems.
That is what Flash is or will be. Adobe a
Re: (Score:2)
Well, you'd at least need someone to create an editor to make it easy to develop. The company most likely to create such an editor would be Adobe, except that the functionality would compete directly with Flash. Is there any economic motivation for someone else to invest the money in creating a Flash-style editor to compete? Or for Adobe to integrate support for using Flash to create HTML5 interfaces instead of using the Flash format?
Re: (Score:3, Insightful)
The economic motivation is to be able to compete in the new market. If HTML5 is awesome enough to kill Flash, the best Adobe could do is be ready to take part of the new market, even if it's less profitable. If they refuse to do so, and Flash does get killed, they end up with nothing, which is certainly even less profitable.
Re:It's the tools stupid (Score:5, Interesting)
I don't see why it would be less profitable. They don't charge for the Flash client, only for the authoring tools.
Even if Silverlight were to take over, as long as Adobe makes a decent tool for creating Silverlight projects, they'll make close to the same amount. Although come to think of it, they may lose some sales only because they don't "own" the technology in consumers' eyes, and many consumers would buy Microsoft if they could anyway.
But since HTML5 is not owned by a company, it puts Adobe on equal footing with any other company making an editor. Consumers would be able to choose their editor, and Adobe has a well-established footing in the market. If they just changed their product to output HTML5 instead of or in addition to a swf file, they'll keep their strangehold on the editor market.
Re:It's the tools stupid (Score:4, Interesting)
Sure. Anyone whose determined it is in their interest to support HTML5 + Javascript as an alternative to Flash has an interest in seeing that it gets used, so everyone that has been embracing HTML5 for browsers -- Google, Apple, Mozilla, and Opera, just to name the browser publishers -- also has an interest in creating tooling to make sure that HTML5 doesn't just sit around unused in favor of Flash and Silverlight.
Re:It's the tools stupid (Score:5, Insightful)
Not to mention the fact that it enhances the user experience. If you can just get a browser, with no plugins required, that's much easier for users to deal with.
And on a final note, have most of the people arguing that Flash is "easier for designers to use" actually used Flash? Doing anything really interesting in Flash requires using Actionscript, and Actionscript 2 is basically a javascript clone, while Actionscript 3 is more similar to Java. I learned actionscript 2 before I learned javascript, and the total time to go from one to the other was about 10 minutes (how long it took to learn the new constants, global variables, and proper DOM manipulation).
The fact is, if the web is to continue to grow, it MUST shirk Adobe and Microsoft's proprietary plugins for open standards. Not only do they often run better (Flash can be amazingly bloated, just look at Hulu's standalone Adobe Air app), but they give us more options and possibilities as well.
Re: (Score:3, Informative)
Except on the iPhone
Re: (Score:3, Informative)
And heinously buggy. Most of the crashes I've seen in Safari have Flash in the backtrace (and usually Flash_EnforceLocalSecurity()). Some flash sites crash browsers with such ease and regularity that it borders on painful to visit them at all---particularly some of those flash games that display random flash ads before you can play them. Those crash Safari and FireFox about 50% of the time.
From a quick skim of the 'net, I see reports that it is not only the #1 cause of crashes in Safari, but also in Fir
Re:It's the tools stupid (Score:5, Insightful)
Re:It's the tools stupid (Score:5, Funny)
Re:It's the tools stupid (Score:5, Insightful)
What you're not considering are all the other Flash-based sites that don't trade in pointless crap -- the far more subtle ones where you have to take a peek at the context menu just to be sure they aren't actually using some particularly clever JavaScript.
These are the sites that use but don't abuse Flash, and are the best candidates for HTML 5's more lightweight environment. If the designers and developers of these sites can be convinced it's worth migrating from Flash for the decreased overhead, they just might.
Re:It's the tools stupid (Score:4, Informative)
1x1 flash is for permanent cookies. Browsers have all sorts of cookie controls and max cookie storage times whitelists and blacklists flash doesn't. Any site can set a cookie and cookies in flash never go away unless you go to a special adobe site that allows you to browse your flash cookies and delete some or all of them.
Re:It's the tools stupid (Score:4, Informative)
Browse any directories below that and files with the
rm -Rf ~/.macromedia/Flash_Player/*
rm -Rf ~/.macromedia/Macromedia/*
In windows they are stored under C:\documents and settings\Local User name\Application Data\Macromedia\
Re:It's the tools stupid (Score:4, Interesting)
If graphics artist types can't make the kind of pointless crap that they do now with Flash, we won't see uptake of HTML 5.
As a professional "graphics artist type" I take a offense at that. What if I were to ask about the computer coders types making the kind of buggy crap they do now with [whatever language you like]?
Don't blame me for the ugly crap made by my less talented brethren and I won't blame you for the unstable, insecure crap made by yours. No-talent assclowns are no-talent assclowns, regardless of profession.
This graphics artist type (full disclosure: I may get paid for design, but my hobby is programming so I'm sort of an odd duck), for one, is very excited at the potential of HTML5. I look forward to a world where I can make animations for the web and embed videos and whatnot without having to muck around with stupid Flash/Silverlight/Java/whatever. I HATE Flash, I HATE Silverlight more, I HATE Java the most, and anything I can't name off the top of my head can go STRAIGHT to hell. I do see where the parent is coming from though. I see a lot of designers building sites in Flash just because they lack the analytical skills to wrap their overdeveloped right hemispheres around using CSS and (X)HTML. To design a website that isn't just pretty, but is actually good takes more than a good creative sense.
These days everyone and their brother and their cat might think they're a web designer, but most of them aren't. They're just some guy with a pirated copy of Photoshop. Rest assured that there are web designers out there who know what they're doing.
Re: (Score:3, Insightful)
They don't plug into tools, for some reason (Score:3, Insightful)
That is one thing MS Silverlight team doesn't understand too.
If you want designers/video guys embrace a new technology, you have to plug into Adobe's tools and Apple Quicktime framework in a perfect, seamless way.
Both Adobe tools and Apple quicktime has no problems with stuff plugging into them and in case of Quicktime, it is actually designed for "components adding new functionality". There is no "evil" to whine about, just an ignorant company who aims to give hell to people who dares not to use their oper
Flash is de-facto standard for a reason (Score:5, Interesting)
That huge framework install with all the functionality still hurts quicktime, in case of Windows Media, you have already got it forcibly installed and it also uses undocumented goods of Windows to perform better. Linux? No official support. Real? Well, people still think it is spyware even while it is open source.
All these tools are in fact superior to Flash for embedding video, especially Real Player is really in 11th generation. Why they fail? Because they don't have Adobe design tools for use of real artists (designers) and they are still STUPID (hear me Apple) to add additional stuff to that already bulky download.
I always feel sad for using Flash to embed videos with the functionality missing from it but as I can't tell people to "download 30 mb application" or "give up your IE and use that open source browser" (sorry!), I embed Flash.
That was my point. Quicktime is a great technology being wasted by couple of idiots at Apple Inc. You know, the idiots insisted on asking $$$ for full screen playback for years. They couldn't seperate the "player" and "recorder"... They owned 80% of video market share back in worst days of Apple, can you believe?
Total nonsense (Score:5, Insightful)
Just because I can embed video and sound doesn't make my HTML pages the equivalent of flash. More importantly, Microsoft has "announced" intension to support HTML 5, but there's exactly zero movement so far from the market leader, and a long history of similar unfulfilled promises. Until Microsoft says HTML 5 is the next big thing, it isn't. Sorry, I know it sucks.
Re: (Score:2)
Re:Total nonsense (Score:4, Insightful)
Acid 3 is, unfortunately, heavily dependent upon CSS3 functionality, which isn't officially standard yet and could change. So claiming that Acid3 is some kind of test only tests if you're compliant with drafts.
Re:Total nonsense (Score:4, Insightful)
The more compliant the browsers are, the less work I have to do. As long as my code is also standards-compliant, the less cross-browser testing is necessary. This is so huge I don't really know how to emphasize it.
Right now we have to test our site under IE6, IE7, FireFox, Chrome, and Safari in both Windows XP and Vista. We have to test IE6, IE7, FireFox, Chrome, and Safari in both XP and Vista running in a VM on a Mac. We have to test FireFox, Chrome, and Safari under OS X. (Opera has not had a sufficient piece of our customer share.)
Now, unless I have miscounted, that is 23 browser tests we have to do for each update of our site. You think that's fun? And all because of different levels of standards compliance.
It will get somewhat easier when IE6 dies its glorious painful death (which could not be too soon for me), because that is the browser that is LEAST compliant of them all, and which requires more tests than any other. Though IE7 is no picnic.
Re: (Score:3, Insightful)
If you'd stop for a second to remove your head from between Ballmer's legs, you'd notice that Microsoft's monopoly on the browser market has long crumbled and they're constantly losing market share. Microsoft's power to blatantly ignore standards and have everyone have to grudgingly follow behind is but a mere shadow of what it once was, and it doesn't look like they'll be regaining such a position any time soon, if ever.
Which is why a Silverlight plugin for Firefox exists. IE is headed to live on a farm with a nice family right now.. So unless they can pull off Silverlight and a few other things that get Windows specific stuff commonly used on the net, in a few years time, expect IE to be abandoned again. Microsoft may not be able to instantly deliver 90%+ install base of any codec or media playing system any more, but they can still do enough to bugger the net up for the rest of us given enough time. And they can afford t
Let's get on with it! HTML 5.0 Now!!! (Score:3, Insightful)
Dump Flash and Silverlight into the dust bin of bit history along with the YouTube master control! Onward!
How about adopting Chromes Native Code Binary API plugins for all the browsers while we're at it? Let's get it so that we can auto download plugins written in languages other than that icky JavaScript gooicky stuff.
Get on with it guys! The web browser is still just so much as a dumb terminal spitting screens to a central server master control program!
Let the independent distributed revolution begin!
Re:Let's get on with it! HTML 5.0 Now!!! (Score:4, Insightful)
Re: (Score:2, Interesting)
Ick, you have to ask? For starters it's a round parenthesis language like C, Java, and other icky goo.
Well, it does have prototypes so it's not all totally lost.
Heck, even C is getting blocks now with llvm and clang over at apple - grand central dispatch relies upon lambda blocks like smalltalk has for decades.
If you like javascript that's great, good for you. It's just not for all of us who prefer other languages. That's were the chrome native binary api comes in with the browsers. It let's us download nat
Re: (Score:3, Insightful)
Not a particularly great explanation as to the shortcomings of Javascript other than apparently C-style languages are a no-go with you. Plus it's prototype system is pretty half-assed, so I'm not sure that's even a positive (I'd prefer real prototype setup like in SELF).
I don't recall asking why anyone would want to use another language, though, as that's obvious: language preference. *shrug*
Re:Let's get on with it! Native Client Now!!! (Score:2)
I'd also prefer SELF in the browser and with Native Client you'll be able to add SELF to your web pages!!!
Yes, javascript sucks for me. Notice I didn't mention the language that I prefer as I didn't really want to get into a language war. I don't care if someone else prefers another language as I pretty much get their reasons as I've been around a while. If someone wants to use some language, SomeLanguage(tm), then please let them!
Native Client now!
I have an ARM, you insensitive clod (Score:5, Informative)
I'd also prefer SELF in the browser and with Native Client you'll be able to add SELF to your web pages!!!
From the front page of the Native Client site [google.com], with my emphasis:
That doesn't bode well for compatibility with ARM subnotebooks, ARM PDAs and PDA phones, PowerPC set-top boxes, etc.
And even on devices with a GenuineIntel or AuthenticAMD CPU, it's far from ready. From the release notes [googlecode.com]:
native client on 64 bit... (Score:3, Informative)
And even on devices with a GenuineIntel or AuthenticAMD CPU, it's far from ready. From the release notes [googlecode.com]:
Unfortunately, this is a more fundamental problem. Native Client makes use of x86 CPU's segmentation features to provide memory protection. These are not available on 64-bit CPUs (except when running a program in 32-bit mode). So native client will NEVER work for a fully 64-bit browser. I do not see any way of providing equivalent memory protection without segmentation, short of dynamic instruction rewriting (emulator-style) which has an order of magnitude more overhead (say, 2x overhead, versus 5% overhead
Re:Let's get on with it! Native Client Now!!! (Score:2)
Here are some articles on the topic of what is wrong with javascript.
Certainly the speed issue is or has been resolved with impressive recent results. Hopefully that trend will continue.
I don't agree with the strong typing but then that's just me.
Here they are, all with the title "What is wrong with Javascript" funny enough! [ayende.com] [compuskills.co.uk] [infoworld.com]
Re: (Score:2)
Re: (Score:2)
Need good tools (Score:5, Insightful)
Flash, Silverlight, and JavaFX all have major vendor tooling support to help coding, developing, deploying on these platforms easy. I don't know of any tools in existence or in development that can beat the solutions offered by these vendors. Adobe might be willing to do that in the past, but they own Macromedia (flash) so I don't know if they will step up. In short, unless the tools are there, it will not see major adoption.
Re: (Score:2)
The only thing that would get any of the above-mentioned companies on board would be for HTML 5 to take off to such a degree that they feel their authoring environments are threatened enough that they need to adapt.
And as arguably their support would be instrumental in HTML5 taking off in the dynamic browser-based media market, it's pretty much a catch-22.
Unless some new player lands on the scene with a well-designed and powerful authoring environment built from the ground up for HTML 5. Then things could g
What about the browsers? (Score:3, Insightful)
The RIA guys are quoted as saying they're not worried, because HTML 5 + CSS 3 is 10 years out.
If this is the case, how far behind will the browsers be in supporting the standards?
Re: (Score:2)
The 2D Canvas tag already works pretty well in Chrome, and mostly works in Firefox with some notable features missing. The w3c plans on adding a 3D standard at some point, but my guess is that the 2D API isn't going to change much from here.
Re: (Score:2)
Re:What about the browsers? (Score:4, Interesting)
The 10 year timeframe is for going to REC. Which means there are two complete interoperable implementations.
Unlike previous W3C standards, this time they're not going to publish as final it until they have evidence that it can actually be implemented, and by more than one development team. That's been a major issue with CSS2, for example: the long time CSS2.1 has been taking has been largely about fixing things that were underdefined, contradictory, or just wrong (in the sense of not making any sense) in CSS2 and that were discovered when people went to actually implement the spec.
HTML5 is awesome (Score:3, Interesting)
Re:HTML5 is awesome (Score:4, Informative)
Why is the site you link to [dloh.org] in your piece show as 100% black in Firefox 3.0.11?
Disclaimer: I am no web developer.
Re: (Score:3, Informative)
yet it doesn't work on any of the browsers in stalled on my computer.
HTML5, with canvas, is fantastic (Score:5, Interesting)
I've recently embarked upon a hobby project where I'm only targeting the latest browsers, excluding IE8.
Not until now have I realized how much we web developers are hampered by IE. Canvas and Javascript are a highly capable platform for interactive graphics, and it works across browsers and operating systems without issue. Chromium on Linux for example, incomplete as it is, works with canvas out of the box (not to mention about 10 times faster than FF in executing Javascript).
The ability to create web pages quickly, using convenient CSS2 and 3 rules, the ability to use piles and piles of Javascript without worry, the ability to have everything just work across my target browsers, it's utterly amazing. If we weren't stuck in this damn backwater due to having to support IE, the web would be a far more compelling platform.
I absolutely cannot wait for the day when HTML5 and CSS3 are widely supported and adopted, but will that day ever come? Surely Microsoft realizes, as I have, how much potential is here, and I don't doubt that some of the higher ups would hold IE back so that developers are forced to use their plugins in order to deliver their content.
For those projects that don't care about IE support, HTML5 canvas/video/audio is a fantastic leap forward for the web. For the rest, business as usual for some time to come I'm afraid.
Re: (Score:2)
For those projects that don't care about IE support, HTML5 canvas/video/audio is a fantastic leap forward for the web. For the rest, business as usual for some time to come I'm afraid.
No, it's not. You have the option to double your coding efforts, and implement your canvas features in VML as well (see for example OpenLayers [openlayers.org] for nicely abstracted code; it has 3 renderers: canvas, SVG and VML), or use ExCanvas [google.com], which does all that for you. It's slower compared to a native implementation, but it works.
Re:HTML5, with canvas, is fantastic (Score:4, Insightful)
The assumption that the IE team is motivated to compete with other browsers on the grounds of features and compatibility is naive. MS if pushing Silverlight through every vector they can think of. They like things the way they are: proprietary. This is the same company that makes Visual Studio, along with compilers for a dozen languages. Do you *really* think they'd have a problem developing a JavaScript engine to compete with V8? Or implement a few additional CSS rules? How about Canvas?
As long as the numbers of IE usage remain where they are, they are not compelled to push this route of technology. They like things the way they are now.
Re:HTML5, with canvas, is fantastic (Score:5, Insightful)
I'm actually staring at the screen and trying to think of what to "say". Have you just met Microsoft? They've had
.Net code running on BSD since ~2002, and I'm *not* talking about Mono. They've released plenty of code that runs "on the competition", while attacking both from the legal *and* the PR fronts. It's all a messed up game for them, they're stalling for as long as they can. They'll help you along with your science project and then sue you for using their patents in it. If we haven't learned this by now, I suppose we never will.
Yeah, but javascript sucks (Score:5, Insightful)
Re:Yeah, but javascript sucks (Score:4, Insightful)
I was ready to jump on you when I read the title of your post, but you're right, mostly. JavaScript is actually a really nice language to develop in (for small projects). With features such as lambdas, closures, and functions as first class objects, you can write some very elegant solutions with very little code.
Even with those features it's still stuck in the dark ages when compared to other modern languages. Prototypal inheritance, while cool, doesn't really offer the power that classical inheritance gives you when you're creating large systems. There's no such thing as super in prototypal inheritance, which gets annoying after a while.
Lately I've been looking into Flex and ActionScript 3. AS3 is basically what EcmaScript 4 was going to be before Microsoft derailed it. It's basically Java with a different syntax, a few extra features (lambdas, closures, namespaces), and no equivalent to abstract. It's really nice.
While I'm all for HTML5 and open standards, I highly doubt that it will ever be able to keep up with proprietary solutions like Flex. There's always going to be that big asshole in the corner who refuses to keep his browser up to date with everyone else. I've written large programs in JavaScript and its just far too stressful trying to keep IE-compliance. Until Microsoft or IE are dead and buried, I'm going to have more fun writing Flex apps that run on all browsers and all platforms without any platform specific code.
Re: (Score:3, Informative)
RIA? (Score:2, Funny)
Re: (Score:3, Informative)
Adobe brought this on themselves (Score:3, Insightful)
Had Adobe not steadfastly refused to put any end user controls or setting in Flash no one would have bothered to develop alternatives.
But because they wanted to cater to the jumping monkey segment of the web advertising world, they stonewalled every request for end-user controls, such as no looping, no animation, no sound, etc.
Besides the fact that it is bloatware, its just end user un-friendly.
In order to control Flash, you needed to kill Flash and millions of web browsers would like to do exactly that.
Being an open standard HTML5 is open for development of end-user controls, such as animate only while cursor hovers, sound off till I say so, etc.
Bring on HTML5.
This is a market Adobe deserves to lose.
Re:Adobe brought this on themselves (Score:5, Insightful)
Screw Flash. Screw Acrobat. Screw Silverlight. On the web, the most puritan Free Software advocates are right: If it's proprietary, don't download. Don't install. You've just giving them the power to take away your choices.
well... (Score:4, Insightful)
The problem with HTML is the implementations (Score:2)
Re:The problem with HTML is the implementations (Score:4, Insightful)
> Even if HTML 5 were rigourously defined and backed up by proper compliance testing
For what it's worth, that's one of the most important goals of HTML5.
> how long it will take for browsers to properly support it
That 10 year number in the article is actually more or less the current estimate from people like the spec editor for HTML5.
Developers, developers ... and authoring tools (Score:5, Insightful)
The fundamental issue with the new RIA standards is the lack the of authoring tools. I have got a number of graphically-inclined friends who are never going to write something with HTML5 mainly because there are no tools out there (yet) which come even close what the Adobe authoring tools can do.
Recently, I sat with one of my friends (who's a decent artist [coroflot.com]) and played around with Processing 1.0 [processing.org]. After several minutes of hard work, it just became abundantly clear that visual thinkers have a lot of trouble expressing what they want algorithmically. The experience was repeated the next time, when he was playing around with chucK [princeton.edu] (yeah, he's a music dude too).
The graphic artist folks will have a lot of trouble using the HTML 5 authoring tools currently available, especially if they're confined to use HTML Canvas programmatically. I've easily gotten upto speed with canvas [dotgnu.info], but I'm a programmer with no artistic pretensions.
Real adoption of HTML5 - canvas and video & all, will need easy ways to author media
... not write code.
Re: (Score:3, Interesting)
Re: (Score:3, Insightful)
Not sure if you know this, but with the latest release of Flash and ActionScript3, you have to be a coder to get ANYTHING done.
If you want pure linear animation, Flash still works great in the hands of designers, but the second you add a replay button, you now need to start coding.
Adobe shot themselves in the foot by pushing flash out of the hands of designers, taking away a huge advantage they had against HTML5. [blueboxsw.com]
Double Standards? (Score:2)
What I hear is that "we need an open standard on video that is not controlled by one [proprietary] company."
But when it comes to Linux and where system files are "kept" (read installed), versions and naming conventions for files and all the rest, folks advocate for what is essentially chaos on the Linux platform.
How do they do it? By making lots of noise about choice. Where choice has put us to date is: Being behind on the desktop. We should have a target system configuration and still leave those who wan
RIAs have common runtimes, browsers do not (Score:5, Interesting)
The big problem with HTML5/JavaScript/CSS is that each browser has quirky behaviours that need to be tested. Even if Internet Explorer no longer existed, developers would have to test against Firefox, Safari, Chrome and maybe Opera. An example of a quirk is Safari not recognizing table element widths in percentages. A Flash developer tests against one Flash runtime, same with a Silverlight developer and a JavaFX developer.
Adobe released a beta of a multiple browser runtime testing tool, but it's apparently very flawed.
So until the above problems are solved, many RIA developers will simply use Flex, Silverlight or JavaFX, instead of coding for a hodge-podge of different browsers.
Hope WIN7 catches on (Score:2)
How many organizations are still use IE6? Too many.
We independent developers decide that ... (Score:4, Interesting)
if you make it good, and we like it, you'd be surprised how fast proprietary technology gets replaced. look at PHP. many of you who work corporate may not be aware, but PHP dominates the majority of sites that belong to individuals and small businesses now. check elance, rentacoder, etc - you'll find that the demand for php projects at least quadruples anything closest.
how did it happen ?
people liked it. it was adequate (then), it was free, it allows you to do anything (now). period. it took off.
before any of you language nazis come up and start trolling about how you dont like php syntax, how there are more 'elite' languages out there, and how php is 'not a language' etc, i should say - i dont give a flying fuck. neither do millions of people who utilize it and who develop on it. so keep it.
Re:We independent developers decide that ... (Score:5, Insightful)
It could be done with PHP because replacing server software doesn't affects clients; in particular, it does not require them to install new plugins and/or change their browser.
Client-side, it's a very different kettle of fish. Silverlight can fight Flash by being bundled with the OS (or installed wia WU); JavaFX can fight it by being bundled with JRE (or installed when JRE is auto-updated). I don't see any similar opportunity for HTML5.
Microsoft? (Score:5, Insightful)
Microsoft might be part of the w3 organization, but none of their browsers support any of the HTML5 specs, i dont call that being involved, instead they have specifically decided not to support these standards, and try to slow down, and break apart the web.
Re: (Score:3, Informative)
... but none of their browsers support any of the HTML5 specs
IE8 supports bits and pieces [microsoft.com] of HTML5. It's a very far cry from full support, but your claim that "none of their browsers support any of the specs" is plain wrong.
Re: (Score:3, Informative)
Microsoft might be part of the w3 organization, but none of their browsers support any of the HTML5 specs, i dont call that being involved, instead they have specifically decided not to support these standards, and try to slow down, and break apart the web.
Happened many times, they were members of the Corba consortium and derived DCOM from the technologies there, early they were members of the OpenGL consortium it ended with DirectX 3 being a plain COM based copy of OpenGL, their membership in the W3C consortium has been going on for longer than a decade.
But to Microsofts defense they behave more nicely. The last stunt they pulled was to rip off SVG and label it under their own name (XAML) incompatible of course, while not supporting the official SVG standard
Why is it? (Score:3, Interesting)
But seriously, why can't we look at this in terms of the development doors that will be opened, and not mind the fact that RIA content will someday probably fall by the wayside? Progress happens, and those companies/individuals/organizations that fail to adapt fall behind and eventually wither. I think we can all agree that HTML5 has the potential to be awesome, let's approach it in terms of how to make it as awesome as it can be, instead of wringing our hands over the fates of the poor, defenseless multinational corporations.
Isn't search a factor? (Score:5, Interesting)
Re: (Score:3, Funny)
You should know better than to start a new thread this far down. Find some random troll up at the t
WebKit vs. IE (Score:5, Interesting)
For the past two years, I've been telling everyone the new browser war is between IE and WebKit. WebKit has become the default platform for the mobile browser market (iPhone using Safari and Android and Palm using their version). One of the big reasons Apple started WebKit was to keep the browsing platform out of the hands of a single vendor. It's not that Apple doesn't like proprietary technology. It's that they don't like proprietary technology that they depend upon and don't control.
The battle for HTML 5 vs. Silverlight vs. Flash will be on the mobile platform. It's easy for Silverlight and Adobe to create a desktop application that work with 90% of the desktops (and a bit more work to get another 9%). However, the world is changing. Adobe and Microsoft can't create Silverlight and Flash clients for every single possible mobile platform. The trick is to get enough HTML 5 clients out there that it'll be worth it for developers to learn HTML 5. If enough developers pick up HTML 5, companies will make IDEs for HTML 5.
If that happens, Flash and Silverlight will go away. The other possibility is that Apple will buy Adobe and open source Flash. Apple loves open source standards because it means that they'll be able to sell all the neat gadgets that work with these standards.
Sun uses Flash (Score:4, Interesting)
HTML5 audio/video will be an epic fail (Score:3, Interesting)
For several reasons:
1. Microsoft doesn't give a shit about it. Therefore enterprise users won't give a shit.
2. Even if Microsoft does give a shit, neither Apple nor Microsoft will support Ogg Theora. Therefore Linux is SOL again.
3. Apply #1 and 2 to audio standards as well. No common, open, royalty free, pre-installed standard across all platforms == epic fail.
The main power of Flash right now is that once you install the plugin, you might as well forget all that BS about paying for codecs on all three major platforms. It's all in there. It's convenient. It's sufficient.
Re: (Score:2)
Sooner or later they will.
Re: (Score:3, Insightful)
As a developer deploying to clients via the web browser using a Native Client application I'd need to have versions that work on these cpus assuming I want you to be able to use the app from your handheld gizmo.
So now, every developer has to buy x86-32, x86-64, ARM, and PowerPC devices in order to test his scripts instead of just downloading different browsers and running them on one PC. I thought we got away from having to buy multiple machines when Safari got ported to Windows.
Re: (Score:3, Insightful)
I already have iPhone (ARM)
What makes you think Apple is going to digitally sign a Native Client plug-in? From Apple's iPhone SDK developer agreement:
Besides, | http://tech.slashdot.org/story/09/06/16/2030204/html-5-takes-aim-at-flash-and-silverlight | CC-MAIN-2015-22 | refinedweb | 8,314 | 69.62 |
Apache2::CGI::Builder - CGI::Builder and Apache/mod_perl2 (new namespace)integration
The latest versions changes are reported in the Changes file in this distribution. To have the complete list of all the extensions of the CBF, see "Extensions List" in CGI::Builder
Apache/mod_perl2
Note: You should know CGI::Builder.
This module is the mod_perl2 compilant version of the Apache::CGI::Builder extension. Use it only if you have installed the official release of mod_perl 2 (Apache2::* namespace). Read the documentation in Apache::CGI::Builder.
See "SUPPORT" in CGI::Builder.
© 2004 by Domizio Demichelis ()
All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as perl itself. | http://search.cpan.org/dist/Apache-CGI-Builder/lib/Apache2/CGI/Builder.pm | crawl-003 | refinedweb | 117 | 68.36 |
I'm a coding newb and want to learn some more java. I'm currently taking an introductory programming course in high school and am just trying to play around outside of class. This program I'm creating is supposed to print out a few instructions and questions in the console, to which I want to retrieve user input using a scanner and variable. The goal of the program is for the user to be able to create a 'drawing' based on pure instinct, then this drawing is displayed after the fact.
Here's my problem. I'm asking the user and storing the information in variables that are native to the main method, but I need to use this information in the paintComponent method.
I tried adding static in front of the variable such as:
static int emptyRectW1 = kboard.nextInt();
import java.util.Scanner;
import java.awt.Graphics;
import java.awt.Color;
import java.awt.Container;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class BlindDrawing extends JPanel {
public static void main (String[] args) {
Scanner kboard = new Scanner(System.in);
System.out.println("Welcome to the Blind Drawing Game!");
System.out.println("In this game, you will be asked questions about how to construct an image using rectangles and ovals. You will be asked the shape's dimensions and position. The origin (0,0) is the top left corner.");
System.out.println("First you're making an empty rectangle, how wide do you want it to be?");
int emptyRectW1 = kboard.nextInt();
System.out.println("What about the height?");
int emptyRectH1 = kboard.nextInt();
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawRect(0,0,emptyRectW1, emptyRectH1);
}
}
Actually, a variable declared inside a method is a local variable.
Please extend the scope of the the two variables just before your main method. See code below.
static int emptyRectW1, emptyRectH1; public static void main (String[] args) {
Then manipulate the latter code to avoid duplicate variable declaration as shown below.
emptyRectW1 = kboard.nextInt(); System.out.println("What about the height?"); emptyRectH1 = kboard.nextInt();
I hope this helps. | https://codedump.io/share/hGXHHeLlvBfX/1/how-do-you-make-variables-made-inside-a-method-available-to-all-other-methods-in-a-class | CC-MAIN-2018-17 | refinedweb | 346 | 61.12 |
> On March 8, 2016, 12.
Advertising? > On March 8, 2016, 12. > > Qian Zhang wrote: > Can you please elaborate why making those methods (`connected()`, > `doReliableRegistration()`, `disconnected()`, `received()`, etc.) protected? > I see command executor have the similar methods (`registered()`, > `reregistered()`, `disconnected()`, `launchTask()`, etc.) as public too. The previous `Executor` interface had these methods as pure virtual and one was required to implement these methods. Hence, the command executor implemented these methods in the `public` scope. Here, in the new interface we need only the 3 methods `connected(), disconnected(), received()` i.e. the callback methods to be in the public scope and the rest of the method(s) like `launch() kill()` etc. can be part of the `protected` namespace. > On March 8, 2016, 12:08 a.m., Anand Mazumdar wrote: > > src/launcher/http_command_executor.cpp, lines 930-931 > > <> > > > > s/unAckedUpdates/updates > > s/unAckedTask/task > > > > Did you think naming it as `task` might result in ambiguity? > > Qian Zhang wrote: > Yeah, there is already a local variable `task` in the code to launch > task: `const TaskInfo& task = event.launch().task();`, maybe we rename this > local variable to `_task` to avoid ambiguity? Sounds good. - Anand ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: ----------------------------------------------------------- On April 3, 2016, 12:52 p.m., Qian Zhang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > > ----------------------------------------------------------- > > (Updated April 3, 2016, 12:52 > > | https://www.mail-archive.com/reviews@mesos.apache.org/msg29511.html | CC-MAIN-2017-17 | refinedweb | 225 | 60.51 |
Attach an application as a self-attached entity
#include <ha/ham.h> ham_entity_t *ham_attach_self( const char *ename, uint64_t hp, int hpdl, int hpdh, unsigned flags );
libham
You use the ham_attach_self() call to attach an application as a self-attached entity to the HAM. Self-attached entities can, on their own, decide at exactly what point in their lifespan they want to be monitored, what conditions they want acted upon, and when they want to stop the monitoring. Self-attached entities can also specify an interval at which they'll send heartbeats to the HAM. The heartbeat can be used to detect unresponsive processes that aren't dead.
Once an entity has been attached, you can add conditions and actions to it.
A valid handle to an entity on success; otherwise, NULL (errno is set).
In addition to the above errors, the HAM returns any error it encounters while servicing the request to add a new entity to its context. | https://www.qnx.com/developers/docs/7.1/com.qnx.doc.ham/topic/hamapi/ham_attach_self.html | CC-MAIN-2022-27 | refinedweb | 159 | 52.29 |
asked 2018-10-19 04:29:29 -0600
updated 2018-10-20 10:36:04 -0600
Since the solutions of a SAT formula corresponds to integer points of some polytope, you can solve #SAT by asking Sage to construct that polytope and count its integer points. See the code below.
The default
integral_points_count for rational polytopes basically enumerates all integer points, so the choice of the backend could have an importance on the speed. I bet
normaliz will be faster, it requires the
pynormaliz optional package to be installed. Please report about your real-life experiments.
Also, the
latte_int optional package could speed things in some cases, please report your experiments, since that could depend on the actual problem (on the code below, you should use latte=True to use it).
That said for further improvements, we really need to know your real problem.
Typically, the polytopes we consider are included in the unit cube of large dimension, hence I do not see how Barvinok theory (which is what
latte_int relies on) could speed things up since no set of >=3 points is aligned.
So, depending on your problem, one could imagine to describe it with a "fatter" polytope of smaller dimension, whithout reducing it to SAT first, so that Barvinok theory could be much more efficient.
Other approaches could be thought about too. For example, given a SAT formula, it is easy to enumerate all solution with a SAT solver: for each solution, add its "opposit" as a new constraint and solve it again. I have plans to add such an
__iter__ method to the current SAT solvers in Sage.
def sharp_sat(clauses, backend='cdd', latte=False): r""" Count the number of solutions of the given CNF formula. INPUT: - clauses is a list of lists of integers representing a CNF formula in the DIMACS notation, for example: [[1,2,-3], [-1,2]] means (x1 or x2 or (not x3)) and ((not 1) or 2) - backend : one of `'cdd'`, `'normaliz'`, `'ppl'`, `'polymake'`. - latte : if `True`, use `latte_int` (optional package to be installed) for the computation. """ p = MixedIntegerLinearProgram(solver='ppl') x = p.new_variable(binary=True) for clause in clauses: p.add_constraint(sum([x[i] if i>0 else (1-x[-i]) for i in clause]) >= 1) P = p.polyhedron(backend=backend) if latte: return P.integral_points_count(explicit_enumeration_threshold=0) else: return P.integral_points_count()
Asked: 2018-10-19 04:29:29 -0600
Seen: 193 times
Last updated: Oct 20 '18
CryptoMiniSat assertion error
Model of polynomial with integer coefficients
SAT Math Level 2 Subject Test Sample Question #19 [closed]
How can I compute the minimal fixing set?
How to find the spanning elementary subgraphs of a given graph
SAT Math Level 2 Subject Test Sample Question #26
can you find the total chromatic number (edge and vertices) of a graph?
Non linear Binary equations using sat solver
It's possible you will find this SAT solver information useful, but probably not since you are a seasoned Sage pro and probably #SAT is not the same thing as SAT ... nonetheless I'll leave this as a comment in case it helps people seeing this know that's not what you're looking for.
@kcrisman : SAT is about telling whether there is a solution to some boolean formula, #SAT is about telling how many solutions there are. | https://ask.sagemath.org/question/43984/is-there-anything-in-sage-which-solves-sat/?sort=votes | CC-MAIN-2020-50 | refinedweb | 552 | 59.23 |
All you ever wanted to know about Windows Forms and Windows Presentation Foundation Interoperability (plus some other stuff).
My....
He says in his best maniacal voice...
I assume you know that the fairly recent movie "When a Stranger Calls" is a re-make of the 1979 original which starred Carol Kane as the babysitter. You may remember Carol Kane as Simka, Latka Gravas' (Andy Kaufman) wife in the TV show Taxi. Andy's dead now you know...sad really...he kind of went off the deep end when he started wrestling women...
Blog reader: What the hell are you talking about?
Sorry, my mind wanders like that from time to time. Don't know if it's because I'm a product of the 60's or if I'm just getting old or that I'm just plain out of my FREAKIN' gourd!
Okay, I'm better now. So anyway, I wanted to give you a heads up that there is a breaking change coming in the Crossbow API for Beta2. There used to be a Children property on WindowsFormsHost control. You would use the property to add your subsequent Windows Forms control to the host via the Children.Add() method. We'll it ain't there anymore. We replaced it with a Child property. This was done because we felt it was kinda stupid to have a collection property that limited you to one item. (You may remember that even though we implemented this property as a collection, we enforced a limitation of a single item in the collection). So now there's just the single Child property and you simply assign some Windows Forms control to it.
Likewise on the ElementHost control, we used to have the Controls collection property where you added your single top-level element. Now we have replaced that with a Child property as well. Once again, we just wanted to remove the collection and replace it with a singleton and maintained consistency with the naming.
Note that this change goes into effect in the Beta2 drop of Crossbow.
<ManiacalVoice>So next time when the compiler calls and tells you something's wrong...remember to check the children...</ManiacalVoice>
Have..."
I just wanted to make sure eveyone was aware of this little fact. First of all, in more recent builds (at leas the Feb CTP and beyond) you no longer use Mapping PIs to reference external assemblies. Instead, you simply use the xmlns attribute by itself. So using "old school" syntax you would have something like:
<?
Now you would loose the Mapping PI altogether and just use the xmlns attribute in the following manner:
Furthermore, you do not need to do this at all for the things in WindowsFormsIntegration such as WindowsFormsHost. These are now part of the standard schema and no longer need to be prefixed.
I have received numerous emails from people who are using the Feb CTP version of Crossbow and have run into the bug that we have in ElementHost where the hosted WPF content does not show up until you resize the Form that contains the ElementHost control.
While this may be a small enough issue, many people have requested a work-around for the problem. Well, you would think that all you have to do is force a repaint by calling Invalidate() or Refresh() on the Form, but alas this does not make the content appear. So how can we fix this?
Don't fret my little Crossbow consumers...Uncle Mike is here to hook you up. Here's what you need to do...At the end of your Form_Load() event handler, hook the Shown event and change the Form's size. So, something like:
This little hack will at least get you up and running so that you can see your hosted WPF content when the Form loads. Generally, this will suffice until you get the version of Crossbow that has this fixed.
Okay).
As I typed the title to this post, I wondered just how many people over the years have butchered "Billy the Bard"'s line from Romeo & Juliet? I'm sure it's ridiculously high and here I go contributing to it. Sorry about that Bill, you can roll back over in your grave now...
In the spirit of interoperability, I thought it may be interesting to take a look at a scenario where you want to write a WPF application that uses resources that are entered and stored via the Resource Editor in Visual Studio.
Let's create a cheesy little application that shows off how to do this. First we need to create a WPF application using VS. Then we add some resources using the Resource Editor. To do that we just go over to our Solution Explorer in VS, expand the Properties node and double-click on 'Resources.resx'. This will launch the Resource Editor.
In the Resource Editor, let's add a string resource and an image resource. For the string, we will use some lyrics to one of my favorite Soul Coughing songs 'Screenwriters Blues'.
Since we are using these lyrics, let's use the image of the 'Ruby Vroom' CD that the song is on as our resource image.
Okay, now that we have our resources stored, let's work on the rest of the app. Let's go to our XAML and add a Button and a Label.
What we are going to do is use the string from our resources for the Label and use the image as the background of our button. Now using the string is perfectly straight forward since a string is a string. The bitmap however is a horse of a different color or it smells different or something. (Yeah, I know...I'm mixing my metaphors).
So let's go to the code behind to start doing our thing. We need to figure out where we are going to put our logic to set the label and the button. Usually you do this in some event handler in the code behind so we'll do that as well. However, what event should we choose?Most of the time you see examples using the Loaded event for the Window so that would be normal for us to use as well. BUT, I ain't gonna do that. Why? Well, it's because I want to be different and it's a good habit to get into. Let me explain this a bit. Many times in our code behind, we are doing things like adding controls to our visual tree in a WPF application. And if we use the Loaded event handler for doing this, we can sometimes get undesireable results. For example, if we are using a parent control such as a StackPanel and if we were to handle the Loaded event and put logic there to add controls, you would see that the Loaded event fires more than once due to the re-layout of the window after each control is added. This would result in having the controls added multiple times. If we instead use the SourceInitialized event, we don't have this problem because it is fired only once.
Okay, in our code behind let's handle the SourceInitialized event and put our code there. The first thing we want to do is get our resources.
Next let's do set our label's content to be the value in our string resource.
Now comes the part that's just a bit trickier...setting our button's background to our resource image. It's only tricky because the resource happens to be of type System.Drawing.Bitmap and we cannot set our button's background to a System.Drawing.Bitmap. To do this, we have to convert the bitmap to something that WPF understands. Luckly, there is a helper function that makes this a bit easier. The helper function is called 'CreateBitmapSourceFromHBitmap' which can be found in the System.Windows.Interop.Imaging namespace.
Let's take a quick look at the function signature for this function:
public static BitmapSource CreateBitmapSourceFromHBitmap (
IntPtr bitmap,
IntPtr palette,
Int32Rect sourceRect,
BitmapSizeOptions sizeOptions
)
The first parameter is a pointer to our original bitmap as an HBITMAP. In order to supply that we have to call the GetHBitmap() function on our System.Drawing.Bitmap object.
The next parameter is a pointer to the bitmap's palette. Now we have a Palette property on our original bitmap object, but we can't pass it to this function because the function wants the palette as an IntPtr. So to make this happen, you are going to have to write some magic code that will convert the color palette to an IntPtr. (Actually, I tried this and never quite got it right). But the good news is that since our bitmap does not have a specific palette, we can just pass in IntPtr.Zero (null).
Next is the source rectangle for our bitmap. Note that the function want this to be in the form of an Int32Rect and not a System.Drawing.Rectangle object.
I don't totally understand what the final parameter is all about, but I played around with different settings and managed to get this working so I didn't worry about it too much.
Okay, now that we have converted our bitmap to something that we can use, let's set the background of our button to the image and make sure the size of the button is the proper size.
Okay, now let's run the app and see what it looks like:
Okay, just what we wanted huh?
Okay, now I'm really going to show my age... If you're an old fart like me you remember the classic Cracker Jack commericals featuring character actor Jack Gilford where he succumbs to pressure from little kids to share his Cracker Jacks and the tag line was "Sharing...".
Okay so you don't remember huh? Anyway...the point of all of this is to talk about what else...sharing. Specifically I want to talk about a Crossbow scenario where you may have a Windows Forms application that contains multiple ElementHost controls that each contain some WPF content and you want to use shared resources such as styles.
So here's the deal...In a standard WPF application you usually hang resources off of some parent element and in doing so, child element will inherit these resources. For example, say that we want all Labels in a WPF application to have a certain look. To acheive this we would do something like this:
This will define the style for all Labels that are children of the StackPanel. So all Labels that are added to the StackPanel will all inherit the style so that they all look the same.
Yeah, so... Well the issue here is that say we have a Windows Forms application that contains some WPF content and you want to be able to create "global" styles for your elements. Furthermore, you may have multiple instances of this or other WPF content spread across your Windows Forms application and you want them to all share common styles. How do you do it? The problem is that you don't have the ability to have application level XAML file (MyApp.xaml) where you could define global styles.
Well, it's really not difficult, you just have to know how to wire it all up. So here's the deal... What you need to do is simply create a global ResourceDictionary to hang your global styles off of and then point all of your hosted WPF content to that ResourceDictionary.
Let's take a look at this in more detail. Say we have a WPF UserControl that consists of multiple Labels. (Yeah, I know...it's totally contrived and you would never build something so stupid, but bear with me it's just for illustrative purposes). So the XAML for your UserControl may look something like:
Now suppose that we want to host this content on a Windows Form form multiple times and we want to globally define how the labels in the UserControls should look and we want each instance of the UserControl to have the same look.
So let's host two instances of the UserControl on a Windows Form form using a SplitContainer to separate the two. To do this, we need to first create the form and then drop a SplitContainer on the form. Then we will put two ElementHost controls (one on each SplitterPanel). Now, to make this easy for us to do, we're going to put the ElementHost control onto our Toolbox so that it will be easier for us to work at design time.
To do this, right-click on the ToolBox and pick 'Choose Items...'
Then you will see the 'Choose Toolbox Items' dialog box. Here you will need to click the 'Browse' button to find the WindowsFormsIntegration dll that contains ElementHost.
Assuming that you are using the Feb CTP of Crossbow, you will find the dll in the Cider directory.
Next you will see the ElementHost control in the 'Choose Toolbox Items' dialog box. Check the check box for the ElementHost control and click the OK button.
Now you should see the ElementHost control in the Toolbox.
Whew, you probably already knew how to do that anyway, but what the hell...
Now that we have the ElementHost control on our Toolbox, let's put this thing together. Let's drop a SplitContainer on our Form.
Next we will put an ElementHost control on each of the panels of the SplitContainer. Just drag and drop an ElementHost on each from the Toolbox. Now, you will notice that the ElementHost gets rendered with its background color the same as the panels and without any borders. This makes it look as though it's invisible once it is not selected. If it bugs you that you cannot see the ElementHost when it is not selected, just set its background color to something else.
Okay, next lets select each ElementHost control and Dock Fill them so that they take up all the real estate of each panel. Now we can put our WPF UserControls on the form by hosting them in each ElementHost. Let's do this by going to the code behind in say the Form_Load event handler to do this.
Run the app and it should look something like:
Now we want to introduce our global Label style so that both instances of the UserControl uses the style for all of the labels. We do this by creating a global ResourceDictionary and adding a style to it.
Now we just need to point our UserControls to the ResourceDictionary object:
Let's run the app and see what happens now...
Sweet! Now all of the WPF labels in our Windows Forms application share the same style.
Okay, I bet you are saying: "Hey, you could've just added that style to the definition of the UserControl in XAML and each instance of the UserControl in the app would share the Label's style". Yep, in this particular case you're right. However, what if the two instances of the UserControl were in fact two different UserControls for example. In that case, I would have had to define the style in both XAML files. This way I only have to define the style once in code behind and wire-up any WPF content to that style..
Well my MSDN TV debut finally hit the airwaves. I teased you a while back when I told you that it was coming (I didn't realize that it took so long for these to make it to the site). I know you have been just trembling with anticipation, but tremble no more 'cause it here!
Y'know they tell you that you look 10 pounds heavier when you are on camera? Wow, how many cameras were on me anyway? (Okay, I know, I stole that from a Friends episode) Enjoy!
Hello!
I recently did an interview with Scott Swiggart on the subject of Crossbow and the article ended up on Dr. Dobbs, check it out:
I also did an MSDN TV segment, but it's not posted yet, but keep an eye out for it ()
Yikes, you mean the last time I posted something on my blog was on Halloween? Geez, I'm really sorry about that and I'll try to make it up to you...really I will. You see, there's a few reasons why I've been delinquent in blogland lately... One reason is that I just got too excited and posted too frequently and used up all my good material and then I really didn't have anything interesting to say. The other reason is simply just being busy with stuff...then there's the holidays...you know how it goes. But I'm back and I'll do my best to provide some useful content.
I'm already getting some ideas so stay tuned...
I received an email from Keeron today and he was experiencing some difficulties in hosting an ActiveX control in a WindowsFormsHost which was parented to a Canvas in a WPF application. His basic problem seemed to be that the control simply was not showing up in the WPF application at all. So what's up with that?
Let's start off by removing the ActiveX control from the equation since the issue isn't directly related to the ActiveX control, the issue exists for just standard Windows Forms controls as well. So let's assume we have a simply scenario where we want to host a Windows Forms button in a WPF application. Let's first consider hosting it in a Grid element then we will switch it to use a Canvas element.
The code behind would look something like:
private void WindowLoaded(object sender, RoutedEventArgs e){ WindowsFormsHost host = new WindowsFormsHost(); System.Windows.Forms.Button b = new System.Windows.Forms.Button(); b.Text = "WF Button"; host.Children.Add(b); this.grid1.Children.Add(host);}
Run the app and everything works just fine. But now lets change the Grid element to a Canvas element...
And change the code behind to reference the Canvas instead of the Grid:
private void WindowLoaded(object sender, RoutedEventArgs e){ WindowsFormsHost host = new WindowsFormsHost(); System.Windows.Forms.Button b = new System.Windows.Forms.Button(); b.Text = "WF Button"; host.Children.Add(b); this.canvas1.Children.Add(host);}
Run the app again and we don't see our button! What gives? Well, let's think about it just a second. Firstly, I neglected to indicate where in the canvas the button should go. Normally, you would do this is XAML as follows:
But I'm working in code so I need to figure out how to do this using C#... Well the Canvas.Top and Canvas.Left properties are actually "attached properties" in WPF parlance and to set these using code you would use the SetValue() method on the object in question and then provide the property and value:
private void WindowLoaded(object sender, RoutedEventArgs e){ WindowsFormsHost host = new WindowsFormsHost(); System.Windows.Forms.Button b = new System.Windows.Forms.Button(); b.Text = "WF Button"; host.Children.Add(b); host.SetValue(Canvas.TopProperty, 5.0); host.SetValue(Canvas.LeftProperty, 5.0); this.canvas1.Children.Add(host);}
Cool, that should do it right? Let's give it a whirl... Doh! Still didn't work! Why not? Well, the issue is related to how the WPF layout engine works. The problem is that since we did not explicitly set the size of the WindowsFormsHost control, the layout engine thinks that it has a size of 0 and therefore does not layout the control properly. To fix this, we just need to give the WindowsFormsHost control an explicit size:
private void WindowLoaded(object sender, RoutedEventArgs e){ WindowsFormsHost host = new WindowsFormsHost(); host.Height = 100; host.Width = 300; System.Windows.Forms.Button b = new System.Windows.Forms.Button(); b.Text = "WF Button"; host.Children.Add(b); host.SetValue(Canvas.TopProperty, 5.0); host.SetValue(Canvas.LeftProperty, 5.0); this.canvas1.Children.Add(host);}
Now when we re-run the application, we will see our button. | http://blogs.msdn.com/mhendersblog/ | crawl-002 | refinedweb | 3,380 | 72.26 |
DFS, Folder Redirection and Offline Files...
- From: Gord Armstrong <GordArmstrong@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Jun 2007 20:52:01 -0700
Hello to all...
We have a Windows 2003 domain, two w2k3 SP1 DCs, and my file server is w2k3
R2 SP1 Ent. All of our client machines are Windows XP SP2.
We performed a Root Consolidation via the File Server Migration Utility and
Root Consolidation wizard. I also have a Domain based DFS namespace.
We performed the Root Consolidation for legacy reasons. Namely a ton of
linked files on the old file server, as well as we didn't want to deal with
the fun of moving users' home directories which included thier redirected My
Documents and then having the client side caches go nuts.
Our users have two mapped drives which point to DFS paths in the stand
alone, consolidated, root. (\\retiredservername\share1 and
\\retiredservername\share2\username)
We use the Folder Redirection GPO to send the contents of clients' My
Documents folder to \\retiredservername\share2\username\my documents.
The My Documents folders have been allowed to be made available offline as
the vast majority of our users are laptop based.
That's the windup, here's the pitch.
Since the Root Consolidation, and the creation of the Domain Based
Namespace, we've had an issue where if laptop users, disconnect thier CAT5
cable, pick up thier laptop and walk into a meeting room, reconnect....and
POW...they cannot access either of thier two mapped drives or thier My
Documents folder.
The only way to get the access back is to reboot, a log off/log on won't do
it.
We've seen a number of kb articles around this which mainly pertain to the
combo of DFS, Folder Redirection and Offline files being unsupported in
Windows 2000, but as we are completely Windows 2003, and the file server is
R2 Enterprise to support the multiple roots, we are concerned.
We have found if we take Offline Files out of the equation, by clicking on
the 'caching' button in the share tab of the target folders, and removing the
default selection of 'allow users to make files available offline' and set it
to 'not available offline', we notice a vast improvement in the mapped drive
disconnection issue.
Of course, this solves one issue but cripples our laptop users as now they
still get thier My Documents folders redirected, but now the content is not
available when they are away from the Domain. The 'make available offline'
and 'synchronize' options are now removed from the folder. Going into
Explorer, folder options, synchronize, yields little results as users just
get informed there are no selections available for synchronization.
Has anyone else out there come across this and solved it? I suppose i could
apply SP2 to the file server and see if by some luck it helps.
Thoughts, comments, ideas?
Thanks.
G.
.
- Prev by Date: Random File Selection Software
- Next by Date: Very poor performance after upgrade to Win2K3
- Previous by thread: Random File Selection Software
- Next by thread: Very poor performance after upgrade to Win2K3
- Index(es): | http://www.tech-archive.net/Archive/Windows/microsoft.public.windows.file_system/2007-06/msg00061.html | crawl-002 | refinedweb | 517 | 58.82 |
You can subscribe to this list here.
Showing
5
results of 5
I was wondering about that as well. I've been fooling around with Android to
get an idea what it is and if there is a way to avoid having to write Java
when developing applications for it. The answer for this moment is 'no'.
Although they use their own class libraries (similar to but different from
SUN's), the Dalvik virtual machine and a bytecode fomat that differs from
SUN's, they still stick to the Java syntax. And that is a bit disappointing
in my eyes. Why not support a host of dynamic languages on top of the VM
from the start? That would greatly increase the chances of Android if you
ask me. Anyway, since Java (at least the syntax) is the only programming
language on Android the only possible alternative, from Python's
perspective, would be Jython. I know close to nothing about how Jython works
internally (pointers welcome) and couldn't tell you if Jython can as easily
be inplemented on top of Android's custom class libraries / the Dalvik VM.
If it could, I'm sure it would create a killer environment for developers of
mobile applications. Anybody here that can shed some light on this?
2B
On 11/16/07, Beyonlo Beyonlo <beyonlo@...> wrote:
>
> Hey all, Jython run fine on android ?
> If not, are there a effort to do that works ?
>
> Thanks,
>
> Beyonlo
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
>
> _______________________________________________
> Jython-users mailing list
> Jython-users@...
>
>
Not sure if anyone ever solved this problem
and posted it to the list.. But I just did.
The problem was posted to this list way back in
2004 and it involves using jythonc to deploy a
jar with jfreechart.
Something like:
jythonc -A org.jfree -d -j yourjar.jar myfile.py
When you try to call any jfree stuff it will crap out when run
as a standalone jar file, or a web start application.
The fix is that you NEED to include jcommon in the classpath (or jar
class-path, or as a href in a webstart JNLP file). You might
even be able to include in the -A flag.. (haven't tried that yet).
I think this will probably hold for many external java libraries that
require other dependent jars when deploying byte code compiled jython,
even if the external jar is compiled with the other one.. e.g.
(jfree is supposedly compiled with jcommon in it).
I am not sure why jython can't load it, before, I would get some
static constructor initializer exceptions.. which lead me to
believe that the referenced classes couldn't be found or are not
loaded properly.. (might not be a jython issue).
Hope this helps,
Simon
Hey all, Jython run fine on android ?
If not, are there a effort to do that works ?
Thanks,
Beyonlo
Modules don't inherit the namespace of those that import
them. If you name the interpreter locals namespace, say
'__main__', then your module could do this
from __main__ import DrawMediator
To name the namespace, create your interpreter like
this:
_interp = new PythonInterpreter();
PyModule mod = imp.addModule("__main__");
_interp.setLocals(mod.__dict__);
_interp.set("DrawMediator", drawMediator);
_interp.exec("import header");
Wouter Deketelaere wrote:
> Hi,
>
> why can't I access an Java Object during the import of a module.
>
> In Java, I have:
>
> DrawMediator drawMediator = new DrawMediator();
> PythonInterpreter interp = new PythonInterpreter();
> interp.set("DrawMediator", drawMediator);
>
> I have a module called header.py which has to be imported, but I can't
> reference the DrawMediator object during that import process. I get:
> "NameError: DrawMediator"
>
> I CAN however reference the DrawMediator object once header.py (or any
> other module for that matter) is processed (in that case offcourse I
> have to adapt header.py first so it gets imported without errors)
>
> The same is true for a simple String that I want to reference during the
> module load phase.
>
> What am I doing wrong ?
> Kind regards,
> Wouter
>
>
>
> -------------------------------------------------------------------------
>@...
>
I originally sent this to the jruby list, but did not get any solutions. Ha=
s anyone on this side of things had success running jruby inside jython for=
running ruby unit tests?
(I tried to search the archives, but it wasn't working...) I'm trying to us=
e JRuby in Jython via the JSR-233 engine. The ruby script is a Test::Unit::=
TestCase originating one and runs from the command line using the regular r=
uby interpreter. When I try to run it from it from inside my script however=
, things get ugly. I'm rather confused as to why it is blowing up in the wa=
y it is, but realize that it might be something trivial to make it work and=
having hit the 'spent enough time not figuring it out' its off to the mail=
ing list. So can anyone shed light into the origin of the backtrace or have=
solved this problem a different way? Note: r.eval('puts "Hello!"') works f=
ine, it is just when I pass in this script that it does not work. Thanks. -=
adam <ruby>require 'test/unit'class ExampleTest < Tes=
t::Unit::TestCase def test_something p "ruby!" end def test=
_another p "again!" endend</ruby> <jython>import javax.script.Scr=
iptContextimport javax.script.ScriptEngineimport javax.script.ScriptEngineM=
anagerimport javax.script.ScriptException m =3D javax.script.ScriptEngineMa=
nager()r =3D m.getEngineByName("jruby")rs =3D open(f, "r")y =3D r.eval(rs.r=
ead())rs.close()</jython> <ugliness>Traceback (innermost last): File "jpyt=
honruby.py", line 48, in ?C:/temp/jpythonruby/jruby-1.0.2/lib/ruby/1.8/test=
/unit/autorunner.rb:59: private method `sub' called for nil:NilClass (NoMet=
hodError) from C:/temp/jpythonruby/jruby-1.0.2/lib/ruby/1.8/test/uni=
t.rb:2:in `call' from C:/temp/jpythonruby/jruby-1.0.2/lib/ruby/1.8/t=
est/unit/autorunner.rb:198:in `run' from C:/temp/jpythonruby/jruby-1=
.0.2/lib/ruby/1.8/test/unit/autorunner.rb:13:in `run' from C:/temp/j=
pythonruby/jruby-1.0.2/lib/ruby/1.8/test/unit.rb:278 from <unknown>:=
1 ...internal jruby stack elided... from org.jruby.runtime.Bl=
ock.yield(Block.java:260) from org.jruby.runtime.Block.call(Block.ja=
va:214) from org.jruby.RubyProc.call(RubyProc.java:169) from =
org.jruby.RubyProc.call(RubyProc.java:148) from org.jruby.Ruby.tearD=
own(Ruby.java:1447) from org.jruby.javasupport.JavaEmbedUtils.termin=
ate(JavaEmbedUtils.java:66) from com.sun.script.jruby.JRubyScriptEng=
ine.evalNode(JRubyScriptEngine.java:396) from com.sun.script.jruby.J=
RubyScriptEngine.eval(JRubyScriptEngine.java:139) from javax.script.=
AbstractScriptEngine.eval(AbstractScriptEngine.java:247) from sun.re=
flect.NativeMethodAccessorImpl.invoke0(Native Method) from sun.refle=
ct.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) =
from sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces=
sorImpl.java:25) from java.lang.reflect.Method.invoke(Method.java:59=
7) from org.python.core.PyReflectedFunction.__call__(Unknown Source)=
from org.python.core.PyMethod.__call__(Unknown Source) from =
org.python.core.PyObject.__call__(Unknown Source) from org.python.co=
re.PyInstance.invoke(Unknown Source) from org.python.pycode._pyx0.f$=
0(jpythonruby.py:48) from org.python.pycode._pyx0.call_function(jpyt=
honruby.py) from org.python.core.PyTableCode.call(Unknown Source) =
from org.python.core.PyCode.call(Unknown Source) from org.pytho=
n.core.Py.runCode(Unknown Source) from org.python.core.__builtin__.e=
xecfile_flags(Unknown Source) from org.python.util.PythonInterpreter=
.execfile(Unknown Source) from org.python.util.jython.main(Unknown S=
ource)org.jruby.exceptions.RaiseException: org.jruby.exceptions.RaiseExcept=
ion</ugliness>
Are you ready for Windows Live Messenger Beta 8.5 ? Get the latest for free=
today!=20
_________________________________________________________________
Have fun while connecting on Messenger! Click here to learn more. | http://sourceforge.net/p/jython/mailman/jython-users/?viewmonth=200711&viewday=16 | CC-MAIN-2016-07 | refinedweb | 1,305 | 52.97 |
Matplotlib: custom projection for hemisphere / wedge
I am looking at custom projection in matplotlib gallery - I am trying to change it should only plot the southern hemisphere. I adjusted the required [-pi / 2, pi / 2] limits to [-pi / 2.0]. Now I am looking at:
def _gen_axes_patch(self): """ Override this method to define the shape that is used for the background of the plot. It should be a subclass of Patch. In this case, it is a Circle (that may be warped by the axes transform into an ellipse). Any data and gridlines will be clipped to this shape. """ #return Circle((0.5, 0.5), 0.5) return Wedge((0.5,0.5), 0.5, 180, 360) def _gen_axes_spines(self): return {'custom_hammer':mspines.Spine.circular_spine(self, (0.5, 0.5), 0.25)}
As you can see, I replaced the Circle patch with a wedge. This is what the projection plot looks like now:
The spine still follows the circle / ellipse - how can I indicate that I want the spine to follow the wedge border?
I'm not sure what is the best way to change the spine, so any help would be much appreciated!
Thank,
Alex
source to share
Just for the record, you are sure to jump straight to the deep end of the pool if you are still new to python. (And you, luckily, right now!)
What you are doing requires a fairly detailed knowledge of the inner workings of matplotlib, which is a fairly complex library.
That being said, this is a good way to learn quickly!
For something like this, you need to understand the internal architecture of how things are structured, not just "public" apis.
For most of this, you need to dig in and "source". For any project, the internal processing documentation is the code itself.
That was said, for a simple case, it's pretty straight forward.
import numpy as np from matplotlib.projections.geo import HammerAxes import matplotlib.projections as mprojections from matplotlib.axes import Axes from matplotlib.patches import Wedge import matplotlib.spines as mspines class LowerHammerAxes(HammerAxes): name = 'lower_hammer' def cla(self): HammerAxes.cla(self) Axes.set_xlim(self, -np.pi, np.pi) Axes.set_ylim(self, -np.pi / 2.0, 0) def _gen_axes_patch(self): return Wedge((0.5, 0.5), 0.5, 180, 360) def _gen_axes_spines(self): path = Wedge((0, 0), 1.0, 180, 360).get_path() spine = mspines.Spine(self, 'circle', path) spine.set_patch_circle((0.5, 0.5), 0.5) return {'wedge':spine} mprojections.register_projection(LowerHammerAxes) if __name__ == '__main__': import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111, projection='lower_hammer') ax.grid(True) plt.show()
Dig in the method a bit
_get_axes_spines
:
def _gen_axes_spines(self): """Return the spines for the axes.""" # Make the path for the spines # We need the path, rather than the patch, thus the "get_path()" # The path is expected to be centered at 0,0, with radius of 1 # It will be transformed by `Spine` when we initialize it path = Wedge((0, 0), 1.0, 180, 360).get_path() # We can fake a "wedge" spine without subclassing `Spine` by initializing # it as a circular spine with the wedge path. spine = mspines.Spine(self, 'circle', path) # This sets some attributes of the patch object. In this particular # case, what it sets happens to be approriate for our "wedge spine" spine.set_patch_circle((0.5, 0.5), 0.5) # Spines in matplotlib are handled in a dict (normally, you'd have top, # left, right, and bottom, instead of just wedge). The name is arbitrary return {'wedge':spine}
Now there are several problems with this:
- Things are not centered within the axis correctly
- The axes patch can be scaled a little more to properly tackle the room within the axes.
- We draw the grid lines for the full globe and then crop them. It would be more efficient to just draw them inside our "bottom" wedge.
However, when we look at the structure
HammerAxes
, you will notice that many things (especially centering the axis patch) are effectively hard-coded in the transforms. (As they note in the comments, this means a "toy" example, and, assuming you're always dealing with a full globe, makes the math in transformations much easier.)
If you want to fix this, you will need to configure several different transforms in
HammerAxes._set_lim_and_transforms
.
However, it works well enough as it is, so I'll leave this as an exercise for the reader. :) (Be careful, this part is a little more complicated, as it requires detailed knowledge of matplotlib transforms.)
source to share | https://daily-blog.netlify.app/questions/1891945/index.html | CC-MAIN-2021-21 | refinedweb | 756 | 66.54 |
Subject: Re: [boost] libraries affected by common factor gcd and lcmnamespace change moving from math to integer library
From: Peter Dimov (lists_at_[hidden])
Date: 2015-01-30 10:26:13
Paul A. Bristow wrote:
> I was just suggesting authors of libraries that use gcd or lcm might like
> to make a very small change to use the Boost.Integer library instead of
> Boost.Math (if they haven't already)?
Vicente's point was that most of the libraries in your list have already
been changed to use Integer.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk | https://lists.boost.org/Archives/boost/2015/01/219755.php | CC-MAIN-2020-45 | refinedweb | 110 | 77.64 |
I was toying around with rendering a set of frames from a Python script:
----------------------------------------------------
t_shutdown.py
----------------------------------------------------
import bpy
scene = bpy.context.scene
render = scene.render
render.resolution_x = 960
render.resolution_y = 540
render.resolution_percentage = 100
render.image_settings.file_format = 'PNG'
for frame in [1, 4, 6]:
scene.frame_current = frame
render.filepath = '/tmp/doh%04d.png' % frame
bpy.ops.render.render(write_still=True, animation=False)
----------------------------------------------------
When I run this script with blender -b -P ./t_shutdown.py the rendering
sometimes hangs at exit, sometimes segfaults at exit and sometimes succeeds.
I tried to get some stacktraces, seems to be something to do with shutdown
and unloading NVidia libraries:
Hang (stack trace from gdb -p <pid>):
(gdb) bt
#0 0x00007f44f1754c21 in _nv012tls ()
from /usr/lib/tls/libnvidia-tls.so.285.05.09
#1 0x00007f44f72bce33 in ?? () from /usr/lib/libGL.so.1
#2 0x00007f44f729c379 in ?? () from /usr/lib/libGL.so.1
#3 0x00007f44f753c3ec in _dl_fini () at dl-fini.c:248
#4 0x00007f44f2038262 in __run_exit_handlers (status=0) at exit.c:78
#5 *__GI_exit (status=0) at exit.c:100
#6 0x00000000007f9478 in WM_exit (C=<value optimized out>)
at /home/paulmlocal/c/blender-svn/source/blender/windowmanager/intern/wm_init_exit.c:463
#7 0x00000000007eefb8 in main (argc=4, argv=0x7fffef4d41f8)
at /home/paulmlocal/c/blender-svn/source/creator/creator.c:1247
Crash:
(gdb) bt
#0 0x00007f0011181a08 in _nv007tls () from /usr/lib/tls/libnvidia-tls.so.285.05.09
#1 0x00007f0015c9ea61 in __nptl_deallocate_tsd (arg=<value optimized out>) at pthread_create.c:155
#2 start_thread (arg=<value optimized out>) at pthread_create.c:307
#3 0x00007f0011b1270d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4 0x0000000000000000 in ?? ()
Blender info:
Blender 2.60 (sub 5)
build date: 2011-11-24
build time: 13:16:12
build revision: 42122
build platform: Linux
build type: RelWithDebInfo
build c flags: -fopenmp -msse2 -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -Wall -Wcast-align -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type -Wstrict-prototypes -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith -Wunused-parameter -Wwrite-strings
build c++ flags: -D__STDC_CONSTANT_MACROS -fopenmp -msse2 -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -Wall -Wno-invalid-offsetof -Wno-sign-compare
build link flags: -pthread
build system: CMake
I see this behaviour on an Ubuntu 10.04, x86_64 system with NVidia 285.05.09 drivers. Tried with newer drivers, 290.10, but same problem.
This might be a driver issue, as I don't see this happening on a different system, which has NVidia 260.19.26 drivers.
- Assigned To
- None
- Priority
- Low
- Author
- paulmelis (Paul Melis)
- Subscribers
- None
- Projects
- Type
- OpenGL Error
I was toying around with rendering a set of frames from a Python script:
Seems to be a driver bug, i.e. see
Setting __GL_SINGLE_THREADED=1 seems to work as a work-around for me (got that one from)
Indeed there's posts about this bug crashing various applications. NVidia supposedly fixed an issue with this in 285.05.09, but maybe it only works when you have a newer X.org version. Moving to the OpenGL errors tracker, this is not something we can solve in Blender. | https://developer.blender.org/T29385 | CC-MAIN-2015-22 | refinedweb | 515 | 52.05 |
Standard C Library (libc, -lc)
#include <unistd.h>
int
usleep(useconds_t microseconds);
The usleep() function suspends execution of the calling thread until
either microseconds microseconds have elapsed or a signal is delivered to
the thread and its action is to invoke a signal-catching function or to
terminate the thread or process. The actual time slept may be longer,
due to system latencies and possible limitations in the timer resolution
of the hardware.
This function is implemented using nanosleep(2) by pausing for
microseconds microseconds or until a signal occurs. Consequently, in
this implementation, sleeping has no effect on the state of process
timers, and there is no special handling for SIGALRM.
The usleep() function returns the value 0 if successful; otherwise the
value -1 is returned and the global variable errno is set to indicate the
error.
The usleep() function will fail if:
[EINTR] A signal was delivered to the process and its action
was to invoke a signal-catching function.
nanosleep(2), sleep(3)
The usleep() function appeared in 4.3BSD.
BSD February 13, 1998 BSD | http://www.syzdek.net/~syzdek/docs/man/.shtml/man3/usleep.3.html | crawl-003 | refinedweb | 178 | 52.29 |
Rich Baum wrote:-> This patch should fix the rest of the warnings about #endif > statements when using the 20001225 gcc snapshot. Thanks to > Keith Owens for providing a script to automate this process. It got > the job done sooner and found warnings to fix for non x86 platforms.Unfortunately, the script also gets stuff it shouldn't, and in somecases adds comments within the comments, probably causing stuff tostop compiling altogether. Some examples below.Neil.> +# endif /* # */[....]> * appropriate for an 030 or an 040. This is useful for debugging purposes> - * and as such is enclosed in #ifdef MMU_PRINT/#endif clauses.> + * and as such is enclosed in #ifdef MMU_PRINT/#endif /* clauses. */> *[...]> * is specifically for debugging and can be very useful. It is surrounded by> - * #ifdef CONSOLE/#endif clauses so it doesn't have to ship in known-good> + * #ifdef CONSOLE/#endif /* clauses so it doesn't have to ship in known-good */-To unsubscribe from this list: send the line "unsubscribe linux-kernel" inthe body of a message to majordomo@vger.kernel.orgPlease read the FAQ at | https://lkml.org/lkml/2001/1/7/197 | CC-MAIN-2019-18 | refinedweb | 175 | 65.22 |
the annoying thing about JavaFX is that many basic operations have to be done by yourself. By default, entering carriage return in TextArea will lead to line feed, but in many scenarios, we want it to trigger the sending of information instead of line feed when the user enters carriage return. Line feed is triggered by the combination of Ctrl+Enter. In JavaFX, there is no simple and direct method for this function, which is not the case in all UI languages, but JavaFX does not provide a direct API. After stepping on the pit, the author finally realized this function in JavaFX.
The implemented algorithm is roughly as follows:
Use the processor onKeyPressed of TextArea to listen for keyboard input events of TextArea.
If the user inputs a carriage return, make the following judgment:
If the user does not enter the key combination CTRL+ENTER, remove the line break just entered, and then send the text. At this time, you can choose whether to empty the contents of the text box or keep the contents of the text box unchanged. Then the algorithm ends.
If the user enters the key combination CTRL+ENTER, insert a line break at the cursor, and then move the cursor after the line break. Then the algorithm ends.
If the user does not enter enter and does nothing, the algorithm ends.
The main precautions are as follows:
The range of the text box cursor is [0, length]. Because the cursor points to the gap in the text, and the number of gaps is 1 more than the text.
The callback method of the processor onKeyPressed is triggered immediately after the user presses the key (before it is released).
TextArea does not consider the combined keys entered as the sum of the effects of these keys in turn. This means that when you Enter after pressing but not releasing the Ctrl key, the text you Enter will not contain line breaks, because TextArea does not think you are entering Enter at this time. However, if you press (do not release) a and Enter in turn, the text entered is a\n.
In the callback method of onKeyPressed, when the user enters an ordinary key, the cursor position is the position before the character is entered (the character just entered has not yet taken effect in the text box). If the user enters a special key (such as Ctrl, Alt, Enter, etc.), the position of the cursor is the position of the cursor after the key takes effect. In addition,. This means that if you Enter enter, when the onKeyPressed callback method is triggered, the text box contains not only a newline character, but also the cursor after the newline character.
When splicing the text on both sides of the cursor, the cursor position and text content of Enter and CTRL+ENTER are different. For Enter, you need to clear the line break, and the entered line break is to the left of the cursor. For the key combination CTRL+ENTER, not only insert a line break, but also move the cursor to the right.
Windows interprets carriage return as \ n\r, but TextArea clears all \ r in the text. In other words, when you enter enter in windows, you actually enter \ n\r. However, when you enter \ n\r into TextArea, TextArea will remove all \ R. The string obtained from TextArea will not contain any \ R \ n.
The core code is as follows: (code of FXML and FXML controller)
TextSend.fxml
<?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.layout.VBox?> <?import javafx.scene.control.TextArea?> <?import javafx.scene.control.Button?> <?import javafx.geometry.Insets?> <VBox alignment="CENTER" spacing="20.0" xmlns: <padding> <Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/> </padding> <TextArea prefHeight="200" prefWidth="200" fx: <Button onAction="#Onactionbutton "text =" send "/ > </VBox>
TextSendController.java
package org.wangpai.demo.textsend; import javafx.fxml.FXML; import javafx.event.ActionEvent; import javafx.scene.control.TextArea; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; public class TextSendController { @FXML private TextArea textArea; @FXML public void onKeyPressedTextArea(KeyEvent keyEvent) { // If the Enter key is pressed if (keyEvent.getCode() == KeyCode.ENTER) { // Get the cursor position at this time. This position is after the line break just entered var caretPosition = this.textArea.getCaretPosition(); // If the key you have pressed contains the Control key if (!keyEvent.isControlDown()) { // If the key combination CTRL+ENTER is not entered, remove the newline character, and then send the text // Gets the input text that contains the newline character you just entered var text = this.textArea.getText(); // Gets the text on both sides of the newline character var front = text.substring(0, caretPosition - 1); var end = text.substring(caretPosition); this.textArea.setText(front + end); this.onActionButton(null); // Analog transmission /*----- If you want to keep the input box text after sending, you need to use only the following line of code, and then remove the code that clears the text box-------*/ // this.textArea.positionCaret(caretPosition - 1); } else { // Gets the input text that does not contain the newline character you just entered var text = this.textArea.getText(); // Gets the text on both sides of the cursor var front = text.substring(0, caretPosition); var end = text.substring(caretPosition); // Inserts a line break at the cursor this.textArea.setText(front + System.lineSeparator() + end); // Move cursor to newline this.textArea.positionCaret(caretPosition + 1); } } } /** * Analog transmission method */ @FXML public void onActionButton(ActionEvent event) { System.out.println("Sending message..."); System.out.println(this.textArea.getText()); this.textArea.requestFocus(); /*----- If you want to clear the input box text after sending, use the following line of code-------*/ this.textArea.clear(); } }
The screenshot of the sample program is as follows:
The author's operating environment:
JDK 17.0.1
JavaFX 17.0.1
IntelliJ IDEA 2021.2.2 (Ultimate Edition) | https://programmer.help/blogs/619d5213644ee.html | CC-MAIN-2022-21 | refinedweb | 972 | 56.66 |
scandir()
Scan a directory
Synopsis:
#include <sys/types.h> #include <sys/dir.h> int scandir( char * dirname, struct direct * (* namelist[]), int (*select)(struct dirent *), int (*compar)(const void *,const void *) );
Since:
BlackBerry 10.0.0
Arguments:
- dirname
- The name of the directory that you want to scan.
- namelist
- A pointer to a location where scandir() can store a pointer to the array of directory entries (of type struct direct *) that it builds.
- A pointer to a user-supplied subroutine that scandir() calls to select which entries to included in the array. The select routine is passed a pointer to a directory entry (a struct dirent ).
This function is in libc.a, but not in libc.so (in order to save space)..
Don't confuse the direct and dirent structures:
- The entries in the array are pointers to direct structures.
- The argument to the select function is a pointer to a dirent structure.
- The arguments to the compar() function are used as pointers to direct structures.
The struct direct is defined as:
struct direct { unsigned long d_fileno; unsigned short d_reclen; unsigned short d_namlen; char d_name:
Last modified: 2014-06-24
Got questions about leaving a comment? Get answers from our Disqus FAQ.comments powered by Disqus | http://developer.blackberry.com/native/reference/core/com.qnx.doc.neutrino.lib_ref/topic/s/scandir.html | CC-MAIN-2014-42 | refinedweb | 205 | 67.86 |
Linux Mint 7, based on Ubuntu 9.04 “Jaunty Jackalope”, and planned to be released in May 2009, will be codenamed “Gloria”.
Question to Linux Mint users: In Mint 6, mintMenu was labeled “Menu” instead of getting the traditional release codename (“Felicia”). Do you think it should remain “Menu” in future releases or would you prefer us to use the codenames again?
Edit: Thanks for all your comments. It looks like the right thing to do is to name the menu “Menu” but to also have a tooltip on it showing not only the codename but also the version and edition of Linux Mint. Since the text is easily configurable I don’t want to add that choice to mintAssistant. I released an upgrade in Romeo for mintMenu to show that information in the tooltip.
Well, if I remember correctly, “Menu” was adopted to make mintMenu more appealing to other distributions. I still think that’s a good idea, but if the change is easy, I’d rather see the codename in Mint. Especially “Gloria” – awesome word to decorate the menu (glorious).
I think the menu should be just an icon, with no text.
_
I think you should leave it at menu, people would know what distro they install on their own computer. And if it means just a little bit less coding you guys have to do, then all the better.
Mik
“Menu” or “start” or anything along those lines sounds better when referring to it with someone else.
I agree with Bubba, I prefer the codename in the Mint release.
I second that — Mint sounds good.
Also, please please please, post full content to RSS feeds. Non full content are EVIL. And you’re not EVIL, are you? 🙂
I’d go with “Menu”. It ‘remove’ the confusion between the differents codenames on the new users (or newbies, or average user).
Fantastic Felicia was an awesome release. Really looking forward to Great Gloria 😉 .
As for mintMenu, what if mintmenu defaulted to “Menu”, but then “mintdesktop” switched it to the distribution name on install? Either one works for me. To be honest, I’ve been removing the menu text in there and just having the Linux Mint graphic to save taskbar space. KDE does the same, they don’t have any text beside the menu graphic….
please change the network manager with the quick resolving speed
I think “Menu” is much better. It provides a level of consistency, professionalism, and ease of use. When, for example, I need to walk my father (an extreme newbie) through a process over the phone, it’s a lot easier to train him that that is the “Menu” button to get to his menu, rather than having it change names on him every time we upgrade his OS. “Menu” explains what the button does so newbies don’t have to guess “What does the Felicia button do?” If the goal is winning over Windows users and newbies, “Menu” is much friendlier to help get them going. I realize that for us, the computer literate, this may seem trivial and takes all of 5 seconds to change, but newbies may not always have someone available to help them with these things. So I think defaulting to the simplest option is best, and those of us who prefer the codename instead will know how to change it.
Thank you so much for all your hard work! All the best.
I don’t care.
John
Make it the codename. Menu is too generic. We like unique
Stay with menu, it adds simplicity and removes confusion
def stay with menu. makes it easier to know what it is.
i think menu will be much better.. since we are mostly targetting the first time users.. it avoids a lot of confusion
Gloria is a great name for Mint7!!
for MintMenu, I prefer the Distro Code Name, but I understand the arguments to keep Menu as name.
My Idea is to add an 3-point-Option in mintAssistant to make the Choice of the name:
-Distro-Code-Name
-or place free to type a own Name
Why mintAssistant? because it run directly on the first boot of LinuxMint (and it can be consider as new feature in Mint 7)
Please just leave it menu. Just keep it simple.
I liked “Menu” as the text better than the codename; I think it looked more professional as well as more appealing to new and potential users.
But I also think “Mint”, “LinuxMint”, or just plain “MintMenu” would look nice too.
I really like the idea of giving choices for the menu text in mintAssistant!
For me prefer the word “Menu” coz it makes it look more like the menu.. Its more simple and straight forward rather than the codename itself.. The codename could be placed somewhere else.. I dont think it should be shown in the taskbar itself..
Definitely leave it as “menu”.
I’d vote for “menu” too, using codename may be a bit confusing.
Definitely change back to code names.
Yep, codenames have been confusing my friends, since most of them are windoze users.
Stay with the Menu label.
I agree with Herman in comment 2 that it looks best with just the icon. However, from a usability standpoint, especially for newbies, I think “Menu” is best. It makes it obvious what the mintMenu is from the start, whereas when I first started using Linux Mint with Elyssa, I was a bit confused at first about what the button was all about.
Great work with Linux Mint, definitely the best out-of-the-box distribution I’ve seen thus far!
Menu. But if a more complex solution is alright, I prefer having a mintAssistant option for it.
Prefer codename. The first thing I changed in Felicia was renaming the menu to Felicia. Other distros can change it easily, and the codename is a part of the identity of the release.
Vote: “Menu”
I think just an icon would be the best!.
“Mint” sounds good.
Menu. “Start” would also work.
I liked what Logan said: MintMenu might be interesting… Otherwise just “Mint” works too…
And keep up the awesome work! We’re all really excited and we love Mint much! (I even got a shirt with it to “spread the love”.
Thanks Clem for the Name. 🙂
I had the same idea as knuckles.with the mintAssistant its nice to change it and with a mouse hoover that describe the menu like “MintMenu to start Aplications…” or so ? like the other progis in the panel.
i prefer the Distro name. 😉
I prefer MintMenu.
I think we should stick with Menu. A couple friends I have converted to Linux were confused with the names on the menu.
Menu or Mint or MintMenu is fine.
We can, after all, change it ourselves by right clicking the icon and choosing preferences then the main button tab…!! Can’t we..?? 😉
And I am sure you CLI giants can change it from the terminal too.
I for one don’t want a females name on the menu button (Don’t mean to sound sexist or anything) but having Gloria on the menu button aint gonna impress anyone I know who wants to make the switch to GNU/Linux.
Why try to ruin a very good Distro with a stupid code name on the button.
just start a poll about that…
Personally, I prefer the codename. Just “menu” looks equal to any graphic interface or any operating system. The codename would be more peronal.
Hey folks! I would also stick with the simple Menu label. Your codename could certainly be shown somewhere else in boot screen, boot sequence or default wallpapers. I’m sure everyone would get the message its Gloria.
Menu is more conventional and user friendly, less confusing as some have already mentioned. Although, permitting to choose either one or the other would also be fine.
“Menu” makes more sense. I never saw the point in calling the menu by the distro code name… It doesn’t belong there.
Stay with “Menu”, this is definitely the mature choice… Release name is too geeky for the general public, it doesn’t mean anything for non-geeks… “Menu” is the only way to go… It really says what it is…
An icon (without any text) would have been nice, but it is still not as straight-forward as “Menu”…
I like having the name on the button … reminds me of what the heck I’m using LOL
No seriously … I’m for real. I like the name.
It is very EASY to change it to your own preferends…but I like the codename. So, in Mint 6 I changed it promptly from menu to Felicia.
I always rename it to “Linux”. 🙂
Menu is fine….but I like the option that is available by right clicking ‘menu’ and choosing ‘preferences and changing the name so instead of ‘Elyssa’ it brings up the name “Glynnux” instead of menu which makes me look dead posh. 🙂
So menu as default with the option still available…very sorted! ..a nice option.
I myself always switch mine to having only an icon & no text, however I feel that for new users ‘Menu” would be the best as it does save them from confusion. I have had a few friends say “Who is Elyssia?”, & “why is this woman’s name on my Operating system/Computer?” So then I told them, & they said “well I don’t like it, is there anyway I can change it? Because if I cannot I do not want this on my computer.” Then I told them how to change it & they was happy & they changed it to just the icon or to their own name. So when Falcia changed it to ‘Menu” I was very happy & none of my friends complained about that one. So yes keep it as ‘Menu’ it apparently is a deal breaker for some new users.
Also I wanted to mention that Gloria is my mother’s name 🙂 She is going to be very excited about having a Linux distro’s version codename being the same as hers, though she prefers KDE desktops :p .
I have changed “menu” with “Felicia” immediately!
I’d second the proposal to let the user decide in mintAssistant.
Put the release name. Differentiates(sic) you from the rest. Awsum distro by the way!
oh, “menu” is such a neutral, boring word. “felicia” just makes me feel cooler. …or to put it in minty words, more elegant.
I run a multiboot system, including Elyssia and Felicia distros and sometimes also Linux Mint community editions as well. labelling the menu button explicitly helps in distinguishing which Linux Mint I’m running, and “humanises” Linux Mint as well. The placement of the menu button at the bottom left of the display should implicitly attract uninformed users to just select it at the beginning.
I am new Linux convert and Linux Mint 6 adopter (as in yesterday) which is basis for my opinion: I prefer leaving it as “Menu” with the icon next to it by default. It really makes it easier and less confusing for new people to navigate around. If it’s also easy for the user to relabel to their own tastes, all the more better.
I use 6 computers with Mint. Some have Nvidia GForce2Ti garphic cards and 3D runs smoothly with Mint 5 but i’m unable to get 3D working with Mint 6.
So some computers run Elyssa and others Felicia.
It’s very usefull to know wich version is installed on each computer.
If you decide to keep the Menu button you should let an icon with the code name.
Thanks for the job.
I like the idea of giving the user a choice in mintAssistant. But might I also suggest labeling it ‘Mint’ as another alternative. Thats what I changed mine to. It fits the Distro not just the release. And I don’t think new users would be overly confused. After all, most people who have used a computer are familiar with having an icon in the bottom-left where they Start all their programs. So I don’t think its NECESSARY to label it Menu, but you could go ahead and offer anyways.
P.S. I just started using LinuxMint the other day, and I love it. I will be recommending it to new users interested in checking out linux. Thanks guys.
How about set it to the computer’s network name, or give some options during install on what to name it.
I prefer version’s codename.
Add the option to choose in mintAssistant then it would be perfect for everyone
Far more professional if it’s called menu. Keep it simple – press the menu button and guess what – up pops the menu.
“Menu” works just fine…
I would like to have the option to decide through mintassistant (great idea). After installing Felicia, I removed the word “Menu” and left only the icon.
I vote to either include the option in mintAssistant or leave it as “Menu”, which looks professional and will not risk discouraging new users.
Menu is too plain. I like the idea of Gloria or just the LM icon. I teach two Linux courses at the local community college. I have my students download and install Mint onto their hard drives primary for the simplicity for winblows… excuse me, windows users. They have never asked me where the “start button” was. I don’t like the idea of calling it “Start” as adam and aircave suggested. It reminds me too much of MS. Ninety percent of the OS’s, Linux, Apple and MS have the “menu”, for lack of a better word, in the same place. People will understand what it is.
I like the codename as “Startbutton”. But as someone before said, maybe it’s too geeky for general public.
So personally, I would make a users-choice during install (with two previews of each startbutton or taskbar).
“Menu” is much better and stand for the MENU is
The codename as the menu text was much better imo. I feel it gave the distro some character. “Menu” is just too horribly bland and generic for my tastes.
I vote for “Mint”.
That’s what I always change mine to.
Linux Mint,
That is great that Jaunty is coming up. Just one note if I may.
Older monitors are not being recognized with the new tool being
used to recognize the monitors. Fairly modern one’s have no
problem. I have kept to Elyssa version and Hardy Heron because
of that fact for uniformity for all our computers at home and
at work.
I’d have the older Hardy Heron display tool available or make
sure the tool is better designed.
I would like to see the code name come back. The first time I loaded Mint I knew it was different in the first moments of use. Not Menu,or start but Daryna. And I have stuck with it ever since. It is for me the right distro and I like the different approach. Thanks for asking Mike
I miss the codename of the edition. Put Gloria there!
Menu is for restaurants. Call it Gloria and keep the option to change to Menu for those who so wish. I love it ! Thanks.
MINT in BOLD letters, or just a slightly larger Linux Mint logo should suffice.
Like “noharddrive” said, you only have to right click on the icon, go to preferences then the main button, and choose the name or words we want, or to have an icon or not.
codename plz
Just an icon would be enough. Maybe the icon for menu should be redesigned to make it stand out.
Menu – definitely. Why? Because that’s what it is… it’s a “MENU”. It isn’t a “GLORIA”.
Always label GUI items with dead-on accuracy. The menu button will probably be the very first interaction new users will have with Mint – so it’s not a good place to be cute. Those who prefer something different can change it in 2 seconds.
Branding can go on the wallpaper. GUI labels should always be as clear as it is possible to make them.
Doesn’t really matter to me as I can always change it. But I would like to see the Mint version and 32 or 64 bit somewhere on the menu.
Menu should remain as the default as Lisa points. For newbies is easier to understand what it does…. I prefer to have the release name but I can always change it. I guess all the others which prefer the name can do it themselves, contrary to the newbies which may not find that intuitive to change the name of the button.
I would leave it as menu, which perfectly describes what it is.
Stick with menu
My girlfriend once asked me who Elyssa was and why her name was on my computer.
Since it’s easy for the more advanced users to change it to what they prefer why not keep it simple for the “newbies”. Ans besides, less to explain to the girlfriend. 😉
Doesn’t really matter. Only takes a second to change anyway.
I like “Menu” The title is the function, very straightforward.
Menu or an Icon.
Menu or an Icon. Better yet maybe we can make it customisable.
Mint Menu; Mintu? It is a matter of taste; my personal hierarchy of solutions to this issue is as follows (with most preferred method at the top):
MENU — makes it easier for noobs
MINT — keeping it real with the branding
(icon) — understated and classy
MINTU — to coin a phrase which would merely evoke more chaos.
I have used Mint since Bea. I always change the Menu Button text, so I don’t personally care. “MENU” in all caps would be the user friendly and professional choice. The first thing my father asked me once I installed on his PC was how to get rid of the woman’s name on the Menu button.
Comment #10 above said it best, giving very valid reasons for her vote. Though I’m convinced the option to choose during installation is best, if that won’t be available I vote for “Menu.”
Using the codename as the label may be a nice sentimental touch for some of us, but serves little purpose beyond that. A menu labeled as “Menu” is professional and practical.
Thanks for a truly great Linux Distro.
“Menu” should be the default. It’s easy to change it if need be to suit one’s own taste.
Actually, “Mint” means “Lie” in Romanian – as in telling lies. I don’t know if “Menu” means anything bad in some language but it’s a generic name, it really means what it says and having one word throughout the versions is a good thing considering some of us also offer technical support and it’s easier to say: “Click the Menu button” rather than “Click the bottom-left button named Bianca or Daryna or Elyssa or Gloria”. 😛
“Start” is not a good name. It’s strage to click start to stop your PC, ain’t it?
If we’re talking about a graphical button without text we should consider something that can easily be described in a word or two, not more, also for technical support reasons. How would you describe Mint’s logo except for “the cute green thing”? Linut Mint has green stuff almost everywhere so it can get a little confusing.
So far I would go for the “Menu” version.
I originally argued in the forums for “Menu”; also being impartial with having “Mint” or “Gloria”. BUT People above have mentioned that its easy for newbies to understand “Menu”, some say its more professional. I respectfully disagree posed by comparing the following two situations.
Situation 1:
Command from Administrator: Click on Menu
Interpretations from newbie: Click on the LM Menu / The menu which I recently told you to click on (ie File Menu) / Taskbar (could be misinterpreted on exact differences on where Menu ends… the menu)
Situation 2:
Command from Administrator: Click on Gloria / Start ™ / LM leaf icon
Interpretations from newbie: Only the Actual menu which we are refering to. Not Rightclick menu, or file menu, or a list of files on your computer misinterpreted as a menu.
If you don’t get where I’m getting to, google “Disambiguation”
I would like to see “Mint Menu” as the default. Cheers!
i’d say, u make a poll Clem..and i’ll vote for the codename..
It should be nice if you have the word ‘Menu’ and when you move the mouse over it change to “codename” or maybe ‘Mint’.
I prefer “Mint”, and showing only the icon it’s a good idea.
Also, my girlfriend gets gealous if she sees a woman’s name at compute xD
i think only icon is best option..there is one theme in gnome-look naming glass..is best made menu button i m using that on my current mint..check out pls
I think you should leave it at menu, people would know what distro they install on their own computer
‘Menu’ might be better for newbies, but the release name is more original and unique. I think that might be a possible option to choose from mintAssistant.
I would prefer the code name, as its the only place thats always visible & highlights what you are running. Also it gives vlaue to the code name (As long as the code name is short).
I agree with “diego1188”, it may be a good iidea to put the option in the assistant, and the user choose his favorite.
In the oher side, Iĺl prefer only the buton o “Mint” in artwork
I like the codename, though I can see the arguments for menu and it is probably a better choice for newbies .I really like the idea of being given the choice in mintassistant
MintMenu is the clearest and best for every new Mint distro, i thing. By the way, you made well by fixing the “Filter” in MintMenu
My vote: Use “Menu” as the default, but offer the codename as an option to switch to. (It’s already been suggested, but I thought I’d add my agreement….)
I understand both sides of this, but I agree that menu/programs/start will be more familiar to new users, I like the idea of having a choice in mint assistant, but I would really like to see the button redisigned with changable text intigrated into the button rather than next to the button.
I prefer the codename (dare to be different, and it also helps me remember which version of Mint I’m running on each machine), but a choice would be good. In Bianca it was fairly easy to rename it to anything you wanted, which was nice.
I also liked the start-up screen in Bianca better than any other version.
I like a little individuality between releases. Even if it is something as small as a little label. JMO
I rather like the codename but I can also see why many would prefer it to be descriptive of what the button is for. The only extra reason I can think of for using the codename is that it makes it easy to find out which version the newbie at the other end of the phone line is using.
I prefer the version name instead of menu
I like the idea of asking the user to choose in mintAssistant.
distro name
custom name
otherwise, I think the idea of making “Menu” the default label is good for newbies, but it should be more unique to Mint, “like MintMenu” or “MintStart”.
I’ve always changed the default name on the MintMenu to just the icon with no text. I’d prefer it that way, but honestly, whatever gets done, the tweak is an easy one for me!
Menu makes it easy for everyone. And if your preference is for the code name then it is easy enough to change. Thanks for your excellent work guys, you efforts and Mint made me a Linux convert forever!
Damian
Make it the “Clem” button, hardwired in forevermore! We can tell everyone to “just click Clem” and that it stands for “Complete Linux Entry Menu”. And maybe it could sport a leprechaun on the button?!
But, more seriously, I agree “Menu” would be better for a default.
Just an icon (like KDE) would be nice to have, but users should still have the option to add a name.
i think the name should be left at menu, however i have two suggestions,
1) in the settings the user can choose what to display, either “menu” or “gloria” and
2) if you wish to maintain only the “menu” you could add a wallpaper with “gloria” written on it
I would say use “Menu” as it’s a good default. Please do not use “Start”.
vote: a simple and nice icon instead of menu
if I have to choose from text, I’s prefer codename
Hi,
yh stick with menu imo, makes it easier for everyone 🙂
also totally random and off the topic, but could you bundle JRE v.1.6 with version 7, as i cant seem to get it installed 🙂
I like the Clem button idea. A nice graphic that spelled CLEM would work too. Fire up Gimp and lets come up with one!!!!
Someday Linus and Clem will share the same OS!!!!
Maybe change the acronym to “Customizable Linux Entry Menu”… 🙂
definitely keep the “menu”. It is the first thing I always did when firing up Mint and I have used it since its first week’s launch. It is more accessible to those who haven’t used Linux and I don’t always like to look at the names all of the time. I was thrilled to see the change. Thank you,
Keith
I like “Menu” better than distroname. Cooler still, would be if I could figure out how to change it to username – whichever one of us is logged in at the moment.
Leave it Menu. Put a nice graphic of the name at the top of the menu when it opens.
The reasons I switched to Mint were that my wireless card just worked, and the little touches like Elyssa (my favorite name so far) as the menu name. It adds to that minty personality everyone seems to love.
i vote for Mint logo+Menu – standard
I say keep it as menu, this distro is geared towards noobs. But also if someone wants to change it, or even take it off and put an icon, that option should be available too.
all is good!我喜欢linux mint!!!希望能有更好的中文支持!i hope a better support for chinese!
Cyanide: Sun’s JRE 1.6 comes pre-installed in both Mint 5 and Mint 6.
Thank you for your releases.
My wife believes that Daryna and Elyssa are my secret girlfriends. So I prefer ‘Menu’.
Regards.
I prefer the code name instead of Menu, its kind of a reminder of which Mint I’m using.
I think that it should say what version…By Name….Elyssa Daryna and such. 2 reasons.
1. Helps people identify what version they ahve easy. For easier help.
2. Unique…..Just cause winblows uses 1 word on all….That to me is enough to keep changing it……
If you keep using Menu M$ will try to get you saying you took their idea, lol(Joke).
But on the Real. I think that it should have the Name of the version in Use….If they don’t like it they can always change it with a simple right click….
I suggest miñtu. The tilde over the n makes for a pronounceable combination of the word mint and menu.
MoonForce: Thanks, I’ll make sure to give it a try.
I prefer Menu, it is easier for newbies 😉
Keep it as Menu
An elegant OS like Mint, should have the name of the lovely lady on the menu. I changed mine from menu to “Felicia” that is a pretty name.
use “mintMenu of (codename)” for distinguishment. And let users set between in mintAssistant, and MintMenu Options. Thanks.
GiggleGut: It is customizable you very, very silly boy
make the Menu customizable – give option to allow or deny movement. And plz program a MintMenu for XFCE and K Desktop Environment!
Linux Mint 7, ditunggu diIndonesia
salam dari Indonesia
I think it is time to make the 64bit edition of Linux Mint 7 “Gloria” as main edition and 32 edition separately as an option to old computers. It is almost impossible to buy 32 bit computer nowadays and 64 bit software, as we can see, gets to be usable already.
I renamed my menu button Billgates in honor of the man who inspired Linux development. Without Billgates, we’d all be using OS/2 or some other operating system that never crashes, and Linux would be residing on the abandoned old hard disk of some unknown Finnish grad student. 🙂
As long as it can be changed to whatever I dont mind. But I think its a nice little Mint tardition to have the Codename there. In 6 I changed it to Felicia too.
As for my parents I changed it into “start”
I prefer the Menu/Start label. Another text could lead to confusion for new users/switchers.
I agree with [i]Daniel aka knuckles[/i]. The perfect solution would be to allow individual users to choose. That being said, if it [i]had[/i] to be one way or the other, I would opt for “menu”
Menu is fine for the… Menu 🙂
Otherwise my girlfriend gets jealous… 😛
menu or start is the past and the obvious, putting gloria here it’s more fresh like mint style.. or a cool icon or the user decid what the heck says: the user decide with an option like knuckles+Steve says.
I just started with Mint 6 “Felicia,” and wasn’t aware that the old menus used to have the code names. I actually prefer having the term “Menu” listed.
One thing I noticed is that I’m given a choice to either keep or hide the LM icon next to “Menu”. Great option, so would it be feasible to offer the user a choice between “Menu” and the code name?
Hi,
Just adopted Mint a week ago, after going through >Ubuntu 8.04 and 8.10 and accidentally stumbling upon Mint when googling “fastest Linux”. Lucky for me. Best distro I’ve come across for ease of install and ease of use, even compared to Ubuntu. GUI is beautiful and elegance is an appropriate description. Don’t even want to change the default desktop settings cause they are so nice.
As a Linux newbie I think Menu is a better choice as anything that makes the conversion from W*****s easier is a good thing and your menu layout in Gnome (haven’t tried the XFCE layout cause it wants to uninstall the Gnome desktop) is simplicity and clarity exemplified. Took me all of 15 minutes to figure out how to configure just about everything I needed to on the system. I see that the Preferences option gives users the ability to customize the text as well as choose between the icon and text or both. I think leaving the default “Menu” and letting users change it if they want is the best option for Linux newbies and W*****s converts.
On a different note, will it be possible in the future to install both the Mint-Gnome desktop and the Mint-XFCE desktop and choose between them at log-in the way Ubuntu lets you?
Thanks,
Chris
“Mint” sounds good !
I think it’s intuitive enough with the placing of the button, everybody understands that it’s a menu just by the placement. Thus the text “menu” is redundant.
If any text should be besides the menu I think it should be the codename. Codename or nothing I say (preferably nothing).
Looking forward to Gloria!
Leave it with menu…….. or a larger LM symbol with no text
man your distro is top notch and the best availiable man. I personally reccommend it to all and sundry. Please everyone use mint now. I said now dammit. NOW !!!!!
DEFINITELY USE MENU
Just use menu, its more professional than a name, its supposed to be a user friendly distro so keep it simple for the end user by having the environment resemble what they are used to (Start).
keep it menu!
I like the idea of being able to pick your own option. Maybe have a default of ‘menu’, with the option of changing either on a custom options install or in a preferences location. But if that is way to much work, I would go with just an icon.
very good!
My opinion is the simpler the better. Perhaps some shadowing when clicked instead of highlighting in blue, or a simple animation. Pizazz is nice, but the main key to elegance is simplicity!
Felicia is a nice release. =) Looking forward to the Gloria release. It’s also nice to change the name “Menu” to “Gloria” =).
Just a suggestion: Should shrink the desktop icons a little bit maybe 32×32?
“Go” or “Go to”
I think the text should be “Start”. People who want something unique can change it. Strange names appeal to the geeks in us but does not make it easier for the general masses. Little things like these matter. If something is configurable anyway, it is better for the defaults to side with the common people. We geeks can always change it if we want.
Also, pressing the Super button should start the mintMenu.
codenames
I hope any problems, with ATI drivers, are to be solved. I cant use
compiz desktop cause of that… its a shame. Other than that, GREAT
JOB YOU GUYS !!! (ATI X600 PRO 256MB)
Why not have it be user choice?
I really like the simplicity of “Menu”. Perhaps there could be some radiance in the OS? Brighter colours and sharper lines in the panes and panel. Perhaps a new theme to project the glory of Gloria?
Hey, I just think that the people who make opensource software are so worried about such little things! The MintMenu, as it is, can be renamed as you wish. It is just one more option to make your own look to the system. I personally hate the visual of Mint, although I love this system, and I always change it radically. We should remember that we’re having a great advantage in having this option! Winblows users can’t modify much of the look of their boxes, and we can! Producing look patterns, in this sense of view, is a bullshit.
LET’S NOT WASTE TIME WITH POOR AND SMALL THINGS! THINK BIG, PEOPLE!.
I nice ICON would be nice and simple.
Well it’s so easy to change… you can put whatever you want… right clic, settings and there we go… Well maybe «Mint Menu» by default is good… well me I changed it for “minto” lol… the name of my local domain… ^^
Personally, I think it would be pretty cool if you could get it to dynamically display the hostname of your machine … imagine that on a network …
New user will surely be confused by the code name. Experienced users will surely know what version they have installed. So it must be “Menu” for sure.
I can’t wait to see the 64 Bit version of Gloria, I’d like Mint more if you could just upgrade distributions from the Update option like in Ubuntu. Instead of having to install over my old system and have to re-do all of my changes I like to make. But overall Mint keeps getting better and better with each release.
NOT keeping things simple (i.e. the names of Linux programs etc…) is keeping newbies from diving in and trying the O/S. It did for me, example, Windows Media Player and Kaffeine? Huh? Do I want to watch videos or make coffee?
Im waiting!!.. i started with mint 5 and now i use mint 6 and i like it but my webcam doesnt work, and someone knows if this new release bring more suport for webcams?
Why not have it so that it can be changed by the user? In Ubuntu you can easily do this. But imo the defaulot should be menu. It makes more sense, having the Lunux mint icon then the word menu… Mint>menu 🙂
Perhaps if there is so much undecided and argumentitive conversation over such a trivial thing there could be simply a choice when setting up the OS by the user to their liking?
Cabras en vinagreta rules!
Linux Mint rules!
I have already Windows XP installed on my system (Drive C)
While installing Linux Mint 7 I selected USB drive.
Now when I start my machine it presents a menu for selection of
windows XP or Linux Mint.
It works for both. But if I plug-off my USB, machine fails to start in xp or Linux Mint.
Can any one tell me how to uninstall it from USB as I want to reinstall Linux Mint on my Hard Drive, keeping my windows XP intact.
Hello. I want to ask you something. When I try to install Mint 7 on a partition from live usb, I get an error that says something is wrong with root. Also I tried to install Mint from Windows, it requires internet connection but says “Retrying connection”. Can someone help me??
Can I install the image of Linux without a CD?
I prefer the codename. Its cool to have that.
I’d love to see a wubi installer for Gloria 🙂 | https://blog.linuxmint.com/?p=543 | CC-MAIN-2022-33 | refinedweb | 6,332 | 82.14 |
DEBSOURCES
Skip Quicknav
sources / r-cran-coda / 0446
0.19-3 Martyn.plumemr <martyn.plummer@gmail.com>
- Obsolete documentation for .Coda.options removed
0.19-2 Martyn Plummer <martyn.plummer@gmail.com>
- Maintainer address update
0.19-1 Martyn Plummer <plummerm@iarc.fr>
- gelman.plot() now avoids superfluous calculation of multivariate
diagnostic. Thanks to Gert van Valkenhoef.
- Fixed various issues with the histogram produced by densplot()
for discrete-valued distributions. Thanks to Robert Goudie.
- Obsolete INDEX file removed
- Dimnames bug in geweke.plot fixed. Thanks to Jiri Moravec
0.18-1 Martyn Plummer <plummer@iarc.fr>
- Arni Magnusson is fully credited as coauthor
- Fixed bug in "varnames<-", which failed when the mcmc object was
not a matrix. Thanks to Evangelos Evangelou and Pavel Krivitsky.
- NAMESPACE file now includes imports of functions from base packages.
- codamenu no longer gives option to save mcmc object on exit.
0.17-2 Martyn Plummer <plummerm@iarc.fr>
- Avoid redundant copies when subsetting mcmc.list objects
0.17-1 Martyn Plummer <plummerm@iarc.fr>
- Moved lattice package from Depends to Imports in DESCRIPTION
file. This means that you must load the lattice package to use
any of the lattice methods provided for mcmc objects.
- Russell Almond is fully credited as co-author
- Moved AUTHORS file into inst/ sub-directory
- Fixed bug that stopped trellis graphics from working with vector
mcmc objects (thinned chains). Thanks to Chris Andrews.
- Added additional arguments (...) to as.mcmc()
- coda.options() no longer writes to the global environment
0.16-1
- Fixed main title bug in densplot
- Substitute spectrum0.ar for spectrum0 internally
- densplot parameters fixed when drawing multiple plots
0.15-3
- Correct x axis labelling in xyplot. Thanks to Pavel Krivitsky.
0.15-2
- Allow default plotting parameters to be overridden in densplot and traceplot.
- Stop overplotting of user-supplied title in densplot.
- Fix xyplot for univariate chains. Thanks to Pavel Krivitsky.
0.15-1
- Use Authors@R field in DESCRIPTION
- Fixe geweke.diag for long mcmc samples. Thanks to Philip Johnson gelman.diag.
0.14-3
- Fixed documentation errors in gelman.diag (Thanks to Peng Yu)
- Added CITATION file
0.14-2
- Fix documentation bugs (Thanks to Kurt Hornik)
0.14-1
- traceplot and plot.mcmc no longer plot a smooth line by default,
although it can be added using smooth=TRUE
- new head and tail methods for mcmc and mcmc.list objects
0.13-1
- as.mcmc.list generic and default method are exported in namespace
0.12-1
- Added further changes for S-PLUS from Dawn Woodward.
0.11-3
- Fixed documentation on subsetting methods for mcmc and mcmc.list objects
0.11-2
- The codamenu function has been modified so that it no longer works with
coda.dat and work.dat in the global environment, solving global binding
issues.
- The sample size test at the beginning of codamenu has been corrected
for the case of multiple chains.
Thanks to Luwis Diya and Pablo G Goicoechea for these bug reports
- Syntax errors fixed in help pages.
- Description of Gelman and Rubin diagnostic corrected
0.11-1
- Added changes from Dawn Woodward for S-PLUS.
- Fixed global binding problems
0.10-7
- Documentation clarification for bugs2jags()
- Made linearity test in codamenu less stringent.
Thanks to Bengt Sennblad.
- Fixed rejectionRate() for single-variable chains.
Thanks to Rob Scharpf.
0.10-6
- Fixed HPDinterval() for univariate chains
Thanks to David LeBlond
- Fixed optional parameters in as.data.frame method for mcmc objects
0.10-5
- Registered default method for as.mcmc in NAMESPACE
Thanks to Christian Grose
0.10-4
- fixed eternal loop in codamenu() when saving plot as PostScript.
Thanks to Bengt Sennblad.
0.12-3
- added 'data' in lattice generics for compatibility
0.10-2
- Import generics from lattice
- In plotting functions, "ask" now defaults to dev.interactive(),
and not the default value in par(), as introduced in 0.9-2
0.10-1
- Added "mcmc" and "mcmc.list" methods for several lattice functions
(xyplot, qqmath, densityplot and acfplot (with generic here as
well)). There's a levelplot method too, which is currently
experimental. These are Trellis analogs of existing coda functions,
and may in future replace them.
0.9-5
- Fixed bug in summary.mcmc (safespec0 misspelled) which affected
univariate chains.
0.9-4
- Fixed documentation errors.
0.9-3
- Added date stamp check in read.openbugs to ensure files were created
at the same time.
0.9-2
- [RGA] Added an autoburnin flag (default) true to gelman.diag to suppress
automatic windowing for burn in (so I can do it manually).
- [RGA] Fixed a problem where summary.mcmc.list would not give correct
pooled standard errors.
- [RGA] Fixed propagation of standard par and titles to plot.mcmc and
plot.mcmc.list. Also fixed so that ask will default to value in
par().
- [RGA] Fixed a problem where autocorr would apply thinning twice to
mcmc.list objects.
- [RGA] Changed effectiveSize for mcmc.list to sum across all chains.
Original behavior can be recovered by using lapply(x,effectiveSize)
- [RGA] Added autocorr.diag function.
- [RGA] Patched summary.mcmc and summary.mcmc.list so it would give
standard error of NA when spectrum0 blows ups.
- [RGA] Added a rejectionRate method.
- [RGA] Added a batch Standard Error Function
0.9-1
- spectrum0 function now has default max.length argument of 200.
This means that the output will be batched to a length between
100 and 200 before fitting the glm to the spectrogram. This
should improve robustness for chains with high autocorrelation,
or markedly non-gaussian distributions.
- The read.bugs() function has been removed; read.coda() has been
modified to allow specification of both output and index files;
read.bugs.interactive() has been modified in the same way;
read.openbugs() is a new wrapper function around read.coda() for
OpenBUGS output.
0.8-3
- Fixed documentation errors in coda.menu.Rd and linepost.Rd
0.8-2
- Added generic function thin to list of exported functions
0.8-1
Continuing problems with namespace:
- Addition of namespace requires new version number for coda,
as saved workspaces are not backwards compatible.
- Ensured that mcmc attributes are not assumed for objects returned by
as.matrix.mcmc, as this now no longer returns an mcmc object.
This occurred in, for example, effectiveSize (which returned NA)
and gelman.diag (which dropped variable names).
- Changed "[.mcmc.list" and "[.mcmc" so that they return an
mcmc.list/mcmc object respectively when subsetting columns.
plot.mcmc() and plot.mcmc.list() now work again when there is
only one variable.
- Imported the required time series generics from package stats.
Failure to do this may result in a saved workspace that cannot be reloaded.
Other problems
- Removed S compatibility (statements conditional on is.R and wrapper
function coda.global.assign). Note that S compatibility never worked
at all, and I now have no intention of supporting it.
- Fixed (old) bug in "[.mcmc" which made column subsets of mcmc objects
return invisibly.
- Changed the plotting functions so it is no longer necessary to press
return to see the first page of plots.
0.7-3 (changes done by Andrew Martin <admartin@wustl.edu>)
- Added NAMESPACE
- export only functions that I think should have been exported (based on
the documentation and common sense).
- Registered all S3 methods.
- Fixed documentation for non-exported functions.
- Patched the "mcmc" function to deal with really big thinning intervals.
- Patched the "as.matrix.mcmc" function so it really returns matrices.
- Fixed plot method, by having plot.mcmc pass an mcmc object
rather than a matrix, and by fixing the [.mcmc.list method so it
returns an mcmc.list not a matrix.
- Fixed "varnames<-" which was broken when the as.matrix method was
fixed.
- Fixed documentation mcmc.convert.Rd such that the usage is consistent
with S3 class definition (this fixed an error thrown in the QC tools).
0.7-2
- The spectrum0() function now returns zero when it is given a constant
vector. summary.mcmc() (which calls spectrum0) now works correctly.
0.7
- Modified to run on R 1.9.0 with new organization of base library
0.6-2
- Fixed documentation bug in raftery.diag
0.6-1
- spectrum0.ar no longer crashes when the chain is a linear function
of the iteration number
- codamenu automatically drops variables that are linear functions
of the iteration number
- read.bugs renamed to read.coda. read.bugs exists as an alias.
- initial support for JAGS: bugs2jags function converts WinBUGS
data to R dump format used by JAGS.
- added cumuplot function (not yet in codamenu system)
0.5-14
- Fixed reporting of sample size in densplot(), for variables that are
in the range [0,1] or [0,Inf). Thanks to Roy Levy.
0.5-13
- mcmc() now works with data frames (provided that they contain only
numeric values).
0.5-12
- Documentation errors in coda.options.Rd and nchain.Rd fixed.
Thanks to Kurt Hornik.
0.5-11
- Fixed bug in mcmc() function that causes problems in Geweke diagnostic
- Fixed geweke.plot so that it works with samples running from iteration
N to 2N. These were previously mis-diagnosed as being too short.
Thanks to Vasco Leemans for finding both bugs.
- In autocorr.plot, the `ask' argument was not used. Thanks to
Dennis A Wolf.
0.5-10
- Eliminated use of "=" for assignment operator. This is a syntax error
for R < 1.4.0
0.5-9
- Further documentation bugs removed
0.5-8
- Removed further documentation bugs found by "R CMD check coda" using
R-1.4 (pre-release)
0.5-7
- Removed obsolete line.doc and line.old.doc files from data directory.
- New spectrum0.ar provides model-based estimate of spectral density
at frequency zero.
- New effectiveSize diagnostic gives effective sample size.
- codamenu includes automatic check on effective sample size.
0.5-6
- Removed further documentation bugs found by "R CMD check coda" using
R-1.3 (pre-release)
0.5-5
- Ironed out last warnings generated by "R CMD check coda"
0.5-4
- Provided documentation for all functions and datasets.
(Thanks to Kurt Hornik for the prompting)
0.5-3
- Fixed bug in example for mcmc.list. Row subsetting no longer preserves
mcmc objects (Thanks to Kurt Hornik).
0.5-2
- Fixed bug in gelman.transform which did not work for univariate chains
(Thanks to Mark A. Beaumont)
- Fixed confidence limits in geweke.plot
(Thanks to Mark A. Beaumont)
- Allow user to set ylim in densplot (Thanks to Niels Peter Baadsgaard)
0.5-1
- Replaced time series functions with functions from "ts" library
(R-base >= 0.65.0)
- Removed calls to Version() (deprecated). Use is.R() instead.
- Added new function read.yesno
- Source files maintained using ESS
- Allowed restart() in codamenu.options.plot.kernel
- Simplified print.coda.options
- Removed "onepage" option in coda.options() (Subsumed in user.layout)
- Removed "mrows" and "mcols" options in coda.options (use par instead)
Changes to Geweke's diagnostic
- Uses new function spectrum0() to estimate spectral density at zero
- Gelman-Rubin-Brooks plot never discards more than half the chain
to preserve necessary asymptotic conditions.
Changes to Gelman and Rubin's diagnostic
- Multivariate psrf added.
- Documentation for Gelman-Rubin-Brooks plot update to give
clearer motivation.
Changes to Heidelberger and Welch's diagnostic
- Simplified formula for Cramer-von Mises statistic
- Using new function spectrum0() to estimate spectral density at zero
- Can set p-value threshold for passing convergence test.
- p-value is printed in output, using new function pcramer().
- Prints starting iteration of truncated chain instead of number
of iterations to discard.
0.4-7
Fixed bug in read.bugs.interactive() leading to failure when
user enters both ".ind" and ".out" names (Thanks to John Logsdon).
0.4-6
Archive 0.4-5 was incorrectly compressed with "compress" instead
of "gzip". Corrected by Friedrich Leisch.
0.4-5
Bug fixes
- densplot failed with show.obs=TRUE when scale was "positive" or
"proportion".
- as.matrix.mcmc failed to preserve start, end and thin.
- codamenu did not tidy up on exit.
0.4-4
Started S3 compatibility
Fixed bug which caused options menus to crash
Fixed legend bug in gelman.plot
Confirmed that these bugs are fixed:
* densplot "missing" and "scale" bugs (Thanks to Greg Warnes)
* autocorr "improper time series parameters" bug ("acf"
function rewritten by Paul Gilbert)
* integer overflow bug in raftery.diag (Thanks to Morten
Frydenberg)
* read.bugs.interactive will search for the files it needs
and print their names.
codamenu now assigns default variable and chain names to
data when these are NULL.
0.4-3
Fixed help page errors pointed out by Brian Ripley.
Fixed coda.credits
0.4-2
Whoops. 0.4-1 was a mistake.
0.4-1
updated manual pages
new class mcmc.list added to deal with multiple chains. ugrade.mcmc
function introduced to deal with old mcmc objects.
plot functions changed to use the "ask" parameter instead of
"pause" functions.
spec.pgram now handles matrix time-series.
acf function now calculates cross-correlations. Thanks to Paul Gilbert.
codamenu functions now use title argument in "menu"
corrected spelling mistakes in help pages
changed instances of "T" and "F" to "TRUE" and "FALSE" (R coding standards)
densplot now recognizes discrete distributions and prints histogram ...
... also prints histogram if IQR=0 (large mass on one point)
fixed bug in mcmc which allowed non-integer thinning intervals
Fixed manual pages with bad use of "alias" command.
0.3-4
Fixed bug in "tspar<-" which breaks much of the code in R-0.62
0.3-3
Package was in obsolete format. Corrected by Fritz.
** Pre-release changes for R version
Created class "mcmc" with associated constructor and extractor
functions as well as plot, print and summary methods.
Modified diagnostics so they all work on objects of class "mcmc"
and can be called directly by the user. All diagnostics return
objects with associated print methods. Renamed some functions
and arguments for ease of use.
Changed the menu driven interface - now called by the function
"codamenu" - to avoid recursive calling of menu functions.
Put frequently used code inside utility functions.
Got rid of functions written by Mathsoft
Wrote drop-in replacements for some time series functions which
are found in S-PLUS but not R.
The logfile facility has been removed. Sorry.
Changed license terms to GPL. | https://sources.debian.org/src/r-cran-coda/0.19-3-1/CHANGELOG/ | CC-MAIN-2020-05 | refinedweb | 2,369 | 62.54 |
Hi all,
Me and my friend are trying to find a way to bake multiple texture with vray in blender,
after some help we use this script:
import bpy
sce = bpy.context.scene
Enable autosave
sce.vray.exporter.auto_save_render = True
sce.vray.SettingsOutput.img_dir = “//bake/”
Enable Bake
sce.vray.VRayBake.use = True
Manual object list:
ob = [‘cube’,‘plane’]
for ob in objects:
Selection
for ob in bpy.context.selected_objects:
sce.vray.VRayBake.bake_node = ob.name
sce.vray.SettingsOutput.img_file = “bake_%s”%(ob.name)
bpy.ops.vray.render()
the problem is vray opens 2 windows to bake, but renders 2 times only the 1st object (cube).
it’s possible to fix?
thank you in advance! | https://blenderartists.org/t/vray-multi-bake-textures/567864 | CC-MAIN-2021-49 | refinedweb | 114 | 60.51 |
Garbage Collection Test
Hi,
I am trying to test garbage collection. To start with i am using book O'Reilly - "Java Performance Tunning". In it i found the code below. But when I comment out //s=null and //v=null the time results are the same as with initialising them to null.
Any ideas?
Im I missing some aspects here?
import java.util.*;
public class GarbageTest
{
public static void main(String[] args) {
int SIZE = 40000;
StringBuffer s;
Vector v;
for(int i = 0; i < SIZE; i++) {
s = new StringBuffer(50);
v = new Vector(30);
s.append(i).append(i+1).append(i+2).append(i+3);
}
s = null;
v = null;
System.out.println("Sarting Garbage collection");
long time = System.currentTimeMillis();
System.gc();
long after = System.currentTimeMillis()-time;
System.out.println("Garbage collection took " +
after + " millis");
int[] arr = new int[SIZE*10];
time = System.currentTimeMillis();
arr = null;
System.out.println("Sarting Garbage collection");
System.gc();
after = System.currentTimeMillis()-time;
System.out.println("Garbage collection took " +
after + " millis");
}
}
Thank you
But setting them to null shouldn't be garbage collected all those 2*40000 objects?
no, of course not - how is an assignment statement that overwrites the previous pointer reference (s = new ...; v = new ...) going to leave the previous object still strongly referenced? :)
that's what I would expect - the time difference with a pair of objects out of 2x40000 would be tiny ;)
but obviously setting them to null is just for concrete correctness~ | https://www.java.net/node/653837 | CC-MAIN-2015-35 | refinedweb | 242 | 59.7 |
Asynchronous Functional Programming Using React Hooks
In the first three parts of this series, we’ve looked at why functional programming is important to react, how to manage state in a stateless component, and how to replace the flux pattern or replace redux with React hooks. In this part, we’re going to look at how to handle asynchronous tasks in the functional programming world, and how you can use the async/await pattern when working with React Hooks and stateless components.
I simply have to wait for something — being async in a synchronous functional world
As you’ve noticed, everything that we’ve talked about until now has been completely linear and synchronous. If we’re just working with a simple webpage, that’s all well and good, but what if we need to use a backend, what if we need to venture into the asynchronous world?
Luckily,
useEffect is made for exactly that purpose.
The
React.useEffect hook takes a function as an argument and it will call that function after the main render cycle has completed, meaning that you can use it to complete async operations, like calls to an API remote, whether it be GraphQL or RESTful (or SOAP or really whatever you like).
It’s generally best practice to define a function that you call from your effect and then do your async operations there. It allows you to use the
async/await paradigm, which, I think we can all agree, makes life easier.
Let’s take a look at a simple async handler, we’ll call it
updateProductBackend.
const updateProductBackend = async (product) => {
return await updateBackend(product);
}
This is very simple, it doesn’t update our UI or anything like that, however, since closures are a thing that exist, we can use any variable in the current scope (including, say, a update function pointer from a
useState call or the dispatch method from a
useContext call where the context provider was initialized with
useReducer to do that for us. Or, if we don’t want to use closures, then we can pass those items into this handler and use them there, they’ll still work.
That might make this function look something like this:
const updateProductBackend = async (product, dispatch) => {
const result = await updateBackend(product);
if (result.success) {
dispatch({ type: “success” });
} else {
dispatch({ type: “failure” });
}
}
Of course, for this to be meaningful, our middleware reducer has to be extended to handle the
success and
failure action types.
The
React.useEffect call
Let’s now take the async handler we defined in the previous section and put it to use inside a
useEffect call.
In the body of any component, we can now add the following code:
useEffect(() => updateProductBackend(product, dispatch));
Let’s look at our
ProductDisplay component from earlier, and see how this fits in.
const ProductDisplay = () => {
const {
state: product,
dispatch
} = React.useContext(ProductsContext);
useEffect(() => updateProductBackend(product, dispatch));
return <Product data={product} />;
};
This is fine, but the eagle eyed reader will notice that this effect will call our backend every single time that our state changes. We probably don’t want that.
Let’s say that we’ve got a woot like item that increments our price by a penny each time someone buys.
To do this, we’ll need a buy button, and then we’ll need to handle that price increment, but only if the product is bought.
Let’s accomplish this with a state that tells us if the user intends to purchase (we’ll call it
purchaseIntent), and then an effect to do the purchase and to increment the price.
const ProductDisplay = () => {
const {
state: product,
dispatch
} = React.useContext(ProductsContext);
const [purchaseIntent, setPurchaseIntent] = useState(false);
useEffect(() => {
const newProduct = {
…product,
price: product.price + 0.01
};
if (purchaseIntent) {
updateProductBackend(newProduct, dispatch);
purchaseProduct(product, dispatch);
}
return null;
},
[ purchaseIntent ]
);
return (
<React.Fragmemt>
<Product data={product} />
<button onClick={() => setPurchaseIntent(true);} />
);
};
What you should note here is the fact that I’ve passed
purchaseIntent as the second argument to
useEffect. What this does is to tell
useEffect that it needs to execute the first argument if the value it receives in the second argument is different from the last value received. Given that before the first time, it’s
undefined, it will run the first time as well (hence the check on
purchaseIntent).
It’s also important here to note that if your call to
useEffect has any long-running consequences, you need to return a callback that will terminate these processes.
Wrapping it all up
As you can see through these examples, hooks allow us to do absolutely everything that we would in the classic react lifecycle method, but everything is in a single flow, where we don’t have to worry about all the complexities that the object model exposed us to.
This allows each piece to become a more discrete unit (which, as such, can be unit tested), and to keep all of the pieces simple as well.
It also has the wonderful side effect of being faster. Since with this approach, your functions are not long-running and don’t contribute to the heap size like objects do, your app will have a lower overall memory footprint and run more smoothly everywhere it runs.
Read More — Other parts in this series
If you haven’t seen it, please also read part 1, discussing the reasons for functional programming and stateless components in react, part 2 managing local state with React Hooks, and part 3 replacing your redux action/reducer pattern with the react Hooks
useContext and
useReducer hooks.
Coming up next will be the final part in this series, exploring the various gotchas of working with React Hooks, React Concurrent Mode, and Functional Programming in Javascript.
About the Author
Stefan Nagey is Co-Founder of Capbase and Dharma. In a previous life he has variously promoted motion pictures, been a diplomat and registered foreign agent, and run payment processing in the online gambling space. He variously writes about engineering and the headaches of being a startup founder in the 21st century. | https://medium.com/capbase-engineering/asynchronous-functional-programming-using-react-hooks-e51a748e6869?source=---------6----------------------- | CC-MAIN-2019-35 | refinedweb | 1,006 | 53.75 |
Inner Class in Java
Reading time: 20 minutes | Coding time: 5 minutes
In Java, an inner class is a type of nested class. A nested class is a class which is defined inside of another class. Just as we nest the conditional statements such as if...else, switch and loops in the same way we can nest classes in Java. It provides better encapsulation.
The basic syntax of Inner class in Java is as follows:
class OuterClassName { //code class InnerClassName { //code } }
To create an object of the Inner class, the syntax is as follows:
OuterClassName.InnerClassName inner = new OuterClassName().new InnerClassName();
Uses of Inner class
- It can access private members of the outer class, which increases encapsulation.
- It is better to create a class as nested when it needs to be used only by one class.
- It makes our source code more readable and maintainable.
Types of Nested Classes
The different types of Nested classes in Java are:
- Non Static Nested Class (Inner Class)
- Method Local Inner Class
- Anonymous Inner Class
- Static Nested Class
Non Static Inner Class
A non-static nested class is also known as inner class which is just a simple nested class. It can access all variables of the outer class. If it is declared as private then it cannot be accessed by any other class except the class in which it is declared.
In this example, we will create a class A which will have class B as an inner class. We will create a object of class A and try to class B constructor.
Example
Java code for A.java:
//File name opengenus_A.java class opengenus_A{ private int a = 10; class opengenus_B{ public void print(){ System.out.println("a = " + a); } } }
Java code for Main.java:
//File name Main.java class Main{ public static void main(String[] args){ //this is the way of creating an instance of an inner class. opengenus_A.opengenus_B inner = new opengenus_A().new opengenus_B(); inner.print(); } }
Output:
a = 10
As you can see in the above example we have created a class B inside of class A and in B's print() method we are printing the value of A's private variable a.
Method Local Inner Class
When a class is declared inside a method then it is known as method local inner class. The scope of this type of inner class is only within the method it is declared. It can be instantiated only in the method it is defined.
In the following Java code example, notice that the inner class B is a part of the myMethod() function of class A. It is local to that function.
Example
//File name opengenus_A.java class opengenus_A{ void myMethod(){ int a = 50; class opengenus_B{ public void print(){ System.out.println("a = " + a); } } opengenus_B b = new opengenus_B(); b.print(); } }
Output:
a = 50
Anonymous Inner Class
An anonymous inner class is an inner class which is declared without any name. Like other anonymous classes we declare and instantiate it at the same time. Anonymouns inner classes are usefull for overriding methods.
Follow the following Java code example to understand it better.
Example
//File name B.java abstract class opengenus_A{ public abstract void method(); } public class opengenus_B{ public static void main(String[] args){ opengenus_A a = new opengenus_A(){ public void method(){ System.out.println("Inside anonymous class."); } }; a.method(); } }
Output:
Inside anonymous class.
Static Nested Class
A static nested class is declated with the keyword static. Static classes cannot be called an inner class as they are just like other static members of a class. It cannot access the non-static variables of the outer class.
Follow the following Java code example to understand it better:
Example
class opengenus_A{ static int a = 100; static class opengenus_B{ void print(){ System.out.println("a = " + a); } } }
class Main{ public static void main(String[] args){ opengenus_A.opengenus_B b = new opengenus_B(); b.print(); } }
In the above case we do not need to create an object of the outer class as the inner class is static and static members can be accessed without creating it's instance.
Output:
a = 100
If we create a static method inside of a static class then we can access it just like any normal static method of class.
With this article at OpenGenus, you have the complete knowledge of Inner classes in Java and its different kinds. Enjoy. | https://iq.opengenus.org/inner-class-in-java/ | CC-MAIN-2020-24 | refinedweb | 722 | 65.73 |
SiteMesh 3 Users Support for SiteMesh 3 users. <br> <br>Please note, the first time you post, your message needs approval - this is to protect against the spammers. Be patient if your post doesn't appear right away. Google Groups Corrado Alesso 2014-11-06T01:44:52Z Page truncation (Sitemesh 3, Tomcat 8) Hello all, I am experiencing a problem while porting my app from Tomcat 7 to Tomcat 8. The app is unchanged and the configuration of Tomcat is stock for both the versions. The problem manifests itself as a page truncation for html pages served by Sitemesh. The truncation occurs, for some Jairo Junior 2014-09-15T14:21:02Z SItemesh3 and HTML5 Hey, Is there any known problem with Sitemesh3 e HTML5? I'm trying to use it with both a decorator and a decorated page in HTML5. When I use in offline mode, the generated page is just fine, but when i use in my webapp, the decorated HTML presented is incomplete. I followed the exact steps of 有限 2014-09-03T22:59:10Z Sitemesh3 : DivExtractingTagRuleBundle issue *in sitemesh3.xml, I added this:* <content-processor> <tag-rule-bundle class= *"org.sitemesh.content.tagrules.html.DivExtractingTagRuleBundle"* /> </content-processor> *in my html file:* <body> <div id="siteMeshJavaScript"> <script> $(function() { alert("Starting"); }); </script> mschipperheyn 2014-04-23T17:57:11Z How to prevent HTML in TEXTAREA from being parsed documents a way to prevent Sitemesh from parsing HTML contained in a textarea. I'm trying to find out how to achieve this with Sitemesh 3. Any suggestions? Kind regards, Marc fabrice....@gmail.com 2014-02-17T14:24:15Z sitemesh3 feature request Hello, Sitemesh3 introduce a new feature that I consider very useful : to be able to build offline website with sitemesh But in sitemesh3 there is a feature I used heavily on sitemesh2 that is missing : the ability to include some code fragment (from an other file) in a page : In sitemesh2, mschipperheyn 2014-02-03T16:10:13Z Wrong decorator selected Hi, I have two decorators <mapping path ="/*/??_??/account/**" decorator= "/WEB-INF/decorators/single_column.ftd"/> <mapping path ="/*/??_??/*/user/profile/edit/*/" decorator= "/WEB-INF/decorators/smallest_column.ftd"/> When I use the url /brasil/BR_pt/account/user/profile/edit/skill/, the Paulo Sérgio Medeiros 2014-01-01T22:00:18Z SiteMesh missing documentation (advanced features) Hi folks, I was looking at the SiteMesh documentation and noticed that the whole "SiteMesh Bells and Whistles" section () is missing. Is this documentation available anywhere else? Or it simply never existed? Amel Badaoui 2013-08-13T14:37:35Z Parser missed something Hi, We have this stack trace in our console logs when rendering one of our decorators : SEVERE: Servlet.service() for servlet springmvc threw exception java.lang.AssertionError: Parser missed something. Please report this bug to SiteMesh team. at org.sitemesh.tagprocessor.TagTokenizer.p Ashish Chudasama 2013-05-28T11:18:10Z How to create printable decorator using sitemesh3 Hi Friends, Can you please help me how to implement printable decorator in sitemesh3 As in sitemesh 2 we do the following configuration <decorator-mappers> <mapper class="com.opensymphony.module.sitemesh.mapper.PrintableDecoratorMapper"> <param name="decorator" value="printable" /> <param Alfabeto 2013-05-16T00:20:45Z My contribution: struts2 with sitemesh3 implementation Hello people Just write to give thanks to the people who develop sitemesh3. As reciprocity I published an example of sitemesh3 with struts2 in the following project: You know struts1 is death and now struts2 is the new standard. You can Aravind N 2013-03-21T20:46:40Z sitemesh 3 when is sitemesh 3 going to release an official version ? I see that the alpha-2 version was released 2 years ago. Mark Tombs 2013-03-15T09:35:42Z using getParameter in sitemesh3 Hi, I have a site that works ok with sitemesh2, but I want some of the new functionality in sitemesh3 so I am trying it out. I am doing the following: On each decorated page I have a <meta name='menu' content='something'/> tag in the header. In the decorator I have navigation, and I am fetching Bryn Cooke 2013-02-18T09:59:05Z Sitemesh3 custom properties Hi I'm taking a look at sitemesh3 as it is one of the few templating frameworks that can deal with non XML markup which is ideal for html5. In the sitemesh3 documentation it says: "The *<sitemesh:write* tag will be rewritten by SiteMesh to include properties extracted from the Stephan Kliche 2012-12-12T19:58:33Z Excludes issue SiteMesh in an application with JAX-RS on GlassFish Hi Group, I am using SiteMesh 3.0-alpha-2 in an application which also provides some REST endpoints using JAX-RS and it is running on GlassFish 3.1.2. In the application I defined a JAX-RS ApplicationConfig and mapped the endpoint to "/api": @ApplicationPath("/api") > > public class RestApp Stephan Kliche 2012-12-12T19:23:46Z Excludes in a JAX-RS app on Glassfish Hi Group, I am using SiteMesh in an application which also provides some JAX-RS restful endpoinds and I am testing it on Glassfish 3.1.2. The REST endpoint is mapped to the ApplicationPath "/api": @ApplicationPath("/api") > > public class RestApp extends Application { > > } > > And I have a Bashar Saleh 2012-11-29T13:00:32Z Property default value In Sitemesh 2, one used to be able to provide Sitemesh with a default value if a property was not found. How can this be done using sitemesh 3? For example, in Sitemesh 2: <decorator:getProperty. ). I wanted to add a date field using a date picker. I have Ramichetty Mahesh 2012-11-15T06:51:01Z CMS integration using Sitemesh Does the Site Mesh Web frame work has the capability that it can be integrated with the CMS ( Content Manged System) The second thing is that the access to the appropriate HTML templates in which the content has to be loaded has to be done through the Web app that acts as an interceptor and Shirish Padalkar 2012-11-08T04:19:59Z Parsing multiple head, body tags in document using Sitemesh 3 Hi all, I have posted a question on StackOverflow about how to parse a document which can have duplicate head and body tags. Can you guys have a look at it and try to answer? Thanks and regards, Shirish Gunnar Hillert 2012-10-12T05:32:05Z New Milestone Release? Hi, It looks like there were a few critical issues fixed over the last few months. Any chance to maybe release a new milestone? Thanks! Cheers, Gunnar Corrado Alesso 2012-08-24T21:18:47Z Tag properties Hi all. I have very simple decorator <html> <head> <sitemesh:write </head> <body> <sitemesh:write </body> </html> and a content page <html> <head> </head> <body id="page1"> Content </body> </html> Notice the id george 2012-07-13T15:38:40Z cant display "<=" on page Using sitemesh 2.4 and spring framework on our page's text field, if it contains "<=", then all characters after <= will be truncated, e.g., "123<=456" will be displayed as "123". however, "1>2" , "1<2", and "1=>2" are all fine. I dont think its our code's problem, because the same jsp snippet Sean Gilligan 2012-07-03T05:50:07Z Gradle hello.html Example on GitHub I forked the project on GitHub, added a "hello" (hello.html) example, and created a pull request. The fork is here: The pull request is here: To run the example, just check it out and run: gradle jettyRun sirj 2012-07-03T05:59:55Z sitemesh 3 can't get session information when decorating the root context path of my webapp I have a webapp using sitemesh3, here is the sitemesh3.xml: <sitemesh> <mapping> <path>/mystuff/*</path> <decorator>/WEB-INF/decorators/en-layouts/mystuff.jsp</decorator> <decorator>/WEB-INF/decorators/en-layouts/header.jsp</decorator> </mapping> <mapping> <path>/*</path> <decorator Ilyas Patel 2012-06-11T11:12:46Z How could I unit test a custom decorator which extends AbstractDecoratorMapper I have created a new custom decorator which extends a AbstractDecoratorMapper. The new class calls methods in the abstract class using super. The problem I have is when trying to write the unit test, I'm not sure how to write a test as I would not know what SiteMesh passes to the init methods. I Ilyas Patel 2012-06-05T00:58:14Z New custom decorator mapper still defaults to ConfigDecoratorMapper class I have created a custom decorator mapper and added to my sitemesh.xml file. When I view the println statements it still defaults to com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper class which I am also using but not from my new mapper. Looking through the SiteMesh code I couldn't Ilyas Patel 2012-06-04T21:38:34Z Is it possible to use another decorator file for certain requests (Java based configuration)? I use SiteMesh 2 xml configuration to add specific headers and footers to a page depending on a URL (for our main site). I would like to now add a different header and footer if the HTTP Referer is within a specific list and I don’t want to use the decorators.xml we use for the main site. I am xtian 2012-04-18T13:44:41Z Need help investigating a malfunction on a production site (urgent!) I am on my second website release using sitemesh 3 (sitemesh-3.0-alpha-2) and I'm experiencing a weird behavior. If you go to the following site: and reload the homepage, say, 20 times, you are likely to see a decorated empty page instead of the expected content. Opening Ramu 2012-01-06T07:53:31Z Sitemesh3 Beta release Hi, We are using the sitemesh 2.x in our applications, we want to migrate the application to sitemesh 3.0 Can anyone let us know the tentative beta release for the sitemesh 3.0. Thanks & Regards Ramu shiva 2012-01-01T13:45:03Z Freemarker in Sitemesh3 Hi All, I'm going to in integration sitemesh 3 with spring mvc 3.1 and freemarker. I want to import spring.ftl macro into decorator.ftl. Please let me know how can i do this. Thanks shivantha, Shantanu Kumar 2011-12-23T11:39:13Z Sitemesh 3 for JVM languages Hello, I have few questions about suitability of Sitemesh 3 for JVM languages: 1. Is SiteMesh 3 strongly tied to Java? How easy it might be for users of JVM languages (eg. Clojure, Groovy etc.) to use Sitemesh 3? For example, a requirement to pass a classname for Sitemesh to instantiate may Guillaume MAKA 2011-12-14T17:19:08Z How to exclude css mime type ? I've a problem with the sitemesh 2.4 when I try to retrieve local css stylesheet in my JSP files with the <rel /> tag. Safari say me it requested with the correct text/css mime-type but get text/html response in place. My CSS declaration: <link type="text/css" rel="stylesheet" href="/MyApp/assets/ Hasif S 2011-11-18T05:31:58Z How to the set paths and decorators dynamically Hi, I am configuring SiteMesh using Java. My of some my pages are accessed by string concatenation to the URL. So the url changes dynamically. Different string to the URL directs users to different pages with different decorators. So how can this be done. Here is code for my filter class. public Martin Röbert 2011-11-14T19:10:07Z SItemesh3 and SpringMobile Hi there, I would like to Sitmesh together with the device resolution of Spring Mobile. An Interceptor (DeviceResolverHandlerInterceptor) is responsible for the device recognition and Sitemesh should do the beautification ;) My problem: If I want to obtain the current device from DeviceUtil santhi sri 2011-11-11T00:19:15Z Reg: Sending notifications to Admin Hi, I am new to Open Symphony, am trying to send mail notification to the admin depeding on the node creation. Could you please share your views on this. Thanks, Santhi Kasper 2011-11-08T08:33:45Z Different decorators for the same URL Hi there I need to specify one decorator for a given page, when the user is logged in, and one decorator for the user that is not logged in? What is important is that the URL does not change. So if my URL is: It should stay the same, but be decorated differently whether stan...@yahoo.fr 2011-11-08T18:55:31Z problem with sitemesh about struts2jquery grid i have a problem with my grid because i use sitemesh decorator pattern my grid pager is very ugly when i use sitemesh decorator. how can i fix it? i erase all about size font on my master decorator page and my grid look so ugly and when i exclude my page what have a grid . my grid is Corrado Alesso 2011-11-01T01:41:56Z Meta tag decorator Hi, in sitemesh 2 I was able to configure a PageDecoratorMapper and have the decorator be choosen on the meta tag defined in the page. For example this: <meta name="decorator" content="error"> will render the page using the "error" decorator. Is this still possbile in sitemesh 3? Thanks, Reza 2011-09-23T09:00:39Z Model Data in decorator Hi , I have a problem with using model data in decorator. I have a set of Menu object that I inject into every ModelAndView using postHandle method of a customised HandlerInterceptor. It is fine so far and I am able to render menus in the decorator. However, I need to somehow indicate the AeonofTime 2011-09-14T18:40:00Z Is this project active? Is Sitemesh an active project or is the project abandonware or on its last legs? Can anyone tell me what is going on with this project? Corrado Alesso 2011-09-18T16:53:31Z SiteMesh 3 Taglib Hello everyone, I'm an avid user of sitemesh 2, I've jsut discovered sitemesh 3 and I want to give it a try on a real project even if it's alpha... But I have a problem with the tag library definition. In sitemesh 2 I had <%@ taglib </sitemesh> Iam going to apply the logo from the decorator.But the decorator itself is not applying for that particular jsp. Any mistakes in my code.Please advice stan...@yahoo.fr 2011-07-13T14:10:08Z resize my windows my menu move on the top Hi people i have a problem wih organisation about my windows on the left i have my menu i put code menu on my decorator page. Its working good if the windows display on the normal size but when you resize the windows my menu is on the top how to stabilize this menu :/ i put my code : my stan...@yahoo.fr 2011-07-08T01:40:57Z problem exclude file with sitemesh3 hi sitemesh develloper i need some help i want to exclude one file but i dont sucess :/ sitemesh working good all my file is decoratinf my sitemesh3.xml <sitemesh> <excludes> <pattern>/index.jsp</pattern></excludes> <mapping path="/*" decorator="/decorator/decorator.jsp"></mapping> | https://groups.google.com/forum/feed/sitemesh3-users/topics/atom_v1_0.xml?num=50 | CC-MAIN-2017-26 | refinedweb | 2,495 | 61.77 |
import org.apache.http.conn.routing.HttpRoute; 33 import org.apache.http.conn.scheme.SchemeRegistry; 34 35 /** 36 * Management interface for {@link ManagedClientConnection client connections}. 37 * The purpose of an HTTP connection manager is to serve as a factory for new 38 * HTTP connections, manage persistent connections and synchronize access to 39 * persistent connections making sure that only one thread of execution can 40 * have access to a connection at a time. 41 * <p> 42 * Implementations of this interface must be thread-safe. Access to shared 43 * data must be synchronized as methods of this interface may be executed 44 * from multiple threads. 45 * 46 * @since 4.0 47 * 48 * @deprecated (4.3) replaced by {@link HttpClientConnectionManager}. 49 */ 50 @Deprecated 51 public interface ClientConnectionManager { 52 53 /** 54 * Obtains the scheme registry used by this manager. 55 * 56 * @return the scheme registry, never {@code null} 57 */ 58 SchemeRegistry getSchemeRegistry(); 59 60 /** 61 * Returns a new {@link ClientConnectionRequest}, from which a 62 * {@link ManagedClientConnection} can be obtained or the request can be 63 * aborted. 64 */ 65 ClientConnectionRequest requestConnection(HttpRoute route, Object state); 66 67 /** 68 * Releases a connection for use by others. 69 * You may optionally specify how long the connection is valid 70 * to be reused. Values <= 0 are considered to be valid forever. 71 * If the connection is not marked as reusable, the connection will 72 * not be reused regardless of the valid duration. 73 * 74 * If the connection has been released before, 75 * the call will be ignored. 76 * 77 * @param conn the connection to release 78 * @param validDuration the duration of time this connection is valid for reuse 79 * @param timeUnit the unit of time validDuration is measured in 80 * 81 * @see #closeExpiredConnections() 82 */ 83 void releaseConnection(ManagedClientConnection conn, long validDuration, TimeUnit timeUnit); 84 85 /** 86 * Closes idle connections in the pool. 87 * Open connections in the pool that have not been used for the 88 * timespan given by the argument will be closed. 89 * Currently allocated connections are not subject to this method. 90 * Times will be checked with milliseconds precision 91 * 92 * All expired connections will also be closed. 93 * 94 * @param idletime the idle time of connections to be closed 95 * @param tunit the unit for the {@code idletime} 96 * 97 * @see #closeExpiredConnections() 98 */ 99 void closeIdleConnections(long idletime, TimeUnit tunit); 100 101 /** 102 * Closes all expired connections in the pool. 103 * Open connections in the pool that have not been used for 104 * the timespan defined when the connection was released will be closed. 105 * Currently allocated connections are not subject to this method. 106 * Times will be checked with milliseconds precision. 107 */ 108 void closeExpiredConnections(); 109 110 /** 111 * Shuts down this connection manager and releases allocated resources. 112 * This includes closing all connections, whether they are currently 113 * used or not. 114 */ 115 void shutdown(); 116 117 } | http://hc.apache.org/httpcomponents-client-dev/httpclient/xref/org/apache/http/conn/ClientConnectionManager.html | CC-MAIN-2015-18 | refinedweb | 474 | 53.61 |
# Generated from XSLoader.pm.PL (resolved %Config::Config value) # This file is unique for every OS package XSLoader; $). What is described here is equally applicable to the L<DynaLoader|DynaLoader> interface.> A sufficiently complicated module using XS would have both Perl code (defined in F<YourPackage.pm>) and XS code (defined in F<YourPackage.xs>). If this Perl code makes calls into this XS code, and/or this XS code makes calls to the Perl code, one should be careful with the order of initialization. The call to C<XSLoader::load()> (or C<bootstrap()>) calls the module's bootstrap code. For modules build by F<xsubpp> (nearly all modules) this has three side effects: =over =item * A sanity check is done to ensure that the versions of the F<.pm> and the (compiled) F<.xs> parts are compatible. If C<$VERSION> was specified, this is used for the check. If not specified, it defaults to C<$XS_VERSION // $VERSION> (in the module's namespace) =item * the XSUBs are made accessible from Perl =item * if a C<BOOT:> section was present in the F<.xs> file, the code there is called. =back Consequently, if the code in the F<.pm> file makes calls to these XSUBs, it is convenient to have XSUBs installed before the Perl code is defined; for example, this makes prototypes for XSUBs visible to this Perl code. Alternatively, if the C<BOOT:> section makes calls to Perl functions (or uses Perl variables) defined in the F<.pm> file, they must be defined prior to the call to C<XSLoader::load()> (or =head2 The most hairy case If the interdependence of your C<BOOT:> section and Perl code is more complicated than this (e.g., the C<BOOT:> section makes calls to Perl functions which make calls to XSUBs with prototypes), get rid of the C<BOOT:> section altogether. Replace it with a function C =head1 DIAGNOSTICS =over =item C<Can't find '%s' symbol in %s> B<(F)> The bootstrap symbol could not be found in the extension module. =item C<Can't load '%s' for module %s: %s> B<(F)> The loading or initialisation of the extension module failed. The detailed error follows. =item C<Undefined symbols present after loading %s: %s> B<(W)> As the message says, some symbols stay undefined although the extension module was correctly loaded and initialised. The list of undefined symbols follows. =back =head1 LIMITATIONS To reduce the overhead as much as possible, only one possible location is checked to find the extension DLL (this location is where C<make install> would put the DLL). If not found, the search for the DLL is transparently delegated to C<DynaLoader>, which looks for the DLL along the C<@INC> list. In particular, this is applicable to the structure of C<@INC> used for testing not-yet-installed extensions. This means that running uninstalled extensions may have much more overhead than running the same extensions after C<make install>. =head1 KNOWN BUGS The new simpler way to call C<XSLoader::load()> with no arguments at all does not work on Perl 5.8.4 and 5.8.5. =head1 BUGS Please report any bugs or feature requests via the perlbug(1) utility. =head1 SEE ALSO L<DynaLoader> =head1 AUTHORS Ilya Zakharevich originally extracted C<XSLoader> from C<DynaLoader>. CPAN version is currently maintained by SE<eacute>bastien Aperghis-Tramoni E<lt>sebastien@aperghis.netE<gt>. Previous maintainer was Michael G Schwern <schwern@pobox.com>. =head1 COPYRIGHT & LICENSE Copyright (C) 1990-2011 by Larry Wall and others. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut | https://metacpan.org/release/XSLoader/source/XSLoader.pm | CC-MAIN-2019-30 | refinedweb | 613 | 64.1 |
What it says on the tin, post vids.
MP4/Webm Thread
- Miscellaneous
- Archive
did the speedboat people die?
lmao
are you kidding? of course they died, just look at that impact.
Well they kind of skimmed a bit so I thought that might have slowed them down so they didn't die. Although it looks like the engine might have landed on them as well. What fucking pointless way to die.
Anyone have that webm of the new Star Wars: The Eternal throne with the loli girl force gripping some trainers, with the screamo in the background?
no?
Thats the exact one, thank you, i thought i had it but apparently i deleted it. Any source on the music?
This is turning into that exact same fucking WEBM thread from yesterday.
I'm quite thick, can someone webm this for me please.
kek potential is underrated over here
boo hoo
I've got that whole video. It's one of the hottest, but that music is complete garbage.
I've been looking for more of her. Post anything you can of her please, she's so hot it's fucking stupid.
does anyone know what the 'it's a pussy' clip is from?
is that guy even romanian?
Get you some ffmpeg bra
nice one, thank you bro
That was stupid. Could have done it in like two seconds with a damn brick.
Np. It was just a dirty encode. Just used youtube-dl to download it and literally ran
ffmpeg -i youtubemoive.webm stupidshit.webm
Thanks, I'll look into it.
I use it for encoding old GIFs too. I'm sure there's probably online tools, but I'm more DIY.
whats the explanation to the mouse PTS ?
Song name?
Bag Raiders - Shooting Stars
the intrumental version
danka
I think it has a heart condition and reaching for the strawberries cause a problem so it zoned out for awhile until its blood pressure got back up.
Made it real quick.
I don't get it, why is it being spammed all over here?
called that shit 15 seconds in. you can't fake the eyes
well, thanks
Be the change. Control within your reach.
If I didn't know any better, I'd say that was a pretty harsh arrest.
he stalls in the end and falls down and dies. it was cut from the video
Didn't look harsh to me. I'd be willing you bet you're one of those "they didn't have to kill him the should have just shoot the gun out of his hand" kind of libs.
Was not harsh at all to be honest. Looks like he got what he deserved. Can't stand those fuckers blocking public highways. DUmb selfish fucks are getting people killed. Nothing more satisfying than seeing the idiots getting run over.
Source on that?
Any of you got the one of the one that hits the bride?
60-100K a year
DAMN DAYYYUM SON THIS WHITE ASS NIGGA CAN HUSTLE CUZ
wow this is next level cancer. like cuckchan's 10 year old rotted corpse became undead and this is the cancer on it. that's the joke, right?
how old is that person? where are they? what kind of accent is that?
is that a real life elmer fudd?
sounds like australian or new zealander; probably has a disease that causes them not to age correctly. surely in their 20s or very early 30s
Importance
kek
Man, Korea is suh-weeeeeet.
I saw Grizzly Man, that fucking retard deserved it
Metal Gear Gecko with rollerblades
Yep. Look up the Potomac River Run in Maryland article. Dead on impact
USE THE EMBED FEATURE TZAIRKSPi4Q
it really fucks me up, thinking about how many total man hours of development this took. first, whoever created the software, then whoever used the software to animate this. unless it was all one sicko that created the animation from scratch. jesus. days, weeks, maybe even months.
Nigga it's MMD and I'm sure dick swinging animations were already made by another sicko.
Holla Forums ate my videos
sauce?
Take it! Take it! Take it!
Did that part give anyone else a massive, extremely homosexual erection?
thas rite!
just imaging 100,000 of those swarming you on the battlefield…
Frequently Asked Question, from yellowstone-bearman.com
Have you listened to the supposedly "real death audio" that is floating around on the internet, including UTube and is it real?
I have heard it and no it is not real but a fake or spoof. Jewel Palovak still holds the original tape and has no plans to release it. I hope that she never does. There is now a second fake version posted on UTube. The publisher of this latest UTube version stated to me in an email that he knew the audio he labeled as real, is in fact a fake. It was posted to draw traffic to his UTube page.
All fake recordings so far have been under 3 minutes in length and the real tape is 6 minutes. As I reported above in my investigation the bear is nearly silent. Bears typically make very little sounds, and each fake recording has the sound of a bear roaring, growling, and making all sorts of noises. In movies, bear noises are dubbed in electronically.
Make crazy steel ball instruments not war
no way that's korea, user. from the looks of it, seems to be china
def china. plebs
He probably remembers the time that he was flushed down the toilet.
some please edit this, this needs a scene of like a tiger eating a gazelle at the end
needs a screaming shock face at the end
this one has english subtitles
That second one pisses me off. That nigga probably has MS. You can learn to understand what they're trying to say, and their cognition is not damaged. The link between their body and their brain is gradually being severed, though.
Just because someone talks like retards do, doesn't mean they're retarded. Not that people posting that kinda shit would be smart enough to be aware of that though.
SJWs/antifa are such mutant subhumans
Darude - sandstorm
Were they not wearing seatbelts?
hahahahhhahha
I love you
god damn i wish this had subtitles
the parrot is basically what all the neets browsing here would sound like if they got kicked out of their moms basement
source for the first vid?
When you have to go
Song name?
how would you feel
if someone you love was told similar things?
wtf im SJW now
sandstorm…
Too bad all those brainless talking heads in the media didn't realize that half the fucking reason Trump won is because they WOULDN'T SHUT UP ABOUT HIM. They gave him all the publicity anyone could want, Republicans don't give a shit how much of a disgusting, filthy hypocrite he is or how much he actually clashes with their sense of morality and righteousness.
how would you feel
No one would care how ==I== feel because I'm ==white==.
implying she didn't win simply because everyone else in the contest was white
Until someone cares about racism against ==my== race, FUCK OFF. Racism against whites is an even bigger problem yet we waste all our resources on making darkies feel slightly better. FUCK. OFF. Just fuck right off.
going to need a source on that asian one
straight newfag
thats a mainer accent
haha hot….
What is this??
i think the hamster caught a glimpse of his reflection on the lens of the camera right after falling down which gave him an out of body experience
2bigvid4u
Here's the original for faggots too lazy to jewgle search.
Game name?
I fucking like this guy
Sauce?
DELET THIS
blank page with just this:
o_o
forbidden
cucked again
not funny, interesting, or random. perhaps you should make a webm thread on pol
OMG LOL IM 11 AND THIS IS HILARIOUS JAJAJAJAJAJA XDDDDDDDDDDDDDDDDDDDDDDDDDD
What a load of bullshit.
pretty harsh arrest
play stupid games…
every fucking time!
But he was right
livescience.com
DELET THIS
THIS IS MY OC NOT TO BE REDISTRIBUTED
I'LL SEE YOU IN COURT
jej ppl still believing they're trolling her, go back to 4cuck. she's the troll you are the taret
The guy in the second webm was really fucking stupid. Doesn't hold his breath, and grasps the thing at the last second making it shift slightly. Good riddance, maybe he won't reproduce and spread his stupidity to the next generation.
That's the bad part though. He's crazy, but he's usually right about stuff.
Nooo, just let me die!
This. She's one of us.
liking pepe makes you an automatic Holla Forums user
For every one trying not to post shit, 100 are happily spamming the millionth variant of meme-rap-dancing hitler, exploding mohammed, niggers raping chickens live, and fashionable anti-sjwism by fashionable alt-right teens.
I could post quite a lot of this if you'd like.
Poor Hamster ;_;
what the story on that clip? been seeing it for awhile
What's the name of the song and what's the meaning of the lyrics?
(I have checked and it's not Darude - Sandstorm)
not to mention agreeing to it in the first place
Non-troll answer
You know, with good graphics and controls, that would make a great videogame. Doubly so if it was VR.
As for the question in the filename, the adrenaline rush.
No nasheed after the explosion.
555-come-on-now.jpg
Tattoo
Reminds me of this
God damn that's amazing.
Translation? Ich spreche nur ein bisschen Deutsch, und er spricht zu schnell für mich.
Original?
Source for that second webm?
You stupid ass nigga.
fuck you for making me watch that stupid shit you fucking complete cunt.
It's all fun and music until it JAMS!
Subtitles for that bit of the speech.
STOP CATERING TO THE SNOW NIGGERS SPREADING THEIR SNOW NIGGER GOSPEL/GOSSIP
IT ALL COMES DOWN TO YOUR SOUL
thank you
NAZI FART STEAMS
London is lost.webm
fear, nothing else, it will be fine move along
God damn, I watched that movie 2x and cried 2x at the same god damn part! That shit just got me very deep!
Camwhore said she's thirsty, her little brother heard this and got a caprisun for her. what happened after i've got no clue. probably nothing
Probably sucked his dick as a thank-you and for tips.
Are they chanting "Jerry! Jerry!" ? Holy fucking Kek.
Loud Nigra Scream.wav
Not a mental illness my ass
is that Bill Nye?
those legs
Help i'am being subverted by this jewess
3dpd, not even once
This thread
botched cat rescue
all these idiots would have had to do was block-off the hallway or set a trap for the cat on their side of the partition, then drape a rug over the glass rail a few yards away and secure it.. then walk away and leave the fucking cat alone.
the cat would have climbed up the rug once it felt safe and if the cage or trap was clever enough, ended up there. Worst case scenario the cat gets loose but is out of immediate danger.
the whole 'fireman rescuing cat stuck in tree' meme caused these retards to over-react… either that or they thought they were dealing with a suicidal cat.
this thread
comes to every thread posting wubms with "meme-_" as the name
kys
song name on the first one?
t h i c c
he will nut inside us
ABSOLUTELY FUCKING RIGHT!
100% not Aussie or NZ. Canadian perhaps.
you will never a Brittany
why even live
whites congregating with blacks
degeneracy.
And here's some OC.
Relax for once, stop having agenda
Some OP asked for sauce on a Russian heavy metal webm that went
In my city there are too many crows
in my city there are too many funerals
but I guess that OP was a faggot and the thread is gone. Does anybody have the webm?
Don't have the webm but the song is 'in my city' by MC Val
What a vile pile of flesh
furfag
anyone got that webm of the anime girl playing the recorder while hiter enters a room full of nazi officers, then the girl sieg heils along the others?
I remember watching the kingsman in theaters the day it came out, this scene was badass on the big screen
I've never felt like going vegan until now
what the fuck is wrong with this kid? are rednecks born this way?
lmao this was too much for me
i can't believe they brought the whole cast back for this | https://hollaforums.com/thread/6775507/miscellaneous/mp4-webm-thread.html | CC-MAIN-2019-30 | refinedweb | 2,150 | 82.75 |
import org.apache.ecs.ConcreteElement;61 62 public class RTFElement extends org.apache.ecs.ConcreteElement63 {64 65 public RTFElement()66 {67 setCase(org.apache.ecs.Element.LOWERCASE);68 }69 70 public Object get(String key)71 {72 return getElement(key);73 }74 75 public String createStartTag()76 {77 /* I should proabably store this within the class document, but78 RTF isn't as complex with tag types as other markups.79 */80 StringBuffer sb = new StringBuffer ();81 sb.append("{");82 sb.append(getElementType());83 84 return(sb.toString());85 }86 87 public String createEndTag()88 {89 /* I should proabably store this within the class document, but90 RTF isn't as complex with tag types as other markups.91 */92 StringBuffer sb = new StringBuffer ();93 sb.append("}");94 95 return(sb.toString());96 }97 }98
Java API By Example, From Geeks To Geeks. | Our Blog | Conditions of Use | About Us_ | | http://kickjava.com/src/org/apache/ecs/rtf/RTFElement.java.htm | CC-MAIN-2013-20 | refinedweb | 148 | 51.75 |
horus934,333 Points
EOF error in challenge, code runs fine in workspace
So I saw another post regarding a similar problem that didn't answer my question so here's mine.
"Create a function named square. It should define a single parameter named number.
In the body of the function return the square of the value passed in."
From what I could tell, and running it seems to do what the question's asking for. I created the function named square, defining only a single parameter named number, and return the square of the value passed in by the users input. Oddly it passes the first test ok, and the second one returns the EOF error. Maybe there's a different way it's wanting me to do things and I'm just misunderstanding the ask in this particular challenge?
import math def square (number): return math.ceil(number * number) number = float(input("What number would you like to square? ")) squared = square(number) print ("Your number squared equals {}".format(squared))
2 Answers
Jennifer NordellTreehouse Moderator
Hi there, horus93 ! I can see that you've worked hard on this and you're doing great. But keep in mind that these challenges aren't a full-fledged program. Treehouse is going to call that function and send in a number. They expect to get back the result of that number squared. Doing things like using an
input will likely cause the challenge to break. Remember, there's no one on the other side to input anything. You've also printed out the result and formatted it neatly, but again, this was not asked for by the challenge. Doing things that are not asked for can cause the challenge to break even if they are functional outside of the challenge.
Here's a list of things you will not need:
- the import of the math library
- math.ceil
- a
- an
inputstatement
You will also need to change the
squared variable to
result as asked for in the second step. In that step, you will send in a concrete number like 10 or 7 instead of trying to get the number from the user.
Mainly, the problem here lies in doing things that are not asked for by the challenge. I feel like you can get it with these tips, but let me know if you're still stuck!
horus934,333 Points
Haha thanks, as usual I was over thinking things, and after a day of work I came home with my brain too tired to process things properly (for some reason I was scanning over the word "not" in your list of things I would not need, and just reading it as "Here's a list of things you will need", so basically slapping my head against a wall until I reread your post this morning and fixed the issue allowing me to continue onward and upward!
Thanks Jennifer! | https://teamtreehouse.com/community/eof-error-in-challenge-code-runs-fine-in-workspace | CC-MAIN-2019-26 | refinedweb | 486 | 78.79 |
Do you want to transpose the input tensor? If yes then tf.transpose() allows you to do so. In this entire tutorial, you will learn how to implement TensorFlow transpose in python using different examples.
Example on Tensorflow Transpose
Before going to the examples part make sure you have properly installed TensorFlow on your system. Also, note that all the examples have been done on Jupyter notebook. So for better understanding, you should do the same on it.
The syntax for the TensorFlow transpose is below.
tf.transpose( a, perm=None, conjugate=False )
Here ‘ a‘ is the input tensor. The perm parameter allows the tensor to be transposed along the given axis. It defines the output shape of the transposed tensor. The parameter conjugate is true if the input tensor is of a complex type.
Example 1: Simple Tensorflow transpose on input tensor
In the example, I will create a simple input tensor and pass it to the tf.transpose() function. The output will be the transpose of the input array. The output will also be of tensor type.
Run the below lines of code.
import tensorflow as tf x = tf.constant([[10, 20, 30], [40, 50, 60]]) tf.transpose(x)
Output
Example 2: Transpose on input tensor using perm
If you pass the perm parameter then it will transpose the input array according to the size defined. For example,
I want to transpose as a 3×3 dimension then I will pass perm=[0,1]. Execute the below lines of code to transpose the tensor.
import tensorflow as tf x = tf.constant([[10, 20, 30], [40, 50, 60],[70,80,90]]) tf.transpose(x,perm =[0,1])
Output
Example 3: Transpose of Conjugate tensor
The above examples were not for conjugate tensors. But in case the input tensor is conjugate then also you can transpose it. To do so you have to pass conjugate=True as an argument to the tf.transpose().
Let’s create sample conjugate and transpose the tensor. Execute the below lines of code and see the output.
import tensorflow as tf x = tf.constant([[10 + 1j, 20 + 2j, 30 + 3j], [40 + 4j, 50 + 5j, 60 + 6j]]) tf.transpose(x,conjugate = True)
Output
There are examples of how to implement TensorFlow transpose. I hope you have liked this article. If you have any queries then you can contact us for more help.
Source:
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox. | https://www.datasciencelearner.com/tensorflow-transpose-implementation-python-examples/ | CC-MAIN-2021-39 | refinedweb | 415 | 68.36 |
Hello, i may be asking very small question, but i could nt find how to do ? Anyways lemme give my code for copying all the files from one directory to another
public class CopyingFile {
static File source = new File("/home/dev06/File/sourcefolder");
static File destin = new File("/home/dev06/File/destinationfolder");
public void copyFile(File source, File dest) throws IOException {
if (source.isDirectory()) {
String[] children = source.list();
for (int i = 0; i < children.length; i++) {
copyFile(new File(source, children[i]), new File(destin,
children[i]));
}
} else {
InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(destin);
// Copy the bits from instream to outstream
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}
}
public static void main(String[] args) throws IOException {
CopyingFile c = new CopyingFile();
c.copyFile(source, destin);
}
}
with my above code i was able to copy all the files from source to destin - now my query is i want copy only a list of files which are less than 1MB - and i want delete those copied files in source
any help will be appreciated | http://www.javaprogrammingforums.com/file-i-o-other-i-o-streams/13608-how-copy-files-one-directory-another-directory.html | CC-MAIN-2014-10 | refinedweb | 190 | 61.77 |
This manual page is part of the POSIX Programmers 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.
Name
Synopsis
Description
Return Value
Errors
Examples
Taking the Sine of a 45-Degree Angle
Application Usage
Rationale
Future Directions
See Also
sin, sinf, sinl - sine function
#include <math.h>
double sin(double x);
float sinf(float x);
long double sinl(long double x);
These functions shall compute the s sine of x.
If x is NaN, a NaN shall be returned.
If x is ±0, x shall be returned.
If x is subnormal, a range error may occur and x should.
() , feclearexcept() , fetestexcept() , isnan() , . | http://manpages.sgvulcan.com/sin.3p.php | CC-MAIN-2018-17 | refinedweb | 123 | 56.45 |
AS3 Sprite added to Stage but not visible
I'm trying to get a simple AS3 app up and running, and for some reason, I cannot get a sprite to show. At this point, all I want to do is get a red sprite to fill the stage.
public class Main extends Sprite { public function Main():void { super(); stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; var square:Sprite = new Sprite(); square.width = stage.stageWidth; square.height = stage.stageHeight; square.x = square.width / 2; square.y = square.height / 2; square.graphics.clear(); square.graphics.lineStyle(3, 0xFF0000); square.graphics.beginFill(0xFF0000); square.graphics.drawRect(0, 0, width, height); square.graphics.endFill(); square.addEventListener(Event.ADDED_TO_STAGE, addedToStage); square.addEventListener(MouseEvent.CLICK, onClick); addChild(square); } private function addedToStage(e:Event):void { trace("Added sprite to stage"); } private function onClick(e:Event):void { trace("Got click on sprite"); } }
The trace shows that the sprite was added to the stage, but nothing is displayed, and if I click on it, the onClick function never gets called. If I use a TextField instead of a Sprite, it displays just fine. There must be something weird about Sprites.
What am I doing wrong?
Thanks!
Answers
Trying to set the width and height for a empty Sprite will return 0. Have a look at here.
and
Refer Mr.Marty Wallace's answer.
Your issue is here:
square.graphics.drawRect(0, 0, width, height);
The values for width and height in this line are 0. The reason being that they are referring to the width and height properties of the class you're working within (Main - properties inherited from DisplayObject) which will be zero based on what I can see.
You're essentially saying:
square.graphics.drawRect(0, 0, 0, 0);
Which will render nothing.
Need Your Help
Create and pass Map to a request scoped attribute
java jsp spring-mvc jstl jsp-tagsIn my JSP model I have a bean of class MyBean in the scope.
How can I get my generic method to work?
c# generics lambda expression extension-methodsI am writing a small extension to my WPF viewModel base class that allows me to define dependencies between properties in a cleaner way than the standard method of raising multiple PropertyChanged ... | http://unixresources.net/faq/8321230.shtml | CC-MAIN-2019-04 | refinedweb | 375 | 66.94 |
I've done a lot of searching about casting an object in Ruby, and can only find examples of casting a string to an integer or vice versa. I'm curious how to cast other, more complex objects..
For Example with these classes...
class Animal
attr_accessor :weight, :name
end
class Duck < Animal
def speak
'Quack'
end
end
irb> animal = Animal.new
irb> duck = (Duck)animal
irb> duck.speak
=> "Quack"
An object in Ruby is created with a particular class and it will be destroyed with the same class, it never changes. You can't cast, either, all you can do is call functions which convert, a process that involves creating a new object or using another as a proxy.
In your case you can't cast, but you can create a duck with identical properties:
class Animal attr_accessor :weight, :name def initialize(options) # Allow calling new with either an options hash, or another # animal that's intended to be cloned. case (options) when Animal @weight = options.weight @name = options.name when Hash @weight = options[:weight] @name = options[:name] end end end class Duck < Animal def speak(phrase) '%s says %s' % [ name, phrase.inspect ] end end animal = Animal.new(weight: 10, name: 'Bill') duck = Duck.new(animal) puts duck.speak('quack!')
A second option is to move the duck-like functionality to a separate module you can mix-in:
module ActsAsDuck def speak 'Quack!' end end animal.extend(ActsAsDuck) puts animal.speak
That mixes in any methods in that module into your object instance. | https://codedump.io/share/PkZQYvwRiwZw/1/ruby-class-ineritance | CC-MAIN-2016-44 | refinedweb | 253 | 58.69 |
hi,
hi,
An unanswerable question is why is it 'bool' and not 'bool_t' to match <stdint.h> types?
Inconsistencies like this are annoying.
stdbool.h defines bool as a macro because the C standard 7.18
stdint.h defines intN_t as typedefs because the C standard 7.20
You can use one or the other to achieve the same effect, but it's better to use the proper one to your needs, you need to consider the compatibility of the your project.
Regards
Daniel.
The point is 'bool' is used as a type, it should end with a _t.
The heading of 7.16 clearly states 'bool' is a type:
"7.16 Boolean type and values".
By convention macros in C are upper case then by 7.18 it should
be BOOL, or properly BOOL_T.
We may be looking at different version of the standard as the one I'm looking at has 7.20 as:
7.20 General utilities <stdlib.h>
Hi yang,
'bool' is not a keyword in the C programming language. To use it, make sure you include stdbool.h:
#include <stdbool.h>
in your sources.
I hope this helps,
Erich | https://community.nxp.com/thread/490970 | CC-MAIN-2019-39 | refinedweb | 194 | 87.31 |
NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » compiling a .c file
i need to write a program with both a millisecond delay and a microsecond delay. i figured out with a changed value in the provided millisecond delay function of the libnerdkits i could get the desired microsecond behavior. i hoped i could then just save this .c file with a new name ( udelay )and it would create a corresponding udelay.o ( object ) file. i read in another thread that the normal compile of a program automatically runs the make file in the libnerdkits. when i do this i get, however, no created udelay.o file created. can anyone help?
Or you could just use delay_us(); instead of delay_ms();
Rick
sure. well, it looks to me that the ms delay is built on the us delay function anyway, but that does not solve my problem. i need this to put this seperate function in the libnerdkits folder. this is what i do not know how to do.
You are correct, delay_ms is built on delay_us. But you lost me as to what exactly you are trying to achieve. If you want to use delay_us or delay_ms, all you have to do is include ../libnerdkits/delay.h in your programs and both would be accessable.
If you are having problems compiling a library from a copy you modified, that would require a change in the makefile.
For instatnce. Say you make a change inside one of the funtions in the delay library (without adding or changing names of functions) then save it to a file called mydelay.c You would also need to copy delay.h to mydelay.h. Then in the makefile, change the reference of ../libnerdkits/delay.o in the LINKOBJECTS to ../libnerdkits/mydelay.o
Then your file will compile with your program. Keep in mind, you will also need to change the include in your program for your custom delay file.
just to explain the reason for two delays. i need a 30 micro second hi output. with the provided millisecond delay, i was unable to achieve such a short time. after changing a variable in the millisecond delay's .c file, i was able to get my 30 microseconds ( i am checking with an oscilliscope). between the high outputs i need it to stay low in the millisecond's range. the altered .c file did not cooperate, however. it appears less than 1 millisecond in the millisecond delay is a problem and more than 1000 microseconds in the microsecond delay is a problem.
i read something on .h files and thought it would not be necessary for what i was trying to do. i will digest your info. and let you know the my results... good or bad.
thanks
-dave
A little while back I had need for an improvement over delay_ms and delay_us and I put together this web page to create accurate timing loops. To use it in C, surround the results with "asm volatile". For example, to generate a 30us loop, go to the web page, enter 14.7456 as the CPU speed (for NerdKits crystal), 30 as the delay, press the "us" button, and it generates this:
; Delay 442 cycles
; 29us 975 25/576 ns
; at 14.7456 MHz
ldi r18, 147
L1: dec r18
brne L1
nop
To turn this into C code, make some minor tweaks to get it to work with the "asm" statement syntax:
asm volatile (
" ldi r18, 147" "\n"
"1: dec r18" "\n"
" brne 1b" "\n"
" nop" "\n"
);
I'm planning on having the web page do that automatically at some point.
It handles long delays quite easily. Here's a one-second delay for example:
asm volatile(
" ldi r18, 75 " "\n"
" ldi r19, 206" "\n"
" ldi r20, 238" "\n"
"1: dec r20 " "\n"
" brne 1b " "\n"
" dec r19 " "\n"
" brne 1b " "\n"
" dec r18 " "\n"
" brne 1b " "\n"
" rjmp 2f " "\n"
"2: " "\n"
);
hey bretm,
i have been away from my nerdkit for a while, but just plugged in your delay code. works! awesome. thanks man.
I have found the delay functions that are included with avr/gcc are quite accurate and as long as you define F_CPU to reflect your clock frequency, they self-adjust. I wonder why the nerdkit folks wrote their own in libnerdkits?
They're in the util directory ...
#include <util/delay.h>
functions are _delay_us(?) and _delay_ms(?).
Please log in to post a reply. | http://www.nerdkits.com/forum/thread/1384/ | CC-MAIN-2020-05 | refinedweb | 753 | 74.39 |
Switches in a cell in a table view
Is there any way to put switches in a cell in a table view?
@techteej Yes. I've just made a SettingsSheet class that does that and reads/writes the settings from a plist embedded in the .py file You need to subclass ListDataSource and then you can build the cells yourself.
@tony There doesn't happen to be an easier way?
@techteej The documentation talks about implementing your own datasource from scratch and there's a few examples of that around. Hopefully though, it's simpler to just subclass the existing ListDataSource. Don't be put off, it's not too hard. There's only one method to override, the one that builds the row... and 2 lines to make the cell, 6 the switch.
@techteej Here's a little test harness that will let you run the class above... paste it after the class and move the import to the top. Of course you'll get an error if you switch the switches because there's no plist in this little harness... but if you see it working you might be encouraged...
import ui tv = ui.TableView() lds = SettingsSheetDataSource([{'setting' : 'Setting 1', 'value' : 'On'}, {'setting' : 'Setting 2', 'value' : 'On'}]) lds.tableview_can_delete = False tv.data_source = lds tv.row_height = 50 tv.allows_selection = False tv.present('sheet')
_swA()throws AttributeError: 'NoneType' object has no attribute '_pl'.
Also, setting the "value" to True or False instead of 'On' or 'Off' simplifies the logic.
@ccc Did you read the comment with the post... "Of course you'll get an error if you switch the switches because there's no plist in this little harness" ?
Ahh, Another instance of iietdpctep. Code fragments are suboptimal. | https://forum.omz-software.com/topic/1042/switches-in-a-cell-in-a-table-view | CC-MAIN-2018-47 | refinedweb | 288 | 77.64 |
If I do this code in the command line:
f = open(fl, 'r') txt = "" for line in f: txt+=line f.close() print txt
I get all the output for the file fl, but if I do:
def editfl(self, fl): f = open(fl, 'r') txt = "" for line in f: txt+=line f.close() self.notebook_1.SetSelection(2) self.dedfrom = "fm" self.dedfl = fl self.text_ctrl_8.SetValue(txt)
then I only get the first 8-9 lines,
Until now it only occurs with this file (a log file generated by logkeys),
other (longer) files appear right...
What is causing the problems?
P.S.:If I try it with gedit I only get a bunch of weird not ASCII signs.
in bash, `cat` does output the content of the file right :s | https://www.daniweb.com/programming/software-development/threads/260818/python-command-line-and-wxpython | CC-MAIN-2018-26 | refinedweb | 131 | 74.08 |
Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Which method is executed when clicking on trash icon in tree view
I am using odoo 9. I am working in a view with a one2many field. The one2many field tree view list, there is a trash icon on the left of each row. When I click on the trash icon, I would like to intercept record deletion and perform some custom action.
I tried to override unlink method but it does not break into the break point set inside the unlink so I think odoo is not calling unlink. Any idea?
The view is view_pack_operation_lot_form. Here is my method:
@api.multi
def unlink(self):
res=super(myclass, self).unlink()
# do my stuff
return res
It is not clear from you question whether you are calling the Unlink method of Child or Parent object.
Anyways In case of One2many, Deleting depends on the record's storage mode, i.e
deletion upon saved lines (physical records)
deletion upon unsaved records (cache records)
Hence when you calling Unlink method of Child Object, this will work well w.r.t Physical Records, but not on Cache records, which are not saved to the database.
So the alternate solution would be to deal with the One2many field values which you will receive in the Write Values of Parent Object.
Sorry, originally I put the unlink method in the child class (stock.pack.operation.lot) which I realize is not correct. It should be in the parent class (stock,pack.operation). So I override the parent (stock.pack.operation) unlink method. Upon deleting the row, it still does not trigger the parent class' unlink method.
In my case, it is the cache scenario since the rows are not saved yet. I cannot wait until "write" is called when clicking on the "Save" button though since I need to perform some operation on the cached rows before saving to the db.
I would like to know which method is called when the trash can icon is clicked. Then I can try to intercept and override that, I cannot locate the codes in the source. If you have ideas, please share with | https://www.odoo.com/forum/help-1/question/which-method-is-executed-when-clicking-on-trash-icon-in-tree-view-110542 | CC-MAIN-2017-04 | refinedweb | 384 | 74.19 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.