Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
AARO
Mar 9, 2005

by Lowtax
Do I need to do anything about this?

quote:

This email was sent from your website "Olin Obnizov" by the Wordfence plugin at Thursday 28th of July 2016 at 03:03:03 AM
The Wordfence administrative URL for this site is: http://olinobnizov.com/wp-admin/admin.php?page=Wordfence

A user with IP address 195.154.240.176 has been locked out from the signing in or using the password recovery form for the following reason: Exceeded the maximum number of login failures which is: 20. The last username they tried to sign in with was: 'Admin'
User IP: 195.154.240.176
User hostname: 195-154-240-176.rev.poneytelecom.eu
User location: France

Adbot
ADBOT LOVES YOU

kedo
Nov 27, 2007

AARO posted:

Do I need to do anything about this?

Do you have an admin user? If so, delete it.

AARO
Mar 9, 2005

by Lowtax

kedo posted:

Do you have an admin user? If so, delete it.

No I don't have a user with that name. This has been happening for the past few weeks. Always from France. Always tries to login with "Admin".

Really stupid for a "hacker" so I don't understand what their point is.

fuf
Sep 12, 2004

haha

AARO posted:

No I don't have a user with that name. This has been happening for the past few weeks. Always from France. Always tries to login with "Admin".

Really stupid for a "hacker" so I don't understand what their point is.

Welcome to wordpress :)

It's very unlikely anyone targeted you specifically - they're just random bots / scripts that scour the internet trying to get into vulnerable wordpress sites.

Make sure there's no user called "admin", use strong passwords, let wordfence do its thing, and hope for the best.

(maybe also make sure that the admin user is not the author of any public posts / pages so that the bots can't figure out what username to try.)

IronDoge
Nov 6, 2008

Looking at the security logs of my clients' sites, you can see people trying the same thing across the board. It's always some SQL injection attempt or XSS to try and exploit outdated plugins or insert themselves as an admin. If you're up to date on your CMS version, you generally don't have much to worry about. Often times these types of folks like to expend zero effort so they are just poking every site they can find to see who doesn't have the security patches in place. I've had logs where people try to do a SQL injection into a non-existent Wordpress table on my Joomla sites. It's most likely automated whoever is doing it.

Maed
Aug 23, 2006


I've made a form that walks Professors through creating a consent form. Is there a good JS library to create a docx from the information for them to download?

I need it to have a certain letterhead, font, and font size. I found a JS library that lets me make the docx but it can't read my CSS styles to format it correctly or add the letterhead. I'm not allowed to install anything onto the server so I can only either use client side JS or PHP for this. I'm awful at PHP though if there is an awesome PHP option I will use it.

Maed fucked around with this message at 16:34 on Jul 28, 2016

fuf
Sep 12, 2004

haha

IronDoge posted:

Looking at the security logs of my clients' sites, you can see people trying the same thing across the board. It's always some SQL injection attempt or XSS to try and exploit outdated plugins or insert themselves as an admin. If you're up to date on your CMS version, you generally don't have much to worry about. Often times these types of folks like to expend zero effort so they are just poking every site they can find to see who doesn't have the security patches in place. I've had logs where people try to do a SQL injection into a non-existent Wordpress table on my Joomla sites. It's most likely automated whoever is doing it.

yeah I see constant POST requests to non-existent files from scripts hoping to find outdated / vulnerable plugins.

As well as keeping WP up to date (ideally automatic updates), you also need to keep plugins updated (annoying because every so often something breaks), and imo use as few plugins as possible.

I have been super unlucky (negligent) when it comes to WP sites getting hacked. The only thing that makes me feel secure now is actively monitoring site files for changes, and monitoring logs for unusual POSTs. But then you're past the "Wordpress is so easy to use!" level...

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Maed posted:

I'm made a form that walks Professors through creating a consent form. Is there a good JS library to create a docx from the information for them to download?

I need it to have a certain letterhead, font, and font size. I found a JS library that lets me make the docx but it can't read my CSS styles to format it correctly or add the letterhead. I'm not allowed to install anything onto the server so I can only either use client side JS or PHP for this. I'm awful at PHP though if there is an awesome PHP option I will use it.

What do you mean 'read' your CSS styles? Are you trying to use the CSS on the webpage also in the docx? I can think of two ways to get around your problem. One is to simply duplicate the CSS you want in the JS and use it only for docx generation. This may not even be that bad, as you may need some custom tweaks later on that will only apply to documents. The second would be to use an XMLHttpRequest to fetch the CSS file from the webserver a second time, in your JS, and then parse through it as a string looking for the parts that you want. Personally, if it's not that complex, I'd go with one, you are already somewhat in a shitshow being so constrained. You could maybe use some build tools like Gulp to automate this process so you still only have one real source of truth.

Maed
Aug 23, 2006


Skandranon posted:

What do you mean 'read' your CSS styles? Are you trying to use the CSS on the webpage also in the docx? I can think of two ways to get around your problem. One is to simply duplicate the CSS you want in the JS and use it only for docx generation. This may not even be that bad, as you may need some custom tweaks later on that will only apply to documents. The second would be to use an XMLHttpRequest to fetch the CSS file from the webserver a second time, in your JS, and then parse through it as a string looking for the parts that you want. Personally, if it's not that complex, I'd go with one, you are already somewhat in a shitshow being so constrained. You could maybe use some build tools like Gulp to automate this process so you still only have one real source of truth.

I tried using https://github.com/evidenceprime/html-docx-js but it doesn't look at the styles at all. By read I was wondering if there was some other library that would parse the styles for me. I found another that said it would but when I looked at the code the function just said TODO: add css support. I'll try out the duplicating CSS in the JS and see if html-docx.js handles it correctly.

Right now it gives them a editable preview before they download the docx. I was hoping I could just use the styles I use for the preview to style the docx as well.

Maed fucked around with this message at 16:42 on Jul 28, 2016

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Maed posted:

I tried using https://github.com/evidenceprime/html-docx-js but it doesn't look at the styles at all. By read I was wondering if there was some other library that would parse the styles for me. I found another that said it would but when I looked at the code the function just said TODO: add css support. I'll try out the duplicating CSS in the JS and see if html-docx.js handles it correctly.

Something like https://www.npmjs.com/package/gulp-css-to-js may help in turning your css file into a js file which has the styles as JS objects, which may help.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



IronDoge posted:

Looking at the security logs of my clients' sites, you can see people trying the same thing across the board. It's always some SQL injection attempt or XSS to try and exploit outdated plugins or insert themselves as an admin. If you're up to date on your CMS version, you generally don't have much to worry about. Often times these types of folks like to expend zero effort so they are just poking every site they can find to see who doesn't have the security patches in place. I've had logs where people try to do a SQL injection into a non-existent Wordpress table on my Joomla sites. It's most likely automated whoever is doing it.

I replaced /wp-admin/login.php or whatever it is with a multi-gigabyte gzipped (valid!) static HTML file and configured Apache to serve it raw as a compressed output stream because of this stuff :3:

simcole
Sep 13, 2003
PATHETIC STALKER
Does anyone have any experience with WooCommerce? I have a previous customer wanting me to do a small bakery store with inhouse credit card processing using woocommerce. I know I'll need a SSL certificate but I've never done e-commerce before so I'm looking for any help and guidance before I quote it.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

I've set up about a dozen WooCommerce sites and have been working in eCommerce for the last 10 years, AMA

simcole
Sep 13, 2003
PATHETIC STALKER

Scaramouche posted:

I've set up about a dozen WooCommerce sites and have been working in eCommerce for the last 10 years, AMA

Thanks for the reply. Let me explain what they want and you can tell me what's maybe the best route to take. They have 4 bakeries across a large town. They want an online order system for these bakeries where certain items require a minimum purchase (say 3 dozen cookies or more). They want a sort of universal menu with online ordering/pickup where the user picks the "pickup location" once they order. This will email the correct bakery the order. It needs SSL (no problem), and some form of credit card processing preferably within the same web page without a ton of re-directs.

I have a bunch of questions:

1) What's my direct cost for using WooCommerce? Is there a yearly subsciption or plugin cost etc? I don't see one.
2) Are there any specific theme requirements to use WooCommerce or should I stick with their selections
3) Any must have plugins for Woo?
4) What kind of time commitment will it take to setup the e-store?

With all I've listed do you mind doing some hand holding here and pointing me in the direction you'd take. Thank you a bunch!

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

I'll answer your questions first and then address your use case second:

1)Direct cost for Wordpress is nothing. Totally free, requires Linux Hosting with MySQL database access (which is not free) and Wordpress (which is). However, there are two areas where you'll likely spend money. Plugins, and Themes. Woo is free, but it's also a bit under-featured, and that lack of functionality is made up by specific-purpose plugins made by a variety of authors. An example: The last site I did was for a wholesaler/importer of European equipment, all of these relatively well known brand names within his industry. The problem? WooCommerce doesn't support Brands as a concept. So we had to buy a plugin. Another example: We ship across Canada+US for the sales made on the site. Woo doesn't support a Tracking Number/Close Order kind of workflow, so I wrote a crappy one that re-purposes Order Notes. Last example: Our (Canadian) Payment Processor had no integration with WooCommerce, so we bought a (really good) plugin that saved me tons of time and headache. Depending on your use-case you're probably going to have to buy some plugins for Woo, or spend some time adding in the functionality you want by hand. What I like about it though is, those plugins are generally flat rate buys. No monthly recurring costs. Themes are the same; if you're super wizardy at WP you can just hack something together with the default themes. Or, you can save time/money and buy one. For me, the best for pay theme I've used on Woo is Flatsome. Lots of built-in shortcodes, grids, sliders, controls, menus, all great stuff. Support is quite good too. A good free theme for Woo in my experience is Customizr, however it's not super user friendly. Basically you're expected to configure everything, and everything you don't configure you'll have to hand-style/code using the (relatively elegant) Bootstrap implementation underlying it. It takes a bit of tweaking (think messing with grid height, corner style, etc.) but you can get a nice looking site out of it.
2)Generally if a theme says it supports WooCommerce, it'll work for it in my experience. What's nice with the free ones is that you can just install them, see what it looks like, and then mess around/change to another theme, without really "losing" anything since your product/logic stuff is abstracted out.
3)Good plugins for Woo are going to depend on functionality. For my last three projects I've used these (all free): Abandoned Cart Lite for Woo, All In One Scheme.org Rich Snippets (might not be necessary for a bespoke product like baking), Better Wordpress Google XML Sitemaps (Webmaster Tools bait basically), Booster for Woocommerce (a bunch of pricing/shipping/cart functionality, some useful some not), Ninja Forms (pretty good basic form creator/handler), The SEO Framework (basic set and forget SEO plugin), WooCommerce Conversion Tracking (Google analytics conversion metrics for ecommerce specific targets), YITH Ajax Search, YITH Gift Cards, YITH Wishlist, WP All Import - WooCommerce (so I can create products in Excel instead of in Woo interface; generally only needed if you're doing 100s of products at once).
4)Setting up a new Woo is basically broken down into two big things: 1)styling/aesthetics/photoshop/css'ing and 2)data entry for products. Buying a pro theme cuts down on 1) considerably, but not much will help you with 2). I've down a small Woo (~40 products) in about 20 hours, but that was bare minimum, and was actually more of a conversion of an existing property so all the information I needed was already present.

Now for what you're asking for features wise.
- Minimum order qty: There's plugins that do this (https://en-ca.wordpress.org/plugins/woocommerce-incremental-product-quantities/ note: I have not used this). There's also a Minimum Order Amount ($$$) option in the Booster plugin above.
- Pickup locations could be done with a thing called Shipping Zones, where you set up say 4 shipping methods called Local Pickup - (Location 1), Local Pickup - (Location 2), etc. Automatic assignment/notification of those orders to those locations would have to occur separately, or maybe there's a plugin that does it? Worst case is each bakery can log into the Orders section of the site; there's a column that lists the shipping method and they could pick up their own orders that way.
- Credit card processing requires a payment processor of some kind. Usually, for a real world case, you can piggy back on their existing processor. For example if they use Chase Paymentech as their in-store POS processor, you can also use Chase online. This could be the sticking point actually, depending on how big/good/popular your payment processor is, and is usually the cause of a plugin purchase. At worst, Woo can default to PayPal/PayPal Express pretty well out of the box. The latter does not require SSL (since everything gets thrown to PayPal) and can be a good testing/starting point. If their in-store processor is totally worthless you can go Stripe/Braintree/etc. quite easily, but it really makes financial sense to only be paying a percentage/per order fee to one processor in the business.

simcole
Sep 13, 2003
PATHETIC STALKER

Scaramouche posted:

I'll answer your questions first and then address your use case second:

1)Direct cost for Wordpress is nothing. Totally free, requires Linux Hosting with MySQL database access (which is not free) and Wordpress (which is). However, there are two areas where you'll likely spend money. Plugins, and Themes. Woo is free, but it's also a bit under-featured, and that lack of functionality is made up by specific-purpose plugins made by a variety of authors. An example: The last site I did was for a wholesaler/importer of European equipment, all of these relatively well known brand names within his industry. The problem? WooCommerce doesn't support Brands as a concept. So we had to buy a plugin. Another example: We ship across Canada+US for the sales made on the site. Woo doesn't support a Tracking Number/Close Order kind of workflow, so I wrote a crappy one that re-purposes Order Notes. Last example: Our (Canadian) Payment Processor had no integration with WooCommerce, so we bought a (really good) plugin that saved me tons of time and headache. Depending on your use-case you're probably going to have to buy some plugins for Woo, or spend some time adding in the functionality you want by hand. What I like about it though is, those plugins are generally flat rate buys. No monthly recurring costs. Themes are the same; if you're super wizardy at WP you can just hack something together with the default themes. Or, you can save time/money and buy one. For me, the best for pay theme I've used on Woo is Flatsome. Lots of built-in shortcodes, grids, sliders, controls, menus, all great stuff. Support is quite good too. A good free theme for Woo in my experience is Customizr, however it's not super user friendly. Basically you're expected to configure everything, and everything you don't configure you'll have to hand-style/code using the (relatively elegant) Bootstrap implementation underlying it. It takes a bit of tweaking (think messing with grid height, corner style, etc.) but you can get a nice looking site out of it.
2)Generally if a theme says it supports WooCommerce, it'll work for it in my experience. What's nice with the free ones is that you can just install them, see what it looks like, and then mess around/change to another theme, without really "losing" anything since your product/logic stuff is abstracted out.
3)Good plugins for Woo are going to depend on functionality. For my last three projects I've used these (all free): Abandoned Cart Lite for Woo, All In One Scheme.org Rich Snippets (might not be necessary for a bespoke product like baking), Better Wordpress Google XML Sitemaps (Webmaster Tools bait basically), Booster for Woocommerce (a bunch of pricing/shipping/cart functionality, some useful some not), Ninja Forms (pretty good basic form creator/handler), The SEO Framework (basic set and forget SEO plugin), WooCommerce Conversion Tracking (Google analytics conversion metrics for ecommerce specific targets), YITH Ajax Search, YITH Gift Cards, YITH Wishlist, WP All Import - WooCommerce (so I can create products in Excel instead of in Woo interface; generally only needed if you're doing 100s of products at once).
4)Setting up a new Woo is basically broken down into two big things: 1)styling/aesthetics/photoshop/css'ing and 2)data entry for products. Buying a pro theme cuts down on 1) considerably, but not much will help you with 2). I've down a small Woo (~40 products) in about 20 hours, but that was bare minimum, and was actually more of a conversion of an existing property so all the information I needed was already present.

Now for what you're asking for features wise.
- Minimum order qty: There's plugins that do this (https://en-ca.wordpress.org/plugins/woocommerce-incremental-product-quantities/ note: I have not used this). There's also a Minimum Order Amount ($$$) option in the Booster plugin above.
- Pickup locations could be done with a thing called Shipping Zones, where you set up say 4 shipping methods called Local Pickup - (Location 1), Local Pickup - (Location 2), etc. Automatic assignment/notification of those orders to those locations would have to occur separately, or maybe there's a plugin that does it? Worst case is each bakery can log into the Orders section of the site; there's a column that lists the shipping method and they could pick up their own orders that way.
- Credit card processing requires a payment processor of some kind. Usually, for a real world case, you can piggy back on their existing processor. For example if they use Chase Paymentech as their in-store POS processor, you can also use Chase online. This could be the sticking point actually, depending on how big/good/popular your payment processor is, and is usually the cause of a plugin purchase. At worst, Woo can default to PayPal/PayPal Express pretty well out of the box. The latter does not require SSL (since everything gets thrown to PayPal) and can be a good testing/starting point. If their in-store processor is totally worthless you can go Stripe/Braintree/etc. quite easily, but it really makes financial sense to only be paying a percentage/per order fee to one processor in the business.

Wonderful write up. I appreciate the amount of time that must have taken you. I'm pretty good at setting up the themes/coding but I do love a good theme to save lots of time. It seems I need to do a potential test install on my development site and see what's what. The plugins are the interesting thing. There are tons and I'll have to make sure the ones I select will work. I REALLY appreciate you listing all the plugins you use. I see the Local Pickup plugin, the minimum order, etc. I think this will work nice.

I think I'm doing to dip my toes into this one and see how I come out. Again, Bravo at the writeup! I'll post another question if I get stuck. I'm going to budget 40 hours roughly to start/learn.

IronDoge
Nov 6, 2008

Munkeymon posted:

I replaced /wp-admin/login.php or whatever it is with a multi-gigabyte gzipped (valid!) static HTML file and configured Apache to serve it raw as a compressed output stream because of this stuff :3:

That is deliciously evil. I would do that if I wasn't worried about racking up bandwidth costs across my entire client base, lol.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

simcole posted:

Wonderful write up. I appreciate the amount of time that must have taken you. I'm pretty good at setting up the themes/coding but I do love a good theme to save lots of time. It seems I need to do a potential test install on my development site and see what's what. The plugins are the interesting thing. There are tons and I'll have to make sure the ones I select will work. I REALLY appreciate you listing all the plugins you use. I see the Local Pickup plugin, the minimum order, etc. I think this will work nice.

I think I'm doing to dip my toes into this one and see how I come out. Again, Bravo at the writeup! I'll post another question if I get stuck. I'm going to budget 40 hours roughly to start/learn.

Yeah that's basically how I started; get it going on Localhost. The newer IIS will even run php/wp on Windows with a relatively clean Web Deploy package instead of having to screw around with WAMP/LAMP if you're on Windows.

If you're going to mess with the Woo appearance stuff all their templates are in the /plugins/woocommerce/template folder. Also make sure after setup to go into WP Settings and WooCommerce settings to figure out your permalink/home page/shop page stuff before committing to anything else.

Data Graham
Dec 28, 2009

📈📊🍪😋



IronDoge posted:

That is deliciously evil. I would do that if I wasn't worried about racking up bandwidth costs across my entire client base, lol.

Won't it also gently caress your open thread pool on your server, though? Not to mention your own bandwidth usage.

dexter6
Sep 22, 2003
I stood up a single-page wordpress site and it's slow as balls. Google says it takes 16 seconds to load a 42KB site.

How do I figure out if it's lovely Network Solutions hosting or some other problem?

http://fallschurchvfd.org/join/

(please go easy on me)

Data Graham
Dec 28, 2009

📈📊🍪😋



I get 4 seconds before the first byte comes back from the server. The rest (images, css, js) loads in almost immediately, and nothing's particularly big.

So it's not the static content that's the problem. Nor is it the .asp pages that make up the rest of the site; they're nice and snappy.

What is that admin-ajax.php XHR that loads in? I assume it's something for that map at the bottom. It too takes 4 seconds. What happens if you take that out?

dexter6
Sep 22, 2003

Data Graham posted:

I get 4 seconds before the first byte comes back from the server. The rest (images, css, js) loads in almost immediately, and nothing's particularly big.

So it's not the static content that's the problem. Nor is it the .asp pages that make up the rest of the site; they're nice and snappy.

What is that admin-ajax.php XHR that loads in? I assume it's something for that map at the bottom. It too takes 4 seconds. What happens if you take that out?
I don't actually know, because I just did everything through the WP GUI.

But yes, I have noticed the map seems to lazy load, sometimes you can scroll and not see it there.

So other than that last 4 seconds, it seems to say it's dependent on Network Solutions?

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

dexter6 posted:

I stood up a single-page wordpress site and it's slow as balls. Google says it takes 16 seconds to load a 42KB site.

How do I figure out if it's lovely Network Solutions hosting or some other problem?

http://fallschurchvfd.org/join/

(please go easy on me)

Considering your long TTFB (time to first byte) on both of your .php routes, I'm guessing the problem is with rendering your PHP pages. Either a lack of available resources to do the rendering, or there is something insane going on in your PHP code.

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.

Skandranon posted:

Considering your long TTFB (time to first byte) on both of your .php routes, I'm guessing the problem is with rendering your PHP pages. Either a lack of available resources to do the rendering, or there is something insane going on in your PHP code.

Black-box debugging ahoy:

http://fallschurchvfd.org/join/wp-content/uploads/2016/07/cropped-header.jpg
Loads quickly. Network and the webserver itself are OK.

http://fallschurchvfd.org/join/wp-settings.php
Crashes out (expected), and crashes fast. The problem isn't base PHP.

http://fallschurchvfd.org/join/xmlrpc.php
Takes about an average time to load (when compared with other WP sites). The XML-RPC endpoint loads WP core, so it's not Wordpress Core being the problem. Also helps to exclude show hosting (SQL Connection, disk read, etc).

TTFB on that AdminAjax request is dog slow (2-5s) as is the homepage itself http://fallschurchvfd.org/join/

