text:
Q: Line numbers with template toolkit I am using the Perl Template Toolkit to generate C files. I dearly want to be able to include #line directives in my C code so that error messages from the C compiler send me to the right place (the template file) rather than the wrong place (the template output). However, I don't know how to do this.  The only result I got from Google was an unanswered message on the Template Toolkit mailing list.
I can imagine a tortured solution like reading the template file myself and adding line numbers, but does anyone have a trick or even a sensible method of getting the line numbers of the original file in Template Toolkit?

A: Looks to me like Template::Parser's location method returns a suitable #line directive, but there isn't any built in function I see to include that in the output.  You'd have to extend Template Toolkit to make it do so.

A: Since number and "filename" are totally made up (whatever you want) in the #line directive,
I suggest putting #line directives in the template using a slightly different context.
Rather than counting lines in the template yourself, which you could do, even using a template pre-processor. I would 'invent' file names for the different sections of the template and number thos lines with small numbers that you can count.
Then an error message might say "... in line 2 of div id='topleft'"

A: It doesn't look like Template::Toolkit natively supports this. One thing that you could do is make your program also write a mapping of generated lines to their lines in the appropriate template, so that you can look the errors up the errors with a simple script.

A: A brute-force solution:
#!/usr/local/bin/perl
use warnings;
use strict;
my $file = "something.c";
open my $input, "<", $file or die $!;
while (<$input>) {
    print "#line $. \"$file\"\n";
    print;
}
close $input or die $!;

Even better, test for [% on the line and only print #lines where necessary.


text:
Q: 2D Array Confusion (C program) I have a 2D array, lets call it "A1".
A1[rows][cols].

later in my program I create another 2D array called "A2",
A2[new_rows][new_cols]

A2 is bigger than A1... is there any way for me to set A1 the same size & contents of A2?

A: Arrays are static in C, so unfortunately you cannot change the size of an array once you define it. You can, however, achieve what you speak of using dynamically allocated arrays (although, this isn't strictly the same as resizing an array since, when reallocating, you lose the reference to the original array). Start by creating two dynamically allocated arrays A1 and A2 using malloc. Next, use realloc to reallocate A1 to be the same size as A2. Finally, copy the contents of A2 to A1. This will effectively "resize" A1 to be the same size as A2 with the same contents as A2. Here is some sample code (you may use whatever populating method is right for you, I just used filler):
#include <stdio.h>
#include <stdlib.h>

int **make2DArray(int rows, int cols);
void populate2DArray(int **array, int rows, int cols);
void print2DArray(int **array, int rows, int cols);

int main(int argc, char **argv)
{
  int i, j;
  int rows = 2, cols = 3;
  int newRows = 4, newCols = 7;

  // Create two dynamic arrays.
  int **A1 = make2DArray(rows, cols);
  int **A2 = make2DArray(newRows, newCols);

  // Populate the dynamic arrays (however you like).
  populate2DArray(A1, rows, cols);
  populate2DArray(A2, newRows, newCols);

  // Print original arrays.
  printf("A1 (before):\n");
  print2DArray(A1, rows, cols);
  printf("\nA2 (before):\n");
  print2DArray(A2, newRows, newCols);

  // Reallocate A1 to be same size as A2.
  int **temp = realloc(A1, sizeof(int *) * newRows);
  if (temp)
  {
    A1 = temp;
    int *tempRow;
    for (i = 0; i < newRows; i++)
    {
      tempRow = realloc(A1[i], sizeof(int) * newCols);
      if (tempRow)
      {
        A1[i] = tempRow;
      }
    }
  }

  // Copy contents of A2 to A1.
  for (i = 0; i < newRows; i++)
  {
    for (j = 0; j < newCols; j++)
    {
      A1[i][j] = A2[i][j];
    }
  }

  // Print resized A1 (should be same as A2).
  printf("\nA1 (after):\n");
  print2DArray(A1, newRows, newCols);
  printf("\nA2 (after):\n");
  print2DArray(A2, newRows, newCols);
}

int **make2DArray(int rows, int cols) {
  // Dynamically allocate a 2D array.
  int **array = malloc(sizeof(int *) * rows);
  if (array)
  {
    for (int i = 0; i < rows; i++)
    {
      array[i] = malloc(sizeof(int) * cols);
    }
  }

  return array;
}

void populate2DArray(int **array, int rows, int cols) {
  // Populate a 2D array (whatever is appropriate).
  int i, j;
  for (i = 0; i < rows; i++)
  {
    for (j = 0; j < cols; j++)
    {
      array[i][j] = i + j;
    }
  }
}

void print2DArray(int **array, int rows, int cols)
{
  // Print a 2D array to the terminal.
  int i, j;
  for (i = 0; i < rows; i++)
  {
    for (j = 0; j < cols; j++)
    {
      printf("%d ", array[i][j]);
    }
    printf("\n");
  }
}

The output to the following code will be:
A1 (before):
0 1 2
1 2 3

A2 (before):
0 1 2 3 4 5 6
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9

A1 (after):
0 1 2 3 4 5 6
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9

A2 (after):
0 1 2 3 4 5 6
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9

redpajama_set_name: RedPajamaStackExchange


text:
Q: Kotlin/Native Basic Image manipulation Does Kotlin/Native  support any image-processing libraries?
(I'm targeting Windows & Linux)
I failed to find anything on google that doesn't target JVM/Android, but I am new to the Kotlin ecosystem so the answer might be right under my nose.
I'm looking for basic manipulations:

*

*open/save image(jpg, png)

*resize

*extract crop

If there aren't any, should I try to create bindings for C Image processing library like  stb-image or opencv?

A: There is a korim library, that might help you. Also, there are several places you can find more info on Kotlin/Native libraries, like here and here.  The option with C library seems also like a good idea. If you'll got some problems with it, feel free to ask here on in Kotlin Slack (get an invite here).


text:
Q: MS Access changing reference path to a no longer existing path When I compile a MS Access 2003 app on Windows 7 SP1 64bit and launch it in Windows 7 SP1 32bit the Microsoft Common Dialog Control 6.0 (SP3) path changes from C:\Windows\SysWOW64\comdlg32.ocx to \\shared\access\comdlg32.ocx which is the shared drive the app launches from for Windows 7 SP1 32bit users.
I need the reference on 32bit machines to be:  C:\Windows\System32\comdlg32.ocx
The 32bit machine errorors out on : Dim Cnxn As ADODB.Connection
    Set Cnxn = New ADODB.Connection But when the Common Dialog Control is referenced correctly by downloading the app to the 32bit machine, browsing for the comdlg32 file, adding it as a reference, and recompiling, the app works fine on the 32bit pc.
What does the Common Dialog Control have to do with ADODB?
I don't think I use the Microsoft Common Dialog Control anywhere. I will do more testing...

A: If u use it for a filedialog remove the reference and replace it with the solution in this article:
http://access.mvps.org/access/api/api0001.htm
EDIT: This should also work in newer version because it's just a way to get around using the comdlg32.ocx control.
You get the ADODB error because that is another reference, when the comdlg32.ocx fails to load Access exits the loop of loading the references, so the ADODB component isn't loaded.
Another option you could try is remove the reference and using late binding for example
Dim fDialog As Object ' previous Office.FileDialog
Set fDialog = CreateObject("Office.FileDialog")

A: The reference has nothing to do with ADODB.
The test to see if you are using it is simple: remove the reference.  If the project fails to compile, then the reference was in use.
If you are not using the reference, remove it, and your problem is solved.  If you are using the reference, you can replace its functionality with Windows API calls, as Arnoldiusss suggested.


text:
Q: Joda DateTime parsing full date name import org.joda.time._
import org.joda.time.format._

val pattern = "MMM d HH:mm:ss Z yyyy"
val input = "Apr 10 18:31:45 +0000 2015"
DateTime.parse(input, DateTimeFormat.forPattern(pattern))

anyone can tell me why it doesnt work ?
I get :
DateTime.parse(input, DateTimeFormat.forPattern(pattern))
java.lang.IllegalArgumentException: Invalid format: "Apr 10 18:31:45 +0000 2015"
  at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:899)
  at org.joda.time.DateTime.parse(DateTime.java:160)
  ... 43 elided

A: val pattern = "MMM d HH:mm:ss Z yyyy"
val input = "Apr 10 18:31:45 +0000 2015"

val format = DateTimeFormat.forPattern(pattern).withLocale(Locale.ENGLISH)
format.parseDateTime(input)

I found out nvm ;)


text:
Q: GUI crashes after uninstalling KDE Plama So I'm was using Ubuntu but I wanted to give KDE Plasma a try. I heard switching between desktop envirnments was pretty seamless. However, I found that I didn't really like it, so I tried removing it. I used the following commands:
sudo apt remove KDE-plasma-desktop
sudo apt autoremove KDE-plasma-desktop

However, when I rebooted, I boot to a black screen with just /dev/sad1: clean, etc(which I assume is ubuntu without the GUI, so just the terminal). From here, I found a temporary solution to use the following command:
sudo systemctl restart gdm

Which restarts the GUI and logs me in as a console user I think? But I don't know how to fix the issue permanently. Does anyone know what I foolishly deleted to cause this?
EDIT: So I found out what was wrong. It was specifically not working because removing KDE must have corrupted the gnome display manager, GDM3. I actually tried reinstalling it earlier but the didn't do anything, so I assumed it wasn't the culprit. However, when I tried installing lightdm it worked. So when I clean reinstalled the GDM3 it fixed it. I appreciate all the responses!

A: Edit: with more info, it seems like SDDM was the problem.
SDDM (default KDE login manager) is trying to load KDE and failing. You might need to disable / uninstall SDDM.
sudo systemctl disable sddm
# or
sudo apt remove sddm

Leaving the original answer in case it helps others:
If running sudo systemctl restart gdm works, that means you still have gdm/Gnome installed, and they are just not automatically running at boot time. You can enable them so they run on boot with this systemctl command:
sudo systemctl enable --now gdm
next time you log in. That will enable gdm so it always starts on boot, and start it immediately (--now flag).

A: For me, what works is:

*

*Booting into recovery mode using Esc during startup.

*Logging in to my account using my username then password

*sudo apt remove lightdm

*sudo apt install lightdm, after that selecting lightdm in the menu showed.

*Reboot

What I think, somehow lightdm got corrupted or may not be set, as a DM.
Therefore, uninstalling and installing it again works for me.

A: If you're seeing this it means that you have tried to install KDE or any other desktop environment and didn't like it and tried to switch back to genome or you have messed with your desktop environment.
Don't worry I will help you out.
Steps:

*

*Reboot your pc either by running sudo reboot or by manually pressing on power button.

*Durning boot please select Ubuntu advanced options.

*Now scroll down by pressing the down arrow from your keyboard and select recovery mode.

*Once you're in recovery menu scroll down by pressing the down arrow from your keyboard and select dpkg repair broken packages and hit enter.

*It will ask for to press Y. Just do it and wait until it tells you to press enter and then press enter.

*Now scroll down to grub. Update gurb boot loader and press enter and Y if it asks you and then wait until it fixes the grub and then hit enter if it asks you do it.
(for your clarity we have fixed packages and grub by following the above steps)

*Now you need to scroll up to resume resume normal boot and hit enter. it will take you to a terminal and it will ask you to login.

*So login with your username and password.

*Now enter these commands carefully and slowly.

*sudo apt update && sudo apt upgrade -f  --> to update all packages.
sudo apt-get install lightdm  --> to install light dm. This file may have gotten corrupted which is causing the issues. So we are fixing it first.
If it shows a menu to choose GDN and lightdm please choose lightdm and hit enter.

*sudo apt-get install gdm3
If it shows a menu to choose GDM and lightdm please choose gdm and hit enter.

*sudo dpkg-reconfigure lightdm
If it show a menu to choose gdm and lightdm please choose gdm and hit enter.

*sudo systemctl stop lightdm  --> we are stop lightdm so that our boot loader can't use it.

*sudo systemctl start gdm3 --> we are trying to start gdm3 so that our boot loader can use it.

*sudo dpkg-reconfigure gdm3 --> choose gdm and  hit enter

*sudo service lightdm stop --> trying to stop all the services so that it can't be used by the boot loader.

*sudo service gdm3 start  or sudo service gdm start  --> it will start the services of gdm3 for boot loader.

*sudo reboot

*After rebooting please choose ubuntu and hit enter and wait it will start genome3.
you can verify it by seeing the login page where it will use the username at the center of the screen.
if your seeing username or login at the left bottom of the screen then it means your using lightdm not genome. please stop it by using the above commands.


text:
Q: How to set text for TextField in SwiftUI on button click I want to set text for Textfield in SwiftUI on button clicked. I tried using @State variable but its giving error

A: Try Below code (tested in Xcode: 11.2.1)
struct ContentView: View {

   @State var name: String = ""
   var body: some View {

       VStack {
           TextField("Please enter", text: $name)
           Button(action: {
               self.name = "Hello text"
           }) {
               Text("Press")
           }
       }
   }
}

A: You can create the action of button-like bellow
@State var name: String = "My Name is jack"

   var body: some View {

       VStack {
           TextField("Name:", text: $name)
           Button(action: {
               self.name = "My Name is Tim"
           }) {
               Text("Change Name")
           }
       }
   }


text:
Q: Apple Push Notification locking iPhone 4s screen I have an app that used to accept push notifications without any issues but since I upgraded to a 4s, I'm noticing that sending a push while the app is not in the foreground locks my screen.  The moment I send the push, my phone's screen goes blank with a spinner and then the lock screen keyboard comes up.  Anybody have any idea why this is happening?  My friend who has a iphone 4 on ios4 seems to be getting the pushes fine.   This seems like a something that should not even be possible because it could be abused by rogue app developers

A: I just ran into this myself.  This is what a normal alert looks like:
{
     "aps" : { "alert" : "This is the alert text", "badge" : 1, "sound" : "default" }
}

I was sending "sound":"" and got the exact same bug you were getting.  If you do not want to send a sound with your message, don't send the sound bit at all.
bad:
    {
         "aps" : { "alert" : "This is the alert text", "badge" : 1, "sound" : "" }
    }
good:
    {
         "aps" : { "alert" : "This is the alert text", "badge" : 1 }
    }


text:
Q: Resetting SSH Settings to 'factory default' This issue is for OS Monterey 12.1
I am trying to set up a kerberos token to connect to a server but it running into the following error:
debug1: Next authentication method: gssapi-with-mic
debug1:  Miscellaneous failure (see text)
no credential for A02C7B68-989D-4E30-9452-645B3272C709

debug1:  An invalid name was supplied
unknown mech-code 0 for mech 1 2 752 43 14 2

debug1:  Miscellaneous failure (see text)
unknown mech-code 0 for mech 1 3 6 1 5 5 14

debug1:  Miscellaneous failure (see text)
unknown mech-code 2 for mech 1 3 6 1 4 1 311 2 2 10

debug1:  An unsupported mechanism was requested
unknown mech-code 0 for mech 1 3 5 1 5 2 7

debug1:  Miscellaneous failure (see text)
unknown mech-code 0 for mech 1 3 6 1 5 2 5

after I run
kinit -f myname@realm
ssh myname@host

with my ~/.ssh/config being
Host myhost
  HostName myhost
  User myname
  GSSAPIAuthentication yes
  GSSAPIDelegateCredentials yes

However, the same exact setup works on a fresh mac running same OS version (luckily I had a friend with one). This makes me think my issue has to do with some SSH setting being changed while I installed other software from third-party. Is there a way I can reset all my SSH settings/binaries to whatever the 'factory default' is?


text:
Q: eval an input string on button press in react I want to create a web-app coding game with react that involves evaluating some user (javascript) input.
  constructor(props) {
    super(props);
    this.state = {
      code: ''
    };
  }

  handleChange(key) {
    return event => this.setState({ [key]: event.target.value });
  }

  funScript() {
    eval(this.state.code);
  }

  anotherScript() {
    console.log("Will this work?");
  }

  render() {
    return (
      <div>
        <input
          type={"text"}
          value={this.state.code}
          onChange={this.handleChange('code')}
         />
        <button onClick={this.funScript()} >run</button>
      </div>
    );
  }

I was hoping that the text input would be able to evaluate javascript on button press by the user (the user types in this.anotherScript(); and the console logs "Will this work?". Unfortunately, it doesn't work and I suspect its an issue specific to React. As soon as the input box is typed in, it tries to evaluate the string (without the button even being pressed!). See here for an example: https://codesandbox.io/s/54rkp584ll
Anyone have a proper React solution that doesn't break javascript on the first character input (and evaluates the function)?

A: When you type
<button onClick={this.funScript()} >run</button>

You are calling this.funScript. Remove the parens and you'll just pass the function like you want. Also, funScript needs to be bound to this for it to work.

A: Here you have funScript, which evaluates your code with proper context:
class Test {

    // ...

    funScript() {
        const code = ("" + this.state.code).replace(/this/ig, "__self__");
        const execute = new Function("__self__", code);
        execute(this);
    }

    // ...
}


text:
Q: How to make dynamic user controls play nice with the designer I have a dynamic user control that instantiates various bars and labels dynamically based on the number of members in a object group. This functionality works out very well, but the issue is that I am not the only developer on this project. I am new to the team and the "senior" members want all of the components to work in the designer. Since the components of the user control are generated at run time I am not sure how to go about making some/any of them show up in design view. Is this even an option?

A: I don't think that's possible, because there is no markup for the designer to show. I find it hard to believe that they would expect dynamically created controls to show in the designer.
EDIT
Thinking about it some more, why don't you just add a few hard-coded instances of the control in the markup, with the ability to add/remove. That way, the control is displayed in the designer, but you can still add/remove instances. That would probably be the best compromise in this case.

A: Why not give both the possibility of defining the number of dynamic controls at design time, and at run time?

*

*In your custom control class, you can define a property that specifies the number of controls. Implement adding/removing controls in the set{} method of this property.

*Make your property a "designer property". See http://msdn.microsoft.com/en-us/library/a19191fh.aspx
Keep in mind that the designer actually creates an instance of your class. Also, when a user changes your "property" in the designer, the set{} method is invoked.
I hope this helps


text:
Q: This in eventHandler equals window type , not element I decided to change onclick events to event listener and got a problem.
Case a works, and Case b doesn't. Debugger shows that this equals window type, not element
  testName.setAttribute("onclick", "toggleTestsWindow(this)");

  // b
  testName.addEventListener("click", () => toggleTestsWindow(this));

A: This is how I usually write event listeners:

// Identifies the HTML element
const mySpan = document.getElementById("mySpan");

// Calls `changeColor` whenever `mySpan` receives a click event
mySpan.addEventListener("click", changeColor);

// Defines `changeColor`
function changeColor(event){
  // The listener can automatically have access to the triggering event
  //   (We call it 'event' for our own convenience)

  // The event's `target` property gives us the element where
  //   the event occurred
  const targ = event.target;

  // Makes some visible change to the DOM
  if(targ.classList.contains("blue")){
    targ.classList.remove("blue");
  }
  else{
    targ.classList.add("blue");
  }
}
.blue { background-color: lightSkyBlue; }
CLICK ME


text:
Q: Automatically increase number everyday / Swift I coded a SwiftUI App, and the User can choose how much days are left. For example he choose 20 days, it should count in a Circle. For example 10 days are done, the circle should be at 50%.
So I thought I create a Int that is everyday increasing by one. When the user choose 20 days, the Int should start to increase and after 10 days for example the Int is at 10 and because the user choose 20 days, the circle should be at 50%.
Days / Int(that is increasing)
But I dont know how to code the Int that is increasing everyday.
Could anyone help me?

A: Adding to the suggestion of storing the start date and using today's date to know how many days have passed, you can use this extension
extension Date {
    func daysSinceDate(_ fromDate: Date = Date()) -> Int {
        let earliest = self < fromDate ? self  : fromDate
        let latest = (earliest == self) ? fromDate : self

        let earlierComponents:DateComponents = Calendar.current.dateComponents([.day], from: earliest)
        let laterComponents:DateComponents = Calendar.current.dateComponents([.day], from: latest)
        guard
            let earlierDay = earlierComponents.day,
            let laterDay = laterComponents.day,
            laterDay >= earlierDay
            else {
            return 0
        }
        return laterDay - earlierDay
    }

    func dateForDaysFromNow(_ days: Int) -> Date? {
        var dayComponent = DateComponents()
        dayComponent.day = days
        return Calendar.current.date(byAdding: dayComponent, to: self)
    }
}


text:
Q: Port OpenGL code from windows to Mac return version '150' is not supported I try to port my Angel's book's windows code to Mac and got GLSL version 150 not support error, which I am sure that my computer do support, i changed glGenVertexArrays() to glGenVertexArraysAPPLE()
I don't know why it return error like that?
 void init(){
    glGenBuffers( 3, buffers );
    //Vertex buffer for the vertex coordinates
    glBindBuffer( GL_ARRAY_BUFFER, buffers[cube_vertices] );
    glBufferData( GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW );

    //Elements buffer for the pointers
    glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, buffers[cube_indeces] );
    glBufferData( GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

    glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, buffers[wire_indeces] );
    glBufferData( GL_ELEMENT_ARRAY_BUFFER, sizeof(indices_wire), indices_wire, GL_STATIC_DRAW);

    glGenVertexArraysAPPLE(2, VAO);

    // Load shaders and use the resulting shader programs
    program[0] = InitShader( "vshader30_TwoCubes_FullPipe.glsl", "fshader30_TwoCubes.glsl" );
    program[1] = InitShader( "vshader30_TwoCubes_FullPipe.glsl", "fshader6_2.glsl" );
    program[2] = InitShader( "vshader6_2.glsl", "fshader6_2.glsl" );

    //VAO[0] the Cube
    glUseProgram( program[0] );
    glBindVertexArrayAPPLE(VAO[0]);
    glBindBuffer( GL_ARRAY_BUFFER, buffers[cube_vertices] );
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers[cube_indeces]);
    GLuint vPosition = glGetAttribLocation( program[0], "vPosition" );
    glEnableVertexAttribArray( vPosition );
    glVertexAttribPointer( vPosition, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0) );
    //done with this packet
    glBindVertexArrayAPPLE(0);

    //VAO[1] the wireframe
    glUseProgram(program[1]);
    glBindVertexArrayAPPLE(VAO[1]);
    glBindBuffer( GL_ARRAY_BUFFER, buffers[cube_vertices] );
    GLuint vPosition_Wire = glGetAttribLocation( program[1], "vPosition" );
    glEnableVertexAttribArray( vPosition_Wire );
    glVertexAttribPointer( vPosition_Wire, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0) );
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers[wire_indeces]);
    //done with this packet
    glBindVertexArrayAPPLE(0);

    //glUseProgram(0);

    glClearColor( 1.0, 1.0, 1.0, 0.0 );
    glClearDepth( 1.0 );
    glEnable( GL_DEPTH_TEST );
    glDepthFunc(GL_LEQUAL);
    glPolygonMode(GL_FRONT, GL_FILL);
}

void display( void )
{
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    //Make sure you start with the Default Coordinate Systems
    projmat=mat4(1.0);
    modelviewStackTop = mat4(1.0);
    mat4 modelviewStackBottom =  modelviewStackTop;
    //Set up the camera optics
    projmat = projmat*Perspective(30,1.0,0.1,20.0);

    //Position and orient the camera
    modelviewStackTop = modelviewStackTop*LookAt(eye, eye-n, v);
    modelviewStackTop = modelviewStackTop*Translate(0.15, 0.15, -2.5);

    modelviewStackBottom =  modelviewStackTop; //mvstack.push

    //Render wireframe
    glUseProgram(program[1]);
    proj_loc       = glGetUniformLocation(program[1], "projection");
    model_view_loc = glGetUniformLocation(program[1], "modelview");
    glUniformMatrix4fv(proj_loc, 1, GL_TRUE, projmat);
    glUniformMatrix4fv(model_view_loc, 1, GL_TRUE, modelviewStackTop);
    glBindVertexArrayAPPLE(VAO[1]);
    glDrawElements(GL_LINES, 24, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));

    modelviewStackTop = modelviewStackBottom; //mvstack.pop

    modelviewStackBottom =  modelviewStackTop; //mvstack.push

    //Render surface mesh
    glUseProgram(program[0]);
    color_loc = glGetUniformLocation(program[0], "color");
    proj_loc       = glGetUniformLocation(program[0], "projection");
    model_view_loc = glGetUniformLocation(program[0], "modelview");
    glUniformMatrix4fv(proj_loc, 1, GL_TRUE, projmat);
    glUniformMatrix4fv(model_view_loc, 1, GL_TRUE, modelviewStackTop);
    glUniform4fv(color_loc, 1, green_transparent);
    glEnable(GL_POLYGON_OFFSET_FILL);
    glPolygonOffset(1.0, 1.0);
    glBindVertexArrayAPPLE(VAO[0]);
    glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));
    glDisable(GL_POLYGON_OFFSET_FILL);

    modelviewStackTop = modelviewStackBottom; //mvstack.pop

    //The glut cone
    modelviewStackTop = modelviewStackTop*Translate(1.0, -1.0, -3.0);
    glUseProgram(program[2]);
    proj_loc       = glGetUniformLocation(program[1], "projection");
    model_view_loc = glGetUniformLocation(program[1], "modelview");
    glUniformMatrix4fv(proj_loc, 1, GL_TRUE, projmat);
    glUniformMatrix4fv(model_view_loc, 1, GL_TRUE, modelviewStackTop);
    glutSolidCone(0.5, 3.0, 2, 3);

    glutSwapBuffers();
}

A: OSX tops out at OpenGL 2.1 (#version 120) for non-Core contexts.
Make sure you use #version 150 core and request a Core context from GLUT.


text:
Q: Como juntar dois selects de tabelas distintas? Tenho as seguintes tabelas:
+--------- +      +-------------+
| usuario  |      |usuario_grupo|     +----------+
+--------- +      +-------------+     | grupo    |
|usuario_id|----->| membro_id   |     +----------+
| nome     |      | grupo_id    |<----| grupo_id |
| ....     |      +-------------+     | nome     |
| ...      |                          +----------+
+----------+

Gostaria de fazer uma query em que eu obtivesse utilizando um foreach, por exemplo, o seguinte:
Todos os grupos que um determinado usuário está, e todos os membros que pertence do grupo em questão.
A principio consigo obter os grupos (estou utilizando o codeigniter).:
$q = $this->db->select('grupo_id')->from('usuario_grupo')->where('membro_id', $membro_id)->get()->result_array();
foreach ($q as $v) {
       $result[] = $this->db->select()->from('grupo')->where_in('grupo_id', $v)->get()->row_array();
}

Resultado em Json, por exemplo:
[
    {
      "grupo_id": "1",
      "nome": "São Paulo",
    }
    {
      "grupo_id": "9",
      "nome": "Rio de Janeiro",
    }
]

No entanto, gostaria de obter também os membros de cada grupo obtido:
[
    {
      "grupo_id": "1",
      "nome": "São Paulo",
      "membros":
                {
                  "membro_id": "21",
                  "membro_id": "39"
                }
    }
    {
      "grupo_id": "9",
      "nome": "Rio de Janeiro",
      "membros":
               {
                 "membro_id": "4",
                 "membro_id": "9"
               }
    }
]

A: A forma mais correta no codeigniter de você fazer isto, penso eu, que seja da forma que vou expor a seguir, usando o join e montando um subarray() para os resultados esperados:
public function get_usuarios(){
    $consulta = $this->db->get('usuario')->result();
    foreach($consulta as &$valor){
        $this->db->select('usuario_grupo.*, grupo.nome as nome_grupo');
        $this->db->where('id_usuario', $valor->id_usuario); // neste caso é o id do usuário
        $this->db->join("grupo", "grupo.grupo_id=usuario_grupo.grupo_id"); // neste caso, montamos o join para buscar o nome do grupo
        $valor->grupos = $this->db->get('usuario_grupo')->result();
    }

    return $consulta;
}

Nisto vamos obter a listagem completa dos usuários e seus respectivos grupos em cada um deles, abaixo deles.
Para você iniciar a pesquisa, você poderá fazer:
$retorno = $this->nome_model->get_usuarios();

foreach($retorno->grupos as $valor){
    echo "Este usuário ".$valor->nome_usuario." pertence ao grupo ".$valor->nome_grupo;
}


text:
Q: Why Does JavaScript Automatically Allow My Function To Take An Extra Argument? I am not understanding JavaScript scoping and inheritance correctly. I clearly defined a function to take 1 argument (and I understand that this is optional due to how JavaScript handles arguments) but it looks like I need an extra argument to make the scoping work. Why is this?
ShapeRenderable.prototype = new Renderable();
function ShapeRenderable()
{
    this._line_join = 'round';
    this._line_cap = 'round';
    .
    .
}

ShapeRenderable.prototype.setFillColor = function (fill_style)
{
    if (fill_style)
    {
        this._fill_style = fill_style;
        this.initialAlpha = fill_style._alpha;
    }
    else
    {
        this._fill_style = new RGBA(0,0,0,1.0);
    }
};

SelectionCube.prototype = new ShapeRenderable();

function SelectionCube()
{
    var self = this; // So we can access public methods and members from within
    // private ones.

    self._visible = true;
    self._scale = 1;
    self._stroke_style   = new RGBA(0,0,0,.1); // Lines solid black
    self._line_width = 7.0; // 1

    var platonicRenderable = new PlatonicRenderable(this);
    platonicRenderable.createCube();

    // surfaces mostly transparent white
    ShapeRenderable.prototype.setFillColor.call(this, new RGBA(255,255,255,1));
    // Why do I have to pass "this" to get the correct scope during
    // execution of the above? If "this" isn't passed, it looks like JavaScript
    // is scoping this for the parent, instead of for the child.
    //
    // This is the correct behavior. My cube is now white.

}

If I just call:
ShapeRenderable.prototype.setFillColor.call(new RGBA(255,255,255,1));

Then my renderable is black (which is incorrect) and it looks like this._fill_style is never set correctly for my SelectionCube. Why is this? Is there some secret JavaScript optional (first) parameter which tells the function what scope to use during execution? I was having the above issue, and I read about passing this so that the class reference will still point to the child but I never understood why.
Here's what it looks like for the two cases:

Broken - Not Updating "this" correctly

Works - Updating "this" correctly

A: You're using .call incorrectly. The correct syntax for call is
fun.call(thisArg[, arg1[, arg2[, ...]]])

See the docs.
The first parameter is the "scope" or the this object within the function. Subsequent arguments are passed to your function's parameters.
However in this situation it's best to use @elclanrs suggestion in your comments.


text:
Q: Ban an ip automatically after repeated suspicious attempt via .htaccess mod rewrite I've been tracking traffic to my website and lately I have been seeing deliberate attrmpts to find a weak spot, specofically in this case, trying various combinations of http:/// + random file names/extensions
So, if I made a "patter recognizer" that detected various domain searches that did not match any that existed, or even just the http:/// part, how could I trigger an automatic .htaccess block?

A: Blocking odd URLs via .htaccess is pointless as you'll only be blocking things that are already safe.  This could lead to a false sense of security or, worse, bad security where you're only protected in the specific case and not the more general case.
Instead, make sure the server installation is well configured so you don't have to worry about those things.


text:
Q: Additive characters modulo reducible polynomial in $\mathbb{F}_q[T]$ Suppose we have a prime power $q$ and a polynomial $F \in \mathbb{F}_q[T]$. I am wanting to know what the additive characters look like modulo $F$. If $F$ is irreducible then $\mathbb{F}_q[T]/(F(T)) \cong \mathbb{F}_{q^r}$ where $r = \deg F$ so the additive characters are all described by
$$\psi(x) = e_p(\text{Tr}(bx)) $$
for some $b \in \mathbb{F}_q[T]/(F(T))$, where $p$ is the characteristic of $\mathbb{F}_q$ and $\text{Tr}$ is the absolute trace $\mathbb{F}_{q^r} \to \mathbb{F}_p$.
I am wondering about when $F$ is not reducible. I can see that the additive structure modulo $F$ isn't super different from the irreducible case, but I am still unsure of what exactly the characters look like. Any help here would be greatly appreciated.

A: You can use the following description of all the additive characters irrespective of whether $F(T)$ is irreducible or not. After all, the additive group of the quotient ring is always isomorphic to $\Bbb{F}_q^r$.
Let $b=(b_0,b_1,\ldots,b_{r-1})$ be any vector from $\Bbb{F}_q^n$. Define the character $\psi_b$ as follows. For any low degree polynomial
$a(T)=a_0+a_1T+\cdots+a_{r-1}T^{r-1}$ declare the value of $\psi_b$ at the coset $\overline{a(T)}=a(T)+\langle F(T)\rangle$ to be
$$
\psi_b(\overline{a(T)})=e_p(Tr(a_0b_0+a_1b_1+\cdots a_nb_n)).
$$
Here $Tr$ stands for the absolute trace $Tr:\Bbb{F}_q\to \Bbb{F}_p$.
As we clearly have $\psi_b\cdot\overline{\psi_{b'}}=\psi_{b-b'}$ it suffices to check that $\psi_b$ is non-trivial for any $b\neq0$. After all, we have the correct number of (candidate) characters, so we only need to check they are distinct. This is straight forward. If $b_i\neq0$ for some $i, 0\le i<r$, we can find an element $a_i\in \Bbb{F}_q$ such that $Tr(b_ia_i)\neq0$. Hence $\psi_b(\overline{a_iT^i)\neq1$, and we are done.


text:
Q: Authenticating User on LogIn ASP.NET MVC I have set-up a repositories class which gets the user object and I check whether the password that is being entered matches the retrieved password from the database. The password is of course hashed with some extra security measures.
I've been doing some research on the web though and I'm still a little confused how I authenticate a user after they log in. I know there is an [Authorize] tag for every controller/action method which basically means: Only allow the current user to access this page if they're authenticated.
I'm just having trouble understanding how to authenticate them.
This is where I am at now:
if (hashedPassword == user.Password)
{
    //Correct Login Details
    //Mark this user as Authenticated/Logged in
}

I am using ASP.NET MVC 4, C#.
Thank you kindly for any hints and tips and answers.

A: This very much depends on what you use as Authentication Framework.
One of the ways with WebSecurity is
    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public ActionResult Login(LoginModel model, string returnUrl)
    {
        if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
        {
            return RedirectToLocal(returnUrl);
        }

        // If we got this far, something failed, redisplay form
        ModelState.AddModelError("", "The user name or password provided is incorrect.");
        return View(model);
    }

If you use SimpleMembership provider, you can use that:
    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public virtual ActionResult Login(LoginModel model, string returnUrl)
    {
        if (ModelState.IsValid && membershipProvider.Login(model.UserName, model.Password, model.RememberMe))
        {
            return RedirectToLocal(returnUrl);
        }

        ModelState.AddModelError("", "The user name or password provided is incorrect.");
        return View(model);
    }

Or for older Membership provider this works:
    [HttpPost]
    public virtual ActionResult Login(LoginModel model, string returnUrl)
    {
        if (ModelState.IsValid)
        {
            if (Membership.ValidateUser(model.UserName, model.Password))
            {
                FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
                    && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                {
                    return Redirect(returnUrl);
                }
                else
                {
                    return RedirectToAction("Index", "Home");
                }
            }
            else
            {
                ModelState.AddModelError("", "The user name or password provided is incorrect.");
            }
        }

        // If we got this far, something failed, redisplay form
        return View(model);
    }


text:
Q: How to center text and image on one line inside a %width div? I am really struggling with this and I have no idea why. I want to have text and an image on 1 line and centered inside a 100% width div. Here's a jsfiddle..
http://jsfiddle.net/JnbeJ/

A: floated elements automatically become block-level. It's impossible to center them via text-align: center. The only way for you to do is to make them inline-block like so: display: inline-block. I added vertical-align: top; for the h to be at the top. The working example is here: http://jsfiddle.net/skip405/JnbeJ/4/

A: Your image and text can't float left and be centred at the same time...

A: You have a div that is 100% width (btw/ divs are 100% to begin with), and trying to center a div inside it that is also 100% width. You can either put a width on the inner div, or make it inline-block.
Updated fiddle.

A: You are using a wrapper with class name "centered" so instead of making both elements (display: inline-block;), just add this to style your wrapper:
.centered {display: inline-block; margin: 0 auto;}

You also have an additional (text-align: center;) in your containers css that does not need to be there.


text:
Q: Reinforcement learning with non repeatable actions I am very new to RL and wondering about the capabilities of RL. In my understand RL is a kind of Neural Network that feeding into a state and output the probability of each action. The training process is to mitigate the difference between the predicted value and the value of the real rewards (may be wrong here).
However, my problem is very tricky. In the beginning, there is an action space [x1, x2, x3, x4,..,x5], after each step, the action cannot be repeated. In other words, the action space is shrinking after each iterate. The 'game' is done when the action space is 0. The goal of this game is to get the highest accumulated rewards.
I did some search online but I failed to find any useful information. Thanks so much!
Added:
Sorry for the unclear problem. For a classical RL such as CartPole game. The action is repeatable, so the agent is learning the reward of each action at each state. The goal is to get a reward '1' rather than '0'. But for my question, since the game will be done anyway (because the action space is decreasing every iterate and the game is done when action space is empty), I hope the agent can do the action with the highest reward firstly, and then second-highest reward.....
So I believe this is some kind of optimization problem. But I don't know how to modify the classical architecture of RL learning for this problem? Or could anyone help me find some related sources or tutorials?
Added Again:
Currently, my solution is to change the part of how an action is picked. I fed a list of previous actions. And avoid these actions to be picked again. For example, if the action is picked by neural network, I made the output of the neural network by
with torch.no_grade():
   action_from_nn = nn(state)
   action_from_nn[actions_already_taken] = 0
   action = torch.max(action_from_nn,1)[1]

if the random value smaller than epsilon, the action is just randomly chosen, it will be:
action = random.sample([i for i in action_space if i not in actions_already_taken], 1)[0]

As can be seen, I only forced the agent not to choose the repeat actions. But I didn't really change the output of the neural network. I am wondering is that OK? Or is there any space for future improvement?

A: Your action and observation space needs to be the same size throughout a run of training.
A way round this for your problem would be to cause any action that has already been performed to no longer have an effect on the game or the observation space. The actions that have been performed could be stored in a 1d array, one-hot encoded and this could also be included in your observation space so your agent will learn to not pick actions it has already performed.


text:
Q: Using jQuery load function against the window scrollbar to retrieve new data from mysql db I am refreshing a div element to get the latest chat message with the scrollbar being programmed to scroll to bottom to see new message.

Here is the function doing that but I cannot scroll up to check other messages, the scrollbar keep scrolling down
var loader = setInterval(
    function(){
        $(".chatLoader").load("./chatData.php").each(function(){

        }).fadeIn(400, function(){
            $(this).scrollTop($(this)[0].scrollHeight - $(this)[0].clientHeight);
        })
},1500);

Is there a way to correct this behaviour?

A: Before scroll you should make a condition.
With this code if you are two messages from the last messages it does not going to scroll to the bottom.
var loader = setInterval(
    function(){
        $(".chatLoader").load("./chatData.php").each(function(){

        }).fadeIn(400, function(){
            var messages = $(".chatLoader");
            var newMessage = messages.children("li:last-child");

            var clientHeight = messages.prop("clientHeight");
            var scrollTop = messages.prop("scrollTop");
            var scrollHeight = messages.prop("scrollHeight");

            var messageHeight = newMessage.innerHeight();
            var lastMessageHeight = newMessage.prev().innerHeight();

           if(clientHeight  + messageHeight + lastMessageHeight + scrollTop >= scrollHeight){
               messages.scrollTop(scrollHeight);
            }

        })
},1500);

A: You're close, you just need to save the old value of scrollHeight and then compare with that before you scroll:
var oldScrollHeight = 0;
var loader = setInterval(
    function(){
        $(".chatLoader").load("./chatData.php").each(function(){
        }).fadeIn(400, function(){
            if ($(this)[0].scrollHeight > oldscrollHeight)
            {
                $(this).scrollTop($(this)[0].scrollHeight - $(this)[0].clientHeight);
            }
            oldscrollHeight = $(this)[0].scrollHeight;
        })
},1500);

Now you should be able to scroll up UNTIL a new message arrives, then it will scroll to the Bottom. Hope that's what you want.
Edit: I have the initial oldscrollHeight to 0 (zero). The function then sets a new value every time it has processed.

A: You can simplify your scenario!
You should add a position: fixed part to bottom of your page.
I think you yourself are now guessing the new scenario!
.fixed-part{
    position: fixed;
    bottom:0;
    width: 100%;
    height: 150px;
    overflow: visible;
    border-top: solid 2px #ccc;
    background-color: #fff;
    z-index: 2;
}

Now, you must add per new message to it and to your previous panel both.
You can minimize this part when scroll to top and open it when new message receives.


text:
Q: Pearson Correlation has quizzy results I investigated experiments with SPSS and following values were out.
I have a question that in which case is possible to get Feature 1 in Group A+B as significant p<.05 while either Group A and B has low significance in Feature 1?
I hardly interpret because Group A have low correlation and Group B also, but combined group have correlation with (very) high significance.

(* p<.05)

A: Here you have a simple example with made-up data: there are two groups $A$ and $B$ and two variables $X$ and $Y$. In both groups alone the correlation of $X$ and $Y$ are small (r = -.17 and .23), but if you combine them you see a linear trend (r = .67).

So, as you can see, this kind of relation is possible. Local relations (or lack of them) is not the same as global relations. You can read more on atomistic fallacy and ecological fallacy - i.e. logical errors when drawing conclusions on groups based on individual level data or individuals based on group level data.


text:
Q: Using patsy formula with pyGAM library in Python pyGAM is a great python library to build generalised additive models (GAM). However, unlike its R counterparts like "mgcv", using patsy formulas (y~X1+X2+X3...+Xn) is not apparently straightforward.
A pull request thread (https://github.com/dswah/pyGAM/pull/249) discusses a possible solution to this problem. But, I cannot replicate the solution. It would be really helpful if someone would guide me in this matter.


text:
Q: Quantum harmonic oscillator hamiltonian in terms of the parity operator Can you write the quantum harmonic oscillator hamiltonian
$$H = -\dfrac{\hbar^2}{2m}\dfrac{d^2}{dx^2}+\dfrac{1}{2}m\omega^2x^2$$
in terms of the parity operator $P$?

A: No.  For one thing $P^2=\hat{1}$ so its eigenvalues of $\pm 1$.  Moreover, $P$ generates discrete transformations $x\to -x$, $p\to -p$.
It is certainly not true that $H^2=\hat{1}$ or that the eigenvalues of $\hat H$ are limited to $\pm 1$.  $e^{-i Ht}$ are continuous not discrete transformations, i.e. $H$ generates continuous not discrete transformations.
It is true that $P$ commutes with $H$, meaning the eigenstates of $H$ are also eigenstates of $P$, i.e. the eigenstate of $H$ have definite parity.


text:
Q: How to obtain response curve characteristics (rise time, settling time, steady state, overshoot) for a non-linear system, from Simulink onto Matlab? I obtain a response curve for my non-linear controller design on Simulink, and I am only able to obtain just the rise time and overshoot using 'Bilevel measurements' on the response curve tab in Simulink. Thus, I import this curve onto MATLAB using the following command in Command window:
plot(simout.Time,simout.Data)
After using the above code, I did obtain the same response curve in MATLAB as obtained in Simulink. But when I right click on the Figure in order to look for 'Characteristics-->Rise Time, settling time etc', this feature seems disabled i.e., I try to right click and nothing appears after I have imported the curve in MATLAB from Simulink.
Unlike when we have a transfer function (tf) defined in the command window, and then we type 'step' to obtain the response curve. Thus, on this figure when we right click, we can select characteristics--> rise time and other parameters.
I would be grateful if I can be assisted on how to obtain the system characteristics from a non-linear system's response curve.
Thank you.

A: I think the data that is shown in the figure generated with the "step" command comes from the "stepinfo" command.
For this case, you can use the stepinfo command with the time and output vector. See Mathworks example. The command will be like:
stepinfo(simout.Time,simout.Data,STEADYSTATE_TIME)


text:
Q: How to mathematically prove that a linear system's vibration frequency is equal to frequency of the harmonic external force? I was reading about "Vibration" on Wikipedia:

Forced vibration: 'for linear systems, the frequency of the steady-state vibration response resulting from the application of a periodic, harmonic input is equal to the frequency of the applied force or motion, with the response magnitude being dependent on the actual mechanical system.'

I would like to enquire the detailed mathematical proof of this conclusion.

A: Hints:

*

*Fourier transform $t\leftrightarrow \omega$ the damped forced linear oscillator, which is a linear second-order ODE. For more details, see e.g. my Phys.SE answer here.

*Show that there are at most 3 (possibly complex) frequencies with non-zero amplitudes: 2 characteristic frequencies and the driven frequency.

*All realistic systems contain dissipation, so the characteristic frequencies will die out. Hence only the driven frequency remains.

A: Best approached using linear system's theory and transfer function analysis.
A linear system (which can be modeled as a rational polynomial transfer function in either $s$ or $j\omega$) responds to a linear excitation resulting in response having the same frequency however possibly different phase and amplitude.
This can be shown in a very generalized fashion either in the frequency domain or in the time domain by convolution of the time based excitation function and the impulse response of the system.


text:
Q: Py2Exe can't find module I've trying to "compile" script including package "pcapy", that I manually compiled with
python setup.py install

but py2exe can't find him. I've tried to add option in setup.py
options={
        "py2exe":{
                "packages": ["pcapy"]
        }
}

But it's not helped. Error that I've got(same if change "include" to "packages")
running py2exe
*** searching for required modules ***
Traceback (most recent call last):
  File "setup.py", line 8, in <module>
    "includes": ["pcapy"]
  File "C:\Python27\Lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "C:\Python27\Lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 243, in run
    self._run()
  File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 296, in _run
    self.find_needed_modules(mf, required_files, required_modules)
  File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 1297, in find_needed_modules
    mf.import_hook(mod)
  File "C:\Python27\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Python27\lib\site-packages\py2exe\mf.py", line 136, in import_hook
    q, tail = self.find_head_package(parent, name)
  File "C:\Python27\lib\site-packages\py2exe\mf.py", line 204, in find_head_package
    raise ImportError, "No module named " + qname

ImportError: No module named pcapy

A: Did you try to include 'pcapy' ?
options = {
    "py2exe": {
        "includes": ["pcapy"],
        "excludes": [...],
        "packages": [...],
        ...
     }
}


text:
Q: Blue links issue on Gmail and iOS email clients I'm building html emails and I know this is a known issue and I've tried many solutions to force address/phone/emails texts not to change the color and become a link on Gmail and ios. The only solution that partly works for me is to have my text inside  and  tags and style to have the font color I need. Here's my example:
...
128 Prinston St | Somewhere, CA 22314
...

This works in sense of having the font color what I need, but I don't want to have this text as a link. As now I have to leave the href attribute empty which directs to a white page when clicking on the text from iOS default email.
So please suggest any working solution that would not need to have  tag in the code.
Thanks in advance.

A: Data detectors have become a real pain when crafting emails if you do not want that blue underline. I have several techniques I suggest you try.
Place the following in the  section of your email. If you already have a  section, add it there:

If that doesn't solve the issue, you can always do something like this around the areas that are being underlined:
your content here

One thing that might fix the issue is add META tags to the  area:
<meta name="format-detection" content="telephone=no" />
<meta name="format-detection" content="email=no" />
<meta name="x-apple-disable-message-reformatting" />

If all else fails (and I have had issues where all else failed) I find that adding a non-printing character might help stop the data detector from detecting a url, phone number, address or date.

A variation on this is usually effective:
gwally@stackoverflow.com

Good luck with ugly blue lines.

A: How about appending a common style for links.

Code:
NSString *styledHTML =  [@"" stringByAppendingString:originalHTMLString];

or
NSRange rOriginal    = [originalHTMLString rangeOfString:@"
"];
NSString *styledHTML = [originalHTMLString stringByReplacingCharactersInRange:rOriginal withString:@"
"];


text:
Q: Rotate in hover doesn't work in chrome I am new here, so sorry if I am being misunderstood.
I made a flip animation when user hovers a div. Works perfectly in Firefox, but not in chrome. I lost last hour trying to find solution.
HTML

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

CSS
/* entire container, keeps perspective */
 .flip-container {
    perspective: 1000;
    transform-style: preserve-3d;
}
/*  UPDATED! flip the pane when hovered */
 .flip-container:hover .back, .front img:hover .back {
    transform: rotateY(0deg);
}
.flip-container:hover .front {
    transform: rotateY(180deg);
}
.flip-container, .front, .back {
    width: 475px;
    height: 300px;
}
/* flip speed goes here */
 .flipper {
    transition: 0.6s;
    transform-style: preserve-3d;
    position: relative;
}
/* hide back of pane during swap */
 .front, .back {
    backface-visibility: hidden;
    transition: 0.6s;
    transform-style: preserve-3d;
    position: absolute;
    top: 0;
    left: 0;
}
/*  UPDATED! front pane, placed above back */
 .front {
    z-index: 2;
    transform: rotateY(0deg);
}
/* back, initially hidden pane */
 .back {
    transform: rotateY(-180deg);
    display: table;
}
/*
    Some vertical flip updates
*/
 .vertical.flip-container {
    position: relative;
}
.vertical .back {
    transform: rotateX(180deg);
}
.vertical.flip-container:hover .back {
    transform: rotateX(0deg);
}
.vertical.flip-container:hover .front {
    transform: rotateX(180deg);
}
.back div.middle {
    display: table-cell;
    vertical-align: middle;
    text-align: center;
    padding: 0px 55px;
}
.back div.middle .avatar {
    display:block;
}
.back div.middle .avatar img {
    border-radius: 50%;
}
.back div.middle .cv {
}
.back div.middle .cv p {
    width: 90%;
    margin-left: auto;
    margin-right: auto;
}

JSFIDDLE

A: Use -webkit-transform: rotateY(xdeg);
Unfortunately not everything from transform works without vendor prefixes.
Check http://caniuse.com/#feat=transforms2d for browser support

A: put this to all your rotations in css, maybe it'll help you...
-webkit-backface-visibility:hidden;


text:
Q: extendscript after effects why isnt my list items not adding why are my Listbox items not added? to Listbox, I don't get it.
the code looks ok just did some modification to the new instance of GUI and now my Listbox items not adding
not sure where the error is just testing as i await your response from all you pros.
feel free to run this and test it and kindly point out the issue thanks.
gridder.buildGUI =function(thisObj){
dialog = (thisObj instanceof Panel) ? thisObj : new Window("palette", thisObj.scriptTitle, undefined, {resizeable:true});

    var w = dialog;
dialog.text = "ALL IN ONE TOOLBOX 2022";
dialog.preferredSize.width = 180;
dialog.preferredSize.height = 520;
dialog.orientation = "column";
dialog.alignChildren = ["fill","top"];
dialog.spacing = 10;
dialog.margins = 16;

var tpanel = dialog.add("tabbedpanel", undefined, undefined, {name: "tpanel"});
tpanel.alignChildren = "fill";
tpanel.preferredSize.width = 348;
tpanel.margins = 0;

// CLRTAB
// ======

var Main = tpanel.add("tab", undefined, undefined, {name: "clrTab"});
Main.text = "Main";
Main.orientation = "column";
Main.alignChildren = ["fill","top"];
Main.spacing = 10;
Main.margins = 10;

// CLRTAB_LSTGRP
// =============
var clrTab_LstGrp = Main.add("group", undefined, {name: "clrTab_LstGrp"});
//clrTab_LstGrp.orientation = "row";
clrTab_LstGrp.alignChildren = ["left","center"];
clrTab_LstGrp.spacing = 10;
clrTab_LstGrp.margins = 0;

var t = Main.add("statictext", undefined, "Hello", {multiline:false});
t.text = "Create Solids";
t.graphics.foregroundColor = t.graphics.newPen (t.graphics.PenType.SOLID_COLOR, [0.0, 1.0, 1.0], 1);
t.graphics.font = ScriptUI.newFont ("Arial", "Bold", 30);

var listBoxxa = Main.add("listbox", undefined, undefined, {name: "listBoxxa", items: listBoxxa_array});
listBoxxa.preferredSize.width = 300;
listBoxxa.size = [100, 130];

 var listBoxxa_array = [
"Create 2 solids",
"Create Solid",
"Create Solid with fractual noise",
"Create Solid CC Particle World",
"Create Solid Particular",
"Solid With BCC Sphere",
"Solid With BCC Turbulence",
 ];

    if (dialog instanceof Window){
        dialog.center();
        dialog.show();
    }
    else dialog.layout.layout(true);
};

gridder.buildGUI(gridder);

A: When you create the Listbox you haven't yet initialised listBoxxa_array. So when you create the control object you're giving it an undefined variable as its contents. Move the section where you define listBoxxa_array above the line where you define listBoxxa.


text:
Q: Gulp can't find itself locally gulpfile.js:
var gulp = require('gulp');
var console = require('console');

gulp.task('default', function() {
  console.log('The "Gulp Default Task" is done.');
});

nodejs commands:
λ gulp
[17:17:48] Local gulp not found in ~\nodework\dyncss
[17:17:48] Try running: npm install gulp

$ (master) (dyncss@0.0.0)
λ npm install gulp --save-dev
C:\Users\TheStaabFamily\AppData\Roaming\npm\gulp -> C:\Users\TheStaabFamily\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js
C:\Users\TheStaabFamily\AppData\Roaming\npm
└── gulp@3.9.0

$ (master) (dyncss@0.0.0)
λ gulp
[20:23:58] Local gulp not found in ~\nodework\dyncss
[20:23:59] Try running: npm install gulp

WTF?  This is on Win7 x64.  It took me quite awhile to install VStudio so node-gyp (a dependency of gulp) could build itself during the gulp install.  I initially installed gulp with:
npm install -g gulp

Incidentally, my package.json is also not being updated by npm when I try to install gulp with the -D or --save-dev options.
I am a new node user so please excuse if this question is too noobie.
THANKS!!!

A: See http://www.bartread.com/2014/02/17/whats-difference-locally-globally-installing-npm-packages/ for details.
Gulp should be installed globally and then linked into projects that use it:
npm install -g gulp

npm link --local gulp (run from your project root directory)
or...
Installed locally and linked globally:
npm install gulp
npm link --global gulp

A: While installing  gulp don't forget to put '-g' in command. it will install globally.
i hope because of user rights and all, sometimes during installation gulp install path was not added in environment PATH variable. you must have to add manually  your installed directory path in PATH variable.
so that 'gulp' keyword will be available locally globally.


text:
Q: Directory shared between users Let's say I have 3 users on my server:

*

*/home/bob

*/home/joe

*/home/fred
I want to create a folder at /share in which bob and joe can both add and delete files. I want all of files added to that directory to have permissions such that both users can modify or delete them.
The issue is that when directories are created within /share/, they are created with permissions for the owner. If a folder is created in /shared then it belongs to the creator, and nobody else can modify/delete its contents.
I need to have this folder behave such that everything created in it has full rwx permissions for everyone.

A: Using Groups
Like Trevor said, you can make a group, and give that group read, write, and execute, permission to that folder.
To create a group:
sudo groupadd groupname

You can use anything in the place of groupname, just remember what it is!
Next, let's create a folder in /share
sudo mkdir /share

Set that folder's group to the created one, and well as set permissions
sudo chgrp groupname /share
sudo chmod 775 /share

Remeber to change groupname to the one your created!
You can see that we change the permissions of /share to 775, here's a explaination of what that means.
7 in the first position, this gives the owner of the folder, read (lists files in folder), write (create/delete files in folder), and execute (be able to cd into that folder). In our case the owner of the folder is root.
7 in the second position, this gives the folder's group, read, write, and execute permission. In our case the folder's group is groupname or whatever you set it to.
5 in the final position, this gives the the public (whoever can logon to the system), read, and execute permission. This allows them to cd into folder and list the files using ls or a similar command. If you want to prevent others from cd'ing into the folder you can use 0 instead of 5, meaning they get no permissions.
To add a user to a group, so that can use the group permissions, we can use:
sudo usermod -a -G groupname [username]

Be sure to change groupname and [username] to their correct values.
Note: a user may only be in one primary group, but multiple secondary groups. The command I provided adds another secondary group to the user specified.
Using ACLs
A alternate solutions, which I think is more complex is to use ACLs (or Access Control Lists).
This allows you to grant specific permissions to specific users without the use of groups or changing owners. For this to work the file system must be mounted with the acl option.
Preparing to use ACL
Firstly, we must check if the drive is already mounted as ACL. Because we the folder is in the /share is in the root (/) partition, we must ensure that the root partition is already mounted with the acl option.
Note: The /home is not always inside the root partition, the /home folder can be it's own partition. This also applies to other partitions.
To determine if a partition has ACL enabled, we can use the mount command.
mount -l

For me, this is on the first line.
/dev/sda5 on / type ext4 (rw,errors=remount-ro)

We can see that the partition /dev/sda5 is mounted at /. Yours may not be on the first line, like mine. It may be on the second, third, but it should be mounted at /, because that's where our /share is.
Now, we will need to determine if we have the acl option.
tune2fs -l [partition path]

From my output of mount -l you can see that my partition path is /dev/sda5, yours may be different.
From running the command we will get something similar to this:
tune2fs 1.42.9 (4-Feb-2014)
Filesystem volume name:   <none>
Last mounted on:          /
Filesystem UUID:          5e7b3dcf-cda0-4a74-ab0e-67c9ce8ab044
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
~cut off to save space~

On the default mount options line, we can see that we have acl enabled. If you don't have acl enabled, you can use Google find out how to do that.
Now, like the method with groups, you will need to create the folder:
sudo mkdir /share

One last thing, we must set the folder to 700, so only root (and people granted access by ACL) can access the folder:
sudo chmod 700 /share

Now we can set the access control.
Note: setting the permissions, without using acl, and instead using chmod, will cause acl permissions to be reset.
Setting ACL permissions
It's a bit simpler now, if you want to set permission for a user, you can use
sudo setfacl -m "u:[username]:rwx" /share

This will grant [username] rwx (read, write, execute) permissions. The sudo is required only because /share is owned by root.
For a group use:
sudo setfacl -m "g:[groupname]:rwx" /share

For a other/public (only includes people who are able to logon to the system) use:
sudo setfacl -m "o:rwx" /share

Note: you can swap rwx out for others like rx for read/execute only.
Note: if you pass a -d option while using setfacl (setfacl -d -m "u:...), this will set the default ACL value for the folder. This will cause any NEW files added to the folder to automatically have the permissions you applied.

A: EDITED:
Make a user group, right click the folder you want and set appropriate permissions for that group! Hope this helps!


text:
Q: Why isn't there a named requirement ordered container in C++? Many STL containers have both ordered and unordered version, e.g. map and unondered_map, set and unordered_set. And on the other hand, some STL algorithms have to be fed in an ordered container to give the correct output. For instance, std::set_difference will not work correctly on unordered_set. So my question is, why isn't there a named requirement that specifies a container is always sorted, such that inputs to algorithms like set_difference are constraint to those sorted containers?

A:
In a way, the STL concept contradicts the original idea of
object-oriented programming: The STL separates data and algorithms
rather than combining them. However, the reason for doing so is very
important. In principle, you can combine every kind of container with
every kind of algorithm, so the result is a very flexible but still
rather small framework.
-- from  Nicolai M. Josuttis <<The C++ Standard Library A Tutorial and Reference Second Edition>>

There are three classes of STL containers :

*

*sequence containers(array, vector, deque, forward_list, list)

*associative containers(set, map, multiset, and multimap)

*unordered associative containers(unordered_set, unordered_map, unordered_multiset, and unordered_multimap)

You can get sorted sequence containers by calling  std::sort for array, vector, deque, sort() member function for forward_list and list.


text:
Q: How to filter rows in R for Eurozone countries easily? I usually use dplyr to filter data. I know hava huge dataset (62176 entries) of banks operating in different countries. I'd like to subset/filter that datasets for Eurozone banks only.
I haven't found any workaround rather than pasting all the name of Eurozone countries and then create a new dataset with filter.
Is there any workaround for this problem?
Thank you!

A: Without the data we can't give you clear answers however, given my understanding of the problem below are some methods.

*

*Assuming your dataset already has a column that has each bank's operating country, you could create a manual vector of the countries you are interested in and then filter the dataset for rows that match

#manually assign countries to vector (this must match how the countries are listed in your data)
euro_countries<- c("Germany","England","France","Poland")

#Then filter dataset to pull up rows that match, I make up colnames as I don't know your data

dataframe %>% filter(op_country %in% euro_countries)

*alternatively, depending on your data set you can reference the very helfpul countrycode library in R which has an existing dataset that can potentially join your dataset country column against the matching column in countrycode::codelist and then reference the countrycode::codelist$continent to filter for countries in "Europe".

#join your data set with the codelist table but depends on country column in your dataset
dataframe <- leftjoin(x=df,y=countrycode::codelist,by=c("op_country"="country.name.en"))

#filter your dataset with the new column
dataframe %>% filter(continent=="Europe")


text:
Q: Добавление обязательного атрибута в подпись Пытаюсь добавить  id-aa-signingCertificate в обязательные атрибуты, описал структуры согласно стандарту rfc2634
/*
SigningCertificate ::=  SEQUENCE {
       certs        SEQUENCE OF ESSCertID,
       policies     SEQUENCE OF PolicyInformation OPTIONAL
   }
ESSCertID ::=  SEQUENCE {
        certHash                 Hash,
        issuerSerial             IssuerSerial OPTIONAL
   }
   Hash ::= OCTET STRING -- SHA1 hash of entire certificate
   IssuerSerial ::= SEQUENCE {
        issuer                   GeneralNames,
        serialNumber             CertificateSerialNumber
   }
*/
type SignerCertificate struct {
    SigningCertificate SigningCertificate `asn1:"sequence"`
}

type SigningCertificate struct {
    ESSCertID       ESSCertID       `asn1:"sequence"`
    IssuerAndSerial issuerAndSerial `asn1:"optional"`
}

type ESSCertID struct {
    Hash []byte `asn1:"explicit,tag:16"`
}

При добавление атрибута функция отрабатывает успешно, но при проверке не парсится сертификат. Вероятно структуру не верно описал ?
h := sha1.New()
    h.Write(cert.Raw)
    b := h.Sum(nil)
    ias, err := cert2issuerAndSerial(cert)
    if err != nil {
        return err
    }

    ss := SignerCertificate{
        SigningCertificate: SigningCertificate{
            ESSCertID: ESSCertID{
                Hash: b},
            IssuerAndSerial: ias},
    }

    attrs.Add(oidAttributeContentType, sd.sd.ContentInfo.ContentType)
    attrs.Add(oidAttributeMessageDigest, sd.messageDigest)
    attrs.Add(oidAttributeSigningTime, time.Now().UTC())
    attrs.Add(oidSigningCert, ss) // если убрать то сертификат распознаётся
    ```


text:
Q: run JS app locally in IE I'm using GWT 2.1 and IE to test the default hello world GWT app.
I compile the default Hello world GWT app and then go to HTML file and
open it with IE.
I get a red warning message "Your web browser must have JavaScript
enabled in order for this application to display correctly."
I had to allow the active content to be running in order to see the
app screen.
things are a bit different  if I run the app via \.psf\Home
\myFile.htm which is path to my Parallel's "shared directory" .. I
wouldn't see such warning.
also running in dev mode seems not to raise this warning message.
it seeems IE doesn't like people opening JS-laced web pages from the local drive.  Probably a security concern, I would imagine.
there is a detailed article that tackles this issue at http://www.phdcc.com/xpsp2.htm
i tried the method of Mark of the web by adding these two lines at the
begining of myfile.html file :
<!-- saved from url=(0014)about:internet -->
<!-- saved from url=(0016)http://localhost -->

but when i add these two lines and then compile app and open the html file with IE the web app doesn't show even though the warning message is gone!
The reason probably is that (by default) a GWT app is loaded within an iframe, i.e. as another HTML page (*.cache.html), which doesn't contain the MotW.
i Tried using the "xs" or "xsiframe" linker, i.e. add one of these lines to our
*.gwt.xml:
<add-linker name="xs" />
<add-linker name="xsiframe" />

Those linkers use *.cache.js" files, so the MotW in our host page should be enough. but The "xs" linker prevents us from using DevMode .
adding line  to xml module file make IE warning message go away and can run app locally with IE.however the line above prevent our app to run in dev mode with IE .
any Idea how we can have the app works both in dev mode and web mode?
i'm not keen on having two xml module files one for dev mode and one
for web mode. but would like to know how to do that if i have to?
also interested in any other method to run javascript apps locally with IE.
thanks

A: Have you tried enabling Active Content from local files in the advanced tab of the Internet Options?

A: This worked for me:
SO - Activex content in local web page
The take away is:
<!-- saved from url=(0014)about:internet -->

Must be the first line in the file and the file must have
\r\n (CRLF)

line endings.

A: you could download and set up xampp and put your files in the htdocs folder. This will give you a local server at your loopback address. This will prevent IE from doing all of its acrobatics concerning locally run js files, as it will think it is accessing a remote website.


text:
Q: Spring Rest JSON conversion I am working on Spring Rest and Angularjs. I have a problem on how the objects are being converted. Lets say I have two classes.
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "fooId", scope = Foo.class)
class Foo {
   int fooId;
   String fooName;
   String fooTitle;
   Bar bar;
}

@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "barId", scope = Bar.class)
class Bar {
   int barId;
   String barName;
   String barTitle;
   int fooId;
}

When I send the Foo object with Bar to Angularjs, I am getting something like this:
{
  "fooId": 1,
  "fooName": "foo-name",
  "fooTitle": "foo-title",
  "bar": 1
}

I was expecting to get like this:
{
  "fooId": 11,
  "fooName": "foo-name",
  "fooTitle": "foo-title",
  "bar":  {
      "barId": 22,
      "barName": "bar-name",
      "barTitle": "bar-title",
      "fooId": 11
  }
}

What could be wrong?

A: Just try to remove @JsonIdentityInfo annotation from your Bar class - default rest controller convert classes well without it!


text:
Q: Sending Firebase Cloud Message using UID of user I want to build an Android app that allows a user to send notification and data messages to other users. I've started using Firebase only recently, and Firebase Cloud Messaging is still pretty confusing to me.
I have already implemented sending a message to a specific device using the Firebase Instance Id. However, in my app, a user can log out and log into their accounts using different devices, so this isn't really what I want. I read the documentation and it's pretty confusing, they mention sending messages to user groups, and topics (which only apps can subscribe to, not users).
Is there a way to send a push notification directly to another user or a group of users using only their UIDs? If not, is there any other way I can implement this?

A: I did it storing the FCM Token in a device structure by user. When the user login, add the deviceData to the userToken structure. You need clear deviceData when the user logout. This way, you will only send notifications to logged devices.
Ex (This is not like mine structure, but it can help you to wondering a good way to do this):

-userToken
  -idUser1
     -device
         -idDevice1
             -fcmToken: "xxxxx"
         -idDevice2
             -fcmToken: "YYYYY"

Hope that I helped you

A: Alright, so to make sure this works across multiple devices when a user logs in, I just make the device subscribe to a topic with the name equal to the user's UID. Now if I want to send a notification to a user, I just send an FCM message on the topic with the name equal to the user's UID!
Example: If my UID is equal to "asdf", whenever I login using multiple devices, each of the devices automatically subscribes to the topic with name "asdf". So now, if I send an FCM from the server on this topic, all the devices from which I am logged on to obtain this notification.


text:
Q: Execute code on assembly load I'm working on wrapper for some huge unmanaged library. Almost every of it's functions can call some error handler deeply inside. The default error handler writes error to console and calls abort() function. This behavior is undesirable for managed library, so I want to replace the default error handler with my own which will just throw some exception and let program continue normal execution after handling of this exception. The error handler must be changed before any of the wrapped functions will be called.
The wrapper library is written in managed c++ with static linkage to wrapped library, so nothing like "a type with hundreds of dll imports" is present. I also can't find a single type which is used by everything inside wrapper library. So I can't solve that problem by defining static constructor in one single type which will execute code I need.
I currently see two ways of solving that problem:

*

*Define some static method like Library.Initialize() which must be called one time by client before his code will use any part of the wrapper library.

*Find the most minimal subset of types which is used by every top-level function (I think the size of this subset will be something like 25-50 types) and add static constructors calling Library.Initialize (which will be internal in that scenario) to every of these types.
I've read this and this questions, but they didn't helped me. Is there any proper ways of solving that problem? Maybe some nice hacks available?

A: A couple of other suggestions:

*

*Create an abstract base class as the root for all the wrapper classes and put the initialize call in the constructor for the base class.

*Give all the objects internal constructors and force clients to instantiate them through some factory method and then perform the initialization before returning an object instance.

A: I think your option 2 is better.  If you include the call in a few extra types, so be it.  Of course, you would have Library.initialize bail out if it's already been called.

A: Might be a bit of a stretch, but you could create your own wrapper class that exposes only the functions that you want. Within each of those functions you could perform your error handling.


text:
Q: Prometheus - add target specific label in static_configs I have job definition as follows:
  - job_name: 'test-name'
    static_configs:
      - targets: [ '192.168.1.1:9100', '192.168.1.1:9101', '192.168.1.1:9102' ]
        labels:
          group: 'development'

Is there any way to annotate targets with labels? For instance, I would like to add 'service-1' label to '192.168.1.1:9100', 'service-2' to '192.168.1.1:9101' etc.

A: I have the same question before. Here is my solution:

*

*use job_name as the group label

*add more target option to separate instance and add labels

For you the code may like this:
  - job_name: 'development'
      static_configs:
      - targets: [ '192.168.1.1:9100' ]
        labels:
          service: '1'
      - targets: [ '192.168.1.1:9101' ]
        labels:
          service: '2'

A: Can be like this
  - job_name: 'node'
    static_configs:
    - targets: ['192.168.1.117:9100']
      labels:
        instance: 'linux-ina'
    - targets: ['192.168.1.138:9100']
      labels:
        instance: 'linux-inb'

Tag name can be replaced with instance

A: For different services you should usually vary the job label, so I would suggest duplicating the scrape config with a job_name of service1 for one and service2 for the other.

A: You can use File Based ServiceDiscovery to achieve this. See this Blog Post for more details.

A: You can find information in here - Prometheus Good Config
But I have used these and it worked

  - job_name:  'PostgreSQL-exporter'
    scrape_interval: 60s
    scrape_timeout: 60s
    static_configs:
      - targets: ['localhost:9187']
      - labels:
          name: value-for-the-name


text:
Q: Brightcove Player Issue on IOS I am working on iPhone application where i have included bright cove SDK to play video. I am able to play video but found letter boxing issue around sides of player view(black space on top and side bar). How can i avoid letterboxing around UIView corners? it would be great if you can provide any example or any sample code.I am attaching screenshot for player as well.

A: Get the ratio of the video from the video properties:
video.properties[kBCOVCatalogJSONKeyFLVFullLength][@"frameWidth"];
video.properties[kBCOVCatalogJSONKeyFLVFullLength][@"frameHeight"];

Then adjust the size of your video player view (playbackController.view) to suit the required height. This may involve the view being wider than its parent and clipping of the left and right sides, but will achieve the desired result.


text:
Q: GSM triangulation Could you describe an algorithm of triangulation based on the GSM data.
If you know the coordinates of three towers in latitude/longitude, the signal strengh of each tower, how to find the intersection of the three cercles ?
Due to damping and reflection I am aware that you can never calculate the exact position.

A: Note that this doesn't work very reliably in practice. The measured signal strength depends not only on the distance to the base station, but also on whether you have a clear line of sight to it (and which obstacles the signal will have to punch through otherwise), and potentially on the orientation of the mobile antenna. And nobody says the different base stations transmit with the same power either -- or even with the same power in all directions; around here the antennas usually seem to be mounted on towers in a triangular arrangement, so one would expect the transmission levels to show a similar pattern.
You also need to know whether the power measurement you have is on a linear scale or something else. Whatever it is, there's a scale-dependent transformation to do in order to get something that is roughly proportional to the distance to the base station.
Why not just use GPS?
For the sake of discussion, though, let's suppose that you somehow have a good idea of the ratios of the distance between yourself and each of three power stations. Then:

*

*First convert the lat/long values to a square coordinate system. Latitude lines are orthogonal to longitude lines, but a degree of longitude is shorter than a degree of latitude by a factor of $\cos \varphi$ (where $\varphi$ is the latitude). Convert to kilometers instead.

*Let your unknown position be $(x,y)$ and the known base stations be at $(x_1,y_1)$, $(x_2,y_2)$ and $(x_3,y_3)$. If you know the distance to base station 2 is $f_{12}$ times the distance to base station 1, you get the equation
$$ (x-x_1)^2 + (y-y_1)^2 = \frac{(x-x_2)^2 + (y-y_2)^2}{f_{12}^2} $$
Since the coordinates of the base stations are known, this reduces to a quadratic equation in $x$ and $y$:
$$ (f_{12}^2-1)(x^2+y^2) + bx + cy = d $$
for some coefficients $b, c, d$ which you calculate.

*Do the same thing for the ratio between the distances to base stations 1 and 3. If you subtract an appropriate multiple of one equation from the other, the quadratic terms will cancel out and you're left with a linear equation in $x$ and $y$.

*Do the same thing for the ratio between the distances to 2 and 3. Subtract one of the quadratic equations you've already got, as before, and you get a different linear equation in $x$ and $y$.

*Find the intersection between the two lines.
By doing this procedure in a different order you can actually get three lines to intersect. For numerical stability in case one of the distance ratios is close to $1:1$, you should compute all three lines and then take the intersection between the pair that are closest to orthogonal.


text:
Q: Xcode 8, iOS 10 - "Starting WebFilter logging for process"

    WF: === Starting WebFilter logging for process Test
2016-09-30 08:56:45.458007 Test[616:142557] WF: _userSettingsForUser mobile: {
    filterBlacklist =     (
    );
    filterWhitelist =     (
    );
    restrictWeb = 1;
    useContentFilter = 0;
    useContentFilterOverrides = 0;
    whitelistEnabled = 0;
}
2016-09-30 08:56:45.458437 Test[616:142557] WF: _WebFilterIsActive returning: NO

I am receiving this warning in my debugger in xcode 8, iOS-10, when I using UIWebView Delegate methods to load something. I didn't find any documentation in Apple website about this web filter Active/De-active mode. Though it's not causing any problem in my existing webView functionality even I am running some javascript function in my webView did finished method. But still curious to know more about this new feature.
Any suggestion about this feature will be appreciate.

A: According to Apple, the "Content Security Policy(CSP)" which support in Safari 10 has been enhanced by including version 2.0 of the standard. It seems that this feature includes in iOS 10 as well.
For more information please look here about the CSP levels: https://content-security-policy.com
OR
Check the site with Chrome Developer Tools and you will find most likely a warning like Mixed Content: The page at '...' as loaded over HTTPS, but requested an insecure resource '...'. This content should also be served over HTTPS.

And If you want to remove the message on the XCode's console then, please find the below steps.

*

*Select Product => Scheme => Edit Scheme or use shortcut : CMD + <

*Select the Run option from left side.

*On Environment Variables section, add the variable OS_ACTIVITY_MODE = disable
For more information please find the below GIF representation.

Note : While debug the code in device, please unchecked this option as the NSLog statement do not show in the console.

A: May be it is printing system log. Check that once and try this
1- From Xcode menu open: Product > Scheme > Edit Scheme
2- On your Environment Variables set OS_ACTIVITY_MODE = disable

A: its very simple to solve you have to follow the below process.
1)goto MenuBar and find product menu->Scheme->Edit Scheme->its comes up with pops ->where you select "Run" and then select "Arguments"->then Environment Variables-> after this click on "+" button and there fore put this "OS_ACTIVITY_MODE = disable"
after that this error will gone.


text:
Q: Creating an image element (modifying the DOM) I am currently taking a course on programming and am struggling with one particular question. I believe I know the answer but I would like to actually understand the concept fully.
I'm trying to figure out whether or not using this syntax (below) in jQuery is only creating an image or if it is creating an image and modifying the DOM.
Code:
$(document).ready(function() {

  $('', {
    src: 'images/little-book.png',
    alt: 'New Book',
    title: 'This is a good book to read'
  });

});

When I test this out in the browser (I have an image in an 'images' directory to use), I receive no errors in the console but I don't see anything render either.
Thank you in advance.

A: Your code creates a new element but isn't appended in the DOM Tree.
You just need to append it then you'll see the modified DOM:
$(document).ready(function() {

  $('', { //create new element
    src: 'images/little-book.png',
    alt: 'New Book',
    title: 'This is a good book to read'
  }).appendTo('body'); //append it to the body

});

From the docs:

If the HTML is more complex than a single tag without attributes the actual creation of the elements is handled by the browser's .innerHTML mechanism. In most cases, jQuery creates a new
 element and sets the innerHTML property of the element to the HTML snippet that was passed in. When the parameter has a single tag (with optional closing tag or quick-closing) — $( "" ) or $( "" ), $( "" ) or $( "" ) — jQuery creates the element using the native JavaScript .createElement() function.

A:    $(document).ready(function(){
// ^ "$" = call to the linked jQuery.js file (This is the same as telling the
//browser you want to use "ready" function from the jQuery you linked in your html)

$(document).ready(function(){
  // ^ "(document)" the document(DOM)

$(document).ready(function(){
          // ^ when the entire DOM is considered "ready" as all
          // of the browser requests for resources are satisfied or
          // have received an error.

$(document).ready(function(){
                  // ^ If jQuery is loaded, and the entire DOM and resources have
                  // been resolved, pass the following "function" (your jQuery code)
                  // back into the document for the browser to show/use.
                  // (execute the code within once the page is ready.  This is
                  // where your jQuery typically gets written/executed until you
                  // separate it out and link your larger javascript file where your
                  // jQuery functionality will reside and be linked to your html
                  // document.

Below is what you're telling the browser to do with the HTML/page once the page has been fully prepared for the view.  It's ready and jQuery's been loaded and called on the dollar sign...
$('', {   // Makes an image tag object. give the following attributes

src: 'images/little-book.png',
// Defines the source of the image using current directory
// i.e ("www.websiteAddress.com/IMAGES/LITTLE-BOOK.PNG)

alt: 'New Book',
// Generates the image html element's "alt" value.
// The plain text that displays if the image doesn't load.

title: 'This is a good book to read'
// Gives the image tag a title of "This is a good book to read"

});
// Ends the image object. At this point it's been instantiated (exists)
// and it is a well defined image object to create the html image tag from

Bhojendra's addition of ".appendTo('body');" (removing the semicolon in lieu of a dot and then replacing it at the new end of the script tells jQuery the following. Now that I have instantiated(created) this object, and I have defined it (image element, src where the image is, alt to call it when can't or won't display, and title to define what the title for it will be) I now want to append it to the "body" element.
});

Becomes:
}).appendTo('body');
^once I have finished the element object "", append it to the body element.
NOTE: Using dot notation, if you were to define the "image" element as a variable previously like this:
var imgToInsert =   $('', {
src: 'images/little-book.png',
alt: 'New Book',
title: 'This is a good book to read'
});

NOTE: Your current code for your IMG could just be prefixed with "var varName = " + all your code for your IMG as well.  If you wanted to, you could now write on a separate line "$('body').append(varName);" Where "varName" is the same as what you declared your IMG variable to be named, and you can call it into the plain "append" function, which is "appendTo" in reverse.  The only benefit here being, you could then "append" any variable, not just the object you had immediately declared previously.
Here's the jQuery references, although I think they're a little hard to grasp from a newer coder's point of perception.
append: (http://api.jquery.com/append/)
appendTo: (http://api.jquery.com/appendTo/)


text:
Q: Regex - Match a string pattern I need a regex that will match only strings of this kind
Match these strings:
edo-apple-iphone-5s-i-gold-16

DON'T match these strings:
edo-apple-iphone-5s-i-gold-16-edo-staff-connect-24

The main difference between the 2 strings is either a connect-24 OR handset-24 added to the end of the string
I have written a Regex, but it seems to match both strings:
^edo[a-z1-9\-]*

How do i modify this to not accept if connect-24 OR handset-24 is in the string?

A: The regex that matches the requirements: Not accept if connect-24 OR handset-24 is in the string
^(?:(?!connect-24|handset-24).)*$

DEMO

A: Here is a regular expression that would satisfy the requirement as stated:
.{32,}

Clearly, the strings you want to match are all longer than the ones you don't want to match. This regex matches only those strings that are 32 characters or longer, while edo-apple-iphone-5c-i-yellow-32, the longest non-matching string, has only 31 characters.


text:
Q: Stationary states in quantum mechanics I know that the general one-dimensional Schroedinger equation is given by:
$$-\frac{\hbar^2}{2m} \frac{\partial^2\Psi(x,t)}{\partial x^2} + U(x)\Psi(x,t) = i\hbar \frac{\partial \Psi(x,t)}{\partial t} $$
The source I am using mentions: "If the potential energy function is nonzero, these sinusoidal waves do not satisfy the Schroedinger equation". Why? I thought the reason why the general equation included $U(x)$ was exactly to address this problem.
Then it continues by: "However, we can still write the wave function for state of definite energy $E$ in the following form" $$\Psi(x,t) = \psi(x)e^{iEt/\hbar} $$
I understand that this comes from $$ \Psi(x,t) = Ae^{i(kx - wt)} $$
But why a state of definite energy must have potential energy non-zero?

A: The form $\Psi(x,t)=\psi(x)e^{-iEt/\hbar}$ does not "come" from $Ae^{i(kx-\omega t)}$ but thee from basic ansatz $\Psi(x,t)=\psi(x)\Phi(t)$ used to solve partial differential equations.
The form $\Psi(x,t)=\psi(x)\Phi(t)$ is used to convert the partial differential equation to a pair of ordinary differential equations connected by a separation constant.
Inserting $\Psi(x,t)=\psi(x)\Phi(t)$ into the time-dependent Schrodinger equation produces a result easily rearranged to
\begin{align}
\frac{1}{\psi(x)}\left(-\frac{\hbar^2}{2m}\frac{d^2\psi(x)}{dx^2}+U(x)\psi(x)\right)=\frac{1}{\Phi(t)}\left(i\hbar \frac{d\Phi(t)}{dt}\right)=E
\end{align}
with $E$ the separation constant (to be identified with the energy). It is possible to solve the $\Phi$ equation immediately as it is independent of the potential:
$$
\Phi(t)=e^{-iEt/\hbar}\, ,
$$
from which $\Psi(x,t)=\psi(x)e^{-iEt/\hbar}$ follows, with $\psi(x)$ a solution to the time-independent Schrodinger equation
$$
-\frac{\hbar^2}{2m}\frac{d^2\psi(x)}{dx^2}+U(x)\psi(x)=E\psi(x)\, .
\tag{1}
$$
The form $\Psi(x,t)=\psi(x)e^{-iEt/\hbar}$ thus holds for arbitrary potential $U(x)$ provided $\psi(x)$ satisfies (1).


text:
Q: Go command to get list of keywords or reserved words? In python they have provided command to list the keywords in it by
>>> import keyword
>>> print(keyword.kwlist)
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']

is there a similar way in go?

A: The token package has a function IsKeyword. The code checks the existence of the string  in
var keywords map[string]Token

This var is not exported, unfortunately. But you can build the same map like it is done in the standard lib:
func init() {
    keywords = make(map[string]Token)
    for i := keyword_beg + 1; i < keyword_end; i++ {
        keywords[tokens[i]] = i
    }
}

keyword_beg and keyword_end are constant values that mark beginning and end of the keyword constants. These also are not exported, but you can still use the value (resolved to 60 and 86).
So you convert int values from 60 to 86 to token.Token and then call Token.String. Like this
tokens := make([]token.Token, 0)
for i := 61; i < 86; i++ {
    tokens = append(tokens, token.Token(i))
}
fmt.Println(tokens)


text:
Q: Is It possible to use #if DEBUG constants to execute code in debug mode in Xamarin.Forms? I building an app, I want to use some value for testing purposes only, so I wrote code similar to this:
#if DEBUG
    public const string AndroidCeneamStaticBannerTest = "ca-app-pub-3940256099942544/6300978111";
    public const string AndroidCeneamInterstitialBannerTest = "ca-app-pub-3940256099942544/1033173712";
    public const string AndroidCeneamInterstitialVideoTest = "ca-app-pub-3940256099942544/8691691433";
    public const string AndroidCeneamRewardedVideoTest = "ca-app-pub-3940256099942544/5224354917";
#else

    public const string AndroidCeneamStaticBanner = "ca-app-pub-7822579076265627/3466411993";
    public const string AndroidCeneamInterstitialBanner = "";
    public const string AndroidCeneamInterstitialVideo = "";
    public const string AndroidCeneamRewardedVideo = "";
#endif

now whenever i have debug chosen set at VS2019 the code withing the #if statements remains colored, and the code within the #else statement remains grayed!
well I thought that it would behave like native UWP when you use that code and set VS2019 to Release mode, but in my VS2019 the code within #if Statement remains colored ignoring that I just set the build to release mode, and obviously the code that i was expecting to be colored still grayed.
so my question is the following one: is it possible to execute code in debug mode and execute another code in release mode in Xamarin.Forms??
I would appreciate your help, thanks!!

A: Yes, it is possible. But there are some settings about build directives that you should make in the solution and not just in the projects.


text:
Q: SQLite - Clustered Columnstore Index Is it possible to create a clustered columnstore index (from T-SQL) or anything like it on a SQLite3 db table?
I looked at the 'without rowid' argument however it doesn't look like it quite fills the bill.
I've searched google and stackoverflow with no luck as a side note. Thanks!
I'm working on a windows machine w/ Python 3.6, the SQLite3 library and SQLite Manager if that matters.

A: SQLite always stores data in rows.
The only way to emulate something similar would be to split your tables into single-column tables, which probably makes your queries too complex, and would not be much more efficient.