Hi
you wish to consume DataSet from .NET webservices , anyway i could not find an easy way to do it , as you do it within c# code, you must deal with XML parsers.
any way, a very good explanation and description could be found here Web Services and DataSets.
In short .. it is most recommended to expose the results as array of objects ,when you want your Java consumer be happy.
.... i used axis 2 to generate webservice proxies .
good luck
Yaniv Tzanany
This Blog is first of all memos for me!! From time to time I get exposed to new and cool stuff for developers and architects ,most of the time its a solution for a problem or tips or tricks, so, I would like to track my memos and share it with you, it can save your time and nervous, I hope you will enjoy it - by Yaniv Tzanany.
Search This Blog
Sunday, February 27, 2011
Tuesday, February 22, 2011
How to get Facebook friends status ? - online or not
just found this post , i didn't test it yet , and i cant promise anything about it.
you need the next Extended permission: friends_online_presence
To actively query the online presence of your friends use the next graph call:
https://api.facebook.com/method/fql.query?access_token='((INSERT ACCESSTOKEN HERE))'&query= SELECT online_presence FROM user WHERE uid = '((UID OF FRIEND))'
That should return the info.
i hope it will work, i will report when it will work for me.
enjoy
Yaniv Tzanany
you need the next Extended permission: friends_online_presence
To actively query the online presence of your friends use the next graph call:
https://api.facebook.com/method/fql.query?access_token='((INSERT ACCESSTOKEN HERE))'&query= SELECT online_presence FROM user WHERE uid = '((UID OF FRIEND))'
That should return the info.
i hope it will work, i will report when it will work for me.
enjoy
Yaniv Tzanany
Wednesday, February 16, 2011
MyLikesBox - You must have this facebook application
See ALL You Facebook LIKE's!
Manage your facebook likes with this App.
see how its looks like at Techcrunch , and you can use it direct from here MyLikesBox.
you will LOVE it !!!
Don't forget to LIKE us too.
enjoy
Yaniv Tzanany
Manage your facebook likes with this App.
see how its looks like at Techcrunch , and you can use it direct from here MyLikesBox.
you will LOVE it !!!
Don't forget to LIKE us too.
enjoy
Yaniv Tzanany
Wednesday, February 9, 2011
C++ code description in XML
The GCC-XML, the XML output extension to GCC!
Development tools that work with programming languages benefit from their ability to understand the code with which they work at a level comparable to a compiler. C++ has become a popular and powerful language, but parsing it is a very challenging problem. This has discouraged the development of tools meant to work directly with the language.
There is one open-source C++ parser, the C++ front-end to GCC, which is currently able to deal with the language in its entirety. The purpose of the GCC-XML extension is to generate an XML description of a C++ program from GCC's internal representation. Since XML is easy to parse, other development tools will be able to work with C++ programs without the burden of a complicated C++ parser.
more could be found here GCC-XML
Yaniv Tzanany
Predefined Macros in c++
In ANSI c++ , there are some predefined macro that you can used , for example to write to your logs. __DATE__ A character string literal containing the date when the source file was compiled. The date will be in the form: "Mmm dd yyyy" __FILE__ Defined as a character string literal containing the name of the source file. __LINE__ Defined to be an integer representing the current source line number. __STDC__ Defined if the C compiler conforms to the ANSI standard. This macro is undefined if the language level is set to anything other than ANSI. __TIME__ Defined as a character string literal containing the time when the source file was compiled. The time will be in the form: "hh:mm:ss"__FUNCTION_ access the name of a currently executing function programmatically.
more macros could be found here Standard Predefined Macro, more about __FUNCTION__ could be found here Retrieve a Function's Name Programmatically
Code sample:#include
#ifdef __STDC__
# define CONFORM "conforms"
#else
# define CONFORM "does not conform"
#endif
int main(void)
{
printf("Line %d of file %s has been executed\n", __LINE__, __FILE__);
printf("This file was compiled at %s on %s\n", __TIME__, __DATE__);
printf("This program %s to ANSI standards\n", CONFORM);
}
Yaniv Tzanany
Monday, January 17, 2011
Adding custom http header to each request with FireFox and IE
Sometimes you need to add an extra http header for each request , to simulate requests from third parties or clients.
in my case i needed to add an extra header for each request to simulate "single sign on" to my system, so an extra header added by the client with the user id , and i wanted to test such solution, without the need to develop a proxy or any test tool, so i found this.
For Firefox - use the add on Modify header to Add, modify and filter http request headers.
For IE browser - it more complicated:
in my case i needed to add an extra header for each request to simulate "single sign on" to my system, so an extra header added by the client with the user id , and i wanted to test such solution, without the need to develop a proxy or any test tool, so i found this.
For Firefox - use the add on Modify header to Add, modify and filter http request headers.
For IE browser - it more complicated:
- you have to download Fiddler
- Open the 'Customize Rules' window (Rules->Customize Rules...)
- Find this function: static function OnBeforeRequest(oSession: Session)
- inside this function, add the header values that you would like to add, in this format: oSession.oRequest["headerName"] = "headerValue";
To get your new header on each request , open your IE , and make sure Fiddler is running.
enjoy
Yaniv Tzanany
Tuesday, January 4, 2011
Working with WebSphere MQ JMS Under WebSphere app server
i struggled allot to make this JMS sample working .
follow the next instruction to use JMS under web sphere.
1. get into admin console
2. get into JMS->connection factories -> new
choose web sphere MQ , click OK .
give it a logic name , and a jndi name such as jms/myMqFactory, and set the correct parameters during the wizard.
click finish and save.
3. goto Resources -> JMS ->queues
4. click new , and choose websphere MQ message provider
set the name and jndi name such as jms/mqRequestQ
and set the queue name
5. click apply and save.
some resources i used :
Developing a JMS client
IBM WebSphere Developer Technical Journal: Building an Enterprise Service Bus with WebSphere Application Server V6 -- Part 3
A java.lang.ClassCastException error occurs during a JNDI lookup of a queue connection factory
here is the code snippets, i used tp send message to mqRequestQ and get result from mqResponseQ , and pick the message with the same msg id:
private void testJMS(String qIn,String qOut )
{
String outString = "I am a string from JMS";
String qcfName = "jms/myMqFactory";
String qnameIn = "jms/mqRequestQ";
String qnameOut = "jms/mqResponseQ";
boolean verbose = false;
Session session = null;
Connection connection = null;
ConnectionFactory qcf = null;
Queue inQueue = null;
Queue outQueue = null;
InitialContext context = null;
try {
context = new InitialContext();
qcf = (ConnectionFactory)context.lookup( qcfName );
inQueue = (Queue)context.lookup( qnameIn );
outQueue = (Queue)context.lookup( qnameOut );
if(qcf != null)
{
connection = qcf.createConnection();
connection.start();
boolean transacted = false;
session = connection.createSession( transacted,
Session.AUTO_ACKNOWLEDGE);
((MQQueue)inQueue).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ); //its 1
MessageProducer queueSender = session.createProducer(inQueue);
queueSender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
queueSender.setTimeToLive(60000); // in milli seconds 0 - unlimited
TextMessage outMessage = session.createTextMessage(outString);
outMessage.setJMSCorrelationID("Alis0000");
queueSender.send(outMessage);
queueSender.close();
String msgID = outMessage.getJMSMessageID();
String selector1 = "JMSMessageID='"+msgID+"'";
MessageConsumer queueReciever = session.createConsumer(outQueue, selector1);
javax.jms.Message inMessage = queueReciever.receive(2000);
if ( inMessage instanceof TextMessage )
{
String replyString = ((TextMessage) inMessage).getText();
}
queueReciever.close();
session.close();
session = null;
connection.close();
connection = null;
}
} catch (NamingException e) {
// there is no such DSN lets report it and will try to work without the DataSource name
} catch (JMSException je) {
System.out.println("JMS failed with "+je);
Exception le = je.getLinkedException();
if (le != null)
{
System.out.println("linked exception "+le);
}
}
}
enjoy
Yaniv Tzanany
follow the next instruction to use JMS under web sphere.
1. get into admin console
2. get into JMS->connection factories -> new
choose web sphere MQ , click OK .
give it a logic name , and a jndi name such as jms/myMqFactory, and set the correct parameters during the wizard.
click finish and save.
3. goto Resources -> JMS ->queues
4. click new , and choose websphere MQ message provider
set the name and jndi name such as jms/mqRequestQ
and set the queue name
5. click apply and save.
some resources i used :
Developing a JMS client
IBM WebSphere Developer Technical Journal: Building an Enterprise Service Bus with WebSphere Application Server V6 -- Part 3
A java.lang.ClassCastException error occurs during a JNDI lookup of a queue connection factory
How to extract Queue Manager Name from CF / QCF in your J2EE JMS application
here is the code snippets, i used tp send message to mqRequestQ and get result from mqResponseQ , and pick the message with the same msg id:
private void testJMS(String qIn,String qOut )
{
String outString = "I am a string from JMS";
String qcfName = "jms/myMqFactory";
String qnameIn = "jms/mqRequestQ";
String qnameOut = "jms/mqResponseQ";
boolean verbose = false;
Session session = null;
Connection connection = null;
ConnectionFactory qcf = null;
Queue inQueue = null;
Queue outQueue = null;
InitialContext context = null;
try {
context = new InitialContext();
qcf = (ConnectionFactory)context.lookup( qcfName );
inQueue = (Queue)context.lookup( qnameIn );
outQueue = (Queue)context.lookup( qnameOut );
if(qcf != null)
{
connection = qcf.createConnection();
connection.start();
boolean transacted = false;
session = connection.createSession( transacted,
Session.AUTO_ACKNOWLEDGE);
((MQQueue)inQueue).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ); //its 1
MessageProducer queueSender = session.createProducer(inQueue);
queueSender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
queueSender.setTimeToLive(60000); // in milli seconds 0 - unlimited
TextMessage outMessage = session.createTextMessage(outString);
outMessage.setJMSCorrelationID("Alis0000");
queueSender.send(outMessage);
queueSender.close();
String msgID = outMessage.getJMSMessageID();
String selector1 = "JMSMessageID='"+msgID+"'";
MessageConsumer queueReciever = session.createConsumer(outQueue, selector1);
javax.jms.Message inMessage = queueReciever.receive(2000);
if ( inMessage instanceof TextMessage )
{
String replyString = ((TextMessage) inMessage).getText();
}
queueReciever.close();
session.close();
session = null;
connection.close();
connection = null;
}
} catch (NamingException e) {
// there is no such DSN lets report it and will try to work without the DataSource name
} catch (JMSException je) {
System.out.println("JMS failed with "+je);
Exception le = je.getLinkedException();
if (le != null)
{
System.out.println("linked exception "+le);
}
}
}
enjoy
Yaniv Tzanany
Subscribe to:
Posts (Atom)