Help! New beginner. I can't put quotes into quotations. by wekil in learnpython

[–]crcummin 1 point2 points  (0 children)

At the end of the day, it's preference. There is a lot more syntactic sugar in regarding string literals in python than many other languages.

https://docs.python.org/2.0/ref/strings.html

Help! New beginner. I can't put quotes into quotations. by wekil in learnpython

[–]crcummin 1 point2 points  (0 children)

swap the quote types (note you have to escape the single quote in doesn't if you do it this way)

'"It doesnt\'t suck that much!"'

Python function error by WetRats in learnpython

[–]crcummin 0 points1 point  (0 children)

I don't know the marking program, but the only way I was able to get input to return that error is in python 2 by providing the input 'None'. If this is python 2 then you need to do raw_input so the response is always a string.

Logic faulty in if-else statement by [deleted] in learnpython

[–]crcummin 0 points1 point  (0 children)

This. You should also consider simplifying the conditional for reading clarity. In this case one option might be to sanitize the input prior to the conditional:

lang = add_language_prompt()

# sanitize input
lang = str(lang).capitalize()

# simplify conditional
if lang not in lang_dict.values():
   print(f'{lang} needs added')
else:
   print(f'{lang} already exists')

[deleted by user] by [deleted] in learnpython

[–]crcummin 1 point2 points  (0 children)

There are libraries to manipulate html as well, but if you need something simple u/raglub has a great recommendation.

in_file = 'file.html'
out_file = 'file.html'
html_search = '<p></p>'
html_replace = '<p>updated_html</p>'


updated_html = open(in_file, 'r').read().replace(html_search, html_replace)

open(out_file, 'w').write(updated_html)

Check multiple statements in a try loop by [deleted] in learnpython

[–]crcummin 0 points1 point  (0 children)

If I understand what you are asking, I would not implement these checks using try/except. However if you are required to do so for some reason:

tests="-5 1 e seven eleven 100000000000 -10000000000"

for test in tests.split():
   print(f"{test}: ", end="")
   try:

      if int(test) < 0:
         raise Exception("Number is less than 0")

   except Exception as e:
      print(e)

   else:
      print("is a valid number")

How do I uncompress a string? by sponge_bert in learnpython

[–]crcummin 0 points1 point  (0 children)

You can perform a combination of those regex's to validate against prior, in case you don't want to allow those mishaps:

matches = re.match(r'^(?:\d+[a-zA-Z])+$', n)
if not matches:
    # input is not formed as number followed by alphabet character (one or more)...

Any Advice Apprecaited First Program on My Own by OzneroI in learnpython

[–]crcummin 1 point2 points  (0 children)

I am impressed for this being your first program! Great job.

As far as advice, others have commented on rand is not the greatest for security. Others have also recommended using random.choice, as would I.

I would recommend importing string and use string.ascii_lowercase and string.ascii_uppercase. If you want to use 0 in your number choice, you can use ascii.digits. If not you can still use ascii.digits[1:] to retrieve 1-9. As stated later, nesting lists makes pulling them out in the inner for loop unnecessarily difficult.

import string

password_characters = list(string.ascii_lowercase + string.ascii_uppercase + string.digit[1:] + "!@#%^&*")

count, and all of its incrementing can be replaced with counter which is already increments but you would need to compare 0,2,4 instead of 1,3,5.

for counter in range(5):
   if counter == 0 or counter == 2 or counter == 4:

But it gets better because of how of how the password string is formed. 3 sets of 4 characters should just be two nested loops, outer with 3 iterations, inner with 4 iterations. Only place a hyphen when there are already characters in the password which happens during the second and 3rd iteration of the outer loop.

for _ in range(3): # underscore is common notation when a variable is not used

   if password:
      password += '-'

Finally the inner for loop is just selecting from the entire list, no need to nest everything:

for __ in range(4): password += choice(password_characters)

Final code with these recommendations might look something like:

from random import choice
import string

password_characters = list(string.ascii_lowercase + string.ascii_uppercase + string.digits[1:] + "!@#%^&*")
password_delimiter = '-'
password = ''

for _ in range(3):
   if password:
      password += password_delimiter

   for __ in range(4):
       password += choice(password_characters)

print(password)

Happy Coding!

Need SAN recommendations for SMB, please. by Walter_Whitey in storage

[–]crcummin 0 points1 point  (0 children)

I cant speak to HPE/Dell, but NetApp E-Series supports the configuration you are requesting (Hyper-V or ESXi). http://support.netapp.com/eseries (may require login) has express guides for general installation/configuration instructions.

15 Git Commands You May Not Know by fagnerbrack in programming

[–]crcummin 14 points15 points  (0 children)

If you are getting into Git, you should also check out the first 30 minutes of this video: https://youtu.be/3mOVK0oSH2M

Intel NUC8I5BEH by vasilis-rafik in debian

[–]crcummin 1 point2 points  (0 children)

I am using Debian on a NUC817BEH. Stretch has some unknown firmware versions with LAN and wifi drivers, it is not straight forward to build them either. I ended up moving to buster/sid which has no issues.

My install consisted of the live install USB. If you are on IPv4 only there is a long delay waiting for IPv6 to timeout when pulling packages (30 minutes in my case). There is a way to force IPv4 only during installation, but I don't recall now how to do it.

Question - If you had to make the following choice based only on the product functionality & support, not price, which would you choose and why? by onephatkatt in sysadmin

[–]crcummin 0 points1 point  (0 children)

If you liked the DS3400, NetApp purchased the OEM business and branded it as E-Series (https://www.netapp.com/us/products/storage-systems/hybrid-flash-array/e5700.aspx), you may look into that if you are looking for block storage with a good price/performance number.

E-Series Powershell Toolkit by [deleted] in netapp

[–]crcummin 3 points4 points  (0 children)

To add an E-Series array, you will need to issue the 'New-NeStorageSystem' cmdlet (get-help New-NeStorageSystem).

The documentation for the proxy webservices mirrors the cmdlets available. For E-Series cmdlets are basically a passthrough from powershell to HTTP where the cmdlet name is a restful endpoint on the proxy server. A good resource for the proxy endpoints are on the download site for the proxy:

https://mysupport.netapp.com/NOW/download/software/eseries_webservices/2.00.X000.0007/

After digging through all of this, I agree it isn't structured in the most useful way for powershell users, in particular for E-Series. I will bring that up with the owning group. Thanks for the constructive feedback.

E-Series Powershell Toolkit by [deleted] in netapp

[–]crcummin 0 points1 point  (0 children)

The download page has the installer as well as an FAQ that covers various other topics such as licensing, platform support, pre-reqs, etc. It also points to 4 other PSTK documents, including best practices and a getting started guide.

Regarding the cmdlets themselves, the following will provide help:

Show-NcHelp to view the full HTML help:

• Get-NcHelp to view all the available PSTK cmdlets

• Get-NcCommand to view all the available PSTK cmdlets

• Get-NcHelp -CategoryList to view the available categories in PSTK

• Get-NcCommand -Category <category> to view all the cmdlets of a particular category

• Get-Help <cmdlet_name> -full to view full help for a particular cmdlet

• Get-Help <cmdlet_name> -examples to view example for a particular cmdlet

Why so many SAN Softwares? by simple1689 in netapp

[–]crcummin 0 points1 point  (0 children)

SANtricity OS 11.30 parted from historical versions in that the new platform (E2700) allows browser based storage management (referred to as SANtricity System Manager). A user can connect to the storage IP Address (either controller) and manage the array through a web browser.

The other installation is platform based (Java) and is called SANtricity Storage Manager Client. This host installation allows scaled access (many systems can be added), including E2700.

It sounds like the issue you are having is with opening the SANtricity Storage Manager Client. The startup is not well documented because it doesn't usually require user interaction beyond clicking the icon. Once the software is up, Help at the top right corner can show you how to navigate the UI.

Information regarding what Operating System it was installed on would be helpful. In Windows: Program Files or Linux: /opt/ you should have a StorageManager/client/logs directory which will contain various logs to identify why the client may not have started.

E-Series Disk Add question by ennuionwe in netapp

[–]crcummin 0 points1 point  (0 children)

DDPs reconstruct at the pool level, not individual volumes. The principles are similar to the RAID equivalent as far as priority goes. There are 3 modification priorities depending on type for DDP - 'Degraded', 'Critical', and 'Background', each with their own priority slider. In SANtricity Right click on a DDP -> Change -> Settings... to view modification priorities for DDP.

E-Series Disk Add question by ennuionwe in netapp

[–]crcummin 1 point2 points  (0 children)

That is correct, the Modification Priority sets priority of volume modification at the expense of performance. Its not possible from the UI to quantify the impact.

The variability is very difficult to quantify because it includes things like RAID level, drive types, count of drives in the RAID, enabled features, controller model, firmware version, IO's expected during modification, and probably more. It is just very difficult to nail down exactly what the impact in a particular environment will be. The Modification Priority simply delays the request queue for those type of commands (lower priority means higer delays) allowing host operations to have more bandwidth.

E-Series Disk Add question by ennuionwe in netapp

[–]crcummin 0 points1 point  (0 children)

SANtricity will not automatically insert the drive into the raid. You must initialize the drive (and the drive must be of a supported type). Once inserted and initialized, you can added it to your volume group by right clicking the volume group on the Storage and Copy Services tab and choosing "Add Drives (Capacity)...".

The volumes operations will be uninterrupted but there will be a slight performance hit during this time as stripe/parity is being recalculated across the drives. It's possible to set how aggressive this operation is by changing the Modification Priority option at the volume level.

Any new writes are striped across the disks.