« first day (1641 days earlier)      last day (3300 days later) » 

mr5
1:00 AM
Hello o/
I'm trying to pass in a function parameter this kind of data but I don't know how to. What data type is NameOfClass.class?
 
1:12 AM
Hi
Don't know what you are trying to ask, can you be more specific?
@mr5
 
mr5
@Mr.777 I'm trying to make a function with a parameter whose type is of NameOfClass.class, how can I do that?
In the other room, they said use Class<?> cls but I get another error which is "<NameOfClass.class> cannot be resolved to a type"? How can I make it work?
 
Something like this:
public void FUNCTION_NAME(Class<NameOfClass> className>) {
      ...........
}
 
mr5
@Mr.777
I made this variable private Class<? extends Activity> mParent;
Then I pass it in some function

pedometerIntent.setComponent(new ComponentName(this, mParent.class));
It's on another project but I don't want to mess up the code. I could, however, call directly the class name I wanted to pass
 
Not sure, what do you mean?
Aaah
So you are looking for a function which could accept mParent?
 
mr5
Nope. I just want to make a variable that would be a placeholder for the name of the class in another project
For example:

Project A contains `MyActivity` class
I like to call this indirectly by storing that name in some variable from Project B
so I thought that would be Class<? extends Activity> mParent
 
1:25 AM
So, why can't you do this?
MyActivity obj = new MyActivity();
 
mr5
But out of luck mParent.class's not working though :/
@Mr.777 I get the error "<> cannot be resolved to a type"
 
What about if you remove mParent.class and use only mParent?
I can just blindly help you and give you suggestions because I don't know what your code looks like
 
mr5
Still invalid
 
Okay, can you give me the exact signature of ComponentName() constructor?
I mean what types it requires?
 
mr5
I need to satisfy this argument:
android.content.ComponentName.ComponentName(Context pkg, Class<?> cls)
 
1:30 AM
Okay then you can not do object.class thing
So what you can do is:
new ComponentName (this, The actual class name of the object mParent.class)
But that should be an activity
 
mr5
@Mr.777 Yes, I'm thinking about that but isn't there anyway I could indirectly call it? I don't want to mess that code of the other project
 
How will the code of other project be messed?
 
mr5
It's of another persons work and I like to keep it as it is.
 
You are doing this on your side, correct?
 
mr5
Uhm, not really to keep but make it robust
 
1:33 AM
So from your side you will have to do:
 
mr5
Yes
 
new ComponentName(context, NameOfClass.class)
Because this is what the other project's code is expecting
 
mr5
Isn't there any other way?
 
Not any that I am aware of.
Well
One thing you can try thought is:
mParent.getClass()
 
mr5
If I do that, the project A & B would be dependent on each other
@Mr.777 YAY! You figured it out.
Thanks pal. How could I be this dumb -_-
 
1:36 AM
Haha, things happen
Sometimes, one can't think of things that are too easy. Same happens to me a lot of times :P
 
mr5
But how does .class is different from getClass() though...
 
.class can only be applied with Class names where as getClass() returns the class of the object
 
mr5
Still can't understand the logic between the instance of this class and the placeholder for that instance
 
instanceof verifies if the given object is actually the instance of the type (class) given.
this keyword is used to refer the current instance
 
mr5
Isn't this === getInstance() ?
 
1:42 AM
Already discussed about .class and getClass()
getInstance() ?
Is that a built-in function?
 
mr5
I mean, MyClass **instance**
the instance
or variable name or placeholder, or whatever they called it
 
There is no === in java :P
No, I really did not.
 
mr5
Yeah but you get my point
 
Hey @Ita
 
mr5
1:44 AM
is of the same type
 
The master is here @mr5
 
mr5
lol wut?
 
Yes, @Ita is here
 
Its difficult to get an internet connection while travelling
:)
 
lol what about 3G or 4G?
I mean data packages
 
