text:
Q: How to populate the ApplicationDbContext with custom tables and the database with Identity framework tables? I am trying to figure out which is the correct way to populate both sides.
First, I am using the add migration command to populate the database with the identity tables that are already created when the project is created with the commands:
dotnet ef migrations add InitialCreate
dotnet ef database update

Once this is done, I have all the identity framework tables in my database, now I create some custom tables that I want to put into the project, so I use the scaffolding:
dotnet ef dbcontext scaffold --context ApplicationDbContext "Server=localhost\SQLEXPRESS;Database=DarkCrowTest;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o Models -f

The models for the new tables are generated but it also generates a ApplicationDbContext inside the Models folder with all the custom tables and identity tables data.
I am calling this last created context to try to connect to the database a pull some data but I am always getting errors, one of them is:
System.InvalidOperationException: 'The entity type 'Artifact' requires a primary key to be defined. If you intended to use a keyless entity type, call 'HasNoKey' in 'OnModelCreating'. For more information on keyless entity types, see https://go.microsoft.com/fwlink/?linkid=2141943.'

The new application DB context is:
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace DC.Models
{
    public partial class ApplicationDbContext : IdentityDbContext
    {
        public ApplicationDbContext()
        {
        }

        public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
            : base(options)
        {
        }

        public virtual DbSet<Artifact> Artifacts { get; set; } = null!;
        public virtual DbSet<ArtifactSize> ArtifactSizes { get; set; } = null!;
        public virtual DbSet<AspNetRole> AspNetRoles { get; set; } = null!;
        public virtual DbSet<AspNetRoleClaim> AspNetRoleClaims { get; set; } = null!;
        public virtual DbSet<AspNetUser> AspNetUsers { get; set; } = null!;
        public virtual DbSet<AspNetUserClaim> AspNetUserClaims { get; set; } = null!;
        public virtual DbSet<AspNetUserLogin> AspNetUserLogins { get; set; } = null!;
        public virtual DbSet<AspNetUserToken> AspNetUserTokens { get; set; } = null!;
        public virtual DbSet<Dcplayer> Dcplayers { get; set; } = null!;
        public virtual DbSet<Dcvillage> Dcvillages { get; set; } = null!;
        public virtual DbSet<DefensiveForm> DefensiveForms { get; set; } = null!;
        public virtual DbSet<OtherPlayer> OtherPlayers { get; set; } = null!;
        public virtual DbSet<OtherVillage> OtherVillages { get; set; } = null!;
        public virtual DbSet<Vagon> Vagons { get; set; } = null!;

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
                optionsBuilder.UseSqlServer("Server=localhost\\SQLEXPRESS;Database=DarkCrowTest;Trusted_Connection=True;");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Artifact>(entity =>
            {
                entity.HasKey(e => e.ArtifactName);

                entity.ToTable("Artifact");

                entity.Property(e => e.ArtifactName)
                    .HasMaxLength(45)
                    .IsUnicode(false);

                entity.HasMany(d => d.Sizes)
                    .WithMany(p => p.ArtifactNames)
                    .UsingEntity<Dictionary<string, object>>(
                        "ArtifactArtifactSize",
                        l => l.HasOne<ArtifactSize>().WithMany().HasForeignKey("Size").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FK_Multi_ArtifactSize_Artifact"),
                        r => r.HasOne<Artifact>().WithMany().HasForeignKey("ArtifactName").OnDelete(DeleteBehavior.ClientSetNull).HasConstraintName("FK_Multi_Artifact_ArtifactSize"),
                        j =>
                        {
                            j.HasKey("ArtifactName", "Size");

                            j.ToTable("Artifact_ArtifactSize");

                            j.IndexerProperty<string>("ArtifactName").HasMaxLength(45).IsUnicode(false);

                            j.IndexerProperty<string>("Size").HasMaxLength(10).IsUnicode(false);
                        });
            });

            modelBuilder.Entity<ArtifactSize>(entity =>
            {
                entity.HasKey(e => e.Size);

                entity.ToTable("ArtifactSize");

                entity.Property(e => e.Size)
                    .HasMaxLength(10)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<AspNetRole>(entity =>
            {
                entity.HasIndex(e => e.NormalizedName, "RoleNameIndex")
                    .IsUnique()
                    .HasFilter("([NormalizedName] IS NOT NULL)");

                entity.Property(e => e.Name).HasMaxLength(256);

                entity.Property(e => e.NormalizedName).HasMaxLength(256);
            });

            modelBuilder.Entity<AspNetRoleClaim>(entity =>
            {
                entity.HasIndex(e => e.RoleId, "IX_AspNetRoleClaims_RoleId");

                entity.HasOne(d => d.Role)
                    .WithMany(p => p.AspNetRoleClaims)
                    .HasForeignKey(d => d.RoleId);
            });

            modelBuilder.Entity<AspNetUser>(entity =>
            {
                entity.HasIndex(e => e.NormalizedEmail, "EmailIndex");

                entity.HasIndex(e => e.NormalizedUserName, "UserNameIndex")
                    .IsUnique()
                    .HasFilter("([NormalizedUserName] IS NOT NULL)");

                entity.Property(e => e.Email).HasMaxLength(256);

                entity.Property(e => e.NormalizedEmail).HasMaxLength(256);

                entity.Property(e => e.NormalizedUserName).HasMaxLength(256);

                entity.Property(e => e.UserName).HasMaxLength(256);

                entity.HasMany(d => d.Roles)
                    .WithMany(p => p.Users)
                    .UsingEntity<Dictionary<string, object>>(
                        "AspNetUserRole",
                        l => l.HasOne<AspNetRole>().WithMany().HasForeignKey("RoleId"),
                        r => r.HasOne<AspNetUser>().WithMany().HasForeignKey("UserId"),
                        j =>
                        {
                            j.HasKey("UserId", "RoleId");

                            j.ToTable("AspNetUserRoles");

                            j.HasIndex(new[] { "RoleId" }, "IX_AspNetUserRoles_RoleId");
                        });
            });

            modelBuilder.Entity<AspNetUserClaim>(entity =>
            {
                entity.HasIndex(e => e.UserId, "IX_AspNetUserClaims_UserId");

                entity.HasOne(d => d.User)
                    .WithMany(p => p.AspNetUserClaims)
                    .HasForeignKey(d => d.UserId);
            });

            modelBuilder.Entity<AspNetUserLogin>(entity =>
            {
                entity.HasKey(e => new { e.LoginProvider, e.ProviderKey });

                entity.HasIndex(e => e.UserId, "IX_AspNetUserLogins_UserId");

                entity.Property(e => e.LoginProvider).HasMaxLength(128);

                entity.Property(e => e.ProviderKey).HasMaxLength(128);

                entity.HasOne(d => d.User)
                    .WithMany(p => p.AspNetUserLogins)
                    .HasForeignKey(d => d.UserId);
            });

            modelBuilder.Entity<AspNetUserToken>(entity =>
            {
                entity.HasKey(e => new { e.UserId, e.LoginProvider, e.Name });

                entity.Property(e => e.LoginProvider).HasMaxLength(128);

                entity.Property(e => e.Name).HasMaxLength(128);

                entity.HasOne(d => d.User)
                    .WithMany(p => p.AspNetUserTokens)
                    .HasForeignKey(d => d.UserId);
            });

            modelBuilder.Entity<Dcplayer>(entity =>
            {
                entity.ToTable("DCPlayer");

                entity.HasIndex(e => e.Username, "UQ__DCPlayer__536C85E49EEEB029")
                    .IsUnique();

                entity.Property(e => e.Id)
                    .ValueGeneratedNever()
                    .HasColumnName("ID");

                entity.Property(e => e.UserIdentityId)
                    .HasMaxLength(450)
                    .HasColumnName("UserIdentityID");

                entity.Property(e => e.Username)
                    .HasMaxLength(20)
                    .IsUnicode(false);

                entity.HasOne(d => d.UserIdentity)
                    .WithMany(p => p.Dcplayers)
                    .HasForeignKey(d => d.UserIdentityId)
                    .OnDelete(DeleteBehavior.Cascade)
                    .HasConstraintName("FK_USER");
            });

            modelBuilder.Entity<Dcvillage>(entity =>
            {
                entity.ToTable("DCVillage");

                entity.Property(e => e.Id)
                    .ValueGeneratedNever()
                    .HasColumnName("ID");

                entity.Property(e => e.DcplayerId).HasColumnName("DCPlayer_ID");

                entity.Property(e => e.VillageName)
                    .HasMaxLength(40)
                    .IsUnicode(false);

                entity.Property(e => e.Xcoordinate).HasColumnName("XCoordinate");

                entity.Property(e => e.Ycoordinate).HasColumnName("YCoordinate");

                entity.HasOne(d => d.Dcplayer)
                    .WithMany(p => p.Dcvillages)
                    .HasForeignKey(d => d.DcplayerId)
                    .HasConstraintName("FK_TEST");
            });

            modelBuilder.Entity<DefensiveForm>(entity =>
            {
                entity.HasKey(e => e.FormId)
                    .HasName("PK_formID");

                entity.ToTable("DefensiveForm");

                entity.Property(e => e.FormId).HasColumnName("formID");

                entity.Property(e => e.ArtifactName)
                    .HasMaxLength(45)
                    .IsUnicode(false)
                    .HasColumnName("Artifact_Name");

                entity.Property(e => e.CalculatedPt).HasColumnName("CalculatedPT");

                entity.Property(e => e.DcplayerId).HasColumnName("DCPlayer_ID");

                entity.Property(e => e.OtherPlayerId).HasColumnName("OtherPlayer_ID");

                entity.Property(e => e.Pt).HasColumnName("PT");

                entity.HasOne(d => d.ArtifactNameNavigation)
                    .WithMany(p => p.DefensiveForms)
                    .HasForeignKey(d => d.ArtifactName)
                    .OnDelete(DeleteBehavior.Cascade)
                    .HasConstraintName("FK_Artifact_DeffForm");

                entity.HasOne(d => d.Dcplayer)
                    .WithMany(p => p.DefensiveForms)
                    .HasForeignKey(d => d.DcplayerId)
                    .HasConstraintName("FK_DCPlayer_DeffForm");

                entity.HasOne(d => d.OtherPlayer)
                    .WithMany(p => p.DefensiveForms)
                    .HasForeignKey(d => d.OtherPlayerId)
                    .HasConstraintName("FK_OtherPlayer_DeffForm");
            });

            modelBuilder.Entity<OtherPlayer>(entity =>
            {
                entity.ToTable("OtherPlayer");

                entity.HasIndex(e => e.Username, "UQ__OtherPla__536C85E4F81000D4")
                    .IsUnique();

                entity.Property(e => e.Id)
                    .ValueGeneratedNever()
                    .HasColumnName("ID");

                entity.Property(e => e.Alliance)
                    .HasMaxLength(10)
                    .IsUnicode(false);

                entity.Property(e => e.Username)
                    .HasMaxLength(20)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<OtherVillage>(entity =>
            {
                entity.ToTable("OtherVillage");

                entity.Property(e => e.Id)
                    .ValueGeneratedNever()
                    .HasColumnName("ID");

                entity.Property(e => e.OtherPlayerId).HasColumnName("OtherPlayer_ID");

                entity.Property(e => e.VillageName)
                    .HasMaxLength(40)
                    .IsUnicode(false);

                entity.Property(e => e.Xcoordinate).HasColumnName("XCoordinate");

                entity.Property(e => e.Ycoordinate).HasColumnName("YCoordinate");

                entity.HasOne(d => d.OtherPlayer)
                    .WithMany(p => p.OtherVillages)
                    .HasForeignKey(d => d.OtherPlayerId)
                    .HasConstraintName("FK_Village_OtherPlayer");
            });

            modelBuilder.Entity<Vagon>(entity =>
            {
                entity.ToTable("Vagon");

                entity.Property(e => e.Id).HasColumnName("ID");

                entity.Property(e => e.DefensiveFormId).HasColumnName("DefensiveForm_ID");

                entity.Property(e => e.VagonTime).HasColumnType("datetime");

                entity.HasOne(d => d.DefensiveForm)
                    .WithMany(p => p.Vagons)
                    .HasForeignKey(d => d.DefensiveFormId)
                    .HasConstraintName("FK_DeffForm_Vagon");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}

I tried to solve it adding the [Key] data annotation to the custom tables but it will then give me an error with the identity tables.


text:
Q: Cocoa Pods with google calendar api I am following the instructions on the google calendar api for iOS web page.
See link. https://developers.google.com/google-apps/calendar/quickstart/ios?ver=objc#step_2_prepare_the_workspace
When I follow these terminal commands
cat << EOF > Podfile &&
platform :ios, '7.0'
pod 'GoogleAPIClient/Calendar', '~> 1.0.2'
pod 'GTMOAuth2', '~> 1.1.0'
EOF
pod install &&
open QuickstartApp.xcworkspace

I get the following error
[!] The dependency `GoogleAPIClient/Calendar (~> 1.0.2)` is not used in any concrete target.
The dependency `GTMOAuth2 (~> 1.1.0)` is not used in any concrete target.

I am not sure why this is happening. My project has a different name then QuickstartApp but I don't think this is causing the errors.

A: You should probably create the Podfile the way Cocoapods recommends.
Yours should probably look like:
platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
    pod 'GoogleAPIClient/Calendar', '~> 1.0.2'
    pod 'GTMOAuth2', '~> 1.1.0
end

Now run pod install then open you Xcode workspace.
One of the recent changes for Cocoapods was that targets need to be named.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Unix (NFS Error)- 7320 Storage I get the following errors on one of my servers:
NFS op OP_OPEN got error NFS4ERR_DELAY causing recovery action NR_DELAY
NFS op OP_WRITE got error NFS4ERR_STALE causing recovery action NR_STALE
NFS4 error: NFS4ERR_STALE

What kind of error is it? As it is not captured on my Alerts that anything strange is happening?


text:
Q: Retrieving DataGrid Cell value I Have just started learning ASP.Net. Last night i was working on Grid View in which i fill data by directly giving command to database. I haven't defined any template field for my grid and i have set AutoGenerated edit button to true. Data is getting displayed corrrectly but While trying to handle update event i'm facing problem as i'm unable to retrieve cell value for the row i'm updating.
I googled a lot but all the examples for retrieving cell value are based on template field but in my case i'm not defining the columns of the grid at design time.
Please help me.
My Code is below: (GridView1_RowUpdating method is giving empty value when i checked by applying break point)
  private void FillGrid()
        {
            SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=TestDatabase;Integrated security=true;");
            DataTable dt = new DataTable("Student");
            using (SqlDataAdapter adapter = new SqlDataAdapter("select name,age,Fathername,dob from student", con))
            {
                adapter.Fill(dt);
            }
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            FillGrid();
        }

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //Response.Write("RowDataBoundEvent Occured"+" "+e.Row.RowType+"\n");
        }

        protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
        {
            GridView1.EditIndex = -1;
            FillGrid();
        }

        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            GridView1.EditIndex = e.NewEditIndex;
            FillGrid();
        }

        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {

            string name = GridView1.Rows[e.RowIndex].Cells[2].Text;
            string age = GridView1.Rows[GridView1.EditIndex].Cells[3].Text;
            string salary = GridView1.Rows[GridView1.EditIndex].Cells[4].Text;
        }

A: Check out GridViewUpdateEventArgs.OldValues and  GridViewUpdateEventArgs.NewValues.
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
    string name = e.NewValues[2];
    string age = e.NewValues[3];
    string salary = e.NewValues[4];
 }


text:
Q: how to ignore forward slash from django URL in a parameter I am using django version 2.2.5. Below is my urls.py
from django.urls import path, include
from . import views

urlpatterns = [
   path('manifest/', views.home),
   path('manifest/<str:some_id>/', views.manifest),
]

It works fine when some_id does not contain any forward slash(/). E.g. http://127.0.0.1:8000/manifest/name:19.2.4:develop:1/
In the following manifest function from views.py, I am able to get the some_id
def manifest(request, some_id):
     print(some_id)

##prints below:
##[21/Oct/2019 19:36:55] "GET /manifest/name:19.2.4:develop:1 HTTP/1.1" 301 0
##name:19.2.4:develop:1

However, when the some_id contains forward slash in it, I don't get the whole id. E.g., from the above URL if I would replace "develop" with "release/19.2.4" http://127.0.0.1:8000/manifest/name:19.2.4:release/19.2.4:1/
"GET /manifest/name:19.2.4:release/19.2.4:1/ HTTP/1.1" 404 3080

This is because of the forward slash being used as delimiter. Is there any way to ignore this forward slash inside of the some_id parameter? The expectation is to get name:19.2.4:release/19.2.4:1 as some_id in the views.py
Note: The format of a valid some_id is it has 4 parts delimited by ":". e.g.: name:version:branch:num, where only the branch section could have one or more slash(/) in it.

A: You might want to use good ol' re_path
In your case, that'll give
from django.urls import path, re_path, include
from . import views

urlpatterns = [
   path('manifest/', views.home),
   re_path(r'manifest/(?P<some_id>\w+)/', views.manifest),
]

Your URL is structured though, have you tried something like:
path('manifest/<str:name>:<str:version>:<path:branch>:<str:num>/', views.manifest),


text:
Q: Arabic WebRequest C# I am trying to access a website through C# using the WebRequest and the WebResponse object,
I logged on to the site and preserved the cookie to further browse it,
The problem is that the website is arabic and somehow I got a formatted message from the website indicating that my browser does not support arabic.
Perhaps I can add something to the request object to ensure the website that arabic is supported.
This is the code I used, please let me know how to update it:
string formUrl = "http://www.kuwaitlook.com/Ar/Residential.asp";
string formParams = string.Format("Mega={0}", searchTarget);

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(formUrl);
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1);Accept-Language:ar";

req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
req.Headers.Add("Cookie", cookieHeader);

byte[] bytes = Encoding.ASCII.GetBytes(formParams);
req.ContentLength = bytes.Length;

using (Stream os = req.GetRequestStream()) {
    os.Write(bytes, 0, bytes.Length);
}
WebResponse resp = req.GetResponse();

StreamReader streamReader = new StreamReader(resp.GetResponseStream());

using (StreamWriter writer = new StreamWriter("text.xml")) {
    string line;
    while ((line = streamReader.ReadLine()) != null) {
        writer.WriteLine(line);
    }
}

A: Like Mikael suggested try this one:
HttpWebRequest request=(HttpWebRequest)WebRequest.Create("http://www.yourdomain.com");
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1);Accept-Language:ar"

A: Here is how you do it in vb.net:
Dim SW As StreamWriter
Dim ar As System.Text.UTF8Encoding = New System.Text.UTF8Encoding

Request.ContentLength = ar.GetByteCount(your_string)     ' Here
SW = New StreamWriter(Request.GetRequestStream(), ar)    ' And Here
SW.Write(your_string)


text:
Q: Windows 10 Mobile - cannot hide status bar (StatusBar doesn't exist in context) I am trying to hide status bar in my Windows 10 Universal App. In WP 8.1, I was using StatusBar.GetForCurrentView().HideAsync();to hide the status bar, however this won't work in my current project (Monogame, Win10 UAP) - I get "StatusBar not found in the current context" error (yes, I am using Windows.UI.ViewManagement).
Am I doing something wrong, or was this option to remove StatusBar removed? How should I do it in W10M?
Thanks in advance.

A: The trick is that you have to add a reference to the Microsoft Mobile Extension SDK first.
Then the code is the following:
StatusBar statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
await statusBar.HideAsync();

The reference can be added by right clicking the universal project. Select "Add reference". In the Reference Manager dialog select "Windows Universal" on the left. Choose "Extensions" and check the "Microsoft Mobile Extension SDK...".

As this is a universal App it will run on every device, but the API will be available only on mobile Devices (aka Phones) with Windows 10. Therefore feature-detect if this API is available at runtime before you actually call the API. Otherwise it will throw a TypeLoadException at runtime.
Use the Windows.Foundation.Metadata.ApiInformation Namespace to find out if the API is available. (E.g. Method IsTypePresent() .
I recommend working with typeof instead of Strings here, e.g. like this:
var isStatusBarPresent = ApiInformation.IsTypePresent(typeof(StatusBar).ToString());

Learn more about adaptive code here: https://channel9.msdn.com/Series/A-Developers-Guide-to-Windows-10/08


text:
Q: angular controller communication with a service I want to communicate controllers with another.
var module = angular.module("app", []);

module.service("MessageAggregator", function(){
    var service = {};

    service.message = {};

    service.setMessage = function(message){
        service.message = message;
    };

    return service;
    });

    function firstController($scope, MessageAggregator){
        $scope.sendRequest = function(){
            MessageAggregator.setMessage({type: "FeatureSet"});
        };
    }

    function secondController($scope, MessageAggregator){
        $scope.info = MessageAggregator;
        $scope.message = MessageAggregator.message;
    }

I want to use MessageAggregator service data in html view.

        <button ng-click="sendRequest()">Request</button>

info: {{info}}

message: {{message}}

Working code is here jsfiddle

message: {{message}}
  not populated and working

info: {{info}}
 is working

A: You should make your controller in your module
module.controller("firstController", function($scope, MessageAggregator){
    $scope.sendRequest = function(){
        MessageAggregator.setMessage({type: "FeatureSet"});
    };
});

module.controller("secondController", function($scope, MessageAggregator){
    $scope.info = MessageAggregator;
    $scope.message = MessageAggregator.message;
});

A: You need to explicitely add watch listener for MessageAggregator.message object:
$scope.$watch(function() { return MessageAggregator.message; },
  function(newVal, oldVal) { $scope.message = newVal; });

Here is an Example
or you should to change the service.setMessage function as below to preserve message object reference:
service.setMessage = function (message) {
    for (var prop in message) {
        if (message.hasOwnProperty(prop)) {
            service.message[prop] = message[prop];
        }

        for(var prop in service.message){
            if(!message.hasOwnProperty(prop)){
                delete service.message[prop];
            }
        }
    }
};


text:
Q: VBO must be bound after VAO Code:
void render()
{
    glClear(GL_COLOR_BUFFER_BIT);

    GLfloat vertices[6][4] = {
        { 1.0f, 1.0f, 1.0f, 1.0f },
        { 1.0f, 1.0f, 1.0f, 1.0f },
        { 1.0f, 1.0f, 1.0f, 1.0f },

        { 1.0f, 1.0f, 1.0f, 1.0f },
        { 1.0f, 1.0f, 1.0f, 1.0f },
        { 1.0f, 1.0f, 1.0f, 1.0f }
    };

    glUseProgram(shadptr->progGraphics);
    glBindVertexArray(vao_g);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_g);
    glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 6 * 4, vertices, GL_DYNAMIC_DRAW);
    glDrawArrays(GL_TRIANGLES, 0, 6);

    glUseProgram(shadptr->progText);
    glBindVertexArray(vao_t);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_t);
    glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 6 * 4, vertices, GL_DYNAMIC_DRAW);
    glDrawArrays(GL_TRIANGLES, 0, 6);

    SDL_GL_SwapWindow(winptr->window);
}

void set_buffers()
{
    glGenVertexArrays(1, &vao_g);
    glBindVertexArray(vao_g);

    glGenBuffers(1, &vbo_g);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_g);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), nullptr);

    glGenVertexArrays(1, &vao_t);
    glBindVertexArray(vao_t);

    glGenBuffers(1, &vbo_t);
    glBindBuffer(GL_ARRAY_BUFFER, vbo_t);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), nullptr);
}

I have a problem. I don't know why I have to bind vbo after binding vao in render function. When I don't bind vbo, in RenderDoc I have an error "glDrawArrays has generated an error (GL_OUT_OF_MEMORY)" and in mesh output, in VS input I see wrong values or --- value.

A:
I don't know why I have to bind vbo after binding vao in render function"

Because you try to create and initialize the buffer object 's data store by glBufferData and for this the buffer has to be bound.
I recommend to move the code, which creates and initializes the buffer to set_buffers. Then it will be sufficient to bind the vertex array object only, in the function render:
void render()
{
    glClear(GL_COLOR_BUFFER_BIT);

    glUseProgram(shadptr->progGraphics);
    glBindVertexArray(vao_g);
    glDrawArrays(GL_TRIANGLES, 0, 6);

    glUseProgram(shadptr->progText);
    glBindVertexArray(vao_t);
    glDrawArrays(GL_TRIANGLES, 0, 6);

    SDL_GL_SwapWindow(winptr->window);
}

void set_buffers()
{
    ....

    GLfloat vertices[6][4] = {
        { 1.0f, 1.0f, 1.0f, 1.0f },
        { 1.0f, 1.0f, 1.0f, 1.0f },
        { 1.0f, 1.0f, 1.0f, 1.0f },

        { 1.0f, 1.0f, 1.0f, 1.0f },
        { 1.0f, 1.0f, 1.0f, 1.0f },
        { 1.0f, 1.0f, 1.0f, 1.0f }
    };

    glBindBuffer(GL_ARRAY_BUFFER, vbo_g);
    glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 6 * 4, vertices, GL_DYNAMIC_DRAW);

    glBindBuffer(GL_ARRAY_BUFFER, vbo_t);
    glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 6 * 4, vertices, GL_DYNAMIC_DRAW);

    glBindBuffer(GL_ARRAY_BUFFER, 0);
}

I recommend to use glBufferSubData, to change the content of a buffer. This will update the buffer, but doesn't creates and initializes a completely new data store and thus would be much more efficient.


text:
Q: How to create nested child on firebase android [Solved. I solved it myself]
Tips: if you want to access a child in the firebase realtime database for collecting data and then by using that data u store or upload something at that child on the firebase realtime database again, then you can't access it. Either u have to create another child or u must not use that child. (I don't no the actual solution but It works for me)]
I want to create a child under the reference of the user phone number. That child will store one or more childs. These child will be called "serialNo" of the item. And under serialNo child, the item name and amount of piece will store. I want to create like this:

[N: B: I've created this on firebase directly, not by my application.]
But when I put my data object as .setValue(dtObject) the previous one will always be replaced.
"orderNo: 1" child was replaced by "orderNo: 2" child
I also use .updateChildren(dtMap) but everytime previous orderNo child was replaced.
My Code of confirm Fragment(from where I upload):
package com.binarysoftwareltd.airaid;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;

import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

import java.util.HashMap;
import java.util.Map;

public class AddressFragment extends Fragment {
private int orderNo = 1;
private int orderSerial = 0;
private DatabaseReference dbReference, dbr;
private static final String STATE_USER = "user";
private String mUser;
private View oldView;
private TextView numWarning;
private EditText nameField, phoneField, areaField, addressField,
detailsField;
private CardView confirmCV;
private int len;
private String nameOfPerson, phoneNumber, areaName, addressOfOrder,
detailsOfOrder;
private int[] serialNos = new int[100];
private String[] names = new String[100];
private int[] pieces = new int[100];
private String imageUri;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Check whether we're recreating a previously destroyed instance
    if (savedInstanceState != null) {
        // Restore value of members from saved state
        mUser = savedInstanceState.getString(STATE_USER);
    } else {
        // Probably initialize members with default values for a new
instance
        mUser = "NewUser";
    }
}

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    savedInstanceState.putString(STATE_USER, mUser);
    // Always call the superclass so it can save the view hierarchy state
    super.onSaveInstanceState(savedInstanceState);
}

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable
ViewGroup container, @Nullable Bundle savedInstanceState) {
    if (oldView != null) {
        return oldView;
    }
    View v = inflater.inflate(R.layout.fragment_address, container,
false);
    initializeAll(v);
    Bundle bundle = getArguments();
    if (bundle != null) {
        len = bundle.getInt("cValue");
        imageUri = bundle.getString("imgUri");
        serialNos = bundle.getIntArray("mSerialNos");
        names = bundle.getStringArray("mNames");
        pieces = bundle.getIntArray("mPieces");
    }
    confirmCV.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            collectAllData();
            if (!phoneNumber.equals("")) {
                checkOrderSerial();
            } else {
                phoneField.requestFocus();
                Toast.makeText(getContext(), orderSerial,
Toast.LENGTH_SHORT).show();
            }
        }
    });
    oldView = v;
    return v;
}

private void checkOrderSerial() {
dbr=FirebaseDatabase.getInstance().getReference(phoneNumber).
child("currentOrderSerial");
    dbr.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
            Integer value = dataSnapshot.getValue(Integer.class);
            if (value != null)
                orderSerial = value;
        }

        @Override
        public void onCancelled(@NonNull DatabaseError databaseError) {

        }
    });
    showConfirmDialog();
}

private void showConfirmDialog() {
    AlertDialog.Builder alb = new AlertDialog.Builder(getContext());
    alb.setIcon(R.drawable.question);
    alb.setTitle("Confirm");
    alb.setMessage("Are you sure want to order?");
    alb.setPositiveButton(R.string.exit_no, new
DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    alb.setNegativeButton(R.string.exit_yes, new
DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            setOrderSerial();
        }
    });
    AlertDialog ald = alb.create();
    ald.show();
}

private void setOrderSerial() {
    dbr = FirebaseDatabase.getInstance().getReference(phoneNumber);
    if (orderNo <= orderSerial) {
        orderNo = orderSerial;
        orderNo += 1;
    }
    OrderSerial osObject = new OrderSerial(orderNo);
    dbr.setValue(osObject);
    uploadAllData();
}

private void uploadAllData() {
    dbReference =
FirebaseDatabase.getInstance().getReference(phoneNumber).child("orderNo:
"+orderNo);
    DataTemplate dtObject;
    int i;
    for (i = 0; i < len; i++) {
        if (pieces[i] != 0) {
            dtObject = new DataTemplate(names[i],pieces[i]);
            dbReference.child("serialNo:
"+serialNos[i]).setValue(dtObject);
        }
    }
}

private void collectAllData() {
    nameOfPerson = nameField.getText().toString();
    phoneNumber = phoneField.getText().toString();
    areaName = areaField.getText().toString();
    addressOfOrder = addressField.getText().toString();
    detailsOfOrder = detailsField.getText().toString();
}

private void initializeAll(View v) {
    numWarning = v.findViewById(R.id.numWarning);
    nameField = v.findViewById(R.id.nameField);
    phoneField = v.findViewById(R.id.phoneField);
    areaField = v.findViewById(R.id.areaField);
    addressField = v.findViewById(R.id.addressField);
    detailsField = v.findViewById(R.id.detailsField);
    confirmCV = v.findViewById(R.id.confirmCV);
}
}

My OrderSerial Class::
package com.binarysoftwareltd.airaid;

public class OrderSerial {

private int currentOrderSerial;

public OrderSerial() {

}

public OrderSerial(int currentOrderSerial) {
    this.currentOrderSerial = currentOrderSerial;
}

public int getCurrentOrderSerial() {
    return currentOrderSerial;
}

public void setCurrentOrderSerial(int currentOrderSerial) {
    this.currentOrderSerial = currentOrderSerial;
}
}

The XML code of the AddressFragment:
 <?xml version="1.0" encoding="utf-8"?>
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:background="@drawable/app_main_bg"
 android:orientation="vertical">

 <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="10dp">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="15dp"
        android:layout_marginEnd="15dp"
        android:layout_marginTop="120dp"
        android:text="@string/address_fragment_title"
        android:textColor="@color/pureBlack"
        android:textSize="25sp"
        android:textStyle="bold" />

    <TextView
        android:gravity="center"
        android:id="@+id/numWarning"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="15dp"
        android:layout_marginTop="5dp"
        android:layout_marginEnd="15dp"
        android:ellipsize="marquee"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:marqueeRepeatLimit="marquee_forever"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:text="@string/number_warning"
        android:textColor="@color/img_warning"
        android:textSize="15sp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="15dp"
        android:layout_marginEnd="15dp"
        android:layout_marginTop="15dp"
        android:gravity="center_vertical"
        android:weightSum="8"
        android:orientation="horizontal">

        <ImageView
            android:contentDescription="@string/name_field"
            android:layout_width="0dp"
            android:layout_height="35dp"
            android:layout_weight="1"
            android:src="@drawable/ic_person"/>

        <EditText
            android:id="@+id/nameField"
            android:layout_marginStart="5dp"
            android:layout_width="0dp"
            android:layout_weight="7"
            android:layout_height="70dp"
            android:hint="@string/name_field" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="15dp"
        android:layout_marginEnd="15dp"
        android:layout_marginTop="15dp"
        android:gravity="center_vertical"
        android:weightSum="8"
        android:orientation="horizontal">

        <ImageView
            android:contentDescription="@string/phone_field"
            android:layout_width="0dp"
            android:layout_height="35dp"
            android:layout_weight="1"
            android:src="@drawable/ic_phone"/>

        <EditText
            android:id="@+id/phoneField"
            android:layout_marginStart="5dp"
            android:inputType="phone"
            android:layout_width="0dp"
            android:layout_height="70dp"
            android:layout_weight="4"
            android:hint="@string/phone_field" />

        <EditText
            android:id="@+id/areaField"
            android:layout_marginStart="10dp"
            android:layout_width="0dp"
            android:layout_height="70dp"
            android:layout_weight="3"
            android:hint="@string/area_field" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="15dp"
        android:layout_marginEnd="15dp"
        android:layout_marginTop="15dp"
        android:gravity="center_vertical"
        android:weightSum="8"
        android:orientation="horizontal">

        <ImageView
            android:contentDescription="@string/address_fragment_title"
            android:layout_width="0dp"
            android:layout_height="35dp"
            android:layout_weight="1"
            android:src="@drawable/ic_location"/>

        <EditText
            android:id="@+id/addressField"
            android:layout_marginStart="5dp"
            android:layout_width="0dp"
            android:layout_height="70dp"
            android:layout_weight="7"
            android:hint="@string/address_fragment_title" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="15dp"
        android:layout_marginEnd="15dp"
        android:layout_marginTop="15dp"
        android:gravity="center_vertical"
        android:weightSum="8"
        android:orientation="horizontal">

        <ImageView
            android:contentDescription="@string/details_field"
            android:layout_width="0dp"
            android:layout_height="35dp"
            android:layout_weight="1"
            android:src="@drawable/ic_details"/>

        <EditText
            android:id="@+id/detailsField"
            android:layout_marginStart="5dp"
            android:layout_width="0dp"
            android:layout_height="70dp"
            android:layout_weight="7"
            android:hint="@string/details_field" />

    </LinearLayout>

    <androidx.cardview.widget.CardView
        android:id="@+id/confirmCV"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:clickable="true"
        android:focusable="true"
        android:layout_marginStart="15dp"
        android:layout_marginTop="15dp"
        android:layout_marginEnd="15dp"
        app:cardCornerRadius="18dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/card_view_bg"
            android:gravity="center">

            <ImageView
                android:contentDescription="@string/order_now"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:src="@drawable/ic_confirm" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="5dp"
                android:text="@string/order_now"
                android:textColor="@color/pureWhite"
                android:textSize="18sp" />
        </LinearLayout>

     </androidx.cardview.widget.CardView>

 </LinearLayout>

 </ScrollView>

 here my JSON::
 {
 "23" : {
  "currentOrderSerial" : 2,
 "orderNo: 2" : {
   "serialNo: 1" : {
     "name" : "napa Extra",
     "piece" : 200
   }
 }
 }
 }

[I use phone number as primary Identifier for every user. That's why phone numbers must be required.]
Please help to fix this...
Thanks in Advance...


text:
Q: How can I set a WebSphere classloader policy to PARENT_LAST for an app created in Eclipse? Our company is currently using RAD to develop our Java apps, but we're looking to move to Eclipse with the WebSphere Developer Tools. The pilot for our transition is going pretty well, except we're running into a classloader policy issue for new applications that are originally created in Eclipse, not RAD. Our projects that were originally created by RAD are deployed with the correct classloader policy (PARENT_LAST) when published via Eclipse because we originally used the Deployment Descriptor Editor in RAD which set the proper classloader policy in /src/main/application/META-INF/ibmconfig/cells/defaultCell/applications/defaultApp/deployments/defaultApp/deployment.xml. But now with Eclipse & WebSphere Developer Tools, we no longer have the nice Deployment Descriptor Editor UI to create or modify this file for us (apparently it's not included with the WDT plugin).
So, my question then is what is the best way to go about setting this classloader policy? We still need some new apps to have the classloader policy of PARENT_LAST set when we deploy them to our local servers. Our team has though about this a bit and we can see 4 options at the moment.

*

*Open the Admin Console after every publish and change it. This would be a huge pain, and is pretty much not even a real option.

*Change the server profile setting to use a PARENT_LAST classloader policy for all apps. This however is not the case for all the apps at our company, and would not work for all groups.

*Run a jython script after every publish to set the classloader policy. This is slightly better than option 1, but not by much.

*Manually create a deployment.xml file in the same location as the other apps created by RAD with the same structure as the deployment.xml files created by RAD, and modify it as necessary for each app.

Option 4 seems to be the best of the bunch, but it's still a manual process and somewhat error prone. Even if most of our developers can grok this approach for new apps, it would be most ideal if this were a simple one button click type process.
So given the fact that IBM has omitted the Deployment Descriptor Editor from the WDT plugin it would seem as if option 4 is our only hope, but I'll ask once more, is there any other better way to set a WebSphere classloader policy to PARENT_LAST for an app when that app is created in Eclipse? Any help is appreciated, thanks.

A: Well, Eclipse is free, while Rational Application Developer costs about $5,000 per year (per developer). The nice Deployment Editor (which wasn't that nice. It tends to include all sorts of things that aren't needed. Who needs that Derby DataSource defined there, anyway?) is one of the things you have to give up for saving tons of cash on an annual basis.
I'm digressing.
Option (1) is a complete no-no. You don't want to rely on manual steps for deployments; you should strive to automate deployments to the extent possible.
Option (2) might do. I am not sure which flavour of WebSphere you're using, but if you're using the Network Deployment edition, then you can design a WebSphere topology that consists of multiple servers and clusters. You could, theoretically, come up with such a topology whereby PARENT_LAST applications run on a specific server (or cluster) and PARENT_FIRST applications run on another server (or cluster).
You may be able to combine option (2) with a technical initiative to have all of your applications work with PARENT_LAST. This is the recommended approach if your application is using popular third-party libraries that WebSphere happens to use as well (for its own internal purposes). For example, if you're using Commons Lang, then you're already recommended to switch to PARENT_LAST because WebSphere uses its own internal copy of Commons Lang that might conflict with yours.
Option (3) - it's of course better than option (1) but isn't necessarily worse than option (2) if you can get your WebSphere topology right.
Option (4) is harder to implement but I believe it's the best approach overall:

*

*It's a one-time setup effort for each EAR (and for each WAR that exists within the EAR).

*Once it's done, deployment can easily be automated as no extra steps are needed.

*If you're working with a local test environment to test your code, and you're rapidly publishing applications from your workspace into your local test environment, then this approach is the only approach (other than option (2)) that will work for you without extra manual work.

If none works... consider paying $5,000 per year (per user) and get option (5) - use IBM's editor. Or, better off... hire someone to design an Eclipse plugin that will do that for you. Shouldn't take more than a week or two to develop.

A: um nether answer is useful.
Go into WAS console and pick your application; example:
Enterprise Applications > my_application_ear > Class loader AND change the "class loader order and WAR class loader policy"

A: Open the admin console within eclipse click server >> your server >> scroll down and under server infrastructure >> java process management  select class loader >> select new you can change it here


text:
Q: ADO.Net, Parametrized Queries and Plan Caching If I have a desktop application that uses ADO.Net to connect to SQL Server 2008 R2 and uses an ad hoc parametrized query to retrieve data, what happens when two different instances of the app run the query? Does the first call get compiled and the second one use the in-memory version?
Example query:
SqlConnection conn = new SqlConnection(_connectionString);
conn.Open();
string s = "SELECT email, passwd, login_id, full_name " +
  "FROM members WHERE email = @email";
SqlCommand cmd = new SqlCommand(s);
cmd.Parameters.Add("@email", email);
SqlDataReader reader = cmd.ExecuteReader();

I'm noticing slow query performance the first time the query is fired and consecutive calls appear to be fine. I'm just wondering if this is across the board behavior for each instance of the app or if the first time the query is fired from one instance it improves the performance for all instances of the app that use this query.

A: SQL Server will have to analyze the query the first time it gets it, and find a reasonably well-performing execution plan for it.
Once it's done that, the query
SELECT email, passwd, login_id, full_name FROM members WHERE email = @email

and its execution plan are stored in plan cache.
As long as the plan cache has enough room, then any subsequent execution of that exact same query ("same" down to the last comma, space or anything! It must be absolutely the same SQL) will reuse that execution plan from the plan cache.
So yes - the very first time that query is executed (e.g. after a SQL Server restart), a slight delay will be noticeable, but once it's been executed and the query plan is cached, it should perform much better - for all connections to the SQL Server that will use that exact same query.
The requirement for the exact same query also illustrates why it's so bad - also from a performance point of view - to string together your SQL yourself and putting the query values into the actual query text - that way, each query with new values is a new SQL query text and the whole story has to be repeated for every single request. If you're using parametrized queries like you are, then the query remains the same and thus a cached execution plan can be reused - only the parameter values change, but that doesn't affect the query execution plan and the ability to reuse a cached plan

A: I think compilation and plan cache does not matter here (you SQL-request is trivial). More important thing is disk cache. It seems, first time you have physical reads from disk, and next times you have logical reads (from the buffer cache). This disk cache is server wide.
You can try add command
DBCC DROPCLEANBUFFERS

befor you request, to force clean up disk cache. So you can check performance

A: Yes, parametrized query execution plans are cashed and reused for every connection until they will be pushet from the cashe. You can check if the plan was recompiled in Profiler with event SP:Recompile. More about it you can read in MSDN Article Execution Plan Caching and Reuse
But, in your case, I think, more significant role plays cashing of the data. As long as you execute the query the first time data pages are loaded into RAM and stay there until they will be pushed from the cashe. It can affect execution time of following queries if they either pass the same value to @email parameter or you don't have index on field email (or both).


text:
Q: How to store Non-serializable object to sqlite in android ? or also you can suggest any another way to store nonserializable arralylist objest I was to store nonserializable object to sqlite in android. but its give me error of object is not Serializable. i just want to know, is that possible or any another way to store this objects ?
Thanks in advance.

A: Go through below,
class MyArrayList<BlutoothGattService> extends ArrayList<BlutoothGattService> implements Serializable{

}

Then use this class instead of ArrayList and you can easily Serialize object of this class.
I think it will help.


text:
Q: google calendar error handling I'm using V3 of the google calendar api to sync with a calendar in a php based application.
I use this code to delete events on the google calendar.
$delJson = json_decode($service->events->delete('primary', $gcal_id), true);

Everything runs smoothly if the google calendar id is found.
However, the entire process STOPS and displays a blank page if there is no match found between $gcal_id and an actual google calendar id.
At the very least, I want the process to continue without coming to complete halt.
I imagine the code would logically be something like this but I can't find any documentation on it.
$delJson = json_decode($service->events->delete('primary', $gcal_id), true);

if ($response == error) { continue }

A: I'm surprised this one has not been answered here, or much of anywhere else; I had the same problem and see it has been asked numerous times without much help answering it.
The V3 PHP api uses exceptions and the one you need to handle for this is probably the same as for an update(), using a Google_Service_Exception similar to below:
try {
    $cal->events->update($this->calName,$e,$event);
} catch (Google_Service_Exception $e ) {
    echo "Caught Google_Service_Exception:";
    print_r($e);
}

Note, if you have a get, update, you'd need to put the try around the get as well as the update.  There are several other exception types in the API and presumably those as well can cause uglies for your website's visitors if not handled.  Google_Auth_Exception, Google_IO_Exception, Google_Cache_Exception.  So maybe best just to put a generic exception catcher around google API code unless you've studied the particular case to be sure you handle various possible errors.


text:
Q: Problem running AWS Lambda function with Sharp library I created a lambda function through the aws-amplify CLI by following an AWS workshop (https://amplify-workshop.go-aws.com/70_generating_thumbnails/10_creating_a_photo_processor_lambda.html).  Seems that there is a problem with conflicting versions of Node.js somewhere.
I believe that the sharp library is the problem, so I have tried to change the version to the latest to see if that would do anything, but it did not fix the issue.
CloudWatch error log:
module initialization error: Error
was compiled against a different Node.js version using
NODE_MODULE_VERSION 67. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/var/task/node_modules/sharp/lib/constructor.js:10:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)

I believe there is a simple fix, but I am unsure where the source of the problem lies.  Thank you.

A: Use your aws lambda node version when installing sharp.
rm -rf node_modules/sharp
npm install --arch=x64 --platform=linux --target=10.4.1 sharp

A: Looks like you have built your node_modules using lambda incompatible version of Node.js. Lambda only supports Node.js 6.10 and 8.10.
Try changing your local node version to 8.10, remove node_modules, npm install, bundle folder including node_modules and upload to lambda. This should work.

A: The following worked for me:
npm_config_arch=x64 npm_config_platform=linux npm install sharp

For some reason, arguments did not work.

A: I know this question is old. I had the same trouble and discovered the issue is when we build the project (layer) in windows machine and try to run it in lambda. The dependencies built in Linux and Windows environments are different.
Try building & creating the zip file in a linux environment. That should fix your issue.


text:
Q: Issue with Email not sending using Mandrill -> Deploying to Heroku I am setting up my AacionMailer and in all honesty have never done this before.. I have watched video after video and read post after post burt to no avail...
the log error I am catching through PapertrailApp is Net::SMTPServerBusy (454 4.7.1 : Relay access denied ):
I can not seem to get mandrill to send the confirmation email to me to sign into the app. I am using locahost:3000 for development and just catching the links to confirm and thats working fine but for production... kinda need this to work..
this is my production.rb file:
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_url_options = { :host => 'patrolprorms.heroku.com' }

  config.action_mailer.smtp_settings = {
  :address => "smtp.mandrillapp.com",
  :port => 25,
  :user_name => ENV['MANDRILL_USERNAME'],
  :password => ENV['MANDRILL_API_KEY'],
  :authentication => 'plain',
  :enable_starttls_auto => true,
  :openssl_verify_mode  => 'none'
}

This is my development.rb file
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_url_options = { :host => 'localhost:3000' }

  config.action_mailer.smtp_settings = {
  :address => "smtp.mandrillapp.com",
  :port => 465,
  :user_name => ENV['MADRILL_USERNAME'],
  :password => ENV['MANDRILL_API_KEY'],
  :authentication => 'plain',
  :enable_starttls_auto => true,
}

this was the error I received when I attempted to use port 2525
Net::SMTPServerBusy (421 4.7.0 relay-7.us-east-1.relay-prod Error: too many errors ):
Using port 465 i get this error
at=error code=H12 desc="Request timeout" method=POST path="/users/confirmation" host=patrolprorms.herokuapp.com request_id=8dfa122b-ab01-4dbc-97d6-0e7640014f08 fwd="68.144.5.70" dyno=web.1 connect=1ms service=30001ms status=503 bytes=0

Based on the errors i think im making some progress??? or loosing more hair.. not sure which just yet.
this is the log file generated by heroku --tail (I don't even have a clue where to begin with this my apologies for the length. PLEASE DONT HESITATE TO COMMENT TO ASK TO SEE MORE OF MY FILES!!!
2015-08-05T03:13:10.057799+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms state=ready
2015-08-05T03:13:10.061201+00:00 app[web.2]: Started POST "/users/confirmation" for 68.144.5.70 at 2015-08-05 03:13:10 +0000
2015-08-05T03:13:10.058707+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=1ms state=active
2015-08-05T03:13:10.080546+00:00 app[web.2]: Processing by Devise::ConfirmationsController#create as HTML
2015-08-05T03:13:10.097976+00:00 app[web.2]:   User Load (1.2ms)  SELECT  "users".* FROM "users" WHERE "users"."email" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["email", "swilson@taurenltd.com"]]
2015-08-05T03:13:10.080589+00:00 app[web.2]:   Parameters: {"utf8"=>"✓", "authenticity_token"=>"KllMOhJfb7tOE4s2XaKAB5XMl7Mnb2nwaz1uyY5lyKBzUBSkaEeBW0Kbwvw+DfVVJzzErJYh1Td3LjKBFWBU1w==", "user"=>{"email"=>"swilson@taurenltd.com"}, "commit"=>"Resend confirmation instructions"}
2015-08-05T03:13:10.092454+00:00 app[web.2]:   User Load (1.7ms)  SELECT  "users".* FROM "users" WHERE "users"."unconfirmed_email" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["unconfirmed_email", "swilson@taurenltd.com"]]
2015-08-05T03:13:10.324637+00:00 app[web.2]:   User Load (1.4ms)  SELECT  "users".* FROM "users" WHERE "users"."confirmation_token" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["confirmation_token", "b7f3914b2e94209c6c7c02ee0d43cfab3a5bdd1e96d49611789eecf8989cb1e9"]]
2015-08-05T03:13:10.331436+00:00 app[web.2]:   SQL (1.0ms)  UPDATE "users" SET "confirmation_token" = $1, "confirmation_sent_at" = $2, "updated_at" = $3 WHERE "users"."id" = $4  [["confirmation_token", "b7f3914b2e94209c6c7c02ee0d43cfab3a5bdd1e96d49611789eecf8989cb1e9"], ["confirmation_sent_at", "2015-08-05 03:13:10.325301"], ["updated_at", "2015-08-05 03:13:10.327429"], ["id", 3]]
2015-08-05T03:13:10.344986+00:00 app[web.2]:   Rendered devise/mailer/confirmation_instructions.html.erb (1.6ms)
2015-08-05T03:13:10.326623+00:00 app[web.2]:    (0.7ms)  BEGIN
2015-08-05T03:13:10.334462+00:00 app[web.2]:    (1.9ms)  COMMIT
2015-08-05T03:13:10.678128+00:00 app[web.2]:
2015-08-05T03:13:10.678134+00:00 app[web.2]: Devise::Mailer#confirmation_instructions: processed outbound mail in 340.9ms
2015-08-05T03:13:11.058190+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=1000ms state=active
2015-08-05T03:13:12.058224+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=2000ms state=active
2015-08-05T03:13:13.058225+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=3000ms state=active
2015-08-05T03:13:14.058223+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=4000ms state=active
2015-08-05T03:13:15.058135+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=5000ms state=active
2015-08-05T03:13:16.058333+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=6001ms state=active
2015-08-05T03:13:17.058342+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=7000ms state=active
2015-08-05T03:13:18.058303+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=8000ms state=active
2015-08-05T03:13:19.058618+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=9001ms state=active
2015-08-05T03:13:20.058189+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=10000ms state=active
2015-08-05T03:13:21.058132+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=11000ms state=active
2015-08-05T03:13:22.058166+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=12000ms state=active
2015-08-05T03:13:23.058203+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=13000ms state=active
2015-08-05T03:13:24.058232+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=14000ms state=active
2015-08-05T03:13:25.082651+00:00 heroku[router]: at=info method=POST path="/users/confirmation" host=patrolprorms.herokuapp.com request_id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 fwd="68.144.5.70" dyno=web.2 connect=1ms service=15025ms status=500 bytes=1755
2015-08-05T03:13:25.059345+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=15001ms state=timed_out
2015-08-05T03:13:25.073324+00:00 app[web.2]:
2015-08-05T03:13:25.073336+00:00 app[web.2]: Rack::Timeout::RequestTimeoutError (Request waited 6ms, then ran for longer than 15000ms):
2015-08-05T03:13:25.073338+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/protocol.rb:155:in `select'
2015-08-05T03:13:25.073339+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/protocol.rb:155:in `rescue in rbuf_fill'
2015-08-05T03:13:25.073340+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/protocol.rb:152:in `rbuf_fill'
2015-08-05T03:13:25.073342+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/protocol.rb:134:in `readuntil'
2015-08-05T03:13:25.073343+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/protocol.rb:144:in `readline'
2015-08-05T03:13:25.073344+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/smtp.rb:932:in `recv_response'
2015-08-05T03:13:25.073345+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/smtp.rb:555:in `block in do_start'
2015-08-05T03:13:25.073346+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/smtp.rb:942:in `critical'
2015-08-05T03:13:25.073348+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/smtp.rb:555:in `do_start'
2015-08-05T03:13:25.073349+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/net/smtp.rb:520:in `start'
2015-08-05T03:13:25.073351+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
2015-08-05T03:13:25.073352+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:2141:in `do_delivery'
2015-08-05T03:13:25.073353+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:236:in `block in deliver'
2015-08-05T03:13:25.073355+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.3/lib/action_mailer/base.rb:543:in `block in deliver_mail'
2015-08-05T03:13:25.073356+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `block in instrument'
2015-08-05T03:13:25.073358+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
2015-08-05T03:13:25.073359+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `instrument'
2015-08-05T03:13:25.073360+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.3/lib/action_mailer/base.rb:541:in `deliver_mail'
2015-08-05T03:13:25.073361+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/mail-2.6.3/lib/mail/message.rb:236:in `deliver'
2015-08-05T03:13:25.073362+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.3/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
2015-08-05T03:13:25.073363+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/lib/devise/models/authenticatable.rb:176:in `send_devise_notification'
2015-08-05T03:13:25.073365+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/lib/devise/models/confirmable.rb:102:in `send_confirmation_instructions'
2015-08-05T03:13:25.073366+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/lib/devise/models/confirmable.rb:117:in `block in resend_confirmation_instructions'
2015-08-05T03:13:25.073367+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/lib/devise/models/confirmable.rb:211:in `pending_any_confirmation'
2015-08-05T03:13:25.073369+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/lib/devise/models/confirmable.rb:116:in `resend_confirmation_instructions'
2015-08-05T03:13:25.073370+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/lib/devise/models/confirmable.rb:265:in `send_confirmation_instructions'
2015-08-05T03:13:25.073371+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/app/controllers/devise/confirmations_controller.rb:9:in `create'
2015-08-05T03:13:25.073372+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
2015-08-05T03:13:25.073373+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/abstract_controller/base.rb:198:in `process_action'
2015-08-05T03:13:25.073375+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_controller/metal/rendering.rb:10:in `process_action'
2015-08-05T03:13:25.073376+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
2015-08-05T03:13:25.073377+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'
2015-08-05T03:13:25.073378+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'
2015-08-05T03:13:25.073379+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:553:in `block (2 levels) in compile'
2015-08-05T03:13:25.073380+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
2015-08-05T03:13:25.073381+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
2015-08-05T03:13:25.073382+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:88:in `run_callbacks'
2015-08-05T03:13:25.073383+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/abstract_controller/callbacks.rb:19:in `process_action'
2015-08-05T03:13:25.073384+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_controller/metal/rescue.rb:29:in `process_action'
2015-08-05T03:13:25.073385+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
2015-08-05T03:13:25.075049+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `block in instrument'
2015-08-05T03:13:25.075051+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
2015-08-05T03:13:25.075053+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `instrument'
2015-08-05T03:13:25.075054+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
2015-08-05T03:13:25.075055+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
2015-08-05T03:13:25.075056+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.3/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
2015-08-05T03:13:25.075058+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/abstract_controller/base.rb:137:in `process'
2015-08-05T03:13:25.075059+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionview-4.2.3/lib/action_view/rendering.rb:30:in `process'
2015-08-05T03:13:25.075060+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_controller/metal.rb:196:in `dispatch'
2015-08-05T03:13:25.075061+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
2015-08-05T03:13:25.075076+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_controller/metal.rb:237:in `block in action'
2015-08-05T03:13:25.075077+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:76:in `call'
2015-08-05T03:13:25.075078+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
2015-08-05T03:13:25.075080+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:45:in `serve'
2015-08-05T03:13:25.075081+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/mapper.rb:49:in `serve'
2015-08-05T03:13:25.075082+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:43:in `block in serve'
2015-08-05T03:13:25.075083+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:30:in `each'
2015-08-05T03:13:25.075084+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:30:in `serve'
2015-08-05T03:13:25.075087+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:821:in `call'
2015-08-05T03:13:25.075088+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075091+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
2015-08-05T03:13:25.075092+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075094+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/rack/browser_monitoring.rb:23:in `traced_call'
2015-08-05T03:13:25.075095+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075096+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
2015-08-05T03:13:25.075097+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
2015-08-05T03:13:25.075099+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
2015-08-05T03:13:25.075100+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075101+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/etag.rb:24:in `call'
2015-08-05T03:13:25.075102+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075103+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/conditionalget.rb:38:in `call'
2015-08-05T03:13:25.075105+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075106+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
2015-08-05T03:13:25.075108+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075109+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
2015-08-05T03:13:25.075110+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075111+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/flash.rb:260:in `call'
2015-08-05T03:13:25.075116+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075148+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in `context'
2015-08-05T03:13:25.075150+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in `call'
2015-08-05T03:13:25.075151+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075152+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/cookies.rb:560:in `call'
2015-08-05T03:13:25.075154+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075155+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.3/lib/active_record/query_cache.rb:36:in `call'
2015-08-05T03:13:25.075156+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075157+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
2015-08-05T03:13:25.075159+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075160+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
2015-08-05T03:13:25.075161+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:84:in `run_callbacks'
2015-08-05T03:13:25.075162+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2015-08-05T03:13:25.075163+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075165+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
2015-08-05T03:13:25.075166+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075167+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
2015-08-05T03:13:25.075168+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075169+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2015-08-05T03:13:25.075170+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075171+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/railties-4.2.3/lib/rails/rack/logger.rb:38:in `call_app'
2015-08-05T03:13:25.075172+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `block in call'
2015-08-05T03:13:25.075173+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2015-08-05T03:13:25.075175+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:26:in `tagged'
2015-08-05T03:13:25.075176+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `tagged'
2015-08-05T03:13:25.075177+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `call'
2015-08-05T03:13:25.075178+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075179+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2015-08-05T03:13:25.075180+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075182+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'
2015-08-05T03:13:25.075183+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075185+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
2015-08-05T03:13:25.068901+00:00 app[web.2]:
2015-08-05T03:13:25.075186+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.068905+00:00 app[web.2]: Sent mail to swilson@taurenltd.com (14390.5ms)
2015-08-05T03:13:25.068972+00:00 app[web.2]: Date: Wed, 05 Aug 2015 03:13:10 +0000
2015-08-05T03:13:25.068974+00:00 app[web.2]: From: admin@patrolprorms.com
2015-08-05T03:13:25.068975+00:00 app[web.2]: Reply-To: admin@patrolprorms.com
2015-08-05T03:13:25.068976+00:00 app[web.2]: To: swilson@taurenltd.com
2015-08-05T03:13:25.075187+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.3/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2015-08-05T03:13:25.075188+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.068978+00:00 app[web.2]: Message-ID: <55c17f46a6750_33fcc653f6490439a0@f547e1bc-2195-4acf-aa76-162e2f3c820a.mail>
2015-08-05T03:13:25.075189+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/static.rb:116:in `call'
2015-08-05T03:13:25.075190+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.068979+00:00 app[web.2]: Subject: Confirmation instructions
2015-08-05T03:13:25.075195+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
2015-08-05T03:13:25.068980+00:00 app[web.2]: Mime-Version: 1.0
2015-08-05T03:13:25.075213+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075215+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-timeout-0.2.4/lib/rack/timeout.rb:108:in `call'
2015-08-05T03:13:25.075216+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.068981+00:00 app[web.2]: Content-Type: text/html;
2015-08-05T03:13:25.075217+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/railties-4.2.3/lib/rails/engine.rb:518:in `call'
2015-08-05T03:13:25.075219+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/railties-4.2.3/lib/rails/application.rb:165:in `call'
2015-08-05T03:13:25.075220+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/newrelic_rpm-3.11.0.283/lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
2015-08-05T03:13:25.075221+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
2015-08-05T03:13:25.075222+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'
2015-08-05T03:13:25.075223+00:00 app[web.2]:   vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'
2015-08-05T03:13:25.075225+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2015-08-05T03:13:25.075226+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2015-08-05T03:13:25.075232+00:00 app[web.2]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2015-08-05T03:13:25.075234+00:00 app[web.2]:
2015-08-05T03:13:25.075235+00:00 app[web.2]:
2015-08-05T03:13:25.076101+00:00 app[web.2]: source=rack-timeout id=2e30bfc7-6b34-4a87-872b-438c09f9cf71 wait=6ms timeout=15000ms service=15018ms state=completed
2015-08-05T03:13:25.068985+00:00 app[web.2]:  charset=UTF-8
2015-08-05T03:13:25.068986+00:00 app[web.2]: Content-Transfer-Encoding: 7bit
2015-08-05T03:13:25.068987+00:00 app[web.2]:
2015-08-05T03:13:25.068988+00:00 app[web.2]: <p>Welcome swilson@taurenltd.com!</p>
2015-08-05T03:13:25.068990+00:00 app[web.2]:
2015-08-05T03:13:25.068991+00:00 app[web.2]: <p>You can confirm your account email through the link below:</p>
2015-08-05T03:13:25.068992+00:00 app[web.2]:
2015-08-05T03:13:25.068994+00:00 app[web.2]: <p><a href="http://patrolprorms.heroku.com/users/confirmation?confirmation_token=6y3Hi7GpaQCvsme54C4_">Confirm my account</a></p>
2015-08-05T03:13:25.068995+00:00 app[web.2]:
2015-08-05T03:13:25.069753+00:00 app[web.2]: Completed 500 Internal Server Error in 14989ms (ActiveRecord: 8.8ms)
Any help will be greatly appreciated to resolve this!

A: So when you change the port to 2525, you're connecting to Mandrill's servers but getting errors. "Too many errors" means your server is hitting one kind of error (usually authentication-related), but continuing to try to send in spite of those errors. Then Mandrill is throttling the connection to avoid having continuous connections from servers that aren't fixing the things that are causing errors in the sending process.
To further debug, double check that your Mandrill credentials in ENV['MANDRILL_APIKEY'] are correct, then add the following to your environment files to perform deliveries and raise delivery errors if there are any:
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

What that will do is make ActionMailer not silently ignore errors, so depending on how you have this set up and which environment you're testing in, there's a risk of exposing those errors to your end users. But it will allow you to see what's actually being written to the SMTP connection to troubleshoot further. You'll need to restart your app before trying to send again.


text:
Q: Constructing particular invariant subspaces Suppose $Z$ is an endomorphism of an $N$-dimensional complex vector space $V$, and that $U \subset V$ is a $Z$-invariant subspace of codimension $M$. Suppose also that $Z$ admits a cyclic vector $\phi \in V$.
Now the minimal polynomial of $Z$ is a degree $N$ polynomial $f$ which factorizes as $f = g h$, where $h$ is the minimal polynomial of $Z\mid_U$, and $g$ has degree $M$.
Then $\ker h(Z) = U$, whilst $\ker g(Z) = W$ is another invariant subspace, of dimension $M$, which I am interested in. My question is: is there any other way to construct the space $W$, without mentioning minimal polynomials, and without making further assumptions about coprimality of $g,h$ or anything like that?
(In particular, note that as $g,h$ are not necessarily coprime, we cannot characterize $W$ by thinking about a $Z$-invariant complement to $U$.)


text:
Q: SVN issue with tag and branches I had check out code from tag module from my project by mistake and also had done many changes in tag module. I want to get the same code changes done in tag module to branches module can any one help with these.
Project Structure:
^/project
     /tags
     /branches
     /trunk

I had check out from tags and done many changes. I need all the changes to the branches module to commit to the svn branches module.

A: As far as I understand your question you got at least two options:

*

*Commit your changes in the local working copy. The second step than is to merge the changes form ^/project/tags to ^/project/branches (see Chapter 4 of the SVN Book)

*Do a checkout of ^/project/branches in another directory. Now copy your modified files from your tag-working copy to the branches-working copy. Now you could commit your branches-working copy. Instead of copying you could also use some merge tool.


text:
Q: Creating an API that reads text in and uses it SOLVED (see below)
I'm trying to create an API so that I can read in text (from a word document) and have the bot in botpress respond with a section of that text.
I'm confused about a couple of things:

*

*What structure should my API follow (what file should functions go into and how can I connect them, OR, can I just put in the function in the main app.js file)

*How do I call the section I want of that word document so that the bot can respond with it?
As you can see, I can call different elements in the array (doing {{session.response.0}} and the bot will respond with Tony On enter or {{session.response.1}} "Lisa".
I only have one app.js file in my api structure but no other ones.
This is my api file (app.js)
    var express =  require("express");
    var fs = require('fs');
    var app = express();
    var port = process.env.PORT || 3002;

    app.get("/url", (req, res, next) =>{
       res.json(["Tony", "Lisa", "Michael","Ginger","Food"]);
    });

    fs.readFile('/home/user/Desktop/test/doc.html', 'utf8', function(err, contents) {
        res.json(contents);
    });

    app.listen(port, () => {
       console.log("Server running on port: " + port);
    });

This is my action file (aka the thing that calls/links the api to botpress):
const axios = require('axios')

/**
 * @title testApi
 * @category Test
 * @author test
 */
const testApi = async () => {
  // We call the test API
  const { data } = await axios.get('http://localhost:3002/url/')

  // We assign the response to the session variable so we can use it later
  session.response = data
}

// Actions are async, so make sure to return a promise
return testApi()

SOLVED
EDIT: FOUND A TEXT READER (https://github.com/dbashford/textract)

A: Used the 'textract' document reader: https://github.com/dbashford/textract


text:
Q: Calculating the Difference between 2 numbers in objective-c I know a similar question has been asked before with C#
Difference between 2 numbers
But I need to know if objective-c provides some function to find the difference between 2 numbers, (2 NSIntegers, to be specific)
For example the difference between:
100 and 25 is 75
-25 and 100 is 125
100 and -25 is also 125
-100 and -115 is 15
//I know I'm using the same example as the previous
Any help is very much appreciated

A: I think basic math is something that every programming language does: abs(num1 - num2) will work.

A: Remember that abs() works for integers and will automatically round any non-integer arguments in addition to performing the absolute value function. My programs tend to be full of fractional data so I end up using fabs() a lot.


text:
Q: Combining two reference variables Is it somehow possible to "glue" two reference variables?
For example
$more = &$first.':'.&$second;

Using this, i receive a syntax error, an unexpected &.
Full code
$numOf = isset($_GET['numof']) ? $_GET['numof'] : 'x';

if($numOf == 1) {

$more = &$first;

} else if($numOf == 2) {

$more = &$first.':'.&$second;

} else {

$more = '';

}

$results = array(); // array with results from database

foreach($results as $res) {

$first = $res[0];
$second = $res[1];

echo $more.$res[3];

}

A: One thing you can do is the following :
$ar = array(&$first, &$second);
$more = implode(":", $ar);

A: You should use a Closure to achieve what you want. Indeed, you need PHP 7(Maybe 5.6, can't tell as I can't test) in order to achieve desired result. Here's an example:
<?php
$first = "a";
$second = "b";
$more = function(){ global $first,$second; return $first.$second; };

echo $more()."<br>"; // This will output ab
$first = "b";
echo $more(); // This will output bb

A: not directly, at least not that i know of.
what you could do is create a class with a method that automatically combines the values. if you only want string output, you can use the magic method __tostring, so you can use the class directly:
class combiner
{
    private $a;
    private $b;
    public function __construct(&$a, &$b)
    {
        $this->a = &$a;
        $this->b = &$b;
    }
    public function __tostring() {
        return $this->a.":".$this->b;
    }
}

$ta = "A";
$tb = "B";
$combined = new combiner($ta, $tb);
echo $combined; //A:B
$ta = "C";
echo $combined; //C:B

A: You can get your required result by:
<?php

function more($first, $second){
    if(!empty($_GET['numof'])){
        if($_GET['numof']==1)
            return $first;
        elseif($_GET['numof']==2)
            return $first.':'.$second
    }
    return '';
}

$results = array(); // array with results from database

foreach($results as $res) {
    $first = $res[0];
    $second = $res[1];
    echo more($first, $second).$res[3];
}


text:
Q: Accessing custom objects field when binding data I am trying to bind some data to a listview and I am dealing with the following issue:
My object type is CartItem which has a product field and a Quantity field.
Quantity is just a integer, but the Product is also a model which has a long ID, string ImageUrl and a bunch of other fields.
I am trying to bind the data inside the Product to my listview like this:
<Image Grid.Column="0" Grid.RowSpan="2" Source="{Binding CartItem.Product.Image}">

But it's not working.
Is there a way I can access this via XAML file or I must write some explicit code?
[EDIT]:
protected override void OnAppearing()
{
    var stack = Navigation.NavigationStack;

    MainPage mainPage = (MainPage)stack[0];

    List<CartItem> cartList = mainPage.cart;

    //DependencyService.Get<IMessage>().LongAlert(cartList[0].product.Image);

    BindingContext = cartList;

    CartListView.ItemsSource = cartList;

    base.OnAppearing();
}

FIXED WITH:
<Image Grid.Column="0" Grid.RowSpan="2" Source="{Binding product.Image}"

A: if your ItemsSource is a List<CartItem>, then each element in your list is an instance of CartItem, therefore the binding expression should be
Source="{Binding Product.Image}"

also note that in your commented out example, you are using "p"roduct instead of "P"roduct - be sure you use the one that matches the naming of your property


text:
Q: Android: View crashes when I have two EditText boxes with @+id defined in the xml Another newbie question here.  I'm trying to create a form which takes several text input fields from the user, however my view keeps crashing/failing to load with the following error reported in the log:

Window already focused, ignoring focus gain of:com.android.internal.view.IInputMethodClient$Stub$Proxy@628a9148

This is what my xml looks like (this crashes)
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
android:layout_height="wrap_content">"
<LinearLayout
    android:orientation="vertical"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:layout_gravity="top">
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Please enter contact details\n\nName:"/>
    <EditText
        android:id="@+id/name"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:inputType="textPersonName"
        android:maxLength="30"
        android:maxLines="1"
        android:hint="@string/compose_name"></EditText>
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="\nSurname:"/>
    <EditText
        android:id="@+id/surname"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
            android:inputType="textPersonName"
            android:layout_below="@id/name"
            android:maxLength="30"
            android:maxLines="1"
            android:hint="@string/compose_surname"></EditText>-->
       <Button
            android:id="@+id/new_contact_button"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/submit" />

</LinearLayout>
</ScrollView>

However if I remove just the line:
android:id="@+id/surname"

It works (well at least it loads the view, of course I can't access the content in the EditText field without creating an id for it).
The view also fails if I add @+id tags to both the TextView fields (but works if I add only one).
What's going on here?  I thought you should be able to label multiple view fields in your UI (all the examples in my book let me do this)?
I'm using NetBeans to develop on.
EDIT: Adding Javacode:
package org.me.savingsdepositrecord;
import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnKeyListener;
import android.widget.Button;
import android.widget.EditText;

public class NewContact extends Activity
    implements OnClickListener, View.OnKeyListener {
//private EditText nameField;
//private String name;
private Button submitButton;
EditText nameField = null;
EditText surnameField = null;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.new_contact);

    nameField = (EditText) findViewById(R.id.name);
    nameField.setOnKeyListener(this);

    surnameField = (EditText) findViewById(R.id.surname);

    submitButton = (Button) findViewById(R.id.new_contact_button);

    // Set up click listeners for all the buttons
    submitButton.setOnClickListener(this);
}

@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
    if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
        (keyCode == KeyEvent.KEYCODE_ENTER)) {
            String name = nameField.getText().toString();
            String surname = surnameField.getText().toString();
            // TODO: Save Nickname setting (strNicknameToSave)
            return true;
    }
    return false;
}

public void onClick(View v) {
    switch (v.getId()) {
    case R.id.new_contact_button:
        Intent i = new Intent(this, MainActivity.class);
        finish();
        startActivity(i);
        break;
        // More buttons go here (if any) ...
    }
}

}

A: Yes, you can label multiple fields.  It might be a good to take out the android:layout_below attribute since that isn't supported in LinearLayout.
Otherwise, your Java code might be the culprit.  Can you post it as well?
Edit: I also tested your code and found no errors, although I had to remove the '-->' and the @string references.


text:
Q: How to use row level security (RLS) for anonymous users based on an ID value in QuickSight I want to embed a dashboard in a web application that I need to show to multiple anonymous users that would login into the application. I don't want to create QuickSight users for them as that would be expensive because there are too many users for the application. I want these users to be able to see only that data that belongs to their organization. I have been trying to pass the organization Id from a parameter to filter the results but now  I am thinking this is not the right way and RLS is what I need.

A: Cognito offers a free tier of 50,000 monthly active users.
Anonymous user is a option.
https://aws.amazon.com/cognito/pricing/