key value relation on Skip List (DXL/DOORS) - skip-lists

I am trying to find the same login id users in database.
First I put every user to skiplist then I want to compare one by one. My question is how can i get the key value on Skiplist.
The piece of my code is here :
for lUser in userList do {
string uName = lUser.name
string uEmail = lUser.email
string uSys = lUser.systemLoginName
string uAdr = lUser.address
outBuf += uName sep uSys sep uEmail sep uAdr
outBuf += "\n"
// Here I have to add some code, I can put the values but not get again or compare
// I need some for loop and get every key value
put(skiplist,count,uSys)
print count
print "\n"
count++
}
Could someone give tips for this, I am new on this language. Thanks in advance.
EDIT: NOW IT IS WORKING
pragma runLim,0
string sep = ";"
string dbName = getDatabaseName
print "\n" "List of doors user in database " getDatabaseName ": \n\n"
int count = 0
User lUser
Group lGroup
Skip skiplist = create
for lUser in userList do {
string uName = lUser.name
string uEmail = lUser.email
string uSys = lUser.systemLoginName
string uAdr = lUser.address
if(null uSys)
{
print uName " doesn't have a System Name.\n"
} else {
bool flagDuplicate = false
string nameDuplicate = ""
string s = ""
for s in skiplist do {
if(s == uSys) {
flagDuplicate = true
nameDuplicate = (string key skiplist)
break
}
}
if(flagDuplicate) print "Users '" uName "' and '" nameDuplicate "' have the same System Name (" uSys ").\n"
else put(skiplist,uName,uSys)
}
}
pragma runLim,0 this line is for avoiding the execution time warning.

It sounds like what you are looking for is this:
for lUser in userList do {
string uName = lUser.name
string uEmail = lUser.email
string uSys = lUser.systemLoginName
string uAdr = lUser.address
outBuf += uName sep uSys sep uEmail sep uAdr
outBuf += "\n"
if(null uSys)
{
print uName " doesn't have a System Name.\n"
} else {
bool flagDuplicate = false
string nameDuplicate = ""
string s = ""
for s in skiplist do {
if(s == uSys) {
flagDuplicate = true
nameDuplicate = (string key skiplist)
break
}
}
if(flagDuplicate) print "Users '" uName "' and '" nameDuplicate "' have the same System Name (" uSys ")."
else put(skiplist,uName,uSys)
print "\n"
}
}
EDIT: I added a check for a blank uSys, you can do anything you want there, if you want to just add all the empty ones to a list then print it out at the end that would work too.
This should at least point you in the right direction.
NOTE: I don't have the ability to test this code currently so I apologize if there are any errors or typos. But I think it will get you close enough.
Good luck!

Related

Get data return from call function from soap is difference language

I have my project about soap.
I can call function from wsdl successfully but the string return is "????" which "???" is thai language.
server.php
<?php
require_once("lib/nusoap.php");
$server = new soap_server();
//$server->soap_defencoding = 'utf-8';
$server->decode_utf8 = false;
//$server->configureWSDL("Testing WSDL ","urn:Testing WSDL ");
$server->configureWSDL("GetInformation","urn:GetInformation");
//Create a complex type
//----------------------------------
//Add ComplexType with Array
$server->wsdl->addComplexType("ArrayOfString",
"complexType",
"array",
"",
"SOAP-ENC:Array",
array(),
array(array("ref"=>"SOAP- ENC:arrayType","wsdl:arrayType"=>"xsd:string[]")),
"xsd:string");
//----------------------------------
$server->register('getInfo',array('CASE_ID' => 'xsd:string'),array('return' => 'tns:ArrayOfString'),'urn:Info','urn:Info#getInfo');
function getInfo($case_id) {
include("ConnectSQL.php");
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
$strCase_ID = $case_id;
// Query
$qry = "SELECT * ";
$qry .= "FROM tbCustomer WHERE CASE_ID = '$strCase_ID' ";
//$arr[0]= $qry;
//execute the SQL query and return records
$result = mssql_query($qry);
//$arr[0] = $strCase_ID;
$i = 0;
$recordcount = mssql_num_rows($result);
if ($recordcount != 0)
{
//display the results
while($row = mssql_fetch_array($result))
{
$myname = $row["PREFIX"] ." ". $row["NAME"] ." ". $row["MIDDLE"]." " ;
$arr[$i] = $myname;
$i = $i+1;
}
//close the connection
mssql_close($dbhandle);
//return $myname; //iconv("ISO-8859-1", "UTF-8", $myname );
return $arr;
}
else
{
return $arr;
//echo "<font color=red>**</font> Username & Password is wrong";
}
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
exit();
?>
client side:
Dim clnt As New SoapClient30
Dim strText
Dim strID As String
clnt.MSSoapInit "http://localhost/MyProject4/server.php?wsdl"
strID = "001"
strText = clnt.getInfo(strID)
MsgBox strText(0)
I don't know way for encode from vb6 client.
thank you

Sending email with multiple attachments vb6

Can someone help me.How to send an email with multiples attachments.
I am using cdo and SMTP Send Mail for VB6. Everything works great except I am only able to send one attachment at a time.
here's the code
Public Function SendMail(sTo As String, sSubject As String, sFrom As String, _
sBody As String, sSmtpServer As String, iSmtpPort As Integer, _
sSmtpUser As String, sSmtpPword As String, _
sFilePath As String, bSmtpSSL As Boolean) As String
On Error GoTo SendMail_Error:
Dim lobj_cdomsg As CDO.Message
Set lobj_cdomsg = New CDO.Message
lobj_cdomsg.Configuration.Fields(cdoSMTPServer) = sSmtpServer
lobj_cdomsg.Configuration.Fields(cdoSMTPServerPort) = iSmtpPort
lobj_cdomsg.Configuration.Fields(cdoSMTPUseSSL) = bSmtpSSL
lobj_cdomsg.Configuration.Fields(cdoSMTPAuthenticate) = cdoBasic
lobj_cdomsg.Configuration.Fields(cdoSendUserName) = sSmtpUser
lobj_cdomsg.Configuration.Fields(cdoSendPassword) = sSmtpPword
lobj_cdomsg.Configuration.Fields(cdoSMTPConnectionTimeout) = 30
lobj_cdomsg.Configuration.Fields(cdoSendUsingMethod) = cdoSendUsingPort
lobj_cdomsg.Configuration.Fields.Update
lobj_cdomsg.To = sTo
lobj_cdomsg.From = sFrom
lobj_cdomsg.Subject = sSubject
lobj_cdomsg.TextBody = sBody
If Trim$(sFilePath) <> vbNullString Then
lobj_cdomsg.AddAttachment (sFilePath)
End If
lobj_cdomsg.Send
Set lobj_cdomsg = Nothing
SendMail = "ok"
Exit Function
SendMail_Error:
SendMail = Err.Description
End Function
Private Sub cmdSend_Click()
Dim retVal As String
Dim objControl As Control
For Each objControl In Me.Controls
If TypeOf objControl Is TextBox Then
If Trim$(objControl.Text) = vbNullString And LCase$(objControl.Name) <> "txtAttach" Then
Label2.Caption = "Error: All fields are required!"
Exit Sub
End If
End If
Next
Frame1.Enabled = False
Frame2.Enabled = False
cmdSend.Enabled = False
Label2.Caption = "Sending..."
retVal = SendMail(Trim$(txtTo.Text), _
Trim$(txtSubject.Text), _
Trim$(txtFromName.Text) & "<" & Trim$(txtFromEmail.Text) & ">", _
Trim$(txtMsg.Text), _
Trim$(txtServer.Text), _
CInt(Trim$(txtPort.Text)), _
Trim$(txtUsername.Text), _
Trim$(txtPassword.Text), _
Trim$(txtAttach.Text), _
CBool(chkSSL.Value))
Frame1.Enabled = True
Frame2.Enabled = True
cmdSend.Enabled = True
Label2.Caption = IIf(retVal = "ok", "Message sent!", retVal)
End Sub
Private Sub cmdBrowse_Click()
Dim sFilenames() As String
Dim i As Integer
On Local Error GoTo Err_Cancel
With cmDialog
.FileName = ""
.CancelError = True
.Filter = "All Files (*.*)|*.*|HTML Files (*.htm;*.html;*.shtml)|*.htm;*.html;*.shtml|Images (*.bmp;*.jpg;*.gif)|*.bmp;*.jpg;*.gif"
.FilterIndex = 1
.DialogTitle = "Select File Attachment(s)"
.MaxFileSize = &H7FFF
.Flags = &H4 Or &H800 Or &H40000 Or &H200 Or &H80000
.ShowOpen
' get the selected name(s)
sFilenames = Split(.FileName, vbNullChar)
End With
If UBound(sFilenames) = 0 Then
If txtAttach.Text = "" Then
txtAttach.Text = sFilenames(0)
Else
txtAttach.Text = txtAttach.Text & ";" & sFilenames(0)
End If
ElseIf UBound(sFilenames) > 0 Then
If Right$(sFilenames(0), 1) <> "\" Then sFilenames(0) = sFilenames(0) & "\"
For i = 1 To UBound(sFilenames)
If txtAttach.Text = "" Then
txtAttach.Text = sFilenames(0) & sFilenames(i)
Else
txtAttach.Text = txtAttach.Text & ";" & sFilenames(0) & sFilenames(i)
End If
Next
Else
Exit Sub
End If
Err_Cancel:
End Sub
You are only passing in one file. Try passing in an array of files and loop through the array. Or, since it looks like its semicolon delimiting the list of files selected, try to just split the list...
For Each s As String in sFilePath.Split(";"c)
lobj_cdomsg.AddAttachemt(s)
Next
I have no idea how to run a vb 6 app anymore, but if this helps, please mark it so.

Why is the same date echoing despite being created and stored properly in db?

I am pulling comments from my database. The 'created_on' field I have created is inserting properly, however when I echo the results, it's a random date and time that is the same no matter what(Mar 11, 2013 at 10:50 AM).
Here is my query to pull the records:
public function get_airwave_comments($profile_id)
{
$session = $this->session->userdata('is_logged_in');
$user_id= $this->session->userdata('id');
if($profile_id == $user_id)
{
$comments_query = "SELECT * FROM airwaves_comments aw,users u WHERE u.id=aw.from_id AND AW.FROM_id=aw.to_id AND aw.from_id=".$profile_id." order by aw.created_on desc" ;
}
else
{
$comments_query = "SELECT * FROM airwaves_comments aw,users u WHERE u.id=aw.from_id AND aw.to_id=".$profile_id." order by aw.created_on desc" ;
}
$query = $this->db->query($comments_query);
if($query->num_rows() >= 1)
{
$data = $query->result_array();
// return whole resultset. It contains zero, one or more records
return $data;
}
else return false;
$query = $this->db->query($poster_info_query);
if($query->num_rows() >= 1)
{
$data = $query->result_array();
// return whole resultset. It contains zero, one or more records
return $data;
}
else return false;
}
}
Here is the view in which I'm trying to echo the 'created_on' field properly:
if ($airwave && $profile_id == $session_id)
{
foreach ($airwave as $airwave_comment_row)
$airwave_comment_row = $airwave[0];
{
echo "<div id='profile_airwave'>";
echo $airwave_comment_row['comment'];
echo "<br />";
echo "<span class='profile_airwave_info'>";
echo date('M d, Y',strtotime($airwave_comment_row['created_on'])); ?> at <?php echo date('g:i A',strtotime($airwave_comment_row['created_on']));
echo "</span>";
echo "</div>";
}
}
so basically even if I just do echo $airwave_comment_row['created_on']; It's echoing the same said date.
thanks in advance.
I changed the name of the datetime column in the comments table so that it was different from the datetime column in the users table it's being spliced with.

Array in Powershell

I used to work with array in VBSCRIPT like below… I am not sure how I should do it in PowerShell… Can any help me out…?
CODE --> VBSCRIPT
dim arrErrors(12)
arrErrors(0) = "APP0"
arrErrors(1) = " APP1"
arrErrors(2) = " APP2"
arrErrors(3) = " APP3”
arrErrors(4) = "APP4"
arrErrors(5) = "APP5"
arrErrors(6) = "APP6"
arrErrors(7) = "APP7"
arrErrors(8) = "APP8"
arrErrors(9) = "APP9"
arrErrors(10) = "APP10"
arrErrors(11) = "APP11"
arrErrors(12) = "APP12"
for i = 0 to ubound(arrErrors)
strError = arrErrors(i)
if (left(lcase(strErrorLine), len(strError)) = lcase(strError)) then
objErrorLog.WriteLine strErrorLine & vbTab & strComputer & vbTab & "Found Error number" & vbTab & i
exit for
end If
Create a hash table. Populate it with error names and values. Parse the error string and look if the hash table contains it. Like so,
$htErr = #{ "app0" = 0; "app1" = 1; "app2" = 2 } # Populate hash table
$error = ... # get the error string from somewhere.
if($htErr[$error]) {
"Found error, code " + $htErr[$error] # Get code based on error string
}

How to get all returned lines with each oracle errror message into one variable using perl

How do i get all of the lines of "$dblink is down" into one $l_msg string?
Ideally I would like to get the error returned by oracle on failure and I cannot see a way to solve this.
my $dblinks = $l_dbh->selectcol_arrayref("select dbname from db_link");
for my $dblink (#$dblinks) {
my $l_results = eval {
my ($l_erg) = $l_dbh->selectrow_array("SELECT dummy||'OK' "
. $l_dbh->quote_identifier($dblink, undef, "dual") );
$l_erg;
};
while (#l_row = $l_results->fetchrow_array) {
$l_erg=$l_row[0];
if ($l_results !~ /XOK/) {
#l_errstr=();
l_msg="$dblink is down with #l_errstr"
# dblink45667 is down with ORA-12154"
} else {
say "$dblink is is up";
}
}
}
How about concatenating them to a variable outside of the loop:
my $dblinks = $l_dbh->selectcol_arrayref("select dbname from db_link");
my $l_msg = '';
for my $dblink (#$dblinks) {
my $l_results = eval {
my ($l_erg) = $l_dbh->selectrow_array("SELECT dummy||'OK' "
. $l_dbh->quote_identifier($dblink, undef, "dual") );
$l_erg;
};
while (#l_row = $l_results->fetchrow_array) {
$l_erg=$l_row[0];
if ($l_results !~ /XOK/) {
#l_errstr=();
l_msg .= "$dblink is down with #l_errstr"
# dblink45667 is down with ORA-12154"
} else {
say "$dblink is is up";
}
}
}