mr5
1:46 AM
I thought Chtulhu is our master?
 
They are in the cities. They still don't cover most of the country-side :P
 
Oh okay
 
mr5
Hey @ItachiUchiha haven't we met in Android room before?
 
May be, IDR..
 
@Ita you do android too? :O
 
mr5
1:48 AM
He does Hokage too I think =P
 
Not much, just a beginner ;)
@mr5 lolz ;)
 
hokage?
 
mr5
It's a reference from where he get his name
 
That sounds dirty to me :p
 
Oh
 
mr5
1:51 AM
What does that mean?
I'm not watching Naruto so I don't understand what that means. I just heard it from my friends =P
 
> He does Hokage too
^^ Considering hokage is a lady, the above sentence does sound dirty to me :P
 
mr5
LoL
I'm trying to make that subject stands as a verb. Like Google e.g "He Googles it"
 
2:28 AM
I know :P
 
3:14 AM
Morning all. My code compiles and runs but I get a "getActionCommand cannot be resolved or is not a field" for this line of code:

public void actionPerformed(ActionEvent event) {
JOptionPane.showMessageDialog(null, String.format("%s", event.getActionCommand));
}

Any idea why? Google hasn't helped me!

Thanks
 
hey
mike
 
you're missing your method parenthesis I think
event.getActionCommand() <-- should be
 
^^
use an IDE
Coding outside an IDE makes no sense. (says me, who isn't even near one)
 
it can be fun :p
 
3:19 AM
I am (Eclipse), but it didn't help here. No suggestion / auto complete came up
Thanks both
 
anyone have an easy way of converting an rgb (0-255 for r, g & b) into a color catagory?
 
@Woodrow What's a color category?
 
Code or 'manually'?
I use this

http://gauth.fr/2011/09/get-a-color-name-from-any-rgb-combination/
 
like say I have a random rgb of (121, 254, 2), then I'd want to convert that into a catagory like "black", "yellow", "red" ect
I bet some non-programming color experts would know a way... :p
that's the nicest rgb converter I've seen
wow, thanks for the link; perhaps I can find a way to integrate this with java
 
I used to have software for it, but this site works better than that did!
 
3:26 AM
@Woodrow ... so... what's a category?
 
"like say I have a random rgb of (121, 254, 2), then I'd want to convert that into a catagory like "black", "yellow", "red" ect"
 
@Unihedro - a colour. Red, dark blue, light green, rusty brown
 
Wait, are you trying to name a color based on an rbg set?
 
Think the 7 categories of the rainbow...
 
correct Unihedro
 
3:28 AM
So what does that have to do with categorizing?
Simple - keep a list of all HTML named colors, then Pantone colors, then brand colors.
 
Excuse the labeling; you can substitute 'catagory' with 'color name'
 
(121, 254, 2) is lawn green, chartreuse, 376 C or eBay trademark green.
You just gotta have a database to store the constants of the names. Color names are arbitrary - the Java language does not provide an API for this.
flatfile or something
 
fascinating.. good thing I know db stuff :D
 
Not quite arbitrary.

http://en.wikipedia.org/wiki/List_of_colors:_A%E2%80%93F
 
then I just have to find the 'closest' match from the random rgb value I think
 
3:32 AM
Well, at least, there are accepted names for various colours (in the design world)
 
@mikeeustace No.
 
interesting..
 
Your wikipedia article uses names from X11.
The X Window System (X11, X, and sometimes informally X-Windows) is a windowing system for bitmap displays, common on UNIX-like computer operating systems. X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting with a mouse and keyboard. X does not mandate the user interface — this is handled by individual programs. As such, the visual styling of X-based environments varies greatly; different programs may present radically different interfaces. X originated at the Massachusetts Institute of Technology (MIT) in 1984. The protocol version...
That's like, from 1987.
 
String stm = "SELECT Color FROM ColorDB WHERE Red < " + String.valueOf(redV+5) + " AND Red > " + String.valueOf(redV-5) + " AND;"; //continue for green & blue
LIMIT 1;
 
True that we're still using it today, but it's not any official definition. It's still an arbitrary list, set for X-win.
@Woodrow sanitization
 
3:34 AM
sanitization?
 
wait, what's the magic number for?
 
I had no idea that's where they came from. We had a big poster of those names and colours (and their RBG values) in the office.
 
@mikeeustace Congrats for learning something new today.
 
Never sure if you're being sarcastic :)
 
I quote from the wikipedia article:
> Color names are not standardized by Xlib or the X11 protocol. The list does not show continuity either in selected color values or in color names, and some color triplets have multiple names. Despite this, graphic designers and others got used to them, making it practically impossible to introduce a different list. In earlier releases of X11 (prior to the introduction of Xcms), server implementors were encouraged to modify the RGB values in the reference color database to account for gamma correction.
@mikeeustace There's nothing wrong with not knowing. I don't know how to ski.
 
3:37 AM
I think this is the important quote

"Despite this, graphic designers and others got used to them, making it practically impossible to introduce a different list."
Ski-ing sucks. Really bloody painfull. And expensive lol
 
"in the design world" isn't that specific
@mikeeustace True :D
 
Could have said, 'common parlance for those needing to describe colour regularly'
 
skiing ftw
 
Right, now I need to learn more things today... back to the text books.

Later all
 
Also worth mentioning is that X11 and HTML (W3C-standard) color names causes clashes or a color having multiple names.
@mikeeustace bye bye
 
3:39 AM
cya
 
Add to Pantone and brand colors and you have a decent library of colors.
 
self learner?
pantone.. will look up; thanks
 
@Woodrow Pantone Matching System (PMS) is a service for artwork printers which matches a color code to a color used in the printing industry.
(121, 254, 2) is "376 C" by this color system.
 
woah
 
Then there are also brand colors. For example, "Fedex Yellow" is a real thing.
22 mins ago, by Unihedro
@Woodrow What's a color category?
^ see how that question is necessary now?
 
3:45 AM
yeah heh; I probably wont need anything that intensive; just enough to place all colors into like 14 catagories
which is perfect for the links you sent me :) I'll use those in a db
going to use this technology to make an automatic road following program for dayz
since the towns are so far away lol
 
