Is it possible to import an external data source - external

I would like to import an external data source into another file.
The way the work flow is distributed right now makes no sense and having the layout open in another window is not really needed.
What I'd like to do is import the whole external file(databases, records, layouts, and scripts) into the first file. Is it possible to automate this process or do I have to import everything manually step-by-step?

There is no automatic way to import code from one FileMaker file to another.
External file references, custom functions, tables, fields, value lists, themes, layouts, scripts, layout objects, menus, ... have to be painstakingly moved by hand, bit by bit!
Order!
Most important is the order in which you do things!
Do it in the wrong order, and references break because the referenced thing has not yet been created in the target file.
The chicken / egg conundrum
Even then you still get "what comes first? chicken/egg" conundrums - due to cyclic references.
For example a layout-button might reference a script, and the script might reference the layout the button is in.
=> That means, if you create the layout first (layout, layout-settings, layout-parts, contents and all) the [Button] breaks (because the script is missing) and if you create the script first the Go to Layout breaks (because the layout is missing). :-/
For this reason you often have to create the object "shells" before you create the contents.
In the given example you would do this:
First create the empty layout (and layout parts with the correct heights)
Then import (or copy/paste) the script
Finally copy & paste the layout contents
Like this, the script can reference the layout ok and the button can reference the script ok.
Useful resources
Geist Interactive have a good post Checklist moving FileMaker code explaining which order to use.
My toolbox fmWorkMate (from www.fmworkmate.com
) and particularly the fmLogAnalyser tool is very useful for catching and tracking breakages when copying and pasting code

Related

TCL Info frame not giving correct file-name and line-number?

We have a problem with info frame not giving the correct file-name and line-number.
We are using Tcl 8.6 with some code forked for proc and source, we are overriding source command with some custom code, so that some of the lines can be skipped, After this, info frame isn't working for this forked version.
Is there a solution for this?
Alas, if you override bits and pieces of code like that then you lose the file tracking. It's done by tracing identities of literals and it really doesn't like what you're up to there.
Formally, the file tracking is known to be theoretically flaky, but it doesn't seem to be much of a problem in practice unless you get into the level of processing that you're up to. One possible workaround is to do your preprocessing by changing files into other files (e.g., in a “deploy” directory) so that source and proc can stay conventional. (Doing that sort of copy is also pretty much what you do when you build an application; you've just got a filtering copy instead of a simple one.)
Details
The following two locations in Tcl's source contain the heart of the problem for you:
generic/tclProc.c lines 199–280, Tcl_ProcObjCmd()
generic/tclIOUtil.c, lines 1955–1959, TclNREvalFile() (and probably lines 1819–1823, Tcl_FSEvalFileEx() too, if you want to do file evaluation that's not source)
You want that code in tclProc.c to trigger so that the frame data is built for the procedure, but for that you need the trigger in tclIOUtil.c to set the triggering action. Your changes to proc and source block both of these. The info frame command reads the data that that block in tclProc.c generates.
Perhaps the easiest way — if you're building custom C in the first place — is to insert your processing in those two functions in tclIOUtil.c; I'd do it by calling a shared function that modifies the contents of the buffer in the Tcl_Obj passed in (which will be single-referenced at that point, and hence writable). Just… don't alter the number of newlines if you want the data out of info frame to be sensible.

PhpStorm searching in project tool window

I'm using PhpStorm 10.0.4
When I start typing characters in project tool window it searchs for files containing typed text.
Is it possible to change this behavior so only files that begins with typed text would be matched?
Is it possible to change this behavior so only files that begins with typed text would be matched?
AFAIK no. There are no GUI settings for this at all.
Plus, this Speed Search is used in many places/tool windows and search logic is the same.
P.S. If you need to search for files .. why not try more appropriate (in general sense) Navigate | File... instead?
Speed Search only finds items in already expanded nodes (as it's a basic search on already displayed text) .. but Navigate | File... will look for files everywhere in the project.
It's not possible directly but you can create and use a scope for that.
Open Settings and go the Appearance & Behaviour -> Scopes. Create a new scope, give it a name (let's say "My Files") and put file:*/c* in the Pattern edit box.
In the big list of files under the Pattern edit box you can preview its effects. The files that are included in the scope are colored in green, the directories that contain included files are colored in blue.
This simple pattern selects only the files whose name start with c, in all directories. You can use slightly more complex filters using wild cards, include or exclude entire directories etc. With a little practice you can create filters that match usual needs pretty well.
When you are pleased with the scope definition, close the Settings box and go back to the Project view. Click on the arrow next to Project and you'll get a list of views of the project files. All the scopes you created should be there. Select "My Files" and only the files (and directories) included in that scope will be displayed in the Project view.
It is not a dynamic filter, you have to work a little to set it up, but it is useful when you work on large projects, with thousands of files, and you need to hide the files not important for your task.

Exporting Oracle APEX regions with DBMS_LOB

I'm interested in exporting the contents of a page generated by Oracle-APEX to an external file while preserving as much formatting as possible. Eventually, I'd like to export it to either a .doc, .xls., or .pdf format. For now, I'm testing with a .doc file.
Currently, I'm attempting to do this by creating a PL/SQL anonymous block "Process" that executes when an "Export" button is pressed. Based off an example I found online, if I use the following code in the process, I can output one of the items in my page to a .doc file:
DECLARE
test_blob BLOB;
BEGIN
dbms_lob.createtemporary(test_blob, FALSE);
dbms_lob.open(test_blob, dbms_lob.lob_readwrite);
DBMS_LOB.APPEND(test_blob, UTL_RAW.CAST_TO_RAW(:P4016_ITEM_NAME));
OWA_UTIL.mime_header('application/doc', FALSE);
HTP.p('Content-Length: ' || DBMS_LOB.getlength(test_blob));
htp.p('Content-Disposition: attachment; filename= "text.doc"');
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file(test_blob);
dbms_lob.close(test_blob);
END;
However, I would like to output some regions on my page that include tables, which are not considered items, as far as I know (I'm still very new to APEX). If I include the table name in the DMS_LOB.APPEND line, I receive an error message. Does anyone know of a simple way to reference these regions?
The only workaround I've found is to replicate the page in my exported file by enclosing the results of the SQL queries used to populate the tables in HTML based off the HTML of my APEX Page. In other words, if I wanted to italicize something, I would do the following:
...
dbms_lob.append(test_blob, UTL_RAW.CAST_TO_RAW('<html><i>'));
dbms_lob.append(test_blob, [PARSED SQL QUERY]);
dbms_lob.append(test_blob, UTL_RAW.CAST_TO_RAW('</i></html>'));
If anyone knows of a simpler way to do this, preferably involving a simple reference to my page regions, I would greatly appreciate it.
There is a way (3 ways) to get PDF - http://www.oracle.com/technetwork/developer-tools/apex/learnmore/custom-pdf-reports-1953918.pdf.
Also you can use Interactive report, it has export option. But it can be exported only in HTML by default.
It is not exactly what you ask, but you don't need to write code.

Entity Editor - How to dynamically generate a list of components?

I'm making a game and I an in-game editor that is able to create entities on the fly (rather than hard coding them). I'm using a component-aggregation model, so my entities are nothing but a list of components.
What would be the best way to obtain or generate a list of components? I really don't want to have to manually add entries for all possible components in some giant registerAllComponents() method or something.
I was thinking maybe somehow with reflection via either the knowledge that all components inherit from the base Component class, or possibly via custom metatags but I haven't been able to find ways to get a list of all classes that derive from a class or all classes that have custom metatags.
What sort of options am I left with?
Thanks.
For a project I did once, we used a ruby script to generate an AS file containing references to all classes in a certain package (ensuring that they were included in the compilation). It's really easy considering that flash only allows classes with the same name as the file it's in, so no parsing of actual code needed.
It would be trivial to also make that add an entry to a dictionary (or something similar), for a factory class to use later.
I believe it's possible to have a program execute before compilation (at least in flashdevelop), so it would not add any manual work.
Edit: I added a basic FlashDevelop project to demonstrate. It requires that you have ruby installed.
http://dl.dropbox.com/u/340238/share/AutoGen.zip
Unfortunately, there is no proper way of getting all loaded classes or anything like that in the Flash API right now. So finding all sub-classes of Component is out, inspecting all classes for a specific meta tag is out as well.
A while ago I did run into a class/function that inspected the SWF's own bytecode upon loading to retrieve all contained classes. That's the only option for this kind of thing. See this link and the bottom of my post.
So, you're left with having to specify a list of component classes to pick from.
One overly complicated/unfeasible option that comes to mind is creating an external tool that searches your source folders, parses AS3 code and determines all sub-classes of Component, finally producing a list in some XML file. But that's not a task for the faint-hearted...
You can probably think of a bunch of manual solutions yourself, but one approach is to keep an accessible Array or Vector.<Class> somewhere, for example:
public static const COMPONENT_LIST:Vector.<Class> = Vector.<Class>( [
CollisionComponent,
VisualComponent,
StatsComponent,
...
...
] );
One advantage over keeping a list of String names, for example, would be that the component classes are guaranteed to be compiled into your SWF.
If the classes aren't explicitly referenced anywhere else in your code, they are not compiled. This might occur for a simple component which you only update() once per frame or so, and is only specified by a string in some XML file.
To clarify: You could use the code in the link above to get a list of the names of all loaded classes, then use getDefinitionByName(className) for each of them, followed by a call to describeType(classObj) to obtain an XML description of each type. Then, parsing that for the type's super-types, you could determine if it extends Component. I personally would just hardcode a list instead; it feels too messy to me to inspect all loaded classes on startup, but it's up to you.

Hack a FITs Image Header

I need to change a few values in a couple of FITs image headers to fit with some test data I have. Therefore I'm trying to hack a FITs image header at the minute to run with the application.
However at the minute - I can't even see the header, never mind hack it. I run Ubuntu.
Can anyone advise some software to view the FITs - perhaps even hack it?
Kind of old, but I think the answer could use some updates and additional information.
View .fits file
My personal favorite GUI for viewing '.fits' files is DS9. Once installed you can view a file by typing ds9 /path/to/file.fits. Alternatively you can just use the menu in the GUI to load the image. Once you load the image in the viewer, you can view the header information by using the very top menu bar and going to 'File -> Display Header'. Unfortunately, I dont believe you can modify the header in DS9.
Modify fits header
For modifying the fits header, I found the easiest is to use astropy (a python package). Since you're using Ubuntu you should be able to download it via apt-get, so hopefully pretty easily. To actually edit the fits header, you can do the following in a python script, or from the interpreter (here's some additional help):
# Import the astropy fits tools
from astropy.io import fits
# Open the file header for viewing and load the header
hdulist = fits.open('yourfile.fits')
header = hdulist[0].header
# Print the header keys from the file to the terminal
header.keys
# Modify the key called 'NAXIS1' to have a value of 100
header['NAXIS1'] = '100'
# Modify the key called 'NAXIS1' and give it a comment
header['NAXIS1'] = ('100','This value has been modified!')
# Add a new key to the header
header.set('NEWKEY','50.5')
# Save the new file
hdulist.writeto('MyNewFile.fits')
# Make sure to close the file
hdulist.close()
You could also throw this in a loop for multiple file manipulation.
If you are familiar with the python programming language, you could use the astropy module to view and manipulate fits files. Say you want to view the header of the file 'image.fits', then you do:
from astropy.io.fits import getheader
header = getheader('image.fits') # Load the data
print header # Print the header to screen
If you want to modify a particular key of the header, you do:
header['key'] = 'new_key'
edhead seems to do the job very well. Only piece of software I have found that allows you to edit the header at the command line.
Is this the Flexible Image Transport System format used by Astronomers?
This site has some background information and further links, but explains that
Users must develop or obtain separate software to read and display the data from the FITS file. There are a number of different packages for particular applications and hardware, but there is no single standard package for all applications.
Still, you can use it for your own purposes.
As only 1/2 of the question was answered (editing the FITS headers), to view the images, I commonly use DS9 (aka SAOImage).
Also, if you're going to be editing a lot of FITS headers, I tend to go with either CFITSIO or Astro::FITS::Header
... and it's possible to edit FITS headers with any text editor, so long as you follow a few simple rules -- cards (key/value/comment sets) are always 80 characters long, and the FITS header is always a multiple of 2880 bytes. Depending on the file, there might be multiple headers, as the first header could declare the file to contain multiple images or tables.
The Sloan Digital Sky Survey developer web site has some libraries that should meet your needs.
FitsLib - A library for reading and manipulating FITS files on the Microsoft's .Net platform.
FITS stands for flexible image transport system. FitsLib aims to provide an interface to the FITS file on the Dot Net Platform. It is built as an object oriented wrapper around the CFITSIO library's interface to the FITS files.
While FitsLib itself is designed for C# and the .NET Framework, you might be able to use it under Mono on your Ubuntu system. Or, perhaps you can use the CFITSIO library directly, which is written in C.