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
T

the_jat

@the_jat
About
Posts
21
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Use same objects to access DB and WebService
    T the_jat

    led mike wrote:

    might be wasting it answering you in one forum when an entire conversation with you is going on in another forum

    First not every question demands a length conversation, and this is one of them. and this tiny little thing didn't got through your brain. How could it have been when you were jumping around forums just to see what went wrong. Also, If some one cross-posts he/she should take responsibility for managing all conversations, you probably wouldn't have done that, but again not everyone is stupid like you. also I don't believe people cannot manage conversations with 4-5 individuals at the same time. and if the issues has been resolved in one of the posts, the one who started can politely thank those who participated and notify them about the status. Thats how it could work.

    led mike wrote:

    freely gives there time

    You cared to give a 1-rating to all the posts and reply with a stupid message. It seems you did jump like a frog, Now, everyone knows how you use your time, you undoubtedly are dumb.

    led mike wrote:

    period, end of story

    Put one on your mouth and one on yourself. That would help you

    led mike wrote:

    JUMP.

    you are good at it, so you do it, i'll just watch.

    Web Development database com

  • Use same objects to access DB and WebService
    T the_jat

    Yes, very helpful, but I hope you do realize that the question spans many fields, and expert in any of them could have the answer.

    Web Development database com

  • Use same objects to access DB and WebService
    T the_jat

    Hello All, Is there a way that I can create objects that will allow me to access DB(like edmx) and use the same objects in webservice also, How good are Persistence Ignorance (POCO) Adapter for Entity Framework[^] Web Service Software Factory: Modeling Edition[^] for the solution. Thanks

    XML / XSL database com

  • Use same objects to access DB and WebService
    T the_jat

    Hello All, Is there a way that I can create objects that will allow me to access DB(like edmx) and use the same objects in webservice also, How good are Persistence Ignorance (POCO) Adapter for Entity Framework[^] Web Service Software Factory: Modeling Edition[^] for the solution. Thanks

    LINQ database com

  • Use same objects to access DB and WebService
    T the_jat

    Hello All, Is there a way that I can create objects that will allow me to access DB(like edmx) and use the same objects in webservice also, How good are Persistence Ignorance (POCO) Adapter for Entity Framework[^] Web Service Software Factory: Modeling Edition[^] for the solution. Thanks

    Web Development database com

  • Generate Dynamic XAML
    T the_jat

    Is there a way I can create forms dynamically(not load, but create), and get the XAML of the form as the output. Is there a tool that can do it? In which I could specify the location and type of control I want to put on the form? Thanks

    WPF wpf question

  • Linq-Entities return null if non existent
    T the_jat

    i have a query like: var z = from a in ab.apple from b in ab.banana from c in ab.cherry where a.color==b.color &&..........&&... select new { a.color, b.color..........}; what i want is that if the table banana is empty, then instead of returning 0 results, the query return values where b.___ are set to null and all others are populated. this is what happens in E-SQL with eager loading could anyone tell how i could achieve that or how can i explicity define the type of join i want to use in linq-entities? Thanks

    LINQ

  • Count taking too long in nested query
    T the_jat

    I am trying to retreive an entire object(including related/nested objects -- there are 2 such collections in the object) using the Include Method(Eager-Loading) i am calling this object as "EveryThing" and 2 of its contained collections as A and B. i also need to retreive "EveryThing" based on wether a '=' or LIKE condition is satisfied in A. i.e. i am checking something like "EveryThing".A.FirstName=="abc", then retrieve "EveryThing" and its two collections. The query is like:

    string searchQuery1 = @"SELECT VALUE TOP(20) sSet FROM EveryThing as sSet where sSet.SPERID LIKE '%1020%' AND COUNT(SELECT VALUE A.ADR FROM sSet.SADDR AS A WHERE A.ADR LIKE '%BOR%') >= 0";

    The query executes fine and returns prefect results, the problem is that it takes around 6-7 minutes to retrieve 20 results. if on the other hand we use EXISTS, the query takes only a fraction of second to execute. I know that exists works, but what is wrong with COUNT? , also is there some other way to acomplish the same thing? Also is there a tool that can help build Entity SQL queries, do the typechecking and other stuff?

    LINQ

  • Eager-Loading not working
    T the_jat

    I have a object lets call it All. All has a navigation prop to A and B, so do A and B have to All. i am trying to do something like: ObjectQuery set = context.CreateQuery(searchQuery).Include("All.B"); OR ObjectQuery set = context.CreateQuery(searchQuery).Include("All").Include("All.B"); i.e. trying to get from A->All->B, so that entire data is returned to retrive all contens of B,. the query executes fine, but the returned results are null for B everything else is fine Can u tell what went wrong, or if this is even possible, if so then how?

    LINQ

  • Regular Expressions
    T the_jat

    Hi! everyone, Regular Expression sometimes match empty strings, can someone tell me why it happens and what is the use of matching empty strings(why have the original designers made it that way)? Here are some examples: In these examples, the "Pattern" is the Pattern used for matching and the "MatchWith" is the string that is evaluated. The "Count" is the number of hits, and finally "Occurrences" lists all of them. Following is the output of a console application.

    Pattern: \d*
    MatchWith: 34544
    String: 34544, Pattern: \d*, Match: |TRUE|
    M String: 34544, Position: 0, Count: 2, S Length: 5
    Occurences:
    String: 34544, Length: 5, Position: 0, Success: True
    String: , Length: 0, Position: 5, Success: True

    The above example matches an empty string, why?

    Pattern: \d*
    MatchWith: dfgdr
    String: dfgdr, Pattern: \d*, Match: |TRUE|
    M String: , Position: 0, Count: 6, S Length: 5
    Occurences:
    String: , Length: 0, Position: 0, Success: True
    String: , Length: 0, Position: 1, Success: True
    String: , Length: 0, Position: 2, Success: True
    String: , Length: 0, Position: 3, Success: True
    String: , Length: 0, Position: 4, Success: True
    String: , Length: 0, Position: 5, Success: True

    The above example matches 6 empty strings, more than the actual length of the input string, why? Following are examples of Lookahead:

    Pattern: (?=.*\d)
    MatchWith: 44
    String: 44, Pattern: (?=.*\d), Match: |TRUE|
    M String: , Position: 0, Count: 2, S Length: 2
    Occurences:
    String: , Length: 0, Position: 0, Success: True
    String: , Length: 0, Position: 1, Success: True

    Above: again an empty string.

    Pattern: (?=.*\d)
    MatchWith: dfg
    String: dfg, Pattern: (?=.*\d), Match: |FALSE|
    M String: , Position: 0, Count: 0, S Length: 3
    Occurences:

    Above: same failed with strings as input: "FALSE"

    Pattern: (?=.*\d)
    MatchWith: fgd3
    String: fgd3, Pattern: (?=.*\d), Match: |TRUE|
    M String: , Position: 0, Count: 4, S Length: 4
    Occurences:
    String: ,

    C# regex question tutorial

  • Synchronization via Locks
    T the_jat

    CPallini wrote:

    OK, so how may you use it (i.e. How may Go be ever called?)?

    Though the author would know better, but one could also do something like:

    public void GoGo()
    {
    ........
    ........
    if(....)
    ThreadSafe.Go();// OR Go();
    else
    GoGoGo();
    ........
    }

    C# question csharp help learning

  • Synchronization via Locks
    T the_jat

    Thanks a lot! I finally got it! :-D

    C# question csharp help learning

  • Synchronization via Locks
    T the_jat

    Thanks! Since the variables are private in the code, I think the author would have used properties and used the lock in the set part, (as the object locker is static), so that no other thread can modify the variables in the mean time. Do you think that would work? Here is the code again:

    class ThreadSafe
    {
    static object locker = new object( );
    static int val1, val2;

    static void Go( )
    {
    lock (locker)
    {
    if (val2 != 0) Console.WriteLine (val1 / val2);
    val2 = 0;
    }
    }
    }

    Thanks again!

    C# question csharp help learning

  • Synchronization via Locks
    T the_jat

    Thanks for the reply, but

    N a v a n e e t h wrote:

    This will not happen as if condition and modifying variable is in the lock

    Did you mean the "modifying variable" or the "statement that modifies the variable"? Can a lock prevent public static variables of a public class from being modifed by other class running other threads? Thanks!

    C# question csharp help learning

  • Synchronization via Locks
    T the_jat

    Thanks for the answer. I think that locks are more of a design thing, they do not protect anything(object..) by themself, but only restrict other threads to enter a code,, so the programmer is left with the arrangements of the lines-of-code that do and donnot modify a variable. I think the nutshell author was wrong when he said that the lock protected the variables, when infact it was the arrangement of the code such that no line-of-code which modified the ... :doh: So would you say that locks :doh: I'm confused Could you refer me to a book or an article that would not say that "lock enforce exclusive access to a resource", when infact(I think) they dont, and tell exactly what locks do and any good programming practice related to locks? Thanks :)

    C# question csharp help learning

  • Synchronization via Locks
    T the_jat

    CPallini wrote:

    I suppose it is...

    The author didn't use the "public" keyword, the code posted is correct. Thanks

    C# question csharp help learning

  • Synchronization via Locks
    T the_jat

    In the book C# 3.0 in a Nutshell, chapter on threading, the author while explaining the locks, says: "The following class is not thread-safe: if Go was called by two threads simultaneously, it would be possible to get a division-by-zero error, because val2 could be set to zero in one thread right as the other thread was in between executing the if statement and Console.WriteLine."

    class ThreadUnsafe
    {
    static int val1, val2;

    static void Go( )
    {
    if (val2 != 0) Console.WriteLine (val1 / val2);
    val2 = 0;
    }
    }

    The author then gives the following class and says that: "In this case, we're protecting the logic inside the Go method, as well as the fields val1 and val2."

    class ThreadSafe
    {
    static object locker = new object( );
    static int val1, val2;

    static void Go( )
    {
    lock (locker)
    {
    if (val2 != 0) Console.WriteLine (val1 / val2);
    val2 = 0;
    }
    }
    }

    My question: I get that two threads cannot enter the lock construct at the same time, but still one thread can(I guess) modify the static variables as the other is executing the if statement, which would again lead to a division by zero error. What I dont' understand is that how this lock construct protects the static variables from being modified by other threads. Furthermore, if the static variables can be modified, what is the use of this lock construct and what exactly the author meant? Thanks :)

    C# question csharp help learning

  • ReaderWriterLock
    T the_jat

    Hi everyone! I wanted to know how the ReaderWriterLock determines what is the "resource" in the code on which it has to accquire the reader lock or the writer lock, or how exactly does these locks work(internally). The MSDN article protects an static integer, but doesn't seem to specify how, as after acquiring a reader lock, writes can be done as in the following code:

    ReaderWriterLock rw = new ReaderWriterLock();
    int counter = 0;
    try
    {
    rw.AcquireReaderLock(100);
    try
    {
    Interlocked.Increment(ref counter);
    }
    finally
    {
    rw.ReleaseLock();
    }
    }
    catch (ApplicationException)
    {
    Console.WriteLine("Failed");
    }
    Console.WriteLine(counter);

    here we are acquiring an reader lock for 100ms, but writing to the data. Confused :doh:

    C# question learning

  • All Indians and related....
    T the_jat

    It is a devastating documentary about the 200 years of British rule in India which ended in 1947 with a hasty and shambolic carve-up of the land between India and Pakistan. Sadly for those there at the time, harmony gave way to mob hatred and many lives were lost. This documentary looks to piece together the reminiscences of eyewitness. The accounts of the huge massacres are particularly chilling. Of course, with such a heavy subject, the mood of the show is grim, powerful, but nevertheless, fascinating. The events that unfolded in the last throes of the Empire are still resonating today, making this show a must-see. Over at the RT, they drily observe that "Lord Mountbatten's daughter describes the opulence of the viceroy's residence, where they found 25 indoor gardeners and one servant whose job it was to carry a seal that bore the British crown, with which he would stamp every single pat of butter. If only they'd taken such care over the big things." I'm not forcing anyone to watch it (nor I can);; just recommending it as a must watch. (Considering you as a grown-up and mature)-->You would understand it if you wanted to.

    The Lounge

  • All Indians and related....
    T the_jat

    must watch: http://www.mininova.org/tor/1980362[^]

    The Lounge
  • Login

  • Don't have an account? Register

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