XML to drive very generic queries

So I had the idea for a project that the easiest way to get some customization into a dB driven system is to use XML – but that would require an engine being built in some platform. Most of the horsepower for his part of the project is in SQL server. So I went surfing. Here is an article by a sheer genius Wayne Ackman who is doing what I require -> XML to SQL statements being executed.

The only thing I have to do is to ensure that primary key can be overridden in a very generic way for an update. Other than that it is perfect.

SQL Connections, Drivers and ODBC drive me crazy. Here is one that worked. Import to Excel from SQL Server

What I am rying to do is use a stored proc in SQL Server and feed it some parameters making it dynamic. What the stored proc does is a query to an excel spreadsheet and compares whats different in a SQL database. The crazy part was that

  • using ADODB in VBA worked once under certain conditions,
  • MSQuery works in others and …
  • doing it with eh Import Data Wizard from the Data tab for SQL Server did NOT work – which is the one you would expect WOULD work best (the native one)

So – I noticed that MSQuery worked Continue reading

VBA Classes 101 links

I often have to refer to this so here are some bookmarks to remember.

  • this is a good primer once you have the over all syntax. I uses classes often – just not my own so much in VBA since the application is different. I usually do “get in -= do = get out” programming in VBA.
  • mix it together with this syntax from top to bottom and … voila. Instant class.
  • For private properties, you cannot prefix with an _ or underscore. That is too bad but p_ will do just fine.

AutoCad copy/paste to and From Excel

I am not sure why this seems so hard – there must be a good reason that I don’t understand, but upon a copy/paste to and from Excel, it is seems oddly strange that AutoCAD does not auto-translate into the standard that is common across the whole world. I know one can link and some other shortcuts, but  mostly , designers want to just get info in and out of AutoCAD.

Anyways, here are some links that I followed to to make routines to copy/paste to and from Excel easily.

 

Drive Space getting you down – automate it…

Drive Space for local backups (local mean QUICK backups) can get ownerous and it constantly needs user interaction. Well lets put a stop to that and fullfill a dream I have.

  1. a) cull either on a date or file limit basis
  2. b) cull rules are to keep
  • last item in the year
  • last item in the month
  • last day in the week
  • last hour in the day

So a way to start is to simply

  • make a file list
  • mark the end of all the years, months, weeks, days and hours
  • delete all else until our time or date criteria is met

Lets get going … Continue reading

AutoCAD auto cleanup – a script on close

Research links:

  • talk of general cleanup that one should do
  • triggers in AutoCAD are called reactors (this is a good starter article)
  • A colleague mentioned not to do anything that takes up too much time on a document close reactor – because it triggers AFTER the close has been issued.
    • I suggested on a save? And the answer was yes, overwrite the qsave function and call a qsave at the end of that routine.
  • we are looking for a drawing reactor – when the doc saves. It mentions to use the vlr-types command to return a complete list of available reactor types.
  • a “before close” reactor … almost exists – read this. Yes – this is the ticket. Change “CLOSE” to “QSAVE” or “QUIT” … or all 3 if you wish. It works.

Continue reading

A really quick way to format your XML – use Notepad++ with the ‘XML Tools’ plug in

What someone asked me was to make the xml readable, and I needed it last week too. The term is called “pretty print” and that is the function or procedure that needs to be performed on the text to make it work.

What I use is Notepad++ with the tool plugin called “XML Tools”. Simply

  • download Notepad++
  • do the updates it recommends (it will restart)
  • click the menu Plugins->Plugin Manager->Show Plugin Manager
  • scroll down to XML Tools, check it and click Install ( if you already have it it might be the Installed tab)
  • Then perhaps after a restart
    • paste in your xml text (it must validate – which is one draw back about this tool – but that can be solved by a gazzillion online validators assuming your data is not too private (try this, or this, or this – sometimes all 3 will do the trick believe it or not. Fiddle with the options too.)
    • highlight the text (not sure if that is necessary but I do it and it works) then
    • choose the menu item Plugins->XML Tools->Pretty Print (XML Only with line breaks)
      • feel free to experiment with the other kinds.