Customized cultures cannot be passed LCID, only by name, Parameter name: culture - vb.net

I'm using crystal report in my VB.net application, when I show the Report and try to print it I face this error :
Customized cultures cannot be passed LCID, only by name, Parameter name: culture
The printing works fine on my computer but the problem on client computer.
this the error picture :

after searching, I found the solution :
By change the region settings of the operation system to a format whose LCID does not equal 4096. The format can be changed in Control Panel > Region > Formats.

Related

Getting attribute text from HTML using VBA selenium

I need to get the value "8.37" from the "data-rating" attribute.
<div class="ch-rating"> "VERYGOOD 8.37"
<div class="star-rating star-rating--alt star-rating--ch" data-rating="8.37" style="">
<span style="width: 83.7%;"></span>
</div>
</div>
In java there is .getAttribute() but I can't find the syntax in VBA.
I guess its something like this:
bot.FindElementByXPath("//div[#data-rating]"). followed by some syntax.
To get the value "8.37" from the "data-rating" attribute you can use the following line of code :
bot.FindElementByXPath("//div[#class='ch-rating']/div[#class='star-rating star-rating--alt star-rating--ch']").getAttribute("data-rating")
Update 1
HtmlElement.GetAttribute Method (String)
Syntax :
var attribute = element.getAttribute(attributeName);
where
attribute is a string containing the value of attributeName.
attributeName is the name of the attribute whose value you want to get.
Update 2 :
As you are seeing Run-time error 438: Object doesn't support this property or method for HtmlElement.GetAttribute Method (String) here are some details :
Error 438 occurs when running a program in which a form is assigned to a variable and that variable is used to access a control on the form if the program is on a system running Windows 95 with Regional Settings set to a setting other than English (United States). The error text is:
Run-Time Error #438:
Object doesn't support this property or method
Resolution
There are two possible workarounds for this problem.
Access the form directly rather than by a variable containing the form.
Create property procedures in the form's code to provide access to the properties of the controls on the form.
Status
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed in Windows 98.
Trivia
To reproduce this bug consistently, you will need HeapWalker, a utility that ships with the Windows 16-bit Software Development Kit and the 16-bit version of Visual C++.
Steps to Reproduce :
From Control Panel, click Regional Settings to open the Regional Settings dialog box. Set the Regional Settings to English (Australian).
Start the 16-bit edition of Visual Basic 4.0. If it is already running, select New Project from the File menu.
Source : FIX: Error 438"Object Doesn't Support This Property or Method"

Detect if printer support duplex programmatically using obj-c

I have been stumped by this for the last few days. I need to detect if a printer support duplex printing.
I have had partial success using code like:
NSPrinter * printer = [NSPrinter printerWithName:pname];
[printInfo setPrinter:printer];
PMPrintSettings settings = printInfo.PMPrintSettings;
PMDuplexMode pmDuplexMode = 0;
OSStatus status = PMGetDuplex(settings, &pmDuplexMode);
supportsDuplex = (status >= 0);
But this only work if I captured a full printerConfig through an NSPrintPanel. What I need is a way to detect if a printer with a specific name support duplex without requiring the user to 1st open a panel. I would like to do if for any printer defined on the local Mac. Any help is appreciated!
In your code snippet, I doubt that it's correct to interpret positive status as indicating support. In general, any value other than zero (noErr) is a failure of some sort.
If you're confident that PMGetDuplex() returns an error for a print settings object when the printer doesn't support duplex, you can try this approach: create a session with PMCreateSession(), obtain a PMPrinter using PMPrinterCreateFromPrinterID() or by searching the array returned from PMSessionCreatePrinterList() for on which matches whatever criteria you want, set the session to use that printer using PMSessionSetCurrentPMPrinter(), create a print settings object with PMCreatePrintSettings(), call PMSessionDefaultPrintSettings() to initialize the print settings from the session, call PMSessionValidatePrintSettings() just for good measure, then call PMGetDuplex() and check the return value.
It might also be worth trying to set a duplex mode with PMSetDuplex() and check the return code and, possibly, calling PMSessionValidatePrintSettings() and checking if it changed that setting.

2 web servers using the same database. One is throwing date out of range error

I am moving a classic asp website from a windows 2k3 server/iis6 environment to windows 2008r2/iis7. A couple of the pages pass the system date to an mssql database and the following error is occuring: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. The date being passed is '13/01/2011 hh:mm:ss AM'. I understand that the database is interpretting this as the 13th month and that is why the error.
What I don't understand is where exactly this date is coming from. The page is using this snippet for the date:
FormatDateTime(DATE() & " " & Time(), vbGeneralDate)
This should return a date in the format mm/dd/yyyy but it doesn't seem to. Since web servers are using the same database I figure the problem must be web server specific.
I checked in control panel/regional settings and both are set to US english and the format there appears to be correct. Is the system date & time formats specified anywhere else? I could not find anything in IIS where I could set a default date format
i think you need a Session.LCID(=LCID) line in your code.
more on this:
http://www.w3schools.com/asp/prop_lcid.asp
The problem ended up being the system locale setting found in control panel --> region and language. This setting "controls the language used when displaying text in programs that do not support Unicode."

Crystal reports 11 RDC (COM API) displays printer dialog even when I tell it not to prompt

I'm using Crystal Reports 11's RDC (COM) API to print. My code looks like this:
HRESULT res = m_Report->SelectPrinter(b_driver, b_device, b_port);
if (FAILED(res)) return res;
// For these calls, the #import wrapper throws on error
m_Report->PutPrinterDuplex(dmDuplex);
m_Report->PutPaperSize(dmPaperSize);
m_Report->PutPaperSource((CRPaperSource)pdlg->GetDevMode()->dmDefaultSource);
if (m_Report->GetPaperOrientation() == crDefaultPaperOrientation)
m_Report->PutPaperOrientation(crPortrait);
VARIANT vfalse;
VariantInit(&vfalse);
vfalse.vt=VT_BOOL;
vfalse.boolVal=0;
res = m_Report->PrintOut(vfalse);
However, at the end of all this, crystal reports still shows its own printer selection dialog - but only for some reports, it seems. Why does crystal reports show a print dialog even when I pass false for promptUser? And how, then, can I suppress crystal reports' internal printer selection dialog and force it to use my values?
Edit: Whoops, CR11, not CR9.
Some further information:
The reports that work properly (ie, do not show the print dialog) are generated internally using the RDC API; we create a new report object, import subreports into it, then print the result. No problem there.
The reports that do not work properly (ie, force the print dialog to open) have been created with a previous version of crystal reports; however, opening and saving the report does not seem to help.
Sample reports in the Crystal Reports installation directory show the same problem.
I tried reproducing with VBScript; however, the result was that nothing was printed at all (no dialog, no nothing):
Set app = CreateObject("CrystalRuntime.Application.11")
Set report = app.OpenReport("C:\Program Files\Business Objects\Crystal Reports 11.5\Samples\en\Reports\General Business\Inventory Crosstab.rpt")
report.PrintOut(True)
rem Testing with a True parameter to force a print dialog - but no printout and nothing appears (no error either though)
First, let me preface that I'm not a C/C++ programmer, so I'm not able to test the code--my interaction w/ the SDK has been with the VB and .Net interface over the years.
I found the following code from BO's devlibrary:
// A dummy variant
VariantInit (&dummy);
dummy.vt = VT_EMPTY;
HRESULT hr = S_OK;
// Specify the path to the report you want to print
_bstr_t ReportPath("c:\\Program Files\\Business Objects\\Crystal Reports 11.5\\Samples\\En\\Reports\\General Business\\Inventory.rpt");
_variant_t vtEmpty(DISP_E_PARAMNOTFOUND, VT_ERROR);
// Instantiate the IApplication object
m_Application.CreateInstance("CrystalRuntime.Application.115");
//Open the Report using the OpenReport method
m_Report = m_Application->OpenReport(ReportPath, dummy)
//Print the Report to printer
m_Report->PrintOut(dummy, dummy, dummy, dummy);
Does it work? It should print the report with its 'default' printer settings and without prompting.
You wrote:
However, at the end of all this,
crystal reports still shows its own
printer selection dialog - but only
for some reports, it seems.
Generally speaking, I've found that Crystal tends to ignore commands to suppress dialogs if it thinks something is missing. I've found this to be true with the parameter dialog. Perhaps it apply to this situation as well. I would ask what is different about the reports that cause the dialog to be generated. There is a 'no printer' option that can be set. Perhaps this is the common thread.
Do you have access to the VB6 IDE? If you write the equivalent commands using VB6's interface, does the prompting occur?
You might also investigate using the CRPE32.dll instead of the report-designer control. To be honest, I don't know if the RDC wraps the CRPE DLL or is an entirely-separate code base.
Turns out it was a bug in my code after all - I'd previously put in a wrapper for the RDC API to fix certain other bugs we were having; due to the large number of methods in the IReport interfaces, I wrote a script to generate pass-through stubs for the methods I wasn't interested in. Turns out that script was passing in bogus values for parameters with default values. Oops! Fixing the wrapper code fixed the bug here.

