SoftLayer order from quote - ibm-cloud

I have customized quote from SL, when placing order I use the following method:
guest = {'hostname': 'test', 'domain': 'example.com'}
container = client['Billing_Order_Quote'].getRecalculatedOrderContainer(id=quote_id)
container['quantity'] = 1
container['hardware'] = []
container['hardware'].append(guest)
container['presetId'] = None
To place an order I use placeOrder method:
client['Product_Order'].placeOrder(container)
I noticed the container gets revalidated every time order is about to be placed and gets changed/adjusted against the standard catalog. In the end my order is not the same as in the quote, all the customizations are not present. Is there any chance to get exactly what is in the quote?

Related

BigBlueButton change branding dynamically on different conference without changing files every time

I have BigBlueButton hosted on one server, I need to organize multiple conferences, But I need different brandings like a logo and background color to change with every single conference, So is there any approach to do this thing with BigBlueButton?
You can change the background color dynamically by adding a query parameter (userdata-customStyle) in join meeting request url. You can see more parameters in the given link userdata parameters.
I'm using greenlight, so I'm sharing a block of code which dynamically set the background color and add it to the query parameter of 'join meeting URL', I think this will help you.
def join_path(room, name, options = {}, uid = nil)
# Create the meeting, even if it's running
start_session(room, options)
# Determine the password to use when joining.
password = options[:user_is_moderator] ? room.moderator_pw : room.attendee_pw
# Generate the join URL.
join_opts = {}
join_opts[:userID] = uid if uid
join_opts[:join_via_html5] = true
join_opts[:guest] = true if options[:require_moderator_approval] && !options[:user_is_moderator]
print "------------------------- Background color----------------------------- \n"
if room.background_color
bg_color = "body { background-color: "+ room.background_color.to_s
bg_color += "!important;}"
else
"body { background-color: #06172A !important;}"
end
print bg_color
join_opts[:"userdata-customStyle"] = bg_color
bbb_server.join_meeting_url(room.bbb_id, name, password, join_opts)
end

Set object properties after setting the object

I've created a class with various properties in VB6.
The properties are
PiccoId
OrderId
UserId
StockCode
Quantity
At the top of the class I have declared 2 instances of classes I'm using.
Dim stkLine As CSOPSLine ' This is the class where the properties are declared and read
Private SOPSLines As cSLine ' This class creates the new objects and sets the property values
When the user enters the order number on a handheld barcode scanner, I'm creating an object to associate with this particular scanner like so:
Set SOPSLines = New cSLine
Set SOPSLines = getSOPSLine(ID, sOrder, "", "", 0)
In the next stage of the process, the user needs to enter their user ID so it can be seen which user scanned in the item.
I need to update the property of this same object, but I'm not sure how - Currently I am trying to do it within my getSOPSLine function, like this:
Dim line As New CSOPSLine
Dim bFound As Boolean
bFound = False
For Each line In SOPSLines.Items
If line.PiccoId = ID Then
line.OrderId = OrderId
line.Quantity = Qty
line.StockCode = stock
line.UserId = UserId
Set getSOPSLine = line
bFound = True
Exit For
End If
Next
If bFound = False Then
Set line = SOPSLines.Add(ID, OrderId, UserId, stock, Qty)
Set getSOPSLine = line
End If
Set line = Nothing
However, as I'm not storing sOrder at class level (Due to the fact multiple users can be using barcode scanners, the order ID can't be kept at class level as other users will just overwrite it),
I'm not sure how once I've got the next variable (In this case, userID, and the other variables after this stage) I can update the same object as I've just created.
I've tried to do something like
Set stkLine = getSOPSLine(ID, stkLine.OrderId, pUser, "", 0)
but it errors saying
object or with block variable has not been set
How can I update the properties of stkLine without constantly creating new objects?
EDIT
To clarify:
When the application receives data from the handheld barcode scanner, a select case is entered, with one case for each of the variables being entered (E.g. Order ID, user ID, stock code etc.)
The first case sets the order ID.
The code here is
Case FRAME_ORDER_SELECTION
On Error Resume Next
Dim sOrder As Long
sOrder = Picco.GetData(ID, 50)
If sOrder = 0 Then
Call Picco.Send(ID, FRAME_ORDER_SELECTION)
Exit Sub
Else
With Picco
Call .ClearForm(ID)
Call .Text(ID, LINE_1, "===== User ID =====")
Call .Text(ID, LINE_2, "")
Call .NewField(ID, 60, 5, FLD_LINE + SND_ENTER)
Call .Send(ID, FRAME_LINE_ADD)
Set SOPSLines = New cSLine
Set SOPSLines = getSOPSLine(ID, sOrder, "", "", 0)
End With
End If
frameid = FRAME_LINE_ADD
m_iLastFrameId = FRAME_ORDER_SELECTION
On Error GoTo Picco_DataArrived_Err
This is where the object is created.
The next case is after the user enters their user ID into the scanner.
Case FRAME_LINE_ADD
On Error Resume Next
Dim pUser As String
pUser = ""
pUser = Picco.GetData(ID, 60)
If pUser = "" Then
Exit Sub
End If
On Error GoTo Picco_DataArrived_Err
With Picco
Call .ClearForm(ID)
Call .Text(ID, LINE_1, "===== Add Line =====")
Call .Text(ID, LINE_2, "")
Call .Text(ID, LINE_7, "Scan or type code")
Call .NewField(ID, FIELD_POS, 18, FLD_LINE + FLD_READER + SND_ENTER)
Call .Send(ID, FRAME_LINE_QTY)
End With
Set stkLine = getSOPSLine(ID, stkLine.OrderId, pUser, "", 0)
frameid = FRAME_LINE_QTY
m_iLastFrameId = FRAME_LINE_ADD
Then there will be 2 or 3 more cases when populating the rest of the required values.
What I need to do, is in the second case (And all other following cases) update the properties of the object created in the first case.
I'm using the getSOPSLine function as this gets the object with the matching barcode scanner ID (As multiple users may be accessing different orders, they need to be kept separate in this way), but I'm not sure how to update the object where the scanner ID matches.
When you call getSOPSLine in each Case, enter some temporary values for the variables that you're not setting.
Example;
In the UserID case: stkLine = getSOPSLine(ID, 0, pUser, "", 0)
Then, in the getSOPSLine() function, change it so that instead of setting the values automatically, it instead only updates them if they don't equal 0, or "", or whichever temporary variables you use.
That way you're updating the same object, but aren't storing data that may get overwritten.
I'm not sure what you're confused about; I think that you must have some misunderstanding of what objects, variables, and properties are that is preventing you from asking this in a way that I understand. I'm not sure how your code lines up with your questions. But I'll give this a shot:
Private SOPSLines As cSLine
Set SOPSLines = New cSLine
Set SOPSLines = getSOPSLine(ID, sOrder, "", "", 0)
This declares a class-level variable, that can hold a cSLine object. That seems reasonable. Then you create a new instance of cSLine to put in that variable. But I don't know why, because you then point the variable to a different instance entirely, which is the instance returned from your getSOPSLine function. That middle line doesn't seem to be doing anything, and I'm not sure what you're trying to do with it.
I've tried to do something like
Set stkLine = getSOPSLine(ID, stkLine.OrderId, pUser, "", 0)
but it errors saying
object or with block variable has not been set
Well, then it sounds like stkLine isn't set to an object. I don't see any code that's trying to set stkLine other than that line. So when you try to get stkLine.OrderId, there isn't an object to get the OrderID property of, so it gives you an error.
I need to update the property of this same object, but I'm not sure how
Well, if there's an object you care about, you probably have it in a variable somewhere. You use variable.property = value syntax to assign value to the property of the object currently stored in variable.
But again, I'm not sure where your confusion is, since you're clearly assigning properties of objects in your code already.
If you're not understanding how objects work in VB, I'd recommend reading through the Working with Objects chapter of the documentation.
And if your confusion lies elsewhere, perhaps you could put together a more specific question about what you're trying to do?

IPython script runs on Spotfire Client, not Spotfire Web

