Cross Column

Showing posts with label FireFox. Show all posts
Showing posts with label FireFox. Show all posts

Friday, August 11, 2017

JMeter: How to Turn Off Captive Portal from the Recording Using Firefox

Apache JMeter is an Apache project that can be used as a load testing tool for analyzing and measuring the performance of a variety of services, with a focus on web applications.

Assume you have installed JMeter and are familiar with it; otherwise, you can watch a good series of videos here to get started.  In this article, we will discuss how to remove the extra HTTP request (1 /success.txt ) in the recording (click below diagram to enlarge).


HTTP(S) Test Script Recorder


You can follow the instructions here to record your web test with "HTTP(S) Test Script Recorder".  In this article, we have chosen Firefox as the browser for JMeter's proxy recorder.

When we recorded a test plan, some repetitive HTTP requests related to Captive Portal feature in Firefox
GET http://detectportal.firefox.com/success.txt
have been captured.  These HTTP traffics are not related to the tested web application and should be excluded from the test plan.  So, how can we achieve that?


How to Turn Off "Captive Portal"


Captive Portal feature in Firefox covers the detection and implementation of handles for captive portals inside Firefox browser. Firefox is expected to handle the handling of a captive portal page upon detection of such.

There is no UI checkbox for disabling Captive Portal.  But, you can turn off Captive Portal using the Configuration Editor of Firefox:[3]
  1. In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button promising to be careful.
  2. In the search box above the list, type or paste captiv and pause while the list is filtered
  3. Double-click the network.captive-portal-service.enabled preference to switch the value from true to false
If you are in a managed environment using an autoconfig file, for example, you could use this to switch the default:
user_pref("network.captive-portal-service.enabled", false)


References

  1. Apache JMeter
  2. JMeter Beginner Tutorial 21 - How to use Test Script Recorder
  3. HTTP(S) Test Script Recorder 
  4. Proxy Step by Step (Apache JMeter)
  5. Book: Apache JMeter (Publisher: Packt Publishing) 
  6. Turn off captive portal (Mozilla Support)
  7. JMeter—Use Extractors (Post-Processor Elements) for Correlation (Xml and More)

Sunday, April 12, 2009

Ubiquity vs. Smart Keyword--Two Firefox Addons

What's Smart Keyword

A smart keyword (also known as bookmark keyword, or keymark for short) is a special kind of bookmark that replaces a special sequence, %s, in the bookmark location field (URL) with the text entered after the keyword in the address bar. For example, if you define "g" for Google Search as shown below:



Pressing Ctrl+L sets the input focus to the address bar and selects the entire content. Then, you enter "g Oracle" in the location bar. After pressing Enter, "g Oracle" will be expanded into:
  http://www.google.com/search?hl=en&q=Oracle&aq=f&oq
In summary, the following keystroke sequence let you Google Search "Oracle":

  Ctrl+L > "g Oracle" > Enter


The Similarity

Similarly, Ubiquity command "google" allows you to Google Search "Oracle" in the following keystroke sequence:

  Ctrl+Space > "g Oracle" > Enter

assuming command "google" is the top one on the suggestion list. You can read another post for how Ubiquity works here. Both Ubiquity and Smart Keyword allow users to save mouse clicking and word typing to achieve everyday's browser tasks easier and quicker. Then, what's the difference between Ubiquity and Smart Keyword?


The Difference

In a nutshell, Ubiquity can do what Smart Keyword can do and more. For example, if you select "Oracle" in the browser window, selected word(s) can become the input of Ubiquity command. In this case, you can achieve the same task by:

  Selecting "Oracle" > Ctrl+Space > "g " > Enter


Both Ubiquity commands and Smart Keywords function like command templates. Firefox selects one of the commands to execute with command variable replaced with user's input. In Smart Keyword, there is one variable one command. However, you can have more than one variable in a single Ubiquity command.

