text:
Q: How can I change or hide the drawer icon? Somebody know how to change the drawer icon on android 4.4.2? The other icons on desktop already have the option to change the icon or remove, but the drawer icon have not. Does anybody knows any app to change it?

A: If you are referring to the topmost left icon in the actionbar I was looking for the same look here for possible solution
In my case I have noticed that Eclipse generated the NavigationDrawerFragment class and that the drawer icon is set up by
mDrawerToggle = new ActionBarDrawerToggle(getActivity(), /* host Activity */
        mDrawerLayout, /* DrawerLayout object */
        R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
        R.string.navigation_drawer_open, /*
                                         * "open drawer" description for
                                         * accessibility
                                         */
        R.string.navigation_drawer_close /*
                                         * "close drawer" description for
                                         * accessibility
                                         */
        )
As defined automatically by Eclipse I had android.support.v4.app.ActionBarDrawerToggle but this is deprecated and shall be android.support.v7.app.ActionBarDrawerToggle and the above shall change to
mDrawerToggle = new ActionBarDrawerToggle(getActivity(), /* host Activity */
    mDrawerLayout, /* DrawerLayout object */
    R.string.navigation_drawer_open, /*
                                     * "open drawer" description for
                                     * accessibility
                                     */
    R.string.navigation_drawer_close /*
                                     * "close drawer" description for
                                     * accessibility
                                     */
    )

and add more because I could not find a way to change the drawer icon with the v7.ActionBarDrawerTogle so I decided to hide it and show a custom home icon.
    mDrawerToggle.setDrawerIndicatorEnabled(false);
    mDrawerToggle.setHomeAsUpIndicator(yourdrawableres);

hth


text:
Q: How can I get SIZE CHART using Amazon Products API? I have went through both the amazon products API documentations Amazon Products Advertising API (AWS) and Amazon Products API (MWS), but was unable to find size chart (Attaching Image for reference).

Please provide me the feasible solution to fetch the size chart through Amazon API.

A: http://z-ecx.images-amazon.com/images/G/01/apparel/en_US/html/sizechart/womens.V154091249.html
This url has the general size chart.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to keep styles while dragging an element? My problem is, I have a draggable element, that has some styling. When i'm dragging it, it doesn't keep all the styles, some of them disappear WHILE the element is being dragged.
Specifically the one I need to keep is box-shadow.
Fiddle here
Standard box-shadow style:
.fixed-red-bg {
    box-shadow:10px 5px 5px 5px;
}

How do I not lose my box shadow while dragging that element? Optionally, is there any other style, that is not lost while dragging, that can be used to mimic a depth effect?

A: On Chrome and Firefox, when you drop the red box into the drop area, the shadow does appear to remain. However, while you are dragging it Chrome will usually drop the shadow. I recall this problem being reported a few years ago but I don't believe it's been resolved?
While someone else may have a suitable fix using css, what you can do is make a semi-transparent .png image as the shadow, and position it under the object using the pseudo before


text:
Q: Projects using this stage in odoo 10 is disappeared? In odoo 10 something is missing.
In odoo 9.0 you can specify the projects that share the same stages in the stage editing page as following:

But this does not exist in Odoo 10.0.
How do I get this to appear?

A: Try enable developer mode, they appear


text:
Q: Checking if value in list. Returning within or outside loop? I'm new to Python programming. I'd like some guidance as to the reason behind the output. I was just doing some exercise online and came across a problem which I could not understand. The code goes like this:
def dataset(data,n):
    for value in data:
        if n == value:
            return True
        else:
            return False

print(dataset([1,5,8,3], 3))
print(dataset([1,5,8,3],-1))

The output would be False, False which is the incorrect answer.
After some tinkering, I found out the problem. The correct code is as follows:
def dataset(data,n):
    for value in data:
        if n == value:
            return True

    return False

print(dataset([1,5,8,3], 3))
print(dataset([1,5,8,3],-1))

The output is True, False which is the correct answer.
So my question is why the different output with just a different putting of the return Falseand else: return False ?

A: Your first answer stops after the first item, the false branch runs for each item, whereas the second only runs the false branch after all the items have been tried.
If you change the final code to this:
def dataset(data,n):
    print("checking", data, n)
    for value in data:
        print("trying", value)
        if n == value:
            print("Found")
            return True
    print("Giving up")
    return False

print(dataset([1,5,8,3], 3))
print(dataset([1,5,8,3],-1))

You can see it tries every item, as it outputs this:
('checking', [1, 5, 8, 3], 3)
('trying', 1)
('trying', 5)
('trying', 8)
('trying', 3)
Found
True
('checking', [1, 5, 8, 3], -1)
('trying', 1)
('trying', 5)
('trying', 8)
('trying', 3)
Giving up
False

Whereas the first code only tries the first item:
def dataset(data,n):
    print("checking", data, n)
    for value in data:
        print("trying", value)
        if n == value:
            print("Found")
            return True
        else:
            print("Giving up")
            return False

print(dataset([1,5,8,3], 3))
print(dataset([1,5,8,3],-1))

Which outputs:
('checking', [1, 5, 8, 3], 3)
('trying', 1)
Giving up
False
('checking', [1, 5, 8, 3], -1)
('trying', 1)
Giving up
False

A: In the first case, you are iterating through the list and then returning either True or False depending on whether the first item matches the input value. Since in your data the first element never matches the input, both return False.
In the second case, the function only returns if any list item matches the input. The loop iterates through all the elements until one is matched. If not, it returns False.

A: I know the question has already been answered but as you're new to Python I thought I'd give you a little extra :-)
def dataset(data,n):
    return n in data

This will work. It simply checks if n is in the list or not and returns either True or False

A: When you have else: return false you program would return False whenever it encounters a element that is not n .
However,  if  you put it at the end of the function, the statement return False would only execute when none of the statement n==data that were previously executed are true because the function would no longer be executed after the return statement. When none of n == data is true, it means n in not in data.

A: This loop
for value in data:
    if n == value:
        return True
    else:
        return False

Is logically equivalent to this one line
return n == data[0]

In other words, you've returned and exited the loop / function after the very first element
Your other solution, which is logically equivalent to return n in data, or return any(n == x for x in data) will iterate over the whole list, and give you the value after all values have been checked. (I think these two alternatives will short circuit when a match exists, though)


text:
Q: Understanding Model View Presentation (MVP) I have searched a lot for MVP, but I haven't found any good articles that help me understand it very well. Does anyone know of any good articles on the subject, with real-world examples to help me understand it better?
Thanks in advance.

A: Check out my answer to a so post, which may help you:
Is ASP.net Model View Presenter worth the time?
It goes through the differences between MVP and MVC, as often the two are contrasted.
Also, there's some helpful links, which show how to easily fit an MVP model to an existing ASP.Net website.
HTH

A: ASP.NET Supervising Controller (Model View Presenter) From Schematic To Unit Tests to Code
Simplest example of MVP design patter of Asp.net
Model View Presenter with ASP.NET
Very Quick MVP Pattern to Use with ASP.NET
Edited
One more link:
Model View Presenter (MVP) Design Pattern with .NET - Winforms vs. ASP.NET Webforms

A: Here's a site devoted to doing mvp on asp.net: http://webformsmvp.com/
MVP as a pattern is kinda obsolete - MVC (which has a great asp.net framework and support) and MVVM (the de facto pattern of WPF) have largely taken over.  In fact, Martin Fowler (MVP's inventor) has documented that the pattern really ought to be split into two patterns, Passive View and Supervising Controller on his site: http://martinfowler.com/eaaDev/ModelViewPresenter.html

A: If you would like to dig more into this patter, take a look at the Web Client Software Factory 2010 tool.
This tool is basically used to create composite web applications (modules) but the views are implemented using the MVP pattern. If you are going to maintain traditional ASP.Net code or if you want to dig a little bit more in the ASP.Net paradigm, checking the source code of this tool is a great place to start.
This tool requires you to install a couple of extensions to Visual Studio, and after that, you can create a special web project that will implement the MVP for you, it will add contextual menus to Visual Studio to facilitate the tasks
Example:

*

*Create a new project

*

*Add a view with a presenter

*

*Check the generated files

*

*Check the default generated code:
     public partial class MyNewView : Microsoft.Practices.CompositeWeb.Web.UI.Page, IMyNewViewView
     {
        private MyNewViewPresenter _presenter;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this._presenter.OnViewInitialized();
            }
            this._presenter.OnViewLoaded();
        }

        [CreateNew]
        public MyNewViewPresenter Presenter
        {
            get
            {
                return this._presenter;
            }
            set
            {
                if (value == null)
                    throw new ArgumentNullException("value");

                this._presenter = value;
                this._presenter.View = this;
            }
        }

        // TODO: Forward events to the presenter and show state to the user.
        // For examples of this, see the View-Presenter (with Application Controller) QuickStart:
        //

    }

    public interface IMyNewViewView
    {
    }

    public class MyNewViewPresenter : Presenter<IMyNewViewView>
    {

        // NOTE: Uncomment the following code if you want ObjectBuilder to inject the module controller
        //       The code will not work in the Shell module, as a module controller is not created by default
        //
        // private IShellController _controller;
        // public MyNewViewPresenter([CreateNew] IShellController controller)
        // {
        //      _controller = controller;
        // }

        public override void OnViewLoaded()
        {
            // TODO: Implement code that will be executed every time the view loads
        }

        public override void OnViewInitialized()
        {
            // TODO: Implement code that will be executed the first time the view loads
        }

        // TODO: Handle other view events and set state in the view
    }

Take a loot at the tool:

*

*http://webclientguidance.codeplex.com/wikipage?title=Web%20Client%20Software%20Factory&referringTitle=Home

*http://msdn.microsoft.com/en-us/library/ff648752.aspx
BTW, If you are going to start a new project, it should be a better idea to use the MVC, if you need to redactor an existing application, you can take as a base the implementation of the MVP in the Web Client Software Factory.
If you are interested, I think there's a work-through in order to convert an existing application to use the Web Client Software Factory


text:
Q: How can i optimize this erosion filter code? I've implemented this Function that applies Erosion Filter to an image
void applyErosionFilter(QImage &input, int matrixSize)
{
    int filterOffset = (matrixSize - 1) / 2;
    int byteOffset = 0;

    uchar red, green, blue = 0;
    uchar morphResetValue = 255;

    uchar *data = input.bits();
    int stride = input.bytesPerLine();
    uchar *newdata = new uchar[stride * input.height()];

    int i = 0;
    for (int y = filterOffset; y < input.height() - filterOffset; y++)
    {
        for (int x = filterOffset; x < input.width() - filterOffset; x++)
        {
            byteOffset = y * stride + x * 4;

            red = morphResetValue;
            green = morphResetValue;
            blue = morphResetValue;

            for (int filterY = -filterOffset; filterY <= filterOffset; filterY++)
            {
                for (int filterX = -filterOffset; filterX <= filterOffset; filterX++)
                {
                    i = byteOffset + (filterX * 4) + (filterY * stride);

                    if (data[i] < red)
                        red = data[i];

                    if (data[i + 1] < green)
                        green = data[i + 1];

                    if (data[i + 2] < blue)
                        blue = data[i + 2];
                }
            }

            newdata[byteOffset] = red;
            newdata[byteOffset + 1] = green;
            newdata[byteOffset + 2] = blue;
            newdata[byteOffset + 3] = 255;
        }
    }

    input = input.fromImage(QImage(newdata, input.width(), input.height(), QImage::Format::Format_ARGB32));
    delete [] newdata;
}

