Select * from Order --doesn't work
select * from [order] --works
--it's planning module in our system...
I think, it's really bad idea to use reserved words in names of tables. I'm surprised, that this db doesn't contain table named like [select]...
int i=0;
for (i=0; i<msg.length;i++){
switch (i){
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 18:
case 19:
case 26:
case 27:
case 34:
case 35:
case 42:
case 43:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 58:
case 59:
case 62:
case 63: log.debug("******** TRAZA-BEA: autenticacion ntlm. mensaje[" + i + "]: " + msg[i] + " SINSIGNO: " + (int)(msg[i] & 0x00ff) + " " + new String(msg,i,1, "UTF-16LE")); break;
case 12:
case 14:
case 16:
case 20:
case 22:
case 24:
case 28:
case 30:
case 32:
case 36:
case 38:
case 40:
case 44:
case 46:
case 48:
case 56:
case 60:log.debug("******** TRAZA-BEA: autenticacion ntlm. mensaje[" + i + "]: " + msg[i] + " SINSIGNO: " + (int)(msg[i] & 0x00ff) + " " + new String(msg,i,2, "UTF-16LE")); break;
case 13:
case 15:
case 17:
case 21:
case 23:
case 25:
case 29:
case 31:
case 33:
case 37:
case 39:
case 41:
case 45:
case 47:
case 49:
case 57:
Why not case 60? LOL
try{
//...
getMyDataFromServer();
//...
}catch(Excepion e){
// :D
}
HMM FIXED BUG!
val weekEnd = DateTime.now.withDayOfWeek(5).plusDays(2)
@Override
public void afterTextChanged(Editable s) {
switch (paymentType) {
case 0:
if (s.length() == 9) etPaymentAmount.requestFocus();
break;
case 1:
if (s.length() == 9) etPaymentAmount.requestFocus();
break;
}
}
guard let reachability = Reachability(), reachability.isReachable == true else {
// No network connection available. Do stuff.
...
}
While this works, it's not immediately readable and creates confusion. Mis-using Swift's control flow. Did not pass code review.
try {
User.ClaimToken();
}
catch {
User.ClaimToken();
}
/// <summary>
/// Method that checks if an object is not null
/// </summary>
/// <param name="obj">extend type of <see cref="Object"/></param>
/// <returns>true if object is not null</returns>
public static bool NotNull(this Object obj)
{
return obj != null;
}
[TestMethod]
public void Test_Something()
{
// test
var result = DoSomething();
// assert
Assert.IsTrue(result.NotNull());
}
// Method put on each input component to unregister
// itself from the form
detachFromForm: function detachFromForm(component) {
var componentPos = this.inputs.indexOf(component);
if (componentPos !== -1) {
this.inputs = this.inputs.slice(0, componentPos).concat(this.inputs.slice(componentPos + 1));
}
this.validateForm();
},
oh boy
public void Handle(SomethingCreatedEvent e)
{
if (e.ActCode == "SOME_VALUE")
{
return;
}
else
{
// insert real function body here
}
}
Public Shared Function CompeleteDateStr(DateStr As String) As String
'MBS 96-09-25: High Caliber DataEntry
Dim DateVal = CType(DateStr, Integer)
If DateVal < 1 Then Return ""
If DateVal < maxDay Then 'DayOnly
Return MakeJalaliDate(curYear, curMonth, DateVal, _4DigitYear)
ElseIf DateVal > maxDay Then
Dim YearPiece? As Short = Nothing, MonthPiece? As Byte = Nothing, DayPiece As Byte
Select Case DateVal
Case Is < 100
MonthPiece = (DateVal \ 10) Mod 10
DayPiece = DateVal Mod 10
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
Case Is < 1000
MonthPiece = DateVal \ 10
DayPiece = DateVal Mod 10
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
MonthPiece = (DateVal \ 100) Mod 10
DayPiece = DateVal Mod 100
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
DayPiece = DateVal \ 10
MonthPiece = DateVal Mod 10
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
DayPiece = (DateVal \ 100) Mod 10
MonthPiece = DateVal Mod 100
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
Case Is < 10000
MonthPiece = DateVal \ 100
DayPiece = DateVal Mod 100
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
MonthPiece = DateVal Mod 100
DayPiece = DateVal \ 100
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
DayPiece = DateVal \ 100
MonthPiece = DateVal Mod 100
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
DayPiece = DateVal Mod 100
MonthPiece = DateVal \ 100
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, curYear) Then Return MakeJalaliDate(curYear, MonthPiece, DayPiece, _4DigitYear)
MonthPiece = (DateVal \ 10) Mod 10
YearPiece = DateVal \ 100
If IsValidMonth(MonthPiece) Then
DayPiece = DateVal Mod 10
If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
Else
MonthPiece = (DateVal \ 100) Mod 10
YearPiece = DateVal Mod 100
DayPiece = DateVal \ 1000
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
End If
Case Is < 100000
Dim DaySize As Byte = 2
MonthPiece = (DateVal Mod 1000) \ 10
If Not IsValidMonth(MonthPiece) Then
MonthPiece = (DateVal \ 100) Mod 10
DaySize = 1
If Not IsValidMonth(MonthPiece) Then Return ""
End If
YearPiece = DateVal \ 1000
DayPiece = DateVal Mod 10 ^ DaySize
If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
YearPiece = DateVal Mod 100
DayPiece = DateVal \ (10000 \ (10 ^ DaySize))
If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
Case Is < 1000000
MonthPiece = (DateVal Mod 10000) \ 100
If IsValidMonth(MonthPiece) Then
YearPiece = DateVal \ 10000
DayPiece = DateVal Mod 100
If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
YearPiece = DateVal Mod 100
DayPiece = DateVal \ 10000
If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
End If
YearPiece = DateVal \ 100
If YearPiece > 1300 AndAlso YearPiece < 1500 Then
MonthPiece = (DateVal \ 10) Mod 10
DayPiece = DateVal Mod 10
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
End If
YearPiece = DateVal Mod 10000
If YearPiece > 1300 AndAlso YearPiece < 1400 Then
DayPiece = DateVal \ 100000
MonthPiece = (DateVal \ 10000) Mod 10
If IsValidMonth(MonthPiece) AndAlso IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece + If(_4DigitYear, 0, -1300), MonthPiece, DayPiece, _4DigitYear)
End If
Case Is < 10000000
Dim DaySize As Byte = 2
MonthPiece = (DateVal Mod 1000) \ 10
If Not IsValidMonth(MonthPiece) Then
MonthPiece = (DateVal \ 100) Mod 10
DaySize = 2
If Not IsValidMonth(MonthPiece) Then Return ""
End If
YearPiece = DateVal \ 1000
DayPiece = DateVal Mod 10 ^ DaySize
If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
YearPiece = DateVal Mod 10000
DayPiece = DateVal \ (100000 * (10 ^ DaySize))
If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece)
Case Is < 100000000
MonthPiece = (DateVal Mod 10000) \ 100 '13961229
If IsValidMonth(MonthPiece) Then
YearPiece = DateVal \ 10000
DayPiece = DateVal Mod 100
If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
YearPiece = DateVal Mod 10000
DayPiece = DateVal \ 1000000
If IsValidDay(DayPiece, MonthPiece, YearPiece) Then Return MakeJalaliDate(YearPiece, MonthPiece, DayPiece, _4DigitYear)
End If
End Select
Return ""
End If
End Function
this code is so wrong in so many different levels
public function get($paymentType, $carrier, $gds, $clearingCompany, $allowDirectPayment)
{
AcqData::preload();
$carrier = strtoupper($carrier);
if($paymentType == 'cc') {
$gdsVal = $this->acqData->getGdsVal($gds);
if(!$allowDirectPayment ||
!$gdsVal ||
!isset($gdsVal['lr'], $gdsVal['direct'], $gdsVal['lr_commission_acq'], $gdsVal['direct_commission_acq'])
) {
$ccDefaultVal = $this->acqData->getPaymentTypeVal($paymentType);
return [[$ccDefaultVal, $ccDefaultVal], false];
}
$commission = $gdsVal['direct_commission_acq'];
$isDirect = $this->isDirect($carrier, $gds, $clearingCompany);
if(!$isDirect) {
$gdsVal['direct'] = $gdsVal['lr'];
$commission = $gdsVal['lr'];
}
return [
[$gdsVal['direct'], $commission],
$isDirect
];
}
$paymentTypeVal = $this->acqData->getPaymentTypeVal($paymentType);
return [
[$paymentTypeVal, $paymentTypeVal],
false
];
}
$ccDefaultVal = $this->acqData->getPaymentTypeVal($paymentType); is duplicated in two branches...
private static final double RESULT_OF_DIVISION_BY_0 = 9.99;
public static double getPercentageDifference(long currentResult, long previousResult) {
if (previousResult == 0 && currentResult == 0) {
return 0;
} else if (previousResult == 0) {
return RESULT_OF_DIVISION_BY_0;
} else {
return (currentResult - previousResult) * 1.0 / previousResult;
}
}
//count to 10
#include <iostream>
#include <string>
int main()
{
int i = 0;
beginning:
if (i < 10) {
std::cout << ++i << std::endl;
goto beginning;
}
else goto end;
end:
return 0;
}
zipped_file.extractall(f'{file_path}')
zipped_file.close()