I have the following python script (reduced, but the rest of it performs similar actions):
from Spotfire.Dxp.Application.Visuals import *
from Spotfire.Dxp.Data import *
#assign default values for prompts if needed
if Document.Properties['cannedKPISelected'].isspace():
Document.Properties['cannedKPISelected'] = 'GS'
if Document.Properties['cannedTimeSelected'].isspace():
Document.Properties['cannedTimeSelected'] = 'Month'
#determine which type of viz needs displayed based on a flag in the data
tableName='PrimaryDataTable'
columnToFetch='displayPercentageFlag'
activeTable=Document.Data.Tables[tableName]
rowCount = activeTable.RowCount
rowsToInclude = IndexSet(rowCount,True)
cursor1 = DataValueCursor.CreateFormatted(activeTable.Columns[columnToFetch])
for row in activeTable.GetRows(rowsToInclude,cursor1):
rowIndex = row.Index
percentageNeeded = cursor1.CurrentValue
break
#create consumer report
for page in Document.Pages:
for viz in page.Visuals:
if str(viz.Id) == 'a7f5b4ec-f545-4d5f-a967-adec4c9fec79':
if Document.Properties['coffeeReportSelected'] == 'Brand Category by Market':
if Document.Properties['cannedKPISelected'] == 'GS' and Document.Properties['cannedTimeSelected'] == 'Month' and percentageNeeded == 'Y':
visualContentObject = viz.As[VisualContent]()
visualContentObject.MeasureAxis.Expression = 'Sum([GS Month]) as [GS Mnth]'
visualContentObject.RowAxis.Expression = '<[BRAND] as [Brand Category] NEST [MARKET] as [Market]>'
visualContentObject.ColumnAxis.Expression = '<[Axis.Default.Names] as [Measure Names]>'
visualContentObject.ShowColumnGrandTotal = True
visualContentObject.ShowColumnSubtotals = True
visualContentObject.ShowRowGrandTotal = False
visualContentObject.Title = 'Monthly GS by Brand, Market'
visualContentObject.Data.WhereClauseExpression = '[NAME] = "CANADA"'
visualContentObject.CellWidth = 125
Document.Properties['cannedReportHideRows'] = 'Sum(Abs(SN([GS Month],0)))'
elif Document.Properties['cannedKPISelected'] == 'GS' and Document.Properties['cannedTimeSelected'] == 'Quarter' and percentageNeeded == 'Y':
visualContentObject = viz.As[VisualContent]()
visualContentObject.MeasureAxis.Expression = 'Sum([GS Quarter]) as [GS Qtr]'
visualContentObject.RowAxis.Expression = '<[BRAND] as [Brand] NEST [MARKET] as [Market]>'
visualContentObject.ColumnAxis.Expression = '<[Axis.Default.Names] as [Measure Names]>'
visualContentObject.ShowColumnGrandTotal = True
visualContentObject.ShowColumnSubtotals = True
visualContentObject.ShowRowGrandTotal = False
visualContentObject.Title = 'Quarterly GS by Brand, Market'
visualContentObject.Data.WhereClauseExpression = '[NAME] = "CANADA"'
visualContentObject.CellWidth = 125
Document.Properties['cannedReportHideRows'] = 'Sum(Abs(SN([GS Quarter],0)))'
So on and so forth.
This script (and others) run perfectly fine in the client. It does not run in the web. The web will say processing, then say ready (in the bottom left corner), all while doing nothing (no error, nothing). A few other scripts that I have in the same analysis run perfectly fine.
I know there are some limitations on IPython scripts on the web for security reasons, but I am only building a table. This cant be restricted can it? Web server logs are not capturing anything out of the ordinary.
We are on Spotfire 7.6
UPDATE: It seems to be due to this: if str(viz.Id) == 'a7f5b4ec-f545-4d5f-a967-adec4c9fec79':. This is because IDs are different between Web and Client unfortunately. Knowing my title changes as well, any ideas on what I could reference a visualization by that stays the same between client and web?
Because Spotfire changes IDs of a vis depending on whether it is on the web player vs the client, the script was not working as intended. I simply added the vis as a parameter instead of relying on the script to go and locate the correct vis. When the name of the vis changes, the parameter is updated correctly so it is still dynamic.
Could you just figure out what the index is on the current visual and refer to it that way?
Try something like:
Replace this line:
if str(viz.Id) == 'a7f5b4ec-f545-4d5f-a967-adec4c9fec79':
With:
if viz[0] (or whatever the index is)
Not sure if this is what you had in mind, but I believe this will give you a way to refer to the visualization without having to use an ID.

OneNote create Page with UpdateHierarchy - how to find new page?

