Functional programming:
It introduces a new style in programming. This is not a property of the language but this is the way to use the language.
The languages are different in degree of support of this style. Java 8 added some features to better support the functional programming such as lambda expression, stream and ...
This style of thinking and programming brings more expressive, easier to write, less error prone and easier parallelism, and makes the code more concise. It allows to the programmer to focus more on what he want instead of describing how to achieve what he wants. In traditional programming style the programmer enters in details of the steps to be passed to do something, but in functional programming there is a higher degree of abstraction that prevents the code to be too verbose.
The conditions need more care
Sunday, 30 April 2017
Friday, 20 January 2017
DataContractSerializer vs XmlSerializer
Problem:
The default serializer of WCF; DataContractSerializer; does not create attributes. It just makes elements. To be able to create the attributes, you must direct WCF to use XmlSerializer.
How: You must add [XmlSerializer] Under [ServiceContract]. Then specify the member is to be an attribute by [DataMember, XmlAttribute].
Example:
to create the following message
<?xml version="1.0" encoding="UTF-8"?>
<Product id="89471">
<Name>
Printer
</Name>
</Product>
[ServiceContract]
[XmlSerializer]
public class Product
{
[DataMember, XmlAttribute]
public string id;
public string Name{get;set;}
}
Problem: This works with GET method but on POST method it returns a response saying the request is not correct.
Solution: When you set XmlSerializer, the request content must be sent in xml format. For example, a method that takes a string parameter would be called like:
<?xml version="1.0" encoding="UTF-8"?><string>John</string>
The default serializer of WCF; DataContractSerializer; does not create attributes. It just makes elements. To be able to create the attributes, you must direct WCF to use XmlSerializer.
How: You must add [XmlSerializer] Under [ServiceContract]. Then specify the member is to be an attribute by [DataMember, XmlAttribute].
Example:
to create the following message
<?xml version="1.0" encoding="UTF-8"?>
<Product id="89471">
<Name>
Printer
</Name>
</Product>
[ServiceContract]
[XmlSerializer]
public class Product
{
[DataMember, XmlAttribute]
public string id;
public string Name{get;set;}
}
Problem: This works with GET method but on POST method it returns a response saying the request is not correct.
Solution: When you set XmlSerializer, the request content must be sent in xml format. For example, a method that takes a string parameter would be called like:
<?xml version="1.0" encoding="UTF-8"?><string>John</string>
Monday, 29 August 2016
How to connect to Oracle database that resides in virtual machine (Virtualbox):
How to connect to Oracle database that resides in virtual machine (Virtualbox):
- First From file menu of virtualbox select Preferences
- Then in network section select "host-only networks" tab. Here you must have "Virtualbox host-only Ethernet adapter". If not, create one. Double click on it to configure network address. For example you can set on: 192.168.1.100
- Now select the virtual machine that contains Oracle DB then select "Settings" to configure it. From network section choose "host-only adapter" ( if you want the database to be used by others on network choose "bridged adapter")
- Now start the virtual machine that contains Oracle DB. Wait until starts up and network icon appears.
- Double click network icon and set an IP address in the same domain. (For this case some IP like 192.168.1.101 or 192.168.1.115). This is important to give an address in the same domain specially in case of bridge mode that address dynamically set by network.
- Choose "net manager" from Oracle administration.
- In the opened box set host address to the one you have chosen for guest machine (192.168.1.101 or 192.168.1.115)
- Restart the virtual machine. It's done
Subscribe to:
Posts (Atom)