it works pretty well, but I've been wondering if there is another way to do this in a more efficient way, perhaps there is a way to perform the computations on the GPU using openGL or so.

A: As a quick improvement I would suggest using multiple threads to calculate several lines in parallel. You could also use OpenCL or Cuda to achieve this on the GPU, but that would require substantial boilerplate.
I have modified your code to use multiple threads, but I have not tested this, because I currently do not have Qt installed on this device. But this could at least give you a hint on where to start.
(BTW uchar red, green, blue = 0; only initializes blue with 0, while red and green stay uninitialized)
#include <thread>
#include <vector>
void applyErosionFilter(QImage &input, int matrixSize)
{
    int filterOffset = (matrixSize - 1) / 2;
    int byteOffset = 0;

    uchar morphResetValue = 255;

    uchar *data = input.bits();
    int stride = input.bytesPerLine();
    uchar *newdata = new uchar[stride * input.height()];

    unsigned num_threads = std::thread::hardware_concurrency();
    if (num_threads == 0)
        num_threads = 1;
    std::vector<std::thread> threads;
    int i = 0;
    for (unsigned i = 0; i < num_threads; ++i)
    {
        int start = (input.height() - 2 * filterOffset) * i / num_threads;
        int end = (input.height() - 2 * filterOffset) * (i+1) / num_threads;
        threads.emplace_back([&](int start_line, int end_line){
            unsigned char red = 0;
            unsigned char green = 0;
            unsigned char blue = 0;
            for (int y = start_line; y < end_line; y++)
            {
                for (int x = filterOffset; x < input.width() - filterOffset; x++)
                {
                    byteOffset = y * stride + x * 4;

                    red = morphResetValue;
                    green = morphResetValue;
                    blue = morphResetValue;

                    for (int filterY = -filterOffset; filterY <= filterOffset; filterY++)
                    {
                        for (int filterX = -filterOffset; filterX <= filterOffset; filterX++)
                        {
                            i = byteOffset + (filterX * 4) + (filterY * stride);

                            if (data[i] < red)
                                red = data[i];

                            if (data[i + 1] < green)
                                green = data[i + 1];

                            if (data[i + 2] < blue)
                                blue = data[i + 2];
                        }
                    }

                    newdata[byteOffset] = red;
                    newdata[byteOffset + 1] = green;
                    newdata[byteOffset + 2] = blue;
                    newdata[byteOffset + 3] = 255;
                }
            }
        },
            start, end);
    }
    for (auto &thread : threads)
        thread.join();

    input = input.fromImage(QImage(newdata, input.width(), input.height(), QImage::Format::Format_ARGB32));
    delete [] newdata;
}

A: *

*Use multi-threading: cut the image horizontally in bands and process them separately. I did it with OpenMP, it's really strait forward.

*A squared structuring element of size NxN can be decomposed in two segments (horizontal and vertical) of size 1xN and Nx1. So instead of doing NxN tests per pixel, you will do 2xN: N=3 9 vs 6, n=5 25 vs 10, etc. Much faster!

*Use the algorithm(s) already implemented in the following libraries: SMIL by Matthieu Faessel (C++ auto-vectorized code based on lines comparison, fastest!!!), libmorpho by Marc Van Droogenbroeck (C++ but limited to 8 bits encoding if I am right), or Fulguro by Christophe Clienti (Lambert algorithm that is a good fit for SIMD optimizations). As you can see in these libraries, they use smart approaches/algorithms/architectures to get fast results. What you developed is the basic that is taught in courses for an easy understanding, but it's the slowest!

A: Thank you every body.
I've found what i was looking for, and i wanted to share it with you.
QOpenGLTexture *m_texImageInput;
QOpenGLShaderProgram *m_shaderComputeH;

void initiateShader()
{
    if (m_texImageInput)
    {
        delete m_texImageInput;
        m_texImageInput = nullptr;
    }

    QImage img(":/image.png");
    m_texImageInput = new QOpenGLTexture(img.convertToFormat(QImage::Format_RGBA8888).mirrored());

    if (m_shaderComputeH)
    {
        delete m_shaderComputeH;
        m_shaderComputeH = nullptr;
    }

    m_shaderComputeH = new QOpenGLShaderProgram;
    m_shaderComputeH->addShaderFromSourceFile(QOpenGLShader::Compute, ":/csErosionFilter.fsh");
    m_shaderComputeH->link();
}

QSize getWorkGroups(int workGroupSize, const QSize &imageSize)
{
    int x = imageSize.width();
    x = (x % workGroupSize) ? (x / workGroupSize) + 1 : (x / workGroupSize);
    int y = imageSize.height();
    y = (y % workGroupSize) ? (y / workGroupSize) + 1 : (y / workGroupSize);

    return QSize(x, y);
}

void executeFilter(int radius)
{
    QOpenGLExtraFunctions *f = QOpenGLContext::currentContext()->extraFunctions();

    // Process input image
    QSize workGroups = getWorkGroups(32, QSize(m_texImageInput->width(), m_texImageInput->height()));
    // Pass 2
    f->glBindImageTexture(0, m_texImageInput->textureId(), 0, 0, 0,  GL_READ_WRITE, GL_RGBA8);
    f->glBindImageTexture(1, m_texImageProcessed->textureId(), 0, 0, 0,  GL_READ_WRITE, GL_RGBA8);
    m_shaderComputeH->bind();
    m_shaderComputeH->setUniformValue("radius", radius);
    f->glDispatchCompute(workGroups.width(), workGroups.height(), 1);
    f->glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
    m_shaderComputeH->release();
    // Compute cleanup
    f->glBindImageTexture(0, 0, 0, 0, 0, GL_READ_WRITE, GL_RGBA8);
    f->glBindImageTexture(1, 0, 0, 0, 0, GL_READ_WRITE, GL_RGBA8);
}

and here's the compute shader
   /// csErosionFilter.fsh
    #version 430 core
    #define COMPUTEPATCHSIZE 32
    layout (local_size_x = COMPUTEPATCHSIZE, local_size_y = COMPUTEPATCHSIZE) in;
    layout(binding=0, rgba8) uniform readonly highp image2D inputImage;
    layout(binding=1, rgba8) uniform writeonly highp image2D resultImage;
    uniform int radius;
    void main()
    {
        ivec2 imgSize = imageSize(resultImage);
        int x = int(gl_GlobalInvocationID.x);
        int y = int(gl_GlobalInvocationID.y);
        if ((x >= imgSize.x) || (y >= imgSize.y))
            return;

        vec4 newValue = vec4(1);
        int left   = clamp(x - radius, 0, imgSize.x - 1);
        int right  = clamp(x + radius, 0, imgSize.x - 1);
        int top    = clamp(y - radius, 0, imgSize.y - 1);
        int bottom = clamp(y + radius, 0, imgSize.y - 1);
        for (int iX = left; iX <= right; iX++)
        {
            for (int iY = top; iY <= bottom; iY++)
            {
                vec4 value = imageLoad(inputImage, ivec2(iX, iY));
                if(value.x < newValue.x)
                    newValue.x = value.x;
                if(value.y < newValue.y)
                    newValue.y = value.y;
                if(value.z < newValue.z)
                    newValue.z = value.z;
            }
        }

        imageStore(resultImage, ivec2(x,y), newValue);
    }


text:
Q: js how to convert a string of 0 and 1 to a byte How to convert a string to a byte in javascript and vice-versa?
Sample:
a = "10101010";
b = toByte(a); //char(170)

backtoBin(b); //10101010

Thank you.

A: binary to integer
integer = parseInt(binary,2);

integer to binary
binary = integer.toString(2);

A: Using toString(2) you can convert a number to its binary value, to revert it you can use parseInt(binaryValue, 2). You could do it this way:

function toByte(str){
  return parseInt(str, 2);
}
function backtoBin(num){
  return num.toString(2);
}

var a = "10101010";
var b = toByte(a); //170
var c = backtoBin(b); //10101010

console.log(b, c)
<script src="http://www.wzvang.com/snippet/ignore_this_file.js"></script>

A: You can use parseInt(a, 2) with radix of 2 to convert the string to a value
a = "1010101010";
b = parseInt(a, 2); // results in b = 170

And use Number(b).toString(2) to convert the integer to string
b = 170;
a = Number(b).toString(2); // results a = "10101010";


text:
Q: How to Customize VSTS Build definitions Summary I am using VSTS Build definitions. Once the build is completed then it will show the summary of that particular build. Along with that I would like to show some customized content in the summary.
Is there any way or plug-in to customize the Summary.

A: The simple way is using Logging Commands:
##vso[task.uploadsummary]local file path

Upload and attach summary markdown to current timeline record. This
  summary shall be added to the build/release summary and not available
  for download with logs.

For example:

*

*Add PowerShell task

Script:
Write-Host "##vso[task.uploadsummary]c:\testsummary.md"

A: Yes, actually there is. You want to build an extension for VSTS and Microsoft has created a GitHub repo with a number of samples and reading material to get you started.
VSTS Extensions Samples
Develop Extensions for VSTS


text:
Q: DirectX 11 Render to Texture Not Working I want to render one triangle to texture and then that render to texture need to be displayed in a smaller size at top-left corner of screen with the original triangle at center of the screen.
I have developed one application but not succeeded. Please help me on this.
My code is as follows -

#include <windows.h>
#include <d3d11_1.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <directxcolors.h>
#include "resource.h"

using namespace DirectX;

//--------------------------------------------------------------------------------------
// Structures
//--------------------------------------------------------------------------------------
struct SimpleVertex
{
    XMFLOAT3 Pos;
};

//--------------------------------------------------------------------------------------
// Global Variables
//--------------------------------------------------------------------------------------
HINSTANCE               g_hInst = nullptr;
HWND                    g_hWnd = nullptr;
D3D_DRIVER_TYPE         g_driverType = D3D_DRIVER_TYPE_NULL;
D3D_FEATURE_LEVEL       g_featureLevel = D3D_FEATURE_LEVEL_11_0;
ID3D11Device*           g_pd3dDevice = nullptr;
ID3D11Device1*          g_pd3dDevice1 = nullptr;
ID3D11DeviceContext*    g_pImmediateContext = nullptr;
ID3D11DeviceContext1*   g_pImmediateContext1 = nullptr;
IDXGISwapChain*         g_pSwapChain = nullptr;
IDXGISwapChain1*        g_pSwapChain1 = nullptr;
ID3D11RenderTargetView* g_pRenderTargetView = nullptr;
ID3D11VertexShader*     g_pVertexShader = nullptr;
ID3D11PixelShader*      g_pPixelShader = nullptr;
ID3D11InputLayout*      g_pVertexLayout = nullptr;
ID3D11Buffer*           g_pVertexBuffer = nullptr;

ID3D11Texture2D* m_renderTargetTexture=nullptr;
ID3D11RenderTargetView* m_renderTargetView=nullptr;
ID3D11ShaderResourceView* m_shaderResourceView=nullptr;
ID3D11DepthStencilView* m_depthStencilView;
ID3D11Texture2D* m_depthStencilBuffer;
ID3D11DepthStencilState* m_depthStencilState;

//--------------------------------------------------------------------------------------
// Forward declarations
//--------------------------------------------------------------------------------------
HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow );
HRESULT InitDevice();
void CleanupDevice();
LRESULT CALLBACK    WndProc( HWND, UINT, WPARAM, LPARAM );
void Render();
void RenderOnTexture();

//--------------------------------------------------------------------------------------
// Entry point to the program. Initializes everything and goes into a message processing
// loop. Idle time is used to render the scene.
//--------------------------------------------------------------------------------------
int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow )
{
    UNREFERENCED_PARAMETER( hPrevInstance );
    UNREFERENCED_PARAMETER( lpCmdLine );

    if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
        return 0;

    if( FAILED( InitDevice() ) )
    {
        CleanupDevice();
        return 0;
    }

    // Main message loop
    MSG msg = {0};
    while( WM_QUIT != msg.message )
    {
        if( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) )
        {
            TranslateMessage( &msg );
            DispatchMessage( &msg );
        }
        else
        {
            Render();
        }
    }

    CleanupDevice();

    return ( int )msg.wParam;
}

//--------------------------------------------------------------------------------------
// Register class and create window
//--------------------------------------------------------------------------------------
HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow )
{
    // Register class
    WNDCLASSEX wcex;
    wcex.cbSize = sizeof( WNDCLASSEX );
    wcex.style = CS_HREDRAW | CS_VREDRAW;
    wcex.lpfnWndProc = WndProc;
    wcex.cbClsExtra = 0;
    wcex.cbWndExtra = 0;
    wcex.hInstance = hInstance;
    wcex.hIcon = LoadIcon( hInstance, ( LPCTSTR )IDI_TUTORIAL1 );
    wcex.hCursor = LoadCursor( nullptr, IDC_ARROW );
    wcex.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1 );
    wcex.lpszMenuName = nullptr;
    wcex.lpszClassName = L"TutorialWindowClass";
    wcex.hIconSm = LoadIcon( wcex.hInstance, ( LPCTSTR )IDI_TUTORIAL1 );
    if( !RegisterClassEx( &wcex ) )
        return E_FAIL;

    // Create window
    g_hInst = hInstance;
    RECT rc = { 0, 0, 800, 600 };
    AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE );
    g_hWnd = CreateWindow( L"TutorialWindowClass", L"Direct3D 11 Tutorial 2: Rendering a Triangle",
                           WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
                           CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, hInstance,
                           nullptr );
    if( !g_hWnd )
        return E_FAIL;

    ShowWindow( g_hWnd, nCmdShow );

    return S_OK;
}

//--------------------------------------------------------------------------------------
// Helper for compiling shaders with D3DCompile
//
// With VS 11, we could load up prebuilt .cso files instead...
//--------------------------------------------------------------------------------------
HRESULT CompileShaderFromFile( WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3DBlob** ppBlobOut )
{
    HRESULT hr = S_OK;

    DWORD dwShaderFlags = D3DCOMPILE_ENABLE_STRICTNESS;
#ifdef _DEBUG
    // Set the D3DCOMPILE_DEBUG flag to embed debug information in the shaders.
    // Setting this flag improves the shader debugging experience, but still allows
    // the shaders to be optimized and to run exactly the way they will run in
    // the release configuration of this program.
    dwShaderFlags |= D3DCOMPILE_DEBUG;

    // Disable optimizations to further improve shader debugging
    dwShaderFlags |= D3DCOMPILE_SKIP_OPTIMIZATION;
#endif

    ID3DBlob* pErrorBlob = nullptr;
    hr = D3DCompileFromFile( szFileName, nullptr, nullptr, szEntryPoint, szShaderModel,
        dwShaderFlags, 0, ppBlobOut, &pErrorBlob );
    if( FAILED(hr) )
    {
        if( pErrorBlob )
        {
            OutputDebugStringA( reinterpret_cast<const char*>( pErrorBlob->GetBufferPointer() ) );
            pErrorBlob->Release();
        }
        return hr;
    }
    if( pErrorBlob ) pErrorBlob->Release();

    return S_OK;
}

//--------------------------------------------------------------------------------------
// Create Direct3D device and swap chain
//--------------------------------------------------------------------------------------
HRESULT InitDevice()
{
    HRESULT hr = S_OK;

    RECT rc;
    GetClientRect( g_hWnd, &rc );
    UINT width = rc.right - rc.left;
    UINT height = rc.bottom - rc.top;

    UINT createDeviceFlags = 0;
#ifdef _DEBUG
    createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

    D3D_DRIVER_TYPE driverTypes[] =
    {
        D3D_DRIVER_TYPE_HARDWARE,
        D3D_DRIVER_TYPE_WARP,
        D3D_DRIVER_TYPE_REFERENCE,
    };
    UINT numDriverTypes = ARRAYSIZE( driverTypes );

    D3D_FEATURE_LEVEL featureLevels[] =
    {
        D3D_FEATURE_LEVEL_11_1,
        D3D_FEATURE_LEVEL_11_0,
        D3D_FEATURE_LEVEL_10_1,
        D3D_FEATURE_LEVEL_10_0,
    };
 UINT numFeatureLevels = ARRAYSIZE( featureLevels );

    for( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ )
    {
        g_driverType = driverTypes[driverTypeIndex];
        hr = D3D11CreateDevice( nullptr, g_driverType, nullptr, createDeviceFlags, featureLevels, numFeatureLevels,
                                D3D11_SDK_VERSION, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext );

        if ( hr == E_INVALIDARG )
        {
            // DirectX 11.0 platforms will not recognize D3D_FEATURE_LEVEL_11_1 so we need to retry without it
            hr = D3D11CreateDevice( nullptr, g_driverType, nullptr, createDeviceFlags, &featureLevels[1], numFeatureLevels - 1,
                                    D3D11_SDK_VERSION, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext );
        }

        if( SUCCEEDED( hr ) )
            break;
    }
    if( FAILED( hr ) )
        return hr;

    // Obtain DXGI factory from device (since we used nullptr for pAdapter above)
    IDXGIFactory1* dxgiFactory = nullptr;
    {
        IDXGIDevice* dxgiDevice = nullptr;
        hr = g_pd3dDevice->QueryInterface( __uuidof(IDXGIDevice), reinterpret_cast<void**>(&dxgiDevice) );
        if (SUCCEEDED(hr))
        {
            IDXGIAdapter* adapter = nullptr;
            hr = dxgiDevice->GetAdapter(&adapter);
            if (SUCCEEDED(hr))
            {
                hr = adapter->GetParent( __uuidof(IDXGIFactory1), reinterpret_cast<void**>(&dxgiFactory) );
                adapter->Release();
            }
            dxgiDevice->Release();
        }
    }
    if (FAILED(hr))
        return hr;

    // Create swap chain
    IDXGIFactory2* dxgiFactory2 = nullptr;
    hr = dxgiFactory->QueryInterface( __uuidof(IDXGIFactory2), reinterpret_cast<void**>(&dxgiFactory2) );
    if ( dxgiFactory2 )
    {
        // DirectX 11.1 or later
        hr = g_pd3dDevice->QueryInterface( __uuidof(ID3D11Device1), reinterpret_cast<void**>(&g_pd3dDevice1) );
        if (SUCCEEDED(hr))
        {
            (void) g_pImmediateContext->QueryInterface( __uuidof(ID3D11DeviceContext1), reinterpret_cast<void**>(&g_pImmediateContext1) );
        }

        DXGI_SWAP_CHAIN_DESC1 sd;
        ZeroMemory(&sd, sizeof(sd));
        sd.Width = width;
        sd.Height = height;
        sd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
        sd.SampleDesc.Count = 1;
        sd.SampleDesc.Quality = 0;
        sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
        sd.BufferCount = 1;

        hr = dxgiFactory2->CreateSwapChainForHwnd( g_pd3dDevice, g_hWnd, &sd, nullptr, nullptr, &g_pSwapChain1 );
        if (SUCCEEDED(hr))
        {
            hr = g_pSwapChain1->QueryInterface( __uuidof(IDXGISwapChain), reinterpret_cast<void**>(&g_pSwapChain) );
        }

        dxgiFactory2->Release();
    }
    else
    {
        // DirectX 11.0 systems
        DXGI_SWAP_CHAIN_DESC sd;
        ZeroMemory(&sd, sizeof(sd));
        sd.BufferCount = 1;
        sd.BufferDesc.Width = width;
        sd.BufferDesc.Height = height;
        sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
        sd.BufferDesc.RefreshRate.Numerator = 60;
        sd.BufferDesc.RefreshRate.Denominator = 1;
        sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
        sd.OutputWindow = g_hWnd;
        sd.SampleDesc.Count = 1;
        sd.SampleDesc.Quality = 0;
        sd.Windowed = TRUE;

        hr = dxgiFactory->CreateSwapChain( g_pd3dDevice, &sd, &g_pSwapChain );
    }

    // Note this tutorial doesn't handle full-screen swapchains so we block the ALT+ENTER shortcut
    dxgiFactory->MakeWindowAssociation( g_hWnd, DXGI_MWA_NO_ALT_ENTER );

    dxgiFactory->Release();

    if (FAILED(hr))
        return hr;

    // Create a render target view
    ID3D11Texture2D* pBackBuffer = nullptr;
    hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), reinterpret_cast<void**>( &pBackBuffer ) );
    if( FAILED( hr ) )
        return hr;

    hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, nullptr, &g_pRenderTargetView );
    pBackBuffer->Release();
    if( FAILED( hr ) )
        return hr;

 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 D3D11_TEXTURE2D_DESC textureDesc;
 HRESULT result;
 D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
 D3D11_SHADER_RESOURCE_VIEW_DESC shaderResourceViewDesc;

 // Initialize the render target texture description.
 ZeroMemory(&textureDesc, sizeof(textureDesc));

 // Setup the render target texture description.
 textureDesc.Width = 400/*textureWidth*/;
 textureDesc.Height = 400/*textureHeight*/;
 textureDesc.MipLevels = 1;
 textureDesc.ArraySize = 1;
 textureDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
 textureDesc.SampleDesc.Count = 1;
 textureDesc.Usage = D3D11_USAGE_DEFAULT;
 textureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
 textureDesc.CPUAccessFlags = 0;
 textureDesc.MiscFlags = 0;

 // Create the render target texture.
 result = g_pd3dDevice->CreateTexture2D(&textureDesc, NULL, &m_renderTargetTexture);
 if (FAILED(result))
 {
  return false;
 }

 // Setup the description of the render target view.
 renderTargetViewDesc.Format = textureDesc.Format;
 renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
 renderTargetViewDesc.Texture2D.MipSlice = 0;

 // Create the render target view.
 result = g_pd3dDevice->CreateRenderTargetView(m_renderTargetTexture, &renderTargetViewDesc, &m_renderTargetView);
 if (FAILED(result))
 {
  return false;
 }

 // Setup the description of the shader resource view.
 shaderResourceViewDesc.Format = textureDesc.Format;
 shaderResourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
 shaderResourceViewDesc.Texture2D.MostDetailedMip = 0;
 shaderResourceViewDesc.Texture2D.MipLevels = 1;

 // Create the shader resource view.
 result = g_pd3dDevice->CreateShaderResourceView(m_renderTargetTexture, &shaderResourceViewDesc, &m_shaderResourceView);

 //D3D11_TEXTURE2D_DESC depthBufferDesc;
 //D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
 //D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
 //// Initialize the description of the depth buffer.
 //ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc));

 //// Set up the description of the depth buffer.
 //depthBufferDesc.Width = 400;
 //depthBufferDesc.Height = 400;
 //depthBufferDesc.MipLevels = 1;
 //depthBufferDesc.ArraySize = 1;
 //depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
 //depthBufferDesc.SampleDesc.Count = 1;
 //depthBufferDesc.SampleDesc.Quality = 0;
 //depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;
 //depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
 //depthBufferDesc.CPUAccessFlags = 0;
 //depthBufferDesc.MiscFlags = 0;

 //// Create the texture for the depth buffer using the filled out description.
 //result = g_pd3dDevice->CreateTexture2D(&depthBufferDesc, NULL, &m_depthStencilBuffer);
 //if (FAILED(result))
 //{
 // return false;
 //}

 //// Initialize the description of the stencil state.
 //ZeroMemory(&depthStencilDesc, sizeof(depthStencilDesc));

 //// Set up the description of the stencil state.
 //depthStencilDesc.DepthEnable = true;
 //depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
 //depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;

 //depthStencilDesc.StencilEnable = true;
 //depthStencilDesc.StencilReadMask = 0xFF;
 //depthStencilDesc.StencilWriteMask = 0xFF;

 //// Stencil operations if pixel is front-facing.
 //depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
 //depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
 //depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
 //depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;

 //// Stencil operations if pixel is back-facing.
 //depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
 //depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
 //depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
 //depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;

 //// Create the depth stencil state.
 //result = g_pd3dDevice->CreateDepthStencilState(&depthStencilDesc, &m_depthStencilState);
 //if (FAILED(result))
 //{
 // return false;
 //}

 //// Set the depth stencil state.
 //g_pImmediateContext->OMSetDepthStencilState(m_depthStencilState, 1);

 //// Initialize the depth stencil view.
 //ZeroMemory(&depthStencilViewDesc, sizeof(depthStencilViewDesc));

 //// Set up the depth stencil view description.
 //depthStencilViewDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
 //depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
 //depthStencilViewDesc.Texture2D.MipSlice = 0;

 //// Create the depth stencil view.
 //result = g_pd3dDevice->CreateDepthStencilView(m_depthStencilBuffer, &depthStencilViewDesc, &m_depthStencilView);
 //if (FAILED(result))
 //{
 // return false;
 //}

 // Bind the render target view and depth stencil buffer to the output render pipeline.
 g_pImmediateContext->OMSetRenderTargets(1, &m_renderTargetView, /*m_depthStencilView*/nullptr);

 // Clear the back buffer.
 g_pImmediateContext->ClearRenderTargetView(m_renderTargetView, Colors::Red);

 // Clear the depth buffer.
 //g_pImmediateContext->ClearDepthStencilView(depthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0);
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Setup the viewport
    D3D11_VIEWPORT vp;
    vp.Width = (FLOAT)width;
    vp.Height = (FLOAT)height;
    vp.MinDepth = 0.0f;
    vp.MaxDepth = 1.0f;
    vp.TopLeftX = 0;
    vp.TopLeftY = 0;
    g_pImmediateContext->RSSetViewports( 1, &vp );

    // Compile the vertex shader
    ID3DBlob* pVSBlob = nullptr;
    hr = CompileShaderFromFile( L"Tutorial02.fx", "VS", "vs_4_0", &pVSBlob );
    if( FAILED( hr ) )
    {
        MessageBox( nullptr,
                    L"The FX file cannot be compiled.  Please run this executable from the directory that contains the FX file.", L"Error", MB_OK );
        return hr;
    }

 // Create the vertex shader
 hr = g_pd3dDevice->CreateVertexShader( pVSBlob->GetBufferPointer(), pVSBlob->GetBufferSize(), nullptr, &g_pVertexShader );
 if( FAILED( hr ) )
 {
  pVSBlob->Release();
        return hr;
 }

    // Define the input layout
    D3D11_INPUT_ELEMENT_DESC layout[] =
    {
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    };
 UINT numElements = ARRAYSIZE( layout );

    // Create the input layout
 hr = g_pd3dDevice->CreateInputLayout( layout, numElements, pVSBlob->GetBufferPointer(),
                                          pVSBlob->GetBufferSize(), &g_pVertexLayout );
 pVSBlob->Release();
 if( FAILED( hr ) )
        return hr;

    // Set the input layout
    g_pImmediateContext->IASetInputLayout( g_pVertexLayout );

 // Compile the pixel shader
 ID3DBlob* pPSBlob = nullptr;
    hr = CompileShaderFromFile( L"Tutorial02.fx", "PS", "ps_4_0", &pPSBlob );
    if( FAILED( hr ) )
    {
        MessageBox( nullptr,
                    L"The FX file cannot be compiled.  Please run this executable from the directory that contains the FX file.", L"Error", MB_OK );
        return hr;
    }

 // Create the pixel shader
 hr = g_pd3dDevice->CreatePixelShader( pPSBlob->GetBufferPointer(), pPSBlob->GetBufferSize(), nullptr, &g_pPixelShader );
 pPSBlob->Release();
    if( FAILED( hr ) )
        return hr;

    // Create vertex buffer
    SimpleVertex vertices[] =
    {
        XMFLOAT3( 0.0f, 0.5f, 0.5f ),
        XMFLOAT3( 0.5f, -0.5f, 0.5f ),
        XMFLOAT3( -0.5f, -0.5f, 0.5f ),
    };
    D3D11_BUFFER_DESC bd;
 ZeroMemory( &bd, sizeof(bd) );
    bd.Usage = D3D11_USAGE_DEFAULT;
    bd.ByteWidth = sizeof( SimpleVertex ) * 3;
    bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
 bd.CPUAccessFlags = 0;
    D3D11_SUBRESOURCE_DATA InitData;
 ZeroMemory( &InitData, sizeof(InitData) );
    InitData.pSysMem = vertices;
    hr = g_pd3dDevice->CreateBuffer( &bd, &InitData, &g_pVertexBuffer );
    if( FAILED( hr ) )
        return hr;

    // Set vertex buffer
    UINT stride = sizeof( SimpleVertex );
    UINT offset = 0;
    g_pImmediateContext->IASetVertexBuffers( 0, 1, &g_pVertexBuffer, &stride, &offset );

    // Set primitive topology
    g_pImmediateContext->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );

 RenderOnTexture();
    return S_OK;
}

//--------------------------------------------------------------------------------------
// Clean up the objects we've created
//--------------------------------------------------------------------------------------
void CleanupDevice()
{
    if( g_pImmediateContext ) g_pImmediateContext->ClearState();

    if( g_pVertexBuffer ) g_pVertexBuffer->Release();
    if( g_pVertexLayout ) g_pVertexLayout->Release();
    if( g_pVertexShader ) g_pVertexShader->Release();
    if( g_pPixelShader ) g_pPixelShader->Release();
    if( g_pRenderTargetView ) g_pRenderTargetView->Release();
    if( g_pSwapChain1 ) g_pSwapChain1->Release();
    if( g_pSwapChain ) g_pSwapChain->Release();
    if( g_pImmediateContext1 ) g_pImmediateContext1->Release();
    if( g_pImmediateContext ) g_pImmediateContext->Release();
    if( g_pd3dDevice1 ) g_pd3dDevice1->Release();
    if( g_pd3dDevice ) g_pd3dDevice->Release();
}

//--------------------------------------------------------------------------------------
// Called every time the application receives a message
//--------------------------------------------------------------------------------------
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
    PAINTSTRUCT ps;
    HDC hdc;

    switch( message )
    {
    case WM_PAINT:
        hdc = BeginPaint( hWnd, &ps );
        EndPaint( hWnd, &ps );
        break;

    case WM_DESTROY:
        PostQuitMessage( 0 );
        break;

        // Note that this tutorial does not handle resizing (WM_SIZE) requests,
        // so we created the window without the resize border.

    default:
        return DefWindowProc( hWnd, message, wParam, lParam );
    }

    return 0;
}

//--------------------------------------------------------------------------------------
// Render a frame
//--------------------------------------------------------------------------------------
void Render()
{
    // Clear the back buffer
    g_pImmediateContext->ClearRenderTargetView( g_pRenderTargetView, Colors::MidnightBlue );

    // Render a triangle
 /*g_pImmediateContext->VSSetShader( g_pVertexShader, nullptr, 0 );
 g_pImmediateContext->PSSetShader( g_pPixelShader, nullptr, 0 );
    g_pImmediateContext->Draw( 3, 0 );*/

 g_pImmediateContext->PSSetShaderResources(0, 1, &m_shaderResourceView);
    // Present the information rendered to the back buffer to the front buffer (the screen)
    g_pSwapChain->Present( 0, 0 );
}

void RenderOnTexture()
{
 g_pImmediateContext->VSSetShader(g_pVertexShader, nullptr, 0);
 g_pImmediateContext->PSSetShader(g_pPixelShader, nullptr, 0);
 g_pImmediateContext->Draw(3, 0);
 g_pImmediateContext->OMSetRenderTargets(1, &g_pRenderTargetView, nullptr);
}

A: Your Render() function has no draw calls in it.


text:
Q: ant tar, exclude content of a folder but include the folder itself What's the right include/exclude pattern to exclude content of a folder but include the folder itself ?
for example,
I want to exclude all classes and all the package structure in WEB-INF/classes, but keep the folder itself.

A: Assuming the following directory str.:
..\ tarring \ xyz \ folder-A;
..\ tarring \ xyz \ folder-B;
...
..\ tarring \ xyz \ folder-X;
<tar basedir="..\tarring\xyz" destfile="..\tarring\xyz.tar">
    <exclude name="folder-X/**/*"/>
</tar>

folder-X:  the folder which is to be included in the tar file, but without its contents
xyz.tar will contain all the contents within the ..\ tarring \ xyz folder, along with an empty folder-X.

*

*<exclude name="folder-X/**/*"/> : includes ONLY folder-X and not inner files or sub-directories

*<exclude name="folder-X/**/*.*"/> : includes folder-X along with all sub-directories under it. However, excludes ALL files within folder-X and its sub-directories.

*<exclude name="folder-X/*.*"/> : includes folder-X and any sub-directories within folder-X, along with all their contents BUT excludes all FILES directly under folder-X


text:
Q: How to select Report Design layout using AX code? I've been modifying a Report design in AX. This design has three layouts, each layout has different sizes. So when the user wants to run the report and wants a specific size, he can just select a predefined size via a drop-down list and I will then use that as a parameter to call the the specific design layout.
My question is how can I call that specific design layout using AX code?
Note: this report is for the bar code labels.
Thanks!

A: Change code in the parmReportName (AOT: \Classes\RetailLabelController\parmReportName).
MSDN: http://msdn.microsoft.com/en-us/library/srsreportruncontroller.parmreportname.aspx


text:
Q: Should i make different texture pack for each image button in libgdx? I am using 12 image buttons in my game, should i make a single texture pack for all buttons or make different .pack file and .png for each and every image button?

A: You should use the least amount of images possible to reduce the amount of images that need loaded into memory.

"The main reason to use a texture packer is that loading individual
  images is expensive. Loading 200 small images would take a lot of
  processing time whereas loading 1 image and using portions of that
  image would use a considerably smaller amount."

Quote from gamedevelopment.blog


text:
Q: How can I change the order of html elements with media queries? This is an example of my code

Display on Desktop

example

example

        classic-menu

Display on Mobile

    menu responsive-------> when the menu go in drop down all header content follow the menu

example

        ----->wrong logo position when you open the menu responsive

example

I want know if with media queries I can change the current order of HTML elements, so as to fix the logo position in responsive view.

A:

@media only screen and (max-width: 600px) {
    #flex { display: flex; flex-direction: column; }
    #a { order: 2; }
    #b { order: 1; }
    #c { order: 3; }
}
You Can try this:

A

B

C

For details: Click here

A: You can make two different html
s call one desktop and one mobile, then use media queries to show or hide based off screen size. https://jsfiddle.net/DIRTY_SMITH/7a7m84ea/2/
.mobile {
    display: none;
}
.mobile > h3 {color: blue;}
@media (max-width: 600px) {
    .mobile {
        display: inline;
    }
    .desktop {
        display: none;
    }
}

A: You could try utilizing CSS tables, as they have pre-defined display types that enforce a certain order (in your case: table-caption, which comes before table-cell):
div { display: table }
header { display: table-cell }
nav { display: table-caption }

Here's a JSFiddle to demonstrate what I mean.


text:
Q: HOw to find value of hidden field from formcollection in controller I am using a hidden field in my view which is saving some value of active tab index
Now I want the value of hidden field in my controller
I m using a submit button to submit.
 public ActionResult Index(FormCollection frm)
    {     var value = frm["HiddenName"];
 }

I m submitting form and using FormCollection to fetch values
but when It comes to find value of hidden field I always gives me blank value, I have checked using page source code It has some value in it

A: FormCollection in MVC pickup all those element having name Attribute
 <input type="hidden" name="username" value="Samsam" />

now you can access this HTML control in server side
 public ActionResult GetValue(FormCollection collection)
 {
   string username = collection.Get("username");
 }

A: Does the input tag have a name attribute and is it located within the form?

A: You can create hidden field like this:
@Html.HiddenFor(model => model.username)

Than user name is in collection, but it should be in views model also.

A: You can get you value like this:
var hiddenvalue = frm.GetValue("HiddenName").AttemptedValue


text:
Q: How to use a html5 color input type but without using a javascript color picker in wicket framework? In the wicket application, I want to use a html5 colorpicker. How can I achieve this?
I expect the output of the html5 color input type as fig.1 enter image description here, but the actual output is fig.2.enter image description here

A: Colour inputs use whatever user interface the browser provides, often the native colour picker UI from the operating system / desktop environment.
You can't control this without reimplementing the entire UI in JavaScript.


text:
Q: Is it possible to login to a site from actionscript? Lets say I've written a flash program that sends POST requests to a web site. Then if the web server sets cookies or sessions, how can I get those cookies/session variable names, lets say that the server uses PHP.
Some little example of code please. Just for view.

A: Take a look at this post. There's a solution how to grab the cookie data.


text:
Q: Visual Studio Code going down to line automatically I am using Brackets at the moment i want to switch to Visual Stuido Code but some features of Brackets are very usefull.
One of them, i use the editor narrowly, Brackets going under line automatically if it is not fit the line, but Visual Studio Code does not.
And second one also is when i design a html i can see the differences in live preview, is it possible to see it in Visual Stuido Code also?
Visual Studio Code
Brackets

A: You want to enable the Word Wrap in Visual Studio Code.
Go to View -> Toggle Word Wrap.
Live Preview is actually possible in every editor you use. Today's devs use task automators like Gulp or Grunt, so they are not attached to specific editor like Brackets.
Using Gulp (or Grunt) you can set up a task that will watch your files for changes and then do specific actions, like reload the page, recompile Sass files etc.
You can find more here:
https://www.youtube.com/watch?v=r5fvdIa0ETk


text:
Q: WPF TabControl default to vertically stacked tabs I just started using Microsoft WPF to try  to make a simple GUI for a small program and ran into trouble when I wanted a TabControl.
When I drag it in from the toolbox it looks like this:
Default TabControl
As you can see the tabs are on the top but stacked vertically and I can't figure out how to make them horizontal. I've tried using the TabStripPlacement option but that just moves the packet of tabs to a different side of the TabControl, it doesn't organize the tabs in relation to each other.
So to be clear: I want the tabs on top, but I want them side by side, like the normal tab arrangement, which seems to be the default for everyone except me.

A: This is default behavior when the horizontal space cannot occupy the tabs horizontally.

So you need to give it more space. Preventing this behavior isn't trivial, but is possible.


text:
Q: Line-Bar Chart: how to set the xAxis ticks when I have 2 series of 2 different frequencies? In LineBar.json
[
{
  "key" : "Data09" ,
  "bar": true,
  "color": "#ccf",
    "values": [[1469440800000, 0]
        , [1469444400000, 0]
        , [1469444400000, 3]
        , [1469448000000, 0]
        , [1469451600000, 0]
        , [1469451600000, 3]
        , [1469455200000, 0]
        , [1469455200000, 5]
        , [1469458800000, 9]
        ]
} ,

{
  "key" : "Data34" ,
  "color" : "#333",
  "values" : [[1469440800000, 0], [1469441400000, 0], [1469441400000, 2]
            , [1469442000000, 0], [1469442600000, 0], [1469443200000, 0]
            , [1469443800000, 0], [1469444400000, 0], [1469444400000, 1]
            , [1469445000000, 0], [1469445600000, 0], [1469446200000, 0]
            , [1469446800000, 0], [1469447400000, 0], [1469448000000, 0]
            , [1469448600000, 0], [1469448600000, 1], [1469449200000, 0]
            , [1469449800000, 0], [1469449800000, 1], [1469450400000, 0]
            , [1469450400000, 1], [1469451000000, 0], [1469451600000, 0]
            , [1469452200000, 0], [1469452800000, 0], [1469453400000, 0]
            , [1469453400000, 1], [1469454000000, 0], [1469454600000, 0]
            , [1469454600000, 3], [1469455200000, 0], [1469455200000, 1], [1469455800000, 0]]
}
]

<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.2/d3.min.js" charset="utf-8"></script>
<script src="../build/nv.d3.js"></script>
<script>
var chart;
d3.json( "lineBar.json", function ( error, data )
{
    nv.addGraph( function ()
    {
        var chart = nv.models.linePlusBarChart()
              .margin( { top: 30, right: 60, bottom: 50, left: 70 } )
              //We can set x data accessor to use index. Reason? So the bars all appear evenly spaced.
              .x( function ( d, i ) { return i } )
              .y( function ( d, i ) { return d[1]; } )
        ;

        chart.xAxis.tickFormat( function ( d )
        {
            //alert( d + ', ' + data[0].values[d][0] );
            var dx = data[0].values[d] && data[0].values[d][0] || 0;
            //alert( d + ', ' + dx );
            return d3.time.format( '%m/%d %H.%M' )( new Date( dx ) )
        } );

        chart.y1Axis
            .tickFormat( d3.format( ',f' ) );

        chart.y2Axis
            .tickFormat( function ( d ) { return d3.format( ',f' )( d ) } );

        chart.bars.forceY( [0] );

        d3.select( '#chart1 svg' )
          .datum( data )
          .transition()
          .duration( 0 )
          .call( chart );

        nv.utils.windowResize( chart.update );

        return chart;
    } );

} );

</script>

When I ran it, my xAxis 's time (except the first few intervals being correct) have all had a New Year Eve's date (not knowing where that came from)!  So I changed the xAxis Data Accessor from i to i/3, it "improved" but still not all right!  (Fig.2)
        var chart = nv.models.linePlusBarChart()
              .margin( { top: 30, right: 60, bottom: 50, left: 70 } )
              //We can set x data accessor to use index. Reason? So the bars all appear evenly spaced.
              .x( function ( d, i ) { return i/3 } )
              .y( function ( d, i ) { return d[1]; } )
        ;

I have been working on this tickmarks for 2 days already, so frustrating that I almost wanted to deflect from using d3!  I need help!

I acquired those date numerals UTC from writing this function
function toUTC( DD )
{
    var date = new Date( "2017-01-23 21:23:59.999" );
    if ( DD ) date = new Date( DD );

    var yyyy = date.getFullYear();
    var MM = date.getMonth();
    var dd = date.getDate();
    var HH = date.getHours();
    var mm = date.getMinutes();
    var ss = date.getSeconds();
    var ms = date.getMilliseconds();
    var UTC = Date.UTC( yyyy, MM, dd, HH, mm, ss, ms );
    return ( UTC );
};

A: I found the answer !!  The problem that I have above is I was using the series that has lower frequency for my time ticks!  I need to calc my time-ticks using intervals from the graph of higher frequency.
var chart = nv.models.linePlusBarChart()
        .margin( { top: 30, right: 60, bottom: 50, left: 70 } )
        //We can set x data accessor to use index. Reason? So the bars all appear evenly spaced.
        .x( function ( d, i ) { return i } )
        .y( function ( d, i ) { return d[1]; } )
;

chart.xAxis.tickFormat( function ( d ) {
    var dx = data[1].values[d] && data[1].values[d][0] || 0;
    return d3.time.format( '%m/%d %H.%M' )( new Date( dx ) )
} );


text:
Q: Meu programa compila mas trava no primeiro printf #include<stdio.h>
void main()
{
    int n1,n2,n3,maior,menor;
    printf("Primeiro numero: ");
    scanf("%d", n1);
    printf("Segundo numero: ");
    scanf("%d", n2);
    printf("Terceiro numero: ");
    scanf("%d", n3);
    if (n1>n2&&n1>n3)
    {
        maior=n1;
        if (n2>n3)
            menor=n3;
        else
            menor=n2;
    }
    else if (n2>n1&&n2>n3)
    {
        maior=n2;
        if (n1>n3)
            menor=n3;
        else
            menor=n1;
    }
    else
    {
        maior=n3;
        if (n1>n2)
            menor=n2;
        else
            menor=n1;
    }
    printf("Menor numero: %d\nMaior numero: %d",menor,maior);
}

Após perguntar o primeiro numero e eu dar a resposta, o programa trava. Alguém sabe o por que disso? Estou usando CodeBlocks pois é recomendado  pela universidade.

