Permalink
Browse files

Merge branch 'master' of https://github.com/begoon/stuff

  • Loading branch information...
2 parents 99fb38a + 3ef509b commit a0c7f15278fa8ad7ab62bd39b7126f0a4e777100 @begoon committed Oct 10, 2012
Showing with 2,331 additions and 0 deletions.
  1. +1 −0 devices/xport/backup.cmd
  2. +4 −0 devices/xport/checkout-bin.cmd
  3. +1 −0 devices/xport/clean.cmd
  4. +148 −0 devices/xport/formload.cpp
  5. +12 −0 devices/xport/formload.h
  6. +145 −0 devices/xport/main.cpp
  7. +228 −0 devices/xport/main.dfm
  8. +74 −0 devices/xport/main.h
  9. +126 −0 devices/xport/xportgpio.cpp
  10. +41 −0 devices/xport/xportgpio.h
  11. +127 −0 devices/xport/xporttest.bpr
  12. +33 −0 devices/xport/xporttest.cpp
  13. +13 −0 devices/xport/xporttest.ini
  14. BIN devices/xport/xporttest.res
  15. +7 −0 languages/assembler/i8080/as-test/Makefile
  16. +16 −0 languages/assembler/i8080/as-test/test.asm
  17. +41 −0 languages/c++/fibonacci/fibo_sequence.cpp
  18. +45 −0 languages/php/ucs2/hex.php
  19. +46 −0 languages/php/ucs2/intconv.php
  20. +77 −0 languages/php/ucs2/ucs2.php
  21. +18 −0 languages/python/serial/modem.py
  22. +23 −0 languages/python/threads/threads.py
  23. 0 languages/python/{begemot → xls}/begemon-convert.py
  24. +10 −0 wince/hello/hello.c
  25. +6 −0 wince/hello/hello1.c
  26. +6 −0 wince/hello/hello2.c
  27. +75 −0 wince/hello/simple_window.c
  28. +1 −0 windows/joystick/backup.cmd
  29. +4 −0 windows/joystick/checkout-bin.cmd
  30. +1 −0 windows/joystick/clean.cmd
  31. +129 −0 windows/joystick/joytest.bpr
  32. +33 −0 windows/joystick/joytest.cpp
  33. BIN windows/joystick/joytest.res
  34. +55 −0 windows/joystick/main.cpp
  35. +95 −0 windows/joystick/main.dfm
  36. +35 −0 windows/joystick/main.h
  37. +1 −0 windows/lnkparse/backup.cmd
  38. +1 −0 windows/lnkparse/build.cmd
  39. +1 −0 windows/lnkparse/clean.cmd
  40. +3 −0 windows/lnkparse/lnkparse.bpf
  41. +127 −0 windows/lnkparse/lnkparse.bpr
  42. BIN windows/lnkparse/lnkparse.res
  43. +74 −0 windows/lnkparse/main.cpp
  44. +2 −0 windows/logoff-all/logoff-all.cmd
  45. +57 −0 windows/ntprocesses/ps.c
  46. +65 −0 windows/ntprocesses/ps.cpp
  47. +141 −0 windows/service/actmonitor/actservice.cpp
  48. +1 −0 windows/service/actmonitor/build.cmd
  49. +1 −0 windows/service/actmonitor/clear.cmd
  50. +131 −0 windows/service/actmonitor/example/service.cpp
  51. +3 −0 windows/service/actmonitor/start.cmd
  52. +1 −0 windows/service/actmonitor/stop.cmd
  53. +46 −0 windows/startlist/startlist.php
View
@@ -0,0 +1 @@
+winrar u -v -r -s -m5 -ag-YYYY.MM.DD-HH.MM.SS -x*.rar -x*.zip xporttest
@@ -0,0 +1,4 @@
+upx -9 xporttest.exe
+winrar a -m5 -x*.rar -x*.zip -x*.rar -x*.bmp -m5 xporttest-bin.zip xporttest.exe
+winrar a xporttest-bin.rar xporttest-bin.zip
+del xporttest-bin.zip
View
@@ -0,0 +1 @@
+del *.obj *.~* *.tds *.ddp *.cgl *.err *.dsk *.exe
View
@@ -0,0 +1,148 @@
+#include <typeinfo>
+
+#include <vcl.h>
+#include <Buttons.hpp>
+#include <IniFiles.hpp>
+
+#include <sstream>
+
+#include "formload.h"
+
+void FormLoader::store( TForm* form, AnsiString file )
+{
+ if( !file.Length() )
+ file = ChangeFileExt( Application->ExeName, ".ini" );
+
+ TIniFile* ini = new TIniFile( file );
+
+ try {
+
+ AnsiString section = form->Name;
+
+ ini->WriteString( section, "Left", form->Left );
+ ini->WriteString( section, "Top", form->Top );
+ ini->WriteString( section, "Width", form->Width );
+ ini->WriteString( section, "Height", form->Height );
+
+ for( int i = 0; i < form->ComponentCount; i++ ) {
+ TComponent* c = form->Components[i];
+
+ if( c->Tag == -1 ) continue;
+
+ AnsiString type = typeid( *c ).name();
+ AnsiString name = c->Name;
+ AnsiString value;
+
+ if( type == "TLabeledEdit" ) value = dynamic_cast< TLabeledEdit * >(c)->Text;
+ if( type == "TEdit" ) value = dynamic_cast< TEdit * >(c)->Text;
+ if( type == "TOpenDialog" ) value = dynamic_cast< TOpenDialog * >(c)->FileName;
+ if( type == "TCheckBox" ) value = (int)dynamic_cast< TCheckBox * >(c)->Checked;
+ if( type == "TRadioButton" ) value = (int)dynamic_cast< TRadioButton * >(c)->Checked;
+ if( type == "TSpeedButton" ) value = (int)dynamic_cast< TSpeedButton * >(c)->Down;
+ if( type == "TMenuItem" ) value = (int)dynamic_cast< TMenuItem * >(c)->Checked;
+
+ if( type == "TMemo" ) {
+ TMemo* memo = dynamic_cast< TMemo * >(c);
+ memo->Lines->QuoteChar = '|';
+ value = memo->Lines->DelimitedText;
+ }
+
+ if( !value.Length() ) continue;
+
+ name = name.Delete( name.Length() - type.Length() + 2, type.Length() - 1 );
+
+ ini->WriteString( section, name, value );
+ }
+ } __finally {
+ delete ini;
+ }
+}
+
+void FormLoader::restore( TForm* form, AnsiString file )
+{
+ if( !file.Length() )
+ file = ChangeFileExt( Application->ExeName, ".ini" );
+
+ TIniFile* ini = new TIniFile( file );
+
+ try {
+
+ AnsiString section = form->Name;
+
+ AnsiString window = ini->ReadString( section, "Window", "" );
+
+ form->Left = ini->ReadString( section, "Left", form->Left ).ToInt();
+ form->Top = ini->ReadString( section, "Top", form->Top ).ToInt();
+ form->Width = ini->ReadString( section, "Width", form->Width ).ToInt();
+ form->Height = ini->ReadString( section, "Height", form->Height ).ToInt();
+
+ for( int i = 0; i < form->ComponentCount; i++ ) {
+ TComponent* c = form->Components[i];
+
+ if( c->Tag == -1 ) continue;
+
+ AnsiString type = typeid( *c ).name();
+ AnsiString name = c->Name;
+ AnsiString default_value;
+
+ bool use = false;
+
+ if( type == "TLabeledEdit" ) {
+ default_value = dynamic_cast< TLabeledEdit * >(c)->Text;
+ use = true;
+ }
+ if( type == "TEdit" ) {
+ default_value = dynamic_cast< TEdit * >(c)->Text;
+ use = true;
+ }
+ if( type == "TOpenDialog" ) {
+ default_value = dynamic_cast< TOpenDialog * >(c)->FileName;
+ use = true;
+ }
+ if( type == "TCheckBox" ) {
+ default_value = (int)dynamic_cast< TCheckBox * >(c)->Checked;
+ use = true;
+ }
+ if( type == "TRadioButton" ) {
+ default_value = (int)dynamic_cast< TRadioButton * >(c)->Checked;
+ use = true;
+ }
+ if( type == "TSpeedButton" ) {
+ default_value = (int)dynamic_cast< TSpeedButton * >(c)->Down;
+ use = true;
+ }
+ if( type == "TMenuItem" ) {
+ default_value = (int)dynamic_cast< TMenuItem * >(c)->Checked;
+ use = true;
+ }
+ if( type == "TMemo" ) {
+ TMemo* memo = dynamic_cast< TMemo * >(c);
+ memo->Lines->QuoteChar = '|';
+ default_value = memo->Lines->DelimitedText;
+ use = true;
+ }
+
+ if( !use ) continue;
+
+ name = name.Delete( name.Length() - type.Length() + 2, type.Length() - 1 );
+
+ AnsiString value = ini->ReadString( section, name, default_value );
+
+ if( type == "TLabeledEdit" ) dynamic_cast< TLabeledEdit * >(c)->Text = value;
+ if( type == "TEdit" ) dynamic_cast< TEdit * >(c)->Text = value;
+ if( type == "TOpenDialog" ) dynamic_cast< TOpenDialog * >(c)->FileName = value;
+ if( type == "TCheckBox" ) dynamic_cast< TCheckBox * >(c)->Checked = (bool)value.ToInt();
+ if( type == "TRadioButton" ) (bool)dynamic_cast< TRadioButton * >(c)->Checked = (bool)value.ToInt();
+ if( type == "TSpeedButton" ) (bool)dynamic_cast< TSpeedButton * >(c)->Down = (bool)value.ToInt();
+ if( type == "TMenuItem" ) (bool)dynamic_cast< TMenuItem * >(c)->Checked = (bool)value.ToInt();
+
+ if( type == "TMemo" ) {
+ TMemo* memo = dynamic_cast< TMemo * >(c);
+ memo->Lines->QuoteChar = '|';
+ memo->Lines->DelimitedText = value;
+ }
+ }
+ } __finally {
+ delete ini;
+ }
+}
View
@@ -0,0 +1,12 @@
+#ifndef _FORMLOAD_H
+#define _FORMLOAD_H
+
+#include <vcl.h>
+
+class FormLoader {
+public:
+ static void FormLoader::store( TForm* form, AnsiString file = "" );
+ static void FormLoader::restore( TForm* form, AnsiString file = "" );
+};
+
+#endif
View
@@ -0,0 +1,145 @@
+//---------------------------------------------------------------------------
+
+#include <vcl.h>
+#include <IdTCPClient.hpp>
+#include <ctime>
+#pragma hdrstop
+
+#include "main.h"
+#include "xportgpio.h"
+#include "formload.h"
+//---------------------------------------------------------------------------
+#pragma package(smart_init)
+#pragma link "CPortCtl"
+#pragma link "SHDocVw_OCX"
+#pragma resource "*.dfm"
+TMainForm *MainForm;
+
+// XPortGPIO xportgpio( "localhost", 0x77F0, 50000 );
+XPortGPIO xportgpio( "localhost" );
+
+//---------------------------------------------------------------------------
+__fastcall TMainForm::TMainForm(TComponent* Owner)
+ : TForm(Owner)
+{
+ xportgpio.set_host( XPortIPLabeledEdit->Text );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led1GetButtonClick(TObject *Sender)
+{
+ int v = xportgpio.GetCurrentStates();
+ ComLed1->State = v & 1 ? lsOn : lsOff;
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led2GetButtonClick(TObject *Sender)
+{
+ int v = xportgpio.GetCurrentStates();
+ ComLed2->State = v & 2 ? lsOn : lsOff;
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led3GetButtonClick(TObject *Sender)
+{
+ int v = xportgpio.GetCurrentStates();
+ ComLed3->State = v & 4 ? lsOn : lsOff;
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led1OutSpeedButtonClick(TObject *Sender)
+{
+ xportgpio.SetDirections( 1, 1 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led1InSpeedButtonClick(TObject *Sender)
+{
+ xportgpio.SetDirections( 1, 0 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led2OutSpeedButtonClick(TObject *Sender)
+{
+ xportgpio.SetDirections( 2, 1 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led2InSpeedButtonClick(TObject *Sender)
+{
+ xportgpio.SetDirections( 2, 0 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led3OutSpeedButtonClick(TObject *Sender)
+{
+ xportgpio.SetDirections( 4, 1 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led3InSpeedButtonClick(TObject *Sender)
+{
+ xportgpio.SetDirections( 4, 0 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led11ButtonClick(TObject *Sender)
+{
+ xportgpio.SetStates( 1, 1 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led10ButtonClick(TObject *Sender)
+{
+ xportgpio.SetStates( 1, 0 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led21ButtonClick(TObject *Sender)
+{
+ xportgpio.SetStates( 2, 2 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led20ButtonClick(TObject *Sender)
+{
+ xportgpio.SetStates( 2, 0 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led31ButtonClick(TObject *Sender)
+{
+ xportgpio.SetStates( 4, 4 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::Led30ButtonClick(TObject *Sender)
+{
+ xportgpio.SetStates( 4, 0 );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::XPortIPLabeledEditChange(TObject *Sender)
+{
+ xportgpio.set_host( XPortIPLabeledEdit->Text );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::FormCreate(TObject *Sender)
+{
+ FormLoader::restore(this);
+ CppWebBrowser->Navigate( (BSTR)WideString(CameraURLLabeledEdit->Text) );
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::FormDestroy(TObject *Sender)
+{
+ FormLoader::store(this);
+}
+//---------------------------------------------------------------------------
+
+void __fastcall TMainForm::GoButtonClick(TObject *Sender)
+{
+ CppWebBrowser->Navigate( (BSTR)WideString(CameraURLLabeledEdit->Text) );
+}
+//---------------------------------------------------------------------------
Oops, something went wrong.

0 comments on commit a0c7f15

Please sign in to comment.