Search Results

Search found 24731 results on 990 pages for 'corner case'.

Page 7/990 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • How to do case-insensitive order in Rails with postgresql

    - by brad
    I am in the process of switching my development environment from sqlite3 to postgresql 8.4 and have one last hurdle. In my original I had the following line in a helper method; result = Users.find(:all, :order => "name collate NOCASE") which provided a very nice case-insensitive search. I can't replicate this for postgresql. Should be easy - any ideas? Thanks.

    Read the article

  • Sort a list of tuples without case sensitivity

    - by dound
    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), ('a', 'a'), ('a', 'c')]

    Read the article

  • Simple way to create possible case

    - by bugbug
    I have lists of data such as a = [1,2,3,4] b = ["a","b","c","d","e"] c = ["001","002","003"] And I want to create new another list that was mixed from all possible case of a,b,c like this d = ["1a001","1a002","1a003",...,"4e003"] Is there any module or method to generate d without write many for loop?

    Read the article

  • Sql case that will use a current table

    - by Dana Ezer
    I have an sql statement that returns this result below,and I want that the num will drag the latest(by date) num that is not null. I can't get it right. I want to add somthing like this: case when num is null then max(num where date<my_date) my result now: Date num 1.1 0 2.1 1 3.1 NULL 4.1 NULL 5.1 4 what I want: Date num 1.1 0 2.1 1 3.1 1 4.1 1 5.1 4

    Read the article

  • mysql custom sorting first alpha then numeric using case when

    - by Nizzy
    How can you sort a query using ORDER BY CASE WHEN REGEXP? or other alternatives? I don't want to use UNION. Thank you mysql> SELECT `floor_id`, `floor_number` FROM `floors`; +----------+--------------+ | floor_id | floor_number | +----------+--------------+ | 1 | 4 | | 2 | 7 | | 3 | G | | 4 | 19 | | 5 | B | | 6 | 3 | | 7 | A | +----------+--------------+ Expected result: +----------+--------------+ | floor_id | floor_number | +----------+--------------+ | 7 | A | | 5 | B | | 3 | G | | 6 | 3 | | 1 | 4 | | 2 | 7 | | 4 | 19 | +----------+--------------+

    Read the article

  • MySQL: Use CASE/ELSE value as join parameter

    - by DRJ
    I'm trying to join the NAME and PHOTO from USERS table to the TRANSACTIONS table based on who is the payer or payee. It keeps telling me can't find the table this -- What am I doing wrong? SELECT name,photo,amount,comment, ( CASE payer_id WHEN 72823 THEN payee_id ELSE payer_id END ) AS this FROM transactions RIGHT JOIN users ON (users.id=this) WHERE payee_id=72823 OR payer_id=72823

    Read the article

  • Swapping switch-case in extra fle/data structure (Java)

    - by poeschlorn
    Hi guys, it may be a nooby question, but I've never needed it before: I have several strings and I want to compare them to given ones... At first glance it would lead to a switch/case construction in what every available entry is checked. Is there a more elegant way to swap those strings as key/value datas? greets, poeschlorn

    Read the article

  • Oracle Data Mining a Star Schema: Telco Churn Case Study

    - by charlie.berger
    There is a complete and detailed Telco Churn case study "How to" Blog Series just posted by Ari Mozes, ODM Dev. Manager.  In it, Ari provides detailed guidance in how to leverage various strengths of Oracle Data Mining including the ability to: mine Star Schemas and join tables and views together to obtain a complete 360 degree view of a customer combine transactional data e.g. call record detail (CDR) data, etc. define complex data transformation, model build and model deploy analytical methodologies inside the Database  His blog is posted in a multi-part series.  Below are some opening excerpts for the first 3 blog entries.  This is an excellent resource for any novice to skilled data miner who wants to gain competitive advantage by mining their data inside the Oracle Database.  Many thanks Ari! Mining a Star Schema: Telco Churn Case Study (1 of 3) One of the strengths of Oracle Data Mining is the ability to mine star schemas with minimal effort.  Star schemas are commonly used in relational databases, and they often contain rich data with interesting patterns.  While dimension tables may contain interesting demographics, fact tables will often contain user behavior, such as phone usage or purchase patterns.  Both of these aspects - demographics and usage patterns - can provide insight into behavior.Churn is a critical problem in the telecommunications industry, and companies go to great lengths to reduce the churn of their customer base.  One case study1 describes a telecommunications scenario involving understanding, and identification of, churn, where the underlying data is present in a star schema.  That case study is a good example for demonstrating just how natural it is for Oracle Data Mining to analyze a star schema, so it will be used as the basis for this series of posts...... Mining a Star Schema: Telco Churn Case Study (2 of 3) This post will follow the transformation steps as described in the case study, but will use Oracle SQL as the means for preparing data.  Please see the previous post for background material, including links to the case study and to scripts that can be used to replicate the stages in these posts.1) Handling missing values for call data recordsThe CDR_T table records the number of phone minutes used by a customer per month and per call type (tariff).  For example, the table may contain one record corresponding to the number of peak (call type) minutes in January for a specific customer, and another record associated with international calls in March for the same customer.  This table is likely to be fairly dense (most type-month combinations for a given customer will be present) due to the coarse level of aggregation, but there may be some missing values.  Missing entries may occur for a number of reasons: the customer made no calls of a particular type in a particular month, the customer switched providers during the timeframe, or perhaps there is a data entry problem.  In the first situation, the correct interpretation of a missing entry would be to assume that the number of minutes for the type-month combination is zero.  In the other situations, it is not appropriate to assume zero, but rather derive some representative value to replace the missing entries.  The referenced case study takes the latter approach.  The data is segmented by customer and call type, and within a given customer-call type combination, an average number of minutes is computed and used as a replacement value.In SQL, we need to generate additional rows for the missing entries and populate those rows with appropriate values.  To generate the missing rows, Oracle's partition outer join feature is a perfect fit.  select cust_id, cdre.tariff, cdre.month, minsfrom cdr_t cdr partition by (cust_id) right outer join     (select distinct tariff, month from cdr_t) cdre     on (cdr.month = cdre.month and cdr.tariff = cdre.tariff);   ....... Mining a Star Schema: Telco Churn Case Study (3 of 3) Now that the "difficult" work is complete - preparing the data - we can move to building a predictive model to help identify and understand churn.The case study suggests that separate models be built for different customer segments (high, medium, low, and very low value customer groups).  To reduce the data to a single segment, a filter can be applied: create or replace view churn_data_high asselect * from churn_prep where value_band = 'HIGH'; It is simple to take a quick look at the predictive aspects of the data on a univariate basis.  While this does not capture the more complex multi-variate effects as would occur with the full-blown data mining algorithms, it can give a quick feel as to the predictive aspects of the data as well as validate the data preparation steps.  Oracle Data Mining includes a predictive analytics package which enables quick analysis. begin  dbms_predictive_analytics.explain(   'churn_data_high','churn_m6','expl_churn_tab'); end; /select * from expl_churn_tab where rank <= 5 order by rank; ATTRIBUTE_NAME       ATTRIBUTE_SUBNAME EXPLANATORY_VALUE RANK-------------------- ----------------- ----------------- ----------LOS_BAND                                      .069167052          1MINS_PER_TARIFF_MON  PEAK-5                   .034881648          2REV_PER_MON          REV-5                    .034527798          3DROPPED_CALLS                                 .028110322          4MINS_PER_TARIFF_MON  PEAK-4                   .024698149          5From the above results, it is clear that some predictors do contain information to help identify churn (explanatory value > 0).  The strongest uni-variate predictor of churn appears to be the customer's (binned) length of service.  The second strongest churn indicator appears to be the number of peak minutes used in the most recent month.  The subname column contains the interior piece of the DM_NESTED_NUMERICALS column described in the previous post.  By using the object relational approach, many related predictors are included within a single top-level column. .....   NOTE:  These are just EXCERPTS.  Click here to start reading the Oracle Data Mining a Star Schema: Telco Churn Case Study from the beginning.    

    Read the article

  • Use Case Diagrams - should I create a diagram just for a view business rule?

    - by Periback
    I'm modeling a UCD where I have two actors ( a content producer and a developer).. the content producer is going to create and specify details of a storyboard functionality, and the other actor (developer) will only be able to view this storyboard ( he'll log in the application and read the storyboard to start developing what it says, outside the application..) I'm working on the specification of this storyboard functionality and I'd like to know it would be like a best-practice if I describe something like " actor- developer", "UCD - read scenes of storyboard" . This is the specification of an application I developed for my thesis and they asked me to add some specification...

    Read the article

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

    - by TheLizardKing
    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__istartswith=starts_with), template_name = 'tlkmusic_base/titles_list.html', template_object_name = 'tracks', paginate_by = 25, ) and my urls.py urlpatterns = patterns('tlkmusic.apps.tlkmusic_base.views', (r'^titles/(?P<starts_with>\w)/$', tracks_by_title), ) the query it produces according to the django debug toolbar is: SELECT `tracks`.`id`, `tracks`.`url`, `tracks`.`artist`, `tracks`.`album`, `tracks`.`genre`, `tracks`.`year`, `tracks`.`title`, `tracks`.`comment`, `tracks`.`tracknumber`, `tracks`.`discnumber`, `tracks`.`bitrate`, `tracks`.`length`, `tracks`.`samplerate`, `tracks`.`filesize`, `tracks`.`createdate`, `tracks`.`modifydate` FROM `tracks` WHERE `tracks`.`title` LIKE a% LIMIT 1 specifically this line: WHERE `tracks`.`title` LIKE a% LIMIT 1 Why is it not ILIKE which is what I was expecting by using __istartswith? I am using Django 1.1.1 on Ubuntu.

    Read the article

  • DB2 CASE Statement

    - by gamerzfuse
    I need to somehow use the CASE syntax (which is beyond me) to affect the database results based on criteria. I have a bunch of royalties in 0.# form (royalty) I have a title ID # (title_id) and I need to show the new increase in royalties so that I can use the data. IF: they have a current royalty of 0.0 - 0.1 = 10% raise IF: they have 0.11 - 0.15 = 20% raise IF: royalty >= 0.16 = 20% raise Any help would be much appreciated. create table royalites ( title_id char(6), lorange integer, hirange integer, royalty decimal(5,2));

    Read the article

  • Why Switch/Case and not If/Else If?

    - by OB OB
    This question in mainly pointed at C/C++, but I guess other languages are relevant as well. I can't understand why is switch/case still being used instead of if/else if. It seems to me much like using goto's, and results in the same sort of messy code, while the same results could be acheived with if/else if's in a much more organized manner. Still, I see these blocks around quite often. A common place to find them is near a message-loop (WndProc...), whereas these are among the places when they raise the heaviest havoc: variables are shared along the entire block, even when not propriate (and can't be initialized inside it). Extra attention has to be put on not dropping break's, and so on... Personally, I avoid using them, and I wonder wether I'm missing something? Are they more efficient than if/else's? Are they carried on by tradition?

    Read the article

  • PHP making input from web form case insensitive?

    - by Haskella
    So I have some code here that takes user input from a standard web form: $searchsport = $_POST['sport']; $sportarray = array( "Football" => "Fb01", "Cricket" => "ck32", "Tennis" => "Tn43", ); if(isset($sportarray[$searchsport])){ header("Location: ".$sportarray[$searchsport].".html"); die; } How would I go about modifying this (I think the word is parsing?) to make it case *in*sensitive? For example, I type in "fOoTbAlL" and php will direct me to Fb01.html normally.

    Read the article

  • CASE + IF MysQL query

    - by terence6
    Problem is as follows. I have a product that can be in one of three categories (defined by category_id). Each category table has category_id field related to category_id in product table. So I have 3 cases. I'm checking If my product.category_id is in table one. If yes, I take some values. If not I check in tables that are left. What can I write In the ELSE section? Can anyone correct my query ? CASE WHEN IF EXISTS(SELECT * FROM table1 WHERE category_id='category_id') THEN SELECT type_id FROM table1 WHERE category_id='category_id'; WHEN IF EXISTS(SELECT * FROM table2 WHERE category_id='category_id') THEN SELECT value_id FROM table2 WHERE category_id='category_id'; WHEN IF EXISTS(SELECT * FROM table3 WHERE category_id='category_id') THEN SELECT group_id FROM table3 WHERE category_id='category_id'; ELSE "dont know what here"; END;

    Read the article

  • Help with MySQL and CASE WHEN with a range of values

    - by kickdaddy
    I have an accounts table and a records table where accounts have multiple records. I would like to break down the account totals by "count of records" range. i.e. show the breakdown of Count of Records | Count 0-25 | 100 25 - 50 | 122 50 - 100 | 300 etc. I am using the following query, but I can't get it to group by "grp" which is what I want, any help on the best way to modify query? Thanks! SELECT count(*) as ct, CASE WHEN COUNT(*) < 25 THEN '1-25' WHEN COUNT(*) >= 25 < 50 THEN '25-50' WHEN COUNT(*) >= 50 < 100 THEN '50-100' WHEN COUNT(*) >= 100 < 250 THEN '100-250' WHEN COUNT(*) >= 250 < 500 THEN '250-500' WHEN COUNT(*) >= 500 < 1000 THEN '500-1000' ELSE '1000+' END AS grp FROM records r,accounts a WHERE r.account_id=a.id ORDER BY ct

    Read the article

  • case insensitive highlighting in php

    - by fusion
    i'm using this function to highlight the results from mysql query: function highlightWords($string, $word) { $string = str_replace($word, "<span class='highlight'>".$word."</span>", $string); /*** return the highlighted string ***/ return $string; } .... $cQuote = highlightWords(htmlspecialchars($row['cQuotes']), $search_result); the problem is, if i type in 'good', it will only show my search results with a lower-case 'g'ood and not 'Good'. how do i rectify this?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >