Crystal Reports - two print formats - printing

I have two ways to print a report, into a PDF or on letterhead.
Is it possible to have in a report a customization so that in the PDF I have a logo in the header, and on the letterhead I don't have that logo in the header?

You could add a parameter with a boolean to the report. Something like IsPDF and then in the header Click on the Format Graphic (assuming it is an image) of the logo and then choose the X2 across from the Suppress checkbox.
From there you can write code that will suppress the graphic when the IsPDF paramater is False and not suppress when the IsPDF is True.
IF {?IsPDF} = True Then
False
Edit: After writing this out I think I would actually make the boolean parameter be IsLetterHead so that when it was True it would be consistent with the True in the Suppress. In other words
IF {?IsLetterHead} = True Then
True

Related

iOS XCUITest isAccessibilityElement always false

Simple test case for UILabel
Given UILabel has following properties set:
label.accessibilityLabel = "Hello"
label.accessibilityTraits = .staticText
label.isAccessibilityElement = false
This test is successful despite "isAccessibilityElement = false", this test gives false positive result - if I run app Voiceover won't read this element.
XCTAssert(app.staticTexts["Hello"].exists)
So I thought adding additional check for isAccessibilityElement, but running UI test it is always false(also when label.isAccessibilityElement = true).
XCTAssert( app.staticTexts["Hello"].isAccessibilityElement) // always false
Am I missing something or "isAccessibilityElement" is not testable?
Is there any other approach how to check if element will be actually picked up by assistant e.g. Voiceover?

Force function arguments on individual lines

I want to format arguments as one per line, e.g. as follows:
cls.def(
"isHomogeneousElastic",
&SUB::System::isHomogeneousElastic,
"isHomogeneousElastic");
However, clang-format wants to format this as:
cls.def(
"isHomogeneousElastic", &SUB::System::isHomogeneousElastic, "isHomogeneousElastic");
How can I avoid this?
I found this question & answer with the solution of using:
BinPackArguments: false
BinPackParameters: false
ExperimentalAutoDetectBinPacking: false
AllowAllParametersOfDeclarationOnNextLine: false
which works on some parts in my code, but not on this particular example.

Breaking Links to Excel for PowerPoint Charts

I wrote a code to break links to the source excel file for my powerpoint deck, the macro works well except for 2 charts. Both the charts are on the same slide (which is not uncommon) and are line charts. The charts need to be manually updated but the data resides in a excel file only. Not sure what am I missing. This is the code that I wrote
Sub SavePPT()
Dim objPP As Object
Dim objPPFile As Object
Dim sld As Object
Dim shp As Object
Dim shp1 As Chart
Dim newshp As Shape
Dim pptChart As Object
Set objPP = CreateObject("PowerPoint.Application")
objPP.Visible = True
Set objPPFile = objPP.ActivePresentation
objPPFile.Save
Application.EnableEvents = False
For Each sld In objPPFile.Slides
For Each shp In sld.Shapes
If shp.HasChart Then
shp.LinkFormat.BreakLink
On Error GoTo 0
End If
Next
Next
Application.EnableEvents = False
For Each sld In objPPFile.Slides
For Each shp In sld.Shapes
If shp.Type = msoLinkedOLEObject Or shp.Type = msoEmbeddedOLEObject Then
shp.LinkFormat.BreakLink
On Error GoTo 0
End If
Next
Next
objPPFile.SaveAs ("Location" _ & Format(Now(), "MM-DD-YYYY") & ".pptx")
objPPFile.Close
objPP.Quit
Set pptChart = Nothing
Set objPPFile = Nothing
Set objPP = Nothing
End Sub
The chart might be in a placeholder, in which case none of your code will act upon it. If the shape's .Type = msoPlaceholder (ie, 14), check the shape's .PlaceholderFormat.ContainedType property to see if it's a linkedOleobject or .HasChart etc.
BTW, an msoEmbeddedOLEObject won't have a .LinkFormat object to call on; I suspect you have some error handling code that's obscuring an error there. In any case, I'd limit that check to just msoLinkedOLEObject.
Thanks for you help. I realized it later that those 2 slides have a lot of text boxes on them and when I consolidate some of those textboxes the issue was resolved.

Why does clang-format wrap this long line the way it does?

In clang-format the following template function declaration gets wrapped to three lines. I think it should only be wrapped to two. Is the problem in my .clang-format file or a bug in the tool?
template <class VEC3_T, class FLOAT_T>
FLOAT_T functionNamedBlahBlahhh(const VEC3_T blabla, const VEC3_T bla, FLOAT_T blah1,
FLOAT_T blah2) // foo
{
}
I am using clang-format version 10.0.0.
My .clang-format file is:
BasedOnStyle: LLVM # (LLVM, Google, Chromium, Mozilla, WebKit)
AccessModifierOffset: -4
AlignEscapedNewlines: Left
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
BreakBeforeBraces: Custom # If this is "Custom" then use the BraceWrapping settings
BraceWrapping:
AfterClass: false
AfterStruct: false
AfterUnion: true
AfterEnum: true
AfterNamespace: false
AfterControlStatement: false
AfterFunction: true
AfterExternBlock: false
BeforeCatch: true
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakConstructorInitializers: AfterColon
ColumnLimit: 130 # Drawback: AllowShort*OnASingleLine kind of goes crazy with it. Is there a Penalty property to adjust this?
IncludeBlocks: Regroup
IndentCaseLabels: false
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
PointerAlignment: Left
SpaceBeforeCpp11BracedList: true
UseTab: Never
I see a few other cases where it wraps a long line to 3+ lines, as well. Here's one more:
OCLShaderEnv::OCLShaderEnv(OCLEnv* oclEnv, SVMStruct* svm, std::string prog, std::string kernelName, int width, int height,
std::string buildOptions, Camera* camera, void* otherStuff, std::array<float, 4> fillColor) :
m_device(oclEnv->getDevice()),
m_context(oclEnv->getContext()), m_cmdQ(oclEnv->getCmdQ()), m_prog(prog), m_kernelName(kernelName), m_width(width),
m_height(height), m_camera(camera), m_svmStructPtr(svm), m_oclEnv(oclEnv)
{
}
Note the three lines of initializers that could easily fit on two.
In your first example, there appears to be an interaction between 1) starting with just one of the parameters on a line, and 2) having a comment on that line. If you remove the comment, it formats to:
template <class VEC3_T, class FLOAT_T>
FLOAT_T functionNamedBlahBlahhh(const VEC3_T blabla, const VEC3_T bla, FLOAT_T blah1, FLOAT_T blah2)
{
}
as you would expect. If you leave the comment, but start with all parameters on one line, it leaves them all on one line, as you would expect.
It seems like a bug in clang-format to me. Possibly it is intended behavior, thinking that the comment must apply to just that parameter and so shouldn't be moved around? But it's hard to imagine that being very useful.
Workaround: Remove the comment, or manually put all parameter together on one line.
In your second example, this seems to be an interaction between 1) having a constructor with enough parameters that the parameters take multiple lines, 2) having multiple initializers for that constructor, and 3) setting BreakConstructorInitializers: AfterColon. In this case, the first initializer is put on its own line even if it could be combined with the subsequent initializers.
This also seems like a bug in clang-format to me.
Workaround: Reduce the parameters to the constructor so that they fit on one line - which I know you shouldn't have to do, but might make your code cleaner anyway. Or set BreakConstructorInitializers to something other than AfterColon. Or just live with the sub-optimal formatting, which is probably what I would do :(.

World of Warcraft Lua - Changing frame:SetAttribute()

I'm working on an addon for World of Warcraft that completely overhauls the interface to adapt to my play style.
In this addon, I would like to have a large button that acts as a "main dps rotation" for my mage. I would like it to change what spell it casts based on what is optimal at any given time. It doesn't cast the spell automatically, it just presents the next best option for the user.
Here is my code so far:
print "Interface Overhaul : LOADED"
heatingUpIsActive = false
print(heatingUpIsActive)
local Button = CreateFrame("Button", "MyButton", UIParent,"SecureActionButtonTemplate")
Button:SetWidth(256)
Button:SetHeight(256)
Button:SetFrameStrata("HIGH")
Button:SetPoint("LEFT")
Button:SetText("Main Rotation")
Button:RegisterForClicks("AnyUp")
Button:SetAttribute("type", "spell")
Button:SetAttribute("spell", "Fireball")
Button:RegisterEvent("UNIT_AURA");
local function auraGained(self, event, ...)
if (UnitAura("player", "Heating Up")) then
if (heatingUpIsActive == false) then
heatingUpIsActive = true
print (heatingUpIsActive)
print ("Heating Up is active!")
Button:SetAttribute("spell", "Inferno Blast")
end
else
heatingUpIsActive = false
print("Heating Up is NOT active.")
print(heatingUpIsActive)
end
end
Button:SetScript("OnEvent", auraGained);
local tex = Button:CreateTexture("ARTWORK");
tex:SetPoint("LEFT")
tex:SetWidth(256)
tex:SetHeight(256)
tex:SetTexture("Interface\\AddOns\\InterfaceOverhaul\\Button2")
If heatingUpIsActive == true, I would like the button to cast ("spell", "Inferno Blast") instead of ("spell", "Fireball"), but it doesn't work if I place that into the correct part of the if statements.
Any thoughts?
As Mud said, you cannot rebind buttons in combat anymore. Blizzard made this change to prevent bots from being able to automate combat. Notably, in order to cast a spell you need to use one of the secure templates, and these secure templates only allow modification of the attributes that control what they do when you're not in combat. So you cannot have one button change spells mid-combat. Similarly, they also prevent you from modifying attributes like their position or visibility, so you cannot move buttons under the mouse either.
The best you can do is display a visual indicator of what spell should be cast, but rely on the user to actually press the correct button.

Resources