Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 587
  • Last Modified:

How to create a GUI front end to create customized batch scripts

First off, I admittedly know very little about programming. With that said, it seems as though what I want to program should be fairly simple to do. Below is my objective:

I'd like to create a GUI front end to automate the creation of batch scripts depending on the input I've given in the GUI itself. The output would create batch scripts that expand tablespace sizes in Oracle databases.

I already know how to write the batch scripts but I'd like to be able to somewhat automate the process to make it quicker and easier for me and my teammates.

Basically I just want the script to have two columns. One for the tablespace name and the other for the size of the tablespace which could compute how many total tablespaces need to be created (for example, if the maximum tablespace size is 1 gig and I need 4 gigs of tablespace, it would know to create 4 lines in the batch script with each tablespace name increasing, i.e. table01.dbf, table02.dbf, etc.).

Then I'd simply like for there to be some sort of execute button to create the batch script and run it.

I know about autoextending tables and ASM but that's not my objective right now. I'm trying to create a simple GUI to automate the creation of these batch scripts.


Any help would be greatly appreciated. If I should use a language other than C+ let me know. One guy suggested using an Oracle language that is web-based but that's not really what I'm looking to do. Thanks in advance.
0
SysAdminWVU
Asked:
SysAdminWVU
  • 4
  • 3
  • 2
  • +2
1 Solution
 
DanRollinsCommented:
Assuming you vave Ms Visual C , I can tell you how to get started:
Use the AppWizard to create a new dialog-based MFC application.
The Dialog Editor appears. Draw in:
Two Text Edit boxes and add Static text labels to the left of them:
tablespace name [                           ]
              size in MB [       ]
At the bottom draw a larger Text Edit and set its properties to Multi-Line.
Batch file output:
|                                             |
|                                             |
|                                             |
in between, add a button: [Generate Batch file]]
Double-click that button and now write the C++ source code thatt will take the data fron the top two input boxes and decide what to do with it.  When the logic is finished, you should have a CString of text that contain all of the steps of the batch file.
Use SetWindowText to set those lines into the lower box, for visual inspection.
This is the starting point. Eventually you will add another button that will execute the batch file, but at this point I'm not certain that you even have Visual C++, let alone if you have ever coded in C++ ... so I'll let you get started.  When you run into problems, let me know by adding a comment here
0
 
maartennieberCommented:
Hi,

the answer depends on whether you want to invest in building skills that will allow you to develop similar tools in the future.

If the answer is no, then my suggestion is to use Java and NetBeans. NetBeans is the application inside which you develop your Java application.

- NetBeans has a good graphical GUI editor
- NetBeans offers a lot of support for programmers. For example, it signals your mistakes (as soon as you make one, for example by forgotting a closing bracket).
- There are many tutorials on creating GUI applications in Java
-Java is a nice language

You need probably a day to install NetBeans, get familiar with it, and create a basic screen with buttons and text fields. Then I suggest reading about file streams in Java (for writing the batch files). Still, don't be surprised if it takes a week to build your application.

The other option (if you want to invest in tool-building skills) is Python and wxFormBuilder (an application to create GUIs for Python; it generates XRC files which you will need to learn how to import into your Python program).

The advantage of Java over Python is that there is better support for beginning programmers. In particular, creating a simple GUI requires less learning than in Python.

The advantage of Python over Java is that in general Python programs are >much< shorter (with less code you can do more) while also being very readable (however, it is always possible to create a mess), In practice, shorter programs are faster to write and take less time to maintain.

I would NOT use C++. It is much more low level and it is easy to create bugs in your program (or run into all kinds of technical programs, with the linker for example) that are difficult to solve.
0
 
SysAdminWVUAuthor Commented:
I will be looking into both of these solutions very soon. I don't have a moment to just this second but I won't let either of these excellent answers go untested.

I will get back to you once I have a free moment to test them.

Thanks!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SysAdminWVUAuthor Commented:
I've just completed installing Visual C++ 2008 Express Edition to go ahead and give it a try.

I'll see how far I can get into this without another hiccup.
0
 
mrjoltcolaCommented:
Having done this sort of thing as a production DBA, I recommend forgoing the GUI route, its overkill. You can choose a good scripting language like Perl or Python that will be available in most computing environments (particularly Perl will be in any Oracle install), and write a command line program that could be run like:

mktablespace -name tablespace1 -size 100G -datafilesize 4G

For a programmer who has no experience writing GUIs in any language, you'll spend hours just learning an IDE and programming environment, whether it be Visual C++/MFC, .NET, Java Swing or a Perl or Python GUI kit. Or you could just get right to work writing a command utility and skip the GUI. Why spend hours writing a GUI that will only have 2 options and a button?

You might also want to fancy it up a bit so you can enter your oradata mount points and the script will "stripe" the datafiles across those mount points.
0
 
mrjoltcolaCommented:
If you still want a GUI, as far as "utility GUI" coding, MFC/C++ is not beginner friendly. I'd create a .NET application, its about as point and click as you can get in Visual Studio. Use the Visual Studio wizard, point and click, drag a button and a couple of widgets on and double click the button and write code. MFC is just a bit more involved and you really need to learn a bit more to be productive.

Nothing against MFC, I actually write & sell commercial applications in MFC, its much leaner and more powerful than .NET for an experience Windows programmer, however, for a beginner, its definitely not the way to go.


0
 
DanRollinsCommented:
With MFC and using the AppWisard to create a dialog-based app, there is very little learning curve to get started.  I think MFC complications only come when one gets into the document/view architecture, etc.  A simple dialog-based app is a good way to start:  Drag some widgets, double-click a button and start coding.
0
 
evilrixSenior Software Engineer (Avast)Commented:
>>  I recommend forgoing the GUI route, its overkill.
For what it's worth I agree. UNless this is to be an end-user application it's far simpler to keep it as a command line application. The other advantage of a CLI application is that they are easy to automate (so you can automate your automation :) )


>> You can choose a good scripting language like Perl or Python
Again, completely agree. Perl and Python are reasonably easy to learn (in fact, Python is a very good language to learn for a new programmer since it promotes good programming idioms).

Anyway... this comment is just to pass on my opinion, please do not accept it as an answer, the posts above have already given you good feedback to consider.

-Rx.
0
 
SysAdminWVUAuthor Commented:
So if I forego the GUI...then how exactly will I be saving time over manually creating the commands?

I'm creating this is a timesaver. In my line of work when we do certain upgrades of the product I work with, it typically takes around an hour to masnually expand all of the tablespaces needed during that upgrade process.

With a GUI creating the batches it seems like I could shave that down to ten miuntes or so and saving our clients valuable downtime.
0
 
mrjoltcolaCommented:
Well, GUI or not, your goal is to write a program to accept input from you and generate DDL, right? GUI vs command line has nothing to do with it.

A GUI will have to be executed, then the user inputs his options, then clicks Run.
Command line will be executed with the options on the command line, or the program will prompt in text mode.

I had a Perl script that was a DBA interface, and all the user had to do was run it. It offered a text menu, such as tablespace maintenance, and then would list the available tablespaces, the DBA would pick by number, then enter a size.

You don't have to take that route with prompts, etc. but the point is the SQL/DDL generation is not a product of GUI vs command line. The DDL generation happens after you have collected the input. I assume you would just write the SQL out to a file (which could also be specified by the user).
0
 
SysAdminWVUAuthor Commented:
The way I currently have the batch script written is to automatically login to the SQL database and automatically increase the tablespaces based on the input I've place in there.


I'm simply looking to make a GUI (or not) that will automatically fill out the input for which tablespaces need to be extended.
0
 
evilrixSenior Software Engineer (Avast)Commented:
>> I'm simply looking to make a GUI (or not) that will automatically fill out the input for which tablespaces need to be extended.
Well, if you really want to make a GUI then your simplest (IMHO) bet is to write something using C# or VB.Net using ADO.Net to make the database connection. You can design your GUI suing either WinForms of WPF.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now