Matlab gui for selecting a text file and the utilize it in further code - function

I have spent a long time studying about the gui. I have made the blank template containing all the buttons and input editable text box. but am facing problem with callback functions.
I have written a code which requires manually entering the text file containing data into the script file and then input a variable's value (in this case 'b') which is then utilized in the later part of the code. i wanted to make the program more user friendly so that one can select the text file from any directory by pushing a button and can change the value of b in a box provided. Also I have not included any functions in the main code...so its a basic data fitting code.
I tried studying about gui in matlab and other resources but am not able to understand it and use it. Therefore i cant put any of my work done uptill now. Please help me in solving the problem..

You may create a button in your GUI and include the following code in the associated callback function:
[aux_file,aux_path]=uigetfile();
if ~isempty('aux_file')
handles.data.file_name = fullfile(aux_path,aux_file);
handles.data.file_data = load(handles.data.file_name);
guidata(handles.figure_window, handles);
end
Now, you can use the data in other functions.

Related

Macro Design - Calling Function

I have a question about the Macro Design in a table for a "After Update" function. In one database that one of my past employees built the "SetField" value as a function call. One of the functions it calls is called GetUserNAme() it is buried in another bas_AuditLog macro, but in a DB that I am building, it doesn't work, even though I thought I had all of the information copied and correct. I have attached an image here that might show my issue. Notice the red exclamation mark.
Image of Macro Builder with error
Perhaps one of you smart people can help me look at an area that in my DB that may have the missing link.
Thanks.
Ok, so in the other (working) applcaiton, there is a going to be a public function called GetUserName(), and it is a VBA function.
So, in that working applcation, you can hit ctrl-g (get to debug window), and then type in GetUserName and then hit shift f2. Your code editor should now jump to that VBA function. You need to copy that code to your new applcation (place it in a plane jane standard code module (not a forms module, and not a class module). and it might very well also use a api call.
So, when you copy over that code. Test and make sure the VBA code works. In most cases in the access debug window, you can type in this:
? GetUserName()
And it should spit out the current windows user name. (or whatever the code supposed to do). So, get the VBA function working, and once you do, then your data macro should now also work.

Changing a value in a .config file based on a user's selection in an InstallShield 2013 install

Sorry - I'm a total newbie with InstallShield. I've inherited an InstallShield 2013 project that presents the user with a dialog that let's the user select a SQL Server and based on their selection sets a value in a config file. That's not working, so I opened the project in IS and looked in the Text File Changes under System Configuration and there's nothing there that would do this. So how do I figure out where this is happening (or not happening in my case), and then how do I get it to work? I need to set both data source and initial catalog in a file called server.config.
So how do I determine what the user selected and then save that in this file? It looks like I can set up a Text File Change, but how do I access the values selected by the user? And how can I figure out where the "code" is that is supposed to be doing this?
Thanks,
Ben
I would try to track this from the dialog and controls in question, or by following the value through a verbose log. Since you say it doesn't work today, there will probably be an interruption in the flow I describe below, and since you don't know the full state of the installation project, it may be hard to identify. So search from what you know.
Top down: what gets configured
First, find the dialog that you fill out as a user making the selection. Then figure out the property that the particular control is associated with. Now you've got a thread; pull on it.
Search in the direct editor for references to the property. If the property is named MYCONFIG search for just that: MYCONFIG. You'll probably find some sort of use that looks like [MYCONFIG] instead, which is typically a format string specifying to use the value of MYCONFIG. You may also have to search all the files related to your project, as Custom Action implementations can be code stored outside of your InstallShield project.
The use may be in a ControlEvent, CustomAction, or some other table. If it's in a ControlEvent, it may be used to set another property. Ditto if it's in a CustomAction that sets properties (type 51) which may be easier to understand in the Custom Actions and Sequences view. In that case, also search for the property that gets set.
If you find it in a table like ISSearchReplace* or ISXml*, or IniFile, it's probably part of the Text Files Changes, XML File Changes, or INI File Changes, and that view should make it easier to understand.
Maybe that thread dead-ends somewhere. A property gets set, but never referenced. So try to search from the other end.
Bottom up: what gets written
If there are text file changes, xml file changes, ini file changes, or custom actions that reference the file you need updated, see where they get their information. Try to follow it back. If they're well written, you should be able to identify the property (noting that one called CustomActionData comes from a property matching the name of the custom action it's used in), and then trace that further back using the same ideas as above, but in the other direction.
Where's the problem?
If the threads don't connect, that's probably the problem. It's also possible that a custom action lacks permissions but doesn't reports a failure, or that the file name or path got misconfigured somewhere along the way. Look for small things like that if things look like they should work but don't.
It turns out that I misunderstood the problem and the project was never set up to change that value, so all I had to do was set up a Text File Change and it works perfectly. Thanks #Michael Urman for the thorough response - I really appreciate it!

Scan an area of a web page's source code for changes while reporting it?

this is one heck of a confusing question to ask so here it goes. Firstly, I'm not asking you to write me any code I just need help going in the right direction for what I'm trying to achieve here. Basically the task is this, I want to scan a select area of a web page's source code for changes and if something does change, I want to report it somewhere (like a console or something). However, I do not want just a notification of change, I also want what the change is/was. I've been looking into things like jsoup but I am still struggling to even find out what this is called.
Any pointers would be insanely appreciated. Thanks, Optimistic.
Here are some steps assuming this is from a node.js project:
Get the URL for the specific script file you're looking for a change in.
Using the request() module, fetch that URL.
Break the data up into lines (probably using .split()).
Find the specific line you are looking for either by counting line numbers of by searching for some representative text in that line.
Using some sort of search in that line (perhaps a regex), find the current value of the exact item in that line you are looking for.
Save the current value.
Then, at some future time, repeat this whole process and compare what you find to the previous value.
If this is being done from a browser instead of node.js, then use an Ajax call to retrieve the file. If the file is on another domain from your web page and that domain does not permit cross-origin requests, then you cannot solve this problem in an automated fashion from a browser in your own web page.
Here is how I would do it with Jsoup:
Document doc = Jsoup.connect(url).get();
String scriptCssQuery = "script"; // Tune this CSS query to find THE script you need.
Element script = doc.select(scriptCssQuery).first();
if (script != null) {
String scriptLines = script.html();
// Store the changing line somewhere and compare it to its previous value...
}

Can we write a function in SSRS globally

Im currently using SSRS-2008R2. I've an scenario where i have to maintain the External image as a logo for each reports we have. Not, only that, we have our custom date formats that what we should change according to the Date Type users define in an asp.net application.
There are lot of things we have to do on every report. Thats my problem.
Following is the one of them Im currently sharing as example :
Currently i maintain the following function for each reports i've:
Public Function GetLogoImage() As String
Dim ImageLogoURL As String
if Globals!ReportServerUrl is nothing then
ImageLogoURL = "http://localhost/ReportServer" + "?%2fImages%2fLogo"
else
ImageLogoURL = Globals!ReportServerUrl + "?%2fImages%2fLogo"
Return ImageLogoURL
End Function
I hope, i asked question clearly. Im newbie in SO.
Thank you in advance.
If you have a list of functions that you wish to apply to multiple reports and you're not willing to copy them to every single one of them, you can create an external library and then add it as a reference to every report.
This is quite simple to do and there's lot of documentation around the web.You can start here. You will, however, have to maintain this external library but if you have a lot of code, I personally think this is a much better solution.
If you want to have a predefined layout, you may want to consider having a master report and then include other reports as sub-report objects, but you'll lose some flexibility design wise.
Since the accepted answer is more of a comment and the link provided is broken, i'll provide my answer for people who might need a quick guide on how to use custom code in ssrs:
In Design view, right-click the design surface outside the border of the report and click Report Properties.
Click Code.
In Custom code, type the code. Errors in the code produce warnings when the report runs.
Once you press ok, to call the function that you saved you just need to right click on a cell, select "Expression" and paste in the following string: Code.GetLogoImage
More detailed source here.

How do I insert HTML to a onenote page using VBA

Background
I use Onenote at work like a scrapbook, keeping track of assigned tasks and my progress through those tasks. Tasks are assigned via an automated email (outlook) typically these tasks involve manually reading web pages and filling in other webpages with results.
So far I've used the email arrival to trigger a VBA script which use uses data in the email to save the "requirements.html" page and the "ingredients.html" page locally. I then use python to parse and do some initial verification on the ingredients.html. This results in an augmented "requirements.html" containg colour coded status of parts.
my question
I've pretty much cut'n'pasted this code and managed to add a new page to section X of notebook Y (where x and y are strings passed to the function) or creating a new section by copying section.one file into the notebook folder DEST = "C:\Documents and Settings\Me\My Documents\OneNote Notebooks\Tasks\" + rqst_section + ".one"
while the code adds plain text to the page adding raw html source code in place of the plain text results in a object error when line
oneNote.UpdatePageContent doc.XML
is executed.
Has anyone managed to get the same result using VBA as this manual sequence,
select all text in browser window and copy 'n' paste it into a page in onenote.
I was getting a "UpdatePageContent" in "IApplication" failed error message, found out I had a Form Feed (chr(12) or vbFormFeed) character in a textfile I was trying to insert text into a page. Stripped that out and everything else seemed to work fine. Run the offending data through a hex editor, or strip it down little-by-little until you find the problem area.
Hope this helps.