Tag: C#的

用C ++扩展PHP?

我有一个用PHP编写的性能密集型例程,我希望将其移植到C ++中以提高性能。 有没有什么办法来编写插件或扩展或使用C ++和从PHP接口? 没有手动编辑实际的PHP源代码?

如何在Linux中实现C的getch()函数?

在TurboC ++中,我可以使用conio.h的getch()函数。 但在Linux中,gcc不提供conio.h 。 我怎样才能得到getch()的function?

#define与常量的优缺点?

有人可以指出使用#define与常量的优缺点吗? 我的大部分工作都是在C和Objective-C中完成的。

标准inputstream(stdin)的文件结尾(EOF)

stdin有没有EOF? 例如 – 如果我开始阅读从标准input使用FRAD /读,然后当下面的循环将结束? while ((c = read(0, buffer, BUFSIZ)) > 0) { . . . } 如果上面的解决scheme是否定的,那么有没有办法在stdin中添加EOF?

System.Drawing在Windows或ASP.NET服务

根据MSDN的说法,在Windows服务或ASP.NET服务的System.Drawing命名空间中使用类并不是一个特别好的主意。 现在我正在开发一个类库,它可能需要访问这个特定的命名空间(用于测量字体),但不能保证主机进程不是服务。 现在,如果System.Drawing不可用,还有一个不太理想的方法,但是如果可能的话,我宁愿在System.Drawing中使用类。 所以我想要做的是在runtume中确定System.Drawing是否安全,如果是,则使用它,否则返回到次优选项。 我的问题是: 我怎么可能检测到System.Drawing是否安全使用? 我想我也应该 检测当前进程是Windows服务还是ASP.NET服务 检测GDI是否可用 或者也许有一种方法来问System.Drawing.dll本身,如果它是安全的使用 不幸的是,我不能想出一个方法来实现这些方法。 有没有人有任何想法?

在代码隐藏的DataTemplate中find一个WPF元素

我有一个数据模板 <Window.Resources> <DataTemplate x:Key="BarChartItemsTemplate"> <Border Width="385" Height="50"> <Grid> <Rectangle Name="rectangleBarChart" Fill="MediumOrchid" StrokeThickness="2" Height="40" Width="{Binding}" HorizontalAlignment="Right" VerticalAlignment="Bottom"> <Rectangle.LayoutTransform> <ScaleTransform ScaleX="4"/> </Rectangle.LayoutTransform> </Rectangle> <TextBlock Margin="14" FontWeight="Bold" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding}"> <TextBlock.LayoutTransform> <TransformGroup> <RotateTransform Angle="90"/> <ScaleTransform ScaleX="-1" ScaleY="1"/> </TransformGroup> </TextBlock.LayoutTransform> </TextBlock> </Grid> </Border> </DataTemplate> </Window.Resources> 我在表格上有一个button。 我需要从dataTemplate改变比例(scaleTransform)矩形。 我该如何访问上述button的Button_Click事件中的“rectangleBarChart”元素?

什么是x86_64 va_list结构的格式?

任何人都可以参考x86_64 ABI(在Linux上使用的)中的va_list的表示? 我试图debugging一些代码堆栈或参数看起来腐败,这将有助于理解我应该看到什么…

欺骗后如何检测原始MAC地址?

我们使用下面的代码来检索Windows PC的活动MAC地址。 private static string macId() { return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled"); } private static string identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue) { string result = ""; System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass); System.Management.ManagementObjectCollection moc = mc.GetInstances(); foreach (System.Management.ManagementObject mo in moc) { if (mo[wmiMustBeTrue].ToString() == "True") { //Only get the first one if (result == "") […]

在main()中调用main()

是否有可能在c中的main()函数中调用main() ?

使用C#转换DateTime for MySQL

我想在C#中更改MySQL的DateTime。 我的MySQL数据库只接受这种格式1976-04-09 22:10:00 。 在C#中有一个string谁有一个date值: string str = "12-Apr-1976 22:10"; 我想转换为MySQL然后它看起来像: 1976-04-12 22:10 我怎么可以改变他们或其他程序员如何使用dd mm hh yy方法? 谁能告诉我他们?