MSBuild and IgnoreStandardErrorWarningFormat

I'm trying to write a MSBuild project that will generate html documentation using doxygen. I couldn't find anything about that on the net except for one example, which seems incomplete; it doesn't parse doxygen warnings.
I found that MSBuild's Exec task has parameters like IgnoreStandardErrorWarningFormat and CustomWarningRegularExpression. What is the "Standard Error/Warning Format" and what kind of REs are allowed in these properties?
Edit: ah, "Inside the Microsoft Build Engine" wrongly describes it as property in .NET 3.5, where it is actually from 4. No use for me...
The standard msbuild error/warning format is described here.
In a nutshell, the format is:
MSBuild recognizes error messages and warnings that have been specially formatted by many command line tools that typically write to the console. For instance, take a look at the following error messages - they are all properly formatted to be MSBuild and Visual Studio friendly.
Main.cs(17,20): warning CS0168: The variable 'foo' is declared but never used
C:\dir1\foo.resx(2) : error BC30188: Declaration expected.
cl : Command line warning D4024 : unrecognized source file type 'foo.cs', object file assumed
error CS0006: Metadata file 'System.dll' could not be found.
These messages confirm to special format that is shown below, and comprise 5 parts - the order of these parts are important and should not change:
Origin (Required)
Origin can be blank. If present, the origin is usually a tool name, like 'cl' in one of the examples. But it could also be a file name, like 'Main.cs' shown in another example. If it is a file name, then it must be an absolute or a relative file name, followed by an optional parenthesized line/column information in one of the following forms:
(line) or (line-line) or (line-col) or (line,col-col) or (line,col,line,col)
Subcategory (Optional)
Subcategory is used to classify the category itself further, and should not be localized.
Category (Required)
Category must be either 'error' or 'warning'. Case does not matter. Like origin, category must not be localized.
Code (Required)
Code identifies an application specific error code / warning code. Code must not be localized and it must not contain spaces.
Text (Optional)
User friendly text that explains the error, and must be localized if you cater to multiple locales.
The format is fully documented in the MSBuild source code here.
I can't find docs on it right now, but I think the standard error format is something like
.*(\d+(,\d+(,\d+,\d+)?)?)?: error .*:.*
.*(\d+(,\d+(,\d+,\d+)?)?)?: warning .*:.*
examples:
c:\somefile.txt(10,20,10,30): error CMD1234: blarg
c:\somefile.txt(10,20): error CMD1234: yadda yadda
c:\somefile.txt: warning ARG5678: blah blah