|
|
|
Can't be done through WMI.
Using the GetJob APi and getting the dmCopies field of the JOB_INFO_2.DEVMODE structure works 80% of the time but if the client is using Microsoft Word it misreports the number of copies. In that case only actually parsing the spool file to get the true copy count works.
|
|
|
|
|
|
hi all,
I want to backup database and restore database using C#..
can any body please help me to do it?
Thanks in advance..
|
|
|
|
|
First, what kind of database?
Second, local backup or remote backup?
Third, "describing" backup or pure content-backup?
Cheers
Sid
|
|
|
|
|
I am using SQL Server 2000 and I can access Network SQL Servers also..
So I want to get complete database backup and restore itself in SQL Server's databases in my network..
|
|
|
|
|
Hi,
can anybody tell me that how to find out the minimum and maximum value from the single dimention array?
i don't want to go with for -loop or do while logic becoz it's taking somuch time and it reduce the performance.
can anybody tell me that what is the direct way to find out min & max value from array?
any sample code available then give me.
|
|
|
|
|
Are you creating the array ? You could just keep track of the min and max as you add values to the array with a couple variables. Other than that, I believe you will have to do some kind of sort on the array.
|
|
|
|
|
it's not that difficult. If it's generic array, and you don't have any specific information about array (specific information would be e.g. "it's sorted array"), you have to go through whole array - that's common sense. You can optimize this stupid algorithm only if you know something more... As already suggested, you could keep a variable with maximal/minimal value. Or you can have sorted array. Or if you need better performance (e.g. it's BIG array - I can think of sizes 1000+ ) you may consider different structure than array - heap, tree etc. Or you can sort array once and then find min and max is easy and in O(1). It really depends on what is in array and how you use the array... without more information, answer is you can't do anything better then O(N) (meaning: check all N items in array).
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Hi,
Let me tell you whole information.I had taken generic array not sorted one and it's single dimentional array.I am storing the pixel value of the image(i.e. R,G,B) into that single dimentional array.I want to find out the Minimum and maximum value from the pixel.so now i think u got whole idea.
so now for getting excellent performance what is the best way?
I think now u r having whole information.
|
|
|
|
|
Since you are adding each value to the array yourself just check each value against a Min and Max variable before you enter it into the array. i.e.
if(CurrentValue < MinValue)
MinValue=CurrentValue;
else if(CurrentValue > MaxValue)
MaxValue=CurrentValue;
Array.Add(CurrentValue);
|
|
|
|
|
Hi,
yeh i had applied logic which you had suggested but here as i am first using math.min(,) method which for looping the color pixel ,it only gives me min. value of last two pixels ,not min. value of whole pixels.
here is the code,
for (int row = rect.Left; row < rect.Right; row++)
{
for (int col = rect.Top; col < rect.Bottom; col++)
{
// XmlElement nodeColorFG = xmlDoc.CreateElement("COLOR");
dropColors[k] = PixelInfo.getColor(row, col);
if (dropColors[k].R < MinRvalue)
{
Minmax.MinRvalue = dropColors[k].R;
}
else if (dropColors[k].R > MaxRvalue)
{
Minmax.MaxRvalue = dropColors[k].R;
}
//RAvg+= dropColors[k].R / TotalPixels;
//Getting the Minimum & Maximum value of the Red (R) colors.
if (k!=0)
{
MinRvalue = Math.Min(dropColors[k-1].R, dropColors[k].R);
MaxRvalue = Math.Max(dropColors[k - 1].R, dropColors[k].R);
}
//Getting the Minimum & Maximum value of the Green (G) colors.
//GAvg += dropColors[k].G / TotalPixels;
BAvg += dropColors[k].B / TotalPixels;
k++;
//if (dropColors[k - 1].R > dropColors[k].R) Minmax.MinRvalue = dropColors[k].R;
}
}
so can you suggest me some more changes to get min. and maxi. value of whole pixels?pls.
|
|
|
|
|
Ok, I'm not sure what your variable Minmax is, but here is a possible solution to your problem...
for (int row = rect.Left; row < rect.Right; row++)
{
for (int col = rect.Top; col < rect.Bottom; col++)
{
dropColors[k] = PixelInfo.getColor(row, col);
Minmax.MinRvalue = Math.Min(Minmax.MinRvalue,dropColors[k].R);
Minmax.MaxRvalue = Math.Max(Minmax.MaxRvalue,dropColors[k].R);
Minmax.MinGvalue = Math.Min(Minmax.MinGvalue,dropColors[k].G);
Minmax.MaxGvalue = Math.Max(Minmax.MaxGvalue,dropColors[k].G);
Minmax.MinBvalue = Math.Min(Minmax.MinBvalue,dropColors[k].B);
Minmax.MaxBvalue = Math.Max(Minmax.MaxBvalue,dropColors[k].B);
BAvg += dropColors[k].B / TotalPixels;
k++;
}
}
if (k!=0)
{
MinRvalue = Minmax.MinRvalue;
MaxRvalue = Minmax.MaxRvalue;
}
|
|
|
|
|
Hi,
yeh this works great but one contstrain is as below:
yours given logic is perfactly ok but now need some more logic which remove below constraints:
main problem of this logic is that as it's taking minimum and maximum value of R,G,B if user select the color in which there is one white color pixel of my logic taken white color value in min. value and so it removes all the colors from the image instead of selected color.
so i need to make some more improvement of this logic?can any one help out or guide me in changing this logic ?
thanks again
|
|
|
|
|
So add in another variable to handle White pixels. We cannot write this software for you.....
|
|
|
|
|
Hi,
Can you pls. tell me yours whole idea for improve that logic.It may possible that it helps me lot.
thanks in advance
|
|
|
|
|
I don't see how "loop inspection" on an array is a giantic performance hit but if you do not want to do that then you must create your own ArrayList (or suitable substitute).
When you override Add and Insert just put in extra logic to track the min/max. Extra work will have to be done with Remove where you probably need to search the entire array when the min/max is removed from the collection.
|
|
|
|
|
I start a thread in my program, wich do some actions. At the end of the actions it have to display (make Visible to true) a button to close the window. It seams when the thread stops (finishes) the buttons that is unvisible (Visible is false)
How can i prevent that the buttons will be only visible in the thread i started?
Thanks.
|
|
|
|
|
Hi:
i have hosted my server dll in IIS its code is like
Server view:
//server dll name is mydll.dll
<code>
namespace NameSpaceabc
{
Class ServiceProvider:MarshalByRefObject, IServices
{
void DoIt(string strWorkOnit)
{
//..do some work
}
}
}
//shared assembly has interface def
public interface IServices
{
bool DoIt(string strName);
}
the web.config file is as folllows
//////////////////////////////////////
<configuration>
<system.runtime.remoting>
<application>
<service>
<activated mode="SingleCall" type="NameSpaceabc.ServiceProvider,mydll" objectUri="services.soap" />
</service>
<channels>
<channel ref="http">
<serverProviders>
<formatter ref="soap" typeFilterLevel="Full" />
</serverProviders>
</channel>
</application>
</system.runtime.remoting>
</configuration>
//////////////////////////////////////
Client view:
HttpChannel channel = new HttpChannel();
ChannelServices.RegisterChannel(channel);
IServices iservice = (IServices )Activator.GetObject(
typeof(IServices ),"http://10.0.0.108/mydll/services.soap");
string abc="eiwero";
//as soonas i call my first method it gives an exception ..service not found
//whats the issue
iservice .DoIt(abc);
dlls are copied in the www/mydll/bin folder
web.config is in www/mydll folder
Please help
Regards
Muhammad Ahmed
Ahmed
|
|
|
|
|
Hi Ahmed,
Seems there is nothing wrong with your code. Are you getting the WSDL file when you give the URL http://10.0.0.108/mydll/services.soap?wsdl.
Thanks and Regards
Kodandapani.
|
|
|
|
|
ok,..i have fixed it by changing the server config file tag from
<activated mode="SingleCall" type="NameSpaceabc.ServiceProvider,mydll" objectUri="services.soap" />
to
<wellknown mode="SingleCall" type="NameSpaceabc.ServiceProvider,mydll" objectUri="services.soap" />
now its working fine,..
now i have another problem,.i cant debug the server side dll hosted in IIS,.although i am attaching it to w3wp.exe but to no use,.. ihave also used Debug.Assert(false) but futile,..i check the w3wp.exe using a tool the monitors path where a dll is loaded from ,..it loaded my server dll from a very starnge path,...
my dll is also not registered in GAC,..but yet it loads from that strange path,(i guess cache).i deleted my dll from that path but it copies it again,..
any help on as to how to debug,.??? as an alternative i am debugging by making a service that loads my dll,..
but how to debug using IIS????
thanks
Ahmed
|
|
|
|
|
i am trying to use following COnnection String by putting mDB file in EXE folder
String ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=myfile.mdb;Persist Security Info=False";
its throwing Exception 'file c:\myfile.mdb' was not found
I have put both EXE and MDB file in same folder..
MyBlogs
http://weblogs.com.pk/kadnan
|
|
|
|
|
I guess I'm not sure what your question is. You can fix this problem by including the full path to the MDB in the connection string. Or are you just making the comment that the OLEDB driver is not a relative path ? If you want to make sure the path to the MDB is the same as the EXE you can use the static property of Application.StartupPath...i.e.
string MDBPath=Path.Combine(Application.StartupPath,"MyFile.mdb");
String ConnStr=string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Persist Security Info=False",MDBPath);
|
|
|
|
|
You just got bit by your assumption that the current directory will be the directory that your app was launched from. This is almost always never the case.
NEVER assume that the file you want is in the current directory. ALWAYS supply a full path specification to whatever function you need.
In your case, I'm assuming that the database you want is in the same folder as your application .EXE:
string appPath = Application.StartupPath();
string filePathToDatabase = Path.Combine( appPath, "myFile.mdb" );
string connStr = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", filePathToDatabase);
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|