What are the shortcut to Auto-generating toString Method in Eclipse?

Eclipse 3.5.2 (and possibly earlier versions) already provides this feature. If you right-click within the editor, you’ll find it under Source -> Generate toString()… To answer your question about whether it’s a bad practice to autogenerate toString(), my opinion is that it is not. If the generated code is very similar to the code you … Read more

What’s the least redundant way to make a site with JavaScript-generated HTML crawlable?

Why didn’t I think of this before! Just use http://phantomjs.org. It’s a headless webkit browser. You’d just build a set of actions to crawl the UI and capture the html at every state you’d like. Phantom can turn the captured html into .html files for you and save them to your web server. The whole … Read more

Firefox refresh current tab from command-line

You can use xdotool for automation. Install on Ubuntu with sudo aptitude install xdotool Then you can search for windows and send keys or mouse events, see man xdotool for the full documentation. I use following script on Ubuntu 16.04 LTS during development: WID=`xdotool search –name “Mozilla Firefox” | head -1` xdotool windowactivate $WID xdotool … Read more

Check if element is clickable in Selenium Java

elementToBeClickable is used for checking an element is visible and enabled such that you can click it. ExpectedConditions.elementToBeClickable returns WebElement if expected condition is true otherwise it will throw TimeoutException, It never returns null. So if your using ExpectedConditions.elementToBeClickable to find an element which will always gives you the clickable element, so no need to … Read more

Automation Google login with python and selenium shows “”This browser or app may be not secure””

First of all don’t use chrome and chromedriver. You need to use Firefox.(if not installed) Download and install Firefox. Login to Google with normal Firefox. You need to show the Google site that you are not a robot. You can use code like this: from selenium import webdriver import geckodriver_autoinstaller from selenium.webdriver.common.desired_capabilities import DesiredCapabilities geckodriver_autoinstaller.install() … Read more

Creating a file shortcut (.lnk)

One way to do this is pointed out by Joepro in their answer here: You’ll need to add a COM reference to Windows Scripting Host. As far as i know, there is no native .net way to do this. WshShellClass wsh = new WshShellClass(); IWshRuntimeLibrary.IWshShortcut shortcut = wsh.CreateShortcut( Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + “\\shorcut.lnk”) as IWshRuntimeLibrary.IWshShortcut; shortcut.Arguments = … Read more

Automating Visual Studio with EnvDTE

As a solution to this issue you can register to an event that notifies when the solution load is done. This is a sample of class that lets you listen to events on solution loading: public class SolutionEventsListener : IVsSolutionEvents, IDisposable { private IVsSolution solution; private uint solutionEventsCookie; public event Action AfterSolutionLoaded; public event Action … Read more

Can Gulp overwrite all src files?

I can think of two solutions: Add an option for base to your gulp.src like so: gulp.src([…files…], {base: ‘./’}).pipe(…)… This will tell gulp to preserve the entire relative path. Then pass ‘./’ into gulp.dest() to overwrite the original files. (Note: this is untested, you should make sure you have a backup in case it doesn’t … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)