Git新手入门

Categories: Development Notes; Tagged with: ; @ December 11th, 2012 0:27

1. 创建Repository

git init

2. Commit文件

git add .
git commit –m “init Import”

3. 查看状态

git status

4.增加本地Repo到服务器

git remote add origin https://github.com/.....git

5Commit 到服务器

git push origin master

6. 从gitHub复制Repository

git clone git://…git

7. 从服务器更新:

git pull origin master

当一个Repo在GitHub上创建完毕后会有简要提示:

Create a new repository on the command line

touch README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/DavidGuoliang/DoubanAnalytics.git git push -u origin master

Push an existing repository from the command line

git remote add origin https://github.com/DavidGuoliang/DoubanAnalytics.git git push -u origin master

GitHub有提供Windows下的UI图形界面.

Links: http://gitref.org/creating/

Get DTSx/SSIS Connections From C#

Categories: DatabaseDevelopment Notes; Tagged with: ; @ December 5th, 2012 23:49

Requirement:  Get all connections from dtsx packages using C#.

Solution:

Using Microsoft.SqlServer.Dts.Runtime to load the package, and then get all connections.

Step1 Add reference

In case you are totally new to .Net/C#, you may need this screen capture:

image

In the pop-up window, click “Browse” tab, and select: C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Microsoft.SQLServer.ManagedDTS.dll

About the dll path:

ref 1: http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/c333d8e5-a4ca-470e-a2d8-4f67a5e05a10/

ref 2: http://stackoverflow.com/questions/4920591/havent-got-microsoft-sqlserver-manageddts-dll-but

Step 2 Coding

import: using Microsoft.SqlServer.Dts.Runtime

 

        public void testDts()
        {
            string pkgLocation;
            Package pkg;
            Application app;
            DTSExecResult pkgResults;

            pkgLocation =
              @"C:\Users\x\Documents\Visual Studio 2008\Projects\Integration Services Project1\Integration Services Project1\" +
              @"Package.dtsx";
            app = new Application();
            pkg = app.LoadPackage(pkgLocation, null);

            Connections conns = pkg.Connections;
            foreach (ConnectionManager cm in conns)
            {
                Console.WriteLine("Name = " + cm.Name + ", HostType = " + cm.HostType + "; ConnectionString=" + cm.ConnectionString);
            }
        }

API: http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.package.connections(v=sql.100).aspx

Output:

Name = Flat File Connection Manager, HostType = ConnectionManager; ConnectionString=C:\Users\x\Desktop\ssisTest.txt
Name = x_instan, HostType = ConnectionManager; ConnectionString=Data Source=x-PC\x_INSTAN;Integrated Security=SSPI;Connect Timeout=30;

Grails: generate-all Class Error: No domain class found for name “Class”

Categories: Development Notes; Tagged with: ; @ December 3rd, 2012 19:35

After I created a new Class using: 

grails> create-domain-class User

I want to to generate the controller:

grails>generate-all User

I got these error:

| No domain class found for name User. Please try again and enter a valid domain class name
| Error Error running generate-all (Use –stacktrace to see the full trace)
| Error Error running script generate-all User: org.codehaus.groovy.grails.cli.ScriptExitException (
Use –stacktrace to see the full trace)
grails> –stacktrace
| Error Error running script –stacktrace: Cannot invoke method findAll() on null object (NOTE: Stac
k trace has been filtered. Use –verbose to see entire trace.)
java.lang.NullPointerException: Cannot invoke method findAll() on null object
        at RunApp$_run_closure8_closure13.doCall(RunApp:229)
        at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.ja
va:1231)
        at RunApp$_run_closure8_closure13.doCall(RunApp)
        at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.ja
va:1231)
| Error Error running script –stacktrace: Cannot invoke method findAll() on null object

The solution is use the class full name:

generate-all helloworld.User

helloworld is my application name. and the User class package is “hellowolrd”.

Many thanks for:  generate-all No domain class found for.. error in grails

Grails: Hello world!

Categories: Development Notes; Tagged with: ; @ December 2nd, 2012 23:57

1. Download Grails, unzip.

2. Add the bin path into PATH

3. run: grails –version, if you not set JAVA_HOME yet, there will be some info about this.

now, you are ready to create the application:

 

1.  Run: grails create-app helloworld  there’ll be some mesg about the application path.
Note: can not use this command in “Interactive Mode”

2. cd helloworld

3. Create controller:  grails>  create-controller  hello, get some info after success:

| Created file grails-app/controllers/helloworld/HelloController.groovy
| Created file grails-app/views/hello
| Created file test/unit/helloworld/HelloControllerTests.groovy

4.  Modify the controller:

package helloworld

class HelloController {

    def index() { 
		render "Hello World!!"
	}
}

5. Ok, everything is ready, now, just run the application:  grails> run-app

image

Negative to the page,  the console will be there, click the application link: “Hello world!!”

Excel 首字母大写

Categories: Development Notes分享; Tagged with: ; @ November 28th, 2012 20:38

使用Proper函数只能做到每个单词的首字母大写, 该单词的其余字母会变小写。

但如果有时只需要将首字母大写,剩余字符保持不变, 此种情况下可使用公式操作:

= UPPER(LEFT(A2))&RIGHT(A2,LEN(A2)-1)

 

image

Newer Posts <-> Older Posts



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.