Consuming SSIS Data Profile XML - ssis

I am attempting to read the output of an SSIS Data Profile task into an MVC app. To work out the kinks, I wrote a small console app to test the parsing of the xml file.
I used the following link:
http://schemas.microsoft.com/sqlserver/2008/DataDebugger/DataProfile.xsd
to download the .XSD file that should describe the .XML file that was generated in the Data Profile output file.
I then ran xsd.exe to create a C# class to include in my console app.
Following is my very simple test code:
XmlSerializer xser = new XmlSerializer(typeof(DataProfile));
DataProfile dProf = xser.Deserialize(new FileStream(#"D:\InputFiles\ProfilerDataCVD.XML", FileMode.Open)) as DataProfile;
if (dProf != null)
{
var profs = dProf.DataProfileOutput.Profiles;
foreach (ColumnValueDistributionProfileType c in profs)
{
Console.WriteLine(string.Format("Column Name: {0}, RowCount: {1}, Distinct Values: {2}", c.Column.Name, c.Table.RowCount, c.NumberOfDistinctValues));
}
}
In that code, "dProf" is never NULL, but always empty. Any assistance at getting data in dProf would possibly save a life, because I am about to jump off of a cliff trying to figure this out!
If there is some obvious XML thing that I am missing, I will be the first to admit that this is not my strongest suit. Feel free to chastise me at will as long as you tell me how to make this return data.

Regrettably, no one has been able to answer this question. And I would still really like to understand why something so simple does not work.
In the meantime, anyone else struggling with the same issue should check out the following link on MSDN forums for an alternative way of doing the same thing.
http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/a282bb60-c099-4656-bf71-52ddc6153c28
I implemented it yesterday in just a few minutes and it works great.

Related

Simple function to read file from an URL to a string buffer ( C++ / MQL{4|5} using WinInet.dll )

I am looking for a simple function which is able to read a text or binary file from the internet into a string variable.
It´s unbelievable that I could not find anything in the web, just low level descriptions of all the WinInet functions and useless samples, that do not work at all, at the MQL-forums.
What I need is a function like:
string buffer = ReadTextFileFromWeb( "www.myurl.net/textfile.txt" );
No more, no less. I am not very familiar with internet programming stuff at all, but I am sure there is anybody out there who is able to present the reason just like that.
The code will be used in MQL4/MQL5. I know that there is already a WebRequest() function which works, but it is restricted to expert advisors and cannot be used in Custom Indicator type of code.
I need this solution to load data into a custom indicator.
Go get this on github https://github.com/sergeylukin/mql4-http
//For MT4 Add HTTP Access
#include <mql4-http.mqh>
string URLr = "www.myurl.net/textfile.txt";
Print("URLr return is: ", URLr);
For MT5 you are on your own.
The above dose not have the issues that WebRequest() has. Or I have not seen it have any issues. I use it all the time in a lot of EA and never had a chart lockup or have a issue.

Reading from a text file into HTML

I want to make a small html based game for a school project. I would like to be able to extract data from a text file, then insert if necessary in order to save data. So my question is:
What programming language can i use in order to read from a .txt file into a HTML page?
Thanks in advance for any help you are able to provide.
My suggestion would be php. There are dozens of methods to achieve this. Note, however, that this task will be much easier to accomplish if your text file is on the same domain as the code. This is best for single levels that dont change.
Php
In php, you could use
$file = fopen('pathtofile.txt', r);
Note that the second parameter, r, signifies that the file should be readable. Use w if you want to write to the file.
There are a lot of tutorials on google for this.
Ajax
If you'd prefer not to use php, Ajax is also available to you via javascript. This method is best if you need to change files while the game is running, ie loading new levels.
$.ajax({
method: 'get',
path: 'pathtofile.txt',
success: function(data){
//level info is in **data**
},
error: function(x, h, r){
// this will display error info, ie file does not exist
}
})
The code above most likely won't work, it is intended as a demo. Again, there are plenty of examples for this on google.
Have fun and happy coding.

how to pass data from python to an HTML page

I am currently working on a program in python which keeps trak of a lot of builds.
This progress is reported in a html file which is current deleted and written again with the new data for me to update it. However I know this is not the idea approach though i have never really worked with html web pages in any degree what so ever.
But i would like to make it the right way but every time i search on something i just get how to pass data from a html page into a program. So what i am asking for is some guide lines as to what I need to look for to achive this.
Also any suggestion as to how the right approach whould be. I just need to pass data from my running python program to a html page.
Ad if im lucky maybe someone posseses a very simple exsample. like just a python constant passed to a text box or what ever on a html page.
Regards
Ephreal
#!/usr/bin/python3
__author__ = 'Aidan'
from urllib import request
goog_url = 'http://real-chart.finance.yahoo.com/table.csv?s=GOOG&d=8&e=2&f=2014&g=d&a=2&b=27&c=2014&ignore=.csv'
def dl(csv_url, dest):
response = request.urlopen(csv_url)
csv_str = str(response.read())
lines = csv_str.split("\\n")
fx = open(dest, "w")
for line in lines:
fx.write(line + "\n")
fx.close()
dl(goog_url, 'a.csv')
This will take a file from the web band save it to a filename of your choice.

Post an object of type Reference

I have had this problem for some time now and I have seen others have it as well. It has to deal with posting your custom objects that you create in Open Graph to post with your application. I am having this problem primarily on all platforms, but right now let's say I am using Android. If someone has accomplished this in C# or on IOS or even in PHP please post your answer.
An Example:
I have an object that posts a meal to Facebook. Let's say its properties are the following.
mealName = "Lunch"
mealType = "Vegetarian"
mealLocation = "Somewheresville, OH"
Now I have another object in my Open Graph and it is called DailyFood. It has properties such as the following.
day = "12/01/2012"
meal = "MyCustomMeal" // This references a meal object
Now when I go to post that I try to do the following in Java.
//Build Meal
JSONObject mealData = new JSONObject();
mealData.put("mealName", "Lunch");
mealData.put("mealType", "Vegetarian");
mealData.put("mealLocation", "Somewheresville, OH");
Bundle params = new Bundle();
params.putString("day", "12/01/2012");
params.putString("meal", mealData.ToString());
AsyncFacebookRunner request = new AsyncFacebookRunner(facebook);
This is where I generate the following error code.
{"error":
{"message":"(#3503) is an invalid value for property
\"meal\" with type \"Reference\"","type":"OAuthException","code":3503}}
Now I know that it says OAuthException but I am able to post feeds to Facebook with this app just fine. If anyone else has experienced this error on any platform and has found a solution please post it here.
Thanks!
So the answer to this question is that you actually need a website available for your app to be able to reference what its posting to Facebook. In the docs, I at least, wasn't able to find out where this was noted.
according to this official video you must have the web application to post the action using open graph,no matter in which platform we are working android,ios etc
as it fetches the meta tags and properties from the web url only which works as refrence.

Having trouble binding JSON data to a mobile list in Adobe Flash builder

Hi, i have been having some problems using JSON data in flash builder lately and I was hoping someone could help me out here.
I have spent the past month working solidly on this issue, so I HAVE been looking around, HAVE been trying out everything I can find or think of. I am simply stuck.
I have been working on a flex mobile application for the Blackberry Playbook tablet with Adobe Flash Builder 4.6. It is a reddit app, designed to give users the main reddit feed, subreddits, search function, hopefully log in stuff etc. Of course I need the aid of the reddit API to access this information, of which the documentation can be found here: https://github.com/reddit/reddit/wiki/API/ The api uses either XML or JSON formatted data.
Now onto my problem- Like mentioned above, i want to display the reddit feed inside the app. I want to be able to use a item renderer to customize the data that is shown within each entry of the list.
One entry would consist of:
1) a thumbnail of the image in the post
2) The title of the post
3) a 'like/dislike' button, but this is unimportant at the moment.
Of course to start out, i placed a spark List component onto the design view. Then i configured a new HTTP data service using the Data/Services panel. I specified http://www.reddit.com/r/all.json for the url. I configured the return type, and the did a Test Operation. Everything connected just fine. All the data came through as normal. I will give you an idea of what the data comes back as so that you may understand my issue later on.
Test Operation Results (json data structure):
NoName1
data
after
before
children
[0]
data
media_embed
score
id
title
thumbnail
url
(etc etc...)
kind
[1]
data
media_embed
score
title
thumbnail
(etc etc...)
kind
[2] (array continues)
modhash
kind
As you can see, to get to the thumnail for example, you would have to go through data.children[].data.thumnail. When I tried to bind this data to the spark List component, I specified the data service to be from the one above. Then I specified the Data provider option to be Children[], as this value is typically set to the array. Now this is where the trouble begins. The final option, Label Field, only gave me one value to choose from: 'kind'. So as you can tell, it wasnt expecting the data to go any further nested. It stops at the two value just within each array item, which would be Data and Kind, though it only offers me Kind. I need to go one level further to access Title and Thumbnail. This is my problem.
Now, I have analyzed the code for the binding, and I have tried altering it to accomodate the further nested value. No success what so ever. The following is the code that the binding generates:
<s:List
id="myList" width="100%" height="100%" change="myList_changeHandler(event)"
creationComplete="myList_creationCompleteHandler(event)" labelField="kind">
<s:AsyncListViewlist="{TypeUtility.convertToCollectionredditFeedJSONResult.lastResult.data.children)}"/>
<s:List>
Obviously i would want to have something like along the lines of:
"TypeUtility.convertToCollection(redditFeedJSONResult.lastResult.data.children.data" and then set the labelField="title" or "thumbnail".
I certainly hope someone can help me with this. I am out of my mind as to what to do. If you need any further clarification I would be happy to provide it. I tried to explain the situation above as clearly as possible. Thank you so much.
Ted
I have this situation often: get an XML or JSON data from the server, then trying to use it as a dataProvider for a spark.components.List or for a mx.controls.Menu and then they just wouldn't display the data as I want them, because something in the data is different from what they expect. And then they display wrong XML-children or [Object,Object,etc.]
And in such cases I just create an empty ArrayCollection() which serves as dataProvider instead (and can be sorted and/or filtered too). And when data comes from the server, I push() new Objects into it:
[Bindable]
private var _data:ArrayCollection = new ArrayCollection();
public function update(xlist:XMLList):void {
_data.length = 0;
for each (var xml:XML in xlist)
_data.push({label: xml, event: xml.#event});
}
This always works. And if you get your next problem - flickering of the List, then that is solvable by merging data too.
Good luck with your Playbook development, which is a cool piece of hardware :-)