4:43 AM
@Unihedro hey man I did a small programming challenge where I was given an integer and had to print in binary form. Can you look and see how I can make it more efficient? Here is the code. pastebin.com/GSEKrRzu
 
fge
Moo
 
@fge boo
 
mr5
Awoo
Hi guys! :D
no? okay :/
 
Hello
 
5:12 AM
@ItachiUchiha Did you set the phone to accept non google play apps?
Lovely... My question asked early march has been marked as a duplicate of a question asked 14h ago by a user with more rep :(
 
@gem flag it
Write that your question is older. And why it shouldn't be duplicated.
 
5:40 AM
HI, how to select date range between two same dates like date between '2014-11-30' and '2014-11-30'
i want to fetch the records on date of 2014-11-30
 
fge
6:05 AM
@greenhorn define "select"
 
select * from table where date between '2014-11-30' and '2014-11-30';
this doesn't returns the records
i use below query to fetch records dated 2014-11-30
select * from table where date between '2014-11-30' and '2014-11-31';
 
fge
You should select where date is greater than, or equal to, 30th at midnight, and strictly less than the 31st at midnight; also, no code, so I can't help further
I do hope you use at least a PreparedStatement
 
@ItachiUchiha Flag that my question is marked as a duplicate? Hasn't a mod already had a look at it when marking it as a duplicate?
 
6:23 AM
@fge this is the code
Statement stmt = null;
stmt=con.createStatement();
String s="select * from table DATE > ' 2014-11-30' <= ' 2014-11-30' "
rs = stmt.executeQuery(s);
 
fge
...
@greenhorn please use a PreparedStatement
 
and close it
 
fge
Also, I do hope that your date column is actually a date and not some varchar
 
@fge yeah its date type only, but how to fetch the same in MYsql workbench
 
fge
And MySQL to boot, eh?
Use PostgreSQL
But first things first, use a PreparedStatement and close your resources correctly
 
6:29 AM
good morning ;)
 
