|
I am using a library built by some other person. It has various arguments......
The below mentioned function had been implemented by someone in .NET and I am using that library:
list(java.lang.String userName, java.lang.String password,java.lang.String role, java.lang.String langpref,int parentid,int[] orderId,int[] resellerId,int[] customerId, boolean showChildOrders,java.lang.String[] domainType,java.lang.String[] currentStatus,java.lang.String description,java.lang.String creationDTRangStart,
java.lang.String creationDTRangEnd,java.lang.String endTimeRangStart,java.lang.String endTimeRangEnd,
int numOfRecordPerPage,int pageNum,java.lang.String[] orderBy)
The problem is that I have only one reseller ID that is 40...
when I provide the seventh argument as 40, then I get error as:
Argument '7': cannot convert from 'int' to 'int[]'
Plz suggest any way to convert int to int[]
Thanks,
Sandeep
+919891027854
|
|
|
|
|
Just wrap the int in an array.
Like this
int []arr = new int[] {resellerID};
I'm a 23 yrs old developer working with HCL Technologies, Chennai. I'm currently working in C#, C++, but I've done some Java programming as well.
You can read My Blog here. I've also done some open source software, like WinMacro - A open source macro recorder/player for Windows, A Chess Game with AI that I wrote in college and Winbots - a game for programmers.
|
|
|
|
|
Hi i am pasting my code belo which is giving error
System.NullReferenceException' occurred in
Additional information: Object reference not set to an instance of an object.
it breaks on line
if(cl[i].status==true) in listen class
code for listen class
public class listen
{
TcpListener server=null;
Thread tcpthread=null;
client[] cl=new client[5];
public listen()
{
//
// TODO: Add constructor logic here
//
}
public void startlisten()
{
Int32 port = 3310;
IPAddress localAddr = IPAddress.Parse("192.168.0.5");
// TcpListener server = new TcpListener(port);
server = new TcpListener(localAddr, port);
// Start listening for client requests.
server.Start();
// Enter the listening loop.
// for(int i=0;i<5;i++)
// {
// cl[i].status=true;
// }
Boolean flag;
while(true)
{ flag=false;
// Perform a blocking call to accept requests.
// You could also user server.AcceptSocket() here.
for(int i=0;i<5;i++)
{
if(cl[i].status==true)
{
cl[i]= new client(server.AcceptTcpClient());
tcpthread=new Thread(new ThreadStart(cl[i].getClient));
tcpthread.Start();
flag=true;
break;
}
}
if(flag!=true)
{
//display error message
}
}
}
}
code for client class
public class client
{
TcpClient tcpClient;
public Boolean status;
// Buffer for reading data
Byte[] bytes = new Byte[256];
String data = null;
public client()
{ //
// TODO: Add constructor logic here
//
//status=true;
}
public client(TcpClient Client)
{
tcpClient =Client;
//
// TODO: Add constructor logic here
//
status=false;
}
public void getClient()
{
try
{
data = null;
// Get a stream object for reading and writing
NetworkStream stream = tcpClient.GetStream();
int i;
// Loop to receive all the data sent by the client.
while((i = stream.Read(bytes, 0, bytes.Length))!=0)
{
// Translate data bytes to a ASCII string.
data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
// Process the data sent by the client.
string replyMsg = data;
clamdCommand x=new clamdCommand();
replyMsg=x.Command(replyMsg);
byte[] msg = System.Text.Encoding.ASCII.GetBytes(replyMsg);
// Send back a response.
stream.Write(msg, 0, msg.Length);
//Console.WriteLine(String.Format("Sent: {0}", data));
}
}
catch(Exception se)
{
MessageBox.Show(se.ToString());
}
// Shutdown and end connection
tcpClient.Close();
status=true;
}
}
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
Please format your code snippets using PRE and CODE blocks. It makes it easier for people to help you.
The problem is that client[] cl=new client[5]; merely creates an array of 5 references to client objects. It does NOT create 5 client objects. So, before you do anything at all with your array, you should do
for(int i = 0; i < cl.Length; i++)
{
cl[i] = new client();
}
Typically, this code should go in the ctor of the class which contains the array, in this case, listen .
Cheers,
Vikram. "When I read in books about a "base class", I figured this was the class that was at the bottom of the inheritence tree. It's the "base", right? Like the base of a pyramid." - Marc Clifton.
|
|
|
|
|
Tthanks
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
well here is the description of my problem
I have a component in which all the methods are static let
the skeleton is like below
public Class Component
{
.............
.........
.......
public static void St_F1(--,--,--)
{
--- -
---
--
}
public static void St_F2(--,--,--)
{
--- -
---
--
}
public static void St_F3(--,--)
{
--- -
---
--
}
public static void St_F4(--)
{
--- -
---
--
}
}
//////////////////
now these functions are called in other class MyClass in
the delegate MyDlg that is called when the Capture event
occurs
public Class MyClass
{
----
----
private Scanner myobj=new Scanner();
myobj.Capture+=new CaptureEventHandler(MyDlg);
private void MyDlg(---,--,---)
{
Componet.St_F4(--);
Componet.St_F1(--,--,---);
if(myobj.id==1)
Componet.St_F3(---,--);
if(myobj.id==2)
Componet.St_F2(--,--);
}
}
////////////////////////
Now i make 2 objects of MyClass each of them has a unique
value of myobj.id
MyClass ClassObj1=new MyClass();
MyClass ClassObj2=new MyClass();
Now both of these instances of the MyClass have to call
event myobj.Capture+=new CaptureEventHandler(MyDlg);
implicitly nad may be event occurs from both objects at a time i want to make the call to the each Static Function called in the body of MyDlg synchronized. So as Only one object may call the Static function at a time. How to achieve this. Plz help Me
Thnx in Advance
|
|
|
|
|
Does locking/Monitor.Enter(), Monitor.Exit()[^] on a static object solve your problem?
public class Component
{
private static object syncObject = new object();
public static void ST_F1()
{
lock(syncObject)
{
...
}
}
public static void ST_F2()
{
lock(syncObject)
{
...
}
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Actually i forgot to mention one more thing , The component class is only a sketch to understand , in real i m using these static function form a dll named Component. for which i dont have acess to implementation code of these Static function.i m just using the functionality.
So if there is any other possibility plz let me know.
Thnx
|
|
|
|
|
You can create a static object in the event handler class instead.
Something like
class XYZ
{
static object syncObject = new object();
void SomeMethod()
{
abc.SomeEvent += new SomeEvent(SomeEventHandler);
}
void SomeEventHandler(...)
{
lock(syncObject)
{
Component.Method1();
...
}
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Well!
First of all thnx for Reply. Ok i m already calling these functions in the delegate MyDlg that is called whenevr Capture event occurs then how can i add an other event handler and call these functions. may i do this as below
myobj.Capture+=new CaptureEventHandler(MyDlg);
static object syncObject = new object();
private void MyDlg(---,--,---)
{
lock(syncobject);
Componet.St_F4(--);
lock(syncobject);
Componet.St_F1(--,--,---);
if(myobj.id==1)
lock(syncobject);
Componet.St_F3(---,--);
if(myobj.id==2)
lock(syncobject)
Componet.St_F2(--,--);
}
|
|
|
|
|
If you lock each function call, then at any point in time, only one thread could be executing a function. Which is what you want, so yes, it works. But there is a difference between the behavior of
private void MyDlg(---,--,---)
{
lock(syncObject)
{
Componet.St_F4(--);
Componet.St_F1(--,--,---);
Componet.St_F3(---,--);
}
}
and your code. The code above makes sure that at one point, only one thread can execute the whole sequence of functions (F4, F1, F3...). So if you have two threads, they will run like
Thread1
-------
Component.ST_F4
Component.ST_F3
Component.ST_F1
Thread2
-------
Component.ST_F4
Component.ST_F3
Component.ST_F1
With your code, the behaviour *could* be
Thread1
-------
Component.ST_F4
Thread2
-------
Component.ST_F4
Thread1
-------
Component.ST_F3
Component.ST_F1
Thread2
--------
Component.ST_F3
Component.ST_F1
Or in any order. If you're fine with that, go ahead.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thnx for reply!
I m almost very near to my solution. Ok What i want is that two threads could have acess to static functions at one time but these function should be different. that means let thread t1,t2 may have acess to static function Componet.St_F4(--);
Componet.St_F1(--,--,---); respectively. that is
t1---->Componet.St_F4(--);
t2--->Componet.St_F1(--,--,---);
is it so as i did b4. or how to achieve this
|
|
|
|
|
My DataGrid has DataSource with 2 related data tables:
A --> B. When I expand A's row, DataGrid display relation name, then I click on Relation name, Data Grid display ralated B's rows.
But I don't want to display relation name before display related child table's rows.
How can I do?
dhtuan
|
|
|
|
|
I'm writing an app in C# .net 2.0. I want to have a TreeView where the first
level of nodes would have check boxes, but their subsequent children would
not have check boxes.
Is this achievable using the .net controls? If not, how can I make this
possible?
Thanks,
Andy
|
|
|
|
|
Simple question really, I am fairly certain the answer is no.
Are there any cryptography systems out there that support skeleton keys?
i.e. A group of users all have there own "private key" which is used to encrypted data, but an administrator has a skeleton key that is capable of decrypting anything encrypted by the users regardless of the private key they use.
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
Have you google'd around on this? I am not sure if it is possible...
PC
|
|
|
|
|
Does anyone have a method for retrieving the 'real' hardware serial number of a hd without requiring administrator rights?
There is an article on this site which uses win32_physicalmedia to obtain the serial, but this doesn't work without admin rights.
I have heard that its possible through a windows api? but how?
Any help much appreciated.
|
|
|
|
|
Hi, Im developing a localizable aplication, so I add language support to my forms a and dialog messages whit resx files.
all is good but if I change something in my forms i miss some messages and control language definations in resx files.
So, what can i do?
Ho do you implement localizable languanges in your applications.
I use VS.c# 2005 express.
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
For serious use buy a localization tool. It will track deltas, carry over resize, protect against changes on data that is not localizable (as Microsoft pretty much managed to make one of the worst beginner misktakes when designing the resx format - they did not separate translatable strings from strings that should be changed by engineers/programmers).
If it is a small home project you probably have to do it the hard way - manually. VS really isn't meant as a localization environment for anything but small hobby use.
|
|
|
|
|
Thank you!
Is sad to hear that but I think is true too.
My project is a framework for business aplications, so I will study the tools that are n market or I will make somethig for my needs (read, write, import, export resx files for control.text properties,tooltips,helpstrings and custom messages strings)
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
TRY using StringDB at www.swbox.com
- supports ALL languages in the world (ASCII, UNICODE, UTF-8)
- uses MS Excel files for translation
- You can change language and strings without recompiling the software
- Non-technical people can prepare new language releases
- Is being used by embedded devices and also PC software
coldstone
|
|
|
|
|
Hi,
I am creating a project using typed dataset for the first time.
The DataTier returns a dataset of the .xsd type to the webservice
//dsEmps is the .xsd
public dsEmps GetData()
{
string strSQL = "SELECT EmployeeID, LastName, FirstName, Title, TitleOfCourtesy, BirthDate, HireDate, Address, City, Region, PostalCode, Country, HomePhone, Extension, Photo, Notes, ReportsTo, PhotoPath FROM Employees";
string strConn = "Server=localhost;" + "DataBase=Northwind;" + "Integrated Security=SSPI;Connect Timeout=5";
dsEmps dsData = new dsEmps();
using(SqlDataAdapter oDA = new SqlDataAdapter(strSQL, strConn))
{
oDA.Fill(dsData, "Employees");
return dsData;
}
}
here if I use the dataset as below:
placing a dot after the dataset (i.e. dsData) shows the Employees table and then placing another dot shows the field names...
This is good so far. But the problem is that in the webservice where I get the returned dataset as below, I can not get the column names after daData.Employees.
//EmpData is the datatier...
public EmpData.dsEmps GetData()
{
try
{
EmpData.Employees dc = new EmpData.Employees();
return dc.GetData();
}
catch
{
throw;
}
}
Can you see why this is the case?
Thanks
|
|
|
|
|
I need to create a site using sharepoint, and to be honest I have no idea about sharepoint. I am willing to learn though. Can anyone give me suggestions or URL for an article with an example on how to work with sharepoint?
Any help is very much appreciated.
Thanks!!
Winning is not Important. Wanting to win is!!!
|
|
|
|
|
Download the Windows SharePoint Services with Service Pack 2, install it, and read the SPS Online Help. It has a whole lot of information on SharePoint initialization, administration, and customization.
I just finished customizing a SharePoint installation for Ernst & Young for Sarbanes-Oxley compliance. At the beginning of the project, I knew nothing of SharePoint. I found the online help indispensable.
To supplement the books, I read the blogs by the SharePoint developers. Google for SharePoint blogs and you can read those, too.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Does anyone know of any API for Visual Studio that has functions for sending Short Message Service (SMS) Text Messages to Cell Phones??
I know there are a few services out there you can connect to and send messages using SOAP/XML messaging but these services are NOT free.
MSN Messenger has a feature that allows you to send a Text Message to any mobile device. If this is possible through MSN, then there must be an API available for developers to include this feature in their apps??
Any info is much appreciated.
mheese@inebraska.com
|
|
|
|
|