The centerpiece of Ubiquity architecture is a natural language parser which can provide user a list of candidate commands based on partially matched results. For the top candidate command on the suggestion list, it immediately generates a preview of the top command results in the preview panel. If the top command on the suggestion list is what user wants, user can hit TAB to automatically complete the command name. As user types more characters or uses arrow key to select commands on the suggestion list, Ubiquity dynamically changes the content of suggestion list and command preview.

Besides good for search, Ubiquity commands can be designed to do almost anything. For example, you can translate selected paragraph from one language to another language, insert selected image from search results to the current cursor position, italicize or underline text, etc.

Based on the group activity on ubiquity-firefox@googlegroups.com, you can tell that Ubiquity has active community supports and it evolves fast. This Firefox addon is still in experimental phase (the latest beta is 0.2pre29). There are a lot of design details to be ironed out. But, I think it has potential to become a big hit. At least, I have found it handy and used it on a daily basis.

Friday, April 3, 2009

What's Ubiquity--User's Perspective

Ubiquity is a Firefox extension and it provides you with a different way to navigate and interact with your computer through the use of keyboard shortcuts and typed commands. Ubiquity let you apply textual commands (called "verbs") to whatever you're looking at on your screen. See here for its formal introduction. You can also view the video below:

Ubiquity for FireFox (YouTube link)

Platforms Supported

Ubiquity is cross-platform. Here are a list of platforms it supports with descriptions:

Mac OS XNeed to have Growl installed
  • This is a Mac OS X system extension that applications can use to display unobtrusive transparent messages
WindowsOn Windows (XP and later), you don't need to install anything special.

LinuxOn Linux, you shouldn't have to do anything special: just make sure you're updated to the latest version of Firefox.



Where to find Ubiquity?


Ubiquity is still in flux. The latest release is 0.1.7. If you're viewing this post from Firefox, you can get the latest version here. If you're a brave soul, you can get the latest beta vesion here. The installation is a simple Firefox add-on installation. After installation of Ubuiquity, you can start playing with its commands from standard feeds. To see a list of commands available to you, paste the following URL to your Firefox address field:

chrome://ubiquity/content/cmdlist.html



How to launch Ubiquity?

  1. Open up Ubiquity (CTRL+SPACE on Windows and ALT+SPACE on other platforms), and type any command name.

  2. You should see command options on suggestion list or preview pane, complete the command and hit Enter.

Where to get more commands?

There are two sources that you can get more Ubiquity commands from:

After you get started, you'll have a need to manage all your Ubiquity commands. To do that, go to the command management page by pasting the following URL into your Firefox address field:

about:ubiquity


How to subscribe new commands?

After navigating to the command source page in Firefox, you should see a bar at the top of the page asking you to subscribe to the Ubiquity command. If not, then you either do not have Ubiquity installed or you are already subscribed to the command.

What happens when you click on subscribe button?

Ubiquity commands are implemented in Javascript. All Javascripts are deemed potentially dangerous. So, what happens if you click on the subscribe button? At ease. It will bring you to a subscription page like this:



It will show you the content of Javascript source. At the bottom of the page, it shows two buttons for you to either accept or reject the subscription. In Ubiquity 0.2, it redesigns the security model of Ubiquity with command feed plugins. So, you can identify and/or trust your command feeds more easily.

To learn more, check out other blog posts here.

Thursday, April 2, 2009

Understanding URL Syntax of Oracle Application Express

Oracle Aria (i.e., Oracle people search site; this is located in the intranet of Oracle) is built using Oracle Application Express. Oracle Application Express (Oracle APEX) is a rapid web application development tool for the Oracle database.

To build a Ubiquity command for Oracle Aria, you need to understand its URL syntax. Web application built using Oracle APEX is composed of multiple pages. Each application is identified by a unique number (i.e., application ID). Similarly, each page is uniquely identified by its page number.
Applications and pages may also have alphanumeric aliases. Application aliases are unique within a workspace and page aliases are unique within each application.

Understanding URL Syntax

The URL that displays for each page identifies the address of Oracle Application Express, the application ID, page number, and session ID. For example:

http://xxx.us.oracle.com/pls/oracle/f?p=8000:1:7528859885365

This example indicates:
  • xxx.us.oracle.com is the URL of the server
  • pls is the indicator to use the mod_plsql cartridge
  • oracle is the database access descriptor (DAD) name. The DAD describes how HTTP Server connects to the database server so that it can fulfill an HTTP request.
  • f?p= is a prefix used by Oracle APEX
  • 8000 is the application being called
  • 1 is the page within the application to be displayed
  • 7528859885365 is the session ID

You can create URLs to access pages in your application using the following syntax:
  f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly

Table 1 describes the arguments you can pass when using f?p syntax.

Syntax Description
App Indicates an application ID or alphanumeric alias.
Page Indicates a page number or alphanumeric alias.
Session Identifies a session ID. You can reference a session ID to create hypertext links to other pages that maintain the same session state by passing the session number.
Request Sets the value of REQUEST. Each application button sets the value of REQUEST to the name of the button. This enables accept processing to reference the name of the button when a user clicks it.
Debug Displays application processing details. Valid values for the DEBUG flag are YES or NO. Setting this flag to YES displays details about application processing.
See Also: "Debugging an Application"
ClearCache Clears the cache. This sets the value of items to null. To clear cached items on a single page, specify the numeric page number. To clear cached items on multiple pages, use a comma-separated list of page numbers. Clearing a page's cache also resets any stateful processes on the page. Individual or comma-separated values can also include collection names to be reset or the keyword RP, which resets region pagination on the requested page. The keyword APP clears cache for all pages and all application-level items in the current application and removes sort preferences for the current user. The keyword SESSION achieves the same result as the APP keyword, but clears items associated with all applications that have been used in the current session. See Also: "Clearing Session State"
itemNames Comma-delimited list of item names used to set session state with a URL.
itemValues List of item values used to set session state within a URL. Item values cannot include colons, but can contain commas if enclosed with backslashes. To pass a comma in an item value, enclose the characters with backslashes. For example:
\123,45\
PrinterFriendly Determines if the page is being rendered in printer friendly mode. If PrinterFriendly is set to Yes, then the page is rendered in printer friendly mode. The value of PrinterFriendly can be used in rendering conditions to remove elements such as regions from the page to optimize printed output. When the value is Yes, the Application Express engine will not display tabs or navigation bars, and all items will be displayed as text and not as form elements.



What Is a Session?

HTTP is a stateless protocol. In web browser, each page request is treated by the server as an independent event, unrelated to any page requests that happened previously or may occur in the future. Typically, when a user enters values into a form on one page, those values are not accessible on later pages.

A session is a logical construct that establishes persistence (or stateful behavior) across page views. Each session is assigned a unique identifier. The Application Express engine uses this identifier (or session ID) to store and retrieve an application's working set of data (or session state) before and after each page view. It transparently maintains session state and provides developers with the ability to get and set session state values from any page in the application.

Using Zero as Session ID

Application pages that do not require authentication can be accessed with "f?p" URLs where the session ID is zero (that is, the single digit 0). When you request a page by either entering the URL in the browser or by clicking on a link having 0 for the session ID, the Application Express engine assigns a new session ID and sends a session cookie containing this new session ID to your browser. As you navigate through the application's public pages, you will see that all generated links to public pages will contain 0 for the session ID and all branches to public pages will have new URLs that use 0 as the visible session ID. Behind the scenes, however, the Application Express engine uses the session ID in the cookie as the actual session ID to locate session state.

This feature is useful when you want to hide the actual session ID. By hiding the session ID, you enable users to bookmark pages without needing to include the session ID in the bookmark link. As an added benefit, using zero as the session ID also keeps the actual session ID hidden from search engines.

Sunday, March 29, 2009

Ubiquity Command - Dissected

It's easy to create a Ubiquity command by yourself if you know JavaScript. Using Ubiquity command editor, you can start creating new commands such as this:

