2010年8月30日

摘要: 作为一个从事.net 开发刚刚4年的新人 我又重新看一些面试题 希望能够以自己的视角独立解决问题 今天想和大家聊的就是 小猫嚷嚷 群鼠乱窜 主人惊醒的问题 程序设计: 猫大叫一声,所有的老鼠都开始逃跑,主人被惊醒。(C#语言) 要求: 1.要有联动性,老鼠和主人的行为是被动的。 2.考虑可扩展性,猫的叫声可能引起其他联动效应。 我的思考方式是 先大致构造一个概略性设计程式 然后逐步构建小的逻辑代码 猫大叫一声 关键词 猫 叫喊 所有的老鼠开始逃跑 关键词 老鼠 跑 主人被惊醒 关键词 主人 惊醒 于是就有了下面的代码 cat.Call(); allmouses.Flee(); man.WakeUp(); 怎样才能让上面的三句话有关联 可以继续读题目要求 猫大叫一声 ,所有的老鼠开始逃跑 也就是 cat.Called+=new Called(allmouses.Flee); 阅读全文
posted @ 2010-08-30 15:45 天使也疯狂 阅读(268) 评论(0) 编辑

2008年11月6日

Private Sub CreateDnnManifest(ByVal objDesktopModule As DesktopModuleInfo)

Dim filename As String
= ""
_Name
= objDesktopModule.ModuleName

'Create Manifest Document
Dim xmlManifest As New XmlDocument

'Root Element
Dim nodeRoot As XmlNode = xmlManifest.CreateElement("dotnetnuke")
nodeRoot.Attributes.Append(XmlUtils.CreateAttribute(xmlManifest,
"version", "3.0"))
nodeRoot.Attributes.Append(XmlUtils.CreateAttribute(xmlManifest,
"type", "Module"))

'Folders Element
Dim nodeFolders As XmlNode = xmlManifest.CreateElement("folders")
nodeRoot.AppendChild(nodeFolders)

'Folder Element
Dim nodeFolder As XmlNode = xmlManifest.CreateElement("folder")
nodeFolders.AppendChild(nodeFolder)

'Desktop Module Info
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "name", _Name))
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest,
"friendlyname", objDesktopModule.FriendlyName))
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest,
"foldername", objDesktopModule.FolderName))
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest,
"modulename", _Name))
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest,
"description", objDesktopModule.Description))
If objDesktopModule.Version
= Null.NullString Then
objDesktopModule.Version
= "01.00.00"
End If
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest,
"version", objDesktopModule.Version))
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest,
"businesscontrollerclass", objDesktopModule.BusinessControllerClass))
If objDesktopModule.CompatibleVersions
<> "" Then
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest,
"compatibleversions", objDesktopModule.CompatibleVersions))
End If
If objDesktopModule.Dependencies
<> "" Then
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest,
"dependencies", objDesktopModule.Dependencies))
End If
If objDesktopModule.Permissions
<> "" Then
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest,
"permissions", objDesktopModule.Permissions))
End If
If SupportsProbingPrivatePath Then
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest,
"supportsprobingprivatepath", SupportsProbingPrivatePath.ToString))
End If

'Add Source files
If IncludeSource Then
nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest,
"resourcefile", ResourceFileName))
End If

'Modules Element
Dim nodeModules As XmlNode = xmlManifest.CreateElement("modules")
nodeFolder.AppendChild(nodeModules)

'Get the Module Definitions for this Module
Dim objModuleDefinitionController As New ModuleDefinitionController
Dim arrModuleDefinitions As ArrayList
= objModuleDefinitionController.GetModuleDefinitions(objDesktopModule.DesktopModuleID)

'Iterate through Module Definitions
For Each objModuleInfo As ModuleDefinitionInfo In arrModuleDefinitions
Dim nodeModule As XmlNode
= xmlManifest.CreateElement("module")

'Add module definition properties
nodeModule.AppendChild(XmlUtils.CreateElement(xmlManifest, "friendlyname", objModuleInfo.FriendlyName))

'Add Cache properties
nodeModule.AppendChild(XmlUtils.CreateElement(xmlManifest, "cachetime", objModuleInfo.DefaultCacheTime.ToString))

'Get the Module Controls for this Module Definition
Dim arrModuleControls As ArrayList = ModuleControlController.GetModuleControls(objModuleInfo.ModuleDefID)

'Controls Element
Dim nodeControls As XmlNode = xmlManifest.CreateElement("controls")
nodeModule.AppendChild(nodeControls)

'Iterate through Module Controls
For Each objModuleControl As ModuleControlInfo In arrModuleControls
Dim nodeControl As XmlNode
= xmlManifest.CreateElement("control")

'Add module control properties
XmlUtils.AppendElement(xmlManifest, nodeControl, "key", objModuleControl.ControlKey, False)
XmlUtils.AppendElement(xmlManifest, nodeControl,
"title", objModuleControl.ControlTitle, False)

XmlUtils.AppendElement(xmlManifest, nodeControl,
"src", objModuleControl.ControlSrc, True)
XmlUtils.AppendElement(xmlManifest, nodeControl,
"iconfile", objModuleControl.IconFile, False)
XmlUtils.AppendElement(xmlManifest, nodeControl,
"type", objModuleControl.ControlType.ToString, True)
XmlUtils.AppendElement(xmlManifest, nodeControl,
"helpurl", objModuleControl.HelpURL, False)

If objModuleControl.SupportsPartialRendering Then
XmlUtils.AppendElement(xmlManifest, nodeControl,
"supportspartialrendering", "true", False)
End If

'Add control Node to controls
nodeControls.AppendChild(nodeControl)

'Determine the filename for the Manifest file (It should be saved with the other Module files)
If filename = "" Then
filename
= Folder & "\" & objDesktopModule.ModuleName + ".dnn"
End If
Next

'Add module Node to modules
nodeModules.AppendChild(nodeModule)
Next

'Files Element
Dim nodeFiles As XmlNode = xmlManifest.CreateElement("files")
nodeFolder.AppendChild(nodeFiles)

'Add the files
For Each file As PaFileInfo In _Files
Dim nodeFile As XmlNode
= xmlManifest.CreateElement("file")

'Add file properties
XmlUtils.AppendElement(xmlManifest, nodeFile, "path", file.Path, False)
XmlUtils.AppendElement(xmlManifest, nodeFile,
"name", file.Name, False)

'Add file Node to files
nodeFiles.AppendChild(nodeFile)
Next

'Add Root element to document
xmlManifest.AppendChild(nodeRoot)

'Save Manifest file
xmlManifest.Save(filename)

End Sub
			
			
posted @ 2008-11-06 20:08 天使也疯狂 阅读(111) 评论(0) 编辑

2008年10月27日

大家下载这个Crack,安装到Dreamweaver CS4 目录下就可以了

 

附: Dreamweaver CS4 正式版迅雷下载地址

 

备注:大家安装好这个Crack文件后,不需要修改etc目录下的hosts文件即可使用Adobe DreamWeaver CS4的

posted @ 2008-10-27 17:34 天使也疯狂 阅读(1442) 评论(5) 编辑

2008年2月20日

自己有问题了 自己解决了 也不吱一声 就把自己的帖子删除了

不仗义

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace splitString
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入您要分解的字符串");
            string m_string = Console.ReadLine();

            ArrayList[] getString=DealString(m_string);

            int numCount = 0;
            if (getString != null)
            {
                foreach (ArrayList c in getString)
                {
                    if (c != null)
                    {
                        numCount++;
                        Console.WriteLine("第{0}种分类情况为", numCount);
                        for (int i = 0; i < c.Count; i++) {
                            Console.WriteLine("({0}/{1}){2}", i+1, c.Count, c[i].ToString());
                        }
                    }
                }
            }
            Console.Read();

        }

        private static ArrayList[] DealString(string m_string)
        {
            int m_length = m_string.Length;
            int tempa;
            int number;
            ArrayList[] all=new ArrayList[m_length];
            number = 0;
            for (int i = 1; i <= m_length; i++) {
                //分成的temp段的新加字段的长度
                tempa = 0;
               
                for (int j = 1; j <= i; j++) {
                    tempa += j.ToString().Length;
                }
                tempa += i * 2;
                if ((tempa + m_length) % i == 0)
                {
                    all[number] = new ArrayList();
                    all[number] = DealString(m_string, i);
                    number++;

                }
            }
            return all;
        }

        private static ArrayList DealString(string m_string, int N)
        {
            int m_length = m_string.Length;
            if (m_length < N) {
                Console.WriteLine("貌似不能分成这么多段");
                return null;
            }

            ArrayList al = new ArrayList();
            int temp=m_length/N;
            for (int i = 0; i < m_length-temp; i+=temp) {
                al.Add(m_string.Substring(i,temp));            
            }
            al.Add(m_string.Substring(m_length-temp));
            return al;
        }
    }
}


本来想到 三脚猫的 那个问题是 分解质因数 就可以解决的 后来一想 不是这样的
只好用穷举法解决
posted @ 2008-02-20 21:32 天使也疯狂 阅读(162) 评论(1) 编辑

2008年2月18日

引用自 pkdoor 升级VS 2005 的方法

如果我们不小心安装VS 2008的时候,没有事先更改CDKEY 我们也可以这么做来实现VS 2008的注册

在“添加删除”里面选择删除"Microsoft Visual Studio Team System 2008 Team Suite--简体中文",然后在打开的窗口中选择最后一项“添加注册码升级到正式版”,在里面输入下面的cd-key:
N:PYHYP-WXB3B-B2CCM-V9DX9-VDY8T

此时VS2008提示升级成功。

 

最近收到同学反馈说Windows 7下不能更新序列号

顺便在网上找了写解决方案

 

1.解压缩VS.NET安装程序

2.打开Setup文件夹

3.用记事本编辑里面的setup.sdb文件,查找“[Product key]”,把试用版的序列号替换为正式的序列号,保存文件

4.正常安装就可以了

 

 

对于已经安装了试用版的同学 可以下载补丁包 来修复这个问题

 

http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=27638

 

需要在电脑上预安装vs 2008 sp1

下载上面的包 就能在控制面板中设置了

posted @ 2008-02-18 12:02 天使也疯狂 阅读(6790) 评论(13) 编辑

公告

昵称:天使也疯狂
园龄:4年
粉丝:0
关注:0

导航

<2012年2月>
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910

统计

  • 随笔 - 5
  • 文章 - 0
  • 评论 - 24
  • 引用 - 0

搜索

 

常用链接

我的标签

随笔分类

随笔档案

最新评论