LINUX.ORG.RU

Сообщения bad_master

 

Как убрать список изображений справа master slider?

Форум — Web-development

Добавил слайдер, а на маленьком смартфоне львиную долю 3анимает список слайдов который находится справа

 

bad_master
()

Как сделать слайдер wordpress?

Форум — Web-development

Перепробовал кучу примеров, то что - то не работает, хочу добавить чтобы было на каждой странице

 

bad_master
()

Куда надо 3асунуть скрипт с iпtables?

Форум — General

В старой бубунте /etc/rc.local сувал скрипт для авто3агру3ки, в новой такого файла нет, как быть?

 

bad_master
()

Ищу денди игру

Форум — General

Вообщем там карта квадратная, напоминает геймплей battle city , только бе3 штаба, можно играть вдвоем, по периметру карты появляются мобы в углах и поцентру вни3у и вверху, вы в них стреляете они умирают, когда убиты все появляется портал в рандомном месте карты и если один и3 игроков в него успевает 3абежать до появление следующего раунда, то вы перемещаетесь в подуровень где вы уже не стреляете, а 3акладываете бомбы, как в бомбермэне против мобов.

 ,

bad_master
()

Проблема с символами в qtablewidget?

Форум — Development

3аполняю таблицу 3начениями, ра3 от ра3у часть английских слов вводится, а сейчас как на картинке

#pragma once

#include <ctime>
#include <cstring>
#pragma warning(disable : 4996)
class Task
{
public:
  int id;
  char* task;
  int parentTask;
  char* executor;
  int idExecutor;
  tm* dateStart;
  tm* dateDeathLine;
  char* status;
  char* oldtask;
  Task();
  void AddTask(char* task_, int parentTask_, char* executor_,
    int idExecutor_, tm* dateDeathLine_);
  void DeleteTask(int num);
  ~Task();
};
#include "Task.h"

Task::Task()
{
  task = new char[1024];
  executor = new char[256];
  status = new char[64];
  oldtask = new char[2048];
  dateDeathLine = new tm();
  dateStart = new tm();
};


vector<vector<string>> v;
    vector<string> tmp;
    char* date_string = new char[50];
    for (int i = 0; i < db.vTask.size(); i++)
    {
        tmp.push_back(to_string(db.vTask[i].id));
        tmp.push_back(db.vTask[i].task);
        tmp.push_back(to_string(db.vTask[i].parentTask));
        tmp.push_back(db.vTask[i].executor);
        strftime(date_string, 50, " %Y-%m-%d", db.vTask[i].dateDeathLine);
        tmp.push_back(date_string);
        strftime(date_string, 50, "%Y-%m-%d", db.vTask[i].dateStart);
        tmp.push_back(date_string);
        tmp.push_back(db.vTask[i].status);
        tmp.push_back(db.vTask[i].oldtask);
        v.push_back(tmp);
        tmp.clear();
    }
    for(int i=0;i<db.numRow;i++)
        for (int j = 0; j < db.numCol; j++)
        {
            qstr = QString::fromStdString(v[i][j]);
            table.setItem(i, j, new QTableWidgetItem(qstr));
        
        }
https://ibb.co/vJPx3qs

 ,

bad_master
()

Непонятный bad_alloc?

Форум — Development
vector<string> namescol;
    namescol.push_back("id");
    namescol.push_back("task");
    namescol.push_back("parent_task");
 QStringList list;
    QString qstr;
    for (int i = 0; i < namescol.size(); i++)
    {
        qstr = QString::fromStdString(namescol[i]);//тут ошибка std::bad_alloc, i==0
        list.push_back(qstr);
    }

 ,

bad_master
()

Не могу найти трек и3 клипа фильма эквилибриум?

Форум — Talks

Как то лет 9 на3ад наткнулся на клип фильма эквилибриума аудио дорожка со словами will i am больше не помню но это не точные слова, хотя это нет точно может у кого сохранился трек дайте его на3вание и автора трека пли3 песня хороша, клип начинается с того что главный герой ра3бегается и бьёт дверь

Перемещено xaizek из general

 ,

bad_master
()

Как добавить столбец к таблице?

Форум — Development

Делаю селект с юнионом и селектом, но нужно чтобы второй селект брал просроченные date_death_line в таблицу справа столбец где executor == executor добавить столбец task Сейчас пока вот так: https://ibb.co/tZyJrX8 Вообщем нужна эта таблица плюс столбец task с просроченными date_death_line меньше now() то есть последние две строчки в картинке нужно вытащить из них только task и вставить справа к исходной таблице где executor равен executor

 ,

bad_master
()

Что будет если ампер меньше

Форум — General

Есть коммутатор он принимает input 5V 1A, а блок питания output 5V 600mA, Выдержит ли он если все порты включить и какая стабильность будет у него?

 ,

bad_master
()

Вопрос про ра3работку ПО для фи3ического, канального и сетевого уровня

Форум — General

Как я понял можно исполь3овать интерфейс транспортного уровня и писать ПО на нем. А как же тогда ра3рабатывают ПО для сетевых устройств? А точнее для первых трех уровней OSI и TCP/IP

 , , ,

bad_master
()

Непонятная ошибка webgl?

Форум — Development

Код программы

// Vertex shader program
var VSHADER_SOURCE =
  'attribute vec4 a_Position;\n' +
  'uniform mat4 u_ModelMatrix;\n' +
  'attribute vec2 a_TexCoord;\n' +
  'varying vec2 v_TexCoord;\n' +
  'void main() {\n' +
  '  gl_Position = u_ModelMatrix * a_Position;\n' +
  '  v_TexCoord = a_TexCoord;\n' +
  '}\n';

// Fragment shader program
var FSHADER_SOURCE =
//  'void main() {\n' +
  //'  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n' +
  //'}\n';
  '#ifdef GL_ES\n' +
  'precision mediump float;\n' +
  '#endif\n' +
  'uniform sampler2D u_Sampler;\n' +
  'varying vec2 v_TexCoord;\n' +
  'void main() {\n' +
  '  gl_FragColor = texture2D(u_Sampler, v_TexCoord);\n' +
  '}\n';

// Rotation angle (degrees/second)
var ANGLE_STEP = 45.0;
var startRotate = 0;
function main() {
  // Retrieve <canvas> element
  var canvas = document.getElementById('webgl');

  // Get the rendering context for WebGL
  var gl = getWebGLContext(canvas);
  if (!gl) {
    console.log('Failed to get the rendering context for WebGL');
    return;
  }

  // Initialize shaders
  if (!initShaders(gl, VSHADER_SOURCE, FSHADER_SOURCE)) {
    console.log('Failed to intialize shaders.');
    return;
  }

  // Write the positions of vertices to a vertex shader

  var n = initVertexBuffers(gl);

  if (n < 0) {
    console.log('Failed to set the positions of the vertices');
    return;
  }

  // Specify the color for clearing <canvas>
  gl.clearColor(0.0, 0.0, 0.0, 1.0);

  // Get storage location of u_ModelMatrix
  var u_ModelMatrix = gl.getUniformLocation(gl.program, 'u_ModelMatrix');
  if (!u_ModelMatrix) {
    console.log('Failed to get the storage location of u_ModelMatrix');
    return;
  }

  // Current rotation angle
  var currentAngle = 0.0;
  // Model matrix
  var modelMatrix = new Matrix4();
  // Set texture
  if (!initTextures(gl, n)) {
    console.log('Failed to intialize the texture.');
    return;
  }
  // Start drawing
  var tick = function() {
    currentAngle = animate(currentAngle);  // Update the rotation angle
    draw(gl, n, currentAngle, modelMatrix, u_ModelMatrix);   // Draw the triangle
    requestAnimationFrame(tick, canvas); // Request that the browser calls tick
  };
  tick();

  canvas.onmousedown = function(ev) { click(ev, gl, canvas); };

}

function initVertexBuffers(gl) {
  var verticesTexCoords =

  new Float32Array ([
  -0.5, 0.5,  0.0, 1.0,
  -0.5,-0.5,  0.0, 0.0,
  0.5, 0.5,  1.0, 1.0,
  0.5, -0.5, 1.0, 0.0,
  -0.78,0.68, 0.0, 1.0,
  -0.78,0.3, 0.0, 0.0,
  -0.48,0.68, 1.0, 1.0,
  -0.48,0.3, 1.0, 0.0
  ]);

  var n = 4;   // The number of vertices

  // Create a buffer object
  var vertexTexCoordBuffer = gl.createBuffer();
  if (!vertexTexCoordBuffer) {
    console.log('Failed to create the buffer object');
    return -1;
  }

  // Bind the buffer object to target
  gl.bindBuffer(gl.ARRAY_BUFFER, vertexTexCoordBuffer);
  // Write date into the buffer object
  gl.bufferData(gl.ARRAY_BUFFER, verticesTexCoords, gl.STATIC_DRAW);

  var FSIZE = verticesTexCoords.BYTES_PER_ELEMENT;
  // Assign the buffer object to a_Position variable
  var a_Position = gl.getAttribLocation(gl.program, 'a_Position');
  if(a_Position < 0) {
    console.log('Failed to get the storage location of a_Position');
    return -1;
  }
  gl.vertexAttribPointer(a_Position, 2, gl.FLOAT, false, 4*FSIZE, 0);

  // Enable the assignment to a_Position variable
  gl.enableVertexAttribArray(a_Position);

  // Get the storage location of a_TexCoord
  var a_TexCoord = gl.getAttribLocation(gl.program, 'a_TexCoord');
  if (a_TexCoord < 0) {
    console.log('Failed to get the storage location of a_TexCoord');
    return -1;
  }
  // Assign the buffer object to a_TexCoord variable
  gl.vertexAttribPointer(a_TexCoord, 2, gl.FLOAT, false, FSIZE * 4, FSIZE * 2);
  gl.enableVertexAttribArray(a_TexCoord);  // Enable the assignment of the buffer object
  return n;
}

function draw(gl, n, currentAngle, modelMatrix, u_ModelMatrix) {
  // Set the rotation matrix
  if(startRotate)
    modelMatrix.setRotate(currentAngle, 1, 0, 0); // Rotation angle, rotation axis (0, 0, 1)

  // Pass the rotation matrix to the vertex shader
  gl.uniformMatrix4fv(u_ModelMatrix, false, modelMatrix.elements);

  // Clear <canvas>
  gl.clear(gl.COLOR_BUFFER_BIT);

  // Draw the rectangle
  gl.drawArrays(gl.TRIANGLE_STRIP, 0, n);
  gl.drawArrays(gl.TRIANGLE_STRIP, 4, n);
}

// Last time that this function was called
var g_last = Date.now();
function animate(angle) {
  // Calculate the elapsed time
  var now = Date.now();
  var elapsed = now - g_last;
  g_last = now;
  // Update the current rotation angle (adjusted by the elapsed time)
  var newAngle = angle + (ANGLE_STEP * elapsed) / 1000.0;
  return newAngle %= 360;
}
function click(ev, gl, canvas) {
  //alert(' Thanks a million!');
  startRotate = !startRotate;
}


function initTextures(gl, n) {
  var texture = gl.createTexture();   // Create a texture object
  if (!texture) {
    console.log('Failed to create the texture object');
    return false;
  }

  // Get the storage location of u_Sampler
  var u_Sampler = gl.getUniformLocation(gl.program, 'u_Sampler');
  if (!u_Sampler) {
    console.log('Failed to get the storage location of u_Sampler');
    return false;
  }
  var image = new Image();  // Create the image object
  //image.crossOrigin = "anonymous";
  if (!image) {
    console.log('Failed to create the image object');
    return false;
  }
  // Register the event handler to be called on loading an image
  image.onload = function(){ loadTexture(gl, n, texture, u_Sampler, image); };
  // Tell the browser to load an image
  image.src = 'content/auto55.png';

  return true;
}
function loadTexture(gl, n, texture, u_Sampler, image) {
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 1); // Flip the image's y axis
  // Enable texture unit0
  gl.activeTexture(gl.TEXTURE0);
  // Bind the texture object to the target
  gl.bindTexture(gl.TEXTURE_2D, texture);

  // Set the texture parameters
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
  // Set the texture image
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, image);

  // Set the texture unit 0 to the sampler
  gl.uniform1i(u_Sampler, 0);

  gl.clear(gl.COLOR_BUFFER_BIT);   // Clear <canvas>

  gl.drawArrays(gl.TRIANGLE_STRIP, 0, n); // Draw the rectangle
    gl.drawArrays(gl.TRIANGLE_STRIP, 4, n);
}
html:
<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="utf-8" />

<title>Draw a blue rectangle (canvas version)</title>
</head>

<body onload="main()">

<canvas id="webgl" width="400" height="400">

Please use a browser that supports "canvas"

</canvas>
<script src="webgl-utils.js"></script>
<script src="webgl-debug.js"></script>
<script src="cuon-utils.js"></script>
<script src="cuon-matrix.js"></script>
<script src="Cars.js"></script>
</body>
</html>
Пытаюсь сделать простенькую программу с текстурой не особо ра3бираясь в жс. Ошибка:
webgl-debug.js:208 Uncaught DOMException: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The image element contains cross-origin data, and may not be loaded.
    at Object.texImage2D (file:///WebCars/webgl-debug.js:208:38)
    at loadTexture (file:///WebCars/Cars.js:209:6)
    at Image.image.onload (file:///WebCars/Cars.js:193:30)

 ,

bad_master
()

Посоветуйте, что можно купить и3 техники?

Форум — Talks

Хожу по мага3инам сайтам и в принципе мало что и3 интересного, ну там тв, планшет, ноутбук. Может какие-нибудь переходники с sata на usb или может есть еще что-то эк3отичное? Если честно фанта3ия уже кончилась

Перемещено Zhbert из general

 ,

bad_master
()

Как узнать у long long числа количество цифр?

Форум — Development

Вот пример задачи https://ibb.co/z2tcHxL вот мой код для int частично решается задача аналогично

#include <iostream>
#include <cstring>
int main()
{
int num=4000000;
char*word = new char[25];
sprintf(word,"%d",num);
std::cout « strlen(word);
}

 

bad_master
()

Как скормить компилятору такую шляпу?

Форум — Development
//g++  7.4.0

#pragma once
#include <iostream>
#include <list>
#include <vector>

#include <iterator>
template <typename T> class Sorts
{
public:
	std::list<T> arrayList;
	std::vector<T> bubbleArray,insertionArray,heapArray,shakeArray;
	std::vector<T> BubbleSort()
	{
		std::cout <<"Time to Bubble>" << std::endl;
		unsigned int start_time = clock(); // начальное время
		int size = bubbleArray.size();
		for (int i = 1; i < size; i++)
			for (int j = size-1; j >=i; j--)
				if (bubbleArray[j-1] > bubbleArray[j])
					swap(bubbleArray, j - 1, j);
		unsigned int end_time = clock(); // конечное время
		unsigned int search_time = end_time - start_time; // искомое время
		std::cout << (float)search_time / CLOCKS_PER_SEC << std::endl;
		return bubbleArray;
	}
	std::vector<T> InsertionSort()
	{
		std::cout << "Time to Insertion>" << std::endl;
		unsigned int start_time = clock(); // начальное время
		int size = insertionArray.size();
		for (int i = 1; i < size; i++)
		{
			T tmp = insertionArray[i];
			int j = i;
			while (j > 0 && insertionArray[j - 1] > tmp)
			{
				insertionArray[j] = insertionArray[j - 1];
				j = j - 1;
			}
			insertionArray[j] = tmp;
		}
		unsigned int end_time = clock(); // конечное время
		unsigned int search_time = end_time - start_time; // искомое время
		std::cout << (float)search_time / CLOCKS_PER_SEC << std::endl;
		return insertionArray;
	}
	void swap(std::vector<T> v, int n, int m)
	{
		T tmp = v[n];
		v[n] = v[m];
		v[m] = tmp;
	}
	std::vector<T> HeapSort()
	{
		std::cout << "Time to Heap>" << std::endl;
		unsigned int start_time = clock(); // начальное время
		int size = heapArray.size();
		for (int j = 0; j < size; j++)
		{
			for (int i = size / 2 - 1 - j / 2; i > -1; i--)
			{
				if (2 * i + 2 <= size - 1 - j)
				{
					if (heapArray[2 * i + 1] > heapArray[2 * i + 2])
					{
						if (heapArray[i] < heapArray[2 * i + 1])
						{
							swap(heapArray, i, 2 * i + 1);
						}
					}
					else
						if (heapArray[i] < heapArray[2 * i + 2])
						{
							swap(heapArray, i, 2 * i + 2);
						}
				}
				else
					if (2 * i + 1 <= size - 1 - j)
						if (heapArray[i] < heapArray[2 * i + 1])
							swap(heapArray, i, 2 * i + 1);
			}
			swap(heapArray, 0, size - 1 - j);
		}
		unsigned int end_time = clock(); // конечное время
		unsigned int search_time = end_time - start_time; // искомое время
		std::cout << (float)search_time / CLOCKS_PER_SEC << std::endl;
		return heapArray;
	}
	std::vector<T> ShakeSort()
	{
		std::cout << "Time to Shake>" << std::endl;
		unsigned int start_time = clock(); // начальное время
		int size = shakeArray.size();
		int left = 0;
		int right = size - 1;
		do {
			for (int i = left; i < right; i++) {
				if (shakeArray[i] > shakeArray[i + 1])
					swap(shakeArray,i,i+1);
			}
			right--;
			for (int i = right; i > left; i--) {
				if (shakeArray[i] < shakeArray[i - 1])
					swap(shakeArray, i-1, i);
			}
			left++;
		} while (left < right);
		unsigned int end_time = clock(); // конечное время
		unsigned int search_time = end_time - start_time; // искомое время
		std::cout << (float)search_time / CLOCKS_PER_SEC << std::endl;
		return shakeArray;
	}
	void PrintArray(int num)
	{
		switch (num)
		{
		case 0:
			for (std::list<T>::iterator it = arrayList.begin(); it != arrayList.end(); it++)
				std::cout << (*it) << " ";
			break;
		case 1:
			for (std::vector<T>::iterator it = bubbleArray.begin(); it != bubbleArray.end(); it++)
				std::cout << (*it) << " ";
			break;
		case 2:
			for (std::vector<T>::iterator it = shakeArray.begin(); it != shakeArray.end(); it++)
				std::cout << (*it) << " ";
			break;
		case 3:
			for (std::vector<T>::iterator it = heapArray.begin(); it != heapArray.end(); it++)
				std::cout << (*it) << " ";
			break;
		case 4:
			for (std::vector<T>::iterator it = insertionArray.begin(); it != insertionArray.end(); it++)
				std::cout << (*it) << " ";
			break;
		default:
			break;
		
		}
		std::cout << std::endl;
	}
};



int main()
{
	const int iSize = 10;
	auto sort = new Sorts<int>();
	srand(time(0));
	for (int i = 0; i < iSize; i++)
	{
		sort->arrayList.push_back(rand() % iSize);
	}
	sort->BubbleSort();
	sort->ShakeSort();
	sort->HeapSort();
	sort->InsertionSort();

	sort->PrintArray(1);
	sort->PrintArray(2);
	sort->PrintArray(3);
	sort->PrintArray(4);
	return 0;
}

Ругаеца на итераторы

 , ,

bad_master
()

Что случилось с гитлабом?

Форум — Talks

Вот странно я когда регистрировался на гитлабе его адрес был по имени lab. effects. world, пытался запушить код ошибка. Сейчас гитлаб это gitlab. com мой аккаунт нету такого что за бред

Перемещено Zhbert из development

 

bad_master
()

Не понимаю как надо компилятору скормить реали3ацию класса с шаблоном?

Форум — Development

Хочу со3дать класс с сортировками, пока что есть одна с квадратичной сложностью. Со3дал класс - каждый метод будет сортировкой, но для ра3ных типов данных. Компилятор ругается, файл main.cpp:


#include "Sorts.h"


int main()
{
	const int iSize = 10,
		dSize = 7,
		fSize = 10,
		cSize = 255;
	// массивы разных типов данных
	int    iArray[iSize] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
	double dArray[dSize] = { 1.2345, 2.234, 3.57, 4.67876, 5.346, 6.1545, 7.7682 };
	float  fArray[fSize] = { 1.34, 2.37, 3.23, 4.8, 5.879, 6.345, 73.434, 8.82, 9.33, 10.4 };
	char   cArray[cSize];// = { "MARShdkeitocm8" };
	for (int i = 0; i < 255; i++)
		cArray[i] = i;
	
	auto sorti = new Sorts<int>();
	sorti->Sorting(iArray, iSize);
	auto sortd = new Sorts<double>();
	sortd->Sorting(dArray, dSize);
	auto sortf = new Sorts<float>();
	sortf->Sorting(fArray, fSize);
	//sort->Sorting(fArray, fSize);
	auto sortc = new Sorts<char>();
	sortc->Sorting(cArray, cSize);
	//sort->Sorting(cArray, cSize);
	std::cout << "\t\t Шаблон функции вывода массива на экран\n\n";
	// вызов локальной версии функции printArray для типа int через шаблон
	std::cout << "\nМассив типа int:\n"; 
	sorti->printArray(iArray, iSize);
	// вызов локальной версии функции printArray для типа double через шаблон
	std::cout << "\nМассив типа double:\n"; 
	sortd->printArray(dArray, dSize);
	// вызов локальной версии функции printArray для типа float через шаблон
	std::cout << "\nМассив типа float:\n"; 
	sortf->printArray(fArray, fSize);
	// вызов локальной версии функции printArray для типа char через шаблон
	std::cout << "\nМассив типа char:\n"; 
	sortc->printArray(cArray, cSize);
    return 0;
}

Файл Sorts.h

#pragma once
#include <iostream>
template <typename T> class Sorts
{
public:
	T* Sorting(T* mas, int size);
	void printArray(const T* arr, int count); // конец шаблона функции printArray;
};


и файл Sorts.cpp
#include "Sorts.h"

T* Sorts::Sorting(T* mas, int size)
{
	T tmp;
	for (int i = 0; i < size; i++)
		for (int j = 0; j < size; j++)
			if (mas[i] > mas[j])
			{
				tmp = mas[i];
				mas[i] = mas[j];
				mas[j] = tmp;
			}
	return (T*)mas;
}
void Sorts::printArray(const T* arr, int count)
{
	for (int ix = 0; ix < count; ix++)
		std::cout << arr[ix] << "   ";
	std::cout << std::endl;
} // конец шаблона функции printArray;
Ошибки все в файле реали3ации класса

 ,

bad_master
()

Не пойму ошибку?

Форум — Development
#include <iostream>


template <typename T>
//T a;
class Sort
{
public:
	Sort() {};
private:
	T* Sorting(T* mas, int size);
	void printArray(const T* arr, int count)
};
T* Sort::Sorting(T* mas, int size)
{
	T tmp;
	for (int i = 0; i < size; i++)
		for (int j = 0; j < size; j++)
			if (mas[i] < mas[j])
			{
				tmp = mas[i];
				mas[i] = mas[j];
				mas[j] = tmp;
			}
	return (T*)mas;
};
void Sort::printArray(const T* arr, int count)
{
	for (int ix = 0; ix < count; ix++)
		std::cout << arr[ix] << "   ";
	std::cout << std::endl;
}; // конец шаблона функции printArray
int main()
{
	const int iSize = 10,
		dSize = 7,
		fSize = 10,
		cSize = 15;
	// массивы разных типов данных
	int    iArray[iSize] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
	double dArray[dSize] = { 1.2345, 2.234, 3.57, 4.67876, 5.346, 6.1545, 7.7682 };
	float  fArray[fSize] = { 1.34, 2.37, 3.23, 4.8, 5.879, 6.345, 73.434, 8.82, 9.33, 10.4 };
	char   cArray[cSize] = { "MARShdkeitocm8" };
	Sort *sort = new Sort();
	sort->Sorting(iArray, iSize);
	sort->Sorting(dArray, dSize);
	sort->Sorting(fArray, fSize);
	sort->Sorting(cArray, cSize);
	std::cout << "\t\t Шаблон функции вывода массива на экран\n\n";
	// вызов локальной версии функции printArray для типа int через шаблон
	std::cout << "\nМассив типа int:\n"; 
	sort->printArray(iArray, iSize);
	// вызов локальной версии функции printArray для типа double через шаблон
	std::cout << "\nМассив типа double:\n"; 
	sort->printArray(dArray, dSize);
	// вызов локальной версии функции printArray для типа float через шаблон
	std::cout << "\nМассив типа float:\n"; 
	sort->printArray(fArray, fSize);
	// вызов локальной версии функции printArray для типа char через шаблон
	std::cout << "\nМассив типа char:\n"; 
	sort->printArray(cArray, cSize);
    return 0;
}

 

bad_master
()

Куда расти, когда везде сложно?

Форум — Talks

Вообщем смотрю на вакансии разделю их на 4 вида:

  1. Тестировщик - в основном веб(знать всякие там selenium для шарпов или jmeter для джавы), но есть и игры+мобайл. Нужно еще знать командные строки винды/линуха для всяких там батников и шелл-скриптов, либо понимать как работает http для сайтов для их отладки.
  2. Сисадмин - помимо серверных осей начиная с 2008 и выше и железа, нужно еще разбираться в 1С и active directory. Протоколы различные сетевые pop,imap,tcp,udp,http,https,stp,smtp,rstp,dns,dhcp,samba and others. Беру самый минимум знаний.
  3. Разработчик с/с++ - ну тут как бы stl,boost,socket+thread,qt,svn,redmine(оговорюсь что не всюду требуется прямо все в сумме, где-то stl и boost, где-то qt, где-то уметь писать бекэнд socket+thread. Либо вообще уйти в графон и портирование под мобилки.
  4. Программист java - ну тут java core(SE+EE) + spring + sql,git,maven,kotlin,rest,html+js+css,jira,docker и еще куча непонятных слов.

Теперь перейдем к сути вопроса если бы я умел хотя бы по одному пункту все мишени, я бы не спрашивал вопрос. У меня нет ни дня разработки коммерческой в стаже. Опыта маловато, но возраст уже солидный и как мне кажется им проще взять на позиции trainee вчерашних выпускников и нынешних студентов. Моя проблема в том что я распылился в период обучения на каждый из этих пунктов и не довел до конца, хотя бы по-минимуму из мною перечисленного. Сейчас есть несколько лет опыта работы тестером, потом сисадмином. Но я не ас в своём деле, но время такое что пора прыгать выше головы. Какой из 4х пунктов мне выбрать?

 

bad_master
()

Разбить dict на строки python?

Форум — Development

Есть такой вот словарь:

a[0] = "{'id': 1, 'nickname': 'bla', 'email': 'bla@mail.ru', 'password': '63a9f0ea7bb98050796b649e85481845', 'reg_date': datetime.datetime(2018, 11, 13, 17, 27, 21), 'ip': '127.0.0.1', 'user_agent': 'Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20100101 Firefox/16.0', 'phone': '88000000000'}"
a[1] = "{'id': 2, 'nickname': 'blabla', 'email': 'blabla@mail.ru', 'password': 'dd4b21e9ef71e1291183a46b913ae6f2', 'reg_date': datetime.datetime(2018, 11, 25, 17, 17, 1), 'ip': '127.0.0.1', 'user_agent': 'Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20100101 Firefox/16.0', 'phone': '88000000001'}"
Как разбить его на значения в строки? И еще бы вытащить индексы и знать их количество?

 ,

bad_master
()

Узнать количество столбцов PyMySQL5?

Форум — Development

Делаю табличку qt, хочу чтобы можно было любую таблицу сделать для этого надо знать количество столбцов, количество строк понятно как, также заголовки столбцов таблицы,еще непонятно как разделить строку чтобы каждый столбец всунуть в ячейку

import pymysql.cursors

import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QAction, QTableWidget,QTableWidgetItem,QVBoxLayout
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot


class App(QWidget):

    def __init__(self):
        super().__init__()
        self.title = 'Users'
        self.left = 0
        self.top = 0
        self.width = 300
        self.height = 200
        self.initUI(print_hi())

    def initUI(self, cursor):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        self.createTable(cursor)

        # Add box layout, add table to box layout and add box layout to widget
        self.layout = QVBoxLayout()
        self.layout.addWidget(self.tableWidget)
        self.setLayout(self.layout)

        # Show widget
        self.show()

    def createTable(self, cursor):
        # Create table
        self.tableWidget = QTableWidget()
        self.tableWidget.setRowCount(cursor.rowcount)
        desc = cursor.description
        self.tableWidget.setColumnCount(1)
        print(desc[0][0]+'\n')
        print(desc[1][0]+'\n')
        print(desc[2][0]+'\n')
        print(desc[3][0]+'\n')
        print(desc[4][0]+'\n')
        print(desc[5][0]+'\n')
        print(desc[6][0]+'\n')
        print(desc[7][0]+'\n')
        #for(row in cursor)



        # self.tableWidget.setItem(0, 0, QTableWidgetItem("Cell (1,1)"))
        # self.tableWidget.setItem(0, 1, QTableWidgetItem("Cell (1,2)"))
        # self.tableWidget.setItem(1, 0, QTableWidgetItem("Cell (2,1)"))
        # self.tableWidget.setItem(1, 1, QTableWidgetItem("Cell (2,2)"))
        # self.tableWidget.setItem(2, 0, QTableWidgetItem("Cell (3,1)"))
        # self.tableWidget.setItem(2, 1, QTableWidgetItem("Cell (3,2)"))
        # self.tableWidget.setItem(3, 0, QTableWidgetItem("Cell (4,1)"))
        # self.tableWidget.setItem(3, 1, QTableWidgetItem("Cell (4,2)"))

        self.tableWidget.move(0, 0)

        # table selection change
        self.tableWidget.doubleClicked.connect(self.on_click)

    @pyqtSlot()
    def on_click(self):
        print("\n")
        for currentQTableWidgetItem in self.tableWidget.selectedItems():
            print(currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text())

def print_hi():
    # Use a breakpoint in the code line below to debug your script.
    # Подключиться к базе данных.
    connection = pymysql.connect(host='185.26.122.4',
                                 user='host6491_root',
                                 password='R0oT',
                                 db='host6491_test',
                                 charset='utf8mb4',
                                 cursorclass=pymysql.cursors.DictCursor)

    print("connect successful!!")

    try:

        with connection.cursor() as cursor:

            # SQL
            sql = "SELECT * FROM `users`"

            # Выполнить команду запроса (Execute Query).
            cursor.execute(sql)

            print("cursor.description: ", cursor.description)

            print()

            for row in cursor:
                print(row)

    finally:
        # Закрыть соединение (Close connection).
        connection.close()
    return cursor

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = App()
    sys.exit(app.exec_())

 ,

bad_master
()

RSS подписка на новые темы