Search Results

Search found 1744 results on 70 pages for 'steven don'.

Page 6/70 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • groovy closure parameters

    - by Don
    Hi, The following example of using the sendMail method provided by the grails mail plugin appears in this book. sendMail { to "[email protected]" subject "Registration Complete" body view:"/foo/bar", model:[user:new User()] } I understand that the code within {} is a closure that is passed to sendMail as a parameter. I also understand that to, subject and body are method calls. I'm trying to figure out what the code that implements the sendMail method would look like, and my best guess is something like this: MailService { String subject String recipient String view def model sendMail(closure) { closure.call() // Code to send the mail now that all the // various properties have been set } to(recipient) { this.recipient = recipient } subject(subject) { this.subject = subject; } body(view, model) { this.view = view this.model = model } } Is this reasonable, or am I missing something? In particular, are the methods invokedwithin the closure (to, subject, body), necessarily members of the same class as sendMail? Thanks, Don

    Read the article

  • Groovy: stub typed reference

    - by Don
    Hi, I have a Groovy class similar to class MyClass { Foo foo } Under certain circumstances I don't want to initialize foo and want to stub out all the calls to it. Any methods that return a value should do nothing. I could do it like this: Foo.metaClass.method1 = {param -> } Foo.metaClass.method2 = { -> } Foo.metaClass.method3 = {param1, param2 -> } While this will work, it has a couple of problems Tedious and long-winded, particularly if Foo has a lot of methods This will stub out calls to any instance of Foo (not just foo) Although Groovy provides a StubFor class, if I do this: this.foo = new groovy.mock.interceptor.StubFor(Foo) I get a ClassCastException at runtime. Although this would work if I could redefine foo as: def foo But for reasons I won't go into here, I can't do that. Thanks, Don

    Read the article

  • Grails domain class initialization

    - by Don
    Hi, My Grails app has the following Spring bean defined in spring/resources.groovy calendarService(CalendarService) { bean -> bean.initMethod = "init" } This method looks something like: class CalendarService { void init() { User.findByEmail("[email protected]") } } When I call the dynamic finder findByEmail I get a MissingMethodException. My guess is that I'm trying to call this method too early, i.e. before the domain classes have had the dynamic finders added to their metaclass. One solution would be to call CalendarService.init() myself from Bootstrap.init, rather than instructing Spring to call it, but is there a better solution? Thanks, Don

    Read the article

  • mkdir error in bash script

    - by Don
    Hi, The following is a fragment of a bash script that I'm running under cygwin on Windows: deployDir=/cygdrive/c/Temp/deploy timestamp=`date +%Y-%m-%d_%H:%M:%S` deployDir=${deployDir}/$timestamp if [ ! -d "$deployDir" ]; then echo "making dir $deployDir" mkdir -p $deploydir fi This produces output such as: making dir /cygdrive/c/Temp/deploy/2010-04-30_11:47:58 mkdir: missing operand Try `mkdir --help' for more information. However, if I type /cygdrive/c/Temp/deploy/2010-04-30_11:47:58 on the command-line it succeeds, why does the same command not work in the script? Thanks, Don

    Read the article

  • Google Calendar API DoS prevention

    - by Don
    Hi, It appears that the Google calendar API effectively locks you out if you create and delete a few (less than 10) calendars within a short space of time. This has made it basically impossible for me to test my app, because it creates/deletes a calendar for each user that is added/removed from the app. Currently, I'm "working around" this issue by creating a new Google account each time I get locked out of the Calendar API. Clearly, this solution is less than satisfactory. Is there any way I can avoid this over-zealous DoS prevention? Thanks, Don

    Read the article

  • unit-testing maven plugins

    - by Don
    Hi, I'm looking for information about how to write unit tests for Maven plugins. Although there's a page on the Maven site about this topic, there's only one example unit test, which does nothing useful. I also found this wiki page, but it hasn't been updated for more than 4 years, so I'm reluctant to invest any faith in it. I checked the book "The Definitive Guide to Maven", but it doesn't even mention the subject. I'd like to write my unit tests in either Groovy or Java, and would appreciate any information about how to do this. Thanks, Don

    Read the article

  • download mail attachment with Java

    - by Don
    Hi, I had a look in the reference doc, and Spring seems to have pretty good support for sending mail. However, I need to login to a mail account, read the messages, and download any attachments. Is downloading mail attachments supported by the Spring mail API? I know you can do this with the Java Mail API, but in the past I've found that very verbose and unpleasant to work with. EDIT: I've received several replies pointing towards tutorials that describe how to send mail with attachments, but what I'm asking about is how to read attachments from received mail. Cheers, Don

    Read the article

  • customisable JSLint

    - by Don
    Hi, I'm looking for a tool that checks JS code, which can be integrated into a Maven build. I need a tool that will check for errors such as use of reserved words as identifiers trailing semi-colon, e.g. var obj = { a: 1, b, 2, } JSLint seems like a perfect candidate, but the problem is that it is too strict, because it also checks for various coding patterns which are (arguably) bad style, but do not actually generate errors in a browser. Examples of such issues include Disallow ++ and -- and Allow one var statement per function If possible, I would like the errors to fail the build, and I would like the other rules to only print warnings (or disable them completely). Obviously, I need the ability to specify which of the available rules I consider errors and which I consider warnings. Thanks, Don

    Read the article

  • How to drag and scroll in a div with jQuery

    - by Don Munter
    Hey guys, I've been looking around for some time now, but I can't find a way to combine these elements: I want a 100% width div, with 1 row of elements. I need to scroll through this div, just like: http://jqueryfordesigners.com/demo/scrollable-timelines.html So with a hidden overflow and such. But now I want some sort of smooth ease when I let go of the mouseclick, so it'll be like a sort sweep. So when I drag the screen from left to right, and let go of the mouse, it'll move on for 1 sec and linearly slowing down. Hm, am I making sense? Does anyone know of any scripts or some tips to put me back on track? Don

    Read the article

  • Java or Groovy CMS

    - by Don
    Hi, I'm considering developing a school information system using the Grails web framework. Before a school can use the system, they will need to setup the following data School data Students Teachers Subjects Classes etc. I'm considering using a CMS in order to get the ability to CRUD these entities "for free". The CMS may also provide other features out-of-the-box that I could use. Ideally the CMS should be implemented in Java or Groovy, does anyone know of something suitable? I looked at the Weceem CMS plugin for Grails, but it's missing some core concepts I need, e.g. the ability to add users to groups. Thanks, Don

    Read the article

  • Enable GD support in PHP

    - by Don
    Hi, I'm trying to install pixelpost on an Apache server on windows. The installer is failing because: Pixelpost will not run if your PHP installation is not compiled with the GD graphics library. I've added the following line to php.ini extension=php_gd2.dll But I still get the same error message. When I run phpinfo() I don't see any reference to GD, so I guess it really isn't installed. I searched for php_gd2.dll and it's in the ext subfolder of my PHP root dir. I know nothing about PHP, so be gentle with me. Thanks, Don

    Read the article

  • rewrite image URLs

    - by Don
    Hi, I'm writing a Maven plugin that merges CSS files together. So all the CSS files that match /foo/bar/*.css might get merged to /foo/merged.css. A concern is that in a file such as /foo/bar/baz.css there might be a property such as: background: url("images/pic.jpg") So when the file is merged into /foo/merged.css this will need to be changed to background: url("bar/images/pic.jpg") The recalculated URL obviously depends on 3 factors: original URL original CSS file location merged CSS file location Assuming that the original and merged CSS files are both on the same filesystem, is there a general formula (or Java library) that can be used to calculate the new url given these 3 inputs? Thanks, Don

    Read the article

  • replace capturing group

    - by Don
    Hi, If I have a regex with a capturing group, e.g. foo(_+f). If I match this against a string and want to replace the first capturing group in all matches with baz so that foo___f blah foo________f is converted to: foobaz blah foobaz There doesn't appear to be any easy way to do this using the standard libraries. If I use Matcher.replaceAll() this will replace all matches of the entire pattern and convert the string to baz blah baz Obviously I can just iterate through the matches, store the start and end index of each capturing group, then go back and replace them, but is there an easier way? Thanks, Don

    Read the article

  • Java replace all capturing groups

    - by Don
    Hi, If I have a regex with a capturing group, e.g. foo(g.*f). If I match this against a string and want to replace the first capturing group in all matches with baz so that foog___f blah foog________f is converted to: foobaz blah foobaz There doesn't appear to be any easy way to do this using the standard libraries, because the Matcher.replaceAll() method will only replace all matches of the entire pattern, am I missing something? Obviously I can just iterate through the matches, store the start and end index of each capturing group, then go back and replace them, but is there an easier way? Thanks, Don

    Read the article

  • Do You Develop Your PL/SQL Directly in the Database?

    - by thatjeffsmith
    I know this sounds like a REALLY weird question for many of you. Let me make one thing clear right away though, I am NOT talking about creating and replacing PLSQL objects directly into a production environment. Do we really need to talk about developers in production again? No, what I am talking about is a developer doing their work from start to finish in a development database. These are generally available to a development team for building the next and greatest version of your databases and database applications. And of course you are using a third party source control system, right? Last week I was in Tampa, FL presenting at the monthly Suncoast Oracle User’s Group meeting. Had a wonderful time, great questions and back-and-forth. My favorite heckler was there, @oraclenered, AKA Chet Justice.  I was in the middle of talking about how it’s better to do your PLSQL work in the Procedure Editor when Chet pipes up - Don’t do it that way, that’s wrong Just press play to edit the PLSQL directly in the database Or something along those lines. I didn’t get what the heck he was talking about. I had been showing how the Procedure Editor gives you much better feedback and support when working with PLSQL. After a few back-and-forths I got to what Chet’s main objection was, and again I’m going to paraphrase: You should develop offline in your SQL worksheet. Don’t do anything in the database until it’s done. I didn’t understand. Were developers expected to be able to internalize and mentally model the PL/SQL engine, see where their errors were, etc in these offline scripts? No, please give Chet more credit than that. What is the ideal Oracle Development Environment? If I were back in the ‘real world’ of database development, I would do all of my development outside of the ‘dev’ instance. My development process looks a little something like this: Do I have a program that already does something like this – copy and paste Has some smart person already written something like this – copy and paste Start typing in the white-screen-of-panic and bungle along until I get something that half-works Tweek, debug, test until I have fooled my subconscious into thinking that it’s ‘good’ As you might understand, I don’t want my co-workers to see the evolution of my code. It would seriously freak them out and I probably wouldn’t have a job anymore (don’t remind me that I already worked myself out of development.) So here’s what I like to do: Run a Local Instance of Oracle on my Machine and Develop My Code Privately I take a copy of development – that’s what source control is for afterall – and run it where no one else can see it. I now get to be my own DBA. If I need a trace – no problem. If I want to run an ASH report, no worries. If I need to create a directory or run some DataPump jobs, that’s all on me. Now when I get my code ‘up to snuff,’ then I will check it into source control and compile it into the official development instance. So my teammates suddenly go from seeing no program, to a mostly complete program. Is this right? If not, it doesn’t seem wrong to me. And after talking to Chet in the car on the way to the local cigar bar, it seems that he’s of the same opinion. So what’s so wrong with coding directly into a development instance? I think ‘wrong’ is a bit strong here. But there are a few pitfalls that you might want to look out for. A few come to mind – and I’m sure Chet could add many more as my memory fails me at the moment. But here goes: Development instance isn’t properly backed up – would hate to lose that work Development is wiped once a week and copied over from Prod – don’t laugh Someone clobbers your code You accidentally on purpose clobber someone else’s code The more developers you have in a single fish pond, the greater chance something ‘bad’ will happen This Isn’t One of Those Posts Where I Tell You What You Should Be Doing I realize many shops won’t be open to allowing developers to stage their own local copies of Oracle. But I would at least be aware that many of your developers are probably doing this anyway – with or without your tacit approval. SQL Developer can do local file tracking, but you should be using Source Control too! I will say that I think it’s imperative that you control your source code outside the database, even if your development team is comprised of a single developer. Store your source code in a file, and control that file in something like Subversion. You would be shocked at the number of teams that do not use a source control system. I know I continue to be shocked no matter how many times I meet another team running by the seat-of-their-pants. I’d love to hear how your development process works. And of course I want to know how SQL Developer and the rest of our tools can better support your processes. And one last thing, if you want a fun and interactive presentation experience, be sure to have Chet in the room

    Read the article

  • How to unit test C# Web Service with Visual Studio 2008

    - by Steven Behnke
    How are you supposed to unit test a web service in C# with Visual Studio 2008? When I generate a unit test it adds an actual reference to the web service class instead of a web reference. It sets the attributes specified in: http://msdn.microsoft.com/en-us/library/ms243399(VS.80).aspx#TestingWebServiceLocally Yet, it will complete without executing the test. I attempted to add the call to WebServiceHelper.TryUrlRedirection(...) but the call does not like the target since it inherits from WebService not WebClientProtocol. Thanks, Steven

    Read the article

  • Objective-C (iPhone) Memory Management

    - by Steven
    I'm sorry to ask such a simple question, but it's a specific question I've not been able to find an answer for. I'm not a native objective-c programmer, so I apologise if I use any C# terms! If I define an object in test.h @interface test : something { NSString *_testString; } Then initialise it in test.m -(id)init { _testString = [[NSString alloc] initWithString:@"hello"]; } Then I understand that I would release it in dealloc, as every init should have a release -(void)dealloc { [_testString release]; } However, what I need clarification on is what happens if in init, I use one of the shortcut methods for object creation, do I still release it in dealloc? Doesn't this break the "one release for one init" rule? e.g. -(id)init { _testString = [NSString stringWithString:@"hello"]; } Thanks for your helps, and if this has been answered somewhere else, I apologise!! Steven

    Read the article

  • Alignment of rollover item affected by position of header

    - by Steven
    Hi guys, Got a problem where when you rollover "about us" the rollover appeared to the right of the screen exactly 224 pixels from the edge of the browser (maintained this gap when reducing the size of the browser) I fixed it by changing the .css position of the wrapper (from absolute to static) How ever now as you can see in the example ive done the header is aligning to the left: http://jimbeamracing.com.au/navigationtest.htm wrapper{ margin:0 auto; width:994px; position:static; padding:113px 0 0; } Any help would be much appreciated Regards, Steven

    Read the article

  • Spring MVC parameter validation

    - by Don
    Hi, I've defined a controller, validator and command class for a Spring 2.5 MVC application like this: public class ResourceController extends AbstractCommandController { private MessageRetriever messageRetriever; protected ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { ResourceCommand resourceCommand = (ResourceCommand) command; // I NEED TO CHECK HERE IF COMMAND IS VALID? } public static class ResourceCommand { private String module; private String site; private String lang; // GETTERS AND SETTERS OMITTED } public static class ResourceValidator implements Validator { public boolean supports(Class clazz) { return ResourceCommand.class.isAssignableFrom(clazz); } public void validate(Object obj, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "module", "MODULE_REQUIRED"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "site", "SITE_REQUIRED"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lang", "LANG_REQUIRED"); } } } I have wired these all together in the application context: <bean id="resourceController" class="com.amadeus.jcp.ui.framework.localization.ResourceController"> <property name="commandClass" value="com.amadeus.jcp.ui.framework.localization.ResourceController.ResourceCommand"/> <property name="validator"> <bean class="com.amadeus.jcp.ui.framework.localization.ResourceController.ResourceValidator"/> </property> </bean> However, I can't figure out how to actually check whether the command is valid or not - I assume the framework calls the validator, but how do I get access to the result? Incidentally, I'm using Java 1.4, so can't use any solutions that require annotations or other Java 1.5 features. Thanks, Don

    Read the article

  • Grails bean-fields plugin

    - by Don
    Hi, I'm having problems using the Grails bean-fields plugin with a class this is annotated Validateable, but is not a domain/command class. The root cause of the problem appears to be in this method of BeanTagLib.groovy private def getBeanConstraints(bean) { if (bean?.metaClass?.hasProperty(bean, 'constraints')) { def cons = bean.constraints if (cons != null) { if (log.debugEnabled) { log.debug "Bean is of type ${bean.class} - the constraints property was a [${cons.class}]" } // Safety check for the case where bean is no a proper domain/command object // This avoids confusing errors where constraints comes back as a Closure if (!(cons instanceof Map)) { if (log.warnEnabled) { log.warn "Bean of type ${bean.class} is not a domain class, command object or other validateable object - the constraints property was a [${cons.class}]" } } } else { if (log.warnEnabled) { log.warn "Bean of type ${bean.class} has no constraints" } } return cons } else return null } I tested out this method above in the grails console and when I pass an instance of MyBean into this method, it logs: Bean of type ${bean.class} is not a domain class, command object or other validateable object - the constraints property was a [${cons.class}] Because the constraints are returned as an instance of Closure instead of a Map. If I could figue out how to get a Map reference to the constraints of a @Validateable class (that is not a domain/command class), I guess I could resolve the problem. Thanks, Don

    Read the article

  • using JQuery and Prototype in the same page

    - by Don
    Hi, Several of my pages use both JQuery and Protoype. Since I upgraded to version 1.3 of JQuery this appears to be causing problems, because both libraries define a function named '$'. JQuery provides a function noConflict() which relinquishes control of $ to other libraries that may be using it. So it seems like I need to go through all my pages that look like this: <head> <script type="text/javascript" src="/obp/js/prototype.js"></script> <script type="text/javascript" src="/obp/js/jquery.js"></script> </head> and change them to look like this: <head> <script type="text/javascript" src="/obp/js/prototype.js"></script> <script type="text/javascript" src="/obp/js/jquery.js"></script> <script type="text/javascript"> jQuery.noConflict(); var $j = jQuery; </script> </head> I should then be able to use '$' for Prototype and '$j' (or 'jQuery') for JQuery. I'm not entirely happy about duplicating these 2 lines of code in every relevant page, and expect that at some point somebody is likely to forget to add them to a new page. I'd prefer to be able to do the following Create a file jquery-noconflict.js which "includes" jquery.js and the 2 lines of code shown above Import jquery-noconflict.js (instead of jquery.js) in all my JSP/HTML pages However, I'm not sure if it's possible to include one JS file in another, in the manner I've described? Of course an alternate solution is simply to add the 2 lines of code above to jquery.js directly, but if I do that I'll need to remember to do it every time I upgrade JQuery. Thanks in advance, Don

    Read the article

  • Database localization

    - by Don
    Hi, I have a number of database tables that contain name and description columns which need to be localized. My initial attempt at designing a DB schema that would support this was something like: product ------- id name description local_product ------- id product_id local_name local_description locale_id locale ------ id locale However, this solution requires a new local_ table for every table that contains name and description columns that require localization. In an attempt to avoid this overhead I redesigned the schema so that only a single localization table is needed product ------- id localization_id localization ------- id local_name local_description locale_id locale ------ id locale Here's an example of the data which would be stored in this schema when there are 2 tables (product and country) requiring localization: country id, localization_id ----------------------- 1, 5 product id, localization_id ----------------------- 1, 2 localization id, local_name, local_description, locale_id ------------------------------------------------------ 2, apple, a delicious fruit, 2 2, pomme, un fruit délicieux, 3 2, apfel, ein köstliches Obst, 4 5, ireland, a small country, 2 5, irlande, un petite pay, 3 locale id, locale -------------- 2, en 3, fr 4, de Notice that the compound primary key of the localization table is (id, locale_id), but the foreign key in the product table only refers to the first element of this compound PK. This seems like 'a bad thing' from the POV of normalization. Is there any way I can fix this problem, or alternatively, is there a completely different schema that supports localization without creating a separate table for each localizable table? Update: A number of respondents have proposed a solution that requires creating a separate table for each localizable table. However, this is precisely what I'm trying to avoid. The schema I've proposed above almost solves the problem to my satisfaction, but I'm unhappy about the fact that the localization_id foreign keys only refer to part of the corresponding primary key in the localization table. Thanks, Don

    Read the article

  • Error creating Google Calendar

    - by Don
    Hi, I'm trying to use the Google Calendar Java API to create a secondary calendar for a Google apps user. The relevant code is: // Initialise the API client CalendarService googleCalendar = new GCalendarService("canimo.ca"); googleCalendar.setUserCredentials("[email protected]", "secret"); // Create the calendar CalendarEntry cal = new CalendarEntry(); cal.title = new PlainTextConstruct(user.email); cal.summary = new PlainTextConstruct("Collection calendar"); cal.timeZone = new TimeZoneProperty("America/Montreal"); cal.hidden = HiddenProperty.FALSE; googleCalendar.insert(CALENDAR_URL, calendar); The call to insert() above results in com.google.gdata.util.ServiceException: Internal Server Error and no calendar is created. If I try and perform the same operation through the Google calendar website, it also fails with the error message: We could not save changes. Please try again in a few minutes. An obvious conclusion is that there's some problem on Google's side, but this has been going on for several days now. Strangely, if I create a new user, everything works fine for a while. I can create calendars via the website, and download them via the API. But as soon as I try and create a new calendar using the API, I get the exception above, and thereafter can't create new calendars using either the website or the API. Thanks, Don

    Read the article

  • eliminating duplicate Enum code

    - by Don
    Hi, I have a large number of Enums that implement this interface: /** * Interface for an enumeration, each element of which can be uniquely identified by it's code */ public interface CodableEnum { /** * Get the element with a particular code * @param code * @return */ public CodableEnum getByCode(String code); /** * Get the code that identifies an element of the enum * @return */ public String getCode(); } A typical example is: public enum IMType implements CodableEnum { MSN_MESSENGER("msn_messenger"), GOOGLE_TALK("google_talk"), SKYPE("skype"), YAHOO_MESSENGER("yahoo_messenger"); private final String code; IMType (String code) { this.code = code; } public String getCode() { return code; } public IMType getByCode(String code) { for (IMType e : IMType.values()) { if (e.getCode().equalsIgnoreCase(code)) { return e; } } } } As you can imagine these methods are virtually identical in all implementations of CodableEnum. I would like to eliminate this duplication, but frankly don't know how. I tried using a class such as the following: public abstract class DefaultCodableEnum implements CodableEnum { private final String code; DefaultCodableEnum(String code) { this.code = code; } public String getCode() { return this.code; } public abstract CodableEnum getByCode(String code); } But this turns out to be fairly useless because: An enum cannot extend a class Elements of an enum (SKYPE, GOOGLE_TALK, etc.) cannot extend a class I cannot provide a default implementation of getByCode(), because DefaultCodableEnum is not itself an Enum. I tried changing DefaultCodableEnum to extend java.lang.Enum, but this doesn't appear to be allowed. Any suggestions that do not rely on reflection? Thanks, Don

    Read the article

  • How to Reuse Your Old Wi-Fi Router as a Network Switch

    - by Jason Fitzpatrick
    Just because your old Wi-Fi router has been replaced by a newer model doesn’t mean it needs to gather dust in the closet. Read on as we show you how to take an old and underpowered Wi-Fi router and turn it into a respectable network switch (saving your $20 in the process). Image by mmgallan. Why Do I Want To Do This? Wi-Fi technology has changed significantly in the last ten years but Ethernet-based networking has changed very little. As such, a Wi-Fi router with 2006-era guts is lagging significantly behind current Wi-Fi router technology, but the Ethernet networking component of the device is just as useful as ever; aside from potentially being only 100Mbs instead of 1000Mbs capable (which for 99% of home applications is irrelevant) Ethernet is Ethernet. What does this matter to you, the consumer? It means that even though your old router doesn’t hack it for your Wi-Fi needs any longer the device is still a perfectly serviceable (and high quality) network switch. When do you need a network switch? Any time you want to share an Ethernet cable among multiple devices, you need a switch. For example, let’s say you have a single Ethernet wall jack behind your entertainment center. Unfortunately you have four devices that you want to link to your local network via hardline including your smart HDTV, DVR, Xbox, and a little Raspberry Pi running XBMC. Instead of spending $20-30 to purchase a brand new switch of comparable build quality to your old Wi-Fi router it makes financial sense (and is environmentally friendly) to invest five minutes of your time tweaking the settings on the old router to turn it from a Wi-Fi access point and routing tool into a network switch–perfect for dropping behind your entertainment center so that your DVR, Xbox, and media center computer can all share an Ethernet connection. What Do I Need? For this tutorial you’ll need a few things, all of which you likely have readily on hand or are free for download. To follow the basic portion of the tutorial, you’ll need the following: 1 Wi-Fi router with Ethernet ports 1 Computer with Ethernet jack 1 Ethernet cable For the advanced tutorial you’ll need all of those things, plus: 1 copy of DD-WRT firmware for your Wi-Fi router We’re conducting the experiment with a Linksys WRT54GL Wi-Fi router. The WRT54 series is one of the best selling Wi-Fi router series of all time and there’s a good chance a significant number of readers have one (or more) of them stuffed in an office closet. Even if you don’t have one of the WRT54 series routers, however, the principles we’re outlining here apply to all Wi-Fi routers; as long as your router administration panel allows the necessary changes you can follow right along with us. A quick note on the difference between the basic and advanced versions of this tutorial before we proceed. Your typical Wi-Fi router has 5 Ethernet ports on the back: 1 labeled “Internet”, “WAN”, or a variation thereof and intended to be connected to your DSL/Cable modem, and 4 labeled 1-4 intended to connect Ethernet devices like computers, printers, and game consoles directly to the Wi-Fi router. When you convert a Wi-Fi router to a switch, in most situations, you’ll lose two port as the “Internet” port cannot be used as a normal switch port and one of the switch ports becomes the input port for the Ethernet cable linking the switch to the main network. This means, referencing the diagram above, you’d lose the WAN port and LAN port 1, but retain LAN ports 2, 3, and 4 for use. If you only need to switch for 2-3 devices this may be satisfactory. However, for those of you that would prefer a more traditional switch setup where there is a dedicated WAN port and the rest of the ports are accessible, you’ll need to flash a third-party router firmware like the powerful DD-WRT onto your device. Doing so opens up the router to a greater degree of modification and allows you to assign the previously reserved WAN port to the switch, thus opening up LAN ports 1-4. Even if you don’t intend to use that extra port, DD-WRT offers you so many more options that it’s worth the extra few steps. Preparing Your Router for Life as a Switch Before we jump right in to shutting down the Wi-Fi functionality and repurposing your device as a network switch, there are a few important prep steps to attend to. First, you want to reset the router (if you just flashed a new firmware to your router, skip this step). Following the reset procedures for your particular router or go with what is known as the “Peacock Method” wherein you hold down the reset button for thirty seconds, unplug the router and wait (while still holding the reset button) for thirty seconds, and then plug it in while, again, continuing to hold down the rest button. Over the life of a router there are a variety of changes made, big and small, so it’s best to wipe them all back to the factory default before repurposing the router as a switch. Second, after resetting, we need to change the IP address of the device on the local network to an address which does not directly conflict with the new router. The typical default IP address for a home router is 192.168.1.1; if you ever need to get back into the administration panel of the router-turned-switch to check on things or make changes it will be a real hassle if the IP address of the device conflicts with the new home router. The simplest way to deal with this is to assign an address close to the actual router address but outside the range of addresses that your router will assign via the DHCP client; a good pick then is 192.168.1.2. Once the router is reset (or re-flashed) and has been assigned a new IP address, it’s time to configure it as a switch. Basic Router to Switch Configuration If you don’t want to (or need to) flash new firmware onto your device to open up that extra port, this is the section of the tutorial for you: we’ll cover how to take a stock router, our previously mentioned WRT54 series Linksys, and convert it to a switch. Hook the Wi-Fi router up to the network via one of the LAN ports (consider the WAN port as good as dead from this point forward, unless you start using the router in its traditional function again or later flash a more advanced firmware to the device, the port is officially retired at this point). Open the administration control panel via  web browser on a connected computer. Before we get started two things: first,  anything we don’t explicitly instruct you to change should be left in the default factory-reset setting as you find it, and two, change the settings in the order we list them as some settings can’t be changed after certain features are disabled. To start, let’s navigate to Setup ->Basic Setup. Here you need to change the following things: Local IP Address: [different than the primary router, e.g. 192.168.1.2] Subnet Mask: [same as the primary router, e.g. 255.255.255.0] DHCP Server: Disable Save with the “Save Settings” button and then navigate to Setup -> Advanced Routing: Operating Mode: Router This particular setting is very counterintuitive. The “Operating Mode” toggle tells the device whether or not it should enable the Network Address Translation (NAT)  feature. Because we’re turning a smart piece of networking hardware into a relatively dumb one, we don’t need this feature so we switch from Gateway mode (NAT on) to Router mode (NAT off). Our next stop is Wireless -> Basic Wireless Settings: Wireless SSID Broadcast: Disable Wireless Network Mode: Disabled After disabling the wireless we’re going to, again, do something counterintuitive. Navigate to Wireless -> Wireless Security and set the following parameters: Security Mode: WPA2 Personal WPA Algorithms: TKIP+AES WPA Shared Key: [select some random string of letters, numbers, and symbols like JF#d$di!Hdgio890] Now you may be asking yourself, why on Earth are we setting a rather secure Wi-Fi configuration on a Wi-Fi router we’re not going to use as a Wi-Fi node? On the off chance that something strange happens after, say, a power outage when your router-turned-switch cycles on and off a bunch of times and the Wi-Fi functionality is activated we don’t want to be running the Wi-Fi node wide open and granting unfettered access to your network. While the chances of this are next-to-nonexistent, it takes only a few seconds to apply the security measure so there’s little reason not to. Save your changes and navigate to Security ->Firewall. Uncheck everything but Filter Multicast Firewall Protect: Disable At this point you can save your changes again, review the changes you’ve made to ensure they all stuck, and then deploy your “new” switch wherever it is needed. Advanced Router to Switch Configuration For the advanced configuration, you’ll need a copy of DD-WRT installed on your router. Although doing so is an extra few steps, it gives you a lot more control over the process and liberates an extra port on the device. Hook the Wi-Fi router up to the network via one of the LAN ports (later you can switch the cable to the WAN port). Open the administration control panel via web browser on the connected computer. Navigate to the Setup -> Basic Setup tab to get started. In the Basic Setup tab, ensure the following settings are adjusted. The setting changes are not optional and are required to turn the Wi-Fi router into a switch. WAN Connection Type: Disabled Local IP Address: [different than the primary router, e.g. 192.168.1.2] Subnet Mask: [same as the primary router, e.g. 255.255.255.0] DHCP Server: Disable In addition to disabling the DHCP server, also uncheck all the DNSMasq boxes as the bottom of the DHCP sub-menu. If you want to activate the extra port (and why wouldn’t you), in the WAN port section: Assign WAN Port to Switch [X] At this point the router has become a switch and you have access to the WAN port so the LAN ports are all free. Since we’re already in the control panel, however, we might as well flip a few optional toggles that further lock down the switch and prevent something odd from happening. The optional settings are arranged via the menu you find them in. Remember to save your settings with the save button before moving onto a new tab. While still in the Setup -> Basic Setup menu, change the following: Gateway/Local DNS : [IP address of primary router, e.g. 192.168.1.1] NTP Client : Disable The next step is to turn off the radio completely (which not only kills the Wi-Fi but actually powers the physical radio chip off). Navigate to Wireless -> Advanced Settings -> Radio Time Restrictions: Radio Scheduling: Enable Select “Always Off” There’s no need to create a potential security problem by leaving the Wi-Fi radio on, the above toggle turns it completely off. Under Services -> Services: DNSMasq : Disable ttraff Daemon : Disable Under the Security -> Firewall tab, uncheck every box except “Filter Multicast”, as seen in the screenshot above, and then disable SPI Firewall. Once you’re done here save and move on to the Administration tab. Under Administration -> Management:  Info Site Password Protection : Enable Info Site MAC Masking : Disable CRON : Disable 802.1x : Disable Routing : Disable After this final round of tweaks, save and then apply your settings. Your router has now been, strategically, dumbed down enough to plod along as a very dependable little switch. Time to stuff it behind your desk or entertainment center and streamline your cabling.     

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >