tech
Discord ID: 352761432833523713
1,350 total messages. Viewing 250 per page.
Prev |
Page 5/6
| Next
I'm trying to figure out how to fix it right now
you can keep a (global) list or set with the text of every comment you've printed before, so that if the text is already found in your list of already printed comments, then you don't print it.
There's a few slightly more optimized ways to do it, but that would be the laziest fastest to implement
hmm ya that's what I'm trying to do
@Jacob what difficulty are you running into?
I added this in interested_comments():
interesting_list = []
and then I modified the if statements to be like this
if "white" in comment_set and {"priviledge", "privilege", "privledge"}.intersection(comment_set) and comment not in interesting_list:
I think I can figure this out, though
@ThisIsChris I'm testing out my solution right now
In the meantime, I have some new ideas
How difficult do you think it would be to add this functionality? Detect what specific immigration topic is about, and automatically suggest counterarguments from a database.
Maybe I could put the arguments in a list, and look for phrases like "jobs Americans won't do" and the script would immediately pop out a refutation
I think it would be pretty straightforward. You need a list keywords/key phrases that indicate the topic of conversation, then you just need a pre-written counter argument for each topic
@Jacob "Maybe I could put the arguments in a list, and look for phrases like "jobs Americans won't do" and the script would immediately pop out a refutation" yeah exactly this
cool
This is gonna get pretty advanced
I'll see if I can make the script automatically run once a day and send me an email with pro-immigration comments and recommended counter arguments
@Jacob perfect MVP to work on. I look forward to seeing it
@ThisIsChris What's the point of searching comment_set over comment_text?
it just made comment_set.intersection({set of keywords}) simpler to write
Does
```
if {"immigrant", "immigration"}.intersection(comment_text)
```
work?
would that work for plurals?
comment_text is a string, so no
intersection is for sets
ah
so I can't check for certain phrases in order?
You can, look at the "white people" condition as an example
oh that's right
I just can't do it as an intersection
right
so, if I want to check for one out of a list of phrases, I just have to use ```and``` a lot?
I mean, I have a list of phrases, and I want to see if one of those phrases is in a comment
that is a straightforward way, a less verbose way would be:
```python
if any(key_phrase in my_string for key_phrase in list_of_phrases)
```
thanks
what do you guys think of DuckDuckGo? I'm sick of google
@Deleted User at first I was hesitant to use it because its owner and founder is a "you know who" but I find DDG gives different results from Google often so it's a good other source to check out. However, if you like Google results and are just worried about privacy then you can use startpage.
@ThisIsChris Any idea why the script skips over some comments?
If I use this, it shows comments that the script didn't find
@Jacob you could be being rate limited. Instead of silently handling the JSONDecodeError try printing the error to see what's happening. One thing you can do to mitigate is add
```python
import time
time.sleep(4)
```
I did try that
Into the while loop
but I think it misses a lot of comments, no?
I did time.sleep() with .5, 1, and 2
Try 4
That's the documented rate limit
Wouldn't 4 seconds be enough for a lot of comments to be posted?
Also I think the rate limit is actually 1 request every 2 seconds
Otherwise try printing the JSONDecodeError
E0602:Undefined variable 'JSONDecodeError'
@Jacob I think it's one per 2 seconds if you are using a dev account. One per 4 seconds if not
ah
would be interesting if we could find a way around this
like send requests from 4 different IP addresses
To print the JSONDecodeError rewrite the `except` statement to be
```python
except JSONDecodeError as e:
print(str(e))
```
Well, another way to look it is, do we *need* every comment? Running the script for an hour probably will yield more comments than I have time to respond to anyway.
@Jacob sure that shouldn't be a problem, you just need 4 proxies. Or just get a dev account, which is free and not too hard to set up. But I think from a development focus that it's more important to get your system working on just the comments you find first, and after that worry about increasing the throughput of the comment stream
@Jacob "do we need every comment" exactly
That can be a future development step, first step is just to get it working sometimes, then work on that part later
Ya, the function of the program is "scan Reddit for pro-immigration comments so we can respond to them" not "scan Reddit for literally every pro-immigration comment"
Yeeep
It's probably more important to get the other functionalities working, which, for now, includes,
1. Suggesting counterarguments
2. Sending out emails
oh, another issue is that is still occasionally posts duplicates
but that's not too huge of a problem
Yeah. I agree 1 and 2 are more important.
1 is just for you to copy and paste the arguments into a lookup table
2 you can use the `mail` library of the standard library
@ThisIsChris itโs not so much a privacy think - I just donโt want to support them
@Deleted User then yeah startpage pays Google a licensing fee so that's still supporting Google. In that case yeah duckduckgo or bing seem good
You could also try gigablast but they're not really pro-free speech, just different answers than Google
@ThisIsChris How do I use a local email server?
server = smtplib.SMTP('smtp.gmail.com', 587)
Do I just put 'localhost', 25 in here?
would it be better to just use gmail's server?
it is better to use gmails, just make sure to go to your gmail account security settings and enable the "allow 3rd party apps" option
server.login("youremailusername", "password")
do I just put my email address and password here?
or is there some special server log in?
yep that's it. I forget if you put in email address or just username, try both
@Jacob I checked, username should be the full email-address, the port should be 25, the host is smtp.gmail.com
thanks
this example uses 587 as the port
maybe I'll try both
@ThisIsChris
```
smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.
```
I checked "allow less secure apps"
Thanks
okay I got the email server to send out emails
just test emails so far, but we're making progress
yeah sounds awesome!
my next step should be to figure out a way to accumulate a list of posts, and send out an email once it reaches a certain threshold
right now it just spams me every time it finds a comment lol
So, this is the idea I have so far:
> Automate the script to start up once a day
> Scan Reddit for pro-immigration comments until it reaches a certain threshold
> Send out an email with all the comments plus recommended counterarguments for me to copy paste
> Script automatically shuts down after sending out the email to be restarted the next day at a set time
Once this program is finished, it's going to be peak weaponized autism
that's great!
@ThisIsChris we have a weird problem
the emails don't send if they have a link in them
```
for comment in interesting_comments(request.json()):
if comment not in printed:
print('')
#on some computers printing \a is an escape
#sequence that produces a ding sound
print('\a\a\a', flush=True)
#for interesting comments found
#print out a link
#print out the subreddit it was found in
#print out what the comment says
message = comment['permalink'] \
+ '\n' \
+ '\n' \
+ comment['body']
server.sendmail("[email protected]", "email censored pls no dox", message)
server.sendmail("[email protected]", "email censored pls no dox", message)
printed.append(comment)
```
sends fine
```
for comment in interesting_comments(request.json()):
if comment not in printed:
print('')
#on some computers printing \a is an escape
#sequence that produces a ding sound
print('\a\a\a', flush=True)
#for interesting comments found
#print out a link
#print out the subreddit it was found in
#print out what the comment says
message = "Reddit.com" + comment['permalink'] \
+ '\n' \
+ '\n' \
+ comment['body']
server.sendmail("[email protected]", "email censored pls no dox", message)
server.sendmail("[email protected]", "email censored pls no dox", message)
printed.append(comment)
```
no longer sends
I don't think this library has email subjects
it's the really basic one
@ThisIsChris perhaps we have some Python experts in IE who could help with this project?
<@&435155896780324864> Is anyone here a Python expert?
@Jacob An expert is not going to know the answer to every question about every library off the top of their head, but a lot of these questions can be answered by googling and checking the documentation or stack overflow which are usually the first results.
good point
now I feel like one of those boomers that asks their grandkids how to close a dialog box
:boomer:
@ThisIsChris I have a big 4 hour programming test this week, so I'm gonna be preparing for that and should probably put my work on this script on hold for a few days
@Jacob good luck on your exam!
thanks!
```java
/**
*
* Implement the private reverse(ListNode node) method using recursion.
* You are allowed to add helper method into this class if needed.
* @param node -- the reference of the first data node(successor of the dummy) in the original list.
* @return A new MyLinkedList object contains the same set of data items, but in a reversed order.
*/
private MyLinkedList reverse(ListNode node) {
MyLinkedList reversed = new MyLinkedList();
ListNode curr = node;
ListNode lastNode = null;
while (curr != null) {
lastNode = curr;
curr = curr.next;
}
reversed.head.next = lastNode;
if (node.next != null) {
reversed.head.next.next = reverse(node.next).head.next;
}
return reversed; // change this line of code as needed
}
```
Does anyone see anything wrong with this code?
```java
/**
* This method reverse2() will reverse all data nodes in this list, WITHOUT
* creating(introducing) new list nodes, by simply re-wiring the next reference in
* the existing list node. For example, list1 = []โ>[A]โ>[B],
* the reversed list1 will be []-->[B]-->[A],
* after assigning node A to B's next reference and setting A's next to null.
*
*/
public void reverse2() {
if(this.size <= 1)
return;
// The following method call works on a *sublist* without a Dummy Node.
// Namely, we preserved the OLD dummy head node in the reversed list.
this.head.next = reverse(this.head.next, this.head.next.next);
}
/**
* Please implement the helper method below for reverse2().
* @param first, the first node of the list to be reversed.
* @param second, the second node of the list to be reversed.
* @return the new head node of the reversed list.
* Note: you are NOT allowed to create new list node, but have to
* re-wiring the existing nodes by changing their next references.
* Write this method using recursion.
*/
private ListNode reverse(ListNode first, ListNode second) {
ListNode curr = first;
ListNode newFirstNode = null;
ListNode newLastNode = null;
ListNode newHead = new ListNode();
while (curr.next != null) {
newLastNode = curr;
newFirstNode = curr.next;
curr = curr.next.next;
}
newHead.next = newFirstNode;
newLastNode.next = null;
newFirstNode.next = reverse(newFirstNode.next, newFirstNode.next.next);
return newHead; //change this line of code as needed.
}
```
and this ^
I'm honestly not sure what the point of passing the second node is, since (I think) it can be determined from the first node using .next
<@&435155896780324864>
That's all for tonight by the way. I won't spam you guys with a bunch of other methods, it's just these.
@Jacob well it's recursive right, and one node IIRC is a null node, right? null wouldn't have a null.next
ah
you mean at the end?
when the function is originally called, I assume both nodes are fine
but ya I think that makes sense
that at some point second will be null
wait no that shouldn't be an issue
because each Linked List object has a size variable to check for that
wait no that wouldn't work because I'm not actually passing a list
haha yeah that linked list/ tree stuff is tricky, maybe later in the weekend I can focus on it if you're still working on it, hopefully someone else here can help out sooner than that though ๐ <@&387091385075105804> <@&435155896780324864>
Do you think I'm understanding this correctly?
```java
/**
* This method reverse2() will reverse all data nodes in this list, WITHOUT
* creating(introducing) new list nodes, by simply re-wiring the next reference in
* the existing list node. For example, list1 = []โ>[A]โ>[B],
* the reversed list1 will be []-->[B]-->[A],
* after assigning node A to B's next reference and setting A's next to null.
*
*/
public void reverse2() {
if(this.size <= 1)
return;
// The following method call works on a *sublist* without a Dummy Node.
// Namely, we preserved the OLD dummy head node in the reversed list.
this.head.next = reverse(this.head.next, this.head.next.next);
}
/**
* Please implement the helper method below for reverse2().
* @param first, the first node of the list to be reversed.
* @param second, the second node of the list to be reversed.
* @return the new head node of the reversed list.
* Note: you are NOT allowed to create new list node, but have to
* re-wiring the existing nodes by changing their next references.
* Write this method using recursion.
*/
private ListNode reverse(ListNode first, ListNode second) {
ListNode newHead = new ListNode();
if (second.next != null) {
ListNode curr = first;
ListNode newFirstNode = null;
ListNode newLastNode = null;
while (curr.next != null) {
newLastNode = curr;
newFirstNode = curr.next;
curr = curr.next.next;
}
newHead.next = newFirstNode;
newLastNode.next = null;
newFirstNode.next = reverse(newFirstNode.next, newFirstNode.next.next);
}
else {
newHead.next = second;
second.next = first;
first.next = null;
}
return newHead; //change this line of code as needed.
}
```
@ThisIsChris okay this is what I have right now, do you think this works?
<@&435155896780324864> In the past week I've been hit up by recruiters 3 times asking if I know how to update a website for Search Engine Optimization (SEO). I don't intend to go into it, but the demand is there and I know this is a field you can get into relatively quickly. Lots of information online to learn from this is a big one https://moz.com/beginners-guide-to-seo
Iโm an SEO and Iโd love to pick up work if I could. If you need help learning about it or see an offer let me know ๐
@Gumbo - AZ will do!
<@&435155896780324864> Does anyone know how to do a Big O time complexity analysis on a Java function?
@Jacob example function?
```java
public static void two(int n)
{
if(n > 0)
{
System.out.println("n: " +n);
two(n - 1);
two(n - 1);
}
else if (n < 0)
{
two(n + 1);
two(n + 1);
System.out.println(โณn: โณ + n);
}
}
```
It's mostly like doing it on paper, you have most of the same assumptions of the Random Access Machine
Do you have any skepticism that assumptions of RAM don't hold?
No, it's just a basic analysis. I need to provide a "logical justification" for my answer. Not sure if that means I have to write a paragraph or there's some kind of equation I need to use.
There's an equation.
Not necessarily expecting an answer to the question from anyone, but maybe something that can get me in the right direction
f(0) = O(1)
f(|n|) = 2*f(|n|-1) + O(1)
๐ฌ
so f(n) = O(2^n)
Is that the equation for this particular function?
yep
How would I go about getting that?
So start by looking at the function to understand what is the "base case". The base case is the input that doesn't cause a recursive call
ah, okay
and write the base case as one of those formulas?
the only input that doesn't have a recursive call is n=0
yep
so how do I move up from there?
So after that you really have two cases, one when n is > 0 and one when , is < 0. If you look closely what you have in each case is that n decreases or increases towards 0 with steps of 1. I'm just here pointing out the two cases. For simplicity consider what happens in just the positive case first
so for the positive case you have that f(n) involves a check on n, which is constant time, a printline which is constant time, and then two calls to f(n-1)
so in this n positive case
f(n) = the constant stuff + 2\*f(n-1) = O(1) + 2\*f(n-1)
But don't the calls to f(n-1) create even more calls?
since it's recursive
Yep
Do I need some kind of formula to determine how many calls it will create?
so by using the same formula, f(n-1) = 2*f(n-2) + o(1)
plugging that in to what you had before:
f(n) = 2\*(2\*f(n-2) + O(1)) + O(1) = 2\*2\*f(n-2) + O(1)
ah, so it just simplifies to another logarithmic function?
yes
its exponential (the inverse of logarithm)
Okay. That should be enough to write up a logical explanation, I think. Apparently the other two function are easier to analyze.
Thanks a lot
```java
public void three(int n)
{
int i, j, k;
for (i = n/2; i > 0; i = i/2)
for (j = 0; j < n; j++)
for (k = 0; k < n; k++)
System.out.println("i: " + i + " j: " + j+" k: " + k);
```
This is the next one. Should be easier for me to figure this one out since it's just for loops, right?
yes
```java
public static void four(int n)
{
if (n > 1)
{
System.out.println(n);
four(n-1);
}
for (int i = 0; i < n; i++)
System.out.println(i);
}
```
I'm pretty sure this one is just Nlog(N) but I might be wrong
idk I'll go try to figure this stuff out myself and come back if there's a problem
thanks
you're welcome
@ThisIsChris If there was only one call to two() rather than two calls, would that make it an O(n) function?
Since it just calls itself n times until it reaches the base case, and than calling itself twice each time
@Jacob yes
Thanks
so I guess the last function is O(n^2 log(n))
wait no
last one if O(n^2)
second one is O(n^2 log(n))
maybe that simplifies to something idk
@Jacob base case is f(1) = O(1)
for n > 1:
f(n) = f(n-1) + O(n)
so f(n) = sum over i from 1 to n of O(i)
sum of i from 1 to n of i = n*(n-1)/2
so f(n) = O(n^2)
^
you could also expand and see how much work is being done in each step
four(n) does a function call (O(1) not accounting for the recursion) and then prints n
if you expand that all the way, you'll see that it does n+(n-1)+(n-2)+...+2+1 print statements, which is O(n^2) as @ThisIsChris pointed out
that's another perspective that I use sometimes to calculate big Os
<@&435155896780324864> Lads, it's that time of week again
anyone online to help me with Java?
I have a program that converts infix expressions into postfix expressions. It worked for one expression, but didn't work for another. I don't know if exponents broke it or what.
false alarm guys, I figured out the problem
Iโm thinking about doing freelance SEO work along with some other things in my relatively rural area working with small businesses. Anyone have experience with this sort of thing?
I do!
What do you need help with specifically?
Nothing as of yet Iโm about to do up some marketing materials and try to get a couple of low risk customers to work on (car dealerships, private restaurants, etc) do you do this as work?
I may reach out somewhere down the road thank you!
I donโt do it anymore, no. I have 6 employees in my marketing department though and oversee everything there. Previously I ran marketing at a few startups and freelanced when I left university.
Happy to help! Getting clients is fairly easy, especially with SEO work, though I would bundle it with email marketing too.
Oh wow Iโm strong on the sales side but Iโll have to build on my technical skills. Iโm still in the brainstorming stage at the moment. Itโs nice to know there is someone such as yourself in IE. Iโm going to take your advice on the email marketing. Do you think social media should be a focus or is that too much to bite off at first
Thereโs a real need for digital marking in my area
That depends on the business. Generally I think it is better for local businesses to focus on email and SEO. The fact is, most people donโt want to follow the instagram account of their local car dealership
Email has been my number one sales channel at every company. Both marketing and SDR outbound emails.
Then again, a good friend of mine runs a real estate marketing company that just does FB ads for local realtors. They do quite well.
Thanks thatโs solid advice. I may incorporate the social media aspect once I get a foundation to fall back on. Youโre right about people not caring about car dealership social media accounts lol.
Of course. Please reach out if I can help in any way. You might check out Backlinko.com. I have all my marketing employees go through the archives.
Awesome this is invaluable. Iโll give you an update when I get something and will prolly pop in here time to time. Iโll check out that site tonight.
HostGator sold me a domain that was already in use and being hosted by go daddy. I've been dealing with this for three hours now. Just needed to tell someone. rage intensifies
oh I totally sympathize with that feeling
ya that's messed up you should yell at them for it
it had a domino effect of unforeseen issues
restarting router now lol
Anyone use Elementor to edit Wordpress? Iโve been stuck for like 4 hours
Fixed it. Was using the wrong browser and didnโt realize. Talk about tunnel vision
<@&435155896780324864> I have to write my own linked list class in Java as part of an assignment. Is there really any way to do this without it looking plagiarized? I can't imagine there's that many possible ways to write a linked list class. Does my professor expect to reinvent the wheel somehow, or is it fine if it looks exactly the same as the linked list class we were given by the teacher in the past?
This is the assignment btw
@Jacob can you please put docs in a pastebin or convert to PDF? .docx is a PITA for mobile
yes, just a second
@Jacob without reading the doc though, I'd say there is no trick here. All linked lists are basically the same. Two main types are singly linked lists and doubly linked lists.
@ThisIsChris Here's the PDF so you don't get docxed
@Jacob lol thanks
yep as it says start by implementing a linkedlist. Yes there's only one real way to do this so I think you can use the one from class here. It doesn't seem to be the main point of the homework assignment. It's just a starter step because the other questions then go on to require you to start adding methods to this linkedlist.
Thanks
Has anyone here heard of or have any experience with a company named Revature? If so do you think it's a good place for a recent STEM graduate to gain experience?
@GDoctor I've seen similar programs help people who have poor interviewing skills get their first job. They are not really an employer, their are an employment firm. They take candidates who are already qualified to work, help them build a resume and little portfolio, and teach them a 5 minute presentation to give at interviews that they find for you. In return, they take aassive chunk of your first few years salary. Generally since you're already qualified these places are just capitalizing on your poor social skills. That being said, I've known even PhDs who this kind of thing because they just absolutely need that hand-holding through the networking part.
I don't need interviewing skills, I'm more interested in work experience and training.
@GDoctor Sounds like you need an internship. I suggest trying to find startup companies in your area and just contacting them, they often have more work than they can handle and will gladly hand you something to work on, they also tend not to advertise well. The best known and best advertising companies usually only have a few slots (and to be frank big megacorps would rather fill their internships with "underprivileged kids" because they need the progressive line item more than any actual work the interns produce).
Awesome https://www.turbulent.be
It's a whirlpool generator that can harvest power from just about any moving water
This will sound like a strange request, but does anyone @here have administrative access to a Facebook page with on the order of several tens of thousands of followers or more? I would have a favor to ask of such a person.
Obviously one you're willing to let me know you administrate.
Can anyone help a brother out with a computer build? It's not a passion of mine but I still want to know my machine. Don't game but I wouldn't want one that couldn't keep up if I wanted to. Just want a solid desktop. I'd be willing to spend anywhere from $500-$1500 or so (not including peripherals) so I'd be interested in what you guys have to say. There are just so many options out there that I just don't know how to get a good balance of value and necessity.
http://www.logicalincrements.com/ is a good resource for that
I've been out of the loop on tech work since getting laid off 6 months ago. Still, my own personal brand preference is as follow: ASUS for motherboards, EVGA for graphics cards (or ASUS if you prefer their cooler style), it's hard to go wrong with RAM and Corsair's stuff was decently reliable. Intel and AMD CPUs were at functional parity and any hemming and hawing was over single digit percentage advantages in specific areas like gaming.
Get a microATX or ATX form factor motherboard and corresponding case. If you try to go smaller (miniITX) it gets tougher to build.
Don't skimp on power supplies, get a name brand like Corsair, Seasonic, or EVGA. I'd stay away from Seasonics highest wattage PSUs because they seemed to be DOA more than chance, but their mid range (750w) were reliable.
1,350 total messages. Viewing 250 per page.
Prev |
Page 5/6
| Next