Accessing values from Publish profile - msbuild

Is there a way to access the vaules in the Publish Profile in the proj-file, when publishing from VS?
I get no value when using "$(SqlCmdVar__3)".
< Message Text="$(SqlCmdVar__3)" Importance="high"/ >
I just get the default values when using "%(SqlCmdVariable.Value)".
< Message Text="%(SqlCmdVariable.Value)" Importance="high"/ >
The variable is in my included file (included from proejct-file, with a before-build target that is executed ok except for this issue):
< SqlCmdVariable Include="TargetServerName">
< DefaultValue>TestServer1< /DefaultValue>
< Value>$(SqlCmdVar__3)< /Value>
< /SqlCmdVariable >

Related

How to utilize the batch function with multiple inputs to receive one agent from each input to meet the batch?

I have 8 inputs that I would like to combine to one agent using the batch block. All the inputs have the same flow rate (1 per minute) and I would like them all to deliver one and only one agent to the batch so all inputs deliver one agent for the batch to be complete.
I have tried to use a delay and queue to manually restrict flow but that has not worked. I got an error saying cannot restrict flow but I have the inputs set "agents that cant exist are destroyed".
I also looked into trying to use a function but have not come across one that makes sense in my problem. Any help would be appreciated!
In a very primitive way you can build the following model:
You will define the HOLD block as follows:
The function will check that each queue has at least one agent ready and then release agents from each HOLD block:
if (queue.size() > 0 &&
queue1.size() > 0 &&
queue2.size() > 0 &&
queue3.size() > 0 &&
queue4.size() > 0 &&
queue5.size() > 0 &&
queue6.size() > 0 &&
queue7.size() > 0 )
{
hold.unblock();
hold1.unblock();
hold2.unblock();
hold3.unblock();
hold4.unblock();
hold5.unblock();
hold6.unblock();
hold7.unblock();
}
Every time an agent arrives you call the function() under the onAtExit event of your sources.

Store T-SQL warning messages into table

Is there any way I can insert the warning messages into a table?
Specifically I mean the warnings that are like 'The module 'x' depends on the missing object 'y'. The module will still be created; however, it cannot run successfully until the object exists.' which are not picked up by the system error messages
You probably don't want to know about every single message, as some of them are completely benign, for example Warning: Null value is eliminated by an aggregate or other SET operation.
You can use sp_altermessage to log specific errors that are not logged by default.
EXEC sp_altermessage
#message_id = 2007,
#parameter = 'WITH_LOG',
#parameter_value = 'false';
The last parameter specifies whether to log to the Windows event log also.
The error you are talking about is error 2007. You can view all errors using
select * from sys.messages
Another option is to set up an Extended Events session, which logs all errors.
For example, I have this one on my server (note that it only logs to the ring buffer, but you can log to a file also).
CREATE EVENT SESSION [Errors] ON SERVER
ADD EVENT sqlserver.error_reported (
ACTION (
sqlserver.client_hostname,
sqlserver.sql_text,
sqlserver.tsql_stack
)
WHERE ([severity] > 10 AND [error_number] <> 3980 AND [error_number] <> 17830)
)
ADD TARGET package0.ring_buffer (
SET max_events_limit = 50,
occurrence_number= 50
)
WITH (
MAX_MEMORY = 4096 KB,
EVENT_RETENTION_MODE = ALLOW_SINGLE_EVENT_LOSS,
MAX_DISPATCH_LATENCY = 30 SECONDS,
MAX_EVENT_SIZE = 0 KB,
MEMORY_PARTITION_MODE = NONE,
TRACK_CAUSALITY = OFF,
STARTUP_STATE=ON
);
GO

python-ldap: Retrieve only a few entries from LDAP search

I wish to mimic the ldapsearch -z flag behavior of retrieving only a specific amount of entries from LDAP using python-ldap.
However, it keeps failing with the exception SIZELIMIT_EXCEEDED.
There are multiple links where the problem is reported, but the suggested solution doesn't seem to work
Python-ldap search: Size Limit Exceeded
LDAP: ldap.SIZELIMIT_EXCEEDED
I am using search_ext_s() with sizelimit parameter set to 1, which I am sure is not more than the server limit
On Wireshark, I see that 1 entry is returned and the server raises SIZELIMIT_EXCEEDED. This is the same as ldapsearch -z behavior
But the following line raises an exception and I don't know how to retrieve the returned entry
conn.search_ext_s(<base>,ldap.SCOPE_SUBTREE,'(cn=demo_user*)',['dn'],sizelimit=1)
Based upon the discussion in the comments, this is how I achieved it:
import ldap
# These are not mandatory, I just have a habit
# of setting against Microsoft Active Directory
ldap.set_option(ldap.OPT_REFERRALS, 0)
ldap.set_option(ldap.OPT_PROTOCOL_VERSION, 3)
conn = ldap.initialize('ldap://<SERVER-IP>')
conn.simple_bind(<username>, <password>)
# Using async search version
ldap_result_id = conn.search_ext(<base-dn>, ldap.SCOPE_SUBTREE,
<filter>, [desired-attrs],
sizelimit=<your-desired-sizelimit>)
result_set = []
try:
while 1:
result_type, result_data = conn.result(ldap_result_id, 0)
if (result_data == []):
break
else:
# Handle the singular entry anyway you wish.
# I am appending here
if result_type == ldap.RES_SEARCH_ENTRY:
result_set.append(result_data)
except ldap.SIZELIMIT_EXCEEDED:
print 'Hitting sizelimit'
print result_set
Sample Output:
# My server has about 500 entries for 'demo_user' - 1,2,3 etc.
# My filter is '(cn=demo_user*)', attrs = ['cn'] with sizelimit of 5
$ python ldap_sizelimit.py
Hitting sizelimit
[[('CN=demo_user0,OU=DemoUsers,DC=ad,DC=local', {'cn': ['demo_user0']})],
[('CN=demo_user1,OU=DemoUsers,DC=ad,DC=local', {'cn': ['demo_user1']})],
[('CN=demo_user10,OU=DemoUsers,DC=ad,DC=local', {'cn': ['demo_user10']})],
[('CN=demo_user100,OU=DemoUsers,DC=ad,DC=local', {'cn': ['demo_user100']})],
[('CN=demo_user101,OU=DemoUsers,DC=ad,DC=local', {'cn': ['demo_user101']})]]
You may use play around with more srv controls to sort these etc. but I think the basic idea is conveyed ;)
You have to use the async search method LDAPObject.search_ext() and separate collect the results with LDAPObject.result() until the exception ldap.SIZELIMIT_EXCEEDED is raised.
The accepted answer works if you are searching for less users than specified by the server's sizelimit, but will fail if you wish to gather more than that (the default for AD is 1000 users).
Here's a Python3 implementation that I came up with after heavily editing what I found here and in the official documentation. At the time of writing this it works with the pip3 package python-ldap version 3.2.0.
def get_list_of_ldap_users():
hostname = "google.com"
username = "username_here"
password = "password_here"
base = "dc=google,dc=com"
print(f"Connecting to the LDAP server at '{hostname}'...")
connect = ldap.initialize(f"ldap://{hostname}")
connect.set_option(ldap.OPT_REFERRALS, 0)
connect.simple_bind_s(username, password)
connect=ldap_server
search_flt = "(cn=demo_user*)" # get all users with a specific cn
page_size = 1 # how many users to search for in each page, this depends on the server maximum setting (default is 1000)
searchreq_attrlist=["cn", "sn", "name", "userPrincipalName"] # change these to the attributes you care about
req_ctrl = SimplePagedResultsControl(criticality=True, size=page_size, cookie='')
msgid = connect.search_ext_s(base=base, scope=ldap.SCOPE_SUBTREE, filterstr=search_flt, attrlist=searchreq_attrlist, serverctrls=[req_ctrl])
total_results = []
pages = 0
while True: # loop over all of the pages using the same cookie, otherwise the search will fail
pages += 1
rtype, rdata, rmsgid, serverctrls = connect.result3(msgid)
for user in rdata:
total_results.append(user)
pctrls = [c for c in serverctrls if c.controlType == SimplePagedResultsControl.controlType]
if pctrls:
if pctrls[0].cookie: # Copy cookie from response control to request control
req_ctrl.cookie = pctrls[0].cookie
msgid = connect.search_ext_s(base=base, scope=ldap.SCOPE_SUBTREE, filterstr=search_flt, attrlist=searchreq_attrlist, serverctrls=[req_ctrl])
else:
break
else:
break
return total_results

What are the different states in Clear Quest defect life cycle

I have not been using ClearQuest Web for a long time.Can anybody please tell the different states of the defects and its corresponding CQ status ?
The different states of the defects in CQ Web are:
> 1.New (Tester)
> 2. Estimate (Project management)
> 3.In Development(Developer)
> 4.Fix Complete(Developer)
> 5.Send to Release
> 6.Deferred
> 6.InAcceptance test
> 7.InInteration test
> 8.Insystem test
> 9.In release
> 10.Ready to Develop
> 11. Ready to test
> 12. Under Investigation
Open your schema using ClearQuest Designer and check State Transition Matrix.

Processing JS Hit Box Not Working

I am trying to make a hit box that causes a program restart when triggered.
Here is the code I am using:
if(snakey.position.x < mos.position.x + 20 && snakey.position.y > mos.position.y - 20 || snakey.position.x > mos.position.x - 20 && snakey.position.y < mos.position.y + 20){
Program.restart();
}
The problem is that instead of triggering the program restart when the hit box is entered it seems to be triggering randomly or at least very erratically. I have checked this several times and am getting no error messages so the syntax is fine.
Me and a friend have also both gone over the logic several times to make sure that the conditions can actually be met. We have found no problems, but it is still not activating the program restart at the right time or even at a consistent time I will link the full program bellow if anyone can tell me why it is acting so strange I would appreciate it.
https://www.khanacademy.org/computer-programming/spin-off-of-project-computational-creatures/5001415574814720
you need to wrap the conditions in brackets properly
if((snakey.position.x < mos.position.x + 20 && snakey.position.y > mos.position.y - 20) || (snakey.position.x > mos.position.x - 20 && snakey.position.y < mos.position.y + 20))