One thing that would definitely help the problem is software solutions to help parents, teachers, administrators, and social media content mediators identify potential threats. Algorithms could be developed that help red flag research, online behavior, etc - since a lot of these people are openly reading, discussing, threatening others etc on the Internet all the fucking time before shit like this happens. I'm not saying it would stop them all but for god sakes - people need to start paying fucking attention to what kids are doing and saying on the Internet. Yah it sucks and it's an invasion of your privacy but too fucking bad.
I also think badge access/keyfob entry controlling doors, monitored camera systems, modifying school layouts and entry points, school district police departments and/or campus marshalls etc would also really help the problem. I grew up in a city where most public highschools had their own dedicated police officers - add some more until you feel like your school is adequately covered. Also - the media hysteria surrounding mass casualty events absolutely plays a role in motivating sociopathic/psychopathic behavior in people who are suicidal and want to be remembered for killing innocent people.
What really amazing is all the technological and security options we have in place all over the country at large events, conferences, work campuses that everyone completely ignores in favor of just banning all guns.