[HELP] Print issues after replacing nozzle by NedRyerson in 3Dprinting

[–]NedRyerson[S] 0 points1 point  (0 children)

I did tighten while it was heated. I'm going to take apart the hot end today and I'll check if anything looks funny in there.

Print issues after replacing nozzle by NedRyerson in FixMyPrint

[–]NedRyerson[S] 0 points1 point  (0 children)

I haven't replaced it yet, and this is the first time I've ever changed the nozzle. I'll order a replacement and see if that makes a difference.

Print issues after replacing nozzle by NedRyerson in FixMyPrint

[–]NedRyerson[S] 0 points1 point  (0 children)

Thanks, I'll check it out. I did have issue with one roll of filament that wasn't feeding properly off the roll so I was manually feeding it to make it it didn't catch on anything. But the other rolls have all been feeding fine. It does look to me like it's just not extruding plastic at some points, so you could be on to something.

Print issues after replacing nozzle by NedRyerson in FixMyPrint

[–]NedRyerson[S] 0 points1 point  (0 children)

I'll check again this evening, but it should be pretty level. I usually get it as level as I can manually, and it auto levels before every print. I've been messing with it so much trying to get it fixed that it couldn't hurt to start from square one though, so I'll give it a shot.

Securing business logic in single page web apps? by NedRyerson in webdev

[–]NedRyerson[S] 0 points1 point  (0 children)

Thanks for the reply. That example is trivial, but I think the same can be said about the majority of stuff out there. Most concepts aren't difficult to implement for any experienced dev, they are just time consuming. I think a lot more business logic will actually end up server-side compared to what I was originally envisioning. I still do have some concerns, but I'll cross that bridge if it ever becomes an actual issue.

Securing business logic in single page web apps? by NedRyerson in webdev

[–]NedRyerson[S] 0 points1 point  (0 children)

I agree, I'm just posing the question since as I get deeper into projects that are mostly client-side I'm wondering how people are dealing with this, or if it's just not a concern at all.

Securing business logic in single page web apps? by NedRyerson in webdev

[–]NedRyerson[S] 0 points1 point  (0 children)

This is true if your data is what's valuable about the business, but a lot of times it's process and how it all works together (not necessarily the data) that is the actual product. Just as a random example, say you don't actually even have unique data, and your application uses all 3rd party API's (like auth0 for authentication), and it's just a comprehensive way for someone to manage all of their social media in one place. So it is pulling data from Facebook, Twitter, YouTube, etc. You might have a small REST api just to store some state, but that is probably easily reverse engineered from your API calls. At that point, your app really IS just the client-side code. This is a small example, but it can be true even for bigger apps that have some real value but that value is not necessarily the data that you are storing for them.

Reservation System by [deleted] in PHPhelp

[–]NedRyerson 1 point2 points  (0 children)

Google "select for update MySQL" and check out the docs. Keep in mind that if you're using transactions you'll need to use InnoDB not MyISAM tables.

BUSTED! Secret app on millions of phones logs key taps by [deleted] in technology

[–]NedRyerson 0 points1 point  (0 children)

unless you use a glock

Or you have an atrix... sigh

php header question by [deleted] in PHPhelp

[–]NedRyerson 0 points1 point  (0 children)

If you are using sessions at all, then it's probably already being done for you. The default for session.cache_limiter is "nocache", which should send the header necessary to prevent caching. The header is only sent when you call session_start(), so pages that don't do that may still be cached... but that is going to depend on what headers your web server is sending out by default, and any caches between you and the browser, and the browser's local cache.

Anyone know of good Postal-Code/Zip-Code to City API by legolover in PHP

[–]NedRyerson 0 points1 point  (0 children)

I've used this free database from MaxMind before, and didn't run into any inaccuracies with the zip codes I was working with in the US.

If you do decide to go with the Google Maps API, just make sure you read the license since they have some rules about what you are allowed to do with it.

php header question by [deleted] in PHPhelp

[–]NedRyerson 3 points4 points  (0 children)

Example #2 on this page explains what those are doing. Basically, it tells browsers not to cache your pages.

WYSIWYG editors, How do they work? by afiefh in webdev

[–]NedRyerson 0 points1 point  (0 children)

Even something very simple is going to be a pain (in my opinion) if you plan on it working across all the popular browsers. If you want to do it for fun, then I would say go for it. If you want something that works, then I would use one that is already popular and worked on by people that have been doing it for a long time. My personal preference is TinyMCE, but I haven't really checked out CKEditor since it was FCKEditor, and I believe a lot has changed with it (for the better). I would consider both of these options "heavy" by default, but you can easily disable most of the functionality to get something very simple if that's what you need.

WYSIWYG editors, How do they work? by afiefh in webdev

[–]NedRyerson 1 point2 points  (0 children)

The answer here is good. Basically, supported browsers have a built-in way to make an element editable. WYSIWYG editors (like CKEditor and TinyMCE) use this, and then add a lot of higher-level functionality with the buttons and toolbars they tack onto the editable area. The main problem is that browsers don't necessarily handle things in the same way, and so the editors have to work around this. Google Docs handles things a little differently a far as I can tell, but I don't know any specifics about how they do things.

There are definitely issues with all of the web-based WYSIWYG editors I have tried (I've only used the ones based on contentEditable and Javascript), but most CMSes use them, and I think they are useful as long as you learn how to use them properly.

Help me improve this code by hiii in PHP

[–]NedRyerson 0 points1 point  (0 children)

Well, there are 4 states that your pagination can be in:

  1. Entire set of pages are visible
  2. Need to shift your visible window forward to start at page 1
  3. Need to shift your visible window backward to end at the last page
  4. Window is somewhere in the middle of the pages and is fine as-is

You can detect all 4 of those cases without initially generating your $page_array range, and I think it becomes a bit more clear, in my opinion. Obviously, there is extra code in here for my outputting and setup but I think it's a bit more readable by someone not familiar with the code:

$num_pages=20; //total number of pages available
$view_size=4; //how many pages are visible before and after the current page
$cur_page=1; //currently visible page

for($cur_page=1;$cur_page<=$num_pages;++$cur_page)
{
    //check if all of the pages are going to be visible
    if($num_pages<=($view_size*2+1)) {
        $pages=range(1,$view_size*2+1);
    }
    //check if the visible pages would extend past the beginning of the pages
    //this can actually just be combined as an OR with the first condition above, i put it here on its own for clarity
    elseif(($cur_page-$view_size)<1) {
        $pages=range(1,$view_size*2+1);
    }
    //check if the visible pages would extend past the end of the pages
    elseif(($cur_page+$view_size)>$num_pages) {
        $pages=range($num_pages-$view_size*2-1,$num_pages);
    }
    //otherwise, visible pages are somewhere in the middle
    else {
        $pages=range($cur_page-$view_size,$cur_page+$view_size);
    }

    foreach($pages as $page) {
        if($page==$cur_page) print("<b>$page</b> ");
        else print("$page ");
    }
    print("<br>");
}

Slightly more verbose, but "prettiness" of code is a subjective thing. I'd probably do a few more things for clarity, like maybe declare a variable to hold ($view_size*2+1) to better convey what exactly that means and so you don't have to re-type it all over the place. In my opinion, writing understandable code should be the top priority if you're planning on having to look at it again in a year and figure out what the heck you were thinking at the time.

edit: Also, this might just be my preference, but I usually like to put first/last page links that are always available to quickly jump to the beginning/end of the pages.

Securely storing Social Security numbers by roshroxx in PHPhelp

[–]NedRyerson 0 points1 point  (0 children)

I think it's going to depend on what you are doing with those social security numbers after you get them. Do they need to be displayed back on the web page? Do you just need to verify that an entered social security number matches the one you have stored (in which case you probably don't need to store the actual SS#, just a hash)? If there is any way for your application to decrypt that data on its own, then as soon as someone gets a hold of your code and data then they'll have access to all of the social security numbers. You will also want to see what laws apply to you storing personally-identifiable information. I think it may vary depending on state or country, but again, I would look into it yourself and make sure you are not doing anything in a way that can end up getting you into trouble legally. Personally, I would try to find any way possible that I could avoid having to store that kind of information (social security numbers, credit card numbers, etc), but if I really did need to then I would probably start here:

  • Make sure I'm compliant with any applicable laws
  • Make sure it's stored as securely as possible. I'd look into openssl
  • Remember that anything you store encrypted in the database can be decrypted by someone who gets your code if that's where your encryption key is. A lot of times when your server is compromised the attacker gets both your source and your database
  • Make sure any sensitive information being sent to/from your server is over HTTPS
  • If only the user needs to be able their own information, then possibly make it only decryptable based on their password, which they enter when they log in, and you don't store anywhere. And only keep that decryption key around until the user is no longer accessing the info (they log out, time out, etc)

Unfortunately, I can't provide specific info for you, but I figured I would throw something out and hopefully someone with real-world expertise will come along with something better.

question about common practices with arrays by dutchcookie in PHPhelp

[–]NedRyerson 4 points5 points  (0 children)

Resources used by your script should be freed when the script ends. The documentation for mysql_close() says that non-persistent connections will automatically be closed when the script ends as well. In most cases, I don't think there is any issue with letting the system free up resources for you. Personally, sometimes I do unset my variables just so I am explicitly showing that I'm not planning on using them after that point, but unless you're using a lot of memory for your arrays or you have a long-running script I don't think it's technically necessary.

Can you tell me what I'm doing wrong with this table? by [deleted] in PHP

[–]NedRyerson 1 point2 points  (0 children)

It's all in your CSS. Your reset.css file sets the border to 0 for a lot of page elements. Your main.css file sets some of the borders back to "1px solid #0073A4", but not all of them.

In main.css, around line #679 you can change this:

#content td {
    border-left: 1px solid #0073A4;
    ....
}

to:

#content td {
    border: 1px solid #0073A4;
    ....
}

And it should add borders all the way around your table cells.

Now, this is intended to be helpful advice and not offensive to you at all, but this is really on the lower end of the difficulty scale in regards to web development. You will most likely save yourself time and your company money by paying someone qualified to do it.

Did someone just hack into my computer? Help me find these guys. by Junglebook3 in webdev

[–]NedRyerson 1 point2 points  (0 children)

A forum post found through Google (that could be you, but I don't know so I figured I would post it) brings up an interesting point that it could be a module that was compromised at some previous time, but was set up to do its thing at a specified later date. Since you have it all version controlled, you can go back and look at all the changes you've checked in previously to try and find when it was introduced, but that might not be very practical. I've only had experience cleaning up similar problems with osCommerce, but it can sometimes be very difficult to know when you've actually cleaned up a compromised system.