Suite CRM , Creating users Issues - suitecrm

MY issue that when am trying to create a normal user from Suite CRM ( User Management ) after pressing save , the server getting loading without any response and in the same time another active user getting msgs ( Cannot connect to data base ) until i need to restart the server ?

Wed Sep 11 11:33:41 2019 [30147][8dfa3f2c-e526-6242-6732-585643139abd][INFO] Query: SELECT alerts.* , jt0.user_name modified_by_name , jt0.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt1.user_name created_by_name , jt1.created_by created_by_name_owner , 'Users' created_by_name_mod , jt2.user_name assigned_user_name , jt2.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod FROM alerts LEFT JOIN users jt0 ON alerts.modified_user_id=jt0.id AND jt0.deleted=0
AND jt0.deleted=0 LEFT JOIN users jt1 ON alerts.created_by=jt1.id AND jt1.deleted=0
AND jt1.deleted=0 LEFT JOIN users jt2 ON alerts.assigned_user_id=jt2.id AND jt2.deleted=0
AND jt2.deleted=0 where (alerts.assigned_user_id = '8dfa3f2c-e526-6242-6732-585643139abd' AND is_read != '1') AND alerts.deleted=0
Wed Sep 11 11:33:41 2019 [30147][8dfa3f2c-e526-6242-6732-585643139abd][INFO] Query Execution Time:0.0002281665802002
Wed Sep 11 11:33:41 2019 [30147][8dfa3f2c-e526-6242-6732-585643139abd][DEBUG] process_full_list_query: result is mysqli_result Object
(
[current_field] => 0
[field_count] => 23
[lengths] =>
[num_rows] => 0
[type] => 0
)
Wed Sep 11 11:33:41 2019 [30147][8dfa3f2c-e526-6242-6732-585643139abd][WARN] Saving error level. Try to remove the error_reporting() function from your code.
Wed Sep 11 11:33:41 2019 [30147][8dfa3f2c-e526-6242-6732-585643139abd][WARN] Pop error level. Try to remove the error_reporting() function from your code.
Wed Sep 11 11:33:41 2019 [30147][8dfa3f2c-e526-6242-6732-585643139abd][DEBUG] Hook called: ::server_round_trip
Wed Sep 11 11:33:41 2019 [30147][8dfa3f2c-e526-6242-6732-585643139abd][DEBUG] Calling MySQLi::disconnect()

Related

apache-flink: sliding window in output

I'm currently coding a small application to understand the sliding windowing in FLINK (with data input from a APACHE-KAFKA topic):
//Split kafka stream by comma and create tuple
DataStream<Tuple3<String, Integer, Date>> parsedStream = stream
.map((line) -> {
String[] cells = line.split(",");
return new Tuple3(cells[1], Integer.parseInt(cells[4]), f.parse(cells[2]));
});
DataStream<Tuple3<String, Integer, Date>> parsedStreamWithTSWM = parsedStream
.assignTimestampsAndWatermarks(new BoundedOutOfOrdernessTimestampExtractor<Tuple3<String, Integer, Date>>(Time.minutes(1)) {
#Override
public long extractTimestamp(Tuple3<String, Integer, Date> element) {
return element.f2.getTime();
}
});
//Sum values per windows and per id
DataStream<Tuple3<String, Integer, Date>> AggStream = parsedStreamWithTSWM
.keyBy(0)
.window(SlidingEventTimeWindows.of(Time.minutes(30), Time.minutes(1)))
.sum(1);
AggStream.print();
Is it possible to improve my output (AggStream.print();) by adding the window details which produce the aggregation output ?
$ tail -f flink-chapichapo-jobmanager-0.out
(228035740000002,300,Fri Apr 07 14:42:00 CEST 2017)
(228035740000000,28,Fri Apr 07 14:42:00 CEST 2017)
(228035740000002,300,Fri Apr 07 14:43:00 CEST 2017)
(228035740000000,27,Fri Apr 07 14:43:00 CEST 2017)
(228035740000002,300,Fri Apr 07 14:44:00 CEST 2017)
(228035740000000,26,Fri Apr 07 14:44:00 CEST 2017)
(228035740000001,27,Fri Apr 07 14:44:00 CEST 2017)
(228035740000002,300,Fri Apr 07 14:45:00 CEST 2017)
(228035740000000,25,Fri Apr 07 14:45:00 CEST 2017)
Thank you in advance
You can use the generic function apply where you have access to Window info.
public interface WindowFunction<IN, OUT, KEY, W extends Window> extends Function, Serializable {
/**
* Evaluates the window and outputs none or several elements.
*
* #param key The key for which this window is evaluated.
* #param window The window that is being evaluated.
* #param input The elements in the window being evaluated.
* #param out A collector for emitting elements.
*
* #throws Exception The function may throw exceptions to fail the program and trigger recovery.
*/
void apply(KEY key, W window, Iterable<IN> input, Collector<OUT> out) throws Exception;
}
See docs

Date format issue in Firefox browser

My code
for(n in data.values){
data.values[n].snapshot = new Date(data.values[n].snapshot);
data.values[n].value = parseInt(data.values[n].value);
console.log(data.values[n].snapshot);
}
here console.log shows perfect date in Chrome as 'Thu Aug 07 2014 14:29:00 GMT+0530 (India Standard Time)', but in Firefox it is showing as 'Invalid Date'.
If I console.log(data.values[n].snapshot) before the new Date line, it is showing date as
2014-08-07 14:29
How can I convert the date format to Firefox understandable way.
The Date object only officially accepts two formats:
Mon, 25 Dec 1995 13:30:00 GMT
2011-10-10T14:48:00
This means that your date 2014-08-07 14:29 is invalid.
Your date can be easily made compatible with the second date format though (assuming that date is yyyy-mm-dd hh:mm):
for(n in data.values){
n = n.replace(/\s/g, "T");
data.values[n].snapshot = new Date(data.values[n].snapshot);
data.values[n].value = parseInt(data.values[n].value);
console.log(data.values[n].snapshot);
}

Turn array of strings into array of dates in Google Apps Script

I have a Google Sheets spreadsheet. In Column B, I have a list of strings that are either dates or ranges of dates in the format month/date. For example:
7/26
7/27-7/31
8/1
8/2
8/3-8/5
I want to create an array with the first date on the left and the second date (if any) on the right. If there's no second date, it can be left blank. This is what I want:
[7/26,]
[7/27,7/31]
[8/1,]
[8/2,]
[8/3,8/5]
I've tried:
var r = 'B'
var dateString = sheet.getRange(dateColumns[r] + '1:' + dateColumns[r] + lastRow.toString()).getValues();
var dateArr = Utilities.parseCsv(dateString, '-');
But that just keeps concatenating all values. Also if it's possible to put the output in a date format that would be great too.
This was a funny exercise to play with...
Here is a code that does what you want :
function test(){
convertToDateArray('7/26,7/27-7/31,8/1,8/2,8/3-8/5');
}
function convertToDateArray(inputString){
if(typeof(inputString)=='string'){inputString=inputString.split(',')}; // if input is a string then split it into an array using comma as separator
var data = [];
var datesArray = [];
for(var n in inputString){
if(inputString[n].indexOf('-')==-1){inputString[n]+='-'};// if only 1 field add an empty one
data.push(inputString[n].split('-'));// make it an array
}
Logger.log(data);//check
for(var n in data){
var temp = [];
for(var c in data[n]){
Logger.log('data[n][c] = '+ data[n][c]);
var date = data[n][c]!=''? new Date(2014,Number(data[n][c].split('/')[0])-1,Number(data[n][c].split('/')[1]),0,0,0,0) : '';// create date objects with right values
Logger.log('date = '+date);//check
temp.push(date);
}
datesArray.push(temp);//store output data in an array of arrays, ready to setValues in a SS
}
Logger.log(datesArray);
var sh = SpreadsheetApp.getActive().getActiveSheet();
sh.getRange(1,1,datesArray.length,datesArray[0].length).setValues(datesArray);
}
Logger result for datesArray :
[[Sat Jul 26 00:00:00 GMT+02:00 2014, ], [Sun Jul 27 00:00:00 GMT+02:00 2014, Thu Jul 31 00:00:00 GMT+02:00 2014], [Fri Aug 01 00:00:00 GMT+02:00 2014, ], [Sat Aug 02 00:00:00 GMT+02:00 2014, ], [Sun Aug 03 00:00:00 GMT+02:00 2014, Tue Aug 05 00:00:00 GMT+02:00 2014]]

CakePHP grouping if row contains the same value

<?php
$user_first = "123";
$query = $this->Post->find("all", array("conditions"=>array("userid"=>$user_first, "type"=>"message"), "group"=>"date"));
foreach($query as $val){
echo $val["message"];
echo $val["date"];
}
?>
<div>
//Using foreach the results would be like this:
Jan 10 2012 Hello
Jan 10 2012 Hi
Jan 10 2012 Hey
Jan 10 2012 Yo!
Jan 12 2012 Nice
But I would want to achieve is this:
Jan 10 2012
Hello
Hi
Hey
Yo!
Jan 12 2012
Nice
</div>
I want to group the results using date. So that the if the dates have the same result, they dont have to be redundant. Thanks.
Try like this.
$newDate =null;
foreach($query as $val) {
if ($newDate !== $val["date"]) {
echo $val["date"]. "<br />";
}
echo $val["message"];
$newDate = $val["date"];
}
Cast/Convert the values to a Date type for your group by.
GROUP BY CAST(myDateTime AS DATE)

DBLib error driving me crazy

I am working on a perl script that has multiple database calls and I continuously get the following error:
DB-Library error:
Attempt to initiate a new SQL Server operation with results pending.
In my code I have the following:
The first call to the database performs a number of insert statements built from a hash:
while (my ($key, $value) = each(%holidays)) {
system("log4k", "DEBUG", "$0", "Staging holiday info data for: $cal_name: $key");
$sql = "INSERT INTO stg_holiday_data (hol_mnemonic, hol_date, hol_comment, dml_type) VALUES (\"$cal_name\", $key, \"$value\", \"N\")";
system("log4k", "TRACE", "$0", "SQL being executed: $sql");
if ($test == 0) {
$dbh->dbcmd($sql);
($dbh->dbsqlexec() && $dbh->dbresults)
or &fatalError("Database error in $sql", "DB_ERROR");
while($dbh->dbresults != NO_MORE_RESULTS) {
while(my #dat = $dbh->dbnextrow){}
}
}
}
immediately after that finishes I close off the connection, and cancel it to make sure that there are no results left to be processed by issuing:
$dbh->dbcancel();
$dbh->dbclose();
From there I call a separate subroutine to execute a stored procedure which will produce three lines of output signifying row numbers:
subroutine call
&run_sproc() if ($test == 0);
subroutine:
sub run_sproc() {
system("log4k", "DEBUG", "$0", "Loading staged holiday data");
my $sql1 = "upd_holiday_data";
system("log4k", "TRACE", "$0", "SQL being executed: $sql1");
my($dbh2) = new Sybase::DBlib $ENV{DATABASE_USER}, $ENV{DATABASE_PASSWORD}, $ENV{DATABASE_SERVER}, "GME_calendar_sync";
&fatalError("Failed to login imagine database", "DB_LOGIN_ERROR") unless ($dbh2);
$dbh2->dbcmd($sql1);
($dbh2->dbsqlexec() && $dbh2->dbresults )
or &fatalError ("Database error in $sql", "DB_ERROR");
while ($dbh2->dbresults != NO_MORE_RESULTS) {
while (my #d = $dbh2->dbnextrow) {
system("log4k", "TRACE", "$0", "Next row being inserted #d");
}
}
$dbh2->dbclose();
}
I do have a third SQL block that comes after the stored procedure that works fine with or without this subroutine.
What is happening is I am receiving the error mentioned above right before the results from the stored procedure print. I have tried everything I can imagine to make sure that all the results are being processed. A sample of the log output is below:
[Tuesday, 23 October 2012 13:30:02 BST] [DEBUG] gme_process_calendars.pl: Staging holiday info data for: CA: 20251226
[Tuesday, 23 October 2012 13:30:03 BST] [TRACE] gme_process_calendars.pl: SQL being executed: INSERT INTO stg_holiday_data (hol_mnemonic, hol_date, hol_comment, dml_type) VALUES ("CA", 20251226, "upload", "N")
[Tuesday, 23 October 2012 13:30:03 BST] [DEBUG] gme_process_calendars.pl: Staging holiday info data for: CA: 20220103
[Tuesday, 23 October 2012 13:30:03 BST] [TRACE] gme_process_calendars.pl: SQL being executed: INSERT INTO stg_holiday_data (hol_mnemonic, hol_date, hol_comment, dml_type) VALUES ("CA", 20220103, "upload", "N")
[Tuesday, 23 October 2012 13:30:03 BST] [DEBUG] gme_process_calendars.pl: Loading staged holiday data
[Tuesday, 23 October 2012 13:30:03 BST] [TRACE] gme_process_calendars.pl: SQL being executed: upd_holiday_data
DB-Library error:
Attempt to initiate a new SQL Server operation with results pending.
[Tuesday, 23 October 2012 13:30:03 BST] [TRACE] gme_process_calendars.pl: Next row being inserted 310107230
Any help with this would be greatly appreciated as I have already tried everything I can find doing an internet search and reading the documentation.
Thanks
I think your problem is that your run_proc method tries to execute this SQL:
my $sql1 = "upd_holiday_data";
which I doubt is a valid SQL command
Solution Found:
In the run_sproc sub routine, the check:
($dbh2->dbsqlexec() && $dbh2->dbresults )
or &fatalError ("Database error in $sql", "DB_ERROR");
the second condition $dbh2->dbresults is what is causing this error condition, once this was removed the error did not come up anymore.

Resources