instruction
stringlengths
71
71.9k
I saw a post in chat a few days ago, of what I thought was an interesting (albeit fairly simple) statistical challenge: By @skiwi: If I shoot once with 50% chance of target A and 50% of target B, and if I hit target A I have 95% chance to shoot again, then how many of target A will I hit on average? So I broke out th...
I have just started trying to learn Haskell and tried to think of a practical, but simple problem to try and solve. I have a strong background in C, but am just beginning to dip my toes in the world of functional programming. The idea came from my investing in notes on Prosper: given a list of note ratings, and a des...
I just recently started working on python (interesting language, actually), and, as I always do when I learn a new language (with the exception of BrainFuck, that's too hard), I write a FizzBuzz program. I notice there is no error-checking, so my program would have problems with incorrect input, but please ignore that ...
I wrote a Java class to make a GIF animation from a list of images. The whole project can be found here. I am pretty new with GitHub, so I would be very glad if you can give critiques regarding my project structure. package shine.htetaung.giffer; import java.awt.image.BufferedImage; import java.io.File; import java.io...
Is this a proper way to cache side effects (occurring on job.tryLoad)? case class DFStorage(private var cache: Map[String, DataFrame] = Map()) { def tryLoad(job: Job): Kleisli[IO, MakeContext, \/[List[String], Unit]] = { if(!cache.contains(job.id)) { job.tryLoad.map(_.map(df => add(job, df))) } else { ...
I'm building an app that serves videos to a front end client. My stack is Express/Angular/SQLite. The db doesn't hold users, only root. I'm concerned that my controllers are too hardcoded, but I'm wary of the balance between making controllers too dynamic such that I'm merely pigeonholing myself into an over-engineered...
I've just finished up a functional emailing client in the Java language. It applies the JavaFX libraries and the JavaMail/activation APIs. Give the source a read through and make all the suggestions you think of, please. I'm in the process now of cleaning it up since it was just finished, but address any discrepancies ...
The idea is to batch download a list of movies (torrents) off a torrent site and add them to your server. I have a little bit of Java experience (sophomore in college), so I'm looking for things that I could improve on. Main.java import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.u...
The octoberCMS(based on laravel) controller below is what I use to select the lowest price in 4 pricelists in the given daterange. Prices can vary and it's not guaranteed that the more expensive sounding categories will have higher prices. I have 4 relations in my model pricelist_bronze, pricelist_silver, pricelist_gol...
I'm trying to read in a few lines of parameters from an textfile and format these paths. How can I improve this code to work with less lists? I just need the final paths. import os config = open("C:\\Users\\config.txt") content = config.readlines() removedEnds = [] removedStarts = [] finalPaths = [] for string in cont...
I have a simple class that I use to logging errors and other informations from my applications. I wondering what will happen when 2 or more threads of the same application would like to log something to file. What will happen when they call Log() function at the same time? The more important question is how could I mak...
I have a lot of Task continuation that depend on .Result of previous Task -> for example: I have a command that should: Stop previous instance Copy files elsewhere Delete original files Start instance again So for example the command function: public Task<CommandResult> Execute(ICommandArguments arguments) { Task...
I'm brand new to Python and I feel my code is really like what coded in Java. I try to practice python by small problem and that is to find the maximum population of R-pentomino. Wiki says: During this early research, Conway discovered that the R-pentomino failed to stabilize in a small number of generations. In fa...
I need to write a software in JAVA which allows me to simulate the transfer of some images over a noisy channel while adding redundancy with a repetition code . Before going into code details and issues, here are some requirements: read files from a directory containing images for each file, apply a repetition code (w...
This was one of the tougher challenges on hackerrank.com because the solution had to run under 4s time limit. I had to do a lot of optimization for this one. I had to switch from using Java 8 to Java 7 which for some reason ran much faster and didn't time out on some of the cases. Any comments on the solution and c...
I'm using the CakePHP 3.0 to paginate some content, but I can't find a way to change the limit (user on browser choose the limit of content displayed on screen) using Paginator built-in method (like sort built-in), to do this I use javascript to change limit in URL. Qustion: Exist any way to do this in cakephp style ? ...
I'm very new to Clojure/ClojureScript and have a question regarding a "proper" way to express something. This code sends a mail using nodemailer on nodejs: (defn send-mail [some-id] (try (let [clj-props (:mail (config/config-file)) ; get the mail server cofiguration mail-address (mail-adress-from-props...
My latest refactoring for Rubberduck is called Introduce Field - it promotes a local variable to a private field. The three overridden Refactor() methods are the members of IRefactoring, and are used to start the refactoring sequence. The other methods are the worker methods. Overall, I am pretty happy with it, but th...
Some fraction of a follow-up to The half-finished version. What's changed: Added year as well as Day/Month. Added input Validation. Implemented a poor man's .EnableEvents = false for UserForms. Re-jigged the event heirarchy (Change year --> Repopulate Months or Days, Change Months --> Repopulate Days). As always, all ...
I am still new to VBA. I recorded several actions that I need to perform to ensure that a specific worksheet is formatted properly. Row 1 contains headers. Other than the headers, there is no data in the sheet when this should be run. I know that the raw code from the recording can be shrunk down, but I would appreciat...
I have a query to split a delimited string into to multiple columns. The query is extremely slow and takes more than 5 minutes to handle 80444 rows. How can I improve execution time? WITH cte (Execution_ID,Intake_Generic_ID, [File_Name],F1,Report_Attributes) AS ( SELECT Execution_ID, Intake_Generic_ID, [Fil...
Problem Statement Find the max sequence finder. findMaxSequence([3, 2, 3, 4, 2, 2, 4]); findMaxSequence([3, 5, 4, 6, 1, 2, 3, 6, 10, 32]); findMaxSequence([3, 2, 1]); Expected Output [ 2 , 3 , 4 ] [1, 2, 3, 6, 10, 32] no Solution function findMaxSequence(array, start = -1, end = -1, i = 0, results=[]){ ...
In modern C++, many classes accept a policy type as a template parameter. The author of the class does not know in advance what kind of policy its class will be instantiated with. If the policy class is empty, it would be desirable to inherit from it so to leverage the empty base optimization (EBO). On the other hand, ...
Based on this question, I have made a simple program to print a sequence of random numbers. The program seems to run fine, but I would like to know if my implementation is correct and how I can improve it. #include <random> #include <array> #include <algorithm> #include <functional> #include <iostream> template<class ...
You are writing your web-page and relentlessly adding links, as you think that links are the best thing a web-page can offer. The fact is that you write links even to pages that do not exist just yet, because you will write them later. But later becomes a lot later and now you have your website in your directory with a...
This is my solution to Project Euler 14: The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1 It can be seen that this sequence ...
Write a method named numUnique that accepts a sorted array of integers as a parameter and that returns the number of unique values in the array. The array is guaranteed to be in sorted order, which means that duplicates will be grouped together. I'm mainly concerned with following proper conventions and maximizing r...
Recently I found the need to implement a normalization formula in a couple of places in my basketball game, so I created some static methods inside of a class to do so. public class Normalize { //explanation of normalization formula: /* Suppose you have a range or scale from A to B and you want to convert ...
I am working on a library which will make HTTP call to my rest service basis on inputs passed to this library. And whatever response comes back from service whether it is successful response or failure coming from the service or something happened in this library like timeout or any other errors, I am returning a respo...
Below is the assignment I was given and the coding is what I have came up with. I would appreciate criticism on how I did and on ways to have gone differently about it. You want to number your random list numbers, so use an iterator to put the list numbers into a map (but keep the list). The key will be the number th...
I wrote a random file opener in Python that takes file extensions as a tuple at code level, and directory/amount at console level: import os import random import sys class RandomFileOpener(): def __init__(self, positives, file_exts): self.file_list_complete = [] self.amount_to_open = 0 #So it can...
I've created a simple static website generator called pjen. The GitHub repository can be found here. import os class pjen: def __init__(self, path=None): """ By default, the path will be set to the current working directory, or the path can be specified using the 'path' keyword parameter. ...
Problem: Integer partition without re-arrangement Input: An arrangement S of nonnegative numbers {s1, . . . , sn} and an integer k. Output: The largest job from partitioning S into k or fewer ranges, to minimize the maximum sum over all the ranges, without reordering any of the numbers. Also the indexes of the partitio...
I've read about half of a pretty extensive and popular Python book (I'm a complete beginner) and I decided to get my hands dirty with this little exercise to crystallize all the concepts I've taken in. The program does as explained above in the title, it creates a showdown situation with random community cards and play...
All classes on GitHub repo This is the code for downloading files from a FTP-server running Mozilla Fileserver. FtpItem is the interface for the two classes FtpFile and FtpFolder; FtpFile represents a file on the server and FtpFolder represents a Folder directory on the server. FtpUser might be better named FtpHandler ...
A while ago, I wrote a program that combined L-systems and turtles. This was before I understood OOP (I still don't fully understand classes, or if they are even needed here). I tried to add some documentation and included some demos as functions. If I ever get around to it, I hope to include a simple GUI with user-adj...
I'm taking this C++ program and am trying to replace some of the older structures like memset (which I don't completely understand) and struct with newer language optimized for C++11. The program works as is and I am just trying to further my understanding by playing with the code. "Hike on a Graph" is played on a bo...
Problem Statement Write JavaScript code hideOddRows.js that attaches to the button click event and hides the odd rows of the table when clicked. Expected Output When you click on "Hide Odd Rows": Solution /* hideOddRows.js */ document.querySelector('[name=HideRows]').onclick = hideRows; function hideRows(){...
Recently, I've come up with an idea of building a custom query builder combine with FluentApi. Expected usage: List<User> users = userQueryBuilder .Active() .IsMale() .AgeGreaterThan(25) .Include(u => u.UserProfile, u => u.P...
I have a simple function: func getList() (sendgrid.RecipientList, bool, agerr.E) { lists, err := client.GetRecipientLists() if err == nil { for _, l := range lists { if l.Name == myList { return l, true, nil } } } return sg.RecipientList{}, false, ...
I have a legacy method which I would like to clean up: public void readFile(String filename) { int i; int j; String ins = new String(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); try (FileReader input = new FileReader(filename); BufferedReader bufInput = new...
This code gets a list of all files and directories from a specific location. Thes code below works. List<string> FullList = new List<string>(LoadFiles("patch.txt")); List<string> ShortCatalogList = new List<string>(); List<string> ShortFileList = new List<string>(); for (int i = 0; i < FullList.Count; i++...
I've written a small script to enable the vote count viewing functionality that comes for users at 1k reputation: // ==UserScript== // @name Vote count viewer // @namespace https://github.com/The-Quill/VoteCountViewer // @version 1.0 // @description Lets you view the vote count on posts. // @author Qu...
I would like to use the following routine in my job submission bash script which expects the allowed walltime in the format [[HH:]MM:]SS. (Brackets indicating optionality.) For easier readability I want to convert any input value into the fixed format HH:MM:SS where the value for hours is open ended. I think it works o...
I have a python script that I'd like to speed up. I'm hoping some of the gurus here can offer some advice. The script reads in some data from file: 2 arrays with lat/lon vals, 3 arrays with image data and one quality mask. Each array is typically around 22M datapoints. An output array exists and I convert the lat/lon v...
I am creating a system for a client that loads information from an XML file and then parses the information where needed. For this, I have got this class: <?php class Config { private static $init; private static $link; private static $db_hostname; private static $db_username; private static $db_pa...
I'm re-writing my Module of standard methods. These 3 are used to retrieve Workbooks as Workbook Objects. The standard I'm aiming for here is "Third-party Library/Add-in". So: Do these functions adhere to the principle of least surprise? Have I missed any potential error cases? As always, general feedback is als...
I've taken this algorithm question, which is to find the indexes of any two numbers in an array that sum to a given number. It is quite a simple problem to solve. But it is the execution time of my code algorithm that bugs me. #include <iostream> #include <vector> using namespace std; class TwoSum { public: static s...
Problem Statement Write a JavaScript program that prints the mouse coordinates in a text area when the mouse cursor is moved over the HTML document. Expected Output Solution <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Track mouse coordinates</title> </head> <body> ...
I have a database (PostgreSQL) from which I want to migrate some data to a MS SQL Server database. I decided to use a code first approach. The question is related to the proper way of feeding my new tables. Model.cs: public class Info { [Key] public int InfoID { get; set; } public int NameID { get; set;...
I took a class covering HTML, CSS, Javascript and for a final project, thinking of a previous community challenge, I created Simon Says. Going through my code my professor deemed it overly complicated (or did he mean complex?), explicitly referring to my showSequence method in particular. I'm just wondering what and ho...
In order to automate a manual task I created the following code. As I've never written a program to this size, I'm curious if my use of variables, as well as, solutions are the most optimal way for handling. In this program, the user will choose a Year, Month, and Zone. These choices are used to narrow down Month withi...
I'm new to coding so I can't create complex code yet. I do as much as I can with fors and ifs, since while I know a bit about arrays and other topics, I am not familiar enough with them to apply them on my own. This code works, but if I tell it to go to 2 million in main the program never finishes; 200,000 took about a...
I have written a little class that is intended to be used to spend unused time in a loop body, sleeping. That is, I have a loop. I want every iteration to take at least X seconds. If the operations actually complete quicker, the excess time shall be spent sleeping. My implementation is based on a class that is created ...
Problem Definition : When John was a little kid he didn't have much to do. There was no internet, no Facebook, and no programs to hack on. So he did the only thing he could... he evaluated the beauty of strings in a quest to discover the most beautiful string in the world. Given a string s, little Johnny defined the b...
Problem Statement Write a HTML page holding a form and a text field. Using JavaScript make the text field to accept numbers only. When a non-number character is entered through the keyboard (or by any other way), make the field red for a while and do not accept the change (preserve the previous value of the field). Ex...
Write a method range that accepts an ArrayList of integers as a parameter and that returns the range of values contained in the list, which is defined as 1 more than the difference between the largest and smallest elements. I feel like I'm beginning to understand conditionals, but for some reason this just makes me c...
I am new to Java / OOP and I'm concerned that I have a method which is doing far too much "stuff" - but I don't easily see how it can be shortened in a way which is not contrived / arbitrary. This is a server-side API method built using Google App Engine. Currently, the method (which is really just a template at this s...
I have a small Person Domain Model as follows: public class Person { public Person() { FirstName = "John"; LastName = "Doe"; BirthDate = DateTime.Now.AddYears(-18); } [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid PersonId { get; set; } [Max...
The following is for a chapter exercise in C++ Primer Plus, 6/e by Stephen Prata, for the first part of Chapter 14 which deals with code reuse through composition. The problem is to implement a Wine class (for modelling a wine collection) which contains a std::string (the wine name), an int and a Pair of std::valarrays...
I have created a program which works out days, hours, minutes, seconds and milliseconds until a date which the user inputs. Is it possible to shorten/make the output a little clearer? from datetime import datetime while True: inp = input("Enter date in format yyyy/mm/dd hh:mm:ss") try: then = datetime...
So I maintain a large number of spreadsheets which are stored on a version-controlled server. In each spreadsheet maintained on this server there is a module containing the following code, which is intended to verify that the spreadsheet is the latest revision, opened from the server, and is locked to prevent inadverte...
Following this question, I've tried to rewrite some core methods to avoid using String for bit operations, and I ended up using BitStream. The code is almost 8x faster than before but it still looks quite slow, because it processes 15 images per minute (0.25 FPS). I think that there's still room for improvement but one...
I'm new to Python. For learning purposes, I want to create desktop application by using QtWebKit and Flask. You can find the source code here Main idea is: create a form including a QWebview widget create a Flask app run Flask app on QWebview It works correctly but I want to know: How can I improve my code? is ...
I am using Spring Security in order to check if a logged in user is authenticated. However, after authentication, as some actual requests come in, I would like to minimize the number of database calls as much as possible. Hence my question: From the SecurityContextHolder I can get my hands on the User object using getP...
Based off my Java Petals Around the Rose, I thought it would be good practice to write something again in a different language. Because the language is Python, I named it "Pythons Around the Rose", and everywhere in my code, the word "rose" would be replaced with "python". Also, "Potentate" is replaced with "Pytentate"...
In the pursuit of learning F#, I have been working through some Project Euler problems. This is my solution for problem 3: open System open System.Collections.Generic let number = 600851475143L let limit = Convert.ToInt32(sqrt (float number)) let sieve = Array.create (limit+1) true sieve.SetValue(false,0) sieve.SetVa...
I'm trying to add a lot of objects manually into a collection. The best I can figure out is to define an object, create an add method, and call that add method multiple times in the object's constructor. function FieldMap(){ FieldMap.prototype.add=function(listField,formField,fieldType){ this[listField]={ ...
I am having difficulty understanding the runtime and space complexity while implementing the said question. Following is the code: import java.util.HashMap; import java.util.Map; public class AnagaramInBigString { private static Map<Character, Integer> frequencyMap(String str) { Map<Character, Integer> source = ...
I have this list of at least seven else-if. When their condition is met, I change the same boolean is_attacked to true. This should be simple but I can't figure out in what way I can achieve the same in a more readable way. if(request_is_attacked){ if(as_knight){ if(piece_abs_val==2){//knight is...
As in my previous question, this module is coupled with its own testing framework. As a symbol-table for a Unicode-capable programming language interpreter, I decided to combine the 3 types of associative array that I had implemented before. Xpost's postscript nametype objects are implemented with a ternary search tree...
My application needs to read 20-million-line text files and count the word frequencies for one and two words. For example: A B A B SSS G D A One word Frequency A: 3 B: 2 SSS: 1 G: 1 Two Word Frequency A B: 2 B A: 1 B SSS: 1 SSS G: 1 After the reading method, it puts all HashMap values in the TreeMap for sorting a...
The source data represents interaction between people. Some are internal, others are external. The internals are recorded in the Users table (represented as the Users CTE in this demonstration). Each Entries record is identified by an ID (ItemID), the time of the interaction (Sequence) and who performed the interaction...
Problem statement You need to create the Animal base class having four fields: a. name b. sound c. owner d. favFood You need to create a derived class Cat such that every instance of Cat inherits instance members of Animal. In addition, Cat adds a new instance member mode. Animal and Cat class should enforce encapsu...
I am writing a utility class for a game client. This class has two main functions: connect to a game server and retrieve the current game revision, and retrieve a "recipe", which is basically serialized data containing information unique to a revision number. The specifics of the "recipe" are irrelevant for the purpose...
I am writing a code which would return the path in a maze using recursion, but now with the path I also want the number of steps. How do count number of steps in this program? or number of times this recursive function is called in my actual path? I can't put the increment counter just inside the recursive function as...
I have a programme which uses many circular buffers in an identical fashion on a CPU and GPU (C and C/C++ CUDA). I essentially require many queues, however, due to this being run on a GPU, I have limited its length so memory can be set up once at the beginning of the program. I therefore have the code below with a circ...
I have two seperate calls that returns a .csv file. I need to extract a couple of headers from the files depending on which one is called. The headers does not always sit in the same index, and the CourseId name changes to Asset_ID in the one call. How can I refactor the code to make it more maintainable? Also, I think...
I was never really sure what the cleanest way would be to use JSP-Pages for receiving sent parameters. It's common knowledge to use as little JSP as possible - yet as some things have to be done there, for example the request.getParameter-Commands. Right now most of my pages which are fetching parameters look like that...
I am working in project that uses a Tablayout inside fragment. I have three tabs that fetch data from web service. This part of the app shows questions.We have three categories: one for recent, the second for unanswered, and third for all questions view. Here is my situation: The web developer designed me a web servic...
I have been working on a web application that produces an image out of colours. Having multiple divs works, but the load time is slow and until the image loads it's time-taking. I would like to make a table like image with lots of colors extracted from an image and display them inside a web page. I don't know which lan...
I have this implementation of Quicksort for strings. The algorithm sorts the requested range by first character, then by second, third, and so on. (Please, do not confuse this with radix sort; it is not.) The pseudocode might look like this: # Public API Sort(R): Sort(R, 0) Sort(R, len): if |R| < 2 return R ...
I was trying to review state design pattern, and tried to create flexible implementation of it so it could reuse it in future. So I came out with this: public interface FsmState<S extends Enum<?>,INPUT> { Result<S> action(INPUT input); } and this: public class Result<S extends Enum<?>> { public boolean isComp...
I have a few pages that is not connected with entities (index page, terms of use page, email page). Detailed description: In CakePHP, when you want to have a static page (such as index for example), you should use the PagesController (not connected to any entity). However, my static pages have dynamic content, as the i...
I am trying to build a food search app. I am using Angular and Spring. I am currently using the yelp API, but it's done on the Java side. I think what I have achieved is really bad design. It works, but the data is not always updated correctly. For Java, I created two methods and one string variable: private String res...
I recently posted an answer to this SO question as I did not think any of the current answers were satisfactory (most don't even answer the question!). I was wondering if anyone could offer any improvements on my solution to this problem? I'm most interested in performance here. Also note this algorithm does not requir...
My data set is a list of Edges which are passed as a pair of integers. Based on that, I have the following graph implementation for BFS. Could someone please review my code and comment on errors/omissions/efficiency and other points. #include <queue> #include <iostream> #include <vector> class Graph { private: i...
I wanted to implement a simple oriented graph as part of an exercise in both Object Oriented Programming and Data Structures. I wanted to make it as class-focused as possible, so I don't know if my implementation follows the standard adjacency list/matrix implementations. I started reading on software design patterns, ...
I wrote this code as my first self-directed effort and would appreciate any input on things that I've done seriously wrong. I worry that perhaps I'm over-relying on if-statements, for example, but am not sure how to change the pieces of code to use them less. import random def playchosengame(chosengame): if chose...
So, I've written FizzBuzz for a dialect of JavaScript called Dogescript. It has the same functionality as JavaScript, it simply changes some of the syntax points: [A few from the language spec] shh [comment] - // [comment] very [var] is [value] - var [var] = [value] [var] is [value] - [var] = [value] such [name] much ...
I want to use JavaFX as a solution to Java's issues with buffered input making things like 'press any key to continue' not easy. I plan to use an event listener to detect keyboard input. But before I start down that road I want to know if this is on the right track. Is the code below a good way to use JavaFX to impleme...
This is a part of the code for the almighty bot @Duga (That's me!). Every evening, 15 minutes before "RELOAD" (00:00 UTC), I post the reputation differences for some Code Review users. Example output is: Mat's Mug vs. Simon Forsberg: 2728 diff. Year: +3618. Quarter: +885. Month: +648. Week: -40. Day: +185. The code b...
I have this code in my library and I wanted to see whether we can avoid duplicating stuff. private String getAddress(final String path, final int clientId) { if (TestUtils.isEmpty(mapping) || TestUtils.isEmpty(mapping.get(path)) || TestUtils.isEmpty(mapping.get(path).get(clientId))) { logger.logError("mapp...
This class exposes the public method getAuthToken which takes a user's Facebook OAuth token as an input parameter and queries Facebook for information about it - such as the application it is valid for, its expiry date, the user it belongs to etc. The flow for this method is as follows: Uses the token passed into the ...
This database must be able to track multiple home owners, who may own many properties, have many phone numbers, and their mailing address may depend on what month we're in. Each property may have more than one owner. Please point out all bad coding practices. create table home_owner ( owner_id SMALLINT UNSIG...
I have implemented A* search in MATLAB, but I am looking for ways to increase the speed and optimize it. I have tried using a priority queue but I found it doesn't work that well, so I am using a different way to implement the search. I will explain the details, so it might get a bit long. I appreciate your patience. T...
I'm working with two huge objects: event and booking, and in my code I need to create a new object with just a few properties of both objects, which I am doing like this: let event = {huge object}; let booking = {huge object}; let b = booking let e = event let data = { name : b.attribu...
I have the following code which iterates on an Integer[] and makes sure that the the values in the array are in ascending order and that there are no neighbouring duplicates: Integer previous = null; for (Integer tb : trancheBoundaries) { if (previous == tb) { throw new IllegalThresholdConfigurationExceptio...
I am joining datatables to create a new datatable: var row = from r0w1 in dt_vi.AsEnumerable() join r0w2 in dt_w.AsEnumerable() on r0w1.Field<int>("ID") equals r0w2.Field<int>("iD") join r0w3 in dt_re.AsEnumerable() on r0w1.Field<int?>("ID") equals r0w3.Field<int?...
I have created a reusable code for jQuery tab functionality for my client site. Every thing works fine but the only thing I am worried is that the lines code I have written for this small feature is very high. Can any one help me to shrink lines of code or any suggestions. Here is my script /** * @param link Class na...