hate these ads?, log in or register to hide them
Page 132 of 132 FirstFirst ... 3282122129130131132
Results 2,621 to 2,628 of 2628

Thread: <xml><thread isTerrible="true" isUnderstandable="false" /></xml> - Coding help thread

  1. #2621

    Join Date
    May 31, 2011
    Posts
    6,308
    Hi there, it's me again with another C#(?) question.

    Though I'm not sure if this is limited to C# or if it's more of a general .NET / VS oddity. And I already have a working (and proper, I think) solution for this. I'm just curious as to why this happens.

    I'm working on an application that doesn't do anything special security/permission-wise. It reads data from a XML file and updates a SQL database. Nothing out of the ordinary, nothing I haven't done before (in VB.NET). What's strange though that a regular build of the application, with basically default out-of-the-box project property settings, this application raises an administrative UAC prompt. The solution is to add a custom manifest with
    Code:
    <requestedExecutionLevel level="asInvoker" />
    This ofc works and the application has no issues doing its job. But why does it throw it in the first place?

    [Fake edit]
    Now that I wrote that I remember that there's this thing called Installer Detection Technology.

    tl;dr
    Certain terms like "install", "setup" or "update" in an application's executable name trigger UAC

    And sure enough, my application has "update" in its name.

    I'll leave this here for others, though.

  2. #2622

    Join Date
    May 31, 2011
    Posts
    6,308
    (MS) SQL query time.

    Given these 3 tables, obviously an address database allowing for multiple adresses per entity in Table1
    Code:
    Table1
    	* ID
    	* Lastname
    	* Firstname
    	
    Table2
    	* IDTable1 -- 1:1 relation Table2.IDTable1: Table1.ID
    	* IDTable3 -- 1:n relation Table2.IDTable3: Table3.ID
    	
    Table3
    	* ID
    	* Street
    	* PostalCode
    	* City
    	* NumValue
    ... I'm trying to create a query that returns columns from Table1 and Table3 (got that part figured out), but only return the rows of Table3 with the lowest NumValue

    What I tried so far always results in multiple rows due to the 1:n relation in Table2, e.g.

    Code:
    SELECT
    	t1.ID
    	, t1.Firstname
    	, t1.Lastname
    	, t2.IDTable3
    	, t3.Street
    	, t3.PostalCode
    	, t3.City
            , t3NumValue
    	FROM Table2 t2
    	INNER JOIN Table1 t1 ON t1.ID = t2.IDTable1
    	INNER JOIN Table3 t3 ON t3.ID = t2.IDTable3
    Ofc, when there are multiple rows in Table2 with identical IDTable1 columns, this results in something like
    Code:
    1 | First Name | Last Name | Street 123 | 123 | City | 3
    1 | First Name | Last Name | Avenue 456 | 456 | Village | 2
    I've tried variations like using a subquery for the 2nd JOIN with SELECT TOP 1, but then the whole query only returns 1 row although there are obviously more.

    In the result example above, I only need the second row.
    Last edited by Hel OWeen; March 2 2022 at 10:17:03 AM.

  3. #2623
    GeromeDoutrande's Avatar
    Join Date
    April 10, 2011
    Location
    Fakefrenchistan
    Posts
    3,965
    group by t1.id and then do min(t3.numvalue)?

  4. #2624

    Join Date
    May 31, 2011
    Posts
    6,308
    In my initial attempts, I also tried variations with GROUP BY with not much success ... which may totally be to my limited SQL knowledge.

    That said, a working solution is using OUTER APPLY:
    Code:
    SELECT 
    	LastName, 
    	FirstName, 
    	(more columns)
    FROM Table1 t1
    OUTER APPLY
    (SELECT TOP 1
    	IDTable1, 
    	IDTable3
    FROM Table2
    WHERE IDTable1 = t1.ID
    ) AS  t2
    LEFT JOIN Table3 t3 ON t2.IDTable3 = t3.ID

  5. #2625
    halka's Avatar
    Join Date
    April 19, 2011
    Location
    SVK
    Posts
    2,135
    One of these days I really should take a good look at all the fancy advanced SQL stuff.
    All expressed opinions match those of my employers, hail satan

  6. #2626
    NoirAvlaa's Avatar
    Join Date
    April 12, 2011
    Location
    Portugal, laaaa
    Posts
    6,401
    postgresql nerds, is it common to have row level security on all tables? Or how do I make sure the users can't fuck up data that isn't theirs?
    Quote Originally Posted by Djan Seriy Anaplian View Post
    Also that didn't sound like abloo bloo to me, PM me and we can agree on a meeting spot and settle this with queensberry rules, that's a serious offer btw. I've been a member of this community since 2005 and i've never met a more toxic individual.

  7. #2627
    Movember 2011Movember 2012 Nordstern's Avatar
    Join Date
    April 10, 2011
    Posts
    13,279
    My company is adopting some new tools to make our lives a bit easier. One of those tools uses Python code, so the IEs in my group have been asked to learn Python. I don't believe the company has allocated any money for Python training, so they're learning on their own. Any good starter tutorials you people use?
    "Holy shit, I ask you to stop being autistic and you debate what autistic is." - spasm
    Quote Originally Posted by Larkonis Trassler View Post
    WTF I hate white people now...
    Johns Hopkins CSSE COVID-19 Dashboard (updated link)

  8. #2628

    Join Date
    May 31, 2011
    Posts
    6,308
    Maybe worth a look: https://github.com/vinta/awesome-python#websites. And maybe check out Humble Bundle from time to time for a Python book bundle.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •