Catching all exceptions in Python

except Exception: vs except BaseException:: The difference between catching Exception and BaseException is that according to the exception hierarchy exception like SystemExit, KeyboardInterrupt and GeneratorExit will not be caught when using except Exception because they inherit directly from BaseException. except: vs except BaseException:: The difference between this two is mainly in python 2 (AFAIK), and … Read more

Spring catch all route for index.html

Since my react app could use the root as forward target this ended up working for me @Configuration public class WebConfiguration extends WebMvcConfigurerAdapter { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController(“/{spring:\\w+}”) .setViewName(“forward:/”); registry.addViewController(“/**/{spring:\\w+}”) .setViewName(“forward:/”); registry.addViewController(“/{spring:\\w+}/**{spring:?!(\\.js|\\.css)$}”) .setViewName(“forward:/”); } } To be honest I have no idea why it has to be exactly in this specific format … Read more

Entity Framework Caching Issue

If you know that changes happened outside of EF and want to refresh your ctxt for a specific entity, you can call ObjectContext.Refresh datamodel.Refresh(RefreshMode.StoreWins, orders); If this seems like it will be a common occurance, you should disable object caching in your queries: SchoolBriefcaseEntities datamodel = new SchoolBriefcaseEntities(); datamodel.tblCities.MergeOption = MergeOption.NoTracking; or for to turn … Read more

nginx server_name wildcard or catch-all

Change listen option to this in your catch-all server block. (Add default_server) this will take all your non-defined connections (on the specified port). listen 80 default_server; if you want to push everything to index.php if the file or folder does not exist; try_files $uri /$uri /index.php; Per the docs, It can also be set explicitly … Read more

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