@fge should i have to close only PreparedStatement?
 
@greenhorn close PreparedStatement, ResultSet and Connection (if transaction ended)
Connection (if transaction ended)
 
ended in what sense?
 
fge
What @Mikhail said, and this is the reason why you should use a try-with-resources statement
Also, it depends on whether you use some sort of connection pooling
Meh, just use JooQ
 
@fge i tried what you said but again it doesn't returns any records
 
PreparedStatement ps = null;
String s="select * from table DATE > ' 2014-11-30' <= ' 2014-11-30' " ps = con.prepareStatement(s);

rs = ps.executeQuery();
 
fge
...
=javadoc PreparedStatement
 
@fge java.sql.PreparedStatement: An object that represents a precompiled SQL statement. (1/6)
 
fge
@greenhorn ^^^ read the javadoc
And google around
 
@greenhorn Show the description of the table
columns and types
 
6:44 AM
user_date - datetype
 
hai any one have idea about hibernate ?
 
fge
Yes, I have one: don't use it, use jooq instead
 
how to compare my timestamp to string in hibernate?
 
fge
@vicky parse your string so that you get a date/time object and then compare
 
@fge
k i will check it
 
7:30 AM
Morning
 
fge
Morning @Vogel612
 
7:50 AM
Can I ask about WebSphere in this room?
Then the, in a whisper:
Is there a maven-plugin to deploy applications on WAS7?
 
fge
No idea; I don't use maven and I don't use WebSphere
 
@fge what do you use instead of maven?
 
fge
gradle
 
I do not want to use WAS too, but it is necessary..... :(
My IDE supports gradle badly.
WAS stupid and is buggy
 
8:56 AM
12 messages moved to bin
 
9:13 AM
sup peeps
 
 
2 hours later…
fge
10:46 AM
1
A: Safe implementation of BufferdReader

fgeYou are not doing it correctly; moreover you say that you have a choice between an "image or binary", and this all looks binary... Here is one thing that you can do to check whether a file is truly text or not; note that this requires that you know the encoding beforehand: final Charset cs = St...

^^^ byte vs char demystified -- again
 
Yet again?
19 hours ago, by Unihedro
@Vogel612 life is full of remix and repetition
 
fge
@Unihedro yes; I have stopped counting the number of questions I have answered which cleared/attempted to clear the misunderstanding
 
@fge This doesn't seem to address the question at all.
OP is looking for an implementation that, quote: "reads bytes until it [...] or it reaches the maximum amount of bytes allowed"
 
fge
@Unihedro and he also says that the input may be an image etc
 
@fge If that causes you to believe that there is an underlying problem, specify that. That seem to have no correlation with your answer either.
 
fge
11:01 AM
Sorry, but read the question again
In particular the comment I just added
 
@fge I just did for three times continuously and now I'm tempted to flag your answer as vlq.
 
Hello, Java
 
hiya
 
fge
@Unihedro read my comment
 
your cite does not really address my inquiry
gotta be right back, I'll review your answer once again later
 
fge
11:05 AM
Ohwell
I've deleted it
Nevermind
The OP has yet to answer my "comment question" anyway
 
11:19 AM
Hm... I really need some GUI generator for obfuscater rules...
 
AARRRGHH. Some people are ****heads!!
@Vogel612 what kind of answer you are expecting . i told you my approach . if you want to know anything else then ask . — Bijay Ojha 1 min ago
 
fge
Obfuscation == security by obscurity == worthless
(imnsho)
 
hmmm...
 
Hi guys
Can any one help me in fetching values from XML object
 
@fge Hacking of protection should more expensive than the program itself
 
11:26 AM
@fge "Security by ostrich" :) Anyway...
 