A: Faltou colocar & antes da variável no scanf. Por isso é muito melhor usar a biblioteca  e usar cin ao inves de scanf.
Voce usou "return 0" no final?
Seu codigo ficaria (trecho):
include
using namespace std;
void main()
{
    int n1,n2,n3,maior,menor;
cout <<"Primeiro numero: ";
cin >> n1;
cout <<"Segundo numero: ";
cin >> n;
cout <<"Terceiro numero: ";
cin >> n3;
if (n1>n2&&n1>n3)
{

A: Olá!
Você deve utilizar o & nas variáveis quando utilizar o scanf.
Exemplo: scanf("%d", &n1);
Pois o valor que você digitar será armazenado no endereço de n1, quando você estiver no tópico de ponteiros compreenderá melhor. Caso continue com dúvidas, visite o site http://linguagemc.com.br

A: Primeiro, O Code::Blocks é uma bela de uma *****!
Sem brincadeiras.
Segundo, inclua o <stdlib.h>
Terceiro, dê um valor de 0 a todas as variáveis (sempre atribua um valor a cada variável que você declara!).
Espero que resolva teu problema! :D


text:
Q: Create a string variable and ask for input on the same line? I absolutely hate these unnecessary steps in programming where you declare and assign a variable on one line and ask for an input in the next.
To keep it short, I want to create a variable and ask for input all on the same line.
Currently I'm writting code like this:
string name = "";
cout << "Please enter your name: ";
cin >> name; //Too many steps for no reason

This is somewhat my goal:
string name = cin >> name

Obviously that line does not work in C++ nor will it work if I close an eye and prey for it to work.
Is there a small trick to do that? I mean its possible to work with for-loops when assigning an array so why not declaration and input assigment on one line?
I'm aware that the reader will try to jump out of the window. goto proved that theory and yes I use it with pride :)
Any help appreciated!

A: You can try writing a template function, e.g.
template <typename T>
T read (std::istream & in = std::cin)
{
    T x; in >> x; return x;
}

and use it like
 auto x = read<int>();

If you want to validate user input (and you almost certainly do want it in real-life code), you can use e.g. std::optional:
template <typename T>
std::optional<T> read (std::istream & in = std::cin)
{
    T x; in >> x; return in ? x : std::nullopt;
}

template <typename T>
T read_loop (std::istream & in = std::cin)
{
    while (true)
    {
        auto input = read<T>(in);
        if (input) return *input;
        in.clear();
        std::cout << "try again: ";
    }
}

A: So what is the problem?
If you have repeating code (any not necessary annoying) you just enclose it in function/method:
template<typename T>
auto consoleInput(std::string_view request) -> T
{
    std::cin.sync();
    std::cout << request;
    T x;
    while(! (std::cin >> x)) {
        std::cin.clear();
        std::cin.ignore(200, '\n');
        std::cout << "\ntry again: " << request;
    }
    return x;
}

auto name = consoleInput<std::string>("Provide a name");

https://wandbox.org/permlink/iUWmrMCbCWGjoiGu

A:
yes I use it with pride :)

You really shouldn't. Learn to write good, easy to read, small function with the simplest control flow in it. Also, <algorithm>.

You can do that by moving the steps to initialize the variable into a function:
template<typename T>
auto ask_user(std::string_view message) -> T {
    std::cout << message;
    T value;
    std::cin >> value;
    return value;
}

Now you can do your inputs like that:
int main() {
    auto name = ask_user<std::string>("What's your name? ");
}


text:
Q: Неправильный вызов библиотеки CI Использую CI.
В пользовательской библиотеке, в конструкторе, подключаю еще одну библу:
    $this->CI->load->library('redispusher');
В результате чего, происходит редирект (страница не найдена).
Сам класс redispusher стоит в автозагрузке.
Если зайти в класс class RedisPusher {} и в конструкторе поставить die(), то он не срабатывает:
function __construct(){ die('d');
        $options = array(
                'namespace' => '',
                'servers'   => array(
                        array( 'host' => '127.0.0.1', 'port' => 6379 )
                )
        );
        include( APPPATH.'libraries/Rediska.php' );
        include( APPPATH.'libraries/Rediska/Key.php' );
        $this->_redis = new Rediska($options);

    }

Если поставить die('d'); перед Class - тоже не срабатывет.
Вопрос в том, как найти этот стек вызовов и где происходит редирект


text:
Q: Replace image with error image by image name with onChange="swapImage()" Pretty new to Javascipt.
Using a form with on top of the form a image.  If they change an option in one of the eight dropdown boxes the image will change. However, if they make a configuration that doesn't exsist, the image is not found and the standard broken imagelink will be displayed.
Is there a way to check when I'm  changing a value and trigger the onChange="swapImage()"from a dropdown to trigger an event to check if image exsists, and if not, replace it with an error image?
<script type="text/javascript">
function swapImage(){
    var image = document.getElementById("imageToSwap");
    var hoogte = document.getElementById("hoogte").value;
    var bt = document.getElementById("bt").value;
    var fase = document.getElementById("fase").value;
    var aardlek = document.getElementById("aardlek").value;
    var kook = document.getElementById("kook").value;
    var groepen = document.getElementById("groepen").value;
    var merk = document.getElementById("merk").value;

    image.src = "http://www.groepenkasten.expert/images/" + merk + "/" + hoogte + "_"  + bt + "_"  + fase + "_" + aardlek + "_" + kook + "_" + groepen +".gif";
};

Because the image is Dynamic, there is no full page reload,. Therefore it will not detect the error that the broken image produce when the image doesn't exsist.
Link to the form: http://www.groepenkasten.expert/meld-uw-storing/kant-en-klare-groepenkasten


text:
Q: $L^1$ convergence of a martingale, conditional expectation I am trying to prove the following:
Let our space be $(\Omega, \mathcal{F}, P, \{ \mathcal{F}_n \}_{n \in \mathbb{N}})$.
Let $\{X_n \}_{n \in \mathbb{N}}$ be a martingale (adapted to the filtration ) such that $X_n \to X$ in $L^1$. Then $X_n = \mathbb{E}(X| \mathcal{F}_n)$
So our assumptions are that $\mathbb{E} |X_n| < \infty, \ \ \mathbb{E}(X_{n+1} | \mathcal{F}_n) = X_n$ and $\mathbb{E}|X_n - X| \to 0$.
And we need to show that $X_n = \mathbb{E}(X| \mathcal{F}_n)$.
We could take the conditional expectation with respect to $\mathcal{F}_{n-1}$ on both sides:
$$\mathbb{E}(X_n | \mathcal{F}_{n-1}) = \mathbb{E}(\mathbb{E}(X| \mathcal{F}_n)| \mathcal{F}_{n-1})$$
$$X_{n-1} = \mathbb{E}(X| \mathcal{F}_{n-1})$$ due to the tower property, because $ \mathcal{F}_{n-1} \subset \mathcal{F}_n$
Is this ok? Didn't I cheat somewhere here?

A: Fix a positive integer $n$. By the martingale property and $L^1$ convergence of $\{X_n\}$ we have for $m\geqslant n$,
$$\mathbb E[|X_n - \mathbb E\left[X\mid \mathcal F_n]|\right] = \mathbb E\left[| \mathbb E[X_m-X\mid \mathcal F_n]|\right]\leqslant \mathbb E\left[|X_m-X|\right]\stackrel{m\to\infty}\longrightarrow 0, $$
so that $$X_n=\mathbb E[X\mid \mathcal F_n]. $$


text:
Q: code removing wrong Nodes I am learning to manipulate Nodes, and am having an issue with one of my test cases and it seems my code is not removing the correct nodes. The code should be removing nodes that contain lowercase Characters, but when the test case expects E I get l returned. Could someone look over my code and test case and explain what is wrong. I cannot use static    variables, arrays or Java collections.
my code
public class ListUppercaseExample {

    public static Node<Character> uppercase(Node<Character> head) {
        if (head == null) {
            return null;
        }
        Node<Character> prev = head;
        Node<Character> start = head;

        while (head != null) {
            if (Character.isLowerCase(head.value)) {
                if (Character.isLowerCase(start.value)) {
                    start = head.next;
                    prev = head.next;
                    head = head.next;
                } else {
                    if(head.next == null){
                        return start;
                    }
                    else{
                        prev.next = head.next;
                        head = head.next;
                    }
                }
            } else {
                head = head.next;
            }
        }

        return start;
    }
}

my node class
public final class Node<T> {
    public final T value;
    public Node<T> next;

    public Node(T _value) {
        this( _value, null );
    }

    public Node(T _value, Node<T> _next) {
        value = _value;
        next  = _next;
    }

    @Override
    public String toString() {
        return "" + value;
    }
}

test case
@Test
public void testDrEvil() {
    @SuppressWarnings("unchecked")
    Node<Character>[] nodes = new Node[] {
        new Node<Character>( 'd' ), // 0
        new Node<Character>( 'R' ), // 1
        new Node<Character>( 'E' ), // 2
        new Node<Character>( 'v' ), // 3
        new Node<Character>( 'I' ), // 4
        new Node<Character>( 'l', null )
    };

    for (int i = 0; i < nodes.length-1; i++) {
        nodes[ i ].next = nodes[ i+1 ];
    }

    // expected: D -> R
    Node<Character> actual = ListUppercaseExample.uppercase(nodes[0]);
    Node<Character> now = actual;
    assertEquals("", nodes[1], now); // R
    assertEquals("", nodes[2], now.next); // E
    now = now.next;
    assertEquals("", nodes[4], now.next); // I
    now = now.next;
    assertEquals("", null, now.next);
}

A: You have two problems:

*

*You are not removing the last value in the list if the last value is lowercase because of this line in your while loop:
if(head.next == null){
    return start;
}

You want to skip over the current value of head if it is lowercase, whether the next value is null or not. So you can just remove that part of the if-statement so your code is like this:
if (Character.isLowerCase(start.value)) {
    start = head.next;
    prev = head.next;
    head = head.next;
} else {
    prev.next = head.next;
    head = head.next;
}

*You are never updating prev. You need to set prev to head when
the character is an uppercase before you change the value of
head. Your else statement if character is uppercase should look
like like this:
} else {
    prev = head;
    head = head.next;
}

Once those changes are made, your while loop should look like:
  while (head != null) {
        if (Character.isLowerCase(head.value)) {
            if (Character.isLowerCase(start.value)) {
                start = head.next;
                prev = head.next;
                head = head.next;
            } else {
                prev.next = head.next;
                head = head.next;
            }
        } else {
            prev = head;
            head = head.next;
        }
    }


text:
Q: Add Auto-Increment ID to existing ascending column? I have a pre-existing table, containing 'fname', 'lname', 'email', 'rgtime' and 'ip'. But now I want an auto-increment column.
I am trying to add ascending values of 'rgid' auto-increment according to ascending values of 'rgtime' registration time
How do I add auto-increment column by by ascending values of 'rgtime'
This makes random auto increment values for id
ALTER TABLE `myTable` ADD COLUMN `id` INT AUTO_INCREMENT UNIQUE FIRST;

But is not what I want.
Any help is appreciated .

A: Create new table of the same structure but with id field. Then run a query
INSERT INTO MyTable2 SELECT NULL, * FROM MyTable ORDER BY rgtime

then check whether everything is OK, then delete MyTable and rename MyTable2 to MyTable


text:
Q: Octave vectorize strsplit return value into separate variables I have a file with a list of records which I parse one line at a time. Each record is newline delimited and each value is space delimited. This is just a simplified example, but it has a similar structure to the real data.
Bob blue pizza
Sally red sushi

The first value is a name, then their favorite color, then their favorite food. Let's say this is in a processing loop and I want to set variables up for each value. For the first line, my values should look like this.
friendsName = "Bob";
favoriteColor = "blue";
favoriteFood = "pizza";

I read in the line and start out with
lineInFile = "Bob blue pizza";

strsplit seems like a good idea, but it outputs a cell array instead of a matrix of strings and I end up with
strsplit(lineInFile, " ") =
{
  [1,1] = Bob
  [1,2] = blue
  [1,3] = pizza
}

I want something like
{friendsName,favoriteColor,favoriteFood} = strsplit(lineInFile, " ");

This gives me error: invalid lvalue function called in expression
Arrays can be used as lvalues, so I tried
cell2mat(strsplit(lineInFile, " "))
ans = Bobbluepizza

That's not what I want.

A: This worked.
 [friendsName favoriteColor favoriteFood] = strsplit(lineInFile, " "){1,:}


text:
Q: How to check if any of the keys are present in any of the values in a dictionary? I have this dictionary:
{
'Bob': ['Paul', 'Mark', 'Carol', 'Leanne', 'Will'],
'Carol': ['Mark', 'Leanne'],
'Farley': ['Paul'],
'Leanne': ['Sarai'],
'Larry': ['Carol', 'Mark', 'Leanne', 'Will'],
'Mark': ['Philip', 'Zach'],
'Paul': ['Zach'],
'Will': ['Leanne', 'Mark'],
'Zach': ['Philip']
}

and need to come up with code to check if any of the keys are present in any of the values. I rgwb need to print any key that does not appear in the any of the values. (Should print Bob, Farley, and Larry.) How would I go about doing this — ideally without using break?

A: returns "the keys that do not appeared in none of the values"
import itertools
all_values = list(itertools.chain.from_iterable(my_dict.values()))
print(*[x for x in my_dict.keys() if x not in all_values],sep=', ')

Hope this helps...

A: Solution 1: Using the set minus operator. See https://docs.python.org/3/tutorial/datastructures.html#sets.
keys = mydict.keys()
for values in mydict.values():
    keys = keys - set(values)
print(keys)

Output: {'Bob', 'Larry', 'Farley'}
Solution 2: Using set.union
keys = mydict.keys()

## convert list of lists to list of sets
values = [set(x) for x in mydict.values()]
values = set.union(*values)
print(keys - values)

Output: {'Bob', 'Larry', 'Farley'}


text:
Q: Como eu posso abrir o postman pelo vba do excel? Gostaria de saber como posso abrir o POSTMAN pelo VBA do EXCEL.
Gostaria de instanciar a aplicação como um objeto porém não sei como fazer.
Exemplo:
Set IE = CreateObject("InternetExplorer.application")
With IE
End with

A: Tenho quase certeza que o Postman não fornece uma interface via ActiveX, pois o CreateObject é isto, uma referencia a um objeto ActiveX, logo é impossivel ter um objeto de algo que não suporta ActiveX.
Note que ActiveX é uma tecnologia Microsoft que era bastante usada no passado, mas hoje é um tanto quanto incomum. Creio que vai conseguir fazer no máximo é usar o SendKeys que creio ser especifico para VBA do Office:

*

*https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2010/gg278655(v=office.14)
Um exemplo da propria documentação com a calculadora do windows:
Dim ReturnValue, I
ReturnValue = Shell("CALC.EXE", 1)    ' Inicia a calculador
AppActivate ReturnValue               ' Ativa a calculadora (janela)
For I = 1 To 100                      ' 100 repetições
    SendKeys I & "{+}", True          ' Envia o numero mais o sinal de soma
Next I
SendKeys "=", True                    ' Obtem o total
SendKeys "%{F4}", True                ' Envia ALT+F4 para fechar a calculadora

Eu não vou formular um exemplo com postman porque creio que vai ser algo complexo de ajustar, já que o postman parece não funcionar muito bem com o TAB (o que seria o essencial para o uso disto), ao menos eu não consegui, mas creio que isto será o mais próximo que irá chegar, segue comandos suportados:

Tecla
Código

BACKSPACE
{BACKSPACE}, {BS} ou {BKSP}

BREAK
{BREAK}

CAPS LOCK
{CAPSLOCK}

DEL ou DELETE
{DELETE} ou {DEL}

END
{END}

ENTER
{ENTER} ou ~

ESC
{ESC}

HELP
{HELP}

HOME
{HOME}

INS ou INSERT
{INSERT} ou {INS}

NUM LOCK
{NUMLOCK}

PAGE DOWN
{PGDN}

PAGE UP
{PGUP}

LEFT ARROW
{LEFT}

RIGHT ARROW
{RIGHT}

UP ARROW
{UP}

DOWN ARROW
{DOWN}

PRINT SCREEN
{PRTSC}

SCROLL LOCK
{SCROLLLOCK}

TAB
{TAB}

F1
{F1}

F2
{F2}

F3
{F3}

F4
{F4}

F5
{F5}

F6
{F6}

F7
{F7}

F8
{F8}

F9
{F9}

F10
{F10}

F11
{F11}

F12
{F12}

F13
{F13}

F14
{F14}

F15
{F15}

F16
{F16}

Para especificar chaves combinadas com qualquer combinação das teclas "SHIFT", "CTRL" e "ALT", anteceda o código da chave com um ou mais dos seguintes códigos:

Tecla
Código

SHIFT
+

CTRL
^

ALT
%

No entanto (eu não posso afirmar porque nunca usei) você pode experimentar usar os próprios recursos do postman que parece que fornecem ambientes de criação de scripts para automatizar tarefas dentro do próprio postman, ao menos foi o que me pareceu com esta esta página: https://www.getpostman.com/postman-features (aonde esta escrito "Scripts and the Postman Sandbox"), creio que seja isto:

*

*https://learning.getpostman.com/docs/postman/scripts/intro_to_scripts/
Agora se tiver uma pergunta especifica, como por exemplo:

como acessar um documento html e pegar uma certa variável para aplicar em uma requisição no postman?

Creio que será uma pergunta diferente e que você estude primeiro a API que lhe indiquei para ver a possibilidade e então se tiver dificuldade formule a pergunta.


text:
Q: Empty result in user_recyclebin table CREATE TABLE t_test (id VARCHAR2(255), name VARCHAR2(255));
DROP TABLE t_test;

When I look the user_recyclebin table by following query,
SELECT * FROM user_recyclebin;

There is no rows selected and I can't flashback the t_test table. Please explain me. Why?

A: From the documentation:

The recycle bin is only available for non-system, locally managed tablespaces.

You are doing this as SYSTEM, which is a really bad idea for a lot of reasons. In this case the default tablespace for SYSTEM is SYSTEM, which may be locally managed but fails the 'non-system' requirement.
But really don't create your own objects as SYSTEM:

The SYSTEM user name is used to create additional tables and views
  that display administrative information, and internal tables and views
  used by various Oracle Database options and tools. Never use the
  SYSTEM schema to store tables of interest to non-administrative users.

Don't use SYS either, or any default accounts. Create your own user and create objects under that schema.


text:
Q: Universal USER in Directorys? I want to write some text to a text file but I need a universal USER at the directory.
E.g. C:/Users/USER/Desktop/test.txt
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<windows.h>
#include<signal.h>
void main() {
    int i,l;
    FILE *fp;
    char text[255];
    char verz[255];
    char username[128];
    DWORD usernamelen;
    if(!GetUserName(username, &usernamelen)) {
        printf("Error %d occured\n", (int)GetLastError());
    }
    strcat(verz,"C:/Users/");
    strcat(verz,username);
    strcat(verz,"/Destktop/test.txt");
    printf("Dein Text: ");
    fgets(text, 255, stdin);
    fp = fopen(verz, "w");
    fprintf(fp, "%s",text);
}

I expect that there is a new file on the Desktop with some text in it.

A: When you're composing your pathname you're doing
strcat(verz,"C:/Users/");
strcat(verz,username);
strcat(verz,"/Destktop/test.txt");

The problem is that verz is not initialized, so the first strcat invokes undefined behaviour because the string is not empty/nul-terminated.
Results may vary, in your case, the filename is not valid and no file is created, but you don't know this since you're not testing the return value of fopen:
fp = fopen(verz, "w");
fprintf(fp, "%s",text);

A quickfix would be:
strcpy(verz,"C:/Users/");

One line with sprintf, faster & clearer:
sprintf(verz,"C:/Users/%s/Desktop/test.txt",username);
fp = fopen(verz, "w");
if (fp!=NULL)
{
     fprintf(fp, "%s",text);
     fclose(fp);  // better close the file
}


text:
Q: MATLAB logicical indexing RAM constraints; workaround? I have an array  I = 6100x6300x72 which is applied to function, and the result Icor contains some negative values I'd like to replace with zeros. Whilst this is much asked question, in my case RAM constraints make the task a little bit harder. Take the example:
I=rand(6100,6300,72); %# example size of I
[x,y,z]=size(I); %# get the dimensions for later reshaping
I=reshape(I,x*y,z); %# reshape to columns
Icor=function(I) %# apply a function to I, result Icor
Icor(Icor < 0)=0; %# Icor has negatives which need removing
Icor=reshape(Icor,x,y,z); %# reshape back to same size as I (original size)

My problem lies in the logical indexing step, Icor(Icor < 0)=0;, which is where my RAM maxes out. Is there a creative way around this? (or forgive me if I'm I've missed something really obvious).

A: I would loop over the last dimension - it is just as efficient as using vectorized logical indices. You must loop over the last dimension, because the first two are stored contiguously in the memory, and hence such access is the most efficient one:
% forgive my lack of memory ;)
I = rand(610,630,72)-0.5;
s = size(I);

% temporary variables for the test
I1 = reshape(I, [], s(3));
I2 = I1;

% method 1
tic;
I1(I1<0) = 0;
toc

% method 2
tic;
for i=1:s(3)
    I2(I2(:,i)<0,i) = 0;
end
toc

isequal(I1, I2)

Elapsed time is 0.321225 seconds.
Elapsed time is 0.282395 seconds.

ans =

 1

As you see, the loop is actually faster, so it is a win-win situation for you.

A: Once you start running out of memory, usually you need to change something pretty major to get your memory use back in line.
However, if you want to specifically find the loop equivalent of your mask call, try the code below:
Fully vectorized call (like you have now)
Icor(Icor < 0)=0;

Per row equivalent (assumed a 2D matrix)
for ix = 1:size(Icor,1)
    Icor(Icor(ix,1)<0,  1) = 0;
end

Per element equivalent
for ix = 1:numel(Icor)
    if iCor(ix) < 0
        iCor(ix) = 0;
    end
end


text:
Q: Why can't delete four white blanks at the beginning from 7 to 10 line? :7,10s/^.\{4}//g

I want to remove  four  white blanks  at the beginning from 7 to 10 line,why i get the strange result?
In my vimrc, set softtabstop=4 .

4 whith blanks was removed only on line7.
From 8 to 10 line ,more than 4 white blanks were removed,why?

A: you can make use of < command.
Depends on your shiftwidth setting, you may try:
:7,10 <

A: Seems there are mixed tabs and whitespaces in your file. If you only want to replace whitespace, say so.
:7,10s/^ \{4}//g

A: The command :7,10s/^.\{4}//g removes the first four characters on each line, which in your case may be tabstop characters or space characters.
More specifically:

*

*In line 7, the leading white space consists of 20 space characters (' ') of which 4 are removed, which results in border:... moving 4 columns to the left.

*In lines 8-10, the leading white space consists of 2 tab stop characters (\t) and 4 space characters. This is because a tab stop character is still up to 8 columns wide (read this techblog for more information about tabs in vim). Now if you remove the first 4 characters, you only have 2 space characters left.
However, to achieve the desired indentation, you can use the indentation commands << and >> (taken from this answer):
In normal mode, place the cursor on the first line you want to indent, then press 4<< where 4 is the number of lines that are affected and << is the command to move one indentation level to the left.


text:
Q: How to run streamripper and mplayer in a split-screen X terminal, via a single script I want to run streamripper in its own X Terminal (window), then split the terminal horizontally, and then run mplayer in the lower half.
This is simple enough to do manually, but getting a script to do it eludes me.

*

*start a new terminal window

*run streamripper http://radio.net:8000 -r 8000

*split the terminal window horizontally

*run mplayer http://localhost:8000 in the bottom panel.

