- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
function detectSourceindex(aobject){
for (i=0; i<tabobjlinks.length; i++){
if (aobject==tabobjlinks[i]){
tabsourceindex=i //source index of tab bar relative to other tabs
break
}
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+112
function detectSourceindex(aobject){
for (i=0; i<tabobjlinks.length; i++){
if (aobject==tabobjlinks[i]){
tabsourceindex=i //source index of tab bar relative to other tabs
break
}
}
}
Челы позиционируют себя как супер пупер команда разработчиков
+112
public List<string> GetAllowedActionsOnHistory(UserInfo info, string objectName, string action, bool def) {
UserManager.Instance.Register(info);
return StaticFunctions.GetAllowedActions(new ObjectTypesWorker().GetByName("История сотрудника"));
}
Получение каких-то прав :-D
+111.7
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct pl
{
int speed;
double time;
char cname[25];
}player;
int cni;//countries number
static double disti;//distance of road
player *bpll;
class country
{
public:
// country();
// country(country& cnr);
void setinfo();
char name[25];
int pn;
int sp;
player *cpl;
player *bpl;
void getname(char *name);
void findbestplayer(int pp);
void sortplayers();
~country();
};
void country::setinfo()
{
static char nm[255];
printf("Enter country name\n");
gets(nm);
strcpy(name,nm);
printf("Country name: %s\n",name);
static char pnc[25];
printf("Enter number of players: ");
gets(pnc);
pn=atoi(pnc);
cpl=new player[pn];
for(int i2=0;i2<pn;i2++)
{
int spd;
static char spdc[10];
printf("Enter speed of player %d:",i2+1);
gets(spdc);
spd=atoi(spdc);
cpl[i2].speed=spd;
cpl[i2].time=disti/spd;
memset(&cpl[i2].cname,0x20,25);
strcpy(cpl[i2].cname,name);
printf("Player time %f\n",cpl[i2].time);
};
return;
};
country::~country()
{
delete []cpl;
delete []bpl;
};
void country::findbestplayer(int pp)
{
int min=0;
bpl=new player;
for(int i=1;i<pn;i++)
{
if(cpl[i].time<cpl[min].time){
min=i;
};
bpl=&cpl[min];
};
return;
};
int compare (player * arg1, player * arg2);
int main(int argc,char *argv[])
{
static char cn[10];
static char dist[10];
printf("Enter distance\n");
gets(dist);
disti=atoi(dist);
printf("Enter number of countries\n");
gets(cn);
cni=atoi(cn);
country c1[cni];
bpll=new player[cni];
for(int i=0;i<cni;i++)
{
c1[i].setinfo();
c1[i].findbestplayer(c1[i].pn);
printf("best time %f\n",c1[i].bpl->time);
bpll[i].speed=c1[i].bpl->speed;
bpll[i].time=c1[i].bpl->time;
Задача для олимпиады для подсчёта занятых мест по времени и скорости, каждого спортсмена, предыдущее но правильно работающее.
+111.6
private ArrayList MNK(Matrix x, ArrayList y) {
normalization(ref x);
for (int i = 0; i < x.N; i++)
for (int j = 0; j < x.M; j++)
x.data[i, j] = Chebyshev.function(x.data[i,j],POWER_POLYNOM);
Matrix yNew = Matrix.CreateMatrixFromArrayList(y);
Matrix tranc = x.Tranc_Matrix(x);
Matrix temp = x.Obernena_Matrix(x.Mul_Matrix(tranc, x));
temp = x.Mul_Matrix(temp, tranc);
temp = x.Mul_Matrix(temp, yNew);
yNew = yNew.Mul_Matrix(x,temp);
return (returnValue(yNew, y));
}
//****************************************************
#region
private static ArrayList returnValue(Matrix yNew, ArrayList y)
{
ArrayList t = new ArrayList();
Random r = new Random();
double k = 2;
for (int i = 0; i < y.Count; i++)
{
if (y.GetHashCode() == y1.GetHashCode())
k = 1;
if (y.GetHashCode() == y2.GetHashCode())
k = 4000;
if (y.GetHashCode() == y3.GetHashCode())
k = 1000000;
t.Add((double)y[i] + ((double)(r.NextDouble() * k - k/2)));
}
return t;
}
#endregion
вот как тру системные аналитики пишут свои прогнозы))))))))))
+111
@AutoValidated
public void remove(
@NotNull PaymentProviderConfiguration paymentProviderConfiguration
) {
paymentProviderConfiguration.setDeleted(true);
paymentProviderConfiguration.setDisabled(true);
paymentProviderConfiguration.setEditable(false);
paymentProviderConfigurationDAO.update(paymentProviderConfiguration);
context.getHibernate().evict(paymentProviderConfiguration);
context.getHibernate().flush();
}
интересно еще и то, что внутри paymentProviderConfigurationDAO.update(p aymentProviderConfiguration); есть еще один flush
+111
public void close() throws IOException {
try {
flush();
} catch (IOException ignored) {
}
out.close();
}
java.io.FilterOutputStream
+111
public class PmsUtil {
public static boolean allowViewFolder(IFolder folder) {
return isIntersected(folder.getPermissions(), getUserPms());
}
private static Set<Permission> getUserPms() {
return LoginController.get().getUser().getRole().getPermissions();
}
private static boolean isIntersected(Set<Permission> pmsSetA, Set<Permission> pmsSetB) {
for(Permission pms : pmsSetB) {
if(pmsSetA.contains(pms)) {
return true;
}
}
return false;
}
}
К слову об именах переменных... любил мой предшественник делать нестандартные сокращения.
+111
public static void kk(int KEY, int[] Q, ref int x)
{
if (KEY <= Q[4095]) // 0-4095
{
if (KEY <= Q[2047]) // 0-2047
{
if (KEY <= Q[1023]) // 0-1023
{
if (KEY <= Q[511]) // 0-511
{
if (KEY <= Q[255]) // 0-255
{
if (KEY <= Q[127]) // 0-127
{
if (KEY <= Q[63]) // 0-63
{
if (KEY <= Q[31]) // 0-31
{
if (KEY <= Q[15]) // 0-15
{
if (KEY <= Q[7]) // 0-7
{
if (KEY <= Q[3]) // 0-3
{
if (KEY <= Q[1]) // 0-1
{
if (KEY <= Q[0]) x = 0;
else x = 1;
} // end 0-1
else //2-3
{
if (KEY <= Q[2]) x = 2;
else x = 3;
} // end 2-3
} // end 0-3
.................................................................
С форума sql.ru: "......есть адский статический метод на 33.000 строк...."
+111
/* ..от молодых, дерзких и успешных,
форматирование и комментарии сохранены. */
void zanulit_massiv ()
{
int i;
for(i=0;i<27;i++) // dlja vseh elementov massiva
{
switch (i) // perebiraem
{
case 0: mass_znach[0]=3;
case 1: mass_znach[0]=5;
case 2: mass_znach[0]=6;
case 3: mass_znach[0]=1;
case 4: mass_znach[0]=2;
case 5: mass_znach[0]=3;
case 6: mass_znach[0]=4;
case 7: mass_znach[0]=5;
case 8: mass_znach[0]=6;
case 9: mass_znach[0]=31;
case 10: mass_znach[0]=2;
case 11: mass_znach[0]=1;
case 12: mass_znach[0]=1;
case 13: mass_znach[0]=1;
case 14: mass_znach[0]=33;
case 15: mass_znach[0]=15;
case 16: mass_znach[0]=13;
case 17: mass_znach[0]=8;
case 18: mass_znach[0]=43;
case 19: mass_znach[0]=2;
case 20: mass_znach[0]=9;
case 21: mass_znach[0]=14;
case 22: mass_znach[0]=17;
case 23: mass_znach[0]=21;
case 24: mass_znach[0]=22;
case 25: mass_znach[0]=8;
case 26: mass_znach[0]=5;
default: break; // objazatelno v sluchae neizvesnogo znacheniya
}
}
}
Не могу больше :|
+111
for(p=first; p!=NULL; p=p->next)
free(p);
Освобождаем память всех элементов списка.