Jhon Parker

Ranch Hand
+ Follow
since Nov 11, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jhon Parker

Tim Holloway wrote:Log4j properties are expected to be located in the application classpath. For web applications, that would be /WEB-INF/classes/log4j.properties or /WEB-INF/classes/log4j.xml

Any other log4 configuration would have to be done in application logic.



but I don't have those folders do I need to create that classes folder inside my WEB inf??

Also I forgot to mention that it's a maven web aplication this is my project structure

MyWebAppProjectName
--Web Pages
--WEB-INF
--jsp
index.jsp
--resources
--js
js.js
--css
site.css
log4j.properties
--Source Packages
--config
ConfigMVC.java
WebInitializaer.java
--controllers
HomeController.java
--Test Packages
--Other Resources
--src/main/resources
--default package
--log4j.properties
--Dependencies
--Java Dependencies
--Project FIles


So I put the log4j.properties in the Other Resources/src/main/resources and when I did this Netbeans created a default Package with the file inside like this default package/log4j-properties and it worked the logs starting to appear in the output and everything worked fine as expected.

I tried to create a package named Log4jResource inside this path src/main/resources but when I did this it stopped to work and the error showed again, so it's there a way to put this file in that folder but without having to use default package that NetBeans creates when I put the folder in there.

I tried doing refactor rename the default package but it shows me this error Module JPA Refactoring threw java.lang.NullPointerException. Please report a bug against JPA Refactoring module and attach your var/log/messages.log.

It would be better if I create that classes folder inside my WEB-INF??
3 years ago
I'm working on a `Spring MVC 4.2.5.RELEASE` web application, I'm using `Netbeans` IDE with `GlassFishSErver 4.1`, I want to use `log4j 1.2.17` so I created a log4j.properties file but it seems like my properties file it's not being found because I get the following error:



I configured my Spring application using java annotations here is my configuration



here is my WebInitializer



and here is my controller


and here it's my `log4j.properties`



and I put this log4j.properties in my resources folder, here is my project structure

3 years ago

Tushar Goel wrote:I don't have much idea but why don't you write some filters where all the requests lend first then you can check whether it is valid or not?



but how would I know if the exception was for "source's not found 404" or any other exception, I didn't know that doing a 404 not found exception in spring would be this hard
3 years ago
I want to handle 404 page not found exception in my Spring MVC web app, I'm using SPRING 4.2.5.RELEASE, I had read several question regarding this topic but the similar questions are using a different spring java configuration.

I have a Global Exception Handler Controller class that have all my Exceptions, this class works fine but I can't handle a 404 page not found exception.

This is the approach that I take following a tutorial

1) I created a class named ResourceNotFoundException that extends from RuntimeException and I putted this annotation over the class definition

like this:



2) I created this method in my exception's controller class



But still when I put a URL that doesn't exist I get this error "No mapping found for HTTP request with URI"

The questions that I had read said that I need to enable to true an option for the Dispatcher but since my configuration it's different from the other questions and I don't have a Web.xml I couldn't apply that.

Here it's my Config.java


Here is my WebInitializer

Here is my Global Exception Handler Controller


And the class I created that extends Runtime Exception

3 years ago
I'm new in Javascript web applications, I'm more used to creating java/Spring c#/.Net applications, I'm also not a guru in those, though.

What I always do when I create a web application using MVC pattern I do the following:

I create the following folders to organize my code

-View folder: here I put all the HTML files

-Controller folder: here I put all my methods that call the necessary methods to bring me the data that's needed in the views.

-Service folder: here I put all the methods that go to the database to bring info and other necessary methods from the business logic.

-Model folder: here I put all my classes with the attributes example (User class, Role class, Vehicle class, etc).

Example:
public class User {
private name;
.....
getters and setters...
}

I want to apply the same or a similar concept to my Javascript/AngularJS tutorial learning app

So far I have created a very simple app a calculator app with the Service Layer, Controller Layer and View Layer and they work as I expected to work,

the service layer: have all the methods like add, subtracts, multiply.
the view layer: have the html where I input the numbers.
the controller layer: have the method that calls the service and then I pass the data to the view.

BUT my problem is that I don't know how the Model fits in a AngularJS app I have see that some tutorials put the model objects inside the controllers like this





but I don't know if that's the way because if I need a model object in another controller do I need to declare the same code in the other controller??

Also how should I deal with model objects that have inside other model object lets say Users have roles inside them.

where should I put my model objects like User, Role, Vehicle etc? Is there a good approach if I create a .JS file named model.js and put there all the objects like this:



But I have read about the global scopes and bad practices etc I actually don't know too much about that if I create that file model.js with my model objects would I be creating a problem?

