小编Ste*_*ger的帖子

如何设计公共交通时刻表数据库?

是否有公共交通时间表数据库设计的例子?

或者任何OpenSource时间表引擎解决方案?

或者如果没有,怎么做自己?

如何最好地设计数据库,以便快速合理地进行搜索?

我这样做:

为了测试,我采用了一个X形总线网络,有5个停靠点(边缘和顶点).

表1:村庄/地点/停靠点及其地理坐标列表以及UID.

表2:位置名称列表,包括翻译,短号,表1作为外键

表3:运输车辆清单,例如公共汽车,火车,飞机,船舶及其翻译.

表4:国家清单

表5:公共假日和包括翻译在内的假日名称的包含性新日期和时间表列表,国家/地区为外键

表6:n个不同季节的来源日期列表,包括翻译,例如冬季,夏季,以国家为外键

现在是棘手的部分(时间表,路线,站点):

表7:Line_UID,vehicle_uid,line_nr,line_name,line_start_location_uid,line_stop_location_uid

表8:hop_uid,line_uid,stop_uid,stop_sequence_nr,time_uid

表9:time_nuid,hop_uid,时间

我认为特别是停止和停止时间之间的关联很困难.此外,我还在考虑如何将不同季节与线路/路线联系起来.这看起来合情合理吗?或者你看到了问题?

编辑: 不,不起作用,我需要考虑到达和离开时间.

.net sql database-design timetable

2
推荐指数
1
解决办法
3207
查看次数

C#DLL可以被截去?

问题:是否可以编写可以被限制的C#dll?

我想为WinAPI调用WritePrivateProfileString等编写一个替换库来读取和写入ini文件.

是否可以导出一个函数,例如'WritePrivateProfileString',在C#中实现,这样可以用DllImport对dll进行pinvoke?

我想用托管dll替换本机dll,因此托管dll会被pinvoke调用(而不是本机dll,当托管dll在bin目录中时)调用.

.net c# pinvoke dllimport

2
推荐指数
1
解决办法
261
查看次数

为什么WellKnownSidType有时无法转换为sid/account?

问题:我正在查找每个WellKnownSidType枚举成员的帐户名称和SID,如下所示.

为什么有时会失败?
为什么有时会将WellKnownSidType转换为sid失败?
据我了解,只有从sid到accountname的转换有时会失败,甚至只有当帐户不是本地而不是域时才会失败.



例如,在将enum LogonIdsSid转换为SID时,我得到:
Bekannte SIDs des TypsLogonIdsSidkönnennichterstellt werden.
(无法创建LogonIdsSid类型的已知SID.)

或者在查找NTAuthoritySid的
帐户名时,我得到:Manche oderallestatitätsverweisekontentenichtübersetztwerden.
(部分或全部的标识 - 引用无法翻译.)

Sub Main()
    Enumerations.SidInfo(Of System.Security.Principal.WellKnownSidType)()
End Sub

Public Class Enumerations

   Public Shared Sub SidInfo(Of T)()
        Dim enumType As Type = GetType(T)


        For Each ThisEnumValue As T In System.Enum.GetValues(GetType(T))
            Try
                Console.WriteLine("Enum: System.Security.Principal.WellKnownSidType." + System.Enum.Format(GetType(T), ThisEnumValue, "G"))
                Dim enumItem1 As System.Reflection.FieldInfo = enumType.GetField(System.Enum.Format(GetType(T), ThisEnumValue, "G"))
                Dim enumValue1 As T = CType(enumItem1.GetValue(enumType), T)
                Dim sid As System.Security.Principal.SecurityIdentifier = New System.Security.Principal.SecurityIdentifier(CType(CType(enumValue1, Object), System.Security.Principal.WellKnownSidType), Nothing)
                Console.WriteLine("SID: " + …
Run Code Online (Sandbox Code Playgroud)

.net c# vb.net asp.net permissions

2
推荐指数
1
解决办法
4996
查看次数

ComboBox SelectedText,为什么不切换到SelectedText项?

题:

如果我使用的话,我的组合框(Me.cbHomeDrive)没有正确初始化

Me.cbHomeDrive.SelectedText = "E:"
Run Code Online (Sandbox Code Playgroud)

在Form_Load上:

For i As Integer = AscW("C"c) To AscW("Z"c) Step 1
      Me.cbHomeDrive.Items.Add(New ComboBoxItem(ChrW(i) + ":"))
Next

Me.cbHomeDrive.SelectedIndex = 26 - 3
Me.cbHomeDrive.Enabled = False
Run Code Online (Sandbox Code Playgroud)

类ComboBoxItem是:

Public Class ComboBoxItem
    Public Text As String
    Public ID As String

    Public Sub New(ByVal strText As String)
        Text = strText
        ID = strText
    End Sub

    Public Sub New(ByVal strText As String, ByVal strID As String)
        Text = strText
        ID = strID
    End Sub


    Public Overrides Function ToString() As String
        Return …
Run Code Online (Sandbox Code Playgroud)

c# vb.net combobox winforms

2
推荐指数
2
解决办法
9247
查看次数

ASP.NET:为无 cookie 会话实现 ISessionIDManager?

题:

我正在编写一个自定义会话提供程序。到目前为止,它运行良好。我决定添加一个自定义的 ISessionIDManager 来控制会话 ID。

它已经适用于 cookie 会话。但是当我切换到 cookieless 时,就像这样:

<sessionState mode="Custom" customProvider="custom_provider" cookieless="true" timeout="1"
                sessionIDManagerType="Samples.AspNet.Session.MySessionIDManager"
                sqlConnectionString="Data Source=localhost;Initial Catalog=TestDB;User Id=SomeUser;Password=SomePassword;" 
                sqlCommandTimeout="10" 
                >
    <!-- timeout in minutes-->
    <providers>
      <add name="custom_provider" type="Test.WebSession.CustomSessionStoreProvider" />
    </providers>
  </sessionState>
Run Code Online (Sandbox Code Playgroud)

然后它重定向到:
http://localhost:52897/(77bb065f-d2e9-4cfc-8117-8b89a40e00d8)/default.aspx
这会抛出 HTTP 404。

我明白为什么,因为没有这样的文件夹。

但是当您使用默认会话管理器(asp.net 附带的那个)并切换到 cookieless 时,URL 如下所示:
http://localhost:52897/(S(sq2abm453wnasg45pvboee45))/DisplaySessionValues.aspx

和那里不是 HTTP 404...

我尝试将 (S 和 ) 添加到我的会话 ID 中的 url 括号中,但这没有帮助。


我错过了什么?

using System;
using System.Configuration;
using System.Web.Configuration;
using System.Web;
using System.Web.SessionState;

// http://allantech.blogspot.com/2011/04/cookieless-session-state-in-aspnet.html
// http://forums.asp.net/t/1082784.aspx/1

// http://stackoverflow.com/questions/4612310/implementing-a-custom-sessionidmanager
// http://msdn.microsoft.com/en-us/library/system.web.sessionstate.isessionidmanager.aspx
// http://msdn.microsoft.com/en-us/library/system.web.sessionstate.isessionidmanager(v=vs.80).aspx

namespace Samples.AspNet.Session …
Run Code Online (Sandbox Code Playgroud)

c# asp.net session session-state session-cookies

2
推荐指数
1
解决办法
5309
查看次数

如何在FileHelpers中使用动态CSV分隔符?

问题:我需要阅读CSV文件.我使用FileHelpers库来实现这一点.

问题是我需要一个动态分隔符(用户定义),这意味着任何东西都可以是分隔符(逗号,分号,制表符,换行符,还有其他任何东西).

问题是,FileHelpers在属性中定义了分隔符,这意味着在编译时.这使得它无法动态地完成.

我能做的是声明一个新类,它继承自一个基类,并在这个新类上设置分隔符.

[FileHelpers.DelimitedRecord(",")]
public class CommaCustomer : BaseCustomer
{

}
Run Code Online (Sandbox Code Playgroud)

这样我只需要在每个新分隔符的基类中进行更改.问题是,这是我不能(也不想)为每个可能的分隔符创建子类.

这是我到目前为止的代码:

using System;
using System.Data;
using System.IO;
//using FileHelpers;
//using FileHelpers.RunTime;


namespace Examples
{


    class MainClass
    {


        [STAThread]
        static void Main()
        {
            FileHelpers.FileHelperEngine engine = new FileHelpers.FileHelperEngine(typeof(SemicolonCustomer));

            // To read use:

            string str = @"D:\Username\Desktop\FileHelpers_Examples_CSharp_VbNet\Data\SemicolonCustomers.txt";
            //str = @"D:\Username\Desktop\FileHelpers_Examples_CSharp_VbNet\Data\CustomersDelimited.txt";
            SemicolonCustomer[] custs = (SemicolonCustomer[])engine.ReadFile(str);
            //Customer[] custs = (Customer[]) engine.ReadFile("yourfile.txt");


            foreach (SemicolonCustomer cli in custs)
            {
                Console.WriteLine();
                Console.WriteLine("Customer: " + cli.CustId.ToString() + " - " + cli.Name);
                Console.WriteLine("Added Date: " …
Run Code Online (Sandbox Code Playgroud)

.net c# csv filehelpers code-generation

2
推荐指数
1
解决办法
1万
查看次数

正则表达式删除单行SQL注释( - )

题:

任何人都可以给我一个可以从SQL语句中删除单行注释的正则表达式(C#/ VB.NET)吗?

我的意思是这些评论:

-- This is a comment
Run Code Online (Sandbox Code Playgroud)

不是那些

/* this is a comment */
Run Code Online (Sandbox Code Playgroud)

因为我已经可以处理明星评论了.

我有一个小的解析器,当它们在行的开头时删除那些注释,但是它们也可以在代码之后的某个地方或者更坏的情况下,在SQL字符串中'hello --Test -- World' 也应该删除那些注释(除了SQL字符串中的那些注释)当然 - 如果可能的话).

令人惊讶的是我没有使用正则表达式.我会认为明星评论更难,但实际上,他们不是.

根据请求,这里我的代码删除/**/ - 样式注释(为了让它忽略SQL样式字符串,你必须用uniqueidentifier替换字符串(我使用4个标准),然后应用注释删除,然后应用string-backsubstitution.

    static string RemoveCstyleComments(string strInput) 
    { 
        string strPattern = @"/[*][\w\d\s]+[*]/"; 
        //strPattern = @"/\*.*?\*/"; // Doesn't work 
        //strPattern = "/\\*.*?\\*/"; // Doesn't work 
        //strPattern = @"/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/ "; // Doesn't work 
        //strPattern = @"/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/ "; // Doesn't work 

        // http://stackoverflow.com/questions/462843/improving-fixing-a-regex-for-c-style-block-comments 
        strPattern = @"/\*(?>(?:(?>[^*]+)|\*(?!/))*)\*/";  // Works ! 

        string strOutput = System.Text.RegularExpressions.Regex.Replace(strInput, strPattern, string.Empty, System.Text.RegularExpressions.RegexOptions.Multiline); 
        Console.WriteLine(strOutput); …
Run Code Online (Sandbox Code Playgroud)

.net c# regex sql vb.net

2
推荐指数
1
解决办法
5701
查看次数

Windows 安装程序:错误 1001,CustomAction _xxxxx.install 返回实际错误代码 1603

问题:

我已经使用 Visual Studio 2012 和 InstallShield 创建了 Windows 服务的安装程序。

服务运行良好。
安装程序在我的开发计算机(Windows 8 64 位)和我的 XP 虚拟机(32 位)上运行良好。

但在 Windows Server 2008 R2 上,同一安装程序会收到“错误 10001”。
没有任何进一步的信息。

事件日志中包含以下信息:

Product: DbBackupServiceSetup -- Error 1001. 
(NULL)
(NULL)
(NULL)
(NULL)
(NULL)

the message resource is present but the message is not found in the string/message table
Run Code Online (Sandbox Code Playgroud)

如果我手动安装:

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "D:\Program Files\Test\DbBackupService.exe"
Run Code Online (Sandbox Code Playgroud)

即使在 Windows Server 2008 R2 上它也可以正常工作...

我创建了一个具有 32 位可执行文件的安装程序和一个具有 64 位可执行文件的安装程序,但我在这两个安装程序上都遇到了此错误...

我尝试在启用日志记录的情况下执行 msi

msiexec /i "D:\Install\DISK1\DbBackupServiceSetup.msi" /Lv "D:\example.log"
Run Code Online (Sandbox Code Playgroud)

日志文件中第一个错误指示如下:

Created Custom Action Server with …
Run Code Online (Sandbox Code Playgroud)

.net windows-installer windows-services installshield-2012

2
推荐指数
1
解决办法
2万
查看次数

Java与C#:BigInteger十六进制字符串产生不同的结果?

题:

这段代码用Java:

BigInteger mod = new BigInteger("86f71688cdd2612ca117d1f54bdae029", 16);
Run Code Online (Sandbox Code Playgroud)

产生(在java中)数字

179399505810976971998364784462504058921
Run Code Online (Sandbox Code Playgroud)

但是,当我使用C#时,

BigInteger mod = BigInteger.Parse("86f71688cdd2612ca117d1f54bdae029", System.Globalization.NumberStyles.HexNumber); // base 16
Run Code Online (Sandbox Code Playgroud)

我没有得到相同的号码,我得到:

-160882861109961491465009822969264152535
Run Code Online (Sandbox Code Playgroud)

但是,当我直接从十进制创建数字时,它可以工作

BigInteger mod = BigInteger.Parse("179399505810976971998364784462504058921");
Run Code Online (Sandbox Code Playgroud)

我尝试在字节数组中转换十六进制字符串并将其反转,并从反转数组创建一个大整数,以防万一它是一个具有不同字节序的字节数组,但这没有帮助...

将Java-Code转换为C#时,我也遇到了以下问题:
Java

BigInteger k0 = new BigInteger(byte[]);
Run Code Online (Sandbox Code Playgroud)

要在C#中获得相同的数字,我必须反转数组,因为biginteger实现中的Endianness不同

C#等价物:

BigInteger k0 = new BigInteger(byte[].Reverse().ToArray());
Run Code Online (Sandbox Code Playgroud)

c# java arrays biginteger endianness

2
推荐指数
1
解决办法
399
查看次数

在没有固定高度的 HTML/inlineSVG 中将文本旋转 270°?

我想在 HTML5 中有一个这样的表格:

像这样的桌子

也就是说,第 2 列的标题旋转 270°,垂直对齐底部,水平居中,黑色背景上的白色字体,但没有为标题行/列设置明确的高度,最好不必求助于使用 JavaScript 进行布局...

现在,直到现在,我通过使用服务器端图像生成来做到这一点,
<img src="handler.ashx?text=bla&fg=FFFFFF&bg=000000" />
不幸的是,这会禁用使用 搜索文本CTRL + F,这是相当不幸的,因为有很多组(数百个)。

现在有一些关于 SO 的帖子,例如将
HTML SVG 文本旋转 270 度
如何在 TH 表标签中使用 CSS Rotate()
使用 CSS 转换旋转表格标题文本
https://jsfiddle.net/t5GgE/1/

但是它们要么明确地(或间接地)设置高度,要么在表格标题中使用背景颜色无法正常工作。

现在我到目前为止是这样的:https :
//jsfiddle.net/kn46f38n/6/

其中的问题是垂直对齐底部无法正常工作,并且高度不会自动调整(除非我添加画布图像)。

所有这些都相当令人沮丧,这基本上意味着唯一的进展是用画布替换处理程序,这减轻了服务器的负担,但在可搜索性方面没有任何进展,而且最糟糕的是,使用 JS 进行布局,而有仍然是不支持画布的浏览器。

真的没有办法在 HTML/inlineSVG 中做到这一点,而不必设置显式高度(任何类型的高度,比如包括变换原点),也不必求助于 javascript 吗?

没有 jQuery:

var maxH = 0;
// Find the column label with the tallest height
var hdrs = document.querySelectorAll(".hdr")
for (i = 0; i < hdrs.length; i++)
{
    var bbox …
Run Code Online (Sandbox Code Playgroud)

html css svg

2
推荐指数
1
解决办法
1595
查看次数