|
|
Hello,
I have a portable instruments with Celeron processor and Windows 10.
I notice that Celeron as an I2C.
Can I use I2C with .NET framework ?
Thankyou
|
|
|
|
|
I am not sure whether .NET framework has an implementation of that driver, or you might want to go a bit deeper using C++ for CLR. Somehow, looking at a few Google search results I can say community is working on it. The following links show the I2C bus communication through a few community-led projects, samples, since there is no native support (or interest) in the .NET framework.
How to use i2C driver in C# ?? - FriendlyARM
GitHub - mshmelev/RPi.I2C.Net: Library for working with I2C bus on Raspberry Pi
This github library has a sample code that shows how to connect,
using (var bus = RPi.I2C.Net.I2CBus.Open("/dev/i2c-1"))
{
bus.WriteByte(42, 77);
}
Also, for Windows IoT there is a post here that you can use to learn how .NET can be used there, C# for I2C Devices on Windows 10 IoT Core | Jeremy Lindsay, this will be much of Windows Runtime and not .NET framework.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Hello,
I have to develop a c# program on Windows 10 on an embedded PC for a portable instrument.
The instrument has two keyboard attached.
One keyboard is optional: the user can connect to the PC a normal keyboard.
The other keyboard is always connected to the instrument and has special function that, in a normal keyboard, are F1...F12, arrows, tab, or other.
My problem is to detect in "PreviewKyDown" which keyboard has fired the event.
Can someone help me ?
|
|
|
|
|
You can't - keyboard data isn't "tagged" with a source in any way. The only way to do that would be to write custom drivers for your keyboards, and that is a huge amount of work!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
thank al lot
|
|
|
|
|
Welcome! Sorry it's bad news...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
No problem, ... we are moving to another solution
|
|
|
|
|
i came across itext dll for visual basic to do a form fill ; can I use it with c# ? are there any compatibility issues?
|
|
|
|
|
Provides it's a .NET assembly, it doesn't matter what language the DLL file was written in: it can be used from any language which supports .NET.
So yes, you can use a VB DLL (or EXE) assembly from a C# program as if it was a C# file.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
A minor correction. You can only guarantee that you can use a DLL from one .NET assembly in another if it is inherently CLSCompliant. That's not to say that you can't use an assembly that is marked as CLSCompliant(false), but there's no guarantee that you can.
This space for rent
|
|
|
|
|
I stand corrected!
Or more literally, I sit corrected because it's easier to type...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
There is no way to know without either trying it, reading the documentation, or contacting whoever made it. We have no idea what dll you are referring to so we really can't say. Just try it and find out. That's the easiest thing to do.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
Please help me... I am stuck up with http post using http request.
I have an asp.net applicaton which is hosted locally in IIS(http:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Test Web Page</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
function showImage() {
alert('hi');
}
</script>
</head>
<body>
<form id="imageForm" name="imageForm" method="post" action="Default.aspx" >
<input type="text" name="showImage" value="false" />
<input type="submit" name="refresh" value="submit" onclick="showImage();" />
</form>
</body>
</html>
My Default.aspx.cs ;
protected void Page_Load(Object Source, EventArgs E)
{
}
I have a separate c# application which tries to simulate the button click of "refresh" via http post to Default.aspx, here is the code;
string url = "http://localhost/TestWebPage/Default.aspx";
string postDataStr = "showImage=true";
postDataStr += "&refresh=submit";
byte[] postData = Encoding.ASCII.GetBytes(postDataStr);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = postData.Length;
req.Proxy = WebRequest.DefaultWebProxy;
using (var reqStream = req.GetRequestStream())
{
reqStream.Write(postData, 0, postData.Length);
}
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream, Encoding.Default);
string pageContent = reader.ReadToEnd();
string status = ((HttpWebResponse)response).StatusDescription;
reader.Close();
responseStream.Close();
response.Close();
My aspx page is already opened in a chrome browser. When the above code is executed, I want the javascript alert in the showImage() function to be displayed in the Default.aspx page in the same browser window itself.
Unfortunately its not happening now... am I missing anything? or is there any good approach to simulate the button click using separate c#?
Please guide.
|
|
|
|
|
The clicks are on the client-side, not the server-side and should never be injected through server-side. That said, you can simulate the click in JavaScript easily, or if the purpose is to just trigger the function you can call the function on the body's load event as well. That would be much better and semantically correct code in your application.
<body load="onLoadFunc()">
<!--
</body>
Then you can write the function, that gets executed on the load,
function onLoadFunc() {
showImage();
}
This will execute the function, as soon as the body finishes loading, thus on the page load. This will be a better approach, as compared to any of the code injections from server.
load - Event reference | MDN
If you want to get a response from the server, and then execute the code on client-side, then I would recommend that you read a bit about Ajax first. Ajax will let you do that easily, that is also JavaScript based service, so please learn more of JavaScript here to perform tasks on client-side.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Prasadaknair wrote: My aspx page is already opened in a chrome browser. When the above code is executed, I want the javascript alert in the showImage() function to be displayed in the Default.aspx page in the same browser window itself.
You're loading the page in an external process, and expecting the response to affect the page in a totally different process?
That's never going to work, for obvious reasons.
If you want to control an existing browser, you'll need to look at using something like Selenium WebDriver[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am trying to fetch data from an API using C# but every time i get 404 error. What can be the problem, is the API is prevented by my firewall or anti virus problem. The API url is totally correct and I have checked it many times.
|
|
|
|
|
What happens if you try to access the API URL directly from your browser?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
404 Not Found Error means that the resource you were trying to reach could not be found on the server. Check if you pointing it correctly.
modified 20-Sep-20 21:01pm.
|
|
|
|
|
You also get a 404 if the firewall is blocking the request, or the host-file is blocking it. It is a rather generic connection-error.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You should be sure that where you're calling the API can be called/reached. I mean, for ex if your App URL is http://localhost/web/home/index make sure that when you call the API can be reached from that URL.
I've happened that when I create an API of Users is only reached by the URL http://localhost/web/user/index (example) and not from http://localhost/web/home/index
A solution can be create a Route, and specify it in the API's method .
|
|
|
|
|
I have been struggling with what Jeff Atwood calls VS's "bastardized regular expression syntax" [^].
Along the way, I found Peter Macej's very useful VS extension for multiple-line-search-replace [^].
It kind of warps my mind that VS, at this late date, doesn't have a built-in multi-line search and replace, and doesn't support a more "standard" RegEx syntax !
Using 'Find in Files' in VS it's easy to limit the search to specific types of files, like *.cs.
Where I am stumped is how to select files that have specific text (keyword) content, and then apply S&R to only the matching files.
The goal is to apply the search replace only to the content in 'file1.cs
While all this is easy to do in UltraEdit (which offers UNIX and Perl regex flavors in addition to its own syntax), I'd like to know if this is possible in VS.
thanks, Bill
«Beauty is in the eye of the beholder, and it may be necessary from time to time to give a stupid or misinformed beholder a black eye.» Miss Piggy
modified 8-Jun-17 7:30am.
|
|
|
|
|
BillWoodruff wrote: I have been struggling with what Jeff Atwood calls VS's "bastardized regular expression syntax"
That only applies to VS2008 and earlier. Since VS2012, the search & replace uses standard .NET regular expressions[^].
Visual Studio uses .NET Framework regular expressions to find and replace text.
Before Visual Studio 2012, Visual Studio used custom regular expression syntax in the Find and Replace windows.
BillWoodruff wrote: how to select files that have specific text (keyword) content, and then apply S&R to only the matching files.
I don't think there's any way to do that in a single step, unless the content you're searching for is the content you want to replace.
You might need to do a "find in files" to find and open the matching files, and then a S&R targeting the open files.
Or were you wanting to limit the S&R based on the file names? I don't think they support regex; you'd need to use DOS-style wildcards instead.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|