Setting Objects to Null/Nothing after use in .NET

Should you set all the objects to null (Nothing in VB.NET) once you have finished with them? I understand that in .NET it is essential to dispose of any instances of objects that implement the IDisposable interface to release some resources although the object can still be something after it is disposed (hence the isDisposed … Read more

Origin null is not allowed by Access-Control-Allow-Origin

I have made a small xslt file to create an html output called weather.xsl with code as follows: <!– DWXMLSource=”http://weather.yahooapis.com/forecastrss?w=38325&u=c” –> <xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” exclude-result-prefixes=”yweather” xmlns:yweather=”http://xml.weather.yahoo.com/ns/rss/1.0″ xmlns:geo=”http://www.w3.org/2003/01/geo/wgs84_pos#”> <xsl:output omit-xml-declaration=”yes” indent=”yes”/> <xsl:strip-space elements=”*”/> <xsl:template match=”https://stackoverflow.com/”> <img src=”https://stackoverflow.com/questions/8456538/{/*/*/item/yweather:condition/@text}.jpg”/> </xsl:template> </xsl:stylesheet> I want to load in the html output into a div in an html file which I’m … Read more

getActivity() returns null in Fragment function

I have a fragment (F1) with a public method like this public void asd() { if (getActivity() == null) { Log.d(“yes”,”it is null”); } } and yes when I call it (from the Activity), it is null… FragmentTransaction transaction1 = getSupportFragmentManager().beginTransaction(); F1 f1 = new F1(); transaction1.replace(R.id.upperPart, f1); transaction1.commit(); f1.asd(); It must be something that … Read more

MySQL CONCAT returns NULL if any field contain NULL

I have following data in my table “devices” affiliate_name affiliate_location model ip os_type os_version cs1 inter Dell 10.125.103.25 Linux Fedora cs2 inter Dell 10.125.103.26 Linux Fedora cs3 inter Dell 10.125.103.27 NULL NULL cs4 inter Dell 10.125.103.28 NULL NULL I executed below query SELECT CONCAT(`affiliate_name`,’-‘,`model`,’-‘,`ip`,’-‘,`os_type`,’-‘,`os_version`) AS device_name FROM devices It returns result given below cs1-Dell-10.125.103.25-Linux-Fedora cs2-Dell-10.125.103.26-Linux-Fedora … Read more

Select rows which are not present in other table

I’ve got two postgresql tables: table name column names ———– ———————— login_log ip | etc. ip_location ip | location | hostname | etc. I want to get every IP address from login_log which doesn’t have a row in ip_location. I tried this query but it throws a syntax error. SELECT login_log.ip FROM login_log WHERE NOT … Read more

Filter values only if not null using lambda in Java8

I have a list of objects say car. I want to filter this list based on some parameter using Java 8. But if the parameter is null, it throws NullPointerException. How to filter out null values? Current code is as follows requiredCars = cars.stream().filter(c -> c.getName().startsWith(“M”)); This throws NullPointerException if getName() returns null. 6 Answers … Read more