Baran Topal

Categories


baran
Author

baran

simple ajax with PHP

Long 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 [...]

baranbaran

super fast logging with log4j

Sometimes, 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 [...]

baranbaran

Connect to database in VB

Long 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> [...]

baranbaran

Some silly jquery example

Long 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> [...]

baranbaran

some more JQuery

Long 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'); [...]

baranbaran