|
That looks interesting. I might do some digging around into that.
|
|
|
|
|
It's fun when you look at a problem domain and actually find that the best solution is to not use computers but to go back to a manual solution.
The simplest description is that you look for a single small step to improve the situation, then go back and repeat until you reach an acceptable situation without knowing what the solution will eb when you start. As I said, it's brain fick to start with until you have an epiphany.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Now to actually give you an alternate answer...
While this is overly complicated for the question:
Body and Title could be considered types of text components and your Post could be a 'Base Object' type that consists of a component list. In this 'silly' system, your 'Post' can easily be given any number of components because Post supports having components that have their own functions.
Why not have the components as members? Well because with this idea of base objects having a list you only have to change whether you are giving the component to the object rather than modifying the member in the class. e.g. I want a new 'StupidEnemy' that has a different 'AIComponent' to the 'Enemy'. I don't have to have a new class for my new type of enemy I simply give them a different AIComponent at instantiation.
I don't think this is a great approach in most cases (As you 'could' end up using a data structure to hold a single component, this seems illogical), I’ve used it a little before and it has its pros and cons but it does mean your code fits SOLID. It works quite well for game development though as it keeps the project tidy (Relative to just using straight composition).
BaseObject post = new Post();
TextComponent Header = new Header("Header");
post.Add(Header);
Post->getComponent("Header").SetMessage("Hello World")
Post->Execute();
/rant I didn't do English at University, it has no real place in a BSc also it's more of a sociology/business idea and while it does occur, I want to aim to have a better work ethic constantly for myself!/endrant
modified 9-Jul-12 16:09pm.
|
|
|
|
|
I'm attempting automate tests using my Agilent EXA 9010A Signal analyzer. Any suggestions for doing this in Java? I am not a fan of C# and would prefer to use Java
|
|
|
|
|
|
Via the link in the other answer...look at the document tab. Then look at
"X-Series Signal Analyzer Spectrum Analyzer Mode User's and Programmer's Reference"
From there I found the following reference in the summary section
• Using the Windows XP Remote Desktop to connect to the instrument remotely
• Using the Embedded Web Server Telnet connection to communicate SCPI
The first is a possibility however the second would be what I would start with first because it is easy to do telnet. Only question is that does what it suggests and does everything you want.
If it does then you create an API for management FIRST (before doing what ever else you want.) You can either write your own telnet interface or use the Apache Commons Net component.
|
|
|
|
|
i wrote java code to read text file and when i give it word it give me its position .now i want code that when i give it a word the result will be words behind this word in same line
EX: market shop,online,web site-----data of text file in line 1
: market shop,null
when i enter "market shop"&"online" it give me "web site"
but when i enter only "market shop" it give me "null"
|
|
|
|
|
fine. You have done something wrong in there.
This is homework. So please try to solve it yourself.
You can get help for that by posting your code here (format it with the code tags).
Then we might be able to give you a hind where the problem is.
Have you debugged your code?
|
|
|
|
|
yes i debug my code.ok anyway thank you i will solve it by my self
|
|
|
|
|
what i mean that anyone give me an algorithm or idea for writing this code not give me a code ,i already think about it and i have ideas but i want another ideas that more flexible
|
|
|
|
|
algorithm ?
This is basic Java, don't make it rocket science.
Don't get me wrong: We are willing to help you. But it's our basic rule to not post solutions to homework.
|
|
|
|
|
ok and what i mean is not to solve or give me a code just all i want is steps that i applied it in code of course not code syntax .but thank you i working on my code & i will do it by my self
|
|
|
|
|
As Torsten said earlier, there is something wrong in your code, but unless you show us that code we cannot begin to guess what the problem is. Nor can we suggest any possible solutions since we have no idea how you are processing your inputs and your searches. Help us to help you, by posting the code involved in the search process, and don't forget to put <pre> tags round it so it is readable.
|
|
|
|
|
hi, I'm looking for a way to disable the minimize button in the JFrame's titlebar. I've been googling on how to solve this, I didn't get the answer that i've been looking for...
some suggestions include:
1. using a jdialog -> but the maximize button will also be hidden
2. using JInternalFrame -> but it's not the look-and-feel that i want to achieve
please help me with this one... at first, i thought it would be easy because i thought that there's a setMinimizeable or setIconifiable method for JFrame, but there isn't.
|
|
|
|
|
There is no way to do this - you will have to use JDialog.
Maximize and minimize are 2 functions that are literally combined.
Another approach would be to make the JFrame undecorated(true) and to draw some buttons yourself (and a title bar if you need a real title bar).
|
|
|
|
|
can i know how to the excel files can be imported into sql database by using java codes..
thank u
u.vinothh@gmail.com
|
|
|
|
|
What does "imported" mean?
Do you want to store the excel file itself into the database?
Or do you want to read the data from the excel file and then store that into columns in the database?
For the first option read the file in binary (bytes, not String/char) and then stream it via JDBC.
For the second, easiest is don't use java. Store the excel file as CSV then use the import features of the database to load it.
|
|
|
|
|
I have a project with Java Eclipse for android which stores data in SQLLite. My issue comes in when I include 100 lines of INSERT, it prompts me the EXCEEDED 65535 bytes.
Is it possible to place 2 "provider android:name=" in manifest then create 2 sets of the ContentProvider then make the second provider run like a continuation of the first set?
Hope you can help me. This is my first project with android. Thank you.
|
|
|
|
|
false approach.
Why do you insert 100 rows into the database at once? what is that? can't you narrow that down?
you should limit the data - paging could also be a solution.
|
|
|
|
|
What my objective is to update the database if there is a new version. Normally 1 category contains between 50 to 100 records which I hardcode in ContentProvider. Since I was getting the exceeded 65535 error, I had to split the insert to 2 classes however I am not sure how. Should I place 2 Provider android:name in Manifest? I am lost.
However, if there are any better options I am open to it since I am very new to Java Eclipse.
Thank you.
|
|
|
|
|
Given the following code:
private String name;
private List<String> years;
private List<String> studyChoices;
private void doCheck() {
if (!name.isEmpty() || name == null) {
}
for (String year : years) {
if (!year.isEmpty() || year == null) {
}
}
for (String studyChoice : studyChoices) {
if (!studyChoice.isEmpty() || studyChoice == null){
}
}
}
How do I condense this code into a more elegant and OO solution? Maybe put it all in one list and check for each item in that list?
I would like something like:
'If any of these parameters were not passed in or if they are empty, output an error message, else give the desired output'.
Basically I have to write a Servlet that gets form parameters from the request and checks if all parameters were provided. If they were, it is then supposed to write an output page.
Any ideas?
Thanks
|
|
|
|
|
First thing is that all your tests are the wrong way round (and logically wrong I suspect), you should check the variable is not null before using it as a reference to a method thus:
if (name == null || name.isEmpty()) {
if (name != null && !name.isEmpty()) {
I am not sure how you would condense the two loops any more as they appear to be independent of each other.
|
|
|
|
|
Is this entered from a GUI or is this object coming from some API?
For a GUI you can also use a GUI sided validation. You can e.g. use a KeyListener and validate the entered value right away.
For an API side validation I would suggest a Validation Layer which has to be passed before the data is used.
Your code - as Richard already stated - is a bit mixed up. Here is a valid suggestion:
private void doCheck() {
if (name != null && name != "") {
for (String year : years) {
if (year != null && year != "" ) {
try{
int i = Integer.parseInt(year);
}
catch(Exception oException){
}
}
}
for (String studyChoice : studyChoices) {
if (studyChoice!=null && studyChoice != ""){
}
}
}
else{ }
}
|
|
|
|
|
i am trying to design a simulation with java for my project title location-aware communication to achieve social inclusion and social responsibility which is a telecommunication project which conveys messages to subscribers that are mostly affected or benefited by the piece of information and shows boosters that are necessary to make this possible.
|
|
|
|
|
We believe you. What is the question?
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|