I managed to create sections at very specific places within my OneNote Notebooks. Now I want to achieve the same with pages. So instead of using the unpredicteable-placing "CreateNewPage" method, I use UpdateHierarchy which works perfectly fine (for testing purpose I'm using AppendChild below).
The only issue I'm having is, that after creating the new page using UpdateHierarchy I'm completely loosing any links to the newly created page. OneNote assigns an ID and ignores all further Tags/Names I give. Also setting the One:T member used for setting the title is getting ignored - it always creates an "Untitled Page".
Am I doing anything wrong or do I need to first CreateNewPage and, using the assigned page-ID, re-place it using UpdateHierarchy?
Regards
Joel
function createPage {
param([string]$title, [string]$sectionnode)
[string]$pageref=$null
# Gather the pages within the notebook
[xml]$ref = $null
$_globalOneNote["COM"].GetHierarchy($sectionnode, [Microsoft.Office.InterOp.OneNote.HierarchyScope]::hsPages, [ref]$ref)
[System.Xml.XmlNamespaceManager] $nsmgr = $ref.NameTable
$nsmgr.AddNamespace('one', "http://schemas.microsoft.com/office/onenote/2010/onenote")
# Creation of a new page
$newPage = $ref.CreateElement('one', 'Page', 'http://schemas.microsoft.com/office/onenote/2010/onenote')
$newTitle = $ref.CreateElement('one', 'Title', 'http://schemas.microsoft.com/office/onenote/2010/onenote')
$newOE = $ref.CreateElement('one', 'OE', 'http://schemas.microsoft.com/office/onenote/2010/onenote')
$newT = $ref.CreateElement('one', 'T', 'http://schemas.microsoft.com/office/onenote/2010/onenote')
$newPage.SetAttribute('name', "Olololo")
$newT.InnerText = '<![CDATA[Testtitle]]>'
$newOE.AppendChild($newT)
$newTitle.AppendChild($newOE)
$newPage.AppendChild($newTitle)
$ref.Section.AppendChild($newPage)
$_globalBJBOneNote["COM"].UpdateHierarchy($ref.OuterXML)
}
This does the trick. Setting of title etc. must still be done using UpdatePageContent however the new page is placed properly. For putting metadata (title, indention etc.) a separate function may be used that works using the returned GUID of the createPage function.
function createPage {
param([string]$sectionnode, [string]$pagenode = $sectionnode)
# Gather the sections within the notebook
[xml]$ref = $null
$_globalBJBOneNote["COM"].GetHierarchy($sectionnode, [Microsoft.Office.InterOp.OneNote.HierarchyScope]::hsPages, [ref]$ref)
[System.Xml.XmlNamespaceManager] $nsmgr = $ref.NameTable
$nsmgr.AddNamespace('one', "http://schemas.microsoft.com/office/onenote/2010/onenote")
# Create new page
[string]$pageID = $null
$_globalBJBOneNote["COM"].createNewPage($ref.Section.ID, [ref]$pageID)
# Reload the hierarchy, now we can get the node of the new notebook
$_globalBJBOneNote["COM"].GetHierarchy($sectionnode, [Microsoft.Office.InterOp.OneNote.HierarchyScope]::hsPages, [ref]$ref)
$newPageNode = $ref.SelectSingleNode('//one:Page[#ID="' + $pageID + '"]', $nsmgr)
$referencePageNode = $ref.SelectSingleNode('//one:Page[#ID="' + $pagenode + '"]', $nsmgr)
# Reposition
[void]$ref.Section.removeChild($newPageNode)
[void]$ref.Section.InsertAfter($newPageNode, $referencePageNode)
$_globalBJBOneNote["COM"].UpdateHierarchy($ref.OuterXML)
$pageID
}

Zend router: combining a list of urls into a single or list

I have several urls:
/dave
/davina
/dave/chris
/davina/peter
I have entries for all of them in my routes, an example of this is:
routes.dave.route = /dave
routes.dave.defaults.module = default
routes.dave.defaults.controller = person
routes.rcp.defaults.action = index
routes.davina.route = /dave/chris
routes.davina.defaults.module = default
routes.davina.defaults.controller = person
routes.davina.defaults.action = index
I think you can see straight away that I have a duplication issue. Is there a way of combining multiple urls into a single route?
I have played around with using /:person but I also have other content aswell not going to person controller.
routes.person.route = /:personname
routes.person.defaults.module = default
routes.person.defaults.controller = person
routes.person.defaults.action = index
routes.person.reqs.personname = "^[a-zA-Z0-9]+$"
Urls such as /search?person=dave which goes off to the search controller is obviously being killed by the expression above.
Can I express the requirement as a list? "dave|davina|etc" or is there another magical zend method of doing this?
UPDATE:
I was playing around and came across this partial solution:
routes.person.route = /:personname
routes.person.defaults.module = default
routes.person.defaults.controller = person
routes.person.defaults.action = index
routes.person.reqs.personname = "(dave|davina)"
routes.person.route = /:person/:personname
routes.person.defaults.module = default
routes.person.defaults.controller = person
routes.person.defaults.action = index
routes.person.reqs.personname = "(chris|peter)"
I am going to run with this for the moment as is satisfies my requirements but I will leave this open(at least for a day) for anyone to offer there advice. The main issues is that both lists are going to grow, which will eventually cause an issue.
I think I may have the anwser for that.
In ZF, the routes are matched in reverse-order. So the last defined route, is the first matched.
In this case, you should define your /:person/:personname route, then define the others static routes like about page, contact page, etc.
If I understand Zend correctly, it should work. This do that in clear:
url=/about
match route "/about"
url=/david/parker
match route "/:person/:personname"
not "/about" or "/contact"