[Python] I'm struggling a little bit to learn from this quick Selenium tutorial

Learn Programming - 5 hours 26 min ago

This is the blog that tells you how to code something. It's a short introduction to the module Selenium and tells you how to search Google using it. The first portion was easy, install the module, download the driver for Chrome and insert it into the Python directory (she didn't say that, but someone else on Stack Overflow) and open a window before closing it. Easy, only a few lines of code and I can remember that.

  • time.sleep is just accessing the sleep function from the time module, with 5 as the function argument.
  • Okay, that's how you install and define what you're doing with the WebDriver

But then it goes 'rest of the fucking Owl' and introduces about 20+ lines of code I've never seen before. I appreciate that she explained what each block of code did, but I don't know how she knows. I still don't understand what's really going on and how I can use this for future projects that don't simply involve searching Google - I can do that myself anyway.

import time from selenium import webdriver from import By from import WebDriverWait from import expected_conditions as EC from selenium.common.exceptions import TimeoutException

I know what the keywords are. "Import" is how a module is accessed. "From" is simply cherry-picking what to import from a hierarchy, "as" is dictating what to refer to the "include" as in the code. That's all well and good, but do I have to remember those five includes for everything I do using Selenium? Like, does every function I use have to be included in a separate line? Where would I find these keywords and objects while using them in my projects.

def lookup(driver, query): driver.get("") try: box = driver.wait.until(EC.presence_of_element_located( (By.NAME, "q"))) button = driver.wait.until(EC.element_to_be_clickable( (By.NAME, "btnK"))) box.send_keys(query) except TimeoutException: print("Box or Button not found in")

Functions like Try + Except were in some of the first lessons I found with Python, so I know what they do, but even the parenthesis above are hard to see. I could go on about what I don't understand, but beyond learning where to copy and paste this function from, I don't feel like I've learnt anything about how really use Selenium - Just how to open and search something on Google.

