The "No Dev Question is Stupid" Thread - Basic HTML / CSS / Etc.

Joined
Mar 30, 2016
Messages
80
Likes
107
Degree
0
There are plenty of other SAAS options, and some more specific to this use case, though most I've seen seem to start at $50+/mth, if that's an issue for you?
Under a $100 a month is not an issue. The solutions I was finding where $200+ a month or a one time fee of $1K+.

One other desktop-based app I came across is Katalon Studio. It actually looks incredibly nice, professional, and robust. Best part is it's FREE!
I'm going to take this for a test drive. It looks very promising. Thank you for your help!
 

Ryuzaki

女性以上のお金
Staff member
BuSo Pro
Digital Strategist
Joined
Sep 3, 2014
Messages
2,880
Likes
5,269
Degree
7
Sounds like an easy bot to write up. Python, Python Requests, and some Regex. If they're using the same contact form plugin or the same roll-your-own, you can likely get it done with one chunk of code iterating through an array that includes the URLs to the contact pages. Requests & being able to grab Regex right out of the developer console of your browser should make this a walk in the park.

Some Google searches show people doing similar tasks, like logging into a set of websites with a username, email address, and password, in as little as 15 lines of code and less, using Python & Requests. Since it's a form on the page you can probably just grab the HTML "value=" attribute to tell it which input to use for each piece of text, and skip Regex altogether.
 
Joined
Mar 30, 2016
Messages
80
Likes
107
Degree
0
@turbin3 Thank you!
Just a quick update. Katalon Studio did the trick. For a nonprogrammer such as myself, it was rather easy to get setup and running. It took about an hour to get a functioning script together.

Katalon does not have a scheduler, but it has a built in feature which will make batch files, so you can just use Task Manager to schedule to run a batch file.

I'm not a developer, but this program looks like it could be really hand for simple repeatable tasks.
 

turbin3

BuSo Pro
Digital Strategist
Joined
Oct 9, 2014
Messages
574
Likes
1,124
Degree
2
Awesome! Glad to hear it. It certainly looked to be well-developed. Glad to hear the barrier to entry wasn't too high either.
 
Joined
Apr 7, 2016
Messages
227
Likes
136
Degree
1
I made an image repeater with ACF pro but it doesn't show the wordpress image sizes. Is there a setting or component I'm missing or is this not an option with the ACF image field?
 
Joined
Dec 5, 2014
Messages
59
Likes
54
Degree
0
I made an image repeater with ACF pro but it doesn't show the wordpress image sizes. Is there a setting or component I'm missing or is this not an option with the ACF image field?
You'll have to get the correct image size when you go to call the image in your PHP template:

Code:
$image = get_field('image');
$size = 'full'; // (thumbnail, medium, large, full or custom size)

if( $image ) {

    echo wp_get_attachment_image( $image, $size );

}
 
Joined
Apr 7, 2016
Messages
227
Likes
136
Degree
1
You'll have to get the correct image size when you go to call the image in your PHP template:

Code:
$image = get_field('image');
$size = 'full'; // (thumbnail, medium, large, full or custom size)

if( $image ) {

    echo wp_get_attachment_image( $image, $size );

}
Thanks, this worked great! I ended up echoing it like this:
Code:
<img class="aligncenter" src="<?php echo $image[0]; ?>" alt="<?php echo $alt_text ?>" />
 
Joined
Dec 31, 2016
Messages
214
Likes
111
Degree
1
How difficult would it be to code an algorithm that can create its own RegEx expression if provided with two identical elements on a website? For use in scraping price on websites.
 

Rageix

BuSo Pro
Joined
Jan 11, 2017
Messages
94
Likes
102
Degree
0
How difficult would it be to code an algorithm that can create its own RegEx expression if provided with two identical elements on a website? For use in scraping price on websites.
Normally it's not all that hard, but depends on how complex the regex is. For scraping prices on websites it's typically not all that difficult because most stores are laid out in a sane, predictable, fashion. RegEx might not even be the best choice honestly there are lots of different ways to scrape a website, xPath can work really well, or you run in to random things like goquery which help out scraping a ton because you can just use css selectors like in jQuery.
 