I'm very open to suggestions since I'm learning
3 years ago

A.J. Côté wrote:Hello,

Search for pom.xml. It seems to be the file you are looking for.

https://maven.apache.org/guides/introduction/introduction-to-the-pom.html

Also, I remember one of my dev had trouble getting Maven to work in a Android project and ultimately gave up. I am not saying maven can't work in an Android project although, I am just sharing what I heard and I never had the time to try it myself.

In eclipse, you can just click on New->Project->Maven to create a new Maven project and this will take care of creating pom.xml for you. Also it will automagically download any needed jar files you mention in pom.xml and put them in your local maven repository so there is no need for you the download the jar files and put them into eclipse manually.



thnks for the info but I already had worked with Maven before in a Spring MVC application that had a POM.xml file I used to put my dependencies there click maven update and maven downloaded all the jars in a folder, the thing here is that I'm working in an Android project and to convert that project in a maven project i believe that you had to download m2e plugin with don't work for me, but in my project I can right click my libs folder and choose import JAR, so I was thinking in just download those JAR and put then in my project manually,

Is there a default POM.xml file that I could create and configure it to download the JARS in a external folder let's say a folder in "user/MyDocuments" or should I do this by throwing commands in cmd after creating the POM.xml file?

I'm thinking in using maven to download the JAR and not doing it myself it's because when I download some libraries they are not complete if I don't download them with maven.
3 years ago
Hi I'm just installed maven and by installing maven I mean put the maven_home variable in my system variables path, and then check with maven --version in my CMD (I'm using windows). I currently working in am android project using Eclipse IDE, i wanted to install the maven for android plugin (m2e) in eclipse but it give me a error this one . So i came up with the idea since I already have maven installed in my computer I wanted to know if it is possible to create I don't know if this posible but to create a file.txt or whatever extension and in this file put this dependency

<dependency>
<groupId>com.nostra13.universalimageloader</groupId>
<artifactId>universal-image-loader</artifactId>
<version>1.9.4</version>
</dependency>

in that file and then in the windows cmd put some maven commands in the cmd pointing to the file that I created and then other commands that allow me to generate the jars from that dependency in a external folder in my pc and then i manually copy those jars in eclipse. Is this posible??
3 years ago
Hi I have a Spring MVC web application and I believe that this application is a RESTful web service application I'm not very sure I think that is a RESTful web service application because it have methods like POST GET in the controllers and those controllers have the @ResponseBody tag and some of then return JSON strings.

My question is that I'm now doing an Android application in Eclipse IDE, and my Spring MVC web application is in Netbeans IDE, It is possible to call a RESTful web services from my Android app in Eclipse if this RESTful web services is in a Spring MVC Nentbeans IDE application? I don't know if my Android application that runs in a virtual device it's using in a way the localhost and if then I try to run my netbeans application it somehow create a conflict between the two IDEs.
3 years ago
Hi I'm new in security aspects and I'm trying to download an Apache tool named Axis2 for web services.

My problem is that when I click the download link a page saying this site it's not secure and then a few options are given to me, the one that says take me out and another that says I now what I'm doing, my question is that how a big site like Apache.org have this kinds of insecure download links?? and what should I do in this case should I download the file or I shouldn't.

Here's the link https://www.us.apache.org/dist//axis/axis2/java/core/1.6.3/axis2-1.6.3-bin.zip

Why Apache does this or it's something wrong with my web browser?
3 years ago
Hi I'm new in android development and I wanted to know where can I find templates for admins apps, I used to do web applications and I wanted to do something similar in android, so I wanted to look some free templates from admin apps, but I can't find anyone, like almost all administrators app are almost the same I wanted to look a few to make my own.

When I talk about admin apps I'm referring to those apps that have a Menu bar in the left or in the top with some tabs inside, like the ones in this picture: https://www.google.co.ve/search?q=admin+templates&tbm=isch&tbo=u&source=univ&sa=X&ved=0CDIQsARqFQoTCJzDn5GKmcgCFQR3Hgod_SkC3A&biw=981&bih=702

I don't know how this is called in android or mobile development, but I used to call them admins templates in web develoment. In short words I don't want to reinvent the wheel if there are already admin templates that I can modify to suit my need.

Thanks in advance.
3 years ago

Guillermo Ishi wrote:Around 2012 with Eclipse and various Android plugins I never was able to get any more going than you are. I downloaded ADT which is Eclipse already bundled with the android stuff and never had a problem. I still use that, but I think most people now use something named Android Studio or close to that. Which is supposed to be the most modern development tools.

Since you are trying for your first app, I suggest looking up an Android course on edx or coursera. They will obviously help you get the tools installed. I took one and it was fun and really eased the learning curve with android. They don't cost anything. You can teach yourself but there are some things you will probably miss.



I follow at youtube course I installed eclipse then the adt then sdk, I follow all the steps, I already have the ARM system image emulator working in a very deficient way to make it run I need to run my application two times, but the intel atmx86 don't work at all. I need help with this bug it's explained better in this stackoverflow question but the question don't have and answer in it's 1 year old, so my best bet it's that it's not going to be answered

https://stackoverflow.com/questions/27091035/android-on-eclipse-logcat-tag-servicemanager-with-text-waiting-for-service-surfa
3 years ago
I'm new to android and I still can't pass the installation part or running my first android app.
I have a doubt about eclipse emulators and AVDs, first I downloaded from the sdk manager a system image from my sdk version api 23, this image was an ARM EABI v7.

I tried to launch my hello world app with this and it worked for a moment the emulator was launched i could navigate in the virtual phone menu.

I watched my app get installed but there was a message that says something about a process it's not responding and it give the option to choose wait or stop, later I installed the intel Atomx86 image and this was the worst it give all kinds of error in the android console and the emulator was never launched.

After this, i decided to delete all my avd that i created, I deleted them in the eclipse IDE and I deleted them from the AVD folder of eclipse,

After this eclipse went crazy and started to print a loop message in logCat saying this:

09-25 20:48:39.990: I/ServiceManager(1696): Waiting for service SurfaceFlinger...
09-25 20:48:40.960: I/PGA(577): Attempting to create new SOCKET connectionn pid = 577, tid = 577
09-25 20:48:41.000: I/ServiceManager(1696): Waiting for service SurfaceFlinger...

this repeats over and over and over

Later I tried to create another AVD with ARM because it kinda worked, but now i think that my eclipse went crazy not only because the looping message in logcat but also becasue went i choose in eclispe to show the tab Devices it shows this:

emulator 5554 Online ?[4.4.2, debug]

I'm not a expert but i think that that 4.4.2 is from the firts AVD i created because i choose to run a project with that android version, but i don't know why it still there if deleted all traces of that AVD,

So later when i choose to run my project in my ARM AVD it shows in the devices tab the emulator 5556 with all the process and i think this is normal, but my problem is that in the emulator 5554 Online ?[4.4.2, debug] because when my project is launching this tab becomes crazy and it appear and disappear a process.

In resume i just want to know how to delete this emulator 5554 Online ?[4.4.2, debug and also how to stop this

09-25 20:48:39.990: I/ServiceManager(1696): Waiting for service SurfaceFlinger...
09-25 20:48:40.960: I/PGA(577): Attempting to create new SOCKET connectionn pid = 577, tid = 577
09-25 20:48:41.000: I/ServiceManager(1696): Waiting for service SurfaceFlinger...

loop messages from my logCat, that messages loops forever, i dont want to create a filter to not show it, that would be a fake solution i want to stop it for good,





3 years ago

A.J. Côté wrote:

Jhon Parker wrote:Ok thanks but i would like to use a emulator firts before trying with my phone, is there any device that take lees ramm and cpu, or all the devices takes the exact same ram and cpu, I know that i can assign memory to my avd device like 512mb or 1024, but is there a particular device for low spec PCs, becasue in the list there's a lot of devices



the Intel Hardware Accelerated Execution Manager (Intel HAXM) if you are on Intel, it will use your native cpu instead of emulating one.

https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager



I'm learning now about HAXM I already install it and i set it to 1024mb, but is this good for my computer? it is better for my low spec computer to use HAXM instead of the regular eclipse AVD emulator??
3 years ago
Ok thanks but i would like to use a emulator firts before trying with my phone, is there any device that take lees ramm and cpu, or all the devices takes the exact same ram and cpu, I know that i can assign memory to my avd device like 512mb or 1024, but is there a particular device for low spec PCs, becasue in the list there's a lot of devices
3 years ago
Hi recently I started learning how to program in android, but since I have a low spec PC i wanted to ask: what's the best aporach to develop android applications with a low spec PC.

I started learning in android studio, but this IDE take to much RAM memory and CPU, so I switched to Eclipse, now in eclipse i want to know what is the best way to run my app and test it, I know that the best approach would be to work with a a real device, but what is the second best approach, I know this options by the moment:

1) Eclipse have an AVD creator to create a virtual android device, but what would be the best eclipse options to create a decent AVD without taking to much CPU or RAM, what is the simplest android device that you can create with this option.

2) If I use genymotion, it would be take less RAM and CPU than if I use the eclipse AVD

3) If there's another option besides these 3 I would like to know.

thanks in advance.

My PC specs are

dual core 2.6 gh
4gb of ram
4 years ago