Skip to content

Discount Office Supplies and More

www.OasisSupplies.com

Archive

Category: Filing

Vaultz Locking File Security Box, Letter Size, 13.5 x 10.5 Inches, Black (VZ01165)

  • Protects letter hanging files
  • Combination locks for key-less convenience
  • HIPAA compliant to comply with legal privacy protection
  • Chromed steel corners, handle and aluminum trim
  • Organizer compartment inside lid with compartments for pens, calculators, business cards and other supplies

An excellent way to transport and store important items and files. Metal rails accommodate letter size hanging files; organizer compartment inside lid with compartments for pens, calculators, business cards and other supplies. Comfortable chrome carrying handle on lid. Black. Dimensions 13.25 x 10.5 x 13.5 Inches

List Price: $ 39.99

Price: $ 33.68

1878-02-09 MANUFACTURE OF CALLIPERS- , FILE
US $2.95
End Date: Monday Feb-06-2012 15:10:41 PST
Buy It Now for only: US $2.95
Buy it now | Add to watch list

Smead Hanging Steel Letter Size File Folder Drawer Frames 2 Count (64870)

  • Heavy-gauge steel construction
  • Rails are finished with smooth edges
  • Rails scored to adjust from 23″ to 27″ length
  • Smead 100 Years of Excellence

Heavy-gauge steel construction. Rails are finished with smooth edges. Rails scored to adjust from 23″ to 27″ length.

List Price: $ 15.99

Price: $ 4.99

20 Pcs Finger Nail Clippers Folding File Key Chain NEW
US $9.00
End Date: Monday Feb-06-2012 15:09:44 PST
Buy It Now for only: US $9.00
Buy it now | Add to watch list

Smead Hanging File Folders, Letter Size, 1/5 Cut Tab, Assorted Colors, 25 Per Box (64059)

  • Use color coding to categorize file type
  • Includes color-coordinated plastic tabs and replaceable white inserts
  • Coated rod tips allow smooth gliding
  • Keep papers neatly vertical
  • Assortment contains blue, green, orange, red and yellow

Hanging folders keep papers neatly vertical in the file. No more slumping folders or folders that slip under one another. Vivid colors help you code files for quick, easy identification. Color-coordinated tabs and inserts included. Contains 10% post-consumer materials. SFI Fiber-Sourcing Certified.

List Price: $ 28.99

Price: $ 5.20

Norton 86165 Square File Sharpening Stone (P531-1)
US $17.00
End Date: Monday Feb-06-2012 15:08:52 PST
Buy It Now for only: US $17.00
Buy it now | Add to watch list

Rubbermaid Regeneration Plastic Letter Tray 6 Pack (86028)

  • The newest wave in plastic! Made with 25% post-consumer recycled plastic
  • Holds A4 size documents and folders
  • Self-stacking. 6 Trays
  • Self-stacking
  • 6 Trays

Add productivity to your workspace and make an impact on the environment at the same time. Made with 25% post-consumer recycled plastic.

List Price: $ 15.99

Price: $ 14.28

Smead 73681 ExtraWide EndTab Expanding File Pockets 39c
US $101.99
End Date: Monday Feb-06-2012 15:08:42 PST
Buy It Now for only: US $101.99
Buy it now | Add to watch list

Oxford Decoflex Black 12 1/4 x 6 x 9 1/2 Inch Desktop File (23013)

  • Complete portable hanging file system
  • Perfect for desk, shelf, or in a file drawer
  • Color: Black
  • Holds letter size hanging file folders
  • Built in handles
  • Black

Desktop file is perfect on your desk, on a shelf or in a file drawer. made of durable high-impact plastic. Holds letter size hanging folders.

List Price: $ 21.99

Price: $ 12.99

VuPoint PS-C500-VP Scanner Digital Photo Converter Picture to File Organization
US $9.95 (0 Bid)
End Date: Monday Feb-06-2012 15:08:31 PST
Buy It Now for only: US $12.95
Bid now | Buy it now | Add to watch list

Home Paperwork Filing System – Over 80 Files To Keep You Organized (various) (9″H x 12″W (each folder))

  • Color: various
  • Size: 9″H x 12″W (each folder)
  • These folders are ready to use!
  • Labeling makes filing easy!
  • Fun, bright colors!

Does it seem like you are deluged under a storm of documents? Do you try to keep important papers organized, but just end up with an overstuffed accordion file? Get your life in order with this ingenious Home Filing Solution. This ready-to-go paperwork filing system streamlines and demystifies the process of filing. Colorful file folders are pre-labeled, color coded, and can be alphabetically collated within categories. With this home filing system, the hard work of preparing and labeling folder

Price: $ 78.00

Electric Nail Art File Drill 6 Bits Acrylic Tool 110V Manicure File Band Salon
US $49.95 (0 Bid)
End Date: Monday Feb-06-2012 15:06:35 PST
Buy It Now for only: US $54.95
Bid now | Buy it now | Add to watch list

Danger! Danger! That File Extension May Be Your First Clue

Files arrive on computers several different ways. Some are loaded as part of a software installation; others are transferred onto the computer over a network or from a removable storage device; other files are downloaded from the Internet (with or without the user’s knowledge); and other files arrive as email attachments. When a file arrives on your computer, how it arrived provides you with a clue as to its safety.

 

For example, if you transferred some work documents from your desktop to your laptop via a USB stick, you can be reasonably assured that the files are not dangerous. Likewise, if you transfer photo files from your digital camera to your hard drive, those files are most likely safe. On the other hand, if an email with an attachment arrives from a stranger, the file’s safety should be immediately questioned. In fact, if an unsolicited file comes from a stranger, it’s most likely some form of malware and should be removed, preferably by your antivirus program. If you must manually delete it, delete the entire email message, making sure not to open the attachment.

 

Your next clue as to a file’s potential for danger is its file extension. Certain file extensions are more notorious than others, especially executable file extensions such as .exe, .bat, or .com. When an executable file is clicked, an application runs. This application could be either innocent or dangerous. Again, consider the source before taking any action. Did an .exe file arrive from a trusted source? For instance, is it a software setup file that you downloaded from a site such as Microsoft.com? If so, then it’s likely safe. If the .exe file randomly arrived, it may be dangerous.

]]>

 

