start telnet with echo
Every now and then, I need to start telnet with an echo so that I can see what I type. So, here you go: telnet set localecho open localhost 80
baranEvery now and then, I need to start telnet with an echo so that I can see what I type. So, here you go: telnet set localecho open localhost 80
baranLong ago, while i was fiddling with PHP, I had 2 simple scripts, one takes input and the other processes that input. <!DOCTYPE html> <body> <script type="text/javascript"> // create a function that will receive data // sent from the server and will update // div section in the same page function process() { var [...]
baranSometimes, I want to set a logger in Java but I don’t want to lose time with setting a separate logger.properties file. Here is a snippet I use right in the code: Logger logger = Logger.getLogger("com.foo"); logger.setLevel(Level.INFO); FileAppender fa = new FileAppender(); fa.setWriter(new OutputStreamWriter(new [...]
baranLong ago, I needed to connect my database in VB and well, the best way is to use app.config and a ConnectionString in it. In app.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <connectionStrings> [...]
baranLong ago, I needed to grab a text field value when the mouse is click on a button. Here you go: <input type="text" value="hello value" id="hello" /> <input type="button" value="world value" id="world" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> [...]
baranA javabean is a class that conforms to certain standard conventions. That way the Servlet container can find your data. You can download the specification at http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html For a Servlet container, the javabean must be in a package. package rrz; import java.util.Random; [...]
baranLong ago, I needed to find specific XML element with XPath in Java. Here you go: package xpath; import java.io.IOException; import java.io.StringReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import [...]
baranLong ago, I wanted to populate a table where each component of JSON corresponds each table row and here is the solution: var json = { "component0": { "top": "99", "bottom": "14", "surcharge": "11" }, "component3": { "top": "99", "bottom": "14", "surcharge": "11" }, "component4": { "top": "99", "bottom": "14", "surcharge": "11" }, [...]
baranLong ago, I needed to have a map having a map as a value of the parent map 😛 Map<String, Map<String, String> myMap = new HashMap<String Map<String, String>>(); void addEntryToMap(String key, subKey, value) { Map<String, String> subMap = myMap.get(key); if (subMap == null) { subMap = new HashMap<String, [...]
baranLong ago, I was trying to get a value of a td class and appending the value to a text field in jquery. <table> <tr> <td class="test">This is a test</td> </tr> </table> <input type="text" id="myTextBox" /> $('td').click(function() { var myClass = $(this).attr('class'); [...]
baran