23
Mon, Dec
3 New Articles

Practical RDPi: Supercharge Your Editor

RPG
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Out of the box, RDPi makes programming faster. Now let me show you what happens when you make a few tweaks under the hood to make your editor fly!

 

RDPi is an incredible tool. Whether it's something new like the Screen and Report Designers or something as standard as the LPEX editor, there's almost no part of programming where RDPi won't make your life a little easier. And that's just from day one after installing the tool. However, as powerful as RDPi is, it still has room for some personalization, the kind of tweaks that can make the tool as comfortable as your favorite chair.

 

In my previous article, I showed you the power of base RDPi in making traditional programming changes; in this article, I'll show you how to shave precious seconds off of those repetitive tasks that are so common in our job. Let's see if I can fit five speed techniques in one article, shall we?

First We Need to Venture Where There Be Dragons!

OK, not quite. But we do have to use the dreaded Preferences dialog. Fear not, though, intrepid reader. One of the tips in this article is a trick for navigating the Preferences just a little bit more easily.

 

080410PlutaFigure1

Figure 1: The path to the treasure of user actions leads through the dreaded Preferences menu. (Click images to enlarge.)

 

Shown in Figure 1, the Preferences dialog has rightly earned the sobriquet "The Sargasso Sea of Eclipse." That's because every user setting ends up in here in a huge unwieldy collection of thousands of options. I'm not kidding, either: the General category alone has hundreds of settings. And while the tree control is probably the most logical way to navigate, it's not particularly efficient, especially when digging down several levels. But there is hope!

 

080410PlutaFigure2

Figure 2: RDPi provides a nice way to filter only those options you need.

 

The filter text at the top of the option tree allows you to enter a text string that will be used to filter all the myriad options and categories in the system. Note that this technique not only selects categories whose names match the filter, but also categories that have options whose names match the filter. For example, in Figure 2, the Password Management dialog shows up in the list because it has an option Username (you can't see it because I'm showing the User Key Actions dialog, but trust me: it's there!). Cool, eh? That's speed trick number one. Number two is right on its heels: as powerful as the text filter is, it becomes even more powerful when you know you can use wildcards! For example, "user*act" would have selected only User Actions, User Key Actions, and User Mouse Actions.

Defining User Key Actions

In the previous article, I used a menu option to filter my source code to show only the lines that contained the text I had highlighted. The option can be found under the Edit menu (Edit > Selected > Filter selection), but that's cumbersome; you have to actually move your cursor out of the source code to get to the main menu. The same option exists in the context menu (the one that pops up when you right-click), but even that requires several clicks and a couple of mouse movements. Faster, certainly, but not fast. And we're shooting for cheetah fast. Let's see how we do that.

 

The obvious way is to use a User Key Action. Referring again to Figure 2, you'll see that I've created a new user key action by tying a keystroke (in this case, Alt+F) to a specific editor action, namely filterSelection. A couple of points need mentioning: first, you have to remember the proper shorthand for the keystrokes (well, you don't have to memorize them; they are in the Help for this dialog). Notice that a-f is Alt+F, while a-s-f is Alt+Shift+F. The prefixes are a for Alt, c for Control, and s for Shift, and as you can see, you can combine them. Press Set to add the combination to the list.

 

Productivity tip number three is a two-parter. First, be very careful with your keystroke definition. Not only do you have to manually enter the keystroke (there is no way to capture a keystroke from the keyboard), but you can enter an invalid value and the editor takes it! I did "Alt-f" a few times until I figured that out. Hint: the dialog will show the correct key to the right of the entry field if you enter something syntactically correct. Note: always, always remember to hit the Set button. If you hit OK before hitting Set, the dialog goes away and you lose the action you so laboriously concocted.

 

OK, having created the new action, you can now use it. Hit OK and return to editing your source. Select some text and then press Alt-F in your editor; this will invoke the "filterSelection" action and will filter your source based on the selected text. And that's speed tip four. In fact, tip four is an aggregate tip because it allows you to automate a whole range of actions: you can select any action from the dropdown and tie it to any keystroke. The trick is knowing which action does what. That's primarily investigative testing: configure one and see what it does. Sometimes, there are several that seem to do similar things. An example might be the three commands split, splitAndShift, and splitLine. Each is a variation of splitting a line, with the difference being how much the second line is indented. What I did was assign each one to a different key (I use Alt-1, Alt-2, and Alt-3, because they're easy to remember and don't typically conflict with other shortcuts). Personally, I prefer the splitLine, but I'll leave it as an exercise for you. In another article, I'll try to give a more complete analysis of the various available actions, but let me list a few of my favorites.

 

You already known filterSelected; it filters based on the currently selected code. Another favorite is blockFill, which fills a rectangle. Mark a rectangle using Alt-R and fill it with the same text repeated (think of adding modification marks or commenting out sections of code). A little-known action is hexEditLine. It lets you edit the hex code of a source line. The really cool feature is that it allows you to edit in EBCDIC, ASCII, or even Unicode (see Figure 3).

 

080410PlutaFigure3

Figure 3: The hex editor allows you to edit the hex code of a source using any of several character encodings.

Leaving You with the Mouse

At this point you can double-click on a word (such as a file or field name or an opcode) and then hit Alt-F to filter the source to show only those lines with that code. It's fast, but it's not cheetah fast. Why? Because I still have to switch between mouse and keyboard. Even though I made the keystroke a left-handed one (Alt-F is pretty easy to hit with the left hand), it's not completely fluid. And thus the fifth and final tip: using the mouse!

 

080410PlutaFigure4

Figure 4: This configuration allows me to switch in and out of filtered mode using the mouse wheel.

 

User Mouse Actions is the dialog that does for mouse events what User Key Actions does for keystrokes. The event definition is quite sophisticated; I was surprised by just how many variations of the mouse event you could define. How about Alt-left-button-triple-click? However, a complex action defeated my purpose. I wanted something quick and simple, so I went with the wheel. The wheelUp action means rolling the wheel away from you (toward the top of the mouse), while wheelDown is the opposite. In map software like Google Maps, wheel up zooms in, and wheel down zooms out, so I made wheel up filter the source code ("zooming" into the filtered source) and wheel down executes the showAll action, which "zooms out" to show all the code. A bit of a stretch, but I don't care because now I am truly cheetah fast!

 

Seriously, I can double-click on a file name and push the wheel up to see only the lines where the file is used, see a line I want to review, then click on that line and wheel down to show the code in context at that point. At that point, I can then click on something else and continue the process. This works really well when I'm watching how variables are set: I click on one variable, see where it gets its value, and then click on that variable and filter it, and so on.

 

So there you have it. A quick set of tips for using User Key Actions and User Mouse Actions to supercharge your editor. I hope this inspires you to do a little investigating of your own!

 

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: