content
stringlengths 228
999k
| pred_label
stringclasses 1
value | pred_score
float64 0.5
1
|
---|---|---|
Expressions and Equations End of Unit
starstarstarstarstarstarstarstarstarstar
by Courtney Paull
| 10 Questions
1
1
5x + 4x - x = 40
x = ?
2
1
Which of the following is equivalent to the expression below:
5x + 3 + 6x + 6
20x
8x + 12
11x + 9
20 + x
3
1
x + 7x - 90 = 8x + 90
True
False
4
1
x + 7x - 90 = 8x + 90
Explain your answer from problem 3.
5
1
Ann had $120 to spend on books. After buying 10 books she had $8.30 left.
If each book costs the same, let b be the cost of each book
Write an algebraic equation that represents the situation:
6
1
Simplify the expression:
2(3x + 6)
7
1
4(2x + 3) = 44
What is the value of x?
8
1
Five people visited a local restaurant to get some lunch. A burger costs 6 dollars and a bottle of apple juice costs an unknown amount. If all five people ordered a burger and a bottle of apple juice, write a numerical expression to show the amount of money the restaurant made for this order.
Which expression matches the story. (Choose all that apply)
5*x + 6
5(6 + x)
5*6 + x
5*6 + 5*x
9
1
The cost of trip to the water park costs $85. The trip cost includes $15 for lunch and 1 pass for the wet rides and 1 pass for the dry rides. The cost of each pass is the same. Let p be the price of one pass
Write an algebraic equation that represents the cost of the trip using p
10
1
The cost of trip to the water park costs $85. The trip cost includes $15 for lunch and 1 pass for the wet rides and 1 pass for the dry rides. The cost of each pass is the same.
Let p be the price of one pass
What is the cost of one pass?
Add to my formatives list
Formative uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to the Terms of Service and Privacy Policy. | __label__pos | 0.989684 |
How to use the follow me tool in Google SketchUp
The “follow me” tool in GoogleSketchUp can make a 2D object 3-dimensional, making it follow a path that you specify. The SketchUp follow me tool allows you to create these objects at various angles. To become a SketchUp pro and learn how to work efficiently in this software it is important to know how to work your way around these various tools.
To learn how to use the follow me tool in Google SketchUp look at the steps given below.
Step # 1 – Create a shape and its path
To understand the workings of this tool, create a rectangle and use the line tool to create a path extending from this shape.
Draw a shape and its path
Step # 2 – Select the “follow me” tool
To select the “follow me” tool go to the “tool” menu and select the “follow me” option.
Choose the “follow me” tool
Step # 3 – Use the “follow me” tool
Now select the “follow me” tool, click on the rectangle and move the cursor along the path. The shape automatically extends till your path.
This is only possible for shapes. If you draw a line and use the “follow me” tool on it, the tool has no effect.
Work with the “follow me” tool
Step # 4 – Make a circle and its path in the same direction
Make a circle and a path from it; however in this path, the “follow me” tool does not work. This is because the line that is made is on the same axis as the circle.
Draw a circle and its path in the same direction
Step # 5 – Make a path with a different direction
Make another path which is not in the same direction as the shape itself. The “follow me” tool will now extrude the shape.
Create a path in a different direction
Step # 6 – Alter the size of the shape
Once you have made the shape and you feel like increasing the length of the shape, then the “follow me” tool does not work, the “Push/Pull” tool can be used instead. The length of it can be shortened though, even the remaining path that you did not cover can be deleted by selecting it and pressing the “delete” option. Both the “follow me” and the “Push/Pull” tool in GoogleSketchUp cannot extrude a circular surface as shown by the message that pops up once you hover above the object.
Learning about these tools allows you to become a SketchUp pro and enables you to work more efficiently on your drawings.
Change the size of the shape | __label__pos | 0.997691 |
Personal tools
Haskell Quiz/Housie/Solution Dolio
From HaskellWiki
Jump to: navigation, search
This solution uses a two pronged approach to the problem. Naively generating and testing books is too slow. However, if one looks only at whether spaces are empty or filled, the search space is sufficiently small to generate random candidates and search for a valid result among them. This search results in a template for the book, which can then be filled in (with some additional constraint checking) to get the final result.
Since the algorithm involves randomly guessing candidate results, it's possible for it to take a very long time. However, in practice, results usually appear in a matter of seconds.
This code makes use of the random monad.
module Main where
import Control.Monad
import Data.List
import MonadRandom
-- Some handy datatypes and aliases
type Card a = [[a]]
type Book a = [Card a]
data Slot = Filled | Vacant deriving (Eq)
-- Some general functions
combinations :: [a] -> [a] -> [[a]]
combinations xs [] = [xs]
combinations [] ys = [ys]
combinations (x:xs) (y:ys) = map (x:) (combinations xs (y:ys))
++ map (y:) (combinations (x:xs) ys)
splitAtM :: MonadPlus m => Int -> [a] -> m ([a], [a])
splitAtM _ [] = mzero
splitAtM n xs = return $ splitAt n xs
select :: MonadRandom m => [a] -> m (a, [a])
select xs = do i <- getRandomR (0, length xs - 1)
let (f, x:l) = splitAt i xs
return (x, f ++ l)
stream :: MonadRandom m => [a] -> m [a]
stream rs = map (rs !!) `liftM` getRandomRs (0, length rs - 1)
slice :: Int -> [a] -> [[a]]
slice n x@(_:tx) = take n x : slice n tx
-- Some problem-specific functions
rowTemplates :: [[Slot]]
rowTemplates = combinations (replicate 5 Filled) (replicate 4 Vacant)
bounds :: [(Int, Int)]
bounds = zip (1: [10, 20 .. 80]) ([9, 19 .. 79] ++ [90])
validateCol :: [Int] -> Bool
validateCol c = nc == (nub . sort $ nc)
where nc = filter (> 0) c
-- For creating an entire book
bookTemplates :: MonadRandom m => [[Slot]] -> m [[[Slot]]]
bookTemplates rs = (filter validateBookTemplate . slice 18) `liftM` stream rs
validateBookTemplate :: [[Slot]] -> Bool
validateBookTemplate b = and $ zipWith (==) fls bls
where
fls = map (length . filter (== Filled)) . transpose $ b
bls = map (length . uncurry enumFromTo) bounds
fillBook :: MonadRandom m => [[Slot]] -> m (Book Int)
fillBook bt = liftM (unfoldr (splitAtM 3) . transpose)
. mapM fill . zip bounds . transpose $ bt
where
fill (b,c) = do c' <- f (uncurry enumFromTo b) c
if all validateCol (unfoldr (splitAtM 3) c')
then return c'
else fill (b, c)
f _ [] = return []
f b (Vacant:xs) = liftM (0:) (f b xs)
f b (Filled:xs) = do (r, b') <- select b
liftM (r:) (f b' xs)
-- For output
intercalate s = concat . intersperse s
showCard = unlines . map (intercalate "|") . map (map showN)
where
showN n
| n == 0 = " "
| n < 10 = " " ++ show n
| otherwise = show n
showBook = intercalate "\n" . map showCard
main = bookTemplates rowTemplates >>= fillBook . head
>>= putStrLn . showBook | __label__pos | 0.921975 |
In particle animation, where did the Vect setting go?
Hi Everyone,
What I’m trying to do is to create an interesting video background using nothing but particles, I set up a single plane emitting particles and then two field objects effecting the particle 1 wind and 1 vortex. The problem I’m running into is that when changing the shape of the particles by using the object particle type, the particles no longer face the vector as the they do with the ‘line’ setting. the physics tab seems to only orient the particle based on emission, the ‘dynamic’ button even when turned on only rotates them slightly in odd directions. I’ve tried rotate the object used as particles. I searched all over the internet and the only solution I found was the ‘Vect’ button, that is no longer in the current versions of blender. I am using version 2.49. Is there a good replacement for the ‘vect’ function?
Any help is appreciated.
• Sam
I figured it out, sorry for the extra thread
Hi ! I was also looking for this answer… I can’t find the “vector” button anywhere, and it’s necessary for the look I’m trying to achieve based on a tutorial I’m following.
soooo what was the solution you figured out?
Thanks!
Also forgot to ask… In the tutorial that I’m doing, the emitter is a circle with 6 vertices.
I can’t seem to figure out how to get all six vertices to emit as in the tutorial. The idea is to get a symmetrical shape where all 6 vertices emit particles as lines or points . In the Tut, using mostly default settings (from 2.41) just giving the particles velocity from the normals seems to give a nice stream of particles from all 6, mine does what appears to be 99% of the particles coming from one vertex.
Is there a setting in 2.49 that makes all vertices emit simultaneously?
Thanks! | __label__pos | 0.986064 |
Due to shifting worldwide trends and technological advancements, traditional television has been on the decrease for some years. The increasing spread of the internet has made everything, including television, more accessible. Thanks to internet protocol television, you may now watch your favorite shows and movies whenever you want (IPTV internet protocol television). IPTV has swiftly swept the market because to its enhanced user experience, which is the number-one consumer requirement in today’s fast-paced world.
But what precisely is IPTV? What is the mechanism behind it? Is it all good? Is there nothing bad about it? These are just a few of the issues we’ll discuss in this post.
Let’s begin with the fundamentals.
• What Is IPTV and How Does It Work?
IPTV stands for internet protocol television, which means that instead of using antennas, satellite dishes, or fiber-optic cables, consumers get television shows through the internet. To put it another way, IPTV internet protocol television broadcasts video content over the internet.
Although IPTV content distribution differs from that of internet video platforms such as YouTube or over-the-top (OTT) services such as Netflix, it shares many of its advantages. IPTV, for example, allows subscribers to subscribe to video on demand (VOD) programming and view live broadcasts. This allows people to watch their favorite episodes whenever they want while still being able to watch live events and programming on traditional television.
Because of its versatility, IPTV internet protocol television outperforms traditional television and is regarded as the medium’s future.
• What Is IPTV and How Does It Work?
Traditional television transmits analog signals to consumers through wires, allowing them to view only the currently aired material. Users can only control when and what they see in these situations by using external recording equipment.
The way IPTV internet protocol television operates varies a lot. Unlike traditional television, which can only transmit live programming, IPTV uses servers to store content. This allows users the ability to request applications at any time. After a user chooses a show to view, the content is converted to digital format and sent to their playback device in packets over the internet protocol. Before they reach the end-users, the files will be compressed and optimized for streaming.
However, in order for any of the above to work, your TV must be able to interpret signals sent through the internet protocol. Unfortunately, not all TVs can set up an IPTV service straight once because most of them can’t interpret signals without assistance. If your TV isn’t IPTV internet protocol television compatible, you’ll need to get an IPTV set-top box.
• What Is an IPTV Box?
An IPTV box, often known as a set-top box, is a device that converts streaming internet protocol signals into a format that a television can understand and reproduce. In other words, set-top boxes translate the internet protocol’s language. These boxes are frequently linked to the television by HDMI or AV connections, or, in the case of newer devices, over Wi-Fi.
You won’t need a set-top box if you prefer to stream IPTV internet protocol television from your computer because PCs can already read data sent over the internet protocol. Those who don’t want to spend money on a set-top box but still want to view IPTV on their TVs can mirror their computer displays on the TV and watch from there.
• Types of IPTV Formats:
IPTV, as previously stated, provides a variety of extra services and video formats in addition to standard television broadcasts. Most IPTV internet protocol television systems provide one of three content formats:
• Live TV – Similar to traditional television, live IPTV allows viewers to live stream television programming in real time. Live TV is most commonly used to broadcast live events such as sporting events, conferences, and so on.
• Video on Demand (VOD) – VOD IPTV services function similarly to other OTT providers in that you pay a monthly membership fee in exchange for access to a vast library of movies that you can watch whenever you want.
• Time-Shifted TV — Also known as “catch-up TV,” this service allows customers to watch previously broadcast television episodes at a later time. However, there is one key distinction between time-shifted TV and VOD. Users of time-shifted television may only revisit past programs for a limited amount of time. Broadcasts are often available for a few days before fading. Anything older than that is termed a video on demand (VOD).
With the ability to view live broadcasts, catch up on missed episodes, and watch on-demand programming, IPTV internet protocol television clearly outperforms its conventional equivalent in terms of options and user experience.
Let’s take a brief look at all of IPTV’s advantages and disadvantages.
• IPTV’s Advantages and Disadvantages:
Although IPTV provides tremendous flexibility and user experience, it is much more than that. It’s also important to consider both sides of the argument, as IPTV internet protocol television isn’t without flaws. Here are some of the most noteworthy IPTV advantages and disadvantages as you can also check out this page to see why you should choose our IPTV LIT subscription service:
Pros:
• Simple to Set Up and Use – To get started, all you need to do is purchase a set-top box and connect it to your television. In addition, newer models’ Wi-Fi connectivity simplifies the procedure greatly.
• It’s 100 percent digital – As the world becomes increasingly digital, switching to digital television offers a solid foundation for the future and new technology.
• IPTV Allows Smooth Simultaneous Streaming of Various Programs — IPTV internet protocol television services allow customers to watch multiple programs on different devices at the same time (TV, PC, Mobile, etc.).
• Variety of Service Types – IPTV provides a wide range of services to cater to a wide range of user preferences.
• Allows Users to Enjoy a Commercial-Free Experience – Many people despise advertising, so the ability to skip or fast-forward through them is a significant increase in quality of life.
• Incredibly Effortless in terms of time — IPTV’s attraction to customers throughout the world stems from the absence of needing to wait for your program to begin at a set time and the ability to skip ads.
Cons:
• Network Overloads May Cause Technical Troubles – If too many people view the same program at the same time, the network may become overloaded, resulting in buffering or playback issues.
• Users Have No to No Control Over Channel-Related Issues – If a channel’s server has a mistake, viewers have little choice except to wait.
• Synchronization Issues Are All Too Common – Viewers may suffer synchronization issues as a result of normal network speed and quality changes. If this happens, it will have a significant impact on the quality of the user experience.
As you can see, IPTV internet protocol television isn’t perfect, and it has certain drawbacks when compared to regular television. But, given how quickly technology advances, we shouldn’t be shocked if these few concerns are resolved sooner rather than later. Besides, wouldn’t you agree that the UX improvements IPTV brings to the table far outweigh these potential issues?
• Is IPTV the Way of the Future?
The future of IPTV is difficult to predict, but we have enough data to make an educated judgment.
People currently have less time to watch television, and the desire for personalized programming is at an all-time high. As a result, having the flexibility that IPTV internet protocol television provides is becoming increasingly important in today’s environment. And, with internet video platforms delivering on-demand programming at an all-time high, the television business must find a means to compete. Fortunately, IPTV turned out to be the ideal option!
You still don’t trust us? Let’s get down to business!
Globally, demand for IPTV services is increasing at a rate of 30–35 percent each year. The anticipated market value of IPTV internet protocol television adds to this trend. The IPTV industry was valued $40.85 billion in 2019 alone, according to Mordor Intelligence, and it’s only projected to expand. Experts believe that by 2025, the figure might be as high as $104 billion!
When you consider the above, as well as the fact that conventional broadcasting firms are facing an increasing number of competitors in the shape of OTT platforms like Netflix and Hulu, it’s evident that they must find a method to stay relevant in the market. And IPTV internet protocol television has shown to be just that!
• So, what does IPTV’s future hold?
In the increasingly competitive internet video broadcasting sector, we feel that nothing is definite, but the odds are that it will continue to rise. After all, the only way for traditional television to survive the digital era is to embrace it and figure out how to adapt.
IPTV LIT might be the ideal answer!
Select your currency
USD United States (US) dollar
EUR Euro | __label__pos | 0.60853 |
Vertopal — Free Online Converter
Upload to Clouds
Drop Files Anywhere to Upload
Convert PJPEG to EPSI
Convert PJPEG pictures to EPSI format, edit and optimize pictures online and free.
Loading Uploader...
if you have uploaded a file, it will be displayed.
Confirm Cancel
Progressive JPEG Image (.pjpeg)
PJPEG Converter
Encapsulated PostScript (.epsi)
EPSI and EPS both stand for an identical format. EPSI, short for Encapsulated PostScript Interchange, is a vector file format developed by Adobe Systems. It is often used for professional and high-quality image printing and retains individual coding on color and size, allowing images to maintain their resolution when scaled. EPSI was designed to simplify the process of incorporating images and illustrations into text-based documents. EPSI is the same as plain EPS, except that it has a preview image inside it.
EPSI Converter More About EPSI
How to convert PJPEG to EPSI?
1. Upload PJPEG File
Drag & drop or browse your device to select and upload your PJPEG file.
2. Select PJPEG Tools
Before clicking the Convert button, use any available PJPEG to EPSI tools.
3. Download Your EPSI
You will be redirected to the download page to see the conversion status and download your EPSI file.
Convert PJPEG to EPSI
Tools
PJPEG Rotate
Rotate PJPEG to right (90° clockwise), to left (90° counter-clockwise), 180°, and convert it to EPSI.
PJPEG Flip
Flip PJPEG vertically and/or horizontally (flop), and convert it to EPSI.
Frequently Asked Questions
How to change PJPEG format to EPSI?
To change PJPEG format to EPSI, upload your PJPEG file to proceed to the preview page. Use any available tools if you want to edit and manipulate your PJPEG file. Click on the convert button and wait for the convert to complete. Download the converted EPSI file afterward.
Convert Files on Desktop
macOS
Windows
Linux
Convert PJPEG to EPSI on macOS
Follow steps below if you have installed Vertopal CLI on your macOS system.
1. Open macOS Terminal.
2. Either cd to PJPEG file location or include path to your input file.
3. Paste and execute the command below, substituting in your PJPEG_INPUT_FILE name or path. $ vertopal convert PJPEG_INPUT_FILE --to epsi
Convert PJPEG to EPSI on Windows
Follow steps below if you have installed Vertopal CLI on your Windows system.
1. Open Command Prompt or Windows PowerShell.
2. Either cd to PJPEG file location or include path to your input file.
3. Paste and execute the command below, substituting in your PJPEG_INPUT_FILE name or path. $ vertopal convert PJPEG_INPUT_FILE --to epsi
Convert PJPEG to EPSI on Linux
Follow steps below if you have installed Vertopal CLI on your Linux system.
1. Open Linux Terminal.
2. Either cd to PJPEG file location or include path to your input file.
3. Paste and execute the command below, substituting in your PJPEG_INPUT_FILE name or path. $ vertopal convert PJPEG_INPUT_FILE --to epsi
Loading, Please Wait... | __label__pos | 0.574041 |
fishbone fishbone - 9 months ago 37
PHP Question
Symfony2 remove id field from submitted form data
My Symfony2 form has a text field containing the entity's ID.
I used the following to achieve this:
$formBuilder->add('id', TextType::class, ['attr' => ['readonly' => true]])
When submitting the form, which represents an existing entity, the ID is passed and Doctrine searches for an accessor method to modify the ID. At this point, an exception is thrown, as the entity doesn't allow to change the ID.
What is the common way in Symfony2 to provide a read-only field, which is not meant to be saved?
Answer
readonly is for clients. It indicates that client can't change the value of the element. But it is going to be submitted with form.
If you don't want element's value to be submitted use disabled instead. | __label__pos | 0.820491 |
MATLAB Answers
Advantages of mwsize (Cross-Platform Flexibility)?
2 views (last 30 days)
Steradiant
Steradiant on 23 Dec 2020
Edited: James Tursa on 21 Jan 2021
Hello,
in the documentation there is the hint to use mwsize rather than int for Cross-Platform Flexibility. What is the actual advantage? The backround of my question is the following: I want to write (and partly already have written) C-Code which I wan to use in MATLAB. I tried to find a good workflow to extend the existing C-Code and use it in MATLAB. The big problem I came across is the debugging. I found this very helpful Blog entry: https://blogs.mathworks.com/developer/2018/06/19/mex-debugging-vscode/ nevertheless, it is pretty cumbersome to debug like this all the time. Especially because MATLAB might crash pretty often because bugs happen during development of new C-Code. Therefore, I thought it would be better to write the code in a C IDE and just put the wrapper mexFunction around my code at the end. My question is, if I loose a lot of performance if i do it this way?
Furthermore, a question arose regarding the 'MATLAB Support for Interleaved Complex API in MEX Functions'. Which API is preferred for high speed applications?
Accepted Answer
James Tursa
James Tursa on 21 Jan 2021
Edited: James Tursa on 21 Jan 2021
"Furthermore, a question arose regarding the 'MATLAB Support for Interleaved Complex API in MEX Functions'. Which API is preferred for high speed applications?"
This is somewhat of a moot point given that the choice is determined by the MATLAB version you are using. If you are using R2017b or earlier, then you will be using two separate Real/Imaginary data areas. If you are using R2018a or later, then you will be using a single interleaved Complex data area. There are no MATLAB versions that simultaneously support both methods. Compiling a mex routine in R2018a or later with the -R2017b memory model option simply forces the mex routine to do a copy-in/copy-out on all complex variables in the background. It does not change the underlying storage scheme of the variable data, which is always interleaved complex in R2018a and later.
As to which is faster, that depends on what you are doing. Note that the BLAS and LAPACK complex linear algebra library routines that MATLAB uses only support the interleaved complex data model (in every version of MATLAB, not just R2018a and later), so that drives the comments below. E.g.,
Matrix Multiply real * complex:
The R2017b separate storage scheme will be faster because the BLAS matrix multiply routines can be called directly without any intermediate data copying needed. I.e., the individual real*real and real*imaginary pieces can be done by making two calls to the real BLAS matrix multiply routine and the results stuffed directly into the MATLAB output variable. For the R2018a interleaved storage scheme to use the complex BLAS matrix multiply routine in this case, it must first deep copy the real variable into a complex variable with imaginary part 0, and then make the call. So extra wasted memory and time to do the intermediate deep data copy for R2018a and lots of extra unnecessary 0 multiplies.
Linear Algebra calls to complex LAPACK routines:
The R2018a interleaved storage scheme will be faster because the input can be passed directly to the LAPACK routine and the output stuffed directly into a MATLAB variable. No intermediate deep data copying needed. For the R2017b separate storage scheme to use the complex LAPACK routine, it must first deep copy the separate real/imaginary data areas into a single contiguous interleaved area and then pass that to the LAPACK routine. Then it must take the interleaved result and deep copy it into two separate real/imaginary data areas for output back to MATLAB. So extra wasted memory and time to do the intermediate deep data copies.
More Answers (1)
Walter Roberson
Walter Roberson on 23 Dec 2020
In C, int is permitted to be 16 bits or larger. It is common for compilers to treat int as 32 bits. It is uncommon for compilers to treat int as 64 bits: 64 bits is typically long int or long long.
Meanwhile, mwsize is defined as 64 bits provided that large array dims is enabled, which it should be for any 64 bit target.
Using int puts the correctness of your code at the mercy of the compiler default integer size, instead of using a fixed size as is required by MATLAB
5 Comments
Walter Roberson
Walter Roberson on 20 Jan 2021
At some point in the future, Mathworks might decide to switch to (for example) 80 bits for matlab class double. Interfaces coded in mxDouble would make the transition automatically, but code that uses C or C++ double would have to be upgraded.
Also, some vendors such as IBM are actively pursuing non-IEEE-754 floating-point, as some of the design choices of 754 are limiting performance improvements (in particular, signaling nan and denormalized numbers)
Sign in to comment.
Tags
Products
Release
R2020b
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Translated by | __label__pos | 0.584276 |
dcsimg
October 20, 2018
Hot Topics:
Getting Started with the Greenfoot Java IDE
• July 29, 2008
• By Richard G. Baldwin
• Send Email »
• More Articles »
Programming Notes # Hs00301
Preface
What is Greenfoot?
Greenfoot is a combination of a Java IDE that provides a class browser, compilation, interactive execution, single-step execution, a code editor, etc., on one hand and a framework for creating two-dimensional animations, games, and simulations on the other hand (see Greenfoot Home in Resources). Greenfoot is also available free of charge.
Relatively painless, fun, and engaging
Greenfoot provides a painless, fun, and engaging entry point for novice programmers but also supports the full power of the Java programming language for more advanced programmers.
A harmonic wave simulator
Click here to open a page containing a harmonic wave simulator in a separate browser window (or in a separate tab on your browser). Click the Run button at the bottom and move the blue bead to activate the wave motion. Move the Amplitude, Frequency, and Damping sliders to change the physics of the simulation. Flip the switch on the upper left to switch between manual operation and an oscillator. (Note that your browser must support Java 1.5 or later for this applet to run properly.)
Fun and engaging
Greenfoot is fun and engaging because Greenfoot makes it relatively easy for novice programmers to create 2D games, animations, and simulations.
Powerful
Greenfoot is powerful because it allows for the use of the same Java code that an advanced Java programmer would use in a major Java project. Included in that power is the ability to do any or all of the following:
• Execute the scenario (project) inside the IDE, either in single-step mode or run mode.
• Export the scenario as a Java applet in a JAR file with an accompanying HTML file.
• Export the scenario as an application in an executable JAR file.
• Publish the scenario on the Greenfoot web site for review and comment by others.
Terminology - scenario or project
As a matter of clarification, most of the Greenfoot documentation uses the word scenario to describe what might be referred to as a project in other programming environments and IDEs. For purposes of this tutorial, the two terms are interchangeable.
Viewing tip
I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the figures and listings while you are reading about them.
Figures
• Figure 1. Visual manifestation of the Greenfoot IDE.
• Figure 2. Context menu for the World class.
• Figure 3. Dialog for specifying name and image for new class.
• Figure 4. Context menu for the MyWorld class.
• Figure 5. The source code editor.
• Figure 6. Context menu for the Actor class.
• Figure 7. Result of selecting the new MyActor() option.
• Figure 8. Lots of spiders.
• Figure 9. The Greenfoot IDE in Run mode.
• Figure 10. The context menu for a MyActor object.
• Figure 11. Method inheritance information for a MyActor object.
• Figure 12. An Object Inspector window.
• Figure 13. Export dialog.
Listings
• Listing 1. Class definition code for the class named MyWorld.
• Listing 2. Class definition code for the class named MyActor.
Supplementary material
I recommend that you also study the other lessons in my extensive collection of online programming tutorials. You will find a consolidated index at www.DickBaldwin.com.
A simple Greenfoot scenario
I'm going to begin by giving you a look at a very simple Greenfoot scenario. The visual manifestation of the Greenfoot IDE, version 1,4,1 is shown in Figure 1.
Figure 1. Visual manifestation of the Greenfoot IDE.
The stage and the actors
This is an animation scenario involving a stage and an actor. The blue rectangle on the left in Figure 1 is the stage upon which the actors perform. (In this scenario, there is only one actor, which is represented by an image of a spider. Note, however, that there could be many actors in a more complicated scenario.)
Classes and objects
If you are a beginner in OOP, you may not yet know about classes and objects. If so, you will simply need to bear with me at this point. I want to make certain that I am using proper terminology throughout, even when I haven't yet explained that terminology.
Classes and objects
This stage is the visual manifestation of an object created from the class named MyWorld shown in the class diagram on the right in Figure 1. The spider is the visual manifestation of an object created from the class named MyActor shown in the class diagram on the right.
A quick explanation of classes and objects
I have much more to say about classes and objects in other lessons on my website (see Dick Baldwin's Programming Tutorials in Resources). For now, suffice it to say that a class is analogous to a set of blueprints or plans from which something can be constructed. An object is the thing that is constructed from those blueprints.
Overall behavior
A little later, I will show you the Java code that produces the behavior that I am about to describe. This scenario is designed to animate the spider and cause it to move diagonally down and to the right across the stage toward the lower right corner.
At the bottom of Figure 1, you see a button labeled Act and another button labeled Run. Each time the button labeled Act is clicked, the spider will move one step to the right and one step down. (I will explain what I mean by one step later.) If the button labeled Run is clicked, the spider will move in incremental steps toward the lower right corner. The effect of clicking the Run button is the same as if someone were to repeatedly click the Act button. When the spider reaches the lower right boundary of the stage, it will stop.
The Reset button and the speed slider
You can also see a button labeled Reset in Figure 1. This button does what most buttons labeled reset do. It resets the program.
There is also a speed slider on the bottom of the IDE but it doesn't show in Figure 1. This slider is used to increase or decrease the animation speed. (The slider doesn't show in Figure 1 because I had to manually reduce the width of the IDE to make it fit into this narrow publication format.)
The classes named World and Actor
The classes named World and Actor are part of the Greenfoot IDE and are always there when you create a new scenario. Their purpose is to make it easy to write animation, game, and simulation scenarios in addition to more general-purpose Java programs. A custom API is also included with the IDE to support that purpose.
To define the class named MyWorld so that I could construct an object from that class to represent the stage, I extended (or inherited from) the class named World. The arrow that points from MyWorld up to World in the class diagram on the right side of Figure 1 indicates that MyWorld extends World. Similarly, to define the class named MyActor so that I could construct an object from that class, I extended the class named Actor.
What does it mean to extend or inherit from another class?
For the benefit of beginners, let's consider a hypothetical analogy. (Experienced Java programmers can skip this section.) Assume that you go to an architect to purchase a set of plans to build a new house. Assume also that the architect has in her files, a general set of plans named World that describes features of all the houses in the development where your house is going to be built. She makes a copy of those plans and that copy becomes a part of the plans for your new house.
Assume that she draws additional plans that refer to everything in theWorld plans and supplements that information with information that is peculiar to your house, such as the types of appliances, the types of bathroom fixtures, the floor coverings, etc. She names the second set of plans MyWorld, and they also become part of the plans for your new house. In effect, the second set of plans has extended the original set of plans and the overall plans for your house include both World and MyWorld.
The architect delivers the two sets of plans to you and you deliver them to the construction contractor who uses them to build your new house. Your new house will have characteristics that are common to all of the houses in the development and will also have characteristics that are peculiar to your individual house.
A fairly good analogy
This is a fairly good analogy to the concept of classes, inheritance, and objects in Java. The two sets of construction plans are analogous to the two classes shown by the two upper boxes in the class diagram in Figure 1. The completed house is analogous to an object that is constructed from those two classes (the stage in this case). The Java code constructs an object from the plans (class) named MyWorld, and the characteristics defined the plans (class) named World are included in the object through inheritance.
The Java code that constructs the object is analogous to the construction contractor that constructs your new house.
You could also say that the two sets of construction plans are analogous to the two classes shown by the two boxes in the lower right in Figure 1, and that the completed house is analogous to the object that is constructed from those two classes (represented by the spider image).
The class definition code
Listing 1 shows the class definition code for the class named MyWorld.
Listing 1. Class definition code for the class named MyWorld.
import greenfoot.*;
/**
The purpose of this class is simply to illustrate a
couple of basic things about Greenfoot.
*/
public class MyWorld extends World
{
public MyWorld()//constructor
{
// Create a new world
super(20, 20, 10);
}//end constructor
}//end MyWorld class
You don't need to worry too much about the details of the code shown in Listing 1 at this time. However, there are a couple of things that are worthy of note.
Color
Even though Java code is never actually colored, I added color to the code in Listing 1 to make it easier to discuss.
The class named MyWorld extends World
Note first the code shown in blue in Listing 1. This code stipulates that the new class named MyWorld extends (inherits from) the class named World. That satisfies the inheritance relationship shown by the top two classes in Figure 1.
Terminology
Objects are constructed from classes.
The constructor
The code shown in red is called a constructor. This code is analogous to the construction contractor that built your new house in the earlier discussion. The purpose of this code is to cause the object to come into existence and to occupy memory.
The stage
You can write general-purpose Java programs using Greenfoot that pretty much ignore most of what you see in Figure 1. However, if you want to use Greenfoot to create a 2D animation, game, or simulation, the easiest thing to do is to take advantage of the structure for the stage and the actors that already exist in the IDE.
If you don't need a stage...
If you are writing a general-purpose Java program that doesn't need a stage, just set the super parameters to (1,1,1).
The stage in a Greenfoot scenario is always a rectangular grid of square cells. The statement in Listing 1 that begins with the word super specifies that the dimensions of the stage for this scenario are 20 cells by 20 cells. The first number is the width of the stage in cells and the second number is the height of the stage in cells. The third number specifies that each cell is a square that is ten pixels on each side.
The spider jerks along
If you write and run this scenario, you will see that the spider moves along rather jerkily, with each step taken by the spider being from the center of the current cell to the center of the next cell along the diagonal path. We could make the spider move much more smoothly by increasing the number of cells and making each cell smaller. However, this would also cause the spider to appear to move more slowly because it would have to take more steps to move the same physical distance on the stage.
Class definition code for the class named MyActor
The code that defines the class named MyActor is shown in Listing 2.
Listing 2. Class definition code for the class named MyActor.
import greenfoot.*;
/**
The purpose of this class is simply to illustrate a
couple of basic things about Greenfoot.
*/
public class MyActor extends Actor
{
public void act()
{
setLocation(getX()+1,getY()+1);
}//end method act
}//end class MyActor
Color added
Once again, I added color to make the code easier to discuss. Beginning with the code shown in blue, the class named MyActor extends the class named Actor satisfying the inheritance relationship given by the two corresponding classes shown in Figure 1.
The method named act
The code shown in red is the definition of a method named act. This method is executed once each time the Act button at the bottom of Figure 1 is clicked. Also, as mentioned earlier, his method is executed repeatedly when the Run button in Figure 1 is clicked.
The purpose of this method is to cause the spider to move diagonally across the stage, moving down and to the right. The stage is represented by a Cartesian coordinate system with the origin at the upper left corner. The x-axis is the horizontal axis and the y axis is the vertical axis. The positive x-direction is to the right. Contrary to what you might expect, the positive y-direction is down the screen instead of up.
Each cell width constitutes one unit on the respective axes with the cell in the upper-left corner having a coordinate value of 0,0.There are 20 cells across and 20 cells down.herefore, the coordinate value of the cell at the upper-right corner is 19,0. The coordinate value of the cell at the bottom left corner is 0,19, and the coordinate value of the cell at the bottom right corner is 19,19.
Make the spider move
The code in the act method in Listing 2 causes the spider to move one cell to the right and one cell down each time the method is executed. This is accomplished by calling the setLocation method to cause the spider's new location to be one cell to the right and one cell down from the current cell. This, in turn is accomplished by getting the x and y coordinate values of the current cell, adding one to each of those values, and using those two sums to define the new location.
Convenience features
This IDE provides several convenience features that make it easy for novice programmers to get something interesting up and running quickly without having to know a lot about Java programming. As mentioned earlier, it is also possible for more advanced Java programmers to use the IDE to write Java applications or applets that exercise the full power of Java, completely ignoring most of the convenience features of the IDE if they choose to do so. Thus, Greenfoot provides a little something for everybody. In this lesson, I will concentrate on the use of the convenience features.
Right-click on the World class
If you right-click on the World class, the context menu shown in Figure 2 will appear.
Figure 2. Context menu for the World class.
This context menu provides three options:
• Open editor
• Inspect
• New subclass...
What is a subclass?
In Java, a class that extends or inherits from another class is often referred to as a subclass of the original class. Note however that class is a keyword while subclass is simply jargon. Therefore, I will refer to every class simply as a class even if it extends another class.
The New subclass option
When you start developing a new scenario, only the World class and the Actor class are pre-defined. It is up to you to extend the World class into a new class that represents your particular world and it is up to you to extend the Actor class into one or more new classes that represent the actors in your scenario.
Creating classes with program code
If you know how to do so, you can also define new classes by writing the Java code to define the classes while ignoring the New subclass option in the context menu of Figure 2. If you create classes outside Greenfoot, and store them in the scenario directory, they will be detected and shown in the class diagram (see Figure 2) when the scenario is opened.
You create a new class to represent your world by selecting the New subclass option in the context menu in Figure 2. When you do, the dialog shown in Figure 3 will appear.
Figure 3. Dialog for specifying name and image for new class.
What does this dialog want from you?
The dialog shown in Figure 2 is asking you to specify a name for your new class and to select an image that will represent your new class as the background image on the stage.You type the name in the text field at the top of Figure 2. Then click on one of the many images that are shown and click the Ok button to select the image.
If you want to import and use an image file that is not part of the Greenfoot distribution, you can click the button labeled Browse for more images to find and select a different image file.
If you want the new world to have a plain white background, you can simply enter the name for the class and click the Ok button.
What do the blue stripes mean?
When you click the Ok button, the dialog will be dismissed and the new class will appear as a subclass of the World class as shown in Figure 1. At that point in time, the box that represents the new class will contain light blue diagonal stripes similar to those shown in the MyActor class in Figure 2. The stripes mean that the class needs to be compiled before it can be used. You can compile the class by clicking the button labeled Compile all at the bottom of Figure 2. (You can also compile the class from within the editor that I will discuss shortly.)
The Inspect option
You can open a class inspector on the World class by selecting the Inspect option in Figure 2. Many different classes and objects can be inspected in Greenfoot in order to obtain more information about the class or the object. I am going to defer a discussion of inspection until later while discussing an object of a more interesting class.
The Open editor option
Selecting the Open editor option in Figure 2 will open the source code of the World class definition in a text editor allowing you to view the definition of the class. However, the World and Actor classes are read-only and cannot be modified. I will defer a discussion of the editor until later while discussing the class named MyWorld.
Context menu for the MyWorld class
If you right-click on the MyWorld class, the context menu shown in Figure 4 will appear.
Figure 4. Context menu for the MyWorld class.
The Open editor option
Probably the first option that you will use from this context menu is the Open editor option so I will begin the discussion with that option. Selection of this option will cause the text editor shown in Figure 5 to appear on the screen. (Note that it was necessary for me to reduce the size of the image to force it to fit into this narrow publication format. As a result, some of the text in Figure 5 isn't very legible.)
Figure 5. The source code editor.
Putting some meat on the skeleton
Skeleton code for a new class is automatically created whenever you create a new class using the New subclass option shown in Figure 4. The first time you select the Open editor option in the context menu for the new class, the skeleton code will appear in the editor. The image shown in Figure 5 was captured after I modified the skeleton code to produce the source code shown in Listing 1.
The editor is a fairly standard source-code editor with a few features designed specifically for use with Greenfoot. I'm not going to bore you with all of the operational details of the editor because I doubt that you need those details. You can probably figure out most of what you need to know on your own with a little experimentation.
Source code versus documentation
There is one aspect of the editor that is different from the norm and worth mentioning. Whenever you create a scenario in Greenfoot, standard Java documentation is automatically generated for all of the classes in the scenario. I explain the format of that documentation a separate document titled The Importance of Sun's Java Documentation (see Resources).
You will notice that there is a pull-down list in the upper right corner of Figure 5. That list contains the following two options:
• Source Code
• Documentation
When Source Code is selected, the window serves as a source code editor for the class. When Documentation is selected, the window serves as a non-editable display window for the standard documentation of the class being edited.
Compiling the source code
Any time you modify the source code for a class, you must compile the new source code before you can use the modified class. You can compile the modified source code in at least three ways:
• Click the Compile button shown in Figure 5.
• Pull down the Tools menu in Figure 5 and select Compile.
• Click the Compile all button in Figure 1.
Whenever a class needs to be compiled, it will appear with diagonal lines as shown by the MyActor class in Figure 2.
The new MyWorld() option
Getting back to the context menu in Figure 4, the new MyWorld() option is used to create a new object from the class named MyWorld. However, whenever you modify the code and then compile the class, a new object for the modified class is automatically created. Therefore, you probably won't need to use this option very often, if at all.
The New subclass option
There may be situations where you would want to define a new class that extends or inherits from the class named MyWorld in Figure 4. If so, you can do that by selecting New subclass in Figure 4, providing a name for the new class, selecting an image for the new class, etc.
The Set image... and Remove options
If you decide to change the image for the class after it has been created, the Set image... option can be used for that purpose.
As the name implies, the Remove option can be used to delete a class from the scenario if you decide that you don't need it after all.
Context menu for the Actor class
Right-clicking the Actor class produces the context menu shown in Figure 6.
Figure 6. Context menu for the Actor class.
This should look familiar
By now, you should have a pretty good idea of the purpose of each of the options in the context menu. As is the case with the World class, you can open the Actor class and view the class definition in the editor. However, as I mentioned earlier, the Actor and World classes are read-only and cannot be modified.
I selected the New subclass option to create the class named MyActor shown in Figure 1. When you select that option, the dialog shown in Figure 3 will appear. As with the MyWorld class discussed earlier, you use this dialog to specify a name for the new class and to select an image that will represent objects of the new class on the stage. If you don't select an image, the default image, which is a small green footprint, will be used.
The context menu for the MyActor class
If you right click on the MyActor class, a context menu similar to the one shown in Figure 4 will appear. The only difference will be that the first option will be titled new MyActor() instead of new MyWorld().
The purpose of each option in this context menu is the same as the purpose of each corresponding option that I explained earlier in conjunction with the class named MyWorld. There is one major difference, however. Whereas you will rarely need to create new objects of the class named MyWorld, you may need to create objects of the MyActor class. Creating objects of the MyActor class can be accomplished in at least three ways:
1. Select the new MyActor() option from the context menu for the class.
2. Left-click the MyActor class once, hold down the Shift key and left-click the location on the stage where you want the object to appear.
3. Write standard Java code to create a new object of the class and add it to your new world. (One way to do this by calling the addObject method in the constructor for your new world.)
Selecting the new MyActor() option from the context menu
The result of selecting the new MyActor() option is shown in Figure 7. However, Figure 7 doesn't show the mouse pointer, which is a critical part of the picture. (Just pretend that you can see the mouse pointer pointing to the spider immediately to the left of the box for the class named MyActor.)
Figure 7. Result of selecting the new MyActor() option.
A new object is created
When you select new MyActor() from the context menu for the MyActor class, a new object of the class is created and the image that represents the object is attached to the mouse pointer. You can drag the image and drop it in the desired location on the stage. Initially the red circle with the diagonal line shown in Figure 7 will appear on top of the image indicating that you can't drop the object in that location. This symbol will disappear once you drag the image into the stage area, indicating that it is okay to drop the object anywhere in the stage area.
Left-click the MyActor class once, hold down the Shift key, etc.
There is no way for me to produce a single image illustrating the methodology indicated by option 2 in the above list. You will simply have to try it for yourself to get the feel of it. However, the result of using this procedure to create a large number of objects of the MyActor class (very quickly) and place them in various locations on the stage is shown in Figure 8.
Figure 8. Lots of spiders.
All the spiders behave the same
Because all of the spiders shown in Figure 8 were created from the same class, and the behavior of all objects created from that class is defined by the class definition shown in Listing 2, clicking the Run button in the bottom of Figure 8 causes all of the spiders to move in parallel diagonal paths down and to the right until they reach the boundary of the stage. Once they reach the boundary, they move along that boundary until they all bunch up on top of one another in the bottom right corner as shown in Figure 9.
Figure 9. The Greenfoot IDE in Run mode.
The Run button is now a Pause button
However, my purpose in showing you Figure 9 was not to show you the spiders bunched up in the bottom right corner. Rather, my purpose was to show you what happens to the Run button in Figure 1 when you click it. As you can see in Figure 9, the Run button has turned into a Pause button. Once you click theRun button, the scenario will continue to run until one of the following occurs:
• You click the Pause button.
• The scenario is terminated by program code (not covered in this tutorial).
• You click the X-button in the upper right corner of Figure 9.
• A few other possibilities such as turning of the power to the computer.
You can drag and drop the spiders
When you click the Pause button, the scenario will stop running and the button will revert to a Run button. Note, however, that the spiders won't return to their original locations as shown in Figure 8 because there is no code in the program to cause them to do so. However, you can grab each spider with the mouse pointer and drag it to any location you choose on the stage when the scenario is not in the Run mode. You can't drag the spiders around when the scenario is in the Run mode because the location of each spider is being controlled by the repeated execution of the setLocation method shown in Listing 2.
The context menu for a MyActor object
Right-clicking one of the spiders will produce the context menu shown in Figure 10.
Figure 10. The context menu for a MyActor object.
Second-level information
If you point to one of the top two options in the context menu in Figure 10, information regarding the methods inherited into the object will be presented as shown in Figure 11.
Figure 11. Method inheritance information for a MyActor object.
If you are just learning how to program in Java, you probably won't understand it even if I try to explain the information shown in Figure 11. You will learn about those things in due time. If you are further along in your understanding of Java programming, you probably don't need an explanation anyway so I won't provide one.
Only one method in the class definition
The context menu for an object shows all of the methods that are defined in the class from which the object was created. The class named MyActor defined only one method, and that is the method named act as shown in Listing 2. Therefore, the only method shown in the context menu in Figure 10 is the method named act.
One interesting feature of the context menu is that you can click on a method name in the context menu and that method will be executed one time. This makes it possible to individually execute new methods that you write and compile so that you can confirm proper behavior of each method independently of the other methods in the class definition. However, this isn't too useful with theact method because exactly the same thing happens each time you click theAct button at the bottom of Figure 1. Therefore, this scenario isn't very useful for demonstrating the usefulness of this capability.
Selecting the inspect option
Selecting the inspect option from the context menu for an object will cause an Object Inspector window similar to the one shown in Figure 12 to open.
Figure 12. An Object Inspector window.
Some information is intuitively obvious and some is not
Some of the information in Figure 12, such as the current location of the object in x and y coordinate values and the rotation of the object is intuitively obvious. Some is not so obvious. For example, if you double-click on the top box containing a crooked arrow, a second object inspector window will open containing information about the parent (container) object of the current object. In this case, the container is the object that was created from the class named MyWorld, which I have been referring to as the stage.
If you double-click on the bottom box containing a crooked arrow, another object inspector window will open containing information about the spider image that represents the object on the stage. That object inspector also contains some arrows, which can be double-clicked. The bottom line is that the Inspect option on an object's context menu makes it possible for you obtain information about the object itself, and also to obtain information about other objects to which that object is linked.
Object linkages
The object created from the MyActor class is linked to the object created from the MyWorld class because it is physically contained in that object on the stage. It is linked to an object that was originally created from a file containing an image of a spider because that image is being used to visually represent the object on the stage. That image object, by the way, was created from a class named GreenfootImage, which is one of the relatively hidden parts of the Greenfoot IDE that mainly does its work behind the scenes and out of sight.
The context menu for the stage
Right clicking the label myWorld at the top of Figure 1 causes a context menu to pop up for the object that was created from the class named MyWorld. There is nothing on that menu that I haven't already discussed, so there is no point in me discussing that context menu further.
Scenario Information
Clicking the button labeled Scenario Information at the top right of Figure 1 opens a text editor on a file named README.TXT. This file is contained in the folder that contains the scenario files. The text that is contained in the file when it opens encourages the developer to describe the scenario for the benefit of users who may later need that information.
The target audience
According to recent correspondence with Michael Kölling,
"Today, we are using Greenfoot with high school kids (age 14 and up), and at college and university level. I'd claim that as the target audience. We needed to get a bit of experience with actual classroom situations to see where the lower bound in the age group is, and 14 works well (as does anything older), and I wouldn't recommend it much below that age."
Having taught computer programming at the community college level for about fifteen years and having taught Java OOP since 1997, I am of the opinion that the target audience for Greenfoot clearly includes students at the college level.
Also having taught Java OOP to many old-school procedural programmers who are still struggling with the transition from procedural to object-oriented programming, both at the college and in onsite company-sponsored training programs, I believe that the target audience also includes old-school procedural programmers.
Greenfoot makes learning fun
My great granddaughter often repeats a saying that she learned in Montessori kindergarten, "Fun is learning and learning is fun." Even at my somewhat advanced age, I couldn't agree more.
Greenfoot makes learning to program with Java not only practical but fun as well. Let's face it, regardless of our age, most of us do a better job on those tasks that we enjoy than we do on those tasks that we don't enjoy. So the question is, which activity would most students find more enjoyable?
• Writing a Java program that causes an image of a spider to chase an image of a fly around the screen, or
• Writing a text-based Java program that computes and displays an amortization table for a 30-year mortgage at an interest rate of 6.25 percent.
The same understanding of fundamentals is required
Both Java programs would require an understanding of the same fundamental programming concepts. The difference is that writing programs that provide sensory feedback (such as spiders chasing flies) can be fun while writing programs to compute amortization tables can be extremely boring. At least that is the case for most of the students that I have met during my fifteen years of teaching.
Thanks to Greenfoot, we as Java instructors now have the opportunity to conduct programming instruction that is not only solid from an educational and technical viewpoint, but is also fun and engaging for the students. (Even most old-school procedural programmers would probably rather spend time writing interesting OO programs than writing boring OO programs.)
This kind of help is needed
Without some help of the kind provided by Greenfoot, beginning programmers are not capable of writing a program that causes an image of a spider to chase an image of a fly around the screen, or much else in the way of interesting programs for that matter. (Believe it or not, most students don't get too excited by if statements and while loops.)
Being able to start from scratch and write programs with exciting graphics requires knowledge of some fairly advanced Java programming concepts. Beginning programming students simply do not possess that knowledge and those students are usually relegated to writing boring programs of the amortization-table variety.
The Xbox generation
Computer science enrollments are down in most high schools, colleges, and universities in the U.S. There are many reasons for this. In my opinion, one of the most important reasons is that most existing computer science curricula fail to satisfy the needs of the Xbox generation for something more stimulating than amortization tables.
The challenge
Computer programs of the amortization-table variety are clearly necessary in our economy. However, they should not be necessary in an introductory programming course in a high school, college, or university. Our challenge, as computer science instructors in the U.S., is to keep students involved, interested, and engaged long enough for them to realize that computer programming and computer science are interesting professions even if it may occasionally be necessary to write a program involving amortization tables or to satisfy other similarly boring objectives.
It has been shown in various studies at Carnegie Mellon University and elsewhere that making it possible for students to produce interesting results early in an introductory programming course tends to reduce the dropout rate. This should apply regardless of whether we are talking about high school students, community college students, computer-programming students in curricula other than hard-core computer science at the university level, first-year students with computer science aspirations at the university level, and even old-school procedural programmers struggling with the transition into OOP.
Boredom is a killer of ambition
With the advent of the web, there are many opportunities both inside and outside of hard-core computer science that require participants to understand and to be proficient in modern object-oriented programming using Java, C#, C++, or other similar programming languages. Boredom is a killer of ambition and the reality is that a large percentage of computer programming instruction in the U.S. is extremely boring for the first couple of semesters. Perhaps with products like Greenfoot, we can rectify that situation and rekindle interest in computer science among students in the U.S.
Speaking of the web
Once a Greenfoot scenario is completed and tested, Greenfoot makes it veryeasy to:
1. Export the scenario as a stand-alone Java application suitable for execution on just about any computer that has Java version 1.5 or later installed (without a requirement for the Greenfoot IDE to exist on that computer).
2. Export the scenario as an applet for publishing in a web page on your favorite web server.
3. Publish the scenario on a public Greenfoot website for execution and comments by others.
Writing dual-purpose programs is not easy
Writing a Java program so that it can be used either as an application or an applet isn't rocket science. However, writing such dual-purpose programs is well beyond the capabilities of most beginning programming students. However, Greenfoot makes it easy to do just that.
Many students maintain their own web sites and might like to show off their early programming creations by posting them as applets on their web sites. The ability to do this should be a positive motivating factor for many of those students.
Those same students, as well as many other students, might like to share their early programming creations with friends and family (particularly those with slow or no Internet access) as stand-alone Java applications. Greenfoot makes that easy also. The same Greenfoot program can be exported in both forms.
Greenfoot, Scratch, Alice, and BlueJ
While some tools are more advanced than others, there are currently at least four programming paradigms that occupy roughly the same space in terms of programming education:
1. Greenfoot
2. Scratch
3. Alice
4. BlueJ
I am very familiar with the first three. I know very little about BlueJ so I won't comment on it at this time. (There are probably others that I don't know about as well.)
Nerd
A computer expert by aptitude and not mere training. Usually male, under the age of 35 and socially inept; a person whose tremendous skill with operating or designing computer hardware or software is exceeded only by his, rarely her, passionate love of the technology.
Social networking for nerds
The folks involved in the Scratch project at MIT have proven the positive effect of providing a capability for students to share their programming creations on a public website for review and comment by their peers. By providing this capability, they are attracting and keeping students engaged, involved, and learning about computer programming completely outside of formal schoolwork. (This capability of Scratch is similar to item 3 in the above list.)
The Scratch website, on which students share programs written in Scratch, has become a form of social networking for thousands of young scratchers (as they like to refer to themselves) from around the world. I like to think of the Scratch website, in a positive sense, as social networking for nerds. (By the way, I recognize that I am something of a nerd myself, so I don't consider nerd to be a derogatory term.)
Scratch is not a serious programming language
However, even though the Scratch website is incredibly popular among younger students, Scratch is not a serious programming language in the sense that Java, C++, and C# are serious programming languages. Scratch is seriously lacking insofar as support for important fundamental programming concepts is concerned. Of the ten to fifteen fundamental programming concepts that most computer science professors agree to be extremely important, Scratch only supports three or four.
The main emphasis in Scratch is on multimedia capabilities
Once you get beyond variables, if-else statements, loops, and operators (which Scratch does support in a limited sense), Scratch is primarily a toy language that makes it easy for students to do wild and wonderful things with a wide array of multimedia capabilities. (However, I believe that the multimedia capabilities are one of the factors that make Scratch so popular among younger students.)
Developed in Squeak
Scratch was developed using a programming language named Squeak, but the underlying language is completely hidden from the Scratch programmer. Although I know nothing about Squeak, I don't believe that it is widely used in either academia or industry. Apparently, however, it was well suited for the development of Scratch.
Unconventional loop structures
While Scratch does support loop structures, the loop structures in Scratch are unconventional, at least from the viewpoint of someone whose primary programming experience for the past twenty years or so derives from a tradition rooted in C including C++, Java, and C#. I don't know if the unconventional loop structures in Scratch are a latent manifestation of Squeak and/or Smalltalk, (which I also know nothing about), or if they were designed that way for some other reason. In my opinion, it would have been better from an educational viewpoint for Scratch to use a more conventional C-style loop structure based on the keywords while, for, and possibly do while.
Scratch is a dead-end IDE
The bottom line is that Scratch simply wasn't designed to teach students how to do serious programming. While it may be educational with respect to the effective use of multimedia capability, (and it is very successful in giving young students constructive outlets for their creative energies), insofar as computer science education is concerned, Scratch is a dead-end IDE. Scratch is clearly not suitable for major programming projects. Further, there is no evidence that the folks in the Scratch program at MIT are working on a smooth migration path for students from Scratch to any serious programming language.
What about Alice?
The latest released version of Alice is version 2.0. (Version 2.2 has been released in beta as of this writing.) Alice 3.0 is on the drawing board. I will divide this discussion between Alice 2.0 and Alice 3.0. (Alice 2.2 doesn't appear to be significantly different from 2.0 insofar as this discussion is concerned, so I will skip it altogether.)
Alice 2.0 is also fun and engaging
Alice 2.0 is a 3D programming language, which is also a lot of fun. However, it is more difficult to use than Scratch and may not be as much fun as Scratch. (Alice provides much less in the way of multimedia functionality than Scratch.) Alice 2.0 is much more powerful and more conventional than Scratch, but is still somewhat unconventional nonetheless.
Alice supports most fundamental programming concepts
Alice supports almost all of the fundamental programming concepts that I referred to earlier. I personally consider Alice 2.0 to be suitable for use in a first programming course for community-college students who don't have a strong programming background from high school. However, almost all of my colleagues in the computer science department in the college where I teach disagree with me on this.
A drag and drop programming interface
Both Alice 2.0 and Scratch use a drag and drop programming interface.Scratch programmers are totally insulated from anything resembling source code. Alice 2.0 students are required to create source code using the drag and drop interface, but they are not required to memorize syntax. My colleagues seem to uniformly agree that this is a major failing of Alice. Many Alice students simply don't learn syntax because they are not forced to do so. According to my colleagues, this places them at a disadvantage when they enroll in the next programming course in the computer science curriculum.
Alice 2.0 is also not a serious programming language
To compound matters, Alice 2.0 is also not a serious programming language. By this, I mean that no one is going to use Alice 2.0 for any serious programming projects. Even though Alice 2.0 was developed using Java, the underlying language is completely hidden in Alice 2.0. The bottom line is that Alice 2.0 is strictly for teaching.
A difficult transition is required
Alice 2.0 students must transition to a serious programming language such as Java, C#, or C++ if they are going to continue their computer programming education beyond the first semester. There is no smooth migration path from either Scratch or Alice 2.0 to a serious programming language. According to my colleagues, this is a major drawback of Alice 2.0. (I doubt that they would even be willing to discuss Scratch.) They believe that many students who successfully complete an introductory programming course using Alice 2.0 are still not prepared to make the transition into the next programming course in the computer science curriculum.
Alice 3.0 will be a serious programming language - Java
The folks at Carnegie Mellon University (CMU) are currently hard at work to solve most of the problems that I described above including a smooth migration path to a serious programming language. That solution will come in the form of Alice 3.0.
Alice 3.0 will make it relatively easy to develop 3D games and animations just like Alice 2.0, and will also provide a drag and drop programming interface. However, and this is extremely important, Alice 3.0 will also expose the full power of Java.
The programming interface will be optional
The programming interface that is used with Alice 3.0, whether it is drag and drop or text editor, will be optional. Students will be able to program in either or both ways. As I understand it, the Alice 3.0 interface will sit atop Eclipse, which is already a very popular professional Java IDE.
According to the folks at CMU, a capable programmer will be able to do anything with Alice 3.0 that can be done with Java. While Alice 2.0 is also a dead-end IDE (albeit much more powerful than Scratch), if the above statement holds true, there will be nothing dead end about Alice 3.0. With the full power of Java and a built-in Eclipse IDE, Alice 3.0 will be capable of carrying students all the way from introductory programming to professional employment.
Now for the bad news
That's the good news. The bad news is that the release schedule for Alice 3.0 continues to slip, and the latest estimate for release of a non-beta version is sometime around the fall of 2009.
Where does Greenfoot fit in the mix?
Greenfoot is not a dead-end IDE
Unlike Scratch and Alice 2.0, Greenfoot is not a dead-end IDE because it exposes and supports the full power of Java. In short, Greenfoot is a Java IDE that has been specialized to make programming fun and engaging for beginning programmers.
Although you would probably prefer to use NetBeans or Eclipse for large programming projects, you could develop large projects using Greenfoot if you chose to do so.
Requires students to learn and use Java syntax
Also, because Greenfoot lacks a drag and drop programming interface and requires the students to learn and use Java syntax, it should make my colleagues happy.
Greenfoot is a very good starting point
Students can go as far using Greenfoot as they choose to go. There are virtually no issues having to do with migrating from Greenfoot to a serious programming language. Greenfoot is already an IDE for a serious programming language -- Java.
Of course, when students reach an intermediate to high level of Java programming proficiency, they will probably choose to switch over to a more professional IDE such as NetBeans or Eclipse. Along the way, they may choose to take a look at BlueJ or JGrasp. In the early days of learning to program, however, both NetBeans and Eclipse are overkill. Furthermore, NetBeans, Eclipse, BlueJ, and JGrasp don't provide the features of Greenfoot that are designed to engage programming students and to keep them interested until they are ready for an IDE like NetBeans.
The export dialog
Getting off my soapbox, and returning to technical details, selecting the Export... option on the Scenario menu of Figure 1 produces the dialog shown in Figure 13.
Figure 13. Export dialog.
To export your scenario, select one of the icons at the top of the dialog, fill in the blanks and click the Export button. (Note that you must establish a free account on the Greenfoot Gallery website (see Resources) to publish your scenario on that website.)
Java version 1.5 or later is required
Also note that in order to view Greenfoot applets from the Greenfoot Gallery, to view them locally in your browser, or to view them from any other website, your browser must be compatible with Java 1.5 or later.
Firefox compatibility
When I first became involved with Greenfoot, I discovered that my Firefox browser had not updated itself beyond Java 1.4 even though it had gone through numerous update cycles and everything else on my computer was running Java 1.6. (Firefox seemed to be really fond of Java 1.4.) In the end, I had to go to the Control Panel and remove an old Java 1.4 JRE that was still on my computer to force Firefox to update itself to use Java 1.6.
Run the program
I invite you to go to Greenfoot Home (see Resources) where you can download and install Greenfoot. As of this writing, Greenfoot version 1.4.1 is the latest release.; I'm told, however, that version 1.4.5 will be released very soon, perhaps before this tutorial is actually published.
Also if you need to do so, go to Sun, download and install the latest version of Java (see Resources). Remember, Greenfoot requires Java 1.5 or later, and as of this writing Java 1.6 is available from Sun. According to recent correspondence with Michael Kölling,
"If, at installation time, Greenfoot finds only one Java version on the system (JDK install, not JRE), it will just use it. (Must be Java 5 or up.) If it finds more than one Java version, it asks the user at installation time which one to use. This can be changed later."
Once you computer is ready, use the code in Listing 1 and Listing 2, along with the written instructions in this tutorial to create and execute the simple scenario that I described earlier. Experiment with the code, making changes, and observing the results of your changes. Make certain that you can explain why your changes behave as they do.
Summary
My purpose in publishing this tutorial is to make the case that the Greenfoot IDE is quite possibly the best IDE available at this time for teaching a beginning course in computer programming. Because Greenfoot exposes the full power of Java, it may also prove useful in a second-semester programming course that concentrates on object-oriented programming. I am considering the incorporation of Greenfoot in a variety of ways into the second-semester Java/OOP course that I routinely teach each semester.
No major scenarios in this lesson
Most of the tutorial lessons that I publish contain at least one fairly substantial sample program. However, that is not the case for this tutorial. My main purpose in publishing this tutorial was simply to introduce you to Greenfoot in terms of its capabilities and its operation. I will publish other lessons in the future that will show you how to put Greenfoot to work in more significant ways.
Resources
Historical information about Greenfoot
The first prototype of Greenfoot was developed by Poul Henriksen as part of his Master Thesis at The Maersk Mc-Kinney Moller Institute for Production Technology, University of Southern Denmark, 2004. Greenfoot 1.0 was released on May 31, 2006.
The current release of Greenfoot is version 1.4.1. The About Greenfoot page within the IDE indicates that the current Greenfoot team consists of Poul Henriksen, Michael Kölling, Davin McCall, Bruce Quig, and John Rosenberg.
A page on the Greenfoot website states that Greenfoot is a project at the University of Kent at Canterbury (UK) and Deakin University, Melbourne (Australia), funded by Sun Microsystems. Poul Henriksen and Michael Kölling were at the University of Southern Denmark when Greenfoot started. Both are now at the University of Kent. Some team members are at Deakin University.
Greenfoot won a Dukes Choice Award for 2007. The announcement was made at Sun's prestigious JavaOne conference in California. James Gosling, the inventor of Java, presented the award.
Copyright
Copyright 2008, Richard G. Baldwin. Reproduction in whole or in part in any form or medium without express written permission from Richard Baldwin is prohibited.
About the author
Richard Baldwin is a college professor (at Austin Community College in Austin, TX) and private consultant whose primary focus is a combination of Java, C#, and XML. In addition to the many platform and/or language independent benefits of Java and C# applications, he believes that a combination of Java, C#, and XML will become the primary driving force in the delivery of structured information on the Web.
Richard has participated in numerous consulting projects and he frequently provides onsite training at the high-tech companies located in and around Austin, Texas. He is the author of Baldwin's ProgrammingTutorials, which have gained a worldwide following among experienced and aspiring programmers. He has also published articles in JavaPro magazine.
In addition to his programming expertise, Richard has many years of practical experience in Digital Signal Processing (DSP). His first job after he earned his Bachelor's degree was doing DSP in the Seismic Research Department of Texas Instruments. (TI is still a world leader in DSP.) In the following years, he applied his programming and DSP expertise to other interesting areas including sonar and underwater acoustics.
Richard holds an MSEE degree from Southern Methodist University and has many years of experience in the application of computer technology to real-world problems.
[email protected]
Comment and Contribute
(Maximum characters: 1200). You have characters left.
Enterprise Development Update
Don't miss an article. Subscribe to our newsletter below.
By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.
Thanks for your registration, follow us on our social networks to keep up-to-date | __label__pos | 0.610488 |
В CSS3 появилось свойство
1
box-sizing
, смысл которого в способе вычисления ширины HTML-блока браузером. Но, прежде чем переходить к его рассмотрению, сначала давайте вспомним, как обычно браузер производит расчет ширины блока элемента в HTML-разметке?
Вычисление всегда выполняется по формуле:
1
Width = Margin + Border + Padding + Content
. То есть, если ширина контента задана в 200px,
1
padding
равен 25px,
1
border
равен 10px, а
1
margin
равен 15px; то результирующая ширина блока будет равна 300px.
Такой способ вычисления ширины блока делают все современные браузеры:
200px + 25px*2 + 10px*2 + 15px*2 = 300px
Модель расчета ширины блока в браузере по умолчанию
Однако, были времена, когда не все браузеры вычисляли размеры блока элемента подобным образом. Существовал Internet Explorer версии 5/6, который ширину блока считал несколько иначе: из заданной ширины блока вычитались padding и border, получалась результирующая ширина области content. В те времена веб-разработчики “показывали пальцем” на этот браузер и говорили, что это ошибка и недочет разработчиков IE5/6.
Но теперь времена изменились благодаря появлению адаптивного (
1
responsive
) дизайна. Причины возникновения адаптивного дизайна - в огромном количестве устройств с разными размерами экранов, по большей части мобильных. Задача адаптивного дизайна в “подстраивании” одного и того же дизайна сайта под различные размеры мониторов. При таком “подстраивании” важной становиться задача вычисления ширины блоков элементов, чтобы верстка не “разваливалась”.
Чтобы такого не произошло, как раз и становиться удобным “возврат” к той модели расчета ширины блока, какая присутствовала в IE5/6. Для этого было разработано свойство
1
box-sizing
, с помощью которого можно управлять подобной моделью расчета.
Свойство
1
box-sizing
принимает три значения (три модели вычисления ширины блока): **content-box
padding-box border-box**.
Свойство box-sizing: content-box
Первая модель
1
content-box
является способом вычисления ширины блока по умолчанию, принятым в современных браузерах:
box-sizing: content-box
Ширина блока равна сумме:
1
Width = Width (Content) + Padding + Border + Margin
Свойство box-sizing со значением content-box
Свойство box-sizing: padding-box
Вторая модель
1
padding-box
заключается в том, что ширина блока включает в себя ширину контента (
1
content
) и ширину
1
padding
. Остальные -
1
border-box
и
1
margin-box
- приплюсовываются к заданной ширине, как обычно. Данная модель, хоть и заявлена в спецификации CSS3, не поддерживается на сегодняшний день почти никакими браузерами; так что о ней можно забыть (пока забыть):
box-sizing: padding-box
Ширина блока равна сумме:
1
Width = Width (Content + Padding) + Border + Margin
Свойство box-sizing со значением padding-box
Свойство box-sizing: border-box
Третья модель
1
border-box
очень похожа на предыдущую модель
1
padding-box
. Но, в данном случае, ширина блока включает в себя еще и
1
border-box
; то есть ширина блока включает в себя область
1
content-box
,
1
padding-box
и
1
border-box
. Область
1
margin-box
прибавляется к ширине блока элемента, как обычно.
box-sizing: border-box
Ширина блока равна сумме:
1
Width = Width (Content + Padding + Border) + Margin
Свойство box-sizing со значением border-box
Практический пример свойства box-sizing
Теперь не мешало бы продемонстрировать на практике, каким образом браузеры выполняют вычисления ширины блоков элементов под управлением свойства
1
box-sizing
. Допустим, у нас имеется блок-обертка
1
div class="wrap"
, внутри которого расположены два плавающих блока-потомка
1
div class="left"
и
1
div class="right"
.
HTML-разметка представлена ниже:
<div class="wrap">
<div class="left"></div>
<div class="right"></div>
</div>
… и CSS-таблица, обычная для такого случая. Единственное “новое” правило в этом коде - это свойство
1
box-sizing
, указанное с вендорными префиксами. Обычно его можно не указывать, так как у браузеров по умолчанию свойство
1
box-sizing
установлено в значении
1
content-box
(как уже упоминалось ранее). Но в нашем случае понадобится явно указать это свойство. Для блоков-потомков здесь намерено мы не указываем (пока не указываем)
1
padding
,
1
border
и
1
margin
:
*{
margin: 0;
padding: 0;
}
html{
background-color: #a7c5a8;
}
body {
width: 80%;
margin: 0 auto;
}
.wrap{
width: 800px;
height: 400px;
margin: 50px auto;
background-color: #778899;
border: 3px solid #ff0000;
}
.left, .right{
float: left;
width: 400px;
height: 400px;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.left{
background-color: #000;
}
.right{
background-color: #fff;
}
Свойство box-sizing со значением content-box
Блоки-потомки четко вписываются в блок-родитель, так как у них нет
1
border
,
1
padding
и
1
margin
; ширина блоков-потомков точно равна половине ширине блока-родителя.
Теперь добавим для блоков-потомков
1
padding: 5px
:
.left, .right{
float: left;
width: 400px;
height: 400px;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
padding: 5px;
}
Картина будет заранее предсказуемая - один из блоков-потомков опуститься вниз из-за добавления
1
padding: 5px
к обоим блокам:
Свойство box-sizing со значением content-box и padding: 5px
Настало время применить свойство
1
box-sizing
со значением
1
border-box
. Браузер сразу же пересчитает ширину обоих блоков и картина, как по волшебству, изменится:
.left, .right{
float: left;
width: 400px;
height: 400px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 5px;
}
Свойство box-sizing со значением border-box и padding: 5px
Даже если добавить к блокам-потомкам границу
1
border
, то картинка останется прежней:
.left{
background-color: #000;
border: 6px solid #0000ff;
}
.right{
background-color: #fff;
border: 6px solid #00ff00;
}
Свойство box-sizing со значением border-box и border: 6px
Но если прибавить к блокам
1
div class="left"
и
1
div class="right"
правило
1
margin
, то наша разметка снова “сломается”:
.left, .right{
float: left;
width: 400px;
height: 400px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 5px;
margin-left: 5px;
}
Это происходит потому, что в модель вычисления
1
border-box
поля
1
margin
не входят. Поле
1
margin-left
размером 5px прибавляется к ширине блока-потомка. Суммарная ширина обоих блоков-потомков превышает ширину блока-родителя и один из них выходит из его, опускаясь (снова) вниз:
Свойство box-sizing со значением border-box и margin-left: 5px
В этом примере мы не применили к свойству
1
box-sizing
значения
1
padding-box
, потому что [браузеры не понимают этого значения][1] и свойство
1
box-sizing
работать не будет в этом случае.
Заключение
Вот и все, что можно сказать о свойстве
1
box-sizing
. Понимание этого свойства понадобиться еще, когда придет время изучать адаптивный (responsive) дизайн.
Основой для данной статьи послужила замечательная “Большая книга CSS3 Д. Макфарланд (3-е издание).
[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing “MDN CSS - box-sizing”
Javascript - методы call, apply, bind
## Метод callМетод call и apply достаточно древние - они оба из стандарта ES3. Суть создания и работы методов - заставить некоторую произ...… Continue reading
MongoDB - документы
Published on May 23, 2017 | __label__pos | 0.801279 |
current code: Response.Redirect("DeviceInformation.aspx?arg=" + e.CommandArgument);
which redirects to a page with a data grid. The argument is passed into a stored proc on a database and the infor is returned in a grid.
What i want, is the same thing, but, open it in a new page.
So something like:
Response.OpenNewDamnPage("DeviceInformation.aspx?arg=" + e.CommandArgument);
but unfortunatly that does not exsist.
Thanks in advance for any help!
Hey
Try This
protected void button1_Click(object sender, EventArgs e)
{
Response.Write("<script type='text/javascript'>window.open('NewPageUrlWithArgument.aspx','_blank');</script>");
}
This sure will work
If it solves your problem mark the thread as solved.
Use this exactly for your case:
protected void button1_Click(object sender, EventArgs e)
{
Response.Write("<script type='text/javascript'>window.open('DeviceInformation.aspx?arg=" + e.CommandArgument + "','_blank');</script>");
}
Dont forget to enclose your code in code tags like this:
[code=C#] Response.OpenNewDamnPage("DeviceInformation.aspx?arg=" + e.CommandArgument);
[/code]
this will display as
Response.OpenNewDamnPage("DeviceInformation.aspx?arg=" + e.CommandArgument);
Use this exactly for your case:
protected void button1_Click(object sender, EventArgs e)
{
Response.Write("<script type='text/javascript'>window.open('DeviceInformation.aspx?arg=" + e.CommandArgument + "','_blank');</script>");
}
I used the following:
if (e.CommandName == "AssetName")
{
Response.Write("<script type='text/javascript'>window.open('UsageInformation.aspx?arg=" + e.CommandArgument + "','_blank');</script>");
}
I get a new blank page with the correct url!
but if i use:
if (e.CommandName == "AssetName")
{
Response.Redirect("UsageInformation.aspx?arg=" + e.CommandArgument);
}
I get the page reloaded with the data.
So both ways i get the correct url:
http://localhost:4513/WebSite2/UsageInformation.aspx?arg=XFM_UG:#306:100099462
but unless i call the responce.redirect it will load blank. For example even if I copy that link into my browser it loads a blank page.
Very very close... any ideas?
Thanks for your help!
I have some new information tha might help.
If i put a control such as a label as long with the gridview the label loads when I used the following:
http://localhost:4513/WebSite2/UsageInformation.aspx?arg=XFM_UG:#306:100099462
But the grid which is set up to a sql data source that uses the qurrey string to get data, does not load. So i wonder if the remaining problem is with the datagrid?
well, your problem was to load the page in new window.
Which you did successfully.
Did you use the page_load event of new page. Try to get the value from the query string in the page_load event and then load the gridview in the Page_Load event.
This should probably work . I will sure look over this problem.
Your problem of opening new page from the code behind was solved. So you should mark this thread as solved and start new thread.
well, your problem was to load the page in new window.
Which you did successfully.
Did you use the page_load event of new page. Try to get the value from the query string in the page_load event and then load the gridview in the Page_Load event.
This should probably work . I will sure look over this problem.
Your problem of opening new page from the code behind was solved. So you should mark this thread as solved and start new thread.
You quite right, you did solve the question of this thred :)
Thanks so much! I will mark that you solved it.
I did start a new thred for the remaining question of why it did not load. It is here: http://www.daniweb.com/forums/thread207422.html
Thanks so much for your help!
very useful information. Thank you so much
**how to print the diameter of an array in c#
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge. | __label__pos | 0.666848 |
Skip to main content
How to configure BitLocker encryption on Windows 11
Windows 11 set up BitLocker
Windows 11 set up BitLocker (Image credit: Windows Central )
BitLocker on Windows 11 adds an extra layer of security with encryption to protect your device and files from unauthorized access. When using encryption, the feature scrambles the data on the drive to make it unreadable for anyone without the correct decryption key.
The BitLocker security feature is available on Windows 11 Pro, Enterprise, and Education editions. However, on Windows 11 Home, you can use "device encryption," a limited version of BitLocker. It works identical to the full version but without many of the advanced management settings and capabilities, such as "BitLocker To Go." Also, when using device encryption, all the drives will encrypt automatically, while the full version of BitLocker allows you to choose the storage using encryption.
In this Windows 11 guide, we will walk you through the steps to get started setting up device encryption with BitLocker on your computer.
How to set up BitLocker on Windows 11 Pro
To configure BitLocker in the Pro edition of Windows 11, use these steps:
1. Open Settings.
2. Click on Storage.
3. Under the "Storage management" section, click on Advanced storage settings.
4. Click on Disks & volumes.
Source: Windows Central (Image credit: Source: Windows Central)
1. Select the drive with the partition to encrypt.
2. Select the partition to enable encryption.
3. Click the Properties button.
Source: Windows Central (Image credit: Source: Windows Central)
1. Click the Turn on BitLocker option.
Source: Windows Central (Image credit: Source: Windows Central)
1. Click the Turn on BitLocker option again.
Source: Windows Central (Image credit: Source: Windows Central)
1. Select the option to back up the recovery key — for example, Save to your Microsoft account.Quick note: You can always find the recovery key on your Microsoft account (opens in new tab). Also, the option to save online is only available when the account is connected with a Microsoft account.
Source: Windows Central (Image credit: Source: Windows Central)
1. Click the Next button.
2. Select the Encrypt used disk space only option.
Source: Windows Central (Image credit: Source: Windows Central)
1. Click the Next button.
2. Select the New encryption mode option.
Source: Windows Central (Image credit: Source: Windows Central)
1. Check the Run BitLocker system check option.
Source: Windows Central (Image credit: Source: Windows Central)
1. Click the Restart now button (if applicable).
Once you complete the steps, the system will begin encrypting the data on the drive.
While in the "BitLocker Drive Encryption," it is also possible to encrypt other drives, such as secondary storage, external USB hard drives, and removable data drives, using "BitLocker To Go."
Remove BitLocker encryption
If you need to remove the system encryption, use these steps:
1. Open Control Panel.
2. Click on System and Security.
3. Click on BitLocker Drive Encryption.
Source: Windows Central (Image credit: Source: Windows Central)
1. Under the "Operating system drive" section, click the Turn off BitLocker option.
Source: Windows Central (Image credit: Source: Windows Central)
1. Click the Turn off BitLocker button again.
After you complete the steps, the decryption process will take a while, depending on how large the drive is and your data.
How to set up BitLocker on Windows 11 Home
To configure BitLocker in the Home edition of Windows 11, use these steps:
1. Open Settings.
2. Click on Privacy & Security.
3. Click the Device encryption setting.
Source: Windows Central (Image credit: Source: Windows Central)
1. Turn on Device encryption toggle switch.
Source: Windows Central (Image credit: Source: Windows Central)
1. (Optional) Under the "Related" section, click the BitLocker drive encryption option.
2. Under the "Operating system drive" section, click the Back up your recovery key option.
Source: Windows Central (Image credit: Source: Windows Central)
1. Click the Save to a file option.
2. Save the BitLocker recovery key in a different location.
3. Click the Save button.
Once you complete the steps, BitLocker will turn on the system to encrypt the files on the drive.
This version of BitLocker is only available on some devices. If you don't find the option, the device most likely doesn't support device encryption. You would typically see this feature on devices like Microsoft Surface devices, and those from other brands like HP, Lenovo, Dell, etc.
Remove BitLocker encryption
To decrypt a device using BitLocker, use these steps:
1. Open Settings.
2. Click on Privacy & Security.
3. Click the Device encryption setting.
Source: Windows Central (Image credit: Source: Windows Central)
1. Turn off the Device encryption toggle switch.
Source: Windows Central (Image credit: Source: Windows Central)
After you complete the steps, the decryption process will begin on the device.
More Windows resources
For more helpful articles, coverage, and answers to common questions about Windows 10 and Windows 11, visit the following resources:
Mauro Huculak is technical writer for WindowsCentral.com. His primary focus is to write comprehensive how-tos to help users get the most out of Windows 10 and its many related technologies. He has an IT background with professional certifications from Microsoft, Cisco, and CompTIA, and he's a recognized member of the Microsoft MVP community.
1 Comment
• I have a Lenovo Legion Y740 laptop running Windows 11 Home 21H2; and that doesn't have the encryption option mentioned in this article. | __label__pos | 0.824446 |
1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!
Homework Help: Help with a word problem
1. Jun 28, 2011 #1
The word problem: If the product of a number and -5 is reduced by 2, the result is 26 less than twice the opposite of the number. What is the number?
I wrote it out like this:
n x (-5) - 2 = 2(-n) - 26
I'm really at a loss here. Normally when there's a variable, my teacher says to get the variable alone, but when there's two that share a number, I don't know what to do besides pick random numbers and see what happens :P
Thanks in advance,
Cyril
2. jcsd
3. Jun 28, 2011 #2
tiny-tim
User Avatar
Science Advisor
Homework Helper
Hi Cyril! :smile:
Just shove all the n's over to the LHS, and everything else to the RHS. :wink:
4. Jun 28, 2011 #3
Haha thanks :D
So add 7 to the left to get rid of the -5 and - 2 (and add it to the right of course), but how do you move the variable from the right?
5. Jun 28, 2011 #4
tiny-tim
User Avatar
Science Advisor
Homework Helper
eugh! :yuck:
perhaps i'd better start you off :wink:
n x (-5) - 2 = 2(-n) - 26
let's rewrite that as
-5n - 2 = -2n - 26 …
carry on from there :smile:
6. Jun 28, 2011 #5
HallsofIvy
User Avatar
Science Advisor
It would be better to write this as -5n- 2= -2n- 26
So combine the two: add 2n to both sides, add 2 to both sides
(If you don't like negatives, you could start by multiplying both sides by -1 to get
5n+ 2= 2n+ 26. Now subtract 2n from both sides, subtract from both sides.)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook | __label__pos | 0.967809 |
Looi Looi - 2 years ago 79
Python Question
How to call a function from within another function
Im trying to make a program which can calculate density, terminal velocity and viscosity.
I've seperated them so that it's easier for a user to understand.
The flow is as follows:
It's pretty simple but when the density() function is called, its meant to calculate denCould someone help? The code is below, and so is the error.
import sys
def terminalvelandviscocalc(ms,ds,pa):
import math as m
masssteel=ms
diametersteel=ds
projectarea=pa
termvelo=m.sqrt((2*masssteel*9.81)/(density*projectarea*0.5))
visco=((masssteel*9.8)-((4.0/3.0)*((diametersteel/2)**3)*9.8*density))/(6*m.pi*(diametersteel/2)*termvelo)
print 'The terminal velocity is: %.2f' %termvelo
print 'The viscosity is: %.2f' %visco
return termvelo
return visco
And the error :
termvelo=m.sqrt((2*masssteel*9.81)/(density*projectarea*0.5))
TypeError: unsupported operand type(s) for *: 'function' and 'float'
Answer Source
density is a function, yet in the line termvelo=m.sqrt((2*masssteel*9.81)/(density*projectarea*0.5)) you use it as a variable.
You should call it with (), and provide the 3 arguments that it expects (I called them arg1, arg2, arg3. You should use the correct variable names from your code):
termvelo=m.sqrt((2*masssteel*9.81)/(density(arg1, arg2, arg3)*projectarea*0.5))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download | __label__pos | 0.996663 |
What is the Least Common Multiple (LCM) of 17 and 10?
If you are searching to find out what the lowest common multiple of 17 and 10 is then you probably figured out you are in the right place! That's exactly what this quick guide is all about. We'll walk you through how to calculate the least common multiple for any numbers you need to check. Keep reading!
First off, if you're in a rush, here's the answer to the question "what is the LCM of 17 and 10?":
LCM(17, 10) = 170
What is the Least Common Multiple?
In simple terms, the LCM is the smallest possible whole number (an integer) that divides evenly into all of the numbers in the set. It's also sometimes called the least common divisor, or LCD.
There are a number of different ways to calculate the GCF of a set of numbers depending how many numbers you have and how large they are.
For smaller numbers you can simply look at the factors or multiples for each number and find the least common multiple of them.
For 17 and 10 those factors look like this:
• Factors for 17: 1, 2, 5, 10, 17, 34, 85, and 170
• Factors for 10: 1, 2, 5, 10, 17, 34, 85, and 170
As you can see when you list out the factors of each number, 170 is the greatest number that 17 and 10 divides into.
Prime Factors
As the numbers get larger, or you want to compare multiple numbers at the same time to find the GCF, you can see how listing out all of the factors would become too much. To fix this, you can use prime factors.
List out all of the prime factors for each number:
• Prime Factors for 17: 17
• Prime Factors for 10: 2 and 5
Now that we have the list of prime factors, we need to list out all of the prime factors as often as they occur for each given number and then multiply them together. In our example, this becomes:
LCM = 17 x 2 x 5 = 170
Other Ways to Calculate LCM
There are a number of other ways in which you can calculate the least common multiple of numbers, including:
• Prime factorization using exponents
• The cake/ladder method
• The division method
• Using the greatest common factor (GCF)
For the purposes of this tutorial, using factors or prime factors should help you to calculate the answer easily. If you really want to brush up on your math, you can research the other methods and become a full blown LCM expert.
Hopefully you've learned a little math today (but not too much!) and understand how to calculate the LCM of numbers. The next challenge is to pick a couple of new numbers yourself and try to work it out using the above methods.
Not feeling like doing the hard work? No worries! Head back to our LCM calculator instead and let our tool do the hard work for you :)
Cite, Link, or Reference This Page
If you found this content useful in your research, please do us a great favor and use the tool below to make sure you properly reference us wherever you use it. We really appreciate your support!
• "Least Common Multiple of 17 and 10". VisualFractions.com. Accessed on May 25, 2022. http://visualfractions.com/calculator/least-common-multiple/lcm-of-17-and-10/.
• "Least Common Multiple of 17 and 10". VisualFractions.com, http://visualfractions.com/calculator/least-common-multiple/lcm-of-17-and-10/. Accessed 25 May, 2022.
• Least Common Multiple of 17 and 10. VisualFractions.com. Retrieved from http://visualfractions.com/calculator/least-common-multiple/lcm-of-17-and-10/.
Random List of LCM Examples
Here is a list of random least common multiple problems for you to enjoy:
Popular List of LCM Examples
Here are some of the mostly commonly searched for LCM problems for you to enjoy: | __label__pos | 0.844407 |
Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
PerlMonks
Reusing camel code
by gmax (Abbot)
on Dec 02, 2001 at 19:43 UTC ( #128986=perlquestion: print w/ replies, xml ) Need Help??
gmax has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
This one was a slow Saturday, and I spent some idle time looking at the Camel Code. It would be nice to write such a program with a different shape, I thought. Unfortunately, among my many abilities, drawing is definitely missing. However, since the Camel code is a self drawing program, I thought that its magic, albeit not easily duplicated, could be reused. Thus, I got hold of some shapes (using a separated parser, which skips the first two lines and the __DATA__ section) and managed to re-use the Camel code, according to the golden principle of Laziness, so well explained by Larry Wall.
In order to run this program, you must have the Camel code in your current directory. (I only tried it in Linux and FreeBSD.)
perl camelfilter.pl # shows the llama perl camelfilter.pl shark perl camelfilter.pl gmax
The patterns for shark and llama are taken from the omonimous files in the obfuscated code section of www.perlmonks.net. A third pattern, a rather unimaginative "gmax", I got from rotating the output of the good old Unix banner program (still I can't draw, as I told you before). Parsing these files, I got my patterns as sets of F (for Filled) or S (for Spaces) followed by the number of occurrences. Such patterns are then assigned to scalar variables in camelfilter.pl. Newlines are indicated by colons. Thus a pattern of "S30F12:" means 30 spaces, followed by 12 nonspaces and a newline.
+------------------+ | | | while pattern |<------------------+ <-----------------+ | | | | +------------------+ | | | | | V | | /\ | | / \ +----------+----------+ | / \ | | | / is it\____NO_______> | write next non space| | \ space/ | characters from | | \ ? / | camel.pl | | \ / +---------------------+ | \/ | | | | | YES | | | V | +---------------------+ | | write as many spaces| | | as stated in the +------------------------------------+ | pattern | +---------------------+
camelfilter.pl reads camel.pl and makes a string of its code, skipping all spaces. The code is then rewritten in newcamel.pl following the pattern of llama (default), shark or gmax (if stated as an argument in the command line).
newcamel.pl will inherit camel.pl's magic and print its new shapes, with same additional noise lines (due to the difference in size between camels, llamas, sharks and gmax's, I suppose). You can either get rid of the noise by filtering the unwanted lines
system "perl $newcamel | perl -ne 'print if !/^ ?mm|[\\^]{20}/'";
or show them
do "$newcamel";
There is room for improvement (patterns could be bit-encoded, for instance), but I would like some specific hints on how to apply the pattern in a more linear way than my while ($$pattern ...). I suspect that it might be a mappish solution somewhere, but my Laziness did not come up with any practical suggestion (too much Impatience?, not enough Hybris? I don't know.)
I am working on patterns for a less entertaining project, involving database results representation, and some problems are very similar to this one: applying a pattern to a long stream of data in order to create a complex report. Since the problem is basically the same, I thought that asking with a funny example would at least make someone smile.
TIAFYH
gmax
#!/usr/bin/perl -w # camelfilter.pl use strict; my $llama = "S51F11:S47F10S1F9:S45F21:S49F12:S49F9:S49F9:S49F9:" . "S49F9:S49F9:S47F11:S3F8S4F26S4F13:S1F57:F57:F57:S2F54:S2F54:" . "S3F51:S4F49:S4F48:S5F45:S6F17S3F23:S7F15S6F20:S8F13S10F16:" . "S10F10S14F12:S11F8S17F10:S12F5S20F4S1F4:S12F4S21F4S2F3:" . "S11F4S22F3S3F3:S12F3S22F3S3F3:S13F3S21F3S4F2:S13F5S20F3S3F3:" . "S13F6S19F4S2F5:"; my $shark ="S46F9:S41F18:S8F24S5F3S1F21:F41S2F12:F7S2F33S3F9:" . "S2F22S2F20S2F1S2F4:S4F20S3F22S1F4:S6F2S7F10S1F4S1F3S1F20:" . "S11F2S7F14S1F1S1F15S1F3:S13F3S8F11S1F1S1F1S1F18:" . "S14F7S6F6S1F1S2F21:S16F21S1F9S1F13:S19F20S1F3S2F2S1F13:" . "S19F2S4F14S3F6S2F12:S17F7S9F6S1F2S3F4S1F13:S16F5S17F8S2F1S2F13:" . "S16F1S26F21:S53F12:S48F3S5F9:S50F6S2F7:S52F12:S53F10:S54F6:" . "S54F5:S53F4:S53F2:F1:"; my $gmax = "S65:S12F2S51:S11F4S50:S12F2S51:" . "S5F4S3F2S1F5S3F2S4F2S8F3S7F7S3F5S1:" . "S4F6S1F2S2F5S2F3S3F4S5F7S5F7S3F5S1:" . "S3F3S2F3S5F4S1F5S1F5S5F2S2F3S6F5S6F2S2:" . "S2F3S3F4S4F10S1F6S3F3S3F3S6F4S5F2S3:" . "S1F4S4F3S4F5S1F5S2F4S3F3S3F4S5F4S5F1S4:" . "S1F4S4F4S3F4S3F4S2F4S3F3S4F3S6F4S3F2S4:" . "S1F3S6F3S3F4S3F3S3F4S3F3S4F3S6F4S3F2S4:" . "F4S6F3S3F4S3F3S3F4S4F1S5F3S7F4S2F1S5:" . "F4S6F3S3F4S3F3S3F4S10F3S7F4S1F2S5:" . "F4S6F3S3F4S3F3S3F4S10F3S8F5S6:" . "F4S6F3S3F4S3F3S3F4S5F2S3F3S8F5S6:" . "F4S6F3S3F4S3F3S3F4S4F5S1F3S8F5S6:" . "S1F4S4F4S3F4S3F3S3F4S3F10S8F5S6:" . "S1F4S4F4S3F4S3F3S3F4S2F4S2F5S9F4S6:" . "S2F3S4F3S4F4S3F3S3F4S2F3S4F4S9F4S6:" . "S2F3S3F3S5F4S3F3S3F4S2F3S5F3S8F6S5:" . "S3F7S6F4S3F3S3F4S1F4S5F3S8F6S5:" . "S4F6S6F4S3F3S3F4S1F4S5F3S8F1S2F4S4:" . "S4F1S11F4S3F3S3F4S1F4S5F3S7F2S2F4S4:" . "S3F2S11F4S3F3S3F4S2F3S5F3S7F1S4F4S3:" . "S2F3S11F4S3F3S3F4S2F3S4F4S6F2S4F4S3:" . "S2F4S10F4S3F3S3F4S2F4S3F4S6F2S4F4S3:" . "S2F6S8F4S3F3S3F4S3F11S4F2S6F4S2:" . "S2F7S6F6S1F5S1F6S2F6S1F4S2F5S4F6S1:" . "S2F9S4F6S1F5S1F6S4F2S4F4S1F5S4F6S1:" . "S2F10S53:S1F2S2F7S53:S1F1S4F7S52:" . "S1F1S6F5S52:F2S8F3S52:F2S8F3S52:" . "F2S8F3S52:F2S8F3S52:S1F1S8F3S52:" . "S1F2S6F3S53:S2F3S3F4S53:S2F9S54:S3F7S55:S65:"; my $newcamel = "newcamel.pl"; my $oldcamel = "camel.pl"; open CAMEL, "< $oldcamel" or die "camel ($oldcamel) not found\n"; open NEWCAMEL, "> $newcamel" or die "can't create new camel ($newcamel)\n"; my $camel; while (<CAMEL>) { print NEWCAMEL $_,next if /^(:?use|#)/; chomp; while (/(.)/g) { $camel .= $1 if $1 ne " "; } } close CAMEL; my $out; my $choice=shift; my $pattern = \$llama; if (defined $choice) { $pattern = \$gmax if $choice eq "gmax"; $pattern = \$shark if $choice eq "shark"; } else { $choice = "llama"; } my $camelcount =0; while ($$pattern =~ /([SF:])([^SF:]*)/g) { if ($1 eq "F"){ $out = substr ($camel, $camelcount, $2); $camelcount += $2; } elsif ($1 eq "S"){ $out = " " x $2; } else { $out = "\n"; } print NEWCAMEL $out; } $out = substr($camel,$camelcount); print NEWCAMEL $out; close NEWCAMEL; system "perl $newcamel | " . "perl -ne 's/camel/$choice/;print if !/^ ?mm|[\\^]{20}/'"; #do "$newcamel";
Edit 2001-12-05 by dvergin per user request</link>
Comment on Reusing camel code
Select or Download Code
Replies are listed 'Best First'.
Re: Reusing camel code
by Beatnik (Parson) on Dec 03, 2001 at 00:02 UTC
#!/usr/bin/perl eval eval '"'. ('#'). '!'.'/' .('[' ^'.' ) .('['^'('). ("\["^ ')')."\/".( '`'|'"').('`'| ')').( '`'|'.') .'/'. ( '['^'+').('`'|'%').('[' ^')').('`'|',').('!' ^'+').('!'^'+').('['^'+' ).('['^')').('`'|')') .('`'|'.').('['^'/').(('{')^ '[').'\\'.'"'.("\`"^ '(').('`'|'%').('`'|',').('`'|','). (('`')| '/').('{'^'[').('{'^',').('`'|'/').( '['^')').('`'|',').('`'|'$').'\\'.'"'.';'.'"';$:='.'^'~';$~ ='@'|'(';$^=')'^'[';$/='`'|'.';$_='('^'}';$,='`'|'!';$\="\)"^ '}';$:='.'^'~';$~='@'|'(';$^=')'^'[';$/='`'|'.';$_='('^"\}";$,= '`'|'!';$\=')'^'}';$:='.'^'~';$~='@'|'(';$^=')'^'[';$/='`'|'.'; $_='('^'}';$,='`'|'!';$\=')'^'}';$:='.'^'~';$~='@'|'(';$^="\)"^ '[';$/='`'|'.';$_='('^'}';$,='`'|'!';$\=')'^'}';$:='.'^"\~";$~= '@'|'(';$^=')'^'[';$/='`'|'.';$_='('^'}';$,='`'|'!';$\=')'^"\}"; $:='.'^'~';$~='@'|'(';$^=')'^'[';$/='`'|'.';$_='('^'}';$,="\`"| '!';$\=')'^'}';$:='.'^'~';$~='@'|'(';$^=')'^'[';$/='`' |"\."; $_='('^'}';$,='`'|'!';$\=')'^'}';$:='.'^'~';$~="\@"| "\("; $^=')'^'[';$/='`'|'.';$_='('^'}';$,='`'|'!';$\=')' ^'}'; $:='.'^'~';$~='@'|'(';$^=')'^'[';$/='`' |'.';$_= '('^ (( '}'));$,='`'|'!';$\=')'^"\}";$:= '.'^'~'; ($~) ='@'|"\("; $^=')'^'[' ;$/='`'| '.';$_= '(' ^('}');$,= '`'|'!';$\ =')'^'}' ;$:='.' ^+ "\~";$~= '@'|'(';$^ =(')')^ '[';$/ ='`'|'.' ;$_=('(')^ '}';$,= "\`"| '!';$\= ')'^'}';$: ="\."^ '~';$~ =('@')| "\(";$^= (')')^ "\["; $/='`' |"\."; $_='(' ^'}'; ($,)= ('`')| '!';$\ =')'^ "\}"; $:='.'^ '~';$~ ='@' |'('; $^=')'^'[' ;$/= '`'| "\.";$_= '('^ '}'; $,=('`')| '!'; ($\) =')'^'}';$: ='.'^ "\~"; $~='@'|'(';$^= (')')^ "\["; $/="\`"| '.'; $_='('^ '}';$,= '`'|'!'; $\="\)"^ '}';#;
Now that I have your attention, the above camel is generated with Acme::EyeDrops and it's one of the many shapes available. You can have your own ASCII art too :) BooK explained the REAL camel at YAPC::Eu 2.00.1. Slides are here.
Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.
Re: Reusing camel code
by chromatic (Archbishop) on Dec 03, 2001 at 00:00 UTC
split looks like a better choice than a regex. I whittled away at this and came up with the untested:
for (split(/:/, $$pattern)) { # make sure it starts and ends with spaces $_ = 'S0' . $_ unless /^S/; $_ .= 'S0' unless /S\d+$/; my @pieces = split(/[SF](\d+)/, $_); while (my ($spaces, $fills) = splice(@pieces, 0, 2)) { $out .= " " x $spaces . substr($camel, $camelcount, $fills); } $out .= "\n"; }
I'm fairly pleased with that, but might try to fit a pack in there. (How would you have used map?)
Aside, this:
while (/(.)/g) { $camel .= $1 if $1 ne " "; }
could be spelled:
tr/ //d; $camel .= $_;
I'm sure you can trim that down more, too. Don't forget to check out Acme::EyeDrops for a different take on things.
Update, very shortly after: You could, of course, just split on [SF] and probably get the same effect, though you'll have an empty element at the start. It may or may not be more clear that way.
Thank you very much for your hints. I tested your code
for (split(/:/, $$pattern)) { $_ = 'S0' . $_ unless /^S/; $_ .= 'S0' unless /S\d+$/; print STDERR "pattern: $_\n"; my @pieces = split(/[SF](\d+)/, $_); foreach my $count (0..$#pieces) { print STDERR "$count -> [$pieces[$count]] "; } print STDERR "\n"; }
But I got an odd output. Split gives back some empty items
pattern: S51F11S0 0 -> [] 1 -> [51] 2 -> [] 3 -> [11] 4 -> [] 5 -> [0]
Changing split to match only /[SF]/ (your update suggestion) and adding a shift afterwards improves the output,
pattern: S51F11S0 0 -> [51] 1 -> [11] 2 -> [0]
leaving me with the second problem, i.e. that having an odd number of items in my array, splice(@,0,2) will give back an undefined second element.
Nothing catastrophic, but it is going to increase the number of necessary checks.
Even if it doesn't do what I need, though, this code of yours gives me some ideas that I can further develop.
As for the second hint:
tr/ //d; $camel .= $_;
yes, it looks much faster (not to mention smarter) than my code.
Ciao gmax
Log In?
Username:
Password:
What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://128986]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...
How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2015-10-10 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Does Humor Belong in Programming?
Results (255 votes), past polls | __label__pos | 0.814876 |
101
Switching Protocols
Resmi
Protokol transmisi diubah atas permintaan klien
Penjelasan umum tentang kode status 101
Bayangkan Anda sedang berada di sebuah restoran dan ingin memesan minuman. Pelayan menghampiri Anda dan menanyakan pesanan Anda. Anda berkata, "Saya ingin segelas air putih, tetapi jika Anda memiliki jus jeruk segar, saya lebih suka itu." Di sini Anda pada dasarnya memberi pelayan dua pilihan dan memberi tahu bahwa Anda fleksibel. Permintaan untuk berpindah protokol juga bekerja dengan cara yang sama.
Ketika browser web atau alat klien lainnya mengirimkan permintaan ke server, klien dapat menyarankan untuk berpindah ke protokol komunikasi yang berbeda karena percaya bahwa protokol yang lain akan lebih efisien atau lebih cocok. Sebagai contoh, klien yang awalnya menggunakan koneksi HTTP mungkin menyarankan untuk beralih ke WebSockets untuk menyediakan koneksi yang selalu terbuka untuk data waktu nyata.
Ketika server menerima saran ini, server akan merespons dengan kode status 101 Switching Protocols untuk memberi tahu klien, "Baiklah! Mari kita beralih protokol." Sejak saat itu, komunikasi antara klien dan server berlanjut melalui protokol baru yang telah disepakati.
Spesifikasi kode status HTTP 101
Kode status 101 Switching Protocols menunjukkan bahwa server memahami dan bersedia memenuhi permintaan klien, melalui bidang header Upgrade, untuk perubahan protokol aplikasi yang digunakan pada koneksi ini. Server HARUS membuat bidang header Upgrade dalam respons yang menunjukkan protokol mana yang akan dialihkan segera setelah baris kosong yang mengakhiri respons 101 Switching Protocols. Diasumsikan bahwa server hanya akan setuju untuk mengganti protokol jika memang menguntungkan. Sebagai contoh, beralih ke versi HTTP yang lebih baru mungkin lebih menguntungkan daripada versi yang lebih lama, dan beralih ke protokol sinkron waktu nyata mungkin lebih menguntungkan ketika mengirimkan sumber daya yang menggunakan fitur tersebut.
Sumber / Kutipan dari: Kode status HTTP 101 Switching Protocols ditentukan oleh bagian 6.2.2 dari RFC7231.
Bagaimana cara melempar kode status 101 dengan PHP?
Untuk melemparkan kode status HTTP 101 pada halaman web, fungsi PHP http_response_code dapat digunakan. Sintaksnya adalah sebagai berikut: http_response_code(101) (PHP 5 >= 5.4.0, PHP 7, PHP 8)
Menguji Kode Status HTTP 101
Untuk dapat menampilkan kode status HTTP (dalam hal ini 101 Switching Protocols) dan informasi lain di sisi klien, konsol pengembangan harus dibuka dengan F12. Kemudian arahkan ke tab "Jaringan". Sekarang halaman dapat dibuka, situs web (contoh index.php) akan terlihat di tab jaringan. Ini harus dipilih dan kemudian bagian Herder harus dipilih. Pengguna kemudian akan melihat hasil berikut:
Kode status 101 Switching Protocols
Ikhtisar
URL: https://http-statuscode.com/errorCodeExample.php?code=101
Status: 101 Switching Protocols
Itu: Network
Alamat IP: XX.XX.XX.XX
Kode status 101 Switching Protocols
Kompatibilitas browser dari kode status 101
Chrome no data
Edge no data
Firefox no data
Opera no data
Safari no data
Chrome Android no data
Firefox for Android no data
Opera Android no data
Safari on iOS no data
Internet no data
WebView Android no data
Konstanta dalam bahasa pemrograman
HttpStatusCode.SwitchingProtocols
http.StatusSwitchingProtocols
Response::HTTP_SWITCHING_PROTOCOLS
httplib.SWITCHING_PROTOCOLS
http.client.SWITCHING_PROTOCOLS
http.HTTPStatus.SWITCHING_PROTOCOLS
:switching_protocols
HttpServletResponse.SC_SWITCHING_PROTOCOLS
Meme yang menghibur tentang kode status HTTP 101
Penulis: Tony Brüser
Penulis: Tony Brüser
Tony Brüser adalah seorang pengembang web yang antusias dengan kegemaran pada kode status HTTP.
LinkedInGitHub | __label__pos | 0.93367 |
4
$\begingroup$
Shall I construct a stochastic process $X(t)$ such that $X(s+t)-X(s)\sim U(-t,t)$ ? Or is there already any similar formula?
$\endgroup$
1 Answer 1
3
$\begingroup$
Let $U$ be uniform in $[-1,1]$ and let $X_t=Ut$, which is uniform in $[-t,t]$. Then $$X_{t+s}-X_s=U(t+s)-Us=Ut$$ so this works. So it's not so much a stochastic process as just a random variable giving the slope of a line.
$\endgroup$
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.994405 |
What s the difference between Docker for Windows and Docker on Windows
0 votes
What's the difference between Docker for Windows and Docker on Windows?
Oct 1, 2018 in Docker by Sophie may
• 10,530 points
462 views
1 answer to this question.
0 votes
Docker on Windows is a way to refer to just the Docker Engine running on Windows. I find it helpful to think of this as a Windows Container Host, so yes Windows containers only. This would be what you would run on a Windows Server 2016 machine. So maybe a better name is Docker for Windows Server which I believe people have used as well. I still prefer a Windows Container Host. Which means it only has the Docker Engine at the end of the day, doesn't even need to have any of the Docker clients.
Docker for Windows is a product meant for running both Linux and Windows containers on Windows. It's not meant for a production environment, and instead is meant for a desktop/client SKU of Windows, hence the Windows 10 requirement. So, you could think of this as Docker for Windows 10. Because Docker for Windows can run both container types.
answered Oct 1, 2018 by Tyrion anex
• 8,650 points
Related Questions In Docker
0 votes
1 answer
0 votes
1 answer
What is the difference between “expose” and “publish” in Docker?
Basically, you have three options: Neither specify EXPOSE nor -p -> ...READ MORE
answered Jul 18, 2018 in Docker by Nilesh
• 7,020 points
1,881 views
0 votes
2 answers
0 votes
3 answers
What is the difference between a Docker image and a container?
Images are read-only templates that contain a ...READ MORE
answered Aug 10, 2020 in Docker by Vishal
• 260 points
4,651 views
+2 votes
1 answer
+2 votes
1 answer
Deploy Docker Containers from Docker Cloud
To solve this problem, I followed advice ...READ MORE
answered Sep 3, 2018 in AWS by Priyaj
• 58,100 points
1,039 views
0 votes
1 answer
0 votes
1 answer
How to enable/ disable Hyper-V for Docker on Windows?
You can do this from command prompt ...READ MORE
answered Sep 10, 2018 in Docker by Tyrion anex
• 8,650 points
4,008 views | __label__pos | 0.538216 |
Sorry, we don't support your browser. Install a modern browser
Single sign-on (SSO) via SAML 2.0
Nolt supports Single sign-on using SAML 2.0. If you have an IdP that supports SAML 2.0 protocol, you can allow users to log in to Nolt board using our single sign-on mechanism. This guide will help you configure single-sign-on using SAML 2.0 for your Nolt board.
This feature is only available for enterprise customers.
Application setup in IdP
You have to add a new application (Nolt) in your IdP that uses SAML 2.0 for authentication. Just make sure to use the following configuration for the application.
1. Single sign-on URL:
https://YOUR_BOARD.nolt.io/sso/saml
2. Audience URI (SP Entity ID):
https://YOUR_BOARD.nolt.io
3. Redirect URL/Callback URL/ACS (Consumer) URL/Recipient URL:
It's compulsory to pass the Recipient URL from IdP which should be equal to the callback url. If you don't mention it (not a required field in IdP), some IdPs will automatically send the value of the Recipient URL as the ACS URL. If you mention make sure it is same as the ACS URL.
https://YOUR_BOARD.nolt.io/sso/saml
4. Attributes/Parameters
It's mandatory to pass the below fields with the same field-name as below (case sensitive).
• id
• name
• email
• noltUserRole (Optional)
• Custom Attributes (Optional)
You can set the custom attributes that will be shown in the user profile. You can use any field-name and field value for custom attributes.
The id should be unique for every user. The field picture (optional) can also be passed.
5. SAML signature element
SAML Assertion should be signed not the SAML response
6. Signature Algorithm
The Signature Algorithm should be RSA-SHA256 and the Digest Algorithm should be SHA256.
Integration in Nolt
Navigate to your board → IntegrationsSAML 2.0. Set up all the required fields to activate the integration.
1. IDP entity ID (Issuer URL):
Use the Identity Provider Issuer/Issuer URL of the Nolt application in your IdP.
2. SP Entity ID (Audience URI):
https://YOUR_BOARD.nolt.io
It should match the Audience URI of the Nolt application in IdP.
3. X509 Certificate:
Use the X.509 certificate of the Nolt application in your IdP.
4. Remote Login URL:
Use the Remote Login/Endpoint URL of the Nolt application in your IdP.
5. Remote logout URL (optional)
Add a Remote logout URL if you want to redirect users to a specific URL after they log out from their Nolt account.
6. User role structure (optional)
To add the additional user role parameter for making any SSO user a moderator or admin you can set this field. For the below response,
{ customParams: { noltUserRole: 'ADMIN' }}
The user role structure should be set as follows:
customParameters:noltUserRole
7. Custom Attributes (optional)
If you have any custom attributes, you need to set up this field.
{
email: '[email protected]',
customParams:{
employees: [{
employeeId: {
id: 3232324,
},
}]
}
}
For the above response from IdP the custom attributes needs to be setup as,
{ “Employee ID”: “customParams:employees:0:employeeId:id” }
8. Click Test and activate:
This should activate the SSO. To test the SSO try logging in as a new user.
Need help?
Please feel free to reach out at [email protected] for any help regarding SAML integration.
Related
Setting up SSO with Auth0
Setup single-sign-on (SSO) via Auth0.
Setting up SSO with Okta
Setup single-sign-on (SSO) via Okta.
Setting up SSO with OneLogin
Setup single-sign-on (SSO) via OneLogin. | __label__pos | 0.906787 |
WC_Eval_Math{}WC 1.0
Class WC_Eval_Math. Supports basic math only (removed eval function).
Based on EvalMath by Miles Kaufman Copyright (C) 2005 Miles Kaufmann http://www.twmagic.com/.
Хуков нет.
Использование
$WC_Eval_Math = new WC_Eval_Math();
// use class methods
Методы
1. private static debugPrintCallingFunction()
2. public static evaluate( $expr )
3. private static nfx( $expr )
4. private static pfx( $tokens, $vars = array() )
5. private static trigger( $msg )
Код WC_Eval_Math{} WC 6.4.1
class WC_Eval_Math {
/**
* Last error.
*
* @var string
*/
public static $last_error = null;
/**
* Variables (and constants).
*
* @var array
*/
public static $v = array( 'e' => 2.71, 'pi' => 3.14 );
/**
* User-defined functions.
*
* @var array
*/
public static $f = array();
/**
* Constants.
*
* @var array
*/
public static $vb = array( 'e', 'pi' );
/**
* Built-in functions.
*
* @var array
*/
public static $fb = array();
/**
* Evaluate maths string.
*
* @param string $expr
* @return mixed
*/
public static function evaluate( $expr ) {
self::$last_error = null;
$expr = trim( $expr );
if ( substr( $expr, -1, 1 ) == ';' ) {
$expr = substr( $expr, 0, strlen( $expr ) -1 ); // strip semicolons at the end
}
// ===============
// is it a variable assignment?
if ( preg_match( '/^\s*([a-z]\w*)\s*=\s*(.+)$/', $expr, $matches ) ) {
if ( in_array( $matches[1], self::$vb ) ) { // make sure we're not assigning to a constant
return self::trigger( "cannot assign to constant '$matches[1]'" );
}
if ( ( $tmp = self::pfx( self::nfx( $matches[2] ) ) ) === false ) {
return false; // get the result and make sure it's good
}
self::$v[ $matches[1] ] = $tmp; // if so, stick it in the variable array
return self::$v[ $matches[1] ]; // and return the resulting value
// ===============
// is it a function assignment?
} elseif ( preg_match( '/^\s*([a-z]\w*)\s*\(\s*([a-z]\w*(?:\s*,\s*[a-z]\w*)*)\s*\)\s*=\s*(.+)$/', $expr, $matches ) ) {
$fnn = $matches[1]; // get the function name
if ( in_array( $matches[1], self::$fb ) ) { // make sure it isn't built in
return self::trigger( "cannot redefine built-in function '$matches[1]()'" );
}
$args = explode( ",", preg_replace( "/\s+/", "", $matches[2] ) ); // get the arguments
if ( ( $stack = self::nfx( $matches[3] ) ) === false ) {
return false; // see if it can be converted to postfix
}
$stack_size = count( $stack );
for ( $i = 0; $i < $stack_size; $i++ ) { // freeze the state of the non-argument variables
$token = $stack[ $i ];
if ( preg_match( '/^[a-z]\w*$/', $token ) and ! in_array( $token, $args ) ) {
if ( array_key_exists( $token, self::$v ) ) {
$stack[ $i ] = self::$v[ $token ];
} else {
return self::trigger( "undefined variable '$token' in function definition" );
}
}
}
self::$f[ $fnn ] = array( 'args' => $args, 'func' => $stack );
return true;
// ===============
} else {
return self::pfx( self::nfx( $expr ) ); // straight up evaluation, woo
}
}
/**
* Convert infix to postfix notation.
*
* @param string $expr
*
* @return array|string
*/
private static function nfx( $expr ) {
$index = 0;
$stack = new WC_Eval_Math_Stack;
$output = array(); // postfix form of expression, to be passed to pfx()
$expr = trim( $expr );
$ops = array( '+', '-', '*', '/', '^', '_' );
$ops_r = array( '+' => 0, '-' => 0, '*' => 0, '/' => 0, '^' => 1 ); // right-associative operator?
$ops_p = array( '+' => 0, '-' => 0, '*' => 1, '/' => 1, '_' => 1, '^' => 2 ); // operator precedence
$expecting_op = false; // we use this in syntax-checking the expression
// and determining when a - is a negation
if ( preg_match( "/[^\w\s+*^\/()\.,-]/", $expr, $matches ) ) { // make sure the characters are all good
return self::trigger( "illegal character '{$matches[0]}'" );
}
while ( 1 ) { // 1 Infinite Loop ;)
$op = substr( $expr, $index, 1 ); // get the first character at the current index
// find out if we're currently at the beginning of a number/variable/function/parenthesis/operand
$ex = preg_match( '/^([A-Za-z]\w*\(?|\d+(?:\.\d*)?|\.\d+|\()/', substr( $expr, $index ), $match );
// ===============
if ( '-' === $op and ! $expecting_op ) { // is it a negation instead of a minus?
$stack->push( '_' ); // put a negation on the stack
$index++;
} elseif ( '_' === $op ) { // we have to explicitly deny this, because it's legal on the stack
return self::trigger( "illegal character '_'" ); // but not in the input expression
// ===============
} elseif ( ( in_array( $op, $ops ) or $ex ) and $expecting_op ) { // are we putting an operator on the stack?
if ( $ex ) { // are we expecting an operator but have a number/variable/function/opening parenthesis?
$op = '*';
$index--; // it's an implicit multiplication
}
// heart of the algorithm:
while ( $stack->count > 0 and ( $o2 = $stack->last() ) and in_array( $o2, $ops ) and ( $ops_r[ $op ] ? $ops_p[ $op ] < $ops_p[ $o2 ] : $ops_p[ $op ] <= $ops_p[ $o2 ] ) ) {
$output[] = $stack->pop(); // pop stuff off the stack into the output
}
// many thanks: https://en.wikipedia.org/wiki/Reverse_Polish_notation#The_algorithm_in_detail
$stack->push( $op ); // finally put OUR operator onto the stack
$index++;
$expecting_op = false;
// ===============
} elseif ( ')' === $op && $expecting_op ) { // ready to close a parenthesis?
while ( ( $o2 = $stack->pop() ) != '(' ) { // pop off the stack back to the last (
if ( is_null( $o2 ) ) {
return self::trigger( "unexpected ')'" );
} else {
$output[] = $o2;
}
}
if ( preg_match( "/^([A-Za-z]\w*)\($/", $stack->last( 2 ), $matches ) ) { // did we just close a function?
$fnn = $matches[1]; // get the function name
$arg_count = $stack->pop(); // see how many arguments there were (cleverly stored on the stack, thank you)
$output[] = $stack->pop(); // pop the function and push onto the output
if ( in_array( $fnn, self::$fb ) ) { // check the argument count
if ( $arg_count > 1 ) {
return self::trigger( "too many arguments ($arg_count given, 1 expected)" );
}
} elseif ( array_key_exists( $fnn, self::$f ) ) {
if ( count( self::$f[ $fnn ]['args'] ) != $arg_count ) {
return self::trigger( "wrong number of arguments ($arg_count given, " . count( self::$f[ $fnn ]['args'] ) . " expected)" );
}
} else { // did we somehow push a non-function on the stack? this should never happen
return self::trigger( "internal error" );
}
}
$index++;
// ===============
} elseif ( ',' === $op and $expecting_op ) { // did we just finish a function argument?
while ( ( $o2 = $stack->pop() ) != '(' ) {
if ( is_null( $o2 ) ) {
return self::trigger( "unexpected ','" ); // oops, never had a (
} else {
$output[] = $o2; // pop the argument expression stuff and push onto the output
}
}
// make sure there was a function
if ( ! preg_match( "/^([A-Za-z]\w*)\($/", $stack->last( 2 ), $matches ) ) {
return self::trigger( "unexpected ','" );
}
$stack->push( $stack->pop() + 1 ); // increment the argument count
$stack->push( '(' ); // put the ( back on, we'll need to pop back to it again
$index++;
$expecting_op = false;
// ===============
} elseif ( '(' === $op and ! $expecting_op ) {
$stack->push( '(' ); // that was easy
$index++;
// ===============
} elseif ( $ex and ! $expecting_op ) { // do we now have a function/variable/number?
$expecting_op = true;
$val = $match[1];
if ( preg_match( "/^([A-Za-z]\w*)\($/", $val, $matches ) ) { // may be func, or variable w/ implicit multiplication against parentheses...
if ( in_array( $matches[1], self::$fb ) or array_key_exists( $matches[1], self::$f ) ) { // it's a func
$stack->push( $val );
$stack->push( 1 );
$stack->push( '(' );
$expecting_op = false;
} else { // it's a var w/ implicit multiplication
$val = $matches[1];
$output[] = $val;
}
} else { // it's a plain old var or num
$output[] = $val;
}
$index += strlen( $val );
// ===============
} elseif ( ')' === $op ) { // miscellaneous error checking
return self::trigger( "unexpected ')'" );
} elseif ( in_array( $op, $ops ) and ! $expecting_op ) {
return self::trigger( "unexpected operator '$op'" );
} else { // I don't even want to know what you did to get here
return self::trigger( "an unexpected error occurred" );
}
if ( strlen( $expr ) == $index ) {
if ( in_array( $op, $ops ) ) { // did we end with an operator? bad.
return self::trigger( "operator '$op' lacks operand" );
} else {
break;
}
}
while ( substr( $expr, $index, 1 ) == ' ' ) { // step the index past whitespace (pretty much turns whitespace
$index++; // into implicit multiplication if no operator is there)
}
}
while ( ! is_null( $op = $stack->pop() ) ) { // pop everything off the stack and push onto output
if ( '(' === $op ) {
return self::trigger( "expecting ')'" ); // if there are (s on the stack, ()s were unbalanced
}
$output[] = $op;
}
return $output;
}
/**
* Evaluate postfix notation.
*
* @param mixed $tokens
* @param array $vars
*
* @return mixed
*/
private static function pfx( $tokens, $vars = array() ) {
if ( false == $tokens ) {
return false;
}
$stack = new WC_Eval_Math_Stack;
foreach ( $tokens as $token ) { // nice and easy
// if the token is a binary operator, pop two values off the stack, do the operation, and push the result back on
if ( in_array( $token, array( '+', '-', '*', '/', '^' ) ) ) {
if ( is_null( $op2 = $stack->pop() ) ) {
return self::trigger( "internal error" );
}
if ( is_null( $op1 = $stack->pop() ) ) {
return self::trigger( "internal error" );
}
switch ( $token ) {
case '+':
$stack->push( $op1 + $op2 );
break;
case '-':
$stack->push( $op1 - $op2 );
break;
case '*':
$stack->push( $op1 * $op2 );
break;
case '/':
if ( 0 == $op2 ) {
return self::trigger( 'division by zero' );
}
$stack->push( $op1 / $op2 );
break;
case '^':
$stack->push( pow( $op1, $op2 ) );
break;
}
// if the token is a unary operator, pop one value off the stack, do the operation, and push it back on
} elseif ( '_' === $token ) {
$stack->push( -1 * $stack->pop() );
// if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
} elseif ( ! preg_match( "/^([a-z]\w*)\($/", $token, $matches ) ) {
if ( is_numeric( $token ) ) {
$stack->push( $token );
} elseif ( array_key_exists( $token, self::$v ) ) {
$stack->push( self::$v[ $token ] );
} elseif ( array_key_exists( $token, $vars ) ) {
$stack->push( $vars[ $token ] );
} else {
return self::trigger( "undefined variable '$token'" );
}
}
}
// when we're out of tokens, the stack should have a single element, the final result
if ( 1 != $stack->count ) {
return self::trigger( "internal error" );
}
return $stack->pop();
}
/**
* Trigger an error, but nicely, if need be.
*
* @param string $msg
*
* @return bool
*/
private static function trigger( $msg ) {
self::$last_error = $msg;
if ( ! Constants::is_true( 'DOING_AJAX' ) && Constants::is_true( 'WP_DEBUG' ) ) {
echo "\nError found in:";
self::debugPrintCallingFunction();
trigger_error( $msg, E_USER_WARNING );
}
return false;
}
/**
* Prints the file name, function name, and
* line number which called your function
* (not this function, then one that called
* it to begin with)
*/
private static function debugPrintCallingFunction() {
$file = 'n/a';
$func = 'n/a';
$line = 'n/a';
$debugTrace = debug_backtrace();
if ( isset( $debugTrace[1] ) ) {
$file = $debugTrace[1]['file'] ? $debugTrace[1]['file'] : 'n/a';
$line = $debugTrace[1]['line'] ? $debugTrace[1]['line'] : 'n/a';
}
if ( isset( $debugTrace[2] ) ) {
$func = $debugTrace[2]['function'] ? $debugTrace[2]['function'] : 'n/a';
}
echo "\n$file, $func, $line\n";
}
} | __label__pos | 0.995613 |
/[escript]/trunk/escript/py_src/generateutil
ViewVC logotype
Contents of /trunk/escript/py_src/generateutil
Parent Directory Parent Directory | Revision Log Revision Log
Revision 536 - (show annotations)
Fri Feb 17 03:20:53 2006 UTC (13 years, 6 months ago) by gross
File size: 139688 byte(s)
symmetric and nonsymmetric part functions added
1 #!/usr/bin/python
2 # $Id$
3
4 """
5 program generates parts of the util.py and the test_util.py script
6 """
7 test_header=""
8 test_header+="import unittest\n"
9 test_header+="import numarray\n"
10 test_header+="from esys.escript import *\n"
11 test_header+="from esys.finley import Rectangle\n"
12 test_header+="class Test_util2(unittest.TestCase):\n"
13 test_header+=" RES_TOL=1.e-7\n"
14 test_header+=" def setUp(self):\n"
15 test_header+=" self.__dom =Rectangle(11,11,2)\n"
16 test_header+=" self.functionspace = FunctionOnBoundary(self.__dom)\n"
17 test_tail=""
18 test_tail+="suite = unittest.TestSuite()\n"
19 test_tail+="suite.addTest(unittest.makeSuite(Test_util2))\n"
20 test_tail+="unittest.TextTestRunner(verbosity=2).run(suite)\n"
21
22 case_set=["float","array","constData","taggedData","expandedData","Symbol"]
23 shape_set=[ (),(2,), (4,5), (6,2,2),(3,2,3,4)]
24
25 t_prog=""
26 t_prog_with_tags=""
27 t_prog_failing=""
28 u_prog=""
29
30 def wherepos(arg):
31 if arg>0.:
32 return 1.
33 else:
34 return 0.
35
36
37 class OPERATOR:
38 def __init__(self,nickname,rng=[-1000.,1000],test_expr="",math_expr=None,
39 numarray_expr="",symbol_expr=None,diff=None,name=""):
40 self.nickname=nickname
41 self.rng=rng
42 self.test_expr=test_expr
43 if math_expr==None:
44 self.math_expr=test_expr.replace("%a1%","arg")
45 else:
46 self.math_expr=math_expr
47 self.numarray_expr=numarray_expr
48 self.symbol_expr=symbol_expr
49 self.diff=diff
50 self.name=name
51
52 import random
53 import numarray
54 import math
55 finc=1.e-6
56
57 def getResultCaseForBin(case0,case1):
58 if case0=="float":
59 if case1=="float":
60 case="float"
61 elif case1=="array":
62 case="array"
63 elif case1=="constData":
64 case="constData"
65 elif case1=="taggedData":
66 case="taggedData"
67 elif case1=="expandedData":
68 case="expandedData"
69 elif case1=="Symbol":
70 case="Symbol"
71 else:
72 raise ValueError,"unknown case1=%s"%case1
73 elif case0=="array":
74 if case1=="float":
75 case="array"
76 elif case1=="array":
77 case="array"
78 elif case1=="constData":
79 case="constData"
80 elif case1=="taggedData":
81 case="taggedData"
82 elif case1=="expandedData":
83 case="expandedData"
84 elif case1=="Symbol":
85 case="Symbol"
86 else:
87 raise ValueError,"unknown case1=%s"%case1
88 elif case0=="constData":
89 if case1=="float":
90 case="constData"
91 elif case1=="array":
92 case="constData"
93 elif case1=="constData":
94 case="constData"
95 elif case1=="taggedData":
96 case="taggedData"
97 elif case1=="expandedData":
98 case="expandedData"
99 elif case1=="Symbol":
100 case="Symbol"
101 else:
102 raise ValueError,"unknown case1=%s"%case1
103 elif case0=="taggedData":
104 if case1=="float":
105 case="taggedData"
106 elif case1=="array":
107 case="taggedData"
108 elif case1=="constData":
109 case="taggedData"
110 elif case1=="taggedData":
111 case="taggedData"
112 elif case1=="expandedData":
113 case="expandedData"
114 elif case1=="Symbol":
115 case="Symbol"
116 else:
117 raise ValueError,"unknown case1=%s"%case1
118 elif case0=="expandedData":
119 if case1=="float":
120 case="expandedData"
121 elif case1=="array":
122 case="expandedData"
123 elif case1=="constData":
124 case="expandedData"
125 elif case1=="taggedData":
126 case="expandedData"
127 elif case1=="expandedData":
128 case="expandedData"
129 elif case1=="Symbol":
130 case="Symbol"
131 else:
132 raise ValueError,"unknown case1=%s"%case1
133 elif case0=="Symbol":
134 if case1=="float":
135 case="Symbol"
136 elif case1=="array":
137 case="Symbol"
138 elif case1=="constData":
139 case="Symbol"
140 elif case1=="taggedData":
141 case="Symbol"
142 elif case1=="expandedData":
143 case="Symbol"
144 elif case1=="Symbol":
145 case="Symbol"
146 else:
147 raise ValueError,"unknown case1=%s"%case1
148 else:
149 raise ValueError,"unknown case0=%s"%case0
150 return case
151
152
153 def makeArray(shape,rng):
154 l=rng[1]-rng[0]
155 out=numarray.zeros(shape,numarray.Float64)
156 if len(shape)==0:
157 out=l*random.random()+rng[0]
158 elif len(shape)==1:
159 for i0 in range(shape[0]):
160 out[i0]=l*random.random()+rng[0]
161 elif len(shape)==2:
162 for i0 in range(shape[0]):
163 for i1 in range(shape[1]):
164 out[i0,i1]=l*random.random()+rng[0]
165 elif len(shape)==3:
166 for i0 in range(shape[0]):
167 for i1 in range(shape[1]):
168 for i2 in range(shape[2]):
169 out[i0,i1,i2]=l*random.random()+rng[0]
170 elif len(shape)==4:
171 for i0 in range(shape[0]):
172 for i1 in range(shape[1]):
173 for i2 in range(shape[2]):
174 for i3 in range(shape[3]):
175 out[i0,i1,i2,i3]=l*random.random()+rng[0]
176 elif len(shape)==5:
177 for i0 in range(shape[0]):
178 for i1 in range(shape[1]):
179 for i2 in range(shape[2]):
180 for i3 in range(shape[3]):
181 for i4 in range(shape[4]):
182 out[i0,i1,i2,i3,i4]=l*random.random()+rng[0]
183 else:
184 raise SystemError,"rank is restricted to 5"
185 return out
186
187 def makeNumberedArray(shape,s=1.):
188 out=numarray.zeros(shape,numarray.Float64)
189 if len(shape)==0:
190 out=s*1.
191 elif len(shape)==1:
192 for i0 in range(shape[0]):
193 out[i0]=s*i0
194 elif len(shape)==2:
195 for i0 in range(shape[0]):
196 for i1 in range(shape[1]):
197 out[i0,i1]=s*(i1+shape[1]*i0)
198 elif len(shape)==3:
199 for i0 in range(shape[0]):
200 for i1 in range(shape[1]):
201 for i2 in range(shape[2]):
202 out[i0,i1,i2]=s*(i2+shape[2]*i1+shape[2]*shape[1]*i0)
203 elif len(shape)==4:
204 for i0 in range(shape[0]):
205 for i1 in range(shape[1]):
206 for i2 in range(shape[2]):
207 for i3 in range(shape[3]):
208 out[i0,i1,i2,i3]=s*(i3+shape[3]*i2+shape[3]*shape[2]*i1+shape[3]*shape[2]*shape[1]*i0)
209 else:
210 raise SystemError,"rank is restricted to 4"
211 return out
212
213 def makeResult(val,test_expr):
214 if isinstance(val,float):
215 out=eval(test_expr.replace("%a1%","val"))
216 elif len(val.shape)==0:
217 out=eval(test_expr.replace("%a1%","val"))
218 elif len(val.shape)==1:
219 out=numarray.zeros(val.shape,numarray.Float64)
220 for i0 in range(val.shape[0]):
221 out[i0]=eval(test_expr.replace("%a1%","val[i0]"))
222 elif len(val.shape)==2:
223 out=numarray.zeros(val.shape,numarray.Float64)
224 for i0 in range(val.shape[0]):
225 for i1 in range(val.shape[1]):
226 out[i0,i1]=eval(test_expr.replace("%a1%","val[i0,i1]"))
227 elif len(val.shape)==3:
228 out=numarray.zeros(val.shape,numarray.Float64)
229 for i0 in range(val.shape[0]):
230 for i1 in range(val.shape[1]):
231 for i2 in range(val.shape[2]):
232 out[i0,i1,i2]=eval(test_expr.replace("%a1%","val[i0,i1,i2]"))
233 elif len(val.shape)==4:
234 out=numarray.zeros(val.shape,numarray.Float64)
235 for i0 in range(val.shape[0]):
236 for i1 in range(val.shape[1]):
237 for i2 in range(val.shape[2]):
238 for i3 in range(val.shape[3]):
239 out[i0,i1,i2,i3]=eval(test_expr.replace("%a1%","val[i0,i1,i2,i3]"))
240 else:
241 raise SystemError,"rank is restricted to 4"
242 return out
243
244 def makeResult2(val0,val1,test_expr):
245 if isinstance(val0,float):
246 if isinstance(val1,float):
247 out=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1"))
248 elif len(val1.shape)==0:
249 out=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1"))
250 elif len(val1.shape)==1:
251 out=numarray.zeros(val1.shape,numarray.Float64)
252 for i0 in range(val1.shape[0]):
253 out[i0]=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1[i0]"))
254 elif len(val1.shape)==2:
255 out=numarray.zeros(val1.shape,numarray.Float64)
256 for i0 in range(val1.shape[0]):
257 for i1 in range(val1.shape[1]):
258 out[i0,i1]=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1[i0,i1]"))
259 elif len(val1.shape)==3:
260 out=numarray.zeros(val1.shape,numarray.Float64)
261 for i0 in range(val1.shape[0]):
262 for i1 in range(val1.shape[1]):
263 for i2 in range(val1.shape[2]):
264 out[i0,i1,i2]=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1[i0,i1,i2]"))
265 elif len(val1.shape)==4:
266 out=numarray.zeros(val1.shape,numarray.Float64)
267 for i0 in range(val1.shape[0]):
268 for i1 in range(val1.shape[1]):
269 for i2 in range(val1.shape[2]):
270 for i3 in range(val1.shape[3]):
271 out[i0,i1,i2,i3]=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1[i0,i1,i2,i3]"))
272 else:
273 raise SystemError,"rank of val1 is restricted to 4"
274 elif len(val0.shape)==0:
275 if isinstance(val1,float):
276 out=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1"))
277 elif len(val1.shape)==0:
278 out=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1"))
279 elif len(val1.shape)==1:
280 out=numarray.zeros(val1.shape,numarray.Float64)
281 for i0 in range(val1.shape[0]):
282 out[i0]=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1[i0]"))
283 elif len(val1.shape)==2:
284 out=numarray.zeros(val1.shape,numarray.Float64)
285 for i0 in range(val1.shape[0]):
286 for i1 in range(val1.shape[1]):
287 out[i0,i1]=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1[i0,i1]"))
288 elif len(val1.shape)==3:
289 out=numarray.zeros(val1.shape,numarray.Float64)
290 for i0 in range(val1.shape[0]):
291 for i1 in range(val1.shape[1]):
292 for i2 in range(val1.shape[2]):
293 out[i0,i1,i2]=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1[i0,i1,i2]"))
294 elif len(val1.shape)==4:
295 out=numarray.zeros(val1.shape,numarray.Float64)
296 for i0 in range(val1.shape[0]):
297 for i1 in range(val1.shape[1]):
298 for i2 in range(val1.shape[2]):
299 for i3 in range(val1.shape[3]):
300 out[i0,i1,i2,i3]=eval(test_expr.replace("%a1%","val0").replace("%a2%","val1[i0,i1,i2,i3]"))
301 else:
302 raise SystemError,"rank of val1 is restricted to 4"
303 elif len(val0.shape)==1:
304 if isinstance(val1,float):
305 out=numarray.zeros(val0.shape,numarray.Float64)
306 for i0 in range(val0.shape[0]):
307 out[i0]=eval(test_expr.replace("%a1%","val0[i0]").replace("%a2%","val1"))
308 elif len(val1.shape)==0:
309 out=numarray.zeros(val0.shape,numarray.Float64)
310 for i0 in range(val0.shape[0]):
311 out[i0]=eval(test_expr.replace("%a1%","val0[i0]").replace("%a2%","val1"))
312 elif len(val1.shape)==1:
313 out=numarray.zeros(val0.shape,numarray.Float64)
314 for i0 in range(val0.shape[0]):
315 out[i0]=eval(test_expr.replace("%a1%","val0[i0]").replace("%a2%","val1[i0]"))
316 elif len(val1.shape)==2:
317 out=numarray.zeros(val0.shape+val1.shape[1:],numarray.Float64)
318 for i0 in range(val0.shape[0]):
319 for j1 in range(val1.shape[1]):
320 out[i0,j1]=eval(test_expr.replace("%a1%","val0[i0]").replace("%a2%","val1[i0,j1]"))
321 elif len(val1.shape)==3:
322 out=numarray.zeros(val0.shape+val1.shape[1:],numarray.Float64)
323 for i0 in range(val0.shape[0]):
324 for j1 in range(val1.shape[1]):
325 for j2 in range(val1.shape[2]):
326 out[i0,j1,j2]=eval(test_expr.replace("%a1%","val0[i0]").replace("%a2%","val1[i0,j1,j2]"))
327 elif len(val1.shape)==4:
328 out=numarray.zeros(val0.shape+val1.shape[1:],numarray.Float64)
329 for i0 in range(val0.shape[0]):
330 for j1 in range(val1.shape[1]):
331 for j2 in range(val1.shape[2]):
332 for j3 in range(val1.shape[3]):
333 out[i0,j1,j2,j3]=eval(test_expr.replace("%a1%","val0[i0]").replace("%a2%","val1[i0,j1,j2,j3]"))
334 else:
335 raise SystemError,"rank of val1 is restricted to 4"
336 elif len(val0.shape)==2:
337 if isinstance(val1,float):
338 out=numarray.zeros(val0.shape,numarray.Float64)
339 for i0 in range(val0.shape[0]):
340 for i1 in range(val0.shape[1]):
341 out[i0,i1]=eval(test_expr.replace("%a1%","val0[i0,i1]").replace("%a2%","val1"))
342 elif len(val1.shape)==0:
343 out=numarray.zeros(val0.shape,numarray.Float64)
344 for i0 in range(val0.shape[0]):
345 for i1 in range(val0.shape[1]):
346 out[i0,i1]=eval(test_expr.replace("%a1%","val0[i0,i1]").replace("%a2%","val1"))
347 elif len(val1.shape)==1:
348 out=numarray.zeros(val0.shape,numarray.Float64)
349 for i0 in range(val0.shape[0]):
350 for i1 in range(val0.shape[1]):
351 out[i0,i1]=eval(test_expr.replace("%a1%","val0[i0,i1]").replace("%a2%","val1[i0]"))
352 elif len(val1.shape)==2:
353 out=numarray.zeros(val0.shape+val1.shape[2:],numarray.Float64)
354 for i0 in range(val0.shape[0]):
355 for i1 in range(val0.shape[1]):
356 out[i0,i1]=eval(test_expr.replace("%a1%","val0[i0,i1]").replace("%a2%","val1[i0,i1]"))
357 elif len(val1.shape)==3:
358 out=numarray.zeros(val0.shape+val1.shape[2:],numarray.Float64)
359 for i0 in range(val0.shape[0]):
360 for i1 in range(val0.shape[1]):
361 for j2 in range(val1.shape[2]):
362 out[i0,i1,j2]=eval(test_expr.replace("%a1%","val0[i0,i1]").replace("%a2%","val1[i0,i1,j2]"))
363 elif len(val1.shape)==4:
364 out=numarray.zeros(val0.shape+val1.shape[2:],numarray.Float64)
365 for i0 in range(val0.shape[0]):
366 for i1 in range(val0.shape[1]):
367 for j2 in range(val1.shape[2]):
368 for j3 in range(val1.shape[3]):
369 out[i0,i1,j2,j3]=eval(test_expr.replace("%a1%","val0[i0,i1]").replace("%a2%","val1[i0,i1,j2,j3]"))
370 else:
371 raise SystemError,"rank of val1 is restricted to 4"
372 elif len(val0.shape)==3:
373 if isinstance(val1,float):
374 out=numarray.zeros(val0.shape,numarray.Float64)
375 for i0 in range(val0.shape[0]):
376 for i1 in range(val0.shape[1]):
377 for i2 in range(val0.shape[2]):
378 out[i0,i1,i2]=eval(test_expr.replace("%a1%","val0[i0,i1,i2]").replace("%a2%","val1"))
379 elif len(val1.shape)==0:
380 out=numarray.zeros(val0.shape,numarray.Float64)
381 for i0 in range(val0.shape[0]):
382 for i1 in range(val0.shape[1]):
383 for i2 in range(val0.shape[2]):
384 out[i0,i1,i2]=eval(test_expr.replace("%a1%","val0[i0,i1,i2]").replace("%a2%","val1"))
385 elif len(val1.shape)==1:
386 out=numarray.zeros(val0.shape,numarray.Float64)
387 for i0 in range(val0.shape[0]):
388 for i1 in range(val0.shape[1]):
389 for i2 in range(val0.shape[2]):
390 out[i0,i1,i2]=eval(test_expr.replace("%a1%","val0[i0,i1,i2]").replace("%a2%","val1[i0]"))
391 elif len(val1.shape)==2:
392 out=numarray.zeros(val0.shape+val1.shape[2:],numarray.Float64)
393 for i0 in range(val0.shape[0]):
394 for i1 in range(val0.shape[1]):
395 for i2 in range(val0.shape[2]):
396 out[i0,i1,i2]=eval(test_expr.replace("%a1%","val0[i0,i1,i2]").replace("%a2%","val1[i0,i1]"))
397 elif len(val1.shape)==3:
398 out=numarray.zeros(val0.shape,numarray.Float64)
399 for i0 in range(val0.shape[0]):
400 for i1 in range(val0.shape[1]):
401 for i2 in range(val0.shape[2]):
402 out[i0,i1,i2]=eval(test_expr.replace("%a1%","val0[i0,i1,i2]").replace("%a2%","val1[i0,i1,i2]"))
403 elif len(val1.shape)==4:
404 out=numarray.zeros(val0.shape+val1.shape[3:],numarray.Float64)
405 for i0 in range(val0.shape[0]):
406 for i1 in range(val0.shape[1]):
407 for i2 in range(val0.shape[2]):
408 for j3 in range(val1.shape[3]):
409 out[i0,i1,i2,j3]=eval(test_expr.replace("%a1%","val0[i0,i1,i2]").replace("%a2%","val1[i0,i1,i2,j3]"))
410 else:
411 raise SystemError,"rank of val1 is rargs[1]estricted to 4"
412 elif len(val0.shape)==4:
413 if isinstance(val1,float):
414 out=numarray.zeros(val0.shape,numarray.Float64)
415 for i0 in range(val0.shape[0]):
416 for i1 in range(val0.shape[1]):
417 for i2 in range(val0.shape[2]):
418 for i3 in range(val0.shape[3]):
419 out[i0,i1,i2,i3]=eval(test_expr.replace("%a1%","val0[i0,i1,i2,i3]").replace("%a2%","val1"))
420 elif len(val1.shape)==0:
421 out=numarray.zeros(val0.shape,numarray.Float64)
422 for i0 in range(val0.shape[0]):
423 for i1 in range(val0.shape[1]):
424 for i2 in range(val0.shape[2]):
425 for i3 in range(val0.shape[3]):
426 out[i0,i1,i2,i3]=eval(test_expr.replace("%a1%","val0[i0,i1,i2,i3]").replace("%a2%","val1"))
427 elif len(val1.shape)==1:
428 out=numarray.zeros(val0.shape,numarray.Float64)
429 for i0 in range(val0.shape[0]):
430 for i1 in range(val0.shape[1]):
431 for i2 in range(val0.shape[2]):
432 for i3 in range(val0.shape[3]):
433 out[i0,i1,i2,i3]=eval(test_expr.replace("%a1%","val0[i0,i1,i2,i3]").replace("%a2%","val1[i0]"))
434 elif len(val1.shape)==2:
435 out=numarray.zeros(val0.shape+val1.shape[2:],numarray.Float64)
436 for i0 in range(val0.shape[0]):
437 for i1 in range(val0.shape[1]):
438 for i2 in range(val0.shape[2]):
439 for i3 in range(val0.shape[3]):
440 out[i0,i1,i2,i3]=eval(test_expr.replace("%a1%","val0[i0,i1,i2,i3]").replace("%a2%","val1[i0,i1]"))
441 elif len(val1.shape)==3:
442 out=numarray.zeros(val0.shape,numarray.Float64)
443 for i0 in range(val0.shape[0]):
444 for i1 in range(val0.shape[1]):
445 for i2 in range(val0.shape[2]):
446 for i3 in range(val0.shape[3]):
447 out[i0,i1,i2,i3]=eval(test_expr.replace("%a1%","val0[i0,i1,i2,i3]").replace("%a2%","val1[i0,i1,i2]"))
448 elif len(val1.shape)==4:
449 out=numarray.zeros(val0.shape,numarray.Float64)
450 for i0 in range(val0.shape[0]):
451 for i1 in range(val0.shape[1]):
452 for i2 in range(val0.shape[2]):
453 for i3 in range(val0.shape[3]):
454 out[i0,i1,i2,i3]=eval(test_expr.replace("%a1%","val0[i0,i1,i2,i3]").replace("%a2%","val1[i0,i1,i2,i3]"))
455 else:
456 raise SystemError,"rank of val1 is restricted to 4"
457 else:
458 raise SystemError,"rank is restricted to 4"
459 return out
460
461
462 def mkText(case,name,a,a1=None,use_tagging_for_expanded_data=False):
463 t_out=""
464 if case=="float":
465 if isinstance(a,float):
466 t_out+=" %s=%s\n"%(name,a)
467 elif a.rank==0:
468 t_out+=" %s=%s\n"%(name,a)
469 else:
470 t_out+=" %s=numarray.array(%s)\n"%(name,a.tolist())
471 elif case=="array":
472 if isinstance(a,float):
473 t_out+=" %s=numarray.array(%s)\n"%(name,a)
474 elif a.rank==0:
475 t_out+=" %s=numarray.array(%s)\n"%(name,a)
476 else:
477 t_out+=" %s=numarray.array(%s)\n"%(name,a.tolist())
478 elif case=="constData":
479 if isinstance(a,float):
480 t_out+=" %s=Data(%s,self.functionspace)\n"%(name,a)
481 elif a.rank==0:
482 t_out+=" %s=Data(%s,self.functionspace)\n"%(name,a)
483 else:
484 t_out+=" %s=Data(numarray.array(%s),self.functionspace)\n"%(name,a.tolist())
485 elif case=="taggedData":
486 if isinstance(a,float):
487 t_out+=" %s=Data(%s,self.functionspace)\n"%(name,a)
488 t_out+=" %s.setTaggedValue(1,%s)\n"%(name,a1)
489 elif a.rank==0:
490 t_out+=" %s=Data(%s,self.functionspace)\n"%(name,a)
491 t_out+=" %s.setTaggedValue(1,%s)\n"%(name,a1)
492 else:
493 t_out+=" %s=Data(numarray.array(%s),self.functionspace)\n"%(name,a.tolist())
494 t_out+=" %s.setTaggedValue(1,numarray.array(%s))\n"%(name,a1.tolist())
495 elif case=="expandedData":
496 if use_tagging_for_expanded_data:
497 if isinstance(a,float):
498 t_out+=" %s=Data(%s,self.functionspace)\n"%(name,a)
499 t_out+=" %s.setTaggedValue(1,%s)\n"%(name,a1)
500 elif a.rank==0:
501 t_out+=" %s=Data(%s,self.functionspace)\n"%(name,a)
502 t_out+=" %s.setTaggedValue(1,%s)\n"%(name,a1)
503 else:
504 t_out+=" %s=Data(numarray.array(%s),self.functionspace)\n"%(name,a.tolist())
505 t_out+=" %s.setTaggedValue(1,numarray.array(%s))\n"%(name,a1.tolist())
506 t_out+=" %s.expand()\n"%name
507 else:
508 t_out+=" msk_%s=whereNegative(self.functionspace.getX()[0]-0.5)\n"%name
509 if isinstance(a,float):
510 t_out+=" %s=msk_%s*(%s)+(1.-msk_%s)*(%s)\n"%(name,name,a,name,a1)
511 elif a.rank==0:
512 t_out+=" %s=msk_%s*numarray.array(%s)+(1.-msk_%s)*numarray.array(%s)\n"%(name,name,a,name,a1)
513 else:
514 t_out+=" %s=msk_%s*numarray.array(%s)+(1.-msk_%s)*numarray.array(%s)\n"%(name,name,a.tolist(),name,a1.tolist())
515 elif case=="Symbol":
516 if isinstance(a,float):
517 t_out+=" %s=Symbol(shape=())\n"%(name)
518 elif a.rank==0:
519 t_out+=" %s=Symbol(shape=())\n"%(name)
520 else:
521 t_out+=" %s=Symbol(shape=%s)\n"%(name,str(a.shape))
522
523 return t_out
524
525 def mkTypeAndShapeTest(case,sh,argstr):
526 text=""
527 if case=="float":
528 text+=" self.failUnless(isinstance(%s,float),\"wrong type of result.\")\n"%argstr
529 elif case=="array":
530 text+=" self.failUnless(isinstance(%s,numarray.NumArray),\"wrong type of result.\")\n"%argstr
531 text+=" self.failUnlessEqual(%s.shape,%s,\"wrong shape of result.\")\n"%(argstr,str(sh))
532 elif case in ["constData","taggedData","expandedData"]:
533 text+=" self.failUnless(isinstance(%s,Data),\"wrong type of result.\")\n"%argstr
534 text+=" self.failUnlessEqual(%s.getShape(),%s,\"wrong shape of result.\")\n"%(argstr,str(sh))
535 elif case=="Symbol":
536 text+=" self.failUnless(isinstance(%s,Symbol),\"wrong type of result.\")\n"%argstr
537 text+=" self.failUnlessEqual(%s.getShape(),%s,\"wrong shape of result.\")\n"%(argstr,str(sh))
538 return text
539
540 def mkCode(txt,args=[],intend=""):
541 s=txt.split("\n")
542 if len(s)>1:
543 out=""
544 for l in s:
545 out+=intend+l+"\n"
546 else:
547 out="%sreturn %s\n"%(intend,txt)
548 c=1
549 for r in args:
550 out=out.replace("%%a%s%%"%c,r)
551 return out
552 #=======================================================================================================
553 # nonsymmetric part
554 #=======================================================================================================
555 from esys.escript import *
556 for name in ["symmetric", "nonsymmetric"]:
557 f=1.
558 if name=="nonsymmetric": f=-1
559 for case0 in ["array","Symbol","constData","taggedData","expandedData"]:
560 for sh0 in [ (3,3), (2,3,2,3)]:
561 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
562 tname="test_%s_%s_rank%s"%(name,case0,len(sh0))
563 text+=" def %s(self):\n"%tname
564 a_0=makeNumberedArray(sh0,s=1.)
565 r_0=(a_0+f*transpose(a_0))/2.
566 if case0 in ["taggedData", "expandedData"]:
567 a1_0=makeNumberedArray(sh0,s=-1.)
568 r1_0=(a1_0+f*transpose(a1_0))/2.
569 else:
570 a1_0=a_0
571 r1_0=r_0
572 text+=mkText(case0,"arg",a_0,a1_0)
573 text+=" res=%s(arg)\n"%name
574 if case0=="Symbol":
575 text+=mkText("array","s",a_0,a1_0)
576 text+=" sub=res.substitute({arg:s})\n"
577 res="sub"
578 text+=mkText("array","ref",r_0,r1_0)
579 else:
580 res="res"
581 text+=mkText(case0,"ref",r_0,r1_0)
582 text+=mkTypeAndShapeTest(case0,sh0,"res")
583 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
584
585 if case0 == "taggedData" :
586 t_prog_with_tags+=text
587 else:
588 t_prog+=text
589 print test_header
590 print t_prog
591 # print t_prog_with_tags
592 print test_tail
593 1/0
594
595 #=======================================================================================================
596 # eigenvalues
597 #=======================================================================================================
598 import numarray.linear_algebra
599 name="eigenvalues"
600 for case0 in ["array","Symbol","constData","taggedData","expandedData"]:
601 for sh0 in [ (1,1), (2,2), (3,3)]:
602 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
603 tname="test_%s_%s_dim%s"%(name,case0,sh0[0])
604 text+=" def %s(self):\n"%tname
605 a_0=makeArray(sh0,[-1.,1])
606 a_0=(a_0+numarray.transpose(a_0))/2.
607 ev=numarray.linear_algebra.eigenvalues(a_0)
608 ev.sort()
609 if case0 in ["taggedData", "expandedData"]:
610 a1_0=makeArray(sh0,[-1.,1])
611 a1_0=(a1_0+numarray.transpose(a1_0))/2.
612 ev1=numarray.linear_algebra.eigenvalues(a1_0)
613 ev1.sort()
614 else:
615 a1_0=a_0
616 ev1=ev
617 text+=mkText(case0,"arg",a_0,a1_0)
618 text+=" res=%s(arg)\n"%name
619 if case0=="Symbol":
620 text+=mkText("array","s",a_0,a1_0)
621 text+=" sub=res.substitute({arg:s})\n"
622 res="sub"
623 text+=mkText("array","ref",ev,ev1)
624 else:
625 res="res"
626 text+=mkText(case0,"ref",ev,ev1)
627 text+=mkTypeAndShapeTest(case0,(sh0[0],),"res")
628 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
629
630 if case0 == "taggedData" :
631 t_prog_with_tags+=text
632 else:
633 t_prog+=text
634 print test_header
635 # print t_prog
636 print t_prog_with_tags
637 print test_tail
638 1/0
639
640 #=======================================================================================================
641 # slicing
642 #=======================================================================================================
643 for case0 in ["constData","taggedData","expandedData","Symbol"]:
644 for sh0 in [ (3,), (3,4), (3,4,3) ,(4,3,5,3)]:
645 # get perm:
646 if len(sh0)==2:
647 check=[[1,0]]
648 elif len(sh0)==3:
649 check=[[1,0,2],
650 [1,2,0],
651 [2,1,0],
652 [2,0,2],
653 [0,2,1]]
654 elif len(sh0)==4:
655 check=[[0,1,3,2],
656 [0,2,1,3],
657 [0,2,3,1],
658 [0,3,2,1],
659 [0,3,1,2] ,
660 [1,0,2,3],
661 [1,0,3,2],
662 [1,2,0,3],
663 [1,2,3,0],
664 [1,3,2,0],
665 [1,3,0,2],
666 [2,0,1,3],
667 [2,0,3,1],
668 [2,1,0,3],
669 [2,1,3,0],
670 [2,3,1,0],
671 [2,3,0,1],
672 [3,0,1,2],
673 [3,0,2,1],
674 [3,1,0,2],
675 [3,1,2,0],
676 [3,2,1,0],
677 [3,2,0,1]]
678 else:
679 check=[]
680
681 # create the test cases:
682 processed=[]
683 l=["R","U","L","P","C","N"]
684 c=[""]
685 for i in range(len(sh0)):
686 tmp=[]
687 for ci in c:
688 tmp+=[ci+li for li in l]
689 c=tmp
690 # SHUFFLE
691 c2=[]
692 while len(c)>0:
693 i=int(random.random()*len(c))
694 c2.append(c[i])
695 del c[i]
696 c=c2
697 for ci in c:
698 t=""
699 sh=()
700 for i in range(len(ci)):
701 if ci[i]=="R":
702 s="%s:%s"%(1,sh0[i]-1)
703 sh=sh+(sh0[i]-2,)
704 if ci[i]=="U":
705 s=":%s"%(sh0[i]-1)
706 sh=sh+(sh0[i]-1,)
707 if ci[i]=="L":
708 s="2:"
709 sh=sh+(sh0[i]-2,)
710 if ci[i]=="P":
711 s="%s"%(int(sh0[i]/2))
712 if ci[i]=="C":
713 s=":"
714 sh=sh+(sh0[i],)
715 if ci[i]=="N":
716 s=""
717 sh=sh+(sh0[i],)
718 if len(s)>0:
719 if not t=="": t+=","
720 t+=s
721 N_found=False
722 noN_found=False
723 process=len(t)>0
724 for i in ci:
725 if i=="N":
726 if not noN_found and N_found: process=False
727 N_found=True
728 else:
729 if N_found: process=False
730 noNfound=True
731 # is there a similar one processed allready
732 if process and ci.find("N")==-1:
733 for ci2 in processed:
734 for chi in check:
735 is_perm=True
736 for i in range(len(chi)):
737 if not ci[i]==ci2[chi[i]]: is_perm=False
738 if is_perm: process=False
739 # if not process: print ci," rejected"
740 if process:
741 processed.append(ci)
742 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
743 tname="test_getslice_%s_rank%s_%s"%(case0,len(sh0),ci)
744 text+=" def %s(self):\n"%tname
745 a_0=makeNumberedArray(sh0,s=1)
746 if case0 in ["taggedData", "expandedData"]:
747 a1_0=makeNumberedArray(sh0,s=-1.)
748 else:
749 a1_0=a_0
750 r=eval("a_0[%s]"%t)
751 r1=eval("a1_0[%s]"%t)
752 text+=mkText(case0,"arg",a_0,a1_0)
753 text+=" res=arg[%s]\n"%t
754 if case0=="Symbol":
755 text+=mkText("array","s",a_0,a1_0)
756 text+=" sub=res.substitute({arg:s})\n"
757 res="sub"
758 text+=mkText("array","ref",r,r1)
759 else:
760 res="res"
761 text+=mkText(case0,"ref",r,r1)
762 text+=mkTypeAndShapeTest(case0,sh,"res")
763 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
764
765 if case0 == "taggedData" :
766 t_prog_with_tags+=text
767 else:
768 t_prog+=text
769
770 print test_header
771 # print t_prog
772 print t_prog_with_tags
773 print test_tail
774 1/0
775 #============================================================================================
776 def innerTEST(arg0,arg1):
777 if isinstance(arg0,float):
778 out=numarray.array(arg0*arg1)
779 else:
780 out=(arg0*arg1).sum()
781 return out
782
783 def outerTEST(arg0,arg1):
784 if isinstance(arg0,float):
785 out=numarray.array(arg0*arg1)
786 elif isinstance(arg1,float):
787 out=numarray.array(arg0*arg1)
788 else:
789 out=numarray.outerproduct(arg0,arg1).resize(arg0.shape+arg1.shape)
790 return out
791
792 def tensorProductTest(arg0,arg1,sh_s):
793 if isinstance(arg0,float):
794 out=numarray.array(arg0*arg1)
795 elif isinstance(arg1,float):
796 out=numarray.array(arg0*arg1)
797 elif len(sh_s)==0:
798 out=numarray.outerproduct(arg0,arg1).resize(arg0.shape+arg1.shape)
799 else:
800 l=len(sh_s)
801 sh0=arg0.shape[:arg0.rank-l]
802 sh1=arg1.shape[l:]
803 ls,l0,l1=1,1,1
804 for i in sh_s: ls*=i
805 for i in sh0: l0*=i
806 for i in sh1: l1*=i
807 out1=numarray.outerproduct(arg0,arg1).resize((l0,ls,ls,l1))
808 out2=numarray.zeros((l0,l1),numarray.Float)
809 for i0 in range(l0):
810 for i1 in range(l1):
811 for i in range(ls): out2[i0,i1]+=out1[i0,i,i,i1]
812 out=out2.resize(sh0+sh1)
813 return out
814
815 def testMatrixMult(arg0,arg1,sh_s):
816 return numarray.matrixmultiply(arg0,arg1)
817
818
819 def testTensorMult(arg0,arg1,sh_s):
820 if len(arg0)==2:
821 return numarray.matrixmultiply(arg0,arg1)
822 else:
823 if arg1.rank==4:
824 out=numarray.zeros((arg0.shape[0],arg0.shape[1],arg1.shape[2],arg1.shape[3]),numarray.Float)
825 for i0 in range(arg0.shape[0]):
826 for i1 in range(arg0.shape[1]):
827 for i2 in range(arg0.shape[2]):
828 for i3 in range(arg0.shape[3]):
829 for j2 in range(arg1.shape[2]):
830 for j3 in range(arg1.shape[3]):
831 out[i0,i1,j2,j3]+=arg0[i0,i1,i2,i3]*arg1[i2,i3,j2,j3]
832 elif arg1.rank==3:
833 out=numarray.zeros((arg0.shape[0],arg0.shape[1],arg1.shape[2]),numarray.Float)
834 for i0 in range(arg0.shape[0]):
835 for i1 in range(arg0.shape[1]):
836 for i2 in range(arg0.shape[2]):
837 for i3 in range(arg0.shape[3]):
838 for j2 in range(arg1.shape[2]):
839 out[i0,i1,j2]+=arg0[i0,i1,i2,i3]*arg1[i2,i3,j2]
840 elif arg1.rank==2:
841 out=numarray.zeros((arg0.shape[0],arg0.shape[1]),numarray.Float)
842 for i0 in range(arg0.shape[0]):
843 for i1 in range(arg0.shape[1]):
844 for i2 in range(arg0.shape[2]):
845 for i3 in range(arg0.shape[3]):
846 out[i0,i1]+=arg0[i0,i1,i2,i3]*arg1[i2,i3]
847 return out
848
849 def testReduce(arg0,init_val,test_expr,post_expr):
850 out=init_val
851 if isinstance(arg0,float):
852 out=eval(test_expr.replace("%a1%","arg0"))
853 elif arg0.rank==0:
854 out=eval(test_expr.replace("%a1%","arg0"))
855 elif arg0.rank==1:
856 for i0 in range(arg0.shape[0]):
857 out=eval(test_expr.replace("%a1%","arg0[i0]"))
858 elif arg0.rank==2:
859 for i0 in range(arg0.shape[0]):
860 for i1 in range(arg0.shape[1]):
861 out=eval(test_expr.replace("%a1%","arg0[i0,i1]"))
862 elif arg0.rank==3:
863 for i0 in range(arg0.shape[0]):
864 for i1 in range(arg0.shape[1]):
865 for i2 in range(arg0.shape[2]):
866 out=eval(test_expr.replace("%a1%","arg0[i0,i1,i2]"))
867 elif arg0.rank==4:
868 for i0 in range(arg0.shape[0]):
869 for i1 in range(arg0.shape[1]):
870 for i2 in range(arg0.shape[2]):
871 for i3 in range(arg0.shape[3]):
872 out=eval(test_expr.replace("%a1%","arg0[i0,i1,i2,i3]"))
873 return eval(post_expr)
874
875 def clipTEST(arg0,mn,mx):
876 if isinstance(arg0,float):
877 return max(min(arg0,mx),mn)
878 out=numarray.zeros(arg0.shape,numarray.Float64)
879 if arg0.rank==1:
880 for i0 in range(arg0.shape[0]):
881 out[i0]=max(min(arg0[i0],mx),mn)
882 elif arg0.rank==2:
883 for i0 in range(arg0.shape[0]):
884 for i1 in range(arg0.shape[1]):
885 out[i0,i1]=max(min(arg0[i0,i1],mx),mn)
886 elif arg0.rank==3:
887 for i0 in range(arg0.shape[0]):
888 for i1 in range(arg0.shape[1]):
889 for i2 in range(arg0.shape[2]):
890 out[i0,i1,i2]=max(min(arg0[i0,i1,i2],mx),mn)
891 elif arg0.rank==4:
892 for i0 in range(arg0.shape[0]):
893 for i1 in range(arg0.shape[1]):
894 for i2 in range(arg0.shape[2]):
895 for i3 in range(arg0.shape[3]):
896 out[i0,i1,i2,i3]=max(min(arg0[i0,i1,i2,i3],mx),mn)
897 return out
898 def minimumTEST(arg0,arg1):
899 if isinstance(arg0,float):
900 if isinstance(arg1,float):
901 if arg0>arg1:
902 return arg1
903 else:
904 return arg0
905 else:
906 arg0=numarray.ones(arg1.shape)*arg0
907 else:
908 if isinstance(arg1,float):
909 arg1=numarray.ones(arg0.shape)*arg1
910 out=numarray.zeros(arg0.shape,numarray.Float64)
911 if arg0.rank==0:
912 if arg0>arg1:
913 out=arg1
914 else:
915 out=arg0
916 elif arg0.rank==1:
917 for i0 in range(arg0.shape[0]):
918 if arg0[i0]>arg1[i0]:
919 out[i0]=arg1[i0]
920 else:
921 out[i0]=arg0[i0]
922 elif arg0.rank==2:
923 for i0 in range(arg0.shape[0]):
924 for i1 in range(arg0.shape[1]):
925 if arg0[i0,i1]>arg1[i0,i1]:
926 out[i0,i1]=arg1[i0,i1]
927 else:
928 out[i0,i1]=arg0[i0,i1]
929 elif arg0.rank==3:
930 for i0 in range(arg0.shape[0]):
931 for i1 in range(arg0.shape[1]):
932 for i2 in range(arg0.shape[2]):
933 if arg0[i0,i1,i2]>arg1[i0,i1,i2]:
934 out[i0,i1,i2]=arg1[i0,i1,i2]
935 else:
936 out[i0,i1,i2]=arg0[i0,i1,i2]
937 elif arg0.rank==4:
938 for i0 in range(arg0.shape[0]):
939 for i1 in range(arg0.shape[1]):
940 for i2 in range(arg0.shape[2]):
941 for i3 in range(arg0.shape[3]):
942 if arg0[i0,i1,i2,i3]>arg1[i0,i1,i2,i3]:
943 out[i0,i1,i2,i3]=arg1[i0,i1,i2,i3]
944 else:
945 out[i0,i1,i2,i3]=arg0[i0,i1,i2,i3]
946 return out
947
948 def unrollLoops(a,b,o,arg,tap="",x="x"):
949 out=""
950 if a.rank==1:
951 z=""
952 for i99 in range(a.shape[0]):
953 if not z=="": z+="+"
954 if o=="1":
955 z+="(%s)*%s[%s]"%(a[i99]+b[i99],x,i99)
956 else:
957 z+="(%s)*%s[%s]**o+(%s)*%s[%s]"%(a[i99],x,i99,b[i99],x,i99)
958
959 out+=tap+"%s=%s\n"%(arg,z)
960
961 elif a.rank==2:
962 for i0 in range(a.shape[0]):
963 z=""
964 for i99 in range(a.shape[1]):
965 if not z=="": z+="+"
966 if o=="1":
967 z+="(%s)*x[%s]"%(a[i0,i99]+b[i0,i99],i99)
968 else:
969 z+="(%s)*%s[%s]**o+(%s)*%s[%s]"%(a[i0,i99],x,i99,b[i0,i99],x,i99)
970
971 out+=tap+"%s[%s]=%s\n"%(arg,i0,z)
972 elif a.rank==3:
973 for i0 in range(a.shape[0]):
974 for i1 in range(a.shape[1]):
975 z=""
976 for i99 in range(a.shape[2]):
977 if not z=="": z+="+"
978 if o=="1":
979 z+="(%s)*%s[%s]"%(a[i0,i1,i99]+b[i0,i1,i99],x,i99)
980 else:
981 z+="(%s)*%s[%s]**o+(%s)*%s[%s]"%(a[i0,i1,i99],x,i99,b[i0,i1,i99],x,i99)
982
983 out+=tap+"%s[%s,%s]=%s\n"%(arg,i0,i1,z)
984 elif a.rank==4:
985 for i0 in range(a.shape[0]):
986 for i1 in range(a.shape[1]):
987 for i2 in range(a.shape[2]):
988 z=""
989 for i99 in range(a.shape[3]):
990 if not z=="": z+="+"
991 if o=="1":
992 z+="(%s)*%s[%s]"%(a[i0,i1,i2,i99]+b[i0,i1,i2,i99],x,i99)
993 else:
994 z+="(%s)*%s[%s]**o+(%s)*%s[%s]"%(a[i0,i1,i2,i99],x,i99,b[i0,i1,i2,i99],x,i99)
995
996 out+=tap+"%s[%s,%s,%s]=%s\n"%(arg,i0,i1,i2,z)
997 elif a.rank==5:
998 for i0 in range(a.shape[0]):
999 for i1 in range(a.shape[1]):
1000 for i2 in range(a.shape[2]):
1001 for i3 in range(a.shape[3]):
1002 z=""
1003 for i99 in range(a.shape[4]):
1004 if not z=="": z+="+"
1005 if o=="1":
1006 z+="(%s)*%s[%s]"%(a[i0,i1,i2,i3,i99]+b[i0,i1,i2,i3,i99],x,i99)
1007 else:
1008 z+="(%s)*%s[%s]**o+(%s)*%s[%s]"%(a[i0,i1,i2,i3,i99],x,i99,b[i0,i1,i2,i3,i99],x,i99)
1009
1010 out+=tap+"%s[%s,%s,%s,%s]=%s\n"%(arg,i0,i1,i2,i3,z)
1011 return out
1012
1013 def unrollLoopsOfGrad(a,b,o,arg,tap=""):
1014 out=""
1015 if a.rank==1:
1016 for i99 in range(a.shape[0]):
1017 if o=="1":
1018 out+=tap+"%s[%s]=(%s)\n"%(arg,i99,a[i99]+b[i99])
1019 else:
1020 out+=tap+"%s[%s]=o*(%s)*x_ref[%s]**(o-1)+(%s)\n"%(arg,i99,a[i99],i99,b[i99])
1021
1022 elif a.rank==2:
1023 for i0 in range(a.shape[0]):
1024 for i99 in range(a.shape[1]):
1025 if o=="1":
1026 out+=tap+"%s[%s,%s]=(%s)\n"%(arg,i0,i99,a[i0,i99]+b[i0,i99])
1027 else:
1028 out+=tap+"%s[%s,%s]=o*(%s)*x_ref[%s]**(o-1)+(%s)\n"%(arg,i0,i99,a[i0,i99],i99,b[i0,i99])
1029
1030 elif a.rank==3:
1031 for i0 in range(a.shape[0]):
1032 for i1 in range(a.shape[1]):
1033 for i99 in range(a.shape[2]):
1034 if o=="1":
1035 out+=tap+"%s[%s,%s,%s]=(%s)\n"%(arg,i0,i1,i99,a[i0,i1,i99]+b[i0,i1,i99])
1036 else:
1037 out+=tap+"%s[%s,%s,%s]=o*(%s)*x_ref[%s]**(o-1)+(%s)\n"%(arg,i0,i1,i99,a[i0,i1,i99],i99,b[i0,i1,i99])
1038
1039 elif a.rank==4:
1040 for i0 in range(a.shape[0]):
1041 for i1 in range(a.shape[1]):
1042 for i2 in range(a.shape[2]):
1043 for i99 in range(a.shape[3]):
1044 if o=="1":
1045 out+=tap+"%s[%s,%s,%s,%s]=(%s)\n"%(arg,i0,i1,i2,i99,a[i0,i1,i2,i99]+b[i0,i1,i2,i99])
1046 else:
1047 out+=tap+"%s[%s,%s,%s,%s]=o*(%s)*x_ref[%s]**(o-1)+(%s)\n"%(arg,i0,i1,i2,i99,a[i0,i1,i2,i99],i99,b[i0,i1,i2,i99])
1048 return out
1049 def unrollLoopsOfDiv(a,b,o,arg,tap=""):
1050 out=tap+arg+"="
1051 if o=="1":
1052 z=0.
1053 for i99 in range(a.shape[0]):
1054 z+=b[i99,i99]+a[i99,i99]
1055 out+="(%s)"%z
1056 else:
1057 z=0.
1058 for i99 in range(a.shape[0]):
1059 z+=b[i99,i99]
1060 if i99>0: out+="+"
1061 out+="o*(%s)*x_ref[%s]**(o-1)"%(a[i99,i99],i99)
1062 out+="+(%s)"%z
1063 return out
1064
1065 def unrollLoopsOfInteriorIntegral(a,b,where,arg,tap=""):
1066 if where=="Function":
1067 xfac_o=1.
1068 xfac_op=0.
1069 z_fac=1./2.
1070 z_fac_s=""
1071 zo_fac_s="/(o+1.)"
1072 elif where=="FunctionOnBoundary":
1073 xfac_o=1.
1074 xfac_op=0.
1075 z_fac=1.
1076 z_fac_s="*dim"
1077 zo_fac_s="*(1+2.*(dim-1.)/(o+1.))"
1078 elif where in ["FunctionOnContactZero","FunctionOnContactOne"]:
1079 xfac_o=0.
1080 xfac_op=1.
1081 z_fac=1./2.
1082 z_fac_s=""
1083 zo_fac_s="/(o+1.)"
1084 out=""
1085 if a.rank==1:
1086 zo=0.
1087 zop=0.
1088 z=0.
1089 for i99 in range(a.shape[0]):
1090 if i99==0:
1091 zo+= xfac_o*a[i99]
1092 zop+= xfac_op*a[i99]
1093 else:
1094 zo+=a[i99]
1095 z+=b[i99]
1096
1097 out+=tap+"%s=(%s)%s+(%s)%s"%(arg,zo,zo_fac_s,z*z_fac,z_fac_s)
1098 if zop==0.:
1099 out+="\n"
1100 else:
1101 out+="+(%s)*0.5**o\n"%zop
1102 elif a.rank==2:
1103 for i0 in range(a.shape[0]):
1104 zo=0.
1105 zop=0.
1106 z=0.
1107 for i99 in range(a.shape[1]):
1108 if i99==0:
1109 zo+= xfac_o*a[i0,i99]
1110 zop+= xfac_op*a[i0,i99]
1111 else:
1112 zo+=a[i0,i99]
1113 z+=b[i0,i99]
1114
1115 out+=tap+"%s[%s]=(%s)%s+(%s)%s"%(arg,i0,zo,zo_fac_s,z*z_fac,z_fac_s)
1116 if zop==0.:
1117 out+="\n"
1118 else:
1119 out+="+(%s)*0.5**o\n"%zop
1120 elif a.rank==3:
1121 for i0 in range(a.shape[0]):
1122 for i1 in range(a.shape[1]):
1123 zo=0.
1124 zop=0.
1125 z=0.
1126 for i99 in range(a.shape[2]):
1127 if i99==0:
1128 zo+= xfac_o*a[i0,i1,i99]
1129 zop+= xfac_op*a[i0,i1,i99]
1130 else:
1131 zo+=a[i0,i1,i99]
1132 z+=b[i0,i1,i99]
1133
1134 out+=tap+"%s[%s,%s]=(%s)%s+(%s)%s"%(arg,i0,i1,zo,zo_fac_s,z*z_fac,z_fac_s)
1135 if zop==0.:
1136 out+="\n"
1137 else:
1138 out+="+(%s)*0.5**o\n"%zop
1139 elif a.rank==4:
1140 for i0 in range(a.shape[0]):
1141 for i1 in range(a.shape[1]):
1142 for i2 in range(a.shape[2]):
1143 zo=0.
1144 zop=0.
1145 z=0.
1146 for i99 in range(a.shape[3]):
1147 if i99==0:
1148 zo+= xfac_o*a[i0,i1,i2,i99]
1149 zop+= xfac_op*a[i0,i1,i2,i99]
1150
1151 else:
1152 zo+=a[i0,i1,i2,i99]
1153 z+=b[i0,i1,i2,i99]
1154
1155 out+=tap+"%s[%s,%s,%s]=(%s)%s+(%s)%s"%(arg,i0,i1,i2,zo,zo_fac_s,z*z_fac,z_fac_s)
1156 if zop==0.:
1157 out+="\n"
1158 else:
1159 out+="+(%s)*0.5**o\n"%zop
1160
1161 elif a.rank==5:
1162 for i0 in range(a.shape[0]):
1163 for i1 in range(a.shape[1]):
1164 for i2 in range(a.shape[2]):
1165 for i3 in range(a.shape[3]):
1166 zo=0.
1167 zop=0.
1168 z=0.
1169 for i99 in range(a.shape[4]):
1170 if i99==0:
1171 zo+= xfac_o*a[i0,i1,i2,i3,i99]
1172 zop+= xfac_op*a[i0,i1,i2,i3,i99]
1173
1174 else:
1175 zo+=a[i0,i1,i2,i3,i99]
1176 z+=b[i0,i1,i2,i3,i99]
1177 out+=tap+"%s[%s,%s,%s,%s]=(%s)%s+(%s)%s"%(arg,i0,i1,i2,i3,zo,zo_fac_s,z*z_fac,z_fac_s)
1178 if zop==0.:
1179 out+="\n"
1180 else:
1181 out+="+(%s)*0.5**o\n"%zop
1182
1183 return out
1184 def unrollLoopsSimplified(b,arg,tap=""):
1185 out=""
1186 if isinstance(b,float) or b.rank==0:
1187 out+=tap+"%s=(%s)*x[0]\n"%(arg,str(b))
1188
1189 elif b.rank==1:
1190 for i0 in range(b.shape[0]):
1191 out+=tap+"%s[%s]=(%s)*x[%s]\n"%(arg,i0,b[i0],i0)
1192 elif b.rank==2:
1193 for i0 in range(b.shape[0]):
1194 for i1 in range(b.shape[1]):
1195 out+=tap+"%s[%s,%s]=(%s)*x[%s]\n"%(arg,i0,i1,b[i0,i1],i1)
1196 elif b.rank==3:
1197 for i0 in range(b.shape[0]):
1198 for i1 in range(b.shape[1]):
1199 for i2 in range(b.shape[2]):
1200 out+=tap+"%s[%s,%s,%s]=(%s)*x[%s]\n"%(arg,i0,i1,i2,b[i0,i1,i2],i2)
1201 elif b.rank==4:
1202 for i0 in range(b.shape[0]):
1203 for i1 in range(b.shape[1]):
1204 for i2 in range(b.shape[2]):
1205 for i3 in range(b.shape[3]):
1206 out+=tap+"%s[%s,%s,%s,%s]=(%s)*x[%s]\n"%(arg,i0,i1,i2,i3,b[i0,i1,i2,i3],i3)
1207 return out
1208
1209 def unrollLoopsOfL2(b,where,arg,tap=""):
1210 out=""
1211 z=[]
1212 if isinstance(b,float) or b.rank==0:
1213 z.append(b**2)
1214 elif b.rank==1:
1215 for i0 in range(b.shape[0]):
1216 z.append(b[i0]**2)
1217 elif b.rank==2:
1218 for i1 in range(b.shape[1]):
1219 s=0
1220 for i0 in range(b.shape[0]):
1221 s+=b[i0,i1]**2
1222 z.append(s)
1223 elif b.rank==3:
1224 for i2 in range(b.shape[2]):
1225 s=0
1226 for i0 in range(b.shape[0]):
1227 for i1 in range(b.shape[1]):
1228 s+=b[i0,i1,i2]**2
1229 z.append(s)
1230
1231 elif b.rank==4:
1232 for i3 in range(b.shape[3]):
1233 s=0
1234 for i0 in range(b.shape[0]):
1235 for i1 in range(b.shape[1]):
1236 for i2 in range(b.shape[2]):
1237 s+=b[i0,i1,i2,i3]**2
1238 z.append(s)
1239 if where=="Function":
1240 xfac_o=1.
1241 xfac_op=0.
1242 z_fac_s=""
1243 zo_fac_s=""
1244 zo_fac=1./3.
1245 elif where=="FunctionOnBoundary":
1246 xfac_o=1.
1247 xfac_op=0.
1248 z_fac_s="*dim"
1249 zo_fac_s="*(2.*dim+1.)/3."
1250 zo_fac=1.
1251 elif where in ["FunctionOnContactZero","FunctionOnContactOne"]:
1252 xfac_o=0.
1253 xfac_op=1.
1254 z_fac_s=""
1255 zo_fac_s=""
1256 zo_fac=1./3.
1257 zo=0.
1258 zop=0.
1259 for i99 in range(len(z)):
1260 if i99==0:
1261 zo+=xfac_o*z[i99]
1262 zop+=xfac_op*z[i99]
1263 else:
1264 zo+=z[i99]
1265 out+=tap+"%s=sqrt((%s)%s"%(arg,zo*zo_fac,zo_fac_s)
1266 if zop==0.:
1267 out+=")\n"
1268 else:
1269 out+="+(%s))\n"%(zop*0.5**2)
1270 return out
1271 #=======================================================================================================
1272 # transpose
1273 #=======================================================================================================
1274 def transposeTest(r,offset):
1275 if isinstance(r,float): return r
1276 s=r.shape
1277 s1=1
1278 for i in s[:offset]: s1*=i
1279 s2=1
1280 for i in s[offset:]: s2*=i
1281 out=numarray.reshape(r,(s1,s2))
1282 out.transpose()
1283 return numarray.resize(out,s[offset:]+s[:offset])
1284
1285 name,tt="transpose",transposeTest
1286 for case0 in ["array","Symbol","constData","taggedData","expandedData"]:
1287 for sh0 in [ (), (3,), (4,5), (6,2,2),(3,2,3,4)]:
1288 for offset in range(len(sh0)+1):
1289 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1290 tname="test_%s_%s_rank%s_offset%s"%(name,case0,len(sh0),offset)
1291 text+=" def %s(self):\n"%tname
1292 sh_t=sh0[offset:]+sh0[:offset]
1293
1294 # sh_t=list(sh0)
1295 # sh_t[offset+1]=sh_t[offset]
1296 # sh_t=tuple(sh_t)
1297 # sh_r=[]
1298 # for i in range(offset): sh_r.append(sh0[i])
1299 # for i in range(offset+2,len(sh0)): sh_r.append(sh0[i])
1300 # sh_r=tuple(sh_r)
1301
1302 a_0=makeArray(sh0,[-1.,1])
1303 if case0 in ["taggedData", "expandedData"]:
1304 a1_0=makeArray(sh0,[-1.,1])
1305 else:
1306 a1_0=a_0
1307 r=tt(a_0,offset)
1308 r1=tt(a1_0,offset)
1309 text+=mkText(case0,"arg",a_0,a1_0)
1310 text+=" res=%s(arg,%s)\n"%(name,offset)
1311 if case0=="Symbol":
1312 text+=mkText("array","s",a_0,a1_0)
1313 text+=" sub=res.substitute({arg:s})\n"
1314 res="sub"
1315 text+=mkText("array","ref",r,r1)
1316 else:
1317 res="res"
1318 text+=mkText(case0,"ref",r,r1)
1319 text+=mkTypeAndShapeTest(case0,sh_t,"res")
1320 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
1321
1322 if case0 == "taggedData" :
1323 t_prog_with_tags+=text
1324 else:
1325 t_prog+=text
1326
1327 print test_header
1328 # print t_prog
1329 print t_prog_with_tags
1330 print test_tail
1331 1/0
1332 #=======================================================================================================
1333 # L2
1334 #=======================================================================================================
1335 for where in ["Function","FunctionOnBoundary","FunctionOnContactZero","FunctionOnContactOne"]:
1336 for data in ["Data","Symbol"]:
1337 for sh in [ (),(2,), (4,5), (6,2,2),(4,5,3,2)]:
1338 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1339 tname="test_L2_on%s_from%s_rank%s"%(where,data,len(sh))
1340 text+=" def %s(self):\n"%tname
1341 text+=" \"\"\"\n"
1342 text+=" tests L2-norm of %s on the %s\n\n"%(data,where)
1343 text+=" assumptions: self.domain supports integration on %s\n"%where
1344 text+=" \"\"\"\n"
1345 text+=" dim=self.domain.getDim()\n"
1346 text+=" w=%s(self.domain)\n"%where
1347 text+=" x=w.getX()\n"
1348 o="1"
1349 if len(sh)>0:
1350 sh_2=sh[:len(sh)-1]+(2,)
1351 sh_3=sh[:len(sh)-1]+(3,)
1352 b_2=makeArray(sh[:len(sh)-1]+(2,),[-1.,1])
1353 b_3=makeArray(sh[:len(sh)-1]+(3,),[-1.,1])
1354 else:
1355 sh_2=()
1356 sh_3=()
1357 b_2=makeArray(sh,[-1.,1])
1358 b_3=makeArray(sh,[-1.,1])
1359
1360 if data=="Symbol":
1361 val="s"
1362 res="sub"
1363 else:
1364 val="arg"
1365 res="res"
1366 text+=" if dim==2:\n"
1367 if data=="Symbol":
1368 text+=" arg=Symbol(shape=%s,dim=dim)\n"%str(sh_2)
1369
1370 text+=" %s=Data(0,%s,w)\n"%(val,sh_2)
1371 text+=unrollLoopsSimplified(b_2,val,tap=" ")
1372 text+=unrollLoopsOfL2(b_2,where,"ref",tap=" ")
1373 text+="\n else:\n"
1374 if data=="Symbol":
1375 text+=" arg=Symbol(shape=%s,dim=dim)\n"%str(sh_3)
1376 text+=" %s=Data(0,%s,w)\n"%(val,sh_3)
1377 text+=unrollLoopsSimplified(b_3,val,tap=" ")
1378 text+=unrollLoopsOfL2(b_3,where,"ref",tap=" ")
1379 text+="\n res=L2(arg)\n"
1380 if data=="Symbol":
1381 text+=" sub=res.substitute({arg:s})\n"
1382 text+=" self.failUnless(isinstance(res,Symbol),\"wrong type of result.\")\n"
1383 text+=" self.failUnlessEqual(res.getShape(),(),\"wrong shape of result.\")\n"
1384 else:
1385 text+=" self.failUnless(isinstance(res,float),\"wrong type of result.\")\n"
1386 text+=" self.failUnlessAlmostEqual(%s,ref,int(-log10(self.RES_TOL)),\"wrong result\")\n"%res
1387 t_prog+=text
1388 print t_prog
1389 1/0
1390
1391 #=======================================================================================================
1392 # div
1393 #=======================================================================================================
1394 for where in ["Function","FunctionOnBoundary","FunctionOnContactZero","FunctionOnContactOne"]:
1395 for data in ["Data","Symbol"]:
1396 for case in ["ContinuousFunction","Solution","ReducedSolution"]:
1397 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1398 tname="test_div_on%s_from%s_%s"%(where,data,case)
1399 text+=" def %s(self):\n"%tname
1400 text+=" \"\"\"\n"
1401 text+=" tests divergence of %s on the %s\n\n"%(data,where)
1402 text+=" assumptions: %s(self.domain) exists\n"%case
1403 text+=" self.domain supports div on %s\n"%where
1404 text+=" \"\"\"\n"
1405 if case=="ReducedSolution":
1406 text+=" o=1\n"
1407 o="1"
1408 else:
1409 text+=" o=self.order\n"
1410 o="o"
1411 text+=" dim=self.domain.getDim()\n"
1412 text+=" w_ref=%s(self.domain)\n"%where
1413 text+=" x_ref=w_ref.getX()\n"
1414 text+=" w=%s(self.domain)\n"%case
1415 text+=" x=w.getX()\n"
1416 a_2=makeArray((2,2),[-1.,1])
1417 b_2=makeArray((2,2),[-1.,1])
1418 a_3=makeArray((3,3),[-1.,1])
1419 b_3=makeArray((3,3),[-1.,1])
1420 if data=="Symbol":
1421 text+=" arg=Symbol(shape=(dim,),dim=dim)\n"
1422 val="s"
1423 res="sub"
1424 else:
1425 val="arg"
1426 res="res"
1427 text+=" %s=Vector(0,w)\n"%val
1428 text+=" if dim==2:\n"
1429 text+=unrollLoops(a_2,b_2,o,val,tap=" ")
1430 text+=unrollLoopsOfDiv(a_2,b_2,o,"ref",tap=" ")
1431 text+="\n else:\n"
1432
1433 text+=unrollLoops(a_3,b_3,o,val,tap=" ")
1434 text+=unrollLoopsOfDiv(a_3,b_3,o,"ref",tap=" ")
1435 text+="\n res=div(arg,where=w_ref)\n"
1436 if data=="Symbol":
1437 text+=" sub=res.substitute({arg:s})\n"
1438 text+=" self.failUnless(isinstance(res,%s),\"wrong type of result.\")\n"%data
1439 text+=" self.failUnlessEqual(res.getShape(),(),\"wrong shape of result.\")\n"
1440 text+=" self.failUnlessEqual(%s.getFunctionSpace(),w_ref,\"wrong function space of result.\")\n"%res
1441 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
1442
1443
1444 t_prog+=text
1445 print t_prog
1446 1/0
1447
1448 #=======================================================================================================
1449 # interpolation
1450 #=======================================================================================================
1451 for where in ["Function","FunctionOnBoundary","FunctionOnContactZero","FunctionOnContactOne","Solution","ReducedSolution"]:
1452 for data in ["Data","Symbol"]:
1453 for case in ["ContinuousFunction","Solution","ReducedSolution","Function","FunctionOnBoundary","FunctionOnContactZero","FunctionOnContactOne"]:
1454 for sh in [ (),(2,), (4,5), (6,2,2),(4,5,3,2)]:
1455 if where==case or \
1456 ( case in ["ContinuousFunction","Solution","ReducedSolution"] and where in ["Function","FunctionOnBoundary","FunctionOnContactZero","FunctionOnContactOne"] ) or \
1457 ( case in ["FunctionOnContactZero","FunctionOnContactOne"] and where in ["FunctionOnContactZero","FunctionOnContactOne"] ) or \
1458 (case=="ContinuousFunction" and where in ["Solution","ReducedSolution"]) or \
1459 (case=="Solution" and where=="ReducedSolution") :
1460
1461
1462 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1463 tname="test_interpolation_on%s_from%s_%s_rank%s"%(where,data,case,len(sh))
1464 text+=" def %s(self):\n"%tname
1465 text+=" \"\"\"\n"
1466 text+=" tests interpolation for rank %s %s onto the %s\n\n"%(len(sh),data,where)
1467 text+=" assumptions: self.domain supports inpterpolation from %s onto %s\n"%(case,where)
1468 text+=" \"\"\"\n"
1469 if case=="ReducedSolution" or where=="ReducedSolution":
1470 text+=" o=1\n"
1471 o="1"
1472 else:
1473 text+=" o=self.order\n"
1474 o="o"
1475 text+=" dim=self.domain.getDim()\n"
1476 text+=" w_ref=%s(self.domain)\n"%where
1477 text+=" x_ref=w_ref.getX()\n"
1478 text+=" w=%s(self.domain)\n"%case
1479 text+=" x=w.getX()\n"
1480 a_2=makeArray(sh+(2,),[-1.,1])
1481 b_2=makeArray(sh+(2,),[-1.,1])
1482 a_3=makeArray(sh+(3,),[-1.,1])
1483 b_3=makeArray(sh+(3,),[-1.,1])
1484 if data=="Symbol":
1485 text+=" arg=Symbol(shape=%s,dim=dim)\n"%str(sh)
1486 val="s"
1487 res="sub"
1488 else:
1489 val="arg"
1490 res="res"
1491 text+=" %s=Data(0,%s,w)\n"%(val,str(sh))
1492 text+=" ref=Data(0,%s,w_ref)\n"%str(sh)
1493 text+=" if dim==2:\n"
1494 text+=unrollLoops(a_2,b_2,o,val,tap=" ")
1495 text+=unrollLoops(a_2,b_2,o,"ref",tap=" ",x="x_ref")
1496 text+=" else:\n"
1497
1498 text+=unrollLoops(a_3,b_3,o,val,tap=" ")
1499 text+=unrollLoops(a_3,b_3,o,"ref",tap=" ",x="x_ref")
1500 text+=" res=interpolate(arg,where=w_ref)\n"
1501 if data=="Symbol":
1502 text+=" sub=res.substitute({arg:s})\n"
1503 text+=" self.failUnless(isinstance(res,%s),\"wrong type of result.\")\n"%data
1504 text+=" self.failUnlessEqual(%s.getFunctionSpace(),w_ref,\"wrong functionspace of result.\")\n"%res
1505 text+=" self.failUnlessEqual(res.getShape(),%s,\"wrong shape of result.\")\n"%str(sh)
1506 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
1507 t_prog+=text
1508 print test_header
1509 print t_prog
1510 print test_tail
1511 1/0
1512
1513 #=======================================================================================================
1514 # grad
1515 #=======================================================================================================
1516 for where in ["Function","FunctionOnBoundary","FunctionOnContactZero","FunctionOnContactOne"]:
1517 for data in ["Data","Symbol"]:
1518 for case in ["ContinuousFunction","Solution","ReducedSolution"]:
1519 for sh in [ (),(2,), (4,5), (6,2,2)]:
1520 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1521 tname="test_grad_on%s_from%s_%s_rank%s"%(where,data,case,len(sh))
1522 text+=" def %s(self):\n"%tname
1523 text+=" \"\"\"\n"
1524 text+=" tests gradient for rank %s %s on the %s\n\n"%(len(sh),data,where)
1525 text+=" assumptions: %s(self.domain) exists\n"%case
1526 text+=" self.domain supports gardient on %s\n"%where
1527 text+=" \"\"\"\n"
1528 if case=="ReducedSolution":
1529 text+=" o=1\n"
1530 o="1"
1531 else:
1532 text+=" o=self.order\n"
1533 o="o"
1534 text+=" dim=self.domain.getDim()\n"
1535 text+=" w_ref=%s(self.domain)\n"%where
1536 text+=" x_ref=w_ref.getX()\n"
1537 text+=" w=%s(self.domain)\n"%case
1538 text+=" x=w.getX()\n"
1539 a_2=makeArray(sh+(2,),[-1.,1])
1540 b_2=makeArray(sh+(2,),[-1.,1])
1541 a_3=makeArray(sh+(3,),[-1.,1])
1542 b_3=makeArray(sh+(3,),[-1.,1])
1543 if data=="Symbol":
1544 text+=" arg=Symbol(shape=%s,dim=dim)\n"%str(sh)
1545 val="s"
1546 res="sub"
1547 else:
1548 val="arg"
1549 res="res"
1550 text+=" %s=Data(0,%s,w)\n"%(val,str(sh))
1551 text+=" ref=Data(0,%s+(dim,),w_ref)\n"%str(sh)
1552 text+=" if dim==2:\n"
1553 text+=unrollLoops(a_2,b_2,o,val,tap=" ")
1554 text+=unrollLoopsOfGrad(a_2,b_2,o,"ref",tap=" ")
1555 text+=" else:\n"
1556
1557 text+=unrollLoops(a_3,b_3,o,val,tap=" ")
1558 text+=unrollLoopsOfGrad(a_3,b_3,o,"ref",tap=" ")
1559 text+=" res=grad(arg,where=w_ref)\n"
1560 if data=="Symbol":
1561 text+=" sub=res.substitute({arg:s})\n"
1562 text+=" self.failUnless(isinstance(res,%s),\"wrong type of result.\")\n"%data
1563 text+=" self.failUnlessEqual(res.getShape(),%s+(dim,),\"wrong shape of result.\")\n"%str(sh)
1564 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
1565
1566
1567 t_prog+=text
1568 print test_header
1569 print t_prog
1570 print test_tail
1571 1/0
1572
1573
1574 #=======================================================================================================
1575 # integrate
1576 #=======================================================================================================
1577 for where in ["Function","FunctionOnBoundary","FunctionOnContactZero","FunctionOnContactOne"]:
1578 for data in ["Data","Symbol"]:
1579 for case in ["ContinuousFunction","Solution","ReducedSolution","Function","FunctionOnBoundary","FunctionOnContactZero","FunctionOnContactOne"]:
1580 for sh in [ (),(2,), (4,5), (6,2,2),(4,5,3,2)]:
1581 if (not case in ["Function","FunctionOnBoundary","FunctionOnContactZero","FunctionOnContactOne"]) or where==case:
1582 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1583 tname="test_integrate_on%s_from%s_%s_rank%s"%(where,data,case,len(sh))
1584 text+=" def %s(self):\n"%tname
1585 text+=" \"\"\"\n"
1586 text+=" tests integral of rank %s %s on the %s\n\n"%(len(sh),data,where)
1587 text+=" assumptions: %s(self.domain) exists\n"%case
1588 text+=" self.domain supports integral on %s\n"%where
1589
1590 text+=" \"\"\"\n"
1591 if case=="ReducedSolution":
1592 text+=" o=1\n"
1593 o="1"
1594 else:
1595 text+=" o=self.order\n"
1596 o="o"
1597 text+=" dim=self.domain.getDim()\n"
1598 text+=" w_ref=%s(self.domain)\n"%where
1599 text+=" w=%s(self.domain)\n"%case
1600 text+=" x=w.getX()\n"
1601 a_2=makeArray(sh+(2,),[-1.,1])
1602 b_2=makeArray(sh+(2,),[-1.,1])
1603 a_3=makeArray(sh+(3,),[-1.,1])
1604 b_3=makeArray(sh+(3,),[-1.,1])
1605 if data=="Symbol":
1606 text+=" arg=Symbol(shape=%s)\n"%str(sh)
1607 val="s"
1608 res="sub"
1609 else:
1610 val="arg"
1611 res="res"
1612
1613 text+=" %s=Data(0,%s,w)\n"%(val,str(sh))
1614 if not len(sh)==0:
1615 text+=" ref=numarray.zeros(%s,numarray.Float)\n"%str(sh)
1616 text+=" if dim==2:\n"
1617 text+=unrollLoops(a_2,b_2,o,val,tap=" ")
1618 text+=unrollLoopsOfInteriorIntegral(a_2,b_2,where,"ref",tap=" ")
1619 text+=" else:\n"
1620
1621 text+=unrollLoops(a_3,b_3,o,val,tap=" ")
1622 text+=unrollLoopsOfInteriorIntegral(a_3,b_3,where,"ref",tap=" ")
1623 if case in ["ContinuousFunction","Solution","ReducedSolution"]:
1624 text+=" res=integrate(arg,where=w_ref)\n"
1625 else:
1626 text+=" res=integrate(arg)\n"
1627
1628 if data=="Symbol":
1629 text+=" sub=res.substitute({arg:s})\n"
1630 if len(sh)==0 and data=="Data":
1631 text+=" self.failUnless(isinstance(%s,float),\"wrong type of result.\")\n"%res
1632 else:
1633 if data=="Symbol":
1634 text+=" self.failUnless(isinstance(res,Symbol),\"wrong type of result.\")\n"
1635 text+=" self.failUnlessEqual(res.getShape(),%s,\"wrong shape of result.\")\n"%str(sh)
1636 else:
1637 text+=" self.failUnless(isinstance(res,numarray.NumArray),\"wrong type of result.\")\n"
1638 text+=" self.failUnlessEqual(res.shape,%s,\"wrong shape of result.\")\n"%str(sh)
1639 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
1640
1641
1642 t_prog+=text
1643 print test_header
1644 print t_prog
1645 print test_tail
1646 1/0
1647 #=======================================================================================================
1648 # inverse
1649 #=======================================================================================================
1650 name="inverse"
1651 for case0 in ["array","Symbol","constData","taggedData","expandedData"]:
1652 for sh0 in [ (1,1), (2,2), (3,3)]:
1653 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1654 tname="test_%s_%s_dim%s"%(name,case0,sh0[0])
1655 text+=" def %s(self):\n"%tname
1656 a_0=makeArray(sh0,[-1.,1])
1657 for i in range(sh0[0]): a_0[i,i]+=2
1658 if case0 in ["taggedData", "expandedData"]:
1659 a1_0=makeArray(sh0,[-1.,1])
1660 for i in range(sh0[0]): a1_0[i,i]+=3
1661 else:
1662 a1_0=a_0
1663
1664 text+=mkText(case0,"arg",a_0,a1_0)
1665 text+=" res=%s(arg)\n"%name
1666 if case0=="Symbol":
1667 text+=mkText("array","s",a_0,a1_0)
1668 text+=" sub=res.substitute({arg:s})\n"
1669 res="sub"
1670 ref="s"
1671 else:
1672 ref="arg"
1673 res="res"
1674 text+=mkTypeAndShapeTest(case0,sh0,"res")
1675 text+=" self.failUnless(Lsup(matrixmult(%s,%s)-kronecker(%s))<=self.RES_TOL,\"wrong result\")\n"%(res,ref,sh0[0])
1676
1677 if case0 == "taggedData" :
1678 t_prog_with_tags+=text
1679 else:
1680 t_prog+=text
1681
1682 print test_header
1683 # print t_prog
1684 print t_prog_with_tags
1685 print test_tail
1686 1/0
1687
1688 #=======================================================================================================
1689 # trace
1690 #=======================================================================================================
1691 def traceTest(r,offset):
1692 sh=r.shape
1693 r1=1
1694 for i in range(offset): r1*=sh[i]
1695 r2=1
1696 for i in range(offset+2,len(sh)): r2*=sh[i]
1697 r_s=numarray.reshape(r,(r1,sh[offset],sh[offset],r2))
1698 s=numarray.zeros([r1,r2],numarray.Float)
1699 for i1 in range(r1):
1700 for i2 in range(r2):
1701 for j in range(sh[offset]): s[i1,i2]+=r_s[i1,j,j,i2]
1702 return s.resize(sh[:offset]+sh[offset+2:])
1703 name,tt="trace",traceTest
1704 for case0 in ["array","Symbol","constData","taggedData","expandedData"]:
1705 for sh0 in [ (4,5), (6,2,2),(3,2,3,4)]:
1706 for offset in range(len(sh0)-1):
1707 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1708 tname="test_%s_%s_rank%s_offset%s"%(name,case0,len(sh0),offset)
1709 text+=" def %s(self):\n"%tname
1710 sh_t=list(sh0)
1711 sh_t[offset+1]=sh_t[offset]
1712 sh_t=tuple(sh_t)
1713 sh_r=[]
1714 for i in range(offset): sh_r.append(sh0[i])
1715 for i in range(offset+2,len(sh0)): sh_r.append(sh0[i])
1716 sh_r=tuple(sh_r)
1717 a_0=makeArray(sh_t,[-1.,1])
1718 if case0 in ["taggedData", "expandedData"]:
1719 a1_0=makeArray(sh_t,[-1.,1])
1720 else:
1721 a1_0=a_0
1722 r=tt(a_0,offset)
1723 r1=tt(a1_0,offset)
1724 text+=mkText(case0,"arg",a_0,a1_0)
1725 text+=" res=%s(arg,%s)\n"%(name,offset)
1726 if case0=="Symbol":
1727 text+=mkText("array","s",a_0,a1_0)
1728 text+=" sub=res.substitute({arg:s})\n"
1729 res="sub"
1730 text+=mkText("array","ref",r,r1)
1731 else:
1732 res="res"
1733 text+=mkText(case0,"ref",r,r1)
1734 text+=mkTypeAndShapeTest(case0,sh_r,"res")
1735 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
1736
1737 if case0 == "taggedData" :
1738 t_prog_with_tags+=text
1739 else:
1740 t_prog+=text
1741
1742 print test_header
1743 # print t_prog
1744 print t_prog_with_tags
1745 print test_tail
1746 1/0
1747
1748 #=======================================================================================================
1749 # clip
1750 #=======================================================================================================
1751 oper_L=[["clip",clipTEST]]
1752 for oper in oper_L:
1753 for case0 in ["float","array","Symbol","constData","taggedData","expandedData"]:
1754 for sh0 in [ (),(2,), (4,5), (6,2,2),(3,2,3,4)]:
1755 if len(sh0)==0 or not case0=="float":
1756 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1757 tname="test_%s_%s_rank%s"%(oper[0],case0,len(sh0))
1758 text+=" def %s(self):\n"%tname
1759 a_0=makeArray(sh0,[-1.,1])
1760 if case0 in ["taggedData", "expandedData"]:
1761 a1_0=makeArray(sh0,[-1.,1])
1762 else:
1763 a1_0=a_0
1764
1765 r=oper[1](a_0,-0.3,0.5)
1766 r1=oper[1](a1_0,-0.3,0.5)
1767 text+=mkText(case0,"arg",a_0,a1_0)
1768 text+=" res=%s(arg,-0.3,0.5)\n"%oper[0]
1769 if case0=="Symbol":
1770 text+=mkText("array","s",a_0,a1_0)
1771 text+=" sub=res.substitute({arg:s})\n"
1772 res="sub"
1773 text+=mkText("array","ref",r,r1)
1774 else:
1775 res="res"
1776 text+=mkText(case0,"ref",r,r1)
1777 text+=mkTypeAndShapeTest(case0,sh0,"res")
1778 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
1779
1780 if case0 == "taggedData" :
1781 t_prog_with_tags+=text
1782 else:
1783 t_prog+=text
1784
1785 print test_header
1786 # print t_prog
1787 print t_prog_with_tags
1788 print test_tail
1789 1/0
1790
1791 #=======================================================================================================
1792 # maximum, minimum, clipping
1793 #=======================================================================================================
1794 oper_L=[ ["maximum",maximumTEST],
1795 ["minimum",minimumTEST]]
1796 for oper in oper_L:
1797 for case0 in ["float","array","Symbol","constData","taggedData","expandedData"]:
1798 for sh1 in [ (),(2,), (4,5), (6,2,2),(3,2,3,4)]:
1799 for case1 in ["float","array","Symbol","constData","taggedData","expandedData"]:
1800 for sh0 in [ (),(2,), (4,5), (6,2,2),(3,2,3,4)]:
1801 if (len(sh0)==0 or not case0=="float") and (len(sh1)==0 or not case1=="float") \
1802 and (sh0==sh1 or len(sh0)==0 or len(sh1)==0) :
1803 use_tagging_for_expanded_data= case0=="taggedData" or case1=="taggedData"
1804
1805 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1806 tname="test_%s_%s_rank%s_%s_rank%s"%(oper[0],case0,len(sh0),case1,len(sh1))
1807 text+=" def %s(self):\n"%tname
1808 a_0=makeArray(sh0,[-1.,1])
1809 if case0 in ["taggedData", "expandedData"]:
1810 a1_0=makeArray(sh0,[-1.,1])
1811 else:
1812 a1_0=a_0
1813
1814 a_1=makeArray(sh1,[-1.,1])
1815 if case1 in ["taggedData", "expandedData"]:
1816 a1_1=makeArray(sh1,[-1.,1])
1817 else:
1818 a1_1=a_1
1819 r=oper[1](a_0,a_1)
1820 r1=oper[1](a1_0,a1_1)
1821 text+=mkText(case0,"arg0",a_0,a1_0,use_tagging_for_expanded_data)
1822 text+=mkText(case1,"arg1",a_1,a1_1,use_tagging_for_expanded_data)
1823 text+=" res=%s(arg0,arg1)\n"%oper[0]
1824 case=getResultCaseForBin(case0,case1)
1825 if case=="Symbol":
1826 c0_res,c1_res=case0,case1
1827 subs="{"
1828 if case0=="Symbol":
1829 text+=mkText("array","s0",a_0,a1_0)
1830 subs+="arg0:s0"
1831 c0_res="array"
1832 if case1=="Symbol":
1833 text+=mkText("array","s1",a_1,a1_1)
1834 if not subs.endswith("{"): subs+=","
1835 subs+="arg1:s1"
1836 c1_res="array"
1837 subs+="}"
1838 text+=" sub=res.substitute(%s)\n"%subs
1839 res="sub"
1840 text+=mkText(getResultCaseForBin(c0_res,c1_res),"ref",r,r1)
1841 else:
1842 res="res"
1843 text+=mkText(case,"ref",r,r1)
1844 if len(sh0)>len(sh1):
1845 text+=mkTypeAndShapeTest(case,sh0,"res")
1846 else:
1847 text+=mkTypeAndShapeTest(case,sh1,"res")
1848 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
1849
1850 if case0 == "taggedData" or case1 == "taggedData":
1851 t_prog_with_tags+=text
1852 else:
1853 t_prog+=text
1854
1855 print test_header
1856 # print t_prog
1857 print t_prog_with_tags
1858 print test_tail
1859 1/0
1860
1861
1862 #=======================================================================================================
1863 # outer inner
1864 #=======================================================================================================
1865 oper=["outer",outerTEST]
1866 # oper=["inner",innerTEST]
1867 for case0 in ["float","array","Symbol","constData","taggedData","expandedData"]:
1868 for sh1 in [ (),(2,), (4,5), (6,2,2),(3,2,3,4)]:
1869 for case1 in ["float","array","Symbol","constData","taggedData","expandedData"]:
1870 for sh0 in [ (),(2,), (4,5), (6,2,2),(3,2,3,4)]:
1871 if (len(sh0)==0 or not case0=="float") and (len(sh1)==0 or not case1=="float") \
1872 and len(sh0+sh1)<5:
1873 use_tagging_for_expanded_data= case0=="taggedData" or case1=="taggedData"
1874
1875 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1876 tname="test_%s_%s_rank%s_%s_rank%s"%(oper[0],case0,len(sh0),case1,len(sh1))
1877 text+=" def %s(self):\n"%tname
1878 a_0=makeArray(sh0,[-1.,1])
1879 if case0 in ["taggedData", "expandedData"]:
1880 a1_0=makeArray(sh0,[-1.,1])
1881 else:
1882 a1_0=a_0
1883
1884 a_1=makeArray(sh1,[-1.,1])
1885 if case1 in ["taggedData", "expandedData"]:
1886 a1_1=makeArray(sh1,[-1.,1])
1887 else:
1888 a1_1=a_1
1889 r=oper[1](a_0,a_1)
1890 r1=oper[1](a1_0,a1_1)
1891 text+=mkText(case0,"arg0",a_0,a1_0,use_tagging_for_expanded_data)
1892 text+=mkText(case1,"arg1",a_1,a1_1,use_tagging_for_expanded_data)
1893 text+=" res=%s(arg0,arg1)\n"%oper[0]
1894 case=getResultCaseForBin(case0,case1)
1895 if case=="Symbol":
1896 c0_res,c1_res=case0,case1
1897 subs="{"
1898 if case0=="Symbol":
1899 text+=mkText("array","s0",a_0,a1_0)
1900 subs+="arg0:s0"
1901 c0_res="array"
1902 if case1=="Symbol":
1903 text+=mkText("array","s1",a_1,a1_1)
1904 if not subs.endswith("{"): subs+=","
1905 subs+="arg1:s1"
1906 c1_res="array"
1907 subs+="}"
1908 text+=" sub=res.substitute(%s)\n"%subs
1909 res="sub"
1910 text+=mkText(getResultCaseForBin(c0_res,c1_res),"ref",r,r1)
1911 else:
1912 res="res"
1913 text+=mkText(case,"ref",r,r1)
1914 text+=mkTypeAndShapeTest(case,sh0+sh1,"res")
1915 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
1916
1917 if case0 == "taggedData" or case1 == "taggedData":
1918 t_prog_with_tags+=text
1919 else:
1920 t_prog+=text
1921
1922 print test_header
1923 # print t_prog
1924 print t_prog_with_tags
1925 print test_tail
1926 1/0
1927
1928 #=======================================================================================================
1929 # local reduction
1930 #=======================================================================================================
1931 for oper in [["length",0.,"out+%a1%**2","math.sqrt(out)"],
1932 ["maxval",-1.e99,"max(out,%a1%)","out"],
1933 ["minval",1.e99,"min(out,%a1%)","out"] ]:
1934 for case in case_set:
1935 for sh in shape_set:
1936 if not case=="float" or len(sh)==0:
1937 text=""
1938 text+=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1939 tname="def test_%s_%s_rank%s"%(oper[0],case,len(sh))
1940 text+=" %s(self):\n"%tname
1941 a=makeArray(sh,[-1.,1.])
1942 a1=makeArray(sh,[-1.,1.])
1943 r1=testReduce(a1,oper[1],oper[2],oper[3])
1944 r=testReduce(a,oper[1],oper[2],oper[3])
1945
1946 text+=mkText(case,"arg",a,a1)
1947 text+=" res=%s(arg)\n"%oper[0]
1948 if case=="Symbol":
1949 text+=mkText("array","s",a,a1)
1950 text+=" sub=res.substitute({arg:s})\n"
1951 text+=mkText("array","ref",r,r1)
1952 res="sub"
1953 else:
1954 text+=mkText(case,"ref",r,r1)
1955 res="res"
1956 if oper[0]=="length":
1957 text+=mkTypeAndShapeTest(case,(),"res")
1958 else:
1959 if case=="float" or case=="array":
1960 text+=mkTypeAndShapeTest("float",(),"res")
1961 else:
1962 text+=mkTypeAndShapeTest(case,(),"res")
1963 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
1964 if case == "taggedData":
1965 t_prog_with_tags+=text
1966 else:
1967 t_prog+=text
1968 print test_header
1969 # print t_prog
1970 print t_prog_with_tags
1971 print test_tail
1972 1/0
1973
1974 #=======================================================================================================
1975 # tensor multiply
1976 #=======================================================================================================
1977 # oper=["generalTensorProduct",tensorProductTest]
1978 # oper=["matrixmult",testMatrixMult]
1979 oper=["tensormult",testTensorMult]
1980
1981 for case0 in ["float","array","Symbol","constData","taggedData","expandedData"]:
1982 for sh0 in [ (),(2,), (4,5), (6,2,2),(3,2,3,4)]:
1983 for case1 in ["float","array","Symbol","constData","taggedData","expandedData"]:
1984 for sh1 in [ (),(2,), (4,5), (6,2,2),(3,2,3,4)]:
1985 for sh_s in [ (),(3,), (2,3), (2,4,3),(4,2,3,2)]:
1986 if (len(sh0+sh_s)==0 or not case0=="float") and (len(sh1+sh_s)==0 or not case1=="float") \
1987 and len(sh0+sh1)<5 and len(sh0+sh_s)<5 and len(sh1+sh_s)<5:
1988 # if len(sh_s)==1 and len(sh0+sh_s)==2 and (len(sh_s+sh1)==1 or len(sh_s+sh1)==2)): # test for matrixmult
1989 if ( len(sh_s)==1 and len(sh0+sh_s)==2 and ( len(sh1+sh_s)==2 or len(sh1+sh_s)==1 )) or (len(sh_s)==2 and len(sh0+sh_s)==4 and (len(sh1+sh_s)==2 or len(sh1+sh_s)==3 or len(sh1+sh_s)==4)): # test for tensormult
1990 case=getResultCaseForBin(case0,case1)
1991 use_tagging_for_expanded_data= case0=="taggedData" or case1=="taggedData"
1992 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
1993 # tname="test_generalTensorProduct_%s_rank%s_%s_rank%s_offset%s"%(case0,len(sh0+sh_s),case1,len(sh_s+sh1),len(sh_s))
1994 #tname="test_matrixmult_%s_rank%s_%s_rank%s"%(case0,len(sh0+sh_s),case1,len(sh_s+sh1))
1995 tname="test_tensormult_%s_rank%s_%s_rank%s"%(case0,len(sh0+sh_s),case1,len(sh_s+sh1))
1996 # if tname=="test_generalTensorProduct_array_rank1_array_rank2_offset1":
1997 # print tnametest_generalTensorProduct_Symbol_rank1_Symbol_rank3_offset1
1998 text+=" def %s(self):\n"%tname
1999 a_0=makeArray(sh0+sh_s,[-1.,1])
2000 if case0 in ["taggedData", "expandedData"]:
2001 a1_0=makeArray(sh0+sh_s,[-1.,1])
2002 else:
2003 a1_0=a_0
2004
2005 a_1=makeArray(sh_s+sh1,[-1.,1])
2006 if case1 in ["taggedData", "expandedData"]:
2007 a1_1=makeArray(sh_s+sh1,[-1.,1])
2008 else:
2009 a1_1=a_1
2010 r=oper[1](a_0,a_1,sh_s)
2011 r1=oper[1](a1_0,a1_1,sh_s)
2012 text+=mkText(case0,"arg0",a_0,a1_0,use_tagging_for_expanded_data)
2013 text+=mkText(case1,"arg1",a_1,a1_1,use_tagging_for_expanded_data)
2014 #text+=" res=matrixmult(arg0,arg1)\n"
2015 text+=" res=tensormult(arg0,arg1)\n"
2016 #text+=" res=generalTensorProduct(arg0,arg1,offset=%s)\n"%(len(sh_s))
2017 if case=="Symbol":
2018 c0_res,c1_res=case0,case1
2019 subs="{"
2020 if case0=="Symbol":
2021 text+=mkText("array","s0",a_0,a1_0)
2022 subs+="arg0:s0"
2023 c0_res="array"
2024 if case1=="Symbol":
2025 text+=mkText("array","s1",a_1,a1_1)
2026 if not subs.endswith("{"): subs+=","
2027 subs+="arg1:s1"
2028 c1_res="array"
2029 subs+="}"
2030 text+=" sub=res.substitute(%s)\n"%subs
2031 res="sub"
2032 text+=mkText(getResultCaseForBin(c0_res,c1_res),"ref",r,r1)
2033 else:
2034 res="res"
2035 text+=mkText(case,"ref",r,r1)
2036 text+=mkTypeAndShapeTest(case,sh0+sh1,"res")
2037 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
2038 if case0 == "taggedData" or case1 == "taggedData":
2039 t_prog_with_tags+=text
2040 else:
2041 t_prog+=text
2042 print test_header
2043 # print t_prog
2044 print t_prog_with_tags
2045 print test_tail
2046 1/0
2047 #=======================================================================================================
2048 # basic binary operation overloading (tests only!)
2049 #=======================================================================================================
2050 oper_range=[-5.,5.]
2051 for oper in [["add" ,"+",[-5.,5.]],
2052 ["sub" ,"-",[-5.,5.]],
2053 ["mult","*",[-5.,5.]],
2054 ["div" ,"/",[-5.,5.]],
2055 ["pow" ,"**",[0.01,5.]]]:
2056 for case0 in case_set:
2057 for sh0 in shape_set:
2058 for case1 in case_set:
2059 for sh1 in shape_set:
2060 if not case0=="array" and \
2061 (not case0=="float" or len(sh0)==0) and (not case1=="float" or len(sh1)==0) and \
2062 (sh0==() or sh1==() or sh1==sh0) and \
2063 not (case0 in ["float","array"] and case1 in ["float","array"]):
2064 use_tagging_for_expanded_data= case0=="taggedData" or case1=="taggedData"
2065 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
2066 tname="test_%s_overloaded_%s_rank%s_%s_rank%s"%(oper[0],case0,len(sh0),case1,len(sh1))
2067 text+=" def %s(self):\n"%tname
2068 a_0=makeArray(sh0,oper[2])
2069 if case0 in ["taggedData", "expandedData"]:
2070 a1_0=makeArray(sh0,oper[2])
2071 else:
2072 a1_0=a_0
2073
2074 a_1=makeArray(sh1,oper[2])
2075 if case1 in ["taggedData", "expandedData"]:
2076 a1_1=makeArray(sh1,oper[2])
2077 else:
2078 a1_1=a_1
2079 r1=makeResult2(a1_0,a1_1,"%a1%"+oper[1]+"%a2%")
2080 r=makeResult2(a_0,a_1,"%a1%"+oper[1]+"%a2%")
2081 text+=mkText(case0,"arg0",a_0,a1_0,use_tagging_for_expanded_data)
2082 text+=mkText(case1,"arg1",a_1,a1_1,use_tagging_for_expanded_data)
2083 text+=" res=arg0%sarg1\n"%oper[1]
2084
2085 case=getResultCaseForBin(case0,case1)
2086 if case=="Symbol":
2087 c0_res,c1_res=case0,case1
2088 subs="{"
2089 if case0=="Symbol":
2090 text+=mkText("array","s0",a_0,a1_0)
2091 subs+="arg0:s0"
2092 c0_res="array"
2093 if case1=="Symbol":
2094 text+=mkText("array","s1",a_1,a1_1)
2095 if not subs.endswith("{"): subs+=","
2096 subs+="arg1:s1"
2097 c1_res="array"
2098 subs+="}"
2099 text+=" sub=res.substitute(%s)\n"%subs
2100 res="sub"
2101 text+=mkText(getResultCaseForBin(c0_res,c1_res),"ref",r,r1)
2102 else:
2103 res="res"
2104 text+=mkText(case,"ref",r,r1)
2105 if isinstance(r,float):
2106 text+=mkTypeAndShapeTest(case,(),"res")
2107 else:
2108 text+=mkTypeAndShapeTest(case,r.shape,"res")
2109 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
2110
2111 if case0 in [ "constData","taggedData","expandedData"] and case1 == "Symbol":
2112 t_prog_failing+=text
2113 else:
2114 if case0 == "taggedData" or case1 == "taggedData":
2115 t_prog_with_tags+=text
2116 else:
2117 t_prog+=text
2118
2119
2120 print test_header
2121 # print t_prog
2122 # print t_prog_with_tags
2123 print t_prog_failing
2124 print test_tail
2125 1/0
2126 #=======================================================================================================
2127 # basic binary operations (tests only!)
2128 #=======================================================================================================
2129 oper_range=[-5.,5.]
2130 for oper in [["add" ,"+",[-5.,5.]],
2131 ["mult","*",[-5.,5.]],
2132 ["quotient" ,"/",[-5.,5.]],
2133 ["power" ,"**",[0.01,5.]]]:
2134 for case0 in case_set:
2135 for case1 in case_set:
2136 for sh in shape_set:
2137 for sh_p in shape_set:
2138 if len(sh_p)>0:
2139 resource=[-1,1]
2140 else:
2141 resource=[1]
2142 for sh_d in resource:
2143 if sh_d>0:
2144 sh0=sh
2145 sh1=sh+sh_p
2146 else:
2147 sh1=sh
2148 sh0=sh+sh_p
2149
2150 if (not case0=="float" or len(sh0)==0) and (not case1=="float" or len(sh1)==0) and \
2151 len(sh0)<5 and len(sh1)<5:
2152 use_tagging_for_expanded_data= case0=="taggedData" or case1=="taggedData"
2153 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
2154 tname="test_%s_%s_rank%s_%s_rank%s"%(oper[0],case0,len(sh0),case1,len(sh1))
2155 text+=" def %s(self):\n"%tname
2156 a_0=makeArray(sh0,oper[2])
2157 if case0 in ["taggedData", "expandedData"]:
2158 a1_0=makeArray(sh0,oper[2])
2159 else:
2160 a1_0=a_0
2161
2162 a_1=makeArray(sh1,oper[2])
2163 if case1 in ["taggedData", "expandedData"]:
2164 a1_1=makeArray(sh1,oper[2])
2165 else:
2166 a1_1=a_1
2167 r1=makeResult2(a1_0,a1_1,"%a1%"+oper[1]+"%a2%")
2168 r=makeResult2(a_0,a_1,"%a1%"+oper[1]+"%a2%")
2169 text+=mkText(case0,"arg0",a_0,a1_0,use_tagging_for_expanded_data)
2170 text+=mkText(case1,"arg1",a_1,a1_1,use_tagging_for_expanded_data)
2171 text+=" res=%s(arg0,arg1)\n"%oper[0]
2172
2173 case=getResultCaseForBin(case0,case1)
2174 if case=="Symbol":
2175 c0_res,c1_res=case0,case1
2176 subs="{"
2177 if case0=="Symbol":
2178 text+=mkText("array","s0",a_0,a1_0)
2179 subs+="arg0:s0"
2180 c0_res="array"
2181 if case1=="Symbol":
2182 text+=mkText("array","s1",a_1,a1_1)
2183 if not subs.endswith("{"): subs+=","
2184 subs+="arg1:s1"
2185 c1_res="array"
2186 subs+="}"
2187 text+=" sub=res.substitute(%s)\n"%subs
2188 res="sub"
2189 text+=mkText(getResultCaseForBin(c0_res,c1_res),"ref",r,r1)
2190 else:
2191 res="res"
2192 text+=mkText(case,"ref",r,r1)
2193 if isinstance(r,float):
2194 text+=mkTypeAndShapeTest(case,(),"res")
2195 else:
2196 text+=mkTypeAndShapeTest(case,r.shape,"res")
2197 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
2198
2199 if case0 == "taggedData" or case1 == "taggedData":
2200 t_prog_with_tags+=text
2201 else:
2202 t_prog+=text
2203 print test_header
2204 # print t_prog
2205 print t_prog_with_tags
2206 print test_tail
2207 1/0
2208
2209 # print t_prog_with_tagsoper_range=[-5.,5.]
2210 for oper in [["add" ,"+",[-5.,5.]],
2211 ["sub" ,"-",[-5.,5.]],
2212 ["mult","*",[-5.,5.]],
2213 ["div" ,"/",[-5.,5.]],
2214 ["pow" ,"**",[0.01,5.]]]:
2215 for case0 in case_set:
2216 for sh0 in shape_set:
2217 for case1 in case_set:
2218 for sh1 in shape_set:
2219 if (not case0=="float" or len(sh0)==0) and (not case1=="float" or len(sh1)==0) and \
2220 (sh0==() or sh1==() or sh1==sh0) and \
2221 not (case0 in ["float","array"] and case1 in ["float","array"]):
2222 text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
2223 tname="test_%s_%s_rank%s_%s_rank%s"%(oper[0],case0,len(sh0),case1,len(sh1))
2224 text+=" def %s(self):\n"%tname
2225 a_0=makeArray(sh0,oper[2])
2226 if case0 in ["taggedData", "expandedData"]:
2227 a1_0=makeArray(sh0,oper[2])
2228 else:
2229 a1_0=a_0
2230
2231 a_1=makeArray(sh1,oper[2])
2232 if case1 in ["taggedData", "expandedData"]:
2233 a1_1=makeArray(sh1,oper[2])
2234 else:
2235 a1_1=a_1
2236 r1=makeResult2(a1_0,a1_1,"%a1%"+oper[1]+"%a2%")
2237 r=makeResult2(a_0,a_1,"%a1%"+oper[1]+"%a2%")
2238 text+=mkText(case0,"arg0",a_0,a1_0)
2239 text+=mkText(case1,"arg1",a_1,a1_1)
2240 text+=" res=arg0%sarg1\n"%oper[1]
2241
2242 case=getResultCaseForBin(case0,case1)
2243 if case=="Symbol":
2244 c0_res,c1_res=case0,case1
2245 subs="{"
2246 if case0=="Symbol":
2247 text+=mkText("array","s0",a_0,a1_0)
2248 subs+="arg0:s0"
2249 c0_res="array"
2250 if case1=="Symbol":
2251 text+=mkText("array","s1",a_1,a1_1)
2252 if not subs.endswith("{"): subs+=","
2253 subs+="arg1:s1"
2254 c1_res="array"
2255 subs+="}"
2256 text+=" sub=res.substitute(%s)\n"%subs
2257 res="sub"
2258 text+=mkText(getResultCaseForBin(c0_res,c1_res),"ref",r,r1)
2259 else:
2260 res="res"
2261 text+=mkText(case,"ref",r,r1)
2262 if isinstance(r,float):
2263 text+=mkTypeAndShapeTest(case,(),"res")
2264 else:
2265 text+=mkTypeAndShapeTest(case,r.shape,"res")
2266 text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res
2267
2268 if case0 in [ "constData","taggedData","expandedData"] and case1 == "Symbol":
2269 t_prog_failing+=text
2270 else:
2271 if case0 == "taggedData" or case1 == "taggedData":
2272 t_prog_with_tags+=text
2273 else:
2274 t_prog+=text
2275 | __label__pos | 0.987044 |
1
I have situation like this
template<class T> class Vector {
T *data;
uint _size, _counter;
public:
class Iterator;
template<template<class> class C> Vector(typename C<T>::Iterator it1,
typename C<T>::Iterator it2) {
data = NULL;
_size = _counter = 0;
for(typename C<T>::Iterator it = it1; it != it2 && it != end(); it++)
push(*it);
}
};
that is my own Vector class and the constructor mimics behaviour of vector (u can construct it with range of data supplied using interators) but add requirement that the container is to be template of the same type as the one under construction. I get error
5.cpp:16:36: error: no matching function for call to ‘Vector::Vector(Vector::Iterator, Vector::Iterator)’ 5.cpp:16:36: note: candidates are: In file included from 5.cpp:2:0:
5.hpp:17:37: note: template class typedef C C> Vector::Vector(typename C::Iterator, typename C::Iterator)
5.hpp:17:37: note: template argument deduction/substitution failed:
5.cpp:16:36: note: couldn't deduce template parameter ‘template class typedef C C’ In file included from 5.cpp:2:0:
5.hpp:11:3: note: Vector::Vector() [with T = int]
5.hpp:11:3: note: candidate expects 0 arguments, 2 provided
5.hpp:7:25: note: Vector::Vector(const Vector&)
5.hpp:7:25: note: candidate expects 1 argument, 2 provided
Need some help in here.
• What's that template<template<class> class C>? – Alexander Shukaev Apr 18 '13 at 21:12
• constructor is template method with parameter C that is itself a template with one parameter name irrevelant. – lord.didger Apr 18 '13 at 21:14
• it != end(). That can't be right. – jrok Apr 18 '13 at 21:15
• I presume you are defining the class Iterator; below the function definition? – indeterminately sequenced Apr 18 '13 at 21:15
• It looks like you have a case of non-deducible context here. In a nutshell, you cannot deduce C out of C<T>::iterator. It is in fact useless, you are not even mention it in the body of the function. Parameterize by the iterator type, never by the container type. – n. 'pronouns' m. Apr 18 '13 at 21:15
3
In:
template<template<class> class C> Vector(typename C<T>::Iterator it1,
typename C<T>::Iterator it2)
the compiler does not deduce type C from typename C<T>::Iterator because it is what is called nondeduced context.
See §14.8.2.4 Deducing template arguments from a type [temp.deduct.type]:
4 The nondeduced contexts are:
— The nested-name-specifier of a type that was specified using a qualified-id.
— A type that is a template-id in which one or more of the template-arguments is an expression that references a template-parameter.
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.615668 |
Merge from cvs-trunk-mirror to mozilla-central.
[email protected]
Mon, 28 Jan 2008 17:32:29 -0800
changeset 10836 d403bde8a07cdbd9c5dc3c578751bf77a5e796ce
parent 10368 f12729556fbb28e016c5aaafb9b480b041a55ffa (current diff)
parent 10835 55d574a32683b2b54fb406e97b0ccd17645fc71e (diff)
child 10837 1b97a74034d15c57739eb92ca5471fd91329b267
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9b3pre
Merge from cvs-trunk-mirror to mozilla-central.
browser/app/default.xpm
browser/branding/unofficial/default.xpm
client.mk
client.py
config/autoconf.mk.in
config/rules.mk
configure.in
extensions/inspector/resources/locale/sv-SE/search/findFiles.dtd
extensions/inspector/resources/locale/sv-SE/search/junkImgs.dtd
gfx/cairo/cairo/src/cairo-operator.c
intl/unicharutil/public/nsIOrderIdFormater.h
intl/unicharutil/src/nsCharsList.h
intl/unicharutil/src/nsCharsOrderIdFormater.cpp
intl/unicharutil/src/nsCharsOrderIdFormater.h
intl/unicharutil/src/nsRangeCharsList.cpp
intl/unicharutil/src/nsRangeCharsList.h
intl/unicharutil/src/nsStringCharsList.cpp
intl/unicharutil/src/nsStringCharsList.h
js/src/js.cpp
js/src/jsapi.cpp
js/src/jsarray.cpp
js/src/jsatom.cpp
js/src/jsbool.cpp
js/src/jsdbgapi.cpp
js/src/jsemit.cpp
js/src/jsfun.cpp
js/src/jsgc.cpp
js/src/jsinterp.cpp
js/src/jsiter.cpp
js/src/jslock.cpp
js/src/jsobj.cpp
js/src/jsopcode.cpp
js/src/jsparse.cpp
js/src/jsstr.cpp
js/src/jsxml.cpp
modules/libpr0n/test/unit/image2jpg16x16-win.png
modules/libpr0n/test/unit/image2jpg32x32-win.png
other-licenses/branding/firefox/default.xpm
toolkit/themes/winstripe/global/icons/autocomplete-dropmark-arrow.png
toolkit/themes/winstripe/global/icons/autocomplete-dropmark-bkgnd-mid-bottom.png
toolkit/themes/winstripe/global/icons/autocomplete-dropmark-bkgnd-mid-top.png
toolkit/themes/winstripe/global/icons/autocomplete-dropmark-bkgnd.png
widget/public/nsIMenu.h
widget/public/nsIMenuItem.h
widget/src/cocoa/nsIChangeManager.idl
widget/src/cocoa/nsIMenuCommandDispatcher.idl
widget/src/gtk2/nsIPrintJobGTK.h
widget/src/gtk2/nsPrintJobFactoryGTK.cpp
widget/src/gtk2/nsPrintJobFactoryGTK.h
widget/src/gtk2/nsPrintJobGTK.cpp
widget/src/gtk2/nsPrintJobGTK.h
xulrunner/app/default.xpm
--- a/README.txt
+++ b/README.txt
@@ -1,306 +1,20 @@
-==============================================================
-
-= = = = = = = = = = Mozilla Read Me = = = = = = = = = = =
-
-==============================================================
-
-Mozilla is subject to the terms detailed in the license
-agreement accompanying it.
-
-This Read Me file contains information about system
-requirements and installation instructions for the Windows,
-Mac OS, and Linux builds of Mozilla.
-
-For more info on Mozilla, see www.mozilla.org. To submit bugs
-or other feedback, see the Navigator QA menu and check out
-Bugzilla at http://bugzilla.mozilla.org for links to known
-bugs, bug-writing guidelines, and more. You can also get help
-with Bugzilla by pointing your IRC client to #mozillazine
-at irc.mozilla.org.
-
-
-==============================================================
-
- Getting Mozilla
-
-==============================================================
-
-You can download nightly builds of Mozilla from the
-Mozilla.org FTP site at
-
- ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/
-
-For the very latest builds, see
-
- ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/latest-trunk
+For information on how to build Mozilla from the source code, see:
-Keep in mind that nightly builds, which are used by
-Mozilla.org developers for testing, may be buggy. If you are
-looking for a more polished version of Mozilla, Mozilla.org
-releases Milestone builds of Mozilla every six weeks or so
-that you can download from
-
- http://www.mozilla.org/releases
-
-Be sure to read the Mozilla release notes for information
-on known problems and installation issues with Mozilla.
-The release notes can be found at the preceding URL along
-with the milestone releases themselves.
-
-Note: Please use Talkback builds whenever possible. These
-builds allow transmission of crash data back to Mozilla
-developers, improved crash analysis, and posting of crash
-information to our crash-data newsgroup.
-
-
-==============================================================
-
- System Requirements
-
-==============================================================
-
-*All Platforms
-
- To view and use the new streamlined "Modern" theme,
- your display monitor should be set to display
- thousands of colors. For users who cannot set their
- displays to use more than 256 colors, Mozilla.org
- recommends using the "Classic" theme for Mozilla.
-
- To select the Modern theme after you have installed
- Mozilla, from the Navigator browser, open the View
- menu, and then open then open the Apply Theme submenu
- and choose Modern.
-
-*Mac OS
+ http://developer.mozilla.org/en/docs/Build_Documentation
- -Mac OS X or later
- -PowerPC processor (266 MHz or faster recommended)
- -64 MB RAM
- -36 MB of free hard disk space
-
-*Windows
-
- -Windows 95, 98, Me, NT4, 2000 or XP
- -Intel Pentium class processor (233 MHz or faster
- recommended)
- -64 MB RAM
- -26 MB free hard disk space
-
-*Linux
-
- -The following library versions (or compatible) are
- required: glibc 2.1, XFree86 3.3.x, GTK 1.2.x, Glib
- 1.2.x, Libstdc++ 2.9.0. Red Hat Linux 6.0,
- Debian 2.1, and SuSE 6.2 (or later) installations
- should work.
- -Red Hat 6.x users who want to install the Mozilla
- RPM must have at least version 4.0.2 of rpm
- installed.
- -Intel Pentium class processor (233 MHz or faster
- recommended)
- -64MB RAM
- -26MB free hard disk space
-
-
-==============================================================
-
- Installation Instructions
-
-==============================================================
+To have your bug fix / feature added to Mozilla, you should create a patch and
+submit it to Bugzilla (http://bugzilla.mozilla.org). Instructions are at:
-For Mac OS and Windows users, it is strongly recommended that
-you exit all programs before running the setup program. Also,
-you should temporarily disable virus-detection software.
-
-For Linux users, note that the installation instructions use
-the bash shell. If you're not using bash, adjust the commands
-accordingly.
-
-For all platforms, install into a clean (new) directory.
-Installing on top of previously released builds may cause
-problems.
-
-Note: These instructions do not tell you how to build Mozilla.
-For info on building the Mozilla source, see
-
- http://www.mozilla.org/source.html
-
-
-Windows Installation Instructions
----------------------------------
-
-Note: For Windows NT/2000/XP systems, you need Administrator
-privileges to install Mozilla. If you see an "Error 5" message
-during installation, make sure you're running the installation
-with Administrator privileges.
-
-
- To install Mozilla by downloading the Mozilla installer,
- follow these steps:
-
- 1. Click the the mozilla-win32-installer.exe link on
- the site you're downloading Mozilla from to download
- the installer file to your machine.
-
- 2. Navigate to where you downloaded the file and
- double-click the Mozilla program icon on your machine
- to begin the Setup program.
-
- 3. Follow the on-screen instructions in the setup
- program. The program starts automatically the first
- time.
+ http://developer.mozilla.org/en/docs/Creating_a_patch
+ http://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree
-
- To install Mozilla by downloading the .zip file and
- installing manually, follow these steps:
-
- 1. Click the mozilla-win32-talkback.zip link or the
- mozilla-win32.zip link on the site you're down-
- loading Mozilla from to download the .zip file to
- your machine.
-
- 2. Navigate to where you downloaded the file and
- double-click the compressed file.
-
- Note: This step assumes you already have a recent
- version of WinZip installed, and that you know how to
- use it. If not, you can get WinZip and information
- about the program at www.winzip.com.
-
- 3. Extract the .zip file to a directory such as
- C:\Program Files\mozilla.org\Mozilla.
-
- 4. To start Mozilla, navigate to the directory you
- extracted Mozilla to and double-click the Mozilla.exe
- icon.
-
-
-Mac OS X Installation Instructions
-----------------------------------
-
- To install Mozilla by downloading the Mozilla disk image,
- follow these steps:
-
- 1. Click the mozilla-mac-MachO.dmg.gz link to download
- it to your machine. By default, the download file is
- downloaded to your desktop.
-
- 2. Once you have downloaded the .dmg.gz file, drag it
- onto Stuffit Expander to decompress it. If the disk
- image doesn't mount automatically, double-click on the
- .dmg file to mount it. If that fails, and the file
- does not look like a disk image file, do a "Show Info"
- on the file, and, in the "Open with application"
- category, choose Disk Copy. In Mac OS 10.2, you can
- use "Open with" from the context menu.
-
- 3. Once the disk image mounts, open it, and drag the
- Mozilla icon onto your hard disk.
-
- 4. We recommend that you copy it to the Applications
- folder.
-
- 5. Now Eject the disk image.
-
- 6. If you like, you can drag Mozilla to your dock to
- have it easily accessible at all times. You might also
- wish to select Mozilla as your default browser in the
- Internet system preferences pane (under the Web tab).
-
-
-Linux Installation Instructions
--------------------------------
-
-Note: If you install in the default directory (which is
-usually /usr/local/mozilla), or any other directory where
-only the root user normally has write-access, you must
-start Mozilla first as root before other users can start
-the program. Doing so generates a set of files required
-for later use by other users.
-
-
- To install Mozilla by downloading the Mozilla installer,
- follow these steps:
-
- 1. Create a directory named mozilla (mkdir mozilla)
- and change to that directory (cd mozilla).
+If you have a question about developing Mozilla, and can't find the solution
+on http://developer.mozilla.org, you can try asking your question in a
+mozilla.* Usenet group, or on IRC at irc.mozilla.org. [The Mozilla news groups
+are accessible on Google Groups, or news.mozilla.org with a NNTP reader.]
- 2. Click the link on the site you're downloading
- Mozilla from to download the installer file
- (called mozilla-1686-pc-linux-gnu-installer.tar.gz)
- to your machine.
-
- 3. Change to the mozilla directory (cd mozilla) and
- decompress the archive with the following command:
-
- tar zxvf moz*.tar.gz
-
- The installer is now located in a subdirectory of
- Mozilla named mozilla-installer.
-
- 4. Change to the mozilla-installer directory
- (cd mozilla-installer) and run the installer with the
- ./mozilla-installer command.
-
- 5. Follow the instructions in the install wizard for
- installing Mozilla.
-
- Note: If you have a slower machine, be aware that the
- installation may take some time. In this case, the
- installation progress may appear to hang indefinitely,
- even though the installation is still in process.
-
- 6. To start Mozilla, change to the directory where you
- installed it and run the ./mozilla command.
-
-
- To install Mozilla by downloading the tar.gz file:
-
- 1. Create a directory named "mozilla" (mkdir mozilla)
- and change to that directory (cd mozilla).
-
- 2. Click the link on the site you're downloading
- Mozilla from to download the non-installer
- (mozilla*.tar.gz) file into the mozilla directory.
+You can download nightly development builds from the the Mozilla FTP server.
+Keep in mind that nightly builds, which are used by Mozilla developers for
+testing, may be buggy. Firefox nightlies, for example, can be found at:
- 3. Change to the mozilla directory (cd mozilla) and
- decompress the file with the following command:
-
- tar zxvf moz*.tar.gz
-
- This creates a "mozilla" directory under your mozilla
- directory.
-
- 4. Change to the mozilla directory (cd mozilla).
-
- 5. Run Mozilla with the following run script:
-
- ./mozilla
-
-
- To hook up Mozilla complete with icon to the GNOME Panel,
- follow these steps:
-
- 1. Click the GNOME Main Menu button, open the Panel menu,
- and then open the Add to Panel submenu and choose Launcher.
-
- 2. Right-click the icon for Mozilla on the Panel and
- enter the following command:
- directory_name./mozilla
-
- where directory_name is the name of the directory
- you downloaded mozilla to. For example, the default
- directory that Mozilla suggests is /usr/local/mozilla.
-
- 3. Type in a name for the icon, and type in a comment
- if you wish.
-
- 4. Click the icon button and type in the following as
- the icon's location:
-
- directory_name/icons/mozicon50.xpm
-
- where directory name is the directory where you
- installed Mozilla. For example, the default directory
- is /usr/local/mozilla/icons/mozicon50.xpm.
+ ftp://ftp.mozilla.org/pub/firefox/nightly/latest-trunk/
--- a/accessible/public/nsIAccessibleEvent.idl
+++ b/accessible/public/nsIAccessibleEvent.idl
@@ -564,8 +564,22 @@ interface nsIAccessibleTextChangeEvent :
interface nsIAccessibleCaretMoveEvent: nsIAccessibleEvent
{
/**
* Return caret offset.
*/
readonly attribute long caretOffset;
};
+[scriptable, uuid(a9485c7b-5861-4695-8441-fab0235b205d)]
+interface nsIAccessibleTableChangeEvent: nsIAccessibleEvent
+{
+ /**
+ * Return the row or column index.
+ */
+ readonly attribute long rowOrColIndex;
+
+ /**
+ * Return the number of rows or cols
+ */
+ readonly attribute long numRowsOrCols;
+};
+
--- a/accessible/public/nsIAccessibleProvider.idl
+++ b/accessible/public/nsIAccessibleProvider.idl
@@ -47,16 +47,22 @@
[scriptable, uuid(3f7f9194-c625-4a85-8148-6d92d34897fa)]
interface nsIAccessibleProvider : nsISupports
{
/**
* Constants set of common use.
*/
+ /** Do not create an accessible for this object
+ * This is useful if an ancestor binding already implements nsIAccessibleProvider,
+ * but no accessible is desired for the inheriting binding
+ */
+ const long NoAccessible = 0;
+
/** For elements that spawn a new document. For example now it is used by
<xul:iframe>, <xul:browser> and <xul:editor>. */
const long OuterDoc = 0x00000001;
/**
* Constants set is used by XUL controls.
*/
@@ -73,42 +79,43 @@ interface nsIAccessibleProvider : nsISup
const long XULListbox = 0x0000100B;
const long XULListitem = 0x0000100C;
const long XULListHead = 0x00001024;
const long XULListHeader = 0x00001025;
const long XULMenubar = 0x0000100D;
const long XULMenuitem = 0x0000100E;
const long XULMenupopup = 0x0000100F;
const long XULMenuSeparator = 0x00001010;
- const long XULProgressMeter = 0x00001011;
- const long XULScale = 0x00001012;
- const long XULStatusBar = 0x00001013;
- const long XULRadioButton = 0x00001014;
- const long XULRadioGroup = 0x00001015;
+ const long XULPane = 0x00001011;
+ const long XULProgressMeter = 0x00001012;
+ const long XULScale = 0x00001013;
+ const long XULStatusBar = 0x00001014;
+ const long XULRadioButton = 0x00001015;
+ const long XULRadioGroup = 0x00001016;
/** The single tab in a dialog or tabbrowser/editor interface */
- const long XULTab = 0x00001016;
+ const long XULTab = 0x00001017;
/** A combination of a tabs object and a tabpanels object */
- const long XULTabBox = 0x00001017;
+ const long XULTabBox = 0x00001018;
/** The collection of tab objects, useable in the TabBox and independant of
as well */
- const long XULTabs = 0x00001018;
+ const long XULTabs = 0x00001019;
- const long XULText = 0x00001019;
- const long XULTextBox = 0x0000101A;
- const long XULThumb = 0x0000101B;
- const long XULTree = 0x0000101C;
- const long XULTreeColumns = 0x0000101D;
- const long XULTreeColumnItem = 0x0000101E;
- const long XULToolbar = 0x0000101F;
- const long XULToolbarSeparator = 0x00001020;
- const long XULTooltip = 0x00001021;
- const long XULToolbarButton = 0x00001022;
+ const long XULText = 0x0000101A;
+ const long XULTextBox = 0x0000101B;
+ const long XULThumb = 0x0000101C;
+ const long XULTree = 0x0000101D;
+ const long XULTreeColumns = 0x0000101E;
+ const long XULTreeColumnItem = 0x0000101F;
+ const long XULToolbar = 0x00001020;
+ const long XULToolbarSeparator = 0x00001021;
+ const long XULTooltip = 0x00001022;
+ const long XULToolbarButton = 0x00001023;
/**
* Constants set is used by XForms elements.
*/
/** Used for xforms elements that provide accessible object for itself as
* well for anonymous content. This property are used for upload,
--- a/accessible/public/nsIAccessibleRole.idl
+++ b/accessible/public/nsIAccessibleRole.idl
@@ -105,19 +105,19 @@ interface nsIAccessibleRole : nsISupport
/**
* Represents the window frame, which contains child objects such as
* a title bar, client, and other objects contained in a window. The role
* is supported automatically by MS Windows.
*/
const unsigned long ROLE_WINDOW = 9;
/**
- * XXX: document this.
+ * A sub-document (<frame> or <iframe>)
*/
- const unsigned long ROLE_CLIENT = 10;
+ const unsigned long ROLE_INTERNAL_FRAME = 10;
/**
* Represents a menu, which presents a list of options from which the user can
* make a selection to perform an action. It is used for role="menu".
*/
const unsigned long ROLE_MENUPOPUP = 11;
/**
--- a/accessible/public/nsPIAccessible.idl
+++ b/accessible/public/nsPIAccessible.idl
@@ -40,17 +40,17 @@
interface nsIAccessible;
interface nsIAccessibleEvent;
%{C++
struct nsRoleMapEntry;
%}
[ptr] native nsRoleMapEntryPtr(nsRoleMapEntry);
-[uuid(2d552ed0-3f38-4c7f-94c1-419de4d693ed)]
+[uuid(893ee16d-c157-4d5f-b236-60b3b2bef6a5)]
interface nsPIAccessible : nsISupports
{
/**
* Set accessible parent.
*/
void setParent(in nsIAccessible aAccParent);
/**
@@ -78,22 +78,20 @@ interface nsPIAccessible : nsISupports
*/
void invalidateChildren();
/**
* Fire accessible event.
*
* @param aEvent - DOM event
* @param aTarget - target of DOM event
- * @param aData - additional information for accessible event.
*
* XXX: eventually this method will be removed (see bug 377022)
*/
- void fireToolkitEvent(in unsigned long aEvent, in nsIAccessible aTarget,
- in voidPtr aData);
+ void fireToolkitEvent(in unsigned long aEvent, in nsIAccessible aTarget);
/**
* Fire accessible event.
*/
void fireAccessibleEvent(in nsIAccessibleEvent aAccEvent);
/**
* Return true if there are accessible children in anonymous content
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -297,16 +297,17 @@ nsAccessibleWrap::nsAccessibleWrap(nsIDO
#endif
MAI_LOG_DEBUG(("==nsAccessibleWrap creating: this=%p,total=%d left=%d\n",
(void*)this, mAccWrapCreated,
(mAccWrapCreated-mAccWrapDeleted)));
}
nsAccessibleWrap::~nsAccessibleWrap()
{
+ NS_ASSERTION(!mAtkObject, "ShutdownAtkObject() is not called");
#ifdef MAI_LOGGING
++mAccWrapDeleted;
#endif
MAI_LOG_DEBUG(("==nsAccessibleWrap deleting: this=%p,total=%d left=%d\n",
(void*)this, mAccWrapDeleted,
(mAccWrapCreated-mAccWrapDeleted)));
}
@@ -1109,19 +1110,16 @@ nsAccessibleWrap::FireAccessibleEvent(ns
nsCOMPtr<nsIAccessible> accessible;
aEvent->GetAccessible(getter_AddRefs(accessible));
NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
PRUint32 type = 0;
rv = aEvent->GetEventType(&type);
NS_ENSURE_SUCCESS(rv, rv);
- nsAccEvent *event = reinterpret_cast<nsAccEvent*>(aEvent);
- void *eventData = event->mEventData;
-
AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(accessible);
// We don't create ATK objects for nsIAccessible plain text leaves,
// just return NS_OK in such case
if (!atkObj) {
NS_ASSERTION(type == nsIAccessibleEvent::EVENT_ASYNCH_SHOW ||
type == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
type == nsIAccessibleEvent::EVENT_DOM_CREATE ||
@@ -1130,29 +1128,24 @@ nsAccessibleWrap::FireAccessibleEvent(ns
return NS_OK;
}
nsAccessibleWrap *accWrap = GetAccessibleWrap(atkObj);
if (!accWrap) {
return NS_OK; // Node is shut down
}
- AtkTableChange * pAtkTableChange = nsnull;
-
switch (type) {
case nsIAccessibleEvent::EVENT_STATE_CHANGE:
return FireAtkStateChangeEvent(aEvent, atkObj);
case nsIAccessibleEvent::EVENT_TEXT_REMOVED:
case nsIAccessibleEvent::EVENT_TEXT_INSERTED:
return FireAtkTextChangedEvent(aEvent, atkObj);
- case nsIAccessibleEvent::EVENT_PROPERTY_CHANGED:
- return FireAtkPropChangedEvent(aEvent, atkObj);
-
case nsIAccessibleEvent::EVENT_FOCUS:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
nsRefPtr<nsRootAccessible> rootAccWrap = accWrap->GetRootAccessible();
if (rootAccWrap && rootAccWrap->mActivated) {
atk_focus_tracker_notify(atkObj);
// Fire state change event for focus
nsCOMPtr<nsIAccessibleStateChangeEvent> stateChangeEvent =
@@ -1204,83 +1197,93 @@ nsAccessibleWrap::FireAccessibleEvent(ns
} break;
case nsIAccessibleEvent::EVENT_TABLE_MODEL_CHANGED:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_MODEL_CHANGED\n"));
g_signal_emit_by_name(atkObj, "model_changed");
break;
case nsIAccessibleEvent::EVENT_TABLE_ROW_INSERT:
+ {
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_INSERT\n"));
- NS_ASSERTION(eventData, "Event needs event data");
- if (!eventData)
- break;
+ nsCOMPtr<nsIAccessibleTableChangeEvent> tableEvent = do_QueryInterface(aEvent);
+ NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
- pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
+ PRInt32 rowIndex, numRows;
+ tableEvent->GetRowOrColIndex(&rowIndex);
+ tableEvent->GetNumRowsOrCols(&numRows);
g_signal_emit_by_name(atkObj,
"row_inserted",
// After which the rows are inserted
- pAtkTableChange->index,
+ rowIndex,
// The number of the inserted
- pAtkTableChange->count);
- break;
+ numRows);
+ } break;
case nsIAccessibleEvent::EVENT_TABLE_ROW_DELETE:
+ {
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_DELETE\n"));
- NS_ASSERTION(eventData, "Event needs event data");
- if (!eventData)
- break;
+ nsCOMPtr<nsIAccessibleTableChangeEvent> tableEvent = do_QueryInterface(aEvent);
+ NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
- pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
+ PRInt32 rowIndex, numRows;
+ tableEvent->GetRowOrColIndex(&rowIndex);
+ tableEvent->GetNumRowsOrCols(&numRows);
g_signal_emit_by_name(atkObj,
"row_deleted",
// After which the rows are deleted
- pAtkTableChange->index,
+ rowIndex,
// The number of the deleted
- pAtkTableChange->count);
- break;
+ numRows);
+ } break;
case nsIAccessibleEvent::EVENT_TABLE_ROW_REORDER:
+ {
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_REORDER\n"));
g_signal_emit_by_name(atkObj, "row_reordered");
break;
+ }
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_INSERT:
+ {
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_INSERT\n"));
- NS_ASSERTION(eventData, "Event needs event data");
- if (!eventData)
- break;
+ nsCOMPtr<nsIAccessibleTableChangeEvent> tableEvent = do_QueryInterface(aEvent);
+ NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
- pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
+ PRInt32 colIndex, numCols;
+ tableEvent->GetRowOrColIndex(&colIndex);
+ tableEvent->GetNumRowsOrCols(&numCols);
g_signal_emit_by_name(atkObj,
"column_inserted",
// After which the columns are inserted
- pAtkTableChange->index,
+ colIndex,
// The number of the inserted
- pAtkTableChange->count);
- break;
+ numCols);
+ } break;
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_DELETE:
+ {
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_DELETE\n"));
- NS_ASSERTION(eventData, "Event needs event data");
- if (!eventData)
- break;
+ nsCOMPtr<nsIAccessibleTableChangeEvent> tableEvent = do_QueryInterface(aEvent);
+ NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
- pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
+ PRInt32 colIndex, numCols;
+ tableEvent->GetRowOrColIndex(&colIndex);
+ tableEvent->GetNumRowsOrCols(&numCols);
g_signal_emit_by_name(atkObj,
"column_deleted",
// After which the columns are deleted
- pAtkTableChange->index,
+ colIndex,
// The number of the deleted
- pAtkTableChange->count);
- break;
+ numCols);
+ } break;
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_REORDER:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_REORDER\n"));
g_signal_emit_by_name(atkObj, "column_reordered");
break;
case nsIAccessibleEvent::EVENT_SECTION_CHANGED:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SECTION_CHANGED\n"));
@@ -1432,86 +1435,16 @@ nsAccessibleWrap::FireAtkTextChangedEven
isFromUserInput ? "" : kNonUserInputEvent, NULL);
g_signal_emit_by_name(aObject, signal_name, start, length);
g_free (signal_name);
return NS_OK;
}
nsresult
-nsAccessibleWrap::FireAtkPropChangedEvent(nsIAccessibleEvent *aEvent,
- AtkObject *aObject)
-{
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_PROPERTY_CHANGED\n"));
-
- AtkPropertyChange *pAtkPropChange;
- AtkPropertyValues values = { NULL };
- nsAccessibleWrap *oldAccWrap = nsnull, *newAccWrap = nsnull;
-
- nsAccEvent *event = reinterpret_cast<nsAccEvent*>(aEvent);
-
- pAtkPropChange = reinterpret_cast<AtkPropertyChange *>(event->mEventData);
- values.property_name = sAtkPropertyNameArray[pAtkPropChange->type];
-
- NS_ASSERTION(pAtkPropChange, "Event needs event data");
- if (!pAtkPropChange)
- return NS_OK;
-
- MAI_LOG_DEBUG(("\n\nthe type of EVENT_PROPERTY_CHANGED: %d\n\n",
- pAtkPropChange->type));
-
- switch (pAtkPropChange->type) {
- case PROP_TABLE_CAPTION:
- case PROP_TABLE_SUMMARY:
-
- if (pAtkPropChange->oldvalue)
- oldAccWrap = reinterpret_cast<nsAccessibleWrap *>
- (pAtkPropChange->oldvalue);
-
- if (pAtkPropChange->newvalue)
- newAccWrap = reinterpret_cast<nsAccessibleWrap *>
- (pAtkPropChange->newvalue);
-
- if (oldAccWrap && newAccWrap) {
- g_value_init(&values.old_value, G_TYPE_POINTER);
- g_value_set_pointer(&values.old_value,
- oldAccWrap->GetAtkObject());
- g_value_init(&values.new_value, G_TYPE_POINTER);
- g_value_set_pointer(&values.new_value,
- newAccWrap->GetAtkObject());
- }
- break;
-
- case PROP_TABLE_COLUMN_DESCRIPTION:
- case PROP_TABLE_COLUMN_HEADER:
- case PROP_TABLE_ROW_HEADER:
- case PROP_TABLE_ROW_DESCRIPTION:
- g_value_init(&values.new_value, G_TYPE_INT);
- g_value_set_int(&values.new_value,
- *reinterpret_cast<gint *>
- (pAtkPropChange->newvalue));
- break;
-
- //Perhaps need more cases in the future
- default:
- g_value_init (&values.old_value, G_TYPE_POINTER);
- g_value_set_pointer (&values.old_value, pAtkPropChange->oldvalue);
- g_value_init (&values.new_value, G_TYPE_POINTER);
- g_value_set_pointer (&values.new_value, pAtkPropChange->newvalue);
- }
-
- char *signal_name = g_strconcat("property_change::",
- values.property_name, NULL);
- g_signal_emit_by_name(aObject, signal_name, &values, NULL);
- g_free (signal_name);
-
- return NS_OK;
-}
-
-nsresult
nsAccessibleWrap::FireAtkShowHideEvent(nsIAccessibleEvent *aEvent,
AtkObject *aObject, PRBool aIsAdded)
{
if (aIsAdded)
MAI_LOG_DEBUG(("\n\nReceived: Show event\n"));
else
MAI_LOG_DEBUG(("\n\nReceived: Hide event\n"));
--- a/accessible/src/atk/nsRoleMap.h
+++ b/accessible/src/atk/nsRoleMap.h
@@ -51,17 +51,17 @@ static const PRUint32 atkRoleMap[] = {
ATK_ROLE_MENU_BAR, // nsIAccessibleRole::ROLE_MENUBAR 2
ATK_ROLE_SCROLL_BAR, // nsIAccessibleRole::ROLE_SCROLLBAR 3
ATK_ROLE_UNKNOWN, // nsIAccessibleRole::ROLE_GRIP 4
ATK_ROLE_UNKNOWN, // nsIAccessibleRole::ROLE_SOUND 5
ATK_ROLE_UNKNOWN, // nsIAccessibleRole::ROLE_CURSOR 6
ATK_ROLE_UNKNOWN, // nsIAccessibleRole::ROLE_CARET 7
ATK_ROLE_ALERT, // nsIAccessibleRole::ROLE_ALERT 8
ATK_ROLE_WINDOW, // nsIAccessibleRole::ROLE_WINDOW 9
- ATK_ROLE_PANEL, // nsIAccessibleRole::ROLE_CLIENT 10
+ ATK_ROLE_INTERNAL_FRAME, // nsIAccessibleRole::ROLE_INTERNAL_FRAME 10
ATK_ROLE_MENU, // nsIAccessibleRole::ROLE_MENUPOPUP 11
ATK_ROLE_MENU_ITEM, // nsIAccessibleRole::ROLE_MENUITEM 12
ATK_ROLE_TOOL_TIP, // nsIAccessibleRole::ROLE_TOOLTIP 13
ATK_ROLE_EMBEDDED, // nsIAccessibleRole::ROLE_APPLICATION 14
ATK_ROLE_DOCUMENT_FRAME, // nsIAccessibleRole::ROLE_DOCUMENT 15
ATK_ROLE_PANEL, // nsIAccessibleRole::ROLE_PANE 16
ATK_ROLE_CHART, // nsIAccessibleRole::ROLE_CHART 17
ATK_ROLE_DIALOG, // nsIAccessibleRole::ROLE_DIALOG 18
--- a/accessible/src/atk/nsRootAccessibleWrap.cpp
+++ b/accessible/src/atk/nsRootAccessibleWrap.cpp
@@ -41,10 +41,16 @@
#include "nsMai.h"
#include "nsRootAccessibleWrap.h"
nsNativeRootAccessibleWrap::nsNativeRootAccessibleWrap(AtkObject *aAccessible):
nsRootAccessible(nsnull, nsnull)
{
g_object_ref(aAccessible);
- nsAccessibleWrap::mAtkObject = aAccessible;
+ mAtkObject = aAccessible;
}
+
+nsNativeRootAccessibleWrap::~nsNativeRootAccessibleWrap()
+{
+ g_object_unref(mAtkObject);
+ mAtkObject = nsnull;
+}
--- a/accessible/src/atk/nsRootAccessibleWrap.h
+++ b/accessible/src/atk/nsRootAccessibleWrap.h
@@ -50,11 +50,12 @@ typedef nsRootAccessible nsRootAccessibl
* The instance of nsNativeRootAccessibleWrap is a child of MaiAppRoot instance.
* It is added into root when the toplevel window is created, and removed
* from root when the toplevel window is destroyed.
*/
class nsNativeRootAccessibleWrap: public nsRootAccessible
{
public:
nsNativeRootAccessibleWrap(AtkObject *aAccessible);
+ ~nsNativeRootAccessibleWrap();
};
#endif /* __NS_ROOT_ACCESSIBLE_WRAP_H__ */
--- a/accessible/src/base/nsAccessibilityAtomList.h
+++ b/accessible/src/base/nsAccessibilityAtomList.h
@@ -77,16 +77,18 @@ ACCESSIBILITY_ATOM(deckFrame, "DeckFrame
ACCESSIBILITY_ATOM(inlineBlockFrame, "InlineBlockFrame")
ACCESSIBILITY_ATOM(inlineFrame, "InlineFrame")
ACCESSIBILITY_ATOM(objectFrame, "ObjectFrame")
ACCESSIBILITY_ATOM(scrollFrame, "ScrollFrame")
ACCESSIBILITY_ATOM(textFrame, "TextFrame")
ACCESSIBILITY_ATOM(tableCaptionFrame, "TableCaptionFrame")
ACCESSIBILITY_ATOM(tableCellFrame, "TableCellFrame")
ACCESSIBILITY_ATOM(tableOuterFrame, "TableOuterFrame")
+ACCESSIBILITY_ATOM(tableRowGroupFrame, "TableRowGroupFrame")
+ACCESSIBILITY_ATOM(tableRowFrame, "TableRowFrame")
// Alphabetical list of tag names
ACCESSIBILITY_ATOM(a, "a")
ACCESSIBILITY_ATOM(abbr, "abbr")
ACCESSIBILITY_ATOM(acronym, "acronym")
ACCESSIBILITY_ATOM(area, "area")
ACCESSIBILITY_ATOM(autocomplete, "autocomplete")
ACCESSIBILITY_ATOM(blockquote, "blockquote")
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -1191,16 +1191,44 @@ nsresult nsAccessibilityService::InitAcc
nsCOMPtr<nsPIAccessible> privateAccessible =
do_QueryInterface(privateAccessNode);
privateAccessible->SetRoleMapEntry(aRoleMapEntry);
NS_ADDREF(*aAccessibleOut = aAccessibleIn);
}
return rv;
}
+static PRBool HasRelatedContent(nsIContent *aContent)
+{
+ nsAutoString id;
+ if (!aContent || !nsAccUtils::GetID(aContent, id) || id.IsEmpty()) {
+ return PR_FALSE;
+ }
+
+ nsIAtom *relationAttrs[] = {nsAccessibilityAtoms::aria_labelledby,
+ nsAccessibilityAtoms::aria_describedby,
+ nsAccessibilityAtoms::aria_owns,
+ nsAccessibilityAtoms::aria_controls,
+ nsAccessibilityAtoms::aria_flowto};
+ if (nsAccUtils::FindNeighbourPointingToNode(aContent, relationAttrs, NS_ARRAY_LENGTH(relationAttrs))) {
+ return PR_TRUE;
+ }
+
+ nsIContent *ancestorContent = aContent;
+ nsAutoString activeID;
+ while ((ancestorContent = ancestorContent->GetParent()) != nsnull) {
+ if (ancestorContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_activedescendant, activeID)) {
+ // ancestor has activedescendant property, this content could be active
+ return PR_TRUE;
+ }
+ }
+
+ return PR_FALSE;
+}
+
NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
nsIPresShell *aPresShell,
nsIWeakReference *aWeakShell,
nsIFrame **aFrameHint,
PRBool *aIsHidden,
nsIAccessible **aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
@@ -1390,51 +1418,46 @@ NS_IMETHODIMP nsAccessibilityService::Ge
nsIAccessibleRole::ROLE_EQUATION);
}
} else if (!newAcc) { // HTML accessibles
PRBool tryTagNameOrFrame = PR_TRUE;
if (!content->IsFocusable()) {
// If we're in unfocusable table-related subcontent, check for the
// Presentation role on the containing table
- nsIAtom *tag = content->Tag();
- if (tag == nsAccessibilityAtoms::td ||
- tag == nsAccessibilityAtoms::th ||
- tag == nsAccessibilityAtoms::tr ||
- tag == nsAccessibilityAtoms::tbody ||
- tag == nsAccessibilityAtoms::tfoot ||
- tag == nsAccessibilityAtoms::thead) {
+ if (frame->GetType() == nsAccessibilityAtoms::tableCaptionFrame ||
+ frame->GetType() == nsAccessibilityAtoms::tableCellFrame ||
+ frame->GetType() == nsAccessibilityAtoms::tableRowGroupFrame ||
+ frame->GetType() == nsAccessibilityAtoms::tableRowFrame) {
+
nsIContent *tableContent = content;
- nsAutoString tableRole;
while ((tableContent = tableContent->GetParent()) != nsnull) {
- if (tableContent->Tag() == nsAccessibilityAtoms::table) {
- // Table that we're a descendant of is not styled as a table,
- // and has no table accessible for an ancestor, or
- // table that we're a descendant of is presentational
+ nsIFrame *tableFrame = aPresShell->GetPrimaryFrameFor(tableContent);
+ if (tableFrame &&
+ tableFrame->GetType() == nsAccessibilityAtoms::tableOuterFrame) {
nsCOMPtr<nsIDOMNode> tableNode(do_QueryInterface(tableContent));
if (tableNode) {
nsRoleMapEntry *tableRoleMapEntry =
nsAccUtils::GetRoleMapEntry(tableNode);
if (tableRoleMapEntry &&
- tableRoleMapEntry != &nsARIAMap::gLandmarkRoleMap) {
+ tableRoleMapEntry != &nsARIAMap::gLandmarkRoleMap)
tryTagNameOrFrame = PR_FALSE;
- break;
- }
- }
-
- nsIFrame *tableFrame =
- aPresShell->GetPrimaryFrameFor(tableContent);
- if (!tableFrame ||
- tableFrame->GetType() != nsAccessibilityAtoms::tableOuterFrame) {
- tryTagNameOrFrame = PR_FALSE;
}
break;
}
+
+ if (tableContent->Tag() == nsAccessibilityAtoms::table) {
+ tryTagNameOrFrame = PR_FALSE;
+ break;
+ }
}
+
+ if (!tableContent)
+ tryTagNameOrFrame = PR_FALSE;
}
}
if (tryTagNameOrFrame) {
// Prefer to use markup (mostly tag name, perhaps attributes) to
// decide if and what kind of accessible to create.
// The method creates accessibles for table related content too therefore
// we do not call it if accessibles for table related content are
@@ -1468,17 +1491,18 @@ NS_IMETHODIMP nsAccessibilityService::Ge
// If no accessible, see if we need to create a generic accessible because
// of some property that makes this object interesting
// We don't do this for <body>, <html>, <window>, <dialog> etc. which
// correspond to the doc accessible and will be created in any case
if (!newAcc && content->Tag() != nsAccessibilityAtoms::body && content->GetParent() &&
(content->IsFocusable() ||
(isHTML && nsAccUtils::HasListener(content, NS_LITERAL_STRING("click"))) ||
- HasUniversalAriaProperty(content, aWeakShell) || roleMapEntry)) {
+ HasUniversalAriaProperty(content, aWeakShell) || roleMapEntry) ||
+ HasRelatedContent(content)) {
// This content is focusable or has an interesting dynamic content accessibility property.
// If it's interesting we need it in the accessibility hierarchy so that events or
// other accessibles can point to it, or so that it can hold a state, etc.
if (isHTML) {
// Interesting HTML container which may have selectable text and/or embedded objects
CreateHyperTextAccessible(frame, getter_AddRefs(newAcc));
}
else { // XUL, SVG, MathML etc.
@@ -1601,16 +1625,18 @@ nsresult nsAccessibilityService::GetAcce
return CreateOuterDocAccessible(aNode, aAccessible);
nsCOMPtr<nsIWeakReference> weakShell;
GetShellFromNode(aNode, getter_AddRefs(weakShell));
switch (type)
{
#ifdef MOZ_XUL
+ case nsIAccessibleProvider::NoAccessible:
+ return NS_OK;
// XUL controls
case nsIAccessibleProvider::XULAlert:
*aAccessible = new nsXULAlertAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULButton:
*aAccessible = new nsXULButtonAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULCheckbox:
@@ -1685,16 +1711,19 @@ nsresult nsAccessibilityService::GetAcce
}
#endif
*aAccessible = new nsXULMenupopupAccessible(aNode, weakShell);
break;
}
case nsIAccessibleProvider::XULMenuSeparator:
*aAccessible = new nsXULMenuSeparatorAccessible(aNode, weakShell);
break;
+ case nsIAccessibleProvider::XULPane:
+ *aAccessible = new nsEnumRoleAccessible(aNode, weakShell, nsIAccessibleRole::ROLE_PANE);
+ break;
case nsIAccessibleProvider::XULProgressMeter:
*aAccessible = new nsXULProgressMeterAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULStatusBar:
*aAccessible = new nsXULStatusBarAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULScale:
*aAccessible = new nsXULSliderAccessible(aNode, weakShell);
--- a/accessible/src/base/nsAccessibilityService.h
+++ b/accessible/src/base/nsAccessibilityService.h
@@ -147,17 +147,17 @@ static const char kRoleNames[][20] = {
"menubar", //ROLE_MENUBAR
"scrollbar", //ROLE_SCROLLBAR
"grip", //ROLE_GRIP
"sound", //ROLE_SOUND
"cursor", //ROLE_CURSOR
"caret", //ROLE_CARET
"alert", //ROLE_ALERT
"window", //ROLE_WINDOW
- "client", //ROLE_CLIENT
+ "internal frame", //ROLE_INTERNAL_FRAME
"menupopup", //ROLE_MENUPOPUP
"menuitem", //ROLE_MENUITEM
"tooltip", //ROLE_TOOLTIP
"application", //ROLE_APPLICATION
"document", //ROLE_DOCUMENT
"pane", //ROLE_PANE
"chart", //ROLE_CHART
"dialog", //ROLE_DIALOG
--- a/accessible/src/base/nsAccessibilityUtils.cpp
+++ b/accessible/src/base/nsAccessibilityUtils.cpp
@@ -252,17 +252,17 @@ nsAccUtils::FireAccEvent(PRUint32 aEvent
PRBool aIsAsynch)
{
NS_ENSURE_ARG(aAccessible);
nsCOMPtr<nsPIAccessible> pAccessible(do_QueryInterface(aAccessible));
NS_ASSERTION(pAccessible, "Accessible doesn't implement nsPIAccessible");
nsCOMPtr<nsIAccessibleEvent> event =
- new nsAccEvent(aEventType, aAccessible, nsnull, aIsAsynch);
+ new nsAccEvent(aEventType, aAccessible, aIsAsynch);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
return pAccessible->FireAccessibleEvent(event);
}
PRBool
nsAccUtils::IsAncestorOf(nsIDOMNode *aPossibleAncestorNode,
nsIDOMNode *aPossibleDescendantNode)
@@ -582,16 +582,26 @@ nsAccUtils::GetID(nsIContent *aContent,
}
nsIContent*
nsAccUtils::FindNeighbourPointingToNode(nsIContent *aForNode,
nsIAtom *aRelationAttr,
nsIAtom *aTagName,
PRUint32 aAncestorLevelsToSearch)
{
+ return FindNeighbourPointingToNode(aForNode, &aRelationAttr, 1, aTagName, aAncestorLevelsToSearch);
+}
+
+nsIContent*
+nsAccUtils::FindNeighbourPointingToNode(nsIContent *aForNode,
+ nsIAtom **aRelationAttrs,
+ PRUint32 aAttrNum,
+ nsIAtom *aTagName,
+ PRUint32 aAncestorLevelsToSearch)
+{
nsCOMPtr<nsIContent> binding;
nsAutoString controlID;
if (!nsAccUtils::GetID(aForNode, controlID)) {
binding = aForNode->GetBindingParent();
if (binding == aForNode)
return nsnull;
aForNode->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::anonid, controlID);
@@ -633,68 +643,85 @@ nsAccUtils::FindNeighbourPointingToNode(
return nsnull;
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
if (!content)
return nsnull;
if (content != prevSearched) {
labelContent = FindDescendantPointingToID(&controlID, content,
- aRelationAttr, nsnull, aTagName);
+ aRelationAttrs, aAttrNum,
+ nsnull, aTagName);
}
}
break;
}
labelContent = FindDescendantPointingToID(&controlID, aForNode,
- aRelationAttr, prevSearched, aTagName);
+ aRelationAttrs, aAttrNum,
+ prevSearched, aTagName);
prevSearched = aForNode;
}
return labelContent;
}
// Pass in aAriaProperty = null and aRelationAttr == nsnull if any <label> will do
nsIContent*
nsAccUtils::FindDescendantPointingToID(const nsString *aId,
nsIContent *aLookContent,
- nsIAtom *aRelationAttr,
+ nsIAtom **aRelationAttrs,
+ PRUint32 aAttrNum,
nsIContent *aExcludeContent,
nsIAtom *aTagType)
{
// Surround id with spaces for search
nsCAutoString idWithSpaces(' ');
LossyAppendUTF16toASCII(*aId, idWithSpaces);
idWithSpaces += ' ';
return FindDescendantPointingToIDImpl(idWithSpaces, aLookContent,
- aRelationAttr, aExcludeContent, aTagType);
+ aRelationAttrs, aAttrNum,
+ aExcludeContent, aTagType);
+}
+
+nsIContent*
+nsAccUtils::FindDescendantPointingToID(const nsString *aId,
+ nsIContent *aLookContent,
+ nsIAtom *aRelationAttr,
+ nsIContent *aExcludeContent,
+ nsIAtom *aTagType)
+{
+ return FindDescendantPointingToID(aId, aLookContent, &aRelationAttr, 1, aExcludeContent, aTagType);
}
nsIContent*
nsAccUtils::FindDescendantPointingToIDImpl(nsCString& aIdWithSpaces,
nsIContent *aLookContent,
- nsIAtom *aRelationAttr,
+ nsIAtom **aRelationAttrs,
+ PRUint32 aAttrNum,
nsIContent *aExcludeContent,
nsIAtom *aTagType)
{
NS_ENSURE_TRUE(aLookContent, nsnull);
- NS_ENSURE_TRUE(aRelationAttr, nsnull);
+ NS_ENSURE_TRUE(aRelationAttrs && *aRelationAttrs, nsnull);
if (!aTagType || aLookContent->Tag() == aTagType) {
// Tag matches
- // Check for ID in the attribute aRelationAttr, which can be a list
- nsAutoString idList;
- if (aLookContent->GetAttr(kNameSpaceID_None, aRelationAttr, idList)) {
- idList.Insert(' ', 0); // Surround idlist with spaces for search
- idList.Append(' ');
- // idList is now a set of id's with spaces around each,
- // and id also has spaces around it.
- // If id is a substring of idList then we have a match
- if (idList.Find(aIdWithSpaces) != -1) {
- return aLookContent;
+ // Check for ID in the attributes aRelationAttrs, which can be a list
+ for (PRUint32 i = 0; i < aAttrNum; i++) {
+ nsAutoString idList;
+ if (aLookContent->GetAttr(kNameSpaceID_None, aRelationAttrs[i], idList)) {
+ idList.Insert(' ', 0); // Surround idlist with spaces for search
+ idList.Append(' ');
+ // idList is now a set of id's with spaces around each,
+ // and id also has spaces around it.
+ // If id is a substring of idList then we have a match
+ if (idList.Find(aIdWithSpaces) != -1) {
+ return aLookContent;
+ }
}
}
if (aTagType) {
// Don't bother to search descendants of an element with matching tag.
// That would be like looking for a nested <label> or <description>
return nsnull;
}
}
@@ -702,17 +729,18 @@ nsAccUtils::FindDescendantPointingToIDIm
// Recursively search descendants for match
PRUint32 count = 0;
nsIContent *child;
nsIContent *labelContent = nsnull;
while ((child = aLookContent->GetChildAt(count++)) != nsnull) {
if (child != aExcludeContent) {
labelContent = FindDescendantPointingToIDImpl(aIdWithSpaces, child,
- aRelationAttr, aExcludeContent, aTagType);
+ aRelationAttrs, aAttrNum,
+ aExcludeContent, aTagType);
if (labelContent) {
return labelContent;
}
}
}
return nsnull;
}
--- a/accessible/src/base/nsAccessibilityUtils.h
+++ b/accessible/src/base/nsAccessibilityUtils.h
@@ -272,49 +272,75 @@ public:
*/
static nsRoleMapEntry* GetRoleMapEntry(nsIDOMNode *aNode);
/**
* Search element in neighborhood of the given element by tag name and
* attribute value that equals to ID attribute of the given element.
* ID attribute can be either 'id' attribute or 'anonid' if the element is
* anonymous.
+ * The first matched content will be returned.
*
* @param aForNode - the given element the search is performed for
- * @param aRelationAttr - attribute name of searched element, ignored if aAriaProperty passed in
+ * @param aRelationAttrs - an array of attributes, element is attribute name of searched element, ignored if aAriaProperty passed in
+ * @param aAttrNum - how many attributes in aRelationAttrs
* @param aTagName - tag name of searched element, or nsnull for any -- ignored if aAriaProperty passed in
* @param aAncestorLevelsToSearch - points how is the neighborhood of the
* given element big.
*/
static nsIContent *FindNeighbourPointingToNode(nsIContent *aForNode,
- nsIAtom *aRelationAttr,
+ nsIAtom **aRelationAttrs,
+ PRUint32 aAttrNum,
+ nsIAtom *aTagName = nsnull,
+ PRUint32 aAncestorLevelsToSearch = 5);
+
+ /**
+ * Overloaded version of FindNeighbourPointingToNode to accept only one
+ * relation attribute.
+ */
+ static nsIContent *FindNeighbourPointingToNode(nsIContent *aForNode,
+ nsIAtom *aRelationAttr,
nsIAtom *aTagName = nsnull,
PRUint32 aAncestorLevelsToSearch = 5);
/**
* Search for element that satisfies the requirements in subtree of the given
* element. The requirements are tag name, attribute name and value of
* attribute.
+ * The first matched content will be returned.
*
* @param aId - value of searched attribute
* @param aLookContent - element that search is performed inside
- * @param aRelationAttr - searched attribute
- * @param if both aAriaProperty and aRelationAttr are null, then any element with aTagType will do
+ * @param aRelationAttrs - an array of searched attributes
+ * @param aAttrNum - how many attributes in aRelationAttrs
+ * @param if both aAriaProperty and aRelationAttrs are null, then any element with aTagType will do
* @param aExcludeContent - element that is skiped for search
* @param aTagType - tag name of searched element, by default it is 'label' --
* ignored if aAriaProperty passed in
*/
static nsIContent *FindDescendantPointingToID(const nsString *aId,
nsIContent *aLookContent,
+ nsIAtom **aRelationAttrs,
+ PRUint32 aAttrNum = 1,
+ nsIContent *aExcludeContent = nsnull,
+ nsIAtom *aTagType = nsAccessibilityAtoms::label);
+
+ /**
+ * Overloaded version of FindDescendantPointingToID to accept only one
+ * relation attribute.
+ */
+ static nsIContent *FindDescendantPointingToID(const nsString *aId,
+ nsIContent *aLookContent,
nsIAtom *aRelationAttr,
nsIContent *aExcludeContent = nsnull,
nsIAtom *aTagType = nsAccessibilityAtoms::label);
// Helper for FindDescendantPointingToID(), same args
static nsIContent *FindDescendantPointingToIDImpl(nsCString& aIdWithSpaces,
nsIContent *aLookContent,
- nsIAtom *aRelationAttrs,
+ nsIAtom **aRelationAttrs,
+ PRUint32 aAttrNum = 1,
nsIContent *aExcludeContent = nsnull,
nsIAtom *aTagType = nsAccessibilityAtoms::label);
};
#endif
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -824,17 +824,17 @@ NS_IMETHODIMP nsAccessible::TestChildCac
{
#ifndef DEBUG_A11Y
return NS_OK;
#else
// All cached accessible nodes should be in the parent
// It will assert if not all the children were created
// when they were first cached, and no invalidation
// ever corrected parent accessible's child cache.
- if (mAccChildCount == eChildCountUninitialized) {
+ if (mAccChildCount <= 0) {
return NS_OK;
}
nsCOMPtr<nsIAccessible> sibling = mFirstChild;
while (sibling != aCachedChild) {
NS_ASSERTION(sibling, "[TestChildCache] Never ran into the same child that we started from");
if (!sibling)
return NS_ERROR_FAILURE;
@@ -1904,25 +1904,24 @@ PRBool nsAccessible::IsNodeRelevant(nsID
do_GetService("@mozilla.org/accessibilityService;1");
NS_ENSURE_TRUE(accService, PR_FALSE);
nsCOMPtr<nsIDOMNode> relevantNode;
accService->GetRelevantContentNodeFor(aNode, getter_AddRefs(relevantNode));
return aNode == relevantNode;
}
NS_IMETHODIMP
-nsAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible *aTarget,
- void * aData)
+nsAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible *aTarget)
{
// Don't fire event for accessible that has been shut down.
if (!mWeakShell)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessibleEvent> accEvent =
- new nsAccEvent(aEvent, aTarget, aData);
+ new nsAccEvent(aEvent, aTarget);
NS_ENSURE_TRUE(accEvent, NS_ERROR_OUT_OF_MEMORY);
return FireAccessibleEvent(accEvent);
}
NS_IMETHODIMP
nsAccessible::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
{
@@ -1959,17 +1958,17 @@ NS_IMETHODIMP nsAccessible::GetFinalRole
else if (*aRole == nsIAccessibleRole::ROLE_PUSHBUTTON) {
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
if (content) {
if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_pressed)) {
// For aria-pressed="false" or aria-pressed="true"
// For simplicity, any pressed attribute indicates it's a toggle button
*aRole = nsIAccessibleRole::ROLE_TOGGLE_BUTTON;
}
- else if (content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::aria_secret,
+ else if (content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::aria_haspopup,
nsAccessibilityAtoms::_true, eCaseMatters)) {
// For button with aria-haspopup="true"
*aRole = nsIAccessibleRole::ROLE_BUTTONMENU;
}
}
}
else if (*aRole == nsIAccessibleRole::ROLE_LISTBOX) {
// A listbox inside of a combo box needs a special role because of ATK mapping to menu
--- a/accessible/src/base/nsAccessibleEventData.cpp
+++ b/accessible/src/base/nsAccessibleEventData.cpp
@@ -55,25 +55,25 @@
#include "nsPresContext.h"
PRBool nsAccEvent::gLastEventFromUserInput = PR_FALSE;
nsIDOMNode* nsAccEvent::gLastEventNodeWeak = 0;
NS_IMPL_ISUPPORTS1(nsAccEvent, nsIAccessibleEvent)
nsAccEvent::nsAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible,
- void *aEventData, PRBool aIsAsynch):
- mEventType(aEventType), mAccessible(aAccessible), mEventData(aEventData)
+ PRBool aIsAsynch):
+ mEventType(aEventType), mAccessible(aAccessible)
{
CaptureIsFromUserInput(aIsAsynch);
}
nsAccEvent::nsAccEvent(PRUint32 aEventType, nsIDOMNode *aDOMNode,
- void *aEventData, PRBool aIsAsynch):
- mEventType(aEventType), mDOMNode(aDOMNode), mEventData(aEventData)
+ PRBool aIsAsynch):
+ mEventType(aEventType), mDOMNode(aDOMNode)
{
CaptureIsFromUserInput(aIsAsynch);
}
void nsAccEvent::GetLastEventAttributes(nsIDOMNode *aNode,
nsIPersistentProperties *aAttributes)
{
if (aNode == gLastEventNodeWeak) {
@@ -269,34 +269,34 @@ nsAccEvent::GetAccessibleByNode()
// nsAccStateChangeEvent
NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
nsIAccessibleStateChangeEvent)
nsAccStateChangeEvent::
nsAccStateChangeEvent(nsIAccessible *aAccessible,
PRUint32 aState, PRBool aIsExtraState,
PRBool aIsEnabled):
- nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible, nsnull),
+ nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible),
mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
{
}
nsAccStateChangeEvent::
nsAccStateChangeEvent(nsIDOMNode *aNode,
PRUint32 aState, PRBool aIsExtraState,
PRBool aIsEnabled):
- nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode, nsnull),
+ nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
{
}
nsAccStateChangeEvent::
nsAccStateChangeEvent(nsIDOMNode *aNode,
PRUint32 aState, PRBool aIsExtraState):
- nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode, nsnull),
+ nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
mState(aState), mIsExtraState(aIsExtraState)
{
// Use GetAccessibleByNode() because we do not want to store an accessible
// since it leads to problems with delayed events in the case when
// an accessible gets reorder event before delayed event is processed.
nsCOMPtr<nsIAccessible> accessible(GetAccessibleByNode());
if (accessible) {
PRUint32 state = 0, extraState = 0;
@@ -332,17 +332,17 @@ nsAccStateChangeEvent::IsEnabled(PRBool
// nsAccTextChangeEvent
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
nsIAccessibleTextChangeEvent)
nsAccTextChangeEvent::
nsAccTextChangeEvent(nsIAccessible *aAccessible,
PRInt32 aStart, PRUint32 aLength, PRBool aIsInserted, PRBool aIsAsynch):
nsAccEvent(aIsInserted ? nsIAccessibleEvent::EVENT_TEXT_INSERTED : nsIAccessibleEvent::EVENT_TEXT_REMOVED,
- aAccessible, nsnull, aIsAsynch),
+ aAccessible, aIsAsynch),
mStart(aStart), mLength(aLength), mIsInserted(aIsInserted)
{
nsCOMPtr<nsIAccessibleText> textAccessible = do_QueryInterface(aAccessible);
NS_ASSERTION(textAccessible, "Should not be firing test change event for non-text accessible!!!");
if (textAccessible) {
textAccessible->GetText(aStart, aStart + aLength, mModifiedText);
}
}
@@ -376,29 +376,59 @@ nsAccTextChangeEvent::GetModifiedText(ns
}
// nsAccCaretMoveEvent
NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
nsIAccessibleCaretMoveEvent)
nsAccCaretMoveEvent::
nsAccCaretMoveEvent(nsIAccessible *aAccessible, PRInt32 aCaretOffset) :
- nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible, nsnull, PR_TRUE), // Currently always asynch
+ nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible, PR_TRUE), // Currently always asynch
mCaretOffset(aCaretOffset)
{
}
nsAccCaretMoveEvent::
nsAccCaretMoveEvent(nsIDOMNode *aNode) :
- nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode, nsnull, PR_TRUE), // Currently always asynch
+ nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode, PR_TRUE), // Currently always asynch
mCaretOffset(-1)
{
}
NS_IMETHODIMP
nsAccCaretMoveEvent::GetCaretOffset(PRInt32* aCaretOffset)
{
NS_ENSURE_ARG_POINTER(aCaretOffset);
*aCaretOffset = mCaretOffset;
return NS_OK;
}
+// nsAccTableChangeEvent
+NS_IMPL_ISUPPORTS_INHERITED1(nsAccTableChangeEvent, nsAccEvent,
+ nsIAccessibleTableChangeEvent)
+
+nsAccTableChangeEvent::
+ nsAccTableChangeEvent(nsIAccessible *aAccessible, PRUint32 aEventType,
+ PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols, PRBool aIsAsynch):
+ nsAccEvent(aEventType, aAccessible, aIsAsynch),
+ mRowOrColIndex(aRowOrColIndex), mNumRowsOrCols(aNumRowsOrCols)
+{
+}
+
+NS_IMETHODIMP
+nsAccTableChangeEvent::GetRowOrColIndex(PRInt32* aRowOrColIndex)
+{
+ NS_ENSURE_ARG_POINTER(aRowOrColIndex);
+
+ *aRowOrColIndex = mRowOrColIndex;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccTableChangeEvent::GetNumRowsOrCols(PRInt32* aNumRowsOrCols)
+{
+ NS_ENSURE_ARG_POINTER(aNumRowsOrCols);
+
+ *aNumRowsOrCols = mNumRowsOrCols;
+ return NS_OK;
+}
+
--- a/accessible/src/base/nsAccessibleEventData.h
+++ b/accessible/src/base/nsAccessibleEventData.h
@@ -49,26 +49,26 @@
#include "nsString.h"
class nsIPresShell;
class nsAccEvent: public nsIAccessibleEvent
{
public:
// Initialize with an nsIAccessible
- nsAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible, void *aEventData, PRBool aIsAsynch = PR_FALSE);
+ nsAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible, PRBool aIsAsynch = PR_FALSE);
// Initialize with an nsIDOMNode
- nsAccEvent(PRUint32 aEventType, nsIDOMNode *aDOMNode, void *aEventData, PRBool aIsAsynch = PR_FALSE);
+ nsAccEvent(PRUint32 aEventType, nsIDOMNode *aDOMNode, PRBool aIsAsynch = PR_FALSE);
virtual ~nsAccEvent() {}
NS_DECL_ISUPPORTS
NS_DECL_NSIACCESSIBLEEVENT
static void GetLastEventAttributes(nsIDOMNode *aNode,
- nsIPersistentProperties *aAttributes);
+ nsIPersistentProperties *aAttributes);
protected:
already_AddRefed<nsIAccessible> GetAccessibleByNode();
void CaptureIsFromUserInput(PRBool aIsAsynch);
PRBool mIsFromUserInput;
private:
@@ -91,18 +91,16 @@ public:
PRBool aForceIsFromUserInput = PR_FALSE);
/**
* The input state was previously stored with the nsIAccessibleEvent,
* so use that state now -- call this when about to flush an event that
* was waiting in an event queue
*/
static void PrepareForEvent(nsIAccessibleEvent *aEvent);
-
- void *mEventData;
};
class nsAccStateChangeEvent: public nsAccEvent,
public nsIAccessibleStateChangeEvent
{
public:
nsAccStateChangeEvent(nsIAccessible *aAccessible,
PRUint32 aState, PRBool aIsExtraState,
@@ -153,18 +151,26 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_NSIACCESSIBLEEVENT(nsAccEvent::)
NS_DECL_NSIACCESSIBLECARETMOVEEVENT
private:
PRInt32 mCaretOffset;
};
-// XXX todo: We might want to use XPCOM interfaces instead of struct
-// e.g., nsAccessibleTableChangeEvent: public nsIAccessibleTableChangeEvent
+class nsAccTableChangeEvent : public nsAccEvent,
+ public nsIAccessibleTableChangeEvent {
+public:
+ nsAccTableChangeEvent(nsIAccessible *aAccessible, PRUint32 aEventType,
+ PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols,
+ PRBool aIsAsynch);
-struct AtkTableChange {
- PRUint32 index; // the start row/column after which the rows are inserted/deleted.
- PRUint32 count; // the number of inserted/deleted rows/columns
+ NS_DECL_ISUPPORTS
+ NS_FORWARD_NSIACCESSIBLEEVENT(nsAccEvent::)
+ NS_DECL_NSIACCESSIBLETABLECHANGEEVENT
+
+private:
+ PRUint32 mRowOrColIndex; // the start row/column after which the rows are inserted/deleted.
+ PRUint32 mNumRowsOrCols; // the number of inserted/deleted rows/columns
};
#endif
--- a/accessible/src/base/nsBaseWidgetAccessible.cpp
+++ b/accessible/src/base/nsBaseWidgetAccessible.cpp
@@ -141,23 +141,28 @@ nsLinkableAccessible::GetState(PRUint32
*aState |= nsIAccessibleStates::STATE_TRAVERSED;
}
}
}
return NS_OK;
}
-NS_IMETHODIMP nsLinkableAccessible::GetValue(nsAString& _retval)
+NS_IMETHODIMP nsLinkableAccessible::GetValue(nsAString& aValue)
{
+ aValue.Truncate();
+ nsHyperTextAccessible::GetValue(aValue);
+ if (!aValue.IsEmpty())
+ return NS_OK;
+
if (mIsLink) {
nsCOMPtr<nsIDOMNode> linkNode(do_QueryInterface(mActionContent));
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
if (linkNode && presShell)
- return presShell->GetLinkLocation(linkNode, _retval);
+ return presShell->GetLinkLocation(linkNode, aValue);
}
return NS_ERROR_NOT_IMPLEMENTED;
}
/* PRUint8 getAccNumActions (); */
NS_IMETHODIMP nsLinkableAccessible::GetNumActions(PRUint8 *aNumActions)
{
--- a/accessible/src/base/nsCaretAccessible.cpp
+++ b/accessible/src/base/nsCaretAccessible.cpp
@@ -83,16 +83,20 @@ nsresult nsCaretAccessible::ClearControl
mCurrentControlSelection = nsnull;
mCurrentControl = nsnull;
return selPrivate->RemoveSelectionListener(this);
}
nsresult nsCaretAccessible::SetControlSelectionListener(nsIDOMNode *aCurrentNode)
{
+ NS_ENSURE_TRUE(mRootAccessible, NS_ERROR_FAILURE);
+
+ ClearControlSelectionListener();
+
mCurrentControl = aCurrentNode;
mLastTextAccessible = nsnull;
// When focus moves such that the caret is part of a new frame selection
// this removes the old selection listener and attaches a new one for the current focus
nsCOMPtr<nsIPresShell> presShell =
mRootAccessible->GetPresShellFor(aCurrentNode);
if (!presShell)
@@ -116,26 +120,27 @@ nsresult nsCaretAccessible::SetControlSe
nsCOMPtr<nsISelectionController> selCon;
frame->GetSelectionController(presContext, getter_AddRefs(selCon));
NS_ENSURE_TRUE(selCon, NS_ERROR_FAILURE);
nsCOMPtr<nsISelection> domSel;
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
- ClearControlSelectionListener();
nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(domSel));
NS_ENSURE_TRUE(selPrivate, NS_ERROR_FAILURE);
mCurrentControlSelection = do_GetWeakReference(domSel);
return selPrivate->AddSelectionListener(this);
}
nsresult nsCaretAccessible::AddDocSelectionListener(nsIDOMDocument *aDoc)
{
+ NS_ENSURE_TRUE(mRootAccessible, NS_ERROR_FAILURE);
+
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc);
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsCOMPtr<nsISelectionController> selCon = do_QueryInterface(doc->GetPrimaryShell());
NS_ENSURE_TRUE(selCon, NS_ERROR_FAILURE);
nsCOMPtr<nsISelection> domSel;
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
nsCOMPtr<nsISelectionPrivate> selPrivate = do_QueryInterface(domSel);
@@ -166,17 +171,17 @@ NS_IMETHODIMP nsCaretAccessible::NotifyS
mLastUsedSelection = do_GetWeakReference(aSel);
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc);
NS_ENSURE_TRUE(doc, NS_OK);
nsIPresShell *presShell = doc->GetPrimaryShell();
NS_ENSURE_TRUE(presShell, NS_OK);
- // Get first nnsIAccessibleText in parent chain and fire caret-move, selection-change event for it
+ // Get first nsIAccessibleText in parent chain and fire caret-move, selection-change event for it
nsCOMPtr<nsIAccessible> accessible;
nsIAccessibilityService *accService = mRootAccessible->GetAccService();
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
// Get accessible from selection's focus node or its parent
nsCOMPtr<nsIDOMNode> focusNode;
aSel->GetFocusNode(getter_AddRefs(focusNode));
if (!focusNode) {
mLastTextAccessible = nsnull;
@@ -243,16 +248,17 @@ NS_IMETHODIMP nsCaretAccessible::NotifyS
}
nsRect
nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
{
nsRect caretRect;
NS_ENSURE_TRUE(aOutWidget, caretRect);
*aOutWidget = nsnull;
+ NS_ENSURE_TRUE(mRootAccessible, caretRect);
if (!mLastTextAccessible) {
return caretRect; // Return empty rect
}
nsCOMPtr<nsIAccessNode> lastAccessNode(do_QueryInterface(mLastTextAccessible));
NS_ENSURE_TRUE(lastAccessNode, caretRect);
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -686,16 +686,17 @@ nsresult nsDocAccessible::RemoveEventLis
RemoveScrollListener();
// Remove document observer
mDocument->RemoveObserver(this);
if (mScrollWatchTimer) {
mScrollWatchTimer->Cancel();
mScrollWatchTimer = nsnull;
+ NS_RELEASE_THIS(); // Kung fu death grip
}
nsRefPtr<nsRootAccessible> rootAccessible(GetRootAccessible());
if (rootAccessible) {
nsRefPtr<nsCaretAccessible> caretAccessible = rootAccessible->GetCaretAccessible();
if (caretAccessible) {
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(mDocument);
caretAccessible->RemoveDocSelectionListener(domDoc);
@@ -822,16 +823,17 @@ void nsDocAccessible::ScrollTimerCallbac
// Therefore, we wait for no scroll events to occur between 2 ticks of this timer
// That indicates a pause in scrolling, so we fire the accessibilty scroll event
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SCROLLING_END, docAcc);
docAcc->mScrollPositionChangedTicks = 0;
if (docAcc->mScrollWatchTimer) {
docAcc->mScrollWatchTimer->Cancel();
docAcc->mScrollWatchTimer = nsnull;
+ NS_RELEASE(docAcc); // Release kung fu death grip
}
}
}
void nsDocAccessible::AddScrollListener()
{
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
@@ -874,16 +876,17 @@ NS_IMETHODIMP nsDocAccessible::ScrollPos
// then the ::Notify() method will fire the accessibility event for scroll position changes
const PRUint32 kScrollPosCheckWait = 50;
if (mScrollWatchTimer) {
mScrollWatchTimer->SetDelay(kScrollPosCheckWait); // Create new timer, to avoid leaks
}
else {
mScrollWatchTimer = do_CreateInstance("@mozilla.org/timer;1");
if (mScrollWatchTimer) {
+ NS_ADDREF_THIS(); // Kung fu death grip
mScrollWatchTimer->InitWithFuncCallback(ScrollTimerCallback, this,
kScrollPosCheckWait,
nsITimer::TYPE_REPEATING_SLACK);
}
}
mScrollPositionChangedTicks = 1;
return NS_OK;
}
@@ -1025,29 +1028,29 @@ nsDocAccessible::AttributeChangedImpl(ns
// Need to find the right event to use here, SELECTION_WITHIN would
// seem right but we had started using it for something else
nsCOMPtr<nsIAccessNode> multiSelectAccessNode =
do_QueryInterface(multiSelect);
nsCOMPtr<nsIDOMNode> multiSelectDOMNode;
multiSelectAccessNode->GetDOMNode(getter_AddRefs(multiSelectDOMNode));
NS_ASSERTION(multiSelectDOMNode, "A new accessible without a DOM node!");
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
- multiSelectDOMNode, nsnull, eAllowDupes);
+ multiSelectDOMNode, eAllowDupes);
static nsIContent::AttrValuesArray strings[] =
{&nsAccessibilityAtoms::_empty, &nsAccessibilityAtoms::_false, nsnull};
if (aContent->FindAttrValueIn(kNameSpaceID_None, aAttribute,
strings, eCaseMatters) >= 0) {
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_SELECTION_REMOVE,
- targetNode, nsnull);
+ targetNode);
return;
}
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_SELECTION_ADD,
- targetNode, nsnull);
+ targetNode);
}
}
if (aAttribute == nsAccessibilityAtoms::contenteditable) {
nsCOMPtr<nsIAccessibleStateChangeEvent> editableChangeEvent =
new nsAccStateChangeEvent(targetNode,
nsIAccessibleStates::EXT_STATE_EDITABLE,
PR_TRUE);
@@ -1147,17 +1150,17 @@ nsDocAccessible::ARIAAttributeChanged(ns
nsIAccessibleStates::STATE_READONLY,
PR_FALSE);
FireDelayedAccessibleEvent(event);
return;
}
if (aAttribute == nsAccessibilityAtoms::aria_valuenow) {
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
- targetNode, nsnull);
+ targetNode);
return;
}
if (aAttribute == nsAccessibilityAtoms::aria_multiselectable &&
aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::role)) {
// This affects whether the accessible supports nsIAccessibleSelectable.
// COM says we cannot change what interfaces are supported on-the-fly,
// so invalidate this object. A new one will be created on demand.
@@ -1376,22 +1379,21 @@ nsDocAccessible::CreateTextChangeEventFo
new nsAccTextChangeEvent(aContainerAccessible, offset, length, aIsInserting, aIsAsynch);
NS_IF_ADDREF(event);
return event;
}
nsresult nsDocAccessible::FireDelayedToolkitEvent(PRUint32 aEvent,
nsIDOMNode *aDOMNode,
- void *aData,
EDupeEventRule aAllowDupes,
PRBool aIsAsynch)
{
nsCOMPtr<nsIAccessibleEvent> event =
- new nsAccEvent(aEvent, aDOMNode, aData, PR_TRUE);
+ new nsAccEvent(aEvent, aDOMNode, PR_TRUE);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
return FireDelayedAccessibleEvent(event, aAllowDupes, aIsAsynch);
}
nsresult
nsDocAccessible::FireDelayedAccessibleEvent(nsIAccessibleEvent *aEvent,
EDupeEventRule aAllowDupes,
@@ -1617,88 +1619,103 @@ void nsDocAccessible::FlushEventsCallbac
// A lot of crashes were happening here, so now we're reffing the doc
// now until the events are flushed
accessibleDoc->FlushPendingEvents();
}
}
void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode)
{
+ if (mAccessNodeCache.Count() <= 1) {
+ return; // All we have is a doc accessible. There is nothing to invalidate, quit early
+ }
+
nsCOMPtr<nsIAccessNode> accessNode;
GetCachedAccessNode(aStartNode, getter_AddRefs(accessNode));
- nsCOMPtr<nsIDOMNode> nextNode, iterNode;
// Shut down accessible subtree, which may have been created for
// anonymous content subtree
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(accessNode));
if (accessible) {
+ // Fire menupopup end if a menu goes away
+ PRUint32 role = Role(accessible);
+ if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
+ nsCOMPtr<nsIDOMNode> domNode;
+ accessNode->GetDOMNode(getter_AddRefs(domNode));
+ nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(domNode));
+ if (!popup) {
+ // Popup elements already fire these via DOMMenuInactive
+ // handling in nsRootAccessible::HandleEvent
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
+ accessible);
+ }
+ }
nsCOMPtr<nsPIAccessible> privateAccessible = do_QueryInterface(accessible);
NS_ASSERTION(privateAccessible, "No nsPIAccessible for nsIAccessible");
nsCOMPtr<nsIAccessible> childAccessible;
// we only need to shutdown the accessibles here if one of them has been created
privateAccessible->GetCachedFirstChild(getter_AddRefs(childAccessible));
if (childAccessible) {
nsCOMPtr<nsIArray> children;
// use GetChildren() to fetch children at one time, instead of using
// GetNextSibling(), because after we shutdown the first child,
// mNextSibling will be set null.
accessible->GetChildren(getter_AddRefs(children));
PRUint32 childCount;
children->GetLength(&childCount);
+ nsCOMPtr<nsIDOMNode> possibleAnonNode;
for (PRUint32 index = 0; index < childCount; index++) {
nsCOMPtr<nsIAccessNode> childAccessNode;
children->QueryElementAt(index, NS_GET_IID(nsIAccessNode),
getter_AddRefs(childAccessNode));
- childAccessNode->GetDOMNode(getter_AddRefs(iterNode));
- nsCOMPtr<nsIContent> iterContent = do_QueryInterface(iterNode);
+ childAccessNode->GetDOMNode(getter_AddRefs(possibleAnonNode));
+ nsCOMPtr<nsIContent> iterContent = do_QueryInterface(possibleAnonNode);
if (iterContent && (iterContent->IsNativeAnonymous() ||
iterContent->GetBindingParent())) {
// GetBindingParent() check is a perf win -- make sure we don't
// shut down the same subtree twice since we'll reach non-anon content via
// DOM traversal later in this method
- RefreshNodes(iterNode);
+ RefreshNodes(possibleAnonNode);
}
}
}
+ }
- // Shutdown ordinary content subtree as well -- there may be
- // access node children which are not full accessible objects
- aStartNode->GetFirstChild(getter_AddRefs(nextNode));
- while (nextNode) {
- nextNode.swap(iterNode);
- RefreshNodes(iterNode);
- iterNode->GetNextSibling(getter_AddRefs(nextNode));
- }
+ // Shutdown ordinary content subtree as well -- there may be
+ // access node children which are not full accessible objects
+ nsCOMPtr<nsIDOMNode> nextNode, iterNode;
+ aStartNode->GetFirstChild(getter_AddRefs(nextNode));
+ while (nextNode) {
+ nextNode.swap(iterNode);
+ RefreshNodes(iterNode);
+ iterNode->GetNextSibling(getter_AddRefs(nextNode));
+ }
+
+ if (!accessNode)
+ return;
- // Don't shutdown our doc object!
- if (accessNode && accessNode != static_cast<nsIAccessNode*>(this)) {
- // Fire menupopup end if a menu goes away
- PRUint32 role = Role(accessible);
- if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
- nsCOMPtr<nsIDOMNode> domNode;
- accessNode->GetDOMNode(getter_AddRefs(domNode));
- nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(domNode));
- if (!popup) {
- // Popup elements already fire these via DOMMenuInactive
- // handling in nsRootAccessible::HandleEvent
- nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
- accessible);
- }
- }
- // Shut down the actual accessible or access node
- void *uniqueID;
- accessNode->GetUniqueID(&uniqueID);
- nsCOMPtr<nsPIAccessNode> privateAccessNode(do_QueryInterface(accessNode));
- privateAccessNode->Shutdown();
- // Remove from hash table as well
- mAccessNodeCache.Remove(uniqueID);
- }
+ if (accessNode == this) {
+ // Don't shutdown our doc object -- this may just be from the finished loading.
+ // We will completely shut it down when the pagehide event is received
+ // However, we must invalidate the doc accessible's children in order to be sure
+ // all pointers to them are correct
+ InvalidateChildren();
+ return;
}
+
+ // Shut down the actual accessible or access node
+ void *uniqueID;
+ accessNode->GetUniqueID(&uniqueID);
+ nsCOMPtr<nsPIAccessNode> privateAccessNode(do_QueryInterface(accessNode));
+ privateAccessNode->Shutdown();
+
+ // Remove from hash table as well
+ mAccessNodeCache.Remove(uniqueID);
}
NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
PRUint32 aChangeEventType)
{
PRBool isHiding =
aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
aChangeEventType == nsIAccessibleEvent::EVENT_DOM_DESTROY;
@@ -1737,47 +1754,39 @@ NS_IMETHODIMP nsDocAccessible::Invalidat
// doc accessible. In this case we optimize
// by not firing SHOW/HIDE/REORDER events for every document mutation
// caused by page load, since AT is not going to want to grab the
// document and listen to these changes until after the page is first loaded
// Leave early, and ensure mAccChildCount stays uninitialized instead of 0,
// which it is if anyone asks for its children right now.
return InvalidateChildren();
}
- if (aChangeEventType == nsIAccessibleEvent::EVENT_DOM_CREATE) {
- nsIEventStateManager *esm = presShell->GetPresContext()->EventStateManager();
- NS_ENSURE_TRUE(esm, NS_ERROR_FAILURE);
- if (!esm->IsHandlingUserInputExternal()) {
- // Adding content during page load, but not caused by user input
- // Just invalidate accessible hierarchy and return,
- // otherwise the page load time slows down way too much
- nsCOMPtr<nsIAccessible> containerAccessible;
- GetAccessibleInParentChain(childNode, PR_FALSE, getter_AddRefs(containerAccessible));
- if (!containerAccessible) {
- containerAccessible = this;
- }
- nsCOMPtr<nsPIAccessible> privateContainer = do_QueryInterface(containerAccessible);
- return privateContainer->InvalidateChildren();
- }
- // else: user input, so we must fall through and for full handling,
- // e.g. fire the mutation events. Note: user input could cause DOM_CREATE
- // during page load if user typed into an input field or contentEditable area
- }
+ nsIEventStateManager *esm = presShell->GetPresContext()->EventStateManager();
+ NS_ENSURE_TRUE(esm, NS_ERROR_FAILURE);
+ if (!esm->IsHandlingUserInputExternal()) {
+ // Changes during page load, but not caused by user input
+ // Just invalidate accessible hierarchy and return,
+ // otherwise the page load time slows down way too much
+ nsCOMPtr<nsIAccessible> containerAccessible;
+ GetAccessibleInParentChain(childNode, PR_FALSE, getter_AddRefs(containerAccessible));
+ if (!containerAccessible) {
+ containerAccessible = this;
+ }
+ nsCOMPtr<nsPIAccessible> privateContainer = do_QueryInterface(containerAccessible);
+ return privateContainer->InvalidateChildren();
+ }
+ // else: user input, so we must fall through and for full handling,
+ // e.g. fire the mutation events. Note: user input could cause DOM_CREATE
+ // during page load if user typed into an input field or contentEditable area
}
// Update last change state information
nsCOMPtr<nsIAccessNode> childAccessNode;
GetCachedAccessNode(childNode, getter_AddRefs(childAccessNode));
nsCOMPtr<nsIAccessible> childAccessible = do_QueryInterface(childAccessNode);
- if (!childAccessible && !isHiding) {
- // If not about to hide it, make sure there's an accessible so we can fire an
- // event for it
- GetAccService()->GetAttachedAccessibleFor(childNode,
- getter_AddRefs(childAccessible));
- }
#ifdef DEBUG_A11Y
nsAutoString localName;
childNode->GetLocalName(localName);
const char *hasAccessible = childAccessible ? " (acc)" : "";
if (aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE) {
printf("[Hide %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
}
@@ -1865,32 +1874,32 @@ NS_IMETHODIMP nsDocAccessible::Invalidat
}
// Fire EVENT_SHOW, EVENT_MENUPOPUP_START for newly visible content.
// Fire after a short timer, because we want to make sure the view has been
// updated to make this accessible content visible. If we don't wait,
// the assistive technology may receive the event and then retrieve
// nsIAccessibleStates::STATE_INVISIBLE for the event's accessible object.
PRUint32 additionEvent = isAsynch ? nsIAccessibleEvent::EVENT_ASYNCH_SHOW :
nsIAccessibleEvent::EVENT_DOM_CREATE;
- FireDelayedToolkitEvent(additionEvent, childNode, nsnull,
+ FireDelayedToolkitEvent(additionEvent, childNode,
eCoalesceFromSameSubtree, isAsynch);
// Check to see change occured in an ARIA menu, and fire an EVENT_MENUPOPUP_START if it did
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(childNode);
if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_MENUPOPUP) {
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START,
- childNode, nsnull, eAllowDupes, isAsynch);
+ childNode, eAllowDupes, isAsynch);
}
// Check to see if change occured inside an alert, and fire an EVENT_ALERT if it did
nsIContent *ancestor = aChild;
while (PR_TRUE) {
if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_ALERT) {
nsCOMPtr<nsIDOMNode> alertNode(do_QueryInterface(ancestor));
- FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_ALERT, alertNode, nsnull,
+ FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_ALERT, alertNode,
eRemoveDupes, isAsynch);
break;
}
ancestor = ancestor->GetParent();
nsCOMPtr<nsIDOMNode> ancestorNode = do_QueryInterface(ancestor);
if (!ancestorNode) {
break;
}
@@ -1899,17 +1908,17 @@ NS_IMETHODIMP nsDocAccessible::Invalidat
}
if (!isShowing) {
// Fire an event so the assistive technology knows the children have changed
// This is only used by older MSAA clients. Newer ones should derive this
// from SHOW and HIDE so that they don't fetch extra objects
if (childAccessible) {
nsCOMPtr<nsIAccessibleEvent> reorderEvent =
- new nsAccEvent(nsIAccessibleEvent::EVENT_REORDER, containerAccessible, nsnull, PR_TRUE);
+ new nsAccEvent(nsIAccessibleEvent::EVENT_REORDER, containerAccessible, PR_TRUE);
NS_ENSURE_TRUE(reorderEvent, NS_ERROR_OUT_OF_MEMORY);
FireDelayedAccessibleEvent(reorderEvent, eCoalesceFromSameSubtree, isAsynch);
}
}
return NS_OK;
}
@@ -1975,17 +1984,17 @@ nsDocAccessible::FireShowHideEvents(nsID
if (accessible) {
// Found an accessible, so fire the show/hide on it and don't
// look further into this subtree
PRBool isAsynch = aEventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
aEventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW;
nsCOMPtr<nsIAccessibleEvent> event =
- new nsAccEvent(aEventType, accessible, nsnull, isAsynch);
+ new nsAccEvent(aEventType, accessible, isAsynch);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
if (aForceIsFromUserInput) {
nsAccEvent::PrepareForEvent(aDOMNode, aForceIsFromUserInput);
}
if (aDelay) {
return FireDelayedAccessibleEvent(event, eCoalesceFromSameSubtree, isAsynch);
}
return FireAccessibleEvent(event);
--- a/accessible/src/base/nsDocAccessible.h
+++ b/accessible/src/base/nsDocAccessible.h
@@ -103,28 +103,27 @@ class nsDocAccessible : public nsHyperTe
enum EDupeEventRule { eAllowDupes, eCoalesceFromSameSubtree, eRemoveDupes };
/**
* Non-virtual method to fire a delayed event after a 0 length timeout
*
* @param aEvent - the nsIAccessibleEvent event type
* @param aDOMNode - DOM node the accesible event should be fired for
- * @param aData - any additional data for the event
* @param aAllowDupes - eAllowDupes: more than one event of the same type is allowed.
* eCoalesceFromSameSubtree: if two events are in the same subtree,
* only the event on ancestor is used
* eRemoveDupes (default): events of the same type are discarded
* (the last one is used)
*
* @param aIsAsyn - set to PR_TRUE if this is not being called from code
* synchronous with a DOM event
*/
nsresult FireDelayedToolkitEvent(PRUint32 aEvent, nsIDOMNode *aDOMNode,
- void *aData, EDupeEventRule aAllowDupes = eRemoveDupes,
+ EDupeEventRule aAllowDupes = eRemoveDupes,
PRBool aIsAsynch = PR_FALSE);
/**
* Fire accessible event in timeout.
*
* @param aEvent - the event to fire
* @param aAllowDupes - if false then delayed events of the same type and
* for the same DOM node in the event queue won't
--- a/accessible/src/base/nsOuterDocAccessible.cpp
+++ b/accessible/src/base/nsOuterDocAccessible.cpp
@@ -69,17 +69,17 @@ NS_IMETHODIMP nsOuterDocAccessible::GetN
}
}
return rv;
}
/* unsigned long getRole (); */
NS_IMETHODIMP nsOuterDocAccessible::GetRole(PRUint32 *aRole)
{
- *aRole = nsIAccessibleRole::ROLE_CLIENT;
+ *aRole = nsIAccessibleRole::ROLE_INTERNAL_FRAME;
return NS_OK;
}
NS_IMETHODIMP
nsOuterDocAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsAccessible::GetState(aState, aExtraState);
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
@@ -111,17 +111,17 @@ void nsOuterDocAccessible::CacheChildren
if (!mWeakShell) {
mAccChildCount = eChildCountUninitialized;
return; // This outer doc node has been shut down
}
if (mAccChildCount != eChildCountUninitialized) {
return;
}
- SetFirstChild(nsnull);
+ InvalidateChildren();
mAccChildCount = 0;
// In these variable names, "outer" relates to the nsOuterDocAccessible
// as opposed to the nsDocAccessibleWrap which is "inner".
// The outer node is a something like a <browser>, <frame>, <iframe>, <page> or
// <editor> tag, whereas the inner node corresponds to the inner document root.
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -425,17 +425,17 @@ void nsRootAccessible::TryFireEarlyLoadE
if (state & nsIAccessibleStates::STATE_BUSY) {
// Don't fire page load events on subdocuments for initial page load of entire page
return;
}
}
// No frames or iframes, so we can fire the doc load finished event early
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_INTERNAL_LOAD, aDocNode,
- nsnull, eRemoveDupes);
+ eRemoveDupes);
}
PRBool nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
nsIDOMNode *aNode,
nsIDOMEvent *aFocusEvent,
PRBool aForceEvent,
PRBool aIsAsynch)
{
@@ -514,17 +514,17 @@ PRBool nsRootAccessible::FireAccessibleF
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENU_START, menuBarAccessible);
}
}
}
}
}
else if (mCurrentARIAMenubar) {
nsCOMPtr<nsIAccessibleEvent> menuEndEvent =
- new nsAccEvent(nsIAccessibleEvent::EVENT_MENU_END, mCurrentARIAMenubar, nsnull, PR_FALSE);
+ new nsAccEvent(nsIAccessibleEvent::EVENT_MENU_END, mCurrentARIAMenubar, PR_FALSE);
if (menuEndEvent) {
FireDelayedAccessibleEvent(menuEndEvent, eAllowDupes, PR_FALSE);
}
mCurrentARIAMenubar = nsnull;
}
NS_IF_RELEASE(gLastFocusedNode);
gLastFocusedNode = finalFocusNode;
@@ -538,17 +538,17 @@ PRBool nsRootAccessible::FireAccessibleF
// Suppress document focus, because real DOM focus will be fired next,
// and that's what we care about
// Make sure we never fire focus for the nsRootAccessible (mDOMNode)
return PR_FALSE;
}
}
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_FOCUS,
- finalFocusNode, nsnull, eRemoveDupes, aIsAsynch);
+ finalFocusNode, eRemoveDupes, aIsAsynch);
return PR_TRUE;
}
void nsRootAccessible::FireCurrentFocusEvent()
{
nsCOMPtr<nsIDOMNode> focusedNode = GetCurrentFocus();
if (!focusedNode) {
@@ -592,16 +592,19 @@ NS_IMETHODIMP nsRootAccessible::HandleEv
nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
nsIDOMNode* aTargetNode)
{
nsAutoString eventType;
aEvent->GetType(eventType);
nsAutoString localName;
aTargetNode->GetLocalName(localName);
+#ifdef MOZ_XUL
+ PRBool isTree = localName.EqualsLiteral("tree");
+#endif
#ifdef DEBUG_A11Y
// Very useful for debugging, please leave this here.
if (eventType.EqualsLiteral("AlertActive")) {
printf("\ndebugging %s events for %s", NS_ConvertUTF16toUTF8(eventType).get(), NS_ConvertUTF16toUTF8(localName).get());
}
if (localName.LowerCaseEqualsLiteral("textbox")) {
printf("\ndebugging %s events for %s", NS_ConvertUTF16toUTF8(eventType).get(), NS_ConvertUTF16toUTF8(localName).get());
}
@@ -637,35 +640,75 @@ nsresult nsRootAccessible::HandleEventWi
if (eventType.EqualsLiteral("DOMContentLoaded")) {
// Don't create the doc accessible until load scripts have a chance to set
// role attribute for <body> or <html> element, because the value of
// role attribute will be cached when the doc accessible is Init()'d
TryFireEarlyLoadEvent(aTargetNode);
return NS_OK;
}
+#ifdef MOZ_XUL
if (eventType.EqualsLiteral("TreeViewChanged")) { // Always asynch, always from user input
- if (!localName.EqualsLiteral("tree"))
+ if (!isTree)
return NS_OK;
nsCOMPtr<nsIContent> treeContent = do_QueryInterface(aTargetNode);
nsAccEvent::PrepareForEvent(aTargetNode, PR_TRUE);
return accService->InvalidateSubtreeFor(eventShell, treeContent,
nsIAccessibleEvent::EVENT_ASYNCH_SIGNIFICANT_CHANGE);
}
+#endif
+
+ if (eventType.EqualsLiteral("popuphiding")) {
+ // If accessible focus was on or inside popup that closes,
+ // then restore it to true current focus.
+ // This is the case when we've been getting DOMMenuItemActive events
+ // inside of a combo box that closes. The real focus is on the combo box.
+ // It's also the case when a popup gets focus in ATK -- when it closes
+ // we need to fire an event to restore focus to where it was
+ if (!gLastFocusedNode) {
+ return NS_OK;
+ }
+ if (gLastFocusedNode != aTargetNode) {
+ // Was not focused on popup
+ nsCOMPtr<nsIDOMNode> parentOfFocus;
+ gLastFocusedNode->GetParentNode(getter_AddRefs(parentOfFocus));
+ if (parentOfFocus != aTargetNode) {
+ return NS_OK; // And was not focused on an item inside the popup
+ }
+ }
+ // Focus was on or inside of a popup that's being hidden
+ FireCurrentFocusEvent();
+ return NS_OK;
+ }
+
+ if (aTargetNode == mDOMNode && mDOMNode != gLastFocusedNode && eventType.EqualsLiteral("focus")) {
+ // Got focus event for the window, we will make sure that an accessible
+ // focus event for initial focus is fired. We do this on a short timer
+ // because the initial focus may not have been set yet.
+ if (!mFireFocusTimer) {
+ mFireFocusTimer = do_CreateInstance("@mozilla.org/timer;1");
+ }
+ if (mFireFocusTimer) {
+ mFireFocusTimer->InitWithFuncCallback(FireFocusCallback, this,
+ 0, nsITimer::TYPE_ONE_SHOT);
+ }
+ return NS_OK;
+ }
nsCOMPtr<nsIAccessible> accessible;
accService->GetAccessibleInShell(aTargetNode, eventShell,
getter_AddRefs(accessible));
nsCOMPtr<nsPIAccessible> privAcc(do_QueryInterface(accessible));
if (!privAcc)
return NS_OK;
+#ifdef MOZ_XUL
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
- if (!localName.EqualsLiteral("tree"))
+ if (!isTree)
return NS_OK;
nsCOMPtr<nsIDOMDataContainerEvent> dataEvent(do_QueryInterface(aEvent));
NS_ENSURE_STATE(dataEvent);
nsCOMPtr<nsIVariant> indexVariant;
dataEvent->GetData(NS_LITERAL_STRING("index"),
getter_AddRefs(indexVariant));
@@ -680,16 +723,17 @@ nsresult nsRootAccessible::HandleEventWi
indexVariant->GetAsInt32(&index);
countVariant->GetAsInt32(&count);
nsCOMPtr<nsIAccessibleTreeCache> treeAccCache(do_QueryInterface(accessible));
NS_ENSURE_STATE(treeAccCache);
return treeAccCache->InvalidateCache(index, count);
}
+#endif
if (eventType.EqualsLiteral("RadioStateChange")) {
PRUint32 state = State(accessible);
// radiogroup in prefWindow is exposed as a list,
// and panebutton is exposed as XULListitem in A11y.
// nsXULListitemAccessible::GetState uses STATE_SELECTED in this case,
// so we need to check nsIAccessibleStates::STATE_SELECTED also.
@@ -718,17 +762,17 @@ nsresult nsRootAccessible::HandleEventWi
PR_FALSE, isEnabled);
return privAcc->FireAccessibleEvent(accEvent);
}
nsCOMPtr<nsIAccessible> treeItemAccessible;
#ifdef MOZ_XUL
// If it's a tree element, need the currently selected item
- if (localName.EqualsLiteral("tree")) {
+ if (isTree) {
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelect =
do_QueryInterface(aTargetNode);
if (multiSelect) {
PRInt32 treeIndex = -1;
multiSelect->GetCurrentIndex(&treeIndex);
if (treeIndex >= 0) {
nsCOMPtr<nsIAccessibleTreeCache> treeCache(do_QueryInterface(accessible));
if (!treeCache ||
@@ -774,29 +818,16 @@ nsresult nsRootAccessible::HandleEventWi
return nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SELECTION,
treeItemAccessible);
}
}
else
#endif
if (eventType.EqualsLiteral("focus")) {
- if (aTargetNode == mDOMNode && mDOMNode != gLastFocusedNode) {
- // Got focus event for the window, we will make sure that an accessible
- // focus event for initial focus is fired. We do this on a short timer
- // because the initial focus may not have been set yet.
- if (!mFireFocusTimer) {
- mFireFocusTimer = do_CreateInstance("@mozilla.org/timer;1");
- }
- if (mFireFocusTimer) {
- mFireFocusTimer->InitWithFuncCallback(FireFocusCallback, this,
- 0, nsITimer::TYPE_ONE_SHOT);
- }
- }
-
// Keep a reference to the target node. We might want to change
// it to the individual radio button or selected item, and send
// the focus event to that.
nsCOMPtr<nsIDOMNode> focusedItem(aTargetNode);
if (!treeItemAccessible) {
nsCOMPtr<nsIDOMXULSelectControlElement> selectControl =
do_QueryInterface(aTargetNode);
@@ -842,46 +873,29 @@ nsresult nsRootAccessible::HandleEventWi
// AT's expect to get an EVENT_SHOW for the tooltip.
// In event callback the tooltip's accessible will be ready.
event = nsIAccessibleEvent::EVENT_ASYNCH_SHOW;
}
if (event) {
nsAccUtils::FireAccEvent(event, accessible);
}
}
-
- else if (eventType.EqualsLiteral("popuphiding")) {
- // If accessible focus was on or inside popup that closes,
- // then restore it to true current focus.
- // This is the case when we've been getting DOMMenuItemActive events
- // inside of a combo box that closes. The real focus is on the combo box.
- // It's also the case when a popup gets focus in ATK -- when it closes
- // we need to fire an event to restore focus to where it was
- if (!gLastFocusedNode) {
- return NS_OK;
- }
- if (gLastFocusedNode != aTargetNode) {
- // Was not focused on popup
- nsCOMPtr<nsIDOMNode> parentOfFocus;
- gLastFocusedNode->GetParentNode(getter_AddRefs(parentOfFocus));
- if (parentOfFocus != aTargetNode) {
- return NS_OK; // And was not focused on an item inside the popup
- }
- }
- // Focus was on or inside of a popup that's being hidden
- FireCurrentFocusEvent();
- }
else if (eventType.EqualsLiteral("DOMMenuInactive")) {
if (Role(accessible) == nsIAccessibleRole::ROLE_MENUPOPUP) {
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
accessible);
}
}
else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
if (!treeItemAccessible) {
+#ifdef MOZ_XUL
+ if (isTree) {
+ return NS_OK; // Tree with nothing selected
+ }
+#endif
nsCOMPtr<nsPIAccessNode> menuAccessNode = do_QueryInterface(accessible);
NS_ENSURE_TRUE(menuAccessNode, NS_ERROR_FAILURE);
nsIFrame* menuFrame = menuAccessNode->GetFrame();
NS_ENSURE_TRUE(menuFrame, NS_ERROR_FAILURE);
nsIMenuFrame* imenuFrame;
CallQueryInterface(menuFrame, &imenuFrame);
// QI failed for nsIMenuFrame means it's not on menu bar
if (imenuFrame && imenuFrame->IsOnMenuBar() &&
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -852,39 +852,32 @@ nsHTMLTableAccessible::GetTableNode(nsID
NS_IF_ADDREF(*_retval);
return rv;
}
return NS_ERROR_FAILURE;
}
nsresult
-nsHTMLTableAccessible::GetTableLayout(nsITableLayout **aLayoutObject)
+nsHTMLTableAccessible::GetTableLayout(nsITableLayout **aTableLayout)
{
- *aLayoutObject = nsnull;
-
- nsresult rv = NS_OK;
+ *aTableLayout = nsnull;
nsCOMPtr<nsIDOMNode> tableNode;
- rv = GetTableNode(getter_AddRefs(tableNode));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIContent> content(do_QueryInterface(tableNode));
- NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
+ GetTableNode(getter_AddRefs(tableNode));
+ nsCOMPtr<nsIContent> tableContent(do_QueryInterface(tableNode));
+ if (!tableContent) {
+ return NS_ERROR_FAILURE; // Table shut down
+ }
- nsIDocument *doc = content->GetDocument();
- NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
-
- nsIPresShell *presShell = doc->GetPrimaryShell();
+ nsCOMPtr<nsIPresShell> shell = GetPresShell();
+ NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
- nsCOMPtr<nsISupports> layoutObject;
- rv = presShell->GetLayoutObjectFor(content, getter_AddRefs(layoutObject));
- NS_ENSURE_SUCCESS(rv, rv);
-
- return CallQueryInterface(layoutObject, aLayoutObject);
+ nsIFrame *frame = shell->GetPrimaryFrameFor(tableContent);
+ return frame ? CallQueryInterface(frame, aTableLayout) : NS_ERROR_FAILURE;
}
nsresult
nsHTMLTableAccessible::GetCellAt(PRInt32 aRowIndex,
PRInt32 aColIndex,
nsIDOMElement* &aCell)
{
PRInt32 startRowIndex = 0, startColIndex = 0,
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -91,17 +91,20 @@ nsresult nsHyperTextAccessible::QueryInt
if (aIID.Equals(NS_GET_IID(nsHyperTextAccessible))) {
*aInstancePtr = static_cast<nsHyperTextAccessible*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
if (mRoleMapEntry &&
(mRoleMapEntry->role == nsIAccessibleRole::ROLE_GRAPHIC ||
- mRoleMapEntry->role == nsIAccessibleRole::ROLE_IMAGE_MAP)) {
+ mRoleMapEntry->role == nsIAccessibleRole::ROLE_IMAGE_MAP ||
+ mRoleMapEntry->role == nsIAccessibleRole::ROLE_SLIDER ||
+ mRoleMapEntry->role == nsIAccessibleRole::ROLE_PROGRESSBAR ||
+ mRoleMapEntry->role == nsIAccessibleRole::ROLE_SEPARATOR)) {
// ARIA roles that these interfaces are not appropriate for
return nsAccessible::QueryInterface(aIID, aInstancePtr);
}
if (aIID.Equals(NS_GET_IID(nsIAccessibleText))) {
*aInstancePtr = static_cast<nsIAccessibleText*>(this);
NS_ADDREF_THIS();
return NS_OK;
@@ -560,17 +563,20 @@ nsresult nsHyperTextAccessible::DOMPoint
PRInt32* aHyperTextOffset,
nsIAccessible **aFinalAccessible,
PRBool aIsEndOffset)
{
// Turn a DOM Node and offset into an offset into this hypertext.
// On failure, return null. On success, return the DOM node which contains the offset.
NS_ENSURE_ARG_POINTER(aHyperTextOffset);
*aHyperTextOffset = 0;
- NS_ENSURE_ARG_POINTER(aNode);
+
+ if (!aNode) {
+ return NS_ERROR_FAILURE;
+ }
if (aFinalAccessible) {
*aFinalAccessible = nsnull;
}
PRUint32 addTextOffset = 0;
nsCOMPtr<nsIDOMNode> findNode;
unsigned short nodeType;
@@ -614,16 +620,27 @@ nsresult nsHyperTextAccessible::DOMPoint
findNode = do_QueryInterface(parentContent); // Case #2: there are no children
}
}
// Get accessible for this findNode, or if that node isn't accessible, use the
// accessible for the next DOM node which has one (based on forward depth first search)
nsCOMPtr<nsIAccessible> descendantAccessible;
if (findNode) {
+ nsCOMPtr<nsIContent> findContent = do_QueryInterface(findNode);
+ if (findContent->IsNodeOfType(nsINode::eHTML) &&
+ findContent->NodeInfo()->Equals(nsAccessibilityAtoms::br)) {
+ nsIContent *parent = findContent->GetParent();
+ if (parent && parent->IsNativeAnonymous() && parent->GetChildCount() == 1) {
+ // This <br> is the only node in a text control, therefore it is the hacky
+ // "bogus node" used when there is no text in a control
+ *aHyperTextOffset = 0;
+ return NS_OK;
+ }
+ }
descendantAccessible = GetFirstAvailableAccessible(findNode);
}
// From the descendant, go up and get the immediate child of this hypertext
nsCOMPtr<nsIAccessible> childAccessible;
while (descendantAccessible) {
nsCOMPtr<nsIAccessible> parentAccessible;
descendantAccessible->GetParent(getter_AddRefs(parentAccessible));
if (this == parentAccessible) {
@@ -982,16 +999,23 @@ nsresult nsHyperTextAccessible::GetTextH
// For BOUNDARY_LINE_END, make sure we start of this line
startOffset = endOffset = finalStartOffset + (aBoundaryType == BOUNDARY_LINE_END);
nsCOMPtr<nsIAccessible> endAcc;
nsIFrame *endFrame = GetPosAndText(startOffset, endOffset, nsnull, nsnull,
nsnull, getter_AddRefs(endAcc));
if (!endFrame) {
return NS_ERROR_FAILURE;
}
+ if (endAcc && Role(endAcc) == nsIAccessibleRole::ROLE_STATICTEXT) {
+ // Static text like list bullets will ruin our forward calculation,
+ // since the caret cannot be in the static text. Start just after the static text.
+ startOffset = endOffset = finalStartOffset + (aBoundaryType == BOUNDARY_LINE_END) + TextLength(endAcc);
+ endFrame = GetPosAndText(startOffset, endOffset, nsnull, nsnull,
+ nsnull, getter_AddRefs(endAcc));
+ }
finalEndOffset = GetRelativeOffset(presShell, endFrame, endOffset, endAcc,
amount, eDirNext, needsStart);
NS_ENSURE_TRUE(endOffset >= 0, NS_ERROR_FAILURE);
if (finalEndOffset == aOffset) {
if (aType == eGetAt && amount == eSelectWord) {
// Fix word error for the first character in word: PeekOffset() will return the previous word when
// aOffset points to the first character of the word, but accessibility APIs want the current word
// that the first character is in
--- a/accessible/src/mac/nsRoleMap.h
+++ b/accessible/src/mac/nsRoleMap.h
@@ -47,17 +47,17 @@ static const NSString* AXRoles [] = {
NSAccessibilityMenuBarRole, // ROLE_MENUBAR. (irrelevant on OS X; the menubar will always be native and on the top of the screen.)
NSAccessibilityScrollBarRole, // ROLE_SCROLLBAR. we might need to make this its own mozAccessible, to support the children objects (valueindicator, down/up buttons).
NSAccessibilitySplitterRole, // ROLE_GRIP
NSAccessibilityUnknownRole, // ROLE_SOUND. unused on OS X
NSAccessibilityUnknownRole, // ROLE_CURSOR. unused on OS X
NSAccessibilityUnknownRole, // ROLE_CARET. unused on OS X
NSAccessibilityWindowRole, // ROLE_ALERT
NSAccessibilityWindowRole, // ROLE_WINDOW. irrelevant on OS X; all window a11y is handled by the system.
- @"AXWebArea", // ROLE_CLIENT
+ @"AXWebArea", // ROLE_INTERNAL_FRAME
NSAccessibilityMenuRole, // ROLE_MENUPOPUP. the parent of menuitems
NSAccessibilityMenuItemRole, // ROLE_MENUITEM.
@"AXHelpTag", // ROLE_TOOLTIP. 10.4+ only, so we re-define the constant.
NSAccessibilityGroupRole, // ROLE_APPLICATION. unused on OS X. the system will take care of this.
NSAccessibilityGroupRole, // ROLE_DOCUMENT
NSAccessibilityGroupRole, // ROLE_PANE
NSAccessibilityUnknownRole, // ROLE_CHART
NSAccessibilityWindowRole, // ROLE_DIALOG. there's a dialog subrole.
--- a/accessible/src/msaa/nsRoleMap.h
+++ b/accessible/src/msaa/nsRoleMap.h
@@ -90,18 +90,18 @@ static const WindowsRoleMapItem gWindows
{ ROLE_SYSTEM_CARET, ROLE_SYSTEM_CARET },
// nsIAccessibleRole::ROLE_ALERT
{ ROLE_SYSTEM_ALERT, ROLE_SYSTEM_ALERT },
// nsIAccessibleRole::ROLE_WINDOW
{ ROLE_SYSTEM_WINDOW, ROLE_SYSTEM_WINDOW },
- // nsIAccessibleRole::ROLE_CLIENT
- { USE_ROLE_STRING, IA2_ROLE_UNKNOWN},
+ // nsIAccessibleRole::ROLE_INTERNAL_FRAME
+ { USE_ROLE_STRING, IA2_ROLE_INTERNAL_FRAME},
// nsIAccessibleRole::ROLE_MENUPOPUP
{ ROLE_SYSTEM_MENUPOPUP, ROLE_SYSTEM_MENUPOPUP },
// nsIAccessibleRole::ROLE_MENUITEM
{ ROLE_SYSTEM_MENUITEM, ROLE_SYSTEM_MENUITEM },
// nsIAccessibleRole::ROLE_TOOLTIP
@@ -424,17 +424,17 @@ static const WindowsRoleMapItem gWindows
// nsIAccessibleRole::ROLE_IMAGE_MAP
{ ROLE_SYSTEM_GRAPHIC, ROLE_SYSTEM_GRAPHIC },
// nsIAccessibleRole::ROLE_OPTION
{ ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
// nsIAccessibleRole::ROLE_RICH_OPTION
- { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
+ { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
// nsIAccessibleRole::ROLE_LISTBOX
{ ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
// nsIAccessibleRole::ROLE_LAST_ENTRY
{ ROLE_WINDOWS_LAST_ENTRY, ROLE_WINDOWS_LAST_ENTRY }
};
--- a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
@@ -46,17 +46,17 @@ nsXFormsLabelAccessible::
{
}
NS_IMETHODIMP
nsXFormsLabelAccessible::GetRole(PRUint32 *aRole)
{
NS_ENSURE_ARG_POINTER(aRole);
- *aRole = nsIAccessibleRole::ROLE_STATICTEXT;
+ *aRole = nsIAccessibleRole::ROLE_LABEL;
return NS_OK;
}
NS_IMETHODIMP
nsXFormsLabelAccessible::GetName(nsAString& aName)
{
nsAutoString name;
nsresult rv = GetTextFromRelationID(nsAccessibilityAtoms::aria_labelledby, name);
--- a/accessible/src/xul/nsXULAlertAccessible.cpp
+++ b/accessible/src/xul/nsXULAlertAccessible.cpp
@@ -59,8 +59,16 @@ nsXULAlertAccessible::GetState(PRUint32
nsresult rv = nsAccessible::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
if (mDOMNode) {
*aState |= nsIAccessibleStates::STATE_ALERT_MEDIUM; // XUL has no markup for low, medium or high
}
return NS_OK;
}
+NS_IMETHODIMP
+nsXULAlertAccessible::GetName(nsAString& aName)
+{
+ // Screen readers need to read contents of alert, not the accessible name.
+ // If we have both some screen readers will read the alert twice.
+ aName.Truncate();
+ return NS_OK;
+}
--- a/accessible/src/xul/nsXULAlertAccessible.h
+++ b/accessible/src/xul/nsXULAlertAccessible.h
@@ -45,11 +45,12 @@
class nsXULAlertAccessible : public nsAccessibleWrap
{
public:
nsXULAlertAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
+ NS_IMETHOD GetName(nsAString& aName);
};
#endif
--- a/accessible/src/xul/nsXULMenuAccessible.cpp
+++ b/accessible/src/xul/nsXULMenuAccessible.cpp
@@ -481,17 +481,19 @@ nsXULMenuitemAccessible::GetDefaultKeyBi
NS_IMETHODIMP nsXULMenuitemAccessible::GetRole(PRUint32 *aRole)
{
nsCOMPtr<nsIDOMXULContainerElement> xulContainer(do_QueryInterface(mDOMNode));
if (xulContainer) {
*aRole = nsIAccessibleRole::ROLE_PARENT_MENUITEM;
return NS_OK;
}
- if (mParent && Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
+ nsCOMPtr<nsIAccessible> parent;
+ GetParent(getter_AddRefs(parent));
+ if (parent && Role(parent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
return NS_OK;
}
*aRole = nsIAccessibleRole::ROLE_MENUITEM;
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
if (!element)
return NS_ERROR_FAILURE;
@@ -711,24 +713,28 @@ nsXULMenupopupAccessible::GetName(nsAStr
}
NS_IMETHODIMP nsXULMenupopupAccessible::GetRole(PRUint32 *aRole)
{
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
if (!content) {
return NS_ERROR_FAILURE;
}
- if ((mParent && Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX) ||
- content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
- nsAccessibilityAtoms::autocomplete, eIgnoreCase)) {
- *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
+ nsCOMPtr<nsIAccessible> parent;
+ GetParent(getter_AddRefs(parent));
+ if (parent) {
+ // Some widgets like the search bar have several popups, owned by buttons
+ PRUint32 role = Role(parent);
+ if (role == nsIAccessibleRole::ROLE_COMBOBOX ||
+ role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
+ *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
+ return NS_OK;
+ }
}
- else {
- *aRole = nsIAccessibleRole::ROLE_MENUPOPUP;
- }
+ *aRole = nsIAccessibleRole::ROLE_MENUPOPUP;
return NS_OK;
}
// ------------------------ Menu Bar -----------------------------
nsXULMenubarAccessible::nsXULMenubarAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsAccessibleWrap(aDOMNode, aShell)
{
--- a/accessible/src/xul/nsXULSelectAccessible.cpp
+++ b/accessible/src/xul/nsXULSelectAccessible.cpp
@@ -36,16 +36,17 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsXULSelectAccessible.h"
#include "nsAccessibilityService.h"
#include "nsIContent.h"
#include "nsIDOMXULMenuListElement.h"
+#include "nsIDOMXULPopupElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIDOMXULTextboxElement.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsCaseTreatment.h"
////////////////////////////////////////////////////////////////////////////////
@@ -189,19 +190,30 @@ NS_IMETHODIMP nsXULListboxAccessible::Ge
nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
select->GetSelectedItem(getter_AddRefs(selectedItem));
if (selectedItem)
return selectedItem->GetLabel(_retval);
}
return NS_ERROR_FAILURE;
}
-NS_IMETHODIMP nsXULListboxAccessible::GetRole(PRUint32 *_retval)
+NS_IMETHODIMP nsXULListboxAccessible::GetRole(PRUint32 *aRole)
{
- *_retval = nsIAccessibleRole::ROLE_LIST;
+ nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
+ if (content) {
+ // A richlistbox is used with the new autocomplete URL bar,
+ // and has a parent popup <panel>
+ nsCOMPtr<nsIDOMXULPopupElement> xulPopup =
+ do_QueryInterface(content->GetParent());
+ if (xulPopup) {
+ *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
+ return NS_OK;
+ }
+ }
+ *aRole = nsIAccessibleRole::ROLE_LIST;
return NS_OK;
}
/** ----- nsXULListitemAccessible ----- */
/** Constructor */
nsXULListitemAccessible::nsXULListitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsXULMenuitemAccessible(aDOMNode, aShell)
@@ -245,16 +257,18 @@ NS_IMETHODIMP nsXULListitemAccessible::G
/**
*
*/
NS_IMETHODIMP nsXULListitemAccessible::GetRole(PRUint32 *aRole)
{
if (mIsCheckbox)
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
+ else if (mParent && Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
+ *aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
else
*aRole = nsIAccessibleRole::ROLE_RICH_OPTION;
return NS_OK;
}
/**
*
*/
--- a/accessible/src/xul/nsXULTextAccessible.cpp
+++ b/accessible/src/xul/nsXULTextAccessible.cpp
@@ -56,23 +56,19 @@ nsHyperTextAccessibleWrap(aDomNode, aShe
/* wstring getName (); */
NS_IMETHODIMP nsXULTextAccessible::GetName(nsAString& aName)
{
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
if (!content) {
return NS_ERROR_FAILURE; // Node shut down
}
- if (!content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value,
- aName)) {
- // if the value doesn't exist, flatten the inner content as the name (for descriptions)
- return AppendFlatStringFromSubtree(content, &aName);
- }
- // otherwise, use the value attribute as the name (for labels)
- return NS_OK;
+ // if the value attr doesn't exist, the screen reader must get the accessible text
+ // from the accessible text interface or from the children
+ return content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value, aName);
}
NS_IMETHODIMP
nsXULTextAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
@@ -171,23 +167,19 @@ NS_IMETHODIMP nsXULLinkAccessible::GetNa
return AppendFlatStringFromSubtree(content, &aName);
}
// otherwise, use the value attribute as the name (for labels)
return NS_OK;
}
NS_IMETHODIMP nsXULLinkAccessible::GetRole(PRUint32 *aRole)
{
- if (mIsLink) {
- *aRole = nsIAccessibleRole::ROLE_LINK;
- } else {
- // default to calling the link a button; might have javascript
- *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
- }
- // should there be a third case where it becomes just text?
+ // We used to say ROLE_BUTTON if there was no href, but then screen readers
+ // would tell users to hit the space bar for activation, which is wrong for a link
+ *aRole = nsIAccessibleRole::ROLE_LINK;
return NS_OK;
}
void nsXULLinkAccessible::CacheActionContent()
{
// not a link if no content
nsCOMPtr<nsIContent> mTempContent = do_QueryInterface(mDOMNode);
if (!mTempContent) {
--- a/accessible/src/xul/nsXULTreeAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeAccessible.cpp
@@ -558,19 +558,21 @@ nsXULTreeAccessible::GetCachedTreeitemAc
// invalidateCache(in PRInt32 aRow, in PRInt32 aCount)
NS_IMETHODIMP
nsXULTreeAccessible::InvalidateCache(PRInt32 aRow, PRInt32 aCount)
{
// Do not invalidate the cache if rows have been inserted.
if (aCount > 0)
return NS_OK;
+ NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
+
nsCOMPtr<nsITreeColumns> cols;
nsresult rv = mTree->GetColumns(getter_AddRefs(cols));
- NS_ENSURE_SUCCESS(rv, rv);
+ NS_ENSURE_STATE(cols);
#ifdef MOZ_ACCESSIBILITY_ATK
PRInt32 colsCount = 0;
rv = cols->GetCount(&colsCount);
NS_ENSURE_SUCCESS(rv, rv);
#else
nsCOMPtr<nsITreeColumn> col;
rv = cols->GetKeyColumn(getter_AddRefs(col));
@@ -592,17 +594,17 @@ nsXULTreeAccessible::InvalidateCache(PRI
nsCOMPtr<nsIAccessNode> accessNode;
GetCacheEntry(*mAccessNodeCache, key, getter_AddRefs(accessNode));
if (accessNode) {
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(accessNode));
nsCOMPtr<nsIAccessibleEvent> event =
new nsAccEvent(nsIAccessibleEvent::EVENT_DOM_DESTROY,
- accessible, nsnull, PR_FALSE);
+ accessible, PR_FALSE);
FireAccessibleEvent(event);
mAccessNodeCache->Remove(key);
}
}
}
PRInt32 newRowCount = 0;
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -313,20 +313,17 @@ libs:: $(ICON_FILES)
$(INSTALL) $^ $(DIST)/bin/icons
install::
$(SYSINSTALL) $(IFLAGS1) $(ICON_FILES) $(DESTDIR)$(mozappdir)/icons
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
libs::
- $(INSTALL) $(DIST)/branding/default.xpm $(DIST)/bin/chrome/icons/default
-
-install::
- $(SYSINSTALL) $(IFLAGS1) $(DIST)/branding/default.xpm $(DESTDIR)$(mozappdir)/chrome/icons/default
+ $(INSTALL) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default
endif
export::
ifndef MOZ_BRANDING_DIRECTORY
$(NSINSTALL) -D $(DIST)/branding
ifeq ($(OS_ARCH),WINNT)
cp $(srcdir)/firefox.ico $(DIST)/branding/firefox.ico
cp $(srcdir)/firefox.ico $(DIST)/branding/app.ico
@@ -342,17 +339,17 @@ ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_
endif
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
cp $(srcdir)/mozicon128.png $(DIST)/branding/mozicon128.png
cp $(srcdir)/mozicon16.xpm $(DIST)/branding/mozicon16.xpm
cp $(srcdir)/mozicon50.xpm $(DIST)/branding/mozicon50.xpm
cp $(srcdir)/document.png $(DIST)/branding/document.png
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
- cp $(srcdir)/default.xpm $(DIST)/branding/default.xpm
+ cp $(srcdir)/default16.png $(DIST)/branding/default16.png
endif
ifeq ($(OS_ARCH),OS2)
cp $(srcdir)/firefox-os2.ico $(DIST)/branding/firefox.ico
cp $(srcdir)/firefox-os2.ico $(DIST)/branding/app.ico
cp $(srcdir)/document-os2.ico $(DIST)/branding/document.ico
endif
endif
@@ -375,16 +372,19 @@ clean clobber repackage::
rm -rf $(DIST)/$(APP_NAME).app
ifdef LIBXUL_SDK
APPFILES = Resources
else
APPFILES = MacOS
endif
+libs:: $(srcdir)/profile/prefs.js
+ $(INSTALL) $^ $(DIST)/bin/defaults/profile
+
libs repackage:: $(PROGRAM) application.ini
mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS
rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app --exclude English.lproj
mkdir -p $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj/InfoPlist.strings
rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
@@ -414,22 +414,16 @@ endif
libs::
ifeq ($(OS_ARCH),WINNT)
$(PERL) -pe 's/(?<!\r)\n/\r\n/g;' < $(topsrcdir)/LICENSE > $(DIST)/bin/LICENSE
else
$(INSTALL) $(topsrcdir)/LICENSE $(DIST)/bin
endif
-libs:: $(srcdir)/profile/prefs.js
- $(INSTALL) $^ $(DIST)/bin/defaults/profile
-
-install:: $(srcdir)/profile/prefs.js
- $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile
-
ifdef LIBXUL_SDK
ifndef SKIP_COPY_XULRUNNER
libs::
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(APP_NAME).app/Contents/Frameworks
else
$(NSINSTALL) -D $(DIST)/bin/xulrunner
(cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
deleted file mode 100644
--- a/browser/app/default.xpm
+++ /dev/null
@@ -1,1144 +0,0 @@
-/* XPM */
-static char * mozicon50_xpm[] = {
-"48 48 1093 2",
-" c None",
-". c #2099CF",
-"+ c #2CA7D9",
-"@ c #33AEDD",
-"# c #34B2E1",
-"$ c #35B8E5",
-"% c #2FBAE8",
-"& c #26B5E4",
-"* c #199FD6",
-"= c #177DB8",
-"- c #2C8FC4",
-"; c #43A0CE",
-"> c #55ADD6",
-", c #5CB5DD",
-"' c #61C4E8",
-") c #63CBED",
-"! c #64CFF1",
-"~ c #63D1F2",
-"{ c #5ECCEF",
-"] c #57C3E9",
-"^ c #4EB8E1",
-"/ c #3CABD9",
-"( c #2A9ED1",
-"_ c #1991C9",
-": c #0F7CBA",
-"< c #166EAC",
-"[ c #3387BC",
-"} c #4797C6",
-"| c #51A0CC",
-"1 c #56A7D2",
-"2 c #5BAED7",
-"3 c #60B6DD",
-"4 c #67CDEE",
-"5 c #69D3F2",
-"6 c #6BD4F4",
-"7 c #69D3F4",
-"8 c #63CDEF",
-"9 c #5AC0E6",
-"0 c #51B6DF",
-"a c #49ACD8",
-"b c #42A2D1",
-"c c #3898CA",
-"d c #298CC2",
-"e c #167EB9",
-"f c #0B5A9C",
-"g c #2674AE",
-"h c #3D87BA",
-"i c #4590C0",
-"j c #4B97C6",
-"k c #519FCB",
-"l c #58A6D1",
-"m c #5DADD5",
-"n c #62B3DA",
-"o c #69C3E6",
-"p c #6ED4F2",
-"q c #6FD6F4",
-"r c #6ED5F4",
-"s c #6AD3F2",
-"t c #5FC3E7",
-"u c #53B2DC",
-"v c #4BA8D5",
-"w c #439FCE",
-"x c #3B95C7",
-"y c #338BC0",
-"z c #2B82B9",
-"A c #1D76B1",
-"B c #0C69A9",
-"C c #10599A",
-"D c #2D71AA",
-"E c #377CB2",
-"F c #3D84B8",
-"G c #458DBE",
-"H c #4B95C4",
-"I c #529CC9",
-"J c #59A4CF",
-"K c #5FABD4",
-"L c #65B1D8",
-"M c #6BC2E4",
-"N c #71D5F3",
-"O c #73D6F3",
-"P c #72D5F3",
-"Q c #6DD1F0",
-"R c #5FBBE2",
-"S c #54ADD8",
-"T c #4CA4D2",
-"U c #439ACB",
-"V c #3B91C4",
-"W c #3487BD",
-"X c #2D7EB7",
-"Y c #2675AF",
-"Z c #1E6CA9",
-"` c #0F5FA0",
-" . c #055296",
-".. c #115394",
-"+. c #2767A2",
-"@. c #2F70A9",
-"#. c #3679AF",
-"$. c #3C81B5",
-"%. c #448ABC",
-"&. c #4A92C2",
-"*. c #519AC7",
-"=. c #58A2CD",
-"-. c #5FA9D2",
-";. c #65B0D7",
-">. c #6EC8E9",
-",. c #74D4F2",
-"'. c #76D6F3",
-"). c #75D6F3",
-"!. c #71D3F1",
-"~. c #62BCE1",
-"{. c #54A9D5",
-"]. c #4C9FCE",
-"^. c #4396C8",
-"/. c #3B8CC1",
-"(. c #3483BA",
-"_. c #2C7AB3",
-":. c #2670AC",
-"<. c #1F68A6",
-"[. c #195F9F",
-"}. c #0D5497",
-"|. c #04488D",
-"1. c #0F4A8D",
-"2. c #1F5A98",
-"3. c #2663A0",
-"4. c #2D6DA6",
-"5. c #3475AD",
-"6. c #3B7EB3",
-"7. c #4287B9",
-"8. c #4990C1",
-"9. c #51A4CF",
-"0. c #569FCA",
-"a. c #5DA6CF",
-"b. c #66B5DB",
-"c. c #6FD1F0",
-"d. c #75D4F1",
-"e. c #79D5F2",
-"f. c #75D3F1",
-"g. c #63BBE0",
-"h. c #54A4D1",
-"i. c #4B9BCB",
-"j. c #4391C4",
-"k. c #3B88BD",
-"l. c #337FB6",
-"m. c #2C76B0",
-"n. c #266CA9",
-"o. c #1F64A3",
-"p. c #1A5B9C",
-"q. c #145396",
-"r. c #0A498E",
-"s. c #034C8F",
-"t. c #085293",
-"u. c #164D8E",
-"v. c #1D5695",
-"w. c #24609C",
-"x. c #2A69A3",
-"y. c #3271AA",
-"z. c #387AAF",
-"A. c #429FCC",
-"B. c #4CBFE4",
-"C. c #52C4E8",
-"D. c #57AFD7",
-"E. c #5DB3DA",
-"F. c #65C5E7",
-"G. c #6DD0EE",
-"H. c #72D2EF",
-"I. c #78D4F0",
-"J. c #7BD5F1",
-"K. c #76D2EF",
-"L. c #6AC5E6",
-"M. c #55A5D1",
-"N. c #4A95C6",
-"O. c #428CC0",
-"P. c #3A83B9",
-"Q. c #337AB3",
-"R. c #2C71AD",
-"S. c #2568A6",
-"T. c #1F5F9F",
-"U. c #1D65A3",
-"V. c #269ACA",
-"W. c #1C84BA",
-"X. c #0D7DB5",
-"Y. c #0298CC",
-"Z. c #0296CA",
-"`. c #0C5998",
-" + c #14498A",
-".+ c #1B609C",
-"++ c #2498C8",
-"@+ c #2977AF",
-"#+ c #2F75AC",
-"$+ c #3575AC",
-"%+ c #40ABD5",
-"&+ c #49BFE4",
-"*+ c #50C3E7",
-"=+ c #56C5E8",
-"-+ c #5DC8EA",
-";+ c #63CBEB",
-">+ c #69CEED",
-",+ c #6ED0EE",
-"'+ c #73D2EF",
-")+ c #77D3EF",
-"!+ c #72CEEC",
-"~+ c #5AA7D1",
-"{+ c #4F99C9",
-"]+ c #4891C3",
-"^+ c #4087BC",
-"/+ c #387EB5",
-"(+ c #3277B1",
-"_+ c #2B70AB",
-":+ c #2463A2",
-"<+ c #1E5B9C",
-"[+ c #185395",
-"}+ c #165496",
-"|+ c #10498D",
-"1+ c #105F9E",
-"2+ c #0A9ECF",
-"3+ c #0088C0",
-"4+ c #038DC3",
-"5+ c #0A4A8C",
-"6+ c #114E8E",
-"7+ c #1989BD",
-"8+ c #22AAD7",
-"9+ c #28A2D0",
-"0+ c #2C71A9",
-"a+ c #3380B5",
-"b+ c #3EB9E1",
-"c+ c #45BDE3",
-"d+ c #4CC0E5",
-"e+ c #53C3E7",
-"f+ c #59C6E8",
-"g+ c #5EC9EA",
-"h+ c #64CBEB",
-"i+ c #69CDEC",
-"j+ c #6ECFED",
-"k+ c #70D0ED",
-"l+ c #64BDE1",
-"m+ c #55A6D1",
-"n+ c #3D82B8",
-"o+ c #3D8BBE",
-"p+ c #49AFD8",
-"q+ c #378DBF",
-"r+ c #225F9E",
-"s+ c #1D5698",
-"t+ c #174E92",
-"u+ c #12468B",
-"v+ c #0E3F85",
-"w+ c #115F9D",
-"x+ c #15A2D1",
-"y+ c #0395C9",
-"z+ c #0088C1",
-"A+ c #0190C6",
-"B+ c #079ACC",
-"C+ c #0FA0D0",
-"D+ c #169ECF",
-"E+ c #1D99CC",
-"F+ c #25AAD7",
-"G+ c #2BA0CE",
-"H+ c #32AED8",
-"I+ c #3AB7DF",
-"J+ c #41BBE1",
-"K+ c #47BEE3",
-"L+ c #4EC1E5",
-"M+ c #53C4E7",
-"N+ c #5FC8E9",
-"O+ c #63CAEA",
-"P+ c #67CBEB",
-"Q+ c #69CBEA",
-"R+ c #62BCE0",
-"S+ c #5AAFD7",
-"T+ c #478DBF",
-"U+ c #4084B9",
-"V+ c #3A7CB4",
-"W+ c #3E8CBF",
-"X+ c #4DBADF",
-"Y+ c #3383B8",
-"Z+ c #215B9B",
-"`+ c #1B5295",
-" @ c #164A8E",
-".@ c #114288",
-"+@ c #0D3A82",
-"@@ c #0E4C8E",
-"#@ c #1380B7",
-"$@ c #0D96C9",
-"%@ c #0089C1",
-"&@ c #007BB8",
-"*@ c #0085BE",
-"=@ c #008CC4",
-"-@ c #0496C9",
-";@ c #0B9DCF",
-">@ c #1168AB",
-",@ c #174F99",
-"'@ c #21AAD7",
-")@ c #28AED9",
-"!@ c #2FB1DB",
-"~@ c #36B5DE",
-"{@ c #3CB8E0",
-"]@ c #42BBE2",
-"^@ c #49BEE4",
-"/@ c #54C3E6",
-"(@ c #59C5E7",
-"_@ c #5DC7E8",
-":@ c #5FC5E7",
-"<@ c #53A9D3",
-"[@ c #4B96C6",
-"}@ c #478FC2",
-"|@ c #4186BB",
-"1@ c #3C7FB5",
-"2@ c #3676AF",
-"3@ c #306EA9",
-"4@ c #3889BD",
-"5@ c #44AFD8",
-"6@ c #2F84B9",
-"7@ c #194D91",
-"8@ c #15458A",
-"9@ c #144D90",
-"0@ c #0C367E",
-"a@ c #0C4086",
-"b@ c #1797C8",
-"c@ c #1295C8",
-"d@ c #0487C0",
-"e@ c #0079B6",
-"f@ c #0081BC",
-"g@ c #0E9ACC",
-"h@ c #1597CA",
-"i@ c #1CA7D5",
-"j@ c #23ABD8",
-"k@ c #2AAFDA",
-"l@ c #31B2DC",
-"m@ c #37B5DE",
-"n@ c #3DB8E0",
-"o@ c #43BBE2",
-"p@ c #49BEE3",
-"q@ c #4EC0E4",
-"r@ c #53C2E5",
-"s@ c #57C4E6",
-"t@ c #4EAAD4",
-"u@ c #4696C5",
-"v@ c #438FC0",
-"w@ c #4088BC",
-"x@ c #3C80B6",
-"y@ c #3778B1",
-"z@ c #3270AB",
-"A@ c #2C68A5",
-"B@ c #3D9AC8",
-"C@ c #46BADF",
-"D@ c #3DB0D8",
-"E@ c #287CB2",
-"F@ c #164D90",
-"G@ c #299ECC",
-"H@ c #1B79B0",
-"I@ c #1A8CBF",
-"J@ c #199BCC",
-"K@ c #1392C6",
-"L@ c #0A86BE",
-"M@ c #0079B7",
-"N@ c #006AAC",
-"O@ c #0074B3",
-"P@ c #007CB9",
-"Q@ c #0083BE",
-"R@ c #008BC2",
-"S@ c #0393C8",
-"T@ c #099CCD",
-"U@ c #10A1D1",
-"V@ c #17A4D3",
-"W@ c #1EA8D6",
-"X@ c #25ABD8",
-"Y@ c #2BAFDA",
-"Z@ c #37B5DD",
-"`@ c #3DB8DF",
-" # c #42BAE1",
-".# c #48BCE2",
-"+# c #4CBEE3",
-"@# c #50C0E4",
-"## c #48A8D3",
-"$# c #3F8EC0",
-"%# c #3C87BC",
-"&# c #3A81B7",
-"*# c #3679B1",
-"=# c #3171AC",
-"-# c #2D6AA6",
-";# c #2862A0",
-"># c #40A5D1",
-",# c #43B8DE",
-"'# c #3DB5DC",
-")# c #38B1DA",
-"!# c #2D9ECC",
-"~# c #2B9FCE",
-"{# c #246AAA",
-"]# c #1F96C7",
-"^# c #1996C9",
-"/# c #138DC3",
-"(# c #0E84BC",
-"_# c #0175B4",
-":# c #0068AC",
-"<# c #0070B1",
-"[# c #0077B5",
-"}# c #007FBA",
-"|# c #0086BF",
-"1# c #018DC4",
-"2# c #0596C9",
-"3# c #0B9DCE",
-"4# c #12A1D1",
-"5# c #1897C8",
-"6# c #1E96C7",
-"7# c #25A0CE",
-"8# c #2B90C2",
-"9# c #31A4D0",
-"0# c #37B4DD",
-"a# c #3CB7DF",
-"b# c #41B9E0",
-"c# c #45BBE0",
-"d# c #49BCE1",
-"e# c #4BBBE0",
-"f# c #419FCC",
-"g# c #3C91C2",
-"h# c #337AB1",
-"i# c #3072AC",
-"j# c #2C6BA7",
-"k# c #2864A1",
-"l# c #255F9E",
-"m# c #3FAAD4",
-"n# c #40B6DC",
-"o# c #3AB3DB",
-"p# c #35B0D8",
-"q# c #2F86BD",
-"r# c #29599F",
-"s# c #237DB7",
-"t# c #1E99CA",
-"u# c #1892C5",
-"v# c #1389C0",
-"w# c #0E7FBA",
-"x# c #0473B2",
-"y# c #0065AA",
-"z# c #0064A9",
-"A# c #006BAD",
-"B# c #0072B2",
-"C# c #0080BC",
-"D# c #0082BC",
-"E# c #028DC4",
-"F# c #0796C9",
-"G# c #0D88BD",
-"H# c #1372AB",
-"I# c #1982B8",
-"J# c #1F79B0",
-"K# c #247BB1",
-"L# c #2A86B9",
-"M# c #31B1DA",
-"N# c #36B3DC",
-"O# c #3AB5DD",
-"P# c #3FB7DE",
-"Q# c #42B9DF",
-"R# c #45BAE0",
-"S# c #48BBE0",
-"T# c #47B6DD",
-"U# c #3689BC",
-"V# c #2D72AB",
-"W# c #2C73AC",
-"X# c #2F7DB3",
-"Y# c #399BC9",
-"Z# c #3FB4DB",
-"`# c #3CB3DA",
-" $ c #37B0D9",
-".$ c #32AED7",
-"+$ c #2CA8D3",
-"@$ c #277EB8",
-"#$ c #229CCC",
-"$$ c #1D95C8",
-"%$ c #188DC2",
-"&$ c #1384BD",
-"*$ c #0D7AB6",
-"=$ c #066FB0",
-"-$ c #0057A0",
-";$ c #005FA5",
-">$ c #0066AA",
-",$ c #006DAF",
-"'$ c #006EAC",
-")$ c #004C8E",
-"!$ c #005595",
-"~$ c #025999",
-"{$ c #085D9B",
-"]$ c #0D64A0",
-"^$ c #1369A4",
-"/$ c #196EA7",
-"($ c #1E73AA",
-"_$ c #2376AD",
-":$ c #2AA0CE",
-"<$ c #2FAFD9",
-"[$ c #34B1DB",
-"}$ c #38B3DC",
-"|$ c #3BB5DC",
-"1$ c #3EB6DD",
-"2$ c #40B7DD",
-"3$ c #42B7DD",
-"4$ c #43B7DE",
-"5$ c #43B7DD",
-"6$ c #40B5DC",
-"7$ c #3DB4DB",
-"8$ c #3AB2DA",
-"9$ c #33AED6",
-"0$ c #2EABD5",
-"a$ c #29A5D2",
-"b$ c #259ECD",
-"c$ c #2094C6",
-"d$ c #1C8DC2",
-"e$ c #1787BE",
-"f$ c #127EB9",
-"g$ c #0D75B3",
-"h$ c #076AAC",
-"i$ c #005FA6",
-"j$ c #00539D",
-"k$ c #005AA2",
-"l$ c #0060A6",
-"m$ c #0068AB",
-"n$ c #0063A5",
-"o$ c #004487",
-"p$ c #004386",
-"q$ c #004789",
-"r$ c #004B8D",
-"s$ c #045192",
-"t$ c #095997",
-"u$ c #0E5F9C",
-"v$ c #1365A0",
-"w$ c #1869A4",
-"x$ c #1D6EA7",
-"y$ c #2274AB",
-"z$ c #28A6D2",
-"A$ c #2DAED8",
-"B$ c #31AFD9",
-"C$ c #34B1DA",
-"D$ c #37B2DB",
-"E$ c #39B3DB",
-"F$ c #3BB4DB",
-"G$ c #3CB4DB",
-"H$ c #3BB3DA",
-"I$ c #38B1D9",
-"J$ c #35AFD8",
-"K$ c #32ADD6",
-"L$ c #2EAAD4",
-"M$ c #2BA5D1",
-"N$ c #2795C5",
-"O$ c #2374AA",
-"P$ c #1E5691",
-"Q$ c #1A4C89",
-"R$ c #156AA5",
-"S$ c #1078B5",
-"T$ c #0B6FAF",
-"U$ c #0665A9",
-"V$ c #004A97",
-"W$ c #004D9A",
-"X$ c #00509A",
-"Y$ c #00579F",
-"Z$ c #0062A7",
-"`$ c #00468A",
-" % c #00387C",
-".% c #003C7F",
-"+% c #004083",
-"@% c #044D8E",
-"#% c #095493",
-"$% c #0E5A98",
-"%% c #13609C",
-"&% c #18659F",
-"*% c #1C6BA4",
-"=% c #219FCD",
-"-% c #25AAD5",
-";% c #29ABD6",
-">% c #2DADD7",
-",% c #30AED8",
-"'% c #32AFD8",
-")% c #34B0D8",
-"!% c #34AED7",
-"~% c #30ABD4",
-"{% c #2DA8D2",
-"]% c #2BA3CF",
-"^% c #289DCC",
-"/% c #2494C5",
-"(% c #20659E",
-"_% c #1C4684",
-":% c #183D7C",
-"<% c #133B7A",
-"[% c #0F5695",
-"}% c #0A5FA1",
-"|% c #055FA5",
-"1% c #00559F",
-"2% c #004D99",
-"3% c #004896",
-"4% c #002E74",
-"5% c #003C82",
-"6% c #004E94",
-"7% c #003377",
-"8% c #003175",
-"9% c #003578",
-"0% c #003B7F",
-"a% c #003F82",
-"b% c #014285",
-"c% c #044889",
-"d% c #094E8E",
-"e% c #0D5493",
-"f% c #125997",
-"g% c #167FB4",
-"h% c #1A96C7",
-"i% c #1EA5D2",
-"j% c #22A7D3",
-"k% c #25A9D4",
-"l% c #28AAD5",
-"m% c #2AAAD5",
-"n% c #2CABD6",
-"o% c #2DACD6",
-"p% c #2EACD5",
-"q% c #2DA9D3",
-"r% c #2CA6D1",
-"s% c #299FCD",
-"t% c #279ACA",
-"u% c #2495C7",
-"v% c #218FC3",
-"w% c #1D86BC",
-"x% c #1A4683",
-"y% c #163574",
-"z% c #112C6C",
-"A% c #0D2464",
-"B% c #082D6F",
-"C% c #044E94",
-"D% c #004F9A",
-"E% c #004292",
-"F% c #00347D",
-"G% c #002266",
-"H% c #002669",
-"I% c #00286C",
-"J% c #002B6F",
-"K% c #002E72",
-"L% c #003478",
-"M% c #00377B",
-"N% c #003A7E",
-"O% c #013D80",
-"P% c #044285",
-"Q% c #084889",
-"R% c #0D4D8D",
-"S% c #115492",
-"T% c #15609B",
-"U% c #189ACB",
-"V% c #1CA0CF",
-"W% c #1FA2CF",
-"X% c #21A3D1",
-"Y% c #24A4D1",
-"Z% c #25A5D1",
-"`% c #27A4D1",
-" & c #28A4D1",
-".& c #28A0CE",
-"+& c #289ECC",
-"@& c #2596C8",
-"#& c #2392C5",
-"$& c #208DC2",
-"%& c #1D87BD",
-"&& c #1A75AE",
-"*& c #173978",
-"=& c #132E6D",
-"-& c #0F2565",
-";& c #0B1D5D",
-">& c #071555",
-",& c #021151",
-"'& c #001F61",
-")& c #00276D",
-"!& c #003D8E",
-"~& c #003B89",
-"{& c #001E62",
-"]& c #002063",
-"^& c #002569",
-"/& c #002D72",
-"(& c #003074",
-"_& c #003579",
-":& c #033C7F",
-"<& c #074183",
-"[& c #0B4787",
-"}& c #0F5392",
-"|& c #1391C5",
-"1& c #1695C8",
-"2& c #1998CA",
-"3& c #1C99CA",
-"4& c #1E9ACB",
-"5& c #209BCB",
-"6& c #219BCB",
-"7& c #229ACA",
-"8& c #2399C9",
-"9& c #2397C8",
-"0& c #2394C6",
-"a& c #2291C4",
-"b& c #1E89C0",
-"c& c #1C84BC",
-"d& c #1A5B97",
-"e& c #174C89",
-"f& c #142D6C",
-"g& c #102665",
-"h& c #0C1E5D",
-"i& c #081756",
-"j& c #040F4F",
-"k& c #000847",
-"l& c #000541",
-"m& c #00033D",
-"n& c #00368A",
-"o& c #00256E",
-"p& c #00185A",
-"q& c #001A5D",
-"r& c #001D60",
-"s& c #001F63",
-"t& c #002568",
-"u& c #00276B",
-"v& c #00296D",
-"w& c #002B70",
-"x& c #003276",
-"y& c #023579",
-"z& c #063A7D",
-"A& c #0A5997",
-"B& c #0D87BF",
-"C& c #108AC1",
-"D& c #138CC3",
-"E& c #168EC4",
-"F& c #188FC4",
-"G& c #1A90C4",
-"H& c #1C90C4",
-"I& c #1D8FC4",
-"J& c #1D8EC3",
-"K& c #1D8CC2",
-"L& c #1D8AC0",
-"M& c #1C87BE",
-"N& c #1B83BC",
-"O& c #1A7FB9",
-"P& c #1864A0",
-"Q& c #164987",
-"R& c #132C6A",
-"S& c #102564",
-"T& c #0D1E5D",
-"U& c #091756",
-"V& c #06104E",
-"W& c #020947",
-"X& c #000441",
-"Y& c #00023C",
-"Z& c #000038",
-"`& c #003086",
-" * c #001A5E",
-".* c #001354",
-"+* c #001658",
-"@* c #001D5F",
-"#* c #001F62",
-"$* c #002164",
-"%* c #002367",
-"&* c #002D71",
-"** c #014C8E",
-"=* c #0474B2",
-"-* c #077CB9",
-";* c #0B80BA",
-">* c #0E82BB",
-",* c #1083BC",
-"'* c #1285BD",
-")* c #1485BE",
-"!* c #1686BD",
-"~* c #1785BD",
-"{* c #1884BC",
-"]* c #1882BB",
-"^* c #1880B9",
-"/* c #187DB7",
-"(* c #177AB6",
-"_* c #1571AF",
-":* c #143676",
-"<* c #122968",
-"[* c #0F2362",
-"}* c #0D1D5C",
-"|* c #0A1755",
-"1* c #030A47",
-"2* c #000239",
-"3* c #002A82",
-"4* c #00175D",
-"5* c #00104F",
-"6* c #001252",
-"7* c #001454",
-"8* c #001657",
-"9* c #00195C",
-"0* c #001C5E",
-"a* c #001D61",
-"b* c #002165",
-"c* c #002366",
-"d* c #002468",
-"e* c #006CAE",
-"f* c #006FB0",
-"g* c #0271B1",
-"h* c #0574B3",
-"i* c #0877B4",
-"j* c #0B78B5",
-"k* c #0F7AB6",
-"l* c #107AB7",
-"m* c #127AB6",
-"n* c #1279B5",
-"o* c #1377B4",
-"p* c #1375B3",
-"q* c #1372B1",
-"r* c #126FAF",
-"s* c #115797",
-"t* c #0F2766",
-"u* c #0D2160",
-"v* c #0B1B5A",
-"w* c #091554",
-"x* c #06104D",
-"y* c #030A46",
-"z* c #000540",
-"A* c #000036",
-"B* c #00237E",
-"C* c #002980",
-"D* c #002372",
-"E* c #001A60",
-"F* c #001659",
-"G* c #001358",
-"H* c #001A5F",
-"I* c #002064",
-"J* c #001B5E",
-"K* c #005397",
-"L* c #0065A9",
-"M* c #0067AB",
-"N* c #0069AC",
-"O* c #026AAD",
-"P* c #046CAE",
-"Q* c #0768AB",
-"R* c #0965A9",
-"S* c #0A6EAF",
-"T* c #0C6EAE",
-"U* c #0D6DAE",
-"V* c #0D6CAD",
-"W* c #0D6AAB",
-"X* c #0D67AA",
-"Y* c #0D64A7",
-"Z* c #0C498C",
-"`* c #0A1E5E",
-" = c #091856",
-".= c #071350",
-"+= c #050D4B",
-"@= c #020844",
-"#= c #00043F",
-"$= c #00023B",
-"%= c #000037",
-"&= c #000035",
-"*= c #000034",
-"== c #001A77",
-"-= c #00237D",
-";= c #002881",
-">= c #002D84",
-",= c #00287F",
-"'= c #000B6C",
-")= c #00388A",
-"!= c #003785",
-"~= c #001556",
-"{= c #001759",
-"]= c #00195B",
-"^= c #001C5F",
-"/= c #001C60",
-"(= c #004B91",
-"_= c #004287",
-":= c #00569C",
-"<= c #0061A7",
-"[= c #023187",
-"}= c #033388",
-"|= c #0563A7",
-"1= c #0662A7",
-"2= c #0762A7",
-"3= c #0860A6",
-"4= c #085EA4",
-"5= c #085CA3",
-"6= c #084388",
-"7= c #071B5B",
-"8= c #061453",
-"9= c #04104D",
-"0= c #030B48",
-"a= c #010742",
-"b= c #00033E",
-"c= c #00013A",
-"d= c #000033",
-"e= c #000032",
-"f= c #001C79",
-"g= c #00217C",
-"h= c #002780",
-"i= c #002B83",
-"j= c #003589",
-"k= c #001D63",
-"l= c #000F4F",
-"m= c #000F4E",
-"n= c #001050",
-"o= c #001152",
-"p= c #001353",
-"q= c #001455",
-"r= c #002F74",
-"s= c #00529A",
-"t= c #0058A1",
-"u= c #00529D",
-"v= c #0156A0",
-"w= c #02569F",
-"x= c #02549E",
-"y= c #03529D",
-"z= c #034F9A",
-"A= c #032062",
-"B= c #020F4E",
-"C= c #010C49",
-"D= c #000845",
-"E= c #00033C",
-"F= c #000138",
-"G= c #000135",
-"H= c #001474",
-"I= c #001F7B",
-"J= c #00247E",
-"K= c #002D83",
-"L= c #001051",
-"M= c #000A46",
-"N= c #000B48",
-"O= c #000C4A",
-"P= c #000D4B",
-"Q= c #000E4D",
-"R= c #001151",
-"S= c #001253",
-"T= c #00377E",
-"U= c #004E9A",
-"V= c #004C98",
-"W= c #00408C",
-"X= c #000946",
-"Y= c #00053F",
-"Z= c #000137",
-"`= c #000031",
-" - c #000030",
-".- c #001373",
-"+- c #001876",
-"@- c #001D79",
-"#- c #00267F",
-"$- c #000D4D",
-"%- c #000741",
-"&- c #000843",
-"*- c #000945",
-"=- c #000A47",
-"-- c #000B49",
-";- c #000D4C",
-">- c #002F77",
-",- c #00327A",
-"'- c #002267",
-")- c #002166",
-"!- c #00256A",
-"~- c #003D89",
-"{- c #004393",
-"]- c #003F90",
-"^- c #003C8D",
-"/- c #003382",
-"(- c #003587",
-"_- c #002069",
-":- c #00033A",
-"<- c #000136",
-"[- c #00002F",
-"}- c #000C6E",
-"|- c #001171",
-"1- c #001574",
-"2- c #001E7A",
-"3- c #00196A",
-"4- c #00053E",
-"5- c #000640",
-"6- c #000742",
-"7- c #00185B",
-"8- c #003787",
-"9- c #00398C",
-"0- c #00378B",
-"a- c #003388",
-"b- c #002779",
-"c- c #00063F",
-"d- c #00002D",
-"e- c #00096C",
-"f- c #000D6F",
-"g- c #001271",
-"h- c #001675",
-"i- c #001872",
-"j- c #000338",
-"k- c #00043A",
-"l- c #00043B",
-"m- c #00053D",
-"n- c #000844",
-"o- c #000944",
-"p- c #002573",
-"q- c #002E85",
-"r- c #002C83",
-"s- c #001E71",
-"t- c #00002E",
-"u- c #00002C",
-"v- c #000266",
-"w- c #00066A",
-"x- c #000A6D",
-"y- c #000E70",
-"z- c #000C58",
-"A- c #000643",
-"B- c #000337",
-"C- c #000236",
-"D- c #000339",
-"E- c #00053C",
-"F- c #00063E",
-"G- c #00073F",
-"H- c #00145A",
-"I- c #001C78",
-"J- c #000743",
-"K- c #00002A",
-"L- c #00005F",
-"M- c #000267",
-"N- c #000A6C",
-"O- c #000952",
-"P- c #000131",
-"Q- c #000132",
-"R- c #000133",
-"S- c #000134",
-"T- c #000235",
-"U- c #00196E",
-"V- c #001D7A",
-"W- c #001B78",
-"X- c #001977",
-"Y- c #001775",
-"Z- c #001473",
-"`- c #000E66",
-" ; c #00002B",
-".; c #000029",
-"+; c #000053",
-"@; c #00005E",
-"#; c #000265",
-"$; c #000464",
-"%; c #000130",
-"&; c #001160",
-"*; c #001164",
-"=; c #001674",
-"-; c #001272",
-";; c #001071",
-">; c #000E6F",
-",; c #000B6E",
-"'; c #00086C",
-"); c #00045F",
-"!; c #000152",
-"~; c #000046",
-"{; c #000051",
-"]; c #00005A",
-"^; c #00012F",
-"/; c #000542",
-"(; c #00106E",
-"_; c #001070",
-":; c #000F70",
-"<; c #00086B",
-"[; c #000367",
-"}; c #000163",
-"|; c #00005B",
-"1; c #000052",
-"2; c #000047",
-"3; c #000041",
-"4; c #000028",
-"5; c #000021",
-"6; c #000025",
-"7; c #00003E",
-"8; c #00003A",
-"9; c #00075A",
-"0; c #00076B",
-"a; c #000569",
-"b; c #000368",
-"c; c #000162",
-"d; c #00005C",
-"e; c #000054",
-"f; c #00004C",
-"g; c #000042",
-"h; c #000039",
-"i; c #000026",
-"j; c #000023",
-"k; c #000017",
-"l; c #00001C",
-"m; c #00004D",
-"n; c #000055",
-"o; c #000027",
-"p; c #00003D",
-"q; c #000058",
-"r; c #00004E",
-"s; c #000048",
-"t; c #000019",
-"u; c #000012",
-"v; c #00001D",
-"w; c #00001F",
-"x; c #000044",
-"y; c #000008",
-"z; c #000018",
-"A; c #000024",
-"B; c #000015",
-"C; c #000022",
-"D; c #00000F",
-"E; c #000004",
-"F; c #000007",
-"G; c #000009",
-"H; c #00000C",
-"I; c #00000D",
-"J; c #00000E",
-"K; c #00000A",
-"L; c #000003",
-"M; c #000000",
-"N; c #000001",
-"O; c #000005",
-"P; c #00000B",
-" ",
-" ",
-" . + @ # $ % & * ",
-" = - ; > , ' ) ! ~ { ] ^ / ( _ : ",
-" < [ } | 1 2 3 4 5 6 7 8 9 0 a b c d e ",
-" f g h i j k l m n o p q r s t u v w x y z A B ",
-" C D E F G H I J K L M N O P Q R S T U V W X Y Z ` . ",
-" ..+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|. ",
-" 1.2.3.4.5.6.7.8.9.0.a.b.c.d.e.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s. ",
-" t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y. ",
-" Z.`. +.+++@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+^+/+(+_+:+<+[+}+|+1+2+ ",
-" 3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+k+l+m+]+n+o+p+q+r+s+t+u+v+w+x+y+ ",
-" z+A+B+C+D+E+F+G+H+I+J+K+L+M+f+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@ ",
-" &@*@=@-@;@>@,@'@)@!@~@{@]@^@L+/@(@_@:@<@[@}@|@1@2@3@4@5@6@7@8@9@0@a@b@c@d@ ",
-" e@f@z+A+B+g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@C@D@E@F@G@H@I@J@K@L@M@ ",
-" N@O@P@Q@R@S@T@U@V@W@X@Y@l@Z@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#^#/#(#_# ",
-" :#<#[#}#|#1#2#3#4#5#6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y# ",
-" z#A#B#M@C#D#E#F#G#H#I#J#K#L#M#N#O#P#Q#R#S#T#U#V#W#X#Y#Z#`# $.$+$@$#$$$%$&$*$=$z# ",
-" -$;$>$,$O@'$)$!$~${$]$^$/$($_$:$<$[$}$|$1$2$3$4$5$3$6$7$8$ $9$0$a$b$c$d$e$f$g$h$i$ ",
-" j$k$l$m$n$o$p$q$r$s$t$u$v$w$x$y$z$A$B$C$D$E$F$G$G$H$8$I$J$K$L$M$N$O$P$Q$R$S$T$U$k$V$ ",
-" W$X$Y$Z$`$ %.%+%p$q$@%#%$%%%&%*%=%-%;%>%,%'%)%p#p#J$!%K$~%{%]%^%/%(%_%:%<%[%}%|%1%2% ",
-" 3%4%5%6%7%8%9% %0%a%b%c%d%e%f%g%h%i%j%k%l%m%n%o%p%0$q%r%]%s%t%u%v%w%x%y%z%A%B%C%D%3% ",
-" E%F%G%H%I%J%K%8%L%M%N%O%P%Q%R%S%T%U%V%W%X%Y%Z%`% &9+.&+&V.@&#&$&%&&&*&=&-&;&>&,&'&)& ",
-" !&~&{&]&G%^&I%J%/&(&7%_& %:&<&[&}&|&1&2&3&4&5&6&7&8&9&0&a&$&b&c&d&e&f&g&h&i&j&k&l&m& ",
-" n&o&p&q&r&s&G%t&u&v&w&K%(&x&y&z&A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z& ",
-" `& *.*+*p&q&@*#*$*%*^&u&v&J%&***=*-*;*>*,*'*)*!*~*{*]*^*/*(*_*:*<*[*}*|*V&1*l&Y&Z&2* ",
-" 3*4*5*6*7*8*p&9*0*a*s&b*c*d*v&e*f*g*h*i*j**$k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*Y&Z&A*z* ",
-" B*C*D*E*F*G*H*I*+*p&9*J*r&{&x&K*L*M*N*O*P*Q*R*S*T*U*V*W*X*Y*Z*`* =.=+=@=#=$=%=&=*= ",
-" ==-=;=>=,='=)=!=J*.*~=+*{=]=^=/=(=_=:=l$<=[=}=|=1=2=3=4=5=6=7=8=9=0=a=b=c=%=&=d=e= ",
-" f=g=h=i=3*j=k=l=m=n=o=p=q=~=8*r=^=b*s=t=j$u=-$v=w=x=y=z=A=B=C=D=z*E=F=A*&=d=e=G= ",
-" H===I=J=;=K=L=M=N=O=P=Q=l=n=R=6*S=.*T=D%D%D%U=2%V=V$3%W=J*L=X=Y=$=Z=&=*=e=`= - ",
-" .-+-@-g=#-$-%-&-*-M==---O=P=;-Q=m=>-,-'-)-!-~-{-E%]-^-/-(-_-:-<-*=d=e=`=[-[- ",
-" }-|-1-==2-3-4-4-5-%-6-&-*-X==-=-N=q&;-O=O=O=7-8-9-0-j=a-`&b-c-d=e=`= -[-d-$= ",
-" e-f-g-h-i-4-j-k-l-m-4-c-5-%-6-6-&-&-n-o-o-*-M=p-q-r-3*h=s-X=`= -[-t-u-u- ",
-" v-w-x-y-g-z-A-B-C-j-D-:-l-l-E-m-4-F-F-c-c-c-G-H-#-J=g=I=I-J-t-t-d-u-K- ",
-" L-M-w-N-f-O-P-Q-R-S-T-C-C-B-j-D-D-:-k-l-k-D=U-V-W-X-Y-Z-`-[- ; ;.;u- ",
-" +;@;#;$; ;u-d-t-[- -%;P-Q-R-R-S-B-z*&;*;Y-=;H=-;;;>;,;';);!;%=d- ",
-" ~;{;];u-.;K- ; ;u-d-d-d-t-t-^;/;(;_;;;:;f-}-x-<;w-[;};|;1;2; ",
-" A*%=3;4;5;6;u-7;8;u-K- ; ; ; ;^;9;<;0;w-a;b;v-c;d;e;f;g;h; ",
-" i;j;k;l;d=m;1;n;d= ;i;o;o;o;o;p;@;d;q;+;r;s;3;h;`=K- ",
-" t;u;k;o;e=Z&%=5;*=l;v;v;v;w; ;x;3;p;Z&d=d-i;w; ",
-" y;u;z;v;5;A;A;B;u;u;u;j; ;.;i;C;v;z;u;D; ",
-" E;E;F;G;H;I;I;I;H;D;J;H;K;F;E;K; ",
-" y;L;M;M;N;N;M;N;O;P; ",
-" ",
-" ",
-" ",
-" "};
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..9f8274b1371921d92f2651cb9511d66b008b607a
GIT binary patch
literal 722
zc$@*!0xkWCP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00009a7bBm000XU
z000XU0RWnu7ytkQgh@m}R5*>5lS@cc0Te*bn|br~sWW3^qZUS1B!n48&_}U?pu$`P
zwGgrhjB3}eMPNzLrWURWT13$zBElk~f~2U7(9%RiQZm2I|NESo_idA6X+>vs;c^d`
z`vJfN!35!FY~eo;<^!|q&~7v{i5v=$mIra#e8S031OF0;0Ol2MG5)HpRBmfRQ#7<W
z2YnAa&2|Qbc8tFY%yulSt@l%2-Jk{bc(C~N(ZNUJXn%Bb)2*h*j#I4_Zcni@J~JES
z&au#P9f-Ibeo~=sQHh***)wQ#T<TO+YuWyNr;i_W*VL}F`wH!oV=H6h{;n6Z?>=AV
z{e|IqfkkLX5t{DzkdxB{dp_K_dOq{Ir+;-kk*uxusx{>$1@20(Q(Pe!r9Owf#Zy(@
zP0P)l^8zb?d2N-8XmElz54tbvN7rO5_PtpQ%*JM<KmaYCB0M%rPL`45vSd_M)N8J~
zyNo@{iU7j7sVq!oq0P;ix&zkc1_}$Eq-;KBlNt1h5b;P7_ohlbo<cOMYkf|VjsVxi
zUna8ASIzhE27P9lm=%P84`o*kQb`fkIu}_4jC2}fViGdB#-#$)C}L>Xf|5p+iim_`
z<jYDa@O!Z7I(kB8?rk5rfg#W}&%zxn5c?KJ3godk9E5{txh#p#Uy+Nw*z6+a$S`Ve
zFRGjZQ=3^Th~N8yarPrc#oI}ZLNbCG4Wan_DBd!VbC6AdnFqwD3tL!(PF{+TwH!uI
zSW#n;PeURB85`saAeRCo{v3iGkXC;e0OKPVN(v*k18fe=3<w%1B4kFvNWOw-8%%{@
z(K9W@(*V|1(6@l;0%00>0*Tu|^v`w6m_RB8oXaJD0B=VW0A4+5-T(jq07*qoM6N<$
Ef*YVbfB*mh
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -63,16 +63,25 @@ pref("xpinstall.dialog.progress.type.chr
// their extensions are being updated and thus reregistered every time the app is
// started.
pref("extensions.ignoreMTimeChanges", false);
// Enables some extra Extension System Logging (can reduce performance)
pref("extensions.logging.enabled", false);
// Hides the install button in the add-ons mgr
pref("extensions.hideInstallButton", true);
+// Preferences for the Get Add-ons pane
+pref("extensions.getAddons.showPane", true);
+pref("extensions.getAddons.browseAddons", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%");
+pref("extensions.getAddons.maxResults", 5);
+pref("extensions.getAddons.recommended.browseURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%/recommended");
+pref("extensions.getAddons.recommended.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/list/featured/all/10");
+pref("extensions.getAddons.search.browseURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%/search?q=%TERMS%");
+pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/search/%TERMS%");
+
// Blocklist preferences
pref("extensions.blocklist.enabled", true);
pref("extensions.blocklist.interval", 86400);
pref("extensions.blocklist.url", "https://addons.mozilla.org/blocklist/1/%APP_ID%/%APP_VERSION%/");
pref("extensions.blocklist.detailsURL", "http://%LOCALE%.www.mozilla.com/%LOCALE%/blocklist/");
// Dictionary download preference
pref("browser.dictionaries.download.url", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/firefox/%VERSION%/dictionaries/");
@@ -212,16 +221,17 @@ pref("browser.download.manager.showAlert
pref("browser.download.manager.retention", 2);
pref("browser.download.manager.showWhenStarting", true);
pref("browser.download.manager.useWindow", true);
pref("browser.download.manager.closeWhenDone", false);
pref("browser.download.manager.openDelay", 0);
pref("browser.download.manager.focusWhenStarting", false);
pref("browser.download.manager.flashCount", 2);
pref("browser.download.manager.addToRecentDocs", true);
+pref("browser.download.manager.quitBehavior", 0);
// search engines URL
pref("browser.search.searchEnginesURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/firefox/%VERSION%/search-engines/");
// pointer to the default engine name
pref("browser.search.defaultenginename", "chrome://browser-region/locale/region.properties");
// disable logging for the search service by default
@@ -330,24 +340,25 @@ pref("dom.disable_window_move_resize",
pref("dom.disable_window_flip", true);
// popups.policy 1=allow,2=reject
pref("privacy.popups.policy", 1);
pref("privacy.popups.usecustom", true);
pref("privacy.popups.firstTime", true);
pref("privacy.popups.showBrowserMessage", true);
-pref("privacy.item.history", true);
-pref("privacy.item.formdata", true);
-pref("privacy.item.passwords", false);
-pref("privacy.item.downloads", true);
-pref("privacy.item.cookies", false);
-pref("privacy.item.cache", true);
-pref("privacy.item.siteprefs", false);
-pref("privacy.item.sessions", true);
+pref("privacy.item.history", true);
+pref("privacy.item.formdata", true);
+pref("privacy.item.passwords", false);
+pref("privacy.item.downloads", true);
+pref("privacy.item.cookies", false);
+pref("privacy.item.cache", true);
+pref("privacy.item.siteprefs", false);
+pref("privacy.item.sessions", true);
+pref("privacy.item.offlineApps", false);
pref("privacy.sanitize.sanitizeOnShutdown", false);
pref("privacy.sanitize.promptOnSanitize", true);
pref("network.proxy.share_proxy_settings", false); // use the same proxy settings for all protocols
pref("network.cookie.cookieBehavior", 1); // 0-Accept, 1-dontAcceptForeign, 2-dontUse
@@ -594,17 +605,55 @@ pref("browser.places.importBookmarksHTML
// if false, will add the "Smart Bookmarks" folder to the personal toolbar
pref("browser.places.createdSmartBookmarks", false);
// If true, will migrate uri post-data annotations to
// bookmark post-data annotations (bug 398914)
// XXX to be removed after beta 2 (bug 391419)
pref("browser.places.migratePostDataAnnotations", true);
+// the (maximum) number of the recent visits to sample
+// when calculating frecency
+pref("places.frecency.numVisits", 10);
+
+// Perform frecency recalculation after this amount of idle, repeating.
+// A value of zero disables updating of frecency on idle.
+// Default is 1 minute (60000ms).
+pref("places.frecency.updateIdleTime", 60000);
+
+// buckets (in days) for frecency calculation
+pref("places.frecency.firstBucketCutoff", 4);
+pref("places.frecency.secondBucketCutoff", 14);
+pref("places.frecency.thirdBucketCutoff", 31);
+pref("places.frecency.fourthBucketCutoff", 90);
+
+// weights for buckets for frecency calculations
+pref("places.frecency.firstBucketWeight", 100);
+pref("places.frecency.secondBucketWeight", 70);
+pref("places.frecency.thirdBucketWeight", 50);
+pref("places.frecency.fourthBucketWeight", 30);
+pref("places.frecency.defaultBucketWeight", 10);
+
+// bonus (in percent) for visit transition types for frecency calculations
+pref("places.frecency.embedVisitBonus", 0);
+pref("places.frecency.linkVisitBonus", 120);
+pref("places.frecency.typedVisitBonus", 200);
+pref("places.frecency.bookmarkVisitBonus", 140);
+pref("places.frecency.downloadVisitBonus", 0);
+pref("places.frecency.permRedirectVisitBonus", 0);
+pref("places.frecency.tempRedirectVisitBonus", 0);
+pref("places.frecency.defaultVisitBonus", 0);
+
+// bonus (in percent) for place types for frecency calculations
+pref("places.frecency.unvisitedBookmarkBonus", 140);
+pref("places.frecency.unvisitedTypedBonus", 200);
+
// Controls behavior of the "Add Exception" dialog launched from SSL error pages
// 0 - don't pre-populate anything
// 1 - pre-populate site URL, but don't fetch certificate
// 2 - pre-populate site URL and pre-fetch certificate
pref("browser.ssl_override_behavior", 1);
// replace newlines with spaces when pasting into <input type="text"> fields
pref("editor.singleLine.pasteNewlines", 2);
+// The breakpad report server to link to in about:crashes
+pref("breakpad.reportURL", "http://crash-stats.mozilla.com/report/index/");
--- a/browser/app/splash.rc
+++ b/browser/app/splash.rc
@@ -63,21 +63,23 @@ END
#define IDC_CELL 4103
#define IDC_COPY 4104
#define IDC_ALIAS 4105
#define IDC_ZOOMIN 4106
#define IDC_ZOOMOUT 4107
#define IDC_COLRESIZE 4108
#define IDC_ROWRESIZE 4109
#define IDC_VERTICALTEXT 4110
+#define IDC_NONE 4112
IDC_GRAB CURSOR DISCARDABLE "../../widget/src/build/res/grab.cur"
IDC_GRABBING CURSOR DISCARDABLE "../../widget/src/build/res/grabbing.cur"
IDC_CELL CURSOR DISCARDABLE "../../widget/src/build/res/cell.cur"
IDC_COPY CURSOR DISCARDABLE "../../widget/src/build/res/copy.cur"
IDC_ALIAS CURSOR DISCARDABLE "../../widget/src/build/res/aliasb.cur"
IDC_ZOOMIN CURSOR DISCARDABLE "../../widget/src/build/res/zoom_in.cur"
IDC_ZOOMOUT CURSOR DISCARDABLE "../../widget/src/build/res/zoom_out.cur"
IDC_COLRESIZE CURSOR DISCARDABLE "../../widget/src/build/res/col_resize.cur"
IDC_ROWRESIZE CURSOR DISCARDABLE "../../widget/src/build/res/row_resize.cur"
IDC_VERTICALTEXT CURSOR DISCARDABLE "../../widget/src/build/res/vertical_text.cur"
+IDC_NONE CURSOR DISCARDABLE "../../widget/src/build/res/none.cur"
#endif
--- a/browser/app/splashos2.rc
+++ b/browser/app/splashos2.rc
@@ -66,12 +66,13 @@ POINTER IDC_CELL "..\\..\\widg
POINTER IDC_COPY "..\\..\\widget\\src\\os2\\res\\copy.ptr"
POINTER IDC_ALIAS "..\\..\\widget\\src\\os2\\res\\aliasb.ptr"
POINTER IDC_ZOOMIN "..\\..\\widget\\src\\os2\\res\\zoom_in.ptr"
POINTER IDC_ZOOMOUT "..\\..\\widget\\src\\os2\\res\\zoom_out.ptr"
POINTER IDC_ARROWWAIT "..\\..\\widget\\src\\os2\\res\\arrow_wait.ptr"
POINTER IDC_CROSS "..\\..\\widget\\src\\os2\\res\\crosshair.ptr"
POINTER IDC_HELP "..\\..\\widget\\src\\os2\\res\\help.ptr"
+POINTER IDC_NONE "..\\..\\widget\\src\\os2\\res\\none.ptr"
ICON IDC_DNDURL "..\\..\\widget\\src\\os2\\res\\dndurl.ico"
ICON IDC_DNDTEXT "..\\..\\widget\\src\\os2\\res\\dndtext.ico"
#endif
--- a/browser/base/content/aboutDialog.css
+++ b/browser/base/content/aboutDialog.css
@@ -74,17 +74,17 @@
margin-top: 0;
-moz-margin-end: 0;
margin-bottom: 10px;
-moz-margin-start: 17px;
}
#copyright {
margin-top: 0;
- -moz-margin-end: 0;
+ -moz-margin-end: 16px;
margin-bottom: 3px;
-moz-margin-start: 16px;
}
button[dlgtype="extra2"] {
-moz-margin-start: 13px;
}
--- a/browser/base/content/aboutDialog.xul
+++ b/browser/base/content/aboutDialog.xul
@@ -70,17 +70,17 @@
<script type="application/x-javascript" src="chrome://browser/content/aboutDialog.js"/>
<deck id="modes" flex="1">
<vbox flex="1" id="clientBox">
#expand <label id="version" value="&aboutVersion; __MOZ_APP_VERSION__"/>
<label id="distribution"/>
<label id="distributionId"/>
- <description id="copyright">©rightText;</description>
+ <description id="copyright">©rightInfo;</description>
<textbox id="userAgent" multiline="true" readonly="true"/>
</vbox>
<vbox flex="1" id="creditsBox">
<iframe id="creditsIframe" flex="1"/>
</vbox>
</deck>
<separator class="groove" id="groove"/>
new file mode 100644
--- /dev/null
+++ b/browser/base/content/bindings.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+
+# -*- Mode: HTML -*-
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org browser.
+#
+# The Initial Developer of the Original Code is
+# Simon Bünzli <[email protected]>
+# Portions created by the Initial Developer are Copyright (C) 2007 - 2008
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+<!DOCTYPE bindings SYSTEM "chrome://global/locale/global.dtd">
+
+<bindings xmlns="http://www.mozilla.org/xbl"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:xbl="http://www.mozilla.org/xbl"
+>
+ <binding id="unified-back-forward-button-wrapper" display="xul:menu"
+ extends="chrome://global/content/bindings/toolbarbutton.xml#menu">
+ <content>
+ <children includes="toolbarbutton|observes|template|menupopup|tooltip"/>
+ <xul:dropmarker type="menu-button"
+ class="toolbarbutton-menubutton-dropmarker"
+ chromedir="&locale.dir;"
+ xbl:inherits="align,dir,pack,orient,disabled,toolbarmode,buttonstyle"
+ />
+ </content>
+
+ <implementation>
+ <constructor><![CDATA[
+ this._updateUnifiedState();
+ ]]></constructor>
+
+ <method name="_updateUnifiedState">
+ <body><![CDATA[
+ var canGoBack = !document.getElementById("Browser:Back").hasAttribute("disabled");
+ var canGoForward = !document.getElementById("Browser:Forward").hasAttribute("disabled");
+
+ if (canGoBack || canGoForward)
+ this.removeAttribute("disabled");
+ else
+ this.setAttribute("disabled", "true");
+ ]]></body>
+ </method>
+ </implementation>
+
+ <handlers>
+ <!-- observing state changes of the child buttons -->
+ <handler event="broadcast" action="this._updateUnifiedState();"/>
+ </handlers>
+ </binding>
+</bindings>
--- a/browser/base/content/browser-context.inc
+++ b/browser/base/content/browser-context.inc
@@ -49,18 +49,18 @@
accesskey="&openLinkCmd.accesskey;"
oncommand="gContextMenu.openLink();"/>
<menuitem id="context-openlinkintab"
label="&openLinkCmdInTab.label;"
accesskey="&openLinkCmdInTab.accesskey;"
oncommand="gContextMenu.openLinkInTab();"/>
<menuseparator id="context-sep-open"/>
<menuitem id="context-bookmarklink"
- label="&bookmarkLinkCmd.label;"
- accesskey="&bookmarkLinkCmd.accesskey;"
+ label="&bookmarkThisLinkCmd.label;"
+ accesskey="&bookmarkThisLinkCmd.accesskey;"
oncommand="gContextMenu.bookmarkLink();"/>
<menuitem id="context-savelink"
label="&saveLinkCmd.label;"
accesskey="&saveLinkCmd.accesskey;"
oncommand="gContextMenu.saveLink();"/>
<menuitem id="context-sendlink"
label="&sendLinkCmd.label;"
accesskey="&sendLinkCmd.accesskey;"
@@ -121,18 +121,18 @@
accesskey="&reloadCmd.accesskey;"
command="Browser:Reload"/>
<menuitem id="context-stop"
label="&stopCmd.label;"
accesskey="&stopCmd.accesskey;"
command="Browser:Stop"/>
<menuseparator id="context-sep-stop"/>
<menuitem id="context-bookmarkpage"
- label="&bookmarkPageCmd.label;"
- accesskey="&bookmarkPageCmd.accesskey;"
+ label="&bookmarkPageCmd2.label;"
+ accesskey="&bookmarkPageCmd2.accesskey;"
oncommand="gContextMenu.bookmarkThisPage();"/>
<menuitem id="context-savepage"
label="&savePageCmd.label;"
accesskey="&savePageCmd.accesskey2;"
oncommand="gContextMenu.savePageAs();"/>
<menuitem id="context-sendpage"
label="&sendPageCmd.label;"
accesskey="&sendPageCmd.accesskey;"
@@ -189,18 +189,18 @@
<menuitem label="&openFrameCmdInTab.label;"
accesskey="&openFrameCmdInTab.accesskey;"
oncommand="gContextMenu.openFrameInTab();"/>
<menuseparator/>
<menuitem label="&reloadFrameCmd.label;"
accesskey="&reloadFrameCmd.accesskey;"
oncommand="gContextMenu.reloadFrame();"/>
<menuseparator/>
- <menuitem label="&bookmarkFrameCmd.label;"
- accesskey="&bookmarkFrameCmd.accesskey;"
+ <menuitem label="&bookmarkThisFrameCmd.label;"
+ accesskey="&bookmarkThisFrameCmd.accesskey;"
oncommand="gContextMenu.addBookmarkForFrame();"/>
<menuitem label="&saveFrameCmd.label;"
accesskey="&saveFrameCmd.accesskey;"
oncommand="saveDocument(gContextMenu.target.ownerDocument);"/>
<menuseparator/>
<menuitem label="&printFrameCmd.label;"
accesskey="&printFrameCmd.accesskey;"
oncommand="gContextMenu.printFrame();"/>
@@ -235,19 +235,19 @@
accesskey="&viewPageInfoCmd.accesskey;"
oncommand="gContextMenu.viewInfo();"/>
<menuitem id="context-metadata"
label="&metadataCmd.label;"
accesskey="&metadataCmd.accesskey;"
oncommand="gContextMenu.showMetadata();"/>
<menuseparator id="spell-separator"/>
<menuitem id="spell-check-enabled"
- label="&spellEnable.label;"
+ label="&spellCheckEnable.label;"
type="checkbox"
- accesskey="&spellEnable.accesskey;"
+ accesskey="&spellCheckEnable.accesskey;"
oncommand="InlineSpellCheckerUI.toggleEnabled();"/>
#ifndef MOZ_WIDGET_COCOA
<menuitem id="spell-add-dictionaries-main"
label="&spellAddDictionaries.label;"
accesskey="&spellAddDictionaries.accesskey;"
oncommand="gContextMenu.addDictionaries();"/>
#endif
<menu id="spell-dictionaries"
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -83,17 +83,19 @@
#endif
#endif
oncommand="goQuitApplication();"/>
</menupopup>
</menu>
<menu id="edit-menu" label="&editMenu.label;"
accesskey="&editMenu.accesskey;">
- <menupopup id="menu_EditPopup">
+ <menupopup id="menu_EditPopup"
+ onpopupshowing="updateEditUIVisibility()"
+ onpopuphidden="updateEditUIVisibility()">
<menuitem label="&undoCmd.label;"
key="key_undo"
accesskey="&undoCmd.accesskey;"
command="cmd_undo"/>
<menuitem label="&redoCmd.label;"
key="key_redo"
accesskey="&redoCmd.accesskey;"
command="cmd_redo"/>
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -92,21 +92,18 @@ var PlacesCommandHook = {
case "popuphidden":
if (aEvent.originalTarget == this.panel) {
gEditItemOverlay.uninitPanel(true);
this._restoreCommandsState();
}
break;
case "keypress":
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE ||
- aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
- // focus the content area and hide the panel
- window.content.focus();
- this.panel.hidePopup();
- }
+ aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
+ this.panel.hidePopup(); // hide the panel
break;
}
},
_overlayLoaded: false,
_overlayLoading: false,
showEditBookmarkPopup:
function PCH_showEditBookmarkPopup(aItemId, aAnchorElement, aPosition) {
@@ -203,17 +200,17 @@ var PlacesCommandHook = {
}
if (aShowEditUI) {
// dock the panel to the star icon when possible, otherwise dock
// it to the content area
if (aBrowser.contentWindow == window.content) {
var starIcon = aBrowser.ownerDocument.getElementById("star-button");
if (starIcon && isElementVisible(starIcon)) {
- this.showEditBookmarkPopup(itemId, starIcon, "after_start");
+ this.showEditBookmarkPopup(itemId, starIcon, "after_end");
return;
}
}
this.showEditBookmarkPopup(itemId, aBrowser, "overlap");
}
},
/**
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -102,19 +102,17 @@
<command id="Browser:Reload" oncommand="if (event.shiftKey) BrowserReloadSkipCache(); else BrowserReload()" disabled="true"/>
<command id="Browser:ReloadSkipCache" oncommand="BrowserReloadSkipCache()" disabled="true"/>
<command id="cmd_fullZoomReduce" oncommand="FullZoom.reduce()"/>
<command id="cmd_fullZoomEnlarge" oncommand="FullZoom.enlarge()"/>
<command id="cmd_fullZoomReset" oncommand="FullZoom.reset()"/>
<command id="Browser:OpenLocation" oncommand="openLocation();"/>
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
- <command id="Tools:Downloads" oncommand="toOpenWindowByType('Download:Manager',
- 'chrome://mozapps/content/downloads/downloads.xul',
- 'chrome,dialog=no,resizable');"/>
+ <command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
<command id="Tools:Sanitize"
oncommand="Cc[GLUE_CID].getService(Ci.nsIBrowserGlue).sanitize(window || null);"/>
<command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
</commandset>
<commandset id="placesCommands">
<command id="Browser:ShowAllBookmarks"
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -18,16 +18,27 @@ toolbar[printpreview="true"] {
#PopupAutoComplete {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#browser-autocomplete-result-popup");
}
#PopupAutoCompleteRichResult {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#urlbar-rich-result-popup");
}
+/* ::::: Unified Back-/Forward Button ::::: */
+#unified-back-forward-button {
+ -moz-binding: url("chrome://browser/content/bindings.xml#unified-back-forward-button-wrapper");
+}
+#unified-back-forward-button > toolbarbutton > dropmarker {
+ display: none; /* we provide our own */
+}
+.unified-nav-current {
+ font-weight: bold;
+}
+
menuitem.spell-suggestion {
font-weight: bold;
}
#sidebar-box toolbarbutton.tabs-closebutton {
-moz-user-focus: normal;
}
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -53,16 +53,22 @@
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
+let Ci = Components.interfaces;
+let Cu = Components.utils;
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/DownloadUtils.jsm");
+Cu.import("resource://gre/modules/PluralForm.jsm");
+
const kXULNS =
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
const MAX_HISTORY_MENU_ITEMS = 15;
// bookmark dialog features
@@ -94,31 +100,36 @@ var gMustLoadSidebar = false;
var gProgressMeterPanel = null;
var gProgressCollapseTimer = null;
var gPrefService = null;
var appCore = null;
var gBrowser = null;
var gNavToolbox = null;
var gSidebarCommand = "";
var gInPrintPreviewMode = false;
+let gDownloadMgr = null;
// Global variable that holds the nsContextMenu instance.
var gContextMenu = null;
var gChromeState = null; // chrome state before we went into print preview
var gSanitizeListener = null;
var gAutoHideTabbarPrefListener = null;
var gBookmarkAllTabsHandler = null;
#ifdef XP_MACOSX
var gClickAndHoldTimer = null;
#endif
+#ifndef XP_MACOSX
+var gEditUIVisible = true;
+#endif
+
/**
* We can avoid adding multiple load event listeners and save some time by adding
* one listener that calls all real handlers.
*/
function pageShowEventHandlers(event)
{
// Filter out events that are not about the document load we are interested in
@@ -165,16 +176,55 @@ function UpdateBackForwardCommands(aWebN
if (forwardDisabled == aWebNavigation.canGoForward) {
if (forwardDisabled)
forwardBroadcaster.removeAttribute("disabled");
else
forwardBroadcaster.setAttribute("disabled", true);
}
}
+var UnifiedBackForwardButton = {
+ unify: function() {
+ var backButton = document.getElementById("back-button");
+ if (!backButton || !backButton.nextSibling || backButton.nextSibling.id != "forward-button")
+ return; // back and forward buttons aren't adjacent
+
+ var wrapper = document.createElement("toolbaritem");
+ wrapper.id = "unified-back-forward-button";
+ wrapper.className = "chromeclass-toolbar-additional";
+ wrapper.setAttribute("context", "backMenu");
+
+ var toolbar = backButton.parentNode;
+ toolbar.insertBefore(wrapper, backButton);
+
+ var forwardButton = backButton.nextSibling;
+ wrapper.appendChild(backButton);
+ wrapper.appendChild(forwardButton);
+
+ var popup = backButton.getElementsByTagName("menupopup")[0].cloneNode(true);
+ wrapper.appendChild(popup);
+
+ this._unified = true;
+ },
+
+ separate: function() {
+ if (!this._unified)
+ return;
+
+ var wrapper = document.getElementById("unified-back-forward-button");
+ var toolbar = wrapper.parentNode;
+
+ toolbar.insertBefore(wrapper.firstChild, wrapper); // Back button
+ toolbar.insertBefore(wrapper.firstChild, wrapper); // Forward button
+ toolbar.removeChild(wrapper);
+
+ this._unified = false;
+ }
+};
+
#ifdef XP_MACOSX
/**
* Click-and-Hold implementation for the Back and Forward buttons
* XXXmano: should this live in toolbarbutton.xml?
*/
function ClickAndHoldMouseDownCallback(aButton)
{
aButton.open = true;
@@ -884,17 +934,18 @@ function delayedStartup()
var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
os.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
os.addObserver(gXPInstallObserver, "xpinstall-install-blocked", false);
if (!gPrefService)
gPrefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
BrowserOffline.init();
-
+ OfflineApps.init();
+
if (gURLBar && document.documentElement.getAttribute("chromehidden").indexOf("toolbar") != -1) {
gURLBar.setAttribute("readonly", "true");
gURLBar.setAttribute("enablehistory", "false");
}
gBrowser.addEventListener("pageshow", function(evt) { setTimeout(pageShowEventHandlers, 0, evt); }, true);
window.addEventListener("keypress", ctrlNumberTabSelection, false);
@@ -903,16 +954,17 @@ function delayedStartup()
Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
if (gMustLoadSidebar) {
var sidebar = document.getElementById("sidebar");
var sidebarBox = document.getElementById("sidebar-box");
sidebar.setAttribute("src", sidebarBox.getAttribute("src"));
}
+ UnifiedBackForwardButton.unify();
UpdateUrlbarSearchSplitterState();
try {
placesMigrationTasks();
} catch(ex) {}
initBookmarksToolbar();
PlacesStarButton.init();
@@ -1044,23 +1096,43 @@ function delayedStartup()
gBookmarkAllTabsHandler = new BookmarkAllTabsHandler();
// Attach a listener to watch for "command" events bubbling up from error
// pages. This lets us fix bugs like 401575 which require error page UI to
// do privileged things, without letting error pages have any privilege
// themselves.
gBrowser.addEventListener("command", BrowserOnCommand, false);
+ // Delayed initialization of the livemarks update timer.
+ // Livemark updates don't need to start until after bookmark UI
+ // such as the toolbar has initialized. Starting 5 seconds after
+ // delayedStartup in order to stagger this before the download
+ // manager starts (see below).
+ setTimeout(function() PlacesUtils.livemarks.start(), 5000);
+
// Initialize the download manager some time after the app starts so that
// auto-resume downloads begin (such as after crashing or quitting with
// active downloads) and speeds up the first-load of the download manager UI.
// If the user manually opens the download manager before the timeout, the
// downloads will start right away, and getting the service again won't hurt.
- setTimeout(function() Cc["@mozilla.org/download-manager;1"].
- getService(Ci.nsIDownloadManager), 10000);
+ setTimeout(function() {
+ gDownloadMgr = Cc["@mozilla.org/download-manager;1"].
+ getService(Ci.nsIDownloadManager);
+
+ // Initialize the downloads monitor panel listener
+ gDownloadMgr.addListener(DownloadMonitorPanel);
+ DownloadMonitorPanel.init();
+ }, 10000);
+
+#ifndef XP_MACOSX
+ updateEditUIVisibility();
+ let placesContext = document.getElementById("placesContext");
+ placesContext.addEventListener("popupshowing", updateEditUIVisibility, false);
+ placesContext.addEventListener("popuphiding", updateEditUIVisibility, false);
+#endif
}
function BrowserShutdown()
{
try {
FullZoom.destroy();
}
catch(ex) {
@@ -1086,16 +1158,17 @@ function BrowserShutdown()
} catch (ex) {
Components.utils.reportError(ex);
}
if (gSanitizeListener)
gSanitizeListener.shutdown();
BrowserOffline.uninit();
+ OfflineApps.uninit();
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
var enumerator = windowManagerInterface.getEnumerator(null);
enumerator.getNext();
if (!enumerator.hasMoreElements()) {
document.persist("sidebar-box", "sidebarcommand");
document.persist("sidebar-box", "width");
@@ -1264,23 +1337,25 @@ function ctrlNumberTabSelection(event)
if (!(document.commandDispatcher.focusedElement instanceof HTMLAnchorElement)) {
// Don't let winxp beep on ALT+ENTER, since the URL bar uses it.
event.preventDefault();
return;
}
}
#ifdef XP_MACOSX
- if (!event.metaKey)
+ // Mac: Cmd+number
+ if (!event.metaKey || event.ctrlKey || event.altKey || event.shiftKey)
#else
#ifdef XP_UNIX
- // don't let tab selection clash with numeric accesskeys (bug 366084)
- if (!event.altKey || event.shiftKey)
+ // Linux: Alt+number
+ if (!event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
#else
- if (!event.ctrlKey)
+ // Windows: Ctrl+number
+ if (!event.ctrlKey || event.metaKey || event.altKey || event.shiftKey)
#endif
#endif
return;
// \d in a RegExp will find any Unicode character with the "decimal digit"
// property (Nd)
var regExp = /\d/;
if (!regExp.test(String.fromCharCode(event.charCode)))
@@ -1404,22 +1479,24 @@ function BrowserHandleShiftBackspace()
case 1:
goDoCommand("cmd_scrollPageDown");
break;
}
}
function BrowserBackMenu(event)
{
- return FillHistoryMenu(event.target, "back");
+ var menuType = UnifiedBackForwardButton._unified ? "unified" : "back";
+ return FillHistoryMenu(event.target, menuType);
}
function BrowserForwardMenu(event)
{
- return FillHistoryMenu(event.target, "forward");
+ var menuType = UnifiedBackForwardButton._unified ? "unified" : "forward";
+ return FillHistoryMenu(event.target, menuType);
}
function BrowserStop()
{
try {
const stopFlags = nsIWebNavigation.STOP_ALL;
getWebNavigation().stop(stopFlags);
}
@@ -1491,23 +1568,30 @@ function loadOneOrMoreURIs(aURIString)
// so that we don't disrupt startup
try {
gBrowser.loadTabs(aURIString.split("|"), false, true);
}
catch (e) {
}
}
-function openLocation()
+function focusAndSelectUrlBar()
{
if (gURLBar && isElementVisible(gURLBar) && !gURLBar.readOnly) {
gURLBar.focus();
gURLBar.select();
+ return true;
+ }
+ return false;
+}
+
+function openLocation()
+{
+ if (focusAndSelectUrlBar())
return;
- }
#ifdef XP_MACOSX
if (window.location.href != getBrowserURL()) {
var win = getTopWin();
if (win) {
// If there's an open browser window, it should handle this command
win.focus()
win.openLocation();
}
@@ -1899,20 +1983,35 @@ function URLBarSetURI(aURI) {
value = aURI.spec;
if (value == "about:blank") {
// Replace "about:blank" with an empty string
// only if there's no opener (bug 370555).
if (!content.opener)
value = "";
} else {
- // try to decode as UTF-8
- try {
- value = decodeURI(value).replace(/%/g, "%25");
- } catch(e) {}
+ // Try to decode as UTF-8 if there's no encoding sequence that we would break.
+ if (!/%25(?:3B|2F|3F|3A|40|26|3D|2B|24|2C|23)/i.test(value))
+ try {
+ value = decodeURI(value)
+ // 1. decodeURI decodes %25 to %, which creates unintended
+ // encoding sequences. Re-encode it, unless it's part of
+ // a sequence that survived decodeURI, i.e. one for:
+ // ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '#'
+ // (RFC 3987 section 3.2)
+ // 2. Re-encode whitespace so that it doesn't get eaten away
+ // by the location bar (bug 410726).
+ .replace(/%(?!3B|2F|3F|3A|40|26|3D|2B|24|2C|23)|[\r\n\t]/ig,
+ encodeURIComponent);
+ } catch (e) {}
+
+ // Encode bidirectional formatting characters.
+ // (RFC 3987 sections 3.2 and 4.1 paragraph 6)
+ value = value.replace(/[\u200e\u200f\u202a\u202b\u202c\u202d\u202e]/g,
+ encodeURIComponent);
state = "valid";
}
}
gURLBar.value = value;
SetPageProxyState(state);
}
@@ -2872,45 +2971,77 @@ const BrowserSearch = {
function FillHistoryMenu(aParent, aMenu)
{
// Remove old entries if any
deleteHistoryItems(aParent);
var webNav = getWebNavigation();
var sessionHistory = webNav.sessionHistory;
+ var bundle_browser = document.getElementById("bundle_browser");
var count = sessionHistory.count;
var index = sessionHistory.index;
var end;
var j;
var entry;
switch (aMenu)
{
case "back":
end = (index > MAX_HISTORY_MENU_ITEMS) ? index - MAX_HISTORY_MENU_ITEMS : 0;
if ((index - 1) < end) return false;
for (j = index - 1; j >= end; j--)
{
entry = sessionHistory.getEntryAtIndex(j, false);
if (entry)
- createMenuItem(aParent, j, entry.title);
+ createMenuItem(aParent, j, entry.title || entry.URI.spec,
+ bundle_browser.getString("tabHistory.goBack"));
}
break;
case "forward":
end = ((count-index) > MAX_HISTORY_MENU_ITEMS) ? index + MAX_HISTORY_MENU_ITEMS : count - 1;
if ((index + 1) > end) return false;
for (j = index + 1; j <= end; j++)
{
entry = sessionHistory.getEntryAtIndex(j, false);
if (entry)
- createMenuItem(aParent, j, entry.title);
+ createMenuItem(aParent, j, entry.title || entry.URI.spec,
+ bundle_browser.getString("tabHistory.goForward"));
}
break;
+ case "unified":
+ if (count <= 1) // don't display the popup for a single item
+ return false;
+
+ var half_length = Math.floor(MAX_HISTORY_MENU_ITEMS / 2);
+ var start = Math.max(index - half_length, 0);
+ end = Math.min(start == 0 ? MAX_HISTORY_MENU_ITEMS : index + half_length + 1, count);
+ if (end == count)
+ start = Math.max(count - MAX_HISTORY_MENU_ITEMS, 0);
+
+ var tooltips = [
+ bundle_browser.getString("tabHistory.goBack"),
+ bundle_browser.getString("tabHistory.current"),
+ bundle_browser.getString("tabHistory.goForward")
+ ];
+ var classNames = ["unified-nav-back", "unified-nav-current", "unified-nav-forward"];
+
+ for (var j = end - 1; j >= start; j--) {
+ entry = sessionHistory.getEntryAtIndex(j, false);
+ var tooltip = tooltips[j < index ? 0 : j == index ? 1 : 2];
+ var className = classNames[j < index ? 0 : j == index ? 1 : 2];
+ var item = createMenuItem(aParent, j, entry.title || entry.URI.spec, tooltip, className);
+
+ if (j == index) { // mark the current history item
+ item.setAttribute("type", "radio");
+ item.setAttribute("checked", "true");
+ }
+ }
+ break;
}
return true;
}
function addToUrlbarHistory(aUrlToAdd)
{
if (!aUrlToAdd)
@@ -2922,22 +3053,26 @@ function addToUrlbarHistory(aUrlToAdd)
if (aUrlToAdd.indexOf(" ") == -1) {
PlacesUtils.markPageAsTyped(aUrlToAdd);
}
}
catch(ex) {
}
}
-function createMenuItem( aParent, aIndex, aLabel)
+function createMenuItem(aParent, aIndex, aLabel, aTooltipText, aClassName)
{
var menuitem = document.createElement( "menuitem" );
menuitem.setAttribute( "label", aLabel );
menuitem.setAttribute( "index", aIndex );
- aParent.appendChild( menuitem );
+ if (aTooltipText)
+ menuitem.setAttribute("tooltiptext", aTooltipText);
+ if (aClassName)
+ menuitem.className = aClassName;
+ return aParent.appendChild(menuitem);
}
function deleteHistoryItems(aParent)
{
var children = aParent.childNodes;
for (var i = children.length - 1; i >= 0; --i)
{
var index = children[i].getAttribute("index");
@@ -2946,16 +3081,22 @@ function deleteHistoryItems(aParent)
}
}
function toJavaScriptConsole()
{
toOpenWindowByType("global:console", "chrome://global/content/console.xul");
}
+function BrowserDownloadsUI()
+{
+ Cc["@mozilla.org/download-manager-ui;1"].
+ getService(Ci.nsIDownloadManagerUI).show();
+}
+
function toOpenWindowByType(inType, uri, features)
{
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
var topWindow = windowManagerInterface.getMostRecentWindow(inType);
if (topWindow)
topWindow.focus();
@@ -3020,16 +3161,18 @@ function BrowserCustomizeToolbar()
// Disable the toolbar context menu items
var menubar = document.getElementById("main-menubar");
for (var i = 0; i < menubar.childNodes.length; ++i)
menubar.childNodes[i].setAttribute("disabled", true);
var cmd = document.getElementById("cmd_CustomizeToolbars");
cmd.setAttribute("disabled", "true");
+ UnifiedBackForwardButton.separate();
+
var splitter = document.getElementById("urlbar-search-splitter");
if (splitter)
splitter.parentNode.removeChild(splitter);
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
var sheetFrame = document.getElementById("customizeToolbarSheetIFrame");
sheetFrame.hidden = false;
// XXXmano: there's apparently no better way to get this when the iframe is
@@ -3056,18 +3199,23 @@ function BrowserToolboxCustomizeDone(aTo
if (aToolboxChanged) {
gURLBar = document.getElementById("urlbar");
gProxyButton = document.getElementById("page-proxy-button");
gProxyFavIcon = document.getElementById("page-proxy-favicon");
gProxyDeck = document.getElementById("page-proxy-deck");
gHomeButton.updateTooltip();
gIdentityHandler._cacheElements();
window.XULBrowserWindow.init();
+
+#ifndef XP_MACOSX
+ updateEditUIVisibility();
+#endif
}
+ UnifiedBackForwardButton.unify();
UpdateUrlbarSearchSplitterState();
// Update the urlbar
if (gURLBar) {
URLBarSetURI();
XULBrowserWindow.asyncUpdateUI();
PlacesStarButton.updateState();
}
@@ -3096,16 +3244,77 @@ function BrowserToolboxCustomizeDone(aTo
initBookmarksToolbar();
#ifndef TOOLBAR_CUSTOMIZATION_SHEET
// XXX Shouldn't have to do this, but I do
window.focus();
#endif
}
+/**
+ * Update the global flag that tracks whether or not any edit UI (the Edit menu,
+ * edit-related items in the context menu, and edit-related toolbar buttons
+ * is visible, then update the edit commands' enabled state accordingly. We use
+ * this flag to skip updating the edit commands on focus or selection changes
+ * when no UI is visible to improve performance (including pageload performance,
+ * since focus changes when you load a new page).
+ *
+ * If UI is visible, we use goUpdateGlobalEditMenuItems to set the commands'
+ * enabled state so the UI will reflect it appropriately.
+ *
+ * If the UI isn't visible, we enable all edit commands so keyboard shortcuts
+ * still work and just lazily disable them as needed when the user presses a
+ * shortcut.
+ *
+ * This doesn't work on Mac, since Mac menus flash when users press their
+ * keyboard shortcuts, so edit UI is essentially always visible on the Mac,
+ * and we need to always update the edit commands. Thus on Mac this function
+ * is a no op.
+ */
+function updateEditUIVisibility()
+{
+#ifndef XP_MACOSX
+ let editMenuPopupState = document.getElementById("menu_EditPopup").state;
+ let contextMenuPopupState = document.getElementById("contentAreaContextMenu").state;
+ let placesContextMenuPopupState = document.getElementById("placesContext").state;
+
+ // The UI is visible if the Edit menu is opening or open, if the context menu
+ // is open, or if the toolbar has been customized to include the Cut, Copy,
+ // or Paste toolbar buttons.
+ gEditUIVisible = editMenuPopupState == "showing" ||
+ editMenuPopupState == "open" ||
+ contextMenuPopupState == "showing" ||
+ contextMenuPopupState == "open" ||
+ placesContextMenuPopupState == "showing" ||
+ placesContextMenuPopupState == "open" ||
+ document.getElementById("cut-button") ||
+ document.getElementById("copy-button") ||
+ document.getElementById("paste-button") ? true : false;
+
+ // If UI is visible, update the edit commands' enabled state to reflect
+ // whether or not they are actually enabled for the current focus/selection.
+ if (gEditUIVisible)
+ goUpdateGlobalEditMenuItems();
+
+ // Otherwise, enable all commands, so that keyboard shortcuts still work,
+ // then lazily determine their actual enabled state when the user presses
+ // a keyboard shortcut.
+ else {
+ goSetCommandEnabled("cmd_undo", true);
+ goSetCommandEnabled("cmd_redo", true);
+ goSetCommandEnabled("cmd_cut", true);
+ goSetCommandEnabled("cmd_copy", true);
+ goSetCommandEnabled("cmd_paste", true);
+ goSetCommandEnabled("cmd_selectAll", true);
+ goSetCommandEnabled("cmd_delete", true);
+ goSetCommandEnabled("cmd_switchTextDirection", true);
+ }
+#endif
+}
+
var FullScreen =
{
toggle: function()
{
// show/hide all menubars, toolbars, and statusbars (except the full screen toolbar)
this.showXULChrome("toolbar", window.fullScreen);
this.showXULChrome("statusbar", window.fullScreen);
document.getElementById("fullScreenItem").setAttribute("checked", !window.fullScreen);
@@ -3274,17 +3483,20 @@ nsBrowserStatusHandler.prototype =
setDefaultStatus : function(status)
{
this.defaultStatus = status;
this.updateStatusField();
},
setOverLink : function(link, b)
{
- this.overLink = link;
+ // Encode bidirectional formatting characters.
+ // (RFC 3987 sections 3.2 and 4.1 paragraph 6)
+ this.overLink = link.replace(/[\u200e\u200f\u202a\u202b\u202c\u202d\u202e]/g,
+ encodeURIComponent);
this.updateStatusField();
},
updateStatusField : function()
{
var text = this.overLink || this.status || this.jsStatus || this.jsDefaultStatus || this.defaultStatus;
// check the current value so we don't trigger an attribute change
@@ -3358,16 +3570,21 @@ nsBrowserStatusHandler.prototype =
else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
if (aWebProgress.DOMWindow == content) {
if (aRequest)
this.endDocumentLoad(aRequest, aStatus);
var browser = gBrowser.mCurrentBrowser;
if (!gBrowser.mTabbedMode && !browser.mIconURL)
gBrowser.useDefaultIcon(gBrowser.mCurrentTab);
+
+ if (Components.isSuccessCode(aStatus) &&
+ content.document.documentElement.getAttribute("manifest")) {
+ OfflineApps.offlineAppRequested(content);
+ }
}
}
// This (thanks to the filter) is a network stop or the last
// request stop outside of loading the document, stop throbbers
// and progress bars and such
if (aRequest) {
var msg = "";
@@ -4816,16 +5033,127 @@ var BrowserOffline = {
var offlineLocked = gPrefService.prefIsLocked("network.online");
if (offlineLocked)
this._uiElement.setAttribute("disabled", "true");
this._uiElement.setAttribute("checked", aOffline);
}
};
+var OfflineApps = {
+ /////////////////////////////////////////////////////////////////////////////
+ // OfflineApps Public Methods
+ init: function ()
+ {
+ // XXX: empty init left as a placeholder for patch in bug 397417
+ },
+
+ uninit: function ()
+ {
+ // XXX: empty uninit left as a placeholder for patch in bug 397417
+ },
+
+ /////////////////////////////////////////////////////////////////////////////
+ // OfflineApps Implementation Methods
+
+ // XXX: _getBrowserWindowForContentWindow and _getBrowserForContentWindow
+ // were taken from browser/components/feeds/src/WebContentConverter.
+ _getBrowserWindowForContentWindow: function(aContentWindow) {
+ return aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
+ .rootTreeItem
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow)
+ .wrappedJSObject;
+ },
+
+ _getBrowserForContentWindow: function(aBrowserWindow, aContentWindow) {
+ // This depends on pseudo APIs of browser.js and tabbrowser.xml
+ aContentWindow = aContentWindow.top;
+ var browsers = aBrowserWindow.getBrowser().browsers;
+ for (var i = 0; i < browsers.length; ++i) {
+ if (browsers[i].contentWindow == aContentWindow)
+ return browsers[i];
+ }
+ },
+
+ offlineAppRequested: function(aContentWindow) {
+ var browserWindow = this._getBrowserWindowForContentWindow(aContentWindow);
+ var browser = this._getBrowserForContentWindow(browserWindow,
+ aContentWindow);
+
+ var currentURI = browser.webNavigation.currentURI;
+ var pm = Cc["@mozilla.org/permissionmanager;1"].
+ getService(Ci.nsIPermissionManager);
+
+ // don't bother showing UI if the user has already made a decision
+ if (pm.testExactPermission(currentURI, "offline-app") !=
+ Ci.nsIPermissionManager.UNKNOWN_ACTION)
+ return;
+
+ try {
+ if (gPrefService.getBoolPref("offline-apps.allow_by_default")) {
+ // all pages can use offline capabilities, no need to ask the user
+ return;
+ }
+ } catch(e) {
+ // this pref isn't set by default, ignore failures
+ }
+
+ var notificationBox = gBrowser.getNotificationBox(browser);
+ var notification = notificationBox.getNotificationWithValue("offline-app-requested");
+ if (!notification) {
+ var bundle_browser = document.getElementById("bundle_browser");
+
+ var buttons = [{
+ label: bundle_browser.getString("offlineApps.allow"),
+ accessKey: bundle_browser.getString("offlineApps.allowAccessKey"),
+ callback: function() { OfflineApps.allowSite(); }
+ }];
+
+ const priority = notificationBox.PRIORITY_INFO_LOW;
+ var message = bundle_browser.getFormattedString("offlineApps.available",
+ [ currentURI.host ]);
+ notificationBox.appendNotification(message, "offline-app-requested",
+ "chrome://browser/skin/Info.png",
+ priority, buttons);
+ }
+ },
+
+ allowSite: function() {
+ var currentURI = gBrowser.selectedBrowser.webNavigation.currentURI;
+ var pm = Cc["@mozilla.org/permissionmanager;1"].
+ getService(Ci.nsIPermissionManager);
+ pm.add(currentURI, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
+
+ // When a site is enabled while loading, <link rel="offline-resource">
+ // resources will start fetching immediately. This one time we need to
+ // do it ourselves.
+ this._startFetching();
+ },
+
+ _startFetching: function() {
+ var manifest = content.document.documentElement.getAttribute("manifest");
+ if (!manifest)
+ return;
+
+ var ios = Cc["@mozilla.org/network/io-service;1"].
+ getService(Ci.nsIIOService);
+
+ var contentURI = ios.newURI(content.location.href, null, null);
+ var manifestURI = ios.newURI(manifest, content.document.characterSet,
+ contentURI);
+
+ var updateService = Cc["@mozilla.org/offlinecacheupdate-service;1"].
+ getService(Ci.nsIOfflineCacheUpdateService);
+ updateService.scheduleUpdate(manifestURI, contentURI);
+ }
+};
+
function WindowIsClosing()
{
var browser = getBrowser();
var cn = browser.tabContainer.childNodes;
var numtabs = cn.length;
var reallyClose = true;
for (var i = 0; reallyClose && i < numtabs; ++i) {
@@ -5738,26 +6066,33 @@ IdentityHandler.prototype = {
body = this._stringBundle.getString("identity.unknown.body");
}
// Push the appropriate strings out to the UI
this._identityPopupContent.textContent = body;
this._identityPopupContentSupp.textContent = supplemental;
this._identityPopupContentVerif.textContent = verifier;
},
-
+
+ hideIdentityPopup : function() {
+ this._identityPopup.hidePopup();
+ },
+
/**
* Click handler for the identity-box element in primary chrome.
*/
- handleIdentityClick : function(event) {
+ handleIdentityButtonEvent : function(event) {
+
event.stopPropagation();
-
- if (event.button != 0)
- return; // We only want left-clicks
-
+
+ if ((event.type == "click" && event.button != 0) ||
+ (event.type == "keypress" && event.charCode != KeyEvent.DOM_VK_SPACE &&
+ event.keyCode != KeyEvent.DOM_VK_RETURN))
+ return; // Left click, space or enter only
+
// Make sure that the display:none style we set in xul is removed now that
// the popup is actually needed
this._identityPopup.hidden = false;
// Tell the popup to consume dismiss clicks, to avoid bug 395314
this._identityPopup.popupBoxObject
.setConsumeRollupEvent(Ci.nsIPopupBoxObject.ROLLUP_CONSUME);
@@ -5775,8 +6110,115 @@ var gIdentityHandler;
* Returns the singleton instance of the identity handler class. Should always be
* used instead of referencing the global variable directly or creating new instances
*/
function getIdentityHandler() {
if (!gIdentityHandler)
gIdentityHandler = new IdentityHandler();
return gIdentityHandler;
}
+
+let DownloadMonitorPanel = {
+ //////////////////////////////////////////////////////////////////////////////
+ //// DownloadMonitorPanel Member Variables
+
+ _panel: null,
+ _activeStr: null,
+ _pausedStr: null,
+ _lastTime: Infinity,
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// DownloadMonitorPanel Public Methods
+
+ /**
+ * Initialize the status panel and member variables
+ */
+ init: function DMP_init() {
+ // Initialize "private" member variables
+ this._panel = document.getElementById("download-monitor");
+
+ // Cache the status strings
+ let (bundle = document.getElementById("bundle_browser")) {
+ this._activeStr = bundle.getString("activeDownloads");
+ this._pausedStr = bundle.getString("pausedDownloads");
+ }
+
+ this.updateStatus();
+ },
+
+ /**
+ * Update status based on the number of active and paused downloads
+ */
+ updateStatus: function DMP_updateStatus() {
+ let numActive = gDownloadMgr.activeDownloadCount;
+
+ // Hide the panel and reset the "last time" if there's no downloads
+ if (numActive == 0) {
+ this._panel.hidden = true;
+ this._lastTime = Infinity;
+
+ return;
+ }
+
+ // Find the download with the longest remaining time
+ let numPaused = 0;
+ let maxTime = -Infinity;
+ let dls = gDownloadMgr.activeDownloads;
+ while (dls.hasMoreElements()) {
+ let dl = dls.getNext().QueryInterface(Ci.nsIDownload);
+ if (dl.state == gDownloadMgr.DOWNLOAD_DOWNLOADING) {
+ // Figure out if this download takes longer
+ if (dl.speed > 0 && dl.size > 0)
+ maxTime = Math.max(maxTime, (dl.size - dl.amountTransferred) / dl.speed);
+ else
+ maxTime = -1;
+ }
+ else if (dl.state == gDownloadMgr.DOWNLOAD_PAUSED)
+ numPaused++;
+ }
+
+ // Get the remaining time string and last sec for time estimation
+ let timeLeft;
+ [timeLeft, this._lastSec] = DownloadUtils.getTimeLeft(maxTime, this._lastSec);
+
+ // Figure out how many downloads are currently downloading
+ let numDls = numActive - numPaused;
+ let status = this._activeStr;
+
+ // If all downloads are paused, show the paused message instead
+ if (numDls == 0) {
+ numDls = numPaused;
+ status = this._pausedStr;
+ }
+
+ // Get the correct plural form and insert the number of downloads and time
+ // left message if necessary
+ status = PluralForm.get(numDls, status);
+ status = status.replace("#1", numDls);
+ status = status.replace("#2", timeLeft);
+
+ // Update the panel and show it
+ this._panel.label = status;
+ this._panel.hidden = false;
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIDownloadProgressListener
+
+ /**
+ * Update status for download progress changes
+ */
+ onProgressChange: function() {
+ this.updateStatus();
+ },
+
+ /**
+ * Update status for download state changes
+ */
+ onDownloadStateChange: function() {
+ this.updateStatus();
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsISupports
+
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIDownloadProgressListener]),
+};
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -101,17 +101,18 @@
<!-- for search and content formfill/pw manager -->
<panel type="autocomplete" chromedir="&locale.dir;" id="PopupAutoComplete" noautofocus="true" hidden="true"/>
<!-- for url bar autocomplete -->
<panel type="autocomplete-richlistbox" chromedir="&locale.dir;" id="PopupAutoCompleteRichResult" noautofocus="true" hidden="true"/>
<panel id="editBookmarkPanel" orient="vertical" hidden="true"
- onpopupshown="PlacesCommandHook.editBookmarkPanelShown();">
+ onpopupshown="PlacesCommandHook.editBookmarkPanelShown();"
+ label="&bookmarkPageCmd2.label;">
<vbox id="editBookmarkPanelContent" flex="1"/>
<hbox flex="1">
<spacer flex="1"/>
<button id="editBookmarkPanelDeleteButton"
label="&editBookmark.delete.label;"
oncommand="PlacesCommandHook.deleteButtonOnCommand();"/>
<button id="editBookmarkPanelDoneButton"
label="&editBookmark.done.label;"
@@ -132,46 +133,49 @@
onpopupshowing="gPopupBlockerObserver.fillPopupList(event);">
<menuitem observes="blockedPopupAllowSite"/>
<menuitem observes="blockedPopupEditSettings"/>
<menuitem observes="blockedPopupDontShowMessage"/>
<menuseparator observes="blockedPopupsSeparator"/>
</popup>
<popup id="contentAreaContextMenu"
- onpopupshowing="if (event.target != this) return true; gContextMenu = new nsContextMenu(this, window.getBrowser()); return gContextMenu.shouldDisplay;"
- onpopuphiding="if (event.target == this) { gContextMenu = null; }">
+ onpopupshowing="if (event.target != this) return true; updateEditUIVisibility(); gContextMenu = new nsContextMenu(this, window.getBrowser()); return gContextMenu.shouldDisplay;"
+ onpopuphiding="if (event.target == this) { gContextMenu = null; updateEditUIVisibility(); }">
#include browser-context.inc
</popup>
<popup id="placesContext"/>
<!-- Popup for site identity information -->
- <panel id="identity-popup" position="after_start" hidden="true" noautofocus="true">
+ <panel id="identity-popup" position="after_start" hidden="true" noautofocus="true"
+ onpopupshown="document.getElementById('identity-popup-more-info-link').focus();"
+ onpopuphidden="focusAndSelectUrlBar();" norestorefocus="true">
<hbox id="identity-popup-container" align="top">
<image id="identity-popup-icon"/>
<vbox id="identity-popup-content-box">
<!-- Title Bar -->
- <label id="identity-popup-title"/>
+ <label id="identity-popup-title" control="identity-popup"/>
<!-- Content area -->
<description id="identity-popup-content"/>
<description id="identity-popup-content-supplemental"/>
<description id="identity-popup-content-verifier"/>
<hbox id="identity-popup-encryption" flex="1">
<vbox>
<image id="identity-popup-encryption-icon"/>
<spacer flex="1"/>
</vbox>
<description id="identity-popup-encryption-label" flex="1"/>
</hbox>
<spacer flex="1"/>
<!-- Footer link to page info -->
<label id="identity-popup-more-info-link"
class="text-link plain"
value="&identity.moreInfoLinkText;"
+ onblur="getIdentityHandler().hideIdentityPopup();"
onclick="getIdentityHandler().handleMoreInfoClick(event);"/>
</vbox>
</hbox>
</panel>
<tooltip id="urlTooltip">
<label crop="center" flex="1"/>
</tooltip>
@@ -264,18 +268,19 @@
maxrows="10"
newlines="stripsurroundingwhitespace"
oninput="URLBarOnInput(event);"
ontextentered="return handleURLBarCommand(param);"
ontextreverted="return handleURLBarRevert();"
pageproxystate="invalid">
<!-- Use onclick instead of normal popup= syntax since the popup
code fires onmousedown, and hence eats our favicon drag events -->
- <box id="identity-box"
- onclick="getIdentityHandler().handleIdentityClick(event);">
+ <box id="identity-box" role="button"
+ onclick="getIdentityHandler().handleIdentityButtonEvent(event);"
+ onkeypress="getIdentityHandler().handleIdentityButtonEvent(event);">
<hbox align="center">
<deck id="page-proxy-deck" onclick="PageProxyClickHandler(event);">
<image id="page-proxy-button"
ondraggesture="PageProxyDragGesture(event);"
tooltiptext="&proxyIcon.tooltip;"/>
<image id="page-proxy-favicon" validate="never"
ondraggesture="PageProxyDragGesture(event);"
onload="this.parentNode.selectedIndex = 1;
@@ -460,16 +465,19 @@
</panel>
#endif
<findbar browserid="content" id="FindToolbar"/>
<statusbar class="chromeclass-status" id="status-bar"
ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);">
<statusbarpanel id="statusbar-display" label="" flex="1"/>
+ <statusbarpanel id="download-monitor" class="statusbarpanel-iconic-text"
+ tooltiptext="&downloadMonitor.tooltip;" hidden="true"
+ ondblclick="doCommand();" command="Tools:Downloads"/>
<statusbarpanel class="statusbarpanel-progress" collapsed="true" id="statusbar-progresspanel">
<progressmeter class="progressmeter-statusbar" id="statusbar-icon" mode="normal" value="0"/>
</statusbarpanel>
<statusbarpanel id="security-button" class="statusbarpanel-iconic-text"
ondblclick="if (event.button == 0) displaySecurityInfo();"/>
<statusbarpanel id="page-report-button" type="menu"
class="statusbarpanel-menu-iconic"
tooltiptext="&pageReportIcon.tooltip;">
--- a/browser/base/content/credits.xhtml
+++ b/browser/base/content/credits.xhtml
@@ -459,17 +459,17 @@
<li>Radiant Core</li>
<li>silverorange</li>
<li>Revver</li>
<li></li>
<li>MozillaZine Community</li>
</ul>
</div>
- <p id="gecko" class="center">&credit.poweredByGecko;®</p>
+ <p id="gecko" class="center">&credit.poweredByGeckoReg;</p>
<p class="footnote">
&brandFullName;™ &license.part0; ©1998-2008 &license.part1;
<a href="" link="about:credits" onclick="visitLink(event);">&license.contrib;</a>,
&license.part2;
<a href="" link="about:license" onclick="visitLink(event);">about:license</a>
&license.part3;</p>
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -78,16 +78,21 @@ function nsContextMenu(aXulMenu, aBrowse
this.inFrame = false;
this.hasBGImage = false;
this.isTextSelected = false;
this.isContentSelected = false;
this.inDirList = false;
this.shouldDisplay = true;
this.isDesignMode = false;
this.possibleSpellChecking = false;
+ this.ellipsis = "\u2026";
+ try {
+ this.ellipsis = gPrefService.getComplexValue("intl.ellipsis",
+ Ci.nsIPrefLocalizedString).data;
+ } catch (e) { }
// Initialize new menu.
this.initMenu(aXulMenu, aBrowser);
}
// Prototype for nsContextMenu "class."
nsContextMenu.prototype = {
// onDestroy is a no-op at this point.
@@ -244,17 +249,17 @@ nsContextMenu.prototype = {
var hostLabel = "";
try {
hostLabel = uri.host;
} catch (ex) { }
if (hostLabel) {
var shortenedUriHost = hostLabel.replace(/^www\./i,"");
if (shortenedUriHost.length > 15)
- shortenedUriHost = shortenedUriHost.substr(0,15) + "...";
+ shortenedUriHost = shortenedUriHost.substr(0,15) + this.ellipsis;
blockImage.label = gNavigatorBundle.getFormattedString("blockImages", [shortenedUriHost]);
if (this.isImageBlocked())
blockImage.setAttribute("checked", "true");
else
blockImage.removeAttribute("checked");
}
}
@@ -834,19 +839,20 @@ nsContextMenu.prototype = {
},
toggleImageBlocking: function(aBlock) {
var permissionmanager = Cc["@mozilla.org/permissionmanager;1"].
getService(Ci.nsIPermissionManager);
var uri = this.target.QueryInterface(Ci.nsIImageLoadingContent).currentURI;
- permissionmanager.add(uri, "image",
- aBlock ? Ci.nsIPermissionManager.DENY_ACTION :
- Ci.nsIPermissionManager.ALLOW_ACTION);
+ if (aBlock)
+ permissionmanager.add(uri, "image", Ci.nsIPermissionManager.DENY_ACTION);
+ else
+ permissionmanager.remove(uri.host, "image");
var brandBundle = document.getElementById("bundle_brand");
var app = brandBundle.getString("brandShortName");
var bundle_browser = document.getElementById("bundle_browser");
var message = bundle_browser.getFormattedString(aBlock ?
"imageBlockedWarning" : "imageAllowedWarning", [app, uri.host]);
var notificationBox = this.browser.getNotificationBox();
@@ -1030,17 +1036,17 @@ nsContextMenu.prototype = {
// Get 16 characters, so that we can trim the selection if it's greater
// than 15 chars
var selectedText = getBrowserSelection(16);
if (!selectedText)
return false;
if (selectedText.length > 15)
- selectedText = selectedText.substr(0,15) + "...";
+ selectedText = selectedText.substr(0,15) + this.ellipsis;
// Use the current engine if the search bar is visible, the default
// engine otherwise.
var engineName = "";
var ss = Cc["@mozilla.org/browser/search-service;1"].
getService(Ci.nsIBrowserSearchService);
if (isElementVisible(BrowserSearch.searchBar))
engineName = ss.currentEngine.name;
--- a/browser/base/content/pageinfo/pageInfo.js
+++ b/browser/base/content/pageinfo/pageInfo.js
@@ -818,107 +818,97 @@ function onImageSelect()
makePreview(tree.view.selection.currentIndex);
}
}
function makePreview(row)
{
var imageTree = document.getElementById("imagetree");
var item = getSelectedImage(imageTree);
- var col = imageTree.columns["image-address"];
- var url = gImageView.getCellText(row, col);
- // image-bg
+ var url = gImageView.data[row][COL_IMAGE_ADDRESS];
var isBG = gImageView.data[row][COL_IMAGE_BG];
setItemValue("imageurltext", url);
- if (item.hasAttribute("title"))
- setItemValue("imagetitletext", item.title);
- else
- setItemValue("imagetitletext", null);
-
- if (item.hasAttribute("longDesc"))
- setItemValue("imagelongdesctext", item.longDesc);
- else
- setItemValue("imagelongdesctext", null);
+ var imageText;
+ if (!isBG &&
+#ifdef MOZ_SVG
+ !(item instanceof SVGImageElement) &&
+#endif
+ !(gDocument instanceof ImageDocument)) {
+ imageText = item.title || item.alt;
- if (item.hasAttribute("alt"))
- setItemValue("imagealttext", item.alt);
- else if (item instanceof HTMLImageElement || isBG)
- setItemValue("imagealttext", null);
- else
- setItemValue("imagealttext", getValueText(item));
+ if (!imageText && !(item instanceof HTMLImageElement))
+ imageText = getValueText(item);
+ }
+ setItemValue("imagetext", imageText);
-#ifdef MOZ_SVG
- if (item instanceof SVGImageElement) {
- setItemValue("imagetitletext", null);
- setItemValue("imagelongdesctext", null);
- setItemValue("imagealttext", null);
- }
-#endif
+ setItemValue("imagelongdesctext", item.longDesc);
// get cache info
- var sourceText = gBundle.getString("generalNotCached");
var cacheKey = url.replace(/#.*$/, "");
try {
// open for READ, in non-blocking mode
var cacheEntryDescriptor = httpCacheSession.openCacheEntry(cacheKey, ACCESS_READ, false);
- if (cacheEntryDescriptor)
- switch (cacheEntryDescriptor.deviceID) {
- case "disk":
- sourceText = gBundle.getString("generalDiskCache");
- break;
- case "memory":
- sourceText = gBundle.getString("generalMemoryCache");
- break;
- default:
- sourceText = cacheEntryDescriptor.deviceID;
- break;
- }
}
catch(ex) {
try {
// open for READ, in non-blocking mode
cacheEntryDescriptor = ftpCacheSession.openCacheEntry(cacheKey, ACCESS_READ, false);
- if (cacheEntryDescriptor)
- switch (cacheEntryDescriptor.deviceID) {
- case "disk":
- sourceText = gBundle.getString("generalDiskCache");
- break;
- case "memory":
- sourceText = gBundle.getString("generalMemoryCache");
- break;
- default:
- sourceText = cacheEntryDescriptor.deviceID;
- break;
- }
}
catch(ex2) { }
}
- setItemValue("imagesourcetext", sourceText);
// find out the file size
var sizeText;
if (cacheEntryDescriptor) {
- var pageSize = cacheEntryDescriptor.dataSize;
- var kbSize = Math.round(pageSize / 1024 * 100) / 100;
+ var imageSize = cacheEntryDescriptor.dataSize;
+ var kbSize = Math.round(imageSize / 1024 * 100) / 100;
sizeText = gBundle.getFormattedString("generalSize",
- [formatNumber(kbSize), formatNumber(pageSize)]);
+ [formatNumber(kbSize), formatNumber(imageSize)]);
}
+ else
+ sizeText = gBundle.getString("mediaUnknownNotCached");
setItemValue("imagesizetext", sizeText);
var mimeType;
+ var numFrames = 1;
if (item instanceof HTMLObjectElement ||
item instanceof HTMLEmbedElement ||
item instanceof HTMLLinkElement)
mimeType = item.type;
+
+ if (!mimeType && item instanceof nsIImageLoadingContent) {
+ var imageRequest = item.getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
+ if (imageRequest) {
+ mimeType = imageRequest.mimeType;
+ var image = imageRequest.image;
+ if (image)
+ numFrames = image.numFrames;
+ }
+ }
if (!mimeType)
- mimeType = getContentTypeFromImgRequest(item) ||
- getContentTypeFromHeaders(cacheEntryDescriptor);
+ mimeType = getContentTypeFromHeaders(cacheEntryDescriptor);
+ if (mimeType) {
+ // We found the type, try to display it nicely
+ var imageMimeType = /^image\/(.*)/.exec(mimeType);
+ if (imageMimeType) {
+ mimeType = imageMimeType[1].toUpperCase();
+ if (numFrames > 1)
+ mimeType = gBundle.getFormattedString("mediaAnimatedImageType",
+ [mimeType, numFrames]);
+ else
+ mimeType = gBundle.getFormattedString("mediaImageType", [mimeType]);
+ }
+ }
+ else {
+ // We couldn't find the type, fall back to the value in the treeview
+ mimeType = gImageView.data[row][COL_IMAGE_TYPE];
+ }
setItemValue("imagetypetext", mimeType);
var imageContainer = document.getElementById("theimagecontainer");
var oldImage = document.getElementById("thepreviewimage");
const regex = /^(https?|ftp|file|gopher|about|chrome|resource):/;
var isProtocolAllowed = regex.test(url);
if (/^data:/.test(url) && /^image\//.test(mimeType))
@@ -969,28 +959,31 @@ function makePreview(row)
else {
// fallback image for protocols not allowed (e.g., data: or javascript:)
// or elements not [yet] handled (e.g., object, embed).
document.getElementById("brokenimagecontainer").collapsed = false;
document.getElementById("theimagecontainer").collapsed = true;
}
var imageSize = "";
- if (url)
- imageSize = gBundle.getFormattedString("mediaSize",
- [formatNumber(width),
- formatNumber(height)]);
- setItemValue("imageSize", imageSize);
-
- var physSize = "";
- if (width != physWidth || height != physHeight)
- physSize = gBundle.getFormattedString("mediaSize",
- [formatNumber(physWidth),
- formatNumber(physHeight)]);
- setItemValue("physSize", physSize);
+ if (url) {
+ if (width != physWidth || height != physHeight) {
+ imageSize = gBundle.getFormattedString("mediaDimensionsScaled",
+ [formatNumber(physWidth),
+ formatNumber(physHeight),
+ formatNumber(width),
+ formatNumber(height)]);
+ }
+ else {
+ imageSize = gBundle.getFormattedString("mediaDimensions",
+ [formatNumber(width),
+ formatNumber(height)]);
+ }
+ }
+ setItemValue("imagedimensiontext", imageSize);
makeBlockImage(url);
imageContainer.removeChild(oldImage);
imageContainer.appendChild(newImage);
}
function makeBlockImage(url)
@@ -1042,31 +1035,16 @@ function getContentTypeFromHeaders(cache
{
if (!cacheEntryDescriptor)
return null;
return (/^Content-Type:\s*(.*?)\s*(?:\;|$)/mi
.exec(cacheEntryDescriptor.getMetaDataElement("response-head")))[1];
}
-function getContentTypeFromImgRequest(item)
-{
- var httpRequest;
-
- try {
- var imageItem = item.QueryInterface(nsIImageLoadingContent);
- var imageRequest = imageItem.getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
- if (imageRequest)
- httpRequest = imageRequest.mimeType;
- }
- catch (ex) { } // This never happened. ;)
-
- return httpRequest;
-}
-
//******** Other Misc Stuff
// Modified from the Links Panel v2.3, http://segment7.net/mozilla/links/links.html
// parse a node to extract the contents of the node
function getValueText(node)
{
var valueText = "";
// form input elements don't generally contain information that is useful to our callers, so return nothing
--- a/browser/base/content/pageinfo/pageInfo.xul
+++ b/browser/base/content/pageinfo/pageInfo.xul
@@ -227,67 +227,52 @@
<splitter class="tree-splitter"/>
<treecol sortSeparators="true" hidden="true" persist="hidden width" flex="1"
width="1" id="image-count" label="&mediaCount;"/>
</treecols>
<treechildren flex="1"/>
</tree>
<splitter orient="vertical" id="mediaSplitter"/>
<vbox flex="1" id="mediaPreviewBox" collapsed="true">
- <grid>
+ <grid id="mediaGrid">
<columns>
- <column/>
+ <column id="mediaLabelColumn"/>
<column class="gridSeparator"/>
<column flex="1"/>
</columns>
<rows>
<row>
- <label control="imageurltext" value="&mediaURL;"/>
+ <label control="imageurltext" value="&mediaLocation;"/>
<separator/>
<textbox readonly="true" id="imageurltext"/>
</row>
<row>
- <label control="imagetitletext" value="&mediaTitle;"/>
- <separator/>
- <textbox readonly="true" id="imagetitletext"/>
- </row>
- <row>
- <label control="imagealttext" value="&mediaAlt;"/>
- <separator/>
- <textbox readonly="true" id="imagealttext"/>
- </row>
- <row>
- <label control="imagelongdesctext" value="&mediaLongdesc;"/>
- <separator/>
- <textbox readonly="true" id="imagelongdesctext"/>
- </row>
- <row>
<label control="imagetypetext" value="&generalType;"/>
<separator/>
<textbox readonly="true" id="imagetypetext"/>
</row>
<row>
- <label control="imagesourcetext" value="&generalSource;"/>
- <separator/>
- <textbox readonly="true" id="imagesourcetext"/>
- </row>
- <row>
<label control="imagesizetext" value="&generalSize;"/>
<separator/>
<textbox readonly="true" id="imagesizetext"/>
</row>
<row>
- <label control="imageSize" value="&mediaDimensions;"/>
+ <label control="imagedimensiontext" value="&mediaDimension;"/>
<separator/>
- <textbox readonly="true" id="imageSize"/>
+ <textbox readonly="true" id="imagedimensiontext"/>
</row>
<row>
- <label control="physSize" value="&mediaPhysDimensions;"/>
+ <label control="imagetext" value="&mediaText;"/>
<separator/>
- <textbox readonly="true" id="physSize"/>
+ <textbox readonly="true" id="imagetext"/>
+ </row>
+ <row>
+ <label control="imagelongdesctext" value="&mediaLongdesc;"/>
+ <separator/>
+ <textbox readonly="true" id="imagelongdesctext"/>
</row>
</rows>
</grid>
<hbox align="end">
<vbox>
<checkbox id="blockImage" hidden="true" oncommand="onBlockImage()"
accesskey="&mediaBlockImage.accesskey;"/>
<label control="thepreviewimage" value="&mediaPreview;" class="header"/>
--- a/browser/base/content/sanitize.js
+++ b/browser/base/content/sanitize.js
@@ -118,16 +118,38 @@ Sanitizer.prototype = {
},
get canClear()
{
return true;
}
},
+ offlineApps: {
+ clear: function ()
+ {
+ const Cc = Components.classes;
+ const Ci = Components.interfaces;
+ var cacheService = Cc["@mozilla.org/network/cache-service;1"].
+ getService(Ci.nsICacheService);
+ try {
+ cacheService.evictEntries(Ci.nsICache.STORE_OFFLINE);
+ } catch(er) {}
+
+ var storageManagerService = Cc["@mozilla.org/dom/storagemanager;1"].
+ getService(Ci.nsIDOMStorageManager);
+ storageManagerService.clearOfflineApps();
+ },
+
+ get canClear()
+ {
+ return true;
+ }
+ },
+
history: {
clear: function ()
{
var globalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
.getService(Components.interfaces.nsIBrowserHistory);
globalHistory.removeAllPages();
try {
--- a/browser/base/content/sanitize.xul
+++ b/browser/base/content/sanitize.xul
@@ -119,16 +119,17 @@
<preferences id="sanitizePreferences">
<preference id="privacy.item.history" name="privacy.item.history" type="bool" readonly="true"/>
<preference id="privacy.item.formdata" name="privacy.item.formdata" type="bool" readonly="true"/>
<preference id="privacy.item.passwords" name="privacy.item.passwords" type="bool" readonly="true"/>
<preference id="privacy.item.downloads" name="privacy.item.downloads" type="bool" readonly="true"/>
<preference id="privacy.item.cookies" name="privacy.item.cookies" type="bool" readonly="true"/>
<preference id="privacy.item.cache" name="privacy.item.cache" type="bool" readonly="true"/>
+ <preference id="privacy.item.offlineApps" name="privacy.item.offlineApps" type="bool"/>
<preference id="privacy.item.sessions" name="privacy.item.sessions" type="bool" readonly="true"/>
</preferences>
<description>&sanitizeItems.label;</description>
<checkbox label="&itemHistory.label;"
accesskey="&itemHistory.accesskey;"
preference="privacy.item.history"
@@ -144,16 +145,20 @@
<checkbox label="&itemCache.label;"
accesskey="&itemCache.accesskey;"
preference="privacy.item.cache"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
<checkbox label="&itemCookies.label;"
accesskey="&itemCookies.accesskey;"
preference="privacy.item.cookies"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
+ <checkbox label="&itemOfflineApps.label;"
+ accesskey="&itemOfflineApps.accesskey;"
+ preference="privacy.item.offlineApps"
+ onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
<checkbox label="&itemPasswords.label;"
accesskey="&itemPasswords.accesskey;"
preference="privacy.item.passwords"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
<checkbox label="&itemSessions.label;"
accesskey="&itemSessions.accesskey;"
preference="privacy.item.sessions"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -87,18 +87,18 @@
tbattr="tabbrowser-multiple"
oncommand="var tabbrowser = this.parentNode.parentNode.parentNode.parentNode;
tabbrowser.reloadAllTabs(tabbrowser.mContextTab);"/>
<xul:menuitem label="&closeOtherTabs.label;" accesskey="&closeOtherTabs.accesskey;"
tbattr="tabbrowser-multiple"
oncommand="var tabbrowser = this.parentNode.parentNode.parentNode.parentNode;
tabbrowser.removeAllTabsBut(tabbrowser.mContextTab);"/>
<xul:menuseparator/>
- <xul:menuitem label="&bookmarkCurTab.label;"
- accesskey="&bookmarkCurTab.accesskey;"
+ <xul:menuitem label="&bookmarkThisTab.label;"
+ accesskey="&bookmarkThisTab.accesskey;"
oncommand="BookmarkThisTab();"/>
<xul:menuitem label="&bookmarkAllTabs.label;"
accesskey="&bookmarkAllTabs.accesskey;"
command="Browser:BookmarkAllTabs"/>
<xul:menuitem label="&undoCloseTab.label;"
accesskey="&undoCloseTab.accesskey;"
command="History:UndoCloseTab"
anonid="undoCloseTabMenuItem"/>
@@ -2123,19 +2123,20 @@
</method>
<!-- throws exception for unknown schemes -->
<method name="loadURIWithFlags">
<parameter name="aURI"/>
<parameter name="aFlags"/>
<parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
+ <parameter name="aPostData"/>
<body>
<![CDATA[
- return this.mCurrentBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset);
+ return this.mCurrentBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData);
]]>
</body>
</method>
<method name="goHome">
<body>
<![CDATA[
return this.mCurrentBrowser.goHome();
--- a/browser/base/jar.mn
+++ b/browser/base/jar.mn
@@ -8,16 +8,17 @@ browser.jar:
#endif
% overlay chrome://global/content/viewSource.xul chrome://browser/content/viewSourceOverlay.xul
% overlay chrome://global/content/viewPartialSource.xul chrome://browser/content/viewSourceOverlay.xul
% style chrome://global/content/customizeToolbar.xul chrome://browser/content/browser.css
% style chrome://global/content/customizeToolbar.xul chrome://browser/skin/
* content/browser/aboutDialog.xul (content/aboutDialog.xul)
* content/browser/aboutDialog.js (content/aboutDialog.js)
content/browser/aboutDialog.css (content/aboutDialog.css)
+* content/browser/bindings.xml (content/bindings.xml)
* content/browser/browser.css (content/browser.css)
* content/browser/browser.js (content/browser.js)
* content/browser/browser.xul (content/browser.xul)
* content/browser/credits.xhtml (content/credits.xhtml)
* content/browser/EULA.js (content/EULA.js)
* content/browser/EULA.xhtml (content/EULA.xhtml)
* content/browser/EULA.xul (content/EULA.xul)
* content/browser/metaData.js (content/metaData.js)
--- a/browser/branding/unofficial/Makefile.in
+++ b/browser/branding/unofficial/Makefile.in
@@ -15,17 +15,17 @@ DIRS = \
locales \
$(NULL)
PREF_JS_EXPORTS = $(srcdir)/pref/firefox-branding.js
include $(topsrcdir)/config/rules.mk
BROWSER_APP_FILES = \
- default.xpm \
+ default16.png \
mozicon128.png \
mozicon16.xpm \
mozicon50.xpm \
firefox.ico \
document.ico \
$(NULL)
export::
deleted file mode 100644
--- a/browser/branding/unofficial/default.xpm
+++ /dev/null
@@ -1,1144 +0,0 @@
-/* XPM */
-static char * mozicon50_xpm[] = {
-"48 48 1093 2",
-" c None",
-". c #2099CF",
-"+ c #2CA7D9",
-"@ c #33AEDD",
-"# c #34B2E1",
-"$ c #35B8E5",
-"% c #2FBAE8",
-"& c #26B5E4",
-"* c #199FD6",
-"= c #177DB8",
-"- c #2C8FC4",
-"; c #43A0CE",
-"> c #55ADD6",
-", c #5CB5DD",
-"' c #61C4E8",
-") c #63CBED",
-"! c #64CFF1",
-"~ c #63D1F2",
-"{ c #5ECCEF",
-"] c #57C3E9",
-"^ c #4EB8E1",
-"/ c #3CABD9",
-"( c #2A9ED1",
-"_ c #1991C9",
-": c #0F7CBA",
-"< c #166EAC",
-"[ c #3387BC",
-"} c #4797C6",
-"| c #51A0CC",
-"1 c #56A7D2",
-"2 c #5BAED7",
-"3 c #60B6DD",
-"4 c #67CDEE",
-"5 c #69D3F2",
-"6 c #6BD4F4",
-"7 c #69D3F4",
-"8 c #63CDEF",
-"9 c #5AC0E6",
-"0 c #51B6DF",
-"a c #49ACD8",
-"b c #42A2D1",
-"c c #3898CA",
-"d c #298CC2",
-"e c #167EB9",
-"f c #0B5A9C",
-"g c #2674AE",
-"h c #3D87BA",
-"i c #4590C0",
-"j c #4B97C6",
-"k c #519FCB",
-"l c #58A6D1",
-"m c #5DADD5",
-"n c #62B3DA",
-"o c #69C3E6",
-"p c #6ED4F2",
-"q c #6FD6F4",
-"r c #6ED5F4",
-"s c #6AD3F2",
-"t c #5FC3E7",
-"u c #53B2DC",
-"v c #4BA8D5",
-"w c #439FCE",
-"x c #3B95C7",
-"y c #338BC0",
-"z c #2B82B9",
-"A c #1D76B1",
-"B c #0C69A9",
-"C c #10599A",
-"D c #2D71AA",
-"E c #377CB2",
-"F c #3D84B8",
-"G c #458DBE",
-"H c #4B95C4",
-"I c #529CC9",
-"J c #59A4CF",
-"K c #5FABD4",
-"L c #65B1D8",
-"M c #6BC2E4",
-"N c #71D5F3",
-"O c #73D6F3",
-"P c #72D5F3",
-"Q c #6DD1F0",
-"R c #5FBBE2",
-"S c #54ADD8",
-"T c #4CA4D2",
-"U c #439ACB",
-"V c #3B91C4",
-"W c #3487BD",
-"X c #2D7EB7",
-"Y c #2675AF",
-"Z c #1E6CA9",
-"` c #0F5FA0",
-" . c #055296",
-".. c #115394",
-"+. c #2767A2",
-"@. c #2F70A9",
-"#. c #3679AF",
-"$. c #3C81B5",
-"%. c #448ABC",
-"&. c #4A92C2",
-"*. c #519AC7",
-"=. c #58A2CD",
-"-. c #5FA9D2",
-";. c #65B0D7",
-">. c #6EC8E9",
-",. c #74D4F2",
-"'. c #76D6F3",
-"). c #75D6F3",
-"!. c #71D3F1",
-"~. c #62BCE1",
-"{. c #54A9D5",
-"]. c #4C9FCE",
-"^. c #4396C8",
-"/. c #3B8CC1",
-"(. c #3483BA",
-"_. c #2C7AB3",
-":. c #2670AC",
-"<. c #1F68A6",
-"[. c #195F9F",
-"}. c #0D5497",
-"|. c #04488D",
-"1. c #0F4A8D",
-"2. c #1F5A98",
-"3. c #2663A0",
-"4. c #2D6DA6",
-"5. c #3475AD",
-"6. c #3B7EB3",
-"7. c #4287B9",
-"8. c #4990C1",
-"9. c #51A4CF",
-"0. c #569FCA",
-"a. c #5DA6CF",
-"b. c #66B5DB",
-"c. c #6FD1F0",
-"d. c #75D4F1",
-"e. c #79D5F2",
-"f. c #75D3F1",
-"g. c #63BBE0",
-"h. c #54A4D1",
-"i. c #4B9BCB",
-"j. c #4391C4",
-"k. c #3B88BD",
-"l. c #337FB6",
-"m. c #2C76B0",
-"n. c #266CA9",
-"o. c #1F64A3",
-"p. c #1A5B9C",
-"q. c #145396",
-"r. c #0A498E",
-"s. c #034C8F",
-"t. c #085293",
-"u. c #164D8E",
-"v. c #1D5695",
-"w. c #24609C",
-"x. c #2A69A3",
-"y. c #3271AA",
-"z. c #387AAF",
-"A. c #429FCC",
-"B. c #4CBFE4",
-"C. c #52C4E8",
-"D. c #57AFD7",
-"E. c #5DB3DA",
-"F. c #65C5E7",
-"G. c #6DD0EE",
-"H. c #72D2EF",
-"I. c #78D4F0",
-"J. c #7BD5F1",
-"K. c #76D2EF",
-"L. c #6AC5E6",
-"M. c #55A5D1",
-"N. c #4A95C6",
-"O. c #428CC0",
-"P. c #3A83B9",
-"Q. c #337AB3",
-"R. c #2C71AD",
-"S. c #2568A6",
-"T. c #1F5F9F",
-"U. c #1D65A3",
-"V. c #269ACA",
-"W. c #1C84BA",
-"X. c #0D7DB5",
-"Y. c #0298CC",
-"Z. c #0296CA",
-"`. c #0C5998",
-" + c #14498A",
-".+ c #1B609C",
-"++ c #2498C8",
-"@+ c #2977AF",
-"#+ c #2F75AC",
-"$+ c #3575AC",
-"%+ c #40ABD5",
-"&+ c #49BFE4",
-"*+ c #50C3E7",
-"=+ c #56C5E8",
-"-+ c #5DC8EA",
-";+ c #63CBEB",
-">+ c #69CEED",
-",+ c #6ED0EE",
-"'+ c #73D2EF",
-")+ c #77D3EF",
-"!+ c #72CEEC",
-"~+ c #5AA7D1",
-"{+ c #4F99C9",
-"]+ c #4891C3",
-"^+ c #4087BC",
-"/+ c #387EB5",
-"(+ c #3277B1",
-"_+ c #2B70AB",
-":+ c #2463A2",
-"<+ c #1E5B9C",
-"[+ c #185395",
-"}+ c #165496",
-"|+ c #10498D",
-"1+ c #105F9E",
-"2+ c #0A9ECF",
-"3+ c #0088C0",
-"4+ c #038DC3",
-"5+ c #0A4A8C",
-"6+ c #114E8E",
-"7+ c #1989BD",
-"8+ c #22AAD7",
-"9+ c #28A2D0",
-"0+ c #2C71A9",
-"a+ c #3380B5",
-"b+ c #3EB9E1",
-"c+ c #45BDE3",
-"d+ c #4CC0E5",
-"e+ c #53C3E7",
-"f+ c #59C6E8",
-"g+ c #5EC9EA",
-"h+ c #64CBEB",
-"i+ c #69CDEC",
-"j+ c #6ECFED",
-"k+ c #70D0ED",
-"l+ c #64BDE1",
-"m+ c #55A6D1",
-"n+ c #3D82B8",
-"o+ c #3D8BBE",
-"p+ c #49AFD8",
-"q+ c #378DBF",
-"r+ c #225F9E",
-"s+ c #1D5698",
-"t+ c #174E92",
-"u+ c #12468B",
-"v+ c #0E3F85",
-"w+ c #115F9D",
-"x+ c #15A2D1",
-"y+ c #0395C9",
-"z+ c #0088C1",
-"A+ c #0190C6",
-"B+ c #079ACC",
-"C+ c #0FA0D0",
-"D+ c #169ECF",
-"E+ c #1D99CC",
-"F+ c #25AAD7",
-"G+ c #2BA0CE",
-"H+ c #32AED8",
-"I+ c #3AB7DF",
-"J+ c #41BBE1",
-"K+ c #47BEE3",
-"L+ c #4EC1E5",
-"M+ c #53C4E7",
-"N+ c #5FC8E9",
-"O+ c #63CAEA",
-"P+ c #67CBEB",
-"Q+ c #69CBEA",
-"R+ c #62BCE0",
-"S+ c #5AAFD7",
-"T+ c #478DBF",
-"U+ c #4084B9",
-"V+ c #3A7CB4",
-"W+ c #3E8CBF",
-"X+ c #4DBADF",
-"Y+ c #3383B8",
-"Z+ c #215B9B",
-"`+ c #1B5295",
-" @ c #164A8E",
-".@ c #114288",
-"+@ c #0D3A82",
-"@@ c #0E4C8E",
-"#@ c #1380B7",
-"$@ c #0D96C9",
-"%@ c #0089C1",
-"&@ c #007BB8",
-"*@ c #0085BE",
-"=@ c #008CC4",
-"-@ c #0496C9",
-";@ c #0B9DCF",
-">@ c #1168AB",
-",@ c #174F99",
-"'@ c #21AAD7",
-")@ c #28AED9",
-"!@ c #2FB1DB",
-"~@ c #36B5DE",
-"{@ c #3CB8E0",
-"]@ c #42BBE2",
-"^@ c #49BEE4",
-"/@ c #54C3E6",
-"(@ c #59C5E7",
-"_@ c #5DC7E8",
-":@ c #5FC5E7",
-"<@ c #53A9D3",
-"[@ c #4B96C6",
-"}@ c #478FC2",
-"|@ c #4186BB",
-"1@ c #3C7FB5",
-"2@ c #3676AF",
-"3@ c #306EA9",
-"4@ c #3889BD",
-"5@ c #44AFD8",
-"6@ c #2F84B9",
-"7@ c #194D91",
-"8@ c #15458A",
-"9@ c #144D90",
-"0@ c #0C367E",
-"a@ c #0C4086",
-"b@ c #1797C8",
-"c@ c #1295C8",
-"d@ c #0487C0",
-"e@ c #0079B6",
-"f@ c #0081BC",
-"g@ c #0E9ACC",
-"h@ c #1597CA",
-"i@ c #1CA7D5",
-"j@ c #23ABD8",
-"k@ c #2AAFDA",
-"l@ c #31B2DC",
-"m@ c #37B5DE",
-"n@ c #3DB8E0",
-"o@ c #43BBE2",
-"p@ c #49BEE3",
-"q@ c #4EC0E4",
-"r@ c #53C2E5",
-"s@ c #57C4E6",
-"t@ c #4EAAD4",
-"u@ c #4696C5",
-"v@ c #438FC0",
-"w@ c #4088BC",
-"x@ c #3C80B6",
-"y@ c #3778B1",
-"z@ c #3270AB",
-"A@ c #2C68A5",
-"B@ c #3D9AC8",
-"C@ c #46BADF",
-"D@ c #3DB0D8",
-"E@ c #287CB2",
-"F@ c #164D90",
-"G@ c #299ECC",
-"H@ c #1B79B0",
-"I@ c #1A8CBF",
-"J@ c #199BCC",
-"K@ c #1392C6",
-"L@ c #0A86BE",
-"M@ c #0079B7",
-"N@ c #006AAC",
-"O@ c #0074B3",
-"P@ c #007CB9",
-"Q@ c #0083BE",
-"R@ c #008BC2",
-"S@ c #0393C8",
-"T@ c #099CCD",
-"U@ c #10A1D1",
-"V@ c #17A4D3",
-"W@ c #1EA8D6",
-"X@ c #25ABD8",
-"Y@ c #2BAFDA",
-"Z@ c #37B5DD",
-"`@ c #3DB8DF",
-" # c #42BAE1",
-".# c #48BCE2",
-"+# c #4CBEE3",
-"@# c #50C0E4",
-"## c #48A8D3",
-"$# c #3F8EC0",
-"%# c #3C87BC",
-"&# c #3A81B7",
-"*# c #3679B1",
-"=# c #3171AC",
-"-# c #2D6AA6",
-";# c #2862A0",
-"># c #40A5D1",
-",# c #43B8DE",
-"'# c #3DB5DC",
-")# c #38B1DA",
-"!# c #2D9ECC",
-"~# c #2B9FCE",
-"{# c #246AAA",
-"]# c #1F96C7",
-"^# c #1996C9",
-"/# c #138DC3",
-"(# c #0E84BC",
-"_# c #0175B4",
-":# c #0068AC",
-"<# c #0070B1",
-"[# c #0077B5",
-"}# c #007FBA",
-"|# c #0086BF",
-"1# c #018DC4",
-"2# c #0596C9",
-"3# c #0B9DCE",
-"4# c #12A1D1",
-"5# c #1897C8",
-"6# c #1E96C7",
-"7# c #25A0CE",
-"8# c #2B90C2",
-"9# c #31A4D0",
-"0# c #37B4DD",
-"a# c #3CB7DF",
-"b# c #41B9E0",
-"c# c #45BBE0",
-"d# c #49BCE1",
-"e# c #4BBBE0",
-"f# c #419FCC",
-"g# c #3C91C2",
-"h# c #337AB1",
-"i# c #3072AC",
-"j# c #2C6BA7",
-"k# c #2864A1",
-"l# c #255F9E",
-"m# c #3FAAD4",
-"n# c #40B6DC",
-"o# c #3AB3DB",
-"p# c #35B0D8",
-"q# c #2F86BD",
-"r# c #29599F",
-"s# c #237DB7",
-"t# c #1E99CA",
-"u# c #1892C5",
-"v# c #1389C0",
-"w# c #0E7FBA",
-"x# c #0473B2",
-"y# c #0065AA",
-"z# c #0064A9",
-"A# c #006BAD",
-"B# c #0072B2",
-"C# c #0080BC",
-"D# c #0082BC",
-"E# c #028DC4",
-"F# c #0796C9",
-"G# c #0D88BD",
-"H# c #1372AB",
-"I# c #1982B8",
-"J# c #1F79B0",
-"K# c #247BB1",
-"L# c #2A86B9",
-"M# c #31B1DA",
-"N# c #36B3DC",
-"O# c #3AB5DD",
-"P# c #3FB7DE",
-"Q# c #42B9DF",
-"R# c #45BAE0",
-"S# c #48BBE0",
-"T# c #47B6DD",
-"U# c #3689BC",
-"V# c #2D72AB",
-"W# c #2C73AC",
-"X# c #2F7DB3",
-"Y# c #399BC9",
-"Z# c #3FB4DB",
-"`# c #3CB3DA",
-" $ c #37B0D9",
-".$ c #32AED7",
-"+$ c #2CA8D3",
-"@$ c #277EB8",
-"#$ c #229CCC",
-"$$ c #1D95C8",
-"%$ c #188DC2",
-"&$ c #1384BD",
-"*$ c #0D7AB6",
-"=$ c #066FB0",
-"-$ c #0057A0",
-";$ c #005FA5",
-">$ c #0066AA",
-",$ c #006DAF",
-"'$ c #006EAC",
-")$ c #004C8E",
-"!$ c #005595",
-"~$ c #025999",
-"{$ c #085D9B",
-"]$ c #0D64A0",
-"^$ c #1369A4",
-"/$ c #196EA7",
-"($ c #1E73AA",
-"_$ c #2376AD",
-":$ c #2AA0CE",
-"<$ c #2FAFD9",
-"[$ c #34B1DB",
-"}$ c #38B3DC",
-"|$ c #3BB5DC",
-"1$ c #3EB6DD",
-"2$ c #40B7DD",
-"3$ c #42B7DD",
-"4$ c #43B7DE",
-"5$ c #43B7DD",
-"6$ c #40B5DC",
-"7$ c #3DB4DB",
-"8$ c #3AB2DA",
-"9$ c #33AED6",
-"0$ c #2EABD5",
-"a$ c #29A5D2",
-"b$ c #259ECD",
-"c$ c #2094C6",
-"d$ c #1C8DC2",
-"e$ c #1787BE",
-"f$ c #127EB9",
-"g$ c #0D75B3",
-"h$ c #076AAC",
-"i$ c #005FA6",
-"j$ c #00539D",
-"k$ c #005AA2",
-"l$ c #0060A6",
-"m$ c #0068AB",
-"n$ c #0063A5",
-"o$ c #004487",
-"p$ c #004386",
-"q$ c #004789",
-"r$ c #004B8D",
-"s$ c #045192",
-"t$ c #095997",
-"u$ c #0E5F9C",
-"v$ c #1365A0",
-"w$ c #1869A4",
-"x$ c #1D6EA7",
-"y$ c #2274AB",
-"z$ c #28A6D2",
-"A$ c #2DAED8",
-"B$ c #31AFD9",
-"C$ c #34B1DA",
-"D$ c #37B2DB",
-"E$ c #39B3DB",
-"F$ c #3BB4DB",
-"G$ c #3CB4DB",
-"H$ c #3BB3DA",
-"I$ c #38B1D9",
-"J$ c #35AFD8",
-"K$ c #32ADD6",
-"L$ c #2EAAD4",
-"M$ c #2BA5D1",
-"N$ c #2795C5",
-"O$ c #2374AA",
-"P$ c #1E5691",
-"Q$ c #1A4C89",
-"R$ c #156AA5",
-"S$ c #1078B5",
-"T$ c #0B6FAF",
-"U$ c #0665A9",
-"V$ c #004A97",
-"W$ c #004D9A",
-"X$ c #00509A",
-"Y$ c #00579F",
-"Z$ c #0062A7",
-"`$ c #00468A",
-" % c #00387C",
-".% c #003C7F",
-"+% c #004083",
-"@% c #044D8E",
-"#% c #095493",
-"$% c #0E5A98",
-"%% c #13609C",
-"&% c #18659F",
-"*% c #1C6BA4",
-"=% c #219FCD",
-"-% c #25AAD5",
-";% c #29ABD6",
-">% c #2DADD7",
-",% c #30AED8",
-"'% c #32AFD8",
-")% c #34B0D8",
-"!% c #34AED7",
-"~% c #30ABD4",
-"{% c #2DA8D2",
-"]% c #2BA3CF",
-"^% c #289DCC",
-"/% c #2494C5",
-"(% c #20659E",
-"_% c #1C4684",
-":% c #183D7C",
-"<% c #133B7A",
-"[% c #0F5695",
-"}% c #0A5FA1",
-"|% c #055FA5",
-"1% c #00559F",
-"2% c #004D99",
-"3% c #004896",
-"4% c #002E74",
-"5% c #003C82",
-"6% c #004E94",
-"7% c #003377",
-"8% c #003175",
-"9% c #003578",
-"0% c #003B7F",
-"a% c #003F82",
-"b% c #014285",
-"c% c #044889",
-"d% c #094E8E",
-"e% c #0D5493",
-"f% c #125997",
-"g% c #167FB4",
-"h% c #1A96C7",
-"i% c #1EA5D2",
-"j% c #22A7D3",
-"k% c #25A9D4",
-"l% c #28AAD5",
-"m% c #2AAAD5",
-"n% c #2CABD6",
-"o% c #2DACD6",
-"p% c #2EACD5",
-"q% c #2DA9D3",
-"r% c #2CA6D1",
-"s% c #299FCD",
-"t% c #279ACA",
-"u% c #2495C7",
-"v% c #218FC3",
-"w% c #1D86BC",
-"x% c #1A4683",
-"y% c #163574",
-"z% c #112C6C",
-"A% c #0D2464",
-"B% c #082D6F",
-"C% c #044E94",
-"D% c #004F9A",
-"E% c #004292",
-"F% c #00347D",
-"G% c #002266",
-"H% c #002669",
-"I% c #00286C",
-"J% c #002B6F",
-"K% c #002E72",
-"L% c #003478",
-"M% c #00377B",
-"N% c #003A7E",
-"O% c #013D80",
-"P% c #044285",
-"Q% c #084889",
-"R% c #0D4D8D",
-"S% c #115492",
-"T% c #15609B",
-"U% c #189ACB",
-"V% c #1CA0CF",
-"W% c #1FA2CF",
-"X% c #21A3D1",
-"Y% c #24A4D1",
-"Z% c #25A5D1",
-"`% c #27A4D1",
-" & c #28A4D1",
-".& c #28A0CE",
-"+& c #289ECC",
-"@& c #2596C8",
-"#& c #2392C5",
-"$& c #208DC2",
-"%& c #1D87BD",
-"&& c #1A75AE",
-"*& c #173978",
-"=& c #132E6D",
-"-& c #0F2565",
-";& c #0B1D5D",
-">& c #071555",
-",& c #021151",
-"'& c #001F61",
-")& c #00276D",
-"!& c #003D8E",
-"~& c #003B89",
-"{& c #001E62",
-"]& c #002063",
-"^& c #002569",
-"/& c #002D72",
-"(& c #003074",
-"_& c #003579",
-":& c #033C7F",
-"<& c #074183",
-"[& c #0B4787",
-"}& c #0F5392",
-"|& c #1391C5",
-"1& c #1695C8",
-"2& c #1998CA",
-"3& c #1C99CA",
-"4& c #1E9ACB",
-"5& c #209BCB",
-"6& c #219BCB",
-"7& c #229ACA",
-"8& c #2399C9",
-"9& c #2397C8",
-"0& c #2394C6",
-"a& c #2291C4",
-"b& c #1E89C0",
-"c& c #1C84BC",
-"d& c #1A5B97",
-"e& c #174C89",
-"f& c #142D6C",
-"g& c #102665",
-"h& c #0C1E5D",
-"i& c #081756",
-"j& c #040F4F",
-"k& c #000847",
-"l& c #000541",
-"m& c #00033D",
-"n& c #00368A",
-"o& c #00256E",
-"p& c #00185A",
-"q& c #001A5D",
-"r& c #001D60",
-"s& c #001F63",
-"t& c #002568",
-"u& c #00276B",
-"v& c #00296D",
-"w& c #002B70",
-"x& c #003276",
-"y& c #023579",
-"z& c #063A7D",
-"A& c #0A5997",
-"B& c #0D87BF",
-"C& c #108AC1",
-"D& c #138CC3",
-"E& c #168EC4",
-"F& c #188FC4",
-"G& c #1A90C4",
-"H& c #1C90C4",
-"I& c #1D8FC4",
-"J& c #1D8EC3",
-"K& c #1D8CC2",
-"L& c #1D8AC0",
-"M& c #1C87BE",
-"N& c #1B83BC",
-"O& c #1A7FB9",
-"P& c #1864A0",
-"Q& c #164987",
-"R& c #132C6A",
-"S& c #102564",
-"T& c #0D1E5D",
-"U& c #091756",
-"V& c #06104E",
-"W& c #020947",
-"X& c #000441",
-"Y& c #00023C",
-"Z& c #000038",
-"`& c #003086",
-" * c #001A5E",
-".* c #001354",
-"+* c #001658",
-"@* c #001D5F",
-"#* c #001F62",
-"$* c #002164",
-"%* c #002367",
-"&* c #002D71",
-"** c #014C8E",
-"=* c #0474B2",
-"-* c #077CB9",
-";* c #0B80BA",
-">* c #0E82BB",
-",* c #1083BC",
-"'* c #1285BD",
-")* c #1485BE",
-"!* c #1686BD",
-"~* c #1785BD",
-"{* c #1884BC",
-"]* c #1882BB",
-"^* c #1880B9",
-"/* c #187DB7",
-"(* c #177AB6",
-"_* c #1571AF",
-":* c #143676",
-"<* c #122968",
-"[* c #0F2362",
-"}* c #0D1D5C",
-"|* c #0A1755",
-"1* c #030A47",
-"2* c #000239",
-"3* c #002A82",
-"4* c #00175D",
-"5* c #00104F",
-"6* c #001252",
-"7* c #001454",
-"8* c #001657",
-"9* c #00195C",
-"0* c #001C5E",
-"a* c #001D61",
-"b* c #002165",
-"c* c #002366",
-"d* c #002468",
-"e* c #006CAE",
-"f* c #006FB0",
-"g* c #0271B1",
-"h* c #0574B3",
-"i* c #0877B4",
-"j* c #0B78B5",
-"k* c #0F7AB6",
-"l* c #107AB7",
-"m* c #127AB6",
-"n* c #1279B5",
-"o* c #1377B4",
-"p* c #1375B3",
-"q* c #1372B1",
-"r* c #126FAF",
-"s* c #115797",
-"t* c #0F2766",
-"u* c #0D2160",
-"v* c #0B1B5A",
-"w* c #091554",
-"x* c #06104D",
-"y* c #030A46",
-"z* c #000540",
-"A* c #000036",
-"B* c #00237E",
-"C* c #002980",
-"D* c #002372",
-"E* c #001A60",
-"F* c #001659",
-"G* c #001358",
-"H* c #001A5F",
-"I* c #002064",
-"J* c #001B5E",
-"K* c #005397",
-"L* c #0065A9",
-"M* c #0067AB",
-"N* c #0069AC",
-"O* c #026AAD",
-"P* c #046CAE",
-"Q* c #0768AB",
-"R* c #0965A9",
-"S* c #0A6EAF",
-"T* c #0C6EAE",
-"U* c #0D6DAE",
-"V* c #0D6CAD",
-"W* c #0D6AAB",
-"X* c #0D67AA",
-"Y* c #0D64A7",
-"Z* c #0C498C",
-"`* c #0A1E5E",
-" = c #091856",
-".= c #071350",
-"+= c #050D4B",
-"@= c #020844",
-"#= c #00043F",
-"$= c #00023B",
-"%= c #000037",
-"&= c #000035",
-"*= c #000034",
-"== c #001A77",
-"-= c #00237D",
-";= c #002881",
-">= c #002D84",
-",= c #00287F",
-"'= c #000B6C",
-")= c #00388A",
-"!= c #003785",
-"~= c #001556",
-"{= c #001759",
-"]= c #00195B",
-"^= c #001C5F",
-"/= c #001C60",
-"(= c #004B91",
-"_= c #004287",
-":= c #00569C",
-"<= c #0061A7",
-"[= c #023187",
-"}= c #033388",
-"|= c #0563A7",
-"1= c #0662A7",
-"2= c #0762A7",
-"3= c #0860A6",
-"4= c #085EA4",
-"5= c #085CA3",
-"6= c #084388",
-"7= c #071B5B",
-"8= c #061453",
-"9= c #04104D",
-"0= c #030B48",
-"a= c #010742",
-"b= c #00033E",
-"c= c #00013A",
-"d= c #000033",
-"e= c #000032",
-"f= c #001C79",
-"g= c #00217C",
-"h= c #002780",
-"i= c #002B83",
-"j= c #003589",
-"k= c #001D63",
-"l= c #000F4F",
-"m= c #000F4E",
-"n= c #001050",
-"o= c #001152",
-"p= c #001353",
-"q= c #001455",
-"r= c #002F74",
-"s= c #00529A",
-"t= c #0058A1",
-"u= c #00529D",
-"v= c #0156A0",
-"w= c #02569F",
-"x= c #02549E",
-"y= c #03529D",
-"z= c #034F9A",
-"A= c #032062",
-"B= c #020F4E",
-"C= c #010C49",
-"D= c #000845",
-"E= c #00033C",
-"F= c #000138",
-"G= c #000135",
-"H= c #001474",
-"I= c #001F7B",
-"J= c #00247E",
-"K= c #002D83",
-"L= c #001051",
-"M= c #000A46",
-"N= c #000B48",
-"O= c #000C4A",
-"P= c #000D4B",
-"Q= c #000E4D",
-"R= c #001151",
-"S= c #001253",
-"T= c #00377E",
-"U= c #004E9A",
-"V= c #004C98",
-"W= c #00408C",
-"X= c #000946",
-"Y= c #00053F",
-"Z= c #000137",
-"`= c #000031",
-" - c #000030",
-".- c #001373",
-"+- c #001876",
-"@- c #001D79",
-"#- c #00267F",
-"$- c #000D4D",
-"%- c #000741",
-"&- c #000843",
-"*- c #000945",
-"=- c #000A47",
-"-- c #000B49",
-";- c #000D4C",
-">- c #002F77",
-",- c #00327A",
-"'- c #002267",
-")- c #002166",
-"!- c #00256A",
-"~- c #003D89",
-"{- c #004393",
-"]- c #003F90",
-"^- c #003C8D",
-"/- c #003382",
-"(- c #003587",
-"_- c #002069",
-":- c #00033A",
-"<- c #000136",
-"[- c #00002F",
-"}- c #000C6E",
-"|- c #001171",
-"1- c #001574",
-"2- c #001E7A",
-"3- c #00196A",
-"4- c #00053E",
-"5- c #000640",
-"6- c #000742",
-"7- c #00185B",
-"8- c #003787",
-"9- c #00398C",
-"0- c #00378B",
-"a- c #003388",
-"b- c #002779",
-"c- c #00063F",
-"d- c #00002D",
-"e- c #00096C",
-"f- c #000D6F",
-"g- c #001271",
-"h- c #001675",
-"i- c #001872",
-"j- c #000338",
-"k- c #00043A",
-"l- c #00043B",
-"m- c #00053D",
-"n- c #000844",
-"o- c #000944",
-"p- c #002573",
-"q- c #002E85",
-"r- c #002C83",
-"s- c #001E71",
-"t- c #00002E",
-"u- c #00002C",
-"v- c #000266",
-"w- c #00066A",
-"x- c #000A6D",
-"y- c #000E70",
-"z- c #000C58",
-"A- c #000643",
-"B- c #000337",
-"C- c #000236",
-"D- c #000339",
-"E- c #00053C",
-"F- c #00063E",
-"G- c #00073F",
-"H- c #00145A",
-"I- c #001C78",
-"J- c #000743",
-"K- c #00002A",
-"L- c #00005F",
-"M- c #000267",
-"N- c #000A6C",
-"O- c #000952",
-"P- c #000131",
-"Q- c #000132",
-"R- c #000133",
-"S- c #000134",
-"T- c #000235",
-"U- c #00196E",
-"V- c #001D7A",
-"W- c #001B78",
-"X- c #001977",
-"Y- c #001775",
-"Z- c #001473",
-"`- c #000E66",
-" ; c #00002B",
-".; c #000029",
-"+; c #000053",
-"@; c #00005E",
-"#; c #000265",
-"$; c #000464",
-"%; c #000130",
-"&; c #001160",
-"*; c #001164",
-"=; c #001674",
-"-; c #001272",
-";; c #001071",
-">; c #000E6F",
-",; c #000B6E",
-"'; c #00086C",
-"); c #00045F",
-"!; c #000152",
-"~; c #000046",
-"{; c #000051",
-"]; c #00005A",
-"^; c #00012F",
-"/; c #000542",
-"(; c #00106E",
-"_; c #001070",
-":; c #000F70",
-"<; c #00086B",
-"[; c #000367",
-"}; c #000163",
-"|; c #00005B",
-"1; c #000052",
-"2; c #000047",
-"3; c #000041",
-"4; c #000028",
-"5; c #000021",
-"6; c #000025",
-"7; c #00003E",
-"8; c #00003A",
-"9; c #00075A",
-"0; c #00076B",
-"a; c #000569",
-"b; c #000368",
-"c; c #000162",
-"d; c #00005C",
-"e; c #000054",
-"f; c #00004C",
-"g; c #000042",
-"h; c #000039",
-"i; c #000026",
-"j; c #000023",
-"k; c #000017",
-"l; c #00001C",
-"m; c #00004D",
-"n; c #000055",
-"o; c #000027",
-"p; c #00003D",
-"q; c #000058",
-"r; c #00004E",
-"s; c #000048",
-"t; c #000019",
-"u; c #000012",
-"v; c #00001D",
-"w; c #00001F",
-"x; c #000044",
-"y; c #000008",
-"z; c #000018",
-"A; c #000024",
-"B; c #000015",
-"C; c #000022",
-"D; c #00000F",
-"E; c #000004",
-"F; c #000007",
-"G; c #000009",
-"H; c #00000C",
-"I; c #00000D",
-"J; c #00000E",
-"K; c #00000A",
-"L; c #000003",
-"M; c #000000",
-"N; c #000001",
-"O; c #000005",
-"P; c #00000B",
-" ",
-" ",
-" . + @ # $ % & * ",
-" = - ; > , ' ) ! ~ { ] ^ / ( _ : ",
-" < [ } | 1 2 3 4 5 6 7 8 9 0 a b c d e ",
-" f g h i j k l m n o p q r s t u v w x y z A B ",
-" C D E F G H I J K L M N O P Q R S T U V W X Y Z ` . ",
-" ..+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|. ",
-" 1.2.3.4.5.6.7.8.9.0.a.b.c.d.e.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s. ",
-" t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y. ",
-" Z.`. +.+++@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+^+/+(+_+:+<+[+}+|+1+2+ ",
-" 3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+k+l+m+]+n+o+p+q+r+s+t+u+v+w+x+y+ ",
-" z+A+B+C+D+E+F+G+H+I+J+K+L+M+f+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@ ",
-" &@*@=@-@;@>@,@'@)@!@~@{@]@^@L+/@(@_@:@<@[@}@|@1@2@3@4@5@6@7@8@9@0@a@b@c@d@ ",
-" e@f@z+A+B+g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@C@D@E@F@G@H@I@J@K@L@M@ ",
-" N@O@P@Q@R@S@T@U@V@W@X@Y@l@Z@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#^#/#(#_# ",
-" :#<#[#}#|#1#2#3#4#5#6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y# ",
-" z#A#B#M@C#D#E#F#G#H#I#J#K#L#M#N#O#P#Q#R#S#T#U#V#W#X#Y#Z#`# $.$+$@$#$$$%$&$*$=$z# ",
-" -$;$>$,$O@'$)$!$~${$]$^$/$($_$:$<$[$}$|$1$2$3$4$5$3$6$7$8$ $9$0$a$b$c$d$e$f$g$h$i$ ",
-" j$k$l$m$n$o$p$q$r$s$t$u$v$w$x$y$z$A$B$C$D$E$F$G$G$H$8$I$J$K$L$M$N$O$P$Q$R$S$T$U$k$V$ ",
-" W$X$Y$Z$`$ %.%+%p$q$@%#%$%%%&%*%=%-%;%>%,%'%)%p#p#J$!%K$~%{%]%^%/%(%_%:%<%[%}%|%1%2% ",
-" 3%4%5%6%7%8%9% %0%a%b%c%d%e%f%g%h%i%j%k%l%m%n%o%p%0$q%r%]%s%t%u%v%w%x%y%z%A%B%C%D%3% ",
-" E%F%G%H%I%J%K%8%L%M%N%O%P%Q%R%S%T%U%V%W%X%Y%Z%`% &9+.&+&V.@&#&$&%&&&*&=&-&;&>&,&'&)& ",
-" !&~&{&]&G%^&I%J%/&(&7%_& %:&<&[&}&|&1&2&3&4&5&6&7&8&9&0&a&$&b&c&d&e&f&g&h&i&j&k&l&m& ",
-" n&o&p&q&r&s&G%t&u&v&w&K%(&x&y&z&A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z& ",
-" `& *.*+*p&q&@*#*$*%*^&u&v&J%&***=*-*;*>*,*'*)*!*~*{*]*^*/*(*_*:*<*[*}*|*V&1*l&Y&Z&2* ",
-" 3*4*5*6*7*8*p&9*0*a*s&b*c*d*v&e*f*g*h*i*j**$k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*Y&Z&A*z* ",
-" B*C*D*E*F*G*H*I*+*p&9*J*r&{&x&K*L*M*N*O*P*Q*R*S*T*U*V*W*X*Y*Z*`* =.=+=@=#=$=%=&=*= ",
-" ==-=;=>=,='=)=!=J*.*~=+*{=]=^=/=(=_=:=l$<=[=}=|=1=2=3=4=5=6=7=8=9=0=a=b=c=%=&=d=e= ",
-" f=g=h=i=3*j=k=l=m=n=o=p=q=~=8*r=^=b*s=t=j$u=-$v=w=x=y=z=A=B=C=D=z*E=F=A*&=d=e=G= ",
-" H===I=J=;=K=L=M=N=O=P=Q=l=n=R=6*S=.*T=D%D%D%U=2%V=V$3%W=J*L=X=Y=$=Z=&=*=e=`= - ",
-" .-+-@-g=#-$-%-&-*-M==---O=P=;-Q=m=>-,-'-)-!-~-{-E%]-^-/-(-_-:-<-*=d=e=`=[-[- ",
-" }-|-1-==2-3-4-4-5-%-6-&-*-X==-=-N=q&;-O=O=O=7-8-9-0-j=a-`&b-c-d=e=`= -[-d-$= ",
-" e-f-g-h-i-4-j-k-l-m-4-c-5-%-6-6-&-&-n-o-o-*-M=p-q-r-3*h=s-X=`= -[-t-u-u- ",
-" v-w-x-y-g-z-A-B-C-j-D-:-l-l-E-m-4-F-F-c-c-c-G-H-#-J=g=I=I-J-t-t-d-u-K- ",
-" L-M-w-N-f-O-P-Q-R-S-T-C-C-B-j-D-D-:-k-l-k-D=U-V-W-X-Y-Z-`-[- ; ;.;u- ",
-" +;@;#;$; ;u-d-t-[- -%;P-Q-R-R-S-B-z*&;*;Y-=;H=-;;;>;,;';);!;%=d- ",
-" ~;{;];u-.;K- ; ;u-d-d-d-t-t-^;/;(;_;;;:;f-}-x-<;w-[;};|;1;2; ",
-" A*%=3;4;5;6;u-7;8;u-K- ; ; ; ;^;9;<;0;w-a;b;v-c;d;e;f;g;h; ",
-" i;j;k;l;d=m;1;n;d= ;i;o;o;o;o;p;@;d;q;+;r;s;3;h;`=K- ",
-" t;u;k;o;e=Z&%=5;*=l;v;v;v;w; ;x;3;p;Z&d=d-i;w; ",
-" y;u;z;v;5;A;A;B;u;u;u;j; ;.;i;C;v;z;u;D; ",
-" E;E;F;G;H;I;I;I;H;D;J;H;K;F;E;K; ",
-" y;L;M;M;N;N;M;N;O;P; ",
-" ",
-" ",
-" ",
-" "};
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e74f5cf2e442458ea5c621e654f853a65031d1b5
GIT binary patch
literal 744
zc$@*~0vG*>P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00009a7bBm000XT
z000XT0n*)m`~Uy~nn^@KR5*==lgn?6VHC!H-*vvZwQ8oV>GVQLHEyY3gAn5KA6SrB
zSXi>LCy`)b!@^2p!_uO55@|(<jl{LY0%bZ=I-U9EKJ#7P_qA}V`&pfwJkOKo<eW$2
zZ#8}{#kSGDNFpk|hmSw;<V@vHFzwfYbKv5xp-p2a2F3=q_l)$V0^Lya?~4m_ujZ!Q
zr*AI>cTPNBiZ_;u#de-OJ-lw!)irCg8wS&fWOik*(G@jKQEhgsP)_)Pccc^F?5f=K
zqi-brJN@XjQ?b#(GfpC6g$bK*SsaDL2z-QFL#wz%MVN?Bj9=m8&BH%C*l}S!o7Y}9
zNBZr^V46rKg%yjSLO~_BNcqD8`tl@|cLij`(q#Yg?V_>z28FwgFAjQ_9YeR{Ez6{;
z6z<0|rFw^jdYeMNM72~$Pj}I~e=EtcAuPkmup)g3zywVEa5wWs!WSQ@IyQPThS)Mj
zXCRF|njw}=<68#47a(SHC_M?%*b7`XVPBkua+<;i5FuV7h8vF&Ms3=TgQIKcN+K#P
zynKnygGU6_CMY8V=qAhy%5FgO6Id3sns{~uksY8jTf)&Kh636?!M*#mb2)<YA_(6H
zlnFB}T6^A*T)hTagGwGui*V)@je3W+9mj}TX!#uC`7=bbiV{BP`fDW01SIa<B(m!u
zri8{K=r+uhppZv6QABDGqy?G@VHL0xQoHrzjG{J6JGq}QkwFw8D1!{3S%Inx%@9O4
zw0-c3fVd6C^H2-Feqz0aYP}@z_8}L$Q3fbLHNeV%?1xGbI(5LGf!uK@6#fv6o}I8_
z8iqp{RnV&-t6*HgDi4Myp=aYi!vv(D>i}rGKpO&0fp`mQ3hL89?SBGGa}xR5clff@
aZ}l0cBPG#LK)$~K0000<MNUMnLSTXkrBPl0
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -504,17 +504,17 @@ BrowserGlue.prototype = {
// See XXX note above
// bmsvc.runInBatchMode(callback, null);
}
catch(ex) {
Components.utils.reportError(ex);
}
finally {
prefBranch.setBoolPref("browser.places.createdSmartBookmarks", true);
- prefBranch.savePrefFile(null);
+ prefBranch.QueryInterface(Ci.nsIPrefService).savePrefFile(null);
}
},
// for XPCOM
classDescription: "Firefox Browser Glue Service",
classID: Components.ID("{eab9012e-5f74-4cbc-b2b5-a590235513cc}"),
contractID: "@mozilla.org/browser/browserglue;1",
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -420,16 +420,17 @@ PlacesController.prototype = {
switch(nodeType) {
case Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY:
nodeData["query"] = true;
break;
case Ci.nsINavHistoryResultNode.RESULT_TYPE_DYNAMIC_CONTAINER:
nodeData["dynamiccontainer"] = true;
break;
case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER:
+ case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT:
nodeData["folder"] = true;
break;
case Ci.nsINavHistoryResultNode.RESULT_TYPE_HOST:
nodeData["host"] = true;
break;
case Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR:
nodeData["separator"] = true;
break;
--- a/browser/components/places/content/editBookmarkOverlay.js
+++ b/browser/components/places/content/editBookmarkOverlay.js
@@ -433,24 +433,24 @@ var gEditItemOverlay = {
},
_updateTags: function EIO__updateTags() {
var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri, { });
var tags = this._getTagsArrayFromTagField();
if (tags.length > 0 || currentTags.length > 0) {
var tagsToRemove = [];
var tagsToAdd = [];
- var t;
- for each (t in currentTags) {
- if (tags.indexOf(t) == -1)
- tagsToRemove.push(t);
+ var i;
+ for (i = 0; i < currentTags.length; i++) {
+ if (tags.indexOf(currentTags[i]) == -1)
+ tagsToRemove.push(currentTags[i]);
}
- for each (t in tags) {
- if (currentTags.indexOf(t) == -1)
- tagsToAdd.push(t);
+ for (i = 0; i < tags.length; i++) {
+ if (currentTags.indexOf(tags[i]) == -1)
+ tagsToAdd.push(tags[i]);
}
if (tagsToAdd.length > 0)
PlacesUtils.tagging.tagURI(this._uri, tagsToAdd);
if (tagsToRemove.length > 0)
PlacesUtils.tagging.untagURI(this._uri, tagsToRemove);
}
},
@@ -638,27 +638,28 @@ var gEditItemOverlay = {
container != PlacesUtils.toolbarFolderId &&
container != PlacesUtils.bookmarksMenuFolderId)
this._markFolderAsRecentlyUsed(container);
}
// Update folder-tree selection
if (!this._folderTree.collapsed) {
var selectedNode = this._folderTree.selectedNode;
- if (!selectedNode || selectedNode.itemId != container)
+ if (!selectedNode ||
+ PlacesUtils.getConcreteItemId(selectedNode) != container)
this._folderTree.selectItems([container]);
}
},
onFolderTreeSelect: function EIO_onFolderTreeSelect() {
var selectedNode = this._folderTree.selectedNode;
if (!selectedNode)
return;
- var folderId = selectedNode.itemId;
+ var folderId = PlacesUtils.getConcreteItemId(selectedNode);
if (this._getFolderIdFromMenuList() == folderId)
return;
var folderItem = this._getFolderMenuItem(folderId);
this._folderMenuList.selectedItem = folderItem;
folderItem.doCommand();
},
@@ -677,17 +678,18 @@ var gEditItemOverlay = {
if (tagsSelector.collapsed)
return;
while (tagsSelector.hasChildNodes())
tagsSelector.removeChild(tagsSelector.lastChild);
var tagsInField = this._getTagsArrayFromTagField();
var allTags = PlacesUtils.tagging.allTags;
- for each (var tag in allTags) {
+ for (var i = 0; i < allTags.length; i++) {
+ var tag = allTags[i];
var elt = document.createElement("listitem");
elt.setAttribute("type", "checkbox");
elt.setAttribute("label", tag);
if (tagsInField.indexOf(tag) != -1)
elt.setAttribute("checked", "true");
tagsSelector.appendChild(elt);
}
--- a/browser/components/places/content/menu.xml
+++ b/browser/components/places/content/menu.xml
@@ -506,27 +506,27 @@
<getter><![CDATA[
if (this._cachedInsertionPoint !== undefined)
return this._cachedInsertionPoint;
// By default, the insertion point is at the top level, at the end.
var index = -1;
var folderId = 0;
if (PlacesUtils.nodeIsFolder(this._resultNode))
- folderId = this._resultNode.itemId;
+ folderId = PlacesUtils.getConcreteItemId(this._resultNode);
if (this.hasSelection) {
if (PlacesUtils.nodeIsFolder(this.selectedNode)) {
// If there is a folder selected, the insertion point is the
// end of the folder.
- folderId = this.selectedNode.itemId;
+ folderId = PlacesUtils.getConcreteItemId(this.selectedNode);
} else {
// If there is another type of node selected, the insertion point
// is after that node.
- folderId = this.selectedNode.parent.itemId;
+ folderId = PlacesUtils.getConcreteItemId(this.selectedNode.parent);
index = PlacesUtils.getIndexOfNode(this.selectedNode)
}
}
this._cachedInsertionPoint = new InsertionPoint(folderId, index);
return this._cachedInsertionPoint;
]]></getter>
</property>
--- a/browser/components/places/content/toolbar.xml
+++ b/browser/components/places/content/toolbar.xml
@@ -390,27 +390,27 @@
<!-- nsIPlacesView -->
<property name="insertionPoint">
<getter><![CDATA[
if (this._cachedInsertionPoint !== undefined)
return this._cachedInsertionPoint;
// By default, the insertion point is at the top level, at the end.
var index = -1;
- var folderId = this._result.root.itemId;
+ var folderId = PlacesUtils.getConcreteItemId(this._result.root);
if (this.hasSelection) {
if (PlacesUtils.nodeIsFolder(this.selectedNode)) {
// If there is a folder selected, the insertion point is the
// end of the folder.
- folderId = this.selectedNode.itemId;
+ folderId = PlacesUtils.getConcreteItemId(this.selectedNode);
} else {
// If there is another type of node selected, the insertion point
// is after that node.
- index = PlacesUtils.getIndexOfNode(this.selectedNode)
+ index = PlacesUtils.getIndexOfNode(this.selectedNode);
}
}
this._cachedInsertionPoint = new InsertionPoint(folderId, index, 1);
return this._cachedInsertionPoint;
]]></getter>
</property>
<!-- nsIPlacesView -->
@@ -751,40 +751,48 @@
if (PlacesUtils.nodeIsFolder(xulNode.node) &&
!PlacesUtils.nodeIsReadOnly(xulNode.node)) {
NS_ASSERT(xulNode.getAttribute("type") == "menu");
// This is a folder. If the mouse is in the left 25% of the
// node, drop to the left of the folder. If it's in the middle
// 50%, drop into the folder. If it's past that, drop to the right.
if (event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width * 0.25)) {
// Drop to the left of this folder.
- dropPoint.ip = new InsertionPoint(result.root.itemId, i, -1);
+ dropPoint.ip =
+ new InsertionPoint(PlacesUtils.getConcreteItemId(result.root),
+ i, -1);
dropPoint.beforeIndex = i;
return dropPoint;
}
else if (event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width * 0.75)) {
// Drop inside this folder.
- dropPoint.ip = new InsertionPoint(xulNode.node.itemId, -1, 1);
+ dropPoint.ip =
+ new InsertionPoint(PlacesUtils.getConcreteItemId(xulNode.node),
+ -1, 1);
dropPoint.beforeIndex = i;
dropPoint.folderNode = xulNode;
return dropPoint;
}
} else{
// This is a non-folder node. If the mouse is left of the middle,
// drop to the left of the folder. If it's right, drop to the right.
if (event.clientX < xulNode.boxObject.x + (xulNode.boxObject.width / 2)) {
// Drop to the left of this bookmark.
- dropPoint.ip = new InsertionPoint(result.root.itemId, i, -1);
+ dropPoint.ip =
+ new InsertionPoint(PlacesUtils.getConcreteItemId(result.root),
+ i, -1);
dropPoint.beforeIndex = i;
return dropPoint;
}
}
}
// Should drop to the right of the last node.
- dropPoint.ip = new InsertionPoint(result.root.itemId, -1, 1);
+ dropPoint.ip =
+ new InsertionPoint(PlacesUtils.getConcreteItemId(result.root),
+ -1, 1);
dropPoint.beforeIndex = -1;
return dropPoint;
},
onDragStart: function TBV_DO_onDragStart(event, xferData, dragAction) {
if (event.target.localName == "toolbarbutton" &&
event.target.getAttribute("type") == "menu") {
#ifdef XP_WIN
--- a/browser/components/places/content/tree.xml
+++ b/browser/components/places/content/tree.xml
@@ -507,36 +507,35 @@
// If the sole selection is an open container, insert into it rather
// than adjacent to it. Note that this only applies to _single_
// selections - if the last element within a multi-selection is an
// open folder, insert _adajacent_ to the selection.
//
// If the sole selection is the bookmarks toolbar folder, we insert
// into it even if it is not opened
+ var itemId =
+ PlacesUtils.getConcreteItemId(resultView.nodeForTreeIndex(max.value));
if (this.hasSingleSelection && resultView.isContainer(max.value) &&
(resultView.isContainerOpen(max.value) ||
- resultView.nodeForTreeIndex(max.value)
- .itemId == PlacesUtils.bookmarksMenuFolderId))
+ itemId == PlacesUtils.bookmarksMenuFolderId))
orientation = NHRVO.DROP_ON;
this._cachedInsertionPoint =
this._getInsertionPoint(max.value, orientation);
return this._cachedInsertionPoint;
]]></getter>
</property>
<method name="_disallowInsertion">
<parameter name="aContainer"/>
<body><![CDATA[
// Disallow insertion of items under readonly folders
- // Disallow insertion of items under the places root
return (!PlacesUtils.nodeIsFolder(aContainer) ||
- PlacesUtils.nodeIsReadOnly(aContainer) ||
- aContainer.itemId == PlacesUtils.placesRootId);
+ PlacesUtils.nodeIsReadOnly(aContainer));
]]></body>
</method>
<method name="_getInsertionPoint">
<parameter name="index"/>
<parameter name="orientation"/>
<body><![CDATA[
var result = this.getResult();
@@ -576,17 +575,18 @@
var lsi = PlacesUtils.getIndexOfNode(lastSelected);
index = orientation == NHRVO.DROP_BEFORE ? lsi : lsi + 1;
}
}
if (this._disallowInsertion(container))
return null;
- return new InsertionPoint(container.itemId, index, orientation);
+ return new InsertionPoint(PlacesUtils.getConcreteItemId(container),
+ index, orientation);
]]></body>
</method>
<!-- nsIPlacesView -->
<field name="peerDropTypes">PlacesUtils.GENERIC_VIEW_DROP_TYPES</field>
<!-- nsIPlacesView -->
<field name="childDropTypes">PlacesUtils.GENERIC_VIEW_DROP_TYPES</field>
@@ -622,17 +622,23 @@
* from the IDs array, and add the found node to the nodes dictionary.
*
* NOTE: This method will leave open any node that had matching items
* in its subtree.
*/
function findNodes(node) {
var foundOne = false;
// See if node matches an ID we wanted; add to results.
+ // For simple folder queries, check both itemId and the concrete
+ // item id.
var index = ids.indexOf(node.itemId);
+ if (index == -1 &&
+ node.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT)
+ index = ids.indexOf(asQuery(node).folderItemId);
+
if (index != -1) {
nodes.push(node);
foundOne = true;
ids.splice(index, 1);
}
if (ids.length == 0 || !PlacesUtils.nodeIsContainer(node) ||
nodesURIChecked.indexOf(node.uri) != -1)
--- a/browser/components/places/content/treeView.js
+++ b/browser/components/places/content/treeView.js
@@ -370,26 +370,27 @@ PlacesTreeView.prototype = {
if (!parent)
item.containerOpen = !item.containerOpen;
}
this._tree.endUpdateBatch();
// restore selection
if (previouslySelectedNodes.length > 0) {
- for each (var nodeInfo in previouslySelectedNodes) {
+ for (var i = 0; i < previouslySelectedNodes.length; i++) {
+ var nodeInfo = previouslySelectedNodes[i];
var index = nodeInfo.node.viewIndex;
// if the same node was used (happens on sorting-changes),
// just use viewIndex
if (index == -1) { // otherwise, try to find an equal node
- var itemId = nodeInfo.node.itemId;
+ var itemId = PlacesUtils.getConcreteItemId(nodeInfo.node);
if (itemId != 1) { // bookmark-nodes in queries case
for (i=0; i < newElements.length && index == -1; i++) {
- if (newElements[i].itemId == itemId)
+ if (PlacesUtils.getConcreteItemId(newElements[i]) == itemId)
index = newElements[i].viewIndex;
}
}
else { // history nodes
var uri = nodeInfo.node.uri;
if (uri) {
for (i=0; i < newElements.length && index == -1; i++) {
if (newElements[i].uri == uri)
@@ -587,20 +588,23 @@ PlacesTreeView.prototype = {
newViewIndex = viewIndex;
break;
}
}
if (newViewIndex < 0) {
// At the end of the child list without finding a visible sibling: This
// is a little harder because we don't know how many rows the last item
// in our list takes up (it could be a container with many children).
- var lastRowCount =
- this._countVisibleRowsForItem(aParent.getChild(aNewIndex - 1));
- newViewIndex =
- aParent.getChild(aNewIndex - 1).viewIndex + lastRowCount;
+ var prevChild = aParent.getChild(aNewIndex - 1);
+ newViewIndex = prevChild.viewIndex + this._countVisibleRowsForItem(prevChild);
+ // If we were in the same parent and we are swapping the order, we need to adjust
+ if (prevChild.parent == aItem.parent &&
+ aItem.viewIndex != -1 && // view index may not be set
+ prevChild.viewIndex > aItem.viewIndex)
+ newViewIndex--;
}
}
// Try collapsing with the previous node. Note that we do not have to try
// to redraw the surrounding rows (which we normally would because session
// boundaries may have changed) because when an item is merged, it will
// always be in the same session.
var showThis = { value: true };
@@ -680,17 +684,18 @@ PlacesTreeView.prototype = {
// if the item was exclusively selected, the node next to it will be
// selected
var selectNext = false;
var selection = this.selection;
if (selection.getRangeCount() == 1) {
var min = { }, max = { };
selection.getRangeAt(0, min, max);
- if (min.value == max.value)
+ if (min.value == max.value &&
+ this.nodeForTreeIndex(min.value) == aItem)
selectNext = true;
}
// this may have been a container, in which case it has a lot of rows
var count = this._countVisibleRowsForItem(aItem);
// We really want tail recursion here, since we sometimes do another
// remove after this when duplicates are being collapsed. This loop
@@ -774,17 +779,18 @@ PlacesTreeView.prototype = {
// remove the nodes, let itemInserted restore all of its contents
this._visibleElements.splice(oldViewIndex, count);
this._tree.rowCountChanged(oldViewIndex, -count);
this.itemInserted(aNewParent, aItem, aNewIndex);
// restore selection
if (nodesToSelect.length > 0) {
- for each (var node in nodesToSelect) {
+ for (var i = 0; i < nodesToSelect.length; i++) {
+ var node = nodesToSelect[i];
var index = node.viewIndex;
selection.rangedSelect(index, index, true);
}
selection.selectEventsSuppressed = false;
}
},
/**
@@ -1004,35 +1010,37 @@ PlacesTreeView.prototype = {
else
var columnType = aColumn.id;
if (columnType != "title")
return;
var node = this._visibleElements[aRow];
- // To disable the tree gestures for containers (e.g. double-click to open)
- // we don't mark container nodes as such in flat list mode. The container
- // appearance is desired though, so we add the container atom manually.
- if (this._flatList && PlacesUtils.nodeIsContainer(node))
- aProperties.AppendElement(this._getAtomFor("container"));
-
- if (PlacesUtils.nodeIsSeparator(node))
- aProperties.AppendElement(this._getAtomFor("separator"));
- else if (node.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY)
- aProperties.AppendElement(this._getAtomFor("query"));
- else if (node.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER) {
- if (PlacesUtils.annotations.itemHasAnnotation(node.itemId,
- LMANNO_FEEDURI))
- aProperties.AppendElement(this._getAtomFor("livemark"));
- else if (PlacesUtils.bookmarks.getFolderIdForItem(node.itemId) ==
- PlacesUtils.tagsFolderId) {
- aProperties.AppendElement(this._getAtomFor("tagContainer"));
+ var nodeType = node.type;
+ if (PlacesUtils.containerTypes.indexOf(nodeType) != -1) {
+ // To disable the tree gestures for containers (e.g. double-click to open)
+ // we don't mark container nodes as such in flat list mode. The container
+ // appearance is desired though, so we add the container atom manually.
+ if (this._flatList)
+ aProperties.AppendElement(this._getAtomFor("container"));
+ if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY)
+ aProperties.AppendElement(this._getAtomFor("query"));
+ else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER ||
+ nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT) {
+ if (PlacesUtils.annotations.itemHasAnnotation(node.itemId,
+ LMANNO_FEEDURI))
+ aProperties.AppendElement(this._getAtomFor("livemark"));
+ else if (PlacesUtils.bookmarks.getFolderIdForItem(node.itemId) ==
+ PlacesUtils.tagsFolderId)
+ aProperties.AppendElement(this._getAtomFor("tagContainer"));
}
}
+ else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR)
+ aProperties.AppendElement(this._getAtomFor("separator"));
},
getColumnProperties: function(aColumn, aProperties) { },
isContainer: function PTV_isContainer(aRow) {
this._ensureValidRow(aRow);
if (this._flatList)
return false; // but see getCellProperties
--- a/browser/components/places/content/utils.js
+++ b/browser/components/places/content/utils.js
@@ -248,17 +248,18 @@ var PlacesUtils = {
/**
* Determines whether or not a ResultNode is a Bookmark folder or not.
* @param aNode
* A result node
* @returns true if the node is a Bookmark folder, false otherwise
*/
nodeIsFolder: function PU_nodeIsFolder(aNode) {
NS_ASSERT(aNode, "null node");
- return (aNode.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER);
+ return (aNode.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER ||
+ aNode.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT);
},
/**
* Determines whether or not a ResultNode represents a bookmarked URI.
* @param aNode
* A result node
* @returns true if the node represents a bookmarked URI, false otherwise
*/
@@ -326,17 +327,17 @@ var PlacesUtils = {
* @param aNode
* A result node
* @returns true if the node is readonly, false otherwise
*/
nodeIsReadOnly: function PU_nodeIsReadOnly(aNode) {
NS_ASSERT(aNode, "null node");
if (this.nodeIsFolder(aNode))
- return this.bookmarks.getFolderReadonly(aNode.itemId);
+ return this.bookmarks.getFolderReadonly(asQuery(aNode).folderItemId);
if (this.nodeIsQuery(aNode))
return asQuery(aNode).childrenReadOnly;
return false;
},
/**
* Determines whether or not a ResultNode is a host folder or not
* @param aNode
@@ -350,16 +351,17 @@ var PlacesUtils = {
/**
* Determines whether or not a ResultNode is a container item or not
* @param aNode
* A result node
* @returns true if the node is a container item, false otherwise
*/
containerTypes: [Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER,
+ Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT,
Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY,
Ci.nsINavHistoryResultNode.RESULT_TYPE_HOST,
Ci.nsINavHistoryResultNode.RESULT_TYPE_DAY,
Ci.nsINavHistoryResultNode.RESULT_TYPE_DYNAMIC_CONTAINER],
nodeIsContainer: function PU_nodeIsContainer(aNode) {
NS_ASSERT(aNode, "null node");
return this.containerTypes.indexOf(aNode.type) != -1;
},
@@ -409,17 +411,27 @@ var PlacesUtils = {
* @param aNode
* The node to test.
* @returns true if the node is a readonly folder.
*/
isReadonlyFolder: function(aNode) {
NS_ASSERT(aNode, "null node");
return this.nodeIsFolder(aNode) &&
- this.bookmarks.getFolderReadonly(aNode.itemId);
+ this.bookmarks.getFolderReadonly(asQuery(aNode).folderItemId);
+ },
+
+ /**
+ * Gets the concrete item-id for the given node. Generally, this is just
+ * node.itemId, but for folder-shortcuts that's node.folderItemId.
+ */
+ getConcreteItemId: function PU_getConcreteItemId(aNode) {
+ if (aNode.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT)
+ return asQuery(aNode).folderItemId;
+ return aNode.itemId;
},
/**
* Gets the index of a node within its parent container
* @param aNode
* The node to look up
* @returns The index of the node within its parent container, or -1 if the
* node was not found or the node specified has no parent.
@@ -1561,18 +1573,19 @@ var PlacesUtils = {
/**
* Get the most recently added/modified bookmark for a URL, excluding items
* under tag or livemark containers. -1 is returned if no item is found.
*/
getMostRecentBookmarkForURI:
function PU_getMostRecentBookmarkForURI(aURI) {
var bmkIds = this.bookmarks.getBookmarkIdsForURI(aURI, {});
- for each (var bk in bmkIds) {
+ for (var i = 0; i < bmkIds.length; i++) {
// Find the first folder which isn't a tag container
+ var bk = bmkIds[i];
var parent = this.bookmarks.getFolderIdForItem(bk);
if (parent == this.unfiledBookmarksFolderId)
return bk;
var grandparent = this.bookmarks.getFolderIdForItem(parent);
if (grandparent != this.tagsFolderId &&
!this.annotations.itemHasAnnotation(parent, LMANNO_FEEDURI))
return bk;
@@ -1683,17 +1696,18 @@ var PlacesUtils = {
return reallyOpen;
},
/** aItemsToOpen needs to be an array of objects of the form:
* {uri: string, isBookmark: boolean}
*/
_openTabset: function PU__openTabset(aItemsToOpen, aEvent) {
var urls = [];
- for each (var item in aItemsToOpen) {
+ for (var i = 0; i < aItemsToOpen.length; i++) {
+ var item = aItemsToOpen[i];
if (item.isBookmark)
this.markPageAsFollowedBookmark(item.uri);
else
this.markPageAsTyped(item.uri);
urls.push(item.uri);
}
--- a/browser/components/preferences/advanced.js
+++ b/browser/components/preferences/advanced.js
@@ -50,16 +50,17 @@ var gAdvancedPane = {
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
if (preference.value === null)
return;
advancedPrefs.selectedIndex = preference.value;
this.updateAppUpdateItems();
this.updateAutoItems();
this.updateModeItems();
+ this.updateOfflineApps();
},
/**
* Stores the identity of the current tab in preferences so that the selected
* tab can be persisted between openings of the preferences window.
*/
tabSelectionChanged: function ()
{
@@ -174,16 +175,104 @@ var gAdvancedPane = {
{
var cacheService = Components.classes["@mozilla.org/network/cache-service;1"]
.getService(Components.interfaces.nsICacheService);
try {
cacheService.evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
} catch(ex) {}
},
+ /**
+ * Updates the list of offline applications
+ */
+ updateOfflineApps: function ()
+ {
+ var pm = Components.classes["@mozilla.org/permissionmanager;1"]
+ .getService(Components.interfaces.nsIPermissionManager);
+
+ var list = document.getElementById("offlineAppsList");
+ while (list.firstChild) {
+ list.removeChild(list.firstChild);
+ }
+
+ var enumerator = pm.enumerator;
+ while (enumerator.hasMoreElements()) {
+ var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
+ if (perm.type == "offline-app" &&
+ perm.capability != Components.interfaces.nsIPermissionManager.DEFAULT_ACTION &&
+ perm.capability != Components.interfaces.nsIPermissionManager.DENY_ACTION) {
+ var row = document.createElementNS(kXULNS, "listitem");
+ row.id = "";
+ row.className = "listitem";
+ row.setAttribute("label", perm.host);
+
+ list.appendChild(row);
+ }
+ }
+ },
+
+ offlineAppSelected: function()
+ {
+ var removeButton = document.getElementById("offlineAppsListRemove");
+ var list = document.getElementById("offlineAppsList");
+ if (list.selectedItem) {
+ removeButton.setAttribute("disabled", "false");
+ } else {
+ removeButton.setAttribute("disabled", "true");
+ }
+ },
+
+ removeOfflineApp: function()
+ {
+ var list = document.getElementById("offlineAppsList");
+ var item = list.selectedItem;
+ var host = item.getAttribute("label");
+
+ var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Components.interfaces.nsIPromptService);
+ var flags = prompts.BUTTON_TITLE_IS_STRING * prompts.BUTTON_POS_0 +
+ prompts.BUTTON_TITLE_CANCEL * prompts.BUTTON_POS_1;
+
+ var bundle = document.getElementById("bundlePreferences");
+ var title = bundle.getString("offlineAppRemoveTitle");
+ var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [host]);
+ var confirm = bundle.getString("offlineAppRemoveConfirm");
+ var result = prompts.confirmEx(window, title, prompt, flags, confirm,
+ null, null, null, {});
+ if (result != 0)
+ return;
+
+ // clear offline cache entries
+ var cacheService = Components.classes["@mozilla.org/network/cache-service;1"]
+ .getService(Components.interfaces.nsICacheService);
+ var cacheSession = cacheService.createSession("HTTP-offline",
+ Components.interfaces.nsICache.STORE_OFFLINE,
+ true)
+ .QueryInterface(Components.interfaces.nsIOfflineCacheSession);
+ cacheSession.clearKeysOwnedByDomain(host);
+ cacheSession.evictUnownedEntries();
+
+ // send out an offline-app-removed signal. The nsDOMStorage
+ // service will clear DOM storage for this host.
+ var obs = Components.classes["@mozilla.org/observer-service;1"]
+ .getService(Components.interfaces.nsIObserverService);
+ obs.notifyObservers(null, "offline-app-removed", host);
+
+ // remove the permission
+ var pm = Components.classes["@mozilla.org/permissionmanager;1"]
+ .getService(Components.interfaces.nsIPermissionManager);
+ pm.remove(host, "offline-app",
+ Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
+ pm.remove(host, "offline-app",
+ Components.interfaces.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
+
+ list.removeChild(item);
+ gAdvancedPane.offlineAppSelected();
+ },
+
// UPDATE TAB
/*
* Preferences:
*
* app.update.enabled
* - true if updates to the application are enabled, false otherwise
* extensions.update.enabled
--- a/browser/components/preferences/advanced.xul
+++ b/browser/components/preferences/advanced.xul
@@ -19,16 +19,17 @@
# The Initial Developer of the Original Code is
# Ben Goodger.
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Goodger <[email protected]>
# Jeff Walden <[email protected]>
+# Ehsan Akhgari <[email protected]>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
@@ -209,34 +210,53 @@
<hbox align="center">
<description flex="1" control="connectionSettings">&connectionDesc.label;</description>
<button id="connectionSettings" icon="network" label="&connectionSettings.label;"
accesskey="&connectionSettings.accesskey;"
oncommand="gAdvancedPane.showConnections();"/>
</hbox>
</groupbox>
- <!-- Cache -->
- <groupbox id="cacheGroup">
- <caption label="&cache.label;"/>
+ <!-- Cache/Offline apps -->
+ <groupbox id="offlineGroup">
+ <caption label="&offlineStorage.label;"/>
<hbox align="center">
<label id="useCacheBefore"
accesskey="&useCacheBefore.accesskey;">&useCacheBefore.label;</label>
<textbox id="cacheSize" type="number" size="2"
preference="browser.cache.disk.capacity"
onsyncfrompreference="return gAdvancedPane.readCacheSize();"
onsynctopreference="return gAdvancedPane.writeCacheSize();"
aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
<label id="useCacheAfter" flex="1">&useCacheAfter.label;</label>
<button id="clearCacheButton" icon="clear"
label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"
oncommand="gAdvancedPane.clearCache();"/>
</hbox>
- </groupbox>
+ <hbox>
+ <vbox flex="1">
+
+ <label id="offlineAppsListLabel">&offlineAppsList.label;</label>
+ <listbox id="offlineAppsList"
+ style="height: &offlineAppsList.height;;"
+ flex="1"
+ aria-labelledby="offlineAppsListLabel"
+ onselect="gAdvancedPane.offlineAppSelected(event);">
+ </listbox>
+ </vbox>
+ <vbox pack="end">
+ <button id="offlineAppsListRemove"
+ disabled="true"
+ label="&offlineAppsListRemove.label;"
+ accesskey="&offlineAppsListRemove.accesskey;"
+ oncommand="gAdvancedPane.removeOfflineApp();"/>
+ </vbox>
+ </hbox>
+ </groupbox>
</tabpanel>
<!-- Update -->
<tabpanel id="updatePanel" orient="vertical" align="start">
<label control="autoUpdateGroup">&autoCheck.label;</label>
<vbox class="indent" id="autoUpdateGroup" role="group">
<checkbox id="enableAppUpdate"
label="&enableAppUpdate.label;"
@@ -310,17 +330,17 @@
</rows>
</grid>
</groupbox>
<!-- Certificates -->
<groupbox id="certificatesGroup">
<caption id="CertGroupCaption" label="&certificates.label;"/>
- <description id="CertSelectionDesc" control="certSelection">&certselect.description;</description>
+ <description id="CertSelectionDesc" control="certSelection">&certSelection.description;</description>
<!--
The values on these radio buttons may look like l12y issues, but
they're not - this preference uses *those strings* as its values.
I KID YOU NOT.
-->
<radiogroup id="certSelection" orient="horizontal" preftype="string"
preference="security.default_personal_cert" aria-abelledby="CertGroupCaption CertSelectionDesc">
--- a/browser/components/preferences/applications.js
+++ b/browser/components/preferences/applications.js
@@ -845,20 +845,26 @@ var gApplicationsPane = {
this._prefSvc.addObserver(PREF_FEED_SELECTED_READER, this, false);
// Listen for window unload so we can remove our preference observers.
window.addEventListener("unload", this, false);
// Figure out how we should be sorting the list. We persist sort settings
// across sessions, so we can't assume the default sort column/direction.
// XXX should we be using the XUL sort service instead?
- if (document.getElementById("typeColumn").hasAttribute("sortDirection"))
+ if (document.getElementById("actionColumn").hasAttribute("sortDirection")) {
+ this._sortColumn = document.getElementById("actionColumn");
+ // The typeColumn element always has a sortDirection attribute,
+ // either because it was persisted or because the default value
+ // from the xul file was used. If we are sorting on the other
+ // column, we should remove it.
+ document.getElementById("typeColumn").removeAttribute("sortDirection");
+ }
+ else
this._sortColumn = document.getElementById("typeColumn");
- else if (document.getElementById("actionColumn").hasAttribute("sortDirection"))
- this._sortColumn = document.getElementById("actionColumn");
// Load the data and build the list of handlers.
// By doing this in a timeout, we let the preferences dialog resize itself
// to an appropriate size before we add a bunch of items to the list.
// Otherwise, if there are many items, and the Applications prefpane
// is the one that gets displayed when the user first opens the dialog,
// the dialog might stretch too much in an attempt to fit them all in.
// XXX Shouldn't we perhaps just set a max-height on the richlistbox?
@@ -1011,29 +1017,30 @@ var gApplicationsPane = {
_rebuildVisibleTypes: function() {
// Reset the list of visible types and the visible type description counts.
this._visibleTypes = [];
this._visibleTypeDescriptionCount = {};
// Get the preferences that help determine what types to show.
var showPlugins = this._prefSvc.getBoolPref(PREF_SHOW_PLUGINS_IN_LIST);
- var hideTypesWithoutExtensions =
+ var hidePluginsWithoutExtensions =
this._prefSvc.getBoolPref(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS);
for (let type in this._handledTypes) {
let handlerInfo = this._handledTypes[type];
- // Hide types without extensions if so prefed so we don't show a whole
- // bunch of obscure types handled by plugins on Mac.
+ // Hide plugins without associated extensions if so prefed so we don't
+ // show a whole bunch of obscure types handled by plugins on Mac.
// Note: though protocol types don't have extensions, we still show them;
- // the pref is only meant to be applied to MIME types.
- // FIXME: if the type has a plugin, should we also check the "suffixes"
- // property of the plugin? Filed as bug 395135.
- if (hideTypesWithoutExtensions &&
+ // the pref is only meant to be applied to MIME types, since plugins are
+ // only associated with MIME types.
+ // FIXME: should we also check the "suffixes" property of the plugin?
+ // Filed as bug 395135.
+ if (hidePluginsWithoutExtensions && handlerInfo.handledOnlyByPlugin &&
handlerInfo.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo &&
!handlerInfo.primaryExtension)
continue;
// Hide types handled only by plugins if so prefed.
if (handlerInfo.handledOnlyByPlugin && !showPlugins)
continue;
--- a/browser/components/preferences/cookies.js
+++ b/browser/components/preferences/cookies.js
@@ -265,16 +265,28 @@ var gCookiesWindow = {
}
return null;
},
_removeItemAtIndex: function (aIndex, aCount)
{
var removeCount = aCount === undefined ? 1 : aCount;
if (this._filtered) {
+ // remove the cookies from the unfiltered set so that they
+ // don't reappear when the filter is changed. See bug 410863.
+ for (var i = aIndex; i < aIndex + removeCount; ++i) {
+ var item = this._filterSet[i];
+ var parent = gCookiesWindow._hosts[item.rawHost];
+ for (var j = 0; j < parent.cookies.length; ++j) {
+ if (item == parent.cookies[j]) {
+ parent.cookies.splice(j, 1);
+ break;
+ }
+ }
+ }
this._filterSet.splice(aIndex, removeCount);
return;
}
var item = this._getItemAtIndex(aIndex);
if (!item) return;
this._invalidateCache(aIndex - 1);
if (item.container)
--- a/browser/components/preferences/sanitize.xul
+++ b/browser/components/preferences/sanitize.xul
@@ -57,16 +57,17 @@
<preferences>
<preference id="privacy.item.history" name="privacy.item.history" type="bool"/>
<preference id="privacy.item.formdata" name="privacy.item.formdata" type="bool"/>
<preference id="privacy.item.passwords" name="privacy.item.passwords" type="bool"/>
<preference id="privacy.item.downloads" name="privacy.item.downloads" type="bool"/>
<preference id="privacy.item.cookies" name="privacy.item.cookies" type="bool"/>
<preference id="privacy.item.cache" name="privacy.item.cache" type="bool"/>
+ <preference id="privacy.item.offlineApps" name="privacy.item.offlineApps" type="bool"/>
<preference id="privacy.item.sessions" name="privacy.item.sessions" type="bool"/>
</preferences>
<description>&clearDataSettings.label;</description>
<checkbox label="&itemHistory.label;"
accesskey="&itemHistory.accesskey;"
preference="privacy.item.history"/>
@@ -77,16 +78,19 @@
accesskey="&itemFormSearchHistory.accesskey;"
preference="privacy.item.formdata"/>
<checkbox label="&itemCache.label;"
accesskey="&itemCache.accesskey;"
preference="privacy.item.cache"/>
<checkbox label="&itemCookies.label;"
accesskey="&itemCookies.accesskey;"
preference="privacy.item.cookies"/>
+ <checkbox label="&itemOfflineApps.label;"
+ accesskey="&itemOfflineApps.accesskey;"
+ preference="privacy.item.offlineApps"/>
<checkbox label="&itemPasswords.label;"
accesskey="&itemPasswords.accesskey;"
preference="privacy.item.passwords"/>
<checkbox label="&itemSessions.label;"
accesskey="&itemSessions.accesskey;"
preference="privacy.item.sessions"/>
</prefpane>
--- a/browser/components/safebrowsing/content/malware-warden.js
+++ b/browser/components/safebrowsing/content/malware-warden.js
@@ -85,22 +85,26 @@ function PROT_MalwareWarden() {
},
updateUrlRequested: function(url) { },
streamCompleted: function() { },
updateError: function(errorCode) { },
updateSuccess: function(requestedTimeout) { }
};
- dbService_.beginUpdate(listener);
- dbService_.beginStream();
- dbService_.updateStream(testUpdate);
- dbService_.finishStream();
- dbService_.finishUpdate();
-
+ try {
+ dbService_.beginUpdate(listener);
+ dbService_.beginStream();
+ dbService_.updateStream(testUpdate);
+ dbService_.finishStream();
+ dbService_.finishUpdate();
+ } catch(ex) {
+ // beginUpdate will throw harmlessly if there's an existing update
+ // in progress, ignore failures.
+ }
G_Debug(this, "malwareWarden initialized");
}
PROT_MalwareWarden.inherits(PROT_ListWarden);
/**
* Cleanup on shutdown.
*/
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -21,16 +21,17 @@
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Pierre Chanial (v2) <[email protected]>
# Gavin Sharp (v3) <[email protected]>
# Ben Goodger <[email protected]>
# Pamela Greene <[email protected]>
# Michael Ventnor <[email protected]>
+# Ehsan Akhgari <[email protected]>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
@@ -86,18 +87,17 @@
<xul:image class="searchbar-dropmarker-image"/>
<xul:menupopup class="searchbar-popup"
anonid="searchbar-popup"
position="after_start">
<xul:menuseparator/>
<xul:menuitem class="open-engine-manager"
anonid="open-engine-manager"
label="&cmd_engineManager.label;"
- oncommand="openManager(event);"
- accesskey="&cmd_engineManager.accesskey;"/>
+ oncommand="openManager(event);"/>
</xul:menupopup>
</xul:button>
<xul:hbox class="search-go-container">
<xul:image class="search-go-button"
anonid="search-go-button"
chromedir="&locale.dir;"
onclick="handleSearchCommand(event);"
tooltiptext="&searchEndCap.label;" />
@@ -547,17 +547,21 @@
this.focus();
this.select();
]]></handler>
<handler event="popupshowing" action="this.rebuildPopupDynamic();"/>
<handler event="DOMMouseScroll"
phase="capturing"
- action="this.selectEngine(event, (event.detail > 0));"/>
+#ifdef XP_MACOSX
+ action="if (event.metaKey) this.selectEngine(event, (event.detail > 0));"/>
+#else
+ action="if (event.ctrlKey) this.selectEngine(event, (event.detail > 0));"/>
+#endif
</handlers>
</binding>
<binding id="searchbar-textbox"
extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
<implementation implements="nsIObserver nsIDOMXULLabeledControlElement">
<constructor><![CDATA[
if (document.getBindingParent(this).parentNode.parentNode.localName ==
--- a/browser/components/search/nsSearchSuggestions.js
+++ b/browser/components/search/nsSearchSuggestions.js
@@ -422,17 +422,17 @@ SuggestAutoComplete.prototype = {
_startHistorySearch: function SAC_SHSearch(searchString, searchParam, previousResult) {
var formHistory =
Cc["@mozilla.org/autocomplete/search;1?name=form-history"].
createInstance(Ci.nsIAutoCompleteSearch);
formHistory.startSearch(searchString, searchParam, previousResult, this);
},
/**
- * Makes a note of the fact that we've recieved a backoff-triggering
+ * Makes a note of the fact that we've received a backoff-triggering
* response, so that we can adjust the backoff behavior appropriately.
*/
_noteServerError: function SAC__noteServeError() {
var currentTime = Date.now();
this._serverErrorLog.push(currentTime);
if (this._serverErrorLog.length > this._maxErrorsBeforeBackoff)
this._serverErrorLog.shift();
--- a/browser/components/sessionstore/src/nsSessionStore.js
+++ b/browser/components/sessionstore/src/nsSessionStore.js
@@ -860,18 +860,16 @@ SessionStoreService.prototype = {
browser.parentNode.__SS_data = tabData;
}
else {
tabData.entries[0] = { url: browser.currentURI.spec };
tabData.index = 1;
}
- tabData.zoom = browser.markupDocumentViewer.textZoom;
-
var disallow = [];
for (var i = 0; i < CAPABILITIES.length; i++)
if (!browser.docShell["allow" + CAPABILITIES[i]])
disallow.push(CAPABILITIES[i]);
if (disallow.length > 0)
tabData.disallow = disallow.join(",");
else if (tabData.disallow)
delete tabData.disallow;
@@ -1497,18 +1495,16 @@ SessionStoreService.prototype = {
if (!tabData.entries) {
tabData.entries = [];
}
if (tabData.extData) {
tab.__SS_extdata = tabData.extData;
}
- browser.markupDocumentViewer.textZoom = parseFloat(tabData.zoom || 1);
-
for (var i = 0; i < tabData.entries.length; i++) {
history.addEntry(this._deserializeHistoryEntry(tabData.entries[i], aIdMap), true);
}
// make sure to reset the capabilities and attributes, in case this tab gets reused
var disallow = (tabData.disallow)?tabData.disallow.split(","):[];
CAPABILITIES.forEach(function(aCapability) {
browser.docShell["allow" + aCapability] = disallow.indexOf(aCapability) == -1;
--- a/browser/fuel/src/fuelApplication.js
+++ b/browser/fuel/src/fuelApplication.js
@@ -1152,18 +1152,16 @@ function Application() {
this._info = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Ci.nsIXULAppInfo);
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService);
os.addObserver(this, "final-ui-startup", false);
os.addObserver(this, "quit-application-requested", false);
- os.addObserver(this, "quit-application-granted", false);
- os.addObserver(this, "quit-application", false);
os.addObserver(this, "xpcom-shutdown", false);
}
//=================================================
// Application implementation
Application.prototype = {
// for nsIClassInfo + XPCOMUtils
classDescription: "Application",
@@ -1216,21 +1214,17 @@ Application.prototype = {
gShutdown.shift()();
}
// release our observers
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService);
os.removeObserver(this, "final-ui-startup");
-
os.removeObserver(this, "quit-application-requested");
- os.removeObserver(this, "quit-application-granted");
- os.removeObserver(this, "quit-application");
-
os.removeObserver(this, "xpcom-shutdown");
this._info = null;
this._console = null;
this._prefs = null;
this._storage = null;
this._events = null;
this._extensions = null;
--- a/browser/installer/removed-files.in
+++ b/browser/installer/removed-files.in
@@ -34,16 +34,17 @@ searchplugins/eBay.src
searchplugins/eBay.gif
searchplugins/google.src
searchplugins/google.gif
searchplugins/yahoo.src
searchplugins/yahoo.gif
searchplugins/
#ifdef MOZ_ENABLE_LIBXUL
@DLL_PREFIX@xpcom_core@DLL_SUFFIX@
+@DLL_PREFIX@xpistub@DLL_SUFFIX@
components/@DLL_PREFIX@jar50@DLL_SUFFIX@
#ifdef XP_WIN
components/jsd3250.dll
components/xpinstal.dll
#else
components/@DLL_PREFIX@jsd@DLL_SUFFIX@
components/@DLL_PREFIX@xpinstall@DLL_SUFFIX@
#endif
@@ -54,17 +55,16 @@ XUL
#else
@DLL_PREFIX@xul@DLL_SUFFIX@
#endif
#endif
component.reg
components/compreg.dat
components/@DLL_PREFIX@myspell@DLL_SUFFIX@
components/@DLL_PREFIX@spellchecker@DLL_SUFFIX@
-components/spellchecker.xpt
components/@DLL_PREFIX@spellchk@DLL_SUFFIX@
components/xpti.dat
components/xptitemp.dat
components/nsBackgroundUpdateService.js
components/nsCloseAllWindows.js
#ifndef XP_MACOSX
components/autocomplete.xpt
#endif
@@ -85,16 +85,17 @@ components/talkback/talkback
components/talkback/talkback.so
components/talkback/XTalkback.ad
extensions/[email protected]/install.rdf
extensions/[email protected]/chrome.manifest
extensions/[email protected]/chrome/reporter.jar
extensions/[email protected]/defaults/preferences/reporter.js
extensions/[email protected]/components/inspector.xpt
extensions/[email protected]/components/@DLL_PREFIX@inspector@DLL_SUFFIX@
+extensions/[email protected]/chrome/icons/default/winInspectorMain.ico
uninstall/UninstallFirefox.exe
uninstall/UninstallDeerPark.exe
uninstall/uninst.exe
uninstall/uninstall.exe
components/myspell/en-US.dic
components/myspell/en-US.aff
searchplugins/DRAE.src
searchplugins/DRAE.png
@@ -517,18 +518,18 @@ extensions/[email protected]/componen
extensions/[email protected]/components/talkback/Talkback.app/Contents/Resources/KeyInfoSections.plist
extensions/[email protected]/components/talkback/Talkback.app/Contents/Resources/send.tiff
extensions/[email protected]/components/talkback/Talkback.app/Contents/Resources/sort_ascending.tiff
extensions/[email protected]/components/talkback/Talkback.app/Contents/Resources/sort_descending.tiff
extensions/[email protected]/components/talkback/Talkback.app/Contents/Resources/Talkback.icns
#else
extensions/[email protected]/components/talkback/talkback
extensions/[email protected]/components/talkback/XTalkback.ad
-extensions/[email protected]/components/master.ini
-extensions/[email protected]/components/talkback.so
+extensions/[email protected]/components/talkback/master.ini
+extensions/[email protected]/components/talkback/talkback.so
#endif
#endif
components/airbag.xpt
components/nsUrlClassifierTable.js
res/html/gopher-audio.gif
res/html/gopher-binary.gif
res/html/gopher-find.gif
res/html/gopher-image.gif
@@ -541,9 +542,40 @@ res/html/gopher-unknown.gif
res/fonts/mathfontCMEX10.properties
res/fonts/mathfontCMSY10.properties
res/fonts/mathfontMath1.properties
res/fonts/mathfontMath2.properties
res/fonts/mathfontMath4.properties
res/fonts/mathfontMTExtra.properties
res/fonts/mathfontPUA.properties
res/fonts/mathfontSymbol.properties
-
+res/fonts/fontEncoding.properties
+res/fonts/pangoFontEncoding.properties
+res/fonts/fontNameMap.properties
+@DLL_PREFIX@xpcom_compat@DLL_SUFFIX@
+components/nsDictionary.js
+components/nsXmlRpcClient.js
+components/nsInterfaceInfoToIDL.js
+chrome/chromelist.txt
+#ifdef XP_MACOSX
+LICENSE
+extensions/[email protected]/chrome/chromelist.txt
+components/accessibility.xpt
+components/gksvgrenderer.xpt
+components/jsconsole.xpt
+components/necko_data.xpt
+components/nsKillAll.js
+components/passwordmgr.xpt
+components/progressDlg.xpt
+components/search.xpt
+components/websrvcs.xpt
+components/widget_mac.xpt
+components/xml-rpc.xpt
+components/xpcom_obsolete.xpt
+init.d/README
+redo-prebinding.sh
+res/viewer.properties
+#endif
+#ifdef XP_UNIX
+readme.txt
+#endif
+dictionaries/PL.dic
+dictionaries/PL.aff
--- a/browser/installer/unix/config.it
+++ b/browser/installer/unix/config.it
@@ -755,16 +755,23 @@ Do Not Uninstall=FALSE
[Copy File8]
Timing=post smartupdate
Source=[$GRE_INSTALL_DIR]\freebl3.chk
Destination=[SETUP PATH]
Fail If Exists=FALSE
Do Not Uninstall=FALSE
+[Copy File9]
+Timing=post smartupdate
+Source=[$GRE_INSTALL_DIR]\nssutil3.dll
+Destination=[SETUP PATH]
+Fail If Exists=FALSE
+Do Not Uninstall=FALSE
+
[Path Lookup $GRE_INSTALL_DIR]
Path Reg Key Root=HKEY_LOCAL_MACHINE
Path Reg Key=Software\mozilla.org\GRE\$GreUniqueID$\Main
Path Reg Name=Install Directory
Strip Filename=FALSE
;Copy File SequentialX sections
--- a/browser/installer/unix/packages-static
+++ b/browser/installer/unix/packages-static
@@ -49,16 +49,17 @@ bin/application.ini
bin/platform.ini
bin/mozilla-xremote-client
bin/run-mozilla.sh
bin/plugins/libnullplugin.so
bin/res/cmessage.txt
bin/res/effective_tld_names.dat
bin/xpicleanup
bin/libsqlite3.so
+bin/README.txt
; [Components]
bin/components/alerts.xpt
bin/components/accessibility.xpt
bin/components/appshell.xpt
bin/components/appstartup.xpt
bin/components/autocomplete.xpt
bin/components/autoconfig.xpt
@@ -156,16 +157,17 @@ bin/components/pref.xpt
bin/components/progressDlg.xpt
bin/components/proxyObjInst.xpt
bin/components/toolkitremote.xpt
bin/components/rdf.xpt
bin/components/satchel.xpt
bin/components/saxparser.xpt
bin/components/search.xpt
bin/components/shistory.xpt
+bin/components/spellchecker.xpt
bin/components/storage.xpt
bin/components/profile.xpt
bin/components/toolkitprofile.xpt
bin/components/txtsvc.xpt
bin/components/txmgr.xpt
bin/components/uconv.xpt
bin/components/unicharutil.xpt
bin/components/uriloader.xpt
@@ -266,17 +268,17 @@ bin/chrome/browser.jar
bin/chrome/browser.manifest
bin/chrome/classic.jar
bin/chrome/classic.manifest
bin/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf
bin/chrome/comm.jar
bin/chrome/comm.manifest
bin/chrome/toolkit.jar
bin/chrome/toolkit.manifest
-bin/chrome/icons/default/default.xpm
+bin/chrome/icons/default/default16.png
bin/chrome/reporter.manifest
bin/chrome/reporter.jar
bin/@PREF_DIR@/reporter.js
; shell icons
bin/icons/*.xpm
bin/icons/*.png
@@ -343,16 +345,17 @@ bin/components/dom_svg.xpt
; [Personal Security Manager]
;
bin/libnssckbi.so
bin/components/pipboot.xpt
bin/components/pipnss.xpt
bin/components/pippki.xpt
bin/libnss3.so
+bin/libnssutil3.so
bin/libsmime3.so
bin/libsoftokn3.chk
bin/libsoftokn3.so
bin/libfreebl3.chk
bin/libfreebl3.so
bin/libssl3.so
bin/libnssdbm3.so
bin/chrome/pipnss.jar
@@ -370,16 +373,18 @@ bin/libfreebl_32int64_3.so
; [Updater]
;
bin/updater
; [Crash Reporter]
;
bin/crashreporter
bin/crashreporter.ini
+bin/crashreporter-override.ini
+bin/Throbber-small.gif
; [Extensions]
;
bin/components/libnkgnomevfs.so
bin/components/libauth.so
; [Additional Developer Tools]
[adt]
--- a/browser/installer/windows/packages-static
+++ b/browser/installer/windows/packages-static
@@ -177,16 +177,17 @@ bin\components\unicharutil.xpt
bin\components\uriloader.xpt
bin\components\webBrowser_core.xpt
bin\components\webbrowserpersist.xpt
bin\components\webshell_idls.xpt
bin\components\widget.xpt
bin\components\windowds.xpt
bin\components\windowwatcher.xpt
bin\components\shellservice.xpt
+bin\components\spellchecker.xpt
bin\components\xpcom_base.xpt
bin\components\xpcom_system.xpt
bin\components\xpcom_components.xpt
bin\components\xpcom_ds.xpt
bin\components\xpcom_io.xpt
bin\components\xpcom_thread.xpt
bin\components\xpcom_xpti.xpt
bin\components\xpconnect.xpt
@@ -326,16 +327,17 @@ bin\res\svg.css
bin\components\dom_svg.xpt
; [Personal Security Manager]
;
bin\nssckbi.dll
bin\components\pipboot.xpt
bin\components\pipnss.xpt
bin\components\pippki.xpt
+bin\nssutil3.dll
bin\nss3.dll
bin\smime3.dll
bin\softokn3.chk
bin\softokn3.dll
bin\freebl3.chk
bin\freebl3.dll
bin\ssl3.dll
bin\nssdbm3.dll
@@ -344,16 +346,17 @@ bin\chrome\pippki.manifest
; [Updater]
;
bin\updater.exe
; [Crash Reporter]
bin\crashreporter.exe
bin\crashreporter.ini
+bin\crashreporter-override.ini
; [Additional Developer Tools]
[adt]
bin\extensions\[email protected]\install.rdf
bin\extensions\[email protected]\components\inspector-cmdline.js
bin\extensions\[email protected]\chrome.manifest
bin\extensions\[email protected]\chrome\inspector.jar
bin\extensions\[email protected]\defaults\preferences\inspector.js
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -310,8 +310,13 @@ ifeq ($(OS_ARCH),WINNT)
else
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/updater.app/Contents/MacOS
else
$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
endif
endif
endif
+
+ifdef MOZ_CRASHREPORTER
+libs:: $(addprefix $(LOCALE_SRCDIR)/,crashreporter/crashreporter-override.ini)
+ $(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
+endif
--- a/browser/locales/en-US/chrome/browser/aboutDialog.dtd
+++ b/browser/locales/en-US/chrome/browser/aboutDialog.dtd
@@ -1,10 +1,9 @@
<!ENTITY aboutDialog.title "About &brandFullName;">
<!ENTITY copyright "Credits">
<!ENTITY copyright.accesskey "C">
<!ENTITY aboutLink "< About &brandFullName;">
<!ENTITY aboutLink.accesskey "A">
<!ENTITY aboutVersion "version">
-<!ENTITY copyrightText "©1998-2008 Contributors. All Rights Reserved. Firefox and the
+<!ENTITY copyrightInfo "©1998-2008 Contributors. All Rights Reserved. Firefox and the
Firefox logos are trademarks of the Mozilla Foundation. All rights
- reserved. Some trademark rights used under license from The
- Charlton Company.">
+ reserved.">
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -44,16 +44,20 @@
<!ENTITY pageInfoCmd.accesskey "I">
<!ENTITY pageInfoCmd.commandkey "i">
<!ENTITY fullScreenCmd.label "Full Screen">
<!ENTITY fullScreenCmd.accesskey "F">
<!ENTITY fullScreenMinimize.tooltip "Minimize">
<!ENTITY fullScreenRestore.tooltip "Restore">
<!ENTITY fullScreenClose.tooltip "Close">
+<!ENTITY fullScreenAutohide.label "Hide Toolbars">
+<!ENTITY fullScreenAutohide.accesskey "H">
+<!ENTITY fullScreenExit.label "Exit Full Screen Mode">
+<!ENTITY fullScreenExit.accesskey "F">
<!ENTITY closeWindow.label "Close Window">
<!ENTITY closeWindow.accesskey "d">
<!ENTITY bookmarksMenu.label "Bookmarks">
<!ENTITY bookmarksMenu.accesskey "B">
<!ENTITY bookmarkThisPageCmd.label "Bookmark This Page">
<!ENTITY bookmarkThisPageCmd.commandkey "d">
@@ -222,28 +226,30 @@
<!ENTITY viewPageSourceCmd.label "View Page Source">
<!ENTITY viewPageSourceCmd.accesskey "V">
<!ENTITY viewFrameSourceCmd.label "View Frame Source">
<!ENTITY viewFrameSourceCmd.accesskey "V">
<!ENTITY viewPageInfoCmd.label "View Page Info">
<!ENTITY viewPageInfoCmd.accesskey "I">
<!ENTITY viewFrameInfoCmd.label "View Frame Info">
<!ENTITY viewFrameInfoCmd.accesskey "I">
+<!ENTITY showImageCmd.label "Show Image">
+<!ENTITY showImageCmd.accesskey "S">
<!ENTITY viewImageCmd.label "View Image">
<!ENTITY viewImageCmd.accesskey "I">
<!ENTITY viewBGImageCmd.label "View Background Image">
<!ENTITY viewBGImageCmd.accesskey "w">
<!ENTITY setDesktopBackgroundCmd.label "Set As Desktop Background…">
<!ENTITY setDesktopBackgroundCmd.accesskey "S">
-<!ENTITY bookmarkPageCmd.label "Bookmark This Page…">
-<!ENTITY bookmarkPageCmd.accesskey "m">
-<!ENTITY bookmarkLinkCmd.label "Bookmark This Link…">
-<!ENTITY bookmarkLinkCmd.accesskey "L">
-<!ENTITY bookmarkFrameCmd.label "Bookmark This Frame…">
-<!ENTITY bookmarkFrameCmd.accesskey "m">
+<!ENTITY bookmarkPageCmd2.label "Bookmark This Page">
+<!ENTITY bookmarkPageCmd2.accesskey "m">
+<!ENTITY bookmarkThisLinkCmd.label "Bookmark This Link">
+<!ENTITY bookmarkThisLinkCmd.accesskey "L">
+<!ENTITY bookmarkThisFrameCmd.label "Bookmark This Frame">
+<!ENTITY bookmarkThisFrameCmd.accesskey "m">
<!ENTITY sendPageCmd.label "Send Link…">
<!ENTITY sendPageCmd.accesskey "e">
<!ENTITY savePageCmd.label "Save Page As…">
<!ENTITY savePageCmd.accesskey "A">
<!-- alternate for content area context menu -->
<!ENTITY savePageCmd.accesskey2 "P">
<!ENTITY savePageCmd.commandkey "s">
<!ENTITY saveFrameCmd.label "Save Frame As…">
@@ -255,16 +261,18 @@
<!ENTITY sendLinkCmd.label "Send Link…">
<!ENTITY sendLinkCmd.accesskey "d">
<!ENTITY saveImageCmd.label "Save Image As…">
<!ENTITY saveImageCmd.accesskey "v">
<!ENTITY sendImageCmd.label "Send Image…">
<!ENTITY sendImageCmd.accesskey "n">
<!ENTITY copyLinkCmd.label "Copy Link Location">
<!ENTITY copyLinkCmd.accesskey "a">
+<!ENTITY copyLinkTextCmd.label "Copy Link Text">
+<!ENTITY copyLinkTextCmd.accesskey "x">
<!ENTITY copyImageCmd.label "Copy Image Location">
<!ENTITY copyImageCmd.accesskey "o">
<!ENTITY copyImageContentsCmd.label "Copy Image">
<!ENTITY copyImageContentsCmd.accesskey "y">
<!ENTITY blockImageCmd.accesskey "B">
<!ENTITY metadataCmd.label "Properties">
<!ENTITY metadataCmd.accesskey "P">
<!ENTITY copyEmailCmd.label "Copy Email Address">
@@ -278,16 +286,18 @@
<!ENTITY fullZoomEnlargeCmd.commandkey2 "="> <!-- + is above this key on many keyboards -->
<!ENTITY fullZoomReduceCmd.label "Zoom Out">
<!ENTITY fullZoomReduceCmd.accesskey "O">
<!ENTITY fullZoomReduceCmd.commandkey "-">
<!ENTITY fullZoomResetCmd.commandkey "0">
<!ENTITY fullZoomResetCmd.label "Reset">
<!ENTITY fullZoomResetCmd.accesskey "R">
+<!ENTITY fullZoomToggleCmd.label "Zoom Text Only">
+<!ENTITY fullZoomToggleCmd.accesskey "T">
<!ENTITY fullZoom.label "Zoom">
<!ENTITY fullZoom.accesskey "Z">
<!ENTITY newTabButton.tooltip "Open a new tab">
<!ENTITY newWindowButton.tooltip "Open a new window">
<!ENTITY sidebarCloseButton.tooltip "Close sidebar">
<!ENTITY cutButton.tooltip "Cut">
@@ -334,15 +344,17 @@
<!ENTITY findOnCmd.label "Find in This Page…">
<!ENTITY findOnCmd.accesskey "F">
<!ENTITY findOnCmd.commandkey "f">
<!ENTITY findAgainCmd.label "Find Again">
<!ENTITY findAgainCmd.accesskey "g">
<!ENTITY findAgainCmd.commandkey "g">
<!ENTITY findAgainCmd.commandkey2 "VK_F3">
-<!ENTITY spellAddDictionaries.label "Add dictionaries…">
+<!ENTITY spellAddDictionaries.label "Add Dictionaries…">
<!ENTITY spellAddDictionaries.accesskey "A">
<!ENTITY editBookmark.done.label "Done">
<!ENTITY editBookmark.delete.label "Delete">
<!ENTITY identity.moreInfoLinkText "Tell me more about this web site…">
+
+<!ENTITY downloadMonitor.tooltip "Double-click to open downloads window">
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -76,34 +76,52 @@ updatesItem_pendingFallback=Apply Downloaded Update Now…
feedNoFeeds=Page has no feeds
feedShowFeedNew=Subscribe to '%S'…
feedHasFeedsNew=Subscribe to this page…
# History menu
menuOpenAllInTabs.label=Open All in Tabs
menuOpenAllInTabs.accesskey=o
+# Unified Back-/Forward Popup
+tabHistory.current=Stay on this page
+tabHistory.goBack=Go back to this page
+tabHistory.goForward=Go forward to this page
+
# Block autorefresh
refreshBlocked.goButton=Allow
refreshBlocked.goButton.accesskey=A
refreshBlocked.refreshLabel=%S prevented this page from automatically reloading.
refreshBlocked.redirectLabel=%S prevented this page from automatically redirecting to another page.
# Star button
starButtonOn.tooltip=Edit this bookmark
starButtonOff.tooltip=Bookmark this page
+# Offline web applications
+offlineApps.available=This website (%S) is offering to store data on your computer for offline use.
+offlineApps.allow=Allow
+offlineApps.allowAccessKey=A
+
# Identity information
identity.domainverified.title=Location Verified
identity.domainverified.body=You are currently visiting:
identity.domainverified.supplemental=Information identifying the owner of this web site may not have been validated.
identity.identified.title=Identity Verified
identity.identified.body=This web site is owned by:
identity.identified.verifier=Verified by: %S
identity.identified.state_and_country=%S, %S
identity.identified.title_with_country=%S (%S)
identity.unknown.title=Identity Unknown
identity.unknown.body=This web site does not supply identity information.
identity.encrypted=Your connection to this web site is encrypted to prevent eavesdropping.
identity.unencrypted=Your connection to this web site is not encrypted.
+
+# Downloads Monitor Panel
+# LOCALIZATION NOTE (activeDownloads, pausedDownloads): Semi-colon list of plural
+# forms. See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
+# #1 number of downloads; #2 time left
+# examples: One active download (2 minutes remaining); 11 paused downloads
+activeDownloads=One active download (#2);#1 active downloads (#2)
+pausedDownloads=One paused download;#1 paused downloads
--- a/browser/locales/en-US/chrome/browser/credits.dtd
+++ b/browser/locales/en-US/chrome/browser/credits.dtd
@@ -11,9 +11,9 @@
<!-- localization credits look like this: -->
<!--
<!ENTITY credit.translation
"<h3>Translators</h3><ul><li>Name Here</li></ul>">
-->
<!ENTITY credit.translation "">
<!ENTITY credit.memory "In Fond Memory Of">
-<!ENTITY credit.poweredByGecko "Powered by Gecko™">
+<!ENTITY credit.poweredByGeckoReg "Powered by Gecko®">
--- a/browser/locales/en-US/chrome/browser/feeds/subscribe.properties
+++ b/browser/locales/en-US/chrome/browser/feeds/subscribe.properties
@@ -3,15 +3,46 @@ addHandler=Add "%S" (%S) as a Feed Reade
addHandlerAddButton=Add Feed Reader
addHandlerAddButtonAccesskey=A
handlerRegistered="%S" is already registered as a Feed Reader
liveBookmarks=Live Bookmarks
subscribeNow=Subscribe Now
chooseApplicationMenuItem=Choose Application…
chooseApplicationDialogTitle=Choose Application
alwaysUse=Always use %S to subscribe to feeds
+mediaLabel=Media files
+
+# LOCALIZATION NOTE: The next string is for the size of the enclosed media.
+# e.g. enclosureSizeText : "50.23 MB"
+# %1$S = size (in bytes or megabytes, ...)
+# %2$S = unit of measure (bytes, KB, MB, ...)
+enclosureSizeText=%1$S %2$S
+
+bytes=bytes
+kilobyte=KB
+megabyte=MB
+gigabyte=GB
+
+# LOCALIZATION NOTE: The next three strings explains to the user what they're
+# doing.
+# e.g. alwaysUseForVideoPodcasts : "Always use Miro to subscribe to video podcasts."
+# %S = application to use (Miro, iTunes, ...)
+alwaysUseForFeeds=Always use %S to subscribe to feeds.
+alwaysUseForPodcasts=Always use %S to subscribe to podcasts.
+alwaysUseForVideoPodcasts=Always use %S to subscribe to video podcasts.
+
+subscribeFeedUsing=Subscribe to this feed using
+subscribePodcastUsing=Subscribe to this podcast using
+subscribeVideoPodcastUsing=Subscribe to this video podcast using
+
+# "This is a "xyz" of frequently changing content on this site."
+feedsubscription1=This is a "%S" of frequently changing content on this site.
+feedsubscription2=You can subscribe to this %S to receive updates when this content changes.
+webFeed=feed
+videoPodcastFeed=video podcast
+audioPodcastFeed=podcast
# Protocol Handling
# "Add %appName (%appDomain) as an application for %protocolType links?"
addProtocolHandler=Add %S (%S) as an application for %S links?
addProtocolHandlerAddButton=Add Application
# "%appName has already been added as an application for %protocolType links."
protocolHandlerRegistered=%S has already been added as an application for %S links.
--- a/browser/locales/en-US/chrome/browser/pageInfo.dtd
+++ b/browser/locales/en-US/chrome/browser/pageInfo.dtd
@@ -60,26 +60,24 @@
<!ENTITY generalEncoding "Encoding:">
<!ENTITY generalMetaName "Name">
<!ENTITY generalMetaContent "Content">
<!ENTITY generalSecurityMore "More">
<!ENTITY generalSecurityMore.accesskey "o">
<!ENTITY mediaTab "Media">
<!ENTITY mediaTab.accesskey "M">
-<!ENTITY mediaURL "Address:">
-<!ENTITY mediaAlt "Alternate Text:">
+<!ENTITY mediaLocation "Location:">
+<!ENTITY mediaText "Associated Text:">
<!ENTITY mediaAltHeader "Alternate Text">
<!ENTITY mediaAddress "Address">
<!ENTITY mediaType "Type">
<!ENTITY mediaSize "Size">
<!ENTITY mediaCount "Count">
-<!ENTITY mediaDimensions "Specified Dimensions:">
-<!ENTITY mediaPhysDimensions "Actual Dimensions:">
-<!ENTITY mediaTitle "Title:">
+<!ENTITY mediaDimension "Dimensions:">
<!ENTITY mediaLongdesc "Long Description:">
<!ENTITY mediaBlockImage.accesskey "B">
<!ENTITY mediaSaveAs "Save As…">
<!ENTITY mediaSaveAs.accesskey "A">
<!ENTITY mediaSaveAs2.accesskey "e">
<!ENTITY mediaPreview "Media Preview:">
<!ENTITY feedTab "Feeds">
--- a/browser/locales/en-US/chrome/browser/pageInfo.properties
+++ b/browser/locales/en-US/chrome/browser/pageInfo.properties
@@ -52,16 +52,21 @@ mediaBGImg=Background
mediaObject=Object
mediaEmbed=Embed
mediaLink=Icon
mediaInput=Input
mediaFileSize=%S KB
mediaSize=%Spx \u00D7 %Spx
mediaSelectFolder=Select a Folder to Save the Images
mediaBlockImage=Block Images from %S
+mediaUnknownNotCached=Unknown (not cached)
+mediaImageType=%S Image
+mediaAnimatedImageType=%S Image (animated, %S frames)
+mediaDimensions=%Spx \u00D7 %Spx
+mediaDimensionsScaled=%Spx \u00D7 %Spx (scaled to %Spx \u00D7 %Spx)
generalQuirksMode=Quirks mode
generalStrictMode=Standards compliance mode
generalNotCached=Not cached
generalDiskCache=Disk cache
generalMemoryCache=Memory cache
generalSize=%S KB (%S bytes)
generalMetaTag=Meta (1 tag)
--- a/browser/locales/en-US/chrome/browser/places/places.properties
+++ b/browser/locales/en-US/chrome/browser/places/places.properties
@@ -65,17 +65,17 @@ view.sortBy.date.label=Sort by Visit Dat
view.sortBy.date.accesskey=V
view.sortBy.visitCount.label=Sort by Visit Count
view.sortBy.visitCount.accesskey=C
view.sortBy.keyword.label=Sort by Keyword
view.sortBy.keyword.accesskey=K
view.sortBy.description.label=Sort by Description
view.sortBy.description.accesskey=D
view.sortBy.dateAdded.label=Sort by Added
-view.sortBy.dateAdded.accesskey=A
+view.sortBy.dateAdded.accesskey=e
view.sortBy.lastModified.label=Sort by Last Modified
view.sortBy.lastModified.accesskey=M
view.sortBy.tags.label=Sort by Tags
view.sortBy.tags.accesskey=T
searchByDefault=Search in Bookmarks
searchCurrentDefault=Search in '%S'
findInPrefix=Find in '%S'…
--- a/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
@@ -29,17 +29,17 @@
<!ENTITY networkTab.label "Network">
<!ENTITY connection.label "Connection">
<!ENTITY connectionDesc.label "Configure how &brandShortName; connects to the Internet">
<!ENTITY connectionSettings.label "Settings…">
<!ENTITY connectionSettings.accesskey "e">
-<!ENTITY cache.label "Cache">
+<!ENTITY offlineStorage.label "Offline Storage">
<!-- LOCALIZATION NOTE:
The entities useCacheBefore.label and useCacheAfter.label appear on a single
line in preferences as follows:
&useCacheBefore.label [ textbox for cache size in MB ] &useCacheAfter.label;
-->
<!ENTITY useCacheBefore.label "Use up to">
@@ -62,26 +62,31 @@
<!ENTITY askMe.accesskey "k">
<!ENTITY modeAutomatic.label "Automatically download and install the update">
<!ENTITY modeAutomatic.accesskey "d">
<!ENTITY modeAutoAddonWarn.label "Warn me if this will disable any of my add-ons">
<!ENTITY modeAutoAddonWarn.accesskey "W">
<!ENTITY updateHistory.label "Show Update History">
<!ENTITY updateHistory.accesskey "p">
+<!ENTITY offlineAppsList.label "The following websites have data installed for offline use:">
+<!ENTITY offlineAppsList.height "7em">
+<!ENTITY offlineAppsListRemove.label "Remove…">
+<!ENTITY offlineAppsListRemove.accesskey "R">
+<!ENTITY offlineAppRemove.confirm "Remove offline data">
<!ENTITY encryptionTab.label "Encryption">
<!ENTITY protocols.label "Protocols">
<!ENTITY useSSL3.label "Use SSL 3.0">
<!ENTITY useSSL3.accesskey "3">
<!ENTITY useTLS1.label "Use TLS 1.0">
<!ENTITY useTLS1.accesskey "1">
<!ENTITY certificates.label "Certificates">
-<!ENTITY certselect.description "When a web site requires a certificate:">
+<!ENTITY certSelection.description "When a server requests my personal certificate:">
<!ENTITY certs.auto "Select one automatically">
<!ENTITY certs.auto.accesskey "l">
<!ENTITY certs.ask "Ask me every time">
<!ENTITY certs.ask.accesskey "i">
<!ENTITY viewCerts.label "View Certificates">
<!ENTITY viewCerts.accesskey "s">
<!ENTITY viewCRLs.label "Revocation Lists">
<!ENTITY viewCRLs.accesskey "R">
--- a/browser/locales/en-US/chrome/browser/preferences/connection.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/connection.dtd
@@ -1,16 +1,18 @@
<!ENTITY connectionsDialog.title "Connection Settings">
<!ENTITY window.width "37em">
<!ENTITY window.macWidth "39em">
<!ENTITY proxyTitle.label "Configure Proxies to Access the Internet">
<!ENTITY directTypeRadio.label "Direct connection to the Internet">
<!ENTITY directTypeRadio.accesskey "d">
+<!ENTITY systemTypeRadio.label "Use system proxy settings">
+<!ENTITY systemTypeRadio.accesskey "y">
<!ENTITY WPADTypeRadio.label "Auto-detect proxy settings for this network">
<!ENTITY WPADTypeRadio.accesskey "w">
<!ENTITY manualTypeRadio.label "Manual proxy configuration:">
<!ENTITY manualTypeRadio.accesskey "m">
<!ENTITY autoTypeRadio.label "Automatic proxy configuration URL:">
<!ENTITY autoTypeRadio.accesskey "A">
<!ENTITY reload.label "Reload">
<!ENTITY reload.accesskey "e">
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -45,16 +45,18 @@ chooseDownloadFolderTitle=Choose Downloa
#### Applications
fileEnding=%S file
saveFile=Save File
chooseApp=Choose application…
fpTitleChooseApp=Select Helper Application
webFeed=Web Feed
+videoPodcastFeed=Video Podcast
+audioPodcastFeed=Podcast
alwaysAsk=Always ask
# LOCALIZATION NOTE (pluginName):
# %1$S = plugin name (for example "QuickTime Plugin-in 7.2")
# %2$S = brandShortName from brand.properties (for example "Minefield")
pluginName=%S (in %S)
# LOCALIZATION NOTE (previewInApp, liveBookmarksInApp): %S = brandShortName
@@ -77,8 +79,13 @@ AtEndOfSession = at end of session
can=Allow
canSession=Allow for Session
cannot=Block
noCookieSelected=<no cookie selected>
cookiesAll=The following cookies are stored on your computer:
cookiesFiltered=The following cookies match your search:
removeCookies=Remove Cookies
removeCookie=Remove Cookie
+
+#### Offline apps
+offlineAppRemoveTitle=Remove offline website data
+offlineAppRemovePrompt=After removing this data, %S will not be available offline. Are you sure you want to remove this offline website?
+offlineAppRemoveConfirm=Remove offline data
--- a/browser/locales/en-US/chrome/browser/sanitize.dtd
+++ b/browser/locales/en-US/chrome/browser/sanitize.dtd
@@ -10,13 +10,15 @@
<!ENTITY itemFormSearchHistory.label "Saved Form and Search History">
<!ENTITY itemFormSearchHistory.accesskey "F">
<!ENTITY itemPasswords.label "Saved Passwords">
<!ENTITY itemPasswords.accesskey "P">
<!ENTITY itemCookies.label "Cookies">
<!ENTITY itemCookies.accesskey "C">
<!ENTITY itemCache.label "Cache">
<!ENTITY itemCache.accesskey "a">
+<!ENTITY itemOfflineApps.label "Offline Website Data">
+<!ENTITY itemOfflineApps.accesskey "O">
<!ENTITY itemDownloads.label "Download History">
<!ENTITY itemDownloads.accesskey "D">
<!ENTITY itemSessions.label "Authenticated Sessions">
<!ENTITY itemSessions.accesskey "S">
<!ENTITY window.width "30em">
--- a/browser/locales/en-US/chrome/browser/searchbar.dtd
+++ b/browser/locales/en-US/chrome/browser/searchbar.dtd
@@ -1,3 +1,2 @@
<!ENTITY cmd_engineManager.label "Manage Search Engines…">
-<!ENTITY cmd_engineManager.accesskey "M">
<!ENTITY searchEndCap.label "Search">
--- a/browser/locales/en-US/chrome/browser/tabbrowser.dtd
+++ b/browser/locales/en-US/chrome/browser/tabbrowser.dtd
@@ -7,12 +7,12 @@
<!ENTITY closeOtherTabs.label "Close Other Tabs">
<!ENTITY reloadAllTabs.label "Reload All Tabs">
<!ENTITY reloadAllTabs.accesskey "A">
<!ENTITY reloadTab.label "Reload Tab">
<!ENTITY reloadTab.accesskey "r">
<!ENTITY listAllTabs.label "List all tabs">
<!ENTITY bookmarkAllTabs.label "Bookmark All Tabs…">
<!ENTITY bookmarkAllTabs.accesskey "T">
-<!ENTITY bookmarkCurTab.label "Bookmark This Tab…">
-<!ENTITY bookmarkCurTab.accesskey "B">
+<!ENTITY bookmarkThisTab.label "Bookmark This Tab">
+<!ENTITY bookmarkThisTab.accesskey "B">
<!ENTITY undoCloseTab.label "Undo Close Tab">
<!ENTITY undoCloseTab.accesskey "U">
new file mode 100644
--- /dev/null
+++ b/browser/locales/en-US/crashreporter/crashreporter-override.ini
@@ -0,0 +1,5 @@
+# This file is in the UTF-8 encoding
+[Strings]
+# LOCALIZATION NOTE (CrashReporterProductErrorText2): The %s is replaced with a string containing detailed information.
+CrashReporterProductErrorText2=Firefox had a problem and crashed. We'll try to restore your tabs and windows when it restarts.\n\nUnfortunately the crash reporter is unable to submit a crash report.\n\nDetails: %s
+CrashReporterDescriptionText2=Firefox had a problem and crashed. We'll try to restore your tabs and windows when it restarts.\n\nTo help us diagnose and fix the problem, you can send us a crash report.
--- a/browser/locales/en-US/searchplugins/list.txt
+++ b/browser/locales/en-US/searchplugins/list.txt
@@ -1,6 +1,7 @@
amazondotcom
answers
creativecommons
eBay
google
+wikipedia
yahoo
new file mode 100644
--- /dev/null
+++ b/browser/locales/en-US/searchplugins/wikipedia.xml
@@ -0,0 +1,15 @@
+<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
+<ShortName>Wikipedia (English)</ShortName>
+<Description>Wikipedia, the free encyclopedia</Description>
+<InputEncoding>UTF-8</InputEncoding>
+<Image width="16" height="16">data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAEAgQAhIOEAMjHyABIR0gA6ejpAGlqaQCpqKkAKCgoAPz9%2FAAZGBkAmJiYANjZ2ABXWFcAent6ALm6uQA8OjwAiIiIiIiIiIiIiI4oiL6IiIiIgzuIV4iIiIhndo53KIiIiB%2FWvXoYiIiIfEZfWBSIiIEGi%2FfoqoiIgzuL84i9iIjpGIoMiEHoiMkos3FojmiLlUipYliEWIF%2BiDe0GoRa7D6GPbjcu1yIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</Image>
+<Url type="application/x-suggestions+json" method="GET" template="http://en.wikipedia.org/w/api.php">
+ <Param name="action" value="opensearch"/>
+ <Param name="search" value="{searchTerms}"/>
+</Url>
+<Url type="text/html" method="GET" template="http://en.wikipedia.org/wiki/Special:Search">
+ <Param name="search" value="{searchTerms}"/>
+ <Param name="sourceid" value="Mozilla-search"/>
+</Url>
+<SearchForm>http://en.wikipedia.org/wiki/Special:Search</SearchForm>
+</SearchPlugin>
index 63868c24ae64d68997644557079d371f9f088892..152e0475a8bde938586cc882d83a75283c4f1935
GIT binary patch
literal 570
zc$@(`0>%A_P)<h;3K|Lk000e1NJLTq000dD000dL1^@s6a_i)L00004b3#c}2nYxW
zd<bNS00009a7bBm000fw000fw0YWI7cmMzZ8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H10k=s+K~yM_g_6H(6LA=apZn&nN$+y;^4n0sW{nOBL4=APIHlq&
z=-xlTF_V*?3K`Ww5S;uMTr*e@(LpH@HCjRZkv7`on%p;cxtxopmR5b|=i&YEeqN>3
zYVogWn@t6{0^9;#*{-uH{v(_RI_2{6gVjc331|SQe}PW`cMAFZ>1wr>SWGN}0zh;?
zYMadxa64%jm+JNU!jV)ODLs0<9=UvG&Z)oPB+%4U?P{%7jTZ|?MG#Es_xnic;rl)*
z%h;3JX7e&|uTrV#<>O^7iXw)CA)fS*a>B%)5ClHbm;2(~KeMu8q^&GJcD~c?cJbtx
zFbtUyqN*yY8Y3&seeu?wtgqiK6mz<jF&FfdhMa;Bpv5#qOhE{RX&B5UVY|*F;8^e5
z_RY7iH^;-lZctjvQ7mOK%mfKNPC}0pF`LH|0JiIlY}dIKMbUD9Yv<vcjZHb)m0>1p
zVWmy<WE@1ax9QK5+pe>9Zg^uY3}+|5e%gNAdHKQf#*@fQ8N^iOcUK(x5w`1e&kn9%
z4E(A6@!gl_8!z6E-N6V2<zTso$j^XNZL@iy+xhH>nDP|hCm`ml=&;Px?f?J)07*qo
IM6N<$f_D1|4*&oF
index 4fe4569107b86bf197287b624a5feb196ee1af9b..259c8a4f01cd6a929a3440a5b579fef5275ce0ae
GIT binary patch
literal 573
zc$@(}0>b@?P)<h;3K|Lk000e1NJLTq000dD000dL1^@s6a_i)L00004b3#c}2nYxW
zd<bNS00009a7bBm000fw000fw0YWI7cmMzZ8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H10lG;<K~yM_eUi^=6Hyq&e>3-H@^=t15S7+$TnK_9t^}Les1d7q
z3s<gOD9pn3P-tGDh|;ZZPzu64fl3vTLZ=!dwMlBiZ6-6B%v=|mQib%a&*A(&zGJjn
zEqvR33tR@C0dE}TX-<*p+io7HuRK^;Tw1!c0c`uWTR$}fXn>rsxN+@fzH#^7)oS(J
zrf<7jzU^L_7y3uVLYdpQ>V^99@|{wt^xn7KSHA7mPI`>yx|IW>=EFzk=qN;MzyQn2
zA*7(wX{XyCKgDU9t^uo#@<OAzZb=}%-)NY<?jaftTB9`xDX3IR7$yWkFbRUMBjB<8
zdy^4O#vF|lQ8XqThs5!OD2hmugoVWmoWEGJFtioyetRiroKZZYKkO365unM?6w4M1
z)fz$wzI@(^h66P|*+e)|NDD-+fN7ePD@CNpaj@T?9Cn9^)_N6KbCfqe#>0eCr9eJ!
zA*H1EbCB+Lz9%}<ueH`M9Od<ARL6Kiz?riZe)W`Y@3x~X%Qmw#d+I1}@Bg<*M|s+}
zUDP0?y>}2!lk`J6O`kZ*dpB<p@=uGo5$yc9o=&spj`FtVnP>V9B1pwCXWB}@00000
LNkvXXu0mjf?Z5s_
index 2eb45dea23148624db2dabd2cbaa515865427269..01fb204fd6be02c981df6565e5fc0ef91ffe747c
GIT binary patch
literal 840
zc$@)91GoH%P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00001b5ch_0Itp)
z=>Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iO4^
z4<{)JUk?@l00PKKL_t(I%av2zOH*MSe%^E5bI#VBb7!W`k7Q~e&_y4tyyydyOsCQ}
zA`wIoT@`dQ7Q65&1QDydA{B}XL@Y>+a_K)%f}w>&D{5}FRx{6LbLZ^ryj_%n;)Ole
zzvqMJ;YS!_SPvbY?QQ^90JtfomAbA60gMB<?eqHIFW-^10v(<00)RGImM=9nG{@|A
zxrFC=2ZQlF{xcpOdj70LQIrk<H+^2eLDw;F+r4Yg$^F#_tzA#v@n2%oHpU3R49C`D
z8|S-lSsV!rUkV1N8Gx=;2|7C4-LhRCI(_Dx_1e8Ryv1rURTk&LVxq7}JVM_UOn-{0
z_q|7!y1VaW7k@7v;MTZbsjv6M?!K5w$@W~6Ws?a2ke@4IM`<pa_LXDr_G0PQz*NTL
zY5D}<;#vWBo-MEBM?$le6<U#N7VuluVG=kvazqr^B<yrK5DYKa3JVH018}eEfKpmX
zIL^fL6mpIPNzjo<WiS_C0wDlLIK-1_fIy&BZ~`E!1aw^wGQ)711WvZ+2!bSV;0Qq?
zmBGiT0g?U<EQ(Z9)pQuZ?AjH^Bav`zu?+?Di8P$D1&je%!@ztp1IiO5lPS2X@)shJ
z$S(lnt2zjU=Eh%*1zatMTqGP*5RNZG5;&Me9%hL{bbb-ptdVRzT*d`PM_d4US7vN!
zJ=;JjeOgiBGH<QghDJ{_249C+Xn|>J79tE|X=kZ*;Y77l7#<!>&4oiZd|rPKVT`Si
zJ&g@!O;s^F^8rOgMXaW#cD8&=xhRT)Q&qL_x9GQDqhkSAI-S1m^ZI)LfVQ-rJ+@5F
zXc`nHfymdd=|nPlRn^og0B!&T!0f+Y==FL1pI4R>1p271?x<N)H7JULiHWyqRaH+t
zeDL@sHULTp7mdY!I4GsuGP%ERU_)d8pqi!~pPZZ;WXveaWc2g>eFFjf2mSzNk}!GD
SI``%P0000<MNUMnLSTX$(`4xY
index 38d9c590b2cc18ae0c5c6af1826eea41fcca4c36..fd006f4cda7a1412c85677e0cc413107c8fd30b3
GIT binary patch
literal 862
zc$@)V1EKthP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004b3#c}2nYxW
zd<bNS00009a7bBm000fw000fw0YWI7cmMzZ8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H10^3PMK~y-6jgw7CRACf`-|xG>&ei#5939P+8n7I(MT$XDxhXWU
z%)~6Hjb*zQ{SZRXriCO1Eo#xCXcJ^21QlxjR7M1ar4m$>{mke%7YFamIHS(oxpQwD
z4V8%A%~_p?_nh+{Vp$ee)X~{q2H+fkN}lJvhGBdMFbd#S+oj8+_=|{TS?K6&rvNT6
z#@Y_m9S*p1T=@hvFP%=$g~M8)xBsbI)3iGPuC`seoLUXwm+N`2x3smU`k>hH;6uT;
znNLm-3PLQl$(?ClY&v0k_x5$e_{10hTv-j^G8C~SQ^~w{?AVE{mg_HMcP_J6cnfHL
zE<?5>iw43;<?)+e=BfIf?AOo9Z9~HYBYSr5oml};04=q(bw6(Od`wl86i9VDHo;qH
zM~+<r04O#Y*-pEByYK5_O-=1AfU~O|Pym&AZg=jN=?E+HxZq|IT$v(dfnp(Pz@8zX
zC@%}4d7U|!V<Ujd^*bo$c_AMJLTEmL2_IluCZ^_=AaE3Rn*c@P5#)H0Q0n4&URe+L
zoJ=MRQREBbiL?|?EI>C*Ea_=D6cG+ZfKB2c3p8b!re+vMaQz6Qfj}T!S)3E`%|xKZ
zbVTAQC=v%|6W~-tX!8jaFz|uE^uls3)&TAf3_bH4uPUPHv>8*iI5H%P43UE*P)yIo
zF+Cea^Ii`b93Jra{ZnfI+~B})WaQNgO;y!hXBu~t_+l#R55>9gg3fEvMcpZ;xRX^y
zq_^)0rl$NP7!2-v*xmL1XjAj#pCkf6M`wGhEX&vS@2mc~A%BBYlEgw?PX&E`pZ@aY
z^DU~Xk}X?{AxaYZdi$3Q!)Wa8>ggxzeql3!)61tS1uzL<)aUb0#$vIX<>lLDhl4>7
z#T7`y8o<BQe7xy^BuS6T%eTvnF>oBk;NVb*{#Q4E?yjExWHNbVY-~IcjYcs$8!`!@
o>VG>}<)m5=`1^!VRoC_U-_24j#;&EI-~a#s07*qoM6N<$g1e)I`Tzg`
index 718b2287e9aba22863fc2205fefdb80b426172bc..2434023cee756ee0c817db38b2e59c3f09b98ca7
GIT binary patch
literal 856
zc$@)P1E>6nP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004b3#c}2nYxW
zd<bNS00009a7bBm000fw000fw0YWI7cmMzZ8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H10@X=GK~y-6g_BEYTxAr;f8TfS%_N<N5}YQnnYO02N!yh>9}qDZ
zGzg+#?XDX|s0$Yr6nsG~-3VRi%0)pDqy!WNk%}oPh$uC>lGvCr(`syIhBh;EAI#%^
zFBdvvw1WTD;c(86^AyfGwrgqm{5?|2Cp^!)&pCI<IVXe=tH#)GowJMca|=Ihj~9Kw
z((-xXdEV=u=bhM7+FQtGb0U)&CQVbKI3!78cXR7TWUW2*@I#ND`7glHTrPk1;Pjzf
zy<Y1!TaBdK>-pe>?*}HA&1QFGvzco3dX%Q=k@>lWF9Bqq<ayr7iSdctdU-9nR{i~h
zIEn99Djicwjdwcj2eukp@6>A5uy9+UAf<e>pXc`t=iIo%5ht-{tvx<Jw_vxmx(2*-
z;o=v^gCGDna0>t&QR@a;wORe@)xwV#U*z99JbT)iv;#Qtj~TpsYTpa{Cu(n>`@BQD
z3qrt=c|mdXPw;!6Lc8k*{(OFz_3OJ{e*TT}Tf#ZV^4W|o%{=Al{F5YY2?8c3B*jsO
zbv>^BmU45;VvJ>M)F6{(Hh=!u4*4qZ0Wv}A-G1jItbBcvrEfY2VL3c4Ir_Lj>lT}<
zAs>APTEX3W0**a%n&6j3`NNe1`N0f~N|+o|7^4xwa^+VAZWx^6u9CtSFb1w}DvSyN
z(8d$OImc@!?$wVyea36GTI`$J&(P2iS}T0tLupO7+o4{s(`YtmHd;*2%y8k8SL}Lq
zSJnq8S4(bVqe7?CW;iqQ7eHf-LK{P`*Ch-i!YCvPLn<2^lxvd?+}~^5xwD8dhN-D3
zGMNloE3{UF3YyI(jb@e|BO}~VEDlyX08}a!eBb}y3gRdtNs__w_yAJMa=YC=I6M0w
zyGy$Xf&gPQ#%Q!Q^wJ)291}$mQ511`?J`oz+PM!Gdp>|M=DC&cSKhz$-KD)k436v;
i^&d}4dCgk;EWjUj^N(T1Yi1z;0000<MNUMnLSTYF<b@mn
index 1b4a9dff5df4cd022c6d5e8cc9c0d7693ed6f1df..5efc13676caa5331993c84b7e757f0e2ea1d7a8c
GIT binary patch
literal 924
zc$@*817rM&P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004b3#c}2nYxW
zd<bNS00009a7bBm000fw000fw0YWI7cmMzZ8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H10~tv~K~y-6ZIVrFRAm%~pYOZ3ola*uQ;4Ol%ut**LF$S$iedxU
z*wm&jAStqturS8x#zfso8Urp33rviOx-djS%9bFBjg&M-)7CDewm=K5g$~pIPVd~#
zZRg(m9T!j{;G3My$;p#*-uEaGVM~42uI|%XAF(X!H4$kR5v7zG3q$jVi0N%_>m27P
zDG{OX+Ery)R*z*_pEjg-Ct|U<ibN_Xl}b2;HC(qKOUsLnG3LuR-+1fn{{fE2<5fTG
z-P0VOpP$=U&9Ar{o0~R>vhA`k9*e~)W3fms_rNKYO2^vUI)B*$XaLKyPS@Af$0sIl
zIoaIo`GQ+G;QOUo-}mc0ulV}%%JSE9bGfxdGLg_)pZV_wHh_rK2|~dwSjL!-+S@wK
z*1(8Tb-;e9j3$iI#9wG=8TotsaEr+G#{dwV{33y0WNhG6VzmD=09wDA=qay?f4Ke7
z;mV3s3IR6m-LqF`?q3;E>RgM+=jz)tnU9<5=gwWc;!)fHrQle*qIN;3{H~IQci%%z
zPg8yQG5|{*9Y{J&wzqdZbltbruiuvk=@+}Lpz0`YQG<e1y{2%YheWc0m~9hIOi(@k
zFu{CtGqQ6ht}!h3_Yc^SvXWK(d<Vn7ou==152Xw*?a{RS^$&I3FJneWpN<~Av_wT?
zBfvfl5c)2uTAwfs2*ZHsnRO5l&jVwg0f-2A-ormQ^~wIA>z%V!KA)#C(?ofBIYHp#
zojA#Mt*MGeF}d6m0FzAOcpfV^ZVc$jTw3nlonm%&mTWfrs2;F-yqkrwF*dZuY}-b1
zXo%$CAf;#&PbpT%$BQEJg$=M{M-5>ZlF4L<L?Q%%PtcIYoxDT#!bPfTYACd}BF3<}
zw#M4RJQ(xMD<aozfT^h|Y}=+H5`A<+Kp6T2M~^@{g?s)dBDZgY2<xd7KOcD2%+x&B
za|y7u)|16zaqq!{huD?gMOj(dV>5#wWV5M>LRS}#<KQ?BH*ei!c4Q=X=|b-&fE|Y6
y2g833|2Q}_xLYapjN?x@4`{8k#+diF`u_q48ihof!_dh90000<MNUMnLSTaYp0)e{
index 7a0176fd6752bf9e2587e862a815399f52bb4360..8a10dbe5de957af28003db22d53c2f371b9612fc
GIT binary patch
literal 5754
zc$@)x7KQ1FP)<h;3K|Lk000e1NJLTq002+`001Be1^@s6g){$b00001b5ch_0Itp)
z=>Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iO4>
z3JoablIflR000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}000%$Nkl<Z
zXx_z|d2}4boyWh`UER|&J*Q?yw?>B#VT^AO*g$NENrH`I3$L-w5fIq0m}6PvWMSXi
z0B@6ZIE1rHI2;Z`90J5Q5FlWJd|SSaZ~4+;OB#)i(P&0<bye*jBaJ0X2J=_yy?Sr@
ztg2sqtLj^y9`fOumAA-}{FcECAAUfhGOcHvEtog^p0E0zFPgS=s4Pnrnn{_GNEo94
zfKvHTJdv#8T&$@5?CDc|?=PJG+nW?gebr#b2>ifQ``Odv`|e2uem+EEB!>{92_a&#
zOd5%I{h7-xBiT}Zg#=#AIa~lBNuphn$Z6u)a55DKNq%eUO+WKF9j+f#`Cw;<Z{s&#
zyak}JCvcKN<;9Xjp8Lu5Bh+C<Su{5*1Ce+V$Ik{Povihj9XNdEi6Jwde}*ysa_whN
za{!PDeJ>;1Tkzt-Yv6G(P?>_#o-8Ya{8m6^iXk&z03ZlJ#9;Lk{@Gbv7}pEV$3(-2
zW`a<~Y#mX}1nOAx%tNt+_(u1A+;OS)iMCtKJgM9y1iv;KshP!?G+a@n1FE^CmT??s
zEwgq>-r$$iV200bbKvW$zr)|sd|AQE@@C_v$+w_awMEmGN)}DsoS*F+`|P4yEyo*z
z*na37)^9rt0LXURP+Xi(M~*0_pMJUP*-$7vt7zKNAJu;LH0PWb#G~El2z6svVKMAB
z8$bYpKH?(iIU-;j;DQ4HMvi<=IdTMv0gZ2*;W0?^X9Q$wEOKI$>iOMh0Ryr2=L}6B
zVHE^JRSh=LcI#h>`}62vZRAPyW<fAb@Mu1lhK{lots>#tsbvaJHW5h~DZo9v#la~6
zaL%D=W>ooy4;rw?Z!z~f?(FCU=RAF^P<e4)mUHa$PtMd|TeA-yonua!8I(8y00uW<
z<KZ?OtYeru^;-SQuXc{@40bIB@Dc!ctSVmm%RW$g5CRNlO@-BLf@-3WWeKt*fl>*w
zBtxMxObY$Z4(1XmOLU*QpBd32mhAMJ^(h1(h&DeyRIr0qS+V<7bFq<3DE?a(y!8AT
zzcHGz3ql^28^!u<dvX1UM#v-vTkh`ws8AgDOYO}slry0q(3Kw<S*)~C01$$su%H<G
z-`PBPjcys)@37EU4AG;4qG?NqN)mbQR}b7`d1cjJ+%n37A~)dk6~bn70uTs=I^nR?
z<8%wd2iqD@RyIc8xN+NaMbnn92LO9^F1#8+cQ^vZ6KTmw5FmmBkifZsETzhq<^EG&
z<+2xlV;IT*5JFIk$-v%YyD@U)UC^DsNa<E~0}!y6?6U~LOA^6%OIln1;q!Rhhfg&n
zM?dx0Y}j>E`hB_9!x(M-I~*ljAw(2}SOEYg*PZa#XMjj1kYf{dkf9@b6e!@%aAVi<
zJ1=Vp$6`@%p6W4Kk}4*bm8!=Zg2-_J!*fj-QF;{=g#sX0^2^0|;rSQgbYws^9m9zH
z2pS`C6c^{Kr%%^c2reL~iu~ey96xaqet!@Om7!7@!=t}}Vl<)2`&+<LkS<@6r1bA+
zpM91xX8h{$NB^B_ng+odz`JaShPD8%1t78$5D`EmK_ndzaj@7Sgkm{4ZV}HB0<h~Q
z>^{|=e&>Yz78Fn$)Ycbac0ZDOp0@!+fIvpHbs3t1R(QQ2Qm+ELx<Uv9{OMfXum;Vo
z^=Jyzp}Dml)eURX*SfkwX$6{0bV^~qm+n1&9=Bbch5S4pD5W4of+R_3Y-$7{1eD6i
z&B@2C>#`9HhLGWQQH9bem+B;2VlRdim~rQQkHH;T-S3(#^-~}PAZeP0NF;*pNEim!
zAgdmP&W;Co2uPkxWiWJ|nFvMm0K`E!C)!|T697S0hJgPQ7~MMoqaK2{07f$sU4KJI
z`*xfUrbZ>DGOZ7^w)or`o_;Uc+xj6aP7_)aXW&swus84_Mtg2eUk|jlfXcK!kz}JX
zJx*-g*8rzp2;HKm?^(TORi7#W7PAEzHVvV!81nPHV2q8rxbh|JL%79ZAR55!cl;jS
zg4>|~`S;MyKLDZRAe{RYWGR2ppfkn*u0Rqd2$-Sj(*YiUkWy0#Va=e{sgPtRfDQl%
zRon>7nV65Cj&@&|(|HJ#H6b4C1~rd?;9X$x8pvu16zk2fcf5+Co^Vmd*@Egl+Xwi-
zBc4qdoA(p!js6*vl!Z7F*o2RdtsUS40j!C{4G1A%GMNAn2q7Q@PoG=)=Re`L>C>TU
z=AL^7PcrL3M&cV(ESQMGlKC(>#sG-nncw~wI{aJk-h0)Ec2-033~pIDXW-lpA~GNo
zGX!q~OZpLMTm(Qs&v_l--5`<~KnD^Dvd<)Q$g%`Yy)Z2hmJJEnkf;~&;7TOAJ^=^?
zAsQ6(Bv4a6Bq9Jpj?x|@TzGM19<K5X@K^Ky<rf2tYiW7qq0<e4NnWRpm?6P1lAu%u
z=LF@mZpV**{9}Cj=_jaM_A-_%`6VI=0-IGsM|%jeEFWTwPf9CDcA-tZ3G3JI$D&0x
zD5NrFO9b%EH#G=^?Jx>%ym$!rbeI5R44eZHc_5@1LewMLQVD9E0l^u%122I{b`WAg
zdq{^rKsFBQ0p$WPRt!b|Ik-^^MV|rzGXxKVu{M~kHy{>21<u9$1N^|EP2Of9M3zOh
z#W<J-02~Y!)fRiW3W5;ge{FIgJMGky$*QvrfwIEFJo?e*Iy_!(1Lqusq#9|}t(beq
zJj4@maL(}8P4#fP>}Y9hHj;)>1z=L&^3Tfi;0&L|shR*rkI731XwROr2$ie=m2Le3
zsO!4Sk?a}51~}(1L@pR2P!)hGO%NhAi%6yksrS)h962NNhWfCfSq4)whe56akqk((
z4oS46I*C{SVgaEA*mE?D2|s%C<bVJQA+jDC_ZGs!uQkN?0szj%_oMvEr!*_c#Pa<M
zv-%e%RvbT3_r%a4g>>)9Htavuj%!EefEx^i5OB^R1P7%Gb{+{}&&eQs`Ce3?J(mz%
ztN`$z7uP{S7+!Ay_U&yzV^bJYrj)?uaG=ZR0N{b#XBCFbw%9DTlbo|5j2TUwb0N5Z
zA&QWMO;)8^lT6wvAqm2TnI}blLQ!tWkmL{Q%+_SJ=;LS8Z4w-uOEAPJ2%ZD*W)RT<
z##I=?1*_#cbc9|^uV5Fa8<y{1u=SyFZ$gvo00<~C!Ai2QeE$Lf_|ZlC(NiV2J^#$6
zt^1yxc*E6t<?5rj?nn#npLQiOomL141UkZa`||^+KGu%nl3eWAx+fyIc((Slr%x44
zTRNZu2AA>X+k4P0auAmbQN3#ugb*N3+GArbD3BTKXvMt?u1hA3bIf2nIcMpJ7;wR0
zE&!Ym0tg|Alv2gj^XAN_uPuMII?4H!1EvGcAvg!;0tUCkU}hLb!G+BOQTkbce(Cio
zt=k^1@?5`s|H5qx$1aCe_8^m9i8uD$4*)m4KBaZbAd-JM+!dL%W9y!=Wo2XZ6D@H(
zv}`lF!m*Skv1)L-?C|A#v199=NVqF<fOG!xr52N8>eJ9kD-3ff6e=Tx*-)u~WGa9(
z(8g?GMp6WW?YjWM`+CF+DRr)ARzZ7v>rR(5<5~dQ08|VZg}qs%Mi1wyY_Q}&s4`ds
zUZ2vs{oyLlq&E*dwEga@Ug{0r)Yqr9R$YRM@S<r;f7BW5TD)=Nw&#kA^VJNuix%X2
z0RSECA+$6$8$HAJS<WxO1WA$_+Wf5r7?uZ>%Fs0xn#lsQDF>QKfo7sGsZMArg-KDM
zDsozZM~*y`1pa3$W9+=m=J-J{gfUhN;4}ci7$auQeA&-Nqusr6#&_bNhpRl-0@w-Q
zr>{?G{qk~NUNmj#P$H2Eh0-a#K2MhALrKG^68{98^?hmC|5m=5NW>o$LeR^7h7e*X
zit@+BPyF%`^5KUcx@1`{H4MY_gLojNamLt*dGqG=LqaoW&o@hwlx;GZoXKQT?+IWe
zkw^rE5X~Fbe9(`6%qXAhR8@7DVHlPl+V~A?KG^hq_pDj<rkO~xDiKIrfXfnz&n&Nq
zU2Yj`*SupP5E>V$(JB!bgpla0+wYI2{ID#SPMtc{<a9cJ7!M2vO&d3EEbUP!0ATjq
zdkP34MU$>8Bfdf($;$L18jGW@uFhUp*I+w(?0A0poV#k*t$M$qPe)wgcDqdrD(;3=
zw?LNV3k-0OtSAa(S;p;m-2L6bUH6{KnPKOEwds7Fn@F;hm7N!29I<t)-;N|13*IsJ
zLE}3DFG)ml3c%jd((DmJm?@><40mQs2z0Ms`%YIp8SkKmVVLZ8JHGz<Yxw>C%L-m*
zW+raF`DXN0?cBR6#%5)Dtq(1%km}Dh;_#89*tWeI0O0nxQCL(+hL;W}|M*8$;q1Bh
zxYvBN@<7i5WQxUN=<4c1p|1dTyS;aq3^sHign(hB+I{=&capVh|1!YvuUq}LVlcx+
z2ywMEpVz0{{BtYk99y@1A+oabWI>2omSuU(sy73(=PcxdwNWCHOAwM_Boiiw!>!Mr
z^8nso`HG!0BO%FDXIv;MRndnBYH0239yDM#-+0}{>g&e?XV1N-Ak*uy{@Y^@%j-7$
z4Hk=r@uRQAgfS!2*5JtTlc=j}z~sp{%2idHt>ts>D(F?B-Dbr{t2bcHx=&JdF>5eu
zW+-Y(ZIUEGmSxCtiU+Ey`h9(DYisrABolEh8jC80MZ-V{!Qa1FWo|lOCz~{LBEy|2
zgh2AahaW8ow07uy+v9Xt@$Hcsc-=N|ZeZ$9Zig((7&CSvwr=^t14tl}!g6x54BFek
z!oouQ>4UYG6~LmRA_yVUa~>h2=)QaJme#EQ1Xq?0MTW}>pU($}!vP@#LZJ{W77GHc
zZP>Z{0LD)kFK?>aR5Ww;{8j*Pd%dt)EQmxRU`Fx+g(d{(;eoy7U5v8;pt7>E*f5L&
zAq0^m3H9fiF>c%hj2U|^0KjZc0geR^J|zhuv~LgY)M{#un%r)8#NX1U|La2wV6j}7
zf{93==2$g;ao-a#j06-VHPEgabv1^UUIi*sEPvy9nGj-0E70wB<BeBdx=bDzODj;4
zr0lCFj3*7}&ckNak&~T;5hF%GQBr1e$&w{_;e{9AbUIN}Q-hp_^N2*F@D=(<?b+IF
zAp|5zg0IkrnwlB}S_A31?)35Ph;~OXX2OlIJ2NiD0|{fS;PJ;FCz_@q6bj<R@q?&6
zTZ8cvCPC9IFp>!{&Y-F)48uT+zY(%*G6^9}0AR6LaO(7h?@SJx35*Hs*!~r+DVq$#
zNFWwV0TW4*ux;B{h{cTy4zpJ!EiEnSymR+9G&MD$v9S?NO-<Ojdt3TiC=^O7LRD2~
zUS1A4exe4~j30yi{QMpsNK!nov6lx@<mTq$+N;N*GuVlYj0{34z2wRjY;QqUmKXOw
zumBBpC;QJ&{S`<6pqB?mA`wWE1l?-GTg!ikL?VXvj#dOaS|NnMinlAFTW!!x+69L_
zNOERm<J*IKaPC|!LZKickuF3cT{u~D2&YaRhob7eiy(~$0s)iT?e6!2eFt~LYPF)Z
zEdY<(i+u-oW6V|KFYv%X0F=^rGMUufZa4Pr{}#HgL)ZK8z}5XhsKsJ|-EK!D5<zxO
zHW*|2#T9S$*P%Pyf$ne^&ph|v7&UqV-d*t)wr~0rx^BbR2{)t{n!$Krs^ciAOfjr<
z6uP^^&`cVH5Qs#&P+U?9O|t+90f2GMxRJPFVj0Gcy0TB(n&5A$LwjpIva<40ozT_-
zr^|z);w!Lc_g1)^jvgM!*oo@u>H$9R=!ruZH)aC%e!CNsu9=LZCl2A`k3SyZ0|AVT
z$K!o?;03&t=7B3$V*2#yFq^-d2PWb%wE7z`bLMo67%>vX#Y4cEfnPuKYn-e(hEG2E
z9BlzVvU74T!2>xcRiT<R$W%cz8bP=#gwH?w2to)<n?4UlGLfEMn8Cu7Qb>~2Z(*|8
z90+$gV6j+n=wLN!Y7Rq^Bv49G;2Q#m(}nJC0|2^dj}hKE0Bb#2F?j$FoIihnah)^&
z-bll_^LCfZ0mc{%!vLieoO6_ym-q0%PqA#-GAvoL1c^if7K;U)ot=<nIl?(l%Skn9
z@MINW^XBdFcs=Oay(!%xyLRnEBFW*+&Kt0Z^yPs<2w2Qk*c}-Nb+%*2j;}Fv*j3=1
zWBc}v&`cUsMMc8k2uEUreiydeorr`xF}!p%I)iN}EE)z%DH4eUx+7r}`i9`h(PI!o
z_y=rX9(nSCi2_`;n03xMmwJ2FV%GVhCo3isNQqY~-`>%O2L{idKW{52C?K1+?Zm7Z
z)B5v3s}*zS&P6;P2j?7HwpYX9binWT3&Svi0Q!wbPgWt$ojr{Dx^oy_I<zN397m5H
z#pJ2wP*t^G0Cim_y$hOQq<El7(_yo@kegS6STqcg+O{GmC-q^<?#MuQw;@_uf<n`@
zL6z*v$U-uige=R5Mk5ehq|Lm|?m~M<H|~Gn(Wo?#L~!+?ipNksV~%vbDYaoZ*Hnk{
z8FQou?|T#iT)n9Gn@^rREhwcpeWnhl&zuG49En5%$z&4ocpUL~9F$U=I(-JGPS?U>
zv7o-LUI-xu{gTg_fs70%jvYOLty{Ju8jZtlw<8{l4z`Glwb^V@&beTW#TjEU##qc^
zvBxsp*>Q){n>3qkhNf8zi^Xnuy!nZu;wyyNtj8=C%lJ!81pwg6$U<h84<2tm>`o7y
z&P-%x`cQhs7#Ie}rB<N>%U8St-C~8NX{i-dR$$d__~W~O0DuD*?MI_Rh}s=Hs##us
z9@cL746E0DjA$$lP19gDn-P!4v1;uGto!(L6!;3TZ|^=Pgs8oEUwi>*0vk5`4SV)}
z3xA*sD_4GiNF)MTmInloG1gsCQ9+W)WSlY9X&6R`F&5&ShZM!s>2zgwWM=u=vvW$?
zGqZf{R;x3}IgierI~TGnhXw)4X?!Jw0HrE)-2uDZ1KsL^qMG}aKVS&IR=J{c(UTSX
z|M>17#x1<}5$F~xvb;HX<DLHlfP=49uIL=Fbz1d)!|b{DxOY|WvW}lHUT*RS@cUQZ
zKzDa{di8ZU9mvVe!LI6EEF2Dp`|gJ?PQ}B<fEh_RTy9WG;VT*rS(c&qAghZM7&Ht+
zbaZrd2_eMbJg|RiYikR+TrL}cP5{}L{D(tN5Ys%+FfNY=zE-&+wCKr-{cpba>bSe-
zR`dq%+t(^r1TVSy{%GZa@;P@EY^vH+<SX=%jEoGDlbe(JD@bQ2{C>aa8MbwOgC|K+
zysfp(gi?S~3bWY^RaK#B8dOz<NmZb#YC89NOaNHB_AjEWY;=e*mbjF)`3@c!0}$=C
zKYiyyv)TMTJTThdgkCBwda}X}U|dh|IxeSTJzKkMN~yEg=gG1hF%09Mg0sGt2QFJS
sERjg$2q7+;EfPY6q9{#^7cV~f|IlM<R+<Udr2qf`07*qoM6N<$f|RqCdjJ3c
index aabb2b32c110a93ec93c00c2105a1b630c47f262..85910b16ee4ff1c2c0dd8b81b04a45cb1b306ee7
GIT binary patch
literal 8668
zc$@*;AtT<2P)<h;3K|Lk000e1NJLTq004LZ001xu1^@s6+Hbzo00001b5ch_0Itp)
z=>Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iO4>
z3JM<*ZrWA=000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}001BWNkl<Z
zc-rlJd2}4bx$m#4d%9=UERsee$(Cfvk~hiN5HJLT*%H76+lfiI4iI9(5}a_k3HQBw
z;UszIWrMIJ4+ruL0kb9!0RzUw;IJ4QY;1#MTV4R$vL%gnX(WwipYE!9f6SthG&2&$
z@0^^R)H!u}(ezhc^{a3HTEM^BKXoGju;Ha=r^~YZFk|d$A%y&e2oj=8lC)XZ^*dKx
z^Br%#-&QTXw;sR}lTo<<z@k`Oo2D2H9YTmbvAFg=fbFeY?mje?aVxI6w_25?2X#%m
zno=%jOb-GgaTLiPr%uub0f3DDoe;FW`BU=G0I&=IvMfJ*)`D|ZR8>?HLcZ9%gb;FT
z`-v5e`}YFCH*x@LHW>}Sl_Yxog4xsQ%*tZZw9-O29agk;4OO*x2dYkb`<9((?d7%0
zA9zmF^t)QO+#Sw45lSC&7TT9pv3<1ICP7tID2f6_Q9vo3Y*Ru}3{VsW{*eIwyu)`|
z7FX;4`drHR3{Hd#0H`2?l;Q+&Z~El4(C=N|Knbb^hYKKtP(H*3S_~zxHID(9F?Myu
zv?}8B^@DT%g$AXRqGDPV+1vQx)j7ajY*Gy`oWHQzv1Zi;<~>Kcanw761G`S3+ZRHK
z%ZwtY6?5iPn=V?s0B>#I|DBVq-OH+$-g|B9mb*X5H7@7kYP*Hg+rM=KN{XDYTCM4B
zFc_x%{y+QWub`XC#24D+gWojsc>H3)*`i3~*b1E+XB%j&SvA+5U_yM#dY12@f%xA^
z?Hk%D(f5AS$`$QW0kJ3?_;fiZ&RG(M4;d}9j#A(R>swYsxqS=qJQtHwT$flRj_o_Q
zAr_0C(!^BNh$ZJ=j7*vnz%?4){Mq-fu#}a!@QbH*;oMpaE~-;tt+#<Q1yoWIh)X!)
z4dR^-yK&~i+2-lfJ?0(n?|ZXq>AhFv1X&2F(CmbFK)_unAjD|@JT2%S1mONco1Dkv
z7Yl-`1do?;l+G)dv4sZPmMs)K+Civswje0tHiZLt<CN$t@rwnpRPdNvNYiKADqg3d
z_LcJmi?l&9RYQ<M9U}t3tMcgjBsez~i(>6&Kl+DrgIw;m;DI#@CfsjnIX;Hgc(H6$
z4KLht>*W@IgyE$ZcjE__7sH|wlzK{GvDnbud;s(3)*~1S!ej5oqFM{q{;d_xLKn_C
z_YBM4-TPmtT6%A7E^$3~P6eKN^9X+R><}OXI0yiq(8WRkf<RCKA`*HQf`HP5{w0Kf
zQi97WbPyuM7ZJ;`;L+<ft}YislT5|`3xEREbsIwcKfRKGYKlQ=G8m@~h`wd}i2Jo3
z0J!+O_dVD<LhlSmSza5cwk(3zcJ9IAc|(vWV0QlmfC7W_`y|l&(`6tMQx(2jRVxO@
z0L*z}PA+F521fdE@mDU*ImpiUwn3IBzK6?MIEGecGpdH)o_j`>qu6D~tD73}A6L0h
zTH?mE@(K__K?tzx!(CW>{spkvY$$P;psS}7|FweSzE^uuQdWkt@)Ac^XWv5rZl7o^
z5(J^*CqG;P%HxQ~V+e;Mh-(@+2N>sIT!4$j`*AM7MdDi18Ttl;*zmW;OxtTryZ`=Q
zFOe0)A9P)>&IiD2?+nq47PczRnIAxiC<wIx01VczQQ3TvLa3sQoc!`R1|#WVKsA6K
z0O%T`KmPHpSCKNeBku-sn+~GZ_y!y^-U9>!s0jd|*e-`+xd5Pw6gYA2Le+?_v<}YX
zI!{R%fKPF>GmyuS0%U0-z=>xka&Xnsd+Q~MUVr1)zifW^g}wOE)ukx+6r#LrItWQ{
zkI&~r|3E(m2Yqn43PCAFnWr2Cz+KA~{QR$8oUvezxu?7ThN`9aK04mIrV>H_NE{y?
z9YVlAj6t6d1HM7%x&}%qWJ!V~QOI)QT&B|KxkSN*NFpnM1doqt2F38~w^!XzQB+i%
zUq8m)Lu}|6!oByv<h}>sK|n;3BxOYVeuH4xM6EV}2uw>o7t<KASS>i(707Sn6c3_=
zdZ6^&36uMmAUu|!4?sXhxa+?lN%5m&jI5;21OSwJN>ON6(SN)t=O9H+6C_!haKG49
zGKN-0TQaY<j5dDOgA3*qz-}?1)H5v!E(IY3?cR0(KwG;Pg@r{BB4OQ@xJwZXg>cy!
z4m9@!;4Uem9p3IG01l0}glW<Nh{kn<V>&`n4NTV{%MuK-fI&z}?j#@}pqzkHfeh~`
zYg@Z^ts0Go%H8e~ghHWw9t0#k23h?QVu7t-;SV6GGeAHfL=<}T1ccUzK&(M75k5*N
zMlzot4#hDLh~))1VAU~fZ2$(}L#b^yWVH$e5`-9m9_>U++g{YqoONshz$xpwxX6tU
zpZ+0q#<RK;LI}vR1c^>u4aRf~4*Dio;zreQL1lTd=|tBszJ7KAii=7>DM{)+i~-o&
z(S|b@o(Vz(gh*KB4!Z+q&eXBHr4NOL4pVPW{{;XZ9q-T+N|4XVv&I`y7WgZMEXxqH
zT{bZyKuFqm&TNB&gT!oAvu<7?1RxTdL<j-G&7eYnYXgu?XG8E2XpsYuP4i(epO2XD
zJ^)n^0)#U@CQcC71!7u$FJ>fS1ml1z`(Q9Fg5Z9{gYUv%y$G_o9CqU{fC}W~;K9M{
zKH$f}Kcm616frFf)nLZK;Vt-*_1igj^0>Ch<91@l{&o~vT`-wUNQW3i0_1nzc^d-*
z1K7HCE0$lqV$8#eqQGre5Dte?<|zb#MLBpV9mL3{N6WNLxa*!j;dj5j23_L-mdWVm
zpvZ4zjaui4O*nckz)%PR52&FGQQxD`LhphQ6Qa;zuv`dPNl0bJ$q}OzJ)WX@$!vlD
z_*yN(k^CME;RTTNDD*%LA_Kny3+)6oxDg-vBP7cOi1U;b#o@$UlF=tk*N`vB(KPr9
z!lWPl{4<0}Kbi(#$r&_A($dpAQ`4sv6j;zZ7=}S6P!%P)NGXsx1_lN&e|`h}em`FS
z+vfBp;hcj~3X^KUNH7kY%>rF#)3QJdaDiONP()!>G!&OFhQsCrWh3MKcQR^i=aB=P
zF>ubnIR|GvdCrpeIpVwony3V|TnWyjFqkicWVr;g@j@^?4ApiaA~6|*LG{nX^Y^qo
zuJZ^GLLf^tXO}1ekxC(?nUJklL6U7y9V=k4TnNR!9E#$A&gTF?zmUjtX%3boX>-eo
zV=JnwW)ew~vQDfk^eLDe#1K6WyX-($=u;StrYvHbq2<IeAxYBaw1HxfJ34xYs|xK#
zfGUV<8jMs<i(w&v+S)oaHy?!AY{q*#-UA^Nmw)wgFs4IeI+&1PvnmJ#LXc&tBfHc{
zh8vS8+qI7|BmPGaW(JAsSbE*v04P?h`VpR4cLzWX(4&5^vekh5TOf2y>@wRH0_Pke
z$*l>|oZP4>zZ(KEF&kU}GPQu9H}N;Bf(R8tszlQ#ao+KE>B-L#9RwFVL7#I7F$aVQ
zNYnx%x<CX6AcIOq^beXbw`%x)x%ic~G{Cy9-+8jV1;<Yw%^iy_0!HFPI6AZ&F1ZE(
zu;s1S^2VYwtnNK+oxUok-GZSILrGkNsu<JY5+d-O>%Rk^&j(%Cq3Ln7wzXl;-aTk&
zs0U*VzJLac*^J?#5dheeZT<N;-YdcZoKatli!YfAljB_2i{?Yb51_Vg2LAhJ_aHR1
z6MH`V1bYvE1f6~hM3AH|&h9xRL@S#JY*IBO4Dp1&9Tl@dPznh?Pz-?!6-?M+HlGE5
z@L>Sq$$>=zP%ctOJ{rKmENCbLB|ZRy0E{qLs<HR*)41r$N885e;AB$Z8~Fyi{k<Z=
z<RCOlADA3O^0_GmuH$j-eQ(#mvf8>TQ{%B=%<x!Y=4JpiX}A$oRaK#~vMR01&O7(Z
zh{dCbM5B-h!N*63V73_HJ=q`8H2wYTi;=;40`N-9vG=nlarF2u{O}GA9@sy+5n~#j
zTE813Y#PGuAHYn>D6k}_q)!--8QeM+*v$KY5LW20K#1w1b_p?jF0SRAr@`fdC*~-U
zpbHa(C<jmmfS^Ds0q105vLRPnv%R=S2vGt67R46jU`7DoV6Z5*=<V+%7J?Ac`-dg{
zo;;+sdpr90Ip@@4%SR{hm9t7=P=YX<%t?P*j4^9;rbE*b!3rTb{2?8$f7F9{vn$cK
zdw>Jjo|S{g1z6&=2#4s8QK7$rx8C{$-}+`l`fq#ov|@nQBU1K1A<GgdP59$U9h?VX
zmH{Lt1^W~eHfeBEU8Jr>>O28-YV2J8gFMMVCATen0zuIW4rc6#?E?UG#P(s?-2Y*u
zkYFWlJhtzal6-Vpx7>Yb=CTK#-?jVD4fE#JnSb`oK|FfLIfz8UkYyQ^(uA)F0nRye
zrbE|sfDp*Cf}cFoh?*JYII#bdFz4dAY$?P{+enO)t11b=<upRqIZm_;prX<RhtmWD
z??)sf5;j2|k8L_2B+i(g32aK@j2euSfhyz#t$gdA;M#N-Y!vJiSEuwc7szc|Cavh4
z197_ev3)ngO5Etzjv*7^zW8Ubk`g?&?-l^$!pU}}uIoSU?C2RD_K!fZSg_{zdoUc*
zA-F(19!De^K_nVRG#&+K464zHP?TfM+TBpiR)m5<banO)>$-kdPJNZ-z9b^BYr8Rf
zb}{bz&3ky}g--nH*YCn!V1ki%f<{jyewXs0$9WR>KXl)#Mzdk3*=%XjH9gEZZ|0n(
zJL9~WbKWcjZx%u{1IXJoO%EB3rhP`UVdwo1-S<{Da1$X^krvB|&?+Cp)hubbGp>WN
zL?55$pOk~wUDCI6&35<skL|l<=dBAL2LZ+L$PQE)7ok?Y1nc&F58$}y|6bDn{$v2R
zZn-;Lwe;R=_wGLM<~iq{VJRvp!R>2zW5t)J;r#j%loi@wF)9d0<LDd+V&_3GHtp^}
z&5Uw{f<f%veITUk?AjcO20GT(9X%6}AfRB~<9pC&{5FD)ufnPy#QLZH4>;2xBx^c~
zm39-!sEFo_b=`T#kLEzYsx!TlbJi?QJr@DSbnEIHZ*oBhzV^|FQ+Zp%guuy|p5)jp
zK&SNcxMl(nNr{WR?GH=(_T03^dBNlRZhilj1&_fd6~ish#k!`O5DW3k*IzZbGr7Qg
z3Lx*Q_{vYO-n)DMpUTQh9A_+;WBRZqfOncdK`0zXAQ*?us=#74!)!5P-t0;o*#AkS
ztFw1F796_4`|iDavy4Rm7(u{wU8mz68%|UlHs1%8h9T5)7yv|#3(!;gFboDGB!eTJ
z$4;_v%E%%~5{Ecrr9NN(2T1_FP{MqmzxNO!ggTvt=Owus0Gxyn7LUgylgWI_wEZK)
zAcU}_)pZg;*3=XMASJn50wAqlI&}COe<--}kGSoP>+2uHx~7{ja7_E=i?{fj0N4Pq
zjIL+VF;a4u%I$CcVxOgS{vxhl^UI#@zH8hiMYOQcX)N~?!e+A|5C~y-XawGqebL6<
z14565H}*9C<!9l(PXYkU8T8{xpeX=5iwB$9TiVa6DR+|;_Yy*2kR>Rp1FBjKqbkE_
zFhEshs0KS!MTTmSVUQ)n;yQ!?4)!^9Jv8*clXMw?!;CXCfCDL-r=d~KIm-Z;`h0_H
z*Z%%@YZ&M1DHA0m*4H<%F8S^xmxxY*JEp(9X5`S7zp#D%dHm-q9gVToo9_yI48WMN
z;ChDa=i|6cWJ=FacXQ-Kck?goHA~(Z_Es)7+KU$$jE)*kWCs<RUkeYmMTUEhM13dr
z2E2P4vqT)&IQsI?CtIE)Tyy@(+c5)#h_rP{GD6K6PA(aBiPE4kos(nzgIhb^|NWmc
zXdmXB_Y~M2r?pm!bKVMIC>8F$|Go$B2k_g|K^j0Xxkfo-a+x4Y8Ql!Pk_0mdKpV%o
zTJo4nNu^epCO3yG5ki4G*&P6)$%*#^7)Tz6GwAXx`nLeU3;<P<(dMGEqI~{!A)HVe
z5|Q9%nif6|z&{nWa~d1X8zcQ3UREYU{Zmv9CO4ub*_BhAmq>2VU^2|4;a}}v?H|1*
z>Y_JnP-R)3$rvjXLVO{vCWHt{l6<<ZA78a<Ro?9N@|CMB0PL!&Isn+>@wloeN=yh5
zh{xl@0Q{RaZU{|f+-2YRH>1H|sL?d7Fg34~ZcVv0x!jv<_g{bYuiO7wL>pvTo_W?;
zXBAadRpB($MU&Rn)}qG7MgWPNWENnls;V<7rS93Y>d5rz<<#Txz+PZOcTcaeqqED{
z;q55&c65rB*WS>p>w3$kjT`dnLrIcq91cg377f5=wVXm-bmF%oBO}<gr|GmT?#mn3
zn~4x6o?K@N=!B5Sij_BoPY3;tFFk3Y1SSC@Cqw8u7l^F9=6j(r05ir4D=I25Ffed>
z>Y^(uuy^m?!W`h*RaKpP#{35P+HZcH9{Kbryd9m`y=O0cz9G0=4mcbR)Xl1+=bg6*
zAMD)i@p`>Q%U7;CvT5T6e;%u}P*n}M@w%H(R8(}zb<scn`OjgtSijI3yte6C$~4W%
zg|PMa_Y@H#nE@UwD)vOV5aCx|dNRNnA6$9uEvFPQdF|C_CC+sx7qIp8bQY<q$rO)A
zL++BY2qhx=%El*0RMj-N^lRVdsk&&A%9QNbu>-MK?35;^swytL@IqwL%mQx1tv7#H
za=YDl=J^e%sh)wEGb%8*t{S?oLzZR4;u<=;d$DJ4Bj(Sqr{(3P%I@8J8<wwJbubUe
z#N~8h*gt~8!opLoiyj#n`NEvVG|edpadBN!%x0_Q-@d&DfBnlko36!UvOzHmz(6G`
zl6k&Uh=yqn0peo1X0X}p=4)5oj+b71!kVOS1RzJE5davNP_h$?#qid<@54WmySlHa
z(1q`P_qqx9TUuIj>a^u6S5ZY#=6-MW4N^D~#fuwX!KF*ihpMXZcs#ILt!Qp;Mtyxf
zg25mh_5#eDQGu=RY=_h7#F=NEDK&oFICuHVReN%Y>)P5HY<+7Rdi(yGeh(o;x|S?;
z%+$}BM@lJ5i|t=nEDsFyx&d0mxlS%zvJ{de;morZ<GpRK7g9>OqA0-vyGwg@<NDx=
zl{du!VD&Ax*93#%@_0O+S4TSRRvb9^8Ol5^5JGUlk}K2nx4pBukWwlniHta1#o8Ev
zQ=-}Ba$zJ8#3h$pl5>z9J9cERi*~uj(8_FzqReclpC`LqF1)sR3%+{kh46Shm_B{9
zbavOSU0A$$aiT7|qy$}EUHIA+mtpf8Z^2VqhSJhfxu>V62EegwdX#a2@85PaIOmAP
zVu(Z{h{xl}IBrH3X53NJ8HR?2@aERHbI$p``|finic+iVx-lOB-Q9j7Q9*9H`A1+(
zgTaspOx4ykpt7o#NRmN%di{eoLP(q^VgYdg2n0gYzI)^Ka2FTlPuge^9B%#qH?IB>
z1ZR*9375a7W)3PVYCt8KJiY!wTZ--k4)%BwY2D7Q?!5WRYyhX89nZnbSFW;1lH^{#
z>?-==##eCVS1yLf<H59P)5g?A4-5>z=kuYkFj*H}mZ-D-+7*}K<=5UseM3F%?d>gD
zzH(L9c<Y)F0{=(=pB-y~-|xrZ;2?ZHA2cml7oAK?N|FRwmLW+JBuRonP8?I4QV4-;
zff_|oW?y&Rb!t&jegM4fE%@l8?b!CtCM>@23TRpknx>`Sao5hbp|e!fTcpF1nx?^G
zv7ocNH@_N`IV4%d);C|o#g|+S##x#^r4-xWeifYa@Puqqx-Po36gHa;Ct8l@5fcT-
zR=ZVPT%1cp+iR+4kk5`D!|b}5uvjc8D=SNbO9(-Gd$MfS>qSvfQCg&WJRXEXA=J;C
zjqcul6c-nhuC6XSfC&Jn#BDqtPjGNF2BvFi08^VX^;=3Q7#GRUS8~Uh*REYlqtU41
zcDpC7i;l%(C@ZVL@nc8eZEu0YS(K12x`x5Q0rd8GQBdGYxp6G>`A{e{sSQwIRbaKb
z(B9sP&W@9CIEz3jMJyV@$jC4bA3liM+S<qjfYWu+#l?8)kB@>emerjQLO_zFtgZ)R
z3_jn)x@bjF9A#x?w5z)ZXDw(zadC0_`P5>2y@?Xx_V#uxT(~ej7NryphXd7B6*zIS
z9fgHX+Sk|T01}^OWCJ)?8y@UKPsedo&X|MZ(&;%}rtxiXa1ds*IqT-l^s$8ykR=&H
z2!z8yl$BQ@7K@;_rxPWfa!jwN!LFTuhso@O5P~p)G1jckICMR4EdU}B4v7e8@fgad
z%|I*~!O4@Kp{lA5R+|GDm+YFr!9HL1y6DCOd(bd<0b;QjR8_^nBl~gI8H=VGIIy|h
zML5uW5H_nNqb?e0PJR3BjJoLM%g1jJIP3)ohr{rA+(>4yCiBN9-0SOZ#c%Ha9scvK
zf1d!bBuNttuY9z}1DiTmR5MIw8*DZ^KH9q-ttXGdU@(9&hRUj1*zHclH9&9?0(hF!
zYGzEwvZY@|BofIxb|@4;cUK!Y3*&<wZ^G+635(T+eN7*tqM{l`Q+gwYQUPudLWHK}
zuZ!N-{4v6j5c+++2uDKL*Zgr#4oK1x8Tv)FTCEry9EK!GP||hLqYIO$i=LmTi+=s}
z33bt`sv;DQz-qOEF{b8P^jvNcV+;maLfx#na5|mP;<2opJDFRRStpg*S+XwLXf(rW
zDL{42T<BUHGpc8yvZ@vpl`|2G#ZXmM2gU^An%;NKw{A_do4Y7s6{l>2Y@JdHtF-_Q
zXAx>^=Rq}^Fni8?R94nt*6aqDEmqj=#Yo1{d(#{&Ns_OnrKPC4x*9p_qI)`^GYvz2
z9|{Tz(ACp1h7&UvvZbX3k|d=?fx%#i_4f4}3knKADTStKX^u&OQdd`p=H_OY&1P)h
zz8!=RTz>iG&~+WUu0sd`i`j%=FbGMKV%Y#5zd`+jz36EB6pEsNbB<eXxgCTMeCNiS
z@Vnps282q8M#5-Va4u%n&6|=$NLk+FH&o`et)LKG0Fq=tG@7VDm8b-h(F9w86T|+f
z7#<#(@<-U2v^nQ+IEug+gCrRc4vnN$nW7jGkL!>K@h)F^Q#1{*uItB7o;-=;$B*ZY
zMTbHm96xasMXtmL(p$D{$s3E#c)>t-cek;?UVu<I0!`DPs_Ga&^@ba67_E!eG_<v~
zVb7jDXlQ5vV+?^{2xhYxe!m|80#gyo;ovZ4)>L89qO(y^QH`qVI`s8*p=M?c{`>BG
z(0cMH_U$`>p6+(k&Z?hMn3ge?S45}I3kqB?8qJ7BBZ$Q!35(sJqGskSyz%C?&yzQv
z;N}S-;BXYdY_=jA2_qT}Ly`?BDJjLf+jisD+x|T|Mh7R80*CVrwC1kWOLV3ou1BG>
zgjv37)v754<TXtj?(Xg_tgfl1EhpRHDRHNbmJ}B!>Y^*t3w7Rk=OGr0AsUT>5Q3Hy
zCt)(1;BEJEUDt>6>BV$FrlbO0-lN#KaTBh&W(E8sqxMBC8pErvz7B(8!o2y5CXH8*
zU+}4bEJ+5K%rcB7Yx>?)$I0Z_Y(9K~Yh{?sHW*D-5JF(J7GzI0<Z3^->wD)3a0LL&
zCJX1B)6^u*CJSG4*Xkt+e~!i<edx&#^N{j)b#;j|&s>1UrUN+hjCzDZA(%|2wCj=y
zPKt|Tu^2e#2#3S?sPO=5>uS-|*d&t4_^gYc*$k=))2ilTsJ{~*ebk6cFS|JXw}S@{
z!)SJ3;n^2JmT1}vPf8S#kAri8n(O)$5;haS%@?SdG@Fz=1J0G(R^NeOC;-km?dVQ?
z5z*1zhUHhSq?A%v%vL=9^dosIC^l`}5L$Wd4SgSf+*C4W&Mf-;UtYqRTW>-n5=jRj
zGC@k|T|x*91_Pek@FFU!DskxGAufdIooWg(HF-^o!De%UF^0~LPIx>X*a~cj$6B+x
zM>!Tv03e)mF&VH^NYPIE^<pk#ZoH_TEIE{4UI?=Pv8R3yi`j~PUoSek62XX$u6Fbd
z^uTJd;qj**0Ri1V*{pP3Ki<{Vr4Rc@U^JQW=wnYJ6bdE2$cx7jjYbiPL=cO`z!-zk
zXhbv`#UtyUfXQq@Fc?I4cek$VddpPZq7=ss`MOb6Re@)p`7^e?_aUBo>N(h~7Q~_<
z1crTS(V5Mce&B%z<{6E~g=VuksOviCoQF8)A;wsUF&0W)bIwCa*CcP(G>sXJ#-Pz?
zT=>8P56qv;pvu=7V_=M>8RByT{D<GJ_fsP6d;IA~P+eJznKNdA5Q3`dHJCYL79M-*
z_YguHc=Vws{gVN_Y2yaY7(3F`*u(&!*j<80)~(039Xm1L8%(+YR!EYBp<zGX-nIje
ztXq$w;)Frh)Y!xrV@D>-3y%jn0h)xDUw#eKDrTd8;bP31cQ!V^z7^4EG#$&$1UD08
z##sE$JMWZkzWHW@uIn+zSdcLm<eUeE5J4eC5Q#FMDRstJeD&(phCA-KgEGcqnS~eQ
z0nXOP8(o<|XTx>Uy68t9d?Il353k?<_|uOpxaGzlz-qCfq_`C8)~`i8rZqqD$n*ZG
z>XuC#H~6o-dgY<Uj~nNdmX^x(4fXW+iB=pu^a;Y@Fhb!7EM^nTW;0A?6Kd;fap>S7
z-re1;hk}7mw{F=ql1~z4+r^Yp)YYF0!5OT!gc0H_EWz35eFci5z+|?JF@CaG(jmr}
zGB7aUpNgM6S?lZT3lTzy%jGJ_2)D|F5D|~ZNjBGWs?G2Br|bt6iQ>hah3_Pz<B3O}
z4}D|RRR{n0%%ct0U%MLX)~`i>ukXl<&%YK#qS{hq=qZs!$E4}Kv3X;#e0pWmnO{10
zMsII#adB}m3Jaao<8i}kwIUb{!teLP+wSE}jZKKfV*MZO+1c9D)xk2x%B-#=0OV*i
z8fb58w@sf`J|-n7%kr4&4pmj57-T4l0)rv(#bf030003iNkl<Z-|b{sPG_Bb!vPTv
z1zR(8WtcH0rNB5%b<yC7FXd7I6Q9r5`S8OJm!%BZQ!JO_{r&yjlNnhgTYq`O-$GX`
zyX5fmFFZBR+uHTn=8aneNzTazs>o)bq%JzWZM@Ul)>b=f&XChpY`5F(R+HIcB8137
z2t5=GME%1<;emm^k=7H(gE<VIG4Fij(EeV*ncUggX-Y7fm=OHP6|YX+<D8TJzM;Ww
zZ@<x($-$iSxZQ5Y>1>?yC`LaJ(C)wgelLKI(?B{^H=eg_b_@q&Y(29yj!3pX6-$yP
zH<$s5QddLrnq#!aI@R?_Xv;|CR*kCBB+If)Phs~9LI~I5v2ZjRjbM^50RKO=(^VIJ
uS_%FmwAAM|bW+b?YP+9JaijjjxBmy}FMOHBs|Sz(0000<MNUMnLSTYeP-L?J
--- a/browser/themes/gnomestripe/browser/browser.css
+++ b/browser/themes/gnomestripe/browser/browser.css
@@ -201,38 +201,17 @@ menuitem.bookmark-item {
.bookmark-item[container] {
list-style-image: url("moz-icon://stock/gtk-directory?size=menu");
}
/* livemarks have the same layout as folder-item, but in the browser-only livemark-item.png */
/* only the folder icon has any effect for now, item icon is unused */
.bookmark-item[container][livemark] {
- list-style-image: url("chrome://browser/skin/places/livemark-folder.png");
- -moz-image-region: rect(0px, 16px, 16px, 0px);
-}
-
-.bookmark-item[container][livemark][chromedir="rtl"] {
- list-style-image: url("chrome://browser/skin/places/livemark-folder-rtl.png");
- -moz-image-region: rect(0px, 16px, 16px, 0px);
-}
-
-.bookmark-item[container][livemark][open],
-.bookmark-item[container][livemark][open][chromedir="rtl"] {
- -moz-image-region: rect(16px, 16px, 32px, 0px);
-}
-
-.bookmark-item[type="menu"][livemark],
-.bookmark-item[type="menu"][livemark][chromedir="rtl"] {
- -moz-image-region: rect(0px, 32px, 16px, 16px) !important;
-}
-
-.bookmark-item[type="menu"][livemark][open],
-.bookmark-item[type="menu"][livemark][open][chromedir="rtl"] {
- -moz-image-region: rect(16px, 32px, 32px, 16px) !important;
+ list-style-image: url("chrome://browser/skin/feeds/feedIcon16.png");
}
.bookmark-item[container][tagContainer] {
list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
-moz-image-region: auto;
}
.bookmark-item[container][query] {
@@ -796,21 +775,16 @@ toolbar[iconsize="small"] #paste-button[
-moz-user-input: disabled;
cursor: -moz-grab;
}
#wrapper-urlbar-container #urlbar > .autocomplete-history-dropmarker {
display: none;
}
-/* Keep the URL bar LTR */
-#urlbar .autocomplete-textbox-container {
- direction: ltr;
-}
-
#PopupAutoComplete {
direction: ltr !important;
}
#PopupAutoCompleteRichResult {
direction: ltr !important;
}
@@ -846,16 +820,21 @@ toolbar[iconsize="small"] #paste-button[
cursor: default;
-moz-image-region: rect(32px, 16px, 48px, 0px) !important;
}
/* Identity indicator */
#identity-box {
background-color: -moz-dialog;
-moz-border-end: 1px solid ThreeDShadow;
+ -moz-user-focus: normal;
+}
+
+#identity-box:focus {
+ outline: 1px dotted -moz-DialogText;
}
#identity-icon-label {
padding: 0 2px;
margin: 0;
}
#identity-box.verifiedIdentity > hbox {
@@ -937,17 +916,16 @@ toolbar[iconsize="small"] #paste-button[
.verifiedIdentity > #identity-popup-encryption,
.verifiedDomain > #identity-popup-encryption {
margin-left: -18px;
}
.verifiedIdentity > #identity-popup-encryption > * > #identity-popup-encryption-icon,
.verifiedDomain > #identity-popup-encryption > * > #identity-popup-encryption-icon {
list-style-image: url("chrome://browser/skin/Secure.png");
- -moz-image-region: rect(0px, 18px, 18px, 0px);
}
/* Identity popup bounding box */
#identity-popup-container {
background-image: none;
background-color: white;
min-width: 280px;
padding: 10px;
@@ -962,17 +940,19 @@ toolbar[iconsize="small"] #paste-button[
background-color: #F5F6BE; /* #F7F898; */
color: #000000;
}
#urlbar > .autocomplete-textbox-container {
-moz-binding: url(chrome://browser/skin/browser.xml#autocomplete-security-wrapper);
}
+/* keep the URL bar content LTR */
#autocomplete-security-wrapper {
+ direction: ltr; | __label__pos | 0.793548 |
Concepts and Terminology
This document provides an overview of the source tree layout and the terminology used in Bazel.
Table of Contents
Introduction
Bazel builds software from source code organized in a directory called a workspace. Source files in the workspace are organized in a nested hierarchy of packages, where each package is a directory that contains a set of related source files and one BUILD file. The BUILD file specifies what software outputs can be built from the source.
Workspace, Packages and Targets
Workspace
A workspace is a directory on your filesystem that contains the source files for the software you want to build, as well as symbolic links to directories that contain the build outputs. Each workspace directory has a text file named WORKSPACE which may be empty, or may contain references to external dependencies required to build the outputs.
Directories containing a file called WORKSPACE are considered the root of a workspace. Therefore, Bazel ignores any directory trees in a workspace rooted at a subdirectory containing a WORKSPACE file (as they form another workspace).
Repositories
Code is organized in repositories. The directory containing the WORKSPACE file is the root of the main repository, also called @. Other, (external) repositories are defined in the WORKSPACE file using workspace rules.
The workspace rules bundled with Bazel are documented in the Workspace Rules section in the Build Encyclopedia and the documentation on embeded Starlark repository rules.
As external repositories are repositories themselves, they often contain a WORKSPACE file as well. However, these additional WORKSPACE files are ignored by Bazel. In particular, repositories depended upon transitively are not added automatically.
Packages
The primary unit of code organization in a repository is the package. A package is a collection of related files and a specification of the dependencies among them.
A package is defined as a directory containing a file named BUILD or BUILD.bazel, residing beneath the top-level directory in the workspace. A package includes all files in its directory, plus all subdirectories beneath it, except those which themselves contain a BUILD file.
For example, in the following directory tree there are two packages, my/app, and the subpackage my/app/tests. Note that my/app/data is not a package, but a directory belonging to package my/app.
src/my/app/BUILD
src/my/app/app.cc
src/my/app/data/input.txt
src/my/app/tests/BUILD
src/my/app/tests/test.cc
Targets
A package is a container. The elements of a package are called targets. Most targets are one of two principal kinds, files and rules. Additionally, there is another kind of target, package groups, but they are far less numerous.
Files are further divided into two kinds. Source files are usually written by the efforts of people, and checked in to the repository. Generated files, sometimes called derived files, are not checked in, but are generated by the build tool from source files according to specific rules.
The second kind of target is the rule. A rule specifies the relationship between a set of input and a set of output files, including the necessary steps to derive the outputs from the inputs. The outputs of a rule are always generated files. The inputs to a rule may be source files, but they may be generated files also; consequently, outputs of one rule may be the inputs to another, allowing long chains of rules to be constructed.
Whether the input to a rule is a source file or a generated file is in most cases immaterial; what matters is only the contents of that file. This fact makes it easy to replace a complex source file with a generated file produced by a rule, such as happens when the burden of manually maintaining a highly structured file becomes too tiresome, and someone writes a program to derive it. No change is required to the consumers of that file. Conversely, a generated file may easily be replaced by a source file with only local changes.
The inputs to a rule may also include other rules. The precise meaning of such relationships is often quite complex and language- or rule-dependent, but intuitively it is simple: a C++ library rule A might have another C++ library rule B for an input. The effect of this dependency is that B's header files are available to A during compilation, B's symbols are available to A during linking, and B's runtime data is available to A during execution.
An invariant of all rules is that the files generated by a rule always belong to the same package as the rule itself; it is not possible to generate files into another package. It is not uncommon for a rule's inputs to come from another package, though.
Package groups are sets of packages whose purpose is to limit accessibility of certain rules. Package groups are defined by the package_group function. They have two properties: the list of packages they contain and their name. The only allowed ways to refer to them are from the visibility attribute of rules or from the default_visibility attribute of the package function; they do not generate or consume files. For more information, refer to the appropriate section of the Build Encyclopedia.
Labels
All targets belong to exactly one package. The name of a target is called its label, and a typical label in canonical form looks like this:
@myrepo//my/app/main:app_binary
In the typical case that a label refers to the same repository it occurs in, the repository name may be left out. So, inside @myrepo this label is usually written as
//my/app/main:app_binary
Each label has two parts, a package name (my/app/main) and a target name (app_binary). Every label uniquely identifies a target. Labels sometimes appear in other forms; when the colon is omitted, the target name is assumed to be the same as the last component of the package name, so these two labels are equivalent:
//my/app
//my/app:app
Short-form labels such as //my/app are not to be confused with package names. Labels start with //, but package names never do, thus my/app is the package containing //my/app. (A common misconception is that //my/app refers to a package, or to all the targets in a package; neither is true.)
Within a BUILD file, the package-name part of label may be omitted, and optionally the colon too. So within the BUILD file for package my/app (i.e. //my/app:BUILD), the following "relative" labels are all equivalent:
//my/app:app
//my/app
:app
app
(It is a matter of convention that the colon is omitted for files, but retained for rules, but it is not otherwise significant.)
Similarly, within a BUILD file, files belonging to the package may be referenced by their unadorned name relative to the package directory:
generate.cc
testdata/input.txt
But from other packages, or from the command-line, these file targets must always be referred to by their complete label, e.g. //my/app:generate.cc.
Relative labels cannot be used to refer to targets in other packages; the complete package name must always be specified in this case. For example, if the source tree contains both the package my/app and the package my/app/testdata (i.e., each of these two packages has its own BUILD file). The latter package contains a file named testdepot.zip. Here are two ways (one wrong, one correct) to refer to this file within //my/app:BUILD:
testdata/testdepot.zip # Wrong: testdata is a different package.
//my/app/testdata:testdepot.zip # Right.
If, by mistake, you refer to testdepot.zip by the wrong label, such as //my/app:testdata/testdepot.zip or //my:app/testdata/testdepot.zip, you will get an error from the build tool saying that the label "crosses a package boundary". You should correct the label by putting the colon after the directory containing the innermost enclosing BUILD file, i.e., //my/app/testdata:testdepot.zip.
Lexical specification of a label
The syntax of labels is intentionally strict, so as to forbid metacharacters that have special meaning to the shell. This helps to avoid inadvertent quoting problems, and makes it easier to construct tools and scripts that manipulate labels, such as the Bazel Query Language. All of the following are forbidden in labels: any sort of white space, braces, brackets, or parentheses; wildcards such as *; shell metacharacters such as >, & and |; etc. This list is not comprehensive; the precise details are below.
Target names, //...:target-name
target-name is the name of the target within the package. The name of a rule is the value of the name attribute in the rule's declaration in a BUILD file; the name of a file is its pathname relative to the directory containing the BUILD file. Target names must be composed entirely of characters drawn from the set az, AZ, 09, and the punctuation symbols _/.+-=,@~. Do not use .. to refer to files in other packages; use //packagename:filename instead. Filenames must be relative pathnames in normal form, which means they must neither start nor end with a slash (e.g. /foo and foo/ are forbidden) nor contain multiple consecutive slashes as path separators (e.g. foo//bar). Similarly, up-level references (..) and current-directory references (./) are forbidden. The sole exception to this rule is that a target name may consist of exactly '.'.
While it is common to use / in the name of a file target, we recommend that you avoid the use of / in the names of rules. Especially when the shorthand form of a label is used, it may confuse the reader. The label //foo/bar/wiz is always a shorthand for //foo/bar/wiz:wiz, even if there is no such package foo/bar/wiz; it never refers to //foo:bar/wiz, even if that target exists.
However, there are some situations where use of a slash is convenient, or sometimes even necessary. For example, the name of certain rules must match their principal source file, which may reside in a subdirectory of the package.
Package names, //package-name:...
The name of a package is the name of the directory containing its BUILD file, relative to the top-level directory of the source tree. For example: my/app. Package names must be composed entirely of characters drawn from the set A-Z, az, 09, '/', '-', '.', and '_', and cannot start with a slash.
For a language with a directory structure that is significant to its module system (e.g. Java), it is important to choose directory names that are valid identifiers in the language.
Although Bazel allows a package at the build root (e.g. //:foo), this is not advised and projects should attempt to use more descriptively named packages.
Package names may not contain the substring //, nor end with a slash.
Rules
A rule specifies the relationship between inputs and outputs, and the steps to build the outputs. Rules can be of one of many different kinds or classes, which produce compiled executables and libraries, test executables and other supported outputs as described in the Build Encyclopedia.
Every rule has a name, specified by the name attribute, of type string. The name must be a syntactically valid target name, as specified above. In some cases, the name is somewhat arbitrary, and more interesting are the names of the files generated by the rule; this is true of genrules. In other cases, the name is significant: for *_binary and *_test rules, for example, the rule name determines the name of the executable produced by the build.
cc_binary(
name = "my_app",
srcs = ["my_app.cc"],
deps = [
"//absl/base",
"//absl/strings",
],
)
Every rule has a set of attributes; the applicable attributes for a given rule, and the significance and semantics of each attribute are a function of the rule's class; see the Build Encyclopedia for a list of rules and their corresponding attributes. Each attribute has a name and a type. Some of the common types an attribute can have are integer, label, list of labels, string, list of strings, output label, list of output labels. Not all attributes need to be specified in every rule. Attributes thus form a dictionary from keys (names) to optional, typed values.
The srcs attribute present in many rules has type "list of labels"; its value, if present, is a list of labels, each being the name of a target that is an input to this rule.
The outs attribute present in many rules has type "list of output labels"; this is similar to the type of the srcs attribute, but differs in two significant ways. Firstly, due to the invariant that the outputs of a rule belong to the same package as the rule itself, output labels cannot include a package component; they must be in one of the "relative" forms shown above. Secondly, the relationship implied by an (ordinary) label attribute is inverse to that implied by an output label: a rule depends on its srcs, whereas a rule is depended on by its outs. The two types of label attributes thus assign direction to the edges between targets, giving rise to a dependency graph.
This directed acyclic graph over targets is called the "target graph" or "build dependency graph", and is the domain over which the Bazel Query tool operates.
BUILD Files
The previous section described packages, targets and labels, and the build dependency graph abstractly. In this section, we'll look at the concrete syntax used to define a package.
By definition, every package contains a BUILD file, which is a short program. BUILD files are evaluated using an imperative language, Starlark. They are interpreted as a sequential list of statements.
In general, order does matter: variables must be defined before they are used, for example. However, most BUILD files consist only of declarations of build rules, and the relative order of these statements is immaterial; all that matters is which rules were declared, and with what values, by the time package evaluation completes. When a build rule function, such as cc_library, is executed, it creates a new target in the graph. This target can later be referred using a label. So, in simple BUILD files, rule declarations can be re-ordered freely without changing the behavior.
To encourage a clean separation between code and data, BUILD files cannot contain function definitions, for statements or if statements (but list comprehensions and if expressions are allowed). Functions should be declared in .bzl files instead. Additionally, *args and **kwargs arguments are not allowed in BUILD files; instead list all the arguments explicitly.
Crucially, programs in Starlark are unable to perform arbitrary I/O. This invariant makes the interpretation of BUILD files hermetic, i.e. dependent only on a known set of inputs, which is essential for ensuring that builds are reproducible.
BUILD files should be written using only ASCII characters, although technically they are interpreted using the Latin-1 character set.
Since BUILD files need to be updated whenever the dependencies of the underlying code change, they are typically maintained by multiple people on a team. BUILD file authors are encouraged to use comments liberally to document the role of each build target, whether or not it is intended for public use, and to document the role of the package itself.
Loading an extension
Bazel extensions are files ending in .bzl. Use the load statement to import a symbol from an extension.
load("//foo/bar:file.bzl", "some_library")
This code will load the file foo/bar/file.bzl and add the some_library symbol to the environment. This can be used to load new rules, functions or constants (e.g. a string, a list, etc.). Multiple symbols can be imported by using additional arguments to the call to load. Arguments must be string literals (no variable) and load statements must appear at top-level, i.e. they cannot be in a function body. The first argument of load is a label identifying a .bzl file. If it is a relative label, it is resolved with respect to the package (not directory) containing the current bzl file. Relative labels in load statements should use a leading :. load also supports aliases, i.e. you can assign different names to the imported symbols.
load("//foo/bar:file.bzl", library_alias = "some_library")
You can define multiple aliases within one load statement. Moreover, the argument list can contain both aliases and regular symbol names. The following example is perfectly legal (please note when to use quotation marks).
load(":my_rules.bzl", "some_rule", nice_alias = "some_other_rule")
In a .bzl file, symbols starting with _ are not exported and cannot be loaded from another file. Visibility doesn't affect loading (yet): you don't need to use exports_files to make a .bzl file visible.
Types of build rule
The majority of build rules come in families, grouped together by language. For example, cc_binary, cc_library and cc_test are the build rules for C++ binaries, libraries, and tests, respectively. Other languages use the same naming scheme, with a different prefix, e.g. java_* for Java. Some of these functions are documented in the Build Encyclopedia, but it is possible for anyone to create new rules.
• *_binary rules build executable programs in a given language. After a build, the executable will reside in the build tool's binary output tree at the corresponding name for the rule's label, so //my:program would appear at (e.g.) $(BINDIR)/my/program.
Such rules also create a runfiles directory containing all the files mentioned in a data attribute belonging to the rule, or any rule in its transitive closure of dependencies; this set of files is gathered together in one place for ease of deployment to production.
• *_test rules are a specialization of a *_binary rule, used for automated testing. Tests are simply programs that return zero on success.
Like binaries, tests also have runfiles trees, and the files beneath it are the only files that a test may legitimately open at runtime. For example, a program cc_test(name='x', data=['//foo:bar']) may open and read $TEST_SRCDIR/workspace/foo/bar during execution. (Each programming language has its own utility function for accessing the value of $TEST_SRCDIR, but they are all equivalent to using the environment variable directly.) Failure to observe the rule will cause the test to fail when it is executed on a remote testing host.
• *_library rules specify separately-compiled modules in the given programming language. Libraries can depend on other libraries, and binaries and tests can depend on libraries, with the expected separate-compilation behavior.
Dependencies
A target A depends upon a target B if B is needed by A at build or execution time. The depends upon relation induces a Directed Acyclic Graph (DAG) over targets, and we call this a dependency graph. A target's direct dependencies are those other targets reachable by a path of length 1 in the dependency graph. A target's transitive dependencies are those targets upon which it depends via a path of any length through the graph.
In fact, in the context of builds, there are two dependency graphs, the graph of actual dependencies and the graph of declared dependencies. Most of the time, the two graphs are so similar that this distinction need not be made, but it is useful for the discussion below.
Actual and declared dependencies
A target X is actually dependent on target Y iff Y must be present, built and up-to-date in order for X to be built correctly. "Built" could mean generated, processed, compiled, linked, archived, compressed, executed, or any of the other kinds of tasks that routinely occur during a build.
A target X has a declared dependency on target Y iff there is a dependency edge from X to Y in the package of X.
For correct builds, the graph of actual dependencies A must be a subgraph of the graph of declared dependencies D. That is, every pair of directly-connected nodes x --> y in A must also be directly connected in D. We say D is an overapproximation of A.
It is important that it not be too much of an overapproximation, though, since redundant declared dependencies can make builds slower and binaries larger.
What this means for BUILD file writers is that every rule must explicitly declare all of its actual direct dependencies to the build system, and no more. Failure to observe this principle causes undefined behavior: the build may fail, but worse, the build may depend on some prior operations, or upon which transitive declared dependencies the target happens to have. The build tool attempts aggressively to check for missing dependencies and report errors, but it is not possible for this checking to be complete in all cases.
You need not (and should not) attempt to list everything indirectly imported, even if it is "needed" by A at execution time.
During a build of target X, the build tool inspects the entire transitive closure of dependencies of X to ensure that any changes in those targets are reflected in the final result, rebuilding intermediates as needed.
The transitive nature of dependencies leads to a common mistake. Through careless programming, code in one file may use code provided by an indirect dependency, i.e. a transitive but not direct edge in the declared dependency graph. Indirect dependencies do not appear in the BUILD file. Since the rule doesn't directly depend on the provider, there is no way to track changes, as shown in the following example timeline:
1. At first, everything works
The code in package a uses code in package b. The code in package b uses code in package c, and thus a transitively depends on c.
a/BUILD
rule(
name = "a",
srcs = "a.in",
deps = "//b:b",
)
a/a.in
import b;
b.foo();
b/BUILD
rule(
name = "b",
srcs = "b.in",
deps = "//c:c",
)
b/b.in
import c;
function foo() {
c.bar();
}
Declared dependency graph: a --> b --> c
Actual dependency graph: a --> b --> c
The declared dependencies overapproximate the actual dependencies. All is well.
2. A latent hazard is introduced.
Someone carelessly adds code to a that creates a direct actual dependency on c, but forgets to declare it.
a/a.in
import b;
import c;
b.foo();
c.garply();
Declared dependency graph: a --> b --> c
Actual dependency graph: a --> b -->_c
\_________/|
The declared dependencies no longer overapproximate the actual dependencies. This may build ok, because the transitive closures of the two graphs are equal, but masks a problem: a has an actual but undeclared dependency on c.
3. The hazard is revealed
Someone refactors b so that it no longer depends on c, inadvertently breaking a through no fault of their own.
b/BUILD
rule(
name = "b",
srcs = "b.in",
deps = "//d:d",
)
b/b.in
import d;
function foo() {
d.baz();
}
Declared dependency graph: a --> b c
Actual dependency graph: a --> b _c
\_________/|
The declared dependency graph is now an underapproximation of the actual dependencies, even when transitively closed; the build is likely to fail. The problem could have been averted by ensuring that the actual dependency from a to c introduced in Step 2 was properly declared in the BUILD file.
Types of dependencies
Most build rules have three attributes for specifying different kinds of generic dependencies: srcs, deps and data. These are explained below. See also Attributes common to all rules in the Build Encyclopedia.
Many rules also have additional attributes for rule-specific kinds of dependency, e.g. compiler, resources, etc. These are detailed in the Build Encyclopedia.
srcs dependencies
Files consumed directly by the rule or rules that output source files.
deps dependencies
Rule pointing to separately-compiled modules providing header files, symbols, libraries, data, etc.
data dependencies
A build target might need some data files to run correctly. These data files aren't source code: they don't affect how the target is built. For example, a unit test might compare a function's output to the contents of a file. When we build the unit test, we don't need the file; but we do need it when we run the test. The same applies to tools that are launched during execution.
The build system runs tests in an isolated directory where only files listed as "data" are available. Thus, if a binary/library/test needs some files to run, specify them (or a build rule containing them) in data. For example:
# I need a config file from a directory named env:
java_binary(
name = "setenv",
...
data = [":env/default_env.txt"],
)
# I need test data from another directory
sh_test(
name = "regtest",
srcs = ["regtest.sh"],
data = [
"//data:file1.txt",
"//data:file2.txt",
...
],
)
These files are available using the relative path path/to/data/file. In tests, it is also possible to refer to them by joining the paths of the test's source directory and the workspace-relative path, e.g. ${TEST_SRCDIR}/workspace/path/to/data/file.
Using Labels to Reference Directories
As you look over our BUILD files, you might notice that some data labels refer to directories. These labels end with /. or / like so:
data = ["//data/regression:unittest/."] # don't use this
or like so:
data = ["testdata/."] # don't use this
or like so:
data = ["testdata/"] # don't use this
This seems convenient, particularly for tests (since it allows a test to use all the data files in the directory).
But try not to do this. In order to ensure correct incremental rebuilds (and re-execution of tests) after a change, the build system must be aware of the complete set of files that are inputs to the build (or test). When you specify a directory, the build system will perform a rebuild only when the directory itself changes (due to addition or deletion of files), but won't be able to detect edits to individual files as those changes do not affect the enclosing directory. Rather than specifying directories as inputs to the build system, you should enumerate the set of files contained within them, either explicitly or using the glob() function. (Use ** to force the glob() to be recursive.)
data = glob(["testdata/**"]) # use this instead
Unfortunately, there are some scenarios where directory labels must be used. For example, if the testdata directory contains files whose names do not conform to the strict label syntax (e.g. they contain certain punctuation symbols), then explicit enumeration of files, or use of the glob() function will produce an invalid labels error. You must use directory labels in this case, but beware of the concomitant risk of incorrect rebuilds described above.
If you must use directory labels, keep in mind that you can't refer to the parent package with a relative "../" path; instead, use an absolute path like "//data/regression:unittest/.".
Note that directory labels are only valid for data dependencies. If you try to use a directory as a label in an argument other than data, it will fail and you will get a (probably cryptic) error message. | __label__pos | 0.892948 |
Introduction
Are you looking for a comprehensive guide to help you prepare for the Microsoft PL-300 exam? This guide provides an in-depth overview of the exam topics, exam structure, and strategies to help you pass the exam with flying colors. It covers all the topics in the exam syllabus, from Azure fundamentals to Azure solutions and services, and provides a comprehensive set of practice questions to help you hone your skills. With this guide, you will be able to confidently tackle the PL-300 exam and achieve the certification you desire.
Overview of the PL-300 Exam
The PL-300 exam is a Microsoft certification exam designed to test an individual’s knowledge and skills in developing Microsoft Power Platform solutions. It is intended for individuals who have a basic understanding of the Power Platform and are looking to expand their skillset.
The exam consists of a total of 40-60 questions, which are divided into three main categories: Core Solutions, Advanced Solutions, and Professional Solutions. The Core Solutions section covers the fundamentals of the Power Platform, such as understanding the components of the platform, configuring the environment, and developing basic solutions. The Advanced Solutions section focuses on more complex topics, such as developing custom connectors, creating custom visuals, and leveraging the AI Builder. The Professional Solutions section covers topics such as managing and deploying solutions, monitoring and troubleshooting, and optimizing performance.
The exam is designed to assess an individual’s ability to design, develop, and implement solutions that leverage the Power Platform. It is also intended to measure an individual’s understanding of the platform’s features and capabilities. The exam is offered in both English and Japanese, and is available in both online and in-person formats.
In order to pass the exam, individuals must demonstrate a comprehensive understanding of the Power Platform and its features. This includes knowledge of the platform’s components, its development environment, and its various solutions. Individuals must also demonstrate an understanding of the platform’s capabilities and be able to create and deploy solutions that leverage the platform’s features.
The PL-300 exam is an important step for individuals looking to expand their knowledge and skills in developing Microsoft Power Platform solutions. By passing the exam, individuals can demonstrate their expertise in the platform and prove their ability to create and deploy solutions that leverage the platform’s features.
Strategies for Preparing for the PL-300 Exam
Preparing for the PL-300 exam can be a daunting task, but with the right strategies, you can be confident that you’ll be ready to take the exam. The PL-300 exam is a Microsoft certification exam that tests your knowledge of the Azure platform. It is a challenging exam that requires you to have a thorough understanding of the Azure platform and its components.
The first step in preparing for the PL-300 exam is to become familiar with the exam objectives. Microsoft provides a list of exam objectives on their website that you should review. This will give you an idea of the topics that will be covered on the exam. Once you have a good understanding of the exam objectives, you can begin to focus your studies on the topics that are most relevant to the exam.
The next step is to create a study plan. You should set aside a specific amount of time each day to study for the exam. Make sure to break down your study plan into manageable chunks so that you don’t become overwhelmed. You should also consider using study aids such as practice tests and flashcards to help you retain the information you’re learning.
Another important step in preparing for the PL-300 exam is to gain hands-on experience with the Azure platform. You can do this by signing up for a free Azure trial or by using the Azure sandbox. This will allow you to get familiar with the Azure platform and its components. You can also use online tutorials and documentation to learn more about the Azure platform.
Finally, you should consider taking a practice exam. Taking a practice exam will help you get an idea of the types of questions that will be on the exam. It will also help you identify any areas where you need to focus your studies.
By following these strategies, you can be confident that you’ll be well-prepared for the PL-300 exam. With the right preparation, you can be sure that you’ll be ready to take the exam and earn your Microsoft certification.
Exam Content and Format
Exam Content and Format are two of the most important aspects of any exam. Exam Content refers to the material that is covered on the exam, while Exam Format refers to the way in which the exam is administered.
Exam Content is typically determined by the instructor or professor. It should include topics that are relevant to the course material and should be appropriate for the level of the course. For example, a basic introductory course may cover topics such as basic math, English, and history, while an advanced course may cover more complex topics such as calculus, chemistry, and economics. The instructor should provide a syllabus that outlines the topics that will be covered on the exam.
Exam Format is also determined by the instructor or professor. It should be designed to assess the student’s knowledge and understanding of the course material. The format of the exam can vary depending on the type of course. For example, a multiple-choice exam may be used for a basic course, while an essay exam may be used for an advanced course.
In addition to the content and format of the exam, the instructor should also provide instructions for taking the exam. This should include information about the time limit, the number of questions, and any other rules or guidelines that should be followed. It is important for students to read and understand the instructions before taking the exam.
Finally, the instructor should provide a grading system for the exam. This should include the criteria for grading the exam, as well as the criteria for passing the exam. It is important for students to understand the grading system before taking the exam, so that they can properly prepare for it.
Exam Content and Format are essential components of any exam. It is important for instructors to provide clear and concise instructions for taking the exam, as well as a grading system that is fair and consistent. By following these guidelines, students can ensure that they are adequately prepared for the exam and can maximize their chances of success.
PL-300
Tips for Maximizing Your PL-300 Exam Score
Maximizing your score on the PL-300 exam can be a daunting task, but with the right tips and strategies, you can ensure that you are well-prepared and ready to ace the exam. Here are some tips for maximizing your PL-300 exam score:
1. Understand the Exam Structure: Before taking the exam, make sure you understand the structure of the exam. Familiarize yourself with the types of questions, the time limits, and the overall format of the exam. This will help you better plan your approach to the exam and make sure you are well-prepared.
2. Study the Exam Content: The PL-300 exam covers a wide range of topics, so it is important to study the content thoroughly. Make sure you understand the key concepts and the different technologies covered in the exam.
3. Practice with Sample Questions: Practice makes perfect! Make sure you are familiar with the types of questions that will be asked on the exam by practicing with sample questions. This will help you become more comfortable with the exam format and the types of questions you will be asked.
4. Utilize Study Resources: Take advantage of the various study resources available for the PL-300 exam. These include practice tests, study guides, and online courses. These resources can help you better understand the material and prepare for the exam.
5. Manage Your Time: Time management is key when taking the PL-300 exam. Make sure you are aware of the time limits for each section and plan your approach accordingly. This will help you make sure you are able to answer all the questions within the allotted time.
By following these tips, you can ensure that you are well-prepared for the PL-300 exam and maximize your score. Good luck!
Preparing for the Microsoft PL-300 exam can be a daunting task. The exam is designed to test your knowledge and understanding of the Microsoft Power Platform, and it requires a comprehensive understanding of the platform and its components. Fortunately, there are a variety of resources available to help you prepare for the exam.
The Microsoft Learning website is a great place to start. It offers a variety of courses and materials to help you prepare for the exam. The Microsoft Power Platform Fundamentals course is a great place to start. It provides an overview of the Power Platform and its components, as well as an introduction to the concepts and terminology used in the exam. Additionally, the Microsoft Power Platform App Maker course provides an in-depth look at the App Maker feature of the Power Platform.
Another great resource is the Microsoft Power Platform Learning Path. This is a comprehensive guide to the Power Platform and its components. It includes detailed information on the different components of the platform, as well as step-by-step instructions for creating and managing Power Platform applications. Additionally, the Learning Path includes practice tests and sample questions to help you prepare for the exam.
The Microsoft Power Platform Community is also a great resource for exam preparation. The community is a great place to ask questions and get advice from experienced Power Platform users. Additionally, the community offers a variety of resources, such as tutorials, sample code, and best practices.
Finally, there are a variety of third-party resources available to help you prepare for the exam. Exam-Labs is a great resource for practice tests and sample questions. Additionally, Udemy offers a variety of courses and materials to help you prepare for the exam.
Overall, there are a variety of resources available to help you prepare for the Microsoft PL-300 exam. From the Microsoft Learning website to the Microsoft Power Platform Community, there are a variety of resources to help you gain a comprehensive understanding of the Power Platform and its components. Additionally, there are a variety of third-party resources available to help you prepare for the exam.
Conclusion
In conclusion, the PL-300 Exam is a challenging yet rewarding certification that requires comprehensive preparation. By following the tips and strategies outlined in this guide, you can be confident that you are well-prepared for the exam. With a thorough understanding of the exam objectives, a comprehensive study plan, and plenty of practice, you can increase your chances of success and achieve the certification you desire. | __label__pos | 0.679848 |
This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
Documentation / Mathematica / Built-in Functions / Graphics and Sound / Graphics Primitives /
SurfaceGraphics
FilledSmallSquare SurfaceGraphics[array] is a representation of a three-dimensional plot of a surface, with heights of each point on a grid specified by values in array.
FilledSmallSquare SurfaceGraphics[array, shades] represents a surface, whose parts are shaded according to the array shades.
FilledSmallSquare SurfaceGraphics can be displayed using Show.
FilledSmallSquare SurfaceGraphics has the same options as Graphics3D, with the following additions:
FilledSmallSquare SurfaceGraphics does not support the options PolygonIntersections and RenderAll available for Graphics3D.
FilledSmallSquare For SurfaceGraphics, the default setting for BoxRatios is BoxRatios -> {1, 1, 0.4}.
FilledSmallSquare array should be a rectangular array of real numbers, representing values. There will be holes in the surface corresponding to any array elements that are not real numbers.
FilledSmallSquare If array has dimensions , then shades must have dimensions .
FilledSmallSquare The elements of shades must be GrayLevel, Hue or RGBColor directives, or SurfaceColor objects.
FilledSmallSquare Graphics3D[SurfaceGraphics[ ... ]] can be used to convert a SurfaceGraphics object into the more general Graphics3D representation.
FilledSmallSquare SurfaceGraphics is generated by Plot3D and ListPlot3D.
FilledSmallSquare See Section 1.9.6, Section 2.10.1 and Section 2.10.11.
FilledSmallSquare See also: ListPlot3D, Plot3D, ContourGraphics, DensityGraphics.
FilledSmallSquare New in Version 1.
Further Examples | __label__pos | 0.585198 |
Building dynamic tools
Hello Kal_Lam,
Thank you for being very helpful to us starting to use Kobo collect.
is it possible to build tools like the attached images below. Kindly help.
Hello kal_Lam,
Am trying to input the grid theme format in kobo collect shown below and using the excel form. kindly help.
@KNIE, you could do it as outlined in this enketo blog.
Thank you for the recommendation. However it isn’t helpful I had looked at it before i sent the question but it doesn’t provide assistance i requested
@KNIE, could you also let the community know what is not working? Maybe that would help the community to assist you with the issue.
More than one question can appear in the 1 row without allocating each question a column.
@KNIE, where will you have the response if you try to put all the questions in one row? Wouldn’t it be difficult to capture the response for all of them?
I was having this idea of text questions which would be in the same cell separated by the line. some thing like I shared.
@KNIE, much clear now. Well, this format is not supported yet. Maybe you will need to compromise here.
I see okay. Thank you so much for your time. Also is it possible to make the checkbox where respondents put right numbers in a checkbox instead of ticks?
@KNIE, sorry! This too is not possible.
Alright, thank you
1 Like | __label__pos | 0.960601 |
How to install Searchanise on Magento 2
There are two ways to install the Searchanise extension in your Magento 2 store: using CLI or via Composer.
Before the installation, you may want to:
1. Back up your database.
2. Enable maintenance mode:
bin/magento maintenance:enable
Install the extension using CLI
Steps:
1. Download the Searchanise Smart Search Autocomplete extension’s archive from the Commerce Marketplace.
2. Extract the archive to the following folder: <magento2-dir>/app/code/Searchanise/SearchAutocomplete. By default, this folder is absent, so you need to create it first.
3. Execute the following command in the root Magento’s directory to register the extension:
1. For a default or development Magento mode:
php bin/magento setup:upgrade
2. For a production Magento mode::
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
4. Verify that the extension is installed correctly.
That’s it. The extension is installed.
Install the extension using Composer
Steps:
1. Get the Searchanise Smart Search Autocomplete extension from the Commerce Marketplace.
2. Create the auth.json file in your Magento project using the following command if it hasn’t been created yet:
cp auth.json.sample auth.json
3. Enter your authentication keys – replace <public-key> and <private-key> in the auth.json file.
4. Install the extension executing the following command:
composer require searchanise/search-autocomplete
5. Register the extension executing the following command:
1. For a default or development Magento mode:
php bin/magento setup:upgrade
2. For a production Magento mode:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
6. Verify that the extension is installed correctly.
That’s it. The extension is installed.
You can also follow the guidelines of Magento documentation, to install the extension this way.
Verify the extension
Steps:
1. To verify that the extension is installed correctly, run the following command:
bin/magento module:status
2. Look for the extension under “List of disabled modules”. If you’ve found it there, it is disabled. Enable it and clear static view files executing the following command:
bin/magento module:enable Searchanise_SearchAutocomplete --clear-static-content
That’s it. You can now configure and use the extension.
Enjoying your experience with Searchanise?
We’d appreciate it if you could take some time to leave a review.
Updated on March 10, 2022
Was this article helpful?
Related Articles
Need Support?
Can't find the answer you're looking for?
Contact Support
Back to top | __label__pos | 0.999038 |
Hive学习笔记(五)—— DML 数据操作
5.1 数据导入
5.1.1 向表中装载数据(Load)
1.语法
hive> load data [local] inpath ‘/opt/module/datas/student.txt’ [overwrite] | into table student
[partition (partcol1=val1,…)];
(1)load data:表示加载数据
(2)local:表示从本地加载数据到 hive 表;否则从 HDFS 加载数据到 hive 表 (3)inpath:表示加载数据的路径
(4)overwrite:表示覆盖表中已有数据,否则表示追加
(5)into table:表示加载到哪张表
(6)student:表示具体的表
(7)partition:表示上传到指定分区
2.实操案例
(0)创建一张表
hive (default)> create table student(id string, name string) row
format delimited fields terminated by '\t';
(1)加载本地文件到 hive
hive (default)> load data local inpath
'/opt/module/datas/student.txt' into table default.student;
(2)加载 HDFS 文件到 hive 中
上传文件到 HDFS
hive (default)> dfs -put /opt/module/datas/student.txt /user/atguigu/hive;
加载 HDFS 上数据
hive (default)> load data inpath '/user/atguigu/hive/student.txt' into table default.student;
(3)加载数据覆盖表中已有的数据
上传文件到 HDFS
hive (default)> dfs -put /opt/module/datas/student.txt /user/atguigu/hive;
加载数据覆盖表中已有的数据
hive (default)> load data inpath '/user/atguigu/hive/student.txt' overwrite into table default.student;
5.1.2 通过查询语句向表中插入数据(Insert)
1.创建一张分区表
hive (default)> create table student(id int, name string) partitioned by (month string) row format delimited fields terminated by '\t';
2.基本插入数据
hive (default)> insert into table student partition(month='201709') values(1,'wangwu');
3.基本模式插入(根据单张表查询结果)
hive (default)> insert overwrite table student partition(month='201708') select id, name from student where month='201709';
4.多插入模式(根据多张表查询结果)
hive (default)> from student insert overwrite table student partition(month='201707') select id, name where month='201709' insert overwrite table student partition(month='201706') select id, name where month='201709';
5.1.3 查询语句中创建表并加载数据(As Select)
详见 4.5.1 章创建表
根据查询结果创建表(查询的结果会添加到新创建的表中)
create table if not exists student3 as select id, name from student;
5.1.4 创建表时通过 Location 指定加载数据路径
1.创建表,并指定在 hdfs 上的位置
hive (default)> create table if not exists student5(
id int, name string
)
row format delimited fields terminated by '\t'
location '/user/hive/warehouse/student5';
2.上传数据到 hdfs 上
hive (default)> dfs -put /opt/module/datas/student.txt
/user/hive/warehouse/student5;
3.查询数据
hive (default)> select * from student5;
5.1.5 Import 数据到指定 Hive 表中
注意:先用 export 导出后,再将数据导入。
hive (default)> import table student2 partition(month='201709')
from '/user/hive/warehouse/export/student';
5.2 数据导出
5.2.1 Insert 导出
1.将查询的结果导出到本地
hive (default)> insert overwrite local directory
'/opt/module/datas/export/student'
select * from student;
2.将查询的结果格式化导出到本地
hive(default)>insert overwrite local directory
'/opt/module/datas/export/student1'
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
select * from student;
3.将查询的结果导出到 HDFS 上(没有 local)
hive (default)> insert overwrite directory
'/user/atguigu/student2'
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
select * from student;
5.2.2 Hadoop 命令导出到本地
hive (default)> dfs -get
/user/hive/warehouse/student/month=201709/000000_0
/opt/module/datas/export/student3.txt;
5.2.3 Hive Shell 命令导出
基本语法:(hive -f/-e 执行语句或者脚本 > file)
[atguigu@hadoop102 hive]$ bin/hive -e 'select * from
default.student;' > /opt/module/datas/export/student4.txt;
5.2.4 Export 导出到 HDFS 上
(defahiveult)> export table default.student to '/user/hive/warehouse/export/student';
5.2.5 Sqoop 导出
后续课程专门讲。
5.3 清除表中数据(Truncate)
注意
Truncate 只能删除管理表,不能删除外部表中数据
hive (default)> truncate table student;
©️2020 CSDN 皮肤主题: 黑客帝国 设计师:上身试试 返回首页 | __label__pos | 0.940475 |
Why R?
Open-source
R is open-source software, which means using it is completely free. Second, open-source software is developed collaboratively, meaning the source code is open to public inspection, modification, and improvement.
Popular
R is widely used in the physical and social sciences, as well as in government, non-profits, and the private sector.
Many developers and social scientists write programs in R. As a result, there is also a large support community available to help troubleshoot problematic code. As seen in the Redmonk programming language rankings (which compare languages’ appearances on Github [usage] and StackOverflow [support]), R appears near the top of both rankings.
Lack of point-and-click interface
R, like any computing language, relies on programmatic execution of functions. That is, to do anything you must write code. This differs from popular statistical software such as Stata or SPSS which at their core utilize a command language but overlay them with drop-down menus that enable a point-and-click interface. While much easier to operate, there are several downsides to this approach - mainly that it makes it impossible to reproduce one’s analysis.
Things R does well
• Data analysis - R was written by statisticians for statisticians, so it is designed first and foremost as a language for statistical and data analysis. Much of the cutting-edge research in machine learning occurs in R, and every week there are packages added to CRAN implementing these new methods. Furthermore, many models in R can be exported to other programming languages such as C, C++, Python, tensorflow, stan, etc.
• Data visualization - while the base R graphics package is comprehensive and powerful, additional libraries such as ggplot2 and lattice make R the go-to language for power data visualization approaches.
Things R does not do as well
• Speed - while by no means a slug, R is not written to be a fast, speedy language. Depending on the complexity of the task and the size of your data, you may find R taking a long time to execute your program.
Why are we not using Python?
Python was developed in the 1990s as a general-purpose programming language. It emphasizes simplicity over complexity in both its syntax and core functions. As a result, code written in Python is (relatively) easy to read and follow as compared to more complex languages like Perl or Java. As you can see in the above references, Python is just as, if not more, popular than R. It does many things well, like R, but is perhaps better in some aspects:
• General computation - since Python is a general computational language, it is more versatile at non-statistical tasks and is a bit more popular outside the statistics community.
• Speed - because it is a general computing language, Python is optimized to be fast (assuming you write your code optimally). As your data becomes larger or more complex, you might find Python to be faster than R for your analytical needs.
• Workflow - since Python is a general-purpose language, you can build entire applications using it. R, not so much.
That said, there are also things it does not do as well as R:
• Visualizations - visual graphics libraries in Python are increasing in number and quality (see matplotlib, pygal, and seaborn), but are still behind R in terms of comprehensiveness and ease of use. Of course, once you wish to create interactive and advanced information visualizations, you can also used more specialized software such as Tableau or D3.
• Add-on libraries - previously Python was criticized for its lack of libraries to perform statistical analysis and data manipulation, especially relative to the plethora of libraries for R. In recent years Python has begun to catch up with libraries for scientific computing (numpy), data analysis (pandas), and machine learning (scikit-learn). However I personally have found immense difficulty installing and managing packages in Python, even with the use of a package manager such as conda.
At the end of the day, I don’t think it is a debate between learning R vs. Python. Frankly to be a desirable (and therefore highly-compensated) data scientist you should learn both languages. R and Python complement each other, and even R/Python luminaries such as Hadley Wickham and Wes McKinney promote the benefits of both languages:
This course could be taught exclusively in Python (as it was in previous incarnations) or a combination of R and Python (as it was in fall 2016). From my past experience, I think the best introduction to computer programming focuses on a single language. Learning two languages simultaneously is extremely difficult. It is better to stick with a single language and syntax. My language of preference is R, so that is what I teach here. Once you complete this course, you will have the basic skills necessary to learn Python on your own.
Acknowledgements | __label__pos | 0.879422 |
Science Quiz / Make a Fraction from a Rational Decimal
Random Science or Math Quiz
QUIZ: Can you name the answers to these math questions and learn how to make a fraction from any rational decimal?
Quiz not verified by Sporcle
How to PlayForced Order No Skip
Challenge
Share
Tweet
Embed
Score 0/39 Timer 10:00
Super Easy?
[You have 0.7]
Which place is the 7 in?
So write seven of those as a fraction.
You did it!
Now type 'next.'
[You have 0.72]
Which place is the 2 in?
So write seventy two of those as a fraction.
Now reduce.
You did it!
Now type 'next.'
Easy?
[You have 0.444...]
Which place is the first 4 in?
Subtract a oneths from that place. What do you get?
So write four of those as a fraction.
You did it!
Now type 'next.'
[You have 0.666...]
Which place is the first 6 in?
Subtract a oneths from that place. What do you get?
So write six of those as a fraction.
Now reduce.
You did it!
Now type 'next.'
Medium?
[You have 0.171717...]
Which place is the first 7 in?
Subtract a oneths from that place. What do you get?
So write seventeen of those as a fraction.
You did it!
Now type 'next.'
[You have 0.603603...]
Which place is the first 3 in?
Subtract a oneths from that place. What do you get?
So write six hundred three of those as a fraction.
Now reduce.
You did it!
Now type 'next.'
Hard?
[You have 0.3414141...]
Which place is the first 1 in?
What place is the non-repeating digit in?
What is your first answer minus your second answer?
So write forty-one of those as a fraction.
(...but wait, what place was the non-repeating digit in again?)
So write three of those as a fraction.
(...and now we have to add those two fractions together, so what is their lowest common mulitple?)
By how many times do you have to mulitply 10 to get that?
So what is three times that number?
So what is that number plus forty-one?
So put that number over the answer to the 3rd question.
Now reduce.
You did it!
Now type
'challenge me, already!'
Super Hard!?
[You have 5.73249249249...]
Write this as a fraction.
You're not logged in!
Compare scores with friends on all Sporcle quizzes.
Sign Up with Email
OR
Log In
You Might Also Like...
Show Comments
Extras
Top Quizzes Today
Score Distribution
Your Account Isn't Verified!
In order to create a playlist on Sporcle, you need to verify the email address you used during registration. Go to your Sporcle Settings to finish the process. | __label__pos | 0.919955 |
Cloud customer?
Upgrade in MyJFrog >
Search
Overview
This page describes the methods and procedures for triggering an automatic or manual run of a pipeline.
When creating an automated pipeline, you should define your steps so they will execute in an interdependent sequence. This means that each step is configured so that its execution will be triggered by the successful completion of a prior, prerequisite step (or steps). In this way, step 1's completion will trigger the execution of step 2, completion of step 2 triggers execution of step 3, and so on until all steps in the pipeline are executed.
Trigger a Run Automatically
In most cases, you will want your pipeline to initiate execution automatically as the result of some external event that causes a resource to change. This is configured by defining a step's inputResources.
For example, you are likely to want to trigger a run whenever there is a new commit into a source code repository.
To set your source code repo as the pipeline trigger:
1. If you haven't already, add a GitHub integration (or other source control system type) to JFrog Pipelines.
2. In your resources definitions of your pipeline config, define a gitrepo resource type for the project repository, with a descriptive name (for example, "myprojectrepo").
3. In the definition of the first step of your pipeline, specify the gitrepo resource in inputResources. For extra clarity, you can also specify trigger as true (even though that is the default). For example:
inputResources:
- name:
myprojectrepo
trigger: true
When triggering runs through a GitRepo resource, adding [skipRun] to a commit message won't trigger anything when that commit is pushed to the source provider.
Page Contents
When the completed pipeline is viewed, the gitrepo resource is shown as a triggering input into the step.
Other example events might be a change to an Image resource, or receipt through a Webhook.
Triggering a Run Manually
You can trigger a run of any step through the pipeline visualization. To manually run the entire pipeline, trigger the first step in the workflow.
With default configuration
To manually trigger a step:
1. Click on the step. This will display the information box for that step.
2. In the step's information box, click the "Trigger this step" button.
The step will execute, and its successful completion will trigger the subsequent steps of the pipeline. The record of the run is logged in the pipeline history.
With custom configuration
You can trigger a run of any step and provide a set of custom settings to test a specific set of conditions.
To manually trigger a step with custom settings:
1. Click on the step. This will display the information box for that step.
2. In the step's information box, click the "Trigger this step with custom configuration" button.
3. In the resulting Run with custom configuration dialog, you can override the configuration settings, then click Confirm.
The step will execute with the custom settings, and its successful completion will trigger the subsequent steps of the pipeline. The record of the run is logged in the pipeline history.
Viewing Step Execution
You can view the shell commands issued as the step is executing.
To view real-time execution of a step:
1. Trigger the step to execute.
2. While the step executes, click on the step. This will display the information box for that step.
3. In the information box, click "View Logs".
4. This will call up the step log view, where you can see the shell commands issued by the step as they are executed.
Cancelling a Run
You can cancel execution of a run in progress by cancelling execution of a step.
To cancel a step:
1. While the step executes, click on the step. This will display the information box for that step.
2. In the information box, click the "Cancel This Step" button.
The step will cancel execution, and subsequent dependent steps of the pipeline will be skipped. The record of the run is logged in the pipeline history.
Copyright © 2021 JFrog Ltd. | __label__pos | 0.994563 |
in Combinatory retagged by
4,639 views
32 votes
32 votes
In a tournament with $7$ teams, each team plays one match with every other team. For each match, the team earns two points if it wins, one point if it ties, and no points if it loses. At the end of all matches, the teams are ordered in the descending order of their total points (the order among the teams with the same total are determined by a whimsical tournament referee). The first three teams in this ordering are then chosen to play in the next round. What is the minimum total number of points a team must earn in order to be guaranteed a place in the next round?
1. $13$
2. $12$
3. $11$
4. $10$
5. $9$
in Combinatory retagged by
4.6k views
2 Comments
I think possible with 9 only.
0
0
no 9 will not guarantee!!!
1
1
5 Answers
1 vote
1 vote
lets first try with n=9 ( our tarhet is to get only top three teams get 9 points . If more than three teams will get 9 points then choosing top three will also depend upon referee )
A wins over D,E,F,G and ties with B so total 9 points
B wins over D,E,F,G and ties with A so total 9 points ( if A ties with B then B also ties with A)
now try for C to getting 9 points so first three(A,B,C) will qualify for next round
C ties with D (1 point) , wins over E,F,G( 6 points ) , no other possibilities for C
hence with 9 points we cant choose top three teams guarantely.
Now n=10
A wins over D,E,F,G and ties with B,C so total 10 points
B wins over D,E,F,G and ties with A,C so total 10 points
C wins over D,E,F,G and ties with B,A so total 10 points
for others ( D,E,F,G) we cant get 10 points
Hence 10 is the minimum total number of points a team must earn in order to be guaranteed a place in the next round.
ANS is D
Answer:
Related questions | __label__pos | 0.695157 |
HomeGuidesReferenceLearn
Errors and warnings
Learn about Redbox errors and stack traces in your Expo project.
When developing an application using Expo, you'll encounter a Redbox error or Yellowbox warning. These logging experiences are provided by LogBox in React Native.
Redbox error and Yellowbox warning
A Redbox error is displayed when a fatal error prevents your app from running. A Yellowbox warning is displayed to inform you that there is a possible issue and you should probably resolve it before shipping your app.
You can also create warnings and errors on your own with console.warn("Warning message") and console.error("Error message"). Another way to trigger the redbox is to throw an error and not catch it: throw Error("Error message").
This is a brief introduction to debugging a React Native app with Expo CLI. For in-depth information, see Debugging.
Stack traces
When you encounter an error during development, you'll see the error message and a stack trace, which is a report of the recent calls your application made when it crashed. This stack trace is shown both in your terminal and the Expo Go app or if you have created a development build.
This stack trace is extremely valuable since it gives you the location of the error's occurrence. For example, in the following image, the error comes from the file HomeScreen.js and is caused on line 7 in that file.
An example of a stack trace in a React Native app.
When you look at that file, on line 7, you will see that a variable called renderDescription is referenced. The error message describes that the variable is not found because the variable is not declared in HomeScreen.js. This is a typical example of how helpful error messages and stack traces can be if you take the time to decipher them.
Debugging errors is one of the most frustrating but satisfying parts of development. Remember that you're never alone. The Expo community and the React and React Native communities are great resources for help when you get stuck. There's a good chance someone else has run into your exact error. Make sure to read the documentation, search the forums, GitHub issues, and Stack Overflow. | __label__pos | 0.582254 |
Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
I have a horizontal collectionview with code to highlight/color the cell selected. It highlights the cell that was selected, but then every 5 cells after also get highlighted. Any idea what is going on?
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
for(int x = 0; x < [cellArray count]; x++){
UICollectionViewCell *UnSelectedCell = [cellArray objectAtIndex:x];
UnSelectedCell.backgroundColor = [UIColor colorWithRed:0.2 green:0.5 blue:0.8 alpha:0.0];
}
UICollectionViewCell *SelectedCell = [cellArray objectAtIndex:indexPath.row];
SelectedCell.backgroundColor = [UIColor colorWithRed:0.2 green:0.5 blue:0.8 alpha:1.0];
cellSelected = indexPath.row;
NSLog(@"%i", cellSelected);
}
share|improve this question
2 Answers 2
up vote 5 down vote accepted
That happens because cells are reused when you scroll. You have to store the "highlighted" status for all rows in your model (for example in an array or NSMutableIndexSet), and in collectionView:cellForItemAtIndexPath: set the background color of the cell according to the status for that row.
In didSelectItemAtIndexPath it should be sufficient to set the color of the newly selected and the previously selected cell.
Update: If only one cell can be selected at a time, you just have to remember the index path of the selected cell.
Declare a property selectedIndexPath for the currently highlighted row:
@property (strong, nonatomic) NSIndexPath *selectedIndexPath;
In didSelectItemAtIndexPath, unhighlight the previous cell, and highlight the new cell:
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
if (self.selectedIndexPath != nil) {
// deselect previously selected cell
UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:self.selectedIndexPath];
if (cell != nil) {
// set default color for cell
}
}
// Select newly selected cell:
UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
if (cell != nil) {
// set highlight color for cell
}
// Remember selection:
self.selectedIndexPath = indexPath;
}
In cellForItemAtIndexPath, use the correct background color:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Identifier" forIndexPath:indexPath];
if ([self.selectedIndexPath isEqual:indexPath) {
// set highlight color
} else {
// set default color
}
}
share|improve this answer
I get that it happens because of reusable cells, but I kind of lost you after. How should I store the highlighted status? In didSelectItemAtIndexPath? Also, what do you mean in your last sentence? – Spenciefy Nov 9 '13 at 18:25
@Spenciefy: Each time collectionView:cellForItemAtIndexPath: is called, you have to set the correct background color for the cell. Therefore you have to "remember" the status for all rows. That's what I meant with storing the status in an array or index set. – Martin R Nov 9 '13 at 18:26
I see. So how do I assign selected or unselected in a indexset? – Spenciefy Nov 9 '13 at 18:28
@Spenciefy: It seems that in didSelectItemAtIndexPath you set the color for all cells (visible or invisible). That looks superfluous to me, because only two cells change their state. – Martin R Nov 9 '13 at 18:28
Sorry, I'm confused on how to use nsmutableindexset. Can you give a quick example? – Spenciefy Nov 9 '13 at 18:32
I think you use reusable cell for collection - there is the point. You shell to set default background color before reuse cell.
share|improve this answer
How would I set the default before the reuse cell; I highlight the cell when it is selected. – Spenciefy Nov 9 '13 at 18:33
Your Answer
discard
By posting your answer, you agree to the privacy policy and terms of service.
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.652449 |
What Are the Functions of a Microprocessor?
Techwalla may earn compensation through affiliate links in this story.
Microprocessor on a circuit board.
Image Credit: Viper161288/iStock/Getty Images
A microprocessor controls all functions of the CPU, or central processing unit, of a computer or other digital device. The microprocessor functions as an artificial brain. The entire function of the CPU is controlled by a single integrated circuit. The microprocessor is programmed to give and receive instructions from other components of the device. The system can control everything from small devices such as calculators and mobile phones, to large automobiles.
Advertisement
History
Three companies--Intel, Texas Instruments and Garrett Air Research--developed microprocessors around the same period. Intel's 4004 microprocessor is generally accepted to be the first microprocessor. The product was unveiled by the company in 1971. The microprocessor came about in 1969 when a Japanese calculator company called Busicom required the development of a small circuit to control the calculators made by them.
Video of the Day
Features
Microprocessors work based on digital logic. The three components that form the main features of the microprocessor are a set of digital instructions, a certain bandwidth and clock speed that measures the number of instructions that a microprocessor can execute. A series of digital machine instructions are received by the microprocessor. The ALU, or arithmetic logic unit, of the processor does a series of calculations based on the instructions received. Additionally, the unit moves data from one memory to another and has the capacity to jump from one set of instructions to another.
Advertisement
Function
The microprocessor functions through two memories. The read only memory, or ROM, is a program with a fixed set of instructions and is programmed with a fixed set of bytes. The other memory is the RAM, or random access, memory. The number of bytes in this memory is variable and lasts for a short term. If power is switched off the RAM is wiped out. The ROM has a small program within it called the BIOS, or the basic input output system. The BIOS tests the hardware on the machine when it starts up. It then fetches another program in the ROM called the boot sector. This boot sector program executes a series of instructions that helps to utilize the computer effectively.
Advertisement
Considerations
Computers are not merely data processors. Microprocessors should be able to execute instructions in data, audio and video formats. They should support a range of multimedia effects. A 32-bit microprocessor is essential to support multimedia software. With the advent of the internet, microprocessors should have the capacity to support virtual memory and physical memory. They should be able to work with DSP or digital signal processors to handle audio video and playback formats. Fast microprocessors do not require a DSP.
Advertisement
Potential
In this the digital age, there are very few gadgets that do not contain a microprocessor. Advancements in medicine, weather forecasting, automobiles, communications, design and scientific experiments were the results of the development of digital gadgets with microprocessors. Automation for difficult manual jobs is possible because of the microprocessor. The digital logic of microprocessors has led to greater efficiency and speed in all aspects of life. The potential of microprocessor use is therefore immense. Microprocessors ensure lighter, hand-held machinery, imaging and communication systems that have and will improve lifestyles on a global scale.
Advertisement
references | __label__pos | 0.890511 |
Search Images Maps Play YouTube News Gmail Drive More »
Sign in
Screen reader users: click this link for accessible mode. Accessible mode has the same essential features but works better with your reader.
Patents
1. Advanced Patent Search
Publication numberUS6681239 B1
Publication typeGrant
Application numberUS 08/771,550
Publication dateJan 20, 2004
Filing dateDec 23, 1996
Priority dateDec 23, 1996
Fee statusPaid
Publication number08771550, 771550, US 6681239 B1, US 6681239B1, US-B1-6681239, US6681239 B1, US6681239B1
InventorsSteven Jay Munroe, Scott Alan Plaetzer, James William Stopyro
Original AssigneeInternational Business Machines Corporation
Export CitationBiBTeX, EndNote, RefMan
External Links: USPTO, USPTO Assignment, Espacenet
Computer system having shared address space among multiple virtual address spaces
US 6681239 B1
Abstract
A multi-tasking computer operating system allocates a respective virtual address space to each task. A portion of virtual address space is reserved as a shared address space (SAS) region, the SAS region occupying the same range of virtual addresses in the virtual address space of each task. Certain classes of data intended for sharing among multiple tasks are assigned unique and persistent addresses in the range of the shared address space region. Preferably, certain facilities are added to a conventional base operating system to support the SAS region and associated function. These include a join facility for initiating a task to the SAS region, an attach facility for attaching blocks of memory within the SAS region, and a paging facility for retrieving a page within the SAS region from storage. In this manner, it is possible for a multi-tasking multiple virtual address space computer system to assume the advantages of a single level store computer system when performing certain tasks.
Images(21)
Previous page
Next page
Claims(31)
What is claimed is:
1. A computer system, comprising:
a processor;
a memory;
an operating system for supporting concurrent execution of a plurality of tasks on said computer system, said operating system comprising a plurality of instructions executable on said processor, said plurality of instructions maintaining a plurality of data structures supporting operating system functions performed by said plurality of instructions executing on said processor;
wherein said operating system allocates a plurality of overlapping task virtual address spaces, each task virtual address space being allocated to a respective task;
wherein said operating system allocates, within a plurality of said task virtual address spaces, a shared address space region, said shared address space region occupying the same virtual address range within each respective task virtual address space, said shared address space region being less than the entire task virtual address space; and
wherein said operating system allocates, within said virtual address range occupied by said shared address space region, a plurality address ranges assigned to respective addressable entities, each respective one of said range of addresses being uniquely and persistently assigned to its respective addressable entity, and wherein the virtual address range of an addressable entity shared by two or more tasks resides at the same address within each task's shared address space region.
2. The computer system of claim 1, wherein said processor defines a processor address space, and wherein each respective task virtual address space includes the full range of addresses in the processor address space.
3. The computer system of claim 1, wherein said operating system selectively allocates, with respect to each task, said shared address space region within the virtual address space of the respective task, said data structures including at least one data structure which records whether said shared address space region has been allocated within the virtual address space of a task.
4. The computer system of claim 1, wherein said operating system comprises:
a base operating system portion, said base operating system portion including instructions supporting concurrent execution of a plurality of tasks and concurrent allocation of a plurality of overlapping task virtual address spaces; and
a shared address space server portion, said shared address space server portion including instructions supporting said shared address space region, said shared address space server portion responding to calls from said base operating system portion.
5. The computer system of claim 1, wherein said operating system further allocates discrete blocks of virtual address space within said shared address space region, said data structures including at least one data structure which records blocks allocated within said shared address space region.
6. The computer system of claim 5,
wherein said at least one data structure which records blocks allocated within said shared address space region further associates access control information with each respective block allocated within said shared address space region, said access control information including whether a task is authorized to access the respective block; and
wherein said operating system grants a task access to a block within said shared address space region based on the access control information associated with said block.
7. The computer system of claim 6, wherein said access control information associated with each respective block comprises an access control list associated with each respective block.
8. The computer system of claim 5, wherein said operating system further allocates physical storage to selective portions of virtual address space within a block, said data structures including at least one data structure which records physical storage allocated within the virtual address space of a block.
9. A method of operating a multi-tasking computer system, said multi-tasking computer system concurrently executing a plurality of tasks, said method comprising the steps of:
defining a plurality of overlapping virtual address space mappings, each mapping being associated with a respective task executing on said multi-tasking computer system;
designating a fixed portion of a plurality of said virtual address space mappings as a shared address region, said fixed portion being less than the entire virtual address space, said shared address region occupying the same range of virtual addresses in each respective virtual address space mapping;
assigning to each of a first set of addressable entities in said computer system a respective range of addresses in said shared address region, each range of addresses assigned to an addressable entity being uniquely and persistently assigned to the entity, wherein the address range of an addressable entity shared by two or more tasks resides at the same address within each task's shared address space region; and
assigning to each of a second set of addressable entities in said computer system at least one respective range of addresses, each respective range of addresses being in a respective virtual address space mapping, said ranges lying outside said shared address region.
10. The method of claim 9, wherein said multi-tasking computer system inherently designates a fixed portion of each virtual address space mapping associated with a task as a shared address region.
11. The method of claim 9, wherein said step of designating a fixed portion of a plurality of said virtual address space mappings as a shared address region selectively designates, with respect to each task, a fixed portion of the respective virtual address space mapping of the task as a shared address region.
12. The method of claim 11, wherein said step of designating a fixed portion of a plurality of said virtual address space mappings as a shared address region comprises:
receiving requests from a plurality of tasks to designate a fixed portion of the respective virtual address space mapping of each requesting task as a shared address region; and
designating a fixed portion of the respective virtual address space mapping of each requesting task as a shared address region, in response to said requests.
13. The method of claim 9, wherein said computer system includes at least one processor defining a virtual address space, and said step of defining a plurality of overlapping virtual address space mappings comprises defining, for each task, a respective virtual address space mapping which includes the full range of addresses in the processor address space.
14. The method of claim 9, wherein said step of assigning to each of a first set of addressable entities in said computer system a respective range of addresses in said shared address region comprises:
allocating discrete blocks of virtual address space within said shared address space region; and
recording, in at least one data structure of said computer system, blocks allocated within said shared address space region.
15. The method of claim 14, further comprising the steps of:
associating access control information with each respective block allocated within said shared address space region, said access control information including whether a task is authorized to access the respective block; and
granting a task access to a block within said shared address space region based on the access control information associated with said block.
16. A computer operating system program product for supporting concurrent execution of a plurality of tasks on a computer system, said computer operating system program product comprising:
a plurality of instructions executable on a processor of said computer system and recorded on a computer readable medium;
wherein said plurality of instructions when executed on said processor maintain a plurality of data structures supporting operating system functions performed by said plurality of instructions executing on said processor;
wherein said plurality of instructions when executed on said processor allocate a plurality of overlapping task virtual address spaces, each task virtual address space being allocated to a respective task;
wherein said plurality of instructions when executed on said processor allocate, within a plurality of said task virtual address spaces, a shared address space region, said shared address space region occupying the same virtual address range within each respective task virtual address space, said shared address space region being less than the entire task virtual address space; and
wherein said plurality of instructions when executed on said processor allocate, within said virtual address range occupied by said shared address space region, a plurality address ranges assigned to respective addressable entities, each respective one of said range of addresses being uniquely and persistently assigned to its respective addressable entity, and wherein the virtual address range of an addressable entity shared by two or more tasks resides at the same address within each task's shared address space region.
17. The computer operating system program product of claim 16, wherein said plurality of instructions when executed on said processor selectively allocates, with respect to each task, said shared address space region within the virtual address space of the respective task, said data structures including at least one data structure which records whether said shared address space region has been allocated within the virtual address space of a task.
18. The computer operating system program product of claim 16, wherein said computer operating system comprises:
a base operating system portion, said base operating system portion including instructions supporting concurrent execution of a plurality of tasks and concurrent allocation of a plurality of overlapping task virtual address spaces; and
a shared address space server portion, said shared address space server portion including instructions supporting said shared address space region, said shared address space server portion responding to calls from said base operating system portion.
19. The computer operating system program product of claim 16, wherein said plurality of instructions when executed on said processor further allocate discrete blocks of virtual address space within said shared address space region, said data structures including at least one data structure which records blocks allocated within said shared address space region.
20. The computer operating system program product of claim 19,
wherein said at least one data structure which records blocks allocated within said shared address space region further associates access control information with each respective block allocated within said shared address space region, said access control information including whether a task is authorized to access the respective block; and
wherein said plurality of instructions when executed on said processor grant a task access to a block within said shared address space region based on the access control information associated with said block.
21. The computer operating system program product of claim 20, wherein said access control information associated with each respective block comprises an access control list associated with each respective block.
22. The computer operating system program product of claim 19, wherein said plurality of instructions further allocate physical storage to selective portions of virtual address space within a block, said data structures including at least one data structure which records physical storage allocated within the virtual address space of a block.
23. A shared address space server program product for a base computer operating system, said base computer operating system supporting concurrent execution of a plurality of tasks on a computer system and allocating a plurality of overlapping task virtual address spaces, each task virtual address space being allocated to a respective task, said shared address space server program product comprising:
a plurality of instructions executable on a processor of said computer system and recorded on a computer readable medium;
wherein said plurality of instructions when executed on said processor respond to calls from said base operating system;
wherein said plurality of instructions when executed on said processor allocate, within a plurality of said task virtual address spaces, a shared address space region, said shared address space region occupying the same virtual address range within each respective task virtual address space, said shared address space region being less than the entire task virtual address space; and
wherein said plurality of instructions when executed on said processor allocate, within said virtual address range occupied by said shared address space region, a plurality address ranges assigned to respective addressable entities, each respective one of said range of addresses being uniquely and persistently assigned to its respective addressable entity, and wherein the virtual address range of an addressable entity shared by two or more tasks resides at the same address within each task's shared address space region.
24. The shared address space server program product of claim 23,
wherein said plurality of instructions when executed on said processor selectively allocates, with respect to each task, said shared address space region within the virtual address space of the respective task; and
wherein said plurality of instructions when executed on said processor maintain at least one data structure supporting functions performed by said plurality of instructions executing on said processor said at least one data structure including at least one data structure which records whether said shared address space region has been allocated within the virtual address space of a task.
25. The shared address space server program product of claim 23,
wherein said plurality of instructions when executed on said processor further allocate discrete blocks of virtual address space within said shared address space region; and
wherein said plurality of instructions when executed on said processor maintain at least one data structure supporting functions performed by said plurality of instructions executing on said processor, said at least one data structure including at least one data structure which records blocks allocated within said shared address space region.
26. The shared address space server program product of claim 25, wherein said plurality of instructions further allocate physical storage to selective portions of virtual address space within a block, said at least one data structure including at least one data structure which records physical storage allocated within the virtual address space of a block.
27. A multi-tasking computer system having a processor defining a processor address space, said multi-tasking computer system comprising:
means for supporting concurrent execution of a plurality of tasks on said computer system;
means for concurrently allocating a plurality of overlapping task virtual address spaces, each task virtual address space being contained within said processor address space, and each task virtual address space being allocated to a respective task;
means for allocating, within a plurality of said task virtual address spaces, a shared address space region, said shared address space region occupying the same virtual address range within each respective task virtual address space, said shared address space region being less than the entire task virtual address space; and
means for persistently and uniquely assigning address ranges to addressable entities within said shared address space region, wherein the virtual address range of an addressable entity shared by two or more tasks resides at the same address within each task's shared address space region.
28. The computer system of claim 27, further comprising:
means for selectively determining, with respect to each of a plurality of tasks, whether said shared address space region will be allocated within the respective task virtual address space of the task;
wherein said means for allocating a shared address space region allocates said region in response to said means for selectively determining whether said shared address space region will be allocated.
29. The computer system of claim 27, wherein said operating system further comprises:
means for allocating discrete blocks of virtual address space within said shared address space region.
30. The computer system of claim 29, wherein said operating system further comprises:
means for associating access control information with each respective block of virtual address space, said access control information including whether a task is authorized to access the respective block;
means for determining whether a task is authorized to access a block based on the access control information associated with said block; and
means, responsive to said means for determining whether a task is authorized to access a block, for granting a task access to a block only if said task is authorized to access said block.
31. The computer system of claim 30, wherein said access control information associated with each respective block comprises an access control list associated with each respective block.
Description
FIELD OF THE INVENTION
The present invention relates to digital computer systems, and in particular computer operating systems which support multiple simultaneous tasks.
BACKGROUND OF THE INVENTION
A modem computer system typically comprises a central processing unit (CPU), and other supporting hardware such as system memory, communications busses, input/output controllers, storage devices, etc. The CPU is the heart of the system. It executes the instructions which comprise a computer program and directs the operation of the other system components. Typically, the instructions which execute on the CPU may be part of the computer's operating system, or may be part of an application program which performs some particular work for a user.
The operating system may be thought of as that part of the programming code executing on the computer, which regulates the computer's function, while the application programs perform specific work on behalf of a user. Operating systems vary considerably in complexity and function. A very simple operating system for a single-user computer may handle only a single task at a time, mapping all data into a single address space, and swapping data into and out of the address space whenever a new task must be performed. An operating system for a computer which supports multiple simultaneous users must manage the allocation of system resources among the different users. In particular, it must manage the allocation of address space and system memory.
The address space of the system is the range of addresses available to reference data, instructions, etc., and is determined by the size (bit length) of the address. Usually, the address space is significantly larger than the number of actual physical memory locations available on the system. The address size is one of the fundamental architectural features of the computer system. All other things being equal, a larger address size is naturally desirable from the standpoint of capacity of the system to do work. However, the address size entails significant hardware cost. The size of buses, registers, and logic units throughout the system is intimately tied to the address size.
In the early days of computers, hardware was a relatively expensive commodity. Many early systems used 16-bit or smaller addresses. Usually, the amount of data contained in these systems exceeded the size of the address space. An individual program might fit well within the address space, but a user might have many programs to execute on the system. Additionally, multi-user systems required space for each user.
The earliest systems executed only a single application at a time. Typically, storage became hierarchical. Although the total number of addresses exceeded the address space available in main memory, address space could be re-used. Data (including programs) were normally stored in a large secondary storage on disk, drum, tape or other secondary storage devices. When a particular application was needed, it was loaded into main memory and addresses were mapped into the address space of main memory. When no longer needed, it was deleted from main memory but retained in secondary storage. The address space was then re-used. If the same application was needed again, it could be loaded again into main memory.
As computers became more sophisticated, it became common for computer systems to execute multiple tasks concurrently. Operating systems designed for such computer systems were required to manage operations within the available address space of the computer. Since the addresses needed typically exceeded the address space available in the processor's hardware, this was done by allocating a separate address space to each task, resulting in multiple virtual address spaces. Typically, the task's virtual address space was the same size as the address space of the computer's processor.
This multiple virtual address space approach necessarily meant that different bytes of data might have the same virtual address, although they would be in the virtual address spaces of different tasks. When a task was loaded into main memory from secondary storage, a mapping mechanism mapped virtual addresses in the virtual address space of the task to physical addresses in the main memory of the computer system. This increased the complexity of the operating system, but was necessary to cope with the limited size of the system's address space.
As an alternative to the multiple virtual address space architecture, it possible to utilize a single very large system address space, one which is sufficiently large that it is not necessary to have multiple overlapping virtual address spaces, one for each task. Each task has its own discrete portion of the large system address space. One major impediment to this alternative architecture is that is requires a very large system address space, and consequently requires additional hardware to support it. When hardware was very expensive, this alternative appeared unattractive. For that reason, most multi-tasking systems have utilized the multiple virtual address space approach.
With the alternative single large address space approach, programs and other data stored in a computer system can be assigned persistent, unique logical addresses in the large system address space. Because these logical addresses are not duplicated, they can be used to identify data either in main memory or in secondary memory. For this reason, this alternative is sometimes referred to as a single level storage architecture. Examples of such an alternative architecture are the IBM System/38 computer system (formerly manufactured and distributed by IBM Corporation), its successor, the IBM AS/400 System (currently manufactured and distributed by IBM Corporation), and the Opal system at the University of Washington. For additional background concerning the IBM System/38 and IBM AS/400 System, see IBM System/38 Technical Developments (International Business Machines Corporation, 1978), IBM Application System/400 Technology (International Business Machines Corporation, 1988), and IBM Application System/400 Technology Journal, Version 2 (International Business Machines Corporation, 1992). The Opal system is described in a series of academic papers, including J. Chase, et al., “Opal: A Single Address Space System for 64-bit Architectures”, Proc. IEEE Workshop on Workstation Operating Systems (April, 1992).
When compared with the more traditional multiple virtual address space approach, the single level storage architecture offers certain advantages. These advantages are particularly applicable to object oriented programming applications. The object oriented (OO) programming paradigm anticipates that a large number of small code segments will have internal references (pointers) to one another, that these segments may be owned by different users, that during execution of a task, flow of control may jump frequently from one segment to another, and that different tasks executing on behalf of different users will often execute the same code segment.
Where a system uses multiple virtual address spaces, the pointers to different code segments will reference code in the virtual address space of another task or user. Resolution of these pointers becomes difficult. Because multiple overlapping virtual address spaces exist, it is possible that different code segments will share the same virtual address, but in the address space of different tasks or users. It is also possible that the executing task will have assigned the virtual address to some other data. Therefore, it is not possible to directly reference data or code in a segment belonging to a different task or user in the same manner an executing task would use a pointer to its own code in its own virtual address space. There must be a mechanism for resolving the various pointers so that the correct code segment is referenced.
Such mechanisms for resolving pointers in a multiple virtual address space system are possible, but they are awkward and tend to impose a burden on system performance. On the other hand, a single level store architecture can cope with such pointers more easily. Because each code or other data segment will have its own logical address in the single large system address space, there is no need for a mapping mechanism when referencing another code or data segment, even where that code or data is controlled by another task or user. It may be necessary to have a mechanism for verifying access rights, but the pointer addresses themselves do not need to be re-mapped for each new task. This is a substantial advantage where many pointers are used to point to code or other data segments of different tasks or users, and task execution can flow unpredictably from one to another.
Recently, there has been a significant interest in the object-oriented (OO) programming paradigm. The number of OO applications available is rapidly mushrooming. Object-oriented applications are not the only ones which may have pointers referencing code or other data controlled by different users. But OO application rely heavily on these types of operations. As object-oriented applications become more common, the burden of resolving pointers in a multiple virtual address space environment increases.
Another development in the evolution of the computer industry has been the relative decline in hardware costs. Historically, the size of addresses has grown as hardware costs have declined. The earlier 16-bit address based systems have largely been supplanted by 32-bit system. More recently, several commodity processors have been introduced having 64-bit address capability.
Unlike the earlier increases in address size, the increase in size to 64 bits has a revolutionary potential. Even where every task has its own range of addresses and every new piece of data is assigned a persistent address which is not re-used, it is unlikely that all the addresses in a 64-bit address space will be consumed in the lifetime of a given computer system. Thus, a 64-bit address is large enough to support a single level storage architecture. Moreover, it is a capability which is available to the system designer at no cost. Commodity processors simply offer this enormous range of addresses, whether the system designer uses them or not. At the present time, few systems have taken advantage of the full range of 64-bit address space.
The increasing use of OO applications, as well as the availability of large addresses on modem processor hardware, provide some justification for a single level storage architecture. However, architectural decisions for computer systems are not made in a vacuum. There is a long history of computer system development using the multiple virtual address space model. Any computer system architecture has its own characteristic advantages and disadvantages. Operating systems have been designed, and application software written, to take advantage of multiple virtual address spaces. Given the existing investment in these designs, it is difficult for many systems designers and users to change to a single level store architecture, despite any theoretical advantage that may be available.
It would be desirable to obtain the benefits of a single level store architecture computer system, particularly in systems which execute a significant number of OO applications. However, it is very difficult to change something so fundamental as the addressing model used in a computer system. Altering a conventional multi-tasking, multiple virtual address space system, to conform to a single level store design would typically require massive re-writing of the operating system and the application software.
SUMMARY OF THE INVENTION
It is therefore an object of the present invention to provide an enhanced computer system architecture.
Another object of this invention is to increase the performance of a computer system.
Another object of this invention is to enhance the ability of a computer system to execute multiple concurrent tasks.
Another object of this invention is to enhance the ability of a computer system to share data and code between multiple concurrent tasks.
Another object of this invention is to enhance the ability of a computer system to execute tasks involving object-oriented programming applications.
Another object of this invention is to reduce the complexity of pointer resolution among different tasks in a multi-tasking computer system.
Another object of this invention is to enhance the ability of a multi-tasking computer system having multiple virtual address spaces to provide functional advantages of a single address space computer system.
A multi-tasking operating system of a computer system allocates a respective virtual address space to each task, the virtual address spaces for the different tasks overlapping. For at least some tasks, a portion of virtual address space is reserved as a shared address space (SAS) region. These tasks are said to be “participating” in the SAS region. The SAS region occupies the same range of virtual addresses in the virtual address space of each participating task. Certain classes of data intended for sharing among multiple tasks are assigned addresses in the range of the shared address space region. Assignments of such addresses in the shared address space region are unique and persistent. In this manner, it is possible for a multi-tasking multiple virtual address space computer system to behave like a single level store computer system when performing certain tasks.
In the preferred embodiment, certain facilities are added to the base operating system of a conventional multi-tasking computer system to support the SAS region and associated function. These facilities are collectively referred to as the “SAS Server”. The three chief facilities are a join facility, an attach facility, and an external paging facility.
The join facility permits a task to “join” (“participate” in) the SAS region, i.e., to take advantage of the single level storage characteristics of the SAS region. It is preferred that each task can join the SAS region individually, so that tasks are not required to join. By allowing a task to not participate in the SAS region, the operating system retains full compatibility with applications that may use portions of the SAS region for application specific purposes. A task joins a region by issuing a specific command to invoke the join facility. The SAS server maintains a record of tasks which are participating in the SAS region.
The attach facility is used by a participating task to attach blocks of memory within the SAS region. The SAS region is logically partitioned into blocks, which are the basic unit of access control. After joining the SAS region, a task can create blocks in the SAS region or attach blocks in the SAS region created by other tasks. The attach facility may either be invoked explicitly by a command to attach blocks, or implicitly by a memory reference to a location within a block which has not yet been attached. The SAS server maintains a record of attached blocks for each individual task. The fact that a task has joined the SAS region does not automatically grant it authority to access any particular block within the region. The attach facility is therefore responsible for verifying the authority of the task to access the requested block, and updating the record of attached blocks if an explicit or implicit request to access a block is successful. The SAS server also maintains a record of all persistent allocated blocks. This record enables the facility to allocate new blocks in unused address ranges, and guarantee that objects within the SAS region are loaded to consistent virtual addresses.
The external pager (called “external” because in the preferred embodiment it is external to the base operating system) manages paging within the SAS region. In the base operating system, when an executing task references a memory location, the system checks to determine whether the referenced page is currently loaded in physical memory. If not, an exception is generated by the operating system. A system default memory pager is called to bring the requested page in from storage.
This normal procedure is modified if the memory reference is within the SAS region. In that case, the exception causes the external pager to be called. The pager looks for the block in the executing task's record of attached blocks (which indicates authority to access the block containing the requested page). If the block entry is found (the block has been attached), the requested page is added to the task's page table. If necessary, the page is also loaded from storage and placed in memory (note that the page may already be in physical memory if it is used by another task). Subsequent attempts by the same task to access the same page will find it in the task's page table, so that no exception will be generated and the memory location will be accessed directly.
The above described system is a hybrid, which is neither purely a multiple address space system nor a single level store system. Because it builds upon a multiple virtual address space system, it is compatible with many existing architectures, and may execute programs written for these architectures with little or no modification. At the same time, it provides many of the advantages of single level store, e.g., improved ability to resolve pointers among different tasks and execute object-oriented applications where objects are controlled by different users.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a high level diagram of the major hardware components of a computer system according to the preferred embodiment.
FIG. 2 is a conceptual diagram at a high level of main memory according to the preferred embodiment.
FIG. 3 is a high level depiction of the mapping of entities in virtual address space of a conventional multiple virtual address space operating system.
FIG. 4 is a high level depiction of the mapping of entities in virtual address space of a single-level store computer system.
FIG. 5 is a high level depiction of the mapping of entities in virtual address space of a computer system according to the preferred embodiment of the preferred embodiment of the present invention.
FIG. 6 illustrates certain addressing constructs according to the preferred embodiment.
FIG. 7 shows the format of an active task list data structure, according to the preferred embodiment.
FIG. 8 shows the format of a cohort mapping table data structure, according to the preferred embodiment.
FIG. 9 shows the format of a cohort block index data structure, according to the preferred embodiment.
FIG. 10 shows the format of a permanent directory data structure, according to the preferred embodiment.
FIG. 11 shows the format of a free space directory data structure, according to the preferred embodiment.
FIG. 12 shows the format of an active block table data structure, according to the preferred embodiment.
FIG. 13 shows a high-level flow diagram of task execution on the system, according to the preferred embodiment.
FIG. 14 illustrates in greater detail the steps taken by the system when a task joins the SAS region, according to the preferred embodiment.
FIG. 15 illustrates in greater detail the steps taken by the system when a block within the SAS region is created, according to the preferred embodiment.
FIG. 16 illustrates in greater detail the steps taken by the system when an call is made to explicitly attach a block within the SAS region, according to the preferred embodiment.
FIG. 17 illustrates in greater detail the steps taken by the system when an attempt to reference a page from a previously attached block in the SAS region generates a page fault, according to the preferred embodiment.
FIG. 18 illustrates in greater detail the steps, taken by the system when an attempt to reference a page from an unattached block in the SAS region generates a page fault, according to the preferred embodiment.
FIG. 19 illustrates the steps taken by the system when physical storage is assigned to blocks within the SAS region, according to the preferred embodiment.
FIG. 20 illustrates the steps taken by the system when a page within the SAS region is written back to storage, according to the preferred embodiment.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT System Overview
The major hardware components of a computer system 100 for supporting SAS regions in a multiple virtual address space environment in accordance with the preferred embodiment of the present invention are shown in FIG. 1. CPU 101 for processing instructions is coupled to random access main memory 102 via a memory bus 103. CPU 101 and main memory 102 also communicate via I/O interface 105 with I/O buses 110,111. Various I/O devices 112-118 attach to system buses 110,111, such as direct access storage devices (DASD), tape drives, workstations, printers, and remote communication lines.
FIG. 1 shows some of the major components of CPU 101. CPU 101 comprises instruction register 121 for holding the current instruction being executed by the CPU; instruction address register 122 for storing the address of an instruction; control unit 123, which decodes the instruction in register 121, determines the next instruction to be executed, and controls the flow of data internally within the CPU; arithmetic logic unit 124 for performing arithmetic and logical operations on data; and a plurality of general purpose registers 125 which can be used for temporary storage of data or addresses. Depending on the design of CPU 101, it may include various special purpose registers, caches, internal data buses, multiple arithmetic logic units, instruction registers, and instruction address registers for pipelining, and other features. In the preferred embodiment, CPU 101 is a Motorola 64-bit PowerPC processor, it being understood that various other processors could be used. It will be further understood that almost any multi-tasking computer system could be used, and that great variations are possible in the number, type and arrangement of processors, memory, busses, I/O units, etc. In particular, it would be possible to employ a system having a plurality of central processing units.
The size of registers 122 and 125 determines the maximum size of addresses that can be conveniently manipulated and addressed by CPU 101. In many current processor designs, including the processor of the preferred embodiment, it is customary to handle data and addresses in general purpose registers of the same size. While it is theoretically possible to create and manipulate larger addresses by concatenating the contents of multiple registers, this would create a substantial programming and performance burden. Therefore, the size of the registers can be said to define a virtual address space of CPU 101, this address space having a size 2n addressable units, where n is the number of bits in one of the registers. In the preferred embodiment, the registers can store a 64-bit address, defining a virtual address space of 264 bytes.
Applicants experimented with a prototype using a modified version of an IBM RISC System/6000 computer system. The RISC System/6000 computer is available from IBM Corporation, although the version used by applicants is not publicly available. However, applicants' invention is not dependent on the existence of specific hardware features not common to most, if not all, computer systems, and could therefore be implemented using any of various general purpose and special purpose computer systems.
FIG. 2 is a conceptual diagram at a high level of main memory 102. Main memory is preferably a large random access memory which stores programs and other data for use by processor 101 and other components of system 100. Memory 102 includes base operating system 201, SAS server 210, a plurality of applications 220, and shared entities 230. Base operating system 201 is a multi-tasking computer operating system which provides basic operational functions for computer system 100, such as task initiation and termination, resource scheduling, page mapping and swapping, storage I/O, etc. Base operating system maintains numerous data structures for its varied functions, among them address to memory object table (AMOT) 202, page table 203 , and memory object table 205 , which are described more fully herein. It will be understood that base operating system 201 maintains many other data structures in addition, these not being critical to an understanding of applicants' embodiment. SAS server 210 also maintains various data structures, including active task list 211, cohort mapping table 212, cohort block indices 213, permanent directories 214, free space directories 215, and active block table 216. Applications 220 contain programming code or data used by particular tasks executing on system 100. Shared entities are programming code or data structures which have virtual addresses within a shared address space (SAS) region. Typically, these could be entities in an object-oriented programming environment, such as objects, classes, methods, etc. However, the use of the SAS region is not limited to object-oriented programming environments, and the region could also contain conventional files, programs and other data structures. The SAS region is described more fully below.
Although main memory is conceptually shown in FIG. 2 as a single entity in which significant programs and data are contained, it will be understood that in typical operation it is not possible to store all programs and data in main memory simultaneously. Portions of base operating system 201 and other components may be loaded into main memory, while other portions remain on auxiliary storage, such as disk drive storage. These portions may be swapped in or out depending on demand. Additionally, portions of programs or data may be contained in one or more high-speed caches for improved performance.
In the preferred embodiment, base operating system 201 is the Micro-Kernel Operating System available from the Open Software Foundation. However, it should be understood that other multi-tasking operating systems perform similar or analogous functions, and the present invention could be adapted to other multi-tasking operating systems by making minor modifications to the SAS facilities. Particularly, operating systems which support shared memory between different tasks and memory mapped files are appropriate, although the present invention is not necessarily limited in use to operating systems of that type. In reality, applicants experimented with a prototype using IBM's version of the Micro-Kernel Operating System, which is a slight modification of the Open Software Foundation's version. However, it is believed that none of the modifications made in the IBM version of the Micro-Kernel Operating System are relevant to the present invention.
It is expected that typically the operating system described herein would be distributed as an inherent part of a computer system and stored in the non-volatile storage (e.g. magnetic disk drives) of the computer system. However, because the operating system has few, if any, specific hardware dependencies, it would also be possible to distribute the operating system separately from hardware. Additionally, it would be possible to distribute a server portion of an operating system separately for use with an existing base operating system. In these cases, the operating system instructions which maintain data structures as exemplified by FIG. 2 and perform the functions described herein could be distributed on any computer readable medium, such as magnetic tape, removable magnetic disk, optical disk, etc. Appropriate data structures may be distributed in skeleton form on the computer readable medium, or may be created by the code upon execution.
System 100 may be part of a network of computer systems, each of which recognizes unique and persistent virtual addresses within a shared region. In this manner, entities can be shared among the various computer systems in the network. Alternatively, the computer system described herein need not necessarily be attached to a network of systems having similar characteristics, or to any network at all. It would be possible to utilize a shared address region as described herein on a single system, which does not share entities in a network environment.
Virtual Address Space
As noted above, the registers of CPU 101 define a virtual address space, which in the preferred embodiment is 264 addressable bytes. Base operating system 201 in conjunction with SAS server 210 maps this address space for each executing task. A significant feature of the present invention is the form of this mapping, as explained below and shown in FIGS. 3-5. As used in FIGS. 3-5 and the accompanying explanatory text, an “entity” could be a code module, data structure, data space, etc. The term “entity” is used rather than “object”, because “object” has specific meaning in certain contexts. However, an “entity” could also be an object. An “entity” could also be one or more “blocks”, as that term is used below.
FIG. 3 depicts at a high level the mapping of entities in virtual address space of a multi-tasking computer system utilizing a conventional multiple virtual address space operating system of the prior art. A range of addresses from 0 to 2n−1 can be expressed in CPU registers holding n bits of information. For each task executing on the system, there exists a separate mapping 301-303 of entities to virtual addresses. While three task mappings 301-303 are shown in FIG. 3, it will be understood that this is for illustrative purposes only, and that typically a much larger number of tasks can be handled by the system. A table, list or other data structure contains the mapping information for a task. The mapping may be specified on a segment or block basis (i.e., each fixed-size range of addresses), or on an entity basis, or some other basis.
As shown in FIG. 3, each task can map the entire virtual address space of 2n addressable units, and each task's map is different. Because each virtual addresses are duplicating in different virtual address spaces, the spaces are “overlapping”. Some entities, such as A, C, and L, are mapped in the address space of more than one task, but are not necessarily at the same virtual address. Other entities, such as D and P, exist only within a single task. An entity, such as B, may be noncontiguously stored in the virtual address space of one task, and contiguously stored in the virtual address space of another.
Because the virtual address of a particular entity in the system of FIG. 3 may vary from task to task, there is no persistent virtual address associated with an entity. Typically, an arbitrary virtual address is assigned each time the entity is loaded or linked by the task from available virtual address space. Therefore, not only may the same entity have differing virtual addresses in different task address spaces, but the same entity may have differing virtual addresses in the address space of a single application for each instance of the application. If pointers are used to reference locations in different entities, these must be resolved to the current environment of the executing task. This typically introduces considerable complexity in the operation of the system, and can significantly affect performance. For example, pointers will be stored in some convertable form, address resolution data structures will exist, operating system code will manipulate the pointers to resolve the address to a particular environment, etc.
FIG. 4 depicts a high level mapping of entities in virtual address space of a computer system utilizing a single-level store architecture. As shown in FIG. 4, there is but a single large virtual address space map 401, and all entities are mapped into this one space. Entities which are used only by one task, as well as entities which are used by more than one task, are all mapped in the same space. A consequence of this single large mapping is that each mappable entity has its own unique range of virtual addresses, which do not overlap or duplicate those of any other entity. As explained in the background section, this provides certain advantages when accessing entities which are used by different tasks. Since there is only one virtual address associated with an entity, this virtual address is persistent, and will be the same whenever the entity is referenced. This obviates the need to re-assign pointers in the virtual address space, and these pointers may be permanently assigned.
Typically, single-level store architectures are expected to have a sparse utilization of the virtual address space. When an entity is created, a chunk of virtual address space is permanently allocated to the entity, and therefore removed from use by other entities. The operating system will usually allocate virtual address space liberally, because it is not possible to reassign addresses later. Because all entities must share the same virtual address space in the system using single-level store architecture, and addresses are rapidly allocated without actually holding any data, the address space defined by n must be very large. While 16-, 24- and 32-bit addresses have been used with conventional multiple virtual address space architectures, a larger number is usually considered necessary for single-level store. The original IBM System/38 used 48-bit addresses, and more modem implementations envision 64-bit or larger addresses.
FIG. 5 depicts a high level mapping of entities in virtual address space of a computer system utilizing a shared address space region architecture, according to the preferred embodiment of the present invention. As in the case of the conventional multiple virtual address space architecture of FIG. 3, each task has its own mapping 501-503 of entities to virtual address space. Unlike the conventional system, however, a large portion of the virtual address space, designated the shared address space (SAS) region 510, contains a single common mapping across multiple tasks.
The SAS region 510 has characteristics of a single-level store architecture. SAS server 210 enforces a mapping of entities within the SAS region, and assures that all entities within this region are uniquely and persistently mapped. This address range is unique within the SAS region. However, outside SAS region 510, the mapping of entities in virtual memory is handled in the same manner as a conventional multiple virtual address space architecture. As shown in FIG. 5, entities outside the SAS region are mapped differently for each of the different tasks.
It should be understood that although addresses within the SAS region are persistently assigned to entities, there are certain system global events which may cause a re-assignment of addresses, depending on the design of the operating system. For example, the system may be designed so that addresses are re-assigned in the event of a re-building of the system following disaster recovery, or following a major alteration of the system. On the other hand, the system may be designed so that addresses are never re-assigned under any circumstances, and are indeed permanent. As used herein, “persistent” assignment means that addresses are not re-assigned whenever a new task is initiated or an entity is loaded from auxiliary storage. The very purpose of the SAS region and persistent assignment is that the same virtual address can be used to reference the same entity time and again.
As with a single-level store architecture, it is expected that address space in SAS region 510 will be sparsely used, and a very large address space is therefore desirable. In the preferred embodiment, the top and bottom 252 addresses in the processor's virtual address space lie outside the SAS region, and all addresses in the middle are in the SAS region. I.e., addresses 0 through 252−1, and addresses 264−252 through 264−1, lie outside the SAS region, while addresses 252 through 264−252−1 are in the SAS region. In other words, approximately 99.95% of the virtual address space lies in the SAS region. But even with such a large proportion of virtual address space taken by the SAS region, the remaining virtual address space still contains 253 addresses. This is larger than required by most, if not all, of the conventional multiple virtual address space architectures used today.
Because a sufficiently large range of addresses lies outside the SAS region, a multiple virtual address space operating system which has been modified as described herein can function in a normal manner without invoking the SAS facility. It can create multiple virtual address space mappings for multiple tasks, and within the address range lying outside the SAS region, each task can arbitrarily assign addresses to entities without regard to the mappings of other tasks. More significantly, computer programming code which was written and compiled for use on a conventional multiple virtual address space operating system will execute normally as a task in the system of the preferred embodiment, without the need to re-write or re-compile the code. Thus, a system having advantages of a single-level storage architecture is compatible with code written for a conventional multiple virtual address space system.
It should be understood that the mappings of FIGS. 3-5 are intended to illustrate the concepts of different address mapping approaches, and are not intended to show actual mappings for a particular system. In particular, the mappings are not drawn to scale. Typically, the number of mappable entities would be much larger, the size of an individual entity in relation to the total address space would be much smaller, and for larger values of n, the amount of unallocated space in a map would far exceed the amount of allocated space. As explained previously with regard to FIG. 5, SAS region 510 occupies a larger proportion of total address space than graphically depicted in the figure.
Addressing Constructs and Terminology
In order to efficiently support addressing in SAS region 510 as described herein, and to further enable sharing of objects across different systems in a potentially large network of systems, certain addressing constructs are used in the preferred embodiment. These are illustrated in FIG. 6. It should be understood that the addressing constructs illustrated in FIG. 6 are shown here in order to describe applicants' preferred embodiment, and that many variations of address length and address constructs are possible.
In the preferred embodiment, memory is byte-addressable. A virtual address 601 contains 64 bits, that being a convenient number established by the length of hardware registers in CPU 101 and other hardware constraints. A page is a 4 Kbyte contiguous segment of memory, in which all address bits are the same except the lowest order 12 bits. Therefore virtual address 601 may be divided into 52-bit virtual page index 602 and 12-bit byte index 603. Virtual page index 602 is sufficient to specify any page within the 64-bit address space of CPU 101, while byte index 603 is sufficient to specify any byte within a 4 Kbyte page.
In the preferred embodiment, address space is assigned to storage devices in large chunks called cohorts. Each cohort contains 240 (approximately one trillion) bytes of address space. A cohort is simply a convenient unit of assigning large portions of the address space, and is particularly useful in a distributed processing environment. Normally, a single cohort is assigned to a set of physical storage devices. If the set uses up all the virtual addresses in the cohort, additional cohorts may be assigned to the set.
In a distributed processing network, each cohort is uniquely identified by 64-bit cohort identifier 604. Within a cohort, any byte is uniquely identified by 40-bit cohort offset 606. Therefore, it is possible to uniquely identify any address in the network by the concatenation of the 64-bit cohort ID 604 and 40-bit cohort offset 606. This 104-bit identifier is also referred to as the object identifier.
It will be observed that the 104-bit object ID does not fit within the 64-bit address space of CPU 101. A 64-bit cohort ID is used in order to conveniently assure uniqueness of the cohort identifier throughout a potentially large network of systems. While 64 bits are potentially needed to identify all cohorts in a very large network, it is believed to be much larger than needed for identifying all cohorts on a single system. Within the processor address space of a single system, a cohort is identified by 24-bit cohort mapping prefix (CMP) 605. The concatenation of CMP 605 and cohort offset 606 form the 64-bit virtual address 601
The 64-bit space of cohort IDs is mapped into the 24-bit space of CMPs on any single system. A data structure in memory 102 contains the mapping, as described more fully below. This means that any single system can address only a small fraction of the possible number of cohort IDs in the entire distributed processing network. However, even this small fraction is extremely large, amounting to approximately 16 million cohorts. Moreover, 64 bits are provided for cohort identifier to conveniently assure uniqueness of the identifier in a distributed processing network. This does not mean that 264 cohorts actually exist in physical storage. Generally, this range of identifiers will be very sparsely allocated. The large 64-bit range makes it possible to assign portions of the range to different nodes in the network on some predetermined basis, without requiring a global cohort allocater to allocate cohorts sequentially. On a single system, only cohorts which are actually assigned to some physical storage need be given a CMP, allowing CMPs 605 to be assigned sequentially or on some other basis which assures that addresses are not wasted. The 24-bit size of CMP 605 is deemed adequate for this purpose.
If system 100 is not intended to share data in a network environment, the 64-bit cohort ID is unnecessary, and cohorts can simply be identified locally by CMU 605. In this case, certain references to the cohort ID in data structures and procedures described below should be understood to refer to CMP 605.
Cohort ID 604, CMP 605 and cohort offset 606 together constitute a 128-bit object reference, i.e., all the addressing information relating to an addressable entity on the system. However, as explained above, this 128-bit object reference is not itself an address; it is larger than an address. CMP 605 is duplicative of cohort ID 604, and only one or the other is needed to specify a cohort within a system.
As explained above, a cohort is a unit of allocation for sets of storage devices. Within a cohort, address space is allocated for use by the operating system and application programs in blocks. The system of the preferred embodiment supports block allocations of different sizes although the block size must be a power of two, and must be at least a page (4 Kbyte) and no larger than a cohort. Typically, a block is much smaller that a cohort and much larger than a page. As illustrated in FIG. 6, within a cohort, a block is identified by block index 607, and a byte within a block is identified by block offset 608. Block offset 608 can be further subdivided into block page index 609 and byte index 603.
Data Structures
In the preferred embodiment, SAS server 210 maintains various data structures to support the functions of the SAS region. The key structures are active task list 211, cohort mapping table 212, cohort block index 213, permanent directory 214, free space directory 215, and active block table 216, it being understood that these are not necessarily the only data structures maintained by SAS server 210. Because SAS server 210 operates as a server responding to calls from base operating system 201, these data structures are transparent to the base operating system. The structure and function of these data structures is described more fully below.
FIG. 7 depicts the format of active task list data structure 211. Active task list 211 contains a record of all active tasks which have joined the SAS region and the blocks which they have attached within the SAS region, i.e., the blocks for which access has already been requested and verified. Active task list 211 contains a plurality of entries, each entry representing either a pairing of a task with a block attached to that task or a pairing of a task with the SAS region, the latter entry being made when the task first joins the SAS region. If a block is attached to more than one task, its address may appear in multiple entries in active task list 211. Each entry contains task identifier field 701 for identifying the task, and virtual address range field 702 containing the starting virtual address and length of the block or SAS region.
The SAS server 210 maintains a single active task list 211, which contains information for all tasks and blocks.
FIG. 8 depicts the format of cohort mapping table data structure 212. Cohort mapping table 212 contains a mapping of the 64-bit cohort ID 604 into 24-bit CMPs 605 and identifies the set of storage devices to which the cohort is allocated. Cohort mapping table 212 contains a plurality of entries, each entry containing a cohort ID field 801, a cohort mapping prefix field 802, and a media ID field 803. Media ID field 803 contains an identifier for a set of physical storage devices. SAS server 210 maintains a single cohort mapping table 212 for system 100, containing a system-wide mapping of cohort ID to CMP.
FIG. 9 depicts the format of cohort block index data structure 213. Cohort block index 213 is a record of all blocks which have been allocated (created) within a set of storage devices (media group). Generally, a media group will have one cohort of virtual address space allotted for its use, but it may have more than one. Cohort block index contains a header portion containing the starting address of the next unallocated block 901, and a list of all physical storage devices which are in the media group 902. Following the header are a plurality of block entries, each representing an allocated block. Each block entry contains block address range field 903 and authority control field 904. Block address range field 903 contains the starting virtual address and length of a block which has been allocated within one of the cohorts assigned to the media group. Authority control field 904 contains a pointer to an authority control mechanism (such as an access control list) which controls authorization to the block.
As noted above, there is one cohort block index 213 for each media group, and therefore the system may have multiple cohort block index data structures, each one recording allocated blocks within its respective media group. Collectively, the cohort block index data structures contain a complete, permanent record of allocated blocks within the SAS region. It will be recalled that block allocations are persistent, and can not be duplicated by different tasks. The cohort block indices provide the record for assuring that blocks are never allocated more than once. For this reason, cohort block indices are persistent records which survive a system initial program load (IPL) or re-initialization.
FIG. 10 depicts the format of permanent directory data structure 214. Permanent directory 214 constitutes a mapping of virtual address space for which storage has actually been allocated to the physical storage. Permanent directory 214 contains a plurality of entries, each entry representing a contiguous range of virtual addresses which have been allocated a contiguous range of physical storage space. Permanent directory 214 contains virtual address field 1001 containing a starting virtual address for the range of addresses which have been allocated physical storage space, device identifier field 1002 containing the identifier of the physical storage device, sector field 1003 containing the starting sector of the allocated space on the physical storage device, and length field 1004 containing the length of the allocation of physical storage.
Like cohort block index 213, there is one permanent directory 214 for each media group. However, there is not a one-to-one correspondence of entries in the two data structures. When a block is allocated, the virtual address space within the block is reserved for some particular task, but the block does not necessarily contain any data. Typically, the size of the address space far exceeds the amount of physical storage. Address space is intended to be is sparsely used, so that most of the address space in an allocated block will never be allocated any physical storage.
FIG. 11 depicts the format of free space directory data structure 215. Free space directory 215 contains a record of all space on physical storage media which has not yet been allocated to any block. Like permanent directory 214 and cohort block index 213, there is one free space directory 215 for each media group. I.e., there is a one-to-one correspondence between cohort block index data structures 213, permanent directory data structures 214, and free space directory data structures 215. Free space directory contains a plurality of entries each representing a segment of free physical space on storage media. Each entry in free space directory 215 contains device identifier field 1101 containing the identifier of the physical storage device, sector field 1102 containing the starting sector of the free space on the physical storage device, and length field 1003 containing the length of the free physical storage.
FIG. 12 depicts the format of active block table data structure 216. Active block table 216records currently active blocks, media and authority control. The information is active block table 216is largely duplicated in other data structures such as cohort block index 213 and cohort mapping table 212, but the table is used for performance reasons, as explained later. SAS server 210 maintains a single active block table 216for the system. Active block table 216contains a plurality of entries, each entry representing an active block. Each entry in table 216contains memory object identifier field 1201, virtual address range field 1202, cohort identifier field 1203, media identifier field 1204, authority control field 1205, and task count field 1206. Memory object identifier field 1201 contains a memory object identifier which is assigned to the active block by base operating system 201, and used for identifying the block in certain procedure calls between base operating system 201 and SAS server 210. Task count field 1206 contains a count of the number of currently active tasks which have attached the block; this field is used for removing table entries which are no longer being used. Virtual address range field 1202 cohort ID field 1203, media ID field 1204, and authority control field 1205 contain the same information which is contained in virtual address range field 903, cohort ID field 801, media ID field 803, and authority control field 904, respectively, of cohort mapping table 212 and cohort block index 213.
It will be appreciated that, with respect to the above described data structures, it is not necessary to store a complete virtual address and block length in fields 702, 903, 1001, and 1202. For example, since cohort block index 213 is used to identify blocks, it is sufficient to store that portion of the virtual address sufficient to identify a block. In addition, if block size is fixed, it is not necessary to store a block length. In the preferred embodiment, it is deemed better to store the entire virtual address and mask out unwanted bits, and to store the length in order to support blocks of various sizes. Although this requires a small amount of additional memory, it is easier to move entire addresses and gives the system greater flexibility. It will also be appreciated that the data structures may contain additional fields not critical to an understanding of the embodiment described herein.
In addition to the data structures described above, which are maintained by SAS server 210, there are several data structures which are maintained by base operating system 201, and which are significant to the operation of SAS server 210. Base operating system maintains address to memory object tables (AMOT) 202, page table 203 , and memory object table 205 . It should be understood that base operating system 201 further maintains a large number of other data structures which are not described herein, as is common in an operating system for a multi-tasking computer system.
AMOT 202 maps blocks in virtual memory to memory object identifiers, pagers, and block access rights. In base operating system 201, a “pager” is a software port for a page request, i.e., the identity of a service utility for handling a page request. By providing a mapping of blocks to pagers, it is possible to provide different facilities for handling page requests to different parts of memory. Specifically, in the case of SAS regions, a page request to a page in the SAS region will be routed to the pager identified in AMOT 202, which will be SAS Server 210. A page request to a page outside the SAS region will be routed to a default paging utility. AMOT also records for each block the access rights that the task has been given for that block, e.g., “read”, “write” and “execute”. AMOT 202 is also used to reserve ranges of virtual address space, effectively removing these ranges from free space available for allocation. AMOT is referenced by operating system 201 when allocating available free space. Base operating system 201 maintains a separate AMOT for each active task.
Page table 203 maps virtual page indices to page indices in real storage, i.e., it records where a page actually is in real storage. Conceptually, the page table can be visualized as pairs of virtual page indices and real page indices, there being a separate set of pairs for each task on the system. In reality, the table may have a different, more complex structure, for reasons of performance or memory size. The actual structure of the table is not critical to an understanding of the preferred embodiment.
Memory object table 205 records which virtual pages are in real storage on a global basis (i.e., unlike the mapping in page table 203 , which is on a task basis). Memory object table 205 is used to map a page in real storage being used by one task to another task in page table 203 , thus avoiding the need to duplicate the page in real storage.
Operation
In operation, SAS Server 210 offers a battery of facilities that are invoked as necessary to make the system behave in accordance with the shared address space model. FIG. 13 shows a high-level flow diagram of task execution on the system of the preferred embodiment. In this embodiment, each task has the option to join or not to join the SAS region. As shown in FIG. 13, the key facilities available to support the SAS region are Join 1303, Create 1305, Attach Explicit 1306, Load 1307, Attach Implicit 1308, Assign Physical Storage 1309 and Write Back 1310.
A task is initiated in a conventional manner upon the request of a user by base operating system 201 as represented by block 1301. Base operating system creates all the data structures and table entries normally required to support execution of the task in the multi-tasking system. In particular, base operating system creates an AMOT 202 and entries in page table 203.
If the task is to join the SAS region and take advantage of its facilities, it must contain an explicit call to join the SAS region. It is not absolutely necessary that this call be made before any execution of the task takes place, but it would normally be done as one of the earliest commands issued by the task, and the decision to join the SAS region 1302 is therefore shown in FIG. 13 immediately following task initialization 1301. In applicants' embodiment, block 1302 is not a “decision” in the classical sense of a comparison of data, but is simply the presence or absence in the executing task of a call to join the SAS region.
If the task does not join the SAS region, execution proceeds in the conventional manner until completed, as represented by block 1311. In this case, no special allocation is made regarding virtual address space in the range otherwise reserved for the SAS region. Accordingly, the task is free to use any of this virtual address space for any purpose that would normally be permitted under conventional operating system constraints. Because base operating system 201 maintains a separate virtual address map for each task on the system, the use by a task which has not joined the SAS region of a virtual address range within the region will not affect the use by other tasks of that same virtual address range. Thus the system can concurrently execute tasks which have joined the SAS region and tasks which have not.
If a task is to join the SAS region, it initiates a call to the SAS server's join facility. This call is only made once for each task which joins the SAS region. The join call has the effect of reserving virtual address space in the SAS region and directing certain address references within the region to SAS server 210.
FIG. 14 illustrates in greater detail the steps taken by the system when a join call is made. At step 1401, the executing task asks to join the SAS region by issuing a remote procedure call to SAS server 210. SAS server receives the call 1402. SAS server 210 then issues a call back to base operating system 201 to reserve the SAS region for its use. Base operating system receives this call 1404, and reserves the entire SAS region of virtual address space. The reservation of space in the virtual memory map means only that the address space can not be used by the base operating system to satisfy a request for free space; it does not prevent memory accesses to addresses within the SAS region. Base operating system 201 satisfies a request for free space by parsing the entries in AMOT 202 to determine which address ranges have not been allocated. Therefore, the SAS region is reserved by adding an entry to AMOT 202 covering the entire SAS region, effectively preventing the operating system from allocating free space from the SAS region. Base operating system then returns to the SAS server at 1406. Upon returning to the SAS server, the server updates active task list 211 by adding an entry for the task which initially called the SAS server requesting to join the SAS region, at step 1407. The entry contains the identifier of the task in task ID field 701 and the address of the SAS region in virtual address field 702. SAS server 210 then returns at step 1408 to the task which initially called it, and the task resumes execution at 1409.
Having joined the SAS region, the task may invoke any of the SAS server's facilities or may continue execution, as represented in FIG. 13. Generally, the SAS server's facilities may be invoked multiple times and in varying order, as represented by blocks 1304-1310. Conventional execution of the task is represented by block 1304. Typically, the task will execute in a conventional manner until it either explicitly or implicitly requires one of the SAS server's facilities, which is then called (blocks 1305-1310). Upon return the task continues execution. The process repeats until the task completes. Upon completion; base operating system 201 and.SAS server 210 perform certain clean-up functions (block 1312), described more fully below.
The task may create entities having addresses within the SAS region for use by itself and/or other tasks. In order to do this, an address range within the SAS region is assigned to a block using the Create call 1305. Upon creation, a block is like an empty container of virtual memory; it is the unit of allocation and access control within the SAS region. Having created the block and specified access rights to it, the task which created it (or other tasks) will then determine what to place within the block, e.g., text data, object code, database, etc. SAS server 210 only provides the mechanism for block allocation, attachment, etc., and,does not control what is placed in the block by a task which is authorized to access it.
FIG. 15 illustrates in greater detail the steps taken by the system when a create call is made to SAS server 210. A task creates a block by issuing a remote procedure call to SAS server 210 at step 1501, requesting the SAS server to create a block. With the create call, the task passes a cohort identifier, identifying cohort in which the block will be created, and a length identifying the block size. Block size is a power of two, is at least one page, and no larger than a cohort. SAS server 210 receives the call at step 1502. SAS server then refers cohort mapping table 212 to determine the media group (and hence the cohort block index data structure 213) associated with the cohort specified in the create call, and then to the cohort block index 213 to determine the location of the next available unallocated address for the block, at step 1503. This address will be the address in next block field 901.
SAS server 210 creates an appropriate authority control structure for the block to be created at step 1504. In the preferred embodiment, the authority control structure is an access control list. Specifically, it is a list of users who are authorized to access the block (in some implementations, the access control list is a list of tasks authorized to access the block). The access control list will also identify an “owner”, i.e., someone authorized to change the authority to access the block. If no access control list is specified in the create call, SAS server 210 creates a default access control list. As a default, the user on whose behalf the calling task is running is identified as the owner of the block. No other individual authority is granted to access the block, but read only access is granted globally to all users. The calling task, or another task executing on behalf of the same user, may later change this access control list using any utility which may be available on the system for this purpose. Because the cohort block index 213 contains a pointer to the authority control structure in field 904, it is possible for more than one block to reference the same authority control structure. It will be understood by those skilled in the art that alternative (or no) authority control mechanisms may be used, and that SAS server 210 may alternatively call some system security utility provided in base operating system 201 or elsewhere to create an appropriate authority control mechanism.
SAS server 210 then updates cohort block index 213 at step 1505 to reflect the newly created block. A new entry is created in index 213, having the starting address and length of the new block in virtual address range field 903 and a pointer to the authority control structure in field 904. Next block field 901 is advanced to the address immediately after the highest address within the newly created block, this to be the address assigned to the any subsequently created block. Thus, blocks are allocated from the SAS region's address space sequentially, although it will be understood that alternative allocation schemes could also be used. Because cohort block index 213 is the master record of block allocations, and these allocations must not be duplicated, cohort block index 213 is saved to non-volatile storage after each update.
At this point, SAS server 210 may optionally return to the calling task, or may continue by assigning physical storage, as depicted at step 1506. If the server continues, it calls an assign storage subroutine at step 1507 to assign physical space on storage media, which in the preferred embodiment will typically be magnetic disk drive media. The steps taken by SAS server in the assign storage subroutine are illustrated in FIG. 19 as steps 1903-1905. Basically, server 210 searches free space directory 215 for a sufficiently large range of unassigned physical storage at step 1903; updates the free space directory at step 1904 to reflect that the storage range to be assigned is no longer available as free space; and adds a new entry for the newly assigned physical storage to permanent directory 214 at step 1905. These steps are described more fully below with respect to FIG. 19.
After allocating physical storage, the server may optionally immediately attach the block to the calling task by invoking the explicit attach function, as illustrated in steps 1508, 1509. If the explicit attach function is invoked, it is called internally by SAS server 210. This amounts to performing the applicable steps shown in FIG. 16 and described in the accompanying text below. SAS server 210 then returns to the calling task at step 1510, which continues execution at step 1511.
The task may “attach” a block within the SAS region after that block has been created. Attachment is the mechanism by which the task is authorized to access the block. A task which has joined the SAS region may attach any block which it is authorized to access (regardless of which task created the block in the first instance). A task may attach any number of blocks within the SAS region, and a block may be attached by multiple tasks simultaneously, thus enabling shared access to objects in the SAS region. A particular block is attached to a particular task only once; after a task has attached a particular block, it need not attach it again although it may access it multiple times. Attachment is performed either explicitly or implicitly. An explicit attachment is one which is performed as a result of a direct call of the explicit attach function from the task. An implicit attachment is performed when the task attempts to access a block within the SAS region to which it has not previously been attached.
FIG. 16 illustrates in greater detail the steps taken by the system when an explicit attach call is made to SAS server 210. A task initiates the explicit attach function by issuing a remote procedure call to SAS server 210 at step 1601, requesting the SAS server to attach a block. The block starting address and type of access requested (e.g., read only, read/write, etc.) are passed parameters of the remote procedure call. SAS server 210 receives the call at step 1602.
Server 210 then checks active task list 211 for an entry corresponding to the executing task and block requested at step 1603. A corresponding entry in active task list 211 means that the block has already been attached, and need not be attached again; in this case, the server returns immediately to the calling task.
If no entry for the task and block exists in active task list 211, server 210 then accesses cohort block index 213 to find the applicable authority control structure, and verifies that the requesting task has authority to access the block at step 1604. In the preferred embodiment, server 210 parses an access control list identified by a pointer in authority control field 904 to determine whether authority exists. However, it will be recognized that many different and more complex authority verification schemes are possible, and verification of authority may be accomplished by calling a separate authority verification utility for that purpose. If insufficient authority exists (step 1605), server 210 returns immediately to the calling task without attaching any block.
If the requested authority exists, and no entry for the block and task exists in active task list 211, an entry is added to active task list 211 at step 1606. Server 210 then checks active block table 216to determine whether an entry corresponding to the block to be attached already exists in the table at step 1607. An entry may exist in table 216, notwithstanding the fact that there was no entry for the executing task and block in active task list 211, because another active task may have previously attached the block.
If an entry for the block already exists in active block table 216, task count field 1206 of the corresponding entry is incremented at step 1608. Incrementing the count field indicates that another task has attached the block. Server 210 then issues a virtual memory Map call to base operating system 201 at step 1610 (see below).
If, at step 1607, an entry for the block does not exist in active block table 216, the above procedure is slightly modified. SAS Server 210 creates an entry for the block in active block table 216, specifying a block count of one in field 1206, and specifying the appropriate values of fields 1202-1265, at step 1611. Server 210 also generates a memory object identifier for the new block, which is placed in field 1201 of the newly created entry in active block table 216.
Server 210 then issues a virtual memory map call to base operating system 201 at step 1610. The VM map call requests base operating system 201 to update the virtual memory map applicable to the executing task so that the block to be attached is now included in AMOT 202. In the map call, server 210 specifies the memory object ID (from field 1201 of table 216), block virtual address range, pager (which is the SAS server) and type of authority.
Upon receipt of the VM map call, base operating system 201 is acting as a server which has no way of knowing whether the pager specified in the call will respond for the memory object ID. It therefore issues a “notify” call back to the specified pager (i.e., SAS server 210) at step 1611, requesting Server 210 to verify that it will respond for the memory object ID. On receipt of the notify call, a separate thread running on SAS server 210 accesses active block table 216, verifies that the specified memory object ID is in the table, and returns with a positive result at step 1612. Base operating system, 201 then adds the appropriate entry for the newly attached block to AMOT 202 of the executing task at step 1613, and returns to SAS server 210. SAS Server then returns to the executing task at step 1615, which continues execution at step 1616.
Having attached a block, the task is free to reference virtual memory locations within the block. These references are handled with the assistance of base operating system's page fault handling capabilities, and are essentially transparent to the executing task. Base operating system 201 maintains a page table 203 which maps virtual pages to real storage for each executing task, as explained previously. A virtual page in the SAS region is added to the page table using the SAS server's external page facility as part of a load procedure or an implicit attach procedure, both of which are explained below. The authority of the task to access the virtual page is verified before the page entry can be added to table 203 , so that it is not necessary to verify authority to access any page that is already mapped in page table 203 for a particular task.
FIG. 17 illustrates in greater detail the steps taken by the system when an attempt to reference a page from a previously attached block generates a page fault, which may require that the page be loaded from storage to real memory (“Load procedure”). At step 1701, the executing task requires access to a page in virtual memory. At step 1702, the system looks in page table 203 and is unable to find an entry mapping the virtual memory address to real storage (a page fault condition exists).
Base operating system 201 then consults address to memory object table (AMOT) 202 in order to determine the memory object ID and appropriate pager port at step 1703. If the block was previously attached, an entry for the block will exist in AMOT. If no entry for the block exists, or if inadequate authority exists, an exception is generated (see below with respect to FIG. 18). Assuming no exception is generated, base operating system 201 uses memory object ID from AMOT 202 to search memory object table 205 , in order to determine whether the requested page already exists in real memory (i.e., has been read into real memory on behalf of some other task) at step 1704. If the page already exists in real memory, base operating system 201 simply updates page table 203 so that the page is mapped to the appropriate real memory location in the page table entries for the executing task at step 1705. Base operating system then directs the task to re-try the instruction at step 1713 (see below). If the page does not exist in real memory, a pager is called.
In the base operating system of the preferred embodiment, it is possible to specify different software ports for handling page faults to different virtual memory locations. A default pager is provided with the base operating system, but different pagers may be specified. The software port is specified in a pager field in the AMOT entry corresponding to the block to be accessed. It should be understood that other operating systems could use other mechanisms. For a block in the SAS region, the pager specified in the pager field will be the SAS server's external pager. Accordingly, base operating system 201 issues a remote procedure call (in effect a page request) to SAS server 210 at step 1706, passing the memory object ID (from AMOT 202), block index 607 and block page index 609.
SAS server 210 receives the call at step 1707. Server 210 uses the memory object ID as an index to access the appropriate entry in active block table 216. Because the block has already been attached, an entry for the block should exist in active block table 216(if not, an exception is generated). SAS server 210 determines the correct permanent directory 214 from media ID field 1204 in ABT 216 at step 1708. Server 210 then accesses the appropriate permanent directory to find the storage device and sector corresponding to the virtual address sought at step 1709 (if no entry exists in permanent directory 214, an exception is generated). SAS server 210 requests an I/O server to fetch the appropriate page from the designated storage device and sector at step 1710, and returns this page to base operating system 201 at step 1711. Base operating system 201 updates page table 203 and memory object table 205 with entries mapping the virtual address of the page to its real storage location at step 1712. Base operating system then directs the executing task to re-try the instruction at step 1713, as it normally would following any page fault after the desired page has been loaded into memory. Upon re-try by the executing task, the page will be found in page table 203 and the instruction will execute at step 1714. It will be noted that while the page remains in real storage, subsequent memory references to the same page will be mapped directly by base operating system 201 using page table 203 , making further calls to SAS server 210 unnecessary. If the page is “paged out” of real storage, it will be necessary to perform the load function again.
In some circumstances, an executing task may attempt to access an address in the SAS region virtual memory which it has not yet attached. For example, this may occur because the task is following a chain of pointers during execution of an object-oriented application, where different objects of the application are controlled by different users. Because it is difficult for the task to predict which blocks will be necessary for execution beforehand, it is desirable to have a mechanism which allows the executing task to simply attempt access with any pointer, and which automatically attaches the required block where appropriate. In the preferred embodiment, this is accomplished with the implicit attach function.
FIG. 18 illustrates in greater detail the steps taken by the system when an attempt to reference a page from an unattached block generates a page fault. The initial steps are similar to those shown in FIG. 17 and described above with respect to the load procedure. At step 1801, the executing task requires access to a page in virtual memory. At step 1802, base operating system 201 looks in page table 203 and is unable to find an entry mapping the virtual memory address to real storage (a page fault condition exists). Base operating system 201 then consults AMOT 202 to determine the proper pager port at step 1803. Because in this instance the block is unattached, there is no entry in the AMOT, and base operating system 201 generates a bad address exception.
The base operating system 201 of the preferred embodiment has the capability to alter the designation of exception ports. In this embodiment, all bad address exceptions are directed to SAS server 210. At step 1804, SAS server 210 receives the bad address exception. Server 210 then determines at steps 1805-1808 whether it should correct the exception condition or re-route the exception back to the default exception handler.
SAS server 210 first verifies whether the virtual address which generated the exception is within the SAS region at step 1805. If not, the exception is returned to the default exception port of base operating system 201 to be handled as a normal bad address exception at step 1809. SAS Server then accesses active task list to verify that the executing task has joined the SAS region at step 1806; if not, the exception is returned to the default exception port at step 1809. Server 210 then checks cohort block index 213 to verify that the requested block has been created at step 1807; if not, the exception is returned at step 1809. Finally, server 210 uses authority control field 904 to verify authority of the executing task to access the block at step 1808. As previously stated, in the preferred embodiment, field 904 is a pointer to an access control list, which is used to verify authority. If insufficient authority exists, the exception is returned at step 1809. It will be noted that by this method, an invalid address is treated in the same manner as a valid address to which the executing task lacks authority. For purposes of task execution, this is considered acceptable. In either case, the net effect is that task will be unable to access the address.
If the address is within the SAS region, the task has joined the SAS region, the block exists and authority to access the block exists, SAS server 210 will “implicitly” attach the block so that the task can access it. SAS server 210 adds an entry to active task list 211 corresponding to the executing task and block to be attached, at step 1810. The procedure followed at this point is similar to that used for an “explicit attach”, particularly, steps 1607 through 1614, described above. SAS server 210 checks active block table 216for the existence of an entry corresponding to the block to be accessed at step 1811. Even though the block has not yet been attached by the executing task, an entry may exist in table 216 because some other task has previously attached the block.
If an entry for the block already exists in active block table 216, task count field 1206 of the corresponding entry is incremented at step 1812. If, at step 1811, an entry for the block does not exist in active block table 216, server 210 creates an entry for the block in active block table 216, specifying a block count of one in field 1206, and specifying the appropriate values of fields 1202-1205, at step 1813. Server 210 also generates a memory object identifier for the new block, which is placed in field 1201 of the newly created entry in active block table 216.
Server 210 then issues a virtual memory map call to base operating system 201 at step 1814. The VM map call requests base operating system 201 to update the virtual memory map applicable to the executing task so that the block to be attached is now included in AMOT 202. In the VM map call, server 210 specifies the memory object ID (from field 1201 of table 216), block virtual address range, pager (which is the SAS server) and type of authority.
Upon receipt of the VM map call, base operating system 201 is acting as a server which has no way of knowing whether the pager specified in the call will respond for the memory object ID. It therefore issues a “notify” call back to the specified pager (i.e., SAS server 210) at step 1815, requesting Server 210 to verify that it will respond for the memory object ID. On receipt of the notify call, a separate thread running on SAS server 210 accesses active block table 216, verifies that the specified memory object ID is in the table, and returns with a positive result at step 1816. Base operating system 201 then adds the appropriate entry for the newly attached block to AMOT 202 of the executing task at step 1817, and returns to SAS server 210. SAS Server then returns to the executing task at step 1818.
Upon return, the executing task retries the instruction at step 1819. Again, base operating system checks the page table for the existence of the page (which will not be there). However, in this instance there will be an entry in AMOT 202. Therefore, the system performs the “load” procedure described above and shown in FIG. 17, represented as step 1820. Upon return from the “load” procedure, the instruction must be retried again. This time the instruction will be able to access the desired memory location, the page now being in memory and mapped in page table 203 . As described above, if the page is “paged out” of real storage, it will be necessary to perform the load function again. However, it will not be necessary to attach the block again.
Sometimes, a task which has attached a block may need to assign additional physical storage within the block. It will be recalled that a block is like a large container of virtual address space, which is typically sparsely used. Physical storage will normally be allocated on a more conservative basis, because it represents actual hardware capacity. As objects within a block are created or expanded, additional physical storage may be necessary. FIG. 19 illustrates the steps taken by the system when additional physical storage is assigned to blocks within the SAS region. The executing task calls SAS server 210 at step 1901, requesting the server to assign additional physical storage. The amount of physical storage requested is a passed parameter. Server 210 receives the request at step 1902, and searches free space directory 215 for a sufficiently large range of unassigned physical storage, taking the first entry it finds in the free space directory of sufficient size, at step 1903. If no single contiguous range sufficiently large exists, server 210 will take multiple smaller non-contiguous ranges. At step 1904, the free space directory is updated to reflect that the range of storage to be assigned is no longer available as free space. At step 1905, a new entry is added to permanent directory 214 with the information of the newly assigned space. If multiple non-contiguous areas of storage are needed, a separate entry in permanent directory 214 is needed for each such area. The server then returns to the executing procedure at step 1906, which continues execution at step 1907. In the preferred embodiment, the system will not automatically assign physical storage if the executing task references an address within an attached block for which no storage has been assigned; the task must explicitly call the server, requesting it to assign storage. The requirement of an explicit call to assign storage is a design decision intended to the reduce the effect of erroneous references to unassigned addresses. It would alternatively be possible to assign storage automatically.
FIG. 20 illustrates the steps taken by the system when a page within the SAS region is written back to storage. This process may be initiated by base operating system 201 because a “dirty” page (i.e., a page which has been altered since it was loaded) is being paged out (step 2001), or may be initiated by an explicit command from the executing task (step 2002). At step 2003, base operating system accesses AMOT 202 to determine the appropriate pager for the memory object of which the page to be written back is a part. For a page within the SAS region, the pager will be SAS server 210. At step 2004, base operating system 201 issues a call to SAS server 210, requesting that the page be written to storage. SAS server 210 receives the call at step 2005. Server 210 accesses active block table 216 to determine the appropriate media group at step 2006, and then accesses the permanent directory of the corresponding media group to determine the storage device and sector where the page should be written, at step 2007. SAS server then calls the base operating system's file server to write the page to storage, passing the device, media, and page location, at step 2008. The file server is a general purpose I/0 handler which is used by base operating system and SAS server to write data to storage locations. The file server returns control to base operating system 201 when finished writing the page to storage at step 2009.
When a task completes execution, base operating system 201 performs conventional clean-up functions with respect to data structures that it maintains, particularly AMOT 202, page table 203 , free address list 204, and memory object table 205 . Additionally, SAS server is called to clean up its data areas. In particular, SAS server 210 parses active task list 211 to determine whether the task has joined the SAS region. If so, for each task/block pair entry in active task list 211, the SAS server decrements count field 1206 in active block table 216. If the count is zero after decrementing, no active task is any longer attached to the block. Accordingly, the corresponding entry is removed from table 216. Lastly, all the entries for the task are removed from active task list 211. Cohort mapping table 212, cohort block index 213, permanent directory 214, and free space directory 215 are not affected by task termination. These functions are represented in FIG. 13 as step 1312.
A further refinement is employed to support execution of application programs compiled from certain languages which use static storage areas for temporary storage, such as C and C++. Typically, such code contains pointers to static storage locations. The code itself is read-only and doesn't change, but each executing task will need a separate copy of the static storage. If the program is intended to be a shared entity having a virtual address in the SAS region (and the static storage area likewise has a virtual address in the SAS region), some provision is necessary to allow different tasks to have different copies of the static storage area.
In applicant's embodiment, such static storage is allocated to a different block within the SAS region than the block containing the actual code. When the block containing static storage is first attached by an executing task and an entry is created in active block table 216, a field (not shown) in table 216 identifies the block as a “copy-on-write” block. Thereafter, when a virtual memory map call is made by server 210 (step 1610 or step 1814), the call also identifies the block as a “copy-on- write” block, and this information is placed in a field (not shown) in AMOT 202. If the executing task subsequently alters any data in the static storage, base operating system 201 creates a separate copy of the static storage in real memory, and alters the pager designation in the corresponding entry in AMOT 202 to specify the operating system's default pager. If a page in the static storage must be paged out to a temporary area of disk storage, it can be retrieved intact. The task is thus free to alter its copy of the static storage, and the copy remains at the same virtual address within the SAS region, without compromising the corresponding static storage areas of other tasks. In this limited sense, it is possible for different versions of an entity in the SAS region to exist in applicants' preferred embodiment.
Examples of Alternative Embodiments
In the preferred embodiment, a conventional multi-tasking operating system is used as a “base”, and additional functions are added to it in order to support use of the SAS region, as described above. The use of a conventional multi-tasking operating system as a base greatly reduces the amount of development effort required for a new system, and facilitates compatibility with an existing operating system. However, the fact that the functions which support the SAS region in the preferred embodiment are external to the base operating system should not be taken as a design requirement. It would alternatively be possible to design and construct an operating system from scratch, in which the SAS functions are fully integrated into the operating system. There may be advantages to the alternative of a fully integrated operating system which would make it desirable, particularly where compatibility with preexisting software is not a concern.
It will also be understood that, where a SAS server is used to enhance the capabilities of a base operating system as in the preferred embodiment, the functions performed by the SAS server may depend on the capabilities of the base operating system, and the SAS server will not necessarily perform every function performed by the SAS server of the preferred embodiment, or perform every such function in exactly the same way.
It will be further understood that many alternative data structures may be used to support a shared address space among multiple virtual address spaces. A set of data structures has been described with respect to the preferred embodiment, and particularly with respect to a system having a base operating system and a server supporting the SAS region. The description of these particular data structures should not be construed to mean that alternative data structures are not possible, that all of the functions performed by the described data structures are essential for every embodiment, or that other functions might not be necessary, depending on the embodiment.
In the preferred embodiment, a task is not required to “join” the SAS region, and so may choose not to utilize the capabilities of that region. By not joining the SAS region, the full amount of virtual address space is available to the task for whatever use it may make of it. This embodiment enables the system to be fully compatible with a base system having no SAS region capability, since it is possible that certain applications will make use of addresses in the range of the SAS region for purposes other than access to the SAS region facilities. However, since it is anticipated that the total size of the virtual address space available to a task in the system is much larger than it needs, it is unlikely to be unduly constraining if a portion of that space is always reserved for the SAS region. Therefore, in an alternative embodiment, all tasks are required to reserve a fixed range of virtual address space for the SAS region, whether they use this facility or not. Depending on the implementation, this alternative may simplify some of the code required to manage the SAS region.
In the preferred embodiment, there is a single SAS region which consumes the bulk of the virtual address space, and which all participating tasks join. It would alternatively be possible to construct a system with multiple SAS regions for sharing among groups of tasks. As a general rule, the use of multiple SAS regions would appear to contravene the purpose of the shared address space, i.e., the ability to more easily share objects among different tasks. However, there may be situations in which it is desirable for purposes of security or other reasons.
In the preferred embodiment, an access control list is associated with each block and controls access to it. However, many alternative methods of access control are possible. It will be noted that the use of SAS regions already provide a form of access control, i.e., entities within the SAS region have one type of control mechanism, while entities outside the SAS region have different control. It would, for example, be possible to have no authority control within the SAS region, so that any task which has joined the region has authority to access any block within the region. Because each task has a portion of virtual address space outside the SAS region, any entities which the task wishes to protect from use by other tasks can be placed in its private virtual address space outside the SAS region. This alternative embodiment would simplify some of the functions described above. It would also be possible to use other forms of access control within the SAS region, such as domain attributes (described in U.S. Pat. No. 5,280,614, to Munroe et al., herein incorporated by reference) hierarchical rings, or task or user profiles. For example, a task or user profile might contain a list of blocks or other entities to which a task or user is authorized, and these might be automatically attached upon joining the SAS region, or attached on demand for access to a particular block by searching the list. SAS regions provide an addressing and access mechanism which is generally compatible with a wide range of authority control methods.
Although a specific embodiment of the invention has been disclosed along with certain alternatives, it will be recognized by those skilled in the art that additional variations in form and detail may be made within the scope of the following claims.
Patent Citations
Cited PatentFiling datePublication dateApplicantTitle
US4455602May 22, 1981Jun 19, 1984Data General CorporationDigital data processing system having an I/O means using unique address providing and access priority control techniques
US5123094 *Jan 26, 1990Jun 16, 1992Apple Computer, Inc.Interprocessor communications includes second CPU designating memory locations assigned to first CPU and writing their addresses into registers
US5347649 *Mar 6, 1990Sep 13, 1994International Business Machines Corp.System for dynamically generating, correlating and reading multiprocessing trace data in a shared memory
US5581765Aug 30, 1994Dec 3, 1996International Business Machines CorporationSystem for combining a global object identifier with a local object address in a single object pointer
US5729710 *Jun 22, 1994Mar 17, 1998International Business Machines CorporationMethod and apparatus for management of mapped and unmapped regions of memory in a microkernel data processing system
US5752249 *Nov 14, 1996May 12, 1998Macon, Jr.; Charles E.System and method for instantiating a sharable, presistent parameterized collection class and real time process control system embodying the same
US5771383 *Feb 13, 1997Jun 23, 1998International Business Machines Corp.Shared memory support method and apparatus for a microkernel data processing system
US5790852 *Aug 27, 1991Aug 4, 1998International Business Machines CorporationComputer with extended virtual storage concept
EP0327798A2Jan 5, 1989Aug 16, 1989International Business Machines CorporationControl method and apparatus for zero-origin data spaces
EP0398695A2May 16, 1990Nov 22, 1990International Business Machines CorporationA single physical main storage unit shared by two or more processors executing respective operating systems
GB2282470A Title not available
Non-Patent Citations
Reference
1"An Operating System Structure for Wide-Address Architectures," Jeffrey S. Chase. Technical Report Aug. 6, 1995, Department of Computer Science and Engineering, University of Washington.
2"Architectural Support for Single Address Space Operating Systems," Eric J. Koldinger et al. In Proc. of the 5th Int. Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), Oct. 1992.
3"AS/400 System Overview," Ronald O. Fess et al., IBM Application System/400 Technology, pp. 2-10, Jun. 1988.
4"Distribution in a Single Address Space Operating System," Jeff Chase et al. Department of Computer Science and Engineering, University of Washington.
5"Fine-Grained Mobility in the Emerald System," Eric Jul et al. ACM Trans. on Computer Systems 6(1), Feb. 1988.
6"How to Use a 64-Bit Virtual Address Space," Jeffrey S. Chase et al. Technical Report Mar. 2, 1999, Department of Computer Science and Enginering, University of Washington.
7"Implementing Global Memory Management in a Workstation Cluster," Michael J. Feeley et al., In Proc. of the 15th ACM Symposium on Operating Systems Principles, Dec. 1995.
8"Integrating Coherency and Recoverability in Distributed Systems," Michael J. Feeley et al. In Proc. of the First Symposium on Operating Systems Design and Implementation, Nov. 1994.
9"Introduction to IBM System/38 Architecture," G. G. Henry, IBM System/38 Technical Developments, pp. 3-6, Dec. 1978.
10"Lightweight Shared Objects in a 64-Bit Operating System," Jeffrey S. Chase et al. In Proc. of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), Oct. 1992.
11"Opal: A Single Address Space System for 64-bit Architectures," Jeff Chase et al. In Proc. IEEE Workshop on Workstation Operating Systems, Apr. 1992.
12"Shared Memory Suport for Object-based RPC," Rene' W. Schmidt et al. Department of Computer Science and Engineering, University of Washington.
13"Sharing and Protection in a Single Address Space Operating System," Jeffrey S. Chase et al. ACM Transactions on Computer Systems, 12(4), Nov. 1994.
14"Some Issues for Single Address Space Systems," Jeff Chase et al. In Proc. of the Fourth IEEE Workshop on Workstation Operating Systems, Oct. 1993.
15"Supporting Cooperation on Wide-Address Computers," Jeffrey S. Chase et al. Technical Report Mar. 3, 1991, Department of Computer Science and Engineering, University of Washington.
16"System/38-A High-Level Machine," S. H. Dahlby et al., IBM System/38 Technical Developments, pp. 47-58, Dec. 1978.
17"The Amber System: Parallel Programming on a Network of Multiprocessors," Jeffrey S. Chase et al. Proc. of the 12th ACM Symposium on Operating Systems Principles, Dec. 1989.
18"The Protection Lookaside Buffer: Efficient Protection for Single Address-Space Computers," Eric J. Koldinger et al. Technical REport Nov. 5, 1991, Department of Computer Science and Engineering, University of Washington.
19"User-level Threads and Interprocess Communications," Michael J. Freeley et al. Technical Report Feb. 3, 1993, Department of Computer Science and Engineering, University of Washington.
20 *"Using Captured Storage for Accessing Debug Break Points and Storage," IBM Technical Disclosure Bulletin, pp. 261-263, Dec. 1, 1996.*
21"Using Virtual Addresses as Object Referecnes," Jeff Chase et al. In Proc. 2nd Int. Workshop on Object Orientation in Operating Systems, Sep. 1992.
22"System/38—A High-Level Machine," S. H. Dahlby et al., IBM System/38 Technical Developments, pp. 47-58, Dec. 1978.
23 *J. Chase, et al, "Sharing and Protection in a Single-Address-Space Operating System", ACM Trans. Computer Systems, pp. 271-307, Nov. 1994.*
24 *P. Amaral, et al, "A model for persistent shared memory addressing in distributed systems", IWOOOS'92, Chorus Systems, Sep. 1992.*
25 *S. Jagannathan, et al, "A Reseach Prospectus for Advanced Software Systems", NEC Research Institute, 1995.*
26 *Y. Jiang, et al, "Integrating Parallel Functions into the Manipulation for Distributed Persistent Objects", IEEE, pp. 76-82, 1996.*
Referenced by
Citing PatentFiling datePublication dateApplicantTitle
US7028299 *Jun 30, 2000Apr 11, 2006Intel CorporationTask-based multiprocessing system
US7110373 *Dec 23, 2002Sep 19, 2006Lg Electronics Inc.Apparatus and method for controlling memory for a base station modem
US7130840 *May 30, 2001Oct 31, 2006Matsushita Electric Industrial Co., Ltd.Information recording medium, information recording method, information recording apparatus, information reproducing method, and information reproducing apparatus
US7213098 *Feb 11, 2002May 1, 2007Sun Microsystems, Inc.Computer system and method providing a memory buffer for use with native and platform-independent software code
US7269613Apr 21, 2006Sep 11, 2007Matsushita Electric Industrial Co., Ltd.Information recording medium, information recording method, information recording apparatus, information reproducing method and information reproducing apparatus
US7330907 *Oct 2, 2003Feb 12, 2008Internet Associates, LlcMethods, computer systems, and computer readable media for controlling the status of network address space
US7401196 *Oct 11, 2005Jul 15, 2008Hitachi, Ltd.Storage system and storage control method for access exclusion control of each storage area unit comprising storage area of storage device
US7437390Apr 21, 2006Oct 14, 2008Matsushita Electric Industrial Co., Ltd.Information recording medium, information recording method, information recording apparatus, information reproducing method and information reproducing apparatus
US7450420May 8, 2006Nov 11, 2008Sandisk CorporationReclaiming data storage capacity in flash memories
US7480766 *Aug 3, 2005Jan 20, 2009Sandisk CorporationInterfacing systems operating through a logical address space and on a direct data file basis
US7509333Apr 21, 2006Mar 24, 2009Panasonic CorporationInformation recording medium, information recording method, information recording apparatus, information reproducing method and information reproducing apparatus
US7539989Oct 12, 2004May 26, 2009International Business Machines CorporationFacilitating intra-node data transfer in collective communications
US7552271Jul 21, 2006Jun 23, 2009Sandisk CorporationNonvolatile memory with block management
US7558881 *Jan 9, 2008Jul 7, 2009Internet Associates, LlcMethods, computer systems, and computer readable media for controlling the status of network address space
US7558905May 8, 2006Jul 7, 2009Sandisk CorporationReclaiming data storage capacity in flash memory systems
US7558906Jul 21, 2006Jul 7, 2009Sandisk CorporationMethods of managing blocks in nonvolatile memory
US7562181Aug 2, 2006Jul 14, 2009Sandisk CorporationFlash memory systems with direct data file storage utilizing data consolidation and garbage collection
US7581057May 8, 2006Aug 25, 2009Sandisk CorporationMemory system with management of memory blocks that directly store data files
US7590794Aug 2, 2006Sep 15, 2009Sandisk CorporationData operations in flash memories utilizing direct data file storage
US7590795Aug 2, 2006Sep 15, 2009Sandisk CorporationFlash memory systems utilizing direct data file storage
US7610437Aug 2, 2006Oct 27, 2009Sandisk CorporationData consolidation and garbage collection in direct data file storage memories
US7627733Aug 3, 2005Dec 1, 2009Sandisk CorporationMethod and system for dual mode access for storage devices
US7669003 *Jul 21, 2006Feb 23, 2010Sandisk CorporationReprogrammable non-volatile memory systems with indexing of directly stored data files
US7680987 *Mar 29, 2006Mar 16, 2010Emc CorporationSub-page-granular cache coherency using shared virtual memory mechanism
US7739406Jun 10, 2009Jun 15, 2010Internet Associates, LlcControlling the status of network address space
US7747837Dec 21, 2005Jun 29, 2010Sandisk CorporationMethod and system for accessing non-volatile storage devices
US7769978Dec 21, 2005Aug 3, 2010Sandisk CorporationMethod and system for accessing non-volatile storage devices
US7793068Dec 21, 2005Sep 7, 2010Sandisk CorporationDual mode access for non-volatile storage devices
US7844781Feb 23, 2006Nov 30, 2010International Business Machines CorporationMethod, apparatus, and computer program product for accessing process local storage of another process
US7877539Feb 16, 2005Jan 25, 2011Sandisk CorporationDirect data file storage in flash memories
US7900011 *Jul 19, 2007Mar 1, 2011International Business Machines CorporationApparatus, system, and method for improving system performance in a large memory heap environment
US7949845Jul 21, 2006May 24, 2011Sandisk CorporationIndexing of file data in reprogrammable non-volatile memories that directly store data files
US7975018Jul 7, 2005Jul 5, 2011Emc CorporationSystems and methods for providing distributed cache coherence
US8046759 *Aug 26, 2005Oct 25, 2011Hewlett-Packard Development Company, L.P.Resource allocation method and system
US8055832May 8, 2006Nov 8, 2011SanDisk Technologies, Inc.Management of memory blocks that directly store data files
US8117615May 5, 2009Feb 14, 2012International Business Machines CorporationFacilitating intra-node data transfer in collective communications, and methods therefor
US8209516Feb 26, 2010Jun 26, 2012Sandisk Technologies Inc.Method and system for dual mode access for storage devices
US8438341Jun 16, 2010May 7, 2013International Business Machines CorporationCommon memory programming
US8650278Jun 23, 2011Feb 11, 2014Internet Associates, LlcGenerating displays of networking addresses
US8825903Apr 29, 2010Sep 2, 2014Infoblox Inc.Controlling the status of network address space
US8832234Mar 29, 2012Sep 9, 2014Amazon Technologies, Inc.Distributed data storage controller
US8832411Dec 14, 2011Sep 9, 2014Microsoft CorporationWorking set swapping using a sequentially ordered swap file
US8918392 *Mar 29, 2012Dec 23, 2014Amazon Technologies, Inc.Data storage mapping and management
US8930364Mar 29, 2012Jan 6, 2015Amazon Technologies, Inc.Intelligent data integration
US8935203Mar 29, 2012Jan 13, 2015Amazon Technologies, Inc.Environment-sensitive distributed data management
US8972696Mar 7, 2011Mar 3, 2015Microsoft Technology Licensing, LlcPagefile reservations
US20120137282 *Jul 1, 2011May 31, 2012Covia Labs, Inc.System method and model for social synchronization interoperability among intermittently connected interoperating devices
US20140066034 *Aug 26, 2013Mar 6, 2014Pantech Co., Ltd.Apparatus and method for displaying callback information
Classifications
U.S. Classification718/104, 711/E12.068, 719/312
International ClassificationG06F12/10
Cooperative ClassificationG06F12/109
European ClassificationG06F12/10S
Legal Events
DateCodeEventDescription
Jul 15, 2011FPAYFee payment
Year of fee payment: 8
Jul 13, 2007FPAYFee payment
Year of fee payment: 4
Mar 10, 1997ASAssignment
Owner name: INTERNATIONAL BUSINESS MACHINES CORPORATION, NEW Y
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:MUNROE, STEVEN J.;PLAETZER, SCOTT ALAN;STOPYRO, JAMES WILLIAM;REEL/FRAME:008514/0616;SIGNING DATES FROM 19961220 TO 19970304 | __label__pos | 0.666502 |
Difference between revisions of "JEG Reproducible Video Quality Analysis Framework"
From VQEG JEG Wiki
Jump to: navigation, search
Line 43: Line 43:
First of all, the source content should be placed in (DATA/SRC). The current scripts deal with three resolutions (960x544, 1280x720, and 1920x1080).
First of all, the source content should be placed in (DATA/SRC). The current scripts deal with three resolutions (960x544, 1280x720, and 1920x1080).
In the first module (Large-scale encoding environment), the file has to be run (SoftwareLibraries/ENC\_SRC/ENC\_lin.py) to generate and encode the whole coding conditions (ENC\_win.py is a Windows script). The `.265' and `.txt' output files will be placed in (DATA/ENC). The `.265' is the bitstream file and the `.txt' is the encoding information.
+
In the first module (Large-scale encoding environment), the file has to be run (SoftwareLibraries/ENC_SRC/ENC_lin.py) to generate and encode the whole coding conditions (ENC_win.py is a Windows script). The `.265' and `.txt' output files will be placed in (DATA/ENC). The `.265' is the bitstream file and the `.txt' is the encoding information.
===Step 2: Quality measure===
===Step 2: Quality measure===
The quality measure module calculates the objective quality measure by running `SoftwareLibraries/DEC.py'. The software will firstly decode the bitstream file (.265 file) and then uses the (SoftwareLibraries/VQMT\_Binaries/VQMT.exe) to calculate the PSNR, SSIM, and VIF quality measures and saves the output per frame and in average in separate files in the (DATA/QUAL) folder.
+
The quality measure module calculates the objective quality measure by running `SoftwareLibraries/DEC.py'. The software will firstly decode the bitstream file (.265 file) and then uses the (SoftwareLibraries/VQMT_Binaries/VQMT.exe) to calculate the PSNR, SSIM, and VIF quality measures and saves the output per frame and in average in separate files in the (DATA/QUAL) folder.
The final step in this module is to run `SoftwareLibraries/AggregatePSNRtoCSV.py' to aggregate all the quality measures in two files; one keeps sequence-level records, see part and the second keeps the sequence and the frame levels records.
The final step in this module is to run `SoftwareLibraries/AggregatePSNRtoCSV.py' to aggregate all the quality measures in two files; one keeps sequence-level records, see part and the second keeps the sequence and the frame levels records.
Revision as of 09:05, 2 June 2017
Contents
Main idea
The work on this page presents a framework to facilitate reproducibility of research in video quality evaluation. Its initial version is built around the JEG-Hybrid database of HEVC coded video sequences. The framework is modular, organized in the form of pipelined activities, which range from the tools needed to generate the whole database from reference signals up to the analysis of the video quality measures already present in the database. Researchers can rerun, modify and extend any module, starting from any point in the pipeline, while always achieving perfect reproducibility of the results. The modularity of the structure allows to work on subsets of the database since for some analysis this might be too computationally intensive. To this purpose, the framework also includes a software module to compute interesting subsets, in terms of coding conditions, of the whole database.
Software Architecture
The software consists of a pipeline architecture where each active component communicates to the other component using directories. Each individual component will be explained next.
SoftwareArchitectureReproducibleFramework.png
Large scale encoding environment
The large scale encoding environment performs the Hypothetical Reference Circuit (HRC) processing. At this moment, this module consists of the HEVC standardization reference encoding package (http://hevc.kw.bbc.co.uk/svn/jctvc-a124/tags/HM-11.1/) accompanied by a valuable set of configuration files and scripts in order to reproduce or extend the first version of the HEVC large scale database. Whenever the proposed video quality analysis framework needs improvement with more compression standards, other compression parameters, or network impairment simulations, then solely this block must be extended upon.
The correct creation or download of the large-scale database can be verified by SHA512 checksums available at: (ftp://ivc.univ-nantes.fr/VQEG/JEG/HYBRID/hevc_database/sha512_hashas_for_hevc_database_enc.txt.bz2).
Subset selection
This process facilitates the research work if a proper HRCs are selected to represent a large-scale database. Therefore, this component consists of two algorithms for subset selection. The first one is optimized to cover different ranges of quality and bitrate. The second algorithm is optimized for HRCs that behave differently with different source contents. The two algorithms are demonstrated in the accompanying DSP paper.
Quality measure
The quality measurement component consists of a collection of full reference quality measurements like Peak Signal-to-Noise Ratio (PSNR), Structural Similarity (SSIM), Multi-Scale Structural Similarity (MS-SSIM), and Visual Information Fidelity (VIFp). These measurements are integrated in this Reproducible Video Quality Analysis software package using the Video Quality Measurement Tool (VQMT) from Ecole Polytechnique Fédérale de Lausanne (EPFL).
Quality measure analysis
The quality measure analysis focuses on extracting the relevant data from the full reference quality measurement database and process them in order to perform the analysis. In this particular work we extracted frame-level MSE and PSNR values to compare the effect of temporal pooling through averaging either MSE or PSNR. Moreover, the variance of the frame-level PSNR is also computed and made available for the next visualization block. The module can be easily customized to handle different measures either present in the database or made available through files in the same format. Moreover, other indicators (e.g., moving averages etc., can be included in the output for the visualization block.
Visualization
The visualization block is currently a set of gnuplot command files that can be used to easily visualize the data produced in the previous step. In particular, they can automatically generate scatter plots and, with the aid of some custom-developed external modules, interpolation parameters for better visualization.
Running the software
The package contains scripts that are written in different language environments but can be executed under Linux and Windows platforms.
The software package contains 2 directories `DATA' and `SoftwareLibraries'. `DATA' directory contains sub directories that contains the source data and the outputs of running the softwares that can be found in `SoftwareLibraries'.
Step 1: Large Scale Encoding Environment
First of all, the source content should be placed in (DATA/SRC). The current scripts deal with three resolutions (960x544, 1280x720, and 1920x1080).
In the first module (Large-scale encoding environment), the file has to be run (SoftwareLibraries/ENC_SRC/ENC_lin.py) to generate and encode the whole coding conditions (ENC_win.py is a Windows script). The `.265' and `.txt' output files will be placed in (DATA/ENC). The `.265' is the bitstream file and the `.txt' is the encoding information.
Step 2: Quality measure
The quality measure module calculates the objective quality measure by running `SoftwareLibraries/DEC.py'. The software will firstly decode the bitstream file (.265 file) and then uses the (SoftwareLibraries/VQMT_Binaries/VQMT.exe) to calculate the PSNR, SSIM, and VIF quality measures and saves the output per frame and in average in separate files in the (DATA/QUAL) folder.
The final step in this module is to run `SoftwareLibraries/AggregatePSNRtoCSV.py' to aggregate all the quality measures in two files; one keeps sequence-level records, see part and the second keeps the sequence and the frame levels records.
Subset selection
Quality measure analysis | __label__pos | 0.565779 |
• frank
1.8k
Is infinity properly thought of as a number? Is it a quantity? Is that the same question?
• fdrake
1.5k
There are a few different conceptions of infinity in mathematics.
There's what the usual infinity symbol represents: , which usually denotes a limiting process: , IE what value tends to when becomes arbitrarily large. Formally this corresponds to a definition of a limit and can be considered shorthand for it.
Then you've got cardinal numbers, which count how many of something there are. The smallest infinite cardinal is called , which is the size of the set of natural numbers . Then there are ordinal numbers, which agree with cardinal numbers up to and can disagree beyond that - they correspond to different ways of ordering infinite sets of things. For example, the standard ordering of is given the symbol , which denotes its order type. If you removed 42 from and stuck it on the end (after the infinity of numbers), you'd have the same set of elements but it would look like , and this is given the order type . You can separate out the odds and evens similarly and end up with . This operations allow you to define standard arithmetic operations on infinities relating to orders, and similarly for cardinals.
In the first case, infinity is a shorthand for a limiting process (the infinity is hidden in the quantifier 'for all epsilon'), in the second case infinite objects are referred to explicitly.
• frank
1.8k
in the second case infinite objects are referred to explicitly.fdrake
Does that mean that in the second case "infinite" is being used as a quantity?
• fdrake
1.5k
In the first case it's easier to think of as a direction. In the second case - for cardinals - they give the size of infinite sets, so yes they are probably quantities since they represent the magnitude of something.
• Gustavo Fontinelli
3
Following the "default definition", quantity stands for the magnitude of countable and reducible things. I mean, in a geometric view, would be like distance, the space between the initial and the final point. When you're counting something, you're presuming that there's a limit and when you reach the limit you'll be known the quantity.
Also, a x quantity of filler stuff fill in a x quantity of fillable things.
For example, two shoes fits in a box, if you increase the quantity of shoes to 3 shoes, it won't fit any more because it crosses the limit, it can also happen in the negative way. The thing is that with you have an infinitely large box, with an infinite amount of shoes in, no matter how many shoes you take off from the box, it won't change nothing. So talking about quantity doesn't make sense any more.
• alan1000
27
"Limiting processes" tend to have a somewhat uneasy relationship with the axioms of Set Theory and Peano Arithmetic which underlie damn near everything about number theory. If you are talking about aleph-null infinities then, of course, every aleph-null infinity has a precise numeric value (though this value is impossible to identify).
• fdrake
1.5k
Is this a criticism of the epsilon-delta and epsilon-N convergence/continuity criteria?
• alan1000
27
Not at all; I am trying to tread a delicate line between "mathematics" and "mathematical philosophy". Most non-mathematicians, and even many mathematicians, conceive of mathematics as the quintessential, monolithic embodiment of perfect rationalism, the ultimate logical system; and of course, it isn't. There are many logical grey areas, even at basic levels. For example, is 0.9... equal to 1? Or is it the largest real number which is less than 1? There are persuasive mathematical arguments on both sides.
"The wise man doubts often, and his views are changeable; the fool is constant in his opinions, and doubts nothing, because he knows everything, except his own ignorance" (Pharaoh Akhenaton).
• fdrake
1.5k
Ok. Well epsilon-N implies 0.9 recurring = 1 anyway. AFAIK it's even true in non-standard analysis. 1 - infinitesimal isn't the same thing as 0.9 recurring.
• AngleWyrm
66
No, infinity is not a quantity it is a direction on any scale in which it is listed as a measurement.
East is not a location, destination, or even an obtainable goal. It is a direction relative to the current position and might more properly be stated as "east of here," wherever here may be, in the same sense that x + 1 is not an absolute quantity but instead something greater than x.
• Count Radetzky von Radetz
28
From a Hegelian perspective, I would rationally perceive infinity not as a quantity.
• Mr Phil O'Sophy
966
1. A quantity is a specified amount of something. It has a limit. The infinite is that which has no limits and so cannot be quantified. Therefore, not a quantity as not quantifiable.
2. Infinity is not limited to numbers (because it has no limit). if you say infinity is only a number you have broken the law of none contradiction as you have put a limit on something defined as having no limits. Therefore, infinity contains numbers but numbers do not contain infinity as numbers are limited to number.
• MindForged
563
1. A quantity is a specified amount of something. It has a limit. The infinite is that which has no limits and so cannot be quantified. Therefore, not a quantity as not quantifiable.
This is just... no. Look, even if I take your definition of quantity, I can easily show infinity is a quantity. Take the set of Natural Numbers (o, 1, 2, 3...). In set theory, the concept of "size" is formalized as what is known as "cardinality". The cardinality (size) of the set of Natural Numbers is infinity, specifically aleph-null. QED. You can say the Natural Numbers have "no limit" in the sense that it can always get bigger, but that doesn't mean it's impossible to quantify.
2. Infinity is not limited to numbers (because it has no limit). if you say infinity is only a number you have broken the law of none contradiction as you have put a limit on something defined as having no limits. Therefore, infinity contains numbers but numbers do not contain infinity as numbers are limited to number.
A better way to think about it is there are different kinds of infinite numbers, some larger or smaller than others. The set of Real numbers, for instance, is a larger infinity than the infinity of the Natural numbers. Cantor proved this with a proof by contradiction. No one is contradicting themselves saying there are infinite quantities.
• Mr Phil O'Sophy
966
This is just... no. Look, even if I take your definition of quantity, I can easily show infinity is a quantity. Take the set of Natural Numbers (o, 1, 2, 3...). In set theory, the concept of "size" is formalized as what is known as "cardinality". The cardinality (size) of the set of Natural Numbers is infinity, specifically aleph-null. QED. You can say the Natural Numbers have "no limit" in the sense that it can always get bigger, but that doesn't mean it's impossible to quantify.MindForged
The thing you missed here is the unspoken inference you make. The cardinality of the set of Natural Numbers is not infinity (which is defined as having no limits) as by referring to Natural Numbers you are limiting it to Natural Numbers alone. You are not including anything which is not a Natural Number, it does not include different colours, shapes, texture etc. It is a concept limited to that which is considered a natural number.
You can say that the numbers have no end.. or could go on forever.. or go on indefinitely.. but you cannot refer to them as infinite as you contradict yourself by describing them as such. As they are limited... to Natural Numbers. I am aware that mathematicians are fond of using the word infinite, but I would argue that its an illogical thing to do. As I think I have sufficiently shown.
A better way to think about it is there are different kinds of infinite numbers, some larger or smaller than othersMindForged
No because then you're not talking about the infinite any more.
Consider the following:
1. There are two infinite numbers, A and B
2. A is not B, and B is not A.
3. A is larger than B.
this isn't a description of something without limits. You are specifically saying that A is limited to A and does not include B. And that B is limited to B and does not include A. These are limits.
You can say it has no limits in one specific sense but has limits in others, but then you are not referring to the infinite or to a limitless thing anymore.
No one is contradicting themselves saying there are infinite quantities.MindForged
You are if you are saying this thing has no limits when it defined within the specific limits of Real or Natural numbers as in the examples you gave. You are therefore saying that this thing is both limited and not limited simultaneously. Which is a contradiction. It cannot be A and ~A.
• GreenPhilosophy
11
You can add 1 to any real number, so infinity isn't a real number. Infinity is a concept.
• jorndoe
625
Colloquially, infinite is a quantity that's not a number, .
But it's ambiguous (hence the ).
As it turns out there's more than one infinite, there are infinitely many different infinites, no less (Cantor).
Anyway, Dedekind and Tarski came up with different (general) definitions that can be shown equivalent.
• fishfry
469
You can separate out the odds and evens similarly and end up with ω+ω = 2ω.fdrake
Very nice post.
A quibble. I just happen to be brushing up on ordinal arithmetic this week. Ordinal multiplication is defined backwards from our intuition in my opinion. is defined to be copies of concatenated.
So for example means copies of 2 strung together. The ordinal 2 represents the order 0, 1. If you line up of those, you get ... drum roll ... .
On the other hand, is two copies of side-by-side. You can visualize this as 0, 2, 4,6 , 8,...,1, 3, 5, 7, ... the evens-before-odds order. That's .
Other than that quibble, great post.
https://en.wikipedia.org/wiki/Ordinal_arithmetic#Multiplication
• tom
1.5k
You can add 1 to any real number, so infinity isn't a real number. Infinity is a concept.GreenPhilosophy
Nothing to prevent you from adding 1 to infinity.
• Mr Phil O'Sophy
966
Nothing to prevent you from adding 1 to infinity.tom
Yes there is. If it is Infinity then it should already contain the 1 you’re attempting to add to it. If it doesn’t contain that 1 being added then it’s not infinity, as it is limited to not containing the 1 you are adding. This means what you are calling ‘infinity’ is not limitless at all and so not worthy of the title.
• tom
1.5k
Yes there is. If it is Infinity then it should already contain the 1 you’re attempting to add to it. If it doesn’t contain that 1 being added then it’s not infinity, as it is limited to not containing the 1 you are adding. This means what you are calling ‘infinity’ is not limitless at all and so not worthy of the title.Mr Phil O'Sophy
Seriously, you can even add infinity to infinity. Plenty of cases where that happens in mathematics.
• Mr Phil O'Sophy
966
Seriously, you can even add infinity to infinity. Plenty of cases where that happens in mathematics.tom
I understand that mathematics uses the concept of multiple infinities. I’ve been exposed to the idea before.
I’m saying that I fundementally disagree with it. What ever they are adding is more worthy of the title ‘indefinite’ than infinity.
As I said before. If you try to have more than one infinity then you create a problem.
Infinity is boundless, without limit, Etc.
If you have two infinity’s, A & B, then you are saying that in order to add infinity A to infinity B that A does not contain B. Which is to say that both A and B are limited or bounded to A and only A or B and only B.
This making two infinity’s then leads to the logical conclusion that it is an indefinite number; an undisclosed amount that is limited to not containing that which you wish to add to it; not an infinite quantity as the mathematitions like to insist.
• tom
1.5k
I understand that mathematics uses the concept of multiple infinities. I’ve been exposed to the idea before.Mr Phil O'Sophy
Do you understand though?
I’m saying that I fundementally disagree with it. What ever they are adding is more worthy of the title ‘indefinite’ than infinity.Mr Phil O'Sophy
So, we have established that you DON'T understand it.
As I said before. If you try to have more than one infinity then you create a problem.Mr Phil O'Sophy
Repeating an error ad infinitum does not correct it.
Infinity is boundless, without limit, Etc.Mr Phil O'Sophy
And some of those are bigger, infinitely bigger, than the others.
If you have two infinity’s, A & B, then you are saying that in order to add infinity A to infinity B that A does not contain B. Which is to say that both A and B are limited or bounded to A and only A or B and only BMr Phil O'Sophy
You have never studied mathematics.
This making two infinity’s then leads to the logical conclusion that it is an indefinite number; an undisclosed amount that is limited to not containing that which you wish to add to it; not an infinite quantity as the mathematitions like to insist.Mr Phil O'Sophy
Indefinite in number, you say.
• Mr Phil O'Sophy
966
You haven’t actually confronted my rebuttal, only used an appeal to authority fallacy a kin to ‘the mathematitions disagree with you so you’re wrong’.
So it would appear that I understand the problem more than you do, unless of course you can demonstrate why i’m wrong, which so far you haven’t.
Simply agreeing with authority without actually confronting the argument being made against it ad infinitum is not itself an argument.
You have never studied mathematicstom
Yes I have.
Indefinite in number, you say.tom
Yes, that’s something that algebra can also deal with. Unspecified (or indefinite) quantities such as x + y = z
Please feel free to actually deal with the argument. I’m genuinely interested to hear a counter argument, which you have failed to offer so far.
:p
• tom
1.5k
You haven’t actually confronted my rebuttal, only used an appeal to authority fallacy a kin to ‘the mathematitions disagree with you so you’re wrong’.Mr Phil O'Sophy
You have no rebuttal short of "I don't understand this".
So it would appear that I understand the problem more than you do, unless of course you can demonstrate why i’m wrong, which so far you haven’t.Mr Phil O'Sophy
So it's you versus Cantor?
Simply agreeing with authority without actually confronting the argument being made against it ad infinitum is not itself an argument.Mr Phil O'Sophy
Demonstrating your lack of comprehension does not constitute an argument.
Yes I have.Mr Phil O'Sophy
Primary school doesn't count.
Please feel free to actually deal with the argument. I’m genuinely interested to hear a counter argument, which you have failed to offer so far.Mr Phil O'Sophy
You don't have an argument.
• Mr Phil O'Sophy
966
My education isn’t limited to primary school .
And you still haven’t explained what i’m not comprehending.
If you don’t want to do any philosophy and just commit to the appeal to authority fallacy while repeating the whole ‘nah nah you’re wrong’ thing that’s fine. I won’t waste my time with you ;) Enjoy your day.
• GreenPhilosophy
11
Infinity isn't a real number, but it is an extended real number. Infinity can be used to describe infinite things, such as an infinitely sized universe.
By the way, I'm pretty bad at math, so don't take my word for it. I should just stop before I spread false information.
• MindForged
563
The thing you missed here is the unspoken inference you make. The cardinality of the set of Natural Numbers is not infinity (which is defined as having no limits) as by referring to Natural Numbers you are limiting it to Natural Numbers alone. You are not including anything which is not a Natural Number, it does not include different colours, shapes, texture etc. It is a concept limited to that which is considered a natural number.
How was it unspoken if I literally said the assumption (the the natural numbers are infinite)? That aside, you aren't making sense. That the natural numbers do no, for instance, include the Real Numbers does not entail that the set of Natural Numbers is not infinity. In mathematics, infinity is not (as you claimed) defined as "having no limits". In this case that's especially obvious, because by "limit" you're already sneaking in the assumption of finitude (e.g. the natural numbers are finite, somehow, because the set doesn't include other types of numbers). This argument makes no sense.
You can say that the numbers have no end.. or could go on forever.. or go on indefinitely.. but you cannot refer to them as infinite as you contradict yourself by describing them as such. As they are limited... to Natural Numbers. I am aware that mathematicians are fond of using the word infinite, but I would argue that its an illogical thing to do. As I think I have sufficiently shown.
No because then you're not talking about the infinite any more.
Consider the following:
1. There are two infinite numbers, A and B
2. A is not B, and B is not A.
3. A is larger than B.
this isn't a description of something without limits. You are specifically saying that A is limited to A and does not include B. And that B is limited to B and does not include A. These are limits.
You can say it has no limits in one specific sense but has limits in others, but then you are not referring to the infinite or to a limitless thing anymore.
You are simply ignoring the definition of infinity that mathematicians use and thereby conclude that it's incoherent because of we assumed your definition we'd get a contradiction. QED, your definition is wrong because it leads to a contradiction. That's ridiculous.
Your argument makes an obvious assumption, namely that all infinite sets are of the same size That's quite literally rejected in mathematics. Infinite sets which are countable, like the natural numbers, have the ability to be put into a one-to-one correspondence with a proper subset of themselves, e.g. we can map all the even numbers onto the set of natural numbers. Uncountably infinite sets (e.g. the reals) cannot do this mapping with the natural numbers, entailing that such sets are larger. Your definition leaves no real ability to use infinity in mathematically useful ways, e.g. Calculus.
You are if you are saying this thing has no limits when it defined within the specific limits of Real or Natural numbers as in the examples you gave. You are therefore saying that this thing is both limited and not limited simultaneously. Which is a contradiction. It cannot be A and ~A.
Incorrect. The natural numbers are the counting numbers, so they do no include the reals. That does not entail the Natural Numbers have a finite *cardinality*, it simply means the set of natural numbers leaves out particular types of numbers. This simply means the set of natural numbers has a particular size of infinity.
• Relativist
491
It comes down to semantics. Infinity can be considered a quantity in terms of transfinite math - so there are actually many "infinities" (aleph-0 is less than aleph-1; there are "more" real numbers than integers). But it's not a quantity in a sense that it corresponds to anything that exists in the material world.
• MindForged
563
I would say that space and time exist, and both are generally thought to be infinite.
• Relativist
491
The existence of an actual infinity (vs a potential infinity) is controversial among philosophers. I'm of the opinion an actual infinity cannot exist. I feel strongest about the impossibility of an infinite past, because that would entail a completed infinity: how could infinitely many days have passed?
Physicists accept the possibility of infinity in space and time simply because there is no known law of nature that rules it out. That doesn't imply the philosophical analysis is wrong, it just means that we don't know of any particular limits.
My opinions are consistent with the dominant opinion among philosophers prior to Cantor's set theory, but that doesn't seem like a very good reason to believe an actual infinity exists in the world.
• MindForged
563
A lot of this, in my estimation, doesn't make sense under scrutiny.
I'm of the opinion an actual infinity cannot exist. I feel strongest about the impossibility of an infinite past, because that would entail a completed infinity: how could infinitely many days have passed?
Um, before every day there is another day. QED. Or to put it more directly, the cardinality of the set of days prior to day "n" can be put into a one-to-one correspondence with the members of the set of natural numbers. Ergo, the number of past days are infinite. I don't know if this is actually true, but there is no logical argument against the *possibility* of it.
However, this wasn't even really what I was suggesting. Between any two moments of time there's another moment. That's what I had in mind. And it's even clearer with the divisibility of space. It's nearly always taken to be a continuum, meaning it would be infinitely divisible.
That doesn't imply the philosophical analysis is wrong, it just means that we don't know of any particular limits
What philosophical analysis? If we are adopting perfectly standard mathematics (or even most non-standard math systems) there is no contradiction whatsoever in supposing the past days are infinite. This will play into a bigger point I make at the end.
My opinions are consistent with the dominant opinion among philosophers prior to Cantor's set theory, but that doesn't seem like a very good reason to believe an actual infinity exists in the world.
I hope it doesn't come across rude, but that just reads as "If you ignore the last 150 years of mathematics most philosophers would agree with me". Well that's... a defense anyone can make to defend their belief in whatever.
Look, my broader issue/point is this. The interplay between our beliefs about the world and the formal tools (maths, logics) is more complex than often made out (i.e. the influence goes both ways). However, generally the idea is that our physics needs math to guide it's conjectures, and our beliefs about the world ought to be in line with the dominant physical theories. If maths has explicated infinity as a coherent, precise concept - and it has - then presumably it becomes irrational to say (as I understand you to be saying) that "Yea yea, there's infinity in mathematics and in physics, but if you try to apply it to real things it entails a contradiction." I just don't get it.
Infinity is not a contradictory concept, so how is it supposed to produce a contradiction if applied to real things? Or is it supposed to be a category mistake? But how does that work? We talk about infinite collections in mathematics all the time, it's central to set theory. That doesn't mean infinite collections (or other infinite whatevers) can exist in our universe, just that you cannot rule them out as incoherent and thus fail to obtain in every possible universe.
bold
italic
underline
strike
code
quote
ulist
image
url
mention
reveal
youtube
tweet
Add a Comment
Welcome to The Philosophy Forum!
Get involved in philosophical discussions about knowledge, truth, language, consciousness, science, politics, religion, logic and mathematics, art, history, and lots more. No ads, no clutter, and very little agreement — just fascinating conversations. | __label__pos | 0.843827 |
Publicidad
ES
Descargar Inno Setup 5.3.6
Inno Setup 5.3.6
Por Jordan Russell (Open Source)
Valoración de los usuarios
Publicidad
# Windows 7 change:
- Added new [Setup] section directive: UninstallDisplaySize. On Windows 7 and newer, Setup uses this directive to set the EstimatedSize value in the Uninstall registry key when possible since the Windows 7 Add/Remove Programs Control Panel (called Program and Features) no longer automatically calculates it. If an UninstallDisplaySize is not set, Setup estimates the size itself by taking the size of all files installed and adding any ExtraDiskSpaceRequired values set. Note: Windows 7 only supports the display of values smaller than 4 GB.
# Pascal Scripting now supports IUnknown based COM. Previously it only supported IDispatch based COM but a growing number of Windows API functions are COM based without implementing the IDispatch interface, and you can now use these as well. See the new CodeAutomation2.iss example script for an example. Note: this is only supported by Unicode Inno Setup at the moment, because of Delphi 2's limitations (Delphi 2 is used to compile Non Unicode Inno Setup):
- Added StringToGUID, CreateComObject, and OleCheck support functions.
- Added HResult, TGUID, TCLSID, and TIID support types.
# The compiler no longer allows a single LanguageCodePage directive to be applied to multiple languages at once. If you were using this to force Non Unicode Setup to allow the user to select any language regardless of the system code page, set [Setup] section directive ShowUndisplayableLanguages to yes instead.
# Added new CodePrepareToInstall.iss example script.
# Fix: Unicode Pascal scripting: passing a very long string to Format caused an error.
# Minor tweaks.
¿En qué consiste la garantía de protección de FileHippo?
Close
Sabemos lo importante que resulta mantenerse seguro en la red, y por ello FileHippo utiliza la tecnología de escaneado de virus que Avira proporciona para asegurar que todas las descargas realizadas por medio de FileHippo son seguras. Es seguro instalar en tu dispositivo el programa que estás a punto de descargar. | __label__pos | 0.812417 |
blob: 91154d82aae6de5f1206413215c0ca9caead6e41 [file] [log] [blame]
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "courgette/base_test_unittest.h"
#include <string>
#include "base/basictypes.h"
#include "courgette/courgette.h"
#include "courgette/streams.h"
#include "courgette/third_party/bsdiff.h"
class VersioningTest : public BaseTest {
public:
void TestApplyingOldBsDiffPatch(const char* src_file,
const char* patch_file,
const char* expected_file) const;
};
void VersioningTest::TestApplyingOldBsDiffPatch(
const char* src_file,
const char* patch_file,
const char* expected_file) const {
std::string old_buffer = FileContents(src_file);
std::string new_buffer = FileContents(patch_file);
std::string expected_buffer = FileContents(expected_file);
courgette::SourceStream old_stream;
courgette::SourceStream patch_stream;
old_stream.Init(old_buffer);
patch_stream.Init(new_buffer);
courgette::SinkStream generated_stream;
courgette::BSDiffStatus status = courgette::ApplyBinaryPatch(
&old_stream, &patch_stream, &generated_stream);
EXPECT_EQ(status, courgette::OK);
size_t expected_length = expected_buffer.size();
size_t generated_length = generated_stream.Length();
EXPECT_EQ(generated_length, expected_length);
EXPECT_EQ(0, memcmp(generated_stream.Buffer(),
expected_buffer.c_str(),
expected_length));
}
TEST_F(VersioningTest, BsDiff) {
TestApplyingOldBsDiffPatch("setup1.exe", "setup1-setup2.v1.bsdiff",
"setup2.exe");
TestApplyingOldBsDiffPatch("chrome64_1.exe", "chrome64-1-2.v1.bsdiff",
"chrome64_2.exe");
// We also need a way to test that newly generated patches are appropriately
// applicable by older clients... not sure of the best way to do that.
} | __label__pos | 0.795049 |
A simplified Device Identifier and Device DNA AXI read IP for PYNQ
Dear all,
I am sharing a simple DNA IP without HLS and pure Verilog coding.
This example is targeted ZYNQ 7000 series.
This can be read via Python MMIO script.
DNA is an unique ID preprogrammed onto each FPGA and can be used to identify the device for production or development board logging in University and Corporation.
ENJOY~
1 Like | __label__pos | 0.906856 |
Unity 2D – How to anchor a sprite to the left side of the camera viewport
using UnityEngine;
using System.Collections;
public class ActualHeroController : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float camHalfHeight = Camera.main.orthographicSize;
float camHalfWidth = Camera.main.aspect * camHalfHeight;
Bounds bounds = GetComponent().bounds;
// Set a new vector to the top left of the scene
Vector3 topLeftPosition = new Vector3(-camHalfWidth, 0, 0) + Camera.main.transform.position;
// Offset it by the size of the object
topLeftPosition += new Vector3(bounds.size.x / 2,-bounds.size.y / 2, 0);
topLeftPosition.z = 0;
transform.position = topLeftPosition;
}
}
Leave a Reply
Your email address will not be published. Required fields are marked *
This site uses Akismet to reduce spam. Learn how your comment data is processed. | __label__pos | 0.985575 |
If (x + 1)(x + 2)(x + 3)(x + 6) = 3x^2, then the equation has
Rearrange:
Rearrange the equation by subtracting what is to the right of the equal sign from both sides of the equation : (x+1)*(x+2)*(x+3)*(x+6)-(168*x^2)=0
Step by step solution :
Step 1 :
Equation at the over of step 1 :
((((x+1)•(x+2))•(x+3))•(x+6))-(23•3•7x2) = 0
Step 2 :
Equation at the kết thúc of step 2 : (((x+1)•(x+2)•(x+3))•(x+6))-(23•3•7x2) = 0
Step 3 :
Equation at the over of step 3 : ((x+1)•(x+2)•(x+3)•(x+6))-(23•3•7x2) = 0
Step 4 :
Equation at the end of step 4 : (x+1)•(x+2)•(x+3)•(x+6)-(23•3•7x2) = 0
Step 5 :
Polynomial Roots Calculator :
5.1 Find roots (zeroes) of : F(x) = x4+12x3-121x2+72x+36Polynomial Roots Calculator is a set of methods aimed at finding values ofxfor which F(x)=0 Rational Roots thử nghiệm is one of the above mentioned tools. It would only find Rational Roots that is numbers x which can be expressed as the quotient of two integersThe Rational Root Theorem states that if a polynomial zeroes for a rational numberP/Q then p is a factor of the Trailing Constant and Q is a factor of the Leading CoefficientIn this case, the Leading Coefficient is 1 and the Trailing Constant is 36. The factor(s) are: of the Leading Coefficient : 1of the Trailing Constant : 1 ,2 ,3 ,4 ,6 ,9 ,12 ,18 ,36 Let us kiểm tra ....
Bạn đang xem: If (x + 1)(x + 2)(x + 3)(x + 6) = 3x^2, then the equation has
PQP/QF(P/Q)Divisor
-11 -1.00 -168.00
-21 -2.00 -672.00
-31 -3.00-1512.00
-41 -4.00-2700.00
-61 -6.00-6048.00
-91 -9.00-12600.00
-121-12.00-18252.00
-181-18.00-5472.00
-361-36.00960372.00
11 1.00 0.00x-1
21 2.00 -192.00
31 3.00 -432.00
41 4.00 -588.00
61 6.00 0.00x-6
91 9.00 6192.00
121 12.0024948.00
181 18.00137088.00
361 36.002085300.00
The Factor Theorem states that if P/Q is root of a polynomial then this polynomial can be divided by q*x-p chú ý that q and p originate from P/Q reduced khổng lồ its lowest terms In our case this means that x4+12x3-121x2+72x+36can be divided by 2 different polynomials,including by x-6
Polynomial Long Division :
5.2 Polynomial Long Division Dividing : x4+12x3-121x2+72x+36("Dividend") By:x-6("Divisor")
dividendx4+12x3-121x2+72x+36
-divisor* x3x4-6x3
remainder18x3-121x2+72x+36
-divisor* 18x218x3-108x2
remainder-13x2+72x+36
-divisor* -13x1-13x2+78x
remainder-6x+36
-divisor* -6x0-6x+36
remainder0
Quotient : x3+18x2-13x-6 Remainder: 0
Polynomial Roots Calculator :
5.3 Find roots (zeroes) of : F(x) = x3+18x2-13x-6See theory in step 5.1 In this case, the Leading Coefficient is 1 and the Trailing Constant is -6. The factor(s) are: of the Leading Coefficient : 1of the Trailing Constant : 1 ,2 ,3 ,6 Let us thử nghiệm ....
Xem thêm: Phim Đấu Phá Thương Khung Phần 5 Bao Giờ Ra Mắt, Đấu Khí Đại Lục
PQP/QF(P/Q)Divisor
-11 -1.00 24.00
-21 -2.00 84.00
-31 -3.00 168.00
-61 -6.00 504.00
11 1.00 0.00x-1
21 2.00 48.00
31 3.00 144.00
61 6.00 780.00
The Factor Theorem states that if P/Q is root of a polynomial then this polynomial can be divided by q*x-p lưu ý that q and phường originate from P/Q reduced to its lowest terms In our case this means that x3+18x2-13x-6can be divided with x-1
Polynomial Long Division :
5.4 Polynomial Long Division Dividing : x3+18x2-13x-6("Dividend") By:x-1("Divisor")
dividendx3+18x2-13x-6
-divisor* x2x3-x2
remainder19x2-13x-6
-divisor* 19x119x2-19x
remainder6x-6
-divisor* 6x06x-6
remainder0
Quotient : x2+19x+6 Remainder: 0
Trying to factor by splitting the middle term
5.5Factoring x2+19x+6 The first term is, x2 its coefficient is 1.The middle term is, +19x its coefficient is 19.The last term, "the constant", is +6Step-1 : Multiply the coefficient of the first term by the constant 1•6=6Step-2 : Find two factors of 6 whose sum equals the coefficient of the middle term, which is 19.
Xem thêm: Sơ Cứu Khi Gặp Người Tai Nạn Gãy Xương Cần Làm Gì ? Gặp Người Bị Tai Nạn Gãy Xương Ta Cần Làm Gì
-6+-1=-7
-3+-2=-5
-2+-3=-5
-1+-6=-7
1+6=7
2+3=5
3+2=5
6+1=7
Observation : No two such factors can be found !! Conclusion : Trinomial can not be factored
Equation at the kết thúc of step 5 :
(x2 + 19x + 6) • (x - 1) • (x - 6) = 0
Step 6 :
Theory - Roots of a sản phẩm :6.1 A product of several terms equals zero.When a hàng hóa of two or more terms equals zero, then at least one of the terms must be zero.We shall now solve each term = 0 separatelyIn other words, we are going to lớn solve as many equations as there are terms in the productAny solution of term = 0 solves hàng hóa = 0 as well.
Parabola, Finding the Vertex:6.2Find the Vertex ofy = x2+19x+6Parabolas have a highest or a lowest point called the Vertex.Our parabola opens up and accordingly has a lowest point (AKA absolute minimum).We know this even before plotting "y" because the coefficient of the first term,1, is positive (greater than zero).Each parabola has a vertical line of symmetry that passes through its vertex. Because of this symmetry, the line of symmetry would, for example, pass through the midpoint of the two x-intercepts (roots or solutions) of the parabola. That is, if the parabola has indeed two real solutions.Parabolas can model many real life situations, such as the height above ground, of an object thrown upward, after some period of time. The vertex of the parabola can provide us with information, such as the maximum height that object, thrown upwards, can reach. For this reason we want khổng lồ be able to find the coordinates of the vertex.For any parabola,Ax2+Bx+C,the x-coordinate of the vertex is given by -B/(2A). In our case the x coordinate is -9.5000Plugging into the parabola formula -9.5000 for x we can calculate the y-coordinate:y = 1.0 * -9.50 * -9.50 + 19.0 * -9.50 + 6.0 or y = -84.250
Parabola, Graphing Vertex and X-Intercepts :
Root plot for : y = x2+19x+6 Axis of Symmetry (dashed) x=-9.50 Vertex at x,y = -9.50,-84.25 x-Intercepts (Roots) : Root 1 at x,y = -18.68, 0.00 Root 2 at x,y = -0.32, 0.00
Solve Quadratic Equation by Completing The Square
6.3Solvingx2+19x+6 = 0 by Completing The Square.Subtract 6 from both side of the equation :x2+19x = -6Now the clever bit: Take the coefficient of x, which is 19, divide by two, giving 19/2, and finally square it giving 361/4Add 361/4 to lớn both sides of the equation :On the right hand side we have:-6+361/4or, (-6/1)+(361/4)The common denominator of the two fractions is 4Adding (-24/4)+(361/4) gives 337/4So adding lớn both sides we finally get:x2+19x+(361/4) = 337/4Adding 361/4 has completed the left hand side into a perfect square :x2+19x+(361/4)=(x+(19/2))•(x+(19/2))=(x+(19/2))2 Things which are equal to lớn the same thing are also equal to one another. Sincex2+19x+(361/4) = 337/4 andx2+19x+(361/4) = (x+(19/2))2 then, according lớn the law of transitivity,(x+(19/2))2 = 337/4We"ll refer to lớn this Equation as Eq. #6.3.1 The Square Root Principle says that When two things are equal, their square roots are equal.Note that the square root of(x+(19/2))2 is(x+(19/2))2/2=(x+(19/2))1=x+(19/2)Now, applying the Square Root Principle to Eq.#6.3.1 we get:x+(19/2)= √ 337/4 Subtract 19/2 from both sides to obtain:x = -19/2 + √ 337/4 Since a square root has two values, one positive and the other negativex2 + 19x + 6 = 0has two solutions:x = -19/2 + √ 337/4 orx = -19/2 - √ 337/4 chú ý that √ 337/4 can be written as√337 / √4which is √337 / 2
Solve Quadratic Equation using the Quadratic Formula
6.4Solvingx2+19x+6 = 0 by the Quadratic Formula.According to lớn the Quadratic Formula,x, the solution forAx2+Bx+C= 0 , where A, B & C are numbers, often called coefficients, is given by :-B± √B2-4ACx = ————————2A In our case,A= 1B= 19C= 6 Accordingly,B2-4AC=361 - 24 =337Applying the quadratic formula : -19 ± √ 337 x=——————2 √ 337 , rounded to lớn 4 decimal digits, is 18.3576So now we are looking at:x=(-19± 18.358 )/2Two real solutions:x =(-19+√337)/2=-0.321 or:x =(-19-√337)/2=-18.679
Solving a Single Variable Equation:6.5Solve:x-1 = 0Add 1 to lớn both sides of the equation:x = 1
Solving a Single Variable Equation:6.6Solve:x-6 = 0Add 6 lớn both sides of the equation:x = 6
Four solutions were found :
x = 6x = 1x =(-19-√337)/2=-18.679 x =(-19+√337)/2=-0.321 | __label__pos | 0.969515 |
Parameters | Expression Parameters | Transposed Output Data Set
Transposed Output Data Set
The Transposed Output Data Set field is used to specify a name for the transposed output SAS data set.
If no name is specified here, the name of the input data set, with _xxxt appended as a suffix, is specified by default.
Note : The suffix appended to the transposed output data set is _xxxt , where xxx is the suffix normally appended to the standard, non-transposed output data set created for the particular process.
For detailed information about the files and data sets used or created by JMP Life Sciences software, see Files and Data Sets .
To Specify a Name for the Transposed Output Data Set:
*
*
For example, in the Domain Incidence Indicators process, type Nicardipine_Results in the text field, as shown below:
The resulting data set is named: Nicardipine_Results_diit.sas7bdat . | __label__pos | 0.99727 |
Dividing Fractions Calculator
Including Whole and Mixed Numbers
[ Skip to Calculator ] Calcy pointing down
The Dividing Fractions Calculator on this page will divide any combination of fraction, mixed number, or whole number.
This free online divide fractions calculator is handy for dividing fractions, dividing fractions and mixed numbers, and dividing fractions by whole numbers. And in all cases the calculator will restate the quotient fraction in simplest form.
Plus, unlike other online fraction calculators, this Dividing Fractions Calculator will show its work and give a detailed step-by-step explanation as to how it arrived at the calculated quotient.
Also, if you're ever unsure if the fraction you're dividing by is greater or less than the fraction you are dividing into, be sure to check out my fraction comparison calculator.
How to Divide Fractions
While fraction division has one more step than fraction multiplication, it is still much easier than adding and subtracting fractions -- because there is no need to worry about the denominators being like or unlike.
Instead, all you need to do is invert (flip upside down) the divisor (second term in the division equation) and change the sign from division (÷) to multiplication (x), then multiply the dividend (first term in the division equation) by the inverted divisor.
To complete the fraction division you simply multiply the numerators of each fraction to get a new numerator and then multiply the denominators of each fraction to get a new denominator -- regardless of whether the denominators are different or the same.
The following illustrates how you would divide a dividend of 1/2 by a divisor of 1/3:
Step #1: Invert the Divisor
1÷ 1 = 1 x 3
2 3 2 1
Step #2: Multiply Dividend by Inverted Divisor
1 x 3 = 3 = 1 1
2 1 2 2
Dividing Fractions and Mixed Numbers
If you need to divide a fraction by a mixed number, you first need to convert the mixed number to an improper fraction. To do that, you simply multiply the denominator by the whole number and add that product to the value of the numerator. That result then becomes the numerator of the improper fraction, while the denominator remains the same.
To illustrate, here is how you would convert the mixed number 2 1/3 (two and one third) into an improper fraction:
Converting a Mixed Number to a Fraction
2 1 = 3 x 2 + 1 = 7
3 33
Once you have converted the mixed number to an improper fraction, you simply divide the fractions as normal. Of course, the dividing fractions calculator will do all of this for you with the click of the "Calculate Fraction Division" button.
Dividing Fractions By Whole Numbers
Here again, in order to divide a fraction by a whole number you first need to convert the whole number into an improper fraction. To do that you simply place the whole number over the number 1 (any non-zero number divided by 1 is equal to the number), like this:
Converting a Whole Number to a Fraction
4 = 4
1
Once you have converted the whole number into an improper fraction, you simply divide the fractions as explained earlier.
With that, let's use the Dividing Fractions Calculator to divide any combination of a fraction, a mixed number, or a whole number, and then simplify the result.
Dividing Fractions Calculator
Calcy sign introducing Dividing Fractions Calculator
Instructions: Enter the whole number, numerator (top) and the denominator (bottom) of the dividend.
Next, enter the whole number, numerator and denominator of the divisor, and then click the "Calculate Fraction Division" button.
Note that for the dividend or the divisor you can either enter a whole number only, a mixed number, or a fraction only. The dividing fractions calculator will automically detect which type you entered.
Mouse over the blue question marks for a further explanation of each entry field. More in-depth explanations can be found in the glossary of terms located beneath the Dividing Fractions Calculator.
Important: This first version of the calculator is not designed to work with negative signs, so please limit your entries to positive numbers. You can then use the rule of dividing negative numbers to apply a sign to the result.
Help Dividend Help Divisor
Whole # Fraction Whole # Fraction
Help Numerators (#): ÷
Help Denominators (#):
Help Quotient of fractions, whole, or mixed numbers:
Mathway Algebra Calculator
Dividing Fractions Calculator Glossary of Terms
Calcy magnifying glass
Check Out My Other Super
Online Math Calculators
To Help You To
Solve and Learn ...
Super Calcy
Dividend: The first term in the division equation. If the dividend is a whole number only, leave the numerator and denominator blank. If the dividend is a mixed number, enter a positive integer for the whole number, the numerator, and denominator. If the dividend is a fraction only, leave the whole number field blank.
Divisor: The second term in the division equation. If the divisor is a whole number only, leave the numerator and denominator blank. If the divisor is a mixed number, enter a positive integer for the whole number, the numerator, and denominator. If the divisor is a fraction only, leave the whole number field blank.
Numerators: Enter the top number for the dividend if it contains a fraction and enter the top number for the divisor if it contains a fraction. Leave the numerator and denominator fields blank for any dividend or divisor that is a whole number only.
Denominators: Enter the bottom number for the dividend if it contains a fraction and enter the bottom number for the divisor if it contains a fraction. Leave the numerator and denominator fields blank for any dividend or divisor that is a whole number only.
Quotient of fractions, whole, or mixed numbers: This is the result of dividing the entered fractions, mixed numbers, and/or whole numbers. After inverting the divisor and calculating the quotient of fractions, the dividing fractions calculator will show its work and give a detailed explanation of each step it took to arrive at the quotient.
Mixed number: The combination of a whole number and a fraction, such as 3 1/4 (three and one quarter).
Improper fraction: A fraction having a numerator that is larger than the denominator, such as 5/3.
Multiplicand: The first factor in a multiplication. In the equation 1/3 x 1/2, 1/3 would be the multiplicand.
Multiplier: The second factor in a multiplication. In the equation 1/3 x 1/2, 1/2 would be the multiplier.
Product: The result of multiplying the multiplicand by the multiplier.
[ Return to Top of Calculator ] [ Return to Top of Page ] Calcy pointing up
> > Dividing Fractions Calculator
+1 Free-Online-Calculator-Use.com
+1 Page Site
Help
Protected by Copyscape Online Plagiarism Detection
AhaCalcs.com Logo Look!
It's ... Super Version!
• Save your calculator entries between visits and devices!
• Ad-free!
• And more!
Super Version Info
Get the book that changed my life!
Follow me on any of the social media sites below and be among the first to get a sneak peek at the newest and coolest calculators that are being added or updated each month.
Monthly What's New Email Update!
Who knows if I will show up in your next search. This will insure you'll always know what I've been up to and where you can find me!
Email
Name
Then
Don't worry -- your e-mail address is totally secure.
I promise to use it only to send you Whats New.
Online Pocket Calc
Help
Online math problem solver image
Find a Local Math Tutor Today | __label__pos | 0.537308 |
We use cookies to personalise content and advertisements and to analyse access to our website. Furthermore, our partners for online advertising receive pseudonymised information about your use of our website. cookie policy and privacy policy.
+0
+3
82
2
avatar+979
How many real numbers are not in the domain of the function\(f(x) = \frac{1}{x-64} + \frac{1}{x^2-64} + \frac{1}{x^3-64}\)?
EDIT: What I've tried:
-Making an X-Y table
-using DESMOS
-Asking Tutor(who said try an x-y table)
-Asking mom
-Looking it up online
-Sleeping on it
Torquise= not really helpful in my experience
Jul 1, 2019
edited by tommarvoloriddle Jul 1, 2019
edited by tommarvoloriddle Jul 1, 2019
#1
avatar+5589
+3
\(\text{No dividing by zero. So }\\ x=64, ~x = \pm 8,~x = 4\\ \text{are all excluded from the domain}\)
.
Jul 1, 2019
#2
avatar+979
+5
:) Thank You!
tommarvoloriddle Jul 1, 2019
4 Online Users
avatar | __label__pos | 0.653591 |
summaryrefslogtreecommitdiff
path: root/src/lib (follow)
AgeCommit message (Collapse)Author
2019-11-05ecore-wl2: Move ecore_wl2_window_damage function to be internalChristopher Michael
As this function is only used in 1 place and will likely never be used outside of the modular dmabuf engine, we can move it to be internal only. ref T8013
2019-11-05ecore-wl2: Move variables to be above functionsChristopher Michael
NB: No functional changes
2019-11-05evas_textblock: content fit featureAli Alzyod
Summary: **Content Fit Feature for Evas_Object_Textblock** This Feature is available at **Evas **object level. And **Edje **level (where it is internally use evas functionality) This feature will allow text block to fit its content font size to proper size to fit its area. **Main Properties:** Fit Modes : None=Default, Width, Height, All [Width+Height] Fit Size Range : Contains maximum and minimum font size to be used (and in between). Fit Step Size : Step(Jump) value when trying fonts sizes between Size_Range max and min. Fit Size Array : Other way to resize font, where you explicitly select font sizes to be uses (for example [20, 50, 100] it will try 3 sizes only) Text Fit feature was available in Edje but: 1- It doesn't effected by ellipsis or warping in font style (or do not handle the in right way) 2- Accuracy is not good (specially if you have fix pixel size elements (spaces,tabs,items)) 3- No (Step size, Size Array) available. Test Plan: To check the Feature > elementary_test > fit > textbock fit You can modify all the modes and properties These are two examples, One using Evas other uses Edje **Evas** ``` #include <Elementary.h> enum BUTTON{ BUTTON_MODE = 0, BUTTON_MAX = 1, BUTTON_MIN = 2, BUTTON_STEP = 3, BUTTON_ARRAY = 4, BUTTON_CONTENT = 5, BUTTON_STYLE = 6, BUTTON_ALL = BUTTON_STYLE+1, }; char* BUTTON_STR[BUTTON_ALL] ={ "MODE", "MAX", "MIN", "STEP", "ARRAY", "CONTENT", "STYLE", }; char *contents[] = { "Hello World", "This is Line<br>THis is other Line", "This text contains <font_size=20 color=#F00>SPECIFIC SIZE</font_size> that does not effected by fit mode" }; char *styles[] = { "DEFAULT='font=sans font_size=30 color=#000 wrap=mixed ellipsis=1.0'", "DEFAULT='font=sans font_size=30 color=#000 wrap=mixed'", "DEFAULT='font=sans font_size=30 color=#000 ellipsis=1.0'", "DEFAULT='font=sans font_size=30 color=#000'", }; char *styles_names[] = { "wrap=<color=#F00>mixed</color> ellipsis=<color=#F00>1.0</color>", "wrap=<color=#F00>mixed</color> ellipsis=<color=#F00>NONE</color>", "wrap=<color=#F00>NONE</color> ellipsis=<color=#F00>1.0</color>", "wrap=<color=#F00>NONE</color> ellipsis=<color=#F00>NONE</color>", }; typedef struct _APP { Evas_Object *win, *box, *txtblock,*bg, *boxHor, *boxHor2; Eo *btn[BUTTON_ALL]; Eo *lbl_status; char * str; unsigned int i_contnet, i_style; } APP; APP *app; char * get_fit_status(Eo * textblock); static void _btn_clicked(void *data EINA_UNUSED, Eo *obj, void *eventInfo EINA_UNUSED){ if (obj == app->btn[BUTTON_MODE]) { unsigned int options; evas_textblock_fit_options_get(app->txtblock, &options); if (options == TEXTBLOCK_FIT_MODE_NONE) evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_HEIGHT); else if (options == TEXTBLOCK_FIT_MODE_HEIGHT) evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_WIDTH); else if (options == TEXTBLOCK_FIT_MODE_WIDTH) evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_ALL); else if (options == TEXTBLOCK_FIT_MODE_ALL) evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_NONE); } else if (obj == app->btn[BUTTON_MAX]) { unsigned int min, max; evas_textblock_fit_size_range_get(app->txtblock, &min, &max); max -= 5; evas_textblock_fit_size_range_set(app->txtblock, min, max); } else if (obj == app->btn[BUTTON_MIN]) { unsigned int min, max; evas_textblock_fit_size_range_get(app->txtblock, &min, &max); min += 5; evas_textblock_fit_size_range_set(app->txtblock, min, max); } else if (obj == app->btn[BUTTON_STEP]) { unsigned int step; evas_textblock_fit_step_size_get(app->txtblock, &step); step++; evas_textblock_fit_step_size_set(app->txtblock, step); } else if (obj == app->btn[BUTTON_ARRAY]) { unsigned int font_size[] = {10, 50, 100 ,150}; evas_textblock_fit_size_array_set(app->txtblock,font_size,4); } else if (obj == app->btn[BUTTON_CONTENT]) { app->i_contnet++; if(app->i_contnet>=sizeof(contents)/sizeof(char*)) app->i_contnet=0; evas_object_textblock_text_markup_set(app->txtblock,contents[app->i_contnet]); } else if (obj == app->btn[BUTTON_STYLE]) { app->i_style++; if(app->i_style>=sizeof(styles)/sizeof(char*)) app->i_style=0; Evas_Textblock_Style *style = evas_object_textblock_style_get(app->txtblock); evas_textblock_style_set(style,styles[app->i_style]); } elm_object_text_set(app->lbl_status, get_fit_status(app->txtblock)); } char * get_fit_status(Eo * textblock) { static char status[0xFFF]; unsigned int options,min,max,step,size_array[256]; size_t size_array_len; evas_textblock_fit_options_get(textblock,&options); evas_textblock_fit_size_range_get(textblock,&min,&max); evas_textblock_fit_step_size_get(textblock,&step); evas_textblock_fit_size_array_get(textblock,NULL,&size_array_len,0); if (size_array_len>255) size_array_len = 255; evas_textblock_fit_size_array_get(textblock,size_array,NULL,size_array_len); strcpy(status,"Mode : "); if (options == TEXTBLOCK_FIT_MODE_NONE) strcat(status,"MODE_NONE"); else if (options == TEXTBLOCK_FIT_MODE_HEIGHT) strcat(status,"MODE_HEIGHT"); else if (options == TEXTBLOCK_FIT_MODE_WIDTH) strcat(status,"MODE_WIDTH"); else if (options == TEXTBLOCK_FIT_MODE_ALL) strcat(status,"MODE_ALL"); strcat(status,"<br>"); sprintf(status + strlen(status),"Max : %d<br>",max); sprintf(status + strlen(status),"Min : %d<br>",min); sprintf(status + strlen(status),"Step : %d<br>",step); sprintf(status + strlen(status),"Array : [ "); for (size_t i = 0 ; i < 10 ; i++) { if(i<size_array_len) sprintf(status + strlen(status)," %d,",size_array[i]); } if(10<size_array_len) sprintf(status + strlen(status)," ... "); sprintf(status + strlen(status)," ]"); sprintf(status + strlen(status),"<br>"); sprintf(status + strlen(status),"%s",styles_names[app->i_style]); return status; } int elm_main(int argc, char **argv) { app = calloc(sizeof(APP), 1); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); app->win = elm_win_util_standard_add("Main", "App"); elm_win_autodel_set(app->win, EINA_TRUE); app->box = elm_box_add(app->win); app->boxHor = elm_box_add(app->box); app->boxHor2 = elm_box_add(app->box); app->txtblock = evas_object_textblock_add(app->box); app->bg = elm_bg_add(app->box); elm_bg_color_set(app->bg,255,255,255); Evas_Textblock_Style *style = evas_textblock_style_new(); evas_textblock_style_set(style,styles[0]); evas_object_textblock_style_set(app->txtblock,style); evas_object_textblock_text_markup_set(app->txtblock,contents[0]); elm_box_horizontal_set(app->boxHor, EINA_TRUE); elm_box_horizontal_set(app->boxHor2, EINA_TRUE); evas_object_size_hint_weight_set(app->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(app->box, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(app->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(app->box, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(app->txtblock); evas_object_show(app->bg); evas_object_show(app->box); evas_object_show(app->boxHor); evas_object_show(app->boxHor2); elm_box_pack_end(app->box, app->bg); elm_box_pack_end(app->box, app->boxHor); elm_box_pack_end(app->box, app->boxHor2); elm_object_content_set(app->bg,app->txtblock); elm_win_resize_object_add(app->win, app->box); evas_object_resize(app->win, 320, 480); for(int i = 0 ; i < BUTTON_ALL ; i++) { app->btn[i] = elm_button_add(app->boxHor); evas_object_smart_callback_add(app->btn[i], "clicked", _btn_clicked, NULL); elm_object_text_set(app->btn[i], BUTTON_STR[i]); elm_box_pack_end(app->boxHor, app->btn[i]); evas_object_show(app->btn[i]); } app->lbl_status = elm_label_add(app->boxHor2); elm_object_text_set(app->lbl_status, get_fit_status(app->txtblock)); elm_box_pack_end(app->boxHor2, app->lbl_status); evas_object_show(app->lbl_status); evas_object_size_hint_weight_set(app->txtblock, EVAS_HINT_EXPAND,EVAS_HINT_EXPAND); evas_object_size_hint_align_set(app->txtblock, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(app->bg, EVAS_HINT_EXPAND,EVAS_HINT_EXPAND); evas_object_size_hint_align_set(app->bg, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(app->win); elm_run(); return 0; } ELM_MAIN() ``` **Edje** ``` // compile: edje_cc source.edc // run: edje_player source.edje collections { styles { style { name: "text_style"; base: "font=sans font_size=30 color=#FFF wrap=mixed ellipsis=1.0"; tag: "br" "\n"; tag: "ps" "ps"; tag: "tab" "\t"; tag: "b" "+ font_weight=Bold"; } } group { name: "my_group"; // must be the same as in source.c parts { part { name: "background"; type: RECT; scale: 1; description { color: 0 0 0 0; rel1.relative: 0.0 0.0; rel2.relative: 1.0 1.0; } } part { name: "text"; type: TEXTBLOCK; scale: 1; entry_mode: NONE; effect: OUTLINE_SHADOW; description { state: "default" 0.0; rel1.to : "background"; rel1.relative: 0.0 0.0; rel2.to : "background"; rel2.relative: 1.0 1.0; text { style: "text_style"; align: 0.0 0.0; text: "Hello World This is Me"; fit: 1 1; fit_step: 1; size_range: 30 200; //fit_size_array: 20 40 60 80 100 200; } } } } } } ``` Found Task T5724 relative to this Feature Reviewers: woohyun, bowonryu, cedric, raster Subscribers: #committers, #reviewers, cedric Tags: #efl Differential Revision: https://phab.enlightenment.org/D9280
2019-11-05docs: Efl.Ui.Table_StaticXavi Artigas
The need for this class is still being discussed in https://phab.enlightenment.org/T8206 but at least it is a bit more clear what its purpose is.
2019-11-05evas filter: Implement inverse color filterShinwoo Kim
Summary: This is the first version of inverse color filter both GL and SW. Test Plan: 1. Create filter_example with following . efl_gfx_filter_program_set(image, "inverse_color ()", "inverse color"); 2. Run. ./filter_example (Use ELM_ACCEL=gl for GL engine) Reviewers: Hermet, jsuya Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10335
2019-11-04docs: Polish Efl.Canvas.Animation_Group and sonsXavi Artigas
Summary: These docs were almost empty. Reviewers: bu5hm4n, zmike, cedric, Jaehyun_Cho Reviewed By: cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10564
2019-11-04efl_canvas_animation: improve generallyMarcel Hollerbach
Summary: to be taken over by doccop Depends on D10559 Reviewers: Jaehyun_Cho, bu5hm4n Reviewed By: bu5hm4n Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10560
2019-11-04docs: Polish Efl.Canvas.Animation_*Xavi Artigas
Summary: These docs were lacking a lot of detail. Depends on D10562 Reviewers: bu5hm4n, cedric, zmike, Jaehyun_Cho Reviewed By: cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10565
2019-11-04efl_canvas_animation_translate: move from x&y to container typesMarcel Hollerbach
Summary: this now uses Eina.Position2D so its easier to pass arround other positions. ref T8288 Depends on D10559 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8288 Differential Revision: https://phab.enlightenment.org/D10562
2019-11-04efl_canvas_animation_scale: move from 2 doubles to vectorsMarcel Hollerbach
Summary: with this the passing of positions is getting more easy. Additionally, Reading the API call gets easier, as parameters are semantically grouped. Depends on D10558 Reviewers: segfaultxavi, Jaehyun_Cho Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8288 Differential Revision: https://phab.enlightenment.org/D10559
2019-11-04efl_canvas_animation: be more explicit with errorsMarcel Hollerbach
Summary: with this commit invalid values are not accepted silently anymore. But rather a error will be raised. Depends on D10350 Reviewers: segfaultxavi, Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8288 Differential Revision: https://phab.enlightenment.org/D10558
2019-11-04efl_canvas_animation_rotate: adjust APIMarcel Hollerbach
Summary: in task T8288 we concluded that a few APIs need to be adjusted in order to stabelize animation classes at some point. This also adds a new macro to eina in order to create EINA_VECTOR2 values more easily. ref T8288 Reviewers: Jaehyun_Cho, segfaultxavi, zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8288 Differential Revision: https://phab.enlightenment.org/D10350
2019-11-01Revert "elm/genlist: don't process entire item queue on each item add"Carsten Haitzler (Rasterman)
First - the big problem. This breaks enlightenment's bluez5 popup. it does a sortyed inert using the item data and the item data for one of the itmes to compare in _cb_insert_cmp() in e_mod_popup.c when it calls elm_object_item_data_get(0 returns a junk ptr for the item data after this patch. i haven't managed to figure out exactly why in my last 30 mins of looking. But a closer look... this disables immediate processing of: 1. the first block of items (32items) which was intended so for short/small lists you have some content by the time you go to the first frame, and at least the first block of itso you seem to have visual contnt and not a blank list until idlers can process further content. so the patch being reverted would have gotten rid of this logic that gets you content as opposed to blank: while ((sd->queue) && ((!sd->blocks) || (!sd->blocks->next))) 2. if it's a homogenous list, all items have the same size so we do have to realize the first item of each class type but ONLY that one. further items should not need realizing as we can ASSUME the height to be the same as the first item... that's the point of homogenous + compress lists - all items of the same class have the same height and width thus shortcutting further need to calculate nd realize. if we are reizing everything in a homogenous list then the issue lies with something going wrong with this above logic. we shokuld be able to handle such lists super fastif this logic was working. that's the 2nd while: while ((sd->queue) && (sd->blocks) && (sd->homogeneous) && (sd->mode == ELM_LIST_COMPRESS)) so overall, this should not have been realizing every item. either just the first block of 32, OR just the first item of any class and thus assume all further items are the same size without realizing being needed. if these broke then the solution is not commenting this out but finding out why this logic is breaking :) and not to mention... this commenting out also caused segfaults in existing applications which are doing the right thing. perhaps the sorting logic also needed updating as well if this above is commented out... but i didn't have time to chase it more than this. --- This reverts commit 0777b74f07857c86408bc0929e3391ced0e098e4.
2019-11-01ecore_event: Remove unused goto defineJunsuChoi
Summary: For remove -Wunused-label warning Test Plan: N/A Reviewers: Hermet, kimcinoo, YOhoho Reviewed By: YOhoho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10584
2019-10-31efl: fix include due to stale files.Cedric BAIL
Reviewers: zmike Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10583
2019-10-31efl_ui_text: remove elm_general.eotYeongjong Lee
Summary: remove legacy dependency in eo file. Test Plan: ninja Reviewers: woohyun, Jaehyun_Cho, zmike Reviewed By: zmike Subscribers: zmike, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10580
2019-10-31evas: move watching over destruction of device to custom logic due to high use.Cedric Bail
Summary: This specific EFL_EVENT_DEL handler was registered thousand of time alone on an Evas device. Potential solution are to improve handling of this kind of large scale callback logic or just not take that path. I find it easier to have a custom code in this case to handle the destruction of Evas device and avoid this thousand of callback. Depends on D10492 Reviewers: zmike, raster, bu5hm4n, Hermet Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10493
2019-10-31evas: deprecate evas_device_parent_set.Cedric Bail
Summary: It is unlikely that the code was working before and it was a bad idea anyway. There is no user of this API in EFL. Depends on D10490 Reviewers: zmike, raster, bu5hm4n, Hermet Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10491
2019-10-31evas: move exposed internal structure of Efl_Input_Device to be private.Cedric Bail
Summary: Depends on D10489 Reviewers: zmike, raster, bu5hm4n, Hermet Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10490
2019-10-31evas: move efl_input_device into evas/Efl_Canvas.hCedric Bail
Summary: The internal and the API we would like is mostly a canvas API. A lot of the code in evas is working around the fact that efl_input_device is not defined inside Evas. This patch is the first step to try to clean this up. Depends on D10487 Reviewers: zmike, raster, bu5hm4n, Hermet Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10488
2019-10-31eo_base_class: move shift init to the first callMarcel Hollerbach
Summary: this cannot be evalulated in compile time, so this must be evalulated in runtime, at the first call. This should fix OSX build. Co-authored-by: Cedric Bail <[email protected]> Reviewers: zmike, cedric, raster Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10582
2019-10-31eo: add debug ability to detect long chain of event handler.Cedric Bail
Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10484
2019-10-31eo: reduce memory use to track event registration and callback call.Cedric Bail
Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10482
2019-10-31ecore: remove custom code for generating Eina_Future_Schedule attached on ↵Cedric Bail
Efl.Loop. This leverage the new infrastructure from Eo that provide a scheduler for any event attached to any object. Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10481
2019-10-31eo: add infrastructure to attach an Eina_Future_Scheduler to any source of ↵Cedric Bail
event. Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10480
2019-10-31eina: only the type need to be NULL to assume EINA_VALUE_EMPTY.Cedric Bail
This avoid comparison with potentially uninitialized byte. Reviewed-by: Mike Blumenkrantz <[email protected]> Differential Revision: https://phab.enlightenment.org/D10479
2019-10-31ecore: remove unecessary code for Eina_Future scheduler.Cedric Bail
As we do not rely on legacy Ecore Event directly anymore, we do not need to mind the shutting down of EFL. Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10477
2019-10-31ecore: remove unecessary field in data structure.Cedric Bail
Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10476
2019-10-31eo: prevent unecessary callback call walk.Cedric Bail
This patch introduce a small hash (64 or 32bits) that cache all existing Efl_Event_Description callback handler registered on an object. It slightly reduce the time needed to do an unecessary call and cost just a few bytes per object. Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10475
2019-10-31elementary: handle case when XFIXES is not available.Cedric Bail
Summary: ECORE_X_EVENT_FIXES_SELECTION_NOTIFY is only initialized when XFIXES is available. If ecore_event_handler_add is called with type == 0, it will trigger an abort and elementary would not initialize properly. Depends on D10491 Reviewers: zmike, raster, bu5hm4n, Hermet Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10492
2019-10-31edje: load edje seat callback only when necessary.Cedric Bail
Summary: This reduce in elementary_test the number of callback registered on the canvas from hundreds to around 10. Depends on D10486 Reviewers: zmike, raster, bu5hm4n, Hermet Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10487
2019-10-31edje: improve callback count on Evas canvas.Cedric Bail
Summary: This reduce by 3 the amount of callback registered on the canvas. Another potential improvement would be to only register those callback if someone is listening for a 'seat,*' event or if the edje file define seat filters. Depends on D10484 Reviewers: zmike, raster, bu5hm4n, Hermet Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10486
2019-10-31evas - revert evas variation sequence support - out of bound accessesCarsten Haitzler (Rasterman)
This code is filled with out of bounds accesses now after the reverted patch. All those base_char+1, itr+1 etc. in evas_common_font_query_run_font_end_get() are accessing BEYOND the end of the run. textgrid shows this instantly to fall over as it uses single unicode codepoint chars with no nul terminator. As this api takes an explicit run_len we should never access beyond the end of the run_len. Please revisit this code and keep in mind proper memory/bounds accessing. If there was ano run_len and it assumed strings were regular strings that had to be nul terminated... then it might be ok, but not here. of course if i put in guards for these +1's then it ends up in infintie loops, so enough debugging and send it back for a rethink. :) .... Revert "evas_object_textblock: add support for variation sequences" This reverts commit 46f2d8acdcda3f374c9e393ecb734ff9d00fef7d.
2019-10-30ecore/timer: correctly handle recursive deletion of legacy timersMike Blumenkrantz
if a legacy timer callback returns false, the timer is deleted. in the case where the legacy timer is deleted inside the callback while the same timer is ticking recursively, however, the deletion must be deferred until the outer-most frame of the timer's callstack has returned from the callback in order to avoid improperly handling the timer @fix Reviewed-by: Cedric BAIL <[email protected]> Differential Revision: https://phab.enlightenment.org/D10545
2019-10-30evas/font: simplify handling strings when constructing font namesMike Blumenkrantz
no need to strcpy here when we can just pass the length to stringshare directly CID 1382854 Reviewed-by: Cedric BAIL <[email protected]> Differential Revision: https://phab.enlightenment.org/D10441
2019-10-30efl_ui: mark Efl.Ui.Focus.Autoscroll_Mode betaMike Blumenkrantz
this cannot currently be used for anything and was not explicitly stabilized Reviewed-by: Cedric BAIL <[email protected]> Differential Revision: https://phab.enlightenment.org/D10540
2019-10-30efl_ui: remove Efl.Ui.Slider_Indicator_Visible_ModeMike Blumenkrantz
this cannot be used for anything and serves no purpose Reviewed-by: Cedric BAIL <[email protected]> Differential Revision: https://phab.enlightenment.org/D10539
2019-10-30eina: make use of the new near allocation policy for Eina_List.Cedric BAIL
The idea is to improve memory locality and hopefully get better cache hit in general. Reviewed-by: Mike Blumenkrantz <[email protected]> Differential Revision: https://phab.enlightenment.org/D10536
2019-10-30eina: introduce an API for requesting memory near already allocated memory ↵Cedric BAIL
from an Eina_Mempool. Reviewed-by: Mike Blumenkrantz <[email protected]> Differential Revision: https://phab.enlightenment.org/D10535
2019-10-30elm/widget: error on null params for tree_unfocusable functionsMike Blumenkrantz
Summary: these should error so the user can detect that they screwed up Reviewers: devilhorns Reviewed By: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10563
2019-10-30edje_calc: Remove unused flag.Woochanlee
Summary: This has marked remove me. Reviewers: raster, Hermet, zmike, devilhorns Reviewed By: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10561
2019-10-29eina: add comparison macros for Eina_Size2D and Eina_Position2DMike Blumenkrantz
Summary: I'm tired of typing all this out. it's exhausting. also add a couple usages internally to verify that this works as expected @feature Reviewers: cedric, bu5hm4n, devilhorns Reviewed By: devilhorns Subscribers: devilhorns, bu5hm4n, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10557
2019-10-29interfaces: replace doubles with Efl.Gfx.Align where appropriateMike Blumenkrantz
Summary: this makes the types more explicit Depends on D10554 Reviewers: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10555
2019-10-29efl/gfx: add Efl.Gfx.Align typeMike Blumenkrantz
Summary: this can be used to more explicitly specify that a double is intended to be a value of 0.0 to 1.0 for the purpose of aligning objects. it also avoids the need to copy and paste the same docs around everywhere Reviewers: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10554
2019-10-29meson: redo evas buildingMarcel Hollerbach
Summary: before recent times we had to support static and shared building based on the options of the user, which forced us to complicate our build with the evas_goal hack. the evas_goal hack more or less was the idea of "faking" the evas build in the evas directory, finish all the .eo generation there, then build the modules and make all the static files ready. Then build everything in evas_goal. Now, that we just build everything the same always, we can simply build it in the evas way (removing the evas_goal hack FINALLY), as the same modules are build statically and shared. This also gives us the possibility to build the shared image loaders *again* the the modules directory, which unbreaks peoples build scripts who packaged loader files seperatly. Reviewers: zmike, raster, cedric, stefan_schmidt Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10548
2019-10-29edje: selectively inhibit content,changed events when changing swallowed partsMike Blumenkrantz
ref T8321 Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10508
2019-10-29elm/genlist: fix item focus unregister on item moveMike Blumenkrantz
if the block is realized, its items have been registered into the focus manager and must be unregistered to avoid double-registering @fix Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10544
2019-10-29elm/genlist: hide cached item contents and mark content unfocusable during calcMike Blumenkrantz
cached item contents should already be hidden by the edje clipper, so this simply changes their visible state to break them out of the focus calcs contents must also be explicitly marked as unfocusable during calc-only realize operations in order to avoid triggering a full focus recalc which will error due to missing focus adapter in the item block Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10543
2019-10-29elm/genlist: set pan need recalc during item move on item position changeMike Blumenkrantz
item move operations require pan recalc in order to process the item block positioning updates @fix Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D10533
2019-10-29elm/genlist: fix "drag" smart callbackMike Blumenkrantz
this is only a smart callback and not an eo callback @fix Reviewed-by: Cedric BAIL <[email protected]> Differential Revision: https://phab.enlightenment.org/D10527 | __label__pos | 0.529174 |
1
I am reading CISSP and more specifically the Biba model. Biba has some basic properties:
• The Simple Integrity Property states that a subject cannot read an object at a lower integrity level (no read-down).
• The * (star) Integrity Property states that a subject cannot modify an object a a higher integrity level (no write-up).
I am a little confused about the first property.
2
The idea of the "no read down" principle is simply that information produced at a lower level may be tainted, and should not be consumed by a member of a higher tier in the hierarchy.
A classical example is that a priest may write a prayerbook for a farmer, but should not accept religious ideas from the farmer.
1
• 2
The reason for this is to avoid someone from a higher integrity level being corrupted by something written at a lower level. It prevents bias, and less reputable information from being accidentally re-published by a more reputable author than the source material deserves. – Daisetsu Dec 2 '18 at 21:56
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.581895 |
Objectivity in Statistics: “Arguments From Discretion and 3 Reactions”
dirty hands
We constantly hear that procedures of inference are inescapably subjective because of the latitude of human judgment as it bears on the collection, modeling, and interpretation of data. But this is seriously equivocal: Being the product of a human subject is hardly the same as being subjective, at least not in the sense we are speaking of—that is, as a threat to objective knowledge. Are all these arguments about the allegedly inevitable subjectivity of statistical methodology rooted in equivocations? I argue that they are! [This post combines this one and this one, as part of our monthly “3 years ago” memory lane.]
“Argument from Discretion” (dirty hands)
Insofar as humans conduct science and draw inferences, it is obvious that human judgments and human measurements are involved. True enough, but too trivial an observation to help us distinguish among the different ways judgments should enter, and how, nevertheless, to avoid introducing bias and unwarranted inferences. The issue is not that a human is doing the measuring, but whether we can reliably use the thing being measured to find out about the world.
Remember the dirty-hands argument? In the early days of this blog (e.g., October 13, 16), I deliberately took up this argument as it arises in evidence-based policy because it offered a certain clarity that I knew we would need to come back to in considering general “arguments from discretion”. To abbreviate:
1. Numerous human judgments go into specifying experiments, tests, and models.
2. Because there is latitude and discretion in these specifications, they are “subjective.”
3. Whether data are taken as evidence for a statistical hypothesis or model depends on these subjective methodological choices.
4. Therefore, statistical inference and modeling is invariably subjective, if only in part.
We can spot the fallacy in the argument much as we did in the dirty hands argument about evidence-based policy. It is true, for example, that by employing a very insensitive test for detecting a positive discrepancy d’ from a 0 null, that the test has low probability of finding statistical significance even if a discrepancy as large as d’ exists. But that doesn’t prevent us from determining, objectively, that an insignificant difference from that test fails to warrant inferring evidence of a discrepancy less than d’.
Test specifications may well be a matter of personal interest and bias, but, given the choices made, whether or not an inference is warranted is not a matter of personal interest and bias. Setting up a test with low power against d’ might be a product of your desire not to find an effect for economic reasons, of insufficient funds to collect a larger sample, or of the inadvertent choice of a bureaucrat. Or ethical concerns may have entered. But none of this precludes our critical evaluation of what the resulting data do and do not indicate (about the question of interest). The critical task need not itself be a matter of economics, ethics, or what have you. Critical scrutiny of evidence reflects an interest all right—an interest in not being misled, an interest in finding out what the case is, and others of an epistemic nature.
Objectivity in statistical inference, and in science more generally, is a matter of being able to critically evaluate the warrant of any claim. This, in turn, is a matter of evaluating the extent to which we have avoided or controlled those specific flaws that could render the claim incorrect. If the inferential account cannot discern any flaws, performs the task poorly, or denies there can ever be errors, then it fails as an objective method of obtaining knowledge.
Consider a parallel with the problem of objectively interpreting observations: observations are always relative to the particular instrument or observation scheme employed. But we are often aware not only of the fact that observation schemes influence what we observe but also of how they influence observations and how much noise they are likely to produce so as to subtract them out. Hence, objective learning from observation is not a matter of getting free of arbitrary choices of instrument, but a matter of critically evaluating the extent of their influence to get at the underlying phenomenon.
For a similar analogy, the fact that my weight shows up as k pounds reflects the convention (in the United States) of using the pound as a unit of measurement on a particular type of scale. But given the convention of using this scale, whether or not my weight shows up as k pounds is a matter of how much I weigh!*
Likewise, the result of a statistical test is only partly determined by the specification of the tests (e.g., when a result counts as statistically significant); it is also determined by the underlying scientific phenomenon, at least as modeled. What enables objective learning to take place is the possibility of devising means for recognizing and effectively “subtracting out” the influence of test specifications, in order to learn about the underlying phenomenon, as modeled.
Focusing just on statistical inference, we can distinguish between an objective statistical inference, and an objective statistical method of inference. A specific statistical inference is objectively warranted, if it has passed a severe test; a statistical method is objective by being able to evaluate and control (at least approximately) the error probabilities needed for a severity appraisal. This also requires the method to communicate the information needed to conduct the error statistical evaluation (or report it as problematic).
It should be kept in mind that we are after the dual aims of severity and informativeness. Merely stating tautologies is to state objectively true claims, but they are not informative. But, it is vital to have a notion of objectivity, and we should stop feeling that we have to say, well there are objective and subjective elements in all methods; we cannot avoid dirty hands in discretionary choices of specification, so all inference methods do about as well when it comes to the criteria of objectivity. They do not.
*Which, in turn, is a matter of my having overeaten in London.
__________________
3 Reactions to the Challenge of Objectivity
(1) If discretionary judgments are thought to introduce subjectivity in inference, a classic strategy thought to achieve objectivity is to extricate such choices, replacing them with purely formal a priori computations or agreed-upon conventions (see March 14). If leeway for discretion introduces subjectivity, then cutting off discretion must yield objectivity! Or so some argue. Such strategies may be found, to varying degrees, across the different approaches to statistical inference. The inductive logics of the type developed by Carnap promised to be an objective guide for measuring degrees of confirmation in hypotheses, despite much-discussed problems, paradoxes, and conflicting choices of confirmation logics. In Carnapian inductive logics, initial assignments of probability are based on a choice of language and on intuitive, logical principles. The consequent logical probabilities can then be updated (given the statements of evidence) with Bayes’s Theorem. The fact that the resulting degrees of confirmation are at the same time analytical and a priori—giving them an air of objectivity–reveals the central weakness of such confirmation theories as “guides for life”, e.g., —as guides, say, for empirical frequencies or for finding things out in the real world. Something very similar happens with the varieties of “objective’” Bayesian accounts, both in statistics and in formal Bayesian epistemology in philosophy (a topic to which I will return; if interested, see my RMM contribution). A related way of trying to remove latitude for discretion might be to define objectivity in terms of the consensus of a specified group, perhaps of experts, or of agents with “diverse” backgrounds. Once again, such a convention may enable agreement yet fail to have the desired link-up with the real world. It would be necessary to show why consensus reached by the particular choice of group (another area for discretion) achieves the learning goals of interest.
Likewise, routine and automatic choices in statistics can be justified as promoting a specified goal, but it is the onus of anyone supporting the account in question to show this.
(2) The second reaction is to acknowledge and even to embrace subjective and personal factors. For Savage (1964: 178) the fact that a subjective (which I am not here distinguishing from a “personalistic”) account restores the role of opinion in statistics was a cause of celebration. I am not sure if current-day subjective Bayesians concur—but I would like to hear from them. Underlying this second reaction, there is often a deep confusion between our limits in achieving the goal of adequately capturing a given data generating mechanism, and making the goal itself be to capture our subjective degrees of belief in (or about) the data generating mechanism. The former may be captured by severity assessments (or something similar), but these are not posterior probabilities (even if one grants the latter could be). Most importantly for the current issue, assessing the existing limitations and inadequacies of inferences is not the same as making our goal be to quantitatively model (our or someone else’s) degrees of belief! Yet these continue to be run together, making it easy to suppose that acknowledging the former limitation is tantamount to accepting the latter. As I noted in a March 14 comment to A. Spanos, “let us imagine there was a perfect way to measure a person’s real and true degrees of belief in a hypothesis (maybe with some neuropsychology development), while with frequentist statistical models, we grope our way and at most obtain statistically adequate representations of aspects of the data generating mechanism producing the relevant phenomenon. In the former [we are imagining], the measurement is 100% reliable, but the question that remains is the relevance of the thing being measured for finding out about the world. People seem utterly to overlook this” (at least when they blithely repeat variations on “arguments from discretion”, see March 14 post). Henry Kyburg (1992) put it in terms of error: the subjectivist precludes objectivity because they he or she cannot be in error:
This is almost a touchstone of objectivity: the possibility of error. There is no way I can be in error in my prior distribution for µ—unless I make a logical error. . . . It is that very fact that makes this prior distribution perniciously subjective. It represents an assumption that has consequences, but cannot be corrected by criticism or further evidence. (p. 147)
(3) The third way to deal with the challenges of objectivity in inference is to deliberately develop checks of error, and to insist that our statistical methods be self-correcting. Rather than expressing opinions, we want to avoid being misled by beliefs and opinions—mine and yours—building on the recognition that checks of error enable us to acquire reliable knowledge about the world. This third way is to discern what enabled us to reject the “dirty hands” argument: we can critically evaluate discretionary choices, and design methods to determine objectively what is and is not indicated. It may well mean that the interpretation of the data itself is a report of the obstacles to inference! Far from being a hodgepodge of assumptions and decisions, objectivity in inference can and should involve a systematic self-critical scrutiny all along the inferential path. Each stage of inquiry and each question within that stage involve potential errors and biases. By making these explicit we can learn despite background judgments. Nowadays, the reigning mood may be toward some sort of third way; but we must be careful. Merely rejecting the dirty-hands conclusion (as in my March 14 post) is not yet to show that any particular method achieves such objective scrutiny in given cases. Nor does it suffice to declare that “of course we subject our assumptions to stringent checks”, and “we will modify our models should we find misfits with the data”. We have seen in our posts on m-s tests, for instance, the dangers of “error fixing” strategies (M-S post 1, 2, 3, 4). The method for checking must itself be justified by showing it has the needed properties for pinpointing flaws reliably. It is not obvious that popular “third-way” gambits meet the error statistical requirements for objectivity in statistics that I have discussed in many previous posts and papers (the ability to evaluate and control relevant error probabilities). At least, it remains an open question as to whether they do. _____________
Carnap, R. (1962). Logical Foundations of Probability. Chicago: University of Chicago Press.
Kyburg, H. E., Jr. (1992). “The Scope of Bayesian Reasoning,” in D. Hull, M. Forbes, and K. Okruhlik (eds.), PSA 1992, Vol. II, East Lansing, MI: 139-52.
Savage, L. J. (1964). “The Foundations of Statistics Reconsidered,” pp. 173-188 in H. E. Kyburg and and H.E. Smokler (eds.), Studies in Subjective Probability, Wiley, New York: 173-88.
Categories: Objectivity, Statistics | Tags: , | 6 Comments
Post navigation
6 thoughts on “Objectivity in Statistics: “Arguments From Discretion and 3 Reactions”
1. Christian Hennig
As you may have expected, I find this extremely interesting.
I’m all for critical scrutiny of the evidence; I’m happy with most if not all that you advertise in the name of objectivity.
Still, your text to me suggests a certain over-optimism regarding how far we can get “subtracting out” the effects of discretionary choices.
I think that it is a legitimate use (one of the many possible and partly contradictory ones that one can find in the literature) of the term “objective” to say that it is objective what for example the result of a certain t-test implies and does not imply including an acknowledgement that this is based on the assumption of i.i.d. normality, which itself has to be open to critical scrutiny. However, there is no way, using methodology in a so-called “objective” way to distinguish normality and independence from every possible alternative that could potentially lead to substantially different conclusions regarding the underlying reality. At some point we always need to accept working with such a model having tested it in some ways and being not able to test it in some others. Where does this stand in your coordinate system of using the terminologies “objective” and “subjective”?
There are certain possibilities even to analyse this, what potential problems it involves and how some of these (but not them all) can be dealt with, but often such possibilities (as in the robust statistics literature) come with the need of making further discretionary choices, tuning constants and the like.
Personally, although I believe that you use the term “objective” in a consistent and legitimate way, I do believe that advertising objectivity in over-optimistic ways is very problematic in science and that there is a big problem with people trying to *appear* objective by hiding decisions from scrutiny some of which may be arbitrary, some of which may be sensible in their specific context although not generalisable, and some others of which may be absolutely required to get the statistical machinery (frequentist or Bayesian or whatever) going in the first place.
I also believe that the wording “getting your hands dirty” conveys a bad message, namely that either people should clean their hands (i.e., appearing not to make decisions at all), or that once the hand are dirty, everything is possible – and arbitrary. As far as I understand you, you object against this idea as I do, but wouldn’t it then be helpful to have more positive and constructive ideas about how and why to make such decisions, and to encourage scientists to be open and honest about them? But this would require an acknowledgement of the benefits and necessities of such decisions and the rationales behind them, rather than talking exclusively about the “objective” side of things, only grudgingly accepting that discretionary decisions exist but should be “substracted out” as far as we can, wouldn’t it?
• What was my text to you? These are reblogs from the “objectivity” series (of 5 or more) from 3 years ago. Interestingly, I didn’t find there’s much I’d change, except that more needs to be said about the epistemology and metaphysics behind many existing positions on objectivity. The “dirty hands” analogy is one used by others in the risk assessment context to claim “we all have dirty hands”, thus we all are biased, thus scientists should bias their reports in favor of the common good (this was the ethics in evidence post, and this argument is more prevalent than ever.) I am arguing AGAINST the dirty hands allegation, so I am agreeing with you that discretionary choices don’t or needn’t dirty our hands.
The “dirty hands” post:
https://errorstatistics.com/2011/10/13/objectivity-2-the-dirty-hands-argument-for-ethics-in-evidence/
• Mayo:
We all busy with too many opportunities to read too many things.
But Christian’s recent paper with Andrew addresses many issue of objectivity very nicely.
Click to access objectivity10.pdf
In that paper they reference Hasok Chang who seems very consistent with Peirce whom he seems to have gotten mostly from Amy McLaughlin (have to wait until I am at a library to access her work) and John Dewey – so you might be especially interested.
• Keith: Yes, I’ve written very lengthy and detailed comments on that paper. At some point, once cleaned up and provided the authors concur, I can post them. It just so happened to be a topic that coincided with my (end of the month) three-year monthly memory lane routine.
I also know Chang well–a fellow new experimentalist who was one of the people I invited to my Lakatos Prize dinner. (I guess you’re allowed to invite some very tiny number like 3). He had published, in Nature, an early and very favorable review of EGEK (1996).
2. Bayesforlife
Two questions about objectivity.
First, Bayes has the property that you can subdivide the data/evidence in any way you want, and process it any order you want and you’ll get the same final answer. Frequentists methods do not have that property. It’s possible for two different Frequentists for example to get difference answers just because they did the same group of tests/severity analysis in different orders. Isn’t it important that methods be “objective” in this way, or do you think it’s acceptable that irrelevant choices by the analyst can change the import of the same data/evidence?
A follow on questions: if being “objective” in this way is important, why can’t we use this a (mathematical) requirement to limit acceptable procedures? Do you have any idea what formalism you’ll mathematically be lead to if you start imposing these kinds of objectivity requirements?
Second, you say this about logical probabilities:
“The fact that the resulting degrees of confirmation are at the same time analytical and a priori—giving them an air of objectivity–reveals the central weakness of such confirmation theories as “guides for life”, e.g., —as guides, say, for empirical frequencies or for finding things out in the real world.”
For logical probabilities the idea is that P(A|B) represents a model of the uncertainty in A from partial evidence B. The form of P(A|B) then follows logically and objectively from B. “A” could be parameters predicted or unknown or could be a frequency. For example, A could be the percentage of heads in the next 1000 flips of a coin. So where in the world did you get the idea that P(A|B) couldn’t be a “guide for life” because it’s “logical” and “objective”?
• BFL: Yes, Bayesians say they can toss things around, but many also say the prior is supposed to be before the data and not based on the data–warning against double counting. So their position is a bit unclear–doubtless it shifts for different Bayesians.
If you’re alluding, at the start, to the fact that error statisticians violate the strong likelihood principle and that selection effects, stopping rules, multiple testing etc. alter error probabilities, then I say “guilty as charged”. That’s not irrelevant info for us.
I mentioned the general key question raised of logical probabilities based on formal (first order) languages. A research programme essentially abandoned, but surely some still pursue it. One needs to set out all properties, possibly relations (I don’t think they’ve advanced to functions), individual entities, and then choose a “uniformity factor” lambda, and then a way to give initial assignments to states, or structures, or what have you.
What you describe is in sync with having statements be statistical models, or in any event empirical and not purely formal, syntactical context-free claims. syntactic approach.
I welcome constructive comments that are of relevance to the post and the discussion, and discourage detours into irrelevant topics, however interesting, or unconstructive declarations that "you (or they) are just all wrong". If you want to correct or remove a comment, send me an e-mail. If readers have already replied to the comment, you may be asked to replace it to retain comprehension.
Fill in your details below or click an icon to log in:
WordPress.com Logo
You are commenting using your WordPress.com account. Log Out / Change )
Google photo
You are commenting using your Google account. Log Out / Change )
Twitter picture
You are commenting using your Twitter account. Log Out / Change )
Facebook photo
You are commenting using your Facebook account. Log Out / Change )
Connecting to %s
Blog at WordPress.com.
%d bloggers like this: | __label__pos | 0.757937 |
Artificial Intelligence (AI) has been one of the most transformative technologies in recent times. It has made our lives easier by automating many tasks, allowing us to focus on more important things. One of the most exciting areas of AI is Natural Language Processing (NLP). NLP enables computers to understand and interpret human language, making communication between humans and machines more natural and intuitive. This report focuses on a project based on NLP, which has the potential to revolutionize the way we interact with technology. This project has many future applications, such as home automation, Google search, playing songs, controlling the system, and working as a mini PC. The project's working principle is based on NLP, which allows the system to understand and interpret human language.
Voice Activation for Home Automation using ESP8266
Working Principle: The working principle of this project is based on NLP, which is a subset of AI. NLP is the ability of computers to understand and process human language. The system processes the input through various stages such as syntactic analysis, semantic analysis, and pragmatics analysis. Once the input is processed, the system generates an appropriate response. Syntactic analysis involves identifying the parts of speech and the grammatical structure of the input. Semantic analysis involves understanding the meaning of the input, and pragmatics analysis involves understanding the context of the input. The system uses various algorithms and models to process the input and generate the appropriate response. These algorithms and models include deep learning, neural networks, and machine learning algorithms.
Applications
Home automation: The Alpha project can be used for home automation, allowing users to control various devices such as lights, thermostats, and security systems using voice commands.
Google search: The Alpha project can be used to search the internet using voice commands. This can be particularly useful for people who have mobility issues or disabilities.
Entertainment: The Alpha project can be used to play music, tell jokes, and perform other entertainment functions using voice commands.
System control: The Alpha project can be used to control various system settings such as volume, brightness, and power settings using voice commands
Affordability: The Alpha project is designed to be affordable, costing only 450rs. This makes it accessible to a wider range of people, particularly those who might not be able to afford more expensive voice assistant devices.
Components Required
Circuit Diagram
Circuit Diagram for Voice Activation for Home Automation using ESP8266
NodeMCU Pin Relay Module Pin
D1 IN1
D2 IN2
GND GND
VCC VCC
ESP8266 NodeMCU work as a server , Pc send the data on nodemcu through webpage and nodemcu responce according to data for ex:- ledon, nodemcu send the signal to relay module to ON the switch for light ; fanon, nodemcu send the signa to ON the switch for fan ; ledoff, nodemcu send the signal to relay module to OFF the switch for light ; fanoff, nodemcu send the signa to OFF the switch for fan.
Arduino Code
Arduino Code For Voice Activation
In function 'on_fun' it is a function that responsible for send the data on nodemcu. And this function open the webpage on the given ip address and send the data on nodemcu (NOTE :- All nodemcu have different - different ip address, change on the custom ip address.) In function 'home_Automation' it is a function that responsible send useable data on nodemcu , that requred for it.
Leave a comment
Please note, comments must be approved before they are published
Your cart
×
Liquid error (layout/theme line 249): Could not find asset snippets/quantity-breaks-now.liquid | __label__pos | 0.621691 |
How to get peer admin's certificate and key on Bluemix?
0 votes
I am trying to deploy my bna on Bluemix but i am not getting how to get the cert and key of peer admin.
How can I get it?
Jul 16, 2018 in Blockchain by digger
• 27,630 points
69 views
1 answer to this question.
0 votes
Follow the steps mentioned below:
Create connection profile
~/.composer-connection-profiles/bmx-stage1-kubes/connection.json
{
"name": "bmx-stage1-kubes-org1",
"description": "Connection profile for IBM Blockchain Platform",
"type": "hlfv1",
"orderers": [
{
"url": "grpc://169.47.123.123:31010"
}
],
"ca": {
"url": "http://169.47.123.123:30000",
"name": "CA1"
},
"peers": [
{
"requestURL": "grpc://169.47.123.123:30110",
"eventURL": "grpc://169.47.123.123:30111"
}
],
"keyValStore": "/Users/jeff/.composer-credentials/bmx-stage1-kubes-
org1",
"channel": "channel1",
"mspID": "Org1MSP",
"timeout": 300
}
Make sure the public address matches the public address of your kubernetes cluster.
After setting up my kubernetes env, you should get the appropriate admin creds that you can use to create an admin id (PeerAdmin)
In order to grab the creds, you first need to access one of the pods in my kubernetes cluster
kubectl exec -ti $(kubectl get pods | grep ca| awk '{print $1}') bash
Then you have to get the cert file and the key file for the ca. You will find the cert file here:
/shared/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/admincerts
you will find the key file here:
/shared/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore
Then copy the contents of those files into a cert file (admincert.pem) and a private key file (key.pem) on your local system and then run:
composer identity import -p bmx-stage1-kubes-org1 -u PeerAdmin -c admincert.pem -k key.pem
This will create your PeerAdmin (admin identity)
then run
composer network deploy -a myBNA.bna -p bmx-stage1-kubes-org1 -i PeerAdmin -s abc
answered Jul 16, 2018 by slayer
• 29,050 points
Related Questions In Blockchain
0 votes
1 answer
How to get notified when an event triggers on ethereum smart contract?
Here's a simple example for web3js 1.0.0.beta*: function handler ...READ MORE
answered Jun 8, 2018 in Blockchain by ariaholic
• 7,340 points
362 views
0 votes
1 answer
How to get all address and send ethers in solidity using a loop?
I found a similar code somewhere: contract Holders{ uint ...READ MORE
answered Jul 31, 2018 in Blockchain by digger
• 27,630 points
169 views
0 votes
1 answer
How to get results by running the voting code on Ethereum?
In mist go to your contract and ...READ MORE
answered Sep 18, 2018 in Blockchain by digger
• 27,630 points
30 views
0 votes
1 answer
Hyperledger Fabric: How to get transaction history using key?
history, err := stub.GetHistoryForKey(key_value) for history.HasNext() { ...READ MORE
answered Nov 20, 2018 in Blockchain by Omkar
• 67,380 points
618 views
0 votes
1 answer
0 votes
1 answer
Invalid Batch or signature in Savtooth
This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE
answered Aug 1, 2018 in Blockchain by digger
• 27,630 points
67 views
+1 vote
1 answer
How do i change the names of validating peers in IBM Bluemix blockchain?
IBM Bluemix Blockchain service Hyperledger Fabric v0.6 will ...READ MORE
answered Apr 10, 2018 in Blockchain by Perry
96 views
0 votes
1 answer | __label__pos | 0.526155 |
我們致力本地化我們在盡可能多的語言的網站越好,然而這一頁是機器使用谷歌翻譯翻譯。 關閉
文件擴展名查詢
.rzn 文件擴展名
開發商: Red Zion
文件類型: Red Zion Notes File
你在這裡因為你有,有一個文件擴展名結尾的文件 .rzn. 文件與文件擴展名 .rzn 只能通過特定的應用程序推出。這有可能是 .rzn 文件是數據文件,而不是文件或媒體,這意味著他們並不是在所有觀看。
什麼是一 .rzn 文件?
在文件.rzn擴展是指創建並保存在紅錫安電子書應用程序的文本文件。這些RZN文本文件也稱為註釋文件,因為它包含由RZB文件的用戶或創建者輸入的文本。這些RZB文件是可以創建,編輯和使用Red錫安電子書程序查看輸出文件。當用戶創建一個項目RZB,一個RZN文件會自動由紅錫安電子書程序創建的,而這RZN文件將包含該文件RZB其他文本條目中的說明和意見。這個程序再與RZB項目新創建的文件RZN關聯。這是該程序來快速,輕鬆地找到正確的RZN文件時,用戶查看相關RZB文件,使用戶可以查看存儲在RZN文件中的註釋,評論等文字條目。 RZB項目也是文本文件,如文件RZN。一個RZN文件的內容還可以查看和使用流行的文本編輯器,如微軟記事本和寫字板修改。
如何打開 .rzn 文件?
推出 .rzn 文件,或者你的電腦上的任何其他文件,雙擊它。如果你的文件關聯的設置是否正確,這意味著應用程序來打開你的 .rzn 文件將其打開。這是可能的,你可能需要下載或購買正確的應用程序。這也有可能是你有正確的應用程序在PC上,但 .rzn 文件還沒有與它相關聯。在這種情況下,當您嘗試打開一個 .rzn 文件,你可以告訴Windows的應用程序是正確的該文件。從這時起,打開 .rzn 文件將打開正確的應用程序。 點擊這裡修復.rzn文件關聯錯誤
打開一個應用程序 .rzn 文件
Red Zion E-book
Red Zion E-book
Red Zion E-book is an application that is classified as a document viewing tool, and this software is embedded with compatibility support for widely used versions of Microsoft Windows. The Red Zion E-book program is integrated with a set of features that can open, display the content and access certain functionalities implemented into an RZB file, which is a digital document format used by some Slovenian ebook authors. Some of these RZB digital books are encrypted with copy protection keys, and these security tokens are stored in files in the RZK format. This means when a user wants to copy the content of an RZB file that is displayed in the main window of the Red Zion E-book's Graphical User Interface (GUI), this software initially checks if there is a security token that encrypts the content of the RZB file. If this program finds a security token, it requests for the correct set of keys from the user. When the user supplies the correct security keys, this software allows the user to copy the content of the RZB file. It will however deny copy access if the user provides an incorrect security key or if the user does not give one. Red Zion E-book is also known as Red Zion E-knjiga.
Microsoft Notepad
Microsoft Notepad
Notepad is a basic text editor used to create plain documents. It is commonly used to view or edit text (.txt) files, and a simple tool for creating Web pages, and supports only the basic formatting in HTML documents. It also has a simple built-in logging function. Each time a file that initializes with .log is opened, the program inserts a text timestamp on the last line of the file. It accepts text from the Windows clipboard. This is helpful in stripping embedded font type and style codes from formatted text, such as when copying text from a Web page and pasting into an email message or other “What You See Is What You Get†text editor. The formatted text is temporarily pasted into Notepad, and then immediately copied again in stripped format to be pasted into the other program. Simple text editors like Notepad may be utilized to change text with markup, such as HTML. Early versions of Notepad offered only the most basic functions, such as finding text. Newer versions of Windows include an updated version of Notepad with a search and replace function (Ctrl + H), as well as Ctrl + F for search and similar keyboard shortcuts. It makes use of a built-in window class named edit. In older versions such as Windows 95, Windows 98, Windows Me and Windows 3.1, there is a 64k limit on the size of the file being edited, an operating system limit of the EDIT class.
Microsoft WordPad
Microsoft WordPad
Files with .rtf, .openbsd, and .readme extensions are some of the files associated or which can be opened with the Microsoft WordPad. RTF files are text documents that can be created, opened, viewed, edited or changed using word processing applications for both Mac and Microsoft Windows-based computers, like Microsoft WordPad for Windows and Microsoft Word 2011 for Mac. It gives the users a wide cross compatibility support, which was the central objective for the improvement of the Rich Text Format technology, and these .rtf files can even be opened, viewed and used with database applications. The OpenBSD Unix platform is frequently utilized in computers running as Web servers of a secure network. OpenBSD files may be saved in directories of the OpenBSD system that were generated upon installation of the software applications. Files with the .openbsd extension can be opened by standard text editors, particularly well-known like Microsoft Notepad, and this text editor may also be utilized to create and edit OPENBSD files. Files with the .readme extension are text documents engaged to give users with beneficial information and specific details about certain applications installed in the system. These files can be opened, viewed and edited with a selection of text editors including Microsoft Notepad and Microsoft WordPad.
Notepad2
Notepad2
The Notepad2 application is a more advanced text editor for Windows developed by Florian Balmer. This program originated from the original built-in Microsoft Notepad which is why it is also effective and fast even when it is small. Notepad2 also has a lot of features such as syntax highlighting that allows a text or a source code to be displayed using different fonts and colors. This syntax highlighting feature of notepad2 allows users to write programming language easily and distinctly. This amazing function of Notepad2 is also owing to several other features it possess such as auto indentation, regular and expression-based find and replace feature, bracket matching, newline conversion, encoding conversion as well as multiple undo and redo features. These features make the function of the simple Notepad more advanced and it makes Notepad more interesting to use either to open files in .txt format or to write HTML codes. Notepad2 also supports many programming languages such as ASP, C++, Perl, Java, etc.
提醒一句
要小心,不要重命名擴展 .rzn 文件,或任何其他文件。這不會更改文件類型。只有特殊的轉換軟件可以從一個文件類型更改一個文件到另一個。
什麼是文件擴展名?
文件擴展名是一組三個或四個字符在文件名的末尾,在這種情況下, .rzn. 文件擴展名告訴你它是什麼類型的文件,並告訴Windows哪些程序可以打開它。窗戶經常關聯一個默認程序的每個文件的擴展名,這樣,當你雙擊該文件,程序會自動啟動。當該程序不再是您的PC上,有時可以得到一個錯誤,當您試圖打開相關的文件。
修復.rzn文件關聯錯誤
查找和修復文件擴展名錯誤,註冊表問題,并快速,輕鬆和安全地恢復最佳PC性能。
嘗試 Registry Reviver® 自由。
開始下載
發表評論
現在修復.rzn文件擴展名
查找並修復文件關聯錯誤,防止在您的計算機上打開此文件類型。
立即開始修復
安裝 Registry Reviver®
Registry Reviver
你確定嗎?
修復PC上的文件擴展名問題。
安裝並嘗試 Registry Reviver 對於 Free!
Copyright © 2023 Corel Corporation. 版權所有。 使用條款 | 隱私 | Cookies
追隨我們
夏季大減價!
高達40%的折扣
使用高級套房套餐並獲得 Parallels Toolbox 自由!
節省
40
% | __label__pos | 0.804483 |
4
We have a site where the homepage is not being cached and contains the headers:
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-content-type-options: nosniff
x-drupal-dynamic-cache: UNCACHEABLE
I narrowed this down to the content regions contents, and disabled the "Main page content" for the front page. This then gave me a cache HIT, and no longer responded as UNCACHEABLE. From there, I narrowed it down to a field formatter being used on a paragraph. We have a custom one that extends the normal entity render formatter.
If I swap it back to the original "Render entity" formatter, everything is fine. So then, it must be something we are doing in this custom formatter causing the issue.
I can see when I follow with xdebug that shouldCacheResponse of DynamicPageCacheSubscriber returns FALSE, because something is setting max-age to 0 (not by code). It looks like calls to addCacheableDependency may be triggering this behavior in the formatter:
Essentially, the formatter adds cache data to the render so if any of its referenced items are updated, the cache should be invalidated for that host paragraph so it re-renders:
$view_builder = \Drupal::entityTypeManager()->getViewBuilder($entity->getEntityTypeId());
$elements[$delta] = $view_builder->view($entity, $view_mode, $entity->language()->getId());
try {
$parent = $items->getParent();
$parent_entity = $parent->getValue();
$elements[$delta]['#cache']['keys'][] = $parent_entity->id();
$elements[$delta]['#cache']['keys'][] = $parent_entity->bundle();
$elements[$delta]['#cache']['keys'][] = $parent_entity->getEntityTypeId();
$elements[$delta]['#cache']['keys'][] = 'delta_' . $delta;
$elements[$delta]['#cache']['keys'][] = 'context_aware';
$this->renderer->addCacheableDependency($elements[$delta], $parent);
if ($entity->hasField('field_author')) {
$child = $entity->field_author->entity;
if (isset($child)) {
$this->renderer->addCacheableDependency($elements[$delta], $child);
}
}
// similar statements with addCacheableDependency
If I comment out this initial line:
$this->renderer->addCacheableDependency($elements[$delta], $parent);
Then I get a cacheable response. This looks to be because the $parent item (even though it is a node or paragraph or media entity) triggers this:
/**
* Creates a CacheableMetadata object from a depended object.
*
* @param \Drupal\Core\Cache\CacheableDependencyInterface|mixed $object
* The object whose cacheability metadata to retrieve. If it implements
* CacheableDependencyInterface, its cacheability metadata will be used,
* otherwise, the passed in object must be assumed to be uncacheable, so
* max-age 0 is set.
*
* @return static
*/
public static function createFromObject($object) {
if ($object instanceof CacheableDependencyInterface) {
$meta = new static();
$meta->cacheContexts = $object->getCacheContexts();
$meta->cacheTags = $object->getCacheTags();
$meta->cacheMaxAge = $object->getCacheMaxAge();
return $meta;
}
// Objects that don't implement CacheableDependencyInterface must be assumed
// to be uncacheable, so set max-age 0.
$meta = new static();
$meta->cacheMaxAge = 0;
return $meta;
}
Setting cacheMaxAge to 0 because it is not an instance of CacheableDependencyInterface.
If I am already setting the cache keys, is this line even needed:
$this->renderer->addCacheableDependency($elements[$delta], $parent);
If I remove that, will there be an adverse effect (like render displays not re-rendering when referenced items are saved)?
5
• 2
Setting cache keys is not enough, you need the cache tags as well. So don't remove this line, just check the object is not NULL.
– 4uk4
Commented Jul 27, 2021 at 16:13
• 1
Yeah cache keys don't really do anything - contexts, tags, and max-age are what you'd want to make sure to carry over.
– sonfd
Commented Jul 27, 2021 at 16:16
• $parent is not null, but is received in createFromObject as an instance of EntityAdapter (containing the entity node, or paragraph) which I can't trace as implementing CacheableDependencyInterface
– Kevin
Commented Jul 27, 2021 at 16:16
• 2
OK, now I see the problem, the entity with the cache data is $parent_entity.
– 4uk4
Commented Jul 27, 2021 at 16:17
• That is what I suspected, thanks for confirming. Changing that returns a cacheable response to the browser.
– Kevin
Commented Jul 27, 2021 at 16:20
1 Answer 1
5
This was a good debug deep dive. As mentioned by 4k4 the problem is the first addCacheableDependency line.
Instead of passing the host entity itself, I was mistakenly passing the object returned from getParent which is a TypedData instance that does not implement CacheableDependencyInterface - thus causing the max-age to be set to 0 and the UNCACHEABLE header result.
Passing the entity (returned from getValue()) resolved the issue:
$parent = $items->getParent();
$parent_entity = $parent->getValue();
...
$this->renderer->addCacheableDependency($elements[$delta], $parent_entity);
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.778325 |
JavaScript subclassing using Object.create
In my previous post, I talked about how Microsoft’s TypeScript was able to build simple class-based inheritance on top of JavaScript’s prototypal inheritance. To recap, the compiler includes a short function named extends that handles rejigging the prototype chain between the sub-class and the super-class to achieve the desired inheritance.
[javascript]
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
[/javascript]
The trickiness of this pattern can help us understand the impetus for one of JavaScript’s newer features, Object.create. When you first encounter this method, you might wonder why JavaScript needs another way to create objects, when it already has the object literal syntax and constructor functions? Where Object.create differs from those options is that lets you provide, as the first argument to the method, an object that will become the new object’s prototype.
Remember that there is a difference between an object’s public prototype property and its internal [[Prototype]] property. When JavaScript is looking up properties on an object, it uses the latter, but traditionally the only standardised way to control it for a new object has been to use the pattern applied by __extends. You create a new function with a public prototype property, then apply the new operator on the function to create a new object. When the new operator is used with a function, the runtime sets the [[Prototype]] property of the new object to the object referenced by the public prototype property of the function.
While this approach to controlling the [[Prototype]] works, it is a little opaque and wasteful, requiring the declaration of a new function simply for the purpose of controlling this internal property. With Object.create, the extra function is no longer required, as the [[Prototype]] can be controlled directly. A dead simple example would be.
[javascript]
var animal = {
legs: 4
},
dog;
dog = Object.create(animal);
dog.legs == 4; // True
[/javascript]
dog
The end result couldn’t be simpler — An object dog with a [[Prototype]] of animal.
We can extend this to reproduce the functionality of __extends without the faff of an additional function.
[javascript]
function SuperClass() { };
function SubClass() { };
SubClass.prototype = Object.create(SuperClass.prototype);
SubClass.prototype.constructor = SubClass;
[/javascript]
subclass-superclass
I think you’ll agree that this is a much friendlier pattern than what __extends does, and in fact only today I found it recommended in feedback from the W3C TAG to the Web Audio working group, referred to as the “subclassing pattern”. So why didn’t Microsoft use it? Unfortunately, Object.create isn’t supported in Internet Explorer 8 and below, meaning TypeScript has to use the older pattern in order to maximise compatibility. Since __extends is compiler-generated JavaScript, its readability hardly matters anyway, as TypeScript developers will only see the class syntax of that language.
__proto__
I said above that there was traditionally no standardised way to control an object’s [[Prototype]]. However, some browsers have long supported a way of accessing and even changing it, through the __proto__ property. Although not part of any official specification, this property became a de facto standard, and gained support in all the major browsers except IE. It seems this property was controversial, as it was considered an abstraction error, and mutable prototypes were argued to cause implementation problems. There was talk of deprecating and eventually removing __proto__, while standardising equivalent capability, first through the introduction of Object.create and Object.getPrototypeOf in EcmaScript 5 and now Object.setPrototypeOf in EcmaScript 6 ((setPrototypeOf seems locked-in for ES6, despite Brendan Eich saying in 2011 that it wasn’t going to happen. Although it appears no browser has actually implemented it yet.)). But __proto__ has not gone away yet, and in fact it appears from pre-release builds that Internet Explorer 11 will support it, so who knows if it will ever really die.
Posted
in
,
by
Tags:
Comments
5 responses to “JavaScript subclassing using Object.create”
1. Markus A. Avatar
I think you could mix both concepts together, creating a couple of functions, one to extend and other to inherit.
// Plain "module" mixin
function extend(object, mixin) {
Object.getOwnPropertyNames(mixin).forEach(function(prop) {
object[prop] = mixin[prop];
});
return object;
}
// Prototypal inheritance
function inherit(child, parent) {
child.super_ = parent; // Useful, though purely optional
child.prototype = extend(Object.create(parent.prototype), child.prototype);
}
This pattern has worked great for me.
2. zairon87 Avatar
zairon87
I would just like to point out that there is a polyfill for Object.create on the modzilla docs:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create
But it is important to note that the second argument is left off in the polyfill.
3. Owen Densmore Avatar
Do you have a stunt for “super” in either “extends” or Object.create? I’m wondering if CoffeeScript might convert to this as it becomes more standard. Maybe a shim if not present?
Thanks for the discussion, love this stuff.
— Owen
1. Jon Avatar
Hi Owen, glad you liked it 🙂
Capabilities like Object.create do seem to be targeted at least partially at people writing frameworks and languages that compile to JavaScript, and I wouldn’t be surprised if CoffeeScript uses it when possible. One problem with shimming these APIs is that there are certain functionality that can’t be emulated, such as sealing objects or creating getter and setter functions for properties. These aren’t just creating improved idioms, but are actually exposing new features in the runtime.
Take at look at my previous article Exploring JavaScript prototype’s via TypeScript’s class pattern. It has an extended exploration of how TypeScript implements inheritance in JavaScript, including support for superclass access using the “super”keyword. The trick is basically to use function.call() to execute the superclass prototype methods in the context of the subclass instance.
4. Claude Grecea Avatar
You could always use a shim to support `Object.create()` for IE. Such has this git. https://github.com/kriskowal/es5-shim
Leave a Reply
Your email address will not be published. Required fields are marked * | __label__pos | 0.942575 |
Dismiss
Announcing Stack Overflow Documentation
We started with Q&A. Technical documentation is next, and we need your help.
Whether you're a beginner or an experienced developer, you can contribute.
Sign up and start helping → Learn more about Documentation →
Possible Duplicate:
How to convert a number to string and vice versa in C++
In C++ how do you convert a hexadecimal integer into a string representation of the decimal value of the original hex?
Let us say we have an integer whose hexadecimal representation is a1a56 (which in decimal equals 662102) and you want to convert this to a string "662102"
How would you solve this?
ps: i suggest a functional solution as an answer, feel free to shoot it down (in a polite manner, if possible)
share|improve this question
marked as duplicate by R. Martinho Fernandes, Mysticial, jogojapan, Mac, Kevin Oct 16 '12 at 2:04
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
So the hexadecimal number is orignally what type? String? int? If it's originally int then just print it out. – nhahtdh Oct 12 '12 at 2:30
@nhahtdh it is int BUT i do not want to print it out, i need to manipulate the string after (let us say i am putting together a query for mysql). thanx 4 the input! – tony gil Oct 12 '12 at 2:39
3
@tonygil then it is not an "hexadecimal integer". It's an integer. Numbers have no bases. Representations do. – R. Martinho Fernandes Oct 12 '12 at 2:39
@R.MartinhoFernandes i was just editing as per your suggestion. but you override me big time! thanx for the help clarifying the question. the only problem is that, even though it is technically correct, people search for the original title: "How to convert hex to string" (that's what's going on google). – tony gil Oct 12 '12 at 2:45
1
@tony there's no "specific situation" at hand here. It's the same thing, except for a misunderstanding of the concept of number. Feel free to rollback to the old text if you think that helps with search. – R. Martinho Fernandes Oct 12 '12 at 2:53
up vote 2 down vote accepted
You can use stringstreams:
int x = 0xa1a56;
std::stringstream ss;
ss << x;
cout << ss.str();
Or if you prefer a function:
std::string convert_int(int n)
{
std::stringstream ss;
ss << n;
return ss.str();
}
Edit: Make sure you #include <sstream>
share|improve this answer
You can read the number from a string stream as hex, and write it back to a different string stream as decimal:
int x;
istringstream iss("a1a56");
iss >> hex >> x;
ostringstream oss;
oss << x;
string s(oss.str());
Link to ideone.
share|improve this answer
The simplest way of doing this, using the latest version of the C++ Standard (C++11), is to use the std::to_string function:
#include <iostream>
#include <string>
int main()
{
/* Convert: */
std::string s { std::to_string(0xa1a56) };
/* Print to confirm correctness: */
std::cout << s << std::endl;
return 0;
}
share|improve this answer
std::string HexDec2String(int hexIn) {
char hexString[4*sizeof(int)+1];
// returns decimal value of hex
sprintf(hexString,"%i", hexIn);
return std::string(hexString);
}
share|improve this answer
2
char hexString[4*sizeof(int)+1]; should be enough. – R. Martinho Fernandes Oct 12 '12 at 2:39
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.831134 |
What is the minimum value of the function f(x) = 18x^4 + 16x^2 - 16
3 Answers | Add Yours
kingattaskus12's profile pic
kingattaskus12 | (Level 3) Adjunct Educator
Posted on
We can use Calculus to determine the minimum value of the equation. We are required to find the values of` x` where the first derivative`f'(x)=0` because the slope of the line at maximum and minimum point is zero. Moreover, to determine if the point on the graph is a minimum point, the second derivative `f''(a)` must be positive to state that the concavity at that point is upward(the point `a` is the lowest point in the graph) assuming that `x=a` is the solution of `f'(x) = 0` Now, if we take the first derivative of the equation, we get
`f'(x) = d/dx[18x^4+16x^2-16]`
`f'(x) = 18*d/dx(x^4)+16*d/dx(x^2)-d/dx(16)`
`f'(x)=18*4(x^(4-1))+16*2(x^(2-1))-0`
`f'(x) = 72x^3+32x`
Then,
`f'(x) = 72x^3+32x` `=0`
`x(72x^2+32)=0`
This shows that the only real solution is `x=0`
The second derivative will be
`f''(x)=d/dx(72x^3+32x)`
`f''(x) = 72*3(x^(3-1))+32(1)`
`f''(x) =216x^2+32`
Then,
`f''(0) = 216(0)^2+32=32`
which is positive
Thus, it shows that the minimum point of the function
`f(x) = 18x^4+16x^2-16` has a minimum point at `x=0` .
At `x=0` ,
`f(0) = 18(0)^4+16(0)^2-16 = -16`
Therefore, the minimum point on the graph is at `(0,-16).`
justaguide's profile pic
justaguide | College Teacher | (Level 2) Distinguished Educator
Posted on
The minimum value of a function f(x) can be determined using calculus. The function has an extreme value at the point where the first derivative f'(x) = 0. In addition, if x = a is the solution of f'(x) = 0, f''(a) should be positive.
For the function f(x) = 18x^4 + 16x^2 - 16,
f'(x) = 72*x^3 + 32x
72*x^3 + 32x = 0
=> x*(72x^2 + 32) = 0
The only real solution of this equation is x = 0.
The second derivative f''(x) = 216x^2 + 32. At x = 0, f''(0) = 32 which is positive.
The function f(x) = 18x^4 + 16x^2 - 16 has a minimum at x = 0. The value of the function at x = 0 is -16.
The minimum value of f(x) = 18x^4 + 16x^2 - 16 is -16.
tonys538's profile pic
tonys538 | Student, Undergraduate | (Level 1) Valedictorian
Posted on
The minimum value of the function f(x) = 18x^4 + 16x^2 - 16 has to be determined.
One way of doing this is by using calculus. Another way of doing the same is by rewriting the given function as a polynomial with a square of the variable. The square of a real number cannot be negative and as a result its minimum value is 0.
f(x) = 18x^4 + 16x^2 - 16
= x^2*(18x^2 + 16) - 16
Now, x^2 has a minimum value of 0 and 18x^2 + 16 has a minimum value of 16. The minimum value of the product is 0.
This gives the minimum value of x^2*(18x^2 + 16) - 16 as -16.
The minimum value of f(x) = 18x^4 + 16x^2 - 16 is -16.
We’ve answered 318,926 questions. We can answer yours, too.
Ask a question | __label__pos | 0.999948 |
Computer Deactivated
Discussion in 'Studio One' started by Pablo0898, Jun 10, 2024.
1. Pablo0898
Pablo0898 Newbie
Joined:
Jun 10, 2024
Messages:
3
Likes Received:
0
OK! This is not the first time this has happened to me, everytime I have managed to get rid of it until now.
I have inbound and outbound rules blocking studio one and added lines in host file.
I have used Studio One for several years.
This time the dreaded "your computer has been deactivated" will not go away.
Even after deleting the program and all associated files, and reinstalling a fresh.
Started a fresh with 6.0 no luck, then 6.5 no luck and 6.52. Deleted all files between each install.
Any ideas???
2.
3. Danie
Danie Ultrasonic
Joined:
May 12, 2024
Messages:
125
Likes Received:
25
Re-activate your windows with "KMS Activator v5". It resolves all the windows activation issues.
4. Dark6ixer
Dark6ixer Kapellmeister
Joined:
Sep 12, 2017
Messages:
130
Likes Received:
70
have you deleted any studio one entries in your registry also - one thing you *may* have overlooked is blocking the plugin scanner. before I bought FL this was usually the culprit. Block studio one and whatever app or file it uses to scan for plugins. For FL you must block the FL studio app and the "IL plugin scanner"
5. Pablo0898
Pablo0898 Newbie
Joined:
Jun 10, 2024
Messages:
3
Likes Received:
0
I will give that a try later thanks.
6. Pablo0898
Pablo0898 Newbie
Joined:
Jun 10, 2024
Messages:
3
Likes Received:
0
Yes deleted registry entries. Blocking the plugin scan stops the plugins loading.
7. orbitbooster
orbitbooster Audiosexual
Joined:
Jan 8, 2018
Messages:
1,028
Likes Received:
579
1: Windows right?
2: Something like "Your computer is disabled"?
3: Learn the basics of firewalling: imo it's not enough to edit hosts or pushing rules to windows firewall apps because:
4: better to use a third party firewall with those "annoying connection popups" than blissfully leaving the system decide ins and outs without warnings;
5: blocking altogether connections to apps can bring to malfunctions: for example kontakt (s.a. and vst) needs a localhost (127.0.0.1) connection or it crashes.
8. saccamano
saccamano Rock Star
Joined:
Mar 26, 2023
Messages:
1,062
Likes Received:
417
Location:
uranus
Wait. Is it the Windows OS that has become deactivated or Studio One?
If it's the windows os (win10 or above) you should be using the ps activation script which doesn't fail. Or at least I have never seen or heard of it failing even when perusing microsoft sites and/or using msdownload, applying patches, etc... It shouldn't require any special FW blocking either.
9. justwannadownload
justwannadownload Audiosexual
Joined:
Jan 13, 2019
Messages:
1,288
Likes Received:
830
Location:
Central Asia
Had this issue once.
Added the following:
127.0.0.1 api.presonus.com
127.0.0.1 api.presonus.com.cdn.cloudflare.com
to my hosts and it didn't ever happen again. Cheched right now - everything works.
10. Bunford
Bunford Audiosexual
Joined:
Jan 17, 2012
Messages:
2,382
Likes Received:
933
It is Studio One deactivating. Studio One uses a MachineID to activate itself within the R2R keygen. Therefore, I am assuming this is about Studio One becoming deactivating on the machine, which I experienced myself recently in 6.6.1 but haven't investigated at all to see what the issue was as I've not had time.
Have you tried recreating licenses with the R2R keygen and ensuring everything is using correct MachineID, Machine Name, User Name, and so on and then tried to re-license Studio One?
Also, some releases of Studio One aren't truly k'd. R2R releases are, but some others have been raw releases citing "need to use R2R keygen", but this does not work as the installed .exe needs to be patched too. Therefore, if you have installed a non-scene release installer, this may be the issue.
From memory, 6.6.0 is the latest R2R official release, and this worked fine for me without issue. What version are you using?
11. Bunford
Bunford Audiosexual
Joined:
Jan 17, 2012
Messages:
2,382
Likes Received:
933
I just tried this using 6.6.1 and it prompted me with this:
upload_2024-6-11_14-2-53.png
I then chose to "Activate Offline" and then got this (blanked out Activation Code just in case):
upload_2024-6-11_14-5-11.png
I then used the R2R keygen provided in their 6.6.0 release to generate the license files and saved them in an easy location. I then selected the "Select License File" in the above, navigated to the license files locations, and selected the studioapp6.pro.license file. I then got this pop up and upon clicking "OK" the app started up as normally activated:
upload_2024-6-11_14-9-29.png
However, once started, I then got this popup, meaning it's not a properly patched .exe file:
upload_2024-6-11_14-11-8.png
And I know this because when I load up the license for any of these, I get this, as an example:
upload_2024-6-11_14-11-58.png
However, when I then start up Studio One 6.6.1 again, it opens up fine as if it's activated, but still throws up the above requests for licenses for any extensions, but the core app is working fine and activated.
I just re-tried R2R's 6.6.0 following the same as the above, and it does throw up the license request for the extensions too. However, R2R's accept some of the licenses and activates the extension and all is good with those, but there is about 6/7 extensions it won't activate.
Therefore, at present, my advice would be to install R2R version 6.5.2 and authorize as per above and you will have everything licensed, including all extensions. Or, you can use R2R's 6.6.0 with some extensions not working/not authorising.
If you only want the core app and not bothered about any of the extensions, you can also use the 6.6.1 on the sister site, accepting this isn't patched properly and so you will not have licensed extensions.
Last edited: Jun 11, 2024
12. justwannadownload
justwannadownload Audiosexual
Joined:
Jan 13, 2019
Messages:
1,288
Likes Received:
830
Location:
Central Asia
Non-R2R versions often aren't cracked completely. Seems their magic only lasted for one update.
13. Bunford
Bunford Audiosexual
Joined:
Jan 17, 2012
Messages:
2,382
Likes Received:
933
Yup, and that's what I was trying to explain to the OP. Either stick with fully working 6.5.2, upgrade to a half-working 6.6.0 (bunch of extensions not working), or upgrade to core-DAW only 6.6.1 (with no extensions working).
Loading...
Loading... | __label__pos | 0.564039 |
Skip to content
Case CSV
Purpose
By including loops into your automation, you can easily automate repetitive tasks. Yarado can run tasks in loop mode by loading the default loop file at launch. However, there are many cases where it's necessary to load a loop file dynamically or based on business logic. For those situations, Yarado offers the Case CSV function.
The Case CSV function allows you to dynamically load a task's loop file based on the outcome of an IF-statement. Meaning, your predefined criteria must be met before your .csv file is loaded as loop file.
Case CSV
Double click the icon or drag it to the process visuliser to use the Case CSV function.
Using Case CSV
The Case CSV step is a step that must be created manually because it is not possible to provide the decision criteria when you are in recording mode.
Interface elements
Element Description
1. Select Variable Select the corresponding variable.
2. Equals/Contains When testing, define whether the variable should equal (fully match) or contain (partially match) the value.
3. Case sensitivity Checking this box will enable case sensitivity, meaning that Yarado will differentiate between UPPER and lowercase characters.
4. Value to match Select the value or variable to test against.
5. CSV file path Define the file path of the .csv file Yarado should load as loop file if the logic test is passed.
Case CSV interface
Variable based interface elements of Case CSV.
Adding or deleting rules
Once you have configured your rule, click on Add rule to confirm and enter it into the list of rules.
To delete a rule, you first need to select the row you want to delete. You can do so by left-clicking in the most left column of the rules table. If you do so, the row you have selected will light up blue. Then you can right-click to delete the select row or press Delete on your keyboard.
Delete Case CSV rule
Deleting a rule.
Example
Loading a CSV based on a variable value
Case CSV are usually part of more complex task flows, where the steps leading up the Case CSV steps create or append the loop file that will be loaded in the Case CSV step. To keep this example as clear as possible, it's contained to just four Yarado steps.
For this example, we will use a count variable and a value for the trigger in the Case CSV.
1. Create two variables:
• %count% to match against later on.
• %filepath% for the .csv file you want to load.
Case CSV example
Variables used in this example.
2. Open a text editor such as Notepad and a create a .csv file with three lines:
1
2
3
• Make sure you hit Enter one more time after typing "3"; otherwise Yarado will only interpret the first two lines of the loop file.
• Save this file to a location on your machine's main disk.
• Enter the filepath of this file as Variable Value for %filepath%.
3. Add a Hidden Command step with the following argument:
Find /V /C "" < "%filepath%"
This command will count the number of lines in the .csv file you have just created.
Case CSV example
Hidden Command step used in this example.
• Use %count% as the output variable for this step.
• Click on OK to save the step.
4. Add a Case CSV step with the following settings:
Case CSV example
Case CSV step used in this example.
• Click on Add rule and OK to save the step.
5. Add an Execute Program step with the following settings:
Case CSV example
Execute Command step used in this example.
• Click on OK to save the step.
6. Add a Close Application funtion step with the following settings:
Case CSV example
Close Application function step used in this example.
• Click on OK to save the step.
7. Start the loop file at step 3.1 by right clicking on the step and clicking on Steploop → Steploop Start. Repeat this for step 4.1, but click Steploop End here instead of Start.
Case CSV example
Steploop Start.
8. Run the task in loop mode and you will see that your .csv is loaded as loop file, while Yarado loops through opening and closing Edge. | __label__pos | 0.955938 |
QGIS API Documentation 2.11.0-Master
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
layer.h
Go to the documentation of this file.
1 /*
2 * libpal - Automated Placement of Labels Library
3 *
4 * Copyright (C) 2008 Maxence Laurent, MIS-TIC, HEIG-VD
5 * University of Applied Sciences, Western Switzerland
6 * http://www.hes-so.ch
7 *
8 * Contact:
9 * maxence.laurent <at> heig-vd <dot> ch
10 * or
11 * eric.taillard <at> heig-vd <dot> ch
12 *
13 * This file is part of libpal.
14 *
15 * libpal is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * libpal is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with libpal. If not, see <http://www.gnu.org/licenses/>.
27 *
28 */
29
30 #ifndef _LAYER_H_
31 #define _LAYER_H_
32
33 #include "pal.h"
34 #include <QMutex>
35 #include <QLinkedList>
36 #include <QHash>
37 #include <fstream>
38
39 class QgsLabelFeature;
40
41 namespace pal
42 {
43
44 template<class DATATYPE, class ELEMTYPE, int NUMDIMS, class ELEMTYPEREAL, int TMAXNODES, int TMINNODES> class RTree;
45
46 class FeaturePart;
47 class Pal;
48 class LabelInfo;
49
57 class CORE_EXPORT Layer
58 {
59 friend class Pal;
60 friend class FeaturePart;
61
62 friend class Problem;
63
64 friend class LabelPosition;
65 friend bool extractFeatCallback( FeaturePart *ft_ptr, void *ctx );
66
67 public:
68 enum LabelMode { LabelPerFeature, LabelPerFeaturePart };
70 {
71 Upright, // upside-down labels (90 <= angle < 270) are shown upright
72 ShowDefined, // show upside down when rotation is layer- or data-defined
73 ShowAll // show upside down for all labels, including dynamic ones
74 };
75
76 virtual ~Layer();
77
78 bool displayAll() const { return mDisplayAll; }
79
82 int featureCount() { return mHashtable.size(); }
83
85 QgsAbstractLabelProvider* provider() const { return mProvider; }
86
89 QString name() const { return mName; }
90
94 Arrangement arrangement() const { return mArrangement; }
95
100 void setArrangement( Arrangement arrangement ) { mArrangement = arrangement; }
101
105 LineArrangementFlags arrangementFlags() const { return mArrangementFlags; }
106
111 void setArrangementFlags( const LineArrangementFlags& flags ) { mArrangementFlags = flags; }
112
123 void setActive( bool active ) { mActive = active; }
124
128 bool active() const { return mActive; }
129
136 void setLabelLayer( bool toLabel ) { mLabelLayer = toLabel; }
137
141 bool labelLayer() const { return mLabelLayer; }
142
147 ObstacleType obstacleType() const { return mObstacleType; }
148
154 void setObstacleType( ObstacleType obstacleType ) { mObstacleType = obstacleType; }
155
161 void setPriority( double priority );
162
167 double priority() const { return mDefaultPriority; }
168
173 void setLabelMode( LabelMode mode ) { mMode = mode; }
174
178 LabelMode labelMode() const { return mMode; }
179
184 void setMergeConnectedLines( bool merge ) { mMergeLines = merge; }
185
189 bool mergeConnectedLines() const { return mMergeLines; }
190
195 void setUpsidedownLabels( UpsideDownLabels ud ) { mUpsidedownLabels = ud; }
196
200 UpsideDownLabels upsidedownLabels() const { return mUpsidedownLabels; }
201
208 void setCentroidInside( bool forceInside ) { mCentroidInside = forceInside; }
209
214 bool centroidInside() const { return mCentroidInside; }
215
223 void setFitInPolygonOnly( bool fitInPolygon ) { mFitInPolygon = fitInPolygon; }
224
229 bool fitInPolygonOnly() const { return mFitInPolygon; }
230
239 bool registerFeature( QgsLabelFeature* label );
240
242 void joinConnectedFeatures();
243
245 void chopFeaturesAtRepeatDistance();
246
247 protected:
250
253
255
257
259 bool mActive;
264
267 LineArrangementFlags mArrangementFlags;
270
272
273 // indexes (spatial and id)
277
280
282
296 Layer( QgsAbstractLabelProvider* provider, const QString& name, Arrangement arrangement, double defaultPriority, bool active, bool toLabel, Pal *pal, bool displayAll = false );
297
299 void addFeaturePart( FeaturePart* fpart, const QString &labelText = QString() );
300
301 };
302
303 } // end namespace pal
304
305 #endif
UpsideDownLabels upsidedownLabels() const
Returns how upside down labels are handled within the layer.
Definition: layer.h:200
bool mMergeLines
Definition: layer.h:269
ObstacleType obstacleType() const
Returns the obstacle type, which controls how features within the layer act as obstacles for labels...
Definition: layer.h:147
bool mActive
Definition: layer.h:259
bool mLabelLayer
Definition: layer.h:260
QLinkedList< FeaturePart * > mFeatureParts
List of feature parts.
Definition: layer.h:252
bool active() const
Returns whether the layer is currently active.
Definition: layer.h:128
QStringList mConnectedTexts
Definition: layer.h:279
Arrangement arrangement() const
Returns the layer's arrangement policy.
Definition: layer.h:94
bool labelLayer() const
Returns whether the layer will be labeled or not.
Definition: layer.h:141
A layer of spacial entites.
Definition: layer.h:57
QHash< QgsFeatureId, QgsLabelFeature * > mHashtable
Lookup table of label features (owned by the label feature provider that created them) ...
Definition: layer.h:276
double mDefaultPriority
Definition: layer.h:256
void setObstacleType(ObstacleType obstacleType)
Sets the obstacle type, which controls how features within the layer act as obstacles for labels...
Definition: layer.h:154
Arrangement mArrangement
Optional flags used for some placement methods.
Definition: layer.h:266
Pal main class.
Definition: pal.h:111
UpsideDownLabels
Definition: layer.h:69
bool displayAll() const
Definition: layer.h:78
double priority() const
Returns the layer's priority, between 0 and 1.
Definition: layer.h:167
bool centroidInside() const
Returns whether labels placed at the centroid of features within the layer are forced to be placed in...
Definition: layer.h:214
void setUpsidedownLabels(UpsideDownLabels ud)
Sets how upside down labels will be handled within the layer.
Definition: layer.h:195
ObstacleType mObstacleType
Definition: layer.h:258
void setCentroidInside(bool forceInside)
Sets whether labels placed at the centroid of features within the layer are forced to be placed insid...
Definition: layer.h:208
void setArrangement(Arrangement arrangement)
Sets the layer's arrangement policy.
Definition: layer.h:100
void setFitInPolygonOnly(bool fitInPolygon)
Sets whether labels which do not fit completely within a polygon feature are discarded.
Definition: layer.h:223
QString mName
Definition: layer.h:249
bool mergeConnectedLines() const
Returns whether connected lines will be merged before labeling.
Definition: layer.h:189
Optional additional info about label (for curved labels)
Definition: feature.h:47
int featureCount()
Returns the number of features in layer.
Definition: layer.h:82
QgsAbstractLabelProvider * provider() const
Returns pointer to the associated provider.
Definition: layer.h:85
bool mCentroidInside
Definition: layer.h:262
Main class to handle feature.
Definition: feature.h:79
The QgsAbstractLabelProvider class is an interface class.
void setArrangementFlags(const LineArrangementFlags &flags)
Sets the layer's arrangement flags.
Definition: layer.h:111
bool fitInPolygonOnly() const
Returns whether labels which do not fit completely within a polygon feature are discarded.
Definition: layer.h:229
LineArrangementFlags mArrangementFlags
Definition: layer.h:267
bool extractFeatCallback(FeaturePart *ft_ptr, void *ctx)
Definition: pal.cpp:151
Pal * pal
Definition: layer.h:254
QHash< QString, QLinkedList< FeaturePart * > * > mConnectedHashtable
Definition: layer.h:278
LabelMode
Definition: layer.h:68
bool mDisplayAll
Definition: layer.h:261
Arrangement
The way to arrange labels against spatial entities.
Definition: pal.h:77
void setActive(bool active)
Sets whether the layer is currently active.
Definition: layer.h:123
void setLabelLayer(bool toLabel)
Sets whether the layer will be labeled.
Definition: layer.h:136
QgsAbstractLabelProvider * mProvider
Definition: layer.h:248
The QgsLabelFeature class describes a feature that should be used within the labeling engine...
ObstacleType
Definition: pal.h:97
void setLabelMode(LabelMode mode)
Sets the layer's labeling mode.
Definition: layer.h:173
QMutex mMutex
Definition: layer.h:281
LabelPosition is a candidate feature label position.
Definition: labelposition.h:48
QString name() const
Returns the layer's name.
Definition: layer.h:89
LineArrangementFlags arrangementFlags() const
Returns the layer's arrangement flags.
Definition: layer.h:105
LabelMode mMode
Definition: layer.h:268
Represent a problem.
Definition: problem.h:93
RTree< FeaturePart *, double, 2, double, 8, 4 > * rtree
Definition: layer.h:274
bool mFitInPolygon
Definition: layer.h:263
LabelMode labelMode() const
Returns the layer's labeling mode.
Definition: layer.h:178
UpsideDownLabels mUpsidedownLabels
Definition: layer.h:271
void setMergeConnectedLines(bool merge)
Sets whether connected lines should be merged before labeling.
Definition: layer.h:184 | __label__pos | 0.76105 |
0 votes
in Technology by (1.7m points)
What is the use of Initialize and cleanup in object studio in Blue-prism?
1 Answer
0 votes
by (1.7m points)
Initialize and cleanup is the pre and post conditions which will execute at the start and end of the object respectively.
It cannot be called through action as it will run automatically when a particular object is called.
... | __label__pos | 0.995071 |
#!/usr/bin/make -f # template debian/rules provided by dh-make-php. # GNU copyright 2005 by Uwe Steinmann. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This has to be exported to make some magic below work. export DH_OPTIONS CFLAGS = -O2 -Wall CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) CFLAGS += -g DEBUG := --enable-debug else DEBUG := --disable-debug endif TAR=tar PECL_PKG_NAME=radius PECL_PKG_REALNAME=radius PECL_PKG_VERSION=1.2.5 PACKAGE_NAME=php-radius BIN_PACKAGE_NAME=php$*-radius PHPIZE=/usr/bin/phpize PHPCONFIG=/usr/bin/php-config EXT_DIR=$(shell $(PHPCONFIG)$* --extension-dir) SOURCE_DIR=$(shell ls -d $(PECL_PKG_REALNAME)-*) BINARYTARGETS=binary-arch-v5 BUILDTARGETS=build-v5 CLEANTARGETS=clean-v5 # Sarge doesn't support --phpapi option (Bug #365667) phpapiver4=$(shell /usr/bin/php-config4 --phpapi) #phpapiver4=$(/usr/bin/php-config4 --extension-dir | xargs basename) phpapiver5=$(shell /usr/bin/php-config5 --phpapi) configure-v4 configure-v5: configure-v%: configure-stamp-v% configure-stamp-v4 configure-stamp-v5: configure-stamp-v%: dh_testdir # Add here commands to configure the package. (cd $(SOURCE_DIR); \ $(PHPIZE)$*; \ ./configure --with-php-config=$(PHPCONFIG)$* --prefix=/usr) # rm -f configure-stamp-v* touch $@ build: $(BUILDTARGETS) build-v4 build-v5: build-v%: build-stamp-v% build-stamp: # xsltproc --nonet --novalid debian/changelog.xsl package.xml > debian/Changelog $(shell /usr/share/dh-make-php/phppkginfo . changelog > debian/Changelog) touch build-stamp build-stamp-v4 build-stamp-v5: build-stamp-v%: build-stamp configure-stamp-v% dh_testdir # Add here commands to compile the package. (cd $(SOURCE_DIR); $(MAKE); mkdir -p ../tmp/modules$*; cp modules/* ../tmp/modules$*; $(MAKE) clean) # rm -f build-stamp-v* touch $@ clean: $(CLEANTARGETS) dh_clean clean-v4 clean-v5: clean-v%: dh_testdir dh_testroot rm -f build-stamp* configure-stamp* # Add here commands to clean up after the build process. (cd $(SOURCE_DIR); \ $(MAKE) clean; \ $(PHPIZE)$* --clean) rm -rf tmp/modules$* install-v4 install-v5: install-v%: build-v% dh_testdir dh_testroot # can't dh_clean here without specifically excluding the possibly existing installed dirs # for other version. #dh_clean -k dh_installdirs # dh_pecl # Add here commands to install the package into debian/$(PACKAGE_NAME). # $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/$(PACKAGE_NAME) install # sh -c 'VERSION=`egrep "#define ZEND_MODULE_API_NO" \ # /usr/include/php4/Zend/zend_modules.h \ # | sed "s/#define ZEND_MODULE_API_NO //"`; \ # chmod 644 debian/$(PACKAGE_NAME)/usr/lib/php4/$$VERSION/*.so' mkdir -p debian/$(BIN_PACKAGE_NAME)/$(EXT_DIR) install -m 644 -o root -g root tmp/modules$*/$(PECL_PKG_NAME).so debian/$(BIN_PACKAGE_NAME)/$(EXT_DIR)/$(PECL_PKG_NAME).so if [ -f "debian/$(PECL_PKG_NAME).ini" ]; then \ mkdir -p debian/$(BIN_PACKAGE_NAME)/etc/php$*/conf.d; \ cp debian/$(PECL_PKG_NAME).ini debian/$(BIN_PACKAGE_NAME)/etc/php$*/conf.d; \ fi # Build architecture-independent files here. binary-indep: dh_testdir dh_testroot dh_installdirs dh_installchangelogs -i php-radius-*/CHANGES dh_installdocs -i dh_installexamples -i cp php-radius-*/radius_authentication.inc debian/php-radius-legacy/usr/share/php-radius/radius_authentication.inc.php cp php-radius-*/radius_authentication.conf.template debian/php-radius-legacy/usr/share/doc/php-radius-legacy/examples/server.conf cp php-radius-*/CHANGES debian/php-radius-legacy/usr/share/doc/php-radius-legacy/changelog ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) dh_strip -i endif dh_compress -i dh_fixperms -i dh_installdeb -i dh_shlibdeps -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i # Build architecture-dependent files here. binary-arch-v4 binary-arch-v5: binary-arch-v%: install-v% echo "php:Depends=phpapi-$(phpapiver$*)" >> debian/$(BIN_PACKAGE_NAME).substvars binary-arch: $(BINARYTARGETS) dh_testdir dh_testroot dh_installchangelogs -a debian/Changelog dh_installdocs -a dh_installexamples -a dh_installdebconf -a ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) dh_strip -a endif dh_compress -a dh_fixperms -a dh_installdeb -a dh_shlibdeps -a dh_gencontrol -a dh_md5sums -a dh_builddeb -a binary: binary-indep binary-arch .PHONY: build build-v4 build-v5 clean clean-v4 clean-v5 binary-indep binary-arch binary-arch-v4 binary-arch-v5 binary install-v4 install-v5 configure-v4 configure-v5 | __label__pos | 0.656342 |
Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.
Is it a bad idea to grant shell access to the user account destined to be running Apache/Nginx?
I ask because, the Guvnr, in his VPS Bible series, sets up a new user with visudo'd
guvnr ALL=(ALL) ALL
privileges, and then sets up an Nginx server with that user.
Whereas the authors of Nginx HTTP Server recommend that you not grant shell access to the user running Nginx.
You could always remove guvnr's shell access, but then, how would you administer your websites?
edit: @Bart Silverstrim - Here's how the guvnr installs Nginx:
• (logged in as user guvnr)
• sudo install nginx dependencies
• user wget nginx source files
• user ./configure --sbin-path=/usr/local/sbin --with-http_ssl_module
• user make
• sudo make install
So perhaps Nginx is being installed to root here?
Is this an ok practice if root login is disabled in /etc/ssh/sshd_config?
share|improve this question
3 Answers 3
up vote 5 down vote accepted
Generally it's a bad idea to give shell access to any account that is created just for a daemon/service to have access to particular system functions that don't require shell access. That way it'll prevent someone from breaking an (Internet-facing) service and gaining more privileges than was necessary.
Basically, why increase your attack surface if you don't need to?
On the flipside, in re-reading the question, it's not clear that nginx has has a shell account. Was nginx set up BY the guvnr account, or was it granted an actual account of its own? Every application is set up by a user, often with some administrative access. It doesn't mean that it's running AS that user always (i.e., just because cat was installed by root doesn't mean that jdoe running cat is running cat as root.) Only if nginx were running with guvnr's account privileges or as guvnr would it have access to the shell; it may very well be dropping privileges as soon as it forks or it could have its own nginx account or run as a web user account that has little or no privileges. You might want to do more digging in the config and see just what the server is running as.
share|improve this answer
Edited my post to reflect RTFM again :). I believe it's being run from root. Is that ok? – bottles Oct 4 '11 at 15:51
It means it's being installed as an elevated account, not that it's necessarily running as root. There are daemons that start with elevated privileges and drop them at runtime. Look in the config files to see if there's a user account it's specified to run as, or perhaps in Top it may show what user it's running as. – Bart Silverstrim Oct 4 '11 at 16:36
You're right - There's an alternate user specified in nginx.conf. – bottles Oct 4 '11 at 17:24
Because of security. If the user can't get an actual interactive shell, it's one thing less to worry about when securing your server.
Whether the user can use sudo or not has nothing to do with the user being able to open a shell.
share|improve this answer
Generally you want to give your users minimum privileges they need to do their job. Services do not need shell, so you generally wouldn't give shell access to accounts dedicated to running a daemon.
Especially, if a service accessible from network runs as a particular user, it's good idea not to give that user shell access. The reasoning is, that if your service gets compromised, then the attacker won't get shell access to the system.
If this user has a shell access, the attacker potentially has one obstacle less to overcome to take over your system. If this user has a root equivalent privileges (via sudo), then if an attacker manages to trick the system to run some command, he can do it with root authority.
While having a web server run under a uid with shell access is something you can reason about, your setup is very close to running the service as root. Bad idea IMO.
How do you administer? Either "by hand" or find a tool that does not require you to compromise your systems security.
share|improve this answer
Your Answer
discard
By posting your answer, you agree to the privacy policy and terms of service.
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.867507 |
>>> Ïåðåéòè íà ìîáèëüíûé ðàçìåð ñàéòà >>>
Ó÷åáíèê äëÿ 2 êëàññà
|1 ÷àñòü|
ÌÀÒÅÌÀÒÈÊÀ
Óðîê ñòð. 9
Îäíîçíà÷íûå ÷èñëà Äâóçíà÷íûå ÷èñëà
1.
Âûïèøè â îäíó ñòðîêó îäíîçíà÷íûå ÷èñëà, à â äðóãóþ — äâóçíà÷íûå ÷èñëà:
15, 51, 7, 70, 2, 13, 1, 9, 10, 99.
2.
Êàêèå ÷èñëà ïðîïóùåíû â êàæäîì ðÿäó?
3.
4.
Ìèøà âûèãðàë 6 ïàðòèé â øàøêè, à Âàíÿ — íà 2 ïàðòèè áîëüøå.
Ïîñòàâü âîïðîñ è ðåøè çàäà÷ó.
5.
1) Ó Êîëè áûëî 6 êíèã. Â äåíü ðîæäåíèÿ åìó ïîäàðèëè åù¸ 4 êíèãè. Ñêîëüêî êíèã ñòàëî ó Êîëè?
2) Ó Êîëè 10 êíèã. Îí îòí¸ñ 2 êíèãè â êëàññíóþ áèáëèîòåêó. Ñêîëüêî êíèã ó íåãî îñòàëîñü?
6.
7.
Íà ñòîëå ëåæàò îâîùè:
Ñêîëüêèìè ñïîñîáàìè ìîæíî ñîñòàâèòü íàáîð èç äâóõ îâîùåé? Çàðèñóé ýòè íàáîðû â òåòðàäè.
Ïðîâåðî÷íûå ðàáîòû, ñ. 4, 5.
Ðåáóñû:
Top.Mail.Ru
Top.Mail.Ru | __label__pos | 0.928313 |
W3C home > Mailing lists > Public > [email protected] > July to September 2012
[Bug 17765] New: APIs need to take a reference to blob data underlying object URLs
From: <[email protected]>
Date: Thu, 12 Jul 2012 23:04:00 +0000
To: [email protected]
Message-ID: <[email protected]/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=17765
Summary: APIs need to take a reference to blob data underlying
object URLs
Product: WebAppsWG
Version: unspecified
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: normal
Priority: P2
Component: File API
AssignedTo: [email protected]
ReportedBy: [email protected]
QAContact: [email protected]
CC: [email protected]
This is the remaining portion of the autoRevoke blob URL feature. APIs that
take URLs and then operate on them asynchronously need to synchronously take a
reference to the underlying blob data before returning.
For example, when you say "img.src = URL.createBlobURL(blob)", the image fetch
doesn't necessarily begin immediately. It may not happen until well after the
script returns. Currently, that means that by the time the fetch begins, the
URL would no longer exist, because it's released as soon as the script returns.
To fix this, "img.src = blobURL" needs to take a reference to the underlying
blob data before the assignment returns. Then, all fetches that would normally
operate on the @src URL actually take place on the blob data.
For example, using XHR2 as an example, "Associate blob data with *url*" would
be added as a step after 6 (after resolving the URL). The "associate blob data
with url" algorithm would look up the Blob associated with the URL, and
associate the underlying data of that blob to it (or do nothing if it's not a
blob URL). That way, the blob data tags along with the URL when it's lter sent
to fetch (when send is called).
(In case this isn't clear, this is treating XHR2's "url" property as a
string-like object with a property hanging off it, and this wouldn't be visible
to scripts. It's essentially shorthand for passing a (url, blob) tuple to
fetch.)
As a side-effect, this also prevents "img.src = URL.createObjectURL(blob);
blob.close();" from being nondeterministic. Currently, it depends on what
stage the image update was at.
One other note: all APIs should attempt to take this reference at the time the
URL enters the API (eg. when xhr.open is called), not at some later point (like
xhr.send). That is, this should still always work (for any API) without caring
if the caller gave you a blob URL:
function openURLLater(url)
{
xhr.open(url);
setTimeout(function() { xhr.send(); }, 1000);
}
--
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Thursday, 12 July 2012 23:04:01 UTC
This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:37 UTC | __label__pos | 0.524392 |
C Program for simulating blocking probabilities in multiservice loss systems ---------------------------------------------------------------------------- Version 2.0 , 29. Sept. 2000 Author: Jan Hlinovsky, [email protected] Organisation: Laboratory of Telecommunications Technology, Helsinki University of Technology Contents: 1. Copyright information 2. Compiling the program 3. Input file format 4. Running the program 5. References 1. Copyright information ------------------------ The program can be used and modified freely. No claims are made about the correctness of the program and no liability is taken for any damage caused by the use of the program. 2. Compiling the program ------------------------ In Unix, the program can be compiled using the make utility. Make sure you have all the following files: main.c ini.c read.c simu.c ini.h read.h simu.h structs.h Makefile The Makefile is written to be used with gcc, so if you want to use some other compiler and linker, replace the corresponding lines in the Makefile. The program uses two functions for random number generation that are not part of the standard C library, namely srand48() and drand48(). Check that you have these (e.g. "grep [sd]rand48 /usr/include/stdlib.h" ). If you don't have these functions you may want to replace them with some other random number generator that returns a value between 0 and 1. If you have gcc and the above mentioned functions, just type "make" in the directory where the source files and the Makefile are. 3. Input file format -------------------- An input file must be a text file and have the following properties: a) content of an input file is (in following order): number of classes (integer) number of links (integer) load vector rho (real) capacity vector (integer) matrix of bandwidth requirements; (integer) NOTE: nr of rows = nr of classes nr of columns = nr of links b) Every scalar number, vector, or matrix row is on its own line. c) Lines beginning with '%' are ignored (comments). d) Following letters are ignored: []{},; (blocks, braces, comma, semicolon). e) Any number of whitespace (space, tabs, newlines) is allowed, except for rule b): no newlines inside a vector or a matrix row. Examples of input files: ----------------------- The following file is a legal input file: % beginning of example file 1 ----------- 2 3 35 22 100 120 170 2 0 2 0 3 3 % end of example file 1 ------------------ The following is also legal, and more understandable input file: % begining of example file 2 ------------- %number of classes 2 %number of links 3 % load vector rho [35, 22] % capacity C [100, 120, 170] %B [[2, 0, 2] [0, 3, 3]] % end of example file 2 ------------------- 4. Running the program ---------------------- The program is started with the command ./netwsim. The input file may be given as an argument, otherwise it is asked for. Then the program asks for number of batches and batch size. The batches are used for calculating the 95% confidence interval, so the number should be several hundred. The number of samples in one batch should be a multiple of 1000, for optimal allocation of samples. After this the program will ask which class you are interested in. The program will write the point estimate of blocking probability and its 95 % confidence interval for the class that is being simulated, and the amount of processor time used for the simulation. Note that for very long simulations (e.g. hours) the clock may "overflow". example: ~ % ./netwsim inputfile Enter number of batches:400 Enter number of samples in one batch (min. 1000):5000 For which class (number) you want to run the simulation?:2 Traffic class Point estimate of Bk 95% conf int ================================================================== 2 0.0130674 [0.0130644 , 0.0130704] Simulation time: 19.490 sec 5. References ------------- The program uses a sophisticated inverse convolution method for calculating blocking probabilities. The method is described in the following paper: P. Lassila, J. Virtamo, "Nearly Optimal Importance Sampling for Monte Carlo Simulation of Loss Systems", to appear in ACM TOMACS, January 2001. The paper is available from http://www.tct.hut.fi/tutkimus/com2/ | __label__pos | 0.935522 |
Link text frames to duplicate text around a layout?
Previous topic - Next topic
Wally4
Hello
I find myself inserting the same text over and over in each document. Is there a way to link text frames to adopt the text of one?
For example my package design has "Limited Edition" in 5 text frames. Each frame has its own visual properties, but is there a way to change the text in just one and have it update across all 5 text frames wile retaining each text frames properties? Including the inputs required to edit all 5 it feels tedious after doing this to a few documents.
Am I missing something thats already there?
Thanks!
GarryP
Hello Wally4 and welcome to the forum.
As of 1.4.x there's no way for text frames to have contents that are dependant on the content of another frame.
It might be possible to change the text of multiple frames at the same time using a script but that's probably too much work to create and test (certainly more work than just re-typing a small bit of text into a few frames).
However, in 1.5.1 you can create what's currently called "variable text". With this - menu Insert -> Marks -> Variable Text - you can create a variable (e.g. give it a label of "Special" (or whatever) and text of "Limited Edition" (or whatever)).
The first time you insert the variable it is created. The next time you want to use this variable you can insert the variable text mark and choose the already created variable and it will be inserted while taking on the formatting of the existing text/frame. You can change the text by selecting the text inserted, going to insert the variable mark again, selecting the appropriate variable then changing the text which will change all inserted copies.
It's not a pretty way of doing things - and this might change in future versions (or the function might be dropped altogether, who knows?) - but it works.
You need to be aware that the 1.5.x versions of Scribus are development versions and as such are not recommended for use in production situations (although many people are doing so). Also, anything you save with 1.5.x cannot be opened in the 1.4.x versions (so you can't go back to a stable version). It's your choice whether to use it or not. | __label__pos | 0.996793 |
blob: 08494664ab78d362fcc3b62878cff83ce2cd3921 [file] [log] [blame]
/*
* SoC specific setup code for the AT91SAM9N12
*
* Copyright (C) 2012 Atmel Corporation.
*
* Licensed under GPLv2 or later.
*/
#include <linux/module.h>
#include <linux/dma-mapping.h>
#include <asm/irq.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <mach/at91sam9n12.h>
#include <mach/at91_pmc.h>
#include <mach/cpu.h>
#include <mach/board.h>
#include "soc.h"
#include "generic.h"
#include "clock.h"
#include "sam9_smc.h"
/* --------------------------------------------------------------------
* Clocks
* -------------------------------------------------------------------- */
/*
* The peripheral clocks.
*/
static struct clk pioAB_clk = {
.name = "pioAB_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_PIOAB,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk pioCD_clk = {
.name = "pioCD_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_PIOCD,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk usart0_clk = {
.name = "usart0_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_USART0,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk usart1_clk = {
.name = "usart1_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_USART1,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk usart2_clk = {
.name = "usart2_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_USART2,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk usart3_clk = {
.name = "usart3_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_USART3,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk twi0_clk = {
.name = "twi0_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_TWI0,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk twi1_clk = {
.name = "twi1_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_TWI1,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk mmc_clk = {
.name = "mci_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_MCI,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk spi0_clk = {
.name = "spi0_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_SPI0,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk spi1_clk = {
.name = "spi1_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_SPI1,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk uart0_clk = {
.name = "uart0_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_UART0,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk uart1_clk = {
.name = "uart1_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_UART1,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk tcb_clk = {
.name = "tcb_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_TCB,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk pwm_clk = {
.name = "pwm_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_PWM,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk adc_clk = {
.name = "adc_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_ADC,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk dma_clk = {
.name = "dma_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_DMA,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk uhp_clk = {
.name = "uhp",
.pmc_mask = 1 << AT91SAM9N12_ID_UHP,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk udp_clk = {
.name = "udp_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_UDP,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk lcdc_clk = {
.name = "lcdc_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_LCDC,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk ssc_clk = {
.name = "ssc_clk",
.pmc_mask = 1 << AT91SAM9N12_ID_SSC,
.type = CLK_TYPE_PERIPHERAL,
};
static struct clk *periph_clocks[] __initdata = {
&pioAB_clk,
&pioCD_clk,
&usart0_clk,
&usart1_clk,
&usart2_clk,
&usart3_clk,
&twi0_clk,
&twi1_clk,
&mmc_clk,
&spi0_clk,
&spi1_clk,
&lcdc_clk,
&uart0_clk,
&uart1_clk,
&tcb_clk,
&pwm_clk,
&adc_clk,
&dma_clk,
&uhp_clk,
&udp_clk,
&ssc_clk,
};
static struct clk_lookup periph_clocks_lookups[] = {
/* lookup table for DT entries */
CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
CLKDEV_CON_DEV_ID("usart", "f801c000.serial", &usart0_clk),
CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart1_clk),
CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart2_clk),
CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk),
CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk),
CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk),
CLKDEV_CON_ID("pioA", &pioAB_clk),
CLKDEV_CON_ID("pioB", &pioAB_clk),
CLKDEV_CON_ID("pioC", &pioCD_clk),
CLKDEV_CON_ID("pioD", &pioCD_clk),
/* additional fake clock for macb_hclk */
CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &uhp_clk),
CLKDEV_CON_DEV_ID("ohci_clk", "500000.ohci", &uhp_clk),
};
/*
* The two programmable clocks.
* You must configure pin multiplexing to bring these signals out.
*/
static struct clk pck0 = {
.name = "pck0",
.pmc_mask = AT91_PMC_PCK0,
.type = CLK_TYPE_PROGRAMMABLE,
.id = 0,
};
static struct clk pck1 = {
.name = "pck1",
.pmc_mask = AT91_PMC_PCK1,
.type = CLK_TYPE_PROGRAMMABLE,
.id = 1,
};
static void __init at91sam9n12_register_clocks(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
clk_register(periph_clocks[i]);
clk_register(&pck0);
clk_register(&pck1);
clkdev_add_table(periph_clocks_lookups,
ARRAY_SIZE(periph_clocks_lookups));
}
/* --------------------------------------------------------------------
* AT91SAM9N12 processor initialization
* -------------------------------------------------------------------- */
static void __init at91sam9n12_map_io(void)
{
at91_init_sram(0, AT91SAM9N12_SRAM_BASE, AT91SAM9N12_SRAM_SIZE);
}
void __init at91sam9n12_initialize(void)
{
at91_extern_irq = (1 << AT91SAM9N12_ID_IRQ0);
/* Register GPIO subsystem (using DT) */
at91_gpio_init(NULL, 0);
}
struct at91_init_soc __initdata at91sam9n12_soc = {
.map_io = at91sam9n12_map_io,
.register_clocks = at91sam9n12_register_clocks,
.init = at91sam9n12_initialize,
}; | __label__pos | 0.998727 |
css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv
Pen Settings
CSS Base
Vendor Prefixing
Add External Stylesheets/Pens
Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
+ add another resource
You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.
Add External Scripts/Pens
Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
+ add another resource
Use npm Packages
We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.
⚠️ This feature can only be used by logged in users.
Code Indentation
Save Automatically?
If active, Pens will autosave every 30 seconds after being saved once.
Auto-Updating Preview
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
<script>console.clear()</script>
<div class="controls">
<div class="green">
Move the <b>green alpaca</b>
<div class="keys"><kbd data-key="1">1</kbd> & <kbd data-key="2">2</kbd></div>
<small>or mouse/touch</small>
</div>
<div class="mission">Help them <span class="throb">kiss</span>!</div>
<div class="pink">
Move the <b>pink alpaca</b> with
<div class="keys"><kbd data-key="arrowleft">◀︎</kbd> & <kbd data-key="arrowright">▶</kbd></div>
<small>or mouse/touch</small>
</div>
</div>
!
@alt: #470031; // #323232
@main: darken(@alt, 4%);// #212121;
@green: #62D2A2;
@pink: #DD5B82;
@import url('https://fonts.googleapis.com/css?family=Patrick+Hand+SC');
canvas {
width: auto;
max-width: 90%;
height: auto;
max-height: 75vh;
display: block;
margin: 0 auto;
border: solid 10px @main;
cursor: move;
position: relative; z-index: 2;
}
html {
height: 100%;
background: @alt;
color: #FFF;
}
body { min-height: 100%; max-width: 900px; margin: auto; }
@media (min-width: 400px) and (min-height: 400px) and (max-width: 1200px) {
body {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
}
/* //////////////////////////////////////// */
/* Special Valentines Day Background *
@width: 21px;
@height: @width * 2;
@speed: 10s;
// body:before,
// body:after {
// content: '';
// position: absolute;
// top: 0; right: 0; bottom: 0; left: 0;
// margin: auto;
// opacity: 0.5;
// width: 100%;
// height: 100%;
// box-sizing: content-box;
// padding: @width @height;
// background-repeat: repeat;
// background-size: @width auto;
// background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 viewBox=%220 -0.5 20 40%22 shape-rendering=%22crispEdges%22%3E%0A%3Cpath stroke=%22%23DC3737%22 d=%22M1 0h2M4 0h2M0 1h7M1 2h5M2 3h3M3 4h1%22 %2F%3E%0A%3C%2Fsvg%3E");
// animation: hearts @speed linear infinite;
// //animation-timing-function: cubic-bezier(.65,0,.35,.99);
// @keyframes hearts {
// 0% { transform: translate3d(0px, 0px, 0px); }
// // 50% { transform: translate3d(@width, @height * -0.5, 0px); }
// 100% { transform: translate3d(@width, -@height, 0px); }
// }
// @keyframes hearts2 {
// 0% { transform: translate3d(0px, 0px, 0px); }
// // 50% { transform: translate3d(@width, @height * -0.5, 0px); }
// 100% { transform: translate3d(-@width, -@height, 0px); }
// }
// }
// body:after {
// left: @width * -0.5;
// opacity: 0.25;
// animation-name: hearts2;
// animation-delay: @speed * -0.5;
// }
/* //////////////////////////////////////// */
.controls {
// position: absolute;
// bottom: 0;
// left: 0; right: 0;
margin: 0 auto;
width: 90%;
max-width: 800px;
max-height: 80vh;
border: solid 10px @main;
background: @main;
text-align: center;
position: relative;
z-index: 99;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 16px;
font-family: 'Patrick Hand SC', cursive;
text-transform: uppercase;
> * { padding: 0.5em 0.5em; }
}
.mission { font-weight: bold; font-size: 1.5em; }
.keys { margin: 0.5em auto 0.25em; }
.green b { color: @green }
.pink b { color: @pink; }
.throb { animation: throb 1s linear infinite alternate;
}
@keyframes throb {
0% { color: #FE9797; }
100% { color: #DD5B82; }
}
kbd {
display: inline-block;
padding: 10px;
border: solid 1px #aaa;
background: #eee;
border-radius: 0.1em;
color: #555;
width: 2.5em;
height: 1.2em;
text-transform: none;
border-bottom-width: 0.3em;
border-radius: 0.5em;
border-bottom-right-radius: 0.5em;
font-family: monospace;
font-size: calc(11px + 2vw);
}
[data-key] { cursor: pointer; }
!
(function() {
const green = '#62D2A2';
const pink = '#DD5B82';
const size = 30;
const speed = 0.07;
const shape = [
[0,0,0,0,0,0,0,1,0,0,0],
[0,0,0,0,0,0,0,1,1,1,1],
[0,0,0,0,0,0,0,1,1,1,1],
[0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,1,1,1,1,1,1,0,0],
[1,1,1,1,1,1,1,1,1,0,0],
[0,0,0,1,1,1,1,1,1,0,0],
[0,0,0,1,1,0,0,1,1,0,0],
[0,0,0,1,1,0,0,1,1,0,0],
[0,0,0,1,1,0,0,1,1,0,0],
];
const heartShape = [
[0,1,1,0,1,1,0],
[1,1,1,1,1,1,1],
[0,1,1,1,1,1,0],
[0,0,1,1,1,0,0],
[0,0,0,1,0,0,0]
];
var haveKissed = false;
var sceneWidth = 800;
var sceneHeight = 800;
/*////////////////////////////////////////*/
var World = Matter.World,
Bodies = Matter.Bodies,
Body = Matter.Body,
Composites = Matter.Composites,
Composite = Matter.Composite,
Common = Matter.Common,
Constraint = Matter.Constraint,
Bounds = Matter.Bounds,
Engine = Matter.Engine,
Render = Matter.Render,
Events = Matter.Events,
World = Matter.World;
// create an engine
var engine = Engine.create();
engine.enableSleeping = true;
var world = engine.world;
Engine.run(engine);
/*////////////////////////////////////////*/
var canvas = document.createElement('canvas');
canvas.width = sceneWidth;
canvas.height = sceneHeight;
/*////////////////////////////////////////*/
var MouseConstraint = Matter.MouseConstraint,
Mouse = Matter.Mouse;
var mouseConstraint = MouseConstraint.create(engine,{
mouse: Mouse.create(canvas)
});
var ground = Bodies.rectangle(sceneWidth/2, sceneHeight + (sceneHeight/2), Math.max(sceneWidth * 4, 2000), sceneHeight, {
isStatic: true,
render: {
opacity: 1,
fillStyle: '#D7FBE8',
strokeStyle: '#D7FBE8'
}
});
World.add(world,[ mouseConstraint, ground]);
// var walls = [
// Bodies.rectangle(-30, 0, 20, sceneHeight * 2, { isStatic: true }),
// Bodies.rectangle(sceneWidth * 2 + 30, 0, 20, sceneHeight * 2, { isStatic: true }),
// ];
// World.add(world, walls);
/*////////////////////////////////////////*/
function connect(c, bodyA, bodyB, constraintOptions){
if ( bodyA && bodyB ) {
Composite.addConstraint( c, Constraint.create(
Common.extend({
bodyA: bodyA,
bodyB: bodyB
}, constraintOptions)
));
}
}
function softSkeleton(xx, yy, matrix, particleRadius, constraintOptions, callback) {
let c = Composite.create({ label: 'Skeleton' });
let y = 0;
let lastRow = null;
constraintOptions = constraintOptions || { stiffness: 0.95 };
callback = callback || function(x,y,size){
return Bodies.rectangle( x, y, size, size);
};
for (let i = 0, len = matrix.length; i < len; i++){
//let c = Composite.create({ label: 'Row' + i });
let row = matrix[i];
let x = 0;
for (let j = 0, count = row.length; j < count; j++){
if ( row[j] ) {
row[j] = callback(
xx + ( x * particleRadius),
yy + ( y * particleRadius ),
particleRadius,
i,
j
);
Composite.addBody( c, row[j] );
connect(c, row[j - 1], row[j], constraintOptions);
if ( lastRow ) {
connect(c, row[j], lastRow[j], constraintOptions);
connect(c, row[j], lastRow[j + 1], constraintOptions);
connect(c, row[j], lastRow[j - 1], constraintOptions);
}
}
x++;
}
y++;
lastRow = row;
}
return c;
};
/*////////////////////////////////////////*/
world.gravity.y = 0.25;
var color = green;
var width = ( shape[0].length * size );
var height = ( shape.length * size );
var startY = sceneHeight - ( shape.length * size ) - 20;
var startX = 0;//(sceneWidth/2) - width; //-width/2;
var boy = softSkeleton(
startX,
startY,
shape,
size,
{ stiffness: 0.99, render: { visible: false } },
function(x,y,size, i, j){
let s = size * ( j < 4 ? 0.8 : 1 );
let c =
( i === 2 && j === 9 ? '#000' : // Eyeball
( j % 2 !== ( i % 2 ? 0 : 1 ) ? color : '#52C292' )
);
return Bodies.rectangle( x, y, s, s,{
render: {
fillStyle: c,
strokeStyle: color,
lineWidth: s * 0.3
}
});
}
);
World.add(world, boy);
/*////////////////////////////////////////*/
var shape2 = shape.slice(0);
shape2.map(function(row){
return row.reverse();
});
color = pink;
startX = Math.max(width * 2, sceneWidth - width/2); // - ( arr2[0].length * size );
var girl = softSkeleton(
startX,
startY,
shape2,
size,
{ stiffness: 0.9, render: { visible: false } },
function(x,y,size, i, j){
let s = size * ( j > 7 ? 0.8 : 1 );
let c = ( i === 2 && j === 2 ? '#000' : // Eye
( j % 2 !== ( i % 2 ? 0 : 1 ) ? color : '#CD4B72' )
);
return Bodies.rectangle( x, y, s, s, {
//mass: 0.6,
render: {
fillStyle: c,
strokeStyle: color,
lineWidth: s * 0.3
}
});
}
);
World.add(world, girl);
/*////////////////////////////////////////*/
// Controls
function onKeyDown(e){
//if ( haveKissed ) { return; }
let key = ( e.code || e.key || '' ).toLowerCase().replace(/^(key|digit|numpad)/,'');
let target;
let invert = false;
let girlTarget = girl.bodies[girl.bodies.length-4];
let boy1Target = boy.bodies[boy.bodies.length-1];
switch ( key ) {
case 'arrowright':
case 'arrowleft':
target = girlTarget;
break;
case '1':
case '2':
target = boy1Target;
break;
}
switch ( key ) {
case 'arrowleft':
case '1':
invert = true;
break;
}
TweenMax.fromTo('[data-key="' + key + '"]', 0.1, {
backgroundColor: '#eee'
},{
backgroundColor: '#ddd',
repeat: 1,
yoyo: true
});
if ( target ) {
let force = speed * ( invert ? -1 : 1 );
if ( haveKissed ) { force *= 0.2; }
Body.applyForce(target, target.position, {
x: force, y: 0
});
}
}
document.body.addEventListener('keydown',onKeyDown);
function bindKeyButton(el){
let key = el.getAttribute('data-key');
function triggerKey(e){
e.preventDefault();
onKeyDown({ key: key });
}
el.addEventListener('mousedown',triggerKey);
el.addEventListener('touchstart',triggerKey);
}
var keys = document.querySelectorAll('[data-key]');
for (let i = 0; i < keys.length; i++){
bindKeyButton(keys[i]);
}
/*////////////////////////////////////////*/
function kiss(x,y){
if (!haveKissed ) {
haveKissed = true;
// Make everyone weightless
var origGravity = world.gravity.y;
TweenMax.to(world.gravity, 0.5, {
y: -0.2,
ease: Power3.easeIn
});
// Make a heart
let s = size / 2;
let width = s * (heartShape[0].length);
let height = heartShape.length * s;
let c = '#DC3737';
let heart = softSkeleton(
x - (width* 0.4),
y - ( height * 1.75 ),
heartShape,
s,
{ stiffness: 0.7, render: { visible: false } },
function(x,y,size, i, j){
return Bodies.rectangle( x, y, s, s, {
//frictionAir: -0.2,
//density: 0.01,
frictionAir: 0.004,
//mass: 0.3,
render: {
fillStyle: c,
strokeStyle: c,
}
});
}
);
World.add(world, heart);
// Check for sleeping heart pieces & remove them
var bodiesLeft = heart.bodies.length;
heart.bodies.forEach((body)=>{
Events.on(body, 'sleepStart', function(event) {
var body = this;
Composite.remove(heart, body);
bodiesLeft--;
if ( bodiesLeft <= 0 ) {
World.remove(world, heart);
haveKissed = false;
}
});
});
// Break heart & reset gravity.
setTimeout(function(){
var c = Composite.allConstraints(heart);
c.forEach((constraint)=>{ Composite.remove(heart, c); });
TweenLite.to(world.gravity, 2, {
y: origGravity,
ease: Power3.easeIn,
onComplete: function(){
setTimeout(function(){ haveKissed = false; },4000);
}
});
setTimeout(function(){
Body.applyForce(girl.bodies[0], girl.bodies[0].position, {
x: 0.12, y: 0
});
Body.applyForce(boy.bodies[0], boy.bodies[0].position, {
x: -0.09, y: 0
});
},1200);
},3500);
}
}
/*////////////////////////////////////////*/
// Kiss detection & triggering.
var kissDetectors = [
boy.bodies[4],
girl.bodies[1]
];
Events.on(engine, 'collisionStart', function(event) {
var pairs = event.pairs;
// change object colours to show those starting a collision
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i];
if (
kissDetectors.indexOf(pair.bodyA) > -1
&& kissDetectors.indexOf(pair.bodyB) > -1
) {
var center = ( pair.bodyA.position.x + pair.bodyB.position.x ) / 2;
kiss(center, boy.bodies[0].position.y - (size * 2));
}
}
})
/*////////////////////////////////////////*/
// Render
var render = Render.create({
element: document.body,
canvas: canvas,
context: canvas.getContext('2d'),
engine: engine,
options: {
hasBounds: true,
width: sceneWidth,
height: sceneHeight,
//showAngleIndicator: true,
wireframes: false,
//wireframeBackground: '#ffffff',
}
});
Render.run(render);
/*////////////////////////////////////////*/
// Resizing
var origBounds = render.bounds;
var lastScale;
// world.bounds.min.x = -width/2;
// world.bounds.min.y = -height;
// world.bounds.max.x = sceneWidth + width/2;
// world.bounds.max.y = sceneHeight;
var mouse = mouseConstraint.mouse;
var boundsScale = 1;
var initial = true;
function ease(current,target,ease){ return current + (target - current) * ( ease || 0.2 ); };
function resizeRender(){
requestAnimationFrame(resizeRender);
var distance = Math.abs( boy.bodies[0].position.x - girl.bodies[0].position.x ) + width * 2;
var boundsScaleTarget = (distance / sceneWidth);
boundsScale = ease(boundsScale, boundsScaleTarget, (initial ? 1 : 0.01 )); //+= scaleFactor;
// scale the render bounds
render.bounds.min.x = ease( render.bounds.min.x, Math.min(boy.bodies[0].position.x - width, girl.bodies[0].position.x), (initial ? 1 : 0.01));
render.bounds.max.x = render.bounds.min.x + render.options.width * boundsScale;
render.bounds.min.y = (sceneHeight * -0.1 ) * boundsScale;
//render.bounds.min.x - (sceneHeight * (1 - boundsScale) * 0.1 );
render.bounds.max.y = (sceneHeight * 0.9 ) * boundsScale;
//render.bounds.max.x - (sceneHeight * (1 - boundsScale) * 0.1 );
// update mouse
Mouse.setScale(mouse, { x: boundsScale, y: boundsScale });//boundsScale - boundsScaleTarget);
Mouse.setOffset(mouse, render.bounds.min);
initial = false;
}
resizeRender();
document.body.insertBefore(canvas, document.body.firstChild);
// Vue.filter('round', function(value){ return Math.round(value * 100) / 100 });
// var el = document.createElement('div');
// document.body.appendChild(el);
// var v = new Vue({
// el: el,
// template: `
// <table>
// <tr>
// <th>boundsScale</th><td>{{ boundsScale | round }}</td>
// </tr>
// <template v-for="(bound,key) in bounds">
// <tr v-for="(val,i) in bound">
// <th>{{key}}.{{i}}</th>
// <td> {{val | round }}</td>
// </tr>
// </template>
// </table>
// `,
// data: {
// bounds: render.bounds,
// boundsScale: boundsScale
// },
// beforeUpdate: function(){
// this.boundsScale = boundsScale;
// }
// })
})();
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................
Console | __label__pos | 0.997989 |
Essay about the invention of computers
It is clearly superior in many other aspects. Computer Essay 5 words In the modern world of technological advancement, computer is the amazing gift given by the science to us.
Computer is an electronic device having big memory which can save any data value. Apple soon swapped those tapes for Essay about the invention of computers disks.
It can be used to do any kind of works. However, it really did not do much. By many people it is used as the source of entertainment and communication. Computer is a new technology which is used in offices, banks, educational institutions, etc.
It is used by MNC companies for the accounting purpose, invoicing, pay rolls, stock control, etc. Emotions allow the human brain to evolve beyond a problem-solving machine. It allows us to make changes in the already stored data as well as store new data.
Long and Short Essay on Computer in English Find very simple to write and easy to learn essay on computer.
The Invention of Computers
Before microprocessors were invented, computers needed a separate integrated-circuit chip for each one of their functions. Future generations of the computer would be more effective and lots of functioning.
Measurements, results, applications all can be done to the smallest details, far beyond the human brain's capabilities. These date back to almost years ago Dolotta, It helps in enhancing our skill level and get information easily. Emotions open the mind to an endless realm of possibilities.
Users input data by flipping toggle switches. It has the capacity to create, unlike the computer, and it can work without full input, making logical assumptions about problems. It can never perform tasks as efficiently or as tirelessly as the computer. However, computer and information technology provide many benefits for everyone.
They can use it to prepare their projects, learn poems, read different stories, download notes for exam preparations, collect large information within seconds, learn about painting, drawing, etc.
Computer Essay
It is simply a wooden rack holding parallel wires on which beads are strung. Computer is one of them. Also, emotions are not capable in a computer. It can come up with infinite ways of getting around problems encountered in day to day life, while a computer has a limited memory of new tricks it can come up with, which are restricted by programming.
It is very easy to handle by anyone and takes very less time to learn. After Babbage, people began to lose interest in computers. During the World War II it was used to locate and estimate the direction and speed of weapons of the enemies.
Essay on Computer – The Human’s Greatest Invention
It has the capacity to handle things on a far bigger scale than the human brain could ever do. It is very simple to handle the computer as its functioning is so common that a child can handle it.
No one can imagine the life without computer as it has made lots of works so easy within less time. In the higher education there are subjects like network administration, hardware maintenance, software installation, etc for the enhancement of skill.
Charles Babbage had invented the first mechanical computer which was totally different from the modern day computer.
Invention Of the Computer Essay Sample
This computer, called the Apple I, was more sophisticated than the Altair: No one can imagine the life without computer as it has made lots of works so easy within less time. We can buy anything online using computer and internet and get free delivery.
It is an electronic machine which is able to calculate and solve big problems. - Computers This essay will explore the history of computers, show its importance and analyse theories of future computers and their use. Computers definition A computer defines as a device that accepts information and manipulates it.
The Computer Greatest Invention Of The Civilization
The twentieth century was a time of invention and innovation. More specifically, there were major advances in computer technology as electricity developed. The invention of the computer originated from the reliance on electrical based machines that stemmed from a dependence upon mechanical devices.
The History of Computers Essay - The. The Invention of Computers Comparison of the Inventions of Computers and Trains This essay consists of fifteen pages and considers whether the computer or. The invention of the internet changed people¡s point of view of using computers.
Internet was created by an organization called ARPAnet, for the purpose of military use. The History of Computers Essay - The History of Computers In order to fully understand the history of computers and computers in general, it is important to understand what it is exactly that lead up to the invention of the computer.
After all, there was a time when the use of laptops, P.C.s, and other machines was unthinkable. The Invention and Impact of The Computer Mouse If you ask people to name one of the most important technologies of the twentieth century, one of the answers would most certainly be the computer.
A computer, however, is not a technology all to itself.
Essay about the invention of computers
Rated 5/5 based on 100 review
Essay on Computer for Children and Students | __label__pos | 0.843643 |
Rust by Example
12.7.1 The Problem
A trait that is generic over its container type has type specification requirements - users of the trait must specify all of its generic types.
In the example below, the Contains trait allows the use of the generic types A and B. The trait is then implemented for the Container type, specifying i32 for A and B so that it can be used with fn difference().
Because Contains is generic, we are forced to explicitly state all of the generic types for fn difference(). In practice, we want a way to express that A and B are determined by the input C. As you will see in the next section, associated types provide exactly that capability.
struct Container(i32, i32);
// A trait which checks if 2 items are stored inside of container.
// Also retrieves first or last value.
trait Contains<A, B> {
fn contains(&self, &A, &B) -> bool; // Explicitly requires `A` and `B`.
fn first(&self) -> i32; // Doesn't explicitly require `A` or `B`.
fn last(&self) -> i32; // Doesn't explicitly require `A` or `B`.
}
impl Contains<i32, i32> for Container {
// True if the numbers stored are equal.
fn contains(&self, number_1: &i32, number_2: &i32) -> bool {
(&self.0 == number_1) && (&self.1 == number_2)
}
// Grab the first number.
fn first(&self) -> i32 { self.0 }
// Grab the last number.
fn last(&self) -> i32 { self.1 }
}
// `C` contains `A` and `B`. In light of that, having to express `A` and
// `B` again is a nuisance.
fn difference<A, B, C>(container: &C) -> i32 where
C: Contains<A, B> {
container.last() - container.first()
}
fn main() {
let number_1 = 3;
let number_2 = 10;
let container = Container(number_1, number_2);
println!("Does container contain {} and {}: {}",
&number_1, &number_2,
container.contains(&number_1, &number_2));
println!("First number: {}", container.first());
println!("Last number: {}", container.last());
println!("The difference is: {}", difference(&container));
}
See also:
structs, and traits | __label__pos | 0.999397 |
Meteor 1.3 "Meteor" symbol gone from global scope?
I noticed in Meteor 1.3 that Meteor isn’t available at the command line (it’s not global on window. Is Meteor now encapsulated in the new modules system (global to app code that is also inside that scope) and not placed onto window?
I’m not the best one to answer since other people are working on the module system, but I wouldn’t take anything in the current preview release as a solid indicator for how it will work in the final version of 1.3.
1 Like
For sure. I think it’s a good idea though, so that random scripts outside of the app’s code can’t probe for vulnerabilities (or subscribe to things they shouldn’t subscribe to, etc).
huh, without Meteor how do we handle login or create user on the client side?
@seanh We’d be using Meteor 1.3, and we’d import Meteor into our modules like this:
import Meteor from 'meteor'
or
import Tracker from 'meteor/Tracker'
Those symbols would never be stored globally, and only given to use when we request them via the module system.
4 Likes
cool, that indeed look more modularize than before :smile:
1 Like | __label__pos | 0.99793 |
你正在阅读 Celery 3.1 的文档。开发版本文档见: 此处.
celery.bin.base
Preload Options
These options are supported by all commands, and usually parsed before command-specific arguments.
-A, --app
app instance to use (e.g. module.attr_name)
-b, --broker
url to broker. default is ‘amqp://guest@localhost//’
--loader
name of custom loader class to use.
--config
Name of the configuration module
Daemon Options
These options are supported by commands that can detach into the background (daemon). They will be present in any command that also has a –detach option.
-f, --logfile
Path to log file. If no logfile is specified, stderr is used.
--pidfile
Optional file used to store the process pid.
The program will not start if this file already exists and the pid is still alive.
--uid
User id, or user name of the user to run as after detaching.
--gid
Group id, or group name of the main group to change to after detaching.
--umask
Effective umask of the process after detaching. Default is 0.
--workdir
Optional directory to change to after detaching.
exception celery.bin.base.Error(reason, status=None)
status = 1
exception celery.bin.base.UsageError(reason, status=None)
status = 64
class celery.bin.base.Extensions(namespace, register)
add(cls, name)
load()
class celery.bin.base.HelpFormatter(indent_increment=2, max_help_position=24, width=None, short_first=1)[源代码]
format_description(description)[源代码]
format_epilog(epilog)[源代码]
class celery.bin.base.Command(app=None, get_app=None, no_color=False, stdout=None, stderr=None, quiet=False, on_error=None, on_usage_error=None)[源代码]
Base class for command-line applications.
参数:
• app – The current app.
• get_app – Callable returning the current app if no app provided.
exception Error(reason, status=None)
status = 1
Command.Parser
OptionParser 的别名
exception Command.UsageError(reason, status=None)
status = 64
Command.args = u''
Command.check_args(args)[源代码]
Command.create_parser(prog_name, command=None)[源代码]
Command.description = u''
Command.die(msg, status=1)[源代码]
Command.doc = None
Command.early_version(argv)[源代码]
Command.enable_config_from_cmdline = False
Command.epilog = None
Command.error(s)
Command.execute_from_commandline(argv=None)[源代码]
Execute application from command-line.
参数:argv – The list of command-line arguments. Defaults to sys.argv.
Command.expanduser(value)[源代码]
Command.find_app(app)[源代码]
Command.get_cls_by_name(name, imp=<function import_from_cwd at 0xb08d87c>)
Command.get_options()[源代码]
Get supported command-line options.
Command.handle_argv(prog_name, argv, command=None)[源代码]
Parse command-line arguments from argv and dispatch to run().
参数:
• prog_name – The program name (argv[0]).
• argv – Command arguments.
Exits with an error message if supports_args is disabled and argv contains positional arguments.
Command.leaf = True
Command.maybe_patch_concurrency(argv=None)[源代码]
Command.namespace = u'celery'
Command.node_format(s, nodename, **extra)
Command.on_concurrency_setup()[源代码]
Command.on_error(exc)
Command.on_usage_error(exc)
Command.option_list = ()
Command.out(s, fh=None)
Command.parse_doc(doc)[源代码]
Command.parse_options(prog_name, arguments, command=None)[源代码]
Parse the available options.
Command.parse_preload_options(args)[源代码]
Command.preload_options = (<Option at 0xd0d4eec: -A/--app>, <Option at 0xd0d47cc: -b/--broker>, <Option at 0xd0d4e4c: --loader>, <Option at 0xd0d424c: --config>, <Option at 0xd0d42cc: --workdir>, <Option at 0xd09798c: -C/--no-color>, <Option at 0xd09754c: -q/--quiet>)
Command.prepare_args(options, args)[源代码]
Command.prepare_parser(parser)[源代码]
Command.preparse_options(args, options)
Command.pretty(n)
Command.pretty_dict_ok_error(n)
Command.pretty_list(n)
Command.process_cmdline_config(argv)[源代码]
Command.prog_name = u'celery'
Command.respects_app_option = True
Command.run(*args, **options)[源代码]
This is the body of the command called by handle_argv().
Command.run_from_argv(prog_name, argv=None, command=None)[源代码]
Command.say_chat(direction, title, body=u'')
Command.say_remote_command_reply(replies)
Command.setup_app_from_commandline(argv)[源代码]
Command.show_body = True
Command.show_reply = True
Command.simple_format(s, **extra)
Command.supports_args = True
Command.symbol_by_name(name, imp=<function import_from_cwd at 0xb08d87c>)[源代码]
Command.usage(command)[源代码]
Command.verify_args(given, _index=0)
Command.version = '3.1.7 (Cipater)'
Command.with_pool_option(argv)[源代码]
Return tuple of (short_opts, long_opts) if the command supports a pool argument, and used to monkey patch eventlet/gevent environments as early as possible.
E.g::
has_pool_option = ([‘-P’], [‘–pool’])
class celery.bin.base.Option(*opts, **attrs)
Instance attributes:
_short_opts : [string] _long_opts : [string]
action : string type : string dest : string default : any nargs : int const : any choices : [string] callback : function callback_args : (any*) callback_kwargs : { string : any } help : string metavar : string
ACTIONS = ('store', 'store_const', 'store_true', 'store_false', 'append', 'append_const', 'count', 'callback', 'help', 'version')
ALWAYS_TYPED_ACTIONS = ('store', 'append')
ATTRS = ['action', 'type', 'dest', 'default', 'nargs', 'const', 'choices', 'callback', 'callback_args', 'callback_kwargs', 'help', 'metavar']
CHECK_METHODS = [<function _check_action at 0x91148ec>, <function _check_type at 0x9114924>, <function _check_choice at 0x911495c>, <function _check_dest at 0x9114994>, <function _check_const at 0x91149cc>, <function _check_nargs at 0x9114a04>, <function _check_callback at 0x9114a3c>]
CONST_ACTIONS = ('store_const', 'append_const')
STORE_ACTIONS = ('store', 'store_const', 'store_true', 'store_false', 'append', 'append_const', 'count')
TYPED_ACTIONS = ('store', 'append', 'callback')
TYPES = ('string', 'int', 'long', 'float', 'complex', 'choice')
TYPE_CHECKER = {'int': <function check_builtin at 0x9114764>, 'float': <function check_builtin at 0x9114764>, 'complex': <function check_builtin at 0x9114764>, 'long': <function check_builtin at 0x9114764>, 'choice': <function check_choice at 0x911479c>}
check_value(opt, value)
convert_value(opt, value)
get_opt_string()
process(opt, value, values, parser)
take_action(action, dest, opt, value, values, parser)
takes_value()
celery.bin.base.daemon_options(default_pidfile=None, default_logfile=None)[源代码]
上一个主题
celery.worker.strategy
下一个主题
celery.bin.celery
本页 | __label__pos | 0.68938 |
DirtyInformation
Pair program with me!
Lost in Translation
I have had a few conversations about how to design Rails controllers over the last seven years. I've also heard a lot of really great developers say, "Why aren't controllers extracted away by now?" This problems seems to stem from the ActiveRecord API. Once there is a tool that takes a hash it can do anything. With this hammer great developers go drive nails, screws and fluffy bunnies. Just in case that doesn't grab you take a look at these two controller methods I found in the same application.
def update
article = Article.find(params[:id])
article.update_attributes params[:article]
respond_with article
end
That one was straight forward enough.
def update
article = Article.find(params[:id])
article.update_attributes params[:article]
respond_with article
end
Oh, that one two. Make sure to take a really close look at those two methods. Can you tell what the difference is? Can you tell me what they do? Hint: I copy and pasted them. They have the exact same code. So why do they appear in two different places in the code?
Oh, I know, we have this hammer so we can just abstract the controllers away and they should all look like this! Then all the nails are taken care of. Oh, and the screws. We mustn't forget about the bunnies that are now bleeding from the hammer smashing them to bits.
I want to talk about the security flaw in this code, but I think we should discuss what they do first. These two controllers had very distinct responsibilities and where used by two distinct types of users. Can you tell me what the responsibilities of these controllers are? How about I give you the names of the controllers? The first one is the ArticlesController, and the second is the SubmissionsController. Wait that isn't right at all. The first is the SubmissionsController and the second...Well I think you get the confusion here.
In order to try to make this code a little more clear the team working on it wanted to add this to the code:
class SubmissionsController
Submission = Article
def update
submission = Submission.find(params[:id])
#...
end
They thought this would provide some expandability in the future if Submissions and Articles became separate classes. I really appreciated their ability to find the noun, but I also wanted to cry. Do you know what these controllers do now? Neither do I.
You see there is nothing to reveal intention in this code. If you've known me a while you will also know that I am not one for comments, which the team also had in place. Oh, and the comments weren't quite accurate we found out.
Here is the code that I ended up writing.
def update
article = Article.find(params[:id])
article.submit(params[:article][:title], params[:article][:body])
respond_with article
end
def update
article = Article.find(params[:id])
article.publish_on(params[:article][:published_on])
respond_with article
end
There is still a little repetition, but this is a very basic form. I didn't go find the team I helped and ask them for the code. Now can you tell me what these controller do?
The first controller is used by a journalists/community to submit articles/letters to the editor to a newspaper. The second is used by the editor to accept and pick a publishing date for the article.
The change above also solved a security issue that they were a little concerned about. The original code had white listed attributes in the Article class. This was great until they realized that with a little params hack someone could publish an article when they submitted it. The whole point of the software was to make the work flow of getting news to the presses.
ActiveRecord has a very broad interface. Avdi calls it an "infinite interface." This is very true in methods like update_attributes and others that take an attributes hash. The intention of its use is determined by its inputs. This leads to a lot of power, but lacks fine grained controls. This is why the Rails core team had to implement strong parameters. I think these are great in the battle field of security, but still not showing the intention of our code.
After many examples like this I'm asking you to put away the hammer. Pull out your screwdrivers, air guns and multitude of other tools. Pick the one that reveals what it is for. Hide ActiveRecord away as soon as the prototyping is over. I'm not saying to not use ActiveRecord, but treat it like a powerful set of private methods.
The Past
Contact Me
Email
[email protected]
Github
Adkron
Twitter
@adkron
Podcast
This Agile Life | __label__pos | 0.719732 |
Skip to content
Probability (R)
Why is probability important
One of the fundamental topics of data science is probability. This is because, in the real world, there are always random effects that cause randomness in even the most predictable events. Randomness is found in daily life to research conducted to business applications we encounter. Probability is a field which provides us with tools to fight against uncertainty and is, therefore, the backbone of statistics, econometrics, game theory and machine learning.
Elements of the probabilistic model
Let us take an experiment where the potential outcomes are \(\omega_1, \omega_2,...\).
For example, if we roll a six-sided die, the outcomes are \(\omega_1 = 1, \omega_2 = 2, \omega_3 = 3, \omega_4 = 4, \omega_5 = 5, \omega_6 = 6\). This set of all outcomes is called a sample space and is denoted by \(\Omega\). A subset of the sample space is called an event. For example, getting 3 or 4 in a six-headed die roll is an event.
Laws of probability
Which event is more likely to occur and which event is less likely to occur. This is explained by using a probability function P(A). There are four laws of probability:
1. \(0 \leq P(A) \leq 1\): The probability of an event is between 0 and 100%.
2. \(P(\Omega) = 1\): the probability of the sample space is 1.
3. If event A and event B are disjoint, then \(P(A \cup B) = P(A) + P(B)\).
4. If events \(A_i\) are pairwise disjoint events, i.e. \(A_i \cap A_j = \phi\), then \(P(\cup_{i=1}^{\infty}A_i) = \sum_{i=0}^\infty P(A_i)\)
Any probability function that satisfies these three axioms are considered to be a valid probability function.
Some properties that can be derived from these axioms are:
1. \(P(A^C) = 1-P(A)\)
2. \(P(A \cap B) = P(A) + P(B) - P(A \cup B)\)
3. If \(A \subset B\) then \(P(A) \leq P(B)\)
4. If \(P(A \cap B) = P(A)P(B)\), then A and B are independent
Conditional probability
Let A and B be two events from the same sample space. The conditional probability of A given B is the probability of A happening if B has already taken place. This is given by \(P(A|B) = \frac{P(A \cap B)}{P(B)}\)
From the above, we can get the following:
1. \(P(A \cap B) = P(B)\times P(A|B) = P(A)\times P(B|A)\)
2. \(P(A) = \sum_{i=1}^n P(A|B_i)\times P(B_i)\) where \(B_i\) form a partition of the sample space. This is called as the formula of total probability
Bayes theorem
If A and B are two events where P(A)>0, then
\(P(A | B) = \frac{P(B|A)P(A)}{\sum_{i=1}^n P(B|A_i)\times P(A_i)}\)
where \(A_j\)'s form a partition of the sample space \(\cup_{i=1}^{\infty}A_i = \Omega\) and for \(i\neq j, A_i \neq A_j\)
Random Variables
Random variables will help us understand the probability distributions. A random variable maps the outcomes from an experiment from the sample space to a numerical quantity. For example, if we flip a coin four times, we can get the following outcomes with H for heads and T for Tails: HTHT, HHTT, HHHT, TTTH, TTTT etc. if we take a variable that measures the number of heads in the series, we get a mapping like: HTHT - 2; HHTT - 2; HHHT - 3; TTTH - 1; TTTT - 0 and so on. The randomness of a random variable is attached to the event, and not the experiment. Random variables are this mapping which maps the outcomes of the experiment to numerical quantities. There are two types of random variables, discrete and continuous random variables.
The range of a discrete random variable contains a finite or countably infinite sequence of values. Some examples are:
1. No of heads in 10 coin flips: finite
2. The number of flips of a coin until heads appear: countable infinite
Continuous random variables have their range as an interval of real numbers which can be finite or infinite. An example would be the time until the next customer arrives in a store.
Distribution functions
Distribution functions are used to characterise the behaviour of random variables, like the mean, standard deviation and probabilities. There are two types of distribution functions, probability distribution functions and cumulative distribution functions.
For discrete random variables, we use probability mass function, which is the probability that a random variable will take a specific value. For continuous random variables, the probability of a random variable will be in an interval is arrived by integrating the probability density function.
The *cumulative distribution functions
depict the variable will take the value less than equal to the range.
Two random variables \(Y_1\) and \(Y_2\) are said to be independent of each other if \(P(Y_1 \in A, Y_2 \in B) = P(Y_1 \in A)\times P(Y_2 \in B)\)
Discrete random variables
For discrete random variables, the PMF and CDF are defined as follows:
$$ PMF = p_X(x) := P(X = x) $$
$$ CMF = F_X(x) := P(X\leq x) $$
The mean and variance of discrete random variables
Let X be a random variable with range {\(x_1, x_2, ...\)}. The mean and variance of a random variable are given by:
Expected value (Mean): \(E[X] := \sum_{i=1}^n x_i \times P(X=x_i)\)
Variance: \(Var(X) := E[(X-E[X])^2] = E[X^2]-E[X]^2\)
Standard Deviation \(SD(X) = \sqrt{Var(X)}\)
If two events X and Y are independent, then
1. E[XY] = E[X]E[Y]
2. \(Var(aX+bY) = a^2Var(X) + b^2 Var(Y)\)
Bernoulli distribution
Imagine an experiment that can have two outcomes, success or failure but not both. We call such an experiment as a Bernoulli trial. Consider the random variable X, which assigns 1 when we have success and 0 when we have a failure. If the probability of success is 'p', then the Probability mass function is given by:
\(P(X=x)=\left\{ \begin{array}{ll} p \qquad x=1\\ 1-p \quad x=0 \end{array} \right.\)
Consider flipping a coin which has a probability of heads as 60%(probability of success) 100 times. Below is a simulation of the same:
dist <- rbinom(100, 1, 0.6)
plot(dist)
The PMF and CDF of Bernoulli distribution are as shown:
range <- c(0,1)
pmf <- dbinom(x=range, size = 1,prob = 0.6)
cdf <- pbinom(q = range, size = 1, prob = 0.6)
plot_pmf(pmf,range)
plot_cdf(cdf, range)
The mean and variance of the Bernoulli distribution is \(E[X] = p\) and \(Var(X) = p\times q\) This can be verified using the below code
mean(dist)
## [1] 0.54
var(dist)
## [1] 0.2509091
Binomial distribution
Imagine an experiment where we are repeating independent Bernoulli trails n times. Then we can characterise this distribution using only two parameters, the success probability p and the number of trails n. If we have r successes out of n trials, we represent the probability of that event happening using a binomial distribution. The PMF of the binomial distribution is given as
\(P(X=x)=(^nc_r)\times p^r\times q^{n-r}\)
A binomial random variable is the sum of n Bernoulli distributions.
Consider flipping a coin 10 times which has a probability of heads as 60%(probability of success). For the range 0 to 10, the total number of heads in 10 flips is simulated below:
dist <- rbinom(100, 10, 0.6)
plot(dist)
The PMF and CDF of bernoulli distribution are as shown:
range <- c(0,1,2,3,4,5,6,7,8,9,10)
pmf <- dbinom(x=range, size = 10,prob = 0.6)
cdf <- pbinom(q = range, size = 10, prob = 0.6)
plot_pmf(pmf,range)
plot_cdf(cdf, range)
The mean and variance of the binomial distribution are \(E[X] = np\) and \(Var[X] = npq\) This can be derived as shown below and verified using the below code:
Derivations:
\(E[X] = E[Z_1 + Z_2 + ...] = E[Z_1] + E[Z_2] +E[Z_3] + ...E[Z_n] = np\)
where \(Z_1, Z_2..Z_n\) are Bernoulli events which constitute the binomial distribution.
\(Var[x] = Var[Z_1 + Z_2 + ...] = Var[Z_1] + Var[Z_2] +Var[Z_3] + ...Var[Z_n] = npq\) as \(Z_1, Z_2..Z_n\) are independent.
The same can also be verified by taking the mean and variance of the sample data:
mean(dist)
## [1] 6.11
var(dist)
## [1] 2.523131
Geometric distribution
Imagine an experiment where we are repeating independent Bernoulli trails n times. We can characterise this distribution using only two parameters, the success probability p and the number of trails n. Consider the event where we get the first success after n failures. The distribution associated with this event is the geometric distribution. The PMF of the binomial distribution is given as
\(P(X=x)=p\times (1-p)^{r}\)
The range of this function is all Real Values from 0,1,2,3,4,...
Consider flipping a coin unitil we get heads, where the probability of heads is 50%(probability of success). For the range 0 to 10, the probability of n failures until the first heads is given by:
dist <- rgeom(100, 0.5)
plot(dist)
The PMF and CDF of Geometric distribution are as shown:
range <- c(0,1,2,3,4,5,6,7,8,9,10)
pmf <- dgeom(x=range, prob = 0.5)
cdf <- pgeom(q = range,prob = 0.5)
plot_pmf(pmf,range)
plot_cdf(cdf, range)
The mean and variance of the geometric distribution are \(E[X] = \frac{q}{p}\) and \(Var[X] = \frac{q}{p^2}\) This can be derived as shown below and verified using the below code:
Derivations:
\(E[X] = 0p+1qp+2q^2p+3q^3p+..=qp(1+2q+3q^2+..) = qp\frac{1}{(1-q)^2} = q/p\)
\(Var[x] = E[X^2]-E[X]^2 = (0p+1qp+4q^2p+9q^3p+..) -(\frac{q}{p})^2 = \frac{q}{p^2}\)
The same can also be verified by taking the mean and variance of the sample data:
mean(dist)
## [1] 0.86
var(dist)
## [1] 1.232727
Poisson distribution
The Poisson distribution is used when we are counting the number of successes in an interval of time. Usually, in these situations, the probability of an event occurring at a particular time is small. For example, we might be interested in counting the number of customers that arrive in a bus stand in a period of time. This random variable might follow a Poisson distribution as the probability of success; someone coming to the bus stand at any tick of time is small. Only one parameter is used to define the Poisson distribution, i.e. \(\lambda\), which is the average rate of arrivals we are interested in. The PMF is defined as
\(\(P(X=x)= \frac{\lambda^xe^{-\lambda}}{x!}\)\) The range of this function is all Real Values from 0,1,2,3,4,...
For a Poisson distribution of \(\lambda =10\), we have
dist <- rpois(100, 10)
plot(dist)
The PMF and CDF of Poisson distribution are as shown:
range <- c(0,1,2,3,4,5,6,7,8,9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)
pmf <- dpois(x=range, lambda = 10)
cdf <- ppois(q = range, lambda = 10)
plot_pmf(pmf,range)
plot_cdf(cdf, range)
The mean and variance of the Poisson distribution are \(E[X] = \lambda\) and \(Var[X] = \lambda\) This can be derived as shown below and verified using the below code:
Derivations:
\(E[X] = \sum x\frac{\lambda^xe^{-\lambda}}{x!} = \lambda \sum\frac{\lambda^{x-1}e^{-1}}{(x-1)!} = \lambda\)
The same can also be verified by taking the mean and variance of the sample data:
mean(dist)
## [1] 10.24
var(dist)
## [1] 12.28525
Continuous random variables
Unlike discrete random variables, continuous random variables can take all real values in an interval which can be finite or infinite. A continuous random variable X has a probability density function \(f_X(X)\). PDF is different from PMF while its usage in calculating the probability of an event is similar. For instance, the probability of an event A is calculated by summing the probabilities of each discrete variable(PMF), while we integrate the probabilities for all the outcomes for continuous variables(PDF). Similarly, for CDF, we integrate from \(-\infty\) to x.
\(PDF:= f_X(x)\)
\(P(X\in A) = \int_A f_X(y) dy\)
\(CDF:= F_X(x) = \int_{-\infty}^{x} f_x(y) dy\)
Therefore PDF and CDF are lated by \(\frac{d}{dx}F(X) = f(x)\) and \(P(X \in (x+\epsilon, x-\epsilon)) = 2\epsilon \times f(x)\).
Uniform distribution
The uniform distribution is used when we do not have the underlying distribution at hand. We make a simplifying assumption that every element in our range has the same probability of occurring. The PDF of a uniform distribution is given by:
\(PDF:= f(x) = \frac{1}{b-a}, \, x \in (a,b)\)
We need two parameters to characterise a uniform distribution, which is a and b. The distribution is as shown:
dist <- runif(n = 100, min = 5, max = 10)
plot(dist)
The PDF and CDF are plotted below:
range <- 1:150/10
pdf <- dunif(x=range, min=5, max=10)
cdf <- punif(q = range, min=5, max=10)
plot_pdf(pdf,range)
plot_cdf_continuous(cdf, range)
For the uniform distribution, the mean is \(E[X]=\frac{a+b}{2}\) and variance is \(Var[X] = \frac{(a-b)^2}{12}\). This can be proven using:
\(E[X] = \int_a^bx\times\frac{1}{b-a}dx = \frac{a+b}{2}\)
\(Var[X] = E[X^2] - E[X]^2 = \int_a^b x^2\times \frac{1}{b-a}dx - (\frac{a+b}{2})^2 = \frac{(b^3-a^3)}{3(b-a)}- \frac{(a+b)^2}{4} = \frac{a^2+b^2+ab}{4}-\frac{(a+b)^2}{4} = \frac{(a-b)^2}{12}\)
The same can also be verified by taking the mean and variance of the sample data:
mean(dist)
## [1] 7.592581
var(dist)
## [1] 2.017721
Exponential distribution
In the geometric distribution, we looked at the probability of first success happening after n failures. In the exponential distribution, we look at the time taken until which an event occurs, or time elapsed between events. Only one parameter is sufficient to describe an exponential distribution, \(\lambda\) which describes the successes per unit time. The PDF of an exponential distribution is given as:
\(PDF:= f(x) = \lambda\times e^{-\lambda x}\)
The CDF can be derived as
\(CDF = P(X<x) = F(X) = \int_0^x \lambda\times e^{-\lambda y} dy = 1-e^{-\lambda x}\)
Therefore 1-CDF can be written as
\(P(X>x) = e^{-\lambda x}\)
The intervel \(x>0\) and \(\lambda>0\). The distribution if an event happens on an average once every two minutes is as shown:
dist <- rexp(n = 100,rate = 0.5)
plot(dist)
The PDF and CDF are plotted below:
range <- 1:150/10
pdf <- dexp(x=range, rate= 0.5)
cdf <- pexp(q = range, rate = 0.5)
plot_pdf(pdf,range)
plot_cdf_continuous(cdf, range)
For the exponential distribution, the mean is \(E[X]=\frac{1}{\lambda}\) and variance is \(Var[X] = \frac{1}{\lambda^2}\).
The same can also be verified by taking the mean and variance of the sample data:
mean(dist)
## [1] 2.309103
var(dist)
## [1] 5.504272
Normal distribution
The normal distribution is the most famous continuous distribution. It has a unique bell-shaped curve. Randomness generally presents as a normal distribution. It is widespread in nature. Two parameters define a normal distribution, its mean \(\mu\) and standard deviation \(\sigma\).
\(PDF:= f(x) = \frac{1}{2\pi \sigma^2}e^{-\frac{(x-\mu)^2}{2\sigma^2}}\)
The distribution with mean 10 and standard deviation 2 is as shown:
dist <- rnorm(n = 100,mean = 10, sd = 2)
plot(dist)
The PDF and CDF are plotted below:
range <- 50:150/10
pdf <- dnorm(x=range, mean = 10, sd = 2)
cdf <- pnorm(q = range, mean = 10, sd = 2)
plot_pdf(pdf,range)
plot_cdf_continuous(cdf, range)
References
1. Blitzstein, JK and Hwang, J (2014). Introduction to Probability. CRC Press LLC
2. Dinesh Kumar (2019). Business Analytics: the science of Data-Driven Decision Making
Back to top | __label__pos | 0.999716 |
How to Detect Proxy Connections in a Web Browser
Detecting proxies in a web browser is not a difficult task. There are several tools out there that will help you do so. They can also help you detect which proxies are working. You can even see the results of your tests in the interface.
How can I tell if someone is using a proxy?
A proxy is a middleman between the user and the web. It prevents malicious actors from accessing confidential information. However, they can be misleading as well. Depending on the use case, blocking requests from a proxy may be the right solution.
Using the packet headers to detect proxies is not as hard as it sounds. Just check the network settings for your Windows or macOS computer. If the ports are open, you are likely to find a proxy connection. If you’re using a firewall, you can add additional ports to increase your chances of catching a fraudulent proxy.
A good way to find out is to check out the packet headers. These can give you some information about the user’s device, browser, and OS. This information can be used to determine if the user is a privacy-conscious person or an attacker.
In the same way, you can check the HTTP headers to learn more about the corresponding host. This can be a useful tool if you are looking to block proxies on your website. The headers can also tell you about the type of proxies being used on your site.
The above example code was written to test if an IP address is reachable in a given port. This is the same as checking if the URL in the address bar is a valid one. | __label__pos | 0.852248 |
Introducing DigitalOcean Functions: A powerful serverless computing solution
DigitalOcean is releasing a new serverless hosting service. I’ve had good results hosting a LibreTranslate instance on DigitalOcean and this could work well for sporadic use cases.
Could be useful, but I would use it only for small stuff.
The problem is just like with AWS lambda; it’s a proprietary cloud system and you effectively lock yourself with Digital Ocean (or make it costly to migrate should the need arise).
1 Like | __label__pos | 0.814894 |
The null hypothesis, delisted by H0, is normally the hypothesis that sample observations outcome pudepend from opportunity.
You are watching: What is a type ii error quizlet
The alternate hypothesis, deprovided by H1 or Ha, is the hypothesis that sample observations are affected by some non-random reason.
A Type I error occurs as soon as the researcher rejects a null hypothesis as soon as it is true. The probcapacity of committing a Type I error is referred to as the meaning level. This probability is likewise referred to as alpha, and is frequently denoted by α.
A Type II error occurs when the researcher falls short to reject a null hypothesis that is false. The probcapability of committing a Type II error is referred to as Beta, and is regularly dedetailed by β. The probcapacity of not committing a Type II error is called the Power of the test.
The strength of evidence in support of a null hypothesis is measured by the P-value. Suppose the test statistic is equal to S. The P-worth is the probability of observing a test statistic as extreme as S, assuming the null hypotheis is true. If the P-value is much less than the definition level, we reject the null hypothesis.
The area of acceptance is a selection of values. If the test statistic drops within the region of acceptance, the null hypothesis is not rejected. The area of acceptance is defined so that the opportunity of making a Type I error is equal to the significance level.
The collection of worths outside the area of acceptance is called the region of rejection. If the test statistic falls within the area of rejection, the null hypothesis is rejected. In such instances, we say that the hypothesis has been rejected at the α level of definition.
A test of a statistical hypothesis, wright here the area of rejection is on only one side of the sampling circulation, is called a one-tailed test. For example, intend the null hypothesis claims that the mean is less than or equal to 10. The alternative hypothesis would certainly be that the expect is higher than 10. The area of rejection would consist of a range of numbers located situated on the right side of sampling distribution; that is, a collection of numbers greater than 10.
See more: Why Did The Elves Leave Middle Earth ? Why Are The Elves Leaving In Lotr
A test of a statistical hypothesis, where the region of rejection is on both sides of the sampling distribution, is called a two-tailed test. For example, mean the null hypothesis claims that the mean is equal to 10. The different hypothesis would be that the intend is less than 10 or better than 10. The region of rejection would certainly consist of a variety of numbers located situated on both sides of sampling distribution; that is, the area of rejection would consist partly of numbers that were less than 10 and also partly of numbers that were greater than 10.
*
* | __label__pos | 0.935312 |
Does setting pad offset require mixer latency?
In my application I use pad offsets to synchronize audio streams. These offsets are applied to the source pads linked to the sink pads of an audiomixer element.
Do I need to account for these offsets by increasing the latency property of the audiomixer? Or are pad offsets automatically taken into account into the pipeline latency?
Additional question: does it matter whether the pad offset is on the mixer sinkpad, or on its peer?
Do I need to account for these offsets by increasing the latency property of the audiomixer? Or are pad offsets automatically taken into account into the pipeline latency?
You need to take them into account yourself if the addition of the pad offset actually increases the latency. It often doesn’t.
Additional question: does it matter whether the pad offset is on the mixer sinkpad, or on its peer?
Theoretically no, but in practice pad offsets on sink pads misbehave due to hard to fix bugs and I would recommend putting the pad offset on a source pad.
Awesome, thanks!
When/why wouldn’t it? If the offset is not on the “critical path”? In my case I can expect each of the inputs to have nearly identical latency, so then delaying any of them would increase the effective latency, right?
I recall trying that and things not working, so this is very good to know, thanks!
How does min_upstream_latency factor into this? I set this to a worst case amount. My inputs are SRT streams, and it looks like srtsrc actually runs at lower latency than its latency property indicates, as long as network conditions are good. Does the mixer always delay its output by min_upstream_latency or is that only how long it is willing/able to buffer internally if needed?
If you delay them you increase the running time of each buffer. By increasing the running time you effectively reduce the latency (or I am confused and need more coffee :sweat_smile: )
It doesn’t delay anything as long as buffers arrive early enough. It only sets a deadline until when buffers must arrive before the mixer times out and produces output anyway.
The value is taken into account by sinks and other elements that sync to the clock though. They will always delay by that much at least (unless one of the inputs of the mixer or any of the other streams going to any sink has a higher latency, then they delay by that much instead).
:sweat_smile:
I keep confusing myself with this as well!
I apply only positive offsets (negative offsets didn’t work, it just goes silent) so that adds to the running time of the buffers. That means they are due to be aggregated later, so the other inputs have to be buffered until then…? No, maybe you are right, delaying any input actually buys you extra time for the other inputs to arrive.
None of my sinks are sync (hlssink, ie.e. filesink, and rtpbin into udpsinks to another process), but there are multiple levels of mixers and muxers, which do sync to the clock in live mode if I understand correctly.
So if an upstream mixer has a min_upstream_latency already, I don’t need to also set it on a downstream mixer or muxer?
:bulb: Maybe that was because I did “run out” of latency then. I asked it to aggregate one source’s buffers early, and then others weren’t there yet.
What is leading for a live aggregator, the timestamps of its input buffers, or the pipeline clock time?
Yes that’s what I was thinking.
Because then they all arrive even more too late (they were supposed to be rendered before you even received the buffer) and more latency needs to be configured to give them more time.
No, they only use the latency as a deadline for timing out in live pipelines.
The running time of the buffers and the latency make up the deadline for timing out, and it determines when that deadline is reached based on the pipeline clock.
Thanks Sebastian! I am going to digest this info :grin: It might be just what I need, or I might be back with more questions :innocent:
I think the important part to understand about latency in GStreamer is that in a live pipeline the running time of a buffer is the capture time. So at that point the buffer is already exactly just in time and delaying it any further would make it too late. The latency then gives an additional budget for the buffer to be processed further downstream until it arrives at its destination, so each element on the way (including the source as it needs a moment from capture to actually having the buffer ready for sending downstream) adds its own latency to the (minimum!) latency in the latency query.
When configuring the latency on a pipeline (by default) all sinks are queried for the latency, and the maximum of all minimum latencies is then configured on the whole pipeline so that streams with lower latency are delayed inside the sink by as much as is necessary to make them in sync with the stream with the highest latency.
The minimum latency in the latency query is also kind of confusingly named. It’s not the minimum latency that is introduced, but it is the maximum latency that is introduced in the worst case. It is the minimum latency that downstream has to compensate for to allow for buffers to be in time and not consider them all too late.
The maximum latency in the latency query on the other hand is the amount of buffering that is provided by the elements along the way. As delaying streams for a higher latency (e.g. video stream has 200ms latency, audio stream has 100ms latency, then you need to delay the audio for another 100ms to have both streams in sync) requires buffering somehow this always needs to be higher than the configured (and maximum of all minimum) latencies.
That’s good to hear, because I had convinced myself that was correct, then drove home thinking about it and found myself thinking “no wait it’s the other way around or is it” :laughing:
But let me think. If I have one input from say a live testsrc, that has no latency so it sets the deadline for the rest. The mixer knows its upstream latency from the pipeline latency query (which can be “artificially” increased by min-upstream-latency), so it will queue the buffers from the testsrc while they wait for “matching” buffers on the other pads. The latency property configured on the mixer is “extra” to account for imperfect timing upstream?
Now, if I set an offset on one of the inputs, those buffers also spend some time in the queue, because their running time is ahead of the other live inputs. But (and only) if I were to set the offset greater than the upstream latency, I’ll be making buffers “FROM THE FUTURE” and the mixer won’t provide enough queuing and I need to increase the mixer latency?
It’s in addition to allow for wrongly reported latency from upstream, yes. It will allow for buffers to arrive later than they should without discarding them (or whatever the aggregator subclass’ timeout behaviour is).
No, any positive offset would delay the buffers and they would be “from the future”. There would have to be enough possible buffering (see maximum latency from the query) upstream of the mixer (e.g. a big enough queue) to allow for delaying by that much.
The mixer’s latency property only allows for buffers to arrive later than the configured latency. You could make use of that when setting a negative pad offset to compensate for buffers all arriving late according to their timestamp and latency budget. | __label__pos | 0.984122 |
CybersecurityHow to Recognize and Prevent Business Email Compromise (BEC)
In today’s digital age, businesses heavily rely on email for communication and collaboration. However, this also makes them a prime target for cybercriminals seeking to exploit vulnerabilities and steal sensitive information. One of the most common attacks targeting businesses is Business Email Compromise (BEC).
Business Email Compromise (BEC) is one of the types of phishing scams. Cybercriminals impersonate a legitimate company or executive to trick employees into disclosing confidential information or making fraudulent wire transfers. According to the FBI, BEC scams have caused businesses worldwide to lose over $12 billion from 2013 to 2020.
In this guide, we will discuss how you can identify and prevent Business Email Compromise attacks. This information can help safeguard your business from potential financial losses and reputational damage.
Understanding BEC
BEC attacks involve scammers posing as company insiders, like CEOs or CFOs. Their goal is to access sensitive information or deceive employees into making fraudulent wire transfers. These attackers often research their targets thoroughly by examining public information on company websites and social media profiles. They may also compromise legitimate email accounts to make their messages seem more authentic.
Common Types of BEC
There are several types of Business Email Compromise attacks, each with a different approach to deceive their victims. Some common tactics used in BEC attacks include:
1. Unusual Requests
BEC emails often contain urgent requests for wire transfers or changes to payment instructions. Employees should exercise caution when receiving such requests, especially if they deviate from standard procedures or involve unfamiliar recipients.
2. Spoofed Email Addresses
Cybercriminals frequently spoof email addresses to mimic those of trusted colleagues, vendors, or clients. Carefully scrutinize email headers and domain names for any inconsistencies or slight variations that may indicate fraudulent activity.
3. Pressure Tactics
Phishing emails often employ urgency and pressure to compel immediate action. Employees should be wary of emails that emphasize confidentiality, threaten consequences for non-compliance, or request secrecy to avoid detection.
4. Uncharacteristic Language or Tone
BEC perpetrators may attempt to emulate the writing style and tone of the impersonated individual. However, subtle discrepancies may reveal the fraudulent nature of the communication.
5. Unusual Payment Requests
Be cautious of requests to transfer funds to unfamiliar bank accounts or payment methods that deviate from established protocols. Verify any changes to payment instructions through a separate, trusted communication channel before proceeding.
Preventing BEC Attacks
Business Email Compromise attacks can be difficult to detect and prevent. Fortunately, there are several steps you can take to protect your business:
1. Employee Training and Awareness
Educate employees about the tactics used in BEC attacks. Also, encourage a culture of skepticism towards unexpected or unusual requests received via email. Conduct regular training sessions and simulated phishing exercises to reinforce cybersecurity best practices.
2. Multi-Factor Authentication (MFA)
Implement MFA for email accounts and other sensitive systems to add an extra layer of security against unauthorized access. This requires users to provide extra verification, like a code sent to their mobile device, for logins from unfamiliar locations or devices.
3. Strict Verification Procedures
Establish robust verification processes for validating payment requests, particularly those involving significant sums or changes to account details. Require dual authorization for financial transactions and mandate the use of encrypted communication channels for transmitting sensitive information.
4. Email Filtering and Authentication
Deploy advanced email security solutions that leverage machine learning algorithms to detect and block phishing attempts in real-time. Implement email authentication protocols such as SPF, DKIM, and DMARC. They can verify the authenticity of incoming messages and reduce the risk of domain spoofing.
5. Vendor and Client Verification
Verify the identities of vendors and clients before engaging in financial transactions or sharing sensitive information. Maintain up-to-date contact information and establish clear protocols for validating requests received from external parties.
6. Regular Security Audits
Conduct regular security audits and penetration testing to identify vulnerabilities in your organization’s email infrastructure and IT systems. Patch known security flaws promptly and implement proactive measures to mitigate emerging threats.
Conclusion
Business Email Compromise attacks can cause significant financial damage and tarnish your organization’s reputation. By educating employees, implementing security measures, and conducting regular audits, you can effectively safeguard your business against BEC scams. Remember to remain vigilant and always verify unusual or suspicious requests through a trusted communication channel before taking any action. Stay informed about evolving cybersecurity threats and adapt your defenses accordingly to stay one step ahead of cybercriminals.
Need help safeguarding your business against cyber threats? Our cybersecurity services can assist you in implementing effective security measures. Contact us today at [email protected] or (877) 794-3811.
Additional Resources:
https://www.microsoft.com/en-us/security/business/security-101/what-is-business-email-compromise-bec
https://www.fbi.gov/how-we-can-help-you/scams-and-safety/common-scams-and-crimes/business-email-compromise
https://terranovasecurity.com/blog/examples-business-email-compromise/ | __label__pos | 0.586166 |
3.3.9.svn.6752
Amanda modules list
List of All Modules
All Amanda Releases
Amanda::NDMP
NAME
Amanda::NDMP - communicate via NDMP
SYNOPSIS
use Amanda::NDMP qw( :constants );
my $conn = Amanda::NDMP::NDMPConnection->new($host, $port, $ident, $username,
$password, $auth);
my ($ok, $blocksize, $file_num, $blockno) = $conn->tape_get_state();
DESCRIPTION
This package interfaces with the C class NDMPConnection class declared in ndmp-src/ndmpconnobj.h. It is only available in builds that did not specify --without-ndmp. The C class, in turn, interfaces to the XDR code provided by NDMJOB, which sends and receives NDMP messages on a TCP socket.
Constructor
my $conn = Amanda::NDMP::NDMPConnection->new($host, $port, $ident, $username,
$password, $auth);
if ($conn->err_code()) {
# handle error..
}
This gets a new connection object. This will always return an object, but the result should be checked for errors as described in the "Error Handling" section, below.
The $host and $port give the NDMP server's host and port, respectively. The $auth parameter defines the authentication mechanism to use: "md5" or "text"; "none" for no authentication; or "void" to not send any authentication packets at all. For md5 or text modes, $username and $password specify the username and password for the NDMP server; these parameters must always be included, but can be blank for none or void.
The $ident parameter deserves some explanation. NDMP scopes many server-side variables to the NDMP connection - for example, the "current" tape and taper state are associated with the NDMP connection. To facilitate this, the constructor returns the same connection for any constructor invocation with the same host, port, and identifier. In cases where multiple connections are required (e.g., when two tapes are in use simultaneously), callers should provide different identifiers for each connection.
Methods
Note that not all NDMPConnection methods are available. All of these methods block until the appropriate reply is received. The underlying C class provides appropriate locking fundamentals to prevent corrupted on-the-wire messages.
All methods return a boolean "ok" status, with false indicating an error.
Error Handling
my $code = $conn->err_code();
my $msg = $conn->err_msg();
Get the error code and message from the last method that returned false, or after the constructor is invoked.
$conn->set_verbose(1);
This method will enable verbose logging of the NDMP transactions to the Amanda debug logs.
SCSI Interface
my $ok = $conn->scsi_open($device); # NDMP_SCSI_OPEN
my $ok = $conn->scsi_close(); # NDMP_SCSI_CLOSE
# NDMP_SCSI_EXECUTE_CDB
my $res = $conn->scsi_execute_cdb(
flags => $flags,
timeout => $timeout,
cdb => $cdb,
datain_len => $datain_len, # only if $flags == $NDMP9_SCSI_DATA_DIR_IN
dataout => $dataout # only if $flags == $NDMP9_SCSI_DATA_DIR_OUT
)
The first two methods are clear; the third uses keyword parameters to simplify a complex set of parameters. The flags argument can be $NDMP9_SCSI_DATA_DIR_IN, to take data into the server from the SCSI device, or $NDMP9_SCSI_DATA_DIR_OUT to send data out to the SCSI device. The timeout is in milliseconds. The cdb should be a SCSI control block (the pack function is useful here). If the data direction is in, then datain_len indicates the maximum amount of data to expect; otherwise, dataout is the data to send to the device.
The result is undef for an error, or a hashref with the following keys:
status SCSI status byte
ext_sense SCSI extended sense data
datain data from the device
dataout_len number of bytes actually transmitted to the device
Tape Interface
my $ok = $conn->tape_open($device, $mode);
my $ok = $conn->tape_close();
The first method opens a tape device, using the give mode - $NDMP9_TAPE_READ_MODE or $NDMP9_TAPE_RDRW_MODE. The second method closes the tape device associated with this connection.
my ($ok, $resid) = $conn->tape_mtio($op, $count);
This method sends NDMP_TAPE_MTIO with the given operation and count. Operations have the prefix $NDMP9_MTIO_. The number of incomplete operations is returned in $resid.
To read and write blocks, use these methods:
my ($ok, $actual) = $conn->tape_write($data);
my ($ok, $data) = $conn->tape_read($bufsize);
where $actual and $bufsize are byte counts, and $data is a string of data. Finally, to get the state of the tape agent, use
my ($ok, $blocksize, $file_num, $blockno) = $conn->tape_get_state();
Constants
The constants required for the interface exposed here are included in this package. They all begin with the prefix $NDMP9_, which is an implementation detail of the NDMJOB library. The constants are available from the export tag constants:
use Amanda::NDMP qw( :constants );
ABOUT THIS PAGE
This page was automatically generated Sat Jun 25 11:07:08 2016 from the Amanda source tree, and documents the most recent development version of Amanda. For documentation specific to the version of Amanda on your system, use the 'perldoc' command.
3.3.9.svn.6752 | __label__pos | 0.600807 |
1. Home
2. FAQ
3. How to Restrict Languages in Coding Questions?
How to Restrict Languages in Coding Questions?
Coding questions can be solved using any of the languages which are supported in the platform.
The platform allows the recruiter to restrict the use of the languages when the candidate is giving a coding test.
This is how it can be done:
Step 1: Click on Sections on the side menu
Step 2: Go to Coding Questions
Step 3: Choose the concerned Section
Step 4: Beside the concerned question the option of Languages are provided in a drop down menu.
As an example the following template has been provided:
One or more than one languages can be selected as options for the candidate to opt for.
Updated on August 29, 2017
Was this article helpful?
Related Articles | __label__pos | 0.999978 |
Ordenação de coleção com dois ou mais indices
Olá gostaria de saber se existe como ordenar um coleção de dados por dois indices ou mais…
exemplo:
classe
int codigo
String nome
String endereco
e tenha uma coleção delas, quero ordenar por nome de forma descendente e por codigo de forma ascendente por sem perder a primeiro ordenação… sabem me informar como seria possivel criar algo desta natureza?
Oi javapaulomg,
Vc tem dois possiveis caminhos para realizar essa ordenacao. Um deles seria a classe Pessoa implementar a interface Comparable e para isso seria necessario criar o metodo compareTo que iria conter a logica de ordenacao que vc deseja. Outro caminho seria implementar um Comparator para a classe pessoa sendo que esse Comparator teria um metodo que receberia dois objetos retornando o resultado da comparacao entre ambos.
Acredito que implementar o Comparator seja mais interessante porque desta forma vc mantem a classe Pessoa mais simples alem de ser possivel implementar mais de um Comparator para que seja possivel realizar a ordenacao de formas diferentes.
Apos implementar o Comparator basta fazer uma chamada ao metodo sort da classe Collection passando o conjunto de dados que vc deseja ordenar e o Comparator a ser utilizado para que o seu conjunto seja ordenado.
Abaixo segue um exemplo do que foi explicado anteriormente:
[code]import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class TesteOrdena {
public static void main(String[] args) {
ArrayList conj = new ArrayList();
Pessoa p1 = new Pessoa(1,"Aaaa","Rua A");
conj.add(p1);
p1 = new Pessoa(2,"Bbbb","Rua B");
conj.add(p1);
p1 = new Pessoa(5,"Dddd","Rua D");
conj.add(p1);
p1 = new Pessoa(3,"Dddd","Rua D");
conj.add(p1);
p1 = new Pessoa(4,"Dddd","Rua D");
conj.add(p1);
p1 = new Pessoa(7,"Hhhh","Rua H");
conj.add(p1);
p1 = new Pessoa(6,"Hhhh","Rua H");
conj.add(p1);
p1 = new Pessoa(8,"Zaaa","Rua Z");
conj.add(p1);
p1 = new Pessoa(9,"Zzzz","Rua Z");
conj.add(p1);
for (int i = 0; i < conj.size(); i++) {
System.out.println("Codigo = "+((Pessoa)conj.get(i)).getCodigo()+
" | Nome = "+((Pessoa)conj.get(i)).getNome());
}
Collections.sort(conj, new PessoaComparator());
System.out.println("\r\nDepois da ordenação.....\r\n");
for (int i = 0; i < conj.size(); i++) {
System.out.println("Codigo = "+((Pessoa)conj.get(i)).getCodigo()+
" | Nome = "+((Pessoa)conj.get(i)).getNome());
}
}
}
class Pessoa {
private int codigo;
private String nome;
private String endereco;
public Pessoa(int cod, String nom, String end) {
this.codigo = cod;
this.nome = nom;
this.endereco = end;
}
public int getCodigo() {
return codigo;
}
public void setCodigo(int codigo) {
this.codigo = codigo;
}
public String getEndereco() {
return endereco;
}
public void setEndereco(String endereco) {
this.endereco = endereco;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
}
class PessoaComparator implements Comparator {
public int compare(Object p1, Object p2)
throws ClassCastException {
if (!(p1 instanceof Pessoa) || !(p2 instanceof Pessoa))
throw new ClassCastException(“Objetos do tipo Pessoa esperados!”);
Pessoa pes1 = (Pessoa)p1;
Pessoa pes2 = (Pessoa)p2;
int comp = pes1.getNome().compareTo(pes2.getNome());
if (comp < 0) {
comp = 1;
} else if (comp > 0) {
comp = -1;
} else {
if (pes1.getCodigo() == pes2.getCodigo()) {
comp = 0;
} else if (pes1.getCodigo() > pes2.getCodigo()) {
comp = 1;
} else {
comp = -1;
}
}
return comp;
}
}
[/code]
Acredito que isso resolva o seu problema.
Mais uma coisa, foi vc que criou esse post no Off-topic ou ele foi movido para ca?
Acredito que ele deveria estar em Java Basico… | __label__pos | 0.99772 |
#1
1. No Profile Picture
Junior Member
Devshed Newbie (0 - 499 posts)
Join Date
Mar 2003
Posts
7
Rep Power
0
Question Character Array and Pointer
Hi All...
Hoping someone can help me with what is probably a silly question. I am to take user input, put it into uppercase, then lowercase. The code below does output the uppercase, except I am missing the first character. I don't get any output for the lowercase.
Thanks in advance..any help is appreciated!
#include <stdio.h>
#include <ctype.h>
void main (void)
{
char text[70];
char *text_ptr=text;
int i;
[COLOR=blue] printf ("\nEnter a line of text (up to 69 characters):\n");
gets(text);
text[70]='\0';>
[COLOR=blue] printf("\nThe line of text in uppercase is:\n\n");
i=0;
while(*text_ptr)
{
*text_ptr++;
putchar(toupper(*text_ptr));
}
printf("\n\nThe line of text in lowercase is:\n\n");
i=0;
while(*text_ptr)
{
*text_ptr++;
putchar(tolower(*text_ptr));
}
}
2. #2
3. Banned ;)
Devshed Supreme Being (6500+ posts)
Join Date
Nov 2001
Location
Woodland Hills, Los Angeles County, California, USA
Posts
9,643
Rep Power
4248
For printing in uppercase, flip the order of the two statements in the loop, (i.e.) uppercasing the pointer and then increment it. You're incrementing the pointer first and then uppercasing, which is why you're missing the first char:
Code:
while(*text_ptr)
{
putchar(toupper(*text_ptr));
text_ptr++;
}
As for the lowercasing part, you forgot to reset your pointer to the beginning of the string again. As before, also change the order of your statements inside the loop and you should be good to go.
Code:
printf("\n\nThe line of text in lowercase is:\n\n");
text_ptr = text; /* <--- Point text_ptr to the beginning of the string again */
while(*text_ptr)
{
putchar(tolower(*text_ptr));
text_ptr++;
}
I realize that you're probably a beginner to C programming, so I'll give you a little friendly advice. Using gets() is highly discouraged for any serious programming. Consider using fgets() or fread() instead. See the BUGS section in http://www.openbsd.org/cgi-bin/man.c...86&format=html for why.
Last edited by Scorpions4ever; April 13th, 2003 at 06:11 PM.
4. #3
5. No Profile Picture
Junior Member
Devshed Newbie (0 - 499 posts)
Join Date
Mar 2003
Posts
7
Rep Power
0
Thumbs up
Thanks for your help. Yes, I am new to programming. I hate to be so obvious! Thanks for the tip, I appreciate it.
Kathy
IMN logo majestic logo threadwatch logo seochat tools logo | __label__pos | 0.959758 |
137 views
Controlling the Create Content button in the Knowledge application
Overview
In the Knowledge application, users can create new knowledge base articles by clicking the Create Content button.
Create_Content
You can control if the Create Content button appears.
Control through Knowledge Management v2
In KMv2, v2 ACLs (not user criteria), are used:
• the current ACLs do a condition check to determine the version to which an article is attached
• the ACLs determine if the ACL's core user criteria should be applied
• the release version is determined by the knowledge base to which the article belongs
If an article is new and no default value is supplied for the article, there is no knowledge base associated with the article and the condition check on the ACL fails. To resolve this, follow the steps below to add the knowledge base named "Knowledge" as a default value in the kb_knowledge table:
Note: Test this process on a non-production environment first.
1. Log in to the instance as an admin.
2. Navigate to Knowledge > Administration > Knowledge Bases.
3. In the Title column, right-click on the Knowledge knowledge base and select Copy sys_id.
4. Navigate to System Definition > Dictionary.
5. Search for:
• Table = kb_knowledge
• Column name = kb_knowledge_base
6. Open the record.
7. Go to the Default Value section or tab.
8. Clear the Use dynamic default option.
9. In Default value, paste the sys_id you copied in step 3.
10. Save the record.
Control through Knowledge Management v3
If you have KMv3, you do not need to set a default knowledge base. However, you do need to make sure there is user criteria defined for the Can Contribute user criteria on v3 knowledge bases. All users that match the user criteria will see the Create Content button. If your user does not meet any of the user criteria, they will not see the button. If no Can Contribute is defined on any v3 Knowledge base, then all users will see the Create Content button (default behavior).
How it all works
The Create Content button is based 100% on user criteria.
Note that if there are two knowledge bases and the user only has user criteria matching one of them, then the user sees the Create Content button. The user can only create an article for:
• the knowledge base they have Can Contribute user criteria for
• any knowledge base that has no Can Contribute user criteria defined
Migrating to Knowledge Management v3
We recommend migrating from KMv2 to KMv3. There are more security controls applied in KMv3 that allow you to easily set which users can/cannot access and create content. If you have not already migrated to KMv3 and want more information about how to get started, see Migrating to KMv3.
Article Information
Last Updated:2017-03-03 09:04:24
Published:2016-09-12 | __label__pos | 0.900617 |
Tizen Native API 7.0
i18n_uparse_error_s Struct Reference
Public Attributes
int32_t line
int32_t offset
i18n_uchar preContext [16]
i18n_uchar postContext [16]
Detailed Description
Struct used to returned detailed information about parsing errors.
Since :
2.3.1
Member Data Documentation
The line on which the error occurred.
The character offset to the error
The error itself and/or textual context after the error
Textual context before the error | __label__pos | 0.950566 |
Most Beautiful Equation in Mathematics
Euler's identity is considered by many to be remarkable for its mathematical beauty.
These three basic arithmetic operations occur exactly once each: addition, multiplication, and exponentiation.
The identity also links five fundamental mathematical constants:
- The number 0, the additive identity.
- The number 1, the multiplicative identity.
- The number π, which is ubiquitous in trigonometry, the geometry of Euclidean space, and analytical mathematics (π = 3.14159265...)
- The number e, the base of natural logarithms, which occurs widely in mathematical and scientific analysis (e = 2.718281828...). Both π and e are transcendental numbers.
- The number i, the imaginary unit of the complex numbers, a field of numbers that contains the roots of all polynomials (that are not constants), and whose study leads to deeper insights into many areas of algebra and calculus, such as integration in calculus.
A poll of readers conducted by The Mathematical Intelligence magazine named Euler's Identity as the "most beautiful theorem in mathematics". Another poll of readers that was conducted by Physics World magazine, chose Euler's Identity tied with Maxwell's equations (of electromagnetism) as the "greatest equation ever". | __label__pos | 0.999965 |
1
$\begingroup$
I'm new to numerical analysis, and have been learning root finding algorithms. I am a bit confused about the difference between Muller's method, and Newton's method using an n-degree interpolating polynomial.
How is the Muller's method, which approximates f(x) using a quadratic polynomial, different from the Newton's method, where lets say we use a 2 degree interpolating polynomial to find roots of f(x)?
I could not find clear and concise theory on using the Newton method with a 2 degree interpolating polynomial to identify if its the same as or is different than the Muller's method.
$\endgroup$
1
$\begingroup$
One of the most basic techniques in numerical analysis, when solving a complicated problem, is to construct an approximately-similar easy problem, solve that to obtain an approximate solution, and restart the process using that solution as a new starting point. This is a very general technique, and it’s not even restricted to root finding methods.
Newton’s and Halley’s methods both share this construction, but that’s not enough to call them the “same” method: most iterative methods are constructed this way. So picking which specific approximation (a line, a quadratic, etc) to use and how is what defines the method, not the general approach.
| cite | improve this answer | |
$\endgroup$
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.979127 |
Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:
I am currently working on a C# project and I am running an insert query which also does a select at the same time, e.g.:
INSERT INTO table (SELECT * FROM table WHERE column=date)
Is there a way I can see how many rows were inserted during this query?
share|improve this question
2 Answers 2
up vote 43 down vote accepted
ExecuteNonQuery - returns the number of rows affected.
SqlCommand comm;
// other codes
int numberOfRecords = comm.ExecuteNonQuery();
share|improve this answer
If you run the SQL from your question in a SqlCommand and check the return value of ExecuteNonQuery it should tell you how many records were affected.
From the documentation:
Return Value
Type: System.Int32
The number of rows affected.
share|improve this answer
Your Answer
discard
By posting your answer, you agree to the privacy policy and terms of service.
Not the answer you're looking for? Browse other questions tagged or ask your own question. | __label__pos | 0.939859 |
0
$\begingroup$
We know that asymptotically $O(1)$< $O(\log_2 n)$ < $O(n)$, but $O(\log_2 n)$ is asymptotically close to $O(n)$ or $O(1)$?
$\endgroup$
3
• $\begingroup$ Note: We're talking about Big O. The logarithm base is irrelevant. Thus, $O(\log n) = O(\log_2 n)$ since $\log_c n = \log n / \log c$. $\endgroup$ – clemens Jan 12 '18 at 7:08
• 1
$\begingroup$ What do you mean by "asymptotically close"? $\endgroup$ – Raphael Jan 12 '18 at 9:43
• $\begingroup$ Close to O(1), asymptotically close to no one. $\endgroup$ – raindrop Jan 12 '18 at 19:54
2
$\begingroup$
As far as I understand your question, you have to take a look at the differences: $O(\log n - 1) = O(\log n)$ versus $O(n - \log n)$. Since
\begin{eqnarray} n - \log n & \stackrel!> & \log n\\ n & > & 2 \log n\\ \end{eqnarray}
you have $O(\log n) \subset{} O(n - \log n)$. The difference to $O(n)$ grows faster than the difference to $O(1)$.
Thus, $O(\log n)$ is closer to $O(1)$ than $O(n)$.
$\endgroup$
2
• $\begingroup$ I don't know which part I was not able to make it clear. These functions are used to measure run-time of given algorithm. So, I want to know among given two which grows very close to logn? $\endgroup$ – user82923 Jan 12 '18 at 8:00
• $\begingroup$ I edited my post to make it clearer. $\endgroup$ – clemens Jan 12 '18 at 8:43
1
$\begingroup$
In some areas, we use $\widetilde O$ instead of $O$ to ignore $\mathsf{poly}(\log n)$ terms. The reason is that $\mathsf{poly}(\log n)$ terms are very small compared to polynomial terms such as $n^\epsilon$, even for an arbitrarily small $\epsilon>0$.
So, roughly you can say $O(\log n)$ is closer to $O(1)$.
$\endgroup$
0
$\begingroup$
Here is a similar question:
I know that $1 < 10 < 10^6$, but is $10$ close to $1$ or to $10^6$?
I'm not sure what kind of answer you expect – you'll have to explain when two functions $f,g$ are asymptotically close. Often we consider $f,g$ to be asymptotically close if $f = \Theta(g)$. Other times, we also allow logarithmic differences, that is, we say that $f,g$ are asymptotically close if $f = O(g \log^C g)$ and $g = O(f \log^C f)$ for some constant $C > 0$. Under both of these definitions, $\log n$ is asymptotically close to neither $1$ nor $n$.
$\endgroup$
Your Answer
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy | __label__pos | 0.985294 |
Protect Your Business From Cyber Threats With Expert Security Services
Protect Your Business From Cyber Threats With Expert Security Services
Cyber threats are a growing concern for businesses of all sizes around the world. With advancements in technology and increasing dependency on digital infrastructure, cybercriminals have found new ways to exploit vulnerabilities and gain access to sensitive data. The impact of cyber-attacks can be devastating, including financial losses, reputational damage, and legal liabilities. Therefore, it is crucial for businesses to take proactive measures to protect themselves from these risks.
One way to mitigate the risks of cyber threats is by seeking expert security services. These services provide businesses with a range of solutions that help identify potential vulnerabilities, monitor networks for early detection, and strengthen defenses through penetration testing. Furthermore, employee training on best cybersecurity practices is essential for ensuring that everyone in the organization is aware of potential risks and knows how to prevent them. In this article, we will explore how expert security services can help businesses protect themselves from cyber threats and why they are necessary in today’s digital landscape.
Understanding Cyber Threats and Risks
An understanding of cyber threats and risks is crucial in implementing effective security measures to safeguard business data and assets against potential attacks. Cyber security services trends show that the frequency and sophistication of cyber-attacks are increasing, with small businesses being a prime target due to their perceived vulnerability. According to cybercrime statistics, 43% of all cyber-attacks target small businesses and 60% of those attacked go out of business within six months.
Cyber threats come in many forms, including malware, ransomware, phishing scams, social engineering attacks, denial-of-service (DoS) attacks, among others. These types of attacks can cause significant damage to a business’s reputation as well as financial loss from data breaches or theft. It is essential for businesses to understand these risks and take proactive steps towards securing their digital assets through cybersecurity measures such as firewalls, antivirus software, regular backups and updates, employee training on safe internet practices and password management policies.
Identifying Potential Vulnerabilities in Your Business
Identifying potential vulnerabilities within a business can be likened to conducting a thorough investigation, wherein every nook and cranny is examined for any signs of weakness or susceptibility to cyber threats. One of the primary ways that businesses can identify their potential vulnerabilities is through risk assessment. This involves evaluating all aspects of the business, from its technological infrastructure to its personnel practices, to determine where weaknesses may exist.
Another valuable tool in identifying potential vulnerabilities is vulnerability scanning. Vulnerability scanning involves using specialized software designed to scan a network or system for known security holes and other weaknesses. This process allows businesses to proactively identify areas that are vulnerable and take steps to address them before they become exploited by cybercriminals. By using both risk assessment and vulnerability scanning techniques, businesses can gain a comprehensive understanding of their cybersecurity posture and work towards mitigating risks and securing their operations against cyber threats.
Network Monitoring for Early Detection
Network monitoring is a constant watchful eye on the organization’s network to detect any signs of suspicious activity that could lead to potential security breaches. It involves using specialized software tools and techniques to monitor network traffic, identify anomalies, and respond quickly to any threats. Network monitoring can help organizations stay ahead of cyber threats by providing real-time alerts for suspicious activity and enabling automated responses.
Real-time alerts are a critical component of network monitoring because they allow security teams to respond quickly to potential threats before they escalate into major security incidents. These alerts typically include information about the source of the threat, its severity level, and recommended actions for containment or mitigation. Automated responses can also be used in conjunction with real-time alerts to provide immediate remediation actions such as blocking malicious IP addresses or isolating affected systems from the network. By leveraging network monitoring tools and techniques, organizations can stay one step ahead of cybercriminals and protect their business from potentially devastating security breaches.
Penetration Testing for Strengthening Defenses
Penetration testing is a proactive measure that helps organizations identify vulnerabilities in their security defenses before they’re exploited. For example, GuidePoint’s pen testing service specializes in simulating real-world attacks, identifying vulnerabilities, and helping organizations in building up their defenses. Their methodology encompasses techniques like network scanning, vulnerability assessment, and social engineering — tactics devised to elicit sensitive information from employees, ensuring a comprehensive and robust defense against potential threats.
One advantage of penetration testing is that it provides a comprehensive view of an organization’s security posture and helps identify weaknesses across multiple areas, including hardware, software, and human factors. By identifying potential vulnerabilities early on, organizations can take steps to strengthen their defenses and prevent cyberattacks from causing significant damage. Ultimately, penetration testing is an essential part of any cybersecurity strategy because it enables organizations to proactively address threats rather than simply reacting after the fact.
Employee Training for Improved Cybersecurity Practices
One effective way to enhance an organization’s cybersecurity is through comprehensive training programs that educate employees on best practices for protecting sensitive information and mitigating potential risks. Such training should cover topics like phishing prevention and password management, which are two of the most critical areas where employees can inadvertently compromise their employer’s security posture.
Phishing is a common tactic used by cybercriminals to trick employees into giving up sensitive data or access credentials. Training on phishing prevention should educate employees on how to recognize suspicious emails, messages, or phone calls that could be part of a phishing attack. Password management is another crucial area where employee education can make a significant difference in enhancing cybersecurity. Employees must understand the importance of creating strong passwords and never sharing them with anyone else. They also need to know how often they should change their passwords and how to use password managers securely if provided by the organization.
Benefits of Expert Security Services for Businesses of All Sizes
Employing professional security services can provide significant advantages for organizations of all sizes in securing their digital assets against potential attacks. These expert security services offer customized solutions that cater to the specific needs and requirements of a business. By conducting a thorough analysis of an organization’s infrastructure, these services can identify vulnerabilities and develop effective strategies to mitigate potential risks. This approach helps businesses ensure that their systems are adequately protected from cyber threats, reducing the risk of data breaches and other forms of cyber-attacks.
Moreover, expert security services offer cost-effective strategies that help organizations optimize their cybersecurity investments. These services work closely with businesses to understand their budget constraints and design solutions that align with their financial goals. Additionally, they offer 24/7 support and timely response to address any security issues promptly, minimizing downtime caused by cyber incidents. With the increasing sophistication and frequency of cyber-attacks, it has become imperative for businesses to seek out professional security services capable of providing comprehensive protection against these threats. By doing so, businesses can safeguard their digital assets while focusing on core operations without worrying about cybersecurity risks.
Frequently Asked Questions
How much does it cost to hire an expert security service for your business?
Conducting a cost analysis and budget planning are essential steps in determining the expenses associated with hiring an expert security service for a business. The exact cost will vary based on factors such as the level of protection required, size of the company, and duration of the service agreement.
Can an expert security service guarantee 100% protection against all cyber threats?
Expert security services cannot guarantee 100% protection against all cyber threats. However, cost effective solutions such as penetration testing, network vulnerability assessments, ongoing monitoring and maintenance services, employee training and improving cybersecurity practices can greatly reduce the risks of cyber attacks.
What is the process for conducting a penetration test on a business’s network?
The penetration test process involves a network vulnerability assessment which identifies potential security weaknesses and evaluates the effectiveness of existing controls. It typically includes reconnaissance, scanning, exploitation, and reporting to provide insights for remediation and risk mitigation measures.
Do expert security services offer ongoing monitoring and maintenance for a business’s cybersecurity?
Expert security services can provide ongoing monitoring and maintenance for a business’s cybersecurity, including regular updates and patches to software and systems. They may also offer cybersecurity training and employee education to prevent future threats.
How long does it typically take for employees to complete cybersecurity training and see an improvement in their practices?
Employee engagement and measuring cybersecurity effectiveness can be accomplished through regular training and assessing employee behavior. The time for improvement varies, but consistent training can lead to effective practices over time.
Related Articles | __label__pos | 0.97783 |
lu分解
在线性代数中, LU分解(LU Decomposition)是矩阵分解的一种,可以将一个矩阵分解为一个单位下三角矩阵和一个上三角矩阵的乘积(有时是它们和一个置换矩阵的乘积)。LU分解主要应用在数值分析中,用来解线性方程、求反矩阵或计算行列式。
现代电路分析 第一章 矩阵运算的计算机方法及稀疏距阵 广东海洋大学 电子工程系 2007.8 矩阵运算的计算机方法 第二节 高斯消元法解线性方程组 广东海洋大学 电子工程系 2007.8 矩阵运算的计算机方法 第三节 LU分解法解线性方程组 分解法解线性方程
Read: 8726
在線性代數與數值分析中,LU分解是矩陣分解的一種,將一個矩陣分解為一個下三角矩陣和一個上三角矩陣的乘積,有時需要再乘上一個置換矩陣。LU分解可以被視為高斯消去法的矩陣形式。在數值計算上,LU分解經常被用來解線性方程組、且在求反矩陣和
定義 ·
Ax=B,改写成Ly=B,Ux=y的方程组。就相当于将A=LU分解成了两个矩阵。称为矩阵A的三角分解,或LU分解。如果L为单位下三角阵,则叫Doolittle分解,若U为单位上三角阵,则叫Crout分解。只要A的各顺序主子式不为零,则A可唯一分解成一个单位下三角阵L与
狀態: 發問中
LU 分解的意义在于,将矩阵的「分解」与方程的「求解」分离。有什么好处?在不少应用场景中,当需要求解
求大神帮忙,怎么在MATLAB上用LU分解法? – 知乎 12/10/2017
一般矩阵的LDU分解方法? – 知乎 20/12/2015
如何理解不完全LU分解? – 知乎 – 发现更大的世界
SVD分解为什么是最好的?QR分解和SVD比较?LU呢?SVD并行算法可行么?
查看其他搜尋結果
18/9/2019 · A的LU分解 学校: 麻省理工学院 讲师: Gilbert Strang 集数: 35 授课语言: 英文 类型: 数学 国际名校公开课 课程简介: “线性代数”,同微积分一样,是高等数学中两大入门课程之一,不仅是一门非常好的数学课程,也是一门非常好的工具学科,在很多
LU矩阵分解实例_数学_自然科学_专业资料。本文给出了一个基于LU分解的实例,其中对每一步进行了分析和推导。?4 ?8 例:给定一4阶矩阵 A = ? ?4 ? ?6 2 1 5? 7 2 10 ? ? ,通过LU分解求逆矩阵 A?1 。 8 3 6? ? 8 4 9? ?1 解:算法过程为: A 第一步:求LU矩阵 ?1
Read: 7130
20/5/2015 · MATLAB中文论坛MATLAB 基础讨论板块发表的帖子:矩阵LU分解(crout分解 doolittle分解)。matlab里面有直接实现crout分解和Doolittle分解的函数吗?为什么用lu函数得出的
上次張貼日期: 2/11/2014
MATLAB利用LU分解法求解线性方程组,当矩阵(方阵)A为行列式不为0的矩阵时,也就是说方阵A是可逆矩阵的,那么A为非奇异矩阵。对于非奇异矩阵A可以进行LU分解,即把A分解为一个变换形式的下三角矩阵L(进行了行变换)和一个上三角矩阵U,使得A=L*U。
1.前言最近需要研究宽度学习,里面的矩阵知识基本都丢了,所以需要从头开始学习,看完了3Blue1Brown上面的线性代数的本质后,有一些全新的认识,后面将对具体使用到的知识做一个精准的学习。首先是矩阵分解的知识
矩阵的LU分解是将一个矩阵分解为一个下三角矩阵与上三角矩阵的乘积。本质上,LU分解是高斯消元的一种表达方式。首先,对矩阵A通过初等行变换将其变为一个上三角矩阵。对于学习过线性代数的同学来说,这个过程应该很熟悉,线性代数考试中求
MATLAB利用LU分解法求解线性方程组,当矩阵(方阵)A为行列式不为0的矩阵时,也就是说方阵A是可逆矩阵的,那么A为非奇异矩阵。对于非奇异矩阵A可以进行LU分解,即把A分解为一个变换形式的下三角矩阵L(进行了行变换)和一个上三角矩阵U,使得A=L*U。
Chapter 1.7 LU 分解 基本列運算: 將矩陣的某一列乘以一個非零數。 將矩陣中的某兩列互調位置。 將矩陣的某一列乘以某一非零數加入另一列。 基本列運算矩陣: = = (M 1 A) , M 1 = (M 2 A) , M 2 = M 3 = M 3 A: row i = row i + C row j
您今日下载次数已达上限(为了良好下载体验及使用,每位用户24小时之内最多可下载20个资源)
定理:A可以进行LU分解的充要条件是A顺序主子式全不为0.这个定理的证明涉及到高斯消去法.我们知道高斯消去的三种消去1对换:对换矩阵的两行2倍乘,将某行乘以常数3倍加:将矩阵某行乘以常数加到另一行.对应三种初等矩阵.其中第二三个是下三角矩阵
lu分解python Python是一种计算机程序设计语言。是一种动态的、面向对象的脚本语言,最初被设计用于编写自动化脚本(shell),随着版本的不断更新和语言新功能的添加,越来越多
LU 分解 統計軟體 R 簡介 安裝 操作方式 變數與運算 有序數列 向量 矩陣 多維陣列 複數 因子 串列 資料框 時間數列 流程控制 輸出入 呼叫 函數 2D 繪圖 3D 繪圖 互動介面
在線性代數與數值分析中,LU分解是矩陣分解的一種,將一個矩陣分解為一個下三角矩陣和一個上三角矩陣的乘積,有時需要再乘上一個置換矩陣。LU分解可以被視為高斯消去法的矩陣形式。在數值計算上,LU分解經常被用來解線性方程組、且在求反矩陣和
此 MATLAB 函数 将满矩阵或稀疏矩阵 A 分解为一个上三角矩阵 U 和一个经过置换的下三角矩阵 L,使得 A = L*U。
矩阵的LDU分解是在LU分解之后,把U再次分解,目的是把U的对角线元素都化为1。作用很多,比如求特征值,A=LDU,A的特征值是D的对角线元素相乘 因为L、D是对角线元素为1的下、上三角矩阵。L lower triangular matrix 下三角矩阵
狀態: 發問中
LU分解在本质上是高斯消元法的一种表达形式。实质上是将A通过初等行变换变成一个上三角矩阵,其变换矩阵就是一个单位下三角矩阵。这正是所谓的杜尔里特算法(Doolittle algorithm):从下至上地对矩阵A做初等行变换,将对角线左下方的元素变成零
(另一方式來分解 , Chelosky Decomposition,先前之高斯消去法為 不使用 pivoting 的消去法。) Example : 以 A= 來說,無法執行高斯消去法。 若經由列對調 ( 不影響其解 ) 產生新的 再做 LU 分解, 這樣稱為不使用 pivoting 的高斯消去法。 [Summary] A = = 其中
LU 分解 統計軟體 R 簡介 安裝 操作方式 變數與運算 有序數列 向量 矩陣 多維陣列 複數 因子 串列 資料框 時間數列 流程控制 輸出入 呼叫 函數 2D 繪圖 3D 繪圖 互動介面 套件列表
LU decomposition can be viewed as the matrix form of Gaussian elimination. Computers usually solve square systems of linear equations using LU decomposition, and it is also a key step when inverting a matrix or computing the determinant of a matrix. LU
前言 看了麻省理工的线性代数的一部分课程,主要是补补课,大二线代忘得差不多,主要目的是学习SVD,学习SVD之前补补前面的课,第一课就是LU分解了。 什么是LU分解 L是指下三角矩阵,U是指上三角矩阵,也就是说一个矩阵可以分解为下三角矩阵和上
2C4G5M 1200元/3年 码农岛 搬瓦工VPS CN2 GIA 三人行慕课-视频教程 腾讯云2860元代金券 搬瓦工VPS CN2 GIA 威屁恩 低至$1.5/月 免费网址导航大全 美国VPS GIA 半价 薇薇资讯网 阿里云服务器2折起 爱代码社区 海外1核2G 19.8元/月 搬瓦工VPS CN2 GIA
所以使用pivot这种方法可以极大的提高LU分解的稳定程度。但是也需要指出,使用pivot并不一定能提高LU分解的精度,对于特定的矩阵,不使用pivot说不定可以获得更好的性能。 为了进一步提高提高LU分解的稳定性,可以使用full pivoted LU。
Fortran 95 で正方行列の LU 分解アルゴリズムを実装してみました。今回使用する分解法は「内積形式ガウス法(inner-product form)」過去には Ruby で同じことをしました。 Ruby – LU 分解(内積形式ガウス法(inner-product form))!
简介 利用矩阵分解来求先行方程组,可以节省内存,节省计算时间,因此在工程计算中最常用的技术。其中LU分解法是最基本也是最常用的方法。方法/步骤 现将系数矩阵A进行LU分解,得到LU=PA;然后解Ly=Pb; 再解Ux=y得到原方程组的解。
在线性代数中, LU分解(LU Decomposition)是矩阵分解的一种,可以将一个矩阵分解为一个单位下三角矩阵和一个上三角矩阵的乘积(有时是它们和一个置换矩阵的乘积)。LU分解主要应用在数值分析中,用来解线性方程、求反矩阵或计算行列式。
前言 看了麻省理工的线性代数的一部分课程,主要是补补课,大二线代忘得差不多,主要目的是学习SVD,学习SVD之前补补前面的课,第一课就是LU分解了。 什么是LU分解
副程式的使用 本節所用到的副程式有兩個,分別是作 LU 分解的 ludcmp,以及做配合其作反向代回的 lubksb 。 這兩個副程式的呼叫引數 (argument) 安排與課文內說明分別
・LU分解による方法(コレスキー分解による方法) 上三角行列や下三角行列から逆行列が求めやすいことを利用.O(n^2) で解ける シンプルに逆行列を求めたい 1.掃き出し法 掃き出し法
29/10/2011 · AX=B; A= 1 2 1 0 X= X1 這個是X one X2 這個是X two B= 3 1 (1) LU 分解 我不知道 LU分解要怎麼算我只知道LU=A而已.. 題目是LU分解 麻煩會的人 教
LU分解初步 矩阵的LU分解主要用来求解线性方程组或者计算行列式。在使用初等行变换法求解线性方程组的过程中,系数矩阵的变化情况如下: 由上可知
25/6/2013 · 定理1.2.2 设,则存在排列矩阵,以及单位下三角阵 和上三角阵,使得 而且 的所有元素之模均不超过1,的非零对角元的个数正好等于矩阵A的秩。 列主元三角分解的具体算法
用python编写的比较简洁的LU分解法解方程组 python 数值计算 LU分解 计算方法 方程组 2013-12-22 上传 大小:2KB 7积分/C币 立即下载 最低0.28元
在线性代数中, LU分解(LU Decomposition)是矩阵分解的一种,可以将一个矩阵分解为一个单位下三角矩阵和一个上三角矩阵的乘积(有时是它们和一个置换矩阵的乘积)。LU
Fortran 95 で正方行列の LU 分解アルゴリズムを実装してみました。今回使用する分解法は「内積形式ガウス法(inner-product form)」過去には Ruby で同じことをしました。 Ruby
简介 利用矩阵分解来求先行方程组,可以节省内存,节省计算时间,因此在工程计算中最常用的技术。其中LU分解法是最基本也是最常用的方法。方法/步骤 现将系数矩阵A进行 | __label__pos | 0.533201 |
Quantum Computing: A Game-Changer for Science & Engineering!
Quantum computing is the new kid on the block, and it’s here to revolutionize the world of science and engineering! With the power to solve complex problems that traditional computers can’t handle, quantum computing is a game-changer that’s set to transform the way we approach everything from drug discovery to financial modeling. So buckle up, because we’re about to enter a whole new era of technological innovation!
Quantum computing is a new field of study that is revolutionizing the way we think about computing. Traditional computers operate on bits that can store either a one or a zero, while quantum computers use quantum bits, or qubits, that can be in a superposition of states. This allows quantum computers to solve problems that are impossible for classical computers to solve efficiently. The potential applications of quantum computing are vast, and they are poised to revolutionize many fields, including science and engineering.
Quantum Computing: Revolutionizing Science & Engineering!
Quantum computing has the potential to revolutionize scientific and engineering fields by solving problems that are currently impossible to solve with classical computers. For example, quantum computers can simulate the behavior of complex molecules, allowing researchers to design new drugs and materials. They can also be used to optimize supply chains, improve traffic flow, and predict the behavior of financial markets.
Another area where quantum computing shows great promise is in machine learning. Quantum computers can process vast amounts of data in parallel, allowing machine learning algorithms to learn faster and more accurately. This could lead to the development of more advanced artificial intelligence systems, which could revolutionize many industries, including healthcare, finance, and logistics.
Unleashing the Power of Quantum Computing!
The key to unleashing the power of quantum computing is developing quantum algorithms that can solve problems efficiently. This is a difficult task, as quantum algorithms are very different from classical algorithms. However, researchers are making progress, and quantum algorithms are being developed for a wide range of applications.
Another challenge is building quantum computers that are stable and reliable. Quantum computers are very sensitive to their environment, and even slight disturbances can cause errors in their calculations. However, progress is being made in building more stable and reliable quantum computers, and the race is on to build the first large-scale quantum computer.
In conclusion, quantum computing is a game-changer for science and engineering. The potential applications are vast, and researchers are making progress in developing quantum algorithms and building more stable and reliable quantum computers. We are on the cusp of a new era in computing, and the possibilities are endless.
0 Shares:
You May Also Like
Grow Green: Thriving with Sustainable Innovations!
"Grow Green: Thriving with Sustainable Innovations!" brings a burst of hope and joy to the realm of sustainability. It's a refreshing take on an issue that can often feel overwhelming. With fun and innovative ideas, this article inspires us to do our part in creating a better world for ourselves and future generations.
Crypto’s Day is Done, Hooray!
Crypto's day is done, hooray! The once-hyped world of cryptocurrency has finally come to an end, paving the way for more stable and reliable financial systems. No more wild market swings or confusing jargon – we can all breathe a sigh of relief and get back to our traditional currency. Cheers to a brighter, more stable future!
Electric and Autonomous Cars: Driving into a Bright Future!
Electric and autonomous cars are revolutionizing the way we drive, paving the way for a brighter, cleaner, and more efficient future. With advanced technology and innovative designs, these cars are not only eco-friendly but also incredibly fun to drive. So buckle up and get ready to hit the road, because the future of driving is looking bright! | __label__pos | 0.997475 |
Difference between revisions of "GLSL Optimizations"
From OpenGL Wiki
Jump to: navigation, search
(Assignment with MAD)
m (nit-picky language improvements)
(One intermediate revision by one other user not shown)
Line 13: Line 13:
gl_Position.xy = in_pos.xy;
gl_Position.xy = in_pos.xy;
</source>
</source>
Swizzle can both make your shader faster, and the code becomes more readable.
+
Swizzle can both make your shader faster, and make your code more readable.
== Get MAD ==
== Get MAD ==
Line 24: Line 24:
vec4 result3 = (value / -2.0) + 1.0;
vec4 result3 = (value / -2.0) + 1.0;
// There are most likely converted to a single MAD operation (per line).
+
// These are most likely converted to a single MAD operation (per line).
vec4 result1 = (value * 0.5) + 1.0;
vec4 result1 = (value * 0.5) + 1.0;
vec4 result2 = (value * 0.5) - 1.0;
vec4 result2 = (value * 0.5) - 1.0;
Line 56: Line 56:
== Fast Built-ins ==
== Fast Built-ins ==
There are a number of built-in functions that are quite fast, if not "single-cycle" (to the extent that this means something for various different hardware).
+
There are a number of built-in functions that are quite fast, if not "single-cycle" (performance is different on different hardware).
=== Linear Interpolation ===
=== Linear Interpolation ===
Line 66: Line 66:
resultRGB = colorRGB_0 * (1.0 - alpha) + colorRGB_1 * alpha;
resultRGB = colorRGB_0 * (1.0 - alpha) + colorRGB_1 * alpha;
//The above can be converted to the following for MAD purposes:
+
// The above can be converted to the following for MAD purposes:
resultRGB = colorRGB_0 + alpha * (colorRGB_1 - colorRGB_0);
resultRGB = colorRGB_0 + alpha * (colorRGB_1 - colorRGB_0);
//GLSL provides the mix function. This function should be used where possible:
+
// GLSL provides the mix function. This function should be used where possible:
resultRGB = mix(colorRGB_0, colorRGB_1, alpha);
resultRGB = mix(colorRGB_0, colorRGB_1, alpha);
</source>
</source>
+
=== Dot products ===
=== Dot products ===
Latest revision as of 15:20, 17 June 2019
Many of the optimizations in this article are done automatically by some implementations, but often they are not. Therefore it helps to use these code optimizations, and they neither makes your code more complicated to read.
Use Swizzle
Swizzle masks are essentially free in hardware. Use them where possible.
in vec4 in_pos;
// The following two lines:
gl_Position.x = in_pos.x;
gl_Position.y = in_pos.y;
// can be simplified to:
gl_Position.xy = in_pos.xy;
Swizzle can both make your shader faster, and make your code more readable.
Get MAD
MAD is short for multiply, then add. It is generally assumed that MAD operations are "single cycle", or at least faster than the alternative.
// A stupid compiler might use these as written: a divide, then add.
vec4 result1 = (value / 2.0) + 1.0;
vec4 result2 = (value / 2.0) - 1.0;
vec4 result3 = (value / -2.0) + 1.0;
// These are most likely converted to a single MAD operation (per line).
vec4 result1 = (value * 0.5) + 1.0;
vec4 result2 = (value * 0.5) - 1.0;
vec4 result3 = (value * -0.5) + 1.0;
The divide and add variant might cost 2 or more cycles.
One expression might be better than the other. For example:
result = 0.5 * (1.0 + variable);
result = 0.5 + 0.5 * variable;
The first one may be converted into an add followed by a multiply. The second one is expressed in a way that more explicitly allows for a MAD operation.
Assignment with MAD
Assume that you want to set the output value ALPHA to 1.0. Here is one method :
myOutputColor.xyz = myColor.xyz;
myOutputColor.w = 1.0;
gl_FragColor = myOutputColor;
The above code can be 2 or 3 move instructions, depending on the compiler and the GPU's capabilities. Newer GPUs can handle setting different parts of gl_FragColor, but older ones can't, which means they need to use a temporary to build the final color and set it with a 3rd move instruction.
You can use a MAD instruction to set all the fields at once:
const vec2 constantList = vec2(1.0, 0.0);
gl_FragColor = mycolor.xyzw * constantList.xxxy + constantList.yyyx;
This does it all with one MAD operation, assuming that the building of the constant is compiled directly into the executable.
Fast Built-ins
There are a number of built-in functions that are quite fast, if not "single-cycle" (performance is different on different hardware).
Linear Interpolation
Let's say we want to linearly interpolate between two values, based on some factor:
vec3 colorRGB_0, colorRGB_1;
float alpha;
resultRGB = colorRGB_0 * (1.0 - alpha) + colorRGB_1 * alpha;
// The above can be converted to the following for MAD purposes:
resultRGB = colorRGB_0 + alpha * (colorRGB_1 - colorRGB_0);
// GLSL provides the mix function. This function should be used where possible:
resultRGB = mix(colorRGB_0, colorRGB_1, alpha);
Dot products
It is reasonable to assume that dot product operations, despite the complexity of them, will be fast operations (possibly single-cycle). Given that knowledge, the following code can be optimized:
vec3 fvalue1;
result1 = fvalue1.x + fvalue1.y + fvalue1.z;
vec4 fvalue2;
result2 = fvalue2.x + fvalue2.y + fvalue2.z + fvalue2.w;
This is essentially a lot of additions. Using a simple constant and the dot-product operator, we can have this:
const vec4 AllOnes = vec4(1.0);
vec3 fvalue1;
result1 = dot(fvalue1, AllOnes.xyz);
vec4 fvalue2;
result2 = dot(fvalue2, AllOnes);
This performs the computation all at once. | __label__pos | 0.993452 |
Docs
API Docs
Frames
Frames tool
The PhotoEditor SDK includes a versatile frame tool that works with any given photo size or ratio and provides two distinct options to apply frames. For the dynamic frames tool that works perfectly for creatives with repeatable or stretchable areas, we abandoned the 9-patch standard and replaced it with a novel and even more flexible 12-patch layout. The static frames tool can be used for complex and irregular creatives.
The tool is implemented in the FrameEditorTool class and displayed using the FrameToolPanel. If you want to customize the appearance of this tool, take a look at the styling section.
Dynamic frames
Dynamic frames consist of four groups. Each group has a start, middle and end image. The start and end images are optional, and for the middle image there are two modes, FrameTileMode.repeat and FrameTileMode.stretch. These determine whether the asset should be stretched over the area, or if they should be repeated to fill up space. Please note that in our implementation the middle asset will never be cut, when .repeat is set as its mode, but rather squeeze or stretch the single tiles a bit, to fit in only complete copies of the asset. The four groups can be laid out in two ways. Horizontal inside or vertical inside, see the images below.
frame inside
The idea behind the naming is, that if you imagine a box that covers the right and left groups and the top and bottom groups surrounding it, the horizontal box is inside the groups, as illustrated by the following image.
frame horizontal
Finally, let’s have a look at a real-world example.
dia sample
The layout mode here is horizontal inside. The top and bottom group just have a middle image, containing the film strip pattern. The left and right group consist of a stretched border texture, and a start and end image to create a nice transition between the two sides of the film strip.
Adding dynamic frames
In order to change the available frames, rearrange or add new frames, start with a default PESDKConfig as described in the configuration section. Then use the setFrameConfig() method to update the configuration.
Please make sure you put the PNG files into the res/raw or the res/drawable-nodpi folder, otherwise the frame is scaled by Android.
For dynamic frames each FrameConfig takes the following five parameters:
1. Frame identifier, this should be unique. It is currently used for serialization only
2. Resource identifier of the frame name, which should be unique. Will not be displayed in the default layout, but is used for accessibility
3. Drawable resource or ImageSource of the icon
4. Custom patch model, which describes the 12-patch layout
5. Frame thickness, which is between > 0 and 1 (100%)
Each CustomPatchFrameConfig takes the following 5 parameters:
1. FrameLayoutMode, which describes the orientation (HorizontalInside or VerticalInside)
2. Top FrameImagGroup
3. Left FrameImagGroup
4. Right FrameImagGroup
5. Bottom FrameImagGroup
Each FrameImageGroup takes the following 4 parameters:
1. (Optional) Start image tile ImageSource
2. Middle tile ImageSource
3. FrameTileMode of the middle tile (Stretch or Repeat)
4. (Optional) End image tile ImageSource
A dynamic frame configuration could then look like this:
//Internal frame
config.setFrameLists (
FrameConfig.createNonFrameConfig(R.string.imgly_frame_name_none, R.drawable.imgly_icon_option_frame_none),
new FrameConfig(
"your_unique_frame_ID_1",
R.string.imgly_frame_name_dia,
R.drawable.imgly_frame_dia_thumb,
new CustomPatchFrameConfig(
FrameLayoutMode.HorizontalInside,
new FrameImageGroup(ImageSource.create(R.drawable.imgly_frame_dia_top), FrameTileMode.Repeat),
new FrameImageGroup(
ImageSource.create(R.drawable.imgly_frame_dia_top_left),
ImageSource.create(R.drawable.imgly_frame_dia_left), FrameTileMode.Stretch,
ImageSource.create(R.drawable.imgly_frame_dia_bottom_left)
),
new FrameImageGroup(
ImageSource.create(R.drawable.imgly_frame_dia_top_right),
ImageSource.create(R.drawable.imgly_frame_dia_right), FrameTileMode.Stretch,
ImageSource.create(R.drawable.imgly_frame_dia_bottom_right)
),
new FrameImageGroup(ImageSource.create(R.drawable.imgly_frame_dia_bottom), FrameTileMode.Repeat)
),
0.075f
));
//External frame
config.setFrameLists (
FrameConfig.createNonFrameConfig(R.string.imgly_frame_name_none, R.drawable.imgly_icon_option_frame_none),
new FrameConfig(
"your_unique_frame_ID_2",
"Your external frame PNG",
"Your external frame thumb PNG",
new CustomPatchFrameConfig(
FrameLayoutMode.VerticalInside,
new FrameImageGroup(ImageSource.create(Uri.parse("https://content.mydomain/frames/flower_top.png")), FrameTileMode.Repeat),
new FrameImageGroup(
ImageSource.create(Uri.parse("https://content.mydomain/frames/flower_top_left.png")),
ImageSource.create(Uri.parse("https://content.mydomain/frames/flower_left.png")), FrameTileMode.Stretch,
ImageSource.create(Uri.parse("https://content.mydomain/frames/flower_bottom_left.png"))
),
new FrameImageGroup(
ImageSource.create(Uri.parse("https://content.mydomain/frames/flower_top_right.png")),
ImageSource.create(Uri.parse("https://content.mydomain/frames/flower_right.png")), FrameTileMode.Stretch,
ImageSource.create(Uri.parse("https://content.mydomain/frames/flower_bottom_right.png"))
),
new FrameImageGroup(ImageSource.create(Uri.parse("https://content.mydomain/frames/flower_bottom.png")), FrameTileMode.Repeat)
),
0.1f
));
Static frames
Static frames hold several versions of the assets, i.e. one for each supported ratio. During the rendering process, the best fitting asset will be selected and used by the backend. Also, the tolerance can be used to determine how close the ratio of the asset has to be to the current image ratio. Setting a higher tolerance can lead to a deformation of the frame asset since it will be simply scaled to match the image dimensions. In the frame tool UI, only static frames with a matching asset for the current image ratio will be listed. The static frames can be used for complex and irregular creatives.
Adding static frames
For static frames each FrameConfig takes the following six parameters:
1. Frame identifier, this should be unique. It is currently used for serialization only
2. Resource identifier of the frame name, which should be unique. Will not be displayed in the default layout, but is used for accessibility
3. Drawable resource of the icon
4. Drawable resource of the frame
5. Aspect ratio to which the frame corresponds
6. Group ID to identifiy an equal frame with different aspect ratios. If the crop ratio is changed, the frame will be replaced with a frame that fits the new aspect ratio given that both frames have the same group id.
A static frame configuration could then look like this:
config.setFrameLists (
FrameConfig.createNonFrameConfig(R.string.imgly_frame_name_none, R.drawable.imgly_icon_option_frame_none),
new FrameConfig(
"your_unique_frame_ID_1",
R.string.imgly_frame_name_dia,
R.drawable.imgly_frame_dia_thumb,
R.drawable.imgly_frame_dia,
new CropAspectConfig(16, 9),
1
),
...
); | __label__pos | 0.9611 |
Example fibonacci life sequence real
fibonacci sequence in real life Google Search
fibonacci sequence example real life
Sequences and Patterns Fibonacci Numbers. For sure someone remember the fibonacci sequence coming from math using fibonacci for developing real life there are a lot of examples of life, the fibonacci sequence is fixed as starting with 1 and a simple example is 1,2,3 this sequence is interesting as it is observed in real life natural.
Who was Fibonacci? University of Surrey
What are some examples of the Fibonacci reference.com. The fibonacci sequence is one of the most famous formulas in what's the real story behind this famous sequence? and perhaps the most famous example of all,, learn how the fibonacci sequence relates to the golden ratio and explore how your fibonacci sequence: examples, let's take a look at these real-life examples..
This is a recursive formula to find a term in the fibonacci sequence. example of fibonacci sequence. adding real numbers worksheet. home plan & pricing faq contact us examples of fibonacci numbers in real life. triangles in real life a real number fibonacci number sequence in nature
Fibonacci sequence 1 . this thesis offers a brief background on the life of fibonacci as well as fascinating characteristics and applications of the fibonacci what are the real life applications of fibonacci series? numbers are also an example of a complete sequence. the the fibonacci sequence used in real life?
The fibonacci sequence in real life and its applications by acknowledgement i would take this opportunity to thank my research supervisor, family and friends for fibonacci numbers are a sequence discovered by italian mathematician leonardo 3 important uses of fibonacci numbers. an example of the power of math can be found
Find and save ideas about fibonacci sequence examples on pinterest. another example of the connection between life, earth and everything else. ... found in all aspects of life. to use as an example of the fibonacci sequence. fibonacci sequence used today? a great real-time application of
7 beautiful examples of the fibonacci sequence fibonacci (real when your parents get tired of you calling them about every little inconvenience in your life 12/03/2013в в· the fibonacci sequence in real life mike mccraith. nth term formula for the fibonacci sequence, geometric sequence real life salary - duration:
Fibonacci numbers in daily life yining lin, science and real life. therefore fibonacci sequence is for example, when we deal with fibonacci sequence in real life - google search. fibonacci sequence in real life - google search
Find and save ideas about fibonacci sequence examples on pinterest. another example of the connection between life, earth and everything else. for example, xi means 10+1=11 before fibonacci wrote his work, the sequence f(n) references to fibonacci's life and times
Sequences and Patterns Fibonacci Numbers
fibonacci sequence example real life
3 Important Uses of Fibonacci Numbers StockTrader.com. ... found in all aspects of life. to use as an example of the fibonacci sequence. fibonacci sequence used today? a great real-time application of, in the fibonacci sequence of numbers, examples include the brahmaguptaвђ“fibonacci identity, the fibonacci search technique, and the pisano period..
fibonacci sequence example real life
The Fibonacci Sequence in Nature Insteading. Home plan & pricing faq contact us examples of fibonacci numbers in real life. triangles in real life a real number fibonacci number sequence in nature, example: the next number in the sequence above is about fibonacci the man. his real name was leonardo as well as being famous for the fibonacci sequence,.
Running head FIBONACCI SEQUENCE 1 Liberty University
fibonacci sequence example real life
Fabulous Fibonacci Mensa for Kids. The fibonacci sequence is fixed as starting with 1 and a simple example is 1,2,3 this sequence is interesting as it is observed in real life natural This is a recursive formula to find a term in the fibonacci sequence. example of fibonacci sequence. adding real numbers worksheet..
This definition explains the fibonacci sequence and discusses the significance of its patterns throughout the for example, and the distribution (in real life ... as well as to the real world and to the daily life b. definitions of the golden ratio related to fibonacci sequence we can find many examples in
Home plan & pricing faq contact us examples of fibonacci numbers in real life. triangles in real life a real number fibonacci number sequence in nature so let's look at another real-life situation that is the fibonacci sequence as it appears in nature by here are some more examples of non-fibonacci
So let's look at another real-life situation that is the fibonacci sequence as it appears in nature by here are some more examples of non-fibonacci this is the famous fibonacci number sequence, inspiration from fibonacci series in real life. another great example of how insights from one discipline can be
For sure someone remember the fibonacci sequence coming from math using fibonacci for developing real life there are a lot of examples of life what are some examples of the fibonacci sequence in nature? examples of fibonacci sequences and numbers in nature are spiral shell formation, rabbit population and
This is the famous fibonacci number sequence, inspiration from fibonacci series in real life. another great example of how insights from one discipline can be how can you apply series and sequences in real life? some real life applications of different arithmetic series like fibonacci sequence, for example, if f(t
One such example is the golden ratio. this famous fibonacci sequence has demonstrate the sequence in the real abound with examples of the golden ratio. life science; engineering; that also reflect the fibonacci sequence in this to be one of the numbers in the fibonacci sequence. for example,
The fibonacci sequence and the golden ratio in music example, vementвђ™ , i.e fibonacci sequence typically defines in nature is made present in music by using fibonacci sequence 1 . this thesis offers a brief background on the life of fibonacci as well as fascinating characteristics and applications of the fibonacci
How can you apply series and sequences in real life? some real life applications of different arithmetic series like fibonacci sequence, for example, if f(t 7 beautiful examples of the fibonacci sequence in nature fibonacci (real name but roses are my favorite kind to use as an example of the fibonacci sequence.
fibonacci sequence example real life
This is the fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, the next number is found by adding the two numbers before it together:... thus the fibonacci sequence is an example of a fibonacci prime is a fibonacci number przemysе‚aw prusinkiewicz advanced the idea that real instances | __label__pos | 0.976784 |
Spherical collisionobject never stops and falls asleep
Hello!
I want to make a spherical object in my game behave approximately the way it should behave in the real world. And it is surprisingly hard to do. Imagine, for example, how a billiard ball behaves if it is hit with a cue. It will roll for a while and then stop completely. That is, its x and y coordinates will remain unchanged. In my case, inside the game the sphere does not stop completely and continues to roll very slowly to the left or right, as if some very weak force continues to push it. In box2d shouldn’t the physical body fall asleep completely after some time? Why isn’t this happening? Even if, when measuring the speed of the ball, I set angular velocity to zero
go.set("#collisionobject", "angular_velocity", vmath.vector3(0,0,0))
the ball still continues to make some micro-jumps and never falls asleep. Please advise what to do.
Game physics:
Ball physics (sphere):
изображение
Walls:
изображение | __label__pos | 0.86534 |
tuned signature;
authorwenzelm
Wed, 01 Jun 2016 10:45:35 +0200
changeset 63201 f151704c08e4
parent 63200 6eccfe9f5ef1
child 63202 e77481be5c97
tuned signature;
src/HOL/Decision_Procs/Dense_Linear_Order.thy
src/HOL/Library/Sum_of_Squares/positivstellensatz_tools.ML
src/HOL/Library/Sum_of_Squares/sum_of_squares.ML
src/HOL/Library/positivstellensatz.ML
src/HOL/Multivariate_Analysis/normarith.ML
src/HOL/Tools/groebner.ML
src/HOL/Tools/lin_arith.ML
src/HOL/Tools/semiring_normalizer.ML
src/Provers/Arith/fast_lin_arith.ML
src/Pure/General/rat.ML
--- a/src/HOL/Decision_Procs/Dense_Linear_Order.thy Tue May 31 23:06:03 2016 +0200
+++ b/src/HOL/Decision_Procs/Dense_Linear_Order.thy Wed Jun 01 10:45:35 2016 +0200
@@ -897,9 +897,9 @@
fun dest_frac ct =
case Thm.term_of ct of
Const (@{const_name Rings.divide},_) $ a $ b=>
- Rat.rat_of_quotient (snd (HOLogic.dest_number a), snd (HOLogic.dest_number b))
- | Const(@{const_name inverse}, _)$a => Rat.rat_of_quotient(1, HOLogic.dest_number a |> snd)
- | t => Rat.rat_of_int (snd (HOLogic.dest_number t))
+ Rat.make (snd (HOLogic.dest_number a), snd (HOLogic.dest_number b))
+ | Const(@{const_name inverse}, _)$a => Rat.make(1, HOLogic.dest_number a |> snd)
+ | t => Rat.of_int (snd (HOLogic.dest_number t))
fun whatis x ct = case Thm.term_of ct of
Const(@{const_name Groups.plus}, _)$(Const(@{const_name Groups.times},_)$_$y)$_ =>
--- a/src/HOL/Library/Sum_of_Squares/positivstellensatz_tools.ML Tue May 31 23:06:03 2016 +0200
+++ b/src/HOL/Library/Sum_of_Squares/positivstellensatz_tools.ML Wed Jun 01 10:45:35 2016 +0200
@@ -20,7 +20,7 @@
fun string_of_rat r =
let
- val (nom, den) = Rat.quotient_of_rat r
+ val (nom, den) = Rat.dest r
in
if den = 1 then string_of_int nom
else string_of_int nom ^ "/" ^ string_of_int den
@@ -103,8 +103,8 @@
val nat = number
val int = Scan.optional (str "~" >> K ~1) 1 -- nat >> op *
-val rat = int --| str "/" -- int >> Rat.rat_of_quotient
-val rat_int = rat || int >> Rat.rat_of_int
+val rat = int --| str "/" -- int >> Rat.make
+val rat_int = rat || int >> Rat.of_int
(* polynomial parsers *)
--- a/src/HOL/Library/Sum_of_Squares/sum_of_squares.ML Tue May 31 23:06:03 2016 +0200
+++ b/src/HOL/Library/Sum_of_Squares/sum_of_squares.ML Wed Jun 01 10:45:35 2016 +0200
@@ -22,18 +22,18 @@
val rat_0 = Rat.zero;
val rat_1 = Rat.one;
val rat_2 = Rat.two;
-val rat_10 = Rat.rat_of_int 10;
+val rat_10 = Rat.of_int 10;
val max = Integer.max;
-val denominator_rat = Rat.quotient_of_rat #> snd #> Rat.rat_of_int;
+val denominator_rat = Rat.dest #> snd #> Rat.of_int;
fun int_of_rat a =
- (case Rat.quotient_of_rat a of
+ (case Rat.dest a of
(i, 1) => i
| _ => error "int_of_rat: not an int");
fun lcm_rat x y =
- Rat.rat_of_int (Integer.lcm (int_of_rat x) (int_of_rat y));
+ Rat.of_int (Integer.lcm (int_of_rat x) (int_of_rat y));
fun rat_pow r i =
let fun pow r i =
@@ -45,9 +45,9 @@
fun round_rat r =
let
- val (a,b) = Rat.quotient_of_rat (Rat.abs r)
+ val (a,b) = Rat.dest (Rat.abs r)
val d = a div b
- val s = if r < rat_0 then (Rat.neg o Rat.rat_of_int) else Rat.rat_of_int
+ val s = if r < rat_0 then (Rat.neg o Rat.of_int) else Rat.of_int
val x2 = 2 * (a - (b * d))
in s (if x2 >= b then d + 1 else d) end
@@ -302,11 +302,11 @@
else index_char str chr (pos + 1);
fun rat_of_quotient (a,b) =
- if b = 0 then rat_0 else Rat.rat_of_quotient (a, b);
+ if b = 0 then rat_0 else Rat.make (a, b);
fun rat_of_string s =
let val n = index_char s #"/" 0 in
- if n = ~1 then s |> Int.fromString |> the |> Rat.rat_of_int
+ if n = ~1 then s |> Int.fromString |> the |> Rat.of_int
else
let
val SOME numer = Int.fromString(String.substring(s,0,n))
@@ -365,7 +365,7 @@
fun maximal_element fld amat acc =
fld (fn (_,c) => fn maxa => max_rat maxa (abs_rat c)) amat acc
fun float_of_rat x =
- let val (a,b) = Rat.quotient_of_rat x
+ let val (a,b) = Rat.dest x
in Real.fromInt a / Real.fromInt b end;
fun int_of_float x = (trunc x handle Overflow => 0 | Domain => 0)
in
@@ -438,7 +438,7 @@
val v = choose_variable eq
val a = Inttriplefunc.apply eq v
val eq' =
- tri_equation_cmul ((Rat.rat_of_int ~1) / a) (Inttriplefunc.delete_safe v eq)
+ tri_equation_cmul ((Rat.of_int ~1) / a) (Inttriplefunc.delete_safe v eq)
fun elim e =
let val b = Inttriplefunc.tryapplyd e v rat_0 in
if b = rat_0 then e
@@ -608,7 +608,7 @@
if c = rat_0 then Inttriplefunc.empty
else Inttriplefunc.map (fn _ => fn x => c * x) bm;
-val bmatrix_neg = bmatrix_cmul (Rat.rat_of_int ~1);
+val bmatrix_neg = bmatrix_cmul (Rat.of_int ~1);
(* Smash a block matrix into components. *)
@@ -729,10 +729,10 @@
in (vec, map diag allmats) end
val (vec, ratdias) =
if null pvs then find_rounding rat_1
- else tryfind find_rounding (map Rat.rat_of_int (1 upto 31) @ map pow2 (5 upto 66))
+ else tryfind find_rounding (map Rat.of_int (1 upto 31) @ map pow2 (5 upto 66))
val newassigs =
fold_rev (fn k => Inttriplefunc.update (nth pvs (k - 1), int_element vec k))
- (1 upto dim vec) (Inttriplefunc.onefunc ((0, 0, 0), Rat.rat_of_int ~1))
+ (1 upto dim vec) (Inttriplefunc.onefunc ((0, 0, 0), Rat.of_int ~1))
val finalassigs =
Inttriplefunc.fold (fn (v, e) => fn a =>
Inttriplefunc.update (v, tri_equation_eval newassigs e) a) allassig newassigs
--- a/src/HOL/Library/positivstellensatz.ML Tue May 31 23:06:03 2016 +0200
+++ b/src/HOL/Library/positivstellensatz.ML Wed Jun 01 10:45:35 2016 +0200
@@ -287,7 +287,7 @@
fun cterm_of_rat x =
let
- val (a, b) = Rat.quotient_of_rat x
+ val (a, b) = Rat.dest x
in
if b = 1 then Numeral.mk_cnumber @{ctyp "real"} a
else Thm.apply (Thm.apply @{cterm "op / :: real => _"}
@@ -297,8 +297,8 @@
fun dest_ratconst t =
case Thm.term_of t of
- Const(@{const_name divide}, _)$a$b => Rat.rat_of_quotient(HOLogic.dest_number a |> snd, HOLogic.dest_number b |> snd)
- | _ => Rat.rat_of_int (HOLogic.dest_number (Thm.term_of t) |> snd)
+ Const(@{const_name divide}, _)$a$b => Rat.make(HOLogic.dest_number a |> snd, HOLogic.dest_number b |> snd)
+ | _ => Rat.of_int (HOLogic.dest_number (Thm.term_of t) |> snd)
fun is_ratconst t = can dest_ratconst t
(*
--- a/src/HOL/Multivariate_Analysis/normarith.ML Tue May 31 23:06:03 2016 +0200
+++ b/src/HOL/Multivariate_Analysis/normarith.ML Wed Jun 01 10:45:35 2016 +0200
@@ -16,9 +16,9 @@
open Conv;
val bool_eq = op = : bool *bool -> bool
fun dest_ratconst t = case Thm.term_of t of
- Const(@{const_name divide}, _)$a$b => Rat.rat_of_quotient(HOLogic.dest_number a |> snd, HOLogic.dest_number b |> snd)
- | Const(@{const_name inverse}, _)$a => Rat.rat_of_quotient(1, HOLogic.dest_number a |> snd)
- | _ => Rat.rat_of_int (HOLogic.dest_number (Thm.term_of t) |> snd)
+ Const(@{const_name divide}, _)$a$b => Rat.make(HOLogic.dest_number a |> snd, HOLogic.dest_number b |> snd)
+ | Const(@{const_name inverse}, _)$a => Rat.make(1, HOLogic.dest_number a |> snd)
+ | _ => Rat.of_int (HOLogic.dest_number (Thm.term_of t) |> snd)
fun is_ratconst t = can dest_ratconst t
fun augment_norm b t acc = case Thm.term_of t of
Const(@{const_name norm}, _) $ _ => insert (eq_pair bool_eq (op aconvc)) (b,Thm.dest_arg t) acc
@@ -146,7 +146,7 @@
fun match_mp PQ P = P RS PQ;
fun cterm_of_rat x =
-let val (a, b) = Rat.quotient_of_rat x
+let val (a, b) = Rat.dest x
in
if b = 1 then Numeral.mk_cnumber @{ctyp "real"} a
else Thm.apply (Thm.apply @{cterm "op / :: real => _"}
@@ -301,7 +301,7 @@
end
val goodverts = filter check_solution rawverts
val signfixups = map (fn n => if member (op =) f n then ~1 else 1) nvs
- in map (map2 (fn s => fn c => Rat.rat_of_int s * c) signfixups) goodverts
+ in map (map2 (fn s => fn c => Rat.of_int s * c) signfixups) goodverts
end
val allverts = fold_rev append (map plausiblevertices (allsubsets nvs)) []
in subsume allverts []
--- a/src/HOL/Tools/groebner.ML Tue May 31 23:06:03 2016 +0200
+++ b/src/HOL/Tools/groebner.ML Wed Jun 01 10:45:35 2016 +0200
@@ -35,10 +35,10 @@
val rat_0 = Rat.zero;
val rat_1 = Rat.one;
val minus_rat = Rat.neg;
-val denominator_rat = Rat.quotient_of_rat #> snd #> Rat.rat_of_int;
+val denominator_rat = Rat.dest #> snd #> Rat.of_int;
fun int_of_rat a =
- case Rat.quotient_of_rat a of (i,1) => i | _ => error "int_of_rat: not an int";
-val lcm_rat = fn x => fn y => Rat.rat_of_int (Integer.lcm (int_of_rat x) (int_of_rat y));
+ case Rat.dest a of (i,1) => i | _ => error "int_of_rat: not an int";
+val lcm_rat = fn x => fn y => Rat.of_int (Integer.lcm (int_of_rat x) (int_of_rat y));
val (eqF_intr, eqF_elim) =
let val [th1,th2] = @{thms PFalse}
--- a/src/HOL/Tools/lin_arith.ML Tue May 31 23:06:03 2016 +0200
+++ b/src/HOL/Tools/lin_arith.ML Wed Jun 01 10:45:35 2016 +0200
@@ -179,10 +179,10 @@
Same for Suc-terms that turn out not to be numerals -
although the simplifier should eliminate those anyway ...*)
| demult (t as Const ("Num.numeral_class.numeral", _) $ n, m) =
- ((NONE, Rat.mult m (Rat.rat_of_int (HOLogic.dest_numeral n)))
+ ((NONE, Rat.mult m (Rat.of_int (HOLogic.dest_numeral n)))
handle TERM _ => (SOME t, m))
| demult (t as Const (@{const_name Suc}, _) $ _, m) =
- ((NONE, Rat.mult m (Rat.rat_of_int (HOLogic.dest_nat t)))
+ ((NONE, Rat.mult m (Rat.of_int (HOLogic.dest_nat t)))
handle TERM _ => (SOME t, m))
(* injection constants are ignored *)
| demult (t as Const f $ x, m) =
@@ -209,7 +209,7 @@
(p, Rat.add i m)
| poly (all as Const ("Num.numeral_class.numeral", Type(_,[_,_])) $ t, m, pi as (p, i)) =
(let val k = HOLogic.dest_numeral t
- in (p, Rat.add i (Rat.mult m (Rat.rat_of_int k))) end
+ in (p, Rat.add i (Rat.mult m (Rat.of_int k))) end
handle TERM _ => add_atom all m pi)
| poly (Const (@{const_name Suc}, _) $ t, m, (p, i)) =
poly (t, m, (p, Rat.add i m))
--- a/src/HOL/Tools/semiring_normalizer.ML Tue May 31 23:06:03 2016 +0200
+++ b/src/HOL/Tools/semiring_normalizer.ML Wed Jun 01 10:45:35 2016 +0200
@@ -115,11 +115,11 @@
val semiring_funs =
{is_const = can HOLogic.dest_number o Thm.term_of,
dest_const = (fn ct =>
- Rat.rat_of_int (snd
+ Rat.of_int (snd
(HOLogic.dest_number (Thm.term_of ct)
handle TERM _ => error "ring_dest_const"))),
mk_const = (fn cT => fn x => Numeral.mk_cnumber cT
- (case Rat.quotient_of_rat x of (i, 1) => i | _ => error "int_of_rat: bad int")),
+ (case Rat.dest x of (i, 1) => i | _ => error "int_of_rat: bad int")),
conv = (fn ctxt =>
Simplifier.rewrite (put_simpset semiring_norm_ss ctxt)
then_conv Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps @{thms numeral_One}))};
@@ -137,13 +137,13 @@
| t => can HOLogic.dest_number t
fun dest_const ct = ((case Thm.term_of ct of
Const (@{const_name Rings.divide},_) $ a $ b=>
- Rat.rat_of_quotient (snd (HOLogic.dest_number a), snd (HOLogic.dest_number b))
+ Rat.make (snd (HOLogic.dest_number a), snd (HOLogic.dest_number b))
| Const (@{const_name Fields.inverse},_)$t =>
- Rat.inv (Rat.rat_of_int (snd (HOLogic.dest_number t)))
- | t => Rat.rat_of_int (snd (HOLogic.dest_number t)))
+ Rat.inv (Rat.of_int (snd (HOLogic.dest_number t)))
+ | t => Rat.of_int (snd (HOLogic.dest_number t)))
handle TERM _ => error "ring_dest_const")
fun mk_const cT x =
- let val (a, b) = Rat.quotient_of_rat x
+ let val (a, b) = Rat.dest x
in if b = 1 then Numeral.mk_cnumber cT a
else Thm.apply
(Thm.apply (Thm.instantiate_cterm ([(divide_tvar, cT)], []) divide_const)
--- a/src/Provers/Arith/fast_lin_arith.ML Tue May 31 23:06:03 2016 +0200
+++ b/src/Provers/Arith/fast_lin_arith.ML Wed Jun 01 10:45:35 2016 +0200
@@ -482,10 +482,10 @@
AList.lookup Envir.aeconv poly atom |> the_default 0;
fun integ(rlhs,r,rel,rrhs,s,d) =
-let val (rn,rd) = Rat.quotient_of_rat r and (sn,sd) = Rat.quotient_of_rat s
- val m = Integer.lcms(map (abs o snd o Rat.quotient_of_rat) (r :: s :: map snd rlhs @ map snd rrhs))
+let val (rn,rd) = Rat.dest r and (sn,sd) = Rat.dest s
+ val m = Integer.lcms(map (abs o snd o Rat.dest) (r :: s :: map snd rlhs @ map snd rrhs))
fun mult(t,r) =
- let val (i,j) = Rat.quotient_of_rat r
+ let val (i,j) = Rat.dest r
in (t,i * (m div j)) end
in (m,(map mult rlhs, rn*(m div rd), rel, map mult rrhs, sn*(m div sd), d)) end
--- a/src/Pure/General/rat.ML Tue May 31 23:06:03 2016 +0200
+++ b/src/Pure/General/rat.ML Wed Jun 01 10:45:35 2016 +0200
@@ -11,9 +11,9 @@
val zero: rat
val one: rat
val two: rat
- val rat_of_int: int -> rat
- val rat_of_quotient: int * int -> rat
- val quotient_of_rat: rat -> int * int
+ val of_int: int -> rat
+ val make: int * int -> rat
+ val dest: rat -> int * int
val string_of_rat: rat -> string
val eq: rat * rat -> bool
val ord: rat * rat -> order
@@ -40,19 +40,19 @@
exception DIVZERO;
-fun rat_of_quotient (p, q) =
+fun make (p, q) =
let
val m = PolyML.IntInf.gcd (p, q);
val (p', q') = (p div m, q div m) handle Div => raise DIVZERO;
in Rat (if q' < 0 then (~ p', ~ q') else (p', q')) end
-fun quotient_of_rat (Rat r) = r;
+fun dest (Rat r) = r;
-fun rat_of_int i = Rat (i, 1);
+fun of_int i = Rat (i, 1);
-val zero = rat_of_int 0;
-val one = rat_of_int 1;
-val two = rat_of_int 2;
+val zero = of_int 0;
+val one = of_int 1;
+val two = of_int 2;
fun string_of_rat (Rat (p, q)) =
string_of_int p ^ "/" ^ string_of_int q;
@@ -80,10 +80,10 @@
fun add (Rat (p1, q1)) (Rat (p2, q2)) =
let
val ((m1, m2), n) = common (p1, q1) (p2, q2);
- in rat_of_quotient (m1 + m2, n) end;
+ in make (m1 + m2, n) end;
fun mult (Rat (p1, q1)) (Rat (p2, q2)) =
- rat_of_quotient (p1 * p2, q1 * q2);
+ make (p1 * p2, q1 * q2);
fun neg (Rat (p, q)) = Rat (~ p, q); | __label__pos | 0.969527 |
设计模式---访问者模式(C++实现)
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/alpha_love/article/details/61916609
/*************************************************************************************************************
适用于:
把数据结构 和 作用于数据结构上的操作 进行解耦合;
适用于数据结构比较稳定的场合
访问者模式总结:
访问者模式优点是增加新的操作很容易,因为增加新的操作就意味着增加一个新的访问者。
访问者模式将有关的行为集中到一个访问者对象中。那访问者模式的缺点是是增加新的数据结构变得困难了
实现数据结构 和操作数据结构的动作 进行有效的分离
实现方法:
分别定义访问者接口(数据结构的基类指针) 公园部分访问接口(访问者的指针接口)+ 接受访问的内部实现了访问函数的调用
如果要管理访问者增加超级访问者,使用集合将其封装,然后遍历集合
**************************************************************************************************************/
/* 案例需求:
比如有一个公园,有一到多个不同的组成部分;该公园存在多个访问者:清洁工A负责打扫公园的A部分,清洁工B负责打扫公园的B部分,
公园的管理者负责检点各项事务是否完成,上级领导可以视察公园等等。也就是说,对于同一个公园,不同的访问者有不同的行为操作,
而且访问者的种类也可能需要根据时间的推移而变化(行为的扩展性)*/
#include <iostream>
#include <list>
#include <string>
using namespace std;
class ParkElement;
class Visitor//不同的访问者 访问公园完成不同的动作
{
public:
virtual void visit(ParkElement *park) = 0;
};
class ParkElement//公园不同的部分接受不同的访问者
{
public:
virtual void accept(Visitor *v) = 0;
};
class ParkA : public ParkElement //公园A部分接受访问者
{
public:
virtual void accept(Visitor *v){
v->visit(this);}//传来的谁,去回调它是访问函数
};
class ParkB : public ParkElement//公园B部分接受访问者
{
public:
virtual void accept(Visitor *v) {
v->visit(this);}
};
class Park : public ParkElement
{ //公园的部分可以进行集中管理
public:
Park(){
m_list.clear(); }
void setPart(ParkElement *e){
m_list.push_back(e);}
public:
void accept(Visitor *v)
{
for (list<ParkElement *>::iterator it = m_list.begin(); it != m_list.end(); it++)
{ (*it)->accept(v);}
}
private:
list<ParkElement *> m_list;
};
class VisitorA : public Visitor//访问者A
{
public:
virtual void visit(ParkElement *park){
cout << "清洁工A 访问 公园A 部分,打扫卫生完毕" << endl;}
};
class VisitorB : public Visitor//访问者B
{
public:
virtual void visit(ParkElement *park){
cout << "清洁工B 访问 公园B 部分,打扫卫生完毕" << endl;}
};
class VisitorManager : public Visitor//访问者管理员
{
public:
virtual void visit(ParkElement *park)
{ cout << "管理员 检查 此部分卫生情况" << endl;}
};
void main()
{
VisitorA *visitorA = new VisitorA;//创建访问者A
VisitorB *visitorB = new VisitorB;//创建访问者B
ParkA *partA = new ParkA;//创建数据结构 A
ParkB *partB = new ParkB;//创建数据结构 B
partA->accept(visitorA); //公园接受访问者A访问 + 在这个函数中封装了visitorA去访问公园A部分
partB->accept(visitorB); //公园接受访问者B访问 + 在这个函数中封装了visitorA去访问公园B部分
VisitorManager *visitorManager = new VisitorManager;
Park * park = new Park;
park->setPart(partA); //将A部分加入容器
park->setPart(partB); //将B部分加入容器
park->accept(visitorManager); //管理员去检查A部分 + 管理员去检查B部分
//遍历容器,接受visitorManager访问,去调用visitorManager的访问函数
system("pause");
}
参考:传智播客--王保明
阅读更多
没有更多推荐了,返回首页 | __label__pos | 0.997143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.