static HPEN Pen = CreatePen(PS_SOLID, 3, RGB(0, 0, 255));
static BOOL fDraw = FALSE;
static POINT ptPrevious = { 0, 0 };
case WM_PAINT: {
PAINTSTRUCT ps;
hdc = BeginPaint(hWnd, &ps);
// TODO: рисовать здесь
EndPaint(hWnd, &ps);
break;
}
ptPrevious.x = GET_X_LPARAM(lParam);
ptPrevious.y = GET_Y_LPARAM(lParam);
use \lsolesen\pel\PelJpeg;
use \lsolesen\pel\PelTag;
$jpeg = new PelJpeg("test.jpg");
$ifd0 = $jpeg->getExif()->getTiff()->getIfd();
$entry = $ifd0->getEntry(PelTag::SOFTWARE);
if ($entry !== null){
$entry->setValue('Edited by PEL');
}
$jpeg->saveFile("test_out.jpg");
#include <iostream>
#include <conio.h>
#include <vector>
using namespace std;
int main()
{
int rez;
int arr_src[] = {1,8,3,2};
std::vector<int> arr(arr_src, arr_src + sizeof(arr_src)/sizeof(arr_src[0]));
arr.push_back(7);
arr.push_back(8);
rez = arr.size(); //кол-во элементов в массиве
cout << rez << endl;
for (int i = 0; i < rez; i++)
cout << arr[i] << ' ';
getch();
return 0;
}
vector<bool>
специальным стандартным контейнером, в котором каждый элемент bool использует только один бит памяти вместо того, чтобы занимать 1 байт, как занимает обычный bool. Ценой этой оптимизации является то, что этот контейнер не предоставляет всех возможностей и интерфейс, как это делает нормальный стандартный контейнер. bool &pb =v[0]
не является валидным кодом. <?php
header("Content-Type: audio/x-mpegurl");
header("Content-Disposition: attachment; filename=\"playlist.m3u\""); ?>
#EXTM3U
#EXTINF:-1, Stream name
http://example.com/stream.php
#include "enum.h"
BETTER_ENUM(etype, int, laborer, secretary, manager, accountant, executive, researcher);
//...
struct employee {
int number;
float pension;
etype post = etype::laborer;
date start;
};
int main()
{
//... пропущено
for (etype i : etype::_values())
{
std::cout << i << " ";
}
std::cout << std::endl;
std::string etypeStr;
std::cin >> etypeStr;
first.post = etype::_from_string(etypeStr.c_str());
}
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
}
...
const char *url = "http://localhost/test.mp3";
AVFormatContext *pFormatCtx = NULL;
int ret = avformat_open_input(&pFormatCtx, url, NULL, NULL);
if (ret >= 0) {
avformat_find_stream_info(pFormatCtx, NULL);
int seconds = (pFormatCtx->duration / AV_TIME_BASE);
int64_t size = avio_size(pFormatCtx->pb);
avformat_close_input(&pFormatCtx);
avformat_free_context(pFormatCtx);
}
void CMFCApplication1Dlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) {
Default();
}
BOOL CMFCApplication1Dlg::OnNcActivate(BOOL active)
{
if (m_nFlags & WF_STAYACTIVE)
active = TRUE;
return(BOOL)DefWindowProc(WM_NCACTIVATE, active, 0L);
}
#include <fstream>
#include <ios>
#include <ctime>
#include <iostream>
#include <windows.h>
class MyBitmap {
BITMAPFILEHEADER header_;
BITMAPINFOHEADER info_;
bool loaded_;
char* pixels_;
size_t data_size_;
size_t row_padded_;
public:
MyBitmap(const char* fileName) {
loaded_ = false;
pixels_ = 0;
std::ifstream bmp(fileName, std::ios::binary);
if (!bmp) {
return;
}
bmp.read((char*)&header_, sizeof(header_));
if (!bmp) {
return;
}
if (header_.bfType != 'MB') {
std::cout << "Format is not supported" << std::endl;
return;
}
bmp.read((char*)&info_, sizeof(info_));
if (!bmp) {
return;
}
if (info_.biBitCount != 24) {
std::cout << "Format is not supported" << std::endl;
return;
};
row_padded_ = (info_.biWidth * 3 + 3) & (~3);
int height = info_.biHeight;
data_size_ = row_padded_ * height;
pixels_ = new char[data_size_];
bmp.read(pixels_, data_size_);
if (bmp) {
loaded_ = true;
}
return;
}
bool Save(const char* fileName) {
if (!loaded_) {
return false;
}
std::ofstream f(fileName, std::ios::binary);
if (!f) {
return false;
}
f.write((char*)&header_, sizeof(header_));
f.write((char*)&info_, sizeof(info_));
f.write(pixels_, data_size_);
if (f) {
return true;
}
return false;
}
void AddBorderInside(int borderSize = 15) {
for (int i = 0; i < info_.biWidth; i++) {
for (int j = 0; j < info_.biHeight; j++) {
if (i < borderSize || i >= info_.biWidth - borderSize
|| j < borderSize || j >= info_.biHeight - borderSize) {
int pos = row_padded_* j + i * 3;
pixels_[pos] = rand() % 256;
pixels_[pos + 1] = rand() % 256;
pixels_[pos + 2] = rand() % 256;
}
}
}
}
void AddBorderOutside(int borderSize = 15) {
int new_width = info_.biWidth + borderSize * 2;
int new_row_padded = (new_width * 3 + 3) & (~3);
int new_height = info_.biHeight + borderSize * 2;
int new_data_size = new_row_padded * new_height;
char* new_pixels_ = new char[new_data_size];
for (int i = 0; i < info_.biHeight; i++) {
int old_pos = row_padded_* i;
int new_pos = new_row_padded * (borderSize+i) +3 * borderSize;
memcpy(new_pixels_ + new_pos, pixels_ + old_pos, info_.biWidth * 3);
}
delete[] pixels_;
info_.biWidth = new_width;
info_.biHeight = new_height;
pixels_ = new_pixels_;
row_padded_ = new_row_padded;
data_size_ = new_data_size;
AddBorderInside(borderSize);
}
bool IsLoaded() const {
return loaded_;
}
~MyBitmap() {
delete[] pixels_;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
srand(time(0));
MyBitmap bmp("input.bmp");
if (!bmp.IsLoaded()) {
std::cout << "Unable to load bitmap" << std::endl;
return 1;
}
bmp.AddBorderOutside();
if (!bmp.Save("output.bmp")) {
std::cout << "Unable to save bitmap" << std::endl;
}
return 0;
}
InternetGetCookie does not return cookies that the server marked as non-scriptable with the "HttpOnly" attribute in the Set-Cookie header.
$client->authenticate($_REQUEST['code']);
if (isset($token['access_token'])) { }
$client->setAccessToken($_SESSION['accessToken']);
if ($client->isAccessTokenExpired()) {
$new_token = $client->refreshToken(null);
if (isset($new_token['access_token'])) {
$_SESSION['accessToken'] = $new_token;
}
}
<?php
function get_location($ch, $output){
$curl_info = curl_getinfo($ch);
$headers = substr($output, 0, $curl_info["header_size"]); //split out header
preg_match("!\r\n(?:Location|URI): *(.*?) *\r\n!", $headers, $matches);
return $matches[1];
}
$link = "https://vk.com/away.php?to=https%3A%2F%2Fvk.cc%2F8L3cD8&post=-75604109_25935&cc_key=";
$arr = parse_url($link);
parse_str($arr['query'], $output);
$vk_cc_link = $output['to'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $vk_cc_link);
// Я задал эти параметры, потому что у меня на локалхосте не настроен SSL
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
$link = get_location($ch, $output);
$arr = parse_url($link);
parse_str($arr['query'], $out);
$new_link = $out['to'];
curl_setopt($ch, CURLOPT_URL, $new_link);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$output = curl_exec($ch);
$link = get_location($ch, $output);
echo $link;
?>
https://boom.ru/redirect/album/6101146?web=1