To make your invention available for public use and bar somebody patenting it, you need to publish it, simple as that. Of course, nothing ever carries a real 100% guarantee. The issues with invention publication are simple: publication date and how easy it is accessible to the examiner in a prior art search. Obtaining a patent on anything similar that has been invented *after* your information publishes should be hindered by your publication. Understand that it's not important when you have submitted the information for publication, but when it's made available (for example, online). So, verifiable date is one issue. Another issue is whether the examiner will have a chance to consider this information when a related application is submitted to the patent office. There is a chance that your information would not come up in a search and would not be considered, and an improper patent would issue. The good news is, such patent would be flawed, and would likely not withstand a court challenge. The bad news is, not everyone has the resources to battle in court even when the patent is a joke. So, how to make the publication easily available to the examiner? Perhaps the best way is to do so-called statutory invention registration, but you'll have to fork over a few hundred bucks. Such SIR would be recorded in the USPTO database, and an examiner will never fail to search that. Anything else is a step below IMO, but I do have any insight into examiners searching habits, so the significance of that step is debatable. In the end it's up to you to decide what kind of trouble you are willing to go through to achieve your goal.
One final remark. The publication date may be of great importance. From that perspective publishing something in a trade magazine has the advantage of publication date being easily verifiable. Another advantage is that the publication would carry a bit more weight. I am assuming that you are talking about a well known magazine. Of course the date issue can also be addressed if you choose self-publication on a website. You can verify the date by showing the web pages to some people who understand the invention, make a printout and have them date and sign it. That way it's very clear when the invention was made public in case it has to be proven in court.