Monday, September 5, 2016

C# Windows form application DataBinding Example. 윈폼 데이터바인딩 예제

C# Windows form Application에서 DataBinding 사용하기.

데이터를 폼 컨트롤에 연결하여 사용하기.

1. 클래스를 만든다.
2. Collection을 만든다
3. CurrencyManager를 만든다
4. 폼위의 컨트롤에 Binding 한다.
5. CurrencyManager의 Position을 제어한다.



        public class NameValue

        {

            public NameValue(string n, string v)

            {

                Name = n;

                Value = v;

            }



            public string Name { get; set; }

            public string Value { get; set; }

        }





        private CurrencyManager currencyManger = null;

        List<namevalue> data = new List<namevalue>();



        private void Form1_Load(object sender, EventArgs e)

        {

            data.Add(new NameValue("1", "aaaa"));

            data.Add(new NameValue("2", "bbbb"));

            data.Add(new NameValue("3", "cccc"));

            data.Add(new NameValue("4", "dddd"));



            currencyManger = (CurrencyManager)this.BindingContext[data];

            currencyManger.Position = 0;



            textBox1.DataBindings.Add(new Binding("Text", data, "Name"));

            textBox2.DataBindings.Add(new Binding("Text", data, "Value"));

        }



        private void button1_Click(object sender, EventArgs e)

        {

            if (currencyManger.Position + 1 &gt;= currencyManger.Count)

                currencyManger.Position = 0;

            else

                currencyManger.Position++;

       

        }

Friday, August 12, 2016

Adobe premiere pro 478 error

Adobe Premiere pro cs 5.5 에서 premiere pro has encountered an error cpp-478 가 나면서 효과를 사용할 수 없게되면 C:\Program Files\Adobe\Adobe Premiere Pro CS5.5\Support Files\AMTLanguages 에 있는 ko_kr.txt 파일을 삭제하세요.

Tuesday, July 19, 2016

어셈블리 리소스에서 이미지 읽기 (Load image from assembly resource)

using System.Reflection;
using System.Resources;

public static object LoadProjectResource(string strResName)
{
      Assembly assembly = Assembly.GetExecutingAssembly();
      string strBaseName = assembly.GetName().Name + "." + "Properties.Resources";
      ResourceManager rm = new ResourceManager(strBaseName, assembly);
      return rm.GetObject(strResName);
}

// 사용방법  hello 라는 이미지가 프로그램(어셈블리)리소스에 있다면
Image1.Image = LoadProjectResource("hello");


단일 전원에서의 OP-AMP 비반전 회로 구성(Audio Op-Amp on Single supply)

오디오용 Non Invert op amp 구성임.

SingleSupply일 경우 C2가 꼭 필요함. R5,R6은 Bais용임.
C3는 Cutoff 주파수를 결정함.
R5,R6이 너무 작으면 낮은음이 작아짐.

LM32x는 전원을 9V는 써줘야 하고 TL97x와 같은 Rail to rail opamp를 사용하기를 권장함.




Saturday, April 16, 2016

raspberry pi 새 ip address가 잡히지 않을때. assign new ip address in /etc/network/interfaces but not working.

/etc/network/interfaces 파일에 static 으로 ipaddress를 지정한 후
아래와 같이 네트워크 서비스를 다시 시작한다.
sudo /etc/init.d/networking reload


------------------------------
modify /etc/network/interfaces file to static and ip address. and restart network service

type bellow.

sudo /etc/init.d/networking reload


Saturday, March 26, 2016

c# .Net SoapClient의 첫번째 요청이 느리게 처리될때(Slow Soapclient first time)

프로젝트의 app.config 파일에 서버 호스트 이름을 proxy bypass 하도록 한다.

IP주소든 도메인 이름이든 상관 없다.

<configuration> <system.net> <defaultProxy> <bypasslist> <add address="서버호스트이름(host name)" /> </bypasslist> </defaultProxy> </system.net> </configuration>



---------------------------------------
append host name ( or ipaddress, domain name )  to bypass list



Sunday, March 20, 2016

HttpWebRequest의 첫번째 동작이 느릴때. ( HttpWebRequest slow first time )

HttpWebRequest의 Proxy 설정을 null 로 해주면 해결된다.


 HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create( URL );
 httpRequest.Credentials = CredentialCache.DefaultCredentials;

 httpRequest.Proxy = null;

 httpRequest.Method = "GET";
 httpRequest.KeepAlive = false;

 HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();
 System.IO.Stream dataStream = httpResponse.GetResponseStream();
 System.IO.StreamReader streamReader = new System.IO.StreamReader(dataStream);

 String responseText = streamReader.ReadToEnd();

 dataStream.Close();
 streamReader.Close();
 httpResponse.Close();


-------------------
problem : very slow response when first request.
solution : assign null to Proxy attribute.