Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

gnjunge

@gnjunge
About
Posts
242
Topics
30
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Generics Casting [modified]
    G gnjunge

    That's great.

    C# tutorial

  • Generics Casting [modified]
    G gnjunge

    For now I made my own work around. The code has changed multiple times, and I'm sure there was a reason for using generics. Have to check it when I have time.

    C# tutorial

  • Generics Casting [modified]
    G gnjunge

    Thanks. Great explanation. I guess I'm not the only one who bumps into this. Any known workarounds? Or rethink the whole implementation from scratch?

    C# tutorial

  • Generics Casting [modified]
    G gnjunge

    Am I missing something, or the example below is really impossible. The class called FirstImplementation derives from GenericClass, and the generic parameter used, FirstClass derives from Base. So from the outside I should be able to cast FirstImplementation to GenericClass

    public class Base
    {
        public int X { get; set; }
    }
    
    public class FirstClass : Base
    {
        public int Y { get; set; }
    }
    
    public abstract class GenericClass<T> where T: Base
    {
        public T Item { get; set;}
    }
    
    public class FirstImplementation : GenericClass<FirstClass>
    {
        public GenericClass<Base> Cast()
        {
            return (GenericClass<Base> )this; // --> doesn't work
    
        }
    }
    

    modified on Thursday, January 15, 2009 6:18 AM

    C# tutorial

  • Making shortcuts even shorter
    G gnjunge

    Could be, only the project is very new (1 month old) and this function is used on 1 page only (so it was not much work to do a Search & Replace on 1 page).

    The Weird and The Wonderful javascript announcement

  • Query Question
    G gnjunge

    Thanks for all the help in brainstorming. The solution works perfect!

    Database question database

  • Making shortcuts even shorter
    G gnjunge

    That's very considerate of you!

    The Weird and The Wonderful javascript announcement

  • Query Question
    G gnjunge

    Not sure if you understood the requirement. In the car case the question/query would be: give me all cars that have at least partid('s) x,y,z (in which x,y,z can be also only one specific part or a number of specific parts). Or in the article/word case: give me all articles that have at least the following words in them.

    Database question database

  • Query Question
    G gnjunge

    The app is a matching app. So you could also change car and part to article and word, in which i want to find all articles that have at least some (1 or more) given words. No specific reason again dynamic sql, but always want to know the best way before resorting to dynamic sql which is less maintainable then pure sql.

    Database question database

  • Query Question
    G gnjunge

    I didn't mean the sum of the part ID's , but the number of parts (that were returned in the query) per car. so if we have the following

    carid partid
    1 2
    1 3
    1 4
    2 2
    2 5
    3 2
    3 3
    3 4
    3 5

    and i would be looking for cars with parts 2, 3, and 4. I would first select all the cars that have at least one of the 3 parts, so cars 1, 2 and 3:

    carid partid
    1 2
    1 3
    1 4
    2 2
    3 2
    3 3
    3 4

    Note that car 2 has now only one record, and car 3 only has 3. Then I count how many records per car:

    carid count parts
    1 3
    2 1
    3 3

    I know I was looking for 3 parts, so I select carid 1 and 3. I guess these steps can go into one query.

    Database question database

  • Query Question
    G gnjunge

    Actually just thought of something: select all cars that have at least one of the specific part ids, group on car and it's sum of parts and select only those that have the correct sum of parts. This way no dynamic sql is needed. Didn't try it yet so don't know if this is viable or fast enough.

    Database question database

  • Making shortcuts even shorter
    G gnjunge

    I found this in JS:

    function toggleDiv(divName)
    {
    $(divName).toggle();
    }

    So using the shortcut: toggleDiv('foo');, we would end up with 17 characters. Using the unusual long version: $('foo').toggle();, we would end up with 18 characters.

    The Weird and The Wonderful javascript announcement

  • Query Question
    G gnjunge

    But the number of parts can vary. The solution you show is good in case there is a constant number of parts. Is in my case the only solution a dynamic query?

    Database question database

  • Query Question
    G gnjunge

    Thanks, but what happens if I have more than two parts (forgot to add that the number of parts is variable and can range between 1 and up).

    Database question database

  • Query Question
    G gnjunge

    Hi, Suppose I have the following table:

    CarID PartID
    1 4
    1 5
    1 7
    2 4
    2 6
    3 5
    3 7
    4 8

    Now I want to select each Car that has both parts 5 and 7 (which are cars 1 and 3), what would be the best query? I started with some join, but saw it didn't give the right results. This query should be able to run under heavy stress. Thank you all

    Database question database

  • Duplicate in join
    G gnjunge

    This seems like it would be very slow, or isn't it? I guess in the end the names table would contain around 10.000 records,whereas the nicknames table would contain around 50.000

    Database database help question

  • Duplicate in join
    G gnjunge

    Random, I don't care which one he returns.

    Database database help question

  • Duplicate in join
    G gnjunge

    Hi, This must be real simple, but I'm having a blackout. I have two tables: Names:

    ID Name
    1 John
    2 Peter
    3 Carl
    4 Bernard

    Nicknames:

    ID NameID NickName
    1 1 Bonny
    2 1 Bobby
    3 1 Jo
    4 2 Pete
    5 3 Bab
    6 3 Foo

    Now I have a search running, which looks for a certain string in both the nickname field as well as in the name field. But it should return only 1 record per name (doesn't matter which nickname), so if the seachstring would be 'b%' it would return the following.

    NameID NickNameID Name Nickname
    4 null Bernard null
    1 1 John Bonny
    3 5 Bernard Bab

    I fall on the distinct record thing for the nicknames, I have a dirty subselect, but since the query is actually much bigger, and the table contains 100.000 records, it isn't the right solution. Does anybody have the correct solution to this issue?

    Database database help question

  • Composite Collection binding problem [modified]
    G gnjunge

    No I didn't. I also stopped momentarily with the project for which I needed it for. So come to making a workaround.

    WCF and WF help question wpf wcf data-structures

  • Gaia Ajax - recommended yes or no
    G gnjunge

    Anybody uses Gaia ajax widgets, http://ajaxwidgets.com/[^]? And what is your experience? Seems like a good alternative for MS asp.net ajax. My reason for not going for MS asp.net Ajax : heavy and confusing client script library, so bad performance, and hard to extend. Thanks, Gidon

    ASP.NET question csharp asp-net com tools
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups