WPF - DataContext

정보기술(IT) 2015. 6. 26. 10:03


정보기술 교육을 통해서 언어를 배우는것이 많이 편하다는 생각을 해 봅니다. 인터넷을 이용해서 혼자 공부하는것보다는...

하지만 주변상황이 받쳐주질 못해서 나름대로 공부하는 중입니다.

글로 적는다는것이 눈으로 익힌것을 머리에서 정리할수 있는 도구가 될것 같아서 해 볼려고 합니다.

C# 으로 프로그램을 작성할때 Object Oriented Programming (객체지향프로그램)에 대한 기초지식이 필요합니다.

클래스를 프로그램에서 기본이 되는 요소이겠지요. 클래스는 멤버라는 요소을 가지고 있고 요소값을 제어하기 위한 프라퍼티 라는 접근자가 쌍으로 들어갑니다. 외주에서 클래스의 멤버에 접근할 필요가 없다면 접근자도 필요없겠지요.

WPF 에서 C#으로 프로그램을 작성할때에는 바인딩(DataBinding) 연결고리가 중요합니다.

윈도우에 배치되어 있는 컨트롤의 속성에 Binding 된 값이 있다면 여기에 초기값을 설정할 필요가 있을때 DataContext 로 클래스를 연결하면 값이 배정됩니다.


블로그 이미지

희망잡이

,

1. 명령창에서 netsh wlan show driver 로 실행하면

호스트된 네트워크 지원이 예로 되어 있으면 설정이 가능합니다.

2. netsh wlan set hostednetwork mode=allow  ssid=xxx key=8자리이상

3. netsh wlan start hostednetwork

4. 다음으로 네트워크 환경으로 들어가서 로컬랜으로 공유될수 있도록 설정해 줘야 합니다.


블로그 이미지

희망잡이

,

출처 : https://msdn.microsoft.com/ko-kr/magazine/cc163299

데이타 바인딩과 관련해서 기초적인 인터페이스를 알수 있는 곳입니다.

xml 데이타를 이용하여 binding 한다던지, 아니면 Object 데이타를 이용하여 binding 하는 방법을 알 수 있습니다.


데이터 바인딩과 WPF를 사용한 데이터 표시 사용자 지정

출처 : https://msdn.microsoft.com/ko-kr/magazine/cc700358?f=255&MSPPError=-2147217396


WPF의 라우팅된 이벤트와 명령 이해

출처: https://msdn.microsoft.com/ko-kr/magazine/cc785480

WPF Apps With The Model-View-ViewModel Design Pattern

출처 : https://msdn.microsoft.com/en-us/magazine/dd419663.aspx?f=255&MSPPError=-2147217396


WPF 로 툴만들기

출처 : http://www.gamedevforever.com/258


블로그 이미지

희망잡이

,

한번 해보면 쉬울듯하다.

출처 :http://www.dba-oracle.com/t_heterogeneous_database_connections_sql_server.htm

QUESTION:  What are some methods for connecting from Oracle to other databases such as SQL Server?

ANSWER: By John Palinski


Using Oracle Heterogeneous Services in an Operational Data Store or Data Warehouse

By John Adolph Palinski

I recently received a user request to bring information into the data warehouse for use in combination with other data warehouse tables. On the surface this is a routine task. After all, I often bring transaction processing data into the warehouse using materialized views and other tools such as the Merge statement. However, the database for this request was a non-Oracle database. This created a small problem. I could no longer use the normal Oracle tools to bring this data into the warehouse. I would need a different device. 

In the past, whenever I needed to bring non-Oracle data into the warehouse, I required the production data to be placed into a flat file and I loaded the file into Oracle using SQL*Loader. Creating the source system extraction process, the SQL*Loader script, and the batch processes that move and execute the files required quite a bit of work. In the past, we used this technique for single files. However, the current request was to move an entire production system schema into the warehouse for transformation and loading. This would require SQL*Loader and batch files for three hundred and seventy tables. I really did not want to do this much work so I began to look for an easier method.

Investigating various sources I identified Oracle's Hetergeneous Services. This Oracle feature allows you to set up an ODBC connection inside the Oracle database. This was the answer to my problem. With a little configuration, Oracle can read the non-Oracle database files directly. No batch programs, flat files, or SQL*Loader files. Before setting this up I researched the topic in a variety of sources. Some of them were incorrect, some were not. However, none of them discussed setting up hetergenous services using a remote database. All of the articles discussed setting using Oracle on a local Windows server that had an Oracle installation and the ODBC drivers installed on the server. However, our data warehouse was a Unix server and the ODBC drivers could not be installed on this server. I really needed instructions that discussed how to connect from a Unix platform using Oracle to ODBC drivers located on a Windows server. This article describes the steps needed to set up heterogeneous services on a Unix data warehouse server that reads a Sybase database on another server. These same steps can be applied to any non-Oracle database that has ODBC connectivity.

Infrastructure

The infrastructure is illustrated in Figure 1. The following bullets describe the structure:

- The target system is a Sybase database residing on Windows XP server X.
- Server X has Sybase ODBC drivers installed.
- Server X has an Oracle server or code tree installed. Server X does not have the Oracle database installed. 
- The data warehouse resides in an Oracle database on Unix server Z.
- The users will access the Sybase database through the Oracle installation on server Z. 



Problem

The data warehouse residing on the Oracle installation on server Z needs to communicate and query the Sybase database on server X. 

Setup Tasks

Below is a series of steps that are needed to set up the hetergeneous services. The actual code will be discussed following these steps.

1. Install ODBC drivers on the server (server X) that is to actually access the Sybase database. 
2. Setup the ODBC connection on server X using the Windows ODBC Data Source Administrator
3. Test the ODBC drivers to ensure that connectivity is made to the non-Oracle database.
4. Ensure the Global_names parameter is set to False.
5. Install an Oracle server (or code tree) or an Oracle database on the same server (server X) as the ODBC drivers.
6. Configure the Hetergeneous services. This consists of creating an initodbc.ora file within the Oracle installation on server X.
7. Modify the Listener.ora file on server X used to connect to the Oracle instance and ODBC drivers.
8. Modify the Tnsnames.ora file on server Z . This is the Oracle database installation accessed by the users to connect to the ODBC drivers
9. Reload the listener on server X
10. Create a database link on the Oracle installation (server Z) that accesses the heterogeneous connection.
11. Run a Select statement for the Oracle installation (server Z) using the database link.


Step 1

The first step in setting up hetergeneous services is to install the ODBC drivers on the Windows server (server X) that is to directly access the non-Oracle database. In the case of Sybase, this is Adaptive Server Anywhere 9.0. You can identify the current installed drivers on the ODBC Data Source Administrator. Launch this dialog box using this path: Start/Settings/Control Panel/Administrative Tools/Data Sources. Figure 2 depicts the dialog box. The System DSN tab page is shown. This tab page shows the System data sources defined and the associated drivers. You will need to define a DSN for the non-Oracle Sybase database.

Steps 2 and 3 - Seting up and testing the ODBC

The first task in setting up the ODBC driver is to configure the ODBC. This requires you to set up a System DSN (or data source name). Perform the following:

- Launch the Create New Data Source dialog. On the System DSN tab page (Figure 2), press the Add button. This opens the Create New Data Source dialog box (Figure 3).

- Select the appropriate driver and press the Finish button. This launches the ODBC Configuration Dialog box displayed in Figure 3. 

The ODBC Configuration dialog box (Figure 4) is a five tab dialog box and settings will be needed on the first four tabs. The tabs and modifications are:

ODBC - Enter a name for the remote data source (mandatory). This can be a custom name. For our example the name will be Cas30c. You may also enter a description for the remote data source (optional). This can be the actual network sever name or a TCP/IP alias
Login - Enter a remote data source user id and password or use the integrated login
Database - Enter the remote server name. This is the System DSN created on the remote database. Enter the actual remote database name. 
Network - Select the appropriate network protocols. For example, check TCP/IP and IP=Network_server_name. Network_server_name is the actual network server name. 

- Return to the ODBC tab. Press the Test Connection button. If it returns a success message you are ready to begin setting up the Heterogeneous services in Oracle.

Step 4 - Ensure the Global_names parameter is set to false

Execute the following query to determine the parameter setting:

Select *
from v$parameter
where name like 'global_names%'

If the parameter is set to True, you must modify the Init.ora file and restart the database.

Step 5 - Install an Oracle server on server X

In this step you must install an Oracle server on the same server as the ODBC drivers. This installation can be a database or simply the code tree. If the users will not access Oracle directly from this server the code tree is perfectly acceptable.


Step 6 - Setup the Heterogeneous Services file on server x

You will need to document the parameters that Oracle needs to locate and execute the ODBC drivers. Follow these instructions:

- Locate the Oracle_home/hs/admin/initsodbc.ora file.
- Save a copy of this file renaming it per the following template:

initDSNNAME.ora (i.e. initcas30c.ora)
DSNNAME is the DSN value set up on server X containing the ODBC (Figure 4). 
- Open the init.ora file.

Locate the line "HS_FDS_TRACE_LEVEL = ". Change to OFF
Locate the line "HS_FDS_CONNECT_INFO = ". Change to the data source name.
# This is a sample agent init file that contains the HS parameters
# that are needed for an ODBC Agent.

#
# HS init parameters
#
HS_FDS_CONNECT_INFO = Cas30C
HS_FDS_TRACE_LEVEL = off

#
# Environment variables required for the non-Oracle system
#
#set =

Step 7 - Configuring the Listener

The Listener on server X accessing the Oracle database must be configured to point to the Heterogeneous Services entry created in step 6. Create an entry in the SID _LIST similar to the one below. The bolded part is the actual entry. Note the following:

SID_NAME is the DSN for the remote database.
ORACLE_HOME is the actual Oracle home file path.
PROGRAM tells Oracle to use heterogeneous services. This particular entry tell Oracle to look for the initcas30c.ora file defined in step 5.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME=Cas30C) -- Enter the DSN on this line
(ORACLE_HOME = c:\oracle10gdb) -- Enter your Oracle home on this line
(PROGRAM = hsodbc)
)
)

Step 8 - Configuring Tnsnames.ora

Oracle needs to know where to look for the remote database when it is called. This requires an entry in the Tnsnames.ora file in every Oracle instance that will be calling the remote database. In the case of our article, the Tnsnames.ora file entry must be on server Z. The Oracle installation on server X does not require this modification since this Oracle installation will not be directly used by a user. The server X Oracle installation is simply the path from Oracle's listener to the ODBC drivers. The following example can be followed:

Cas30c.world = -- This name can be customized
(DESCRIPTION=
(ADDRESS_LIST=
(Address=(PROTOCOL=TCP) 
(HOST=
-- (Server x) 
(PORT=1521))) -- Enter the port on which the server x Oracle installation
-- is listening
(CONNECT_DATA=(SID=Cas30c)) - Enter the DSN name
(HS=OK) -- Enter this value. It tells Oracle to use hetergeneous 
-- services
)

Step 9 - Reloading the listener

At this point the infrastructure is in place. You will need to reload the Listener.ora settings you defined in Step 7. They must be in place on server X. There are several methods. Execute one of the following from the command line:

Lsnrctl reload

or 

Lsnrctl stop
Lsnrctl start

After completing this step, you should check whether the listener and Tnsnames.ora file are configured correctly. On the server accessing the data (server Z) issue a Tnsping command from the command prompt. If Oracle can contact the server X Oracle installation, the configuration is correct and a response is seen. The following exemplifies the command.

Tnsping cas30c

Step 10 - Create a database link

The last step in the procedure is to create a database link on each installation that will view the non-Oracle data (Server Z). In order to acccess the non-Oracle database, each Oracle ID must know how to contact the database. The database link is placed after the non-Oracle data source reference. The database link contains the Tnsnames reference (Cas30c) along with the remote data user id and password. When the SQL statement containing the link is executed, Oracle reviews the Tnsnames.ora file to locate the server and listener port for the ODBC database. A message is then sent to that server. The listener identifies the signal, locates the hetergeneous services entry, and uses the ODBC drivers to perform the work. The results are sent back through this channel. 

There are a variety of database link options. This example is one that contains the remote database userid and password.

Note:  it's important that the username and password must be in double quotes.

create database link ODBC connect to "sa" identified by "pencil" using 'hsodbc'.

create [public] database link link_name connect to "user_name" identified by "password" using 'cas30c';

You have now completed the configuration. You can test the configuration by executing a Select statement against the non-Oracle database. 

Select * from table_name@link_name;

If you need to have data outside the Oracle database, you will find this a great tool for making it transparent to the Oracle user.

Common errors in heterogeneous services:

A common error when connecting to SQL Server from Oracle through a  database link is the ORA-28500, suggesting that the Oracle database login is incorrect.

ORA-28500: connection from ORACLE to a non-Oracle system returned this message:

[Transparent gateway for ODBC]DRV_InitTdp: [DATADIRECT][ODBC SQL Server Driver][SQL Server] Login failed (SQL State: 28000; SQL Code: 4002)

ORA-02063: preceding 3 lines from HSTEST

Cause: The Oracle database link created for the foreign datasource has either no credentials or incorrect credentials.


Action: Recreate the Oracle database link with the proper username and password.

 When  resolving the ORA-28500 error it's important to note that the username and password must be in double quotes:

create [public] database link 
   link_name 
connect to 
   "user_name" 
identified by 
   "password" 
using 
   'cas30c';

For example, this would create a viable ODBC database link between Oracle and SQL server, being careful to encase the user name and password in double quotes.  This is perfect for migrating to Oracle:

create database link ODBC connect to "sa" identified by "pencil" using 'hsodbc'.

If you encase the login and password in double quotes and the tnsnames reference in single quotes, then it works perfectly.   (Special thanks to Steve Wales for this tip!)

블로그 이미지

희망잡이

,

기존에 마이크로소프트 운영체제의 PC만 사용하다가 이번에 큰 마음먹고 애플 맥에어를 구입했네요.

한단계씩 알아가는 과정에 있습니다.

업무을 보는 주 PC는 마이크로소프트 운영체제 이다 보니 애플 맥에어에서 원격으로 접속하는 방법이 필요할듯 합니다.

그래야 애플 맥에어 만 있으면 원격으로 PC에 접속해서 긴급한 내용을 처리할 수 있지요.

구지 애플 맥에어에 마이크로스프트 운영체제를 설치할 필요도 없고 하고 싶지도 않아서요.

알아보니 두가지 접속할수 있는 프로그램이 있네요.


1. 마이크로 리모트 데스크탑(Microsoft Remote Desktop)

 => 애플 앱스토어에서 다운로드 할수 있으며 마이크로소프트사에서 지원

 => OS X 10.7 버전 이후 가능


2. CoRD 프로그램 설치

 => CoRD works on Mac OS X 10.5 - 10.8 and only with Microsoft's Remote Desktop Protocol


지금 내가 가지고 있는 OS버전이 매버릭스 라서 마이크로 리모트 데스크탑을 설치해야 할듯 하네요.


블로그 이미지

희망잡이

,


SQL문에서 더해서 합을 구하는 함수는 대표적으로 Sum 을 사용합니다.

그러면 곱해서 합을 구하는 함수는?

Ln 함수를 사용해서 계산해야 됩니다.


Log의 성질은 기본수를 얼마나 많이 곱해서 결과값을 수를 만들어 낼수 있는지를 보여줍니다.

How many of one number do we multiply to get another number?

example : How many 2s do we multiply to get 8?

The logarithm tells you what the exponent is!

로그의 정의를 사용해서 곱셈의 합을 구할수 있습니다.

MUL (num) = EXP (SUM (LN (num)))

Not very clear at first, I agree. Lets review the maths behind it:

x = (2 * 3 * 4)
ln(x) = ln(2 * 3 * 4)
ln(x) = ln(2) + ln(3) + ln(4) => SUM(LN(num))
ln(x) = .693 + 1.098 + 1.386
ln(x) = 3.178
x = e (3.178) => EXP(SUM(LN(num)))
x = 24

BOM에서 소요량을 계산하기 위해서는 이 공식을 사용해야 합니다.

참고사이트 : http://blog.daum.net/turnnig-pointer/16498271

참고사이트 : http://viralpatel.net/blogs/row-data-multiplication-in-oracle/



블로그 이미지

희망잡이

,



Microsoft Visual Studio 를 실행해서 화면을 구성할때 에러가 발생했습니다.

Visual C# - WPF 응용프로그램을 선택해서 솔루션 및 프로젝트를 생성합니다.

예제)How to create a simple layout of dock panes

=> https://documentation.devexpress.com/#WPF/CustomDocument6654

이 예제를 먼저 따라해 보았습니다.


강사가 이야기 했던 지렁이가 보이네요. 왜 에러가 발생하는가?

미리 만들어져 있는 오브젝트를 사용하기 위해서는 2가지 작업이 선행되어야 합니다.

1. 네이밍스페이스를 지정합니다.

2. 참조(Reference)에 해당 오브젝트가 담긴 라이브러리를 등록합니다.


여러분 프로젝트의 참조영역에 아래의 라이브러리를 수동으로 추가하는 주의사항이 있더군요.

DevExpress.Data, DevExpress.Xpf.Bars, DevExpress.Xpf.Core, DevExpress.Xpf.Docking and DevExpress.Xpf.Layout.Core

추가작업을 하면 에러메시지가 없어질 것입니다.


블로그 이미지

희망잡이

,



엑셀파일로 차트 작성하는 방법을 적어 볼려고 합니다.

3D 칼럼 차트를 쉽게 만들수 있습니다.

엑셀로 열은 가로축의 묶음이 되고 행은 범주(Category) 가 된다고 생각하면 됩니다.

A2 ~ D5 영역을 선택한 다음에 매뉴로 가서 삽입매뉴에서 차트영역에서 원하는 차트를 선택하시면 됩니다.



블로그 이미지

희망잡이

,