- 1
- 2
- 3
- 4
- 5
- 6
#define TRUE (1)
#define FALSE (0)
#define internal protected:
#define external public:
#define declareSuper(superClass) protected: typedef superClass super
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+24
#define TRUE (1)
#define FALSE (0)
#define internal protected:
#define external public:
#define declareSuper(superClass) protected: typedef superClass super
Оттуда.
+111
// todo
/// <summary>
/// Генерация пароля из GUID
/// </summary>
/// <param name="guid">GUID</param>
/// <returns>пароль</returns>
public string PasswordByGuid(string guid)
{
return guid[33].ToString()
+ guid[28].ToString()
+ guid[2].ToString()
+ guid[10].ToString()
+ guid[21].ToString()
+ guid[15].ToString();
}
Коммерческий проект :)
+119
> Наша фирма разрабатывает серьезный софт на CL, Scheme и
некоторых других языках. Но в последнее время в нашей продукции
часто стали находить эксплоиты (что-бы не пугать наших клиентов -
подробнее не скажу). Нам для LISP-подобных языков необходима
DEP (Data Execution Prevention). Есть ли подобные наработки в этой области?
Пока ничего побобного для языков этого семейства мы не находили и очень
расстроены сложившимися обстоятельствами.
Не мог ни запостить.
+24
Fixed f = 0.2;
f = std::abs(f);
std::cout << (float)f;
Угадайте, чему будет равно f?
Fixed - тип из той же библиотеки, что и в http://govnokod.ru/11294
+15
system("PAUSE")
Красивое, оптимальное, и самое главное, кроссплатформенное решение для ожидания нажатия клавиши.
http://habrahabr.ru/post/147104/
Предупреждая вопрос "где здесь с++", отвечу - автор считал, что он пишет на с++, и даже использовал пару конструкций оттуда - перегрузку функций и new/delete.
+1
class SumClass
{
int A, B;
public:
void Set_A(int A) {this->A = A;}
void Set_B(int B) {this->B = B;}
int Sum() {return A+B;}
}
class MultiSumClass
{
SumClass Sum;
int count;
public:
void Set_A(int A) {Sum.Set_A(A);}
void Set_B(int B) {Sum.Set_B(B);}
void Set_Count(int count) {this->count = count;}
int GetSum() {return Sum->Sum()*count;}
}
void main()
{
MultiSumClass MSC;
MSC.Set_A(5); MSC.Set_B(10);
MSC.Set_Count(2);
cout << MSC.GetSum();
}
Вот зачем ООП нужно
http://www.gamedev.ru/flame/forum/?id=164035
извените за игрстрй
−109
monthes = ['Нулября', 'Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря']
Вот, оказывается, как лечится, что индексы в массиве начинаются с нуля, а номера месяца с 1
+76
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD})
public static @interface Property { String value(); }
public static class PropertyImpl implements Property {
private final String value;
public PropertyImpl(String value) { this.value = value; }
@Override public Class<? extends Annotation> annotationType() { return Property.class; }
@Override public String value() { return this.value; }
@Override public int hashCode() { return (127 * "value".hashCode()) ^ value.hashCode(); }
@Override public boolean equals(Object o) {
if (!(o instanceof Property)) { return false; }
Property other = (Property) o;
return value.equals(other.value());
}
}
отформатировал для компактности.
Идеи для чего делать реализцию аннотации?
+165
@jfredys 23-Mar-2011 01:07
I was looking for trimming all the elements in an array, I found this as the simplest solution:
<?php
array_walk($ids, create_function('&$val', '$val = trim($val);'));
?>
array_map? не, не слышал.
+126
//javax.swing.JTree
public void setBounds(Rectangle r) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setBounds(r);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setBounds(r);
}
}
}
public void setSize (Dimension d) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setSize(d);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setSize(d);
}
}
}
public void requestFocus() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).requestFocus();
} else {
Component c = getCurrentComponent();
if (c != null) {
c.requestFocus();
}
}
}
public void addFocusListener(FocusListener l) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).addFocusListener(l);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.addFocusListener(l);
}
}
}
public boolean isFocusTraversable() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).isFocusTraversable();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.isFocusTraversable();
} else {
return false;
}
}
}