- 1
function e(id){ return document.getElementById(id); }
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+135
function e(id){ return document.getElementById(id); }
Бредогенерации тред.
+53
// quick render params menu actions
if(pe->buttons()&Qt::LeftButton || pe->buttons()&Qt::RightButton){
//
if(cRenderMenuOpended){//
if((p.x()+p.y())<18){// - -
cRenderMenuOpended=!cRenderMenuOpended;
repaint();
return;
}
else if(p.x()>5 && p.y()>5 && p.x()<145 && p.y()<cRenderMenuHeight){// actions rectangle
//
//sliceModifyMode=true; // show slice plane and can be modified
//useSlicePlane=true; // build geometry with slice plane
if(cViewType==0){// 2D
if(p.x()>10 && p.y()>22 && p.x()<140 && p.y()<38){
// reset zoom
if(c2DZoom1To1){
cPanFor2DX1to1=0;
cPanFor2D=0;
cPanFor2DX=0;
cZoomFor2D=1;
if(cViewType==0 && c2DZoom1To1 && renderLimits){
auto testSizeX=cVieportXSize;
auto testSizeY=cVieportYSize;
BoundaryConditionsOfComposite *cond=NULL;
cond=AbstractContainer::getInstance()->getBoundaryCondition(0);
if(cond->isHeatFlux_multiple()){
cPanFor2D+=15;
testSizeY-=20;
}
if(cond->isHeatFlux_multiple() || cond->isHeatFlux() || cond->isHeatPower() || cond->isConvection() || cond->isInsulated() || cond->isTemperature()){
cPanFor2D+=20;
testSizeY-=25;
}
cond=AbstractContainer::getInstance()->getBoundaryCondition(3);
if(cond->isHeatFlux() || cond->isHeatPower() || cond->isConvection() || cond->isInsulated() || cond->isTemperature()){
testSizeX-=35;
cPanFor2DX1to1+=30;
}
cond=AbstractContainer::getInstance()->getBoundaryCondition(1);
if(cond->isHeatFlux() || cond->isHeatPower() || cond->isConvection() || cond->isInsulated() || cond->isTemperature()){
testSizeX-=35;
}
if(cWidth>cThikness){
cZoomFor2D=(double(testSizeX)-50.0)/(zoomed2DX(width_sub_start)-zoomed2DX(width_sub_end));
}
else{
cZoomFor2D=(double(testSizeY)-50.0)/(zoomed2DY(thickness_sub_start)-zoomed2DY(thickness_sub_end));
}
}
}
else{
cZoomFor2D=1;
cPanFor2D=0;
cPanFor2DX=0;
}
repaint();
return;
}
else if(p.x()>10 && p.y()>42 && p.x()<140 && p.y()<58){
cForbidRenderResultsOverLayers=!cForbidRenderResultsOverLayers;
repaint();
return;
}
else if(p.x()>10 && p.y()>62 && p.x()<140 && p.y()<78){
renderLimits++;
if(renderLimits>1){
renderLimits=0;
}
repaint();
return;
}
else if(p.x()>10 && p.y()>82 && p.x()<140 && p.y()<98){
SLOT_swap2DMode11AndScaled();
return;
}
else if(p.x()>106 && p.y()>92 && p.x()<122 && p.y()<118){
cResTransparency-=0.1;
if(cResTransparency<0){cResTransparency=0;}
repaint();
return;
}
else if(p.x()>124 && p.y()>92 && p.x()<140 && p.y()<118){
cResTransparency+=0.1;
if(cResTransparency>1){cResTransparency=1;}
repaint();
return;
}
}
else{//3D
if(p.x()>10 && p.y()>22 && p.x()<140 && p.y()<38){
slot_swapCoordiantes();
return;
}
else if(p.x()>10 && p.y()>42 && p.x()<140 && p.y()<58){
Магия чисел в построении GUI
+51
QVector<double*>*** ElemBoundCond = tbc->getElementsBC();
QVector<double*>* preNodalVals = tbc->getPreNodalValues();
QVector<double*>* nodalForces = tbc->getNodalForces();
long elems = grid->getElemsNumber();
long nodes = grid->getNodesNumber();
long** Elements = grid->getElems();
double** Nodes = grid->getNodes();
long* ElemMaters = grid->getElemsMaterials();
long NBW = grid->getBandWidth();
emit signal_addLineToCalculationProtocol(">>> Solve heat problem ");
long NS[4],//+numbers of 4 nodes
NCL = 1,//number or unknown values per node (1 for thermal analysis)
ni, nj, nk,//face nodes
gnN, dN;
double ESM[4][4],//+element stiffness matrix
EF[4],//+element force matrix
**C,//matrix conteins X, Y, Z coordinates, rows like |1 Xi Yi Zi|
**CA,//conteins columns like |ai bi ci di|
//*GF,//band matrix, pointers to Global Force and Global Sriffness Matrices in A
V36,//+hexa and 36 element volume
S_3,//face area div 3
hS_3, hS_6, hS_12,//h * face area div 6 and div 12
hST_3,//h * face area * T / 3
qS_3;//q * face area / 3
QVector<double*>* fcond;
MaterialsDatabase* matdb = MaterialsDatabase::getInstance();
double Kxx, Kyy, Kzz;//thermal condactivities in X, Y and Z axes
И снова фортранщина.
+79
// Number a, Number b
return new Double(a.doubleValue() - numericTolerance).compareTo(b.doubleValue()) < 0
В продолжение #16698, после рефакторинга. Видимо, диагноз: ООП головного мозга.
+129
class Class1
{
...
public bool checkErrors(){...}
public void DrawNumber(){...}
public void PDF_Resize(){...}
...
}
http://vk.com/feed?z=photo-30666517_340773889%2Fb5a138e78eb1b23380
+57
void NestMathematica::DATABS(){
int ks1 = 0;
int ns1=0;
int ns=0;
ia=-1;
ia=ia+1;
b[ia]=-ak[0];
ia=ia+1;
b[ia]=alfa;
mud=1;
mld=1;
if(ks!=1){
ia=ia+1;
b[ia]=0.;
ks1=ks-1;
for(int i=0; i<ks1; i++){
ns1=ns;
ns=ns+1;
if(ns!=1){
ia=ia+1;
b[ia]=0.;
}
ia=ia+1;
b[ia]=ak[ns1];
ia=ia+1;
b[ia]=0.;
ia=ia+1;
b[ia]=-ak[ns];
ia=ia+1;
b[ia]=0.;
ia=ia+1;
b[ia]=h[ns1];
ia=ia+1;
b[ia]=1.;
ia=ia+1;
b[ia]=0.;
ia=ia+1;
b[ia]=-1.;
if(ns!=ks){
ia=ia+1;
b[ia]=0.;
}
}
mud=2;
mld=2;
ia=ia+1;
b[ia]=0.;
} //10
if(beta<0){
ia=ia+1;
b[ia]=h[ks-1];
ia=ia+1;
b[ia]=1.;
}else{
ia=ia+1;
b[ia]=ak[ks]+beta*h[ks];
ia=ia+1;
b[ia]=beta;
}
return;
}
Программист на фортране может программировать на любом языке... как на фортране.
+154
$_params[] = sTools::convert2cp1251(preg_replace('|\s+|', ' ', str_replace('"', '""', htmlspecialchars_decode($_param['title'])))) . ':' . sTools::convert2cp1251(preg_replace('|\s+|', ' ', str_replace('"', '""', htmlspecialchars_decode($_param['unit'])))) . '|' . implode(',', $_param['value']);
+155
...
$ (object.position).animate (data.point, { duration: data.instant ? 1 : 7 * distance,
progress: data.instant ? function () {} : function (lol, progress) {
object.position.y = data.point.y + Math.abs (Math.sin (progress * distance * 0.3));
},
always: data.instant ? function () {} : function () {
object.position.y = data.point.y;
...
как труъ, сделать if (data.instant) { ... } или и так покатит?
+133
namespace pck_pkx
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button3_Click(object sender, EventArgs e)
{
if (textBox1.Text == "" || textBox2.Text == "")
{
MessageBox.Show("Выберите файлы для слияния!");
}
else
{
FileStream fs = new FileStream(textBox2.Text, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
BinaryWriter bw = new BinaryWriter(new FileStream(textBox1.Text, FileMode.Open, FileAccess.Write));
bw.BaseStream.Seek(0, SeekOrigin.End);
bw.Write(br.ReadBytes(Convert.ToInt32(fs.Length)));
MessageBox.Show("Успешно!");
}
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Angelica engine files|*.pck";
if (ofd.ShowDialog() == DialogResult.OK)
{
textBox1.Text = ofd.FileName;
}
}
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Angelica engine files|*.pkx";
if (ofd.ShowDialog() == DialogResult.OK)
{
textBox2.Text = ofd.FileName;
}
}
}
}
Сука, до слез.
http://kn1fe-zone.ru/index.php?threads/pck-pkx.399/
−122
Select
min(convert(char(10), DatField, 102)) as DatField,
min('ConstantForMe') as type,
f1
From sometable
Where /*условия*/
Group By f1
Люблю я агрегаты,
Любовью к ним пылаю неземною.
Неявные форматы -
И что хотите делайте со мною!
Для вас это - ерунда,
Подумаешь convert!
Но вы возьмите дату,
Но текстового формата,
Десяток первых цифер,
Смешайте всё с константой,
И группируйте с ней.
Поймёте вы всем сердцем -
Какое это чудо,
Потом вам станет худо,
Но это уж потом.