|
Yes it is. You need to install Iron Python[^. Then you gain access to your Python functions directly from .NET.
|
|
|
|
|
You can use IronPython[^] in a C# application. A simple implementation of loading a python file using IronPython looks something like this:-
Console.WriteLine("Loading discountprice.py");
ScriptRuntime py = Python.CreateRuntime();
dynamic random = py.UseFile(@"D:\Documents\Python Scripts\discountprice.py");
Console.WriteLine("discountprice.py loaded.");
that snippet loads a basic python file called discountprice.py in my python scripts folder. To implement this you need to download IronPython and reference Microsoft.Scripting.Hosting and also IronPython.Hosting .
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Thanks it helps. (tried it with a simple script)
my question now is:
I have a python script that import module IntelHex.
when executing the script itself it works properly.
when calling it frm my C# application, I got an exception "No module named intelHex"
Do you have a clue how can I solve this?
Thanks,
|
|
|
|
|
Hi All,
Is there a dll that deal with Intel-Hex ( http://en.wikipedia.org/wiki/Intel_HEX[^] ) file format?
I have 2 hex file (in intel-hex format) and I need to compare them.
the output must be the addresses where data differs.
Do you know if such a thing already exists?
Thanks
|
|
|
|
|
Not that I know of.
From your description, why would you process the file wide respect to byte order? If you're giving an offset into the file where there is a difference the byte order of the data in the file wouldn't make any difference at all.
|
|
|
|
|
Thanks.
I don't really undestand your answer.
I don't have the offset, I need to find it.
more than that, I need to compare address vs. address not the entire file. this is why I need to parse it.
|
|
|
|
|
object code file formats such as Intel Hex and Motorola Hex have an address field and some data fields (often worth 16 or 32 bytes) on each of the lines; the data bytes are ordered within each line, the lines themselves can come, and do come, in any order. So one can not simply do a text compare.
|
|
|
|
|
Yeah, the way he described it, I took the "address where differs" as the offset into the file.
|
|
|
|
|
As I understand it, in Entity Framework we create the backend from which the classes for our frontend code derive. Does this mean that we don't need any thoughts about classes building anymore? Doesn't this make at least a part of OOP thinking and of UML useless?
Thanks.
|
|
|
|
|
Err, no. The Entity Framework encapsulates the data access. It doesn't say anything about how your business logic and UI will look, or how those classes will be implemented.
|
|
|
|
|
UML is useless anyway
|
|
|
|
|
nstk wrote: , in Entity Framework we create the backend from which the classes for our frontend code derive
Not necessarily: it is possible to start with the object model and generate the database tables from it.
nstk wrote: Does this mean that we don't need any thoughts about classes building anymore?
Doesn't this make at least a part of OOP thinking and of UML useless?
We still need to think about the OO design: the Entity Classes are still classes and still need to be designed properly. All the EF does is handle how the object it stored.
It is also perfectly possible to write OO code without UML, even so the classes generated can be described in UML, otherwise there is something seriously wrong with the framework.
|
|
|
|
|
Hi, can I set the value of a textbox in a webpage from a windows application in my computer? For example, www.aaa.com there is a textbox (I know its variable name and it is constant) when I focus on that textbox, my windows application will appear. I will choose a text from a listbox and it will write the value to the target textbox?? Thanks.
|
|
|
|
|
Why would you want to do this from a "windows" application (.NET ?): are you attempting to modify somebody else's website ?
If you wrote the HTML, implement the solution in HTML which should be pretty simple: implement a way to make a List appear, catch the user's click on an item it, and so forth.
best, Bill
"The first principle is that you must not fool yourself, and you are the easiest person to fool." Richard Feynman
|
|
|
|
|
I want to do this because, the I don't have a chance to change the web site and I don't want to make changes on the site. For instance, I am working for an IT support of a company, we have a site that workers ask questions and we answer them. I have some constant answers so, when I focus on a textbox that for the answer, my form will appear and I will choose the constant answer for that question finally I'll send it. Thanks for the answer.
|
|
|
|
|
|
Read the posting guidelines!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Well, you could always hold up a dictaphone to the earpiece.
|
|
|
|
|
I need help to create a phone dialer in c # with multiple lines
|
|
|
|
|
Yes. It will certainly take multiple lines (of c#).
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
If you needed help with something, why didn't you ask a question about what it is you needed help with??
|
|
|
|
|
I need to create Dialer using C# with 5 Data Modems, it`s code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
using System.IO.Ports;
using System.Threading;
namespace ConsoleApplication4
{
class Program
{
[STAThread]
static void Main()
{
int Numero;
Numero = 37924300;
string classname = "Win32_POTSModem";
string strMachine = ".";
System.Management.ObjectQuery oQuery;
System.Management.ManagementScope oScope;
System.Management.ManagementObjectSearcher oSearcher;
string strSQL;
try
{
strSQL = "Select * from " + classname;
oQuery = new ObjectQuery(strSQL);
oScope = new ManagementScope(@"\\" + strMachine + @"\root\cimv2");
oSearcher = new ManagementObjectSearcher(oScope, oQuery);
foreach (ManagementObject oService in oSearcher.Get())
{
if (!oService.GetPropertyValue("DeviceID").ToString().Contains("Modem"))
{
Console.WriteLine(oService.GetPropertyValue("AttachedTo"));
Console.WriteLine(oService.GetPropertyValue("Name"));
Console.WriteLine(oService.GetPropertyValue("DeviceID"));
SerialPort modem1 = new SerialPort(oService.GetPropertyValue("AttachedTo").ToString(), 9600, Parity.None, 8, StopBits.One);
Console.Write("Try call on modem " + oService.GetPropertyValue("Name").ToString());
while (modem1.IsOpen)
{
modem1.Close();
Thread.Sleep(1000);
}
modem1.Open();
modem1.NewLine = "\n";
Console.WriteLine(modem1.ToString());
Console.WriteLine(modem1.PortName);
Console.WriteLine(modem1.NewLine.ToString());
Console.WriteLine(modem1.IsOpen.ToString());
Console.WriteLine(modem1.ReadExisting());
modem1.Open();
modem1.ReadTimeout = 100000;
modem1.NewLine = "\r";
modem1.WriteLine("ATZ");
Console.Write("reset the modem");
modem1.ReadTo("OK\r\n");
Console.Write("wait for OK from modem");
modem1.WriteLine("ATHDT " + Numero + "@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1@1");
Console.Write("Discando para o numero " + Numero);
string response = modem1.ReadTo("\r").Trim();
Console.Write("Read status modem " + response);
int i = 0;
while (i < 900000)
{
Console.WriteLine(modem1.ReadExisting());
i++;
}
modem1.Close();
Console.WriteLine();
Console.Write("Disconnect call " + modem1.PortName);
Console.ReadKey();
}
}
Console.WriteLine("Write call number");
Console.ReadKey();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadKey();
}
}
}
}
|
|
|
|
|
5 seperate lines, huh?? this code is never going to work.
I could descrbie how to rip all this out and convert it to it's own class so you could run multiple instances of it on seperate threads, but it would take FAR more than a few forum posts to do so. That's just not going to happen.
There's no way you're going to get this code to work with any efficiency at all.
|
|
|
|
|
I have a problem with the validation using Enterprise Library 5.0 & the integration with Window Presentation Foundation (WPF). I can't validate the enter of a string. I try with WindowForm and I have the results but with WPF is so impossible.
If exist any example in validation with EntLib & WPF using VS 2010. Please send me right here or at the email jhcastellanos@uci.cu
|
|
|
|
|
Hi all,
i'm looking for a possibilty, to fill/paint the Background of different classes / objects with one Method. My code / thoughts so far:
private void LangSelectWindow_Paint(object sender, PaintEventArgs e)
{
PaintForm(this, e, "#E4A458", "#F0D697", 90f);
}
private void PaintForm(Form sender, PaintEventArgs e, String Color1, String Color2, float Angle)
{
Graphics g = e.Graphics;
Rectangle rBackground = new Rectangle(0, 0,
sender.Width, sender.Height);
System.Drawing.Drawing2D.LinearGradientBrush bBackground
= new System.Drawing.Drawing2D.LinearGradientBrush(rBackground,
System.Drawing.ColorTranslator.FromHtml(Color1),
System.Drawing.ColorTranslator.FromHtml(Color2),
Angle);
g.FillRectangle(bBackground, rBackground);
bBackground.Dispose();
}
works like a charm. But if i have a label or other object, do i have to create a new "PaintForm" for everything ? i.e.
private void LangSelectWindow_Paint(object sender, PaintEventArgs e)
{
PaintLabel(this, e, "#E4A458", "#F0D697", 90f);
}
private void PaintLabel(Label sender, PaintEventArgs e, String Color1, String Color2, float Angle)
{
Graphics g = e.Graphics;
Rectangle rBackground = new Rectangle(0, 0,
sender.Width, sender.Height);
System.Drawing.Drawing2D.LinearGradientBrush bBackground
= new System.Drawing.Drawing2D.LinearGradientBrush(rBackground,
System.Drawing.ColorTranslator.FromHtml(Color1),
System.Drawing.ColorTranslator.FromHtml(Color2),
Angle);
g.FillRectangle(bBackground, rBackground);
bBackground.Dispose();
}
don't want do create a single "paint-method" for every object / class. Only the BOLD marked things changes...
Tom
modified 15-Feb-12 15:08pm.
|
|
|
|