convert unicode to string in java
URL with string text
HttpGet request = new
HttpGet("http://localhost:8090/Servlet/ServletTest?to=3274&from=34875&sms=testtest");
to get value of above url parameter i used following code
while(en.hasMoreElements())
{
Object o1=en.nextElement();
to1=(String)o1;
to2=request.getParameter(to1);
Object o2=en.nextElement();
from1=(String)o2;
from2=request.getParameter(from1);
Object o3=en.nextElement();
text1=(String)o3;
text2=request.getParameter(text1);
}
Url with unicode text
HttpGet request = new
HttpGet("http://localhost:8090/Servlet/ServletTest?to=3274&from=34875&sms=0915094D092F093E00200917093E0902091709410932094000200915094B");
How to get parameter value as string from unicode value
Thursday, 3 October 2013
Wednesday, 2 October 2013
JRebel caused WELD-001414 Bean name is ambiguous
JRebel caused WELD-001414 Bean name is ambiguous
We created a multi-module maven project but is currently encountering the
error in the title on deploy.
Here's the setup (those with parenthesis rebel means there is a jrebel
configuration in that project):
-MainProject: --Model (rebel) --ProjectA ---Web (rebel) ---EJB (rebel)
---Config (rebel)
The weird thing is, if I removed the rebel configuration in EJB it deploys
successfully.
The error:
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean
name is ambiguous. Name bayadDunningInputHistoryBean resolves to beans
[Managed Bean [class xxx.yyy.ClassBean] with qualifiers [@Any @Default
@Named], Managed Bean [class xxx.yyy.ClassBean] with qualifiers [@Any
@Default @Named]]
Base on the error, could it be that the same class is loaded twice?
We created a multi-module maven project but is currently encountering the
error in the title on deploy.
Here's the setup (those with parenthesis rebel means there is a jrebel
configuration in that project):
-MainProject: --Model (rebel) --ProjectA ---Web (rebel) ---EJB (rebel)
---Config (rebel)
The weird thing is, if I removed the rebel configuration in EJB it deploys
successfully.
The error:
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean
name is ambiguous. Name bayadDunningInputHistoryBean resolves to beans
[Managed Bean [class xxx.yyy.ClassBean] with qualifiers [@Any @Default
@Named], Managed Bean [class xxx.yyy.ClassBean] with qualifiers [@Any
@Default @Named]]
Base on the error, could it be that the same class is loaded twice?
JQuery Spinner unselectable after entering zero
JQuery Spinner unselectable after entering zero
I'm having a problem using the JQuery spinner widget. If I manually enter
a value of 0 into the text field (not using the arrows for the spinner,
just entering a value directly), then the spinner greys out and I can not
select it. I have to completely restart the single board microcomputer to
get it back. Any ideas what could be causing this (code below)?
$(function() {
var spinner = $( "#spinner_current" ).spinner({min: 0, max: 100,
stop: function() { dlpCurrent();} });
});
<label for="spinner_current">Illumination Power (%) </label><input
id="spinner_current" style="width:30px" name="value">
I'm having a problem using the JQuery spinner widget. If I manually enter
a value of 0 into the text field (not using the arrows for the spinner,
just entering a value directly), then the spinner greys out and I can not
select it. I have to completely restart the single board microcomputer to
get it back. Any ideas what could be causing this (code below)?
$(function() {
var spinner = $( "#spinner_current" ).spinner({min: 0, max: 100,
stop: function() { dlpCurrent();} });
});
<label for="spinner_current">Illumination Power (%) </label><input
id="spinner_current" style="width:30px" name="value">
HTML-FormHandler Updating fields with the SET data type
HTML-FormHandler Updating fields with the SET data type
I have MySQL table which uses field with the SET data type, for example
`color` SET( 'red', 'green', 'blue' )
I can not find the right way to use HTML-FormHandler for this field. I
tried to use the next variant. I have create form with multiple field
has_field 'color' => ( type => 'Multiple', size => 3,
options => [ { value => 'red', label => 'Red'},
{ value => 'green', label => 'Green'},
{ value => 'blue', label => 'Blue'} ] );
But this does not work. I think because, DBIx returns string value for SET
field ('red,blue') but HTML-FormHandler needs array ref (['red', 'blue']).
Is there any proper way to use HTML-FormHandler for such fields?
I have MySQL table which uses field with the SET data type, for example
`color` SET( 'red', 'green', 'blue' )
I can not find the right way to use HTML-FormHandler for this field. I
tried to use the next variant. I have create form with multiple field
has_field 'color' => ( type => 'Multiple', size => 3,
options => [ { value => 'red', label => 'Red'},
{ value => 'green', label => 'Green'},
{ value => 'blue', label => 'Blue'} ] );
But this does not work. I think because, DBIx returns string value for SET
field ('red,blue') but HTML-FormHandler needs array ref (['red', 'blue']).
Is there any proper way to use HTML-FormHandler for such fields?
Taknig Backup from one server to another server in SUSE SP1 Enterprise Server
Taknig Backup from one server to another server in SUSE SP1 Enterprise Server
I am using SUSE SP1 Enterprise Server installed in two machine (Main
Server and Database Server) within LAN. and I want to Bakcup from Main
Server in Database server. please help me.
I am using SUSE SP1 Enterprise Server installed in two machine (Main
Server and Database Server) within LAN. and I want to Bakcup from Main
Server in Database server. please help me.
Tuesday, 1 October 2013
pos argument to networkx.draw() not working
pos argument to networkx.draw() not working
I'm trying to generate images of subgraphs of a graph where nodes should
appear in the same locations for both graphs.
Based on the documentation for networkx.draw the "pos" argument to the
draw function accepts a dictionary which specifies the positions of the
nodes. I see several examples where people use the pos argument similar to
this pattern:
positions = networkx.spring_layout( GraphObject )
networkx.draw( GraphObject, positions )
However, when I try this I find that the positions is apparently ignored -
or at least when I draw a graph and record the position of its nodes, and
then use that dictionary as the pos argument for drawing a subgraph the
corresponding nodes are not plotted in the same locations.
Here is a simple reproducer that demonstrates the problem. I think what
this code should do is create two .png files of two graphs "g" and "h."
The nodes "c" and "d" should be in the same position in the drawing of "h"
as they are in "g" - however they are not.
#!/usr/bin/python
import matplotlib.pyplot as plt
import networkx as nx
import pylab
g = nx.Graph()
g.add_node( 'a' )
g.add_node( 'b' )
g.add_node( 'c' )
g.add_node( 'd' )
g.add_edge( 'a', 'b' )
g.add_edge( 'c', 'd' )
h = nx.Graph()
h.add_node( 'c' )
h.add_node( 'd' )
# Define the positions of a, b, c, d
positions = nx.spring_layout( g )
# Produce image of graph g with a, b, c, d and some edges.
nx.draw( g, positions )
plt.savefig( "g.png" )
# Clear the figure.
plt.clf()
# Produce image of graph h with two nodes c and d which should be in
# the same positions of those of graph g's nodes c and d.
nx.draw( h, positions )
plt.savefig( "h.png" )
Can anyone please suggest what I'm doing wrong, or how to generate images
of subgraphs where the nodes are in the same location as that of the full
graph?
I'm trying to generate images of subgraphs of a graph where nodes should
appear in the same locations for both graphs.
Based on the documentation for networkx.draw the "pos" argument to the
draw function accepts a dictionary which specifies the positions of the
nodes. I see several examples where people use the pos argument similar to
this pattern:
positions = networkx.spring_layout( GraphObject )
networkx.draw( GraphObject, positions )
However, when I try this I find that the positions is apparently ignored -
or at least when I draw a graph and record the position of its nodes, and
then use that dictionary as the pos argument for drawing a subgraph the
corresponding nodes are not plotted in the same locations.
Here is a simple reproducer that demonstrates the problem. I think what
this code should do is create two .png files of two graphs "g" and "h."
The nodes "c" and "d" should be in the same position in the drawing of "h"
as they are in "g" - however they are not.
#!/usr/bin/python
import matplotlib.pyplot as plt
import networkx as nx
import pylab
g = nx.Graph()
g.add_node( 'a' )
g.add_node( 'b' )
g.add_node( 'c' )
g.add_node( 'd' )
g.add_edge( 'a', 'b' )
g.add_edge( 'c', 'd' )
h = nx.Graph()
h.add_node( 'c' )
h.add_node( 'd' )
# Define the positions of a, b, c, d
positions = nx.spring_layout( g )
# Produce image of graph g with a, b, c, d and some edges.
nx.draw( g, positions )
plt.savefig( "g.png" )
# Clear the figure.
plt.clf()
# Produce image of graph h with two nodes c and d which should be in
# the same positions of those of graph g's nodes c and d.
nx.draw( h, positions )
plt.savefig( "h.png" )
Can anyone please suggest what I'm doing wrong, or how to generate images
of subgraphs where the nodes are in the same location as that of the full
graph?
Alternative PImpl Idiom - advantages vs disadvantages?
Alternative PImpl Idiom - advantages vs disadvantages?
The traditional PImpl Idiom is like this:
#include <memory>
struct Blah
{
//public interface declarations
private:
struct Impl;
std::unique_ptr<Impl> impl;
};
//in source implementation file:
struct Blah::Impl
{
//private data
};
//public interface definitions
However, for fun, I tried to use composition with private inheritance
instead:
#include <iostream>
#include <type_traits>
#include <memory>
template<typename Derived>
struct PImplMagic
{
PImplMagic()
{
static_assert(std::is_base_of<PImplMagic, Derived>::value,
"Template parameter must be deriving class");
}
//protected: //has to be public, unfortunately
struct Impl;
};
struct Test : private PImplMagic<Test>, private
std::unique_ptr<PImplMagic<Test>::Impl>
{
Test();
void f();
};
int main()
{
Test t;
t.f();
}
template<>
struct PImplMagic<Test>::Impl
{
Impl()
{
std::cout << "It works!" << std::endl;
}
int x = 7;
};
Test::Test()
: std::unique_ptr<Impl>(new Impl)
{
}
void Test::f()
{
std::cout << (*this)->x << std::endl;
}
http://ideone.com/WcxJu2
I like the way this alternate version works, however I'm curious if it has
any major drawbacks over the traditional version?
The traditional PImpl Idiom is like this:
#include <memory>
struct Blah
{
//public interface declarations
private:
struct Impl;
std::unique_ptr<Impl> impl;
};
//in source implementation file:
struct Blah::Impl
{
//private data
};
//public interface definitions
However, for fun, I tried to use composition with private inheritance
instead:
#include <iostream>
#include <type_traits>
#include <memory>
template<typename Derived>
struct PImplMagic
{
PImplMagic()
{
static_assert(std::is_base_of<PImplMagic, Derived>::value,
"Template parameter must be deriving class");
}
//protected: //has to be public, unfortunately
struct Impl;
};
struct Test : private PImplMagic<Test>, private
std::unique_ptr<PImplMagic<Test>::Impl>
{
Test();
void f();
};
int main()
{
Test t;
t.f();
}
template<>
struct PImplMagic<Test>::Impl
{
Impl()
{
std::cout << "It works!" << std::endl;
}
int x = 7;
};
Test::Test()
: std::unique_ptr<Impl>(new Impl)
{
}
void Test::f()
{
std::cout << (*this)->x << std::endl;
}
http://ideone.com/WcxJu2
I like the way this alternate version works, however I'm curious if it has
any major drawbacks over the traditional version?
Ubuntu 13.04 shutdown problem. Got no idea what to do next
Ubuntu 13.04 shutdown problem. Got no idea what to do next
I have been using Ubuntu for two years now and had few actual problems. I
have searched this site and tried various things to no effect. I will do
my best to explain, and certainly include too much info as I have no idea
what my problem really is. Please take answers to the 'for dummies'-level
and I shall certainly do my best to understand!
So, I have this lovely acer TravelMate 5310 from around 07 that's causing
a bit of a headache. It's Vista was removed and replaced with Ubuntu 11.??
some two years ago and was updated to the 12.04 LTS at some point before
christmas. It has worked well except a problem with the network that's
solved with a plug in reciever. All was just fine until I two days ago
wanted to install the latest version, 13.04. I by accident installed
12.04LTS again and thought it won't matter. The problem with shutdown
started after this, and we have finally arrived at the point of all this.
It won't shut down. I removed the 12 and installed the 13 last night
thinking the problem might go away. It installed and updated and whent for
a restart without problems but came to a halt at the purple screen.
I performed the hard shutdown(the press button method) and restarted. It
boots up with ease and all is really well BUT it simply cannot shut down.
It now hangs on a black screen with loads of white numbers, words and
other such terminal-like things. So I push and hold shutdown to turn it
off.
I tried doing this Then tried the acpi=off in terminal but nothing works.
I have yet to try the command shutdown -h now but I now managed to hit esc
at the right time and go behind the first screen and see the next. I am
sorry that I have no pictures to show you.
The processes that seems to fail are two:
*killing all remaining processes.... [fail]
modem-manager[953] : Caught signal 15, shutting down...
then follows ok's on deactivating swanps, unmounting filesystems.
then:
*stopping remanining crypto discs... [ok]
*stopping early crypto discs... [fail]
Unmount: /run/lock: not mounted
unmount: /run/shm: not mounted
mount: / is busy
*will now halt
And that is where it hangs..
I hope you are able to understand anything. I have no idea. The formating
above is all wrong and such, I tried my best^^
I have been using Ubuntu for two years now and had few actual problems. I
have searched this site and tried various things to no effect. I will do
my best to explain, and certainly include too much info as I have no idea
what my problem really is. Please take answers to the 'for dummies'-level
and I shall certainly do my best to understand!
So, I have this lovely acer TravelMate 5310 from around 07 that's causing
a bit of a headache. It's Vista was removed and replaced with Ubuntu 11.??
some two years ago and was updated to the 12.04 LTS at some point before
christmas. It has worked well except a problem with the network that's
solved with a plug in reciever. All was just fine until I two days ago
wanted to install the latest version, 13.04. I by accident installed
12.04LTS again and thought it won't matter. The problem with shutdown
started after this, and we have finally arrived at the point of all this.
It won't shut down. I removed the 12 and installed the 13 last night
thinking the problem might go away. It installed and updated and whent for
a restart without problems but came to a halt at the purple screen.
I performed the hard shutdown(the press button method) and restarted. It
boots up with ease and all is really well BUT it simply cannot shut down.
It now hangs on a black screen with loads of white numbers, words and
other such terminal-like things. So I push and hold shutdown to turn it
off.
I tried doing this Then tried the acpi=off in terminal but nothing works.
I have yet to try the command shutdown -h now but I now managed to hit esc
at the right time and go behind the first screen and see the next. I am
sorry that I have no pictures to show you.
The processes that seems to fail are two:
*killing all remaining processes.... [fail]
modem-manager[953] : Caught signal 15, shutting down...
then follows ok's on deactivating swanps, unmounting filesystems.
then:
*stopping remanining crypto discs... [ok]
*stopping early crypto discs... [fail]
Unmount: /run/lock: not mounted
unmount: /run/shm: not mounted
mount: / is busy
*will now halt
And that is where it hangs..
I hope you are able to understand anything. I have no idea. The formating
above is all wrong and such, I tried my best^^
Software for aiding in printing photos
Software for aiding in printing photos
I wanted to know if there is any software to print photos, which can frame
the photo and also change the size of it. I have two printers canon and
while I found the drivers and work, Ubuntu 12.04 will not let me install
the printer CD. Unable to install this SW, not only I can not print photos
as I want, but I can not run a head cleaning, aligning, or know that I
have ink level. I hope you can help me and all the SW probe recommended
software center, but they are very basic and none worked as I expected.
I wanted to know if there is any software to print photos, which can frame
the photo and also change the size of it. I have two printers canon and
while I found the drivers and work, Ubuntu 12.04 will not let me install
the printer CD. Unable to install this SW, not only I can not print photos
as I want, but I can not run a head cleaning, aligning, or know that I
have ink level. I hope you can help me and all the SW probe recommended
software center, but they are very basic and none worked as I expected.
Subscribe to:
Posts (Atom)