|
I'm runninig it from VS.
Last Friday it was running. Monday I came and and attempted to run and this error started showing up. Between Friday and Monday there were no changes.
As I said in my original post, I tried the Google result fixes, which all seem to point to some kind of VS error when OPENING VS. I can run other solutuins. This is NOT a Visual Studio problem. The message sure seems like MEF, which the app is using.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I wasn't suggesting the Google fixes. What I suggested was you doing a full rebuild. When you run from Visual Studio, you can incur rebuilds which could have ended up messing it up.
|
|
|
|
|
|
Hello all friends,
I am newbee here right now, i'm trying to solve my problem code but it's doesn't clear.
I want to get value from my string textBox.Text. initial textBox is hmI7Segment1.Text. it's has string Format as "Channel1.DV1.DB1.Level1". i wish to convert double value from this string into textBoxTarget.Text.
so, here is code problem:
hmI7Segment1.Text = "Channel1.DV1.DB1.Level1";
TextBox txtBoxTarget = converted.Format [hmI7Segment1.Text] as TextBox;
if all of you have solution, please help me to solve my case. thanks for all of you are.
Marbun
|
|
|
|
|
Hey there! I'm slightly confused, are you trying to change the text in a text box? Or a particular box?
Basically is txtBoxTarget a specific box?
|
|
|
|
|
Or a particular box?
|
|
|
|
|
The textbox doesn't contain a number: is contains a string which contains numeric values, but nothing that is immediately recognisable as a number anyone could use.
I suspect that you need to go back to your specification or task description and read it a little more carefully: that string implies that the textbox contains a description of a device which has the value you want, rather than the value itself; and that you need to use that string to access the correct information on a specific part of that device.
And we can't help you do that: we have no idea what the device is, how it's connected, or how to ask it for information! Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
If you're thinking of utilizing "predefined" string formats, perhaps this is what you want:
String.Format Method (System) | Microsoft Docs
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi all, I'm currently working on a side project. I need to click on locations on the screen where an image has been found. I have gotten the code to work but its not as reliable as i would like. I successfully got the project running, and working, but as I stated before its just not reliable. The cameras location has to be EXACTLY in the same space for the bitmaps to line up. I've got some code that ill share below that I am using to find the bitmap, but I have no idea if I've done this efficiently. I'm doing all the work in Visual Studio, as that's what I've used since college. Here is the code I've thrown together for the bitmap search.
private bool FindBitmap(Bitmap bmpNeedle, Bitmap bmpHaystack, out Point location, out Point locationA)
{
Random rnd = new Random();
int rndmousex = rnd.Next(-5, 5);
int rndmousey = rnd.Next(-5, 5);
for (int outerX = 0; outerX < bmpHaystack.Width - bmpNeedle.Width; outerX++)
{
for (int outerY = 0; outerY < bmpHaystack.Height - bmpNeedle.Height; outerY++)
{
for (int innerX = 0; innerX < bmpNeedle.Width; innerX++)
{
for (int innerY = 0; innerY < bmpNeedle.Height; innerY++)
{
Color cNeedle = bmpNeedle.GetPixel(innerX, innerY);
Color cHaystack = bmpHaystack.GetPixel(innerX + outerX, innerY + outerY);
if (cNeedle.R != cHaystack.R || cNeedle.G != cHaystack.G || cNeedle.B != cHaystack.B)
{
goto notFound;
}
}
}
location = new Point(outerX + rndmousex, outerY + rndmousey);
locationA = new Point(outerX, outerY);
return true;
notFound:
continue;
}
}
location = Point.Empty;
locationA = Point.Empty;
return false;
}
private Bitmap Screenshot()
{
Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics g = Graphics.FromImage(bmpScreenshot);
g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size);
return bmpScreenshot;
}
Now I run this and say I have the bitmap of the Facebook login page have it click and login (I don't!) it will ALWAYS find it, never with any issues. Now say i go into Diablo for example how can i search for a bitmap of just a particular sword and ignore the background? I have tried to make the background of the bitmaps transparent in hopes that it would only search for the sword itself but it'll never find it. It searches for the transparency I'm guessing, or am I just not cleaning my bitmaps enough?
|
|
|
|
|
It will search for an exact copy of the first bitmap. Diablo will have their sword not copied into the background as a bitmap, but will blend it into the existing frame with some shadowing and stuff.
You could try to count the amount of pixels that are "found" and try to guess that it's there if more than 90% of the original is found.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Just plain brilliant, i didn't think of that! I'll have an attempt at that today. Thank you for the direction!
I'll try something like this and pray that it does what id'e like.
static void Main()
{
Bitmap img1 = new Bitmap("Lenna50.jpg");
Bitmap img2 = new Bitmap("Lenna100.jpg");
if (img1.Size != img2.Size)
{
Console.Error.WriteLine("Images are of different sizes");
return;
}
float diff = 0;
for (int y = 0; y < img1.Height; y++)
{
for (int x = 0; x < img1.Width; x++)
{
Color pixel1 = img1.GetPixel(x, y);
Color pixel2 = img2.GetPixel(x, y);
diff += Math.Abs(pixel1.R - pixel2.R);
diff += Math.Abs(pixel1.G - pixel2.G);
diff += Math.Abs(pixel1.B - pixel2.B);
}
}
I found this chunk of code online, and i believe that it would get the job done with some nasty fiddling. I would need to actually break this down and throw it into the search of my screen right?
modified 3-Feb-20 11:20am.
|
|
|
|
|
Yes; that would give an indication of how different the bitmaps are - but it won't be very fast, and may break if the sword is drawn a pixel higher then where you expect it to be.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Attempting this bit instead. Its going need a ton of modification in my existing code but i think i can make it work.
public static bool CompareBitmapsFast(Bitmap bmp1, Bitmap bmp2)
{
if (bmp1 == null || bmp2 == null)
return false;
if (object.Equals(bmp1, bmp2))
return true;
if (!bmp1.Size.Equals(bmp2.Size) || !bmp1.PixelFormat.Equals(bmp2.PixelFormat))
return false;
int bytes = bmp1.Width * bmp1.Height * (Image.GetPixelFormatSize(bmp1.PixelFormat) / 8);
bool result = true;
byte[] b1bytes = new byte[bytes];
byte[] b2bytes = new byte[bytes];
BitmapData bitmapData1 = bmp1.LockBits(new Rectangle(0, 0, bmp1.Width, bmp1.Height), ImageLockMode.ReadOnly, bmp1.PixelFormat);
BitmapData bitmapData2 = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadOnly, bmp2.PixelFormat);
Marshal.Copy(bitmapData1.Scan0, b1bytes, 0, bytes);
Marshal.Copy(bitmapData2.Scan0, b2bytes, 0, bytes);
for (int n = 0; n <= bytes - 1; n++)
{
if (b1bytes[n] != b2bytes[n])
{
result = false;
break;
}
}
bmp1.UnlockBits(bitmapData1);
bmp2.UnlockBits(bitmapData2);
return result;
}
I believe i can make it work though. Hopefully. This would be faster right?
modified 3-Feb-20 15:05pm.
|
|
|
|
|
Face-recognition and OCR (text-recognition) usually use a AI trained for recognizing. There's some articles on CodeProject that do so, often using Emgu VC.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Alright thank you. Ill go dive into the face recognition side of things. I guess my project is going to have to wait a while to be worked on haha. Thanks again!
|
|
|
|
|
My pleasure
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
"Bitmap" recognition instead of "face" recognition? Sounds like the same reading department.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I mean basically the same idea, yeah!
|
|
|
|
|
see my code first
var data = dtFilterDataFromAllData.AsEnumerable().Where(x => x.Field<string>("Tab").ToString().Trim() == strBRTab
&& x.Field<string>("Broker Items").ToString() == strBRLineItem
&& x.Field<string>("Row").ToString().Trim() == RowNumber)
.Select(w => new { LinkText = w.Field<string>("LinkedItemList"), AllowBlank = w.Field<string>("Allow Blank in Calc.") }).ToList();
where i am using LINQ on datatable to select data for two fields called LinkedItemList & Allow Blank in Calc.
without using foreach how to read value from LinkText and Allow Blank in Calc.
array like access ?
how to read data like data[0]["LinkedItemList"]
please tell me the way without foreach or for. thanks
|
|
|
|
|
What type is data? It should have a property for LinkText and AllowBlank since you filled those in in your Select.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
You should ask this only in the LINQ forum, and wonder why.
<later>
var foo = data.FirstOrDefault();
foo.?
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
modified 31-Jan-20 21:16pm.
|
|
|
|
|
Mou_kol wrote: please tell me the way without foreach or for. thanks Use a while-statement, or a do-loop.
If you select a list, you'll have to go through it. If you want something more specific, be more specific in your query.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
soo im gonna try this once again
i have a job which is called "a dungeon"
The game assumes the existence of a map of the dungeon where the hero / heroine is, and
you want to escape from. The map is created by the programmer and the player does not know the
map.
It is known that the dungeon has 5 divisions. On the map, each of the dungeon divisions is
encoded by a sequence of 5 integers (INSWE) and a String.
The first of the five integers, I, is the numerical identifier of the division.
The remaining four integers N S W E represent the identifier of the division you are going to
the hero / heroine when advancing in one of the four cardinal directions (North, South, West, East).
If the value is zero it means that this direction has no output; 99 indicates the
dungeon (and game over)
after looking at it carefully and suggestion from my colleagues and teacher is the use of a mtraix to make the map (but not show it to the player) and some of my problems atm is kinda of connecting the matrix i have generated/choose and the change of room indidcationg that for example "on this room there is 2 exist one to the east and the other to the north"
in case you need some code to understand im not asking without even trying
s1 = {1,0,0,2, 3}
s2 = {2,0,0,0,1}
s3 = {3,0,4,1,5}
s4 = {4, 3,0,99,0}
s5 = {5,0,0,3,0}
this is the technicall map of the dungeon where you start in S1 which would be room 1 and would have the warning of a exit to the west(s2) and to the east(s3) as in the whole thing is
5 integers (INSWE)
I indicator - in this case it would be 1
N - north which in this situation is 0 indicating there is no pathway in that direction and its just a wall
S- south and see commentray above
W-west where they move from S1 to room 2 S2 where they will be presented with a new number of directions
------------------------------------------------------------------------------
if (S1[1] =/= 0) => "north"
if (S1[2] =/= 0) => "sul"
this is a system i considered for the case of making it easy on myself for the map like
in matrix S1[1] or matrix [1][1] if the value is not 0 well you can move in that direction
and of course i would most likelly put a else on the end of each just so in case it was a 0 they would give the same message saying to the player you cnat go in that direciton pls choose another option
---------------------------------------------------
so this is my basic ideas and hope any of you can help me/understand what i want to do
|
|
|
|
|
Posting the same thing in multiple places wastes our effort and that annoys people. You have this lack-of-a-question in QA so repeating here is not a good idea.
Particularly when you don't ask a question!
Quote: this is my basic ideas and hope any of you can help me/understand what i want to do
You have shown how you think you might solve it, but you haven't explained what problem you are having with that - we don't know what help you need.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
What is your question?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|