hate these ads?, log in or register to hide them
Page 129 of 129 FirstFirst ... 2979119126127128129
Results 2,561 to 2,568 of 2568

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

  1. #2561

    Join Date
    April 14, 2011
    Posts
    7,274
    There's no titleCase(..) method in PS?

  2. #2562

    Join Date
    May 31, 2011
    Posts
    4,809
    Well, both methods don't work reliably with the typical suspects like McDonald, van Helsing, D'Acosta anyway. So I'm not sure of how much use it is in real world applications.

  3. #2563

    Join Date
    May 30, 2011
    Location
    asleep
    Posts
    6,819
    I'm importing 600 mail users and about 2/3 of them are all NAMED IN UPPER CASE and it's fucking annoying
    there does seem to be an approximation of Titlecase now you mention it:
    Code:
    $info = (get-culture).textinfo
    $input = read-host "Input string" 
    $info.titlecase($input.tolower())
    a bit neater thanks
    Please don't teach me what to do with my pc.

  4. #2564

    Join Date
    May 31, 2011
    Posts
    4,809
    Quote Originally Posted by Itiken View Post
    I'm importing 600 mail users and about 2/3 of them are all NAMED IN UPPER CASE and it's fucking annoying
    Most likely because THEY ARE IMPORTANT!!! ;-)

    But I feel your pain. There are admins that when dealing with a new system for the first time look around how things have been done and follow those standards. They might or might not agree with it, but they try to follow what's already there.

    And then there are those who do like they please. Not even following their personal conventions, because they have none. Today it was all lower case, today it's proper casing, tomorrow it'll be upper case. I shudder and cringe when coming across such inconsistencies. It buggers me to no end.

  5. #2565

    Join Date
    May 31, 2011
    Posts
    4,809
    Here's a question to which I haven't found a satisfying answer yet.

    Suppose a method for deleting a file in an assembly. What's considered to be best practice for such a case?

    Return a method result indicating a problem/failure.
    Code:
    Enum IOResult
    	Success = 0
    	FileNotFound
    	AccessDenied
    	OtherUnknown = 255
    End Enum
    
    Function DeleteFile(ByVal theFile As String) As IOResult
    	If Not File.Exists(theFile) Then
    	   Return IOResult.FileNotFound
    	End If
    End Function
    Throw an exception
    Code:
    Sub DeleteFile(ByVal theFile As String)
    	If Not File.Exists(theFile) Then
               Throw New ArgumentException("File not found: " & theFile)
    	End If
    End Sub

  6. #2566
    Daneel Trevize's Avatar
    Join Date
    April 10, 2011
    Location
    T L A
    Posts
    12,620
    In theory? If that Enum result is type-safe as per the (JIT) compiler, and it can be made public/final without future refactoring concerns, that should be faster and cleaner than exception handling.
    Quote Originally Posted by QuackBot View Post
    Idk about that, and i'm fucking stupid.

  7. #2567

    Join Date
    May 31, 2011
    Posts
    4,809
    Can someone recommend a decent Python 3 beginner's tutorial for someone like me with a programming background?

    Ofc, there's this list at python.org and also (too) many search results. The crux for a beginner is to tell the good ones apart from the bad ones.

    Usage will be devops-related, so I guess tutorials involving/focusing around e.g. GUI widgets/desktop application/web development (Django)/data analysis aren't of much help there.

  8. #2568

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
  •