:)
 
@Mikhail We had a discussion about it a few days ago
 
fge
@Mikhail do you actually think that a determined cracker has any notion of "cost"?
Believe me, it's a lost battle from the start
 
@OlegKuznetsov I went to the chat yesterday
 
Hey guys
 
11:30 AM
Apr 14 at 11:18, by Oleg Kuznetsov
@Unihedro It just was obfuscated!
@Mikhail And welcome! \o/
 
"Believe me, it's a lost battle from the start" == true
about protection of java program
@OlegKuznetsov Hello )
 
Mikhail
Can you help me in fetching the xml object values/
?
 
@Nizam what is the problem?
 
I'm trying to fetch values from a XML object
 
@Nizam don't ask to ask... this is the java room, people here usually are friendly and helpful
don't count me in though, I am a bot
 
11:33 AM
Sure
your XML Source and the output posted both looks different. Please make sure the output and source xml has identical data? So, that we can provide some guidance — Sridhar 22 mins ago
 
fge
@Nizam there's no such thing as an "XML object"
 
def rootnode = new XmlParser().parseText(responseXml);
def rtn = rootnode.'soapenv:Body'.'qde:invokeResponse'.'qde:return'.'ns1:data';

LOG.info("Return value iss:"+rtn);
 
fge
That's not Java
 
This is the output
[{http://to.service.los/xsd}data[attributes={};
value=
[<?xml version="1.0" encoding="UTF-8"?>
<Application>
<LeadRef>100</LeadRef>
<Number>101</Number>
<StatusCode>142</StatusCode> </Application>]]]
 
fge
That's, what, Groovy?
 
11:34 AM
Well thats written in a grrovy file
yeah
 
oh dear god, it's nested XML
~runs away and hides
 
Yeah
 
fge
Well, this is a Java chat room :p Chances are low that anyone here knows groovy at all
 
I want to fetch Application Object in it
:(
 
From what I see you're not viewing the inner XML as XML, but as Text
 
fge
11:35 AM
Personally I don't -- only some hints of using gradle
 
@fge Gradle uses Groovy...
yeah
 
fge
Yeah, I know that gradle uses/is written in groovy
But on top of that it also has its own DSL
 
Any idea how to fetch it?
 
you'll need to get the XML out properly first, and then you can use a proper SAX or DOM parser
 
I was trying like rootnode.'soapenv:Body'.'qde:invokeResponse'.'qde:return'.'ns1:data'.'Applicatio‌​n'
 
11:37 AM
nono, don't do that
you can't view CDATA as a node collection...
 
Then?
No.. I can't view that
 
you'll need (assuming your current rtn calculations:
def applicationNode = new XmlParser().parseText(rtn.value).'Application';
 
Hmm.. what's the solution for this Vogel?
 
and then go from there
 
Sure
Let me check
 
fge
11:40 AM
@Unihedro it appeared that my guess was spot on
 
@fge sheer luck
I wouldn't be saying this if you actually justified your hidden concerns. :p
 
fge
That's not luck
 
Sorry. Yes, I'm friendly and helpful.
I can't help you. I don't understand the XML parsing on groovy :)
 
fge
Just reading the original question led me to guess that
And I was pretty confident that I did guess correctly
 
No problem Michail
Vogel has given some solution.. I'm trying that
 
fge
11:43 AM
But now that the OP has confirmed my guess, well, meh :p
 
@Vogel612 It says Wrong number of arguments
java.lang.IllegalArgumentException: wrong number of arguments
 
well.... it's groovy..
and I am a java person..
don't expect me to get stuff right the first try and without an IDE
 
I know Vogel
Yeah. But, there is no groovy chat room here
 
make one ;)
 

« first day (1641 days earlier)      last day (3300 days later) »