How can I remotely (via web services) determine date format of SharePoint 2003 site, for use in Versions.asmx returned XML? - web-services

The GetVersions() call to the Versions.asmx web service in SharePoint 2003 returns a localised date format, with no way of determining what the format is. It's the site regional setting of date format, but I can't find a way to get even that out of SharePoint 2003. Locally, it looks like SPRegionalSettings can be used (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spregionalsettings.aspx) but what about a web service version of this?

Sadly, it isn't available. However, you can specify a query option to specify that you want the values returned in UTC:
http://www.sharepointblogs.com/pm4everyone/archive/2006/10/03/sharepoint-2003-querying-with-gmt-datetime.aspx

Unfortunately, the parameter that asks for the values in UTC is not supported for this call. I've just had to look for a month greater than 12 and use that as the hint to switch date formats. It'll mess up some dates, but I can't see a way around that. The code is at http://sourceforge.net/projects/splistcp/ if anyone is interested.

Related

Identify PST timezone on non-english Windows installation

I am facing this weird problem where I need to fetch PST timezone information (e.g. MUI_Std, Std, TZI etc.) from Japanese Windows OS machine but unable to find a reliable way to do it.
I have tried RegLoadMUIStringW API. But it returns me name of PST timezone in localized format. I have PST timezone name in English with me. So using output of this API I am not able to compare and tell whether the value being read from registry is for PST timezone.
One possible solution is to have MUI_Std value of PST timezone in code (the value is #tzres.dll,-212) and compare this value with the values read from registry. This way I will come to know if the timezone I am reading is PST or not. But I am not sure if this is a reliable way to detect PST timezone.
Let me know if anyone has any inputs on this.
Time zones are identified by their ID (aka "Key Name"), not their localized names. The IDs are not localized.
Thus, regardless of language of the OS, you'll find the Pacific time zone information at:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Pacific Standard Time
Of the values within, only the Std, Dlt, and Display values are localized, and the MUI values point to where those strings are located in the resource files. The resource files are installed with the Windows language packs. Note, you shouldn't hardcoded a value (eg, -212) because a future update might provide a new string that could change it.
Also, if you just need to retrieve the time zone information for a given ID, you don't actually need to access the registry at all. Just use the EnumDynamicTimeZoneInformation function to iterate over the time zones looking for the one that matches the desired TimeZoneKeyName (which again is not localized).
If however, you're looking for the localizations of these in languages other than the current OS language, you could try taking a look at the TimeZoneWindowsResourceExtractor project.
I wrote a recent SQL Shack article that shows how to extract time zone / time zone adjustment information directly from a Windows PC registry. The technique shows C# and VB.net desktop apps that build text files with time zone and time zone adjustment information. I placed the code at my GitHub resource, and you can modify it if it does not specifically cover the exact data you need. Mr. Johnson-Pint's earlier content here at SO, and at his blog, really helped me build out my ideas.
HTH!

Generating WagtailCMS Document Previews

Is there a way to extend Wagtail's documents to show file previews? There's a service ( I have not tested ), which looks cool, but the free plan to Pro plan is a huge leap in cost. I am hoping someone has figured this out already and can point me to the solution. Thank you.
FilePreviews.io's 100 documents a month on the free plan seems pretty generous to me. You could try to build something similar, e.g. using ImageMagick to create PDF thumbnails:
http://duncanlock.net/blog/2013/11/18/how-to-create-thumbnails-for-pdfs-with-imagemagick-on-linux/
and use a service like Aspose to convert common file formats to PDFs:
https://www.aspose.com
Or you could do it manually, by adding a thumbnail field to your document model, and telling users to provide their own thumbnails.
But if you or your client are uploading more than 100 documents a month, and you want reliable thumbnail generation for multiple document types, $49 a month may be better value than working it all out yourself.

WebServicex Currency Convertor API

WebServicex Currency Convertor API is returning always -1 as the conversion rate regardless of the currencies I specify..
Is there a way I can get it to work, to return an actual accurate conversion rate please?
I don't know why minus 1 is returned. I think there are only 2 parameters FromCurrency and ToCurrency. Here's an example URL I used:
HTTP POST REQUEST:
httppost://www.webservicex.net/currencyconvertor.asmx/ConversionRate?FromCurrency=GBP&ToCurrency=EUR
Here is what's returned:
-1
I also tried From USD to EUR but it still returned -1.
Do I need to register and enter a developer key as a parameter or something? I didn't find that information anywhere, it's just a guess.
If nobody can help me with Webservicex; their service is not working properly; maybe it's just not a good one, can anybody recommend a good currency conversion web service. I want to call the result from within my db solution to meet my clients request, and I only have a day before I need to show something working to them. I hope you can help, it would be much appreciated.
Thankyou
Kind Regards
sharpie
You may use the yahoo finance api.
http://download.finance.yahoo.com/d/quotes.csv?s=GBPEUR=X&f=l1
Although it will give the csv but if you will just use it in script then it will give you the direct transaction value.
I hope it will serve your purpose.

RDbms name and version

I m doing a software in c++ that permit to access to some rdbms with qt library.
The software is only for pc.
The software need to know the name of rdbms and version beacuse the program needs to choose some sql query to execute. Is there any way to retrieve thisdata in any rdbms?
Is there any way to retrieve thisdata in any rdbms?
This is specific to each RDBMS - for example, in Oracle, you can do
select *
from v$version;
but in other RDBMS this view does not exist.
Some possible approaches:
You need to define connect parameters somewhere anyways. Even they are often RDBMS-specific, so you could simply add another parameter like SQLFlavor=Oracle or SQLFlavor=MySQL and then use the value of SQLFlavor in your code to determine which SQL statement to use
You can use some heuristics to find out the RDBMS. For example, query the v$version view - if it does not exist, you will get an error and you know that it is not Oracle and you can continue with the next try (like SELECT VERSION() to see if it is MySQL). Otherwise, you can use the result to find out the concrete Oracle version.

How to work with Google Finance?

I want to develop a small application to get stock price from Google Finance automatically and store it in my local machine for future analysis.
Can anyone give me some clue how to get started?
I know some C#. Will it be suitable for this purpose?
Thank you in advance.
The Google Finance Gadget API has been officially deprecated since October 2012, but as of April 2014, it's still active:
http://www.google.com/finance/info?q=NASDAQ:ADBE
Note that if your application is for public consumption, using the Google Finance API is against Google's terms of service.
This gives a JSON response which can be parsed using a simple JSON parser in C# after chopping off the first two chars ('//').
For downloading historic data again, you could use the Google APIs.
http://www.google.com/finance/historical?q=NASDAQ:ADBE&startdate=Jan+01%2C+2009&enddate=Aug+2%2C+2012&output=csv
gives out a CSV of end of day stock prices from startdate to enddate. Use a simple CSV parser to get meaningful data out of this stored on your db. However, this format=csv option does not work for a few stock exchanges.
If you want to download historical data you can use the Google Finance API (which still works as of May 2016). You do not have to provide an end date, it will automatically fetch data from the start date (or later if the stock did not trade then) to the last full trade date:
http://www.google.com/finance/historical?q=NASDAQ:AAPL&startdate=Jan+01%2C+2000&output=csv
Remember that Google Finance API are for personal consumption ONLY. I suggest you their terms of service.
If you want to simply download the latest date (which could be useful to update your local db) you can use the googlefinance library developed by Hongtao Cai:
https://pypi.python.org/pypi/googlefinance
I have just implemented this with PHP. It might be useful.
<?php
echo readGoogle('AAPL', 'Aug+21%2C+2017', 'Aug+22%2C+2017');
function readGoogle($ticker, $startDate, $endDate) {
$fp = fopen("http://finance.google.com/finance/historical?q=".$ticker."&startdate=".$startDate."&enddate=".$endDate."&output=csv", 'r');
if (FALSE === $fp) return 'Can not open data.';
$buffer = '';
while (!feof($fp)) $buffer .= implode(',', (array)fgetcsv($fp, 5000));
fclose($fp);
return $buffer;
}
?>