|
|
Sure, I can, or API's, but I don't understand how. Can you post me steps (like set device, then set caps, set lights, and so on)
|
|
|
|
|
Sorry, I don't know directx good, I only adviced you to use it because it's powerful and can help you in that.
|
|
|
|
|
I am creating an Access driven program in C#.NET. I am trying to design it around the concept of multiple users. One function I'm trying to create is an automatic update for other users should one user add/edit/delete records. I have already created a file watcher that will watch for updates to a specified file when the database changes. The only problem is that I don't know WHAT has changed! Can anybody give me some suggestions on what to do?
may your code be error free
|
|
|
|
|
This is going to be nearly impossible to do in Access without a TON of extra work. It simply doesn't support, not provides any kind of mechanism to support, what you want to do. Access doesn't support triggers, so there is no way to know when an item has changed let alone what has changed in which table.
The only way around this is to implement a remoting wrapper component around your database. This means you'd have to move all of your database code that you want "watched" from the client to this remote component that does your "watched" database work for you. On every change, this component would have to raise an event with, or send a message to, every subscriber to the component to communicate change notifications to each client.
Or....
SQL Server, on the other hand, DOES support this, with Notification Services. You can find out more about it here[^].
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Thanks Dave for the heads up.
may your code be error free
|
|
|
|
|
I have a property(See below) that should be working. This is in an example straight from my textbook. I have double and triple checked the coding after I typed it into the editor. I'm trying out the book example to see what the code looks like in the "real world".
The editor is telling me "Expected class, delegate, enum, interface, or struct". I am getting that message from the error list with the "string" underlined. As I am new at this, I (at this time) do not understand exactly what I'm being told or how to fix it. Any help in that direction will be apreciated.
public string Major<br />
{<br />
get<br />
{<br />
return major;<br />
}<br />
set<br />
{<br />
major = value;<br />
}<br />
}
|
|
|
|
|
Well, it is a possibility that you accidentily named an object string. Try changing it to String and see if it works.
Hope that helps.
Ben
|
|
|
|
|
Post the rest of your class definition. That would be very helpful in determining what is wrong.
Jon Sagara
This is the stuff we'll drink on special occasions. To paraphrase my father-in-law, this is the kind of wine that results in kids.
-- A friend
Blog | Site | Articles
|
|
|
|
|
I'm sorry if my question is stupid, but are you sure your property definition is inside a class?
Giving the class definition, with the irrelevant parts left out, might help.
Cheers,
Vikram.
"But nowadays, it means nothing. Features are never frozen, development keeps happening, bugs never get fixed, and documentation is something you might find on wikipedia."
- Marc Clifton on betas. Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
Thanks for your answers folks. I have found the solution (pardon the pun) to the problem. It seems that I had accidently typed in some code from the wrong page. Below I've listed my coding that works correctly. Thanks again.
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using PersonNameSpace;
<br />
namespace StudentNameSpace<br />
{<br />
public class Student : Person<br />
{<br />
private string major;<br />
private int studentId;<br />
<br />
<br />
public Student() : base()
{<br />
major = "unknown";<br />
studentId = 0;<br />
}<br />
public Student(string id, string fname, string lname, string maj, int sId)<br />
: base(id, lname, fname)
{<br />
major = maj;<br />
studentId = sId;<br />
}<br />
<br />
public int StudentId<br />
{<br />
get<br />
{<br />
return studentId;<br />
}<br />
}<br />
public string Major<br />
{<br />
get<br />
{<br />
return major;<br />
}<br />
set<br />
{<br />
major = value;<br />
}<br />
}<br />
public override int GetSleepAmt()<br />
{<br />
return 6;<br />
}<br />
public int CallOverriddenGetSleepAmt()<br />
{<br />
return base.GetSleepAmt();<br />
}<br />
}<br />
}
|
|
|
|
|
Dear all,
I my application i need to convert the .gif file which containing the text only not the image or any picture it was contains text Only need to convert in to the .doc formate can any send code for this or guidance to how can i complete this task.
thanks and regards,
easwar.
|
|
|
|
|
The only option you have is to implement some kind of Optical Character Recognition (OCR) to do the conversion. There is nothing in the .NET Framework that is going to do this for you. You can either write your own implementation or use a third party library to do it for you.
To try to do it yourself, you'll have to have a good understanding of neural networks. Try searching the articles for "OCR" and you'll come up with some examples.
If you go the thrid party component route, just Google for "OCR component .NET".
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I made a little application using the FAXCOMLib library that will send a job to the win fax services, however I have attached 3 modems to my computer with 3 different phone lines, and I added the modem to the fax services, however when I send multiple faxes to the queue it sends one at a time even though the other two modems are sitting there. so How can I make windows fax service to use the next available modem as long as there are jobs in the queue?
|
|
|
|
|
In my continuing, and seemingly endless, quest to understand design patterns and apply them to my code I've encountered the Factory Pattern - and I'm struggling to apply it to my current application, inspite of all the articles and literature on it. Can anyone help my edification?
In my tiered application I have a Business Layer consisting of Business Rules and Entities, and a Data Access Layer which takes care of the Database access.
The current design runs thusly - BLL calls function in DAL, which then queries the database and returns (or doesn't return dependent on the query results) a whole bunch of Entities (such as people, machines, models, sites etc etc) to the BLL.
It's the creation of the entities that's got me puzzled. In the DAL what I do to create them is to loop through a DataReader object and pass the DataReader into the Entity's constructor. This works fine, but I can see the limitations to this approach, not least in that the Entity in question has to know about the DataReader type.
What I'm really struggling with is how to inject the Factory Pattern into this scenario - each class in the DAL is responsible for getting different types of object, and as far as I can see they're kind of unrelated. Does this mean I need a different factory for each? Or can I just make one factory and pass it a value (or whatever) to tell it what type of objects I want created?
Any help appreciated!
|
|
|
|
|
WARNING: I'm new to Factory myself.
Utini wrote: In the DAL what I do to create them is to loop through a DataReader object and pass the DataReader into the Entity's constructor. This works fine, but I can see the limitations to this approach, not least in that the Entity in question has to know about the DataReader type.
My understanding is that the Factory method would only take a simple object, like an identifying string or an int representing a code and use that to decide which class to instantiate. For instance, you pass "RFR" to instantiate a Reversal File Reader and "TDFR" to instantiate a Transaction Detail File Reader. What does your Factory method do with the DataReader? Surely it only uses a single value or two? Just modify the method so it takes only the relevant data, and make them native data types.
Utini wrote: What I'm really struggling with is how to inject the Factory Pattern into this scenario - each class in the DAL is responsible for getting different types of object, and as far as I can see they're kind of unrelated.
Again, my understanding is that a Factory method is to be used when the objects it instantiates are similar in some way - typically/perhaps subclasses of the same superclass. While I think having a Factory method that returns different animals or different file readers is very good design, I wouldn't write a Factory method that returns a Tiger, an Apple, and a TransactionSummaryFileReader.
Again, I must emphasize that I'm new to patterns myself, so take whatever I've said with a pinch large dose of salt. I hope I made some sense, and will gladly welcome others' views on this.
Cheers,
Vikram.
"But nowadays, it means nothing. Features are never frozen, development keeps happening, bugs never get fixed, and documentation is something you might find on wikipedia."
- Marc Clifton on betas. Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
Like any tool in software development, patterns can be overused. You always want to keep in mind what problem a pattern seeks to solve and make sure this problem exists (or is likely to exist) in your code. Patterns can be used to make your code more flexible, but they can often make your code more complex.
I know of three Factory patterns: Simple Factory, Factory Method, and Abstract Factory.
Simple Factory and Factory Method encapsulate object creation and allow you to decouple the use of a class from its implementation. This allows you to maintain a level of abstraction in your code. For example, you might have code that uses “automobile” objects. The code that uses the “automobile” doesn’t care if it’s a sports car, sedan, minivan or truck. All it cares about is that it is an “automobile”, which means it can be started, driven, and parked.
The key here is that the objects created by the Simple Factory and Factory Method patterns are related - they either implement the same interface or derive from the same base class.
This doesn’t seem to fit what you have going on in your scenario. You have entities such as person, computer, model, and site. These entities aren’t likely to share a direct base class or implement the same interface.
Abstract Factory allows you group together and encapsulate the creation of families of related objects. So, going back to our automobile example, you might have an abstract factory that deals with the creation of Oil and Gasoline objects. The abstract factory would be defined as an interface with two methods:
Interface CarEssentials
{
Gasoline GetGasoline();
Oil GetOil();
}
You would then implement Concrete Factories to return related Gasoline and Oil objects:
Class SporsCarEssentials : CarEssentials
{
Gasoline GetGasoline() { return UltraUnleaded;}
Oil GetOil() {return HighPerformanceOil;}
}
Class SedanEssentials : CarEssentials
{
Gasoline GetGasoline() { return RegularUnleaded;}
Oil GetOil() {return new StandardOil;}
}
Like the Simple Factory and Factory Method patterns, I don’t see Abstract Factory working for you.
Perhaps the reason you are having difficulty figuring out how to apply a Factory pattern to your code is that the Factory patterns aren’t the right tool for the job.
Then again, I could be completely wrong...
Hope this helps!
Ian
|
|
|
|
|
I'd completely forgotten I'd posted this - until just now!
Thanks both for your answers; Ian, I think what you said is very sound advice! I think I was getting lost in Design Patterns simply because they're there to solve problems that I don't (yet) have.
|
|
|
|
|
Hello,
My bits to byte conversion works for selected items, for unselected items i am trying to make it unselected but the value is not changing.,
this is my piece of code.,
int count = SecurityGroups.Items.Count;
for (int index = 0; index < count; index++)
{
int arrayIndex = Convert.ToInt32(SecurityGroups.Items[index].Value);
if (SecurityGroups.Items[index].Selected)
//convert the bits to bytes
aGroup[arrayIndex / 8] |= (byte)(1 << (arrayIndex % 8));
else
aGroup[arrayIndex] = (byte)(0<< (arrayIndex % 8));
}
for unselected item the conversion part of making those byte to 0 fails. why is it?
i tried making the bit to 0 but that as well does not work
aGroup[arrayIndex] = 0;
With Rgds,
Anil
|
|
|
|
|
Instead of writing your own byte conversion routine, have you tried using the System.BitConverter class?
p.s. you posted duplicate posts. Please delete the other one.
|
|
|
|
|
How do i do that? I cannot use it for this program i guess.
|
|
|
|
|
To convert an int to a byte[], you'd do something like this:
byte[] bytes = BitConverter.GetBytes(theInteger);
Will that work for you?
|
|
|
|
|
No since i do all this based on the selection.
|
|
|
|
|
I got the solution,
I did a bitarray and converted into bytes using this code...
private static byte[] BitArrayToByteArray(BitArray bits)
{
// Who knows, might change
const int BITSPERBYTE = 8;
// Get the size of bytes needed to store all bytes
int bytesize = bits.Length / BITSPERBYTE;
// Any bit left over another byte is necessary
if (bits.Length % BITSPERBYTE > 0)
{
bytesize++;
}
// For the result
byte[] bytes = new byte[bytesize];
// Must init to good value, all zero bit byte has value zero
// Lowest significant bit has a place value of 1, each position to
// to the left doubles the value
byte value = 0;
byte significance = 1;
// Remember where in the input/output arrays
int bytepos = 0;
int bitpos = 0;
while (bitpos < bits.Length)
{
// If the bit is set add its value to the byte
if (true == bits[bitpos])
{
value += significance;
}
bitpos++;
if (0 == bitpos % BITSPERBYTE)
{
// A full byte has been processed, store it
// increase output buffer index and reset work values
bytes[bytepos] = value;
bytepos++;
value = 0;
significance = 1;
}
else
{
// Another bit processed, next has doubled value
significance *= 2;
}
}
return bytes;
}
|
|
|
|
|
AnilUnni wrote: aGroup[arrayIndex] = (byte)(0<< (arrayIndex % 8));
is completely wrong:
1. the array index needs a /8
2. to clear a bit within a byte without affecting the other bits, you need:
either AND with the complement of that bit
or first SET the bit, then EXOR the same bit (to clear it)
|
|
|
|
|