Below are the top ranked snippets.
4
This will render a flash div only if there is a message in flash. Also will set the id to the flash key.
flash[:notice] returns
This is the notice
flash[:notice] returns
This is the notice
4
I was looking for an easy way to populate a combo box with strings taken from an enumeration, and also to be able to pull out Enum objects from the combo box. After some searching, I found EnumComboBoxModel on the JDesktop website, but was not able to find any code.
Instead I came up with an easier solution that did not require me to define a new Model class, but instead uses javax.swing.DefaultComboBoxModel.
Sorry for the disorganization of the code, but hopefully you get the idea.
Instead I came up with an easier solution that did not require me to define a new Model class, but instead uses javax.swing.DefaultComboBoxModel.
Sorry for the disorganization of the code, but hopefully you get the idea.
4
This bit of code will open up the http link in a new browser window. The link should be passed to the variable "HTML_File" as a string (as shown below).
4
This class uses generics and provides functions that wrap writing to and reading from an ASP.NET session.
4
To create a chatprogram in java we need 2 classes one for Client and one for Server from which the client will be able to connect and exchange text messages. to compile the code simply type these commands in command prompt window:-
1)ipconfig(memorize the Ip address)
2)javac client.java
3)javac server.java
4)java server 10.69.23.203 (You need to type your own ip address)
5) After this you need to open another command prompt window(Make sure the server command prompt window is also open). now type:
java client 10.69.23.203
Thats it.
if anyone have any problems please post a comment and i will answer all of your questions or if you are having trouble in compiling.
1)ipconfig(memorize the Ip address)
2)javac client.java
3)javac server.java
4)java server 10.69.23.203 (You need to type your own ip address)
5) After this you need to open another command prompt window(Make sure the server command prompt window is also open). now type:
java client 10.69.23.203
Thats it.
if anyone have any problems please post a comment and i will answer all of your questions or if you are having trouble in compiling.
4
This is a quick and dirty function for preventing SQL Injection, the function is designed to clean any variable that will be concatenated into an SQL query. Apostrophes and Double-Quotes are changed to entities in order to ensure that encoding does not become an issue when the content is pulled back into a page. I'm looking for criticism here, I want to know if this is secure or not.
4
This module is a Python Library to support all IP2Location™ database products. It has been optimized for speed and memory utilization. Developers can use the API to qeury all IP2Location™ binary databases for applications written in Python.
4
This was an update someone else's snippet...
VBScript is a graceful language and Windows Scripting Host cleans up after itself, so this is a compact version for simple usage - reducing code bloat is what small scripts are for.
Just my $.02...
VBScript is a graceful language and Windows Scripting Host cleans up after itself, so this is a compact version for simple usage - reducing code bloat is what small scripts are for.
Just my $.02...
4
There are two methods in this example. One uses directory services the other uses API. Both will return a list of computer names on your network
4
This snippet extracts the keywords or search phrases from a Google referral. It also sets variables for the search engine, date and web page which received the referral if you want to log the data to a file or database. The variables are $engine, $finalphrase (keyword phrase), $page(referred web page), and $date.









