|
Hi Navaneeth,
once again thanks for your reply.
In such cases you may need ask senders to prefix an identifier string with the SMS. So if it is recruitment SMS, format will be REC <RECRUIT> space <NRIC> space <Name> space <PositionInterested>. Here, REC is the identifier. You can look at the starting of message and this identifier will help you to determine the type of message. You can have a valid set of identifiers and validate against it.
Currently this is what i have. I have a database table called "userapp". Below is the schema and the sample data
Userapp
userid(int)
keyword(varchar(50))
103 | Temp
132 | Quiz
150 | Lucky
For each keyword, i have a seperate for them called app_KEYWORD. So it will be app_Temp, app_Quiz, app_Lucky.
try {
ArrayList<String> array = new ArrayList<String>();
String firstword = null;
ResultSet rs1 = null;
ResultSet rs2 = null;
int id = 0;
String sql1 = "SELECT * from userapp";
String sql3 = null;
rs1 = db.SelectDB(sql1);
while (rs1.next()) {
array.add(rs1.getString("keyword"));
}
for (String i : array) {
sql3 = "SELECT * FROM SMSSERVER_IN WHERE TEXT LIKE '" + i + "%'";
ResultSet rs3 = db.SelectDB(sql3);
while (rs3.next()) {
out.print(i);
String sql4 = "Insert into app_" + i + "(originator,text)values(" + rs3.getString("originator") + ",'" + rs3.getString("text") + "')";
db.InsertDB(sql4);
}
String sql5 = "DELETE FROM SMSSERVER_IN WHERE TEXT LIKE'" + i + "%'";
db.DeleteDB(sql5);
}
} catch (Exception ex) {
}
Above is my code to check the identifier and then store it into the correct database.
So instead of storing just 1 keyword, I have to store the whole sms format in it as well?
Also, u mention building a regular expression, how can i create an interface that allows the user who define the format to have their own expression? What kind of form or fields should i display in order to build it.
Thanks
|
|
|
|
|
benjamin yap wrote: Also, u mention building a regular expression, how can i create an interface that allows the user who define the format to have their own expression? What kind of form or fields should i display in order to build it.
I'd create a form with one drop-down list, text-box and a button. User will select the available identifiers from the drop-down and enter expected message format in the text-box. You need to define placeholders like <name>, <NRIC> and <message> etc. Assume user entered <name> space <NRIC> space <message>, you need to find the placeholders in this and convert the string into a valid regular expression and keep in database.
I am very bad at GUI designs and there may be much better way to design GUI than what I suggested.
|
|
|
|
|
Hello,
I have a project from the university to implement the fax protocol (in any language I want).
The idea is to write a software that will be able to receive a fax from a real fax machine. It can be done in any way I want - any language/environment , via modem or some other idea.
I know how the fax protocol works and I wrote a simple implementation already. The problem is actually running it.
I tried writing a C# program using SerialPort class and to access the modem's received data. The problem is that the modem does its own thing upon connecting and doesn't give me control over the received data.
I ran out of ideas at this point.
What else can I do?
Thank you very much.
|
|
|
|
|
ran9 wrote: the modem does its own thing upon connecting and doesn't give me control over the received data.
Can you be more specific about what "its own thing" might be? Is it doing things that other modems don't?
Using modem control strings you can change the behavior of any modem quite a bit, but they aren't as standardized as they used to be. Once upon a time these strings were well defined (the Hayes or AT protocol) and universally implemented, but that's no longer the case. You may need to provide setup routines for each type of modem you plan to use. Your program should initalize the modem to behave as you need it to before the answering mode is enabled.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Roger Wright wrote: Can you be more specific about what "its own thing" might be? Is it doing things that other modems don't?
Thanks for your relpy.
The modem tries to send a connection [data] signal and I would like it to do nothing. Just to give me access to an incoming stream of data.
My program needs to work only my computer which has an Agere HDA modem.
Thanks again.
|
|
|
|
|
Hi,
I think a found a way that might work.
I connected my Nokia phone to the computer and it works as kind of voice modem.
When I answer a call the phone just answers without any processing since it knows to handle only voice.
My problem now is to read the voice samples from the phone/modem.
Any ideas on that?
I tried reading using a SerialPort class but I only get the modem status messages (RING, CONNECTED, etc.) and not the data itself.
Thank you.
|
|
|
|
|
Hi. Could you tell me where I could find information concerning how fax data is encoded?
A friend, who shares my interest in sailing, has suggested I write a program that interprets weatherfax data. (When you're offshore in a small boat, being able to predict the weather is pretty important.) His idea is to receive the weatherfax data on his SSB, route it to his laptop via the modem and and generate a weather map (There already are commercial programs around that do this but he's obviously too cheap to buy one!). As weatherfax transmissions are simplex, there's no handshaking or active error correction involved, so it should be somewhat simpler to program compared to phone-based fax transmissions. Not that I know much about that, I'm just interested in investigating this problem.
Thanks for any suggestions anyone can offer.
|
|
|
|
|
Hello,
I havent found much information about cuckoo hashing apart from the official papers..
I have some questions about it,
1. What would be two good random functions for this type of hashing?
2. What about the rehashing algorithm? Because i'm having troubles with the official specification of it.. which kinda loops between inserting and rehashing infinitely
|
|
|
|
|
I have no experience with cuckoo hashing, so I can't help you there.
If you need to manage hash collisions and have problems with cuckoo or are worried about infinite loops and rehashing, you may consider using chaining[^]. While it's not as performing as cuckoo, it's very simple to implement, scalable, and works like a charm.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
How about using a modified Jenkins One a at a Time[^]
Instead of starting the hash from zero, I tried getting the first hash using root 0 and the second using the first as a root. The two resulting hash's are pretty well distributed.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I'd never heard of cuckoo hashing before; it seems like an interesting concept, though I would be paranoid about worst-case behavior if hash functions are poorly chosen (most hash table algorithms will run in bounded time even with the worst possible hash functions; the worst-case time to add an item to a cuckoo-hash table would seem to be unbounded).
At the expense of some extra book-keeping (probably O(1) in typical cases, but bounded even in the worst case), I would think one could implement a variation of cuckoo hash in which every item was stored at location (H1+k*H2) mod N (as with double hashing), but which provided that if the cell targeted by an item with a certain 'k' contained an item with a sufficiently smaller 'k', the latter item would be displaced. That would tend to balance out the number of search steps required to find any particular item. Provided that H2 is always relatively prime to N, the algorithm should always terminate. If there are never any deletions, the extra book-keeping would be minimal; deletions could complicate things, though.
|
|
|
|
|
How can i calculate space cimplexity
i need explanation more
|
|
|
|
|
i got a tutorial from internate on Space complexity.i show the important part
of this tutorial below. it's may be help u to calculate space complexity.
The space complexity of a program is the number of elementary objects that
this program needs to store during its execution.
For an algorithm T and an input x, DSPACE(T, x) denotes the
number of cells used during the (deterministic) computation T(x).
We will note DSPACE(T) = O(f (n)) if DSPACE(T, x) = O(f (n))
with n = |x | (length of x).
EXAMPLE:1- note: x is an unsorted array
int findMin(int[] x) {
int k = 0; int n = x.length;
for (int i = 1; i < n; i++) {
if (x[i] < x[k]) {
k = i;
}
}
return k;
}
T(findMin, n) = n + 2
T(findMin, n) = O(n)
EXAMPLE:2- note: x is an unsorted array
void multVect(int[] x, int[][] a) {
int k = 0; int n = x.length;
for (int i = 1; i < n; i++) {
for (int j = 1; j < n; j++) {
a[i][j] = x[i] * x[j]
}
}
}
T(multVect, n) = n × n + 2
T(multVect, n) = O(n2)
|
|
|
|
|
hello everybody,i have find a source code of a skin color detection.this program is run well.but i need the explanation of this code.can any body explain this code.i code is given below.....
void Color(IplImage *img);
struct num
{
unsigned char H;
unsigned char S;
unsigned char V;
};
int main( int argc, char** argv )
{
IplImage* pFrame = NULL;
CvCapture* pCapture = NULL;
cvNamedWindow("video",1);
pCapture = cvCaptureFromCAM(-1);
if(pCapture)
{
for(;;)
{
pFrame = cvQueryFrame(pCapture);
Color(pFrame);
// Color_Guass(pFrame);
cvShowImage("video",pFrame);
if(cvWaitKey(10)>=0)
break;
}
cvReleaseCapture(&pCapture);
}
cvDestroyWindow("video");
cvReleaseImage(&pFrame);
return 0;
}
void Color(IplImage *img)
{
int i,j;
IplImage *img_hsv = 0;
img_hsv = cvCreateImage(cvGetSize(img),8,3);
cvCvtColor(img,img_hsv,CV_BGR2HSV);
struct num **bmpdata;
struct num **bmpdata1;
bmpdata = new num*[img->height];
bmpdata1 = new num*[img->height];
//from here i dont understand.please replay me if anybody can understand..........................
for(i=0;i<img->height;i++)
{
bmpdata[i] = new num[img->width];
bmpdata1[i] = new num[img->width];
}
for(i=0;i<img->height;i++)
for(j=0;j<img->width;j++)
{
bmpdata[i][j].H=((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3];
bmpdata[i][j].S=((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3+1] ;
bmpdata[i][j].V=((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3+2];
}
for (i=0;i<img->height;i++)
{
for (j=0;j<img->width;j++)
{
if(bmpdata[i][j].H<=19&&bmpdata[i][j].S>=48)
bmpdata[i][j].H+=0;
else bmpdata[i][j].H=bmpdata[i][j].S=bmpdata[i][j].V=0;
}
}
for (i=1;i<img->height-1;i++)
for (j=1;j<img->width-1;j++)
{
if(bmpdata[i][j].H!=0)
if(bmpdata[i][j-1].H==0||bmpdata[i][j+1].H==0||
bmpdata[i+1][j].H==0||bmpdata[i-1][j].H==0
){
bmpdata1[i][j].H=0;
bmpdata1[i][j].S=0;
bmpdata1[i][j].V=0;
}
else{
bmpdata1[i][j].H+=0;
bmpdata1[i][j].S+=0;
bmpdata1[i][j].V+=0;
}
}
for (i=0;i<img->height;i++)
for (j=0;j<img->width;j++)
{
((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3]=bmpdata[i][j].H;
((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3+1]=bmpdata[i][j].S;
((uchar*)(img_hsv->imageData + img_hsv->widthStep*i))[j*3+2]=bmpdata[i][j].V;
}
cvCvtColor(img_hsv,img,CV_HSV2BGR);
cvErode(img,img,NULL,1);
cvDilate(img,img,NULL,1);
}
|
|
|
|
|
Have you tried searching using Google or your favorite search engine? There are hundreds of scholarly papers on the web about this topic.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
i am still searching google.but i do not get the appropiate explanation of this code.
|
|
|
|
|
Out of curiosity, where did you find this gem?
What the main intent seems to is to preserve pixels with hue values less than equal to 19 and saturation values great than or equal to 48 and to turn pixels that don't match black.
I have no idea why bmpdata1 was even allocated since it's ultimately never used in the code you show. The only reason I can think of is that it's there to waste memory and CPU cycle bacause whoever wrote the program couldn't reverse the sense of their if statements and needed to do the actual work in the else clause. All the "+=0" statements do absolutely nothing. The pair of loops working on bmpdata1 are especially suspicious. It appears to set the pixels in bmpdata1 to zero if a pixel in bmpdata that is nonzero is has a zero neighbor above, below or to the side. The else clause adding zero does nothing. What's more, bmpdata1 is never initialized to anything so the data not set to zero is random.
Not that it probably matters with the rest of this mess, neither bmpdata or bmpdata1 are freed causing memory leaks.
It also appears that all of this work could have been done in place in the original image without doing the copies to and from bmpdata.
If you're looking for an example of segmenting an image based on skin color, I'd try to find a better example.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Another little faux pas in that example is that (even if it works) it will show an output window, do its calculations, and then immediately close the window before you can study the results. You need a cvWaitKey(0) at the end.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
if(bmpdata[i][j].H<=19&&bmpdata[i][j].S>=48)
bmpdata[i][j].H+=0;
else bmpdata[i][j].H=bmpdata[i][j].S=bmpdata[i][j].V=0;
By the above part,i think,identify the background color.if the condition is satisfy then,
it does not perform nothing(bmpdata[i][j].H+=0), otherwise background set by zero(bmpdata[i][j].H=bmpdata[i][j].S=bmpdata[i][j].V=0)
In addition,the ouput is,only show the skin color and background color show black.
but the below part are confuse me.
for (i=1;i<img->height-1;i++)
for (j=1;j<img->width-1;j++)
{
if(bmpdata[i][j].H!=0)
if(bmpdata[i][j-1].H==0||bmpdata[i][j+1].H==0||
bmpdata[i+1][j].H==0||bmpdata[i-1][j].H==0
){
bmpdata1[i][j].H=0;
bmpdata1[i][j].S=0;
bmpdata1[i][j].V=0;
}
|
|
|
|
|
Yes, the intent seems to be to leave the parts of the picture that are skin unchanged and turn everything else black.
The part you question appears to be some attempt to get rid of isolated pixels that might be noise. If a pixel is nonzero but has a zero neighbor, set it to zero. But as I said, using that to alter, or not, bmpdata1 makes absolutely no sense what so ever.
The Erode and Dilate functions at the end also do that to an extent, too.
Whoever wrote this turkey was clueless. I searched and the only place I found it was an earlier post here on CP. Is that where you found it?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
i have got this code from another site.
this is the link of this source code.
http://read.pudn.com/downloads102/sourcecode/graph/texture_mapping/418188/facecolor.cpp__.htm
you mean that,at the end erod and diod are also doing same task,that you explane.is it?
|
|
|
|
|
This video[^] is basically what you're trying to do with the addition of fingertip identification and bounding box. The technique does work. Plenty of other examples out there. I'm using a variation of the same technique to find an orange traffic cone potentially to be used on a RoboMagellan robot[^].
Erode and Dilate are called morphological operators and one of their uses is to remove noise from images. Pixels are first removed from objects and then replaced. The result is that small objects get removed entirely and there's nothing to build back with.
If you're reasonably serious about learning to use OpenCV to do vision problems, I recommend this book.[^]. It will explain much of what's available in OpenCV and how to use the basic techniques.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Can u help with the executable code.This code shows some error.Reply as soon as possible.
|
|
|
|
|
Hi All
Hopefully someone can help shed some light for me.
I have some code I have used for years to calculate and store (in SQL Server database), and retrieve and compare a hash value using ComputeHash of the MD5CryptoServiceProvider. I have recently upgraded to x64 (Windows 7) from x86 (Vista) but now my hashes calculated on the x86 does not match when compared (using x64)! (Hope that all makes sense.)
Is there any obvious reasons for this? Where should I be looking??
thanx
|
|
|
|
|
Well, I think I have narrowed it down to the "GetHashCode" being the culprit! After replacing the "GetHashCode" with my own hash function it seems to work in both x86 and x64 OSs.
For Each c As DataColumn In ds.Tables("mytable").Columns
If Not c.ColumnName = "hashvalue" Then
If r(c) IsNot DBNull.Value Then RowHash += r(c).GetHashCode.ToString
End If
Next
' ... compare the "RowHash" with the one stored in the "hashvalue" column ...
This article seem to agree.
"... the .NET Object.GetHashCode() method, which unfortunately differs between x86 and x64 systems."
Any have any clue why?? That sucks (nothing in the documentation)!
modified on Wednesday, August 19, 2009 3:47 AM
|
|
|
|