|
See here[^] then come back and update your question. (don't create a new one)
|
|
|
|
|
Hello all,
Looks like this is a basic question that I somehow is not able to figure it out properly. The method I am using works for Hex numbers that does not contain 0 in its lower byte.
I guess I have to use a different approach to get around this problem, which I am not able to quite figure it out.
I am reading values off of an IC which pushes out serial data in bits and the total length of the output is always 16bits which are read into two bytes. So, when the value is 255 its fine when I convert it into integer. But when the output from the chip is equivalent to 256, it turns out to be '1' in Upper byte and '0' in lower byte which is not being converted to 256 but rather to 16 using the following code.
string hexValue = In[0].ToString("X") + In[1].ToString("X");
int hscandacvalue = int.Parse(hexValue, System.Globalization.NumberStyles.HexNumber);
Any suggestions?
thanks
PKNT
|
|
|
|
|
The problem with this is that it turns eg 0x01 (as a byte) into the string 1, and then the leading zero is lost. That's a problem, because you're concatenating in front of it. You could fix that by using X2, but don't.
But you don't need any of this weird string business anyway, you can simply use math (lowbyte + 256 * highbyte )
|
|
|
|
|
Thanks Harold, that works great.
PKNT
|
|
|
|
|
hi folks,
i want a general idea of how to create a server-client environment in window application(c#.net). So what i am looking for is:
1. A sample mini project so far none found on google
2. what technology should i use udp/tcp/socket layer or something else.
3. how does client A gets notification of SQL update by client B ;when both are viewing/working on same table. So the record can get an auto refresh or something like that.
Regards
|
|
|
|
|
Don't make this too hard. I wrote one a few years ago and started like you are. I wanted PC-A to tell everyone else that it had just made a change.
But the easy was is for each pc to monitor the db and find the changes on it's own. You don't need any network code to handle that. For me it could be a few minutes behind so it worked great.
|
|
|
|
|
|
are you sure big DB data can travel through sockets ??
|
|
|
|
|
Any type of data can travel through sockets; how do you think the internet, database systems etc work?
Use the best guess
|
|
|
|
|
can you re-create the given sample for a simple test table in sql, yesterday one of my friends told me to just share connection string path to server as one approach to do the thing ; But will it be on the same performance with socks?
|
|
|
|
|
Alok sharma ji wrote: will it be on the same performance with socks? There's only one way to find out.
Use the best guess
|
|
|
|
|
|
Manfred, have you ever used the notification service, I know we have never had to implement it and I am curious.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: I know we have never had to implement it and I am curious.
I have been exclusively doing backend database driven stuff often in high demand environments and the only 'need' I have ever seen for this is when some developer claims that it "could" happen. Analyzing actual business cases and actual usage has never demonstrated a need.
|
|
|
|
|
That has been my experience except I'm the developer so it has never happened, every now and then I have to slap a BA who suggests it to the users.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Indeed I always heard the rumors of SQL notification to subjugate LAN as RTS but caching one is like "fools gold".
|
|
|
|
|
Alok sharma ji wrote: 3. how does client A gets notification of SQL update by client B ;when both are viewing/working on same table. So the record can get an auto refresh or something like that. That's usually not done; the normal way is to fetch the data and show the snapshot as it was on the moment of fetching. Updating "live" data moves the concurrency-problem from the database (where it was solved) into your app, where you need to solve it yourself.
Simple example; you're editing a record, and the boss is editing the same one - you press "update" first. Now, how would you update the bosses record? Change the text in the textbox while he is editing/typing?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
i think i will just put an edit lock for client 2 if client 1 is working on same table.
|
|
|
|
|
Alok sharma ji wrote: how does client A gets notification of SQL update by client B ;when both are viewing/working on same table.
That statement is a bit simple since it isn't a matter of working on the same table, since databases deal with that, but rather working on the same record (data) in the table. And that doesn't matter because it is very, very rare that there is an actual business case for that.
For example when a order center takes a customer order only one employee is taking the order. The customer is making the same order on two different phones lines.
|
|
|
|
|
Why are project files/classes organized by class type (Models folder, Repositories folder, Interfaces Folder), instead of business purpose (Account Objects, Employee Objects)?
I can understand storing reusable files in their own folder, but what about files that really only work when they are part of a unique and specific unit?
Organizing projects by class type seems like story left shoes in one room and right shoes in another room. You need a specific pair of shoes for them to work.
|
|
|
|
|
Mine aren't.
My are divided by function into separate projects:
Presentation (which may have multiple projects)
Business (Again, may well have multiple projects)
Utilities (ditto)
Data Access (normally just the one, but If I'm looking at multiple data sources, I'll probably break it that way as well)
How things are organised is up to you (or your company standards) - it's your project!
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
That's an interesting approach. What's the thinking behind that structure? Do you typically work with presenters alone, and then Data Access alone? Or do you usually work with a group of files from each project based on business process?
|
|
|
|
|
The thinking is that I can swap out my data access for a different datasource without affecting anything else in my application - or I can transport my business logic to a different machine, running Xamarin on an iPhone, or Android perhaps - and just provide the new presentation stuff. The less I have to change, the more reliable the whole should be.
What I work with depends on what I'm doing: I try to work on projects in isolation, with a tester module and only backtrack and make changes when it's clear they are needed.
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
OMVB wrote: but what about files that really only work when they are part of a unique and
specific unit?
That would be unusual.
OMVB wrote: instead of business purpose
Because business needs very seldom devolve to a single class. Even a single business need seldom devolves to that. A single business need is more likely to be fulfilled by multiple classes interacting together.
And in designing for a business there are often groupings of classes based on their common nature that represent layers. Because they are similar they are kept together.
|
|
|
|
|
Instead of a technical structure like this:
>Models
>>AccountModel
>>ContactModel
>>HouseModel
>Repositories
>>AccountRepo
>>ContactRepo
>>HouseRepo
Why not organize the project like this?
>BusinessObjects
>>Accounts
>>>AccountModel
>>>AccountRepository
>>Contacts
>>>ContactModel
>>>ContactRepository
|
|
|
|