Search Results

Search found 3195 results on 128 pages for 'tip and tricks'.

Page 8/128 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Tip #19 Module Private Visibility in OSGi

    - by ByronNevins
    I hate public and protected methods and classes.  It requires so much work to change them in a huge project like GlassFish.  Not to mention that you may well have to support those APIs forever.  They are highly overused in GlassFish.  In fact I'd bet that > 95% of classes are marked as public for no good reason.  It's just (bad) habit is my guess. private and default visibility (I call it package-private) is easier to maintain.  It is much much easier to change such classes and methods around.  If you have ANY public method or public class in GlassFish you'll need to grep through a tremendous amount of source code to find all callers.  But even that won't be theoretically reliable.  What if a caller is using reflection to access public methods?  You may never find such usages. If you have package private methods, it's easy.  Simply grep through all the code in that one package.  As long as that package compiles ok you're all set.  There can' be any compile errors anywhere else.  It's a waste of time to even look around or build the "outside" world.  So you may be thinking: "Aha!  I'll just make my module have one giant package with all the java files.  Then I can use the default visibility and maintenance will be much easier.  But there's a problem.  You are wasting a very nice feature of java -- organizing code into separate packages.  It also makes the code much more encapsulated.  Unfortunately to share code between the packages you have no choice but to declare public visibility. What happens in practice is that a module ends up having tons of public classes and methods that are used exclusively inside the module.  Which finally brings me to the point of this blog:  If Only There Was A Module-Private Visibility Available Well, surprise!  There is such a mechanism.  If your project is running under OSGi that is.  Like GlassFish does!  With this mechanism you can easily add another level of visibility by telling OSGi exactly which public you want to be exposed outside of the module.  You get the best of both worlds: Better encapsulation of your code so that maintenance is easier and productivity is increased. Usage of public visibility inside the module so that you can encapsulate intra-module better with packages. How I do this in GlassFish: Carefully plan out at least one package that will contain "true" publics.  This is the package that will be exported by OSGi.  I recommend just one package. Here is how to tell OSGi to use it in GlassFish -- edit osgi.bundle like so:-exportcontents:     org.glassfish.mymodule.truepublics;  version=${project.osgi.version} Now all publics declared in any other packages will be visible module-wide but not outside the module. There is one caveat: Accessing "module-private" items outside of the module is controlled at run-time, not compile-time.  The compiler has no clue that a public in a dependent module isn't really public.  it will happily compile it.  At runtime you will definitely see fireworks.  The good news is that you don't have to wait for the code path that tries to use the "module-private" items to fire.  OSGi will complain loudly when that module gets loaded.  OSGi will refuse to load it.  You will see an error like this: remote failure: Error while loading FOO: Exception while adding the new configuration : Error occurred during deployment: Exception while loading the app : org.osgi.framework.BundleException: Unresolved constraint in bundle com.oracle.glassfish.miscreant.code [115]: Unable to resolve 115.0: missing requirement [115.0] osgi.wiring.package; (osgi.wiring.package=org.glassfish.mymodule.unexported). Please see server.log for more details. That is if you accidentally change code in module B to use a public that is really a "module-private" in module A, then you will see the error immediately when you try to test whatever you were changing in module B.

    Read the article

  • Windows 7 Tips and Tricks: User Account Control Settings

    One of the most attractive aspects of Windows 7 is that it comes with so many improvements spread across different aspects of your PC. Keep reading for info on tweaking User Account Control settings the revival of the Run As feature an easy way to configure multiple printers on your laptop and how to use Windows Live MovieMaker to import files over a network.... $2.95/mo Web Hosting Unleashed Host your ASP.NET 3.5/2.0, & Java/JSP, PHP, Ruby, CGI, etc. web apps. 24/7/365.

    Read the article

  • JavaScript tip a day: Pretty Print, Debugging Events and $0

    - by Sahil Malik
    SharePoint, WCF and Azure Trainings: more information Debugging is a pain. Debugging events on a web page is an especially bigger pain. This video will make that pain go away! Also check out the previous videos, performance profiling, console.info, warn, assert, error, console.group, console.count, console.table and  console.log   Read full article ....

    Read the article

  • Leadership Tip&ndash;Vent Up!

    - by D'Arcy Lussier
    Leadership is difficult, for many reasons. One of those reasons is that we not only need to keep ourselves motivated when difficult or challenging times come, but we also need to motivate our teams and keep them focussed on the tasks at hand regardless of the mortars being rained down around them. Inexperienced (and experienced) leaders can fall into the “me-too” mentality – that is, the leader sees themselves as part of the team member instead of the leader of the team. Once a leader changes the teams view that he/she is a peer and not the leader, dynamics can change on the team. One of the biggest dangers is that the leader starts sharing frustrations, fears, concerns, etc. with the team that they’re supposed to be leading on to victory. This can destroy a team’s morale and productivity. One simple thing you can do to counter this is remember this rule when it comes to venting: Vent Up! Don’t vent sideways or down, vent up. Vent to the people above you – they’re the ones that tend to have the power to actually change things anyway. You as a leader stay healthy by getting your frustrations and concerns off your chest, your team is still insulated from it, and your superiors are aware of issues that need to be addressed or can coach you through the obstacles. D

    Read the article

  • JavaScript tip a day: More Debugging Tricks

    - by Sahil Malik
    SharePoint, WCF and Azure Trainings: more information Debugging is a pain. Debugging events on a web page is an especially bigger pain. This video will make that pain go away! This video will show you $ keywords, debugger statement, conditional breakpoints, monitoring events, global error handling etc. Make sure you check out the debugging video from yesterday too. Read full article ....

    Read the article

  • ASP.NET Website Security Tips and Tricks

    This is a tutorial on how to secure your ASP.NET Mono website. Securing an ASP.NET website that runs in Mono is very different from securing an ASP.NET website hosted in a Windows environment because an ASP.NET Mono website runs on a non-Windows server such as Apache or Lighttpd and on an operating system such as Linux Unix. Thus the principles of securing a website in Apache server can be applied to securing an ASP.NET that runs in Mono.... Comcast? Business Class - Official Site Learn About Comcast Small Business Services. Best in Phone, TV & Internet.

    Read the article

  • Windows 7 Tips and Tricks: Taskbar Design

    As mentioned earlier in this series the taskbar in Windows 7 is quite flexible and very functional. This is not only true in how it looks but also in the way it can be used to make life easier on your PC. In this edition of our multi-part series on how to improve the look of your Windows 7 interface we will look at two tips you can follow that will affect your taskbar s design.... Comcast? Business Class - Official Site Sign Up For Comcast Business Class, Make Your Business a Fast Business

    Read the article

  • Javascript Tips and Tricks

    - by ybbest
    1. Replace all , in one Javascript string. var totalAmount= "100,000,000,000"; var find= ","; //Replace the first , with the empty string var replace=""; totalAmount= totalAmount.replace(find,replace); alert(totalAmount); var totalAmount2= "100,000,000,000"; var newFind=/,/g //Replace all , with empty string totalAmount2= totalAmount2.replace(newFind,replace); alert(totalAmount2);

    Read the article

  • Javascript Tips and Tricks

    - by ybbest
    1. Replace all , in one Javascript string. var totalAmount= "100,000,000,000"; var find= ","; //Replace the first , with the empty string var replace=""; totalAmount= totalAmount.replace(find,replace); alert(totalAmount); var totalAmount2= "100,000,000,000"; var newFind=/,/g //Replace all , with empty string totalAmount2= totalAmount2.replace(newFind,replace); alert(totalAmount2);

    Read the article

  • Speaker Prep Tip: Use the AV Studio Built into that Laptop

    - by merrillaldrich
    Over at erinstellato.com there is a great post this week about tips for new presenters. Ms. Stellato suggests, insightfully, that we record ourselves, which is really a fantastic piece of advice. What’s extra-cool is that today you don’t need any special equipment or expensive software to do just that. This week I “filmed” two run-throughs of my talk for SQL Saturday tomorrow. For me, the timing is the hardest thing – figuring out how much content I can really present in the time allowed without...(read more)

    Read the article

  • Tip: Regularily reset SharePoint Timer Service during development

    - by panjkov
    There is an interesting issue that can occur on development machines during development of SharePoint solutions that contain Site Templates or list templates in certain scenarios when site creation is not done manually, but using some kind of Custom Timer Job. The issue manifests in a way that even after retraction of old WSP and deployment of new WSP, even after performing IISRESET, sites created with new WSP don't have applied latest changes which are part of new WSP, but instead use (contain)...(read more)

    Read the article

  • Windows 7 Tips and Tricks: Tweaking the Interface

    By default the look of Windows 7 is an improvement over its predecessors in the Windows operating system lineup. Windows 7 s interface not only looks better it also seems to be more user-friendly with the various features it affords its users. While you can enjoy the latest Windows OS without making any adjustments to it there are plenty of tweaks that can help you change and improve its appearance. This multi-part series will offer up some of the tweaks that you can easily apply to your own PC.... Comcast? Business Class - Official Site Sign Up For Comcast Business Class, Make Your Business a Fast Business

    Read the article

  • Windows 7 Tips and Tricks: Tweaking the Interface

    By default the look of Windows 7 is an improvement over its predecessors in the Windows operating system lineup. Windows 7 s interface not only looks better it also seems to be more user-friendly with the various features it affords its users. While you can enjoy the latest Windows OS without making any adjustments to it there are plenty of tweaks that can help you change and improve its appearance. This multi-part series will offer up some of the tweaks that you can easily apply to your own PC.... Comcast? Business Class - Official Site Sign Up For Comcast Business Class, Make Your Business a Fast Business

    Read the article

  • Tech Tip : Sending Email from Command line

    <b>Geek Ride:</b> "Everyone is not as lucky as having a full fletched email client like thunderbird or kmail to send mails. There is one unlucky group known as system administrators who have to send the mails either through the command line or a script running on the remote server."

    Read the article

  • Printing Tip Handling User Initiated Dialogs Exceptions

    I see this question every so often so it makes sense to share it through a quick post. When using the print API in Silverlight 4 you can run into the dreaded exception: System.Security.SecurityException: Dialogs must be user-initiated Then you examine your code and confirm that your code where you invoke the PrintDocuments Print method are indeed being handled by a user-initiated event. If you are not invoking Print in a user-initiated event then your know your solution :) Here is some sample...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

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