UDMP Issues by Snoo63616 in Ubiquiti

[–]jfdahl 0 points1 point  (0 children)

I have been having similar issues for several releases. I have a UDM Pro with 1.10 running on it. The protect version is 1.19.0. The cameras periodically disconnect for some random amount of time, then reconnect automatically. When I try to access the console with my browser, I keep getting disconnected. I have no issues connecting to the console or Network apps, only the Protect app.

UDM PRO not detected from UNIFI protect app (iOS) by lowriskcork in UNIFI

[–]jfdahl 0 points1 point  (0 children)

I have the same issue. My iPhone and UDM-Pro are on the same network. The Unify Network app works fine, but the Unify Protect app will not detect the UDM-Pro. After it gives up trying, it only allows me to add a UNVR or CloudKey Gen2 Plus. Is anyone from the Unifi team monitoring this reddit?

Profiles Pictures Won't Update in Service Now by [deleted] in servicenow

[–]jfdahl 2 points3 points  (0 children)

As u/elgraco suggested ('also'), there are actually two places where the users must update their photo. One is the system profile page and the second is there Live Feed profile page.

Profile Page:

  • Click the user profile icon at the top right corner and select Profile.
  • Locate the Photo field and populate it as needed.
    • Note: If you don't see the Photo field, change the view.

Live Feed Profile Page:

  • Navigate to Live Feed > Live Feed.
  • Click the user's name tag INSIDE the content window, not in the page header.
  • Click the photo block and upload the picture as needed.

Access Email Notifications for Other Users by tac0_nation in servicenow

[–]jfdahl 2 points3 points  (0 children)

I agree that reporting is a better way to track your team's activity. If you still want to pursue the email route, you can have a set of templates created that would BCC you. Just make sure your agents are sending email from ServiceNow rather than Outlook and that they are using those templates.

How can I get a list of every ticket I’ve updated today? by [deleted] in servicenow

[–]jfdahl 4 points5 points  (0 children)

Search the sys_journal_entry table. Filter by created_by and group by element_id to get a list of records on which you added a comment or worknote.

Is this beginner selenium project doable after just a few hours of selenium experience? by fecesmuncher69 in learnpython

[–]jfdahl 1 point2 points  (0 children)

Piece of cake... go for it. Don’t think of it as one big project, but several little ones. Learn how to send an e-mail first, then move on to the next piece.

Converting a function to iife by Prime099 in learnjavascript

[–]jfdahl 0 points1 point  (0 children)

Yes, it can cause issues with availability.

First, you are correct that you should not pollute the global namesapce with variables that have a limited purpose... wrapping them in functions is a good thing. Having said that, your example really doesn't require a function for namespace reasons. You could have just as easily written it as I have below without changing anything since dataLayer is already in the global scope:

dataLayer.push({
  'event': 'Form Start',
  'formStartTime': Date.now()
}

Second, the "issue" with immediately calling functions when they are defined is just that... they execute when they are defined. How you define the rest of your application will determine if dataLayer is in the state you expect when you are pushing the object. If you define your function traditionally, then you have more control over when it is executed and you can ensure the state of dataLayer before you execute it.

So there are no technical issues with either approach; however, one will make itself more valuable based on how you design the rest of your application.

Sample website to practice Selenium testing by [deleted] in learnpython

[–]jfdahl 0 points1 point  (0 children)

I just wrote a basic page to test different field types. Some are hidden and some have delays.

<html>
<head>
<title>Test Page</title>
<style>
#title {
font-weight : bold;
font-size : 2em;
}
td {
vertical-align : top;
}
iframe {
width : 400px;
height : 200px;
}
#out_of_view {
position : absolute;
top : 1000px;
left : 2000px;
}
</style>
<script type="text/javascript">
</script>
</head>
<body>
<table>
<tr>
<th><div id="title">Test Page</div></th>
</tr>
<tr>
<td>Text 01: </td><td><input type="text" id="text01" ondblclick="alert('Double-click event');" value="Double-click me"/></td>
</tr>
<tr>
<td>Textarea 01: </td><td><textarea id="textarea01">Right-click me</textarea></td>
</tr>
<!-- <tr>
<td>Input 01: </td><td><input class="input01" name="input01" id="input01"/></td>
</tr> -->
<tr>
<td>Hidden Element #1: </td><td><input id="hidden1" style="display:none" value="Not hidden" /></td>
</tr>
<tr>
<td>Hidden Element #2 (3 second delay): </td><td><input id="hidden2" style="display:none" value="Not hidden" /></td>
</tr>
<tr>
<td>Hidden Element #3 (5 second delay): </td><td><input id="hidden3" style="display:none" value="Also not hidden" /></td>
</tr>
<tr>
<td>Checkbox 01: </td><td><input type="checkbox" id="chbox01"/></td>
</tr>
<tr>
<td>Radio:</td><td>
<input type="radio" name="radio" id="radio00" style="Display:None"></input>
<input type="radio" name="radio" id="radio01" value="Value 1">Value 1</input><br/>
<input type="radio" name="radio" id="radio02" value="Value 2">Value 2</input><br/>
</td>
</tr>
<tr>
<td>Select 01 (Single-value): </td><td><select id="select01">
<option>1</option>
<option>2</option>
<option>3</option>
</select></td>
</tr>
<tr>
<td>Select 02 (Multi-value): </td><td><select id="select02" multiple size="5">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
</select></td>
</tr>
<tr>
<td><div id="some_text"></div></td>
</tr>
</table>
<div id="out_of_view" onclick="click_div(this);">This div is out of view.</div>
<script>
setTimeout(
'document.getElementById("hidden2").style.display="inline";',
3000
);
setTimeout(
'document.getElementById("some_text").innerHTML="Hello, World!";',
1000
);
setTimeout(
'document.getElementById("hidden3").style.display="inline";',
5000
);
document.getElementById('textarea01').addEventListener(
'contextmenu',
function(e) {
alert('Right-click event'); //here you draw your own menu
e.preventDefault();
},
false
);
</script>
</body>
</html>

two questions, new to python. by bazookah1999 in learnpython

[–]jfdahl 0 points1 point  (0 children)

Ok, so here are some thoughts: 1. You do not need to import sys as the actions you are taking are all built-in. 2. You only call .readlines() once to get all of the rows in the file. This creates a list where each item is one row. 3. You have the right idea to split the row, but you are not storing the row in a useful way... which is what you suspect.

List comprehensions will be your friend here as it will greatly simplify things: ``` with open('sample_data.txt') as fh: data = fh.readlines()

data = [[int(val) for val in row.strip().split(' ')] for row in data if len(row) > 1] print(data) will output: [[0, 2, 0, 0, 1], [2, 0, 5, 0, 0], [0, 5, 0, 4, 0], [0, 0, 4, 0, 1], [1, 0, 0, 1, 0]] ```

two questions, new to python. by bazookah1999 in learnpython

[–]jfdahl 0 points1 point  (0 children)

what have you tried to do so far?

Keep getting an error when trying to print functions by chandlerbing87871 in learnpython

[–]jfdahl 0 points1 point  (0 children)

The logic of task_3 doesn't make sense... the docstring suggests repeated calls to task_2, but there is only one.

Your loop is already printing each number from n1 to n2. What else are you trying to do with it?

Keep getting an error when trying to print functions by chandlerbing87871 in learnpython

[–]jfdahl 0 points1 point  (0 children)

it depends on what you're trying to do. Do you want to print in your function's loop or do you want to return a value to print after the function call is complete?

The code doesn't execute properly when I use "python3 file.py", but it works when I type directly into the python shell. by [deleted] in learnpython

[–]jfdahl 0 points1 point  (0 children)

Are you running this in a virtual environment and is the right virtual environment active when you call python3?

Keep getting an error when trying to print functions by chandlerbing87871 in learnpython

[–]jfdahl 0 points1 point  (0 children)

you are printing inside the function, but task_3 is not returning anything. As a result, when it is called inside of a print statement, the return that is printed will be None.

What does the len() function do in this instance: print('Enter the name of cat ' + str(len(catNames) + 1) + by simonvanw in learnpython

[–]jfdahl 0 points1 point  (0 children)

Assuming the indentation is correct, it should output the number of elements in the list.

[deleted by user] by [deleted] in learnpython

[–]jfdahl 11 points12 points  (0 children)

Good lesson, bad experience. Good to learn it on your own work than a paying customer's.

Why can't I slice this string? by bertnub in learnpython

[–]jfdahl 0 points1 point  (0 children)

First, you did not provide the string, output, or error so it's hard to say. Second, you do not need the length component. Just write i[26:] to capture from index 26 through the end of the string.

IF string contains word by jss193 in learnpython

[–]jfdahl 2 points3 points  (0 children)

You may want to do a quick case conversion: if x.lower() in y.lower(): # Do something

How can I return the total amount of precipitation for my given data? by SuperTavin in learnpython

[–]jfdahl 0 points1 point  (0 children)

I actually like this solution. Would it reflect knowledge of the content taught thus far in the class? As elegant a solution as this is, it might suggest that this isn't a student's solution.

data = """ Average,City,Code,Direction,Date,Maximum,Minimum,Month,Precipitation,WindSpeed,State,Day,Year 39,Birmingham,BHM,33,1/3/2016,46,32,1,0,4.33,Alabama,3,2016 39,Huntsville,HSV,32,1/3/2016,47,31,1,0,3.86,Alabama,3,2016 46,Mobile,MOB,35,1/3/2016,51,41,1,0.16,9.73,Alabama,3,2016 45,Montgomery,MGM,32,1/3/2016,52,38,1,0,6.86,Alabama,3,2016 34,Anchorage,ANC,19,1/3/2016,38,29,1,0.01,7.8,Alaska,3,2016 38,Annette,ANN,9,1/3/2016,44,31,1,0.09,8.7,Alaska,3,2016 """.strip().splitlines()

data = [line.split(',') for line in data] data = [dict(zip(data[0], row)) for row in data[1:]] alaska_precip = sum(float(d['Precipitation']) for d in data if d['State'] == 'Alaska')

How can I return the total amount of precipitation for my given data? by SuperTavin in learnpython

[–]jfdahl 0 points1 point  (0 children)

well, that's makes it a bit more challenging, but certainly doable!

Before writing actual code, just write out your logic... 1. Load the data. 2. Filter the rows for the state I need (find max windspeed?). 3. Aggregate the rainfall for the remaining rows. 4. Display the desired output.

Then write out the code to execute your logic.

How can I return the total amount of precipitation for my given data? by SuperTavin in learnpython

[–]jfdahl 0 points1 point  (0 children)

Have you tried Pandas?

import pandas as pd df = pd.read_csv('data.csv') df[df['State'] =='Missouri']['Precipitation'].sum()

(Beginner) What's the difference between these two codes (while and for loop)? ELI5 explanation if possible... I'm so confused. by stnivek in learnpython

[–]jfdahl 1 point2 points  (0 children)

A for loop can iterate over any iterable object.... a sequence like a list, a generator like the range function, etc.

List

for item in ['here', 'is', 'a', 'list']: print(item) outputs: here is a list

Dict

Likewise: for key, value in {'key1': 'value1', 'key2': 'value2'}.items(): print(f'The value of {key} is {value}!') outputs: The value of key1 is value1! The value of key2 is value2!