CmdUtils.CreateCommand({
name: "ses-login-search",
takes: {"adc60019fems or adc60037fems": noun_type_ses_url },
modifiers: {"for": noun_arb_text, "with": noun_arb_text},
homepage: "http://xteam.us.oracle.com/blogs/index.php?blog=10",
author: { name: "Stanley Guan", email: "xmlandmore@gmail.com"},
description: "Search adc60019fems or adc60037fems for keywords" +
" with given userName/password",
help: "Search server for keywords with given credentials." +
" If server name is not specified, default server will be used." +
" Specify credentials with usename and password (in that order) " +
" and separate them by space.",
license: "GPL",
preview: function(pblock, directObj, mods) {
var server = directObj.text createList(sesNicknames);
var keywords = mods["for"].text "keywords";
var creds = mods["with"].text "userName/password";
pblock.innerHTML = "search " + server + " for " + keywords +
" with " + creds;
},
execute: function(directObj, mods) {
// This function gets executed when user hits ENTER.
// You can have different approaches:
// 1. Launch a new window to display command output.
// 2. Replace selection with command output.
}
});

In the above example, new command is named "ses-login-search" and it takes one direct object and two modifiers. This means that our command should look like this:

ses-login-search (adc60019fems or adc60037fems) for (keywords)
with (username/password)

Ubiquity command parser supports natural language processing. You can choose verbs as your command names. Now it only supports single-word command names. So, you should use "-" to connect multiple words as we've done here. Our command will allow SES users to login and search at the same time. The direct object of our command is a server name. It can be either "adc60019fems" or "adc60037fems".

To pass more arguments, you can use modifiers. Modifiers are prepositional phrases (i.e., prepositions followed by nouns in English). In our case, we use "for" to specify keywords to be searched for and "with" to provide user's credentials.

Other parts of command include the following properties:
  • homepage
  • author
  • description
  • help

These properties are used to compose detailed description of our command on Ubiquity's command list. If our command were subscribed, it could look like this:



Help text provided in "help" property is also displayed in the preview pane when user type "help ses-login-search" in the command entry field as shown below:
As described in Ubiquity's UI Design , preview function is used by command designer to provide preview content (as defined by HTML snippet) to be displayed in the preview pane. For example, if your command is a search command, you can display top-ranked search results here for the user to see. Sometimes, if users find the result they need in the preview pane, they can click on the link and jump directly to the target URL and skip the command execution phase.

If users need to see the full command output, they can execute command (defined by the "execute" property) by hitting ENTER after command is fully specified. Two arguments are passed to "execute" function:

  1. directObj (i.e., direct-object)
  2. mods (i.e., modifiers)

They contain the command options as specified by the users. To access them, you use:

  1. directObj.text for direct-object
  2. mods["with"].text or mods["for"].text for modifiers

As I say, it's easy to create a new Ubiquity command if you know JavaScript. Hopefully, this post has provided enough information for you to begin with. To view more examples, you can find them from:
  1. Commands in the wild
  2. Ubiquity Herd

Tuesday, March 24, 2009

Ubiquity's UI Design

At the root folder where Ubiquity Extension is installed, there is a chrome manifest file named chrome.manifest. The content of it looks like this:

resource ubiquity ./
content ubiquity chrome/content/
skin ubiquity skin chrome/skin/
overlay chrome://browser/content/browser.xul chrome://ubiquity/content/browser.xul

Line 4 (in red) registers an overlay for chrome://browser/content/browser.xul location, allowing you to modify Firefox's main window UI from your overlay XUL file (i.e., chrome://ubiquity/content/browser.xul).

The content of Ubiquity's overlay file looks like this:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://ubiquity/skin/browser.css" type="text/css"?>