I want to learn how to log into a website, save the session (so it's constantly logged on) and save the source code to a variable. I have a feeling that may require the Requests module based on how I plan to scrap the data, but I don't feel like I'm furthered down the learning path.

submitted by /u/Bunny_Wabbit
[link] [comments]

Need help creating Markdown to HTML converter in (preferably) Pure JS, (Example In: **ape**, Out: <b>ape</b>)

Learn Programming - 5 hours 30 min ago


I'm currently in the process of learning JS and have decided to make a live markdown editor with some interesting future features, I've been messing around trying to make a functional prototype / Proof of concept but my limited JS has finaly caught up with me and i'm now stuck.

What i'm currently stuck at is making a functioning MD to HTML converter. I know there are already some pre-made libraries out there but i'd like to try making my own as i feel it would be a nice learning experience.

I've tried using .replace as shown below to replace the double asterisk with a <b> tag

txtInputModified = txtInputModified.replace("**", "<b>")

this only works for one side of the tag as i'm unable to distinguish if there has been a <b> tag before. I've looked into using JavaScript Regular Expressions but tbh it just looks like brainfuck to me.

I'd love some help neither understanding RegExp or using some other method.

PS: Here's my current code: JSFiddle

submitted by /u/Xsimon47
[link] [comments]

[C] Separating digits of a three/four digit number without Arithmetic.

Learn Programming - 5 hours 32 min ago

Could someone help me with this. I know the general mod then integer division method but I need to do it without any arithmetics. I'm kinda lost. Cheers!

submitted by /u/watafaq
[link] [comments]

Dealing with Bash on Windows

Learn Programming - 5 hours 41 min ago

So, I just got into Transfer Learning and I'm trying to Retrain the Last layer of CNN using the Inception V3 Checkpoint on custom data, I get this

Using TensorFlow backend. usage: [-h] [--train_dir TRAIN_DIR] [--val_dir VAL_DIR] [--nb_epoch NB_EPOCH] [--batch_size BATCH_SIZE] [--output_model_file OUTPUT_MODEL_FILE] [--plot]

I know they are bash commands, but I'm not familiar with Linux shell nor I know how to use them in python or in windows.

I'm Following This with This Code

submitted by /u/TheNASAguy
[link] [comments]

Connecting and using an API in java?

Learn Programming - 5 hours 44 min ago

I have a good amount of experiencing with coding and especially in the object oriented side of Java programming. I have not however ever worked with APIs or done much web related programming. My question is, how do I connect to an API and issue the commands to get data? I'm using Eclipse and the API I want to connect to is

Thank you for all help!

submitted by /u/dakman96
[link] [comments]

When building a website is it better to have a local server to test on?

Learn Programming - 5 hours 49 min ago

I'm a little confused about a few things when building a website.

I'm using PHP, so that means that instead of .html files I'll have .php? But the .php files don't load up on my browser normally, so do I have to send them to the website's root folder and test directly on the website? I know that can't possibly correct, unless most websites have a backup site just for testing purposes.

This kinda goes along with it but I'll ask it anyway. I'd get a local database system to test out my SQL queries and such to make sure they're working correctly right?

submitted by /u/Mkerian10
[link] [comments]

need some basic php help.

Learn Programming - 6 hours 1 min ago

I just wanted to know if this is the correct way of using extracted data from a table using mysql

$res=mysqli_query($connect,"SELECT MAX(pId) FROM projectdetails"); $ind=mysqli_fetch_assoc($res); //both statements are used to fetch the max value of of the col pid (int) $sql="INSERT INTO studentdetails VALUES('$ind["pid"]','$count','$name1','$sem1','$acc1','$pNo1','$pEmail1','$g1')"; //I'm inserting the extracted value to the table along with existing variables here, $ind["pid"] holds the integer value

this is how i've written my code, I wanted to know if this was the correct way and if it will work?

submitted by /u/Timelord_42
[link] [comments]

Should I create a website from scratch or use a platform like Wordpress?

Learn Programming - 6 hours 13 min ago

Background info on me:

I've been working as a programmer for 3+ years mostly doing back end development using c#.
Front end design would not be my strong suit. I've been asked to help out a start up company with some friends of mine. I will be making a website which won't be anything like the web application I currently work on.

My Question:

For a basic marketing website that doesn't need many features (maybe a contact form) what's my best option?
I've used wordpress before and it was OK.. at the momemt I'm leaning towards using it again instead of having to design and write the entire site myself (because A. front end design not my strong suit and B. I'll be working on this during evenings and weekends only for the foreseeable future). Is there a better platform than wordpress? Is it so much better that I should learn how to use it over wordpress which I'm already familiar with? Am I right not to consider creating the site myself from scratch?

Any guidance is appreciated, thanks.

submitted by /u/CharDee_MacDennis_EB
[link] [comments]

How useful would it be for me to learn basics of Electrical Engineering for a computer scientist career?

Learn Programming - 6 hours 15 min ago

Hello. I'm almost an 18-year-old living in the Balkans. I'm certain that I want to pursue a career of a computer scientist / software engineer. I'm making a lot of progress in that, but that's not what I want to talk about.

I recently for the first time ever had an encounter with an Arduino. I've never seen in real life anything like it until then. You gotta understand that my school is not that good and we have no experiments in my physics class. So I was very happy when I was messing around with an Arduino, alongside someone who had quite some experience with it.

He showed me how to use an ultrasonic sensor to make LED lights turn on. That got me thinking if I should do some learning of that area on my own, since I have almost no knowledge of anything in it. However, since my time is limited and I want to optimise the quality and the type of learning that I do, I have some doubts.

Another important factor is money. I can't afford a lot of expensive stuff of that sort if it's needed. I guess I could muster a $100 budget and that would be a big hit to my financial condition. I am interested in this, but I don't think I would really try to learn it now if it wouldn't benefit my in-the-plans career as a programmer. What are your thoughts on this? Thanks in advance.

submitted by /u/bsp952
[link] [comments]

Looking for good MEAN stack tutorials

Learn Programming - 6 hours 16 min ago


I done a quick search but couldn't find anything on resources for learning the MEAN stack.

Basically, I'm looking for a solid tutorial or tutorials, that will give me a good understanding of MEAN. I think I would prefer follow along video tutorials, but text is fine also.

Paid or free tutorials also, however, nothing too expensive...less than $50 preferably.

If anyone can help that would be great, thanks.

submitted by /u/phasee12
[link] [comments]

Anyone else learning from scratch?

Learn Programming - 6 hours 22 min ago

Anyone else learning Swift from scratch? No experience here at all. Doing it on my own. Curious if there are other “newbies,” to bounce things off of.

submitted by /u/Golfabrad
[link] [comments]

Interesting command lines

Programming - 6 hours 30 min ago
Categories: Programming

What kind of language and framework should i focus on if i want to specialize in back end development, webshops, big data etc.

Learn Programming - 6 hours 50 min ago

At the moment i am choosing full stack JS, since i am still a beginner. And it's cool if i can use just 1 syntax, for both the front end and back end.

But on what language should i focus if i want to search for a back end job? I mean, i shouldn't be hyped about full stack JS anymore at that point. At that point i should start searching for the most used language for back end development and for companies that are using it.

I feel like full stack JS is still young and new. I might be wrong, maybe i don't have to change languages in 3-4 years from now. It would be great though, if i can practise JS for 3-4 years before i start applying for jobs.

But yeah, i don't mind switching. I just want to practise full stack JS for 2-3 years and focus on the concepts instead of switching from language and frameworks every few months.

At the moment i have 2 internships on my belt. 1 in PHP and 1 in Python.

My strongest language is PHP at the moment. Then Python. So i am still learning JS.

submitted by /u/owlwithbow
[link] [comments]