If you notice a file with the .com file extension, be especially careful. Not only is the .com file extension an executable, MS-DOS application file, it is also deceptive thanks to the use of “.com” in URLs. You may think that a file with the .com file extension is a link to a Web site, but it’s not, so use extreme care before clicking.

 

Another sign that a file might be dangerous is when the file has a double file extension such as filename.gif.exe. These file extensions are named with double extensions to trick users into thinking that they are safe. For example, if your computer isn’t set to display file extensions, the file with the double extension will look legitimate. In our example, filename.gif.exe would appear as filename.gif. In general, .gif files are safe to open, so a savvy computer user wouldn’t see the dangerous .exe extension and have a false sense of security when seeing the relatively safe .gif extension.

Because a file’s extension does provide you with clues, it’s smart to set up your computer to display file extensions. This is done in the Control Panel’s Folder Options. In Windows 7 and Windows Vista, go to Start and type Folder Options into the Search bar and then click on the Folder Options link once it appears. Next, click on the View tab and then remove the checkmark next to “Hide extensions for known file types.”

 

A final consideration when opening newly arrived files is whether you are expecting the file or not, regardless of its file extension or who sent it. For example, it’s not uncommon for malware to overtake a computer’s email system and send viruses on behalf of the computer’s owner. While you may trust your family members and coworkers not to send you infected files, you can’t always be sure that your contacts’ computers haven’t been commandeered by malware. If your boss lets you know that he’ll be sending you a report and then an email arrives with a file named “salesreport.exe,” then it’s likely safe to open because you are expecting it. On the other hand, if out of the blue an unexpected email arrives from your boss with an attachment named “funnymovie.com,” you’d be wise to ask your boss what the file is for before opening it.

 

Dangerous files will arrive on your computer. Whether your computer gets infected or not often starts with you making smart decisions on how to handle these files.

Celeste Stewart writes for Filetonic.com where you’ll find a huge File Extension Library and loads of free computer advice. You can even write in and “Ask a Tech Jock” for specific answers to your computer questions.


Article from articlesbase.com

REG file parser using the Boost Spirit Parser Framework

Testimonials

I would like to thank the people who developed the following projects – they made the implementation of this project easier:

Boost: Spirit Parser Framework Program options Pool library Testing Framework Other Utils: Bind, Function, Scope Exit, String Algorithms Library

I want to say a personal thank you to Silviu Simen for his article “INI file reader using the Spirit library”.

Background and history of this task

There was a project in which I took part and we needed to test the working of a parser for Windows hive Registry files. These files are stored in binary representation and the structure of such a file is not documented by Microsoft. But, by means of research, my colleagues managed to clear out this structure, and after that, the question of verifying the parser work appeared.

To perform testing, I decided to use the functionality of exporting of Registry in two formats: hive and reg. Thus, I could obtain two different files for the same Registry key and after that check the working of the Windows hive Registry file parser.

The structure of the Registry file – I’ll give an example below – is very similar to the structure of the ini file, so you can use standard Windows functions for reading values in this file. But the problem is that, functions work very slow for big files, and that is why this parser was developed – a parser for reg files where I use the Boost Spirit Parser Framework. The reasons why standard Windows functions are slow will be considered below in this article.

What is a reg file?

Let’s consider the general view of a reg file structure first, and some special complicated cases will be considered as necessary.

I’ve taken the following material from here http://en.wikipedia.org/wiki/Windows_Registry.

.REG files (also known as Registration entries) are text-based human-readable files for storing portions of the Registry. On Windows 2000 and later NT-based Operating Systems, they contain the string Windows Registry Editor Version 5.00 at the beginning and are Unicode-based. On Windows 9x and NT 4.0 systems, they contain the string REGEDIT4 and are ANSI-based. Windows 9x format .REG files are compatible with Windows 2000 and later NT-based systems. The Registry Editor on Windows on these systems also supports exporting .REG files in Windows 9x/NT format. Data is stored in .REG files in the following syntax:

[<Hive Name>\<Key Name>\<Subkey Name>]
“Value Name”=<Value type>:<Value data>

Example 1 (different types):

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft]
“Value A”=”<String value data>”
“Value B”=hex:<Binary data>
“Value C”=dword:<DWORD value integer>
“Value D”=hex(7):<Multi-string value data>

“Value E”=hex(2):<Expandable string value data>

Example 2 (real):

[HKEY_CURRENT_USER\Key]
“Value string”=”B”
“Value dword”=dword:00000001
“Value hard”=hex(1000800c):53,00,65,00,72,00,76,00,69,00,63,00,65,00,53,00,\
74,00,61,00,72,00,74,00,54,00,79,00,70,00,65,00,00,00,4d,00,61,00,78,00,44

Making a little digression, I want to stress that the number in the line ” hex(1000800c) ” is the type identifier and it can be anything. It’s often used as the data in the security branch [HKEY_LOCAL_MACHINE\SAM].

And now, let’s try to extend the information about the possible contents of the reg file. Here, I represent some facts obtained during our research process:

1) Key Name may consist of alphabetical symbols and ” , \ , [ , ].
2) Number of values of one key can be from 0 to infinite
3) Value Name can be:
– symbol ‘@’ – it means default
– “text” – any symbols can be in this “text”
even these ones: \n , ” , \ , [ , ]
but it always ends with “\n symbols in sequence
4) Value data can be:
– “text” – any symbols can be in this “text”
but it always ends with ” and \n in sequence
– binary:
– dword:XX
– hex:XX
– hex(N):XX
Comments:
XX can be the pairs of number symbols separated by comas and
it can end with ‘\’ symbol that means that
data continue in the next line
Example:
dword:72,…,00,\
00,..,20 Two approaches and their comparison

As it was mentioned, the structures of reg files and ini files are quite the same, so I started to search for methods for working with ini files. I found the standard Windows functions.

Using the Windows API functions

Windows gives a lot of functions to work with INI files; we are interested in two of them for our task:

GetPrivateProfileSectionNames<link>: Retrieves the names of all the sections in an initialization file. GetPrivateProfileSection<link>: Retrieves all the keys and values for the specified section of an initialization file.

So, we should call GetPrivateProfileSectionNames one time to obtain the list of keys and then call GetPrivateProfileSection to obtain the values inside the keys.

The problem is that if the file is quite big, i.e., there are a lot of keys in it, then we should call GetPrivateProfileSection several times to read from the file. Here is some row test data: file size: 30 MB, file includes about 30,000 keys, the parsing of this file takes about 20 minutes. And, I should say that reg files are often bigger than 100 MB.

So, the problem:

Unjustified number of readings from the file.

Solution:

It’s necessary to load the file to the memory at one time or in some parts and then parse its content using your own tools.

Using a custom parser

When parsing a reg file content using your our own tools, it’s good idea to use already developed work. Thus, I came across the article about the ini file reader using the Spirit library. Using the example of the ini file parser, I developed my reg file parser.

Why boost::spirit ?

The Spirit Parser Framework is an object oriented recursive descent parser generator framework implemented using template metaprogramming techniques. Expression templates allow users to approximate the syntax of Extended Backus Naur Form (EBNF) completely in C++.

I was also attracted by these factors:

There are no intermediate conversions to some code needed, and also no external applications except for the compiler. You need to include only two header files and no libraries to use the Spirit Parser Framework.

Useful links:

Boost Spirit Parser Framework Wikipedia about Spirit Parser Framework Fleeting glance on boost::spirit

The main idea of using boost::spirit is in using the rules. Usually, several basic rules are defined, and then other rules are defined by means of overridden operators as a combinations of basic rules. The following example shows the creation of rules using “AND” and “NOT” operators:

RuleType simpleRule = ~ch_t(‘A’) &amp; ~ch_t(‘B’);

This rule works for any symbol except for ‘A’ and ‘B’.

Below in this article, each rule will be described in detail, but now, I want to give some quick information about possible operators – to let you imagine what the possible operations with the rules are.

Set operators:
a | b Union Match a or b. Also referred to as alternative
a &amp; b Intersection Match a and b
a – b Difference Match a but not b. If both match and b’s matched text
is shorter than a’s matched text, a successful
match is made
a ^ b XOR Match a or b, but not both

Sequencing Operators:
a >> b Sequence Match a and b in sequence
a &amp;&amp; b Sequential-and Sequential-and. Same as above,
match a and b in sequence
a || b Sequential-or Match a or b in sequence

Optional and Loops:
*a – Match a zero (0) or more times
+a – Match a one (1) or more times
!a – Match a zero (0) or one (1) time
a % b – Match a list of one or more repetitions
of a separated by occurrences of b.
This is the same as a >> *(b >> a).
Note that a must not also match b

Single character parsers:
anychar_p Matches any single character
(including the null terminator: ”)
alnum_p Matches alpha-numeric characters
alpha_p Matches alphabetic characters
blank_p Matches spaces or tabs
cntrl_p Matches control characters
digit_p Matches numeric digits
graph_p Matches non-space printing characters
lower_p Matches lower case letters
print_p Matches printable characters
punct_p Matches punctuation symbols
space_p Matches spaces, tabs, returns, and newlines
upper_p Matches upper case letters
xdigit_p Matches hexadecimal digits

Other comments:
negation ~
Example: ~ch_t(‘x’) – matches any character except ‘x’ Introduction to the parser development

Further in this article, I’ll try to keep the high level of clearness so I’m sorry in advance if you think that my descriptions are too detailed.

The description starts from the heart of the parser – its algorithm. The algorithm is described in parts, and then the wrapper for this algorithm is described, and then other auxiliary classes. At the end, we’ll consider a concrete usage example and test.

Algorithm description

The algorithm is represented by a function and interface:

template<class charT>

struct IResultProcessor
{
virtual ~IResultProcessor(){}

virtual void OnKeyFound(const charT* begin, const charT* end)=0;
virtual void OnValueNameFound(const charT* begin, const charT* end)=0;
virtual void OnValueDataFound(const charT* begin, const charT* end)=0;
};

template<class charT>
inline bool ParseRegFileImpl(const charT* buffer,
IResultProcessor<charT>* resultProc);

It follows from the function names that the algorithm will call the OnKeyFound function for each key name found, OnValueNameFound for each value name found, and OnValueDataFound for the value content.

An observant reader can ask a question: “Why is the processing of value separated into two functions, OnValueNameFound and OnValueDataFound, after all it it one single entity?” The answer is simple: “The implementation of this processing inside the algorithm would be hard and so the algorithm entrusts calling inside it the processing of these two parts”.

Preparatory work

At this stage, we will prepare the environment for the convenient work. In particular, we should use namespaces, shorten the line for rule creation, and define frequently used rules.

using namespace boost::spirit;
typedef rule<scanner<const charT*> > RuleType;
typedef chlit<charT> ch_t; // Single character
typedef chset<charT> chs_t; // Character set
typedef IResultProcessor<charT> ResProcT;

chs_t anychar_t(anychar_p); // Pattern anychar to character set
chs_t eol_CR(‘\r’); // End of line CR
chs_t eol_LF(‘\n’); // End of line LF
chs_t eol_t(eol_CR);// CR or LF end of line
eol_t |= eol_LF; Auxiliary rules // Matches spaces or tabs
RuleType blanks = * blank_p;

// Symbols ‘]’and ‘[' - separate Key Name
RuleType not_name_separator = ~ch_t(']‘) &amp; ~ch_t(‘[');

// empty data
RuleType empty_data = blanks >> (eol_t | ch_t(''));

// Data that we don't interested
// @ - it's default value name , " - requires additional processing
RuleType other_data = *(anychar_t &amp; not_name_separator &amp;
~ch_t('@')&amp; ~ch_t('"'));

The first rule is to omit the blanks and tabs. Asterisk means that the rule can work several times in a row or not work at all.

The second rule is to make sure that the current symbol is not the name separator.

The third rule is to omit empty data. The operator >> means that the rule at the left side of the operator and the rule at the right side should be performed in sequence, one after another.

The forth rule is assigned to free data not part of the separators. Any symbol matches this rule except for name separators, @ - the identifier of value by default, and the symbol " that signals the end of the line. This rule can work either several times or never.

Rule for the key name RuleType ident_kname_continue = ch_t(']‘) >> ~eol_t;
RuleType ident_key_name = *(anychar_t &amp; ~ch_t(‘]’)) ||
ident_kname_continue >> ident_key_name;

This rule can be illustrated on the scheme:

Rule ident_kname_continue is an auxiliary for ident_key_name. First of all, ident_key_name is the recursive rule, and after the process meets symbol ], it tries to define if it is the end of the name or the part of the name. If symbol ] is the part of the name, i.e., there is no symbol of line end after it, and then this rule starts itself again and continues parsing.

Let’s consider the following case for example:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\_HARD_NAME[123]_ABCD]

In this example, the symbol ] is the part of the name and that’s why it’s necessary to check if there is the symbol of line end after it. You can see such names in the Registry.

Rule for the Value name // if “= symbols sequence is found – value name ends
RuleType ident_vname_continue = +ch_t(‘”‘) >> ~ch_t(‘=’);
// If ‘”‘ symbol is found – check if value name ends,
// if it doesn’t parsing continues.
RuleType ident_vname_sz_skip = ch_t(‘\’) >> ch_t(‘”‘);
RuleType ident_vname_sz_body = *(anychar_t &amp; ~ch_t(‘”‘) ||
ident_vname_sz_skip );
RuleType ident_vname_sz =
ident_vname_sz_body >> *(ident_vname_continue >> ident_vname_sz_body);
// Rule for default value name
RuleType ident_vname_sz_impl = ch_t(‘”‘) >> ident_vname_sz >> +ch_t(‘”‘);
RuleType ident_vname_def = ch_t(‘@’);
// “text” or DEFAULT
RuleType ident_value_name = ident_vname_def | ident_vname_sz_impl;

This rule can be represented on the scheme:

Rule for the value content // if value content is binary
// Data can be any character except for ‘\’ and ‘\n’ in sequence
RuleType vdata_bin_body =*(anychar_t &amp; ~ch_t(”) &amp;
~eol_t &amp; ~ch_t(‘\’));
RuleType vdata_bin_continue = ch_t(‘\’) >> eol_t;
// if ‘\’ and ‘\n’ in sequence data continue on the next line
RuleType vdata_bin = vdata_bin_body >>
*(vdata_bin_continue >> vdata_bin_body);

// if value content is string
// String data always ends with ‘”‘ and ‘\n’ symbols in sequence
RuleType vdata_sz_continue = +ch_t(‘”‘) >> ~eol_t;
RuleType vdata_sz_body_impl = *(anychar_t &amp; ~ch_t(‘”‘));
RuleType vdata_sz_body = vdata_sz_body_impl >>
*(vdata_sz_continue >> vdata_sz_body_impl);
// String data always starts and ends with ‘”‘ symbol
RuleType ident_vdata_sz = ch_t(‘”‘) >> vdata_sz_body >> +ch_t(‘”‘);

// Check value data format
RuleType ident_vdata = ident_vdata_sz | vdata_bin;

This rule can be represented on the scheme like this:

Rule that describes the line with the key name // line with key name
RuleType l_key =
other_data>> // Can be comments or start title
ch_t(‘[') >> // start of the key name
// Call OnKeyFound function if rule succeeds
ident_key_name [bind(&amp;CRegFileParserImpl::OnKeyFound,
this, _1,_2) ] >>
blanks >> // can be blanks
ch_t(‘]’) >> // end of the key name
blanks >> // can be blanks
*eol_t; // one or more end of line symbols

This rule requires the execution of several rules in sequence. The new idea here is to use the operator []. In this case, it means that when the rule is activated, the functor transferred as the parameter should be called. And, the range where this rule worked will be transferred to this functor via two parameters.

Rule that describes the line with the Value // lines with value name and data
RuleType l_values =
other_data>> // Can be comments or start title
// Call OnValueNameFound function if rule succeed
ident_value_name
[bind(&amp;CRegFileParserImpl::OnValueNameFound, this, _1,_2) ] >>
blanks >> // can be blanks
ch_t(‘=’) >> // always separates value name and value data
blanks >> // can be blanks
// Call OnValueDataFound function if rule succeeded
value_data
[bind(&amp;CRegFileParserImpl::OnValueDataFound, this, _1,_2) ] >>

blanks >> // can be blanks
*eol_t; // one or more end of line symbols

This rule is much like the previous one. At this moment, we can return to the question stated during the interface discussion: “Why is the processing of Value separated into two functions OnValueNameFound and OnValueDataFound, after all it is one single entity?”. Now, we can give a more detailed answer. As it’s seen from the code above, it’s hard to support an interface corresponding to the reg file structure by means of boost::spirit – a function call with 4 parameters for the whole value.

Gathering everything together // Any line can satisfy one of the three rules
RuleType lines = l_key | l_values | empty_data;

// Start lexeme_d pars that compares also additional symbols
// if does just *lines, symbols ‘ ‘,’\t’,'\n’ are not compared
RuleType reg_file = lexeme_d [*lines] ;

// Execute parse
return (parse(buffer, reg_file).full);

So, we finished the algorithm of reg file parsing. The rules for the key name are set, the value is aggregated, and the file parsing starts.

The whole function looks like the following:

template<class charT>
inline bool ParseRegFileImpl(const charT* buffer,
IResultProcessor<charT>* resultProc)
{
using namespace boost::spirit;
typedef rule<scanner<const charT*> > RuleType;
typedef chlit<charT> ch_t; // Single character
typedef chset<charT> chs_t; // Character set
typedef IResultProcessor<charT> ResProcT;

chs_t anychar_t(anychar_p); // Pattern to char set
chs_t eol_CR(‘\r’); // End of line CR
chs_t eol_LF(‘\n’); // End of line LF
chs_t eol_t(eol_CR);// CR or LF end of line
eol_t |= eol_LF;

/* ————————————————————– */
/* Help rules*/

// Matches spaces or tabs
RuleType blanks = * blank_p;
// Symbols ‘]’and ‘[' - separate Key Name
RuleType not_name_separator = ~ch_t(']‘) &amp; ~ch_t(‘[');
// empty data
RuleType empty_data = blanks >> (eol_t | ch_t(''));
// Data in what we aren't interested
// @ - it's default value name, "

// - requires additional processing
RuleType other_data = *(anychar_t &amp; not_name_separator &amp;
~ch_t('@')&amp; ~ch_t('"'));

/* -------------------------------------------------------------- */
/* Rules that describe identifier of key name */

RuleType ident_kname_continue = ch_t(']‘) >> ~eol_t;
RuleType ident_key_name = *(anychar_t &amp; ~ch_t(‘]’)) ||
ident_kname_continue >> ident_key_name;

/* ————————————————————– */
/* Rules that describe identifier of value name */

// Skip \” sequence
RuleType ident_vname_sz_skip = ch_t(‘\’) >> ch_t(‘”‘);
RuleType ident_vname_sz_impl =
*(anychar_t &amp; ~ch_t(‘”‘) || ident_vname_sz_skip );
// Add trailing symbols to match pattern
RuleType ident_vname_sz = ch_t(‘”‘) >>
ident_vname_sz_impl >> +ch_t(‘”‘);
// Rule for default value name
RuleType ident_vname_def = ch_t(‘@’);
// “text” or DEFAULT
RuleType ident_value_name = ident_vname_def | ident_vname_sz;

/* ————————————————————– */
/* Rules that describe value content */

// if value content is binary
// Data can be any character except for ‘\’ and ‘\n’ in sequence
RuleType vdata_bin_body =
*(anychar_t &amp; ~ch_t(”) &amp; ~eol_t &amp; ~ch_t(‘\’));
RuleType vdata_bin_continue = ch_t(‘\’) >> eol_t;
// if ‘\’ and ‘\n’ in sequence then
// data continue on the next line
RuleType vdata_bin = vdata_bin_body >>
*(vdata_bin_continue >> vdata_bin_body);

// if value content is string
// String data always end with ‘”‘ and ‘\n’ symbols in sequence
RuleType vdata_sz_continue = +ch_t(‘”‘) >> ~eol_t;
RuleType vdata_sz_body_impl = *(anychar_t &amp; ~ch_t(‘”‘));
RuleType vdata_sz_body = vdata_sz_body_impl >>
*(vdata_sz_continue >> vdata_sz_body_impl);
// String data always start and end with ‘”‘ symbol
RuleType ident_vdata_sz = ch_t(‘”‘) >>
vdata_sz_body >> +ch_t(‘”‘);

// Check value content format
RuleType ident_vdata = ident_vdata_sz | vdata_bin;

/* ————————————————————– */
/* Put all rules together */

// line with key name
RuleType l_key =
other_data>> // Can be comments or start title
ch_t(‘[') >> // starts key name
// Call OnKeyFound function if rule succeed
ident_key_name [bind(&amp;ResProcT::OnKeyFound,
resultProc, _1,_2) ] >>

blanks >> // can be blanks
ch_t(‘]’) >> // ends key name
blanks >> // can be blanks
*eol_t; // one or more end of line symbols

// lines with value name and data
RuleType l_values =
other_data>> // Can be comments or start title
// Call OnValueNameFound function if rule succeed
ident_value_name [bind(&amp;ResProcT::OnValueNameFound,
resultProc, _1,_2) ] >>
blanks >> // can be blanks
ch_t(‘=’) >> // always separates value name and value data
blanks >> // can be blanks
// Call OnValueDataFound function if rule succeed
ident_vdata [bind(&amp;ResProcT::OnValueDataFound,
resultProc, _1,_2) ] >>

blanks >> // can be blanks
*eol_t; // one or more end of line symbols

// Any line can satisfy one of three rules
RuleType lines = l_key | l_values | empty_data;

// Do lexeme_d pars that compare also additional symbols
// if do just *lines, symbols ‘ ‘,’\t’,'\n’ are not compared
RuleType reg_file = lexeme_d [*lines] ;

// Execute parse
return (parse(buffer, reg_file).full);
} CRegFileParser

It’s time to consider the wrapper class for this algorithm. This class assumes the processing of the value name and the value content. In other words, this class supports the following intrface:

template<class charT>
struct IRegFileObserver
{
virtual ~IRegFileObserver(){}

virtual void OnKeyFound(const charT* begin, const charT* end)=0;
virtual void OnValueFound(const charT* nameBegin, const charT* nameEnd,
const charT* dataBegin, const charT* dataEnd)=0;
};

And the class itself:

template<class charT>
class CRegFileParser:public IResultProcessor<charT>
{
typedef std::pair<const charT*,const charT*> BuferRange;
BuferRange lastVName_;

IRegFileObserver<charT>* pObserver_;

bool bLastVNameProcessed_;
public:
CRegFileParser(IRegFileObserver<charT>* pObserver)
: pObserver_(pObserver)
, bLastVNameProcessed_(true)
{}

bool Parse(const charT* buffer)
{
return ParseRegFileImpl(buffer,this);
}

private:
void OnKeyFound(const charT* begin, const charT* end)
{
CheckVNameProcessed(true);

pObserver_->OnKeyFound(begin,end);
}
void OnValueNameFound(const charT* begin, const charT* end)
{
CheckVNameProcessed(true);

bLastVNameProcessed_ = false;
lastVName_.first = begin;
lastVName_.second = end;
}
void OnValueDataFound(const charT* begin, const charT* end)
{
CheckVNameProcessed(false);

bLastVNameProcessed_ = true;
pObserver_->OnValueFound(lastVName_.first,
lastVName_.second,begin,end);
}
void CheckVNameProcessed(bool needToBeProcessed)
{
if(bLastVNameProcessed_ != needToBeProcessed)
throw std::exception(“Value data not ” +
“found for founded value name”);
}
}; Using Pool

Before considering the observers created for testing, we should describe the usage of the boost Pool library.

What is Pool?

Pool allocation is a memory allocation scheme that is very fast, but limited in its usage.

Installation

The Boost Pool library is a header file library. That means there is no .lib, .dll, or .so to build; just add the Boost directory to your compiler’s include file path, and you should be good to go!

How do I use Pool?

To make it convenient, I created the following classes that have the functionality of the standard STL containers but use the boost Pool library:

#include <boost/pool/pool_alloc.hpp>
#include <map>
#include <vector>
#include <list>

#include <string>

template<class _Kty, class _Ty>
class QMap : public std::map< _Kty, _Ty, std::less<_Kty>,
boost::fast_pool_allocator< std::pair<_Kty,_Ty> > >

{};

template<class _Ty>
class QVect : public std::vector< _Ty, boost::pool_allocator<_Ty> >
{};

template<class _Ty>
class QList : public std::list< _Ty, boost::pool_allocator<_Ty> >

{};

template<class _Ty>
class QStringStream :
public std::basic_stringstream< _Ty,std::char_traits<_Ty>,
boost::pool_allocator<_Ty> >
{};

template<class _Ty>
class QString: public std::basic_string<_Ty,std::char_traits<_Ty>,
boost::pool_allocator<_Ty> >

{
typedef std::basic_string<_Ty,std::char_traits<_Ty>,
boost::pool_allocator<_Ty> >
BaseClass;
public:
QString(){}
// construct from [_First, _Last), const pointers
QString(const _Ty* first,const _Ty* last)
: BaseClass(first,last)
{}
};

The only disadvantage - as you could notice - is no full support for original constructors. I actually think that it's not a big problem, you can just insert the necessary constructor if it's needed.

Observers

Some observers were created for testing purposes:

CRegStatusObserver - assigned to print the status of the parsing process on the screen in percentage. CRegCountObserver - assigned to print the number of keys and the values on the screen. CRegPrintObserver - assigned to print all the keys and values on the screen. CRegFullObserver - assigned to store all the keys in std::map, where the name of the Registry key is key and the vector of all the values of this Registry key is the std::vector values. CRegObserversPool - assigned to make it possible to use several observers simultaneously.

It's important to mention that these observers print information on the screen, but they can be used to print to the file or some other stream. For example, CRegCountObserver:

template<class charT,class streamT>
class CRegCountObserver:public IRegFileObserver<charT>
{
size_t keysCount_;
size_t valuesCount_;

streamT&amp; out_;
public:
CRegCountObserver(streamT&amp; out)
: keysCount_(0)
, valuesCount_(0)
, out_(out)
{}
~CRegCountObserver()
{
out_ << "Keys count: "
<< keysCount_
<< "\t Values count: "
<< valuesCount_
<< "\n";
}
...
};

And some examples of its usage:

// 1
CRegCountObserver<char> screenObsr(std::cout);

// 2
std::stringstream strStream;
CRegPrintObserver<char,std::stringstream> stringObsr(strStream);

// 3
std::fstream fileStream;
CRegPrintObserver<char,std::fstream> fileObsr(fileStream);

The usage of other observers is the same.

Auto-tests description

All auto-test are represented in the one project, RegFileParserAutoTest.

The test is a console application developed with the Boost Testing Framework. Five complicated cases were chosen to be the test data: one for key name, two for value name, and two for value content.

There is one more case with the typical content of a reg file. So, we have six cases, and there are two versions of reg file format - ANSI and UNICODE (Regedit4 and Regedit5 correspondingly); each of our cases duplicates for two formats. As a result, we have 12 test files.

To control the results of parsing, we use a comparison of the original content and the content parsed and saved in memory using CRegPrintObserver:

template<class charT>
class TestRunner
{
protected:
typedef std::basic_string<charT> stringT;
typedef std::basic_stringstream<charT> stringstreamT;

typedef std::basic_fstream<charT> fstreamT;
public:

...

static void
RunTest(const std::wstring&amp; fileName)
{
std::vector<char> buffer;
ReadFile(fileName,&amp;buffer);

stringstreamT stream;
reg_parser::CRegPrintObserver<charT,stringstreamT>
coutObserver(stream);
reg_parser::CRegFileParser<charT> regParser(&amp;coutObserver);

// Run parsing
if( !regParser.Parse( (charT*)&amp;buffer[0] ) )
throw std::exception(“Parsing fail.”);

// Prepare data for comparison
stringT parsedStr;
AddRegHeader(&amp;parsedStr);
parsedStr += stream.str();

stringT originalStr = stringT((charT*)&amp;buffer[0]);

// Trim unneeded symbols
using namespace boost;
trim_if(originalStr,is_any_of(“\n\t “));
trim_if(parsedStr,is_any_of(“\n\t “));

if( parsedStr != originalStr)
{
// Save to file result of parsing
std::wstring parsedFileName = fileName + L”_parsed”;
fstreamT file(parsedFileName.c_str(),
fstreamT::out | fstreamT::trunc);
if( file.is_open() == false )
throw std::exception(“Can’t create file for ”
“result of parsing.”);

BOOST_SCOPE_EXIT( (&amp;file) )
{
file.close();
}
BOOST_SCOPE_EXIT_END

file << parsedStr;

throw std::exception(“Parsed data not ”
“equal to original data.”);
}
}


}; Description for manual testing

Manual tests are represented in one project, RegFileParserTestCmd. The test is a console application implemented using Boost Program Options that has these parameters:

C:\RegFileParser\bin\Debug>RegFileParserTestCmd.exe –help
Allowed options:
–help produce help message
–reg_file arg source reg file
–print Enable printing to the screen
–count Enable counting parsed keys and values
–status Enable printing status of parsing

It’s a pity that I don’t have enough time to add options to save the parsed content to a file, and using the save option like it is in autotest doesn’t seem to be aesthetic to me.

Registry export using Regedit

Conclusion

This article is a special piece of knowledge, so may be it’s not as systematic as it should be.

It was really interesting to learn boost spirit, and I managed to get the pleasure of my work with it and some aesthetic satisfaction – not just get my task done. After all, this discovered to be very effective; for example, the calculation of number of keys and values in a Registry file of 250 MB now takes a couple of seconds only.

So learn something new, and good luck to you in your development!

Download sources from Apriorit site.


Article from articlesbase.com

Pendaflex Portafile Expanding Organizer, Black

  • 19 pockets for categorizing your documents
  • Expandable to 15 inches; one size fits letter and legal size papers
  • Protective flap cover with handle for convenient portability
  • Pre-Printed alphabetic and home subject headings
  • Lifetime Guarantee

19 Pockets for categorizing your documents, exandable to 15 inches. Protective flap cover with handle for convenient portability. Pre-printed alphabetic and home subject headings. One size fits letter and legal size papers.

List Price: $ 21.99

Price: $ 13.94

Ext3 journaled File system ? A study

Ext3  journaled File system  – A study

 Introduction

  A file system is to represent the particular way that the data is stored and how the operating system keeps track of it. Information such as  who(user/group) created a file, date of creation and last modification, what permissions are granted for reading and modifying the file, the size of the file, and where it is located on the drive or partition, are all part of the responsibility of the file system. In other words files system must manage all the files and all of their metadata.

  How file systems become corrupted

Suppose you created a word processing document. After few days you were adding some data to it. But the system crashes before you save the file, you have lost all your changes but your original file will still be okay. If the machine crashes after you save the file, then you really haven’t lost anything but it takes time to reboot and reload the program. But what happens if the machine crashes during the exact moment when the disk is being written?

Since the new version of the file is physically overwriting all or part of the old version, the data can have some of each at the moment the drive stops writing. You end up with a file that you can’t open because the internal format of its data is inconsistent with what the application expects.

This gets even worse if the drive was writing the metadata areas, such as the directory itself. Now instead of one corrupted file, you have one corrupted file system In other words, you can lose an entire directory or all the data on an entire disk partition.

 Modern systems, such as Linux, OS/2, and NT, do make an attempt to prevent and recover from the metadata corruption. To accomplish this, the system performs an extensive file system analysis during bootup. Well-designed file systems often incorporate redundant copies of critical metadata, so that it is extremely unlikely for that data to be completely lost. The system traces out where the corrupt metadata is, and then either repairs the damage by copying from the redundant version or simply deletes the file or files whose metadata is affected. Losing files this way is bad, but it is much better than losing the whole partition.

Unfortunately, such an extensive diagnostic analysis requires a great deal of time. Even on a very fast PC, a large and heavily-used partition can require several minutes to check. Most of the time, however, the check is not really needed because the system was shut down normally, without a sudden crash. To prevent unnecessary delays, the operating system’s normal shutdown process puts a status flag on the file system as it is unmounted, marking it as a “clean” file system. If a crash happened, the system never has the chance to mark the files ystem as “clean” and the bootup process knows that it needs to run the extensive file system tests just to be safe.

The term “journaled” means that the file system maintains a log or record of what it is doing to the main data areas of the disk, so that if a crash occurs it can re-create anything that was lost.

When the system is about to alter the metadata, it first makes an entry in the journal saying, “Here is what I’m going to change.” Then it makes the change. Finally, it goes back to the journal and either marks that change as “completed” or simply deletes the journal entry entirely.

The idea is that the system can crash at any point in this process but that such a crash won’t have lasting effect. If the crash happens before the first journal entry, then the original data is still on the disk. You lost your new changes, but you didn’t lose the file in its previous state. If the crash happens during the actual disk update, you still have the journal entry showing what was supposed to have happened. So when the system reboots, it can simply replay the journal entries and complete the update that was interrupted, or it can back out a partially completed update to restore the file’s previous state. In either case, you have valid data.

 The ext3 file system is a journaling extension to the standard ext2 file system on Linux os. Journaling results in massively reduced time spent recovering a file system after a crash, and is therefore in high demand in environments where high availability is important, not only to improve recovery times on single machines but also to allow a crashed machine’s file system to be recovered on another machine when we have a cluster of nodes with a shared disk.

 Journaling Options are Available with the ext3 file system

The ext3 file system provides three options. These are as follows:

journal -. Both metadata and file contents are written to the journal before being committed to the main file system. Because the journal is relatively continuous on disk, this can improve performance in some circumstances. In other cases, performance gets worse because the data must be written twice – once to the journal, and once to the main part of the file system. Journals all data requiring greater journal space and reduced performance. The most secure data retention policy ordered -  Only metadata is journaled; file contents are not, but it’s guaranteed that file contents are written to disk before associated metadata is marked as committed in the journal. This is the default on many Linux distributions. If there is a power outage while a file is being written or appended to, the journal will indicate the new file or appended data has not been “committed”, so it will be purged by the cleanup process. However, files being overwritten can be corrupted because the original version of the file is not stored. Thus it’s possible to end up with a file in an intermediate state between new and old, without enough information to restore either one or the other. The intermediate state might intersperse old and new data, because the order of the write is left up to the disk’s hardware.  writeback – Only metadata is journaled; file contents are not. The contents might be written before or after the journal is updated. As a result, files modified right before a crash can become corrupted. For example, a file being appended to may be marked in the journal as being larger than it actually is, causing garbage at the end. Older versions of files could also appear unexpectedly after a journal recovery. The lack of synchronization between data and journal is faster in many cases. It has greater speed at the price of limited data integrity. So allows old data to show up in files after a crash and relies on kernel’s standard writebacks to flush buffers.

Interested to share and acquire knowledge.


Article from articlesbase.com

Storex Economy Portable File Box, Black (61502U01C)

  • Easy to carry
  • Holds letter file
  • Large handle
  • Snap-tight lid
  • 50% Post consumer content

This lightweight black file box with has an organizer compartment on top for storing supplies. The snap-tight lid has a large, easy-to-carry, molded handle for mobility with a comfortable grip. Holds letter-size hanging files only. Made with environmentally-friendly 50% post consumer material. Great file storage for a great price!

List Price: $ 16.49

Price: $ 11.99

Recover Deleted Files Q&A

More Recover Deleted Files questions please visit : RecoveryDataFAQ.com

Recover delete avi files?
My little brother decided to delete movies on my laptop. I checked the recycle bin and its empty and near is no trace of the movies anywhere is there any mode I can get those movies final by using applications to recover them, if so what is a good program, or is near another way to…

Recover delete c folder?
I accidentally deleted a c program I be writing (typed “cc -o prog.c prog” instead of “cc prog.c -o prog”). Unfortunately, I am ssh-ed into a unix computer which doesn’t have any backup. So I am left next to the compiled program (prog) and a file name prog.core. Is there any agency to recover my c…

RECOVER delete FILES from computer?CHEATING HUSBAND!!?
I desperatly need to recover delete files from my computer. i heard in that were programs you can download sour the internet to find these files, PLEASE HELP! Need to know if husband and father of 2 is cheating! :( (files were delete in final 48 hrs, from the history on his email account)…

Recover delete files from empty recycle bin?
HI i have delete some very defining files i have after emptied the recycle bin. how can i recover my delete files. can you give me a pattern site where i can download some software to recover my delete files from the recycle bin Cheers you lot there are a…

Recover delete files from portable concrete drive?
I saved a folder on a portable sturdy drive and after I was done next to it i hit delete . I now want the folder again and it is deleted from the from the frozen drive. How can I recover the folder? I am a newb when it comes…

Recover delete files from usb?
I accidentally deleted a powerpoint presentation from my usb when I be trying to delete a virus from it – it didn’t go to the recycle bin – how can I recover it!? please sustain! thank you to anyone who can help! Files delete on a separate partition resembling a USB drive wont…

Recover delete files of a memory stick?
i have accidentally freshly deleted my college course work of my memory Stick but i desperately necessitate to get it put a bet on asap but i don’t have any money to salary for these programs on the internet. Does any body know a free website which recovers deleted files? they adjectives say…

Recover delete files on a mac!! Help!?
ok i have a football organizer game on my mac.. yesterday i downloaded this strategy guide thing but when i go to delete all the parts from that.. i accidentally put my save game surrounded by the trash too and emptied it ! i’ve be on that game for a LONG time and…

Recover delete files on my razr phone?
by accident i delete all of the video files on my cell phone! i hold a razr that i got finishing year and i really want to get my delete files back. does anyone know how this can be done? The singular way to recover them is if you save them to a…

Recover delete files. HELP!?
Hi. I just posted a request for information about some means of access to retrieve deleted photos that i DESPERATELY involve back. Anyway, I’ve taken peoples warning and downloaded different programs to help me recover these files. I hold used * Recuver.com * File Recovery * Handy Recovery and a few others. all of…

Recover delete files….?
Hi, I deleted one historic folder that contained about 15 files. Is it possible to recover those delete folder (and files)? Is there appropriate software? I deleted this from USB drive (western digital password USB drive). Please comfort. Thanks I use RecoverMyFiles from recovermyfiles.com A little pricey, but ddefinitely…

Recover delete files.?
i deleted my description on my laptop because there be an error so it would not let me sign on but i cliked squirrel away files but the files did not save and i would close to to get adjectives my files back does anyone know a free process to do this? or is it not possible?…

Recover delete files?
Can you recover deleted pics and video from a phonee? Have u formatted the Memory Card? if itz quick format u can recover it by these Softs http://www.smartpctools.com/recovery/index.htm http://www.freedownloadscenter.com/Search/data_recovery.html if you own a memory card then here might be a back up on it, otherwise it is difficult for you to do it yourself. i…

Recover delete files?
I have not long deleted some folders from my computer and delete them out of the recycle bin. Can any please tell me of free software to use to recover this? Also I hear doing a system recovry will recover delete files from the recycle bin? Many thanks L I merely know of one and…

Recover delete files?
Is it possible to recover files that were delete over a half a year ago, i have to reformat the disk once due to a virus and lost lots of files, is there anyway to recover them? I you did a complete reformat you cant. But it could be possible to recover it if you just…

Recover delete files?
Is there a means of access to recover files that have be deleted from the recycle bin? Such as Images, Music, Documents, Videos etc. I enjoy not actually lost anything, but it is one computer trick I hold been dying to swot. I want a way to recover them WITHOUT any requisite program downloads. So if…

Recover delete files?
Yikes… Somebody help…. I be cleaning up my hard drive, and I accidently delete a file that I needed. I empty the recycle bin before I realised. Does any one know how to restore delete files without have to buy third party software? I am using Windows xp, and I know for a moment about using…

Recover delete files?
You can try to recover your deleted files near Easy Drive Data Recovery software: http://www.munsoft.com/EasyDriveDataReco… It uses unique modern algorithms to recover files that other software any recovers incorrectly or is unable to detect. you may wanna try system restore which is lower than system tools tab. that will only work if you hold your computer set…

Recover delete music files?
yes, I know, its been asked. But plentiful of the answers does not work. Its either the software requests to be paid or it basically doesnt retrieve the files I need. I accidenltly delete music files in the limewire library. Now they’re gone, not even surrounded by my music folder. help? in recent times download…

Recover delete notepad directory?
i have a database that i need from notepad that i delete i put it in the recycle bin and consequently i deleted them from contained by there in a minute i know there is recovery programs that u can use to procure it back… anyone know of a recovery program that i can DL for…

Recover delete or formatted files?
Hi guys, Anyone knows of a really suitable software to recover deleted or formatted files? Thank you Try using ‘Easy Recovery Pro’ journal 6. This works very well brought-up for me. O&O DiskRecovery is a good choice http://crazywebmaster.com/oo-diskrecover… Also Handy Recovery http://crazywebmaster.com/handy-recovery… and Recover My Files http://crazywebmaster.com/recover-my-fil… Ok….

Recover delete photos / files from Nokia N95 8gb?
I’ve recently bought a Nokia N95 8gb and took loads of nice photos beside it last dark that I would have loved to upload to Facebook but I accidentally delete them in my infinite prudence. I’ve searched Google and can’t come across to find a definitive answer. I use a Mac…

Recover delete skylight files?
i recently used the AVG anti-virus software to scan my computer, it found six threats surrounded by the window files and it automatically delete them. but immediately the computer showed a alert saying that defining files have be changed and the computer cannot run properly without them. i didn’t dare to close the computer incase it…

Recover Deleted Files – Apple Mac? Sims 2?
Hi, I accidentally deleted my Sims 2 Pets extension pack from my apple mac. I want to re-install it but it say I have to install The Sims first, which I hold already done a while ago (obviously, that’s why I could play Sims 2 Pets). But the thing is, I don’t…