<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:svg="http://www.w3.org/2000/svg">
<head></head>
<script type="application/javascript;version=1.7"
src="chrome://ubiquity/content/ubiquity.js"/>
<script type="application/javascript;version=1.7"
src="chrome://ubiquity/content/popupmenu.js"/>
<script type="application/javascript;version=1.7"
src="chrome://ubiquity/content/browser.js"/>
<popupset id="mainPopupSet">
<panel id="transparent-msg-panel" class="msgPanel" hidden="true">
<div id="cmd-panel" xmlns="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<div id="cmd-frame">
<div id="cmd-entry-container">
<input id="cmd-entry"/>
</div>
<iframe id="cmd-preview"
src="chrome://ubiquity/content/preview.html"></iframe>
</div>
</div>
</panel>
</popupset>
<popup id="contentAreaContextMenu">
<menuseparator id="ubiquity-separator"/>
<menu id="ubiquity-menu" label="Ubiquity">
<menupopup id="ubiquity-menupopup">
</menupopup>
</menu>
</popup>
</overlay>


It specifies two major UI's (i.e., "Context Popup Menu UI" and "Command Entry UI") managed by Ubiquity UI Manager as shown in the diagram below:

These two UI's are used to support two Ubiquity command input modes:
  1. Command entry mode
  2. Context menu mode
Command entry mode can be entered via hot keys (i.e., "CTRL + SPACE" on Windows and it's changeable from Ubiquity Command Management Page) while context menu mode can be entered via right-mouse click.

The UI of command entry mode consists of:
  • cmd-entry which is an input field
  • cmd-preview (an "iframe") which contains ubiquity-preview (a "div") which in turn is composed of
    • suggestions (a "div")
    • preview-pane (a "div")
    • help (a "div")

The layout of it is shown below:
Note that the look-and-feel of this command panel is determined by the skin you apply to. To modify its skin, you can go to "about:ubiquity" > "Your Skins" to edit or change it. However, there is a known bug on Windows (Mac OS X is o.k.) to prevent it from being changed dynamically now.

It's easy to create a Ubiquity command by yourself if you know JavaScript. Using Ubiquity command editor, you can start creating a new command using the following template:

/* This is a template command. */
CmdUtils.CreateCommand({
name: "example",
icon: "http://example.com/example.png",
homepage: "http://example.com/",
author: {name: "Your Name", email: "you@example.com"},
license: "GPL",
description: "A short description of your command",
help: "How to use your command",
takes: {"input": /.*/},
preview: function(pblock, input) {
pblock.innerHTML = "Your input is " + input.text + ".";
},
execute: function(input) {
displayMessage("You selected: " + input.text);
}
});

Notice that argument pblock passed to the preview function is the "preview-pane" as described above. You can create any HTML snippet to be placed in there. It can be an image (see figure below), detailed list, or anything you like.

Monday, March 23, 2009

Ubiquity Extension and Its Preferences

In Firefox, it provides Preferences System for extensions to store data or user preferences. To see all of the currently stored preferences in your Firefox, type 'about:config' into the location bar and press return. For example, here is a list of preferences filtered by the 'ubiquity' keyword:

When Ubiquity extension is installed, it comes with a set of default preferences which is stored in the preferences.js file under "<UB>/defaults/preferences" folder where "<UB>" is the Ubiquity installation location (for example, it's at C:\Documents and Settings\<user>\Application Data\Mozilla\Firefox\Profiles\eid50wk9.default\extensions on Window XP).

The content of preferences.js in Ubiquity 0.2pre19 looks like this :

pref("extensions.ubiquity.language", "en");
pref("extensions.ubiquity.trustedDomains",
"ubiquity.mozilla.com");
pref("extensions.ubiquity.skin", "old");
pref("extensions.ubiquity.standardFeedsUri",
"https://ubiquity.mozilla.com/standard-feeds/");
pref("extensions.ubiquity.enablePageLoadHandlers", true);
pref("extensions.ubiquity.displayAlertOnError", false);
pref("extensions.ubiquity.isResetScheduled", false);
pref("extensions.ubiquity.remoteUriTimeout", 60000);
pref("extensions.ubiquity.bugReportUri",
"https://ubiquity.mozilla.com/report-bug/new/");

Referencing from JavaScript

To reference the Preferences System from within the JavaScript code, first, you need to have a reference to XPCOM service given the ClassID of the Preference Manager service. To do that, you must add the following line of code to your file:
       var prefManager = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);

Now that you have access to the preference manager you can get and set preferences using getIntPref()/getBoolPref()/getCharPref() and setIntPref()/setBoolPref()/setCharPref(). For example, to retrieve the default setting of "extensions.ubiquity.language", you use

var lang = prefs.getCharPref("extensions.ubiquity.language");

Sunday, March 22, 2009

Ubiquity and Its Configuration Files

Ubiquity is a Firefox extension. To learn more, click here. You can download the latest beta version from here. By clicking on the link, you'll download an .xpi file to your Firefox. The .xpi file (pronounced zippy) is nothing more than a .zip file that has been renamed.

After installtion, a new folder with the following directories:

ubiquity@labs.mozilla.com/
chrome/
chrome/content/
chrome/skin/
defaults/
defaults/preferences/

will be created in C:\Documents and Settings\<user>\Application Data\Mozilla\Firefox\Profiles\eid50wk9.default\extensions folder on Window XP.

Intall Manifest
In the root folder (i.e., ubiquity@labs.mozilla.com/; hereafter will be referred to as "<UB>"), there is an install manifest file named intall.rdf (a plain text file). install.rdf file is used by the Extension Manager when installing an XPI file and when registering an extension at specified location. From it, you can find the following information:

  • version of the extension being installed (i.e., 0.2pre19)
  • versions of Firefox the extension is designed for (i.e., minVersion: 3.0 and maxVersion: 3.2.*)


Chrome Manifest

At the root folder, there is also a chrome manifest file named chrome.manifest. Chrome is the term used to refer to Interface Packages created for Firefox. The Firefox browser contains a component, the Chrome Manager, that handles the installation and loading of the various parts of Firefox. Everything from the guts (global, browser, etc.) to extensions (such as Ubiquity)register themselves with this manager. Chrome manifest file tells Firefox where your chrome files are and what to do with them. The content of chrome.manifest for Ubiquity looks like this:

resource ubiquity ./
content ubiquity chrome/content/
skin ubiquity skin chrome/skin/
overlay chrome://browser/content/browser.xul chrome://ubiquity/content/browser.xul


content

A content package is registered with the line

content packagename uri/to/files/ [flags]

This will register a location to use when resolving the URI chrome://packagename/content/... . The URI may be absolute or relative to the location of the manifest file. Note, that it must end with an '/'. For instance, "chrome://ubiquity/content/editor.html" is mapped to "<UB>/chrome/content/editor.html."

skin
A skin package is registered with the line

skin packagename skinname uri/to/files/ [flags]

This will register a skin package when resolving the URI chrome://packagename/skin/... . The skinname is an opaque string identifying an installed skin. If more than one skin is registered for a package, the chrome registry will select the best-fit skin using the user's preferences. For instance, "chrome://ubiquity/skin/buttons/grad.png" is mapped to "<UB>/chrome/skin/buttons/grad.png."

resource

When using JavaScript code modules it may be necessary to create resource protocol aliases so extensions and applications can load modules using Components.utils.import. Aliases can be created using the resource instruction:

resource aliasname uri/to/files/ [flags]

This will create a mapping for resource://<aliasname>/ URIs to the path given. For instance, "resource://ubiquity/scripts/jquery.js" is mapped to "<UB>/scripts/jquery.js."

overlay

XUL overlays are registered with the following syntax:

overlay chrome://URI-to-be-overlaid chrome://overlay-URI [flags]

Extensions usually modify an application's UI ("chrome") and behavior by providing overlays to already existent windows/documents. Those overlays are a part of the extension's content package (content provider).

References

  1. Chrome Registration
  2. Firefox Extension Development Tutorial :: Configuration Files
  3. Getting started with extension development

© Travel for Life Guide. All Rights Reserved.

Analytical Insights on Health, Culture, and Security.