Joined
Dec 31, 2016
Messages
214
Likes
111
Degree
1
Normally it's not all that hard, but depends on how complex the regex is. For scraping prices on websites it's typically not all that difficult because most stores are laid out in a sane, predictable, fashion. RegEx might not even be the best choice honestly there are lots of different ways to scrape a website, xPath can work really well, or you run in to random things like goquery which help out scraping a ton because you can just use css selectors like in jQuery.
Hey man, I know how to scrape a little, what I need is something else. There's a plugin I used to have that would be able to figure out regex expressions just from selecting 2 prices from 2 unique products. Do I make sense? Like it would ask for product url 1 and price 1, then product url 2 and price 2, and then you'd be able to scrape prices without writing any regex yourself. So there had to be some kind of smart detection going on behind the scenes.
 

Rageix

BuSo Pro
Joined
Jan 11, 2017
Messages
94
Likes
102
Degree
0
Hmm that's interesting I've never seen anything like that, at least not for regex.

However something along those lines are Chrome and Firefox both have dev tools. Right click the page and open your dev tools, from the Inspector tab (Firefox), or Elements tab (Chrome) you can right click any element and then copy it's XPath. From there it can be pretty simple to just use XPath to scrape. My guess is that is probably what it was, but you never know.
 
Joined
Dec 31, 2016
Messages
214
Likes
111
Degree
1
I don't know, probably wasn't regex then :smile: it did and does work though, do you want me to send you a link to the plugin?
 
Joined
Dec 31, 2016
Messages
214
Likes
111
Degree
1
What is the easiest way to create a python gui on Linux (debian)?

I have a script which gets my earnings across networks. I run it in the browser now, but would prefer a gui, maybe even one with the option of casting to chromecast.
 

Rageix

BuSo Pro
Joined
Jan 11, 2017
Messages
94
Likes
102
Degree
0
Generally I think just making a web app out of it is the easiest option. Flask is a personal favorite framework.

I'm not sure if you can beam an entire web page from Chrome to a Chromecast so I can't really say. The only thing I know about it is you can send video from Chrome to it.

There are some other possible options to stream to your Chromecast, you could use something like AirParrot 2 to stream an entire entire desktop to the Chromecast device.

Also old fashion HDMI but that's not too sexy.
 
Joined
Dec 31, 2016
Messages
214
Likes
111
Degree
1
Hehe, I already have the webapp with Flask. I suppose it is a bit down the list of priorities to make a gui/chromecast. Ideally though it would be cool to integrate into linux debian os, perhaps in the status line, but I don't know if it is possible.
 
Joined
Dec 31, 2016
Messages
214
Likes
111
Degree
1
A css/javascript issue.

I have a conflict with css or javascript. I have a wordpress theme with a shortcode that does numbered headings with a circle. Then I install Table of Contents Plus plugin and it breaks these numbered headings. The circle with a number stays in place, but the header now moves straight down vertically, not horizontally.

I can't figure out what goes on, no css overlap as far as I can tell, could it be javascript? How would I go about debugging this? I was thinking just going on Fiverr to get someone to fix it, but would like to learn how to do it.
 

Ryuzaki

女性以上のお金
Staff member
BuSo Pro
Digital Strategist
Joined
Sep 3, 2014
Messages
2,880
Likes
5,269
Degree
7
You'd want to use your browser's developer tools to view the CSS being applied to the elements. For instance, I'd turn on the ToC plugin and let my header be vertically oriented. Then I'd open the developer console and see exactly the CSS being applied to that element and look for the piece that's making it go vertical. When you find it, you can see under which CSS rule it's being applied and determine if that's coming from the ToC plugin or not.

Here's a visual example, where the CSS rules are on the left, with the top ones being the ones with the most priority and then descending down to more general rules:



The fix would be to either load a 2nd CSS file last in the header after the wp_head() hook, so that the CSS fix overrides the plugin's CSS file. Or you could inline the CSS fix in your header itself.
 
