Boolean b = new Boolean(true);
if (b == true){
...
}
think outside the autoboxing
let True = true
let False = false
使用Python的 True 和 False 在javascript
function urlREPLACER(dtTEXTVALUE){
dtTEXTVALUE.indexOf('http://') != -1 && (dtTEXTVALUE = dtTEXTVALUE.replace('http://','')) && dtTEXTVALUE.indexOf('.aspx') == -1 && (dtTEXTVALUE += '.aspx');
return dtTEXTVALUE;
}
/// <summary>
/// Desctop constructor
/// </summary>
...
This is best XML commentary I found so far.
i++;
i++;
i++;
i++;
Console.WriteLine(i);
He doesn't know what is " i+=4 " :||||
in_array($this->market, ["ru"])
There is an old mysterious legend, which says that those conditions are lightening fast which are using in_array($source, ["target"]) instead of just "==". Is says always that probably you never do code refactoring, and keep all shit alive
public void updateCurrency() {
LOGGER.info("Update currencies");
var ok = false;
try {
getExchangeRatesMechanism(getExchangeRatesProcessor());
ok = true;
} catch (Exception exception) {
LOGGER.error(exception.getMessage(), exception);
}
if (ok) {
LOGGER.info("The currencies were updated successfully!");
}
}
CREATE OR REPLACE FUNCTION melodious.query_flags(user_name varchar(32), chan_name varchar(32), igroup_name varchar(32), iflag_name varchar(32), flagcheck bool)
RETURNS TABLE (
group_holders jsonb [],
flag_id int4,
flag_name varchar(32),
flag jsonb
)
LANGUAGE plpgsql
AS $$
DECLARE
uid int4 := NULL;
cid int4 := NULL;
gid int4 := NULL;
BEGIN
IF user_name <> '' THEN
SELECT id INTO uid FROM melodious.accounts WHERE username=user_name;
IF uid IS NULL THEN
RAISE EXCEPTION 'no such user';
END IF;
END IF;
IF chan_name <> '' THEN
SELECT id INTO cid FROM melodious.channels WHERE name=chan_name;
IF cid IS NULL THEN
RAISE EXCEPTION 'no such channel';
END IF;
END IF;
IF igroup_name <> '' THEN
SELECT id INTO gid FROM melodious.groups WHERE name=igroup_name;
IF gid IS NULL THEN
RAISE EXCEPTION 'go such group';
END IF;
END IF;
IF igroup_name = '' THEN
IF iflag_name = '' THEN
IF user_name = '' AND chan_name = '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE (NOT flagcheck) OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
GROUP BY gf.id, gf.name;
ELSIF user_name <> '' AND chan_name <> '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE (gh.user_id = uid AND gh.channel_id = cid)
OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id = cid)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
GROUP BY gf.id, gf.name;
ELSIF user_name <> '' AND chan_name = '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE (NOT flagcheck AND gh.user_id = uid)
OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
GROUP BY gf.id, gf.name;
ELSIF user_name = '' AND chan_name <> '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE (NOT flagcheck AND gh.channel_id = cid)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id = cid)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
GROUP BY gf.id, gf.name;
END IF;
ELSE
IF user_name = '' AND chan_name = '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE (gf.name = iflag_name)
AND (
(NOT flagcheck)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
)
GROUP BY gf.id, gf.name;
ELSIF user_name <> '' AND chan_name <> '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE gf.name = iflag_name
AND (
(gh.user_id = uid AND gh.channel_id = cid)
OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id = cid)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
)
GROUP BY gf.id, gf.name;
ELSIF user_name <> '' AND chan_name = '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE gf.name = iflag_name
AND (
(NOT flagcheck AND gh.user_id = uid)
OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
)
GROUP BY gf.id, gf.name;
ELSIF user_name = '' AND chan_name <> '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB((SELECT name FROM melodious.groups WHERE id=gh.group_id LIMIT 1)))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE gf.name = iflag_name
AND (
(NOT flagcheck AND gh.channel_id = cid)
OR (flagcheck AND gh.channel_id = cid AND gh.user_id IS NULL)
OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id IS NULL)
)
GROUP BY gf.id, gf.name;
END IF;
END IF;
ELSE
IF iflag_name = '' THEN
IF user_name = '' AND chan_name = '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE gh.group_id = gid
AND (
(NOT flagcheck)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
)
GROUP BY gf.id, gf.name;
ELSIF user_name <> '' AND chan_name <> '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE gh.group_id = gid
AND (
(gh.channel_id = cid AND gh.user_id = uid)
OR (flagcheck AND gh.channel_id = cid AND gh.user_id IS NULL)
OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id = uid)
OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id IS NULL)
)
GROUP BY gf.id, gf.name;
ELSIF user_name <> '' AND chan_name = '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE gh.group_id = gid
AND (
(NOT flagcheck AND gh.user_id = uid)
OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
)
GROUP BY gf.id, gf.name;
ELSIF user_name = '' AND chan_name <> '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE gh.group_id = gid
AND (
(NOT flagcheck AND gh.channel_id = cid)
OR (flagcheck AND gh.channel_id = cid AND gh.user_id IS NULL)
OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id IS NULL)
)
GROUP BY gf.id, gf.name;
END IF;
ELSE
IF user_name = '' AND chan_name = '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
INNER JOIN melodious.groups g
ON g.id = gh.group_id
WHERE (gf.name = iflag_name AND gh.group_id = gid)
AND (
(NOT flagcheck)
OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id IS NULL)
)
GROUP BY gf.id, gf.name;
ELSIF user_name <> '' AND chan_name <> '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE (gf.name = iflag_name AND gh.group_id = gid)
AND (
(gh.user_id = uid AND gh.channel_id = cid)
OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id = cid)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
)
GROUP BY gf.id, gf.name;
ELSIF user_name <> '' AND chan_name = '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE (gh.group_id = gid AND gf.name = iflag_name)
AND (
(NOT flagcheck AND gh.user_id = uid)
OR (flagcheck AND gh.user_id = uid AND gh.channel_id IS NULL)
OR (flagcheck AND gh.user_id IS NULL AND gh.channel_id IS NULL)
)
GROUP BY gf.id, gf.name;
ELSIF user_name = '' AND chan_name <> '' THEN
RETURN QUERY SELECT
ARRAY_AGG(JSONB_SET(ROW_TO_JSON(gh)::JSONB, '{group_name}'::TEXT[], TO_JSONB(igroup_name))) AS group_holders,
gf.id flag_id,
gf.name flag_name,
gf.flag flag
FROM melodious.group_holders gh
INNER JOIN melodious.group_flags gf
ON gh.group_id = gf.group_id
WHERE (gf.name = iflag_name AND gh.group_id = gid)
AND (
(NOT flagcheck AND gh.channel_id = cid)
OR (flagcheck AND gh.channel_id = cid AND gh.user_id IS NULL)
OR (flagcheck AND gh.channel_id IS NULL AND gh.user_id IS NULL)
)
GROUP BY gf.id, gf.name;
END IF;
END IF;
END IF;
END;
$$;
bool vlNoExitIfZeroBytesReceived = false; // false: can exit when receive 0 later; 1: can not exit when receive 0 later;
s[strlen(s)] = '\0';
<?php
public function parse($package)
{
if(isset($package["type"]) && $package["type"] == "unavailable")
{
if(((time() - self::$xmpp->users[(string)$package["from"]]["jointime"] < 30 && (isset(self::$xmpp->users[(string)$package["from"]]["messages"]) && self::$xmpp->users[(string)$package["from"]]["messages"] < 2) && (time() - self::$xmpp->startTime) > 50)) || (!isset(self::$xmpp->users[(string)$package["from"]]["messages"]) && time() - self::$xmpp->users[(string)$package["from"]]["jointime"] < 900 && (time() - self::$xmpp->startTime) > 900))
{
if(!array_search(strstr(self::$xmpp->users[(string)$package["from"]]["jid"], "/", true), explode("\n", file_get_contents("friends.txt"))))
{
self::$xmpp->ban(strstr($package["from"], "/", true), self::$xmpp->users[(string)$package["from"]]["jid"]);
self::$xmpp->groupMessage(strstr($package["from"], "/", true), substr(strstr($package["from"], "/"), 1)." został zbanowany/a za przeciąg!");
}
}
else
if(!array_search(strstr(self::$xmpp->users[(string)$package["from"]]["jid"], "/", true), explode("\n", file_get_contents("friends.txt"))))
file_put_contents("friends.txt", file_get_contents("friends.txt")."\n".strstr(self::$xmpp->users[(string)$package["from"]]["jid"], "/", true));
}
}
In fact whole project is shitty as hell, if you want have some fun grab popcorn and read all the sources: XPBot on sourceforge
$command = 'curl -X GET -H "application/json" -H "X-Api-Key: '.$key.'" https://some-api.com/resource';
exec($command, $output);
$array = json_decode($output[0], true);
Using curl in PHP is boring. Let execute a command for
.black {
color: #000;
}
.not-black {
color: #999;
}
function IsAOrB(const p_Id: string): boolean;
begin
if ((p_Id = 'A') or (p_Id = 'B')) then begin
Result := true;
Exit;
end;
Result := false;
end;
Result := ((p_Id = 'A') or (p_Id = 'B'));
That would have been enough. But this also features Exit and an asymmetrical if.
boolean darkModeSelected = (!darkModeSelected ? true : false);