|
Well I have twice given you some pointers, so the rest should be easy.
The best things in life are not things.
|
|
|
|
|
|
hi for all
<b>(SORRY FOR MY BAD ENGLISH)</b>
i am trying to rereceive a number from a Servlet
i send the request from J2ME using HttpConnection to a servlet , then a servlet make a session to count the number of times
i send the requests
and the servlet send back to me that number
but in HttpConnection i can send just one times terminated after that third states
so every time i send the request the number i received is 1
this is the code in J2ME
<pre>
HttpConnection hc = null;
DataInputStream in = null;
DataOutputStream out = null;
String UrlServer = "http://localhost:8080/DeleteWebApplication/RomaServlet";
StringBuffer sb = new StringBuffer();
private void sendGetContactsRequest() {
try {
UrlServer = "http://localhost:8080/Server2/SessionServlet";
sb = new StringBuffer();
hc = (HttpConnection) Connector.open(UrlServer, Connector.READ_WRITE);
hc.setRequestMethod(HttpConnection.POST);
out = hc.openDataOutputStream();
String getContacts = "getContacts";
byte[] getContactsBytes = getContacts.getBytes();
for (int i = 0; i < getContactsBytes.length; i++) {
out.writeByte(getContactsBytes[i]);
}
in = hc.openDataInputStream();
long len = hc.getLength();
int ch;
if (len != -1) {
for (int i = 0; i < len; i++) {
if ((ch = in.read()) != -1) {
sb.append((char) ch);
}
}
in.close();
hc.close();
out.flush();
out.close();
} else {
sb.append("ERRORR R ");
}
System.out.println(sb.toString());
} catch (IOException ex) {
ex.printStackTrace();
}
}
</pre>
don't care about all the code just about send and receive
this is the code in my servlet
<pre>
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
System.out.println("he totti asdf asdf asdf asdf ");
HttpSession session=request.getSession(false);
if(session==null){
session=request.getSession(true);
Integer times=new Integer(0);
session.setAttribute("count", times);
}
Integer times=(Integer) session.getAttribute("count");
times=new Integer(times.intValue()+1);
session.setAttribute("count", times);
response.getWriter().println("the number of times is "+times.intValue());
}
</pre>
i believe that a session is the best solution but i don't know how to use it
plz help me
ty very much
|
|
|
|
|
ty very much
i solved the problem using a third class with a STATIC variables
|
|
|
|
|
Dear Friends;
I have a database and I want to insert Cyrillic and utf-8 characters, however all Cyrillic characters are displayed as '?'.
How can I handle it?
Thank You.
|
|
|
|
|
This has nothing to do with your database, but the way you are displaying results. check your character set and font settings.
The best things in life are not things.
|
|
|
|
|
I may re-create database,
so I found from internet and will try
CREATE DATABASE dbName COLLATE Cyrillic_General_CI_AI
guess that will be succeed.
|
|
|
|
|
public static Intent getIntentForHome(Activity paramActivity, int paramInt)
{
if ((paramActivity == null) || (paramInt == -1));
Intent localIntent1;
for (Object localObject = null; ; localObject = localIntent1)
{
return localObject;
localIntent1 = new Intent(paramActivity, HomesMapActivity.class);
Intent localIntent2 = localIntent1.setAction("android.intent.action.VIEW");
Intent localIntent3 = localIntent1.putExtra("android.intent.extra.TEXT", paramInt);
}
}
the above method return the following error or warning:
the error is on "return localObject;"
Multiple markers at this line
- Type mismatch: cannot convert from Object
to Intent
- Type mismatch: cannot convert from Object
to Intent
|
|
|
|
|
When I reviewed your code, I found the following things. I used line numbers for reference.
3: You close your if with a ; this will render your if useless. Change it to using curly braces.
5: You use a for loop with no clear start condition, end condition.
7: The first line of the for loop returns localObject which is of type Object and is null, this is where your error comes from. You return an Object but the signature of the Method says you will return an Intent.
9, 10, 11: Lines are useless as there is no way for the program to get to this code.
Patrick Kalkman
My latest article: Digest Authentication on WCF
My Blog: SemanticArchitecture.net
modified on Thursday, April 21, 2011 3:56 PM
|
|
|
|
|
I agree with Patrick.
In the end of if statement replace ";" with "{"
Your for loop, initialize localObject of type Object = null, NO END condition and assign localObject = localIntent
Their is no meaning for this loop as you are returning on first run, you can remove the for loop and work normally. Yet with your problem, replace return statement after Intent localIntent3... and typecast it :
return (Intent)localObject;
This will free you from the error and if you code is proper, then will receive proper results.
Hope this helps.
Thanks & Regards,
|
|
|
|
|
Hello everybody,
i'm working on a small console application for Windows CE 5.0
Is there a possibility to perform a getch()?
Because each key-stroke must be validated with the Return-Key to store the input into the stdin-buffer.
So I need to analyse a key-stroke, without waiting for the Return.
Is it also possible to perform a Clear-Screen on a Win CE console application or to set the position of the cursor?
Or is it really impossible?
Big thanks for any help
Greetings
|
|
|
|
|
|
Hello,
I'm programming an application for use on Mobile Data Terminals. A customer is using the MC95 from Motorola with Windows ME 6.5 on it.
Strangly the camera is not respondive when I try to access it via coding.
I've tried it it with the SHCameraCapture-Function:
SHCAMERACAPTURE scc;
SecureZeroMemory(&scc, sizeof(scc));
scc.cbSize = sizeof(scc);
scc.hwndOwner = NULL;
scc.pszInitialDir = NULL;
scc.pszDefaultFileName = NULL;
scc.pszTitle = NULL;
scc.StillQuality = CAMERACAPTURE_STILLQUALITY_DEFAULT;
scc.Mode = CAMERACAPTURE_MODE_STILL;
res = SHCameraCapture( &scc );
as well as with the ICaptureGraphBuilder2 interface:
LOG('I', "Camera::LoadDriver. Starting");
GUID guidCamera = { 0xCB998A05, 0x122C, 0x4166, 0x84, 0x6A,
0x93, 0x3E, 0x4D, 0x7E, 0x3C, 0x86 };
HRESULT res = 0;
HANDLE hFind = NULL;
DEVMGR_DEVICE_INFORMATION pdi;
DEVMGR_DEVICE_INFORMATION pdi2;
IPersistPropertyBag* pPropBag = NULL;
CPropertyBag propBag;
CameraErrorLog* pErrorLog = new CameraErrorLog();
pdi.dwSize = sizeof(DEVMGR_DEVICE_INFORMATION);
hFind = FindFirstDevice(DeviceSearchByGuid,&guidCamera,&pdi);
LOG('I', "Camera::LoadDriver. Calling FindFirstDevice");
if (hFind == INVALID_HANDLE_VALUE || pdi.hDevice == NULL)
{
LOG('I', "Camera::LoadDriver. Calling FindFirstDevice failed");
res = HRESULT_FROM_WIN32(GetLastError());
LOG('I', "Camera::LoadDriver. Calling FindFirstDevice HRESULT = (%d)", res);
goto CLEANUP;
}
LOG('I', "Camera::LoadDriver. Calling FindNextDevice");
if(FindNextDevice(hFind, &pdi2))
{
propBag.driverName = SysAllocString(pdi2.szLegacyName);
}
else
{
propBag.driverName = SysAllocString(pdi.szLegacyName);
}
CHK(pFilter->QueryInterface(IID_IPersistPropertyBag,(VOID**)&pPropBag));
LOG('I', "Camera::LoadDriver. QueryInterface IID_IPersistPropertyBag");
res = pPropBag->Load(&propBag, pErrorLog);
if(FAILED(res))
{
LOG( 'E', "Camera::LoadDriver pPropBag->Load faile HRESULT = (%x)", res );
goto CLEANUP;
}
LOG('I', "Camera::LoadDriver. pPropBag Load");
CLEANUP:
FindClose(hFind);
RELEASE(pPropBag);
return res;
return S_OK;
In the first case SHCameraCapture is return the value 80070037 indicating an error (FILE_NOT_FOUND/DEV_NOT_FOUND?).
In the second case pPropBag->Load is returning the value 80070037.
But if I'm using the standard Pictures&Videos-Application the camera is working.
When I'm installing my application on a PSION Ikön with Windows ME 6.1 the camera capture with second (which is the standard way I'm using) is working.
Our Development Enviroment is embedded Visual C++ 4.0 with the Mobile SDK 6.
I'm new to the mobile development and now reaching my limits.
Has anyone an idea what's going on?
Zynismus ist der geglückte Versuch die Welt zu verstehen.
Zwei Dinge sind unendlich. Das Universium und die menschliche Dummheit. Nur beim ersteren bin ich mir nicht sicher.
Albert Einstein
|
|
|
|
|
I have same problem.
The reason is that camera and infrared scanner use the same port in Motorola MC95/MC75. if you want to use the camera you need to deactivate DataWedge with DataWedgeAPI.
When you use camera manually, OS 6.5 deactivates it automatically, and re-activate it when you out of camera application.
Note that if you enter in media window, infrared scanner is deactivated (scanner buttonn does nothing)
|
|
|
|
|
Hi All,
I am trying to make a application(java) in which
1.I required to make a read message into unread message
2.we can say that to hold a incoming message
If anyone have related information or view that related to above mention problem then please reply
Thanks & Regard
Zakir Hussain
|
|
|
|
|
|
Hi everyone,
I am trying to consume web service having complex data type as request and response....
I have used ksoap2 stub generator for android.Stub generated is giving error for org.apache.axis and javax.xml.rpc
Pls help in this..
|
|
|
|
|
Hello,
i am having lots of problems with previewing imdb trailer video on my android phone. I tryed embbed webview(flash), but as i figured out, its only supported on android 2.2+(froyo). I am working for 2.1. So i was wondering if anyone has idea where to get link from searched video by title, so i could put it in stream and play it with video player on android phone?
Best regards
|
|
|
|
|
Hi,
My Company is servicing "Government-paid" and "School" employees and students phones, and we are therefore forced to seek and undertake serious security measures to restrict cellphone usage of these clients, mainly about their internet and messaging use.
Our core focus is to have a customized phone firmware which should restrict Data & Messaging access of any kind. This firmware should also disable the loader, the client should not have the capability to flash another firmware on it.
I was advised to look into Motorola model phones like the V-W Series, mainly because the newer phones have lots of back-ends which is hard to prevent.
I was assigned to research to get this done, and I would like to ask the professionals on this form on how to proceed.
Any advice is highly appreciated!
|
|
|
|
|
I am building a Windows Mobile Application for work and I am having an issue. I tried using VB and was successful but it is buggy and did not want to deal with all the bugs involved so I am gonna try C#.
I have the base which is a tabbed webrowser and several menu items.
What I cannot figure out is how to make one of those menu items link to a webpage in the browser.
So basically I have a menu item I want to link to a website and not sure what code I would use to do this.
Thanks in Advanced.
|
|
|
|
|
Hi all,
i m sending SMS by using
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);
its working fine and successfully send a standard sms that is automatically saved in recipient mobile inbox.
i want send the sms as flash(notification) sms by this,that message should be displayed immediately on recipient mobile screen but not stored.
please tell me how can i do this.
thanks in advance.
|
|
|
|
|
Perhaps you can create a class 0 (don't store) SMS message (to be sent) whose isMwiDontStore() [^] method returns false ?
/ravi
|
|
|
|
|
please tell me how can i use it with
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);
|
|
|
|
|
The trick is to be able to specify class 0 mode ("flash" SMS) using the MessageClass.CLASS_0 [^] value. I'm still trying to figure out how/where to specify this. Not sure if this is done by creating an SmsMessage instance using createFromPdu() [^].
/ravi
|
|
|
|
|
I am wondering how to get stream from this link click. I am searching for video link that would end with *.mp4 or something, but can't find it from url source. Can someone explain me how to get this stream on my Android app?
|
|
|
|