Joined
Dec 31, 2016
Messages
214
Likes
111
Degree
1
Yeah, I tried that, but I couldn't figure it out, all very confusing to be honest with Wordpress themes, so much css everywhere. I ended up making a fix where I made new circles in css, div/span/h2, which I suppose I could just make into a shortcode myself. Looked better in the end. Still annoys me I can't figure out this stuff. Can't spend an hour here an hour there on minute things like this.
 

turbin3

BuSo Pro
Digital Strategist
Joined
Oct 9, 2014
Messages
574
Likes
1,124
Degree
2
With so many WP themes and plugins, it's pretty typical for CSS to be setup to overwrite lots of things. What I mean by that is, you'll have a lot of default styles, and things will usually be setup to load the CSS files in a certain order. So your custom CSS loads last and....hopefully...overwrites default stuff.

This is why it's so easy to break styles by inadvertently tweaking things to the point certain files load out of order. That or various performance plugins that concatenate resource files.

I normally start with the browser developer tools, like Ryuzaki said. What I also like to do is pick an element I'm having problems with, click that element in the HTML. Then I'll pick one of the relevant classes or ID's in the CSS window, pick one of its styles, and I'll "!important" it at the end. When in doubt, !important all the things. :wink: Usually throwing a few of those on a few elements (in the browser purely for debugging) will find the culprit pretty quick.

Where possible, I wouldn't actually use !important in your production CSS, as it can cause its own issues. It might just be a matter of tweaking your CSS with more specific class / ID paths. Another option is actually adding new classes / IDs into the HTML element (on top of the existing like class="original new") in your plugin or theme template.

@ragnar, on the Python question, not sure if this would work for what you were asking about. Have you ever used Jupyter (ipython) notebooks? That's a pretty quick and easy way to get you something more GUI-oriented, and working in the browser. That plus something like the Matplotlib library could probably get you up and running pretty quickly with some decent visuals.
 
Joined
Jul 22, 2014
Messages
139
Likes
125
Degree
1
Another option is actually adding new classes / IDs into the HTML element (on top of the existing like class="original new") in your plugin or theme template.
I wouldn't recommend this unless you've designed your own theme or plugin, or have set up a child theme. If you edit the templates directly and then upgrade your theme or plugin, your changes will be overwritten each time. And you definitely want to keep your plugins up to date.

To get around the problem of tools that combine and minify and screw up the order of CSS loading, you should either inline the changes in the header or define the loading of an extra CSS file (like fix.css) at the very end of the header, after wp_head, which is what plugins use to spit out extra files or changes they made.

It's not elegant and creates either inline CSS (not desirable) or an extra HTTP request (not desirable) but that's the small price you pay when you rely on themes and plugins you didn't make.
 

turbin3

BuSo Pro
Digital Strategist
Joined
Oct 9, 2014
Messages
574
Likes
1,124
Degree
2
Sometimes I forget to be specific. To clarify, I always assume child theme and was speaking from that standpoint, and I shouldn't have mentioned plugins. Obviously doesn't quite apply to plugins.
 

turbin3

BuSo Pro
Digital Strategist
Joined
Oct 9, 2014
Messages
574
Likes
1,124
Degree
2
Although this isn't the simplest, what I recommend and use myself is the Scrapy framework for Python. It's wonderful to work with. I put together a tutorial on Scrapy awhile back. In hindsight, though, please forgive the walls of text. ;-)

That framework takes a bit of setup, but it's well worth it. It's easy to add proxies and even do things like setup your bots to rotate user agents, which I detailed in the tutorial.

If you just want something as simple and lightweight as possible, I have several recommendations. Here are a few Python libraries that are excellent for various scraping uses, without resorting to something more complex like Scrapy:
First off, the Requests library is awesome. It's a great solution for starting out, as it's very complete and has excellent documentation. It can even handle proxies, different content types, SSL, and many other things. This library gets used a TON by people since it's so nice to work with. I highly recommend checking it out.

Beautiful Soup's claim to fame is making it really easy to grab only the content you want off a page, without getting too crazy with code. Here's an example of how to use Beautiful Soup to grab content from pages and save it to a CSV. There are easier ways with less code, but that was just one.