filter

What is the best way to filter URLs for input?

I have a form that is accepting URLs from users in PHP. What characters should I allow or disallow? Currently I use $input= preg_replace("/[^a-zA-Z0-9-\?\:#.()\,\/\&\'\\"]/", "", $string); $input=substr($input,0,255); So, it's trimmed to 255 chars and only can include letters, numbers, and ? - _ : # ( ) , & ' " / Anything I should b...

Writing XSS Filter for (X)HTML Based on White List

Hello, I need to implement a simple and efficient XSS Filter in C++ for CppCMS. I can't use existing high quality filters written in PHP because because it is high performance framework that uses C++. The basic idea is provide a filter that have a while list of HTML tags and a white list of options for these tags. For example. typical H...

How can I filter filenames based on their extension?

The following script stores all the files and directories in the array @file_list. How do I only filter only files with the .lt6 extension and none other than that? opendir (CURRDIR, $localdir); @file_list = grep !/^\.\.?$/, readdir CURRDIR; print STDOUT "Found Files: @file_list\n"; cheers ...

DataView.RowFilter, multiple possible values on several columns

I have a dataview where the interresting columns are length, height, color1, and color2 where color1 and color2 can be any of yellow, red, blue, black, white, or green. What is the best way to apply a filter where I get the rows with a certain length and height but with only the colors red, blue, and green? The filter below feels a bit...

SQL query filtering

Hey, Using SQL Server 2005, I have a table where certain events are being logged, and I need to create a query that returns only very specific results. There's an example below: Log: Log_ID | FB_ID | Date | Log_Name | Log_Type 7 | 4 | 2007/11/8 | Nina | Critical 6 | 4 | 2007/11/6 | John | Critical ...

Shoulda: Testing contoller filters

So I have decided to investigate the state of Rails' testing. After reading a few accepted answers here on SO talking about how Rails' testing documentation is atrocious I am starting to agree. Thus far, I am apparently not in the club of people that understand Rails testing- even though I understand the framework quite well, or so I tho...

Creating new Iterator from the results of another Iterator

Hi, I'm trying to get my head around using Iterators effectively in PHP 5, and without a lot of decent examples on the net, it's proving to be a little difficult. I'm trying to loop over a directory, and read all the (php) files within to search for defined classes. What I then want to do is have an associative array returned with the ...

Filtering DataGridView rows in .Net

I have a DataGridView that is displaying a List of objects (not DataSet). Is there an easy way to set a filter, so the DGV will only display rows that match the filter? IList<T> log = ...; dgv.DataSource = log; ...

How can I apply a filter to grandparents in nHibernate?

I have a question about nHibernate and filtering. I am using nHibernate 2.2 but I think this will apply to versions as early as 1.2. I have created a simple example to illustrate the problem. I have three domain objects: Country, State, and City (assume the DB tables match the domain and have the appropriate relations defined. I want to...

how do I get rid of the secure nonsecure warning on page with iframe under SSL with phishing filter?

I have a page under SSL with an iframe that refreshes itself every 20 seconds through an HTTP refresh prgama. If I browse the site with IE7 and phishing filter enabled I receive secure-nonsecure content warnings in irregular intervals which cease if phishing filter is disabled. Does anybody have an idea what I can do in order to get rid ...

Biztalk Send Port Group and Filtering

So the model I need for my solution is as follows: I need to poll the database and based on a result, create a request to the database for more data, get the response and pass it to a group of ports, for which based on a promoted property, only one of the ports will act. It looks like this: However, if you assign "Temp Out" to a sen...

HandleError Attribute not following Order

I have a base controller with a HandleErrorAttibute decorating the class declaration like so: [HandleError(View="Error", Order=1)] public class BaseController : Controller If I put [HandleError(View="DifferentError", Order=2)] on a subclassed controller method and an exception occurs, I get the Error.aspx rendered view. I expect t...

Launching OpenOffice filters from a menu/toolbar button

I have packaged an XSLT export filter for OpenOffice as per the instructions on this page: http://wiki.services.openoffice.org/wiki/Filter_extensions It works fine; but in order to be used, the user has to select the command 'File/Save as' then choose the correct file extension that triggers the use of the filter, and a target file n...

Rails: filter defined in lib file required in environment.rb disappears from filter_chain in production environment. Why?

Hi, In my rails application, I have a file in lib that, among other things, sets up a filter that runs on all controllers. When running under development environment, everything runs fine. However, under production the filter goes missing. Funny thing is, by inspecting the filter_chain, I noticed other filters remain, eg. those define...

How to filter myself out of Google Analytics with a dynamic IP address?

Does anyone know how to setup Google Analytics to filter yourself out if you're visiting the site from a dynamic IP address? I don't want to include myself in my stats from home use where I have a dynamic IP address via Verizon FiOS. ...

Boolean column in Microsoft Access and filtering data using linq

[Apologies for long question but I thought it would be clearer for others to answer] I have a Microsoft Access database and it contains a table "Customers" with following columns: ID (auto number) Name (Text) Active (yes/no) I created the database table class in C# as below: [Table (Name = "Products")] public class Product { [C...

How does this Squid regex filter rule work?

On our Squid server, the admin has put on a new regex rule: ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ I know that it stands for IP address, but it allows all URLs to go through, only pinging external address has stopped. Also tunneling software like UltraSurf have stopped connecting to the server. Skype also is not getting connected. Please e...

Can I specify a hibernate relationship with a filter?

I have a foo that has a relationship to many bar's. When I delete bar's in my system I want to keep them in the database for some crazy business reason so I just set a deleted field to true. Can I specify in my hibernate mapping that I only want my collection to hold elements where that field is false? ...

custom database query in sharepoint using active directory username as filter

Hello, i have a custom query in a database which i want to display to users in a MOSS via performancepoint webpart. I need to filter the report based on the username of the logged in user. How can i pass the AD username to the performancepoint webpart? Thanks ...

Fetch fields from a table that has the same relation to another table

I'll try to explain my case as good as i can. I'm making a website where you can find topics by browsing their tags. Nothing strange there. I'm having tricky time with some of the queries though. They might be easy for you, my mind is pretty messed up from doing alot of work :P. I have the tables "topics" and "tags". They are joined usi...