I'm going to hazard a guess that an API call is being made in the backend, probably by a plugin you've got installed. I don't know of a good way to debug that, but I'd advise disabling plugins one-by-one, and changing theme, if necessary, until the TTFB drops right down.

A quick semi-reliable workflow for this:
1. Crack open dev tools in chrome (F12)
2. Go to the Network Tab.
3. Refresh the page
4. Search for "admin-ajax". It should reveal a single POST request.
5. Right click and hit "Replay XHR"
6. Click the request. Go to the "Timing" tab. Observe the lovely TTFB.
7. Go into WP-admin in another window
8. Disable something
9. Go to step 5.

mike12345
Jul 14, 2008

"Whether the Earth was created in 7 days, or 7 actual eras, I'm not sure we'll ever be able to answer that. It's one of the great mysteries."





I'm still using nanoblogger to manage my site, but am thinking about moving to a different static site generator. Is Jekyll still the go-to solution? There are so many now, it's weird. Content is mostly art & images, would like to switch to something with a grid-view. But that's probably just a themeing issue nowadays.

Odette
Mar 19, 2011

mike12345 posted:

I'm still using nanoblogger to manage my site, but am thinking about moving to a different static site generator. Is Jekyll still the go-to solution? There are so many now, it's weird. Content is mostly art & images, would like to switch to something with a grid-view. But that's probably just a themeing issue nowadays.

Yeah, there's Jekyll, or even Hugo.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Odette posted:

Yeah, there's Jekyll, or even Hugo.

I have used and really like Pelican as well.

mike12345
Jul 14, 2008

"Whether the Earth was created in 7 days, or 7 actual eras, I'm not sure we'll ever be able to answer that. It's one of the great mysteries."





Found a theme for Hugo that suits my needs. Already got a test site up and running on Ubuntu, no big deal. Seems cool.

ModeSix
Mar 14, 2009

Sirs. My Google-Fu is failing me and I can't figure this out on my own.

You're all going to laugh and tell me to go to the Visual Basic thread to die or something equally heinous I am sure, because I am positive this is a very simple thing to do and I can't see the light.

I'm using Angular + Bootstrap, so you know what resources I have at my disposal.

All I am trying to do is set the navbar position on page load to be at the bottom of the viewport, I don't want it to stick there, I want it to scroll with the page, and when it reaches the top of the page to stick there as a fixed top navbar until the person scrolls back down again.

I can get the part where it sticks to the top to work and unsticks when the page is scrolled down again, I however cannot for the life of me figure out how to position it dynamically at the bottom of the viewport on render.

As I said, it's probably dead simple and I should just start stabbing myself with pencils and learn Visual Basic so that I can be made fun of eternally for my inability to grasp simple concepts.

For an example of what I want the navbar to do, you can look at this site (which is not mine): http://www.ianposton.com/

Please help.

ModeSix fucked around with this message at 14:13 on Aug 3, 2016

Data Graham
Dec 28, 2009

📈📊🍪😋



ModeSix posted:

Sirs. My Google-Fu is failing me and I can't figure this out on my own.

You're all going to laugh and tell me to go to the Visual Basic thread to die or something equally heinous I am sure, because I am positive this is a very simple thing to do and I can't see the light.

I'm using Angular + Bootstrap, so you know what resources I have at my disposal.

All I am trying to do is set the navbar position on page load to be at the bottom of the viewport, I don't want it to stick there, I want it to scroll with the page, and when it reaches the top of the page to stick there as a fixed top navbar until the person scrolls back down again.

I can get the part where it sticks to the top to work and unsticks when the page is scrolled down again, I however cannot for the life of me figure out how to position it dynamically at the bottom of the viewport on render.

As I said, it's probably dead simple and I should just start stabbing myself with pencils and learn Visual Basic so that I can be made fun of eternally for my inability to grasp simple concepts.

For an example of what I want the navbar to do, you can look at this site (which is not mine): http://www.ianposton.com/

Please help.

E: Zeroth hint: if you like a thing a site is doing, the code is right there for you to poke through and reference. Ah, front-end.

First hint: it's a JavaScript trick, not pure CSS, which you can tell by turning off JS and seeing that it doesn't happen on page load.

Second: in the scripts loaded by the site, there's one called "x-head.min.js", which defines a likely-looking function called scrollBottom(). Take a look at what it's doing with the document height and so on.

Third: search all the resources for mention of scrollBottom and you'll find it's being called via a chunk of inline code in the page itself.

