text:
Q: Поиск в массиве одинаковых записей В цикле формируется массив вида:
$d['name'][] = 'вася';
$d['surname'][] = 'васечкин';
$d['id'][] = '1';

Нужно найти повторяющиеся id, и вывести всё это в виде строки:
вася васечкин - число совпадений: n

Где n - кол-во совпадений.
Я применил array_count_values для $d['id'], но как результаты связать с остальными частями массива?

A: Можно извратится как-то так, но я бы на Вашем месте изменил архитектуру хранения данных, чтобы такие задачи было бы более удобно решать.
$id_index = array();
$index = 0;
foreach($d['id'] as $id)
{
    if($id_index[$id])
    {
       $id_index[$id]['count']++;
       $id_index[$id]['index'][] = $index;
    }
    else
    {
       $id_index[$id]["count"] = 1;
       $id_index[$id]["index"][] = $index;
    }
    $index ++;
}

    foreach($id_index as $strings)
    {
       $res_str = "";
       foreach($strings["index"] as $str)
       {
           $res_str .= $d["name"][$str]." ".$d["surname"][$str];
       }
       $res_str .= "(".$strings["count"].")";
       echo $res_str;
    }

A: Я считаю, что вам следует немного упростить текущую структуру хранения данных. Например, вы можете вместо массивов использовать классы. ООП всегда несет лишь "свет" в программный код. Так, вы могли бы написать класс, который бы хранил в своих полях информацию о каждом пользователе, имел бы соответствующие методы. Так было бы проще вам как сейчас, да и в дальнейшем разбирательстве своего кода =)

Если вам это по каким-либо причинам не подходит, то я готов это обсудить.


text:
Q: Oracle query to check for failure more than 90 % I have a situation where I need to write a monitoring query to run every 2 hour to raise alert when processed count becomes less than 90%.
Lets say we have a Table Incoming Message where all incoming messages are captured and another table where all processed messages are captured.
This is what I came up with, this works but I am wondering if there is better way of doing this?
SELECT (CASE WHEN PROCESSEDCOUNT <= INCOMINGCOUNT * .9
THEN 'ALERT:: Process Count ' || PROCESSEDCOUNT || ' is less than 90% of Incoming count ' || INCOMINGCOUNT || '. '
ELSE 'FINE:: Process Count ' || PROCESSEDCOUNT || ' is more than or equal to 90% of Incoming count ' || INCOMINGCOUNT || '. '
END ) as Status
from
(SELECT
(SELECT COUNT(*)
FROM INCOMING_TABLE D WHERE INSERTION_TIME > SYSDATE - (1/12)
AND EXISTS (SELECT * FROM PROCESSED_TABLE C WHERE ( D.MESSAGE_ID = C.MESSAGE_ID)
AND C.PROCESSED_TIME > SYSDATE- (1/12))) AS PROCESSEDCOUNT,
(SELECT COUNT(*) FROM INCOMING_TABLE WHERE INSERTION_TIME > SYSDATE - (1/12)) AS INCOMINGCOUNT
FROM DUAL);

*

*PROCESSED_TABLE used for storing other records as well, that is the
reason I need to use EXISTS to figure out process count.

*I understand as time captured in two tables may not fall into same
time duration. We are not worried about that right now, just want to
make sure majority of records processed.

*We are using oracle 11g, if that helps.

A: You are querying the same data from INCOMING_TABLE twice, which isn't really efficient ;-)
One possibility could be to outer join:
SELECT
   CASE
      WHEN COUNT(C.MESSAGE_ID) <= COUNT(*) * .9
      THEN 'ALERT:: Process Count ' || COUNT(C.MESSAGE_ID) || ' is less than 90% of Incoming count ' || COUNT(*) || '. '
      ELSE 'FINE:: Process Count ' || COUNT(C.MESSAGE_ID) || ' is more than or equal to 90% of Incoming count ' || COUNT(*) || '. '
   END as Status
FROM INCOMING_TABLE D
LEFT OUTER JOIN PROCESSED_TABLE C
      ON C.MESSAGE_ID = D.MESSAGE_ID
     AND C.PROCESSED_TIME > SYSDATE- (1/12)
WHERE D.INSERTION_TIME > SYSDATE - (1/12)
/

That will work if you can be sure either zero or one record exists in PROCESSED_TABLE for each message_id. Maybe you can add a AND C.PROCESS_TYPE = ... or something to make that condition come true.
If you cannot guarantee that a join to PROCESSED_TABLE returns at most one row, you can move your EXISTS to inside a COUNT instead of the WHERE clause and thereby again avoid accessing INCOMING_TABLE twice:
SELECT (CASE WHEN PROCESSEDCOUNT <= INCOMINGCOUNT * .9
THEN 'ALERT:: Process Count ' || PROCESSEDCOUNT || ' is less than 90% of Incoming count ' || INCOMINGCOUNT || '. '
ELSE 'FINE:: Process Count ' || PROCESSEDCOUNT || ' is more than or equal to 90% of Incoming count ' || INCOMINGCOUNT || '. '
END ) as Status
from
(
SELECT COUNT(*) INCOMINGCOUNT
     , COUNT(
          CASE
             WHEN EXISTS (SELECT * FROM PROCESSED_TABLE C
                          WHERE D.MESSAGE_ID = C.MESSAGE_ID
                          AND C.PROCESSED_TIME > SYSDATE- (1/12))
             THEN 1
          END
       ) PROCESSEDCOUNT
FROM INCOMING_TABLE D
WHERE D.INSERTION_TIME > SYSDATE - (1/12)
)
/

(PS. If you are at the start of writing a lot of code to handle a messaging queue, I would also suggest like @DARK_A to look into Advanced Queues instead of building your own. There is a lot of issues you need to handle in a messaging system, so why have that trouble if you can use what Oracle has already built ;-)

redpajama_set_name: RedPajamaStackExchange


text:
Q: TwitterAPI: I have an API key but I have bad authentication with isomorphic unfetch I'm working on a Next.JS app which will retrieve a list of tweets by hashtag (ideally, by hashtag between a start and end date, but one step at a time.)
Sadly, this all errors out. Process.env variables work.
fetch is isomorphic-unfetch. I think the problem is that I'm just not setting the headers correctly - what do you think?
edited for latest tools.
Tasks.getInitialProps = async function() {
  const authString: string = encodeURIComponent(
    [
      "OAuth",
      `oauth_consumer_key="${process.env.TWITTER_API_KEY}",`,
      `oauth_token="${process.env.TWITTER_TOKEN}",`,
      `oauth_nonce="${Math.random().toString}",`,
      `oauth_timestamp="${Date.now()}",`,
      `oauth_signature_method="HMAC-SHA1",`,
      `oauth_version="1.0"`
    ].join(" ")
  );
  try {
    console.log(authString); // looks good.
    const res = await fetch(
      "https://api.twitter.com/1.1/search/tweets.json?q=%23hometasking",
      {
        method: "get",
        headers: {
          authorization: authString
        }
      }
    );
    const data = await res.json();
    console.log(data);
    return {
      entries: { tweets: data }
    };
  } catch (err) {
    console.error(err);
    return { entries: { tweets: err } };
  }
};

Error in the console (server side:)
{ errors: [ { code: 215, message: 'Bad Authentication data.' } ] }


text:
Q: OpenGL program isn't rendering on Ubuntu with VirtualBox I'm starting to learn OpenGL and I decided to use Ubuntu 15.10 on a VirtualBox to do this. I installed the packages mesa-common-dev (gl.h), libglew-dev (glew.h) and libglfw3-dev (glfw3.h) and following this tutorial I came up with this code:
#define GLEW_STATIC

#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>

using namespace std;

const GLchar* vertexSource =
    "#version 130\n"
    "in vec2 position;"
    "void main() {"
    "    gl_Position = vec4(position, 0.0, 1.0);"
    "}";

const GLchar* fragmentSource =
    "#version 130\n"
    "out vec4 outColor;"
    "uniform vec3 triangleColor;"
    "void main() {"
    "    outColor = vec4(triangleColor, 1.0);"
    "}";

int main(int argc, char *argv[]) {
    // GLFW initialization
    if (!glfwInit()) {
        cout << "Failed to initialize GLFW." << endl;
        return -1;

    }
    cout << "GLFW initialized." << endl;

    GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL", nullptr, nullptr);
    glfwMakeContextCurrent(window);
    cout << "Window and context created." << endl;

    // GLEW initialization
    glewExperimental = GL_TRUE;
    if (glewInit() != GLEW_OK) {
        cout << "Failed to initialize GLEW." << endl;
        return -1;

    }
    cout << "GLEW initialized." << endl;

    GLfloat vertices[] = {
         0.0f,  0.5f,
         0.5f, -0.5f,
        -0.5f, -0.5f
    };

    // Create Vertex Array Object
    GLuint vao;
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);
    cout << "VAO created and binded." << endl;

    //Vertex Buffer Object
    GLuint vbo;
    glGenBuffers(1, &vbo);
    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
    cout << "VBO created and binded." << endl;

    // Create and compile the vertex shader
    GLint status;
    GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(vertexShader, 1, &vertexSource, NULL);
    glCompileShader(vertexShader);
    glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &status);

    if (!status) {
        // Vertex shader error handling
        char errorLog[512];
        glGetShaderInfoLog(vertexShader, 512, NULL, errorLog);

        cout << errorLog << endl;
        glfwTerminate();
        return -1;
    }
    cout << "Vertex shader created and compiled." << endl;

    // Create and compile the fragment shader
    GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(fragmentShader, 1, &fragmentSource, NULL);
    glCompileShader(fragmentShader);
    glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &status);

    if (!status) {
        // Fragment shader error handling
        char errorLog[512];
        glGetShaderInfoLog(fragmentShader, 512, NULL, errorLog);

        cout << errorLog << endl;
        glfwTerminate();
        return -1;
    }
    cout << "Fragment shader created and compiled." << endl;

    // Link the vertex and fragment shader into a shader program
    GLuint shaderProgram = glCreateProgram();
    glAttachShader(shaderProgram, vertexShader);
    glAttachShader(shaderProgram, fragmentShader);
    glBindFragDataLocation(shaderProgram, 0, "outColor");
    glLinkProgram(shaderProgram);
    glUseProgram(shaderProgram);
    cout << "Shaders linked." << endl;

    // Specify the layout of the vertex data
    GLint posAttrib = glGetAttribLocation(shaderProgram, "position");
    glEnableVertexAttribArray(posAttrib);
    glVertexAttribPointer(posAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0);
    cout << "Layout of the vertex data specified." << endl;

    while( !glfwWindowShouldClose(window) ) {
        glDrawArrays(GL_TRIANGLES, 0, 3);

        if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
            glfwSetWindowShouldClose(window, GL_TRUE);

        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    // Prepare to close the application
    glDeleteProgram(shaderProgram);
    glDeleteShader(fragmentShader);
    glDeleteShader(vertexShader);
    glDeleteBuffers(1, &vbo);
    glDeleteBuffers(1, &vao);
    glfwTerminate();

    return 0;
}

I'm compiling it as g++ test.cpp -o test -lglfw -lGLEW -lGL with no errors.
But, when I execute the program, it opens the window with a black screen without rendering the triangle. I tried to execute this code that someone posted on the comments of the tutorial but I got the same black screen and no polygons rendered. Is the problem on the code? Did I miss something when setting OpenGL up? Are the compiling parameters correct?

A: Since I didn't declare colors neither for the background nor for the triangle, both of them were black by default. Thus, the triangle was not visible althought it was being rendered. Setting up colors for both of them solved the problem.


text:
Q: Por que no Angular usamos a tipagem ": void"? Por que no Angular usamos a tipagem  : void? Exemplo:
ngAfterViewInit(): void {}

A: void significa algo inexistente. Não é algo específico do Angular e sim do TypeScript, na verdade até na imensa maioria das linguagens de programação de tipagem estática. Por simplificação as linguagens só criam funções, que pressupõem que sempre haverá um resultado e ele será retornado para quem chamou (existe uma ou outra que preferiu separar e criar procedures que não possuem retorno). Então, o que fazer quando a função não retorna um valor, nem mesmo um valor nulo? Convencionou-se usar o void indicando que nada será retornado.
Isto ocorre em funções que na verdade não são bem funções, são procedimentos a serem executados e só. Angular usa em vários casos, você só manda executar e não espera um resultado. O que você esperaria receber em ngAfterViewInit()? Nada, ele só está inicializando algo, fez isso, acaba e não devolve nada.
Você não pode usar essas funções em expressões.


text:
Q: Assembly language msdos source code equation between cluster and FAT Going through old MS dos source code on github, I found some peculiar comments as shown below.
;Now we must load the FAT from the disk. Here's how we
;find out where it starts:

;FAT cluster 0 = media descriptor = 0F0h
;FAT cluster 1 = filler cluster = 0FFh
;Cluster start = ((cluster number) - 2) * SectorsPerCluster
+ (start of user) = (cluster number) + 31

Can anyone explain these?


text:
Q: How do I add "+1" to all cells in a user selected range? I need to have the user select a range of cells with their mouse and then run a macro to add +1 to that selected range. The range will often be different every time, so it cannot be defined.
Here's what I have so far, it just works on a single active cell, I cannot get it to work on a range selection, because I do not know what to define or function to utilize.
My code Follows:
Sub Add()
ActiveCell.Value = ActiveCell.Value + 1
End Sub

A: The below code uses the built-in Paste Special Add feature to add 1 to every cell in the selected range.
Sub AddOneToSelection()

    Dim rBlank As Range

    If TypeName(Selection) = "Range" Then

        'Put a '1' in an unused cell and copy it
        Set rBlank = ActiveSheet.Cells.SpecialCells(xlLastCell).Offset(1, 0)
        rBlank.Value = 1
        rBlank.Copy

        'Paste Special Add over the selection
        Selection.PasteSpecial Paste:=xlPasteValues, _
            Operation:=xlAdd

        'Get rid of the copied cell
        rBlank.ClearContents

    End If

End Sub

The benefit of this over looping is that Paste Special Add treats formulas and values differently and you don't have to code that part yourself.
The downside is you increase your UsedRange by one row, if that matters to you.

A: This should work for you:
Dim r, c As Range
Set r = Selection

For Each c In r
    c.Value = "+1"
Next

This assumes that your cell formats will display "+1" instead of "1".  You can set the format of your cells to "Text".


text:
Q: Why 'git rm' rename file instead remove? I am not an expert using git, so I want to understand why occurred that?.
In my project I had two files (for the ask) main.c and  clase.c that are completely different, regardless of that when I typed git rm main.c for removing that file the status showed me that git didn't delete main.c instead it rename that file.
The final result is ok, but why occurred that?
Thanks for help! If you want to checkup what I'm doing see
my opengl learn path

A: As Useless noted in a comment, Git doesn't actually have file renaming.  Instead, it detects certain cases that look like file renaming, and then reports those as if the file was renamed.
Your image shows the output from git status, with git status claiming that, in the proposed new commit, you have:

*

*modified the .gitignore file

*created a new file named PLANTILLAS/plantilla3D.c

*renamed a file from main.c to clase.c

*modified the notas.txt file

*created a new file named profe.c
You have not in fact done any of that, unless maybe you did.  What Git really knows is that, if you made a new commit right now, using the copies of files that are in Git's index right now, the new commit—whatever its hash ID might be; let's call it commit H, where H stands for hash ID—would differ from the current commit.  The current commit has some other hash ID; let's call this one G, which does not stand for anything (unless we make up something like Gedankenexperiment, perhaps).
Commit G, which already exists and will continue to exist forever,1 has a snapshot: an archive of all files, like a tar or zip archive (though in a very different and rather Gitty format)..  The snapshot that is in commit G now differs from the one in proposed future commit H.
The git diff command, when run and given two commit hash IDs, extracts those commits to somewhere temporary,2 and then compares them.  The two extracted commit archives may have files that have the same names, or not.  Those files with the same names may have the same contents, or not.  The point of doing this diff is to come up with a reasonably minimal set of changes that, if applied to the extracted left-side commit, will produce the extracted right-side commit.
That means that if any file is completely unchanged—has the same name and the same content—Git can just skip right over it, without mentioning it at all.  If the file has the same name but different content, the file is "modified" and Git should figure out what changed, as if playing a game of Spot the Difference.3
Sometimes, however, the left-side commit has a file, foo.txt or main.c or whatever, and that file just isn't there at all in the right-side commit.  Git can claim that this file is Deleted and be done with it.  By the same token, of course, sometimes the left-side commit doesn't have a file, and the right-side commit does have a file, such as clase.c.  Git can claim that this file is newly Added and be done with it.
If Git did only this, and you renamed a file without changing it at all, Git would claim that the file was deleted from the left side, and a differently-named file was added to the right side.  And in fact, if you run git diff --name-status --no-renames, this is exactly what git diff will claim, if you renamed a file.  The recipe—"remove old file, create new one"—works just fine.  It's just not very minimal.
Humans don't like this.  So, when you allow it to do so, git diff—or anything that uses git diff—can check: Hey, here's a file that disappeared from the left.  Here's a file that appeared on the right.  Are the contents exactly 100% identical?  This test is very fast because of the way Git de-duplicates file contents.
So, if you allow this, Git will call this a renamed file, pairing up the left-side name (main.c) and the right-side name (clase.c) and say the file was renamed.  Now there are fewer Deleted files on the left and fewer Added files on the right.
Of course, your clase.c is not simply a renamed copy of main.c, with 100% identical C code contents.  But: maybe you not only renamed the file, but also modified it slightly.  If so, calling it a rename, and showing a diff to the contents, will produce a smaller and more-human-pleasing diff.  So now, having paired up exact-same-content renamed files, Git checks for any and all possible remaining pairing-up operations with a deleted-on-left added-on-right pair.  Since main.c is gone on the left, and clase.c and profe.c and PLANTILLAS/plantilla3D.c are all new on the right, the candidate pairings are:

*

*main.c, clase.c

*main.c, profe.c

*main.c, PLANTILLAS/plantilla3D.c
Git now does a similarity computation on the contents of the possible pairings.  How similar is main.c's content to the content of each of the three files?
This similarity computation is not documented, but I worked through it once (see Trying to understand `git diff` and `git mv` rename detection mechanism).  Its output is a single number expressed as a percentage: any value that is at least 50% is considered a match by default, and the pairing with the highest similarity is taken, removing main.c from the rename detection queues.  Since there are no longer any D-state files on the left to pair with the remaining A-state files on the right, the rename detection phase is now complete: main.c is most similar to clase.c, so Git deems these two to be paired as a rename.
All of this is a result of a diff between existing commit G and hypothetical new commit H.  This diff is run with rename detection turned on and the minimum similarity threshold set at 50%.4  The proposed commit H consists of the files stored in Git's index.  By running git add or git rm, you add, replace, or remove files from Git's index.  This changes the proposed new commit, and git status's rename detector changes its behavior accordingly.

1Well, unless you work pretty hard to get rid of it, or all clones of this repo get destroyed by mistake.  Once a commit exists, every Git that has it "likes to" give it to every other Git that doesn't have it, like some sort of virus.  Hook one Git to another, and the sender will infect the receiver with every commit the sender can.  Careful use of fetch and push refspecs can limit the infections to just those commits you wanted copied over.
2This temporary extraction is limited and done in memory, not on disk, to whatever extent possible.  But except for going a lot faster, it acts like Git checked out each commit to a temporary tree somewhere.
3With --name-only or --name-status, Git can stop as soon as it determines the changed-ness, without having to read the file's content after all.  That makes this go very fast.  The git status command uses this mode as much as possible, so that it's fast.  Rename detection, however, messes with this goal of not bothering to look inside files.
4These are the defaults.  In older versions of Git, these defaults cannot be adjusted; in current Git, status.renames enables overall rename detection, and if that's not set, git status uses the diff.renames setting if that is set.  Note that diff.renames itself wasn't consulted by git status in the past: the default was false before Git 2.9.
There is also a renameLimit value for these, which controls the depth of the rename queue used when matching up files.  The file matching is expensive computationally, except for exact-match detection.  Using the command line option --find-renames=number, you can set the minimum threshold level for considering two similar files "renamed", as well; this option was always available in git diff, but became available in git status in Git 2.18.

A: i think you're wrong about that, the command > git rm file_name delete the file from your staging area as well as your git local repo


text:
Q: Trello API: Get all Cards assigned to a user, on a specific board I'm trying to get all cards in a board assigned to a specific user, but the below returns all the cards in a board.
I did not find this solution anywhere; this is what I tried, and it returns cards assigned to all users:
https://api.trello.com/1/boards/${boardid}/cards?fields=name,shortLink&key=${applicationkey}&token=${userkey}

*

*${boardid} = id of the board I want cards from

*${applicationkey} = Trello Developer API Key

*${userkey} = Trello User Token

Looks like a lot of people were able to do this, but there is no working documentation on this one.

A: I was able to accomplish this (get all cards assigned to me), by using the Trello search API.
Query URL (Cards assigned to a member):

https://api.trello.com/1/search?query=label:green%20member:${memberid}%20board:${boardname}%20sort:edited&card_fields=name,shortLink&cards_limit=100&key=${applicationkey}&token=${userkey}

Query Pattern (regexp to read cards):

"name":"({Description}.+?)","shortLink":"({Id}.+?)"

Parameters used:

*

*${applicationkey} =    Developer API Key

*${userkey} = User Token

*${boardname} = Actual name of the board in Trello

*${memberid} = member id of the Trello user

Get Developer API key and User Token: Click here
Get member id from here:

https://api.trello.com/1/search?query=is:open%20board:${boardname}%20sort:edited&card_fields=name,shortLink,member&cards_limit=100&key=APIKey&token=UserToken


text:
Q: Move gravity forms element into another container What I need: To move the "Donation Amount" div(ID #Donation) into the "Dollar_sign" div(ID #Dollar)
I'm using wordpress and gravity forms; these are both gravity forms elements and I can't manage to append one element to the Donation Div; this would allow me to correctly keep the elements inline on mobile.

A: Apply 'display: inline' to both elements?
Wrap both elements in a div with 'display: inline'?
Do you have access to the raw Wordpress files or are you just working through the Wordpress Dashboard/Back end?
Do you have a paid license to Gravity Forms? I've used their support with success before.


text:
Q: US International Keyboard Layout not behaving as expected? Perhaps my question is related to this one.
I use to use the English US International Keyboard with Alt-Gr Dead Keys (as far as I remember. This layout allowed me to write é by pressing R-Alt+' and then e.
I migrated to EOS Luna and now, no matter what English US International keyboard I may use, R-Alt+' prints ' and to get é I need to press R-Alt+e.
Has the layout changed? Is it a bug in EOS? Or do I need another layout?
Here below are the various layouts under English US available on eOS:

xev, on pressing AltGr+ ' returns:
KeyPress event, serial 29, synthetic NO, window 0x3600001,
    root 0xac, subw 0x0, time 22275171, (752,335), root:(753,407),
    state 0x0, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 92
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 32, synthetic NO, window 0x3600001,
    root 0xac, subw 0x0, time 22275456, (752,335), root:(753,407),
    state 0x80, keycode 48 (keysym 0x27, apostrophe), same_screen YES,
    XLookupString gives 1 bytes: (27) "'"
    XmbLookupString gives 1 bytes: (27) "'"
    XFilterEvent returns: False

KeyRelease event, serial 32, synthetic NO, window 0x3600001,
    root 0xac, subw 0x0, time 22275527, (752,335), root:(753,407),
    state 0x80, keycode 48 (keysym 0x27, apostrophe), same_screen YES,
    XLookupString gives 1 bytes: (27) "'"
    XFilterEvent returns: False

KeyRelease event, serial 32, synthetic NO, window 0x3600001,
    root 0xac, subw 0x0, time 22275566, (752,335), root:(753,407),
    state 0x80, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 92
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

A: The issue is not with the keyboard layout itself, but with the "test your keyboard layout" area which does not use the selected keyboard layout in the layout lists but the globally selected layout in the layout-switcher indicator on the panel.
On the screenshot below, the keyboard layout on the panel shows "en", while the third layout is selected in the settings. The test area applies the layout indicated in the panel. If this layout it switched to the third layout, it will show "en3" instead.


text:
Q: In pig How to concatenate all items in bag ? I have a structure like
 {A, {1,2,3}}
 {B, {4,5,6}}

What I want is
 {A, "1|2|3"}
 {B, "4|5|6"}

*

*I looked at CONCAT operator but that will not help me achieve what I wanted.

A: This is most easily achieved with a Python UDF.
myudfs.py
#!/usr/bin/python

@outputSchema('concated: string')
def concat_bag(BAG):
    return '|'.join([ str(i) for i in BAG ])

It can be used like:
Register 'myudfs.py' using jython as myfuncs;

-- Schema of A is: A:{ T:(letter: chararray, B_of_nums: {num: int}) }

B = FOREACH A GENERATE TOTUPLE(T.letter, myfuncs.concat_bag(T.B_of_nums)) ;

-- The output should be:
-- (A, 1|2|3)
-- (B, 1|2|3)


text:
Q: CKM_CAST5_CBC_PAD on LunaSA I have a LunaSA HSM and i'm trying to unwrap a PKCS#8 formatted private key with a CAST5 secret key? The mechanism to use is CKM_CAST5_CBC_PAD the OID of which is 1.2.840.113533.7.66.10.
Unfortunately when i run the C_UnwrapKey function using the above mechanism with the specified secret key, the HSM returns with CKM_MECHANISM_INVALID which according to PKCS11 means that the mechanism is not supported for the specified cryptographic operation.
How can I unwrap my PKCS#8 private key using CKM_CAST5_CBC_PAD?

A: With CKR_MECHANISM_INVALID your PKCS#11 library is telling you that "An invalid mechanism was specified to the cryptographic operation".
Are you sure that your PKCS#11 library supports CKM_CAST5_CBC_PAD mechanism? You can check by simply calling C_GetMechanismList() and checking whether this mechanism is present in the returned list.


text:
Q: How to find element(s) which are not present in the clearcase recursively? How to find element(s) which are not present in the clearcase recursively , let us say from project root folder i want to know the list of files which are not part of clearcase.
Can some one help me on this?

A: First you need to find them through the command line interface, in a DOS session for instance:
for /F "usebackq delims=" %i in (`cleartool ls -r -nxn ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed"`) do @echo "%i"

(See the discussion on how to find private files in this SO answer)
Then, you can add this command to the ClearCase menu entries from the Windows explorer, follwing the process described in the ten ben scripts article.
See also this SO question and that one for example of menu entries commands (not related to your question, but mentioning a few tip about the commands)

A: If it's a snapshot view, then from the project root use:
cleartool ls -view -r
If it's a dynamic view, then from anywhere use:
cleartool lsp

A: Usually Clearcase plugin (with RSA I am sure it does) gives an option "Find Resources to add to source control"..
This will list all files which are not in ClearCase repository..
Hope this helped.. :-)


text:
Q: Partial SSL in ASP.NET Webforms without changing IIS configuration We have a very simple ASP.NET web application comprising mostly static content and a single form which we want to protect with SSL. The secured page is in its own folder, but it inherits from an unsecured master page, and it shares some other resources (the logo, css file and some pictures) with the rest of the website. The site is hosted by a third-party, and changing the IIS configuration (or changing to a different host) is not an option.
As we understand, there are a few challenges when dealing with partial SSL on ASP.NET:

*

*Preventing the "This page contains both secure and nonsecure items" message.

*Providing support for relative URLs as they won't work by default when redirecting to a secured page.

We don't want to secure the whole site, because of the potential performance issues, so what is the best way to protect only one particular page or folder, guaranteeing at the same time that any resource loaded by this page will be secured as well?

A: I ended up overriding the OnInit method on the page I wanted to secure, using the solution described here:
protected override void OnInit(EventArgs e)
{
    if (!Request.IsSecureConnection && !Request.IsLocal)
    {
        UriBuilder builder = new UriBuilder(Request.Url)
        {
            Scheme = Uri.UriSchemeHttps,
            Port = 443
        };
        Response.Redirect(builder.Uri.ToString());
    }
    base.OnInit(e);
}

For the rest of the pages, I inherited from a base page with the following code on the OnInit method:
protected override void OnInit(EventArgs e)
{
    if (Request.IsSecureConnection)
    {
        UriBuilder builder = new UriBuilder(Request.Url)
        {
            Scheme = Uri.UriSchemeHttp,
            Port = 80
        };
        Response.Redirect(builder.Uri.ToString());
    }
    base.OnInit(e);
}

A: I found the easiest way to do this is by adding code to the specific page that checks if the current request is using HTTPS.  If it isn't, do a redirect to the same URL using HTTPS.  Then, that whole page will load using SSL.  Then, make sure that links or redirects to other pages use absolute HTTP.  In other words, SSL can be enabled but not required for the whole site, and the web site's links will control when it gets used.
One way to make sure that all relative links on the site point to non-HTTPS URLs even if the current page is currently using HTTPS is to use the HTML base tag:

  <base href="http://yourdomain/" />

A: SSL works on site level, not on folder level. Once you install SSL certificate your website could be accessed using https protocol, like so: https://www.example.com. At the same time, your website is still accessible at http://www.example.com - no performance issues.
Images and CSS files will be loaded using https protocol, as long as you use relative paths. Master page never gets requested by client separately so SLL doesn't really apply here.
Use this code to have absolute URL for a link:
<a href='<%= "https://" + Request.Url.Host + Page.ResolveUrl("~/Secure.aspx") %>'>Click me


text:
Q: Python CSV read quoted field with embedded separator I'm trying to parse KiCad schematics. Example text is:
F 0 "J1" H 10100 700 50  0000 R CNN
F 1 "1/8\" SJ1-3544" H 10350 800 50  0000 R CNN
F 2 "dish-components:CUI_SJ1-3544" H 10050 1200 50  0001 C CNN
F 3 "https://www.cui.com/product/resource/sj1-354x.pdf" H 10050 1200 50  0001 C CNN
F 4 "CP1-3544-ND" H 10050 1200 50  0001 C CNN "DigiKey"

I'm trying to parse this with
csv.reader(lines, delimiter=" ", doublequote=False, escapechar='\\', quotechar='"')

For line 1, this returns
['F', '1', '1/8', 'SJ1-3544"', 'H', '10350', '800', '50', '', '0000', 'R', 'CNN']

I'm hoping to receive this:
['F', '1', '1/8" SJ1-3544', 'H', '10350', '800', '50', '', '0000', 'R', 'CNN']

Specifically, the second field breaks up into two: 1/8 and SJ1-3544" instead of 1/8" SJ1-3544. Note the double-quote at the end of SJ1-3544".
What am I missing in my configuration?

A: The escapechar option lets you specify an escape character (backslash in your case) for embedded quotes and delimiters.
https://docs.python.org/2/library/csv.html#csv.Dialect.escapechar


text:
Q: if not exist record checking i am trying to to something like if my database dont have the record, then insert it, the query below is my checking, the code have no errors, so i am not sure did i really make the checking ?
Record 1
IF NOT EXISTS ( SELECT 1 FROM TBL_AUDIT_LOG_TYPE WHERE AUDIT_LOG_TYPE_ID = 1 )
INSERT INTO TBL_AUDIT_LOG_TYPE ([AUDIT_LOG_TYPE_ID],[MODULE],[ACTION])
VALUES (1,'User','UserInfo')

Record 2
IF NOT EXISTS ( SELECT 1 FROM TBL_AUDIT_LOG_TYPE WHERE AUDIT_LOG_TYPE_ID = 2 )
INSERT INTO TBL_AUDIT_LOG_TYPE ([AUDIT_LOG_TYPE_ID],[MODULE],[ACTION])
VALUES (2,'User2','UserInfo2')

A: If all you want is to get some type of return value, use a function or stored procedure and return a value.  E.g.,
IF EXISTS ( SELECT 1 FROM TBL_AUDIT_LOG_TYPE WHERE AUDIT_LOG_TYPE_ID = 1 )
   Return -1
Else
   INSERT INTO TBL_AUDIT_LOG_TYPE ([AUDIT_LOG_TYPE_ID],[MODULE],[ACTION])
   VALUES (1,'User','UserInfo')

IF EXISTS ( SELECT 1 FROM TBL_AUDIT_LOG_TYPE WHERE AUDIT_LOG_TYPE_ID = 2 )
   Return -2
Else
   INSERT INTO TBL_AUDIT_LOG_TYPE ([AUDIT_LOG_TYPE_ID],[MODULE],[ACTION])
   VALUES (2,'User2','UserInfo2')

If using just an adhoc query or the query window in SSMS, create a variable above that or just print the message.  If you use a variable with coded sql queries, you can get the return value back.
Declare @ErrorValues int;
Select @ErrorValues = 0;

IF EXISTS ( SELECT 1 FROM TBL_AUDIT_LOG_TYPE WHERE AUDIT_LOG_TYPE_ID = 1 )
 BEGIN
   Select @ErrorValues = @ErrorValues - 1;
   PRINT '-1';
Else
   INSERT INTO TBL_AUDIT_LOG_TYPE ([AUDIT_LOG_TYPE_ID],[MODULE],[ACTION])
   VALUES (1,'User','UserInfo')

IF EXISTS ( SELECT 1 FROM TBL_AUDIT_LOG_TYPE WHERE AUDIT_LOG_TYPE_ID = 2 )
 BEGIN
   Select @ErrorValues = @ErrorValues - 2;
   Print '-2'; --or PRINT 'audit_log_type_ID of 2 already exists';
 END
Else
   INSERT INTO TBL_AUDIT_LOG_TYPE ([AUDIT_LOG_TYPE_ID],[MODULE],[ACTION])
   VALUES (2,'User2','UserInfo2')


text:
Q: resize div with jquery and move up I want to make dynamic blocks which content may be different, so that height of each div can be different.
I have made a simple jquery height change so each div is getting height of the div which is the tallest.
However when I am doing so the height is added to the bottom, so even when divs are the same height they are not displayed in one line.
Here is an example: https://jsfiddle.net/p30rduon/

$(document).ready(function() {
  var maxHeight = Math.max.apply(null, $("div.pb").map(function() {
    return $(this).height();
  }).get());

  $('div.pb').css('height', maxHeight);
  $('div.pb').css('margin-top', 0);
});
div.pb {
  margin: 0 auto;
  width: 200px;
  height: auto;
  display: inline-block;
  margin-right: 15px;
  margin-bottom: 20px;
  background-color: rgba(54, 25, 25, .1);
  box-shadow: 10px 10px 5px #888888;
}
.img-circle {
  border-radius: 50%;
  width: 120px;
  height: 120px;
  background-color: rgba(255, 255, 255, .5);
  display: block;
  margin-left: auto;
  margin-right: auto;
}
p {
  margin: 0;
  text-align: center;
}
p.firstline {
  font-size: 100%;
  font-weight: bold;
  word-wrap: break-word;
}
p.second {
  font-size: 100%;
  font-weight: bold;
}
p.third {
  font-size: 80%;
}
p.fourth {
  font-size: 70%;
}

Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type

Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type

Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type

Can any one give me a hint what am I missing?

A: use     vertical-align: top; to show div in one line.

$(document).ready(function(){
var maxHeight = Math.max.apply(null, $("div.pb").map(function ()
{
 return $(this).height();
}).get());

$('div.pb').css('height', maxHeight);
$('div.pb').css('margin-top', 0);
});
div.pb {
margin:0 auto;
width: 150px;
height: auto;
display: inline-block;
margin-right: 15px;
margin-bottom: 20px;
background-color: rgba(54, 25, 25, .1);
box-shadow: 10px 10px 5px #888888;
vertical-align: top;
}
.img-circle {
border-radius: 50%;
width: 120px;
height: 120px;
background-color: rgba(255, 255, 255, .5);
display: block;
margin-left: auto;
margin-right: auto;
}
p {
margin: 0;
text-align: center;
}
p.firstline {
 font-size: 100%;
 font-weight: bold;
 word-wrap:break-word;
}
p.second {
 font-size: 100%;
 font-weight: bold;
}
p.third {
 font-size: 80%;
}
p.fourth {
 font-size: 70%;
}

Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type

Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type

Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type

A: Your cards are inline-block and are defaulting to baseline vertical-align - so add vertical-align: top to fix this.
See demo below:

$(document).ready(function() {
  var maxHeight = Math.max.apply(null, $("div.pb").map(function() {
    return $(this).height();
  }).get());

  $('div.pb').css('height', maxHeight);
  $('div.pb').css('margin-top', 0);
});
div.pb {
  margin: 0 auto;
  width: 200px;
  height: auto;
  display: inline-block;
  vertical-align: top;
  margin-right: 15px;
  margin-bottom: 20px;
  background-color: rgba(54, 25, 25, .1);
  box-shadow: 10px 10px 5px #888888;
}
.img-circle {
  border-radius: 50%;
  width: 120px;
  height: 120px;
  background-color: rgba(255, 255, 255, .5);
  display: block;
  margin-left: auto;
  margin-right: auto;
}
p {
  margin: 0;
  text-align: center;
}
p.firstline {
  font-size: 100%;
  font-weight: bold;
  word-wrap: break-word;
}
p.second {
  font-size: 100%;
  font-weight: bold;
}
p.third {
  font-size: 80%;
}
p.fourth {
  font-size: 70%;
}

Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type

Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type

Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type

A: Try set this in your css :
display: table-cell;

instead of :
display: inline-block;

Here is a working fiddle : https://jsfiddle.net/pd7m2otk/

A: use display: inline-flex; in a body tag as per your html
body{
  display: inline-flex;
}

FIDDLE

A: Use this script. I hope this code will be working with your code.
Thank you

$(document).ready(function() {
    //set the starting bigestHeight variable
    var biggestHeight = 0;
    //check each of them
    $('.pb').each(function() {
        //if the height of the current element is
        //bigger then the current biggestHeight value
        if ($(this).height() > biggestHeight) {
            //update the biggestHeight with the
            //height of the current elements
            biggestHeight = $(this).height();
        }
    });
    //when checking for biggestHeight is done set that
    //height to all the elements
    $('.pb').height(biggestHeight);

});
div.pb {
    margin: 0 auto;
    width: 150px;
    height: auto;
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 20px;
    background-color: rgba(54, 25, 25, .1);
    box-shadow: 10px 10px 5px #888888;
    vertical-align: top;
}

.img-circle {
    border-radius: 50%;
    width: 120px;
    height: 120px;
    background-color: rgba(255, 255, 255, .5);
    display: block;
    margin-left: auto;
    margin-right: auto;
}

p {
    margin: 0;
    text-align: center;
}

p.firstline {
    font-size: 100%;
    font-weight: bold;
    word-wrap: break-word;
}

p.second {
    font-size: 100%;
    font-weight: bold;
}

p.third {
    font-size: 80%;
}

p.fourth {
    font-size: 70%;
}

Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type

Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type

Lorem ipsum Lorem ipsum

donejob

2016-12-12

Job Type


text:
Q: Error "HTTP code 405 Method not allowed" when using CURL for a GET request I want to fetch response of a GET request by CURL, but get the Error "HTTP/1.1 405 Method Not Allowed" and no content is returned (except the header).
The following is my code.
$url = "http://api.example.com/Q5PLCmwYzho=/7avEU7ptYyummfheg9!0KA==?aqPI=93566&aqIIO=false&aqIP=false&aqSK=0&aqTK=14&aqSO=date&aqCI=0"
$options = array(
    CURLOPT_URL => $url,
    CURLOPT_HTTPGET => true,        //set request type post or get
    CURLOPT_RETURNTRANSFER => true,     // return web page
    CURLOPT_HEADER => true,
    CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36',
    CURLOPT_HTTPHEADER => array(
     'Accept: application/json, text/javascript, */*; q=0.01',
     'Accept-Encoding: gzip, deflate, sdch',
     //'Content-Type: application/json; charset=utf-8',
     //'Access-Control-Allow-Origin: http://localhost:14189',
     //'Origin: http://www.example.com',
     //'Host: api.example.com',
     //'Access-Control-Allow-Credentials: true',
    ),
    CURLOPT_COOKIE => 'Cookie:scarab.profile=%2293566%7C1465411024%22; scarab.mayAdd=%5B%7B%22i%22%3A%2293566%22%7D%2C%7B%22i%22%3A%22117313%22%7D%5D; _ceg.s=o8gwtw; _ceg.u=o8gwtw; _gat=1; _dc_gtm_UA-13212406-1=1; DK-Client=CWUU,09b6ab76-f662-48b3-a1e6-f08779519236; __auc=764bbe2e155314db7ac1a950571; scarab.visitor=%22566B1DCD74FCD3A5%22; _ga=GA1.2.412464545.1465411024'
);

$ch      = curl_init();
curl_setopt_array( $ch, $options );
$content = curl_exec( $ch );
$err     = curl_errno( $ch );
$errmsg  = curl_error( $ch );
$header  = curl_getinfo( $ch );
curl_close( $ch );
$header['errno']   = $err; //no error!
$header['errmsg']  = $errmsg;
$header['content'] = json_decode($content); // no content!
echo $response['http_code']; //output: 405

I checked the corresponding ajax request in the webpage and every curl options seems to be set correctly. The details (captured from chrome Dev tools) are shown in the image.
 ![1]: http://i.stack.imgur.com/XW8k1.png
What am I missing?? I searched a lot but couldn't solve the problem! I know one of the causes of this error is using an unauthorized request method for curl but the corresponding AJAX call uses GET method and get the result.
What is wrong? Any help would be appreciated.
Update: I wrote an AJAX request to fetch the data in local server (localhost) and got this error : "Cross-Origin Request Blocked". It means that I can't make request to a different domain (api.example.com) from localhost. Are there any workarounds or hack to get the response content from that server?

A: I was getting this error in Postman. In my case it was because I was using GET when I should have used POST. Also I was using GET params instead of POST params. Checking the proper method (specified in my java code) and using the "code" button in postman to display the curl CLI helped me.

A: *

*Try to send User-Agent in your request.

*If page that you requested needs any authorization then you need to send cookies with auth data.


text:
Q: Access asks for entering a value I have created a form to search in person table.
But when I input text for searching and click to the 'Search' Button, it says Enter Parameter Value and so I input my text again and click OK, then it will work.
Here is the code that makes this problem(another_table created from lookup):
Task = "SELECT * FROM person WHERE (item1=(SELECT code_item2 FROM
another_table WHERE name_item2=" & Me.txtSearch.Value & "))"
Me.RecordSource = Task

A: If Me.txtSearch.Value is numeric
SELECT * FROM person WHERE item1 ΙΝ (SELECT code_item2 FROM
another_table WHERE name_item2=" & Me.txtSearch.Value  & ")"

if is alphanumeric then
SELECT * FROM person WHERE item1 ΙΝ (SELECT code_item2 FROM
    another_table WHERE name_item2='" & Me.txtSearch.Value  & "')"

A: Consider saving a permanent SQL in form's recordsource, then simply call .Requery with search parameter change.  Doing so, you reference search text with absolute Forms reference and with NZ, you can set up a default value if search is empty like on form open. No concatenation or quote punctuation needed.
SQL (save as stored query to be used in form recordsource)
SELECT * FROM person
WHERE item1 IN
    (SELECT code_item2 FROM another_table
     WHERE name_item2 = NZ(Form!myFormName!txtSearch, 'Default Value'))

VBA
Me.Form.Requery


text:
Q: meaning of a pretty thing "Nonsense, Grace, get in at once, and don't make all this fuss; a pretty
thing it would be if a man of business had to examine every cab-horse
before he hired it--the man knows his own business of course; there, get
in and hold your tongue!"
The above is from "Black Beauty" by Anna Sewell. (1877)
I think 'a pretty thing' in the above paragraph is a kind of twisted expression
and that's all, but I am not very sure of it. which means just an absurd thing or something.
Am I correct ?

A: Some words can be used ironically, examples are "fine" "grand" and "pretty".

That's another fine mess you've got me into.
  The train's been cancelled. Well that's grand.

"Pretty" is used here in the same way, to mean, ironically, "awkward" or "inconvenient".  It is a rather dated use of English, but Black Beauty is an old book.


text:
Q: How to control row height in lightning:layout I have a lightning:layout with a lightning:layoutItem, containing a lightning:select.
I want the row in the layout to be only the height of the select box but I can't figure out how to remove the space above it.
Here is my component:

    <lightning:layout verticalAlign="start">
        <lightning:layoutItem padding="horizontal-small" size="1">
            <lightning:select
                aura:id="select"
                name="regionFilter"
                value="{!v.filterSelectedValueRegion}"
                onchange="{!c.applyRegionFilter}"
                class="slds-m-bottom_medium"
                >
                <option value="Default">-- Region --</option>
                <option value="All">All</option>
                <aura:iteration var="filterRegionOption" items="{!v.filterOptionsRegion}">
                    <option
                        value="{!filterRegionOption}"
                        text="{!filterRegionOption}"
                        selected="{!filterRegionOption.selected}"
                        />
                </aura:iteration>
            </lightning:select>
        </lightning:layoutItem>
    </lightning:layout>

This is how it renders:

I want to reduce the vertical space between 'Home' and region selector.
This is what the inspector shows:

How do I get rid of that space above and below the region select box?

A: Further to comment from @sfdcfox above I tested some variations.  This is the component:
<aura:component>
<aura:attribute name="Option1" type="String" default="Option 1"/>

<lightning:layout>
    <lightning:layoutItem padding="horizontal-small">
            <lightning:button variant="brand" label="My Button 1"/>
    </lightning:layoutItem>
    <lightning:layoutItem padding="horizontal-small">
            <lightning:button variant="brand" label="My Button 2"/>
    </lightning:layoutItem>
    <lightning:layoutItem padding="horizontal-small">
        <lightning:select
            aura:id="select1"
            name="regionFilter1"
            label="A"
            variant="label-hidden"
        >
            <option value="Option 1">Option 1</option>
            <option value="Option 2">Option 2</option>
        </lightning:select>
    </lightning:layoutItem>
    <lightning:layoutItem padding="horizontal-small">
        <lightning:select
            aura:id="select2"
            name="regionFilter2"
            label="A"
            variant="label-inline"
        >
            <option value="Option 1">Option 1</option>
            <option value="Option 2">Option 2</option>
        </lightning:select>
    </lightning:layoutItem>
    <lightning:layoutItem padding="horizontal-small">
        <select id="sel">
            <option value="{!v.Option1}">{!v.Option1}</option>
            <option value="Option 2">Option 2</option>
        </select>
    </lightning:layoutItem>
</lightning:layout>

and this is the result:

Interestingly, the variant="label-inline" on 'select2' seems to have no effect, but the lightning:select docs state 'Use label-inline to horizontally align the label and input field.'

A: Some padding is inevitable, because of the nature of form elements in SLDS, but you can reduce the space by hiding the label:
<lightning:select variant="label-hidden" ...


text:
Q: Add computed column
This is my table:
with these columns:

ShiftId ShiftNum    Date    ShiftType   StartTime   EndTime
1   1   2014-08-07  A   0:00:00 6:00:00
2   2   2014-08-07  B   6:01:00 18:00:00
3   3   2014-08-07  A   18:00:01    23:59:00
4   1   2014-08-08  A   0:00:00 6:00:00
5   2   2014-08-08  C   6:01:00 18:00:00
6   3   2014-08-08  B   18:00:01    23:59:00
7   1   2014-08-09  B   0:00:00 6:00:00
8   2   2014-08-09  C   6:01:00 18:00:00
9   3   2014-08-09  B   18:00:01    23:59:00
10  1   2014-08-10  B   0:00:00 6:00:00
11  2   2014-08-10  D   6:01:00 18:00:00
12  3   2014-08-10  C   18:00:01    23:59:00
13  1   2014-08-11  C   0:00:00 6:00:00
14  2   2014-08-11  D   6:01:00 18:00:00
15  3   2014-08-11  C   18:00:01    23:59:00
16  1   2014-08-12  C   0:00:00 6:00:00
17  2   2014-08-12  A   6:01:00 18:00:00
18  3   2014-08-12  D   18:00:01    23:59:00
19  1   2014-08-13  D   0:00:00 6:00:00
20  2   2014-08-13  A   6:01:00 18:00:00
21  3   2014-08-13  D   18:00:01    23:59:00
22  1   2014-08-14  D   0:00:00 6:00:00
23  2   2014-08-14  B   6:01:00 18:00:00

I want to add "DailyShiftId" column as computrd column means when  shiftType changed then DailyShiftId has been increased.

ShiftId ShiftNum    Date    ShiftType   StartTime   EndTime DailyShiftId
1   1   2014-08-07  A   0:00:00 6:00:00 1
2   2   2014-08-07  B   6:01:00 18:00:00    2
3   3   2014-08-07  A   18:00:01    23:59:00    3
4   1   2014-08-08  A   0:00:00 6:00:00 3
5   2   2014-08-08  C   6:01:00 18:00:00    4
6   3   2014-08-08  B   18:00:01    23:59:00    5
7   1   2014-08-09  B   0:00:00 6:00:00 5
8   2   2014-08-09  C   6:01:00 18:00:00    6
9   3   2014-08-09  B   18:00:01    23:59:00    7
10  1   2014-08-10  B   0:00:00 6:00:00 7
11  2   2014-08-10  D   6:01:00 18:00:00    8
12  3   2014-08-10  C   18:00:01    23:59:00    9
13  1   2014-08-11  C   0:00:00 6:00:00 9
14  2   2014-08-11  D   6:01:00 18:00:00    10
15  3   2014-08-11  C   18:00:01    23:59:00    11
16  1   2014-08-12  C   0:00:00 6:00:00 11
17  2   2014-08-12  A   6:01:00 18:00:00    12
18  3   2014-08-12  D   18:00:01    23:59:00    13
19  1   2014-08-13  D   0:00:00 6:00:00 13
20  2   2014-08-13  A   6:01:00 18:00:00    14
21  3   2014-08-13  D   18:00:01    23:59:00    15
22  1   2014-08-14  D   0:00:00 6:00:00 15
23  2   2014-08-14  B   6:01:00 18:00:00    16

how can I do it?

A: You can add DailyShiftId as a normal column and add an AFTER UPDATE Trigger on your table:
CREATE TRIGGER TAU_MyTable
ON MyTable
AFTER UPDATE
AS
BEGIN

    UPDATE MyTable SET DailyShiftId = DailyShiftId + 1
    WHERE [INSERTED].ShiftType <> [DELETED].ShiftType

END

OR
You can add a function to the database to calculate value of the new column and use Computed Column Specification as done here:
http://www.c-sharpcorner.com/UploadFile/rohatash/formula-for-computed-column-specification-property-in-sql-se/

A: Create On Update Trigger
CREATE TRIGGER ViewEmployeeTrigger ON Employee
INSTEAD OF UPDATE
AS
BEGIN
SET NOCOUNT ON

UPDATE Employee
SET DailyShiftId=DailyShiftId+1
-- what ever your updation logic
FROM INSERTED I JOIN Employee C ON I.ShiftId= C.ShiftId

END
GO

A: This Query will be helpful to you to get the expected result without using trigger.
  DECLARE @Test Table
(
    ShiftId Integer,
    ShiftNum Int,
    Date DATETIME,
    ShiftType VARCHAR(1)
)

INSERT INTO @Test (ShiftId, ShiftNum, Date, ShiftType)

SELECT 1,   1,   '2014-08-07',  'A'    UNION ALL
SELECT 2,   2,   '2014-08-07',  'B'    UNION ALL
SELECT 3,   3,   '2014-08-07',  'A'    UNION ALL
SELECT 4,   1,   '2014-08-08',  'A'    UNION ALL
SELECT 5,   2,   '2014-08-08',  'C'    UNION ALL
SELECT 6,   3,   '2014-08-08',  'B'    UNION ALL
SELECT 7,   1,   '2014-08-09',  'B'

   SELECT C.ShiftId, C.ShiftNum, C.Date, C.ShiftType ,
        DENSE_RANK() OVER( order by C.DailyShift ASC) AS DailyShift
    FROM
    (
        SELECT A.*,
            CASE WHEN A.ShiftType = B.ShiftType
                Then ROW_NUMBER() OVER(ORDER BY A.ShiftId ASC) - 1
                Else  ROW_NUMBER() OVER(ORDER BY A.ShiftId ASC)
            END AS DailyShift
        FROM @Test AS A LEFT JOIN @Test AS B ON A.ShiftId = B.ShiftId + 1
    ) AS C

Using Computed Column:
Add the column to the table specifing the function (Calculate).
  ALTER TABLE dbo.TableName
    ADD DailyShiftID AS dbo.Calculate(ShiftId, ShiftType)

CREATE FUNCTION dbo.Calculate(@nShiftId INT, @sShiftType VARCHAR(1))
RETURNS INT
AS
  BEGIN
    DECLARE @sPrevShiftType AS VARCHAR(1)
    DECLARE @nDailyShift AS INT

    SELECT @sPrevShiftType =  ShiftType, @nDailyShift =  ISNULL(DailyShiftID, 0)
    FROM TableName WHERE ShiftId = @nShiftId - 1

    IF (@sPrevShiftType <> @sShiftType)
        SET @nDailyShift = @nDailyShift + 1

      RETURN @nDailyShift
  END


text:
Q: I want to create testimonial like below image in html Please help me how to create this type of testimonial in html.

A: You can create it using CSS pseudo elements (:before or :after). I did a quick HTML structure, check this JSFiddle
CSS:
.profile {
  width: 200px;
  height: 200px;
  display: block;
  color: rgba(0, 0, 0, 0);
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
  margin: 80px;
  overflow: hidden;
}

.profile::before {
  content: "";
  position: absolute;
  width: 640px;
  height: 393px;
  top: -100px;
  left: -200px;
  z-index: -1;
  background: url(https://cdn.pixabay.com/photo/2017/06/26/15/00/seascape-2444040_640.jpg);
  -webkit-transform: rotate(-45deg);
  transform: rotate(-45deg);
}

HTML:
<div class="profile">
  <!-- Overlay div content goes here -->
</div>


text:
Q: SVN Python pre-commit hook - how to find out target branch I'm writing a pre-commit hook to make sure commits to specific branches fullfill certain criterias. To do this,  I need to find out the target branch of the commit.
I am using a Windows batch file that calls a Python script. I am using a SVN Python bindings api, which is badly documented. The source code can be found here in the Python zip file: http://sourceforge.net/projects/win32svn/files/1.7.8/apache24/. Just so you know which api I mean.
I found another question about this topic: SVN Pre-commit hook for avoiding commits to specific branches. However, I don't really understand the answer and don't know how I could achieve this with tools I have available and Python.

A: I have a Perl hook that's already written that does exactly what you want.
You specify who can commit where by creating a control file:
[FILE All developers can commit to the trunk]
match=/trunk/**
access=read-write
users=@ALL

[FILE All branches are locked. You do not have access to them]
match=/branches/**
access=read-only
users=@ALL

[FILE Only bob and carol can commit to the 3.2 branch]
match/branches/3.2/**
access=read-write
users=bob,carol

You can also create groups, and use those:
[GROUP branch-committers]
users=bob,carol

[FILE Only the branch-committers can commit to the 3.2 branch]
match/branches/3.2/**
access=read-write
users=@branch-committers

And, if you install Perl's Net::LDAP module on your Subversion server, you can use your Windows Active Directory groups.
Perl is open source and free for Windows from either Strawberry Perl or Active State.


text:
Q: How to use the same column as check and condition in WHERE clause Is it possible to filter the column based on this exactly column in condition? I need to count the number of distinct ids in every range of lifetimes. For example, if lifetime = 10, I need to count all the unique ids in range where lifetime is between 10 and 30.
If I write
SELECT
  lifetime,
  COUNT(DISTINCT id_ru) AS number
FROM lifetime_count
WHERE lifetime BETWEEN lifetime AND 30
GROUP BY 1
ORDER BY 1
LIMIT 15

I get different results if I hardcode the needed lifetime value like this, for example
SELECT
  COUNT(DISTINCT id_ru) AS number
FROM lifetime_count
WHERE lifetime BETWEEN 0 AND 30

SELECT
  COUNT(DISTINCT id_ru) AS number
FROM lifetime_count
WHERE lifetime BETWEEN 1 AND 30

...

A: You can also approach this problem by:

*

*counting for each lifetime the distinct values of id_ru, using the COUNT aggregation function

*computing a running sum over this count, using the window function SUM
WITH cte AS (
    SELECT lifetime,
           COUNT(DISTINCT id_ru) AS cnt
    FROM tab
    GROUP BY lifetime
    ORDER BY lifetime
)
SELECT lifetime,
       SUM(cnt) OVER(ORDER BY lifetime DESC) AS cnt
FROM cte
ORDER BY lifetime

Here's a MySQL demo that can give you the general idea and something to play with, though these constructs can be found in any DBMS.


text:
Q: Can't see view controller content after pushing to table view controller I'm new i iOS and Objective-C world, I want to create an example app to learn something but i find some problems in my program.
I Create a TableViewController with Books names, and after touch a book I want see a some more inforamtion about this book.
So I created book class what is a view controller, i created a some Labels inside this class with some text.
NSLogs works fine. After touch the record, apps pushing to new view controller from table view controller worsk good, but I can't see any content over there instead of white bg and back button at the top.
this is book class:
#import "BooksViewController.h"

@interface BooksViewController ()

@end

@implementation BooksViewController

- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{

    if(self){
        self.title = self.bookName;
        self.view.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    UILabel *bookNameLabel = [[UILabel alloc] init];
    bookNameLabel.text = self.bookName;
    bookNameLabel.frame = CGRectMake(10, 10, 300, 50);
    [self.view addSubview:bookNameLabel];

    UILabel *authorNameLabel = [[UILabel alloc] init];
    authorNameLabel.text = self.authorName;
    authorNameLabel.frame = CGRectMake(50, 50, 300, 40);
    [self.view addSubview:authorNameLabel];

    UILabel *bookDescLabel = [[UILabel alloc] init];
    bookDescLabel.text = self.bookDesc;
    bookDescLabel.frame = CGRectMake(50, 50, 300, 40);
    [self.view addSubview:bookDescLabel];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

this is a methods in table view controller witch I use to create a books inforamtion window:
    - (void)viewDidLoad {
        [super viewDidLoad];

        self.bookNames = @[@"Pan Tadeusz", @"Potop", @"Lalka", @"Uczta dla wron", @"Symfonnia C++"];
        self.authorsName = @[@"Adam Mickiewicz", @"Henryk Sienkiewicz", @"Bolesław Prus", @"George R.R Martin", @"Jerzy Greborz"];
        self.bookDescs = @[@"Opis Pan Tadeusz", @"Opis Potop", @"Opis Lalka", @"Opis Uczta dla wron", @"Opis Symfonnia C++"];

    }

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"Książka na pozycji %ld tapped",indexPath.row);
    BooksViewController *bookVC = [[BooksViewController alloc] init];
    bookVC.bookName = self.bookNames[indexPath.row];
    bookVC.authorName = self.authorsName[indexPath.row];
    bookVC.bookDesc = self.bookDescs[indexPath.row];
    NSLog(@"Nazwa wybranej książki: %@",bookVC.bookName);
    [self.navigationController pushViewController:bookVC animated:YES];

}

A: You're doing this wrong.
First, create an iVar that will save the Indexpath that the user selected, for that, simply add an NSIndexPath variable at the very top of your .m file.
@implementation yourControllerNameHere (){    //In your code you will have your controller name, just add the NSIndexpath ;)

    NSIndexPath *selectedPath;
}

You then need to perform a segue when you select a tableview cell, for that, replace your -didSelectRowAtIndexPath method with this :
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"Książka na pozycji %ld tapped",indexPath.row);
    selectedPath = indexPath;  //We're saving the selected path to our instance variable ! This is very important otherwise we can't find it again.
    [self performSegueWithIdentifier:@"fromBooksToDetail"];

}

and add the -prepareForSegue method in your .m file ; it should be there when you first created it ! just find it and add the following
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if([segue.identifier isEqualToString:@"fromBooksToDetail"]){

     BooksViewController *bookVC =(BooksViewController*)segue.destinationViewController;
     bookVC.bookName    = self.bookNames[selectedPath.row];
     bookVC.authorName  = self.authorsName[selectedPath.row];
     bookVC.bookDesc    = self.bookDescs[selectedPath.row];
     NSLog(@"Nazwa wybranej książki: %@",bookVC.bookName);
   }
}

Now this will NOT work unless you add a segue link between your two viewcontrollers in storyboard, so simply open your storyboard and, using a right clic or a ctrl+left clic, drag your mouse from your TableViewController to your BooksController. Don't forget to give it the right identifier in the Attributes Inspector on the right panel !
Note that I wouldn't have named them like that ; BooksViewController has more sense if it's the TableViewController name, and "BookDetailViewController" for the detail page. But that's just a detail.
Once you have the segue link, the performSegue call and the prepareForSegue method, you'll be all set ;)

A: *

*You need to learn how to debug. Try putting NSLog(@"bookname: %@", self.bookName) in your viewDidLoad and see if you print anything. (Most probably not)

*I'm not 100% sure how the view life cycle works when you use alloc init for a view controller. But my bet is that the properties are not set there. Try moving bookNameLabel.text = self.bookName; to viewWillAppear instead of viewDidLoad

*You should use storyboards instead. It's super easy.

Also, your initWithNibName will never get called. You are using the init-method.


text:
Q: Ubuntu Mate theme has no "Traditional" option after update to Jammy I updated my computer, and now the theme is all screwed up. The panel applets in Mate don't work, the icons are wrong or missing. In Mate-Tweak, the option I would usually choose, "Traditional" is missing. The selections are Gnome, and open suse. I tried searching for missing, libraries, and packages, but nothing makes my desktop look proper.
how to I return to my regular panel appearance?


text:
Q: pivot table in js with rtl lang I'm trying to use some pivot table in Javascript for data in Hebrew.
and I found two that look right for my needs -  Flexmonster and PivotTable.js
they worked fine, except when I tried to use the chart option, it shows me the text in the tags in reverse order.
this is the text label. I tried to add the css attribute:

text {
  direction: rtl!important;
  unicode-bidi: embed!important;
}
<text class="fm-label" dy="0.38em" transform="translate(354, 35.464988708496094) rotate(-60)" style="text-anchor: middle; cursor: auto;">חנויות דרום</text>

A: It seems you need unicode-bidi: bidi-override instead of embed.
text {
  direction: rtl!important;
  unicode-bidi: bidi-override!important;
}


text:
Q: HTTP Status 0 from AngularJS Get for JSON I'm running a $http.get for a JSON and am getting a status of 0. I've downloaded the same JSON and the get works locally, and in Python using the requests library I can get the JSON no problem, but in AngularJS it's not working. What I don't understand is why angular isn't getting it but everything else is. Code snippet below.
function AgentListCtrl($scope, $http) {
  $http.get('http://foo.bar/api/objects').success(function(data) {
  $scope.objects = data;
}).error(function(data, status) {
  $scope.status1 = status;
});

This provides the JSON and parses it when using a local file, but otherwise it fails and sets status1 to 0.

A: Just to make this clear since is not directly stated in the above answer (but in its comments) and, like me, some Angular newbies may be spending some time on this:

*

*Angular's $resource will be able to execute a REST verb on another server, which in turn will respond correctly (with a status 200). Angular will nevertheless fail with a cryptical message, identifyiable by the status 0. It is further misleading since, in a browser's debugger, you may actually see the server's answer.

*Angular will do an OPTIONS request on a cross-domain request (at least for the default query() method) unless specified on the contrary. Usually the server will not answer with the desired content (i.e. your representation). One simple way of doing this per request is specifying the method to be 'GET'.
$resource('http://yourserver/yourentity/:id', {}, {query: {method: 'GET'});

*The server answering your REST requests MUST include the headers specified by CORS [1] in order to allow Angular to consume properly the response. Essentially this means including the Access-Control-Allow-Origin header in your response, specifying the servers from where the request comes from, that are allowed. This value may be *.
Complementing this answer for anyone integrating AngularJS with spring-data-rest-webmvc:

*

*the HATEOAS json formatted response will not be properly consumed by Angular, producing instead the error Expected response to contain an array but got an object. This is solved by adding the isArray: false parameter to the $resouce's configuration;

*a very to-the-point example of configuring CORS for the spring-data-rest-webmvc scenario is presented at [2] (see the SimpleCORSFilter)
[1] https://developer.mozilla.org/en/docs/HTTP/Access_control_CORS
[2] https://spring.io/guides/gs/rest-service-cors/

A: In your code, the status assignment only occurs when the error happens. You should be able to get the status when the call was made successfully like this:
success(function(data, status, headers, config) {
    $scope.objects = data;
    $scope.status1 = status;
}).error(function(data, status) {
    $scope.status1 = status;
});

A: I was having a similar problem myself. A third party API that returns JSON just fine through every other means was failing with status 0 when called through Angular's $http.get() method.
In my case there wasn't any CORS problem. Instead, the URL I was using for the API was not quite right and the server was issuing a 301 response. Angular wasn't respecting the redirect.
Word to the wise.


text:
Q: make a button disable/enable base on java flg in the struts2 Action:
public class TuAction() extends ActionSupport{

    private boolean loseItemFlg=false;

    private String doFuilureOrder(){
        if(...){
           loseItemFlg=true;
        }
        return SUCCESS;
    }

    public boolean isLoseItemFlg() {
        return loseItemFlg;
    }

    public void setLoseItemFlg(boolean loseItemFlg) {
        this.loseItemFlg = loseItemFlg;
    }
}

And my Jsp:
function dialogOpen(formName,actionName){
    if(comfirm("do you want do this?")){
        ....
        document.forms[formName].action=actionName;
        document.forms[formName].submit();
    }else{
        //i want do not reload the page.
    }
}

<input type="button" disable="%{loseItemFlg}" value="lose"
    onclick="dialogOpen('tuAction', '<%request.getContextPath()%>/tuAction_doFuilureOrder.action')"
/>

But this code the button's disable property is not by my control!!
Then i change the jsp to:
<s:submit type="button" disable="%{loseItemFlg}" value="lose"
       onclick="dialogOpen('tuAction', '<%request.getContextPath()%>/tuAction_doFuilureOrder.action')"
/>

Now the button's disable property is by my control,but the "doFuilureOrder()" is not by used.
About do not reload the page should do what in my jsp.
My English is terrible,And this is my first time to use the stackoverflow. Someone know what I means.

A: For the input tag, disabled property is not based on true/false. When u write disabled attribute then the input is disabled by default, Please check Fiddle
<input type ='button' disabled='true' value='Button1'/>
<input type ='button' disabled='false' value='Button2'/>

In above code, both buttons is in disabled state.
For your purpose we can rewrite your code as:
Method 1:
By using struts if tag
<s:if test="%{loseItemFlg}"> // if true - button disabled state
  <input type="button" disabled value="lose" onclick="dialogOpen('tuAction','<%request.getContextPath()%>/tuAction_doFuilureOrder.action')"/>
</s:if><s:else> //button enabled
   <input type="button" value="lose" onclick="dialogOpen('tuAction','<%request.getContextPath()%>/tuAction_doFuilureOrder.action')"/>
</s:else>

Method 2:
Rewrite your java code as,
private String loseItemFlg='';

private String doFuilureOrder(){
    if(...){
       loseItemFlg="disabled";
    }
    return SUCCESS;
}
public String getLoseItemFlg() {
    return loseItemFlg;
}

public void setLoseItemFlg(String loseItemFlg) {
    this.loseItemFlg = loseItemFlg;
}

then in jsp :
 <input type = "button"
<s:property value="%{loseItemFlg}"/> value="lose" onclick = "dialogOpen('tuAction'),'<%request.getContextPath()%>/tuAction_doFuilureOrder.action')" />

A: You can't nest scriptlet in Struts tags (like in your second case), while you can (but you should NOT, because using scriptlets is a bad-practice) inject them in HTML tags.
You can then use the <s:property /> tag in the HTML tag (first case)
<input type = "button"
    disable = "<s:property value="%{loseItemFlg}"/>"
    onclick = "dialogOpen('tuAction'), '<%request.getContextPath()%>/tuAction_doFuilureOrder.action')"
/>

, or substitute the scriptlet in your Struts tag (second case), better using the <s:url /> tag to mount the URL:
<s:url action = "tuAction_doFuilureOrder.action"
    namespace = "/"
          var = "myUrl"
/>
<s:submit type = "button"
       disable = "%{loseItemFlg}"
       onclick = "dialogOpen('tuAction'), '%{myUrl}')"
/>

they both work.
The <s:url /> usage can (and should) be applied to the first case too:
<s:url action = "tuAction_doFuilureOrder.action"
    namespace = "/"
          var = "myUrl"
/>
<input type = "button"
    disable = "<s:property value="%{loseItemFlg}"/>"
    onclick = "dialogOpen('tuAction', '<s:property value="%{#myUrl}"/>')"
/>


text:
Q: wxBufferedDC can get to work hi im using wxWidgets in c++, I have been drawing outside of paint events using wcClientDC which caused flicker. I would like help using wxBufferedDC. I literally just replaced wxClientDC with wxBufferedDC, I taut this would work but the code does not compile due to ghe construtor arguments.
my working code is :
wxClientDC dc (panel2);
replaced with:
wxBufferedDC dc (panel2);
What do I need to do inorder to use wxBufferedDC?

A: To fix flicker, you must avoid drawing from outside your wxEVT_PAINT handler, buffering drawing doesn't help much if you are going to redraw the window soon anyhow. So instead of replacing wxClientDC with wxBufferedDC, get rid of wxClientDC entirely and use wxAutoBufferedPaintDC instead of wxPaintDC.


text:
Q: Posicionar imagem à direita e ao top Com esse código, consigo manter à direita a imagem:

Porem essa imagem fica dentro de uma barra de menu. Eu tenho uma imagem e redimencionei de forma a ter a mesma altura da barra(Heigth). Bem, quando isso acontece, a imagem de posiciona abaixo do top da barra, ou seja, ela fica com uma parte para fora da barra(pra baixo). Procurei alguma outra outra classe que pudesse ser usada jundo com o posicionamento à direita para fixar ela no topo da barra, mas não consegui. Usei essa navbar-fixed-top mas não funcionou. Alguém tem uma idéia em como usar? Uso bootstrap 3, mvc 5.
Toda a minha master está aí
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    @Styles.Render("~/bundles/css")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/Scripts/Util.js")

                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

                    </button>
                    @*@Html.ActionLink("Pedidos", "Index", "Home", null, new { @class = "navbar-brand" })*@

        @RenderBody()

© @DateTime.Now.Year - Laboratórios

    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)

Testei várias coisas e não funcionou. Dei um float e também não. Veja a imagem da tela abaixo.

Pessoal, não conseguir ver onde eu altero a tag . Veja o .css da navbars.less, acho ser esse o .css do layout.
.navbar {
  position: relative;
  min-height: @navbar-height; // Ensure a navbar always shows (e.g., without a .navbar-brand in collapsed mode)
  margin-bottom: @navbar-margin-bottom;
  border: 1px solid transparent;

  // Prevent floats from breaking the navbar
  &:extend(.clearfix all);

  @media (min-width: @grid-float-breakpoint) {
    border-radius: @navbar-border-radius;
  }
}

// Navbar heading
//
// Groups `.navbar-brand` and `.navbar-toggle` into a single component for easy
// styling of responsive aspects.

.navbar-header {
  &:extend(.clearfix all);

  @media (min-width: @grid-float-breakpoint) {
    float: left;
  }
}

// Navbar collapse (body)
//
// Group your navbar content into this for easy collapsing and expanding across
// various device sizes. By default, this content is collapsed when <768px, but
// will expand past that for a horizontal display.
//
// To start (on mobile devices) the navbar links, forms, and buttons are stacked
// vertically and include a `max-height` to overflow in case you have too much
// content for the user's viewport.

.navbar-collapse {
  max-height: @navbar-collapse-max-height;
  overflow-x: visible;
  padding-right: @navbar-padding-horizontal;
  padding-left:  @navbar-padding-horizontal;
  border-top: 1px solid transparent;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
  &:extend(.clearfix all);
  -webkit-overflow-scrolling: touch;

  &.in {
    overflow-y: auto;
  }

  @media (min-width: @grid-float-breakpoint) {
    width: auto;
    border-top: 0;
    box-shadow: none;

    &.collapse {
      display: block !important;
      height: auto !important;
      padding-bottom: 0; // Override default setting
      overflow: visible !important;
    }

    &.in {
      overflow-y: visible;
    }

    // Undo the collapse side padding for navbars with containers to ensure
    // alignment of right-aligned contents.
    .navbar-fixed-top &,
    .navbar-static-top &,
    .navbar-fixed-bottom & {
      padding-left: 0;
      padding-right: 0;
    }
  }
}

// Both navbar header and collapse
//
// When a container is present, change the behavior of the header and collapse.

.container,
.container-fluid {
  > .navbar-header,
  > .navbar-collapse {
    margin-right: -@navbar-padding-horizontal;
    margin-left:  -@navbar-padding-horizontal;

    @media (min-width: @grid-float-breakpoint) {
      margin-right: 0;
      margin-left:  0;
    }
  }
}

//
// Navbar alignment options
//
// Display the navbar across the entirety of the page or fixed it to the top or
// bottom of the page.

// Static top (unfixed, but 100% wide) navbar
.navbar-static-top {
  z-index: @zindex-navbar;
  border-width: 0 0 1px;

  @media (min-width: @grid-float-breakpoint) {
    border-radius: 0;
  }
}

// Fix the top/bottom navbars when screen real estate supports it
.navbar-fixed-top,
.navbar-fixed-bottom {
  position: fixed;
  right: 0;
  left: 0;
  z-index: @zindex-navbar-fixed;

  // Undo the rounded corners
  @media (min-width: @grid-float-breakpoint) {
    border-radius: 0;
  }
}
.navbar-fixed-top {
  top: 0;
  border-width: 0 0 1px;
}
.navbar-fixed-bottom {
  bottom: 0;
  margin-bottom: 0; // override .navbar defaults
  border-width: 1px 0 0;
}

// Brand/project name

.navbar-brand {
  float: left;
  padding: @navbar-padding-vertical @navbar-padding-horizontal;
  font-size: @font-size-large;
  line-height: @line-height-computed;
  height: @navbar-height;

  &:hover,
  &:focus {
    text-decoration: none;
  }

  @media (min-width: @grid-float-breakpoint) {
    .navbar > .container &,
    .navbar > .container-fluid & {
      margin-left: -@navbar-padding-horizontal;
    }
  }
}

// Navbar toggle
//
// Custom button for toggling the `.navbar-collapse`, powered by the collapse
// JavaScript plugin.

.navbar-toggle {
  position: relative;
  float: right;
  margin-right: @navbar-padding-horizontal;
  padding: 9px 10px;
  .navbar-vertical-align(34px);
  background-color: transparent;
  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
  border: 1px solid transparent;
  border-radius: @border-radius-base;

  // We remove the `outline` here, but later compensate by attaching `:hover`
  // styles to `:focus`.
  &:focus {
    outline: none;
  }

  // Bars
  .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 1px;
  }
  .icon-bar + .icon-bar {
    margin-top: 4px;
  }

  @media (min-width: @grid-float-breakpoint) {
    display: none;
  }
}

// Navbar nav links
//
// Builds on top of the `.nav` components with its own modifier class to make
// the nav the full height of the horizontal nav (above 768px).

.navbar-nav {
  margin: (@navbar-padding-vertical / 2) -@navbar-padding-horizontal;

  > li > a {
    padding-top:    10px;
    padding-bottom: 10px;
    line-height: @line-height-computed;
  }

  @media (max-width: @grid-float-breakpoint-max) {
    // Dropdowns get custom display when collapsed
    .open .dropdown-menu {
      position: static;
      float: none;
      width: auto;
      margin-top: 0;
      background-color: transparent;
      border: 0;
      box-shadow: none;
      > li > a,
      .dropdown-header {
        padding: 5px 15px 5px 25px;
      }
      > li > a {
        line-height: @line-height-computed;
        &:hover,
        &:focus {
          background-image: none;
        }
      }
    }
  }

  // Uncollapse the nav
  @media (min-width: @grid-float-breakpoint) {
    float: left;
    margin: 0;

    > li {
      float: left;
      > a {
        padding-top:    @navbar-padding-vertical;
        padding-bottom: @navbar-padding-vertical;
      }
    }

    &.navbar-right:last-child {
      margin-right: -@navbar-padding-horizontal;
    }
  }
}

// Component alignment
//
// Repurpose the pull utilities as their own navbar utilities to avoid specificity
// issues with parents and chaining. Only do this when the navbar is uncollapsed
// though so that navbar contents properly stack and align in mobile.

@media (min-width: @grid-float-breakpoint) {
  .navbar-left  { .pull-left(); }
  .navbar-right { .pull-right(); }
}

// Navbar form
//
// Extension of the `.form-inline` with some extra flavor for optimum display in
// our navbars.

.navbar-form {
  margin-left: -@navbar-padding-horizontal;
  margin-right: -@navbar-padding-horizontal;
  padding: 10px @navbar-padding-horizontal;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
  @shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1);
  .box-shadow(@shadow);

  // Mixin behavior for optimum display
  .form-inline();

  .form-group {
    @media (max-width: @grid-float-breakpoint-max) {
      margin-bottom: 5px;
    }
  }

  // Vertically center in expanded, horizontal navbar
  .navbar-vertical-align(@input-height-base);

  // Undo 100% width for pull classes
  @media (min-width: @grid-float-breakpoint) {
    width: auto;
    border: 0;
    margin-left: 0;
    margin-right: 0;
    padding-top: 0;
    padding-bottom: 0;
    .box-shadow(none);

    // Outdent the form if last child to line up with content down the page
    &.navbar-right:last-child {
      margin-right: -@navbar-padding-horizontal;
    }
  }
}

// Dropdown menus

// Menu position and menu carets
.navbar-nav > li > .dropdown-menu {
  margin-top: 0;
  .border-top-radius(0);
}
// Menu position and menu caret support for dropups via extra dropup class
.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {
  .border-bottom-radius(0);
}

// Buttons in navbars
//
// Vertically center a button within a navbar (when *not* in a form).

.navbar-btn {
  .navbar-vertical-align(@input-height-base);

  &.btn-sm {
    .navbar-vertical-align(@input-height-small);
  }
  &.btn-xs {
    .navbar-vertical-align(22);
  }
}

// Text in navbars
//
// Add a class to make any element properly align itself vertically within the navbars.

.navbar-text {
  .navbar-vertical-align(@line-height-computed);

  @media (min-width: @grid-float-breakpoint) {
    float: left;
    margin-left: @navbar-padding-horizontal;
    margin-right: @navbar-padding-horizontal;

    // Outdent the form if last child to line up with content down the page
    &.navbar-right:last-child {
      margin-right: 0;
    }
  }
}

// Alternate navbars
// --------------------------------------------------

// Default navbar
.navbar-default {
  background-color: @navbar-default-bg;
  border-color: @navbar-default-border;

  .navbar-brand {
    color:@navbar-default-brand-color;
    &:hover,
    &:focus {
      color: @navbar-default-brand-hover-color;
      background-color: @navbar-default-brand-hover-bg;
    }
  }

  .navbar-text {
    color: @navbar-default-color;
  }

  .navbar-nav {
    > li > a {
      color: @navbar-default-link-color;

      &:hover,
      &:focus {
        color: @navbar-default-link-hover-color;
        background-color: @navbar-default-link-hover-bg;
      }
    }
    > .active > a {
      &,
      &:hover,
      &:focus {
        color: @navbar-default-link-active-color;
        background-color: @navbar-default-link-active-bg;
      }
    }
    > .disabled > a {
      &,
      &:hover,
      &:focus {
        color: @navbar-default-link-disabled-color;
        background-color: @navbar-default-link-disabled-bg;
      }
    }
  }

  .navbar-toggle {
    border-color: @navbar-default-toggle-border-color;
    &:hover,
    &:focus {
      background-color: @navbar-default-toggle-hover-bg;
    }
    .icon-bar {
      background-color: @navbar-default-toggle-icon-bar-bg;
    }
  }

  .navbar-collapse,
  .navbar-form {
    border-color: @navbar-default-border;
  }

  // Dropdown menu items
  .navbar-nav {
    // Remove background color from open dropdown
    > .open > a {
      &,
      &:hover,
      &:focus {
        background-color: @navbar-default-link-active-bg;
        color: @navbar-default-link-active-color;
      }
    }

    @media (max-width: @grid-float-breakpoint-max) {
      // Dropdowns get custom display when collapsed
      .open .dropdown-menu {
        > li > a {
          color: @navbar-default-link-color;
          &:hover,
          &:focus {
            color: @navbar-default-link-hover-color;
            background-color: @navbar-default-link-hover-bg;
          }
        }
        > .active > a {
          &,
          &:hover,
          &:focus {
            color: @navbar-default-link-active-color;
            background-color: @navbar-default-link-active-bg;
          }
        }
        > .disabled > a {
          &,
          &:hover,
          &:focus {
            color: @navbar-default-link-disabled-color;
            background-color: @navbar-default-link-disabled-bg;
          }
        }
      }
    }
  }

  // Links in navbars
  //
  // Add a class to ensure links outside the navbar nav are colored correctly.

  .navbar-link {
    color: @navbar-default-link-color;
    &:hover {
      color: @navbar-default-link-hover-color;
    }
  }

}

// Inverse navbar

.navbar-inverse {
  background-color: #c81f61;//@navbar-inverse-bg;
  border-color: #c81f61;//@navbar-inverse-border;

  .navbar-brand {
    color: @navbar-inverse-brand-color;
    &:hover,
    &:focus {
      color: @navbar-inverse-brand-hover-color;
      background-color: @navbar-inverse-brand-hover-bg;
    }
  }

  .navbar-text {
    color: @navbar-inverse-color;
  }

  .navbar-nav {
    > li > a {
      color: @navbar-inverse-link-color;

      &:hover,
      &:focus {
        color: @navbar-inverse-link-hover-color;
        background-color: @navbar-inverse-link-hover-bg;
      }
    }
    > .active > a {
      &,
      &:hover,
      &:focus {
        color: @navbar-inverse-link-active-color;
        background-color: @navbar-inverse-link-active-bg;
      }
    }
    > .disabled > a {
      &,
      &:hover,
      &:focus {
        color: @navbar-inverse-link-disabled-color;
        background-color: @navbar-inverse-link-disabled-bg;
      }
    }
  }

  // Darken the responsive nav toggle
  .navbar-toggle {
    border-color: @navbar-inverse-toggle-border-color;
    &:hover,
    &:focus {
      background-color: @navbar-inverse-toggle-hover-bg;
    }
    .icon-bar {
      background-color: @navbar-inverse-toggle-icon-bar-bg;
    }
  }

  .navbar-collapse,
  .navbar-form {
    border-color: darken(@navbar-inverse-bg, 7%);
  }

  // Dropdowns
  .navbar-nav {
    > .open > a {
      &,
      &:hover,
      &:focus {
        background-color: @navbar-inverse-link-active-bg;
        color: @navbar-inverse-link-active-color;
      }
    }

    @media (max-width: @grid-float-breakpoint-max) {
      // Dropdowns get custom display
      .open .dropdown-menu {
        > .dropdown-header {
          border-color: @navbar-inverse-border;
        }
        .divider {
          background-color: @navbar-inverse-border;
        }
        > li > a {
          color: @navbar-inverse-link-color;
          &:hover,
          &:focus {
            color: @navbar-inverse-link-hover-color;
            background-color: @navbar-inverse-link-hover-bg;
          }
        }
        > .active > a {
          &,
          &:hover,
          &:focus {
            color: @navbar-inverse-link-active-color;
            background-color: @navbar-inverse-link-active-bg;
          }
        }
        > .disabled > a {
          &,
          &:hover,
          &:focus {
            color: @navbar-inverse-link-disabled-color;
            background-color: @navbar-inverse-link-disabled-bg;
          }
        }
      }
    }
  }

  .navbar-link {
    color: @navbar-inverse-link-color;
    &:hover {
      color: @navbar-inverse-link-hover-color;
    }
  }

}

A: Já verificou se o  e a  estão zerados?
a{
padding:0;
margin:0;
}

img{
border:none;
padding:0;
margin:0
}

Em ultimo caso tente colocar o elemento pai da  com position:relative e coloque a  com position:absolute

A: Tenho quase certeza que o bootstrap coloca padding automatico, tanto na imagem quanto no link.
img{
border:none;
padding:0;
margin:0
}

e verifique se as classe:
navbar-brand navbar-right
tbm estão com os padding e margin zerados.
A melhor forma de descobrir o motivo é inspecionar o elemento com o firebug ou Brackets.io

A: Realmente era o brand. Essa é a linha.
.........
.navbar-brand {
  float: left;
  padding: 0;//@navbar-padding-vertical @navbar-padding-horizontal;--
  font-size: @font-size-large;
  line-height: @line-height-computed;
.............


text:
Q: How to access a javascript object from .js file in C# code behind file .aspx.cs file How to access a javascript object from .js file in C# code behind file .aspx.cs file?
var user={name:"john";age:"12"};

I want to access this user object in C# code behind file.

A: There are may ways one is you can pass it in query string. Here is a similar question on SO
Use like
str = $.param({name:"john";age:"12"});

and use this str in parameter.
Save individual value to hidden field and then get it in code behind.


text:
Q: search_path in structure.sql file gets modified by rails db:migrate Everytime I run rake db:migrate on my project the db/structure.sql changes and I'm happy. Unfortunately the changes are not only additions to my table but also something strage in explicitly using our tenant keyword and extensions keyword.
db/structure.sql | 20278 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------
1 file changed, 9565 insertions(+), 10713 deletions(-)

This is part of my interesting diff after I migrate:
-CREATE FUNCTION _final_median_function(anyarray) RETURNS double precision
+CREATE FUNCTION extensions._final_median_function(anyarray) RETURNS double precision

and here is an example for table:
-SET search_path = at, pg_catalog;
-CREATE TABLE advert_all_clicks (
+CREATE TABLE at.advert_all_clicks (

Postgres 9.6.10 (also tested and it happens in 10.+)
Multitenancy is done using apartment
Does anyone has any idea why this is happening? Could't find too much and I'm battling with this for a while.
Edit: In connection to my problem I found this but it applies to postgres < 9.3

A: This is strange but I'm going to respond just in case someone else has the same issue.
If you're on a project that uses db/xx.sql file then if you open it, on very first lines you'll see the versions of pg_dump and postgres which were used to generate this dump.
In order to successfully restore from a dump or have this file db/xx.sql clean while running db:migrate you must have the same exact version installed. It's not working with a different major/minor/release (must be the exact same)
In my case first lines are looking like:
--
-- PostgreSQL database dump
--

-- Dumped from database version 9.6.5
-- Dumped by pg_dump version 9.6.5

I tried installing 9.6.10 (which is current postgresql@9.6) and other different versions. It continue to mess with my file until I compiled exactly 9.6.5 from source.
Couldn't find an explanation for this and I don't see changes in the 9.6.x changelogs.
Soon I'll create a homebrew-tap and have it here as an example.


text:
Q: php saving file to a specific location I am a bit of a dummy when it comes to php. I was wondering how to save a file uploaded to a php script (using POST) to a specific location. So for example i want to save it in the directory www.mysite.co.nz/data/motelname/
Also the android sends pairs of data, so how would i make that data into a file with the first bit of data the file name and the second the .txt file data.
If there are any tutorials on this please comment the here too thanks.

A: check out these:
http://www.htmlgoodies.com/beyond/php/article.php/3472551/PHP-Tutorial-Uploading-Files.htm
http://www.sitepoint.com/handle-file-uploads-php/
you can move the uploaded file to every folder that has 777-rights (do it with "chmod 777 foldername" on the shell) via
move_uploaded_file($tmp_name, "my_directory/$filename");


text:
Q: Primefaces inplace calling method before getting into input mode Is it possible to call a bean method when clicking on the inplace field? In my example I want to click on the outputlabel and call a method before getting to the input mode.
Tried many different things with p:ajax but nothing worked. Using PF 5 and JSF 2.2 on a Wildfly server.
           <p:inplace >
              <f:facet name="output">
                 <p:outputLabel value="#{elm.text}" />
              </f:facet>
              <f:facet name="input">
                 <p:inputText value="#{elm.text}" />
              </f:facet>
           </p:inplace>

A: Try using below code.
<p:outputLabel value="#{elm.text}">
  <p:ajax event="click" listener="#{bean.method}" />
</p:outputLabel>

It worked for me.


text:
Q: Print command result side by side It is possible to print the result of 2 commands side by side...
Something like this
something `ls -l /a` `cat bla.txt`

result:
total 24                                                #while [ 1 = 1 ]; do
-rw-r--r-- 1 wolfy wolfy  194 Aug 13 08:50 c.in         #       echo "bla"
-rwxr-xr-x 1 wolfy wolfy   52 Sep 24 11:48 bla.sh       #done
-rwxr-xr-x 1 wolfy wolfy   38 Sep 24 11:48 bla1.sh      echo "bla"
-rwxr-xr-x 1 wolfy wolfy  147 Sep 24 11:54 ble.sh

I know that pr can do something like this with files, but I didn't find a way to do this for commands...

A: TL;DR
Consider using a combination of paste / column rather than pr to get more consistent results.

*

*Depending on your OS, pr incorrectly mixes in the columns when input lengths differ (Ubuntu, macOS) or even worse will print each input on a completely different pages (Centos 7)

*pr both prepends and appends extraneous output
FORMAT:
paste <(cmd1) <(cmd2) | column -s $'\t' -t

Detailed Explanation
A highly robust solution is possible through a combination of the paste and column commands.
Advantages of the paste / column approach over pr:

*

*Cleaner output due to no timestamp or page header information being prepended, nor a full screen of empty lines appended

*Columns always stay separate even when the input lengths are different
Concrete example:
paste <(ls -1 .) <(ls -1 ..) | column -s $'\t' -t

Real-life output of paste / column technique on Ubuntu 16.04:
jay-z@jaytaylor.com:~/go/src/github.com/jaytaylor/html2text
$ paste <(ls -1 .) <(ls -1 ..) | column -s $'\t' -t
LICENSE            archiveify
README.md          go-hostsfile
html2text.go       html2text
html2text_test.go  jaytaylor
testdata           mockery-example
shipbuilder
stoppableListener
tesseract-web

See also: combine text files column-wise
For Comparison: pr on various platforms
TL;DR: pr behavior is inconsistent across Linux flavors.
Output of pr version on Ubuntu:
jay-z@jaytaylor.com:~/go/src/github.com/jaytaylor/html2text
$ pr -m <(ls -1 .) <(ls -1 ..)

2017-05-25 15:50                    /dev/fd/62                    Page 1

LICENSE                 archiveify
README.md               go-hostsfile
html2text.go                html2text
html2text_test.go           jaytaylor
testdata                mockery-example
                    shipbuilder
                    stoppableListener
                    tesseract-web

Output of pr version on OS X / macOs:
jay-z@jaytaylor.com:~/go/src/github.com/jaytaylor/html2text
$ pr -m <(ls -1 .) <(ls -1 ..)

May 25 08:55 2017  Page 1

LICENSE                 archiveify
README.md               go-hostsfile
html2text.go                html2text
html2text_test.go           jaytaylor
testdata                mockery-example
                    shipbuilder
                    stoppableListener
                    tesseract-web

<... remainder of screen filled with blank lines ...>

Output of pr version on Centos:
(Surprisingly the behaviour of pr under Centos 7 differs from that of all other platforms tested)
jay-z@jaytaylor.com:~/go/src/github.com/jaytaylor/html2text
$ pr <(ls -1 .) <(ls -1 ..)

2017-05-25 15:59                    /dev/fd/63                    Page 1

LICENSE
README.md
html2text.go
html2text_test.go
testdata

<... remainder of screen filled with blank lines ...>

2017-05-25 16:21                    /dev/fd/62                    Page 1

archiveify
go-hostsfile
html2text
jaytaylor
mockery-example
shipbuilder
stoppableListener
tesseract-web

<... remainder of screen filled with blank lines ...>

A: You can use screen like this:
In screen type Ctrl-a | for vertical and Ctrl-a S for horizontal split.

*

*jump to next display region: Ctrl-a Tab

*remove current region: Ctrl-a X

*remove all regions but the current one: Ctrl-a Q
start ls -l /a in the right half and cat bla.txt in the left.

A: You can use process substitution
pr -m <(cmd1) <(cmd2)

though in your case, since you have one command and one file:
ls -l | pr -m - bla.txt


text:
Q: Allow static Large array in Cuda The Gpu I work is a Tesla C2075 with 6gb VRAM. And the OS is Ubuntu 64 bit with cuda toolkit 5.5.
What do I need to do to allow  global __device__ static arrays bigger than 2gb ?
I couldn't find many related topics in Google or here in StackOverflow.

A: I frequently see programs that allocate (dynamically at least) more than 2GB of data. So theoretically allocating a __device__ array statically should be possible. To try and solve this, here are my suggestions:

*

*Update the graphics driver to the latest version (the new driver supports large allocations - up to 6GB - on K20, it should support it on your card as well)

*Update your CUDA toolkit to 6.5 (this may not be necessary but maybe CUDA 6.5 will get along better with the latest driver)

If this does not work, I would try allocating page-locked memory (pinned). Check here for more info. After allocating it, to make it visible on the device you need to map it. This enables DMA transfer and might be an even faster solution. I saw this approach in programs that allocate up to 5GB of device memory - see here.