mplayer cannot be allowed to run immediately. It needs to wait for stream data, so a test for this would be better than "wait x seconds" (which is effectively what the manual method does.
If the terminal is significant to this, anything will do, but I currently have installed konsole, gnome-terminal, and terminator (in Ubuntu)

A: Although some terminal programs have support for splitting, you won't be able to access this functionality from the shell which is running in a different layer and doesn't have access to the software displaying it.
What you can do is use a terminal multiplexer such as GNU Screen or tmux that allow you to run multiple shells in "panes" inside a console.
Screen has been around since the dawn of time and works, but lately the project has falled into dis-repair and it's not being well maintained. Tmux is kind of a new player on the scene but the code is very clean and mature, it has a few more features than screen, and it's a good deal easier to learn and configure. Even though I still use screen out of force of habit, I highly recomend you use tmux for this.
You should be able to write a script that launches a tmux session, runs your streamripper code in one pane, waits for a condition, then adds another pane to the same session, displays it as a split screen, then runs mplayer in the new pane.


text:
Q: Joomla2.5.14 Server Side Validation for Login Page I am using Joomla2.5.14 and I want to add some more server side validation like:
a) Please enter your email address. (Outline email address box in red).
b) Your email address is not registered with Us. (Outline email address box in red).
c) Your email address is invalid. (For invalid email address which is different from registered email address - Outline email address box in red).
d) Please enter your password. (Outline password box in red).
e) Your password is incorrect. (Outline password box in red).
in Joomla login page.
For my project I have added "awoelogin" to login with email address.
Can somebody guide me where to apply changes in Joomla files. I want to show error like this style (http://docs.joomla.org/Display_error_messages_and_notices).
Currently I am getting only one error. (Check my attachment)
Thanks

A: Insted of changing Joomla files, can't you try using a component like Chrono Forms?

A: You can make this in components/com_users/controllers/user.php in method
public function login()
{
  if( /*Some Statement*/ )
  {
    $this->setRedirect($link, 'Some Error Text', 'error');
    return;
  }

  /* Here Goes Joomla Code Wich Makes Login */

}


text:
Q: One entity, several models in different bounded contexts with different databases Let's say we have an Order entity that will be modeled in 2 diff. BCs in a e-commerce application.
The first BC is Order Placement. This BC takes care of collecting all orders placed by our customers from our different websites, validates them and populates its corresponding database by Orders with state either Placed or Rejected.
The 2nd BC is Shipment. This allows the employees in the warehouses to mark an Order as Shipped in its database once it leaves the warehouse.
Now since both BCs use different databases which are empty at first, there will be a need to inform the Shipment BC of the orders that were Placed, so that when a scanner wants to Ship an Order it will be there in the Shipment BC.
My initial approach was to create a domain event once an Order is placed in the Order placement BC and have the Shipment BC subscribe to that event and create a corresponding Order entity in its database for every order placed.
However, I can't stop that feeling that I'm duplicating data across different databases.
My second approach is to ask the Order Placement each time an order is being Shipped for an Order entity, but I still need to maintain the state of the Order in case a failure of a failure in the shipment.
Is there a better approach to all this from a DDD POV?

A: Your first approach is perfectly fine in my opinion. You are not duplicating data, because as you already noticed, that data is from another context. Same data in different contexts means different things.

A: As Vernon Vaughn pointed out in his book «Implementing Domain Driven Design»: "A greater degree of autonomy can be achieved when dependent state is already in place in our local system. Some may think of this as a cache of whole dependent objects, but that's not usually the case when using DDD. Instead we create local domain objects translated from the foreign model, maintaining only the minimal amount of state needed by the local model."
So copying data is okay as long as it is the only data other BCs need.
But he also mentions that if you use exact copies, it might be a sign of a modeling problem.


text:
Q: MessageEmbed field values may not be empty everytime I am trying to do like: !help command , if the command doesn't have any aliases, it gives me that error in the console, I tried the following method which if there is no aliases for the specific command, it should return 'None' , here's the code:
            let command = helpArgs[0]

            if(helpArgs[0]){
            if(bot.commands.has(command)) {
                command = bot.commands.get(command)
                const embed = new Discord.MessageEmbed()
                .setTitle(`${command.config.name}`)
                .addField('Name', `${command.config.name}`)
                .addField('Description', `${command.config.description}`)
                .addField('Usage', `${command.config.usage}`)
                .addField('Aliases', `${command.config.aliases !== undefined ? command.config.aliases : 'None'}`)
message.channel.send(embed)

And here is the error:
7:14 GMT+0300 (Eastern European Summer Time)
(node:11744) UnhandledPromiseRejectionWarning: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
    at Function.normalizeField (C:\Users\\OneDrive\Documents\GitHub\Fergus\node_modules\discord.js\src\structures\MessageEmbed.js:425:23)
    at C:\Users\\OneDrive\Documents\GitHub\Fergus\node_modules\discord.js\src\structures\MessageEmbed.js:445:14
    at Array.map (<anonymous>)
    at Function.normalizeFields (C:\Users\\OneDrive\Documents\GitHub\Fergus\node_modules\discord.js\src\structures\MessageEmbed.js:444:8)
    at MessageEmbed.addFields (C:\Users\\OneDrive\Documents\GitHub\Fergus\node_modules\discord.js\src\structures\MessageEmbed.js:259:42)
    at MessageEmbed.addField (C:\Users\\OneDrive\Documents\GitHub\Fergus\node_modules\discord.js\src\structures\MessageEmbed.js:250:17)
    at Object.module.exports.run (C:\Users\\OneDrive\Documents\GitHub\Fergus\commands\Information\help.js:115:18)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11744) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11744) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The error is at .addField('Aliases', ${command.config.aliases !== undefined ? command.config.aliases : 'None'}) , I checked each field.

A: It seems like command.config.aliases is indeed empty, even though it is not undefined. You should modify the check. I do not know what the aliases field contains, so I cannot say what the check should be.

A: I think the error may be, that the method you used in this field causes an error and because of this, the field is empty. To list the aliases in a string you can try the following method.
let aliases = command.config.aliases.toString();
if (aliases == "") {
    aliases = "None";
}

.addField('Aliases', `${aliases}`)

With this method, you create a String from the aliases array of your command config. Then you look if there aren't any aliases. If yes the String is "None". After this, you need to replace your method in the embed with the variable aliases.


text:
Q: Django rest framework, field that is a choice or text Is there a way to create a field which is A text field, but, with choices. that the choices are the field existing objects?
And if the word passed in is not in the existing data, add it?
I've looked across all the internet for a field like this or example of it, either in Django or the rest framework, but could not find one.
My use for it, for example, would be:
class Point(models.Model):
    location_name = models.TextField(verbose_name="Location name",
                                     unique=True,
                                     # This would include the existing names.
                                     choices=,
                                     )
    latitude = models.FloatField(name="GDT1Latitude",
                                 verbose_name="GDT 1 Latitude",
                                 unique=False, max_length=255, blank=False,
                                 help_text="Enter the location's Latitude, first when extracting from Google Maps.",
                                 default=DEFAULT_VALUE)
    longitude = models.FloatField(name="GDT1Longitude",
                                  verbose_name="GDT 1 Longitude",
                                  unique=False, max_length=255, blank=False,
                                  help_text="Enter the location's Longitude, second when extracting from Google Maps.",
                                  default=DEFAULT_VALUE)

So, It could be used when making a post request instead of already typing the latitude, longitude It would be fetched from the exsiting object.

A: At Database level, a field can not be both a "choices"-like and a free text field.
What you actually want is an abstraction on top of a couple of hidden DB fields
class Book(models.Model):
   THEME_CHOICES = (
     ('Horror', 'Horror'),
     ('Romance', 'Romance')
   )
   _theme = models.CharField(choices=THEME_CHOICES, max_length=258, null=True, blank=True)
   _other_theme = models.CharField(max_length=258)

   @property
   def theme(self):
      if self._other_theme:
          return self._other_theme
      else:
          return self._theme

This is just the first "DB-level", but you'll also need to custom '.save()' method, add a setter with @property.setter.
Another option would be to write this abstraction at Form level instead of Model level.

A: It sounds a little like you're looking for the django function get_or_create. Given a model like Point then you can call it like;
obj, created = Point.objects.get_or_create(
    location_name ='Location',
    defaults={'latitude': 1, 'longitude': 2},
)

and it returns an instance obj and a boolean created which indicates if this object is new or pre-existing.
Therefore if you give it an existing location_name it will fetch the existing object for you, however if you give it a new one it will create a new object with that name.

A: Relying on the logic Timothe proposed here I have constructed a kind of workaround
to the problem I presented.
First, the model using the Point model as choices field:

*

*Point has been renamed to KnownLocation.

class Mission(models.Model):
    id = models.UUIDField(primary_key=False, default=uuid.uuid4, editable=False)

    mission_name = models.CharField(name='MissionName',
                                    verbose_name="Mission Name",
                                    max_length=255,
                                    blank=False,
                                    help_text="Enter the mission's name",
                                    unique=True,
                                    primary_key=True
                                    # We want to be able to query missions not let them be confused with other missions.
                                    )

    uav_lat = models.FloatField(name="UavLatitude",
                                verbose_name="UAV Latitude",
                                unique=False, max_length=255, blank=False,
                                help_text="Enter the location's Latitude, first when extracting from Google Maps.",
                                default=DEFAULT_VALUE)

    uav_lon = models.FloatField(name="UavLongitude",
                                verbose_name="UAV Longitude",
                                unique=False, max_length=255, blank=False,
                                help_text="Enter the location's Longitude, second when extracting from Google Maps.",
                                default=DEFAULT_VALUE)

    gdt = models.CharField(verbose_name='Locations',
                           max_length=20)

the gdt field does not inherit directly from the point model, in order for me to do the following:
Here I can't show exactly what I did, but at first, I just added another field called
add_gdt, which is a related field to the knownlocation model.
And as Timothe suggested, if it's none choose the gdt field, if no choice was made
on gdt, than add add_gdt field to the knownlocation db as regular related field.
Serializer:
from Utils.APIConsts.Custom import get_locations, known_locations_data
from django.utils.functional import lazy
from rest_framework.fields import ChoiceField, DictField
from rest_framework.serializers import HyperlinkedModelSerializer

from .models import Mission

class MissionSerializer(HyperlinkedModelSerializer):
    gdt = ChoiceField(choices=lazy(get_locations, tuple)())
    locations = DictField(known_locations_data)

    class Meta:
        model = Mission
        fields = ('Area', 'gdt', 'MissionName', 'UavLatitude', 'UavLongitude', 'UavElevation',
                  'locations')

use gdt here as choices field, using django's lazy to create names corrsepnding to the field of the point model, meaning, the choices field will be composed of the names of the known points in the db.
What is the get_locations being called?
Utils.APIConsts.Custom.py :
def get_locations():
    """
    Returns the names of the locations in KnownLocation model.
    """
    return [loc.Name for loc in KnownLocation.objects.all()]

def get_known_location():

    queryset = KnownLocation.objects.all()
    serialized_data = KnownLocationSerializer(queryset,
                                              many=True)

    locations_data = serialized_data.data
    to_repr_dict = repack(data=locations_data, return_type='dict')
    return to_repr_dict

known_locations_data = get_known_location()

Get the data being from the queryset, serialize it, get the data and created workable dictionary from it, with the following:
def repack(data, return_type=DICT):
    """
    This function receives a list of ordered dictionaries to to unpack and reassign every dict to it's first value.
    data: the data to unpack
    return_type: specify the returned data type; dict or list.
    'dict' is default
    """
    try:
        repacked_dict = {next(iter(d.values())): d for d in data}
        if return_type is DICT:
            return repacked_dict
        elif return_type is LIST:
            repacked_list = list(repacked_dict.items())
            return repacked_list
        raise TypeError('requested return type is not valid.')
    except:
        raise TypeError('data is not a list.')

def return_data_by_name(data, query) -> list:
    """
    This function receive a nested dictionary and matches a given the query to the keys of the dictionary,
    If there's a match, than that match is returned.
    :param dict data:
    :param str query:
    """
    for name, values in data.items():
        if query.lower() in name.lower():
            values = list(values.values())
            return values

Finally, The data being used in the view, using the return by name function to get the data.
gdt = return_data_by_name(data=get_known_location(), query=location_name)