That should be enough to get you pointed in the right direction.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



IronDoge posted:

That is deliciously evil. I would do that if I wasn't worried about racking up bandwidth costs across my entire client base, lol.

This
Bash code:
perl -e 'print "<!DOCTYPE html>\n<html><head><title>gently caress You</title></head><body>l"; for($i=0; $i <= 2359375; ++$i){print "o"x4096;} print "l</body></html>"' | gzip -c > hello.html.gz
emits a 9 MB file that combined with
code:
RewriteEngine On    
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.(html|css|js|php) hello.$2\.gz [QSA]

# Prevent double gzip and give the correct mime-type
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=FORCE_GZIP]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=FORCE_GZIP]
RewriteRule \.html\.gz$ - [T=text/html,E=no-gzip:1,E=FORCE_GZIP]
RewriteRule \.php\.gz$ - [T=text/html,E=no-gzip:1,E=FORCE_GZIP]

Header set Content-Encoding gzip env=FORCE_GZIP
Header set Cache-Control "private"
goes over the wire raw and decompresses to 9 GB on the other end. I picked 9 because I figure a lot of machines max out at 8 GB of RAM nowdays and I figure it shouldn't cost too much bandwidth compared to a single image-heavy page, for example.

Data Graham posted:

Won't it also gently caress your open thread pool on your server, though? Not to mention your own bandwidth usage.

Yeah, that's a good point. I guess having the client on the other end lock up and die during the transfer would block a thread. This is just for my personal site, which is low traffic, so I don't care.

Depressing Box
Jun 27, 2010

Half-price sideshow.

ModeSix posted:

Sirs. My Google-Fu is failing me and I can't figure this out on my own.

You're all going to laugh and tell me to go to the Visual Basic thread to die or something equally heinous I am sure, because I am positive this is a very simple thing to do and I can't see the light.

I'm using Angular + Bootstrap, so you know what resources I have at my disposal.

All I am trying to do is set the navbar position on page load to be at the bottom of the viewport, I don't want it to stick there, I want it to scroll with the page, and when it reaches the top of the page to stick there as a fixed top navbar until the person scrolls back down again.

I can get the part where it sticks to the top to work and unsticks when the page is scrolled down again, I however cannot for the life of me figure out how to position it dynamically at the bottom of the viewport on render.

As I said, it's probably dead simple and I should just start stabbing myself with pencils and learn Visual Basic so that I can be made fun of eternally for my inability to grasp simple concepts.

For an example of what I want the navbar to do, you can look at this site (which is not mine): http://www.ianposton.com/

Please help.

Toggling the stickiness will still need to be in JS, but you can use vh units to position it at the bottom of the window, like so.

EDIT: And if you don't want the navbar to be a child of the header element, you can combine vh with calc() (example).

Depressing Box fucked around with this message at 14:44 on Aug 3, 2016

ModeSix
Mar 14, 2009

Thanks guys.

Both of your answers lead me to the right place.

Combining the CSS with some jquery tricks I have been able to get this to work perfectly. I didn't know about 100vh, and that really put me on the right track.

I think quite literally it's about 10 lines of javascript to do this, and really they are short lines.

Most of the skullfuckery is in the css, which I've gotten sorted out now.

Appreciated.

fuf
Sep 12, 2004

haha

Munkeymon posted:

This
Bash code:
emits a 9 MB file that combined with
code:
RewriteEngine On    
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.(html|css|js|php) hello.$2\.gz [QSA]

# Prevent double gzip and give the correct mime-type
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=FORCE_GZIP]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=FORCE_GZIP]
RewriteRule \.html\.gz$ - [T=text/html,E=no-gzip:1,E=FORCE_GZIP]
RewriteRule \.php\.gz$ - [T=text/html,E=no-gzip:1,E=FORCE_GZIP]

Header set Content-Encoding gzip env=FORCE_GZIP
Header set Cache-Control "private"
goes over the wire raw and decompresses to 9 GB on the other end. I picked 9 because I figure a lot of machines max out at 8 GB of RAM nowdays and I figure it shouldn't cost too much bandwidth compared to a single image-heavy page, for example.


Yeah, that's a good point. I guess having the client on the other end lock up and die during the transfer would block a thread. This is just for my personal site, which is low traffic, so I don't care.

I'm probably reading those rewrite rules wrong but don't they mean your crazy hello.html gets served in response to any css, html, js, php requests? How do you allow legitimate requests and legitimate wordpress logins?

