Sunday, March 24, 2013

FP: Script Not Found

Integrating with GP and a simple one line script is resulting in this error: "FP: Script Not Found"

 Deleting the script and then re-adding seemed to do nothing. There must have a been a reference to an orphaned function with the same name or something. The solution ended up being changing the name of the CHG script that was causing the "Script Not Found" error.

I see a few search results showing that this error can be caused by Saving and not compiling a script. I didn't do this. I always compile the entire dictionary before chunking... so this must be an unknown problem.

Friday, March 22, 2013

Alexander the Great

Summary: Built a bridge to an island. Tyre sent fire ships to burn it. When Alexander finally took the city he killed lots of civilians, the first time his character started to change from a benevolent conqueror to a destroyer.

Summary: When Alexander seiged Gaza, Batis didn't want to surrender to him. This enraged Alexander. He was further enraged when he was hit by an enemy arrow. So, when Alexander breached and took the city he killed Batis brutally, by putting ropes through his heels and dragging him to death behind a chariot.

Note: This is what Achilles did to Hector in the Trojan war as well.

Note 2: A famous incident of this happened in modern times during a US Army Rangers operation in Mogadishu, Somalia. The operation was botched, and the Somalians overran the Americans. They drug the body of a killed soldier through the streets.

Session timing out in ASP.NET even though session timeout is not being met

I set the session timeout to a large number, because users were complaining that it would log them out in the middle of entering an article.

I was wondering how people were still getting logged out, and then I came across an article showing that the App Pool timeout can also cause this. Indeed, this value was set to 20 minutes, much less than the session timeout, and is a likely candidate for why people are still timing out.

Monday, March 18, 2013

Rapid Development metholodogy - unclassified

I have a deadline for code in a few weeks and haven't received the requirements spec. In order to get somewhat close to the deadline I've streamlined the dev process into this:  Designing, coding, and unit testing one piece of functionality at a time.
Have two documents: Design doc and Unit testing doc

Design doc is a tree based structure:
  1. Field Name
    1. Create
      1. Description of what should or shouldn't happen
    2. Read
      1. Dependent Field Name
        1. Create
          1. Description of what should or shouldn't happen
        2. Read
        3. Update
        4. Delete
    3. Update
    4. Delete

The "Dependent Field Name" is a field that's only purpose is to do something to the parent field. For example, I could have a field "Purchase Order Number", and then a Dependent Field would "Purchase Order Number Lookup" - that's sole purpose is to return a PO Number to the parent field.

Unit Test doc is
  1. Window
    1. Field Name
      1. Table with columns #, Bug, Fix. (self-explanatory)
I design a piece of functionality in the Design doc for a field. Code the functionality, and then unit test and write down any bugs in the Unit Test doc. In the Design doc once a piece of functionality is unit tested successfully I strike it out.

This has proven to be efficient and I have working code quickly. Not to mention the documentation is happening on the fly, instead of before or after the coding phase, which is very nice.

I don't know what the name of this development methodology is, but I like it, and I'd like to figure out what it would be classified as.

A quick Google search turns up:
1. Test-driven development and
2. Extreme programming -

I'll have to do more research on this later.

Sunday, March 17, 2013

Capitalize textbox input as it's entered

I have a form with an input textbox and a button to process the results of that input. I need the input to be forced to uppercase in the textbox.

Note: If I didn't need the user to see it as capitalized then I would just do txtBox.Text.ToUpper() in the processing code, but I need the user to see it as capitalized.


Monday, March 11, 2013

Modify an XML document in C#

This shows how to:
1. Open an XML file
2. Search for existing nodes and attributes
3. Modify and insert nodes
4. Save the results

Note: This code solves a specific problem, and makes no attempts to generalize.

How to run an exe with InstallScript

The script below will run an exe. 

prototype runEXE(STRING);  
function runEXE(exe) 
string fullPath;
    if(FeatureIsItemSelected(MEDIA, "Server") == TRUE) then
        fullPath = TARGETDIR^exe;
        LAAW_STARTUPINFO.wShowWindow = FALSE;
        if(LaunchAppAndWait(fullPath, "", LAAW_OPTION_WAIT) < 0)then
            MessageBox("Error launching " + exe + ". Check if it exists in " + TARGETDIR + " then manually launch it" , INFORMATION);

How to call it
The script below checks if the "Server" feature is being installed, and then calls runEXE on two files: test.bat and modifyConfig.exe.

 function OnEnd( )
    if(FeatureIsItemSelected(MEDIA, "Server") == TRUE) then

Sunday, March 10, 2013

POS for .NET with .NET 4 applications

I have a .NET dll that uses POS for .NET to handle devices. I'm integrating with a program that's running in .NET 4.0. This results in PosExplorer not being able to return from the cstr. In some situations this may be causing execeptions, but in my case it's not reporting any errors at all.

In the ApplicationName.exe.config for the exe that is running the DLL put in

      <NetFx40_LegacySecurityPolicy enabled="true"/>

Note: The configuration section will probably already exist, so just stick the runtime section in there. If the application does not have a .config file, then create one. It needs to be named ApplicationName.exe.config

Support thread:

Tool used to debug:

MSDN doc:
There was an error in this gadget