473,804 Members | 2,296 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

creating bitmasks (for bloom filters)

Hi,

Included below is a copy of a message I sent to the py-tutor list. It
didn't garner much in the way of a solution and it was suggested that
this list might be helpful.

Thanks,

-----Forwarded Message-----
From: Aaron Straup Cope <as*@vineyard.n et>
To: pytutor <tu***@python.o rg>
Subject: creating bitmasks (for bloom filters)
Date: Fri, 11 Jun 2004 08:49:20 -0400

Hi,

A quick introduction : I am mostly a Perl hacker, but I am teaching
myself Python because it seems like the right tool for the job in
question. [1] I am not, by any stretch, much of a math weenie.

I am trying to port the Bloom::Filter Perl module [2] for use with my
tool. I know that there is a "pybloom" sourceforge project [3] but
licensing issues aside it's reliance on Unix math libs makes it
problematic for use with a cross-platform GUI tool.

At this point, my not very deep grasp of Python and my poor
understanding of some basic compsci/math principles have combined to
frustrate my efforts.

I was hoping that the the Perl/Python operator and function set would be
similar enough that, with only a few modifications, I could clone the
B:F.pm package pretty much "as is". All other bugs aside, I am stuck
trying to create a bitmask of a key :

"Given a key, hashes it using the list of salts and returns a bitmask
the same length as the Bloom filter. Note that Perl will pad the
bitmask out with zeroes so it's a muliple of 8."

# from the docs for the _make_bitmask method

Specifically, it's not clear to me :

* how to map the various Perl pack/unpack formats to their Python
equivalents (things like Perl's "b*" which is "a bit string, in
ascending bit order inside each byte" where "*" means to use all
the bytes from the input field")

* how to account for the fact that unpack returns a list in Perl and
Python returns a string

* how to pass a salt to the Python sha module

* how to XOR the pieces of an unpacked sha digest (which may simply
be a function of a bad format unpacking stuff)

* A 'vec' [4] function in Python; does one exist?

In short, I don't really have any idea what I'm doing :-(

As much as I relish the challenge purely on the grounds of learning new
stuff I am starting to reach the point of irrational frustration and
wanting to just get this done so I can move on to other things.

The tool should be written in Python because it's the best choice for
the job. The tool needs to be able to read/write Bloom Filters. Python
needs a Bloom Filter library, so I will step up and write it. Except it
appears to be beyond my skill level right now...

Any thoughts, suggestions or clue-bats would be very much welcomed.
Pointers to an already existing implementation that I've missed would be
even better but I'll take what I can get. :-)

Thanks,

---

[1]
http://aaronland.info/weblog/categor...plication_the/
[2] http://search.cpan.org/src/MCEGLOWS/...0.02/Filter.pm
[3] http://cvs.sourceforge.net/viewcvs.py/pybloom/
[4] http://www.perldoc.com/perl5.8.4/pod/func/vec.html

Jul 18 '05 #1
0 1781

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2723
by: Jaakko Holster | last post by:
Lets run following code: ------- snip ------ class Perm { static $read = bindec('001'); static $write = bindec('010'); static $delete = bindec('100'); }
0
2137
by: Ravi Ambros Wallau | last post by:
Hi: I've created a custom control - a grid that uses Infragistics to display some filters, the grid itself, and some buttons. Well, when using this control directly on WebForm, everything works really fine. No problems at all. But, when this control is placed inside a template of an Infragistics UltraWebTab control, somethings stranges happens: 1. When the WebForm is opened, an "Error Creating Control" message is displayed (for container...
3
6107
by: Kim | last post by:
Im making a config file to a C# program in XML. I have save and load functions, but these require a base XML file with its structure to exsist (Im new to XML, so this was the way I it to work). Now I want to extend that, so if the base XML file doesnt exsist a function will make the structure. However this way seem somewhat troublesome to do it, but it works. Is there an easier way? Also is it allowed to use space in the element name ?
3
1838
by: roypython | last post by:
Hello everyone. Your help is very much appreciated. I am trying to create partial replica from the design master. it all goes well until I try to set the filter using: repPartial.Filters.Append "Customers",jrFilterTypeTable,"Customers.Region = 'CA' " It throws an error: "Invalid expression in the ReplicaFilter property". The replica db, does contain "Customers" table, which has "Region" field.
3
2428
by: roypython | last post by:
Hello everyone. Your help is very much appreciated. I am using MS ACCESS 2003. I am trying to create partial replica from the design master. it all goes well until I try to set the filter using: repPartial.Filters.Append "Customers",jrFilterTypeTable,"Customers.Region = 'CA' " It throws an error: "Invalid expression in the ReplicaFilter property". The replica db, does contain "Customers" table, which has "Region" field.
2
596
by: Jonathan Boivin | last post by:
Hi people, Let me introduce to how I get this error. I have a form which load all my bills representation depending upon filters which each bill is a usercontrol of my own having some textboxes containing bill's datas. (I already replaced the labels by painting the text instead.) When I click on my filter button, it clears the current usercontrol bills and load the new ones upon the current chosen filters. The bug happens when
3
1996
by: Mr 200 | last post by:
Hi all ive just recently started learning java and was happy to find a forum that may be able to give me a little assistance. I have been set an excersize to create a filter processor that relays information between several filters to give a result. I have created one of the filters already, however i need the filter processor working in order to test wether the filter i have done works correctly. However im not completely sure where to...
3
5408
by: Redbeard | last post by:
Hi All this is my first time post, be gentle. I am looking at creating a keyword search that searches multiple fields in a Form and then filters records that match the keyword. The Form currently has a button that connects to a Query that run the keyword search in several field and then filters the results. The problem is that I can not do a search within a search, or have multiple words searched in any order. For example there are 20,000...
5
3131
MrPickle
by: MrPickle | last post by:
When using bit masks, how do you do "not bitmask", not sure how to explain it so: How could you do this in bitmasks: if(!something)
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9173
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6863
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.