Skip to content

Instantly share code, notes, and snippets.

View fushnisoft's full-sized avatar

Brahn Partridge fushnisoft

View GitHub Profile
@fushnisoft
fushnisoft / clariondate.sql
Last active January 5, 2024 14:33
Convert a Clarion Date (INT) to SQL DateTime
DECLARE @ClarionDate INT = 47563
DECLARE @SqlDateTime DATETIME
-- Convert the clarion DATE into and SQL DateTime
SET @SqlDateTime = DateAdd(day, @ClarionDate - 4, '1801-01-01')
SELECT @SqlDateTime AS 'SQL Date Time'
-- Now convert it back from and SQL DateTime to a Clarion Date
SET @ClarionDate = DateDiff(day, DateAdd(day, -4, '1801-01-01'), @SqlDateTime)
@fushnisoft
fushnisoft / MyTable.xml
Last active December 20, 2015 02:09
data\options\TextLib\MyTable.xml
<TextLibrary name="My Table">
<Text display = "My Label" value = "drop value" />
<Text display = "My other label" value = "other drop value" />
</TextLibrary>
$rtn = New-Object psobject -Property @{"Value"=$null; "name" = $null; "path"=$null}
1..500 |
ForEach-Object {
$rtn.Value = $_
$rtn.name = (new-object -com shell.application ).namespace($_).title
$rtn.path = (new-object -com shell.application ).namespace($_).self.path
if($rtn.name -ne $null)
{
Write-Host "$($rtn.value) $($rtn.name) $($rtn.path)"
}
@fushnisoft
fushnisoft / OcxIsRegistered.clw
Created August 29, 2013 17:01
OcxIsRegistered concept... NOTE: code not compiled or tested. I am mostly not sure if the second call to OleDirectory appends or replaces the contents of the QUEUE
OcxIsRegistered PROCEDURE(STRING pName) ! ,BYTE
resultQ QUEUE(oleQ)
END
CODE
OleDirectory(resultQ, 0, 3) ! <-- OLE Servers
OleDirectory(resultQ, 1, 3) ! <-- OLE Controls
Get(pResultQ, 0)
LOOP
Get(pResultQ, Pointer(pResultQ)+1)
IF ErrorCode()
@fushnisoft
fushnisoft / GetJsonData.clw
Created September 15, 2013 19:31
Example of implementing a really, really basic DLLExport of Newtonsoft.Json reader and writer in Clarion. But it works pretty darn well! http://james.newtonking.com/projects/json/help/html/ReadingWritingJSON.htm
GetJsonData PROCEDURE(LONG pDate)
Json JsonClassType
CODE
Json.Init()
Json.InitWriter()
Json.WriteStartObject()
Json.WritePropertyName('key')
Json.WriteValue('ASDR-WERT-DFGG-RRTY')
@fushnisoft
fushnisoft / ConsoleSupport.clw
Created September 19, 2013 15:05
Clarion console app!
Member()
Include('ConsoleSupport.inc'),ONCE
Map
MODULE('32-bit Windows API')
! General functions
GetLastError(),DWORD,PASCAL
! Console functions
GetStdHandle(DWORD),HANDLE,PASCAL,PROC,RAW
WriteConsole(Handle,Long,Dword,long,long),bool,Raw,Pascal,name('WriteConsoleA')
@fushnisoft
fushnisoft / cwprope.ps1
Created October 2, 2013 17:14
Use powershell to updated an attribute in ClarionPRoperties.xml
$doc = New-Object System.Xml.XmlDocument
$doc.Load("C:\Dev\Clarion\ClarionProperties.xml")
$XPath = "/ClarionProperties/Properties[@name='WorkbenchMemento']"
$node = ( $doc | Select-Xml -XPath $XPath ).Node
$node.bounds.value = "1,2,3,4"
$doc.Save("C:\Dev\Clarion\ClarionProperties.xml")
@fushnisoft
fushnisoft / CwGet.md
Created October 7, 2013 14:47
Proposal for a Clarion package manager. Possible names: CWGe, CWPackageManager, CWPackage, ClarionGet ?

**Note: The idea for this is based on a combination of PsGet, http://psget.net/ and SublimeText Package Control, https://sublime.wbond.net/ **

  • Easy install via powershell

(new-object Net.WebClient).DownloadString("http://ClarionHub.com/GetCwGet.ps1") | iex

Proposed commands:

  • cwpackage-install
  • cwpackage-update
@fushnisoft
fushnisoft / RefHandler.clw
Last active December 25, 2015 21:18
My fugly ref handler. I wanted to be able to have dynamic length strings stored in a clarion table (IMDD in particular). This is intended for a very specific situation and does not attempt to deal with threading, multiple tables, or any other fancy things but it appears to work well enough for my needs in this case! my_CStringClass could be anyt…
MEMBER()
INCLUDE('RefHandler.inc'),ONCE
MAP
END
RefHandler.Init PROCEDURE(*LONG pTheField)
CODE
IF pTheField = 0
! Create a new instance and assign the address to the storage field
@fushnisoft
fushnisoft / test.clw
Last active December 29, 2015 02:19
string ref test. Console output shows: c:\Dev\Console\>Console.exe thisString = hi there! null
PROGRAM
Include('ConsoleSupport.inc'),ONCE
Console ConsoleSupport
MAP
Main PROCEDURE()
MyTest PROCEDURE(<*STRING pString>)
END
CODE