fuf
Sep 12, 2004

haha

DarkLotus posted:

If you're running any kind of a web hosting server and host wordpress, it will eventually be compromised. I suggest you use something like mailchannels, they identify and stop spam and alert you to it so you can fix it.
It's what Lithium uses on all shared hosting servers and we even sell low volume mailchannels plans if you want to try it out.

So this has already saved my rear end once.

My Mailchannels dashboard right now:

You've sent: 13,987
And we've delivered: 46

lol

DarkLotus
Sep 30, 2001

Lithium Hosting
Personal, Reseller & VPS Hosting
30-day no risk Free Trial &
90-days Money Back Guarantee!

fuf posted:

So this has already saved my rear end once.

My Mailchannels dashboard right now:

You've sent: 13,987
And we've delivered: 46

lol

Are you signed up through Lithium? Are your company initials TWD?
If so, I'm glad to hear it's working well for you. You might want to get some help with your server's mail settings, it looks like alot of the messages are unauthenticated and don't have a from address or a sender id.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



fuf posted:

I'm probably reading those rewrite rules wrong but don't they mean your crazy hello.html gets served in response to any css, html, js, php requests? How do you allow legitimate requests and legitimate wordpress logins?

You're right. Sorry, I should have been clear that it's a honeypot to gently caress with script kiddies' bots.

E: honeypot might not be the right term, but it still gives me the warm fuzzies to find hits in the logs because it's not linked anywhere :3:

Munkeymon fucked around with this message at 17:53 on Aug 3, 2016

fuf
Sep 12, 2004

haha

DarkLotus posted:

Are you signed up through Lithium? Are your company initials TWD?

Maaaaaaaybe :ninja:

I didn't realise you could see my logs haha

Yeah it's still a mess at the moment, but at least I'm not actually sending out spam anymore.

I just fixed the "from" address problem - I had a "MASQUERADE_AS" rule in my sendmail.mc for some reason.

I have no idea about sender id really. I haven't updated most of the dns spf records yet to reflect moving to mailchannels. Maybe when I've done that the sender id will work? :confused:

return0
Apr 11, 2007
I'm a total webdev noob. I've recently started making a single page app using React and Redux. I want to be able to asyncronously dispatch arbitrary events to the back end from the UI, optimistically apply their state changes on the front end client model & DOM, but roll back these changes if the back end action fails.


The use case for this is like:

1. User creates a collection of Things using a UI interaction.
2. User adds Thing 1.
3. User adds Thing 2.
4. User adds Thing 3.

If for some reason the server is taking a long time to process ThingEvents, creating a ThingCollection might take a long time on the back end. I want to the user to be able to interact with the ThingCollection, adding stuff to it before the back end has completed. Likewise for adding things. Now, imagine that adding Thing 2 fails, with a 500 on the back end. I'd like to detect this and roll back adding Thing 3 and Thing 2.

To implement, I've got the actions posting to a queue, which is drained sequentially. An event is dispatched to the back end when the prior event completes, but the UI is updated immediately using redux-optimistic-ui. If the event on the back end succeeds, I commit and dispatch the next event. If it fails, I rollback the state change and then pop each event from the queue, rolling back each.

This architecture appears to work functionally, and avoids highly specific promise chaining (which is not cool for queueing unpredictable user interaction with the UI). However, I feel like I'm fighting with the frameworks a little bit, and am wondering:

  • Is this a sane thing to do?
  • Is this an idiomatic expression of the implementation?
  • If not, is there another better/more idiomatic way?

Also, a general question: where do people implement find the most sane place to implement domain logic in React/Redux - right now I'm finding I'm adding a lot of domain logic in actions, querying the global state to implement the logic?

Thanks!

Adbot
ADBOT LOVES YOU

DarkLotus
Sep 30, 2001

Lithium Hosting
Personal, Reseller & VPS Hosting
30-day no risk Free Trial &
90-days Money Back Guarantee!

fuf posted:

Maaaaaaaybe :ninja:

I didn't realise you could see my logs haha

Yeah it's still a mess at the moment, but at least I'm not actually sending out spam anymore.

I just fixed the "from" address problem - I had a "MASQUERADE_AS" rule in my sendmail.mc for some reason.

I have no idea about sender id really. I haven't updated most of the dns spf records yet to reflect moving to mailchannels. Maybe when I've done that the sender id will work? :confused:

Don't worry, I can't see much, especially not message contents or anything sensitive.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply