Serial Number (Record Count) in Razor?

Question: Could some one point out how to include a Serial Number while populating from a table on a Razor page view.
Here's my view
@foreach (var item in Model) {

            ---- ??? HOW TO INCLUDE SERIAL NUMBER HERE ??? ----

            @Html.DisplayFor(modelItem => item.studentName)

            @Html.ActionLink("Edit", "Edit", new { id = item.studentID }) |
            @Html.ActionLink("Details", "Details", new { id = item.studentID }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.studentID })

}
(Im using EF 4.1 scaffolding to autogenerate the contexts and models)
Comment: Do you have a column on your database which holds the serial number?
Answer: @item.Serial

If you don't want to show it in an html control. You don't need to do anything special.
EDIT: It seems you just want a counter
change the loop in your code to
@foreach (var item in Model.Select((x, i) => new { Data = x, Index = i }))
{

        @item.Index

        @Html.DisplayFor(modelItem => item.Data.studentName)

        @Html.ActionLink("Edit", "Edit", new { id = item.Data.studentID }) |
        @Html.ActionLink("Details", "Details", new { id = item.Data.studentID }) |
        @Html.ActionLink("Delete", "Delete", new { id = item.Data.studentID })

}
Comment: CS0103: The name 'modelItem' does not exist in the current context
Comment: The Column "Serial" is not present in the datatable, i need to append something like 1,2,3,4... (row count).
Comment: Changed the first line to - @foreach (var item in Model.Select((x, i) => new { Data = x, Index = i+1 })) - start counter from one
Answer: @foreach (var item in Model )
{

           @( ((Int32) 1) + @Model.IndexOf(item) )

}

Answer:  @{int index = 1;}
    @foreach (var item in Model)
    {

                @index

        index++;
    }

Answer:

    @{
        int sno = 0;
    }
    @foreach (var item in Model)
    {

                @{ sno++; }
                @sno

    }

Answer: @{ int i = 1; }
@foreach (var item in Model) {

            @i

        @{ i++; }

            @Html.DisplayFor(modelItem => item.studentName)

            @Html.ActionLink("Edit", "Edit", new { id = item.studentID }) |
            @Html.ActionLink("Details", "Details", new { id = item.studentID }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.studentID })

Comment: Please don't post only code as answer, but also provide an explanation what your code does and how it solves the problem of the question. Answers with an explanation are usually more helpful and of better quality, and are more likely to attract upvotes.
Answer: @foreach (var item in Model) {

            @(Model.ToList().IndexOf(item) + 1)

            @Html.DisplayFor(modelItem => item.studentName)

            @Html.ActionLink("Edit", "Edit", new { id = item.studentID }) |
            @Html.ActionLink("Details", "Details", new { id = item.studentID }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.studentID })

}

Comment: Welcome and thanks for contributing! While your answer is correct, it's missing a little explanation on how/why/what you did to make things a bit clearer.

Serial Number (Record Count) in Razor?


Cloud Run for Anthos: You don't have any clusters with Cloud Run for Anthos enabled

Question: I'm stuck trying to create a Cloud Run for Anthos service in my organization's GCP project. I'm not very experienced in GKE creation or GCP infra, but I'm noticing some peculiar things after my setup. For context, I want to use Cloud Run for Anthos with GPUs for my deep learning models. Steps followed include:

Create a standard GKE cluster (named cluster-classifier-app-1) (testing as a public cluster) with 3 e2-standard-4 nodes (8vCPUs is the minimum for the Service Mesh based on the docs) link.
Enable Service Mesh during Setup. (This registers the cluster with the Anthos Fleet)
I head over to the Cloud Run for Anthos menu and I see a You don't have any clusters with Cloud Run for Anthos enabled. message before I can create a service.

Some screenshots:

Cluster registered with Fleet

Cluster Details as viewed in Anthos Clusters Menu (Notice the Cloud Run for Anthos: Unable to connect to cluster message on the top, but the Cloud Run for Anthos item under Cluster Features says enabled)

Services page in Cloud Run Anthos (Notice the error message Missing data from clusters)

Create Service Page (You don't have any clusters with Cloud Run for Anthos enabled.)

Peculiarities:

Viewing the cluster details on the Kubernetes Engine Displays Cloud Run for Anthos as disabled although it says enabled in Screenshot 2.

In the Anthos Features tab - Cloud Run for Anthos displays Enabled and The API appdevelopmentexperience.googleapis.com is not enabled for project even though it is.Screenshot

I'm new to this and I've gone over relevant docs multiple times. I'd appreciate some help and happy to provide any details if necessary.
Comment: I have the same problem; did you manage to solve this?
Comment: Did you solve this problem? I am running into the same issue
Answer: I had this same issue, and it was due to my cluster being autopilot. Apparently, you cannot edit Cloud Run enable/disable for these.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answer: I had the same issue . This command helped. I think this enables cloud run on the cluster we created.
gcloud container hub cloudrun apply --gke-cluster=asia-southeast1/my-anthos-cluster-name

Saw it in this website.


How to position one element under another Buefy navbar

Question: I have problem in positioning two elements below each other in Buefy-Vue.
Currently it works, but if I resize website it breaks because name is set as static. How do I make this responsive? Thank you
Code:

Name

Text I want under name

CSS:
.first{
     width:12%;
     height:100px;
     position:absolute; //Due to this my page breaks if i resize it.
     margin-left: 28%;
     margin-top: 0.5%;
 }
.second{
    width:15%;
    height:50px;
    position: relative;
    top: 65px;
    margin-left: 0%;
}

Answer: Never put fixed height and width, that breaks your responsive design
put them in a div for using flex box

.flex__container {
  display: flex;
  flex-direction: column;
}

Name

Text I want under name

you can play with the font size and padding as you want.


What to do about the cracks on my wood floor?

Question: I am trying to do some repairs of the floor. As you can see on photos, there are some cracks, dents, and gouges.
I am thinking of getting wood filler for these, but I am not sure which one would be best for these types. In addition, I also need to make sure it will not stand out when done. So, I need to find a way around it to match to the rest of the floor. I was thinking of using paint, but I don't know which color and, plus, I tend to be very clumsy in these things.
Any ideas? :)
Comment: In a comment to an answer you mentioned you had extra laminate boards.  Can you post a picture of one of the extra boards so we can see the how they connect together.
Comment: Yes, I do, but there is little point, since the boards are glued and stuck together. I tried taking out one of them and the others began also moving up along. It is more risky than I thought.
Comment: Typically that style of laminate is not glued together but it does take seperating the floor along the seam from one wall to the other.  This is typically done with a mallet and a special tap bar to 'grab' the floor so they can be popped apart.  But in a pinch, and if the click-lock is poor, you can use a shoe that sticky soul and kick the boards apart.
Comment: Leave it, it adds character to the floor.   The one thing you're guaranteed to get with a wood floor, are imperfections. It's part of the charm (at least in my opinion).  Knots, grain, dents, dings, scratches, they all add character to the floor. Clean it up, and cover it with polyurethane to protect the wood.
Answer: First, this doesn't look like like solid wood flooring.  At best, this is an engineering wood flooring (plywood).  Mostly likely, since there are 3 boards to a plank, this is a laminate floor.
Second, the finish, in general, is in really bad shape.  Any type of spot refinishing is just going to stick out, maybe as bad as the damage you are trying to cover.
Since this floor is most likely laminate, the typical means of refinishing a floor (sand and refinish) is out the question.  The dark areas is primarily dirt, but using any type of harsh cleaner to get it out and then reseal is also out of the question.  The cleaners will mostly destroy what is left of the finish and the wood look.
If this damage is localized, lets say the entry way, you can always use an area rug to cover.  This I feel is your best option.
Comment: Thanks for the detailed explanation. But, are there any options other than using a rug? It's not like that's the end of all. I just need to repair it so it matches the rest of the floor. Besides, haven't fillers for laminate surfaces been used before for even worse stuff?
Comment: @BillythePoet How deep are those dents?
Comment: Fillers are usually used to cover nail holes, which are small deep indents.  This give enough for the filler to grab and not fall out.  Shallow wide indents and the filler will just flake out.
Comment: @BillythePoet Also, how long term do you need this to be?  Are you moving out a rental and just want to get your deposit back?  Or is this your residence and want the floor to last another 5 years?
Comment: ,Thank you for getting back to me! The dents are not too deep. And, yes, I need it to get my deposit back. My room was not well furbished even when I signed up for it. I don't think they intend to change anything as long as there is something below the feet. But, they will want to make money off me.
Comment: Since it doesn't need to last, a white crayon rubbed into the cracks will help hide it.  And if you think white might stand out to much, see if the pack has a light tan color.
Comment: Do you think it can get wiped? Maybe i should use it on top of the laminate filler that more or less matches the share of the floor?
Comment: @BillythePoet the crayon will not last and is only used to make the dings less visible.  Use a brush to clean those dings as much as possible and then use the crayon to color over it.  It will fill the small crevices and cracks but not the bigger ding.  The indent will still be there but if it doesn't look black it will not be so noticeable.  But each cleaning of the floor will remove some of the colored wax from the crayon.
Answer: it may sound crazy but if never done before, take pic , pull it up  & flip boards.
choose any color you like, lightly sand, stain, put wood back ( remember to stager boards & keep same gap as original ) lightly sand ( i prefer fine steel wool. ) mysel, a friend works in graphics industry, designed & produced .a large HARLEY DAVIDSON BAR &.CROSS SHIELD which i placed on floor ) &2coats of clear polyurithane ( steel wool between coats)  & that floor will take anything you throw at it.
Comment: I wouldn't recommend taking the wood up with tongue and groove flooring. While possible it's hard to get a good fit once the boards are removed. Additionally it's easy to have other boards damaged when trying to take the few boards out. Just my thoughts though.
Comment: Hi, Dave, is it much of a mess to pull out laminate boards and exchange them with others considering that I have extra?
Comment: Tearing out boards is likely to be a nightmare. If it's a click together floor, you'll need to pull everything in one direction to get new ones in. If they're tongue/groove, they were probably glued and will self destruct on removal. Since I assume complete replacement (with a more durable product this time around) is out of the picture, I agree with @diceless and the area rug.
Comment: They are glued indeed. I began to try but I quickly ceased any work. It didn't take me longer than a minute to understand this ain't going to work out :(
Answer: My dad & I installed Hardwood while I was a teenager. We worked with another guy to finish it. He would get a putty and go over the whole floor with it. I would say with those gouges you can try to sand out the dark outlines and fill with some putty. Their odd shape and form will make them stand out a bit but it's better than paint. If you get a putty to match your end coat (clear finish with poly or something like that) then I think you'll be okay. Clear coats are a little easier to match I think. Also the Woodworkers Stack Exchange would have a wealth of ideas on this but not sure about cross posting.


Unit test fails because of Sessions

Question: I use MVC3 and want to test the following action via Microsoft.VisualStudio.TestTools.UnitTesting and Moq:
public ActionResult index()
{
        Session.Add("username", "Simon");
        var lName = Session["username"] as String;
        var lSessionID = Session.SessionID;
        return Content(lSessionID);
}

My unit test:
[TestMethod]
public void IndexTest()
{

    // Arrange

    var contextMock = new Mock<ControllerContext>();
    var mockHttpContext = new Mock<HttpContextBase>();

    var session = new Mock<HttpSessionStateBase>();
    mockHttpContext.Setup(ctx => ctx.Session).Returns(session.Object);

    StartController controller = new StartController();

    var lResult = controller.index() as ContentResult;

    Assert......;
}

My unit-test results in a NullReferenceException:

I have also tried MvcContrib.TestHelper which fails by Session.SessionID with message "not implemented yet".
How can I test my Action with unit tests?
Answer: Your mock setup is incomplete.
You need to setup the ControllerContextc.HttpContext to return your mockHttpContext and you also need to use your contextMock in your StartController with setting its ControllerContext  property:
So the following setup should work:
var contextMock = new Mock<ControllerContext>();
var mockHttpContext = new Mock<HttpContextBase>();
var session = new Mock<HttpSessionStateBase>();

mockHttpContext.Setup(ctx => ctx.Session).Returns(session.Object);
contextMock.Setup(ctx => ctx.HttpContext).Returns(mockHttpContext.Object);

StartController controller = new StartController();
controller.ControllerContext = contextMock.Object;

Comment: Thank you for your fast advice. You have freed me from my pain.

Unit test fails because of Sessions


An exception of type 'AutoMapper.AutoMapperMappingException' occurred in AutoMapper.dll but was not handled in user code

Question: Somehow my code doesn't work any more (it did work before with the exact same code). This is the problem:
The code
I'm trying to map some objects to ViewModels with this code:
Configuration:
Mapper.CreateMap<BookcaseItem, FoundBookcaseItemViewModel>()
    .ForMember(x => x.Title, opt => opt.MapFrom(src => src.Book.Title))
    .ForMember(x => x.Authors, opt => opt.MapFrom(src => src.Book.Authors.Select(x => x.Name).Aggregate((i, j) => i + ", " + j)))
    .ForMember(x => x.Identifiers, opt => opt.MapFrom(src => (!string.IsNullOrEmpty(src.Book.Isbn10) ? ("ISBN10: " + src.Book.Isbn10 + "\r\n") : string.Empty) +
                                                                (!string.IsNullOrEmpty(src.Book.Isbn13) ? ("ISBN13: " + src.Book.Isbn13) : string.Empty)))
    .ForMember(x => x.Pages, opt => opt.MapFrom(src => src.Book.Pages))
    .ForMember(x => x.ImageUri, opt => opt.MapFrom(src => src.Book.ThumbnailUriSmall));

The usage:
public ActionResult Index()
{
    string facebookId = _accountService.GetLoggedInUserFacebookId();

    IEnumerable<BookcaseItem> items = _bookcaseItemService.GetBookcaseItemsForUser(facebookId);
    IEnumerable<FoundBookcaseItemViewModel> viewModels = items.Select(Mapper.Map<BookcaseItem, FoundBookcaseItemViewModel>);

    return PartialView(viewModels);
}

The error
This results in the following error:

An exception of type 'AutoMapper.AutoMapperMappingException' occurred in AutoMapper.dll but was not handled in user code

The debug data
First of all I ensure that there are no configuration errors by calling:
Mapper.AssertConfigurationIsValid();

I've set breakpoints all over my code and try to debug it, but I can't make sense of it. The 'items' collection is filled with data (proxy classes generated by Entity Framework), but the the 'viewModels' collection is filled with strange data. It has a 'message' that says this:

Mapping types:
  BookcaseItem_B9B52593B2659AC05C47AB2A6E0F7AEA9989CC34D3527DF5B6AA988ED57166FB
  -> String System.Data.Entity.DynamicProxies.BookcaseItem_B9B52593B2659AC05C47AB2A6E0F7AEA9989CC34D3527DF5B6AA988ED57166FB
  -> System.String
Destination path: FoundBookcaseItemViewModel.Authors
Source value:
  System.Data.Entity.DynamicProxies.BookcaseItem_B9B52593B2659AC05C47AB2A6E0F7AEA9989CC34D3527DF5B6AA988ED57166FB

And then there's a stacktrace property that says:

at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.SystemCore_EnumerableDebugView`1.get_Items()

Oh and finally there's another property called 'context' with the following data:

Can anyone explain what's going on here and why my code isn't working any longer? I did a couple of changes to my solution recently, but I've rolled them back by Git, so they shouldn't have any effect on the code.
My setup

Visual Studio 12 RC
ASP.NET MVC 4
.NET Framework 4.0 (I had 4.5 but that caused too many errors, so I rolled back with Git to version 4.0)
Entity Framework 5.0 RC
AutoMapper 2.1.267

The entity and ViewModel
I don't know if it's relevant, but here is the source class for the mapping:
public class BookcaseItem : Entity
{
    public Guid Id { get; set; }
    public bool IsRenting { get; set; }
    public bool IsSwapping { get; set; }
    public bool IsSelling { get; set; }
    public decimal RentingPrice { get; set; }
    public decimal SellingPrice { get; set; }
    public string Currency { get; set; }
    public bool IsAvailable { get; set; }
    public virtual Guid BookId { get; set; }
    public virtual Guid UserId { get; set; }

    public virtual Book Book { get; set; }
    public virtual User User { get; set; }

    public BookcaseItem()
    {
        IsAvailable = true;
        Currency = "USD";
    }
}

And this is the destination class for the mapping:
public class FoundBookcaseItemViewModel
{
    public Guid Id { get; set; }
    public bool IsRenting { get; set; }
    public bool IsSwapping { get; set; }
    public bool IsSelling { get; set; }
    public decimal RentingPrice { get; set; }
    public decimal SellingPrice { get; set; }
    public string Title { get; set; }
    public string Authors { get; set; }
    public string Identifiers { get; set; }
    public int Pages { get; set; }
    public string ImageUri { get; set; }
}

Answer: It seems like there is a problem with mapping Authors property. This Aggregate call will throw an exception if the Authors sequence is null or empty.
.ForMember(x => x.Authors,
           opt => opt.MapFrom(src => src.Book.Authors.Select(x => x.Name).Aggregate((i, j) => i + ", " + j)))

Comment: Looks like you've found the root of the problem good sir. I've added a null check in the MapFrom() method and now the exception is gone :)
Comment: @LeonCullens You should add an empty check too.
Comment: Well, 'Authors' is a collection of strings, so I just check if the collection contains more than 0 items (the strings in the collection can't be null or empty, that's handled elsewhere) :-)
Comment: Why does Mapper.AssertConfigurationIsValid() pass as true despite of it being invalid at runtime?
Comment: @Brendan AutoMapper validation checks if the property names and types match on source and destination types. The exception is thrown inside Select method that is called while mapping.


CDMA 4G network connectivity

Question: My app can not connect to 4G on HTC EV0 device. How app can access network through CDMA 4G?
Comment: Without more specific details this sounds like a hardware/carrier problem rather than a programming problem.
Comment: "CDMA 4G" is not a thing.  CDMA and 4G (as those terms are used when referring to cell network types) are two different technologies.
Answer: Your application cannot choose what network the carrier is using. Whatever wireless network the device has is how your application will access Internet services. If you're trying to restrict your application to specific carriers (and their network), you can do this when you publish it to Android Market. Just select the country link and underneath it will expose the carriers available. By checking off the specific carriers your app will only be visible to users on those carriers. Although even carriers can have more than one network in play at any one time. Something tells me this isn't the answer you were looking for, but I thought it might help someone.

CDMA 4G network connectivity


How do you punch and eat a golden apple at the same time in Minecraft?

Question: I saw some people use a technique where they block with their sword AND punch the player at the same time. Also, those players also end up punching the player WHILE eating the golden apple, creating this weird animation where you punch and eat on the run, like what you see in Wifies's videos. Can this be possible in 1.17?
Answer: No, this is not possible in Vanilla Minecraft since 1.8. There were some mods some years ago that added the <1.7 animations back to the game (and, thus, made this possible), but most of them seem to be abandoned now.
Answer: It is not possible to eat a golden apple while punching a player. Furthermore, it is not possible to block your sword in Java Edition 1.17 because of the shield mechanic.
The animation that you see is most likely a mod for the game that makes it look like the player is punching a block while eating or blocking their sword, but this game mechanic has not been in the game since Minecraft version 1.7.
Some players have created Minecraft Forge mods for version 1.8 which show this animation but most of them do not implement the mechanic. If you want to download these mods, you can find them by searching "1.7 animations mod", however these only work for version 1.8 because of shields being added in 1.9, disabling the sword blocking mechanic.
Comment: Just a note, hitting a player while blocking in vanilla is perfectly possible in versions up to 1.8.9. It's called blockhitting.


import react component from another folder

Question: i have a folder component .
There is OutlinedField in component  folder.
in App.js  i do import OutlinedField from "./../component"; but it fails.
My code is at https://codesandbox.io/s/eloquent-cloud-ngk6u?file=/src/App.js
Answer: As you have component folder in same directory as app.js file, you only need to add import OutlinedField from './component/OutlinedField'
App.js
import React from "react";
import "./styles.css";
import OutlinedField from './component/OutlinedField';
export default function App() {
  return (

Hello CodeSandbox

Start editing to see some magic happen!

  );
}

Comment: that works..but how do i use that imported component https://codesandbox.io/s/pedantic-sanderson-ngzkr
Comment: Add this < OutlinedField /> Before closing tag of div


how to match an array value by it's key in a key value pair elasticsearch array?

Question: I have an array of key value pairs. Is it possible to exact match value of key & then do a check on it's value's range value?
Example: In below doc oracle_props is an array with name, value pairs. I need to check if it has "oracle_cursors" key and then check if it's value is less than 1000.
GET /eg/message/_percolate
{
   "doc": {
      "client": {
         "name": "Athena",
         "version": 1,
         "db": {
            "@type": "Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 64bit",
            "oracle_props": [
               {
                  "@name": "open_cursors",
                  "@value": 4000
               },
               {
                  "@name": "USER_ROLE_PRIVS_COUNT",
                  "@value": 1
               },
               {
                  "@name": "CREATE_PERMISSION",
                  "@value": "Y"
               }
            ]
         }
      }
   }
}

Below is my percolator.
I also need to check the following so that it gives back 3 as my result

"client.name" must be "Athena"
"client.db.@type" must be "Oracle" then only go ahead and check below points
"client.db.oracle_props.@name" field is not found
check if it has "oracle_cursors" key and then check if it's value is < 1000

1 & 2 are and operations and any of 3 or 4 satisfies it should result 3. I need help with point 4, below is my query. Also please suggest if there is a better way.
PUT /eg/.percolator/3
{
   "query": {
      "filtered": {
         "filter": {
            "or": [
               {
                  "missing": {
                     "field": "client.db.oracle_props.@name"
                  }
               }
            ]
         },
         "query": {
            "bool": {
               "must": [
                  {
                     "match": {
                        "client.name": "Athena"
                     }
                  },
                  {
                     "match": {
                        "client.db.@type": "Oracle"
                     }
                  }
               ]
            }
         }
      }
   }
}

Update
Can I have something like below
{
     "match": {
                    "client.db.oracle_props[name='open_cursors'].value": 4000
                 }
              }

More tries
I followed elasticsearch nested query and changed the mapping to nestedtype by re-indexing. Can anyone find problem why am i getting nested: NullPointerException;?
PUT /eg/.percolator/3
{
   "nested" : {
        "path" : "client.db.oracle_props",
        "score_mode" : "avg",
        "query" : {
            "bool" : {
                "must" : [
                    {
                        "match" : {"client.db.oracle_props.@name" : "open_cursors"}
                    },
                    {
                        "range" : {"client.db.oracle_props.@value" : {"lt" : 4000}}
                    }
                ]
            }
        }
    }
}

mapping change
...
"properties": {
               "@type": {
                  "type": "string"
               },
               "oracle_props": {
                   "type" : "nested",
                  "properties": {
                     "@name": {
                        "type": "string"
                     },
                     "@value": {
                        "type": "long"
                     }
                  }
               }
            }
...

Answer: Let's get into it:

You seem to map your nested path wrong, oracle_props is a child item of db in your example document, but not in your mapping, where it appears directly as child of your root.
You are mapping oracle_props.@value as long, but assign a text Y to it at the CREATE_PERMISSION nested doc
You query for range lt 4000, which excludes 4000, lte would fit for you

I didn't get your requirement for the missing value, hence I skipped that.
To get you to the right path, I has to simplify it a bit (since I couldn't follow all the mess in your question, sorry)
I'm not going into percolation either, and renamed everything to twitter/tweet, since this was easier for me to copy from my examples.
1) Create empty index "twitter"
curl -XDELETE 'http://localhost:9200/twitter/'
curl -XPUT 'http://localhost:9200/twitter/'

2) create geo_point mapping for the actual "tweet"
curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '
{
    "tweet": {
        "properties": {
            "db": {
                "type": "object",
                "properties": {
                    "@type": {
                        "type": "string"
                    },
                    "oracle_props": {
                        "type": "nested",
                        "properties": {
                            "@name": {
                                "type": "string"
                            },
                            "@value": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        }
    }
}'

3) Let's check if the mapping was set
curl -XGET 'http://localhost:9200/twitter/tweet/_mapping?pretty=true'

4) Post some tweets, with nested data
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{
    "name": "Athena",
    "version": 1,
    "db": {
        "@type": "Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 64bit",
        "oracle_props": [
            {
                "@name": "open_cursors",
                "@value": 4000
            },
            {
                "@name": "USER_ROLE_PRIVS_COUNT",
                "@value": 1
            },
            {
                "@name": "CREATE_PERMISSION",
                "@value": "Y"
            }
        ]
    }
}'

5) Query nested only
curl -XGET localhost:9200/twitter/tweet/_search -d '{
    "query": {
        "nested" : {
            "path" : "db.oracle_props",
            "score_mode" : "avg",
            "query" : {
                "bool" : {
                    "must" : [
                        {
                            "term": {
                                "db.oracle_props.@name": "open_cursors"
                            }
                        },
                        {
                            "range": {
                                "db.oracle_props.@value": {
                                    "lte": 4000
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
}';

6) Query "Athena" and "Oracle"
curl -XGET localhost:9200/twitter/tweet/_search -d '{
    "query" : {
        "bool" : {
            "must" : [
                {
                    "match" : {"tweet.name" : "Athena"}
                },
                {
                    "match" : {"tweet.db.@type" : "Oracle"}
                }
            ]
        }
    }
}'

7) Combine the former two queries
curl -XGET localhost:9200/twitter/tweet/_search -d '{
    "query" : {
        "bool" : {
            "must" : [
                {
                    "match" : {"tweet.name" : "Athena"}
                },
                {
                    "match" : {"tweet.db.@type" : "Oracle"}
                },
                {
                    "nested" : {
                        "path" : "db.oracle_props",
                        "score_mode" : "avg",
                        "query" : {
                            "bool" : {
                                "must" : [
                                    {
                                        "term": {
                                            "db.oracle_props.@name": "open_cursors"
                                        }
                                    },
                                    {
                                        "range": {
                                            "db.oracle_props.@value": {
                                                "lte": 4000
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    }
                }
            ]
        }
    }
}'

Results as
{
    "took": 2,
    "timed_out": false,
    "_shards": {
        "total": 5,
        "successful": 5,
        "failed": 0
    },
    "hits": {
        "total": 1,
        "max_score": 2.462332,
        "hits": [
            {
                "_index": "twitter",
                "_type": "tweet",
                "_id": "1",
                "_score": 2.462332,
                "_source": {
                    "name": "Athena",
                    "version": 1,
                    "db": {
                        "@type": "Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 64bit",
                        "oracle_props": [
                            {
                                "@name": "open_cursors",
                                "@value": 4000
                            },
                            {
                                "@name": "USER_ROLE_PRIVS_COUNT",
                                "@value": 1
                            },
                            {
                                "@name": "CREATE_PERMISSION",
                                "@value": "Y"
                            }
                        ]
                    }
                }
            }
        ]
    }
}

Comment: @AbhishekSimon -  do a multi-type field.  Make one of them a long,  and one a String.  This will make it index the proper tokens for string contains,  and the long value compare.   See, http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/mapping-multi-field-type.html
Comment: I'll put this in a new question and will explain the problem with your twitter example. Please [check here](http://stackoverflow.com/questions/24817965/how-to-check-missing-key-in-a-nested-type-elasticsearch-object)
Comment: Thanks it worked. Also if I assign `oracle_props.value` mapping as `string` range will not work on `long` but `string` and I need to do a range match and value also contains string. Is there any way to ignore `string` in such case?
Comment: I'm not sure about that, sorry.
Comment: @AndyPryor & Thorsten: Thanks for all the help.
Comment: @Thorsten: Even I missed one of the condition. It's about `missing` field `"db.oracle_props.@name": "open_cursors"`. So it's like a recommendation. If `open_cursor` is not found, or it's value is less than 4000 then suggest a recommendation, which is why I was using percolator, in your case result should match your `twitter result`. Can you help?
Comment: I'm bot sure if I understand you correctly. You might simply want to move the `open_cursors` part from `bool: must` to `bool: should`?
Answer: You need to use a Nested Document.  See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-nested-type.html
Comment: @AbhishekSimon  Cool,  yeah sorry didn't have time to do a full solution,  but Thorsten's looks good.  The gist of it is, without nested types it's all flat in the index.
Comment: Thanks I am able to solve my problem with Thorsten's solution
Comment: Can you please check a [similar question here](http://stackoverflow.com/questions/24817965/how-to-check-missing-key-in-a-nested-type-elasticsearch-object)


Multiple ids in a unique column each and joining them to get details of each on the same line

Question: I'm having in one table a master_id, and student_id. I want to write a query that would print out both the names of the master and student on the same line while joining their details from another table.
master student table
id - 1
fullname - Derek Jason
type: master
id - 2
fullname - John Mason
type: student

assignments table
id - 1
from - 1
to - 2

So I'm trying to write a query that would return the results from the assignment table like
Results
id - 1
master- Derek
student - John Manson

I've tried this query but I'd need help to complete it.
SELECT name AS master FROM `assignments`
LEFT JOIN master_student ON assignments.from = master_student.id

Comment: SQL tables have rows and columns.  It is not clear what the rows and columns are in your data.  Can you better format the data?
Answer: I suspect you just want two joins:
SELECT a.id, ms.name AS master, mt.name as student
FROM assignments a LEFT JOIN
     master_student ms
     ON a.from = ms.id LEFT JOIN
     master_student mt
     ON a.to = mt.id;

Note:  from and to are really, really bad column names because they are SQL keywords.


post install script fails to find Android SDK

Question: Can't figure out why I'm getting this error upon running a post install script
You must set the ANDROID_HOME environment variable to the path of your installation of the Android SDK.
Based on what I have observed in other questions it seems it might be that my environment variables are not pointing to the right part of the SDK. Here is what I have in my .zprofile
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export ANDROID_HOME=/Users/djr/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/bin
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools

This is on an Apple silicon MacBook Pro running 12.1.
It is a .js script being executed by node
Comment: Can you show the output of `ls /Users/djr/Library/Android/sdk`
Comment: build-tools emulator licenses patcher  platform-tools platforms tools
Answer: You should add those lines to the startup file that belongs to your login shell (e.g. .bashrc, .zshrc).
Then before invoking node verify the variables are set with the expected values.
$ ls "$ANDROID_HOME"

can give you a clue if the value is correct.
It's not possible to change the environment of a parent process (perhpas you are invoking node expecting it to change the environment of the parent shell).
Comment: I appreciate the help but this didn't work for some reason
Comment: Which part? Did you add it to your startup file? Did you verify with `ls`?
Comment: Added it where you told me. Tried to verify and got nothing.
Comment: If by *verify* you mean running `ls` as mentioned, *nothing* seems to be not possible as `ls` either shows files or an error message.
Comment: sorry here is what I found

```build-tools emulator licenses patcher  platform-tools platforms tools```


Positioning MenuButton's ContextMenu using css in JavaFX2

Question: I was searching about how to set co-ordinate of MenuButton's Context Menu in css and didn't find a way to achieve. I want to lower the Conext Menu from actual position like attached example images and if possible then up arrow too. Take a look at my code.
FXML
<MenuButton layoutX="1046.0" layoutY="38.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="30.0" styleClass="notification-button">
   <graphic>
      <Pane>
         <children>
            <Circle fill="#db5344" layoutX="20.0" radius="10.0" stroke="BLACK" strokeType="OUTSIDE" strokeWidth="2.0" />

         </children>
      </Pane>
   </graphic>
   <items>
      <MenuItem mnemonicParsing="false" text="Sample" />
   </items>
</MenuButton>

CSS
.menu-button > .arrow-button {
    -fx-padding: 0;
}
.menu-button > .arrow-button > .arrow {
    -fx-padding: 0;
}
.menu-item {
    -fx-padding: 10;
}
.menu-item .label {
    -fx-text-fill: white;
}
.menu-item:focused {
    -fx-background-color: darkgray;
}
.menu-item:focused .label {
    -fx-text-fill: blue;
}
.menu-item .label {
    -fx-text-fill: yellow;
}
.menu-item:focused .label {
    -fx-text-fill: white;
}
.context-menu {
    -fx-skin: "com.sun.javafx.scene.control.skin.ContextMenuSkin";
    -fx-text-fill: white;
    -fx-background-color: #006699;
    -fx-background-insets: 0, 1, 2;
    -fx-background-radius: 0 6 6 6, 0 5 5 5, 0 4 4 4;
    -fx-padding: 10px;
}
.context-menu .separator {
    -fx-padding: 10;
}
.context-menu .container {
    -fx-padding: 10;
}
.context-menu .scroll-arrow {
    -fx-padding: 10;
    -fx-background-color: #006699;
}
.context-menu .scroll-arrow:hover {
    -fx-background: -fx-accent;
    -fx-background-color: #006699;
    -fx-text-fill: -fx-selection-bar-text;
}
.context-menu:show-mnemonics .mnemonic-underline {
    -fx-stroke: -fx-text-fill;
}

The below attached images will help you understand my question.
First image is output of my current code, the second and third image is what I want. both second and third images are for custom styling for drop down in webpages. Can I achieve the same in JavaFX2?
As you can see my fxml code, I have used MenuButton and MenuItem inside it. If you think this won't help. Please tell me other ways for getting it.
Answer: Well, I am sure there are lots of developers who knows how to do this. May be they didn't have time for this or unaware of my question.
By the way, I wasted almost 2 days behind this. But happy that I was able to do the solution.
Comment: I'm new in javafx, could you share with me some example? :)


Using JDE in Emacs, I would like something like Eclipse's run configurations

Question: I'm using JDE for writing a larger project. Coming from Eclipse, i miss the run configurations. Basically, there are several different classes in the project that i would like to launch. Some of them are applets, some of the are regular classes with a main method. I would also like to be able to specify different run time arguments to them.
Basically, something like this:

run_config_1
  applet: false
  main class: package1.subpackage1.ClassX
  arguments: arg1 arg2

run_config_2
  applet: true
  main class: package1.subpackage1.AppletClassX
  arguments:

etc ...

Then I could switch configuration on the fly, testing different parts of the project. So is there something like this for JDE? Or do I have to write it myself? If that is the case, I would like some pointers on the general direction I should take.
Answer: Have you looked at what is already available in JDE? E.g. "Running Java Applications" at http://jdee.sunsite.dk/jdedoc/html/jde-ug/jde-ug.html ?
Answer: you can switch configrations indeed: use the "project files" for this. in a project file your current JDE settings can be recorded. you can set the arguments for java compile and run to your liking. start with jde-create-new-project. you need to set up new directories for each configuration (=project file).
here a generated sample project file
(jde-project-file-version "1.0")
(jde-set-variables
 '(jde-project-name "mysample")
 '(jde-run-option-application-args (quote ("-v" "mydir")))
 '(jde-run-read-app-args t))


How to edit title slide style in .RPres R Presentation?

Question: I'm having troubles editing the style of the title slide in a .RPres R Presentation.
I'm using a .css file to set the styles, and already tried this:
<code>.title-slide{
text-align: center;
background-color: white;
background-size: cover;
color: black;
font-family: 'Montserrat';}
</code>
But the only I get is a white background on the label of the subtitle, but the slide is still with the default style. I have the following code in the title slide:
<code>Title of the presentation
========================================================
class: title-slide
author:
autosize: true
css: prueba1.css

Subtitle of the title slide
</code>
If anyone can tell me how to delete the title slide instead it also helps.
I'm using R version 3.4.4 on a linux x86_64 virtual machine.
Answer: I already found how to edit it. The first slide happens to be of type "section", therefore, to edit its style I have to write in the css:
<code>.section .reveal .state-background{
background-color: white;
background-size: cover;
}
</code>
To set the background with the color I want, and:
<code>.section .reveal h1, h2{
    color: black;
    font-weight: bold;
  }
</code>
And with that I can have the first slide with the style I want.
The only things I haven't been able to edit are author and date. Does anyone know what is the tag for those?
Comment: To change the properties of author and date, you can use:
`.section .reveal p{ color: brown; }`


db4o query taking too long

Question: I have an original and a premium repository, and I tried to add indices to both as such:
    public void SetupIndices()
    {
        original.Ext().Configure().ObjectClass(typeof(LineItem)).ObjectField("idField").Indexed(true);
        original.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(LineItem), "idField"));
        original.Ext().Configure().ObjectClass(typeof(LineItem)).ObjectField("nameField").Indexed(true);
        original.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(LineItem), "nameField"));
        original.Ext().Configure().ObjectClass(typeof(Order)).ObjectField("idField").Indexed(true);
        original.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Order), "idField"));
        original.Ext().Configure().ObjectClass(typeof(Order)).ObjectField("nameField").Indexed(true);
        original.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Order), "nameField"));
        original.Ext().Configure().ObjectClass(typeof(Creative)).ObjectField("idField").Indexed(true);
        original.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Creative), "idField"));
        original.Ext().Configure().ObjectClass(typeof(Creative)).ObjectField("nameField").Indexed(true);
        original.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Creative), "nameField"));
        original.Ext().Configure().ObjectClass(typeof(Company)).ObjectField("idField").Indexed(true);
        original.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Company), "idField"));
        original.Ext().Configure().ObjectClass(typeof(Company)).ObjectField("nameField").Indexed(true);
        original.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Company), "nameField"));
        original.Ext().Configure().ObjectClass(typeof(LineItemCreativeAssociation)).ObjectField("lineItemIdField").Indexed(true);
        original.Ext().Configure().ObjectClass(typeof(LineItemCreativeAssociation)).ObjectField("creativeIdField").Indexed(true);

        original.Commit();

        premium.Ext().Configure().ObjectClass(typeof(LineItem)).ObjectField("idField").Indexed(true);
        premium.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(LineItem), "idField"));
        premium.Ext().Configure().ObjectClass(typeof(LineItem)).ObjectField("nameField").Indexed(true);
        premium.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(LineItem), "nameField"));
        premium.Ext().Configure().ObjectClass(typeof(Order)).ObjectField("idField").Indexed(true);
        premium.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Order), "idField"));
        premium.Ext().Configure().ObjectClass(typeof(Order)).ObjectField("nameField").Indexed(true);
        premium.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Order), "nameField"));
        premium.Ext().Configure().ObjectClass(typeof(Creative)).ObjectField("idField").Indexed(true);
        premium.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Creative), "idField"));
        premium.Ext().Configure().ObjectClass(typeof(Creative)).ObjectField("nameField").Indexed(true);
        premium.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Creative), "nameField"));
        premium.Ext().Configure().ObjectClass(typeof(Company)).ObjectField("idField").Indexed(true);
        premium.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Company), "idField"));
        premium.Ext().Configure().ObjectClass(typeof(Company)).ObjectField("nameField").Indexed(true);
        premium.Ext().Configure().Add(new UniqueFieldValueConstraint(typeof(Company), "nameField"));
        premium.Ext().Configure().ObjectClass(typeof(LineItemCreativeAssociation)).ObjectField("lineItemIdField").Indexed(true);
        premium.Ext().Configure().ObjectClass(typeof(LineItemCreativeAssociation)).ObjectField("creativeIdField").Indexed(true);

        premium.Commit();

    }

problem is, this query takes forever, and there should only be a few hundred to a few thousand results.  None of the object stores should contain more than 40K items.  What am I doing wrong?
        var creatives = from Creative c in original.Query<Creative>()
                        join Company co in original.Query<Company>()
                            on c.advertiserId equals co.id
                        join LineItemCreativeAssociation lica in original.Query<LineItemCreativeAssociation>()
                            on c.id equals lica.creativeId
                        join LineItem li in original.Query<LineItem>()
                            on lica.lineItemId equals li.id
                        join LineItem newLI in premium.Query<LineItem>()
                            on li.name equals newLI.name
                        join Company newCO in premium.Query<Company>()
                            on co.name equals newCO.name
                        from Creative newC in premium.Query<Creative>()
                            .Where(o=>o.name == c.name).DefaultIfEmpty()
                        where newC == null
                        select new { creative = c, newCompany = newCO };

Answer: Some questions / issues regarding your code that could explain the slowness:

It looks like you are trying to configure indexes on an open database. This does not work (check this page).
In your query you call original.Query() which causes db4o to return ALL OBJECTS of type X (and sub types as well) and then LINQ for Objects quick in. You should not use the query method this way db4o LINQ implementation will be used instead (and this should be much faster).

My guess about 2 is that you are doing that to be able to use joins (since db4o LINQ implementation does not support it). In order to use db4o LINQ implementation I am afraid you'll need to try to split your query in multiple simple queries and join the results of each query.
Hope this helps.
Comment: #1 was the problem for me.  Thanks!

db4o query taking too long


Is it still a good practice to put Javascript at the bottom using current technology

Question: I am really new to web programming, and recently I started learning Javascript. I read a debate about where to put javascript, at top or at bottom. The top supporters emphasised that a slow loading is better than broken page since lack of js makes some of the features un-functional; the bottom supporters focused more on the loading speed, and argued that broken function could be warned by using css, which must get to load at the beginning. However, all the debate I've seen was at least 2 years (posts talking about this on SO was around 2009-2010, the latest i've seen is around 2012) from now, and html5 introduces new "async" and "defer" attribute to  tag in recent years. So my questions are:
Where is the best place to put your js, top or bottom using the current technology, i.e. with async and defer? If it depends, what kind of situation should you put js at the top/ bottom, and what kind of js should you put at the top/bottom?
Thanks very much!
Comment: This question is off-topic, because it is primarily opinion-based.
Answer: Typically you want to use async where possible. Preference order : async>defer>no attribute.
When to use them?
1) Use defer if the script relies on another script(or the other way round)
2) Use async when the script can function on its own i.e it does not rely on other scripts.
3) If the script is small and is relied upon by an async script then use an inline script with no attributes placed above the async scripts.
Further reference @ https://html.spec.whatwg.org/multipage/scripting.html#the-script-element


CSS: Curved Divs/Rows of a Seating Map

Question: I'm creating a SeatMap for a theater that contains 1001 seats, I'm using jQuery-Seat-Charts.
I want each row of seats to be a little curved around the stage (not horizontally straight as normal divs/rows).
I tried to use
shape-outside: ellipse(); and clip-path: ellipse();
but it didn't work.
Can this be done with pure CSS? HOW ?
here is my code:

$(document).ready(function() {
    var $cart = $('#selected-seats'),
        $counter = $('#counter'),
        $total = $('#total'),
        sc = $('#seat-map').seatCharts({
            seats: {
                A: {
                    price: 250,
                    classes: 'a_seat ground-floor',
                    category:'first class'
                },
                B: {
                    price: 1000,
                    classes: 'b_seat ground-floor',
                    category:'economy class'
                },
                C: {
                    price: 80,
                    classes: 'c_seat ground-floor',
                    category:'economy class'
                }

            },
            map: [
              '__A[A1]A[A2]A[A3]A[A4]A[A5]A[A6]A[A7]A[A8]__',
                '_B[B1]B[B2]B[B3]B[B4]B[B5]B[B6]B[B7]B[B8]B[B9]B[B10]_',
                'C[C1]C[C2]C[C3]C[C4]C[C5]C[C6]C[C7]C[C8]C[C9]C[C10]C[C11]C[C12]',

            ],
            naming : {
                top : false,
                left: true,
                rows: ['A', 'B', 'C'],
                getLabel : function (character, row, column) {

                    return '';
                },
                getId  : function(character, row, column) {
                    return row + '_' + column;
                }
            },
            legend : {
                node : $('#legend'),
                items : [
                    [ 'a', 'available',   'First Class' ],
                    [ 'b', 'available',   'Economy Class'],
                    [ 'c', 'unavailable', 'Already Booked']
                ]
            },
            click: function () {
                console.log(this.settings);
                if (this.status() == 'available') {
                    //let's create a new
 which we'll add to the cart items
                    $('
'+this.data().category+' Seat # '+this.settings.id+': $'+this.data().price+' [cancel]
')
                        .attr('id', 'cart-item-'+this.settings.id)
                        .data('seatId', this.settings.id)
                        .appendTo($cart);

                    /*
                     * Lets update the counter and total
                     *
                     * .find function will not find the current seat, because it will change its stauts only after return
                     * 'selected'. This is why we have to add 1 to the length and the current seat price to the total.
                     */
                    $counter.text(sc.find('selected').length+1);
                    $total.text(recalculateTotal(sc)+this.data().price);

                    return 'selected';
                } else if (this.status() == 'selected') {
                    //update the counter
                    $counter.text(sc.find('selected').length-1);
                    //and total
                    $total.text(recalculateTotal(sc)-this.data().price);

                    //remove the item from our cart
                    $('#cart-item-'+this.settings.id).remove();

                    //seat has been vacated
                    return 'available';
                } else if (this.status() == 'unavailable') {
                    //seat has been already booked
                    return 'unavailable';
                } else {
                    return this.style();
                }
            }
        });

    //this will handle "[cancel]" link clicks
    $('#selected-seats').on('click', '.cancel-cart-item', function () {
        //let's just trigger Click event on the appropriate seat, so we don't have to repeat the logic here
        sc.get($(this).parents('li:first').data('seatId')).click();
    });

    //let's pretend some seats have already been booked
    sc.get(['A1', '4_1', '7_1', '7_2']).status('unavailable');

});

function recalculateTotal(sc) {
    var total = 0;

    //basically find every selected seat and sum its price
    sc.find('selected').each(function () {
        total += this.data().price;
    });

    return total;
}
div.seatCharts-container {
 /*min-width: 700px;*/
}
div.seatCharts-cell {

 height: 16px;
 width: 16px;
 margin: 1px;
 float: left;
 text-align: center;
 outline: none;
 font-size: 14px;
 line-height:16px;
 color: blue;

}
div.seatCharts-seat {
 /*background-color: green;*/
 color: #676967;
 -webkit-border-radius: 5px;
 -moz-border-radius: 5px;
 border-radius: 5px;
 cursor: default;
}
div.seatCharts-seat:focus {
 border: none;
}
/*
.seatCharts-seat:focus {
 outline: none;
}
*/

div.seatCharts-space {
 background-color: white;
}
div.seatCharts-row {
 height: 30px;
}

div.seatCharts-row:after {
 clear: both;
}

div.seatCharts-seat.selected {
 /*background-color: forestgreen;*/
    color:forestgreen;
}

div.seatCharts-seat.focused {
 /*background-color: #6db131;*/
    color: #6db131;
}

div.seatCharts-seat.available {
 /*background-color: green;*/
    color: #676967;
}

div.seatCharts-seat.unavailable {
 /*background-color: red;*/
    color: darkred;
 cursor: not-allowed;
}

ul.seatCharts-legendList {
 list-style: none;
}
li.seatCharts-legendItem {
 margin-top: 10px;
 line-height: 2;
}

/*stage*/
.stage {
    margin: 10px 85px;
    width: 80px;
    height: 30px;
    background-color: #b3b3b3;
    text-align:center;
}
<!doctype html>

    <title>Seat Map</title>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/>

Stage

Booking Details

                    Selected Seats
                    (0):

                    Total: $0

                    <button class="checkout-button">
                    Checkout »
                    </button>

Answer: You can use the CSS property margin-top to assign a margin to the 2 seats at the edges of each row. This will give a nice curve to the row.
I used margin-top:-4 to the outer seat and margin-top:-1 the the second seat in.
(Due to new account and no reputation I can't post the picture, but I will edit it in later)
Hope this helps:)
Comment: Good solution but i will need to find a way to select first two and last two seats in a row to add classes and style them
Comment: CSS has selectors for nth-child()
Answer: Html File Code

Please select a seat

              <input type="checkbox" id="1A" />
              1A

              <input type="checkbox" id="1B" />
              1B

              <input type="checkbox" id="1C" />
              1C

              <input type="checkbox" disabled id="1D" />
              Occupied

              <input type="checkbox" id="1E" />
              1E

              <input type="checkbox" id="1F" />
              1F

              <input type="checkbox" id="2A" />
              2A

              <input type="checkbox" id="2B" />
              2B

              <input type="checkbox" id="2C" />
              2C

              <input type="checkbox" id="2D" />
              2D

              <input type="checkbox" id="2E" />
              2E

              <input type="checkbox" id="2F" />
              2F

              <input type="checkbox" id="3A" />
              3A

              <input type="checkbox" id="3B" />
              3B

              <input type="checkbox" id="3C" />
              3C

              <input type="checkbox" id="3D" />
              3D

              <input type="checkbox" id="3E" />
              3E

              <input type="checkbox" id="3F" />
              3F

              <input type="checkbox" id="4A" />
              4A

              <input type="checkbox" id="4B" />
              4B

              <input type="checkbox" id="4C" />
              4C

              <input type="checkbox" id="4D" />
              4D

              <input type="checkbox" id="4E" />
              4E

              <input type="checkbox" id="4F" />
              4F

              <input type="checkbox" id="5A" />
              5A

              <input type="checkbox" id="5B" />
              5B

              <input type="checkbox" id="5C" />
              5C

              <input type="checkbox" id="5D" />
              5D

              <input type="checkbox" id="5E" />
              5E

              <input type="checkbox" id="5F" />
              5F

              <input type="checkbox" id="6A" />
              6A

              <input type="checkbox" id="6B" />
              6B

              <input type="checkbox" id="6C" />
              6C

              <input type="checkbox" id="6D" />
              6D

              <input type="checkbox" id="6E" />
              6E

              <input type="checkbox" id="6F" />
              6F

              <input type="checkbox" id="7A" />
              7A

              <input type="checkbox" id="7B" />
              7B

              <input type="checkbox" id="7C" />
              7C

              <input type="checkbox" id="7D" />
              7D

              <input type="checkbox" id="7E" />
              7E

              <input type="checkbox" id="7F" />
              7F

              <input type="checkbox" id="8A" />
              8A

              <input type="checkbox" id="8B" />
              8B

              <input type="checkbox" id="8C" />
              8C

              <input type="checkbox" id="8D" />
              8D

              <input type="checkbox" id="8E" />
              8E

              <input type="checkbox" id="8F" />
              8F

              <input type="checkbox" id="9A" />
              9A

              <input type="checkbox" id="9B" />
              9B

              <input type="checkbox" id="9C" />
              9C

              <input type="checkbox" id="9D" />
              9D

              <input type="checkbox" id="9E" />
              9E

              <input type="checkbox" id="9F" />
              9F

              <input type="checkbox" id="10A" />
              10A

              <input type="checkbox" id="10B" />
              10B

              <input type="checkbox" id="10C" />
              10C

              <input type="checkbox" id="10D" />
              10D

              <input type="checkbox" id="10E" />
              10E

              <input type="checkbox" id="10F" />
              10F

Comment: Could you explain shortly why this solves the problem?

CSS: Curved Divs/Rows of a Seating Map


New Ubuntu installation with Win 10 no dual boot screen

Question: I am very new to this and hope someone can help.
I have just installed Ubuntu 20.04.1.I installed it while keeping my win 10. I wanted it as a dual boot laptop. I burned the iso on a disk, I followed the loading sequence. I selected ' along side existing o/s. once completed I got the 'restart laptop'.
Now, should I get a screen after the Acer logo to select which operating system? as I don't get any. The laptop just starts up with windows as usual. Do I have to select something in win 10 to show a dual boot screen. I have tried to reinstall and this went very smoothly..
Thanks
Comment: All the answers provided are correct. The reason you boot directly into your windows is that the priority is given to windows in boot order and unlike Ubuntu, Windows does not contain a boot menu to let you choose OS. Hence give priority to Ubuntu and when GRUB pops up you can choose Windows from there. But it is not necessary if you are comfortable with pressing the Boot Manager key when your system starts
Comment: Many Acer need UEFI update and "trust" setting on Ubuntu entry to have it work. Acer Trust Settings - details, some now report that then secure boot has to be on to set trust:
https://ubuntuforums.org/showthread.php?t=2297947&p=13369742#post13369742 &
https://ubuntuforums.org/showthread.php?t=2297947 & Acer Aspire E15 will not dual boot, many details Trust settings in step 35
http://askubuntu.com/questions/627416/acer-aspire-e15-will-not-dual-boot
Answer: Turn on your computer than Keep clicking escape untill it takes you to the menu then go to boot manager there will be windows and ubuntu, select ubuntu hit enter and it will boot ubuntu..

Go to the boot options and change the boot order and put ubuntu at the top, with the f5 and f6 keys..
Comment: Unfortunately there's no standardization with motherboard firmware when it comes to what key you need to press to enter the firmware setup (BIOS/UEFI settings).  It could be `ESC`, but could also be `DEL`, or `Enter`, any of the function keys and more.  I've encountered `F1`, `F2`, `F4`, and `F12`. Users should read the splash screen when booting - it is very common for the instructions to be displayed on every boot
Answer: Try what Nmath said and after this check in your BIOS the Boot Order. Seems here is "Windows boot manager" selected. Check if you have other options to boot and use it for test.
If you choose the right boot device, you will get the GRUB Menu every boot where you can choose what you want to boot.
Comment: *"when I select Ubuntu I get a warning ' error boot vmlinuz —— generic has invalid signature , loading initial ram disk error: you need to load kernel first"* - this appears to be the problem you actually *have* but it's not the one that you *asked about*.  This is probably why you haven't found an answer.  But look here: https://askubuntu.com/questions/1081472/vmlinuz-4-18-12-041812-generic-has-invalid-signature (Turn off Secure Boot)
Comment: Hi. I have tried all the above. When I press F12 I only get windows boot. When I select BIOS the boot option only shows windows. I managed to get the grum on F12 boot but when I select Ubuntu I get a warning ' error boot vmlinuz —— generic has invalid signature , loading initial ram disk error: you need to load kernel first.. sorry if it's not clear. I have tried installing on DVD and USB.. I have acer aspire.. Thanks


What could have caused the burnt electronics smell in my Kenmore washer and dryer?

Question: I have a Kenmore washer and dryer (both electric) in a separate laundry room. We came home yesterday after being out, only to find a HORRIBLE smell in the laundry room. At first I thought of turpentine or some sot of paint thinner. Very harsh "ozone" sort of smell. At this point, having removed all containers from the room, I have narrowed down that the smell is that of a blown circuit. I used to smell something similar when I visited businesses that produced circuit boards and semi conductors.

Both units work
Possible heat loss on the dryer, but the clothes do dry. I've just had to put some back a little longer.

What happened here and what do I need to be concerned about now?
Comment: Ooh, that's not a good smell to have -- are you hearing any snap, crackle, pop (aka sparky) sounds from the dryer as well? An arcing heating element sounds like the culprit here, and that's a great way to wind up drying your clothes over a bonfire...
Answer: I have had a few control boards from assorted appliances burn to some degree, but continue to function.
Those pc boards tend to be made from bakelite, the brown color boards you see in less expensive items. Bakelite is a paper based product.
And it smells 'that' way.
If there is loss of heat from the dryer, it is likely the board that controls the temperature. The boards are behind the control section of the appliance, and the ones I have worked on have always been easy to replace.
Buying appliances that are sold by Sears, is great because they stock parts from many years back.
Comment: The smell's more likely flux residue burning off (I had a laptop that emitted intermittent "fluxy" or "smoky organic" odors), but yes, a board that's running (perhaps too) hot will do this.


How to remove this known missing dependency?

Question: I have ubuntu 17.04
How to remove this known missing dependency?
Screenshot of the problem
Comment: did you Google your error ?   I did and found: https://github.com/spyder-ide/spyder/issues/3522
Comment: I guess you mean "install" the dependency to get rid of the error message, not "remove" the dependency?
Comment: @WillemK that's a closed issue & actually I have posted my question there also.
Comment: Please use text for terminal outputs
Comment: Could you please post text files, dialogue messages, and program output listings as text, not as images? To achieve the latter two you can either 1) select, copy & paste the dialogue text or terminal content or 2) [save the program output to a file](//askubuntu.com/q/420981/175814) and use that. Longer listings (the editor will tell you what's too long) should be uploaded to a [pastie service](https://paste.ubuntu.com/) and linked to in the question. Thanks.
Comment: How did you install Spyder3? It's included in the package repositories and Apt pulls in dependencies automatically.
Answer: this is how I installed -----FOLLOW EXPLICITLY------
sudo apt purge spyder spyder3
sudo reboot now

Re-open a terminal and continue-------------
sudo apt install python-rope python-sympy spyder
sudo apt update
sudo reboot now

This is how I finally got spyder to install with missing dependencies. I assume you can use apt to install any of the missing dependencies found in Help > Dependencies and look for any highlighted missing packages. Worked for me.
Comment: Why the reboots and why update *after* all the package management actions? Neither of the former two appear related to the latter.
Answer: Install the dependency using this command
sudo apt install python-rope

You can aswell try reinstalling it so the neccessary dependencies are reinstalled aswell.
sudo apt purge spyder3 && sudo apt install spyder3

Comment: @SumeetDeshmukh As I see it, this *does* provide an answer. It's a short one, but looks perfectly valid and to the point to me. Please recheck your review.
Comment: @ByteCommander deleted it, is that okay?
Comment: Sorry, didn't solve the problem.
Comment: Try reinstalling the software like I mention in my answer. Since I tried installing it on a fresh system and it worked without issues.


Sound settings gui not working

Question: I have a problem, im using 12.10 Ubuntu. Recent i sound settings gui working.
Now it not working. How to get master gui working? My sound working but audio (master) slise in mute permanently also audio settings are empty. However in flash, spotify etc slides working. Also MUTE button is removed.
My alsamixer working.
My hwinfo is this.
 hwinfo --sound
24: PCI 709.0: 0401 Multimedia audio controller
  [Created at pci.318]
  UDI: /org/freedesktop/Hal/devices/pci_13f6_111
  Unique ID: GKX6.fT7WCdwsUsC
  Parent ID: 6NW+.FukESQtKoV4
  SysFS ID: /devices/pci0000:00/0000:00:1e.0/0000:07:09.0
  SysFS BusID: 0000:07:09.0
  Hardware Class: sound
  Model: "TERRATEC Aureon 5.1"
  Vendor: pci 0x13f6 "C-Media Electronics Inc"
  Device: pci 0x0111 "CM8738"
  SubVendor: pci 0x153b "TERRATEC Electronic GmbH"
  SubDevice: pci 0x1144 "Aureon 5.1"
  Revision: 0x10
  Driver: "snd_cmipci"
  Driver Modules: "snd_cmipci"
  I/O Ports: 0x1000-0x1fff (rw)
  IRQ: 21 (336 events)
  Module Alias: "pci:v000013F6d00000111sv0000153Bsd00001144bc04sc01i00"
  Driver Info #0:
    Driver Status: snd_cmipci is active
    Driver Activation Cmd: "modprobe snd_cmipci"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #20 (PCI bridge)

Answer: Resetting User Configuration
For some reason, pulseaudio's user configuration files can become corrupt(unsynced?) in some way, and deleting them (and forcing fresh ones to be generated) fixes a no sound condition. After using the command below, log out/in.
Ubuntu 12.10/Quantal (and earlier)
rm -r ~/.pulse*; pulseaudio -k

Answer: You can give a try to command line interface for your sounds settings, if GUI doesn't work for you..

Install gnome-alsamixer (open terminal CTRL+ALT+T then execute following command):
sudo apt-get install gnome-alsamixer

Run gnome-alsamixer:
alsamixer

on the same terminal AlsaMixer will be opened.
Use -> or <- arrow keys to change the options. Up and down arrow keys to increase/decrease volumes. M key to Mute. Press Esc to exit.

Hope this short description helps you any how. Reply if something goes wrong.
Comment: Yesterday gui working. But today crashed. And reboot not working. Where is config files?
Comment: Is `alsamixer` working from terminal? What are the scenario you are getting?
Comment: yes is working. my pulseaudio settings are corrupted. it is fixed now.
Comment: Then edit my answer and list the changes you did to fix your problem, then mark this question as solved. It would help others to solve such problems.. :)
Comment: how to mark question solved?
Comment: The `Tick` icon is the notification that you accepted the answer and it works for you.

Sound settings gui not working


Graphic objects update without skip, vba

Question: I have a code, for example the class named MyClass and expect after each step the result is updated in the excel workbook, and some chart and graphic object is updated dynamically.
The delay of updating cells, charts and images is just ok but I have to add an additional pause because otherwise it will skip all the process and jumps graphic update to the end of code execution.
What should I do to getrid of unintended pause?
Public a As Double
Public b As Double
Public counter As Integer

Private Sub Class_Initialize()
    a = Range("A1")
    b = Range("B1")
    counter = 1
End Sub
Public Sub some_calculation()
    a = a + b
End Sub
Public Sub graphic_update()
    counter = counter + 1
    Cells(count, 1) = a
    Sheet1.Shapes("Picture 1").Rotation = Sheet1.Shapes("Picture 1").Rotation + 45
End Sub
Public Function pause(pause_time As Double)
    Start_Time = Timer
    Do
    DoEvents
    Loop Until (Timer - Start_Time) >= pause_time
End Function
Sub test()
    Dim obj1 As New MyClass
    For i = 1 To 10
        obj1.some_calculation
        obj1.graphic_update    ' if I had a kind of confirmation of previous line execution, which is cells update, to go to the next one, it would be just ok.
        obj1.pause (0.001)
    Next i
End Sub

Comment: Try adding some DoEvents in your code
Comment: You mean for example in graphic_update function?
Comment: Anywhere where you want to give Excel time to catch up.
Comment: Sorry @TimWilliams could you give a clue to use DoEvents, because actually I didn't manage to solve it correctly?
Answer: Since you requested an example of DoEvents - I would try something like this:
Public Sub graphic_update()
    counter = counter + 1
    Cells(count, 1) = a
    Sheet1.Shapes("Picture 1").Rotation = Sheet1.Shapes("Picture 1").Rotation + 45
    DoEvents '<<<
End Sub


How to log Filename and Linenumber in Akka Classic Actor?

Question: We use logback as the logging backend for Akka as described here: https://doc.akka.io/docs/akka/current/logging.html
But if I use this logback snippet
<pattern>%d{HH:mm:ss.SSS} %-5level [%thread] [%logger] [%F:%L] [%mdc{akkaSource:-}] %msg [%mdc]%n</pattern>

I see ... [Slf4jLogger.scala:83] ... as file name and line number, which seems to be a class from the akka library.
How do I get the real location of the logging statement?
Answer: Patrik Nordwall answered this here: https://discuss.lightbend.com/t/akka-actor-logging-of-line-numbers/7345
"Akka's internal logging is asynchronous, meaning that log messages emitted via the akka.event.LoggingAdapter is sent to the actor Slf4jLogger. It's the Slf4jLogger actor that will call the slf4j.Logger method and therefore the thread and source line number is from the Slf4jLogger actor.
That is by design and there is no work around for that for Akka's internal logging.
For your own logging you don't have to use Akka's LoggingAdapter. You can log directly to your own slf4j.Logger.
More info at https://doc.akka.io/docs/akka/current/logging.html#slf4j"


XSLT to return input xml as is, except replacing a string to another regardless where it may appear

Question: My goal is to produce an XSLT output that is the same as the input, with the exception of the replacement of a string to another, regardless where it may appear. The string to replace can be data, xml tag name, namespace name URI or anything else within the xml document, I'd like it replaced either way.
Example xml input:
<?xml version="1.0" encoding="utf-8"?>

<ns:a xmlns:ns="http://www.toreplace.com" xmlns:nsB="http://www.toreplace.com/anything">
  <nsB:b>
    toreplace
    <toreplace>
      data toreplace
    </toreplace>
    toreplace
  </nsB:b>
</ns:a>

Desired output:
<?xml version="1.0" encoding="utf-8"?>

<ns:a xmlns:ns="http://www.replaceto.com" xmlns:nsB="http://www.replaceto.com/anything">
  <nsB:b>
    replaceto
    <replaceto>
      data replaceto
    </replaceto>
    replaceto
  </nsB:b>
</ns:a>

My best try so far:
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output omit-xml-declaration="no" indent="no"/>

<xsl:template match="*">
    <xsl:copy-of select="replace(., 'toreplace', 'replaceto')"/>
</xsl:template>

</xsl:stylesheet>

This produces output:
<?xml version="1.0" encoding="UTF-8"?>

    replaceto

      data replaceto

    replaceto

The problem I'm facing is that the output produced by the replace function omits everything but data, even though the same XPath expression (dot) does not omit anything in the following example:
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output omit-xml-declaration="no" indent="no"/>

<xsl:template match="*">
    <xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>

produces:
<?xml version="1.0" encoding="UTF-8"?>
<ns:a xmlns:ns="http://www.toreplace.com" xmlns:nsB="http://www.toreplace.com/anything">
  <nsB:b>
    toreplace
    <toreplace>
      data toreplace
    </toreplace>
    toreplace
  </nsB:b>
</ns:a>

What causes the different behavior of the seemingly same XPath expression? How do I resolve this? Do I need a completely different approach to achieve my goal?
Comment: Thank you very much for your quick response. As is, the xslt you referred to does not alter namespace URI, tag name, etc - as you stated in your answer there. I am sorry but I'm new to xslt and I still cannot modify the referred xslt to work the way I'd like it to: as I try to modify the referred xslt, I experience the same problem I had before: the output misses everything but data.
Answer: You can use this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="2.0">

    <xsl:template match="*[namespace-uri()[matches(., 'toreplace')]]" priority="1">
        <xsl:element name="{replace(name(), 'toreplace', 'replaceto')}" namespace="{replace(namespace-uri(), 'toreplace', 'replaceto')}">
            <xsl:apply-templates select="node()|@*"></xsl:apply-templates>
        </xsl:element>
    </xsl:template>

    <xsl:template match="node()|@*">
        <xsl:copy copy-namespaces="no">
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="text()[matches(., 'toreplace')]">
        <xsl:value-of select="replace(., 'toreplace', 'replaceto')"/>
    </xsl:template>

    <xsl:template match="*[matches(local-name(), 'toreplace')]">
        <xsl:element name="{replace(local-name(), 'toreplace', 'replaceto')}">
            <xsl:apply-templates select="node()|@*"></xsl:apply-templates>
        </xsl:element>
    </xsl:template>

    <xsl:template match="@*[matches(., 'toreplace') or matches(name(), 'toreplace')]">
        <xsl:attribute name="{replace(local-name(), 'toreplace', 'replaceto')}">
            <xsl:value-of select="replace(., 'toreplace', 'replaceto')"/>
        </xsl:attribute>
    </xsl:template>

</xsl:stylesheet>

Output
<ns:a xmlns:ns="http://www.replaceto.com">
    <nsB:b xmlns:nsB="http://www.toreplace.com/anything">
        replaceto
        <replaceto>
            data replaceto
        </replaceto>
        replaceto
    </nsB:b>
</ns:a>

Comment: _The string to replace can be data, xml tag name, namespace name URI or anything else within the xml document, I'd like it replaced either way._ The solution provided will not replace the text within element names, namespace value as required.
Comment: @AniketV, Ahh, i miss that part.
Comment: I greatly appreciate your help, Rupesh, thank you, your XSLT works beautifully for the first example xml I provided. However, it seems not to be generic enough. To demonstrate this, I extended my example xml with an additional namespace. Basically, what I would like to achieve here is to replace the toreplace string wherever it is in the input xml.
Comment: @Sely, Answer Updated. only thing change is second namespace is move to child element
Comment: Thank you for the update. Again, your xslt is not generic enough. "ns" and "nsB" are just examples of namespace names, they can be anything in different input xmls. Also, there can be a schema location declaration in the root node like xsi:schemaLocation="http://www.toreplace.com/anything" that needs to be changed. Simply put, I need all occurrences of "toreplace" to be replaced, regardless of the structure or content of the input xml.
Comment: @Sely, Answer Updated.
Comment: Thank you Rupesh, I really appreciate your updates. Your most recent version is pretty solid. The only issue still remaining is the one you noted in your earlier comment: the movement and redundant declaration of the namespace URI. Nevertheless, the resulting xml seems to work for me so the time critical issue is solved by you and for that I am very grateful.
Comment: @Sely, Glad to help you :)
Comment: @Sely, If this answer resolve your query, than accept the answer, so this question is marked as solved


Under what conditions are there only a finite number of distinct generating subsets of a vector space?

Question: Let $V$ be a vector space and $W$ be a subspace of $V$.
Define $I\triangleq \{S\subset W: \text{span} S= W\}$.
Since $\text{span} W=W$, $I$ is nonempty.
Under what conditions, is $I$ finite?
Moreover, i don't understand why subspace $W$ is in the hypothesis, since it seems to me that this hypothesis does not generalize anything more than just saying vector space $V$. Is there anything more general by saying "Let $W$ be a subspace of $V$" rather than not mentioning $W$ in this problem?
Comment: Hint: If $v$ appears in some spanning set, then you can replace $v$ by $av$ for any non-zero scalar $a$ and not change the fact that the set spans the entire space.
Comment: Consider the cases where $W$ has finite/infinite dimension over the field $K$. Consider $K$ finite/infinite.
Comment: @Tobias To be honest, i cannot think of any approach to attack this problem when $W$ is infinite. Would you give me a hint?
Comment: You're right, $V$ is useless here.
Answer: If $W$ is finite, how could $I$ be infinite? And if $W$ is infinite, what happens if you just remove a singleton from $W$? How many singletons are there?
Answer: Hint: Try to prove this (using the comments): $|I|<\infty \iff |W|<\infty$.
($W$ can be infinite either if the base field is infinite or if the dimension is infinite.)


Graphical components stuck on Kubuntu 16.04

Question: I have Kubuntu 16.04 with kde 5.6.5, and I cannot change the graphical components, I am stuck with the qtcurve style.
Here is a screenshot of the settings, as you can see, the style selected (and applied) is Fusion, but the qtcurve is still used.

I am using a laptop with intel graphics and nvidia card, and I had problems insalling drivers because of the optimus system.
While trying to reinstall my graphics drivers, I ended up installing the ubuntu desktop on my system (I don't remember the exact command).
On the login screen, I can now choose between plasma and Ubuntu.
I don't know if it's related, but I thought it was useful to mention it.
I tried rebooting, no luck.
This is not an urgent problem (qtcurve style is good), but this is annoying and I like having a working system :D
Any help is welcome.
Comment: Are you using Unity with KDE?
Comment: I never used Unity with KDE, but I think I installed it by mistake, because I can choose ubuntu in the log in screen
Comment: Installation is enough to override settings. You can't really use Unity with KDE.
Answer: Cause of the Problem
I experienced this same problem yesterday and discovered that, some packages was overriding QT style with gtk looks. The environment variables in question were QT_STYLE_OVERRIDE and QT_QPA_PLATFORMTHEME.
Solution
The solution is putting these lines in ~/.profile file to unset the environment variables.
## Fixing QT style override problem
if [ "x$XDG_SESSION_DESKTOP" == "xKDE" ] || [ "x$XDG_SESSION_DESKTOP" == "xplasma" ];
then
    unset QT_STYLE_OVERRIDE
    unset QT_QPA_PLATFORMTHEME
fi

Now, the style should be changeable and will persist.
Comment: well doing echo $QT_STYLE_OVERRIDE returns nothing, just a blank line
Comment: what is the output of `env | grep QT`? @Keplyx
Comment: QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
QT_ACCESSIBILITY=1
QT_QPA_PLATFORMTHEME=appmenu-qt5
QT_IM_MODULE=compose
Comment: Aha! found it. I've updated the answer. @Keplyx check it now
Comment: Still not working, but I think I know why. I'm dumb and said I was stuck with qtcurve, but this is wrong, I'm stuck with Style GTK+. This is because I had this problem: http://askubuntu.com/questions/812270/color-problem-on-kubuntu-16-04. So I changed the GTK2 theme to oxygen-gtk. Still don't know how to fix this tho
Comment: @Keplyx you added that to ~/.bashrc and logout and login? I too reproduced this problem and it solved that way
Comment: Yes, I added the lines in the .bashrc file in home directory (at the end of the file) but as I said, I'm stuck with gtk+ theme, not qtcurve, my mistake :/
Comment: What is the output of `env | grep QT` now?
Comment: QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
QT_ACCESSIBILITY=1
QT_IM_MODULE=compose
Comment: @Keplyx if that doesn't work, add those lines in `~/.profile` file. `.bashrc` might been ignored. I see a similar case now.


Update statement in linq with external SQL Server 2008 R2

Question: I have a problem with update of a table via linq.
I execute the following code for it
    tbl_Customer tblcust= new tbl_Customer();
    tbl_Customer tcust = obj.tbl_Customers.Single(c => c.C_ID == 1);
    tblcust.C_Name = txtcname.Text;
    tblcust.C_Address = txtcaddress.Text;
    tblcust.C_Mobile =Convert.ToInt64( txtcmobile.Text);
    obj.SubmitChanges();

But this code does not affect the records in table. I use an external SQL Server to connect with database, help me to resolve this stuff.
Comment: i think you should assign values to tcust and not tblcust which is an new object
Answer: Why would it? tblcust is nothing to do with the ORM, and the data-context (obj) has never heard of the object referenced by tblcust. You meant to update tcust instead:
tcust.C_Name = txtcname.Text;
tcust.C_Address = txtcaddress.Text;
tcust.C_Mobile =Convert.ToInt64( txtcmobile.Text);

tcust came from the ORM, and is known to the data-context's change manager, thus it will spot the changes to tcust and apply them to the database.


Repainting rendered exterior walls

Question: My daughter is painting the exterior of her house. The walls are rendered and were painted some 15 years ago. She used a Karcher pressure cleaner to clean the walls and there is no paint flaking.
To repaint, should she use a white sealer paint (primer) first? Then check the wall for any imperfections and fill them if she finds any? After that, she would do the first coat of final colour and wait a day. Then, finally, she'd apply the second final colour coat.
Would this be correct?
Comment: Sounds like a plan.  Applying the primer manually by brushing or rolling is helpful.  Using a thicker high build primer is also helpful.  After the surface is prepped the paint is the easy part
Comment: "there is no paint flaking"- you do not need to prime previously painted surfaces if they are in good condition (i.e. not chalky, no bubbles, crazing, alligatoring, peeling). Primer is for preparing *unpainted* surfaces, preparing surfaces for *specialty* coatings, or for preparing *problem* surfaces. There will be a zillion people telling you to (especially the folks *selling* primer) but it is BS.
Answer: Yes, your plan is a good one. As suggested by Damon using a brush to apply primer will best insure a bond to the wall. A roller may do well to in the larger areas. I would not concern yourself too much with a high build primer though since the paint is intact. If there were bare spots, that would be a different story. Primer has to just get on the surface, not fully color the wall the primer color. Although if the wall will take a drastic color change, the primer can be tinted to help change it. The main thing is getting the primer on a clean sound wall, grips onto the existing surface and allows the finish to grip onto it, no matter how thick the primer goes on. Once primer "wets" the surface and dries, its job is done.
Since this is the time for a good visual inspection on the outside of the house, now is the time to really scrutinize the wood trim that is typically around doors, windows and roof overhangs. When the paint finish begins to fail in these areas, there are small cracks in the paint at the joints in the wood or at the ends. The ends of the wood are highly susceptible to taking on moisture. since the nature of the tree is to draw in water when it is growing. Seriously, it does not change after it is cut. Capillary action is what at work here. Spot check to make sure these areas are detailed with cleaning and scraping if needed and recaulk to seal the joints to seal water out.

Repainting rendered exterior walls


Selected UITableViewCell changes background on Scroll

Question: I have a UITableView with transparent background color, each of its cells have a custom background view, and gray selection style. The selection works fine, but when i select and drag the tableview up or down, the cell changes its background to transparent instead of the custom one. What shall i look to fix it?
EDIT: Source Code as requested by André Morujão
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *CellIdentifier = @"Cell";

    RestaurantInfo *restaurantInfo = [requestBean.restaurantArray objectAtIndex:indexPath.row];

    UITableViewCell *cell = [tableView

                             dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        cell = [[[UITableViewCell alloc]

                 initWithStyle:UITableViewCellStyleDefault

                 reuseIdentifier:CellIdentifier] autorelease];

    }
    else {
        cell = nil;

        cell = [[[UITableViewCell alloc]

                 initWithStyle:UITableViewCellStyleDefault

                 reuseIdentifier:CellIdentifier] autorelease];

    }

    [cell setSelectionStyle:UITableViewCellSelectionStyleGray];

    UIImageView *bgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)];
    [bgView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"table_cell_bg.png"]]];
    [cell setBackgroundView:bgView];

    UILabel *restaurantNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, 310, 15)];
    [restaurantNameLabel setFont:[UIFont boldSystemFontOfSize:16]];
    [restaurantNameLabel setText:restaurantInfo.restaurantName];
    [restaurantNameLabel  setBackgroundColor:[UIColor clearColor]];
    [restaurantNameLabel  setUserInteractionEnabled:NO];
    [cell addSubview:restaurantNameLabel];

    return cell;
}

Comment: Can you paste your tableView:cellForRowAtIndexPath: ?
Comment: i have edited the question with the method
Answer: Sorry, these aren't necessarily the cause for your problem, but start by doing these:

no need for the else block (or did you just put it there for debugging purposes?)
it should be enough to apply the selectionStyle and background inside the if block (unless you're changing them somewhere else)
the restaurantNameLabel should probably be added to the cell's contentView and not directly as a subview
you're leaking restaurantNameLabel and bgView; add [bgView release] and [restaurantNameLabel release] after you're done with them

Also, are you using a UIImageView for any reason in particular? It'd probably be enough to use a UIView, or even just to apply a backgroundColor.
Comment: Solved. i changed

[cell setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"table_cell_bg.png"]]];

to

[cell.contentView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"table_cell_bg.png"]]];

and removed the backgroundview thing.
Comment: like you said, non of these changes solved the problem, any other clues?
Comment: applying a backgroundcolor to cell with pattern image doesnt help too
Comment: I forgot to mention: don't add the UILabel everytime; add it only in the if block and then retrieve it (using viewWithTag: or something similar) and set only the text outside the if block. Also, can you post screenshots of what it looks like before and after? (+ update your code to the latest version)
Comment: No problem. Don't forget to award the bounty :)
Comment: oh yes, its your's after 18 hours! :)
Comment: Ops, didn't know that - it's my first bounty :) Cheers


Integral or sum of $a^x(1-a^x)(1-a^x)$

Question: I'm intested in learning how to get a sum in difference calculus.  I'm willing to settle, at least for now, in learning how to integrate the following integral in calculus:
$\int(a^x(1-a^x)(1-a^x))dx$
The sum that I'm really interested in learning how to get, hopefully using difference calculus, is:
$\sum_x{a^x(1-a^x)(1-a^x)}$
Even better still, extend this technique to include more $(1-a^x)$, and add limits of integration or summation.
_EDIT_
I'd like to do so without multiplying everything out, if possible
Comment: If you have more factors $(1-a^x)$, you can still multiply out using the binomial theorem, and integrate termwise to get an answer in the form of a sum involving binomial coefficients. I doubt that these answers can be simplified very much. For example, trying `Integrate[E^x (1-E^x)^n, x] // Factor` in Mathematica with different values of $n$ doesn't show any obvious factorization pattern.
Answer: Well, integration is easy: just multiply everything out to get a sum where each term has the form $a^{kx} = e^{(k \ln a)x}$, then integrate term by term.
Comment: Summation is just as easy; sums of the form $a^{kx}$ are geometric series and converge absolutely for $|a|<1$.

Integral or sum of $a^x(1-a^x)(1-a^x)$


Load xml file with not escaped quotes

Question: I have a xml file with table of content. The problem is, that it contains not escaped quotes. How can I load the file and repair this quotes?
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.toc"?>

<topic label="Main Topic" href="0.2.1.html#0.2.5">
    <topic label="Topic "Sales"" href="0.2.1.html#18.104.22.168"/>
</topic>

I know that in the standard stays:
In the content of elements, character data is any string of characters which does not contain the start-delimiter of any markup

The source doesn't escape the quotes and I cannot change the source. How can I repair the xml file locally?
Comment: This simply isn't valid XML. If I ever had to work on that, I would tell the originator to correct it. Period. If you really want to _repair_ it, you unfortunately cannot use an XML parser, but must do it on your own.
Comment: You might look into running it through a parser like jsoup. I don't know that it will fix it but it does fix other XML format issues.
Comment: @Micheal Kay: I think this rule relates only to the question and depends on how the question is formulated. If someone asks explicitly for a library or tool, then he or she should better go to [Software recommendations](http://softwarerecs.stackexchange.com/). But it's ok to recommend a tool or library in an answer to prevent to reinvent the wheel.
Comment: I already told the originator to correct it, but the problem is, that my code won't be compatible with previous versions of the product. So I have to repair it by myself. Do you know any Tools, that might help me to escape the quotes?
Comment: I do not know of such tools. I think you have to write it yourself. Additionally, I fear that asking for such tools (or libraries) is off-topic for SO.
Comment: The main problem it that it is ambiguous, for example `a="b" c="d"` can be setting a to `b" c=" d` or setting a to `b` and c to `d`.
Comment: Well, there is always "label" and "href" property in a  tag. I can do it by myself but I was wondering if there's something, that I can use. And I don'T think, that asking about frameworks/tools is offtopic in SO.
Comment: @aphex: [Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic](http://stackoverflow.com/help/on-topic)
Comment: @vanje If I interpret your remarks literally, you're saying we can tell the originator how to write code to solve the problem, but we can't tell him that the code has already been written and he can download it. That's patently absurd.
Comment: @vanje: So my question is not a off-topic in that case.
Comment: @aphex: No, I think your question is not off-topic.
Answer: Don't call it XML when it isn't.
If you want to process this file you'll need to discover what rules (grammar) it conforms to, and write a parser for that grammar. This may be rather difficult; I suspect the grammar, when you discover it, will be ambiguous and will require infinite lookahead to resolve.
Comment: You solve the problem by rigorous adherence to standards. Don't tolerate non-conformance; trying to interoperate with stuff that's essentially garbage will always cost you more than it's worth.
Comment: If your stuff is XML, then any random string of characters is XML, and the term XML has ceased to have any meaning. If you must handle it, then the first step is to acknowledge that it is not XML and that XML tools will be of no use to you. The next step is to understand what it actually is: that is, reverse-engineer a language specification that your parser will be written to handle.
Comment: @aphex I have seen too many systems that have turned into an unmaintainable mess after a few of such "workarounds". Sometimes the problems surfaced only years after the "fix" was built in and nobody could remember it.
Comment: Broken bike is still a bike, right? What about broken xml? I know it doesn't conform xml, but it is still xml. Do you guys never had the chance to use a broken xml from a source, that can't be fixed? Do you write a parser, or do you look first for a way to repair the format and use the xml frameworks?
Comment: how do you solve that problem? Let's say we have a broken xml generator, which is delivered to many providers. Now I need to write a new feature, which depends on that. I can fix the broken generator, but the old providers remain with the same, until they upgrade their generator.

If I support only the new format, the other parties will suffer, that the broken one is not compatible. What would you do in this case?

Load xml file with not escaped quotes