Problem with large int (Int64) support; string conversion

General discussions related to APLNext's VisualAPL.

Moderators: Tech Support, phpbb_admin

Problem with large int (Int64) support; string conversion

Postby Chris McIntosh » August 3rd, 2011, 12:49 pm

I'm trying some workarounds right now for sorting and processing some large (12 digit, one character) keys. I'm trying to strongly type variables for faster execution speed. Normally, I wouldn't bother, except for some reason my code seems to be executing exceedingly slowly, on the order of hours rather than minutes (or less).

Here's the code.

// Declarations.
String KeyString
Int64 NumTypedFi
Int64 NumTypedEx

// Conversion tests.
KeyStringâ†
Chris McIntosh
 

Need actual data to analyze this properly

Postby joe_blaze » August 5th, 2011, 5:52 pm

Hi Chris,

Please attach the actual 'data' used in this example. Maybe in a native file, an Excel workbook or an APL+Win workspace. I will then try it out, especially the 'extra' space with enlist.

Take this as "heresy", but sometimes .Net has a better solution than re-inventing the wheel in APL, e.g. SortedDictionary, plus a lambda function or two or some Linq expressions...

See:
http://msdn.microsoft.com/en-us/library/f7fta44c.aspx
http://stackoverflow.com/questions/289/ ... y-by-value
joe_blaze
 
Posts: 382
Joined: February 11th, 2007, 3:09 am
Location: Box 361 Brielle, NJ 08730-0361

Postby Chris McIntosh » August 5th, 2011, 7:21 pm

Hi, Joe,

I've attached some sample data.

The forum wouldn't let me upload extensions of .csv, .txt, or .dat, so I finally renamed it to be a .pdf file, but really it's a .csv file so just download it and rename it with a .csv extension.

You may not need to know this, but my program reads similar data (more columns) from an Oracle database, puts it into a .Net DataSet, then I convert it to a VisualAPL matrix of strings with the following program. I do this so I can use VisualAPL operators and treat the data like an array.

public static object ConvertDataTableToAplVar(DataTable tableData)
{
// Declare and initialize variables.
⎕ioâ†
Attachments
SampleData.pdf
(190 Bytes) Downloaded 242 times
Chris McIntosh
 

Postby Chris McIntosh » August 10th, 2011, 7:29 pm

Hi, Joe,

I didn't respond to your "heresy" statement. :-)

I'm always open for a little bit of heresy. In this case, if I just wanted to sort data, you're right. There are lots of options, perhaps some that are better than using APL. The problem for me is what I want to do with it after it's sorted, where APL seems a better choice.

I'm not keen, unless I have to, in stuffing the data from an APL variable into a SortedDictionary, then extracting it back into an APL cvar for further processing.

However I definitely agree with your general principle of not re-inventing the wheel, or trying to do in APL what .Net already does perfectly well.

Chris
Chris McIntosh
 

Returning System.Int64 result from a VisualAPL calculation

Postby joe_blaze » August 15th, 2011, 11:33 pm

Hi Chris,

Thanks for sending your data. Using it I created a short VisualAPL script which can be run in the Cielo Explorer to illustrate how to return an Int64 result from a VisualAPL calculation.

When you have time, try out the script in the attached pdf-format document and report back on your results. Note that I could not duplicate the error message you reported.

Joe
Attachments
VisualAPL script which illustrates three ways to return an Int64 result from a VisualAPL calculation.pdf
(346.59 KiB) Downloaded 262 times
joe_blaze
 
Posts: 382
Joined: February 11th, 2007, 3:09 am
Location: Box 361 Brielle, NJ 08730-0361

No spaces in result when enlist is not used

Postby joe_blaze » August 16th, 2011, 12:01 am

Hi Chris,

In the attached pdf-format document, I again used your data and used VisualAPL to select information from an array. I did not use enlist, but I found no spurious leading spaces in the result. Possibly the result you observed comes from the way you convert from the Record Set to an APL array?

Joe
Attachments
Without enlist the result still contains no spaces.pdf
(201.3 KiB) Downloaded 246 times
joe_blaze
 
Posts: 382
Joined: February 11th, 2007, 3:09 am
Location: Box 361 Brielle, NJ 08730-0361

Postby Chris McIntosh » August 16th, 2011, 5:50 pm

Hi, Joe,

Thanks for checking on this. I'm going to have to investigate this further.

I had no problem with your script when I ran it in Cielo Explorer.

As I'm having problems in Visual Studio solutions and project files, I then copied your code into a project file but again had no problems.

I'm going to go back to my original project file, which I've kept, and see if I can determine what is different between these examples and my original data and program. I'll specifically look at nesting depth and data types. As you say, it could be with how I'm creating my data1 array.

Chris
Chris McIntosh
 

Postby Chris McIntosh » August 16th, 2011, 9:25 pm

Hi, Joe,

I'm beginning to wonder if the problem might be with stepping through code in debugging mode.

I executed my original code. I still had my original problems.

So I copied your code, which worked in both Cielo Explorer and in a separate project file, into my original code, placing it at the end of the file. In my project file, I commented out my original lines of code that didn't work. Your working code no longer worked. So I commented out all my original code. Then your code did work.

I'm having a hard time believing that inserting lines of code above your working code could cause problems. I'm having an easier time believing that there may be problems with stepping through code in debugging mode.

I'm going to try to confirm whether this is the case or not by publishing to a web site, and then executing both versions. That should help determine whether there might be a problem with the compiler or the debugger.

Chris
Chris McIntosh
 


Return to VisualAPL

Who is online

Users browsing this forum: No registered users and 1 guest