|
Greeeg wrote: For photos, you should choose jpeg or some wavelet based algorithms like jpeg2000.
Both offer lossy and lossless compressions
No, there is no lossless JPEG compression.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
Matty22 wrote: JPEG 1991 supports lossless compression
No, it doesn't. That's an addition made in 1993, and it's not supported by the standard libraries.
wikipedia: Lossless JPEG[^]
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I'm developing a SMS server, for which I need to store income SMS request and response of my appliction on those SMS in Windows message queue. I've done Googling but could not find some appropriate material. Please help me out.
|
|
|
|
|
Google MSMQ - there's a ton of resources out there, here's some links to some CP articles:
CP MSMQ Search[^]
|
|
|
|
|
I've been experimenting with various implementations of two-way communications using WCF over MSMQ, and without ever thinking it would work, tried the following:
using System;
using System.ServiceModel;
namespace MessagingSample
{
[ServiceContract]
public interface ISampleContract
{
[OperationContract(IsOneWay = true)]
void StartDoingSomething(string someText, SampleClient client);
}
[ServiceBehavior]
public class SampleClient
{
private ISampleContract workerService;
public void StartClient(string server)
{
EndpointAddress endpointAddress = new EndpointAddress(
new Uri(string.Format(@"net.msmq://{0}/private/SampleQueue", server)));
NetMsmqBinding clientBinding = new NetMsmqBinding();
clientBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.None;
clientBinding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.None;
ChannelFactory<ISampleContract> channelFactory =
new ChannelFactory<ISampleContract>(clientBinding, endpointAddress);
workerService = channelFactory.CreateChannel();
}
public void StopClient()
{
if (workerService != null)
{
workerService = null;
}
}
public void StartDoingSomething(string text)
{
if (workerService != null)
{
workerService.StartDoingSomething(text, this);
}
}
public void DoSomethingElse(string text)
{
System.Diagnostics.Debug.WriteLine(text);
}
}
[ServiceBehavior]
public class SampleServer : ISampleContract
{
private ServiceHost serviceHost = null;
public void StartServer(string server)
{
Uri serviceUri = new Uri(string.Format(@"net.msmq://{0}/private/SampleQueue", server));
NetMsmqBinding serviceBinding = new NetMsmqBinding();
serviceBinding.Security.Transport.MsmqAuthenticationMode = MsmqAuthenticationMode.None;
serviceBinding.Security.Transport.MsmqProtectionLevel = System.Net.Security.ProtectionLevel.None;
serviceBinding.MaxReceivedMessageSize = 1024 * 4096;
serviceBinding.ReaderQuotas.MaxArrayLength = 1024 * 4096;
serviceHost = new ServiceHost(typeof(SampleServer));
serviceHost.AddServiceEndpoint(typeof(ISampleContract), serviceBinding, serviceUri);
serviceHost.Open();
}
public void StopServer()
{
if (serviceHost != null)
{
serviceHost.Close();
}
}
public void StartDoingSomething(string someText, SampleClient client)
{
System.Diagnostics.Debug.WriteLine(someText);
client.DoSomethingElse("Processed: "+ someText);
}
}
}
If you create another couple of applications - one that implements the SampleClient, and another that implements the SampleServer - both will communicate in a two-way fashion over MSMQ using this code.
If the server is down/stopped, messages will be queued and returned to the original client when the server comes back online. In situations where a message is received by the server but the client no longer exists it all fails silently - i.e. no exceptions at the server, and the response method call is simply lost in the ether.
The first question is why does it work? I'm not passing any service endpoints for the client to the server, so how is the server able to address the client? All of the two-way MSMQ/WCF samples I've seen thus far require that the client also act as a server.
The second question is when will it not work?
Note: you'll need to create a queue named "SampleQueue" in MSMQ for this all to work of course.
|
|
|
|
|
Try coding it in Java. C# sucks big time. May Allah give you the knowledge
|
|
|
|
|
The operative word there being try, of course.
P.S. Do you always submit message board posts that make you sound like a total moron, or was this just an isolated instance?
|
|
|
|
|
Furty wrote: Do you always submit message board posts that make you sound like a total moron, or was this just an isolated instance?
Dude i was showing u the right path for programming
|
|
|
|
|
Meer Osman Ali wrote: Dude i was showing u the right path for programming
Right. Gotcha.
I had you pegged as a trolling wanker, but thanks for the confirmation!
|
|
|
|
|
Furty wrote:
I had you pegged as a trolling wanker, but thanks for the confirmation!
Gee have a nice day then
|
|
|
|
|
If it farts like a troll, smells like a troll, and looks like a troll, shouldn't we just castrate it?
|
|
|
|
|
Absolutely not. It would fart, smell and look like a troll even more,
and scream its heart out on top of that.
On the other hand, if it intends to procreate, you would have to
accept these short-term disadvantages, and go for the long-term benefits.
Or act a little more effectively and solve the problem once and forever.
PS: nothing much has changed around here, has it?
|
|
|
|
|
Luc Pattyn wrote: PS: nothing much has changed around here, has it?
Same ol', same ol'. Mind you, I've spent the last month or so working on a bit of Open Source work along with Karl Shifflett, so I've spent less time in the forums as a result.
|
|
|
|
|
No, pretty much every post he's made is from a completely ignorant viewpoint.
|
|
|
|
|
Allah has given us C#. Java is an abomination to Allah, a heretic language. Are you rally suggesting that we ignore the progress that He has granted us? Ignore type-safety? Drop the increased productivity?
That sounds like the arrogance that Iblis would display
As Spock would say, "Live long and prosper"
|
|
|
|
|
I created a xsd file using a xml, and then loaded it into a dataset. It created several tables according to the xsd. I notice that each table has a auto-generated column (name ends with ..._id, it looks like the dataset uses these ids to determine the relations between each table).
the problem I am having is that when I fill each table in the dataset with data, then write it out to a xml file, the xml file does not come out in the format defined by xsd, e.g. the child element becomes sibling elment of the parent element
defined in xsd
<parentelement>
<firstelement></firstelement>
</parentelement>
output xml file will become
<parentelement>
</parentelement>
<firstelement>
</firstelement>
When I debug it, I find out that the reason is that in dataset, the auto-generated "parentElement" table's id(key) column is updated automatically(0,1,2...), but the "childElement" table's id column is still empty, therefore cause the two table not to "link" to each other(I found out that by adding child table's id column with 0,1,2.., the xml will come out in the correct format).
I use
adp.fill(ds, "parentElement") and adp.fill(ds, "firstElement") to fill both table, can't figure out why only the parent table's id column is auto-populated not the child one.
Please experts help!!
|
|
|
|
|
It seems that you might have problems with mapping datasets to xml's.
You can find here[^] excellent code snippets, which will lead you to the correct solution.
SkyWalker
|
|
|
|
|
Hi
I have 4 arrays which i want to insert them into 4 columns of a table of my sql server 2000 database, and it should be done at once, not inserting one by one. How can i do this?
|
|
|
|
|
Transactions
http://en.wikipedia.org/wiki/Atomicity_(database_systems)
|
|
|
|
|
Easiest way is to create a stored procedure and pass the data as parameter to server side. This requires only single call to db.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I have read somewhere that I should use union all like this:
<br />
use myDb<br />
insert into myTable (columnName1,columnName2...)<br />
select row1value1,row1value2...<br />
union all<br />
<br />
select row2value1,row2value2...<br />
union all<br />
.<br />
.<br />
.<br />
but I don't know how pass the arrays to the stored procedure and how perform these in a loop to add all array elements automatically...
|
|
|
|
|
Union is only usable in db when you combine several result sets. You cannot use it to pass arrays from client. I don't remember if you can pass table type parameter in sql server 2000. That would be a solution in your case. It's not automatic so you must program the insert loop inside the procedure.
Another option is to use SqlBulkCopy class. Have a look at that also.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
My teacher now and then says that you should be very restrictive with global variables since they, according to him, are not recommended in object oriented programming.
Still he uses global variables himself. An example is that he creates objects which he refers to with global variables in windows applications.
With this as a background I wonder:
Are global variables really dissuaded in OOP? I am especially interested in knowing if global declaration and initialization of objects, which my teacher does, is OK.
|
|
|
|
|
You should restrict access as much as possible. But if it's not possible to restrict it anymore, than a global object is ok, I'd say.
Of course it's also possible to pass the object to every constructor or function as a parameter.. but this can get really complicated, especially if you notice that you need such an object after already having some code.
|
|
|
|