case-insensitive

Rails validates_uniqueness_of across multiple columns with case insensitivity

I have a model that has two fields, which I will call first_name and last_name, and I want to make sure that the combination of the two are case-insensitively unique. I've gotten halfway there by using this: validates_uniqueness_of :first_name, :scope => :last_name The problem is that the uniqueness check seems to be case sensitive, e...

Hibernate + Postgresql with case insensitive searching

Hi, I've been googling around for a straight-forward solution on getting our new postgresql + hibernate setup working with case insensitive search, without luck. We had previously been using mysql which has a policy on case insensative searching however Postgresql seems to lack this. For example, I'd like Hibernate/Postgresql to return ...

Case-insensitive search in Rails model

My product model contains some items Product.first => #<Product id: 10, name: "Blue jeans" > I'm now importing some product parameters from another dataset, but there are inconsistencies in the spelling of the names. For instance, in the other dataset, Blue jeans could be spelled Blue Jeans. I wanted to Product.find_or_create_by_na...

Case Insensitive Pattern Matching over String Lists

I'm trying to parse command line arguments in an F# application. I'm using pattern matching over parameters list to accomplish it. Something like: let rec parseCmdLnArgs = function | [] -> { OutputFile = None ; OtherParam = None } | "/out" :: fileName :: rest -> let parsedRest = parseCmdLnArgs rest ...

Using InvariantCultureIgnoreCase instead of ToUpper for case-insensitive string comparisons

On this page, a commenter writes: Do NOT ever use .ToUpper to insure comparing strings is case-insensitive. Instead of this: type.Name.ToUpper() == (controllerName.ToUpper() + "Controller".ToUpper())) Do this: type.Name.Equals(controllerName + "Controller", StringComparison.InvariantCultureIgnoreCase) Why is this way p...

gcc ignore casing of symbol names while linking

A software I am working on ships with NETLIB BLAS/LAPACK embedded into its sources using all-lowercase symbol names but now while porting the application to windows I discovered that Intel MKL and several other BLAS/LAPACK implementations for this platform use all-uppercase symbol names. Is there a way to tell the gnu compiler/linker to ...

Rails Routes - How to make them case insensitive?

Routes in Ruby on Rails are case sensitive. It seems someone brought this up before, and it has been labeled will not fix. http://rails.lighthouseapp.com/projects/8994/tickets/393-routes-are-case-sensitive That strikes me as unfortunate, as I don't really see any upside on my own application for routes to be case sensitive, while on th...

Is VB Really Case Insensitive?

I'm not trying to start an argument here, but for whatever reason it's typically stated that VB is case insensitive and C languages aren't (and somehow that is a good thing). But here's my question: Where exactly is VB case insensitive? When I type... Dim ss As String Dim SS As String ...into the VS2008 or VS2010 IDE the second one h...

Option Compare Text in Classic ASP

This should be a TOTAL no-brainer, but I haven't really written any classic ASP code in like 10 years and just cannot remember how to do this, and can't find it on google. All I'm looking to do is to set a Classic ASP page to use Option Compare Text, but I cannot remember the syntax for this. I've tried all of the following, as the fir...

Case-insensitive find_or_create_by_whatever

I want to be able to do Artist.case_insensitive_find_or_create_by_name(artist_name)[1] (and have it work on both sqlite and postgreSQL) What's the best way to accomplish this? Right now I'm just adding a method directly to the Artist class (kind of ugly, especially if I want this functionality in another class, but whatever): def sel...

Why can't I define a case-insensitve Dictionary in C#?

This C#/WPF code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigatio...

Sort a list of tuples without case sensitivity

How can I efficiently and easily sort a list of tuples without being sensitive to case? For example this: [('a', 'c'), ('A', 'b'), ('a', 'a'), ('a', 5)] Should look like this once sorted: [('a', 5), ('a', 'a'), ('A', 'b'), ('a', 'c')] The regular lexicographic sort will put 'A' before 'a' and yield this: [('A', 'b'), ('a', 5), ('...

How to make this .htaccess rule case insensitive?

This is a rule in my .htaccess # those CSV files are under the DOCROOT ... so let's hide 'em <FilesMatch "\.CSV$"> Order Allow,Deny Deny from all </FilesMatch> I've noticed however that if there is a file with a lowercase or mixed case extension of CSV, it will be ignored by the rule and displayed. How do I make this case insensiti...

Can PHP's glob() be made to find files in a case insensitive manner?

I want all CSV files in a directory, so I use glob('my/dir/*.CSV') This however doesn't find files with a lowercase CSV extension. I could use glob('my/dir/*.{CSV,csv}', GLOB_BRACE); But is there a way to allow all mixed case versions? Or is this just a limitation of glob() ? ...

Django/MySQL - __istartswith not producing case-insensitive query.

I make use of generic views and I am attempting to query my MySQL db (utf8_bin collation) in a case insensitive manor to try to find all my song titles that start with a particular letter. view.py def tracks_by_title(request, starts_with): return object_list( request, queryset = Track.objects.filter(title__istartswi...

javascript: ignoring case sensitivity of strings

In JavaScript, I'm trying using the user's input to search my database. For example, user input is "monster", and my database's data is "Monster". How can I have it match regardless of it's casing? ...

PostgreSQL + Rails citext

I am trying to move to heroku which uses PostgreSQL 8.4 which has a citext column type which is nice since the app was written for MySQL. Is there any way to use :citext with rails (so that if the migrations are run on MySQL the citext would just use string/text? I found this ticket, but it seems like it isn't going to be a part of rai...

Using Linq-To-SQL I'm getting some weird behavior doing text searches with the .Contains method. Looking for Help or Thoughts on what I am doing wrong.

I have a table, where I need to do a case insensitive search on a text field. If I run this query in LinqPad directly on my database, it works as expected Table.Where(tbl => tbl.Title.Contains("StringWithAnyCase")) // also, adding in the same constraints I'm using in my repository works in LinqPad // Table.Where(tbl => tbl.Title.Contai...

Dictionary<string,T>(StringComparer) vs Dictionary<string,T> and storing key.ToUpper : Which one should you prefer?

Disclaimer: Maybe be micro-YAGNI-optimizing but hear me out .. The problem is to implement a case-insensitive lookup table. My old-skool way: While populating the dictionary, upper-case the key before inserting. Upper-case the key when someone gives you a key to lookup. The new way (I learned about it today): Dictionary takes in an IC...

C# matching two text files, case sensitive issue

What I have is two files, sourcecolumns.txt and destcolumns.txt. What I need to do is compare source to dest and if the dest doesn't contain the source value, write it out to a new file. The code below works except I have case sensitive issues like this: source: CPI dest: Cpi These don't match because of captial letters, so I get i...