How to change the position within the array
I have one class which is called people where I keep track of 50 people, their rank, name, age and order. Then I have a second class called rearrange where I have to change the position of the int...
View ArticleJava MongoDB: updating one item within an object array
Lets say I have this object: { "_class" : "com.foo.Person", "_id" : "2894", "name" : "Pixel Spacebag", "photos" : [ { "_id" : 10, "amount" : "100" }, { "_id" : 11, "amount" : "200" } ] } Now, I want to...
View ArticleMinimising the the use of if statement
I am trying to minimise the conditional statements as much as possible within the following if statement, what can I use to do this? if(safeHalFromCros == true){ System.out.println("Crossbowman cannot...
View ArticleCreating and referencing objects and variables within a class
Hi guys I’m trying to make a basic text base game in Java and I have some working code but I feel there is a better way I could be doing things. I reference stats for different monsters using a few If...
View ArticleCan I create a JAR of a Groovy project and use the Groovy classes within a...
Currently I have a small Groovy Script that I’m using in multiple places. I want to be able to include it in other Groovy scripts by using grapes. I may want to use this library in a Java project in...
View ArticleHow to parse all expressions inside double quotes from a String easily?
I have a String, something like ["first" "second" "third"]. Is there an easy way to get all the expressions within quotes as a String array? I know I can parse it char by char, but maybe there is a...
View ArticleJava Path Directory, Open Folders within Folders
something simple. It has bothered me since long that I had only one folder where I should put all textures of my project – just one! You can imagine that this can quickly become disorganized....
View ArticleConvert TypeScript to Java
I’ve been writing TypeScript recently, for running in a browser. What I’m finding I want to do is run the same code from within a Java application. Now I know that I can host javascript from within...
View ArticleHow to get rid of all html tags and its content within a string in C#
I want to use string manipulation within a string instead of bringing the string into a richTextBox. My programme at the moment does string manipulation within a richTextBox. How can I do the same...
View Articleneo4j insert using jdbc but cannot query immediately within the same connection
question background: 1.database is neo4j 2.3.1, driver using jdbc; 2.db connection initialized as a class member, default is auto-commit(not changed); To avoid insert duplicates, i query before insert....
View ArticleWhy can we execute PHP code in Eclipse without defining an executable within it?
I am trying to understand better how PHP plugin in Eclipse works. I notice that, even without having defined a PHP executable in Eclipse, I can execute Run | Run As | PHP Web Application and I get an...
View ArticleKeep a yaw within two yaws
I’m attempting to prevent a user from turning too far left or right but am having trouble with the YAW going from 0, to 360 at times when turning throwing off my checks. I have one main YAW, and i want...
View ArticleObjects Within Objects in Java
I’ve been given a coursework assignment where I have to build a prototype hotel booking system, in accordance with the specification, which is as follows: You will need at least three classes: Hotel...
View ArticleCalling notifyOnDataSetChanged in AsyncTask (not within the class)
I have been struggling with that nearly half a day. Cannot get it work properly. I have AsyncTask with private method, so I can pass boolean and String values in CustomLvAdapter private void...
View ArticleIndex and length must refer to a location within the string rand number
I’m trying to pass a random number to a character generator that will then return a random string with the length passed to it. The StringToByteArray is as follows: public static byte[]...
View ArticleComplex Data structure in Java multi-level collections (lists) within one class
I am relatively new to Java. I have been struggling to define a class that meets my needs. Searching on this site or google did not have probably because the question is so specific. Any help is...
View ArticleHow can I access the text generated dynamically within in selenium?
I tried using xpath Webelement req=driver.findElement(by.xpath(“//[@id=”leftcolumn”]/table/tbody/tr/td[2]”); req.getText(); System.out.println(req.getText()); which shows error…due to the double quotes...
View ArticleWhat’s wrong within the usage of BeanFactoryAnnotationUtils?
I’m trying to do simple call to the method BeanFactoryAnnotationUtils.qualifiedBeanOfType Here the pom.xml of the project : <?xml version="1.0" encoding="UTF-8"?> <project...
View ArticleDelete file from deployed web app from within the app
I have a Java web application that I build as WAR and deploy on Apache Tomcat. Let’s say that I have a mechanism built-in my app to determine when it is successfully deployed and running on the server...
View ArticleUnable to POST to URL from within a client’s network
PostMethod post = new PostMethod(strURL); try { post.setRequestEntity(new InputStreamRequestEntity(new FileInputStream(input), input.length())); post.setRequestHeader("Content-type","text/xml;...
View Article
More Pages to Explore .....