Tag Info

New answers tagged

-2

It is a valuable certification ever because when you get this certification you can manage simple java projects easily, it helps me more for my carrier. i completed this certification 9 months before, actually i used SCJD training lab simulator. This simulator has One assignment with source code, it was so good. You can get the basic ideas from this also you ...


-3

JSF Courtsey : ihatejsf.com I don't why they make minute things compicated. How do you include javascript. Best Documentation is balusC stackoverflow profile


1

One reason to avoid nesting loops is because it's a bad idea to nest block structures too deeply, irrespective of whether they're loops or not. Each function or method should be easy to understand, both it's purpose (the name should express what it does) and for maintainers (it should be easy to understand the internals). If a function is too complicated to ...


11

He is likely referring to the basic fact that an interface can not be instantiated. You can not reuse an interface. You can only implement code that supports it, and when you write code for an interface there is no reuse. Java has a history of providing frameworks of many API(s) that take an interface as arguments, but the team who developed the API never ...


5

I think slide 13 at his presentation (The Value of Values) helps to understand this: Values Don’t need methods I can send you values without code and you are fine My understanding is, Hickey suggests that if I need to, say, double the value you sent to me, I simply write code looking like MyValue = Double(YourValue) You ...


0

If you can assume that in every case month, day, minute, second have 2 digits, year has 4 digits and milliseconds have 3 digits and just the pattern differs, you can simply do the following: public static long convert(String inputDt, String inputFormat) { int dd = inputFormat.indexOf("dd"); int MM = inputFormat.indexOf("MM"); int yyyy = ...


15

Nested loops are fine as long as they describe the correct algorithm. Nested loops have performance considerations (see @Travis-Presetto's answer), but sometimes it's exactly the correct algorithm, e.g. when you need to access every value in a matrix. Labeling loops in Java allows to prematurely break out of several nested loops when other ways to do this ...


7

Nested loops are frequently (but not always) bad practice, because they're frequently (but not always) overkill for what you're trying to do. In many cases, there's a much faster and less wasteful way to accomplish the goal you're trying to achieve. For example, if you have 100 items in list A, and 100 items in list B, and you know that for each item in ...


4

Given the case of many nested loops you end up with polynomial time. For example given this pseudo code: set i equal to 1 while i is not equal to 100 increment i set j equal to 1 while j is not equal to i increment j end end This would be considered O(n^2) time which would be a graph similar to: Where the y-axis is the amount of time your ...


1

Ranges are a special case of invariants. From Wikipedia: An invariant is a condition that can be relied upon to be true during execution of a program. A range [a, b] can be declared as a variable x of type Integer with the invariants x >= a and x <= b. Therefore Ada or Pascal subrange types aren't strictly neccessary. They could be implemented ...


1

From what I know and checked it with links below, development of software for Java and installing JVM, using and distributing don't need any special license. There is some list of commercial features, but I don't think you need those. If you would like to change something in JVM or classes of JDK then it would be different matter but I do not consider it ...


0

I am in the same situation, I have been using Java for a looong time, Having moved to Perl was a shock and a relief but, I used a book called 'Perl Best Practices' It helps a lot and if you understand the basic concepts of programming languages it's all easy to just flow with it. Just remember with perl there is more then one way to do it, I have spend ...


1

The order of certifications from basic level to advanced level are listed in the image below from this site: Java Certification Path Image on Facebook


0

It's strange that this feature hasn't been added to languages. Special features for range-limited types are not needed in C++ and other languages with powerful type systems. In C++, your goals can be met relatively simply with user-defined types. And in applications where range-limited types are desirable, they are hardly sufficient. For example, one ...


0

Although it is not a gaming engine, Processing is quite capable of importing quite diverse media. Also, there are plenty of libraries that will make you life easier when developing a game (i.e collision detection, physics, sound, support for various user inputs)


2

If you are already over with your OCPJP 6 exam, you are now eligible to take Java EE certifications. From my own experience, I suggest you to take the following exams to deepen your knowledge: Oracle Certified Expert, Java EE 6 Java Persistence API Developer Oracle Certified Expert, Java Platform, Enterprise Edition 6 Enterprise JavaBeans Developer ...


1

Having a jsp as a controller is wrong for multiple reasons. Development mode should not dictate application architecture or in other words if you need hot deploy choose a proper tool/server for that. Adding an intermediate controller (jsp) create many data handling problems than it solves. For instance how do you handle passing request parameters? How do you ...


7

Ada also is a language that allows limits for simple types, in fact in Ada it's good practice to define your own types for your program to guarantee correctness. type MyType1 is range 1 .. 100; type MyType2 is range 5 .. 15; myVar1 : MyType1; It was used for a long time by the DoD, maybe still is but I've lost track of it's current use.


0

When you choose the database for repository you should base your decision on the same criteria like choose the database for web application. For instance, respond yourself to question: if derby is good for jackrabbit, why not use derby as a database for web application. From this point of view I recommend to use the same database for both. This also give you ...


6

See Limiting range of value types in C++ for examples of how to create a range-checked value type in C++. Executive summary: Use a template to create a value type that has built-in minimum and maximum values, which you can use like this: // create a float named 'percent' that's limited to the range 0..100 RangeCheckedValue<float, 0, 100> ...


5

Some restricted form of your intention is to my knowledge possible in Java and C# through a combination of Annotations and Dynamic Proxy Pattern (there exist built-in implementations for dynamic proxies in Java and C#). Java version The annotation: @Target(ElementType.PARAMETER) @Inherited @Retention(RetentionPolicy.RUNTIME) public @interface IntRange { ...


20

Pascal had subrange types, i.e. decreasing the number of numbers that fit into a variable. TYPE name = val_min .. val_max; Ada also has a notion of ranges: http://en.wikibooks.org/wiki/Ada_Programming/Types/range From Wikipedia.... type Day_type is range 1 .. 31; type Month_type is range 1 .. 12; type Year_type is range 1800 .. 2100; ...


2

Well, depending on the complexity vs. load of your application, Spring Batch may or may not be a good solution. This is strictly a personal opinion, but I've found that, while Spring Batch let's you quickly prototype some batching mechanism (you only have to implement the business logic, all the batching mechanism comes out of the box) it can prove slow if ...


4

Take a look at some code quality and code indexing tools. FishEye For starters, you could use FishEye, which would index your code and allow you to quickly query for code from all the repositories so you can keep a bird's eye view of the whole codebase. For instance, you could search for a given file (but also for a file's content, including a method ...


0

This will be a partial answer since I'm not a regular user of Java (more of a C++ guy myself). Here's a few ideas that could guide you : 1) If a attribute may be edited by multiple sources (a Stat calculated with a base value, bonus/malus from a skill and bonus from multiple lifepath), perhaps should you not save it as a single value, but as a association ...


0

Separate interface from implementation. "PlayerCharacter" should be an interface with methods like "getStats", "getContacts", "getReputation" etc. This gives you freedom to play with the implementation without having to change the code which uses this interface. The implementation can choose to cache values and recompute them if necessary. For example a ...


0

Given you're going from Java to PHP the Netbeans IDE might be helpful - as Netbeans can be used for PHP developement and then you have the same IDE for you existing and new development. Further to that it has in built tools for using Symfony and Zend. I wrote about a few other benefits for Testing and Documentation in this answer. Its hard to figure out ...


1

1) First and foremost understand this is not an easier way to approach any problem. PHP has a bad reputation for being nasty and tangled but I feel it has been made that way over the years because of its leniency. It is very easy to get lost in that "damn it's so easy" mentality and lose hold of your standards. 2) Read accepted and respected standards from ...


0

Math is certainly important in game development, so I would advise you to work on that. However, I don't want to make that sound all doom and gloom. Many advanced programmers you ask could not quickly multiply 4395 by 6780 in their heads and then figure out its factorial. But, they would at least be able to write a program to figure it out. The math that ...


1

You have 2 options: 1. by git way: use submodules. Here is a documentation how git manage submodules git submodules. I personally didn't use it but it looks to fit your problem. 2. by maven way: in maven it is not mandatory that your root project (configuration) to be hierarchically the parent directory of all your projects. You can have a structure like ...


2

Google just recently announced that it is moving Android development to IntelliJ. There is a reason for this. I have been using Eclipse as an environment to teach courses for the past few years in both C++ and Android/JAVA. I have watched the quality of Eclipse deteriorate to something approaching unusable. In Fall, 2012, I adopted Eclipse Juno for my ...


-1

Maven would want all of our IT projects to be in subfolders of that main project No, Maven simply wants to be able to retrieve the artifacts that it needs. The best way to do this is with an artifact repository, such as Nexus or Artifactory. Each project can have its own Git repository. We want a top level parent pom that controls plugin versions ...


0

If you can't modify the 3rd party, then you have to do the load balancing on your side using a Message Queue. One server will listen to incoming messages in XMPP, and put it inside a message queue. This message queue will have multiple workers, so it will be automatically load-balanced between the workers. Once the worker is done processing the message, it ...


2

What you are looking for is a "utility" package. This may include classes with static utility methods used all over the application. Common utility classes are String operations, Date/Time, etc. Your validators could be a subclass of the utility package, but personally I would put them in the domain in a higher "common" directory. Refer to this answer for ...


3

You cannot cast since they are different types; the language does not allow you since Java has a very strongly typed system. You can do this however: Integer fiveInteger = Integer.parseInt("5"); String fiveString = String.valueOf(5); In Java you have these types of legal casting: Primitive casting - casting between two primitive types int fiveInt = 5; ...


2

There are three licenses for sub-components of the MorphAdorner library that might restrict its use in your application. The Gate and NGramJ libraries (contained in MorphAdorner) use the LGPL license. The LGPL effectively requires that it must be possible for a user of your application to replace those libraries (and possibly the MorphAdorner library, ...


0

You are going in the correct way, i finished both of this certifications last month with 88%. I used epractize labs java certification training lab for my preparation. Code Ranch helps me more. here i suggest you the link for your reference, http://www.epractizelabs.com/... i think it redirects you for your next step.


0

From my own experience, SCJP Sun Certified Programmer for Java 6 Study Guide - Kathy Sierra is a very best one for SCJP exam, it fully covers the exam topics. CodeRanch Forum, it will helps at all the times in your java carrier, so register your self to clear your doubts with java professionals. Last but not least, Mock exam simulator. I used EPractize ...


0

Interesting question. I would recommend against newCachedThreadPool. It will spawn as many threads as necessary without any upper limit. It is bad! The approach suggested by Michael seems good. Use ThreadPoolExecutor and use a number you are comfortable with as the core pool size. Set maximum number of threads to something you wish to tolerate (or your ...


2

Appears as pretty naive attempt to convert RGB to luminosity with some heuristic use of average brightness as a threshold. You can find correct RGB->LUMA formulas along the lines in this discussion: http://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color


-1

I'm wondering if you're trying to implement the Command Pattern via private methods, and you might find switching to a command pattern easier for what you are doing. What you have now is this: public void callThisMethod(MyObject myObject) { methodA(myObject); mehtodB(myObject) } private void methodA(MyObject myObject) { //do something } ...


-1

What I would keep an eye out for though is the amount of times you're passing around your initial object parameter. If all of your private methods are operating on the main parameter, it may be a bit of a code smell. E.g. if you have: class Foo { public void callThisMethod(Bar myBarObject) { methodA(myBarObject); methodB(myBarObject); ...


17

It's a good pattern. This is what Uncle Bob refers to when he talks about extracting til you drop. It shouldn't affect your tests though. You should only be testing the public interface. Yes, you can reflect your way in and test the private methods, but you're still going to have to test them again when you test your public methods, so it doesn't solve the ...


-2

Stack memory usually stores local variables, method calls, one over the other .. Stack is always busy in arranging the data and popping it out after the method is executed. stack memory stores the primitive datatype like int, double, etc., stack only stores the address (in other words points to the data in heap), say when you create a new object from ...


2

One of the reasons I think this discussion comes up repeatedly is because it seems like a serious pain-in-the-ass to take an object with all the data you need and convert it to an object that looks identical or nearly identical to the one you are handing off. It's true, it's a PITA. But there are a few reasons (besides those enumerated above) for doing so. ...


2

According to me, passing a persistable POJO, like for instance a bean managed by JPA, is not THE good practice. Why? I see three main reasons: Potential issue with lazy collections. http://java.dzone.com/articles/avoid-lazy-jpa-collections Entity should contain behaviour (in contrary of an Anemic domain model) You may not want to let your UI call some ...


-1

The best way to learn any programming language is simply to use it as much as you can while digesting information about the language one concept at a time. Break the language up into smaller pieces and focus on each piece until you understand it then move to the next piece. The SCJP Study Guide mentioned above takes this approach and it works.


0

The trick is to use the right data structure for the job, and in this case the right data structure is a multiset. In fact, the multiset is the answer, you don't even need an algorithm. Here's an example in Ruby: require 'multiset' s = 'Hello World Hello Programming Hello World' Multiset.new(s.split) # => #<Multiset:#3 "Hello", #2 "World", #1 ...


1

Create a Scanner for your InputStream, Reader, File, String, etc Iterate over the tokens If a word doesn't already exist in your Map, add it with a value of 1. If a word already exists in the map, increment its value. When done, close the Scanner. Iterate over the map and display. Your solution and @parsifal's take a couple of unnecessary steps that are ...


0

The inefficient part of your algorithm is in fact the ArrayList, because it can't be traversed in a efficient way. The appropriate data structure is in your case a binary tree. A very detailed discussion of binary trees: http://www.shiffman.net/teaching/a2z/concordance/



Top 50 recent answers are included