text:
Q: Texture values clipped to the range 0-1? SIMPLE QUESTION:
Does OpenGL clip texture values to the range 0-1 by default? And if it does is there a way to disable this?
DETAILED QUESTION:
I have a texture which, when created, I put some default values in.
I create the texture of RGBA values size 16x16 like this:
//Generate the texture and get its ID
GLuint texID;
glGenTextures(1, &texID);

//Bind the texture
glBindTexture(GL_TEXTURE_2D, texID);

//Define the size of the texture
int width = 16;
int height = 16;
int numberOfElementsPerTexel = 4;
int size = width * height * numberOfElementsPerTexel;

//Create an empty array of texel data
float data[size];
std::fill_n(data, size, 0.0f);

//Add the empty data to the texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, GL_RGBA, GL_FLOAT, data);

To test this works correctly after I create and fill the texture I inspect the contents like this:
//Bind the texture
glBindTexture(GL_TEXTURE_2D, texID);

//Get the data from the texture
float texData[size];
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, texData);
{
    for(int i = 0; i < size; i++)
    {
        printf("Value at %d: %f\n", i, texData[i]);
    }
}

So this gives a load of 0's as I would expect, then as another test before I call glTexImage2D I modify one of the values in the array of data:
data[0] = 1.0f;

And as expected this adds a 1.0 in the first number to be printed out. Any number between 0 and 1 prints out as expected however any number greater than 1 or less than 0 clips to that range?
This sounds like it could be because the texture stores colour values and therefore clips to the range of RGBA values. Is this the case or am I doing something wrong?
And if this is the case is there a way to disable it? I'm looking to store arbitrary data in the texture not colour values its just I'm looking to improve performance because the texture/texture lookup structure is highly optimised in the GPU

A:
Does OpenGL clip texture values to the range 0-1 by default?

Sometimes - depending on the way you are accessing the texture and the texture's internal format.

And if it does is there a way to disable this?

Not really, but you can change the internal format to get what you want.
GL Spec 4.6, Section 2.3.5 Fixed-Point Data Conversions:

When generic vertex attributes and pixel color or depth components are
  repre- sented as integers, they are often (but not always) considered
  to be normalized. Normalized integer values are treated specially when
  being converted to and from floating-point values, and are usually
  referred to as normalized fixed-point. Such values are always either
  signed or unsigned.
...
The conversion from a floating-point value f to the corresponding
  unsigned nor- malized fixed-point value c is defined by first clamping
  f to the range [0, 1], then

The following call is deceiving as GL_FLOAT is given for the texture format (which just says the data you give it is 32 bit floating point). The internal format is GL_RGBA. I believe most implementations end up using essentially GL_RGBA8 to store this, i.e. 8 bits per channel like unsigned char r, g, b, a (although this is not required by the spec). From the above section of the GL spec, the input data values values will be clamped and then converted and to fixed point. 0.0f and below becomes 0 and 1.0f and above becomes 255.
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, GL_RGBA, GL_FLOAT, data);

The same happens when you read and write with such textures in a shader. The integer values get transparently scaled to the [0, 1] range. In your case, reaing with glGetTexImage + GL_FLOAT also scales the integer values to back down to [0, 1] but the data you passed in has already been clamped. If instead you read with GL_UNSIGNED_BYTE and an unsigned char/GLubyte array, you should see 0 to 255. When accessing textures it's probably faster to access it with the same format as the internal format. Then there's no need for a conversion.
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, texData);

In short, yes, anything outside the range 0 to 1 gets clamped (eg. using an FBO to write to a typical RGB/A texture). If you don't need the precision but still want numbers bigger than 1 you could scale the values beforehand.
If you need more precision you could use GL_RGBA32F, as below. In this case no conversion is required - your input is the same as the texture storage and clamping does not happen. The downside is it would take up 4 times as much data, which means 4 times as much to transfer when accessing. Of course this isn't just more regular precision because you get the exponent representation in the floating point format.
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, height, GL_RGBA, GL_FLOAT, data);


text:
Q: How do you get non-technical folks to appreciate a non-UI problem? Suppose you're working on an enterprise project in which you have to get management signoff in order for you to develop a new feature set. Usually your management has no problem signing off on some bright shiny new UI feature. Unfortunately they have a hard time appreciating some behind-the-scenes issues that are crucial to the application's well-being such as transactions, data integrity, workflow routing, configurability, security, etc. Since they're non-technical and these issues are not immediately visible, it's not obvious to them that this is crucial.
How have you convinced them that these infrastructural issues have to be dealt with and that it is important to their business process?

A: Same thing folks have been doing for thousands of years: draw pictures. Diagram the problems, use visual metaphors familiar to your audience, drag the problem into their territory.
Assuming they're not being intentionally obtuse...

A: A big +1 for analogies and metaphors.  If possible, find one that will resonate with the personal interests of your audience (if it's 1-2 people).  For general metaphors, I often find myself using commuter traffic or subways, for some reason.
e.g. We are currently migrating an app from an OODB to Postgres/Hibernate: the bulk of this work is done in Release '4'.  Many domain experts have been asking why there are so few user-facing features in R4.  I regularly tell them that we have been 'tearing up the city to put in a subway. It is very expensive and undeniably risky, but once it is done, the benefits in R5+ will be astounding, truly.'  The true conversation is more involved, but I can return to this theme again and again, well after R4.  Months from now, I hope to say "You asked for X and it is now very easy -- precisely because you let us put in that subway back in R4".

A: The surest way to get upper level management to buy off on development work is to present it in a quantifiable way.  Ideally this quantifiable measure is in $$.   You need to explain to them the consequences of skimping on data integrity, security, transactions, etc. and how that will affect the customer\user community and eventually the bottom line.  You should be careful in these situations because sometimes management expects these non-functional requirements to "just work."  If this is the case, you should either estimate high and work on these items alongside the visible UI work (ignorance is bliss) or you need to document these areas of need as you communicate with management so if things do go bad as you anticipate, it's not your job that is on the line.

A: Every craft has its unsexy sides. Things that HAVE to be done, but nobody notices them directly. In a grocery store somebody has to organize how and when to fill the grocery shelves so they always look fresh. In a laundry you need somebody who thinks about how the processes should be optimized so that the customer gets his clothes in time.
The tricky part is: The customer won't notice when these subtle things have been done right UNTIL HE NOTICES THEY ARE MISSING! Like when the laundry is not ready on time but two days late, or the veggies in the super market have brown spots and look terrible.
Same goes for IT. You don't notice good transactions until your major customer knocks on your door and tells you that an important and expensive project has failed because the database entries of your product were mysteriously mixed up. You don't notice good security until customer credit card information shows up in Elbonia (and soon after word is in the national newspapers warning customers of your company).
The thing you really have to hammer in again and again and again is that software is NOT static. It has to be cared for even after its initial development phase is over. It is not just a product you buy once and forget about. Every car manufacturer knows that services is of prime importance to the products they build, simply because things WILL occur that have to be fixed and improved. It's the same with software.
So make a presentation, visualize, verbalize, translate your technical information into benefits. Business people don't care about your wish for code aesthetics in a refactoring project, but they WILL understand that your changes will help the product to become more reliable, gain a better reputation and reduce the amount of future service requests. Make them understand by showing them the benefits!

A: Unfortunately, it usually takes a disaster or two before this stuff gets the attention it deserves.
It really depends what your management is like, but I've had luck with good old honest-to-goodness fearmongering. If you go through a couple of disaster scenarios, and point out someone's going to get blamed if they occur, that can be enough to make their arsecovering instincts kick in and finally pay attention :)

A: I'm battling with essentially the same kind of situation. Whether it is sign-off by management or acceptance by a user/sponsor, the problem remains one of different vocabularies, priorities and perspectives. I asked a simmilar question here.
I also got diverse answers, tantalizingly close to useful, but not quite definitive enough. Browsing and searching SO using relevant keywords led me to find usable insights in various answers spread out over many unrelated questions. To find and extract these gems led me to pose this question on site-mining.
It would have been useful to be able to flag the various answers and see them all in a single list, but alas, that functionality is not yet available in SO. I suggested it on uservoice.
Hope you find something you can use from the references I gave.

A: Car analogies.
Everybody knows that 'system' and it's sufficiently complex to depict the dire situation.

A: The right kind of countering question is the secret.

*

*Is it okay to crash every 5 web pages?

*Do we have to protect the credit card numbers?

*Is is okay to have to pay contractors to deploy a patch every weekend?

*Did you want it now or did you want it to work?

A: Robustness.   When it comes down to it, you need to talk their language, which is how it affects their bottom line.  If its a security or correctness issue, you need to tell them that customers aren't going to want incorrectly acting products, no matter how nice they look.

A: A descriptive picture really helps non-technical people understand what you are talking about.  For example, below is an example from Sun describing how information is processed in one of their somewhat complex applications.

(source: sun.com)
Trying to explain this application in words would be impossible to a non-techy.  Pointing at the diagram and say look, this part is our weak point, we need to improve it.  That will make sense to them.  If they feel like they have some understanding of what you are doing, they will be far more willing to support your request.

A: I like the idea of Technical Debt, because it enables technical issues to be translated (albeit loosely) into money issues -- and money is something most managers do understand.
Although the idea of technical debt was originally applied to architectural issues, it can be used more broadly for any type of situation where there is pressure to take a shortcut -- that is, go into technical debt -- rather than do it right the first time.  (Doing it right is the equivalent to saving up to buy something -- it takes time -- rather than buying it on credit and going into debt.)
Just as debts can be good (e.g. home loans) and bad (e.g. credit cards), so technical debt can be good and bad.  I won't try to characterise the differences completely, but good technical debt can be tracked accurately, so that you know how much in debt you are.
So, try to explain your important, non-UI problem in terms of technical debt, and the cost of not fixing it in terms of paying interest on that debt.

redpajama_set_name: RedPajamaStackExchange


text:
Q: html5-jquery change of checkbox not triggered I used the method described in https://proto.io/freebies/onoff/ to implement an on/off switch in html5.
The switch itself works fine, click on it and it gets the other state and you can query the checked state of the input/checkbox and that too works as expected.
When you click the switch I'd like some action to be performed from javaScript, but there is no event I can capture that does the job.
Any suggestions ?

$(document).ready(function () {
        $('#myonoffswitch').change(function () {
              dosomething();
        });

    });
.onoffswitch {
        margin-top: 15px;
        position: relative;
        width: 90px;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .onoffswitch-checkbox {
        display: none;
    }

    .onoffswitch-label {
        display: block;
        overflow: hidden;
        cursor: pointer;
        border: 2px solid #FFFFFF;
        border-radius: 20px;
    }

    .onoffswitch-inner {
        display: block;
        width: 200%;
        margin-left: -100%;
        transition: margin 0.3s ease-in 0s;
    }

        .onoffswitch-inner:before, .onoffswitch-inner:after {
            display: block;
            float: left;
            width: 50%;
            height: 30px;
            padding: 0;
            line-height: 30px;
            font-size: 14px;
            color: white;
            font-family: Trebuchet, Arial, sans-serif;
            font-weight: bold;
            box-sizing: border-box;
        }

        .onoffswitch-inner:before {
            content: "User";
            padding-left: 10px;
            background-color: #70FF99;
            color: #FFFFFF;
        }

        .onoffswitch-inner:after {
            content: "Admin";
            padding-right: 10px;
            background-color: #EB5555;
            color: #FFFFFF;
            text-align: right;
        }

    .onoffswitch-switch {
        display: block;
        width: 18px;
        margin: 6px;
        background: #FFFFFF;
        position: absolute;
        top: 0;
        bottom: 0;
        right: 56px;
        border: 2px solid #FFFFFF;
        border-radius: 20px;
        transition: all 0.3s ease-in 0s;
    }

    .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
        margin-left: 0;
    }

    .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
        right: 0px;
    }

            <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch">

A: The code itself is working fine. All you have to do is execute your operation inside the change action of the switch.

$(document).ready(function () {
        $('#myonoffswitch').change(function () {
              console.log('works');
        });

    });
.onoffswitch {
        margin-top: 15px;
        position: relative;
        width: 90px;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .onoffswitch-checkbox {
        display: none;
    }

    .onoffswitch-label {
        display: block;
        overflow: hidden;
        cursor: pointer;
        border: 2px solid #FFFFFF;
        border-radius: 20px;
    }

    .onoffswitch-inner {
        display: block;
        width: 200%;
        margin-left: -100%;
        transition: margin 0.3s ease-in 0s;
    }

        .onoffswitch-inner:before, .onoffswitch-inner:after {
            display: block;
            float: left;
            width: 50%;
            height: 30px;
            padding: 0;
            line-height: 30px;
            font-size: 14px;
            color: white;
            font-family: Trebuchet, Arial, sans-serif;
            font-weight: bold;
            box-sizing: border-box;
        }

        .onoffswitch-inner:before {
            content: "User";
            padding-left: 10px;
            background-color: #70FF99;
            color: #FFFFFF;
        }

        .onoffswitch-inner:after {
            content: "Admin";
            padding-right: 10px;
            background-color: #EB5555;
            color: #FFFFFF;
            text-align: right;
        }

    .onoffswitch-switch {
        display: block;
        width: 18px;
        margin: 6px;
        background: #FFFFFF;
        position: absolute;
        top: 0;
        bottom: 0;
        right: 56px;
        border: 2px solid #FFFFFF;
        border-radius: 20px;
        transition: all 0.3s ease-in 0s;
    }

    .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
        margin-left: 0;
    }

    .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
        right: 0px;
    }

            <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch">

A: I tried your code and it is working fine for me..
Try this:

        <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch">


text:
Q: HTML5 Canvas loaded using a onclick event How would I go about adding a html5 canvas element on a click function or does it need to be on document ready or load?
What I would like to do is create a way to use the canvas to act as a highlighter, the user clicks the hightlighter button, then draws the highlighted mark.
I was thinking of including this on a click event so I could continue to use my touchwipe events.  THis is on an Android device, I currently have a slider cycling through rasterized pages of a book that I want to allow users to markup.  The canvas element would sit on top of the img's and be semi transparent.
Can anyone point me in the right direction?

A: canvas element behaves like other dom elements in this case. Try:
var x = $('<canvas height="100px" width="100px"> </canvas> '),
    y = x[0].getContext('2d');

y.strokeRect(0,0,50,50)

x.appendTo('body')


text:
Q: Response.isSuccessfull() is false Help me out.
I am using retrofit for my project and I am totally new on it. I am getting the following error. Why I am getting a false response?
2020-02-20 15:35:26.230 22602-22602/q.goaldiggers.auth_api_testing
D/Ayush: Response
2020-02-20 15:35:26.230 22602-22602/q.goaldiggers.auth_api_testing
D/Ayush:
Response{protocol=http/1.1, code=402, message=Payment Required,
url=https://quizziyapa.herokuapp.com/getTopics}
2020-02-20 15:35:26.230 22602-22602/q.goaldiggers.auth_api_testing
D/Ayush: Payment Required
2020-02-20 15:35:26.230 22602-22602/q.goaldiggers.auth_api_testing
D/Ayush: okhttp3.ResponseBody$1@647c751
2020-02-20 15:35:26.230 22602-22602/q.goaldiggers.auth_api_testing
D/Ayush: null
2020-02-20 15:35:26.230 22602-22602/q.goaldiggers.auth_api_testing
D/Ayush: false
2020-02-20 15:35:26.230 22602-22602/q.goaldiggers.auth_api_testing
D/Ayush: retrofit2.OkHttpCall$NoContentResponseBody@4f0bbb6
[Error][1]

JSON Structure
This is my json structure.
{
    "topics": [
        {
            "_id": 2,
            "topic": "abc",
            "imageUrl": "abc12345"
        },
        {
            "_id": 3,
            "topic": "abc",
            "imageUrl": "abc12345"
        }
    ]
}

Topic.java
My Model class
public class Topic {
    int _id;
    String topic;
    String imageUrl;

    public Topic(int _id, String topic, String imageUrl) {
        this._id = _id;
        this.topic = topic;
        this.imageUrl = imageUrl;
    }

    public int getId() {
        return _id;
    }

    public String getTopic() {
        return topic;
    }

    public String getImageUrl() {
        return imageUrl;
    }
}

TopicResponse.java
JSON response class
public class TopicResponse {
    @SerializedName("topics")
    Topic[] topics;

    public TopicResponse(Topic[] topics) {
        this.topics = topics;
    }

    public Topic[] getTopics() {
        return topics;
    }
}

IUserApi.java (API Interface)
public interface IUserApi {
    @GET("getTopics")
    Call<TopicResponse> getTop();
}

MainActivity.java
Retrofit retrofit = new Retrofit.Builder()
                .baseUrl("https://quizziyapa.herokuapp.com/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        IUserApi api =  retrofit.create(IUserApi.class);
        Call<TopicResponse> call= api.getTop();
        call.enqueue(new Callback<TopicResponse>() {
            @Override
            public void onResponse(Call<TopicResponse> call, Response<TopicResponse> response) {
                Log.d("Ayush", "Response");
                Log.d("Ayush", String.valueOf(response));
                Log.d("Ayush", String.valueOf(response.message()));
                Log.d("Ayush", String.valueOf(response.errorBody()));
                Log.d("Ayush", String.valueOf(response.body()));
                Log.d("Ayush", String.valueOf(response.isSuccessful()));
                Log.d("Ayush", String.valueOf(response.raw().body()));
            }

            @Override
            public void onFailure(Call<TopicResponse> call, Throwable t) {
                Log.d("Ayush", "Failed \n"+t.getMessage());
            }
        });

Help me out what should I do to solve this issue?

A: Well, from the looks of it, the problem is not with the code. The response you are receiving is not a success message rather a 402 errorCode with the message stating "Payment Required".
The reason for this as per the official docs of the API you are using says

either the account has become delinquent as a result of non-payment, or the account's payment method must be confirmed to continue

Check the image below for reference.
.
So basically its the server returning you an error code. and your response.isSuccessful will ultimately be false unless you get a success message in response i.e one of the statuses shown in the image.

A: I think I have found a solution. This API is working perfectly fine over browser and Postman too. But if you notice on PostMan, the status is 402
As per MDN Web Docs

The HTTP 402 Payment Required is a nonstandard client error status response code that is reserved for future use.

Since, retrofit follows status code 200 as success, the response body in your case is null.
However, if you closely look at the debug console, the value (json) is present, but in the errorBody.

I am not sure why Heroku is sending 402 request, but as per ljk's answer, it seems your account is not fully activated.
You can further readout Retrofit Class Response,

Returns true if code() is in the range [200..300).


text:
Q: Can't run go web serve in goroutine on Linux (Mint) I am trying to start a web server inside my go application. When I run my code on Windows everything works as expected. The application runs it starts the web server and then waits. On linux it appears to do the same thing except I am unable to access the web server.
If I start the web server without using a goroutine the server works, it's only when I use a goroutine that it fails.
package main

import (
    "fmt"
    "log"
    "net/http"
)

func main() {
    // go startWebServer()  // This only works on Windows.
    // startWebServer()     // This works on both Windows and Linux.
    fmt.Println("Started web server...")
    for {}
}

func startWebServer() {
    fileServer := http.FileServer(http.Dir("./web"))
    http.Handle("/web/", http.StripPrefix("/web/", fileServer))
    log.Fatal(http.ListenAndServe(":8101", nil))
}

I have a simple HTML file in my web folder, any valid HTML will do.

THIS IS A TEST

Then I point the browser to http://127.0.0.1:8101/web/index.html
On Windows I get my page regardless of which method I use.
On Linux I can only get to my page if I DON'T use a goroutine.

A: Actually that depends on the number cores available in the CPU. That's how go routines works. In your case running the same program on Windows provide all the cores available for your go routine to run.
But when you are running your program on virtual linux OS. It will limit to less number of resource.
To check that how many cores your program is using use GOMAXPROCS on both linux and windows separately.
package main

import (
    "runtime"
    "fmt"
)

func getGOMAXPROCS() int {
    return runtime.GOMAXPROCS(0)
}

func main() {
    fmt.Printf("GOMAXPROCS is %d\n", getGOMAXPROCS())
}

Working Code on Go playground

GOMAXPROCS sets the maximum number of CPUs that can be executing
  simultaneously and returns the previous setting. If n < 1, it does not
  change the current setting. The number of logical CPUs on the local
  machine can be queried with NumCPU. This call will go away when the
  scheduler improves.

Note: Also do not use never ending loop even if you want to wait for go routine use WaitGroups.


text:
Q: How do I save multiple objects to a JSON column in MySQL and Laravel I am using Laravel 5.4 and I have a problem in that when I save out a group of checkboxes, it only saves one of them if I save it like this:
  {!! Form::checkbox('languages[name]', 'English') !!} English

  {!! Form::checkbox('languages[name]', 'French') !!} French

  {!! Form::checkbox('languages[name]', 'Spanish') !!} Spanish

But it gives me a workable format in that I can run searches on name. The output here is just the first one I checked but in this format:
{"name": "English"}

If I take out the array field name in the [].
  {!! Form::checkbox('languages[]', 'English') !!} English

  {!! Form::checkbox('languages[]', 'French') !!} French

  {!! Form::checkbox('languages[]', 'Spanish') !!} Spanish

It saves all the values but it doesnt give me a workable format for my searches etc. The output here is:
["English", "French"]

My function in Laravel is like this
        public function store(Request $request)
{
    $data = $request;
    dd($data['languages']);
    $resource = Resource::create([
        'user_id' => auth()->id(),
        'status_id' => $status,
        'title' => $data['title'],
        'languages' => $data['languages'],
    ]);
    return redirect($resource->path());
}

The column in MySQL called 'languages' is a JSON type.
Now ideally, I would like to get something similar to {"name": "English"} but not just saving as one item but all of them.
Any suggestions?

A: You can do the following:
 {!! Form::checkbox('languages[][name]', 'English') !!} English

 {!! Form::checkbox('languages[][name]', 'French') !!} French

 {!! Form::checkbox('languages[][name]', 'Spanish') !!} Spanish

It will give you:
"languages" => array [
    0 => array: [
        "name" => "English"
    ],
    1 => array: [
        "name" => "French"
    ],
    2 => array: [
        "name" => "Spanish"
    ]
]


text:
Q: How to store predicates permanently? When I'm chatting with my bot, it temporarily stores predicates about me in a session file, so that, for the current session, it knows my name, gender, age, etc, whatever comes up about me in that session.  So question #1 would be: Is my understanding correct?
If so, where is that session data stored?
I want to put in persistent sessions, so that when I identify myself, the bot loads the predicates associated with me.  If someone can help me figure out how to do that, or at least how AIML temporarily stores that info, I'm pretty sure I can capture that info and save it in a file that get's loaded each time.  From there it's pretty trivial to have files for other users so the chat experience is a bit more personalized, ie: once the bot knows who you are it can retrieve the info it previously knew about you.
In the PyAIML docs there is a very brief discussion about persistent sessions, but I can't seem to get it to work and I think it's because I'm not asking it to retrieve the proper info.  I've contacted Cort, and he's been wonderful, but he has moved on to other things and doesn't remember much about this project.  He's also a very busy guy with work and a new family and such, and I figured maybe someone here could help me figure it out as I don't want to "overstay my welcome" as it were with him.
Any suggestions/ guidance?


text:
Q: How to create more SKScene in addition to GameScene I tried to create a new subclass of SKScene "MainScene" like the one apple created the GameScene.
I want to create more scene in addition to my "GameScene" but its not working.
Below is my subclass code.
MainScene :
import SpriteKit
#if !os(iOS)
import AppKit
#endif

class MainScene : SKScene {

    override func didMoveToView(view: SKView) {

        backgroundColor = UIColor.blueColor()

       }

}

MainSceneViewController :
import UIKit
import SpriteKit

class MainViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        if let scene = MainScene(fileNamed:"MainScene") {
            // Configure the view.
            let skView = self.view as! SKView
            //skView.showsFPS = true
            //skView.showsNodeCount = true

            /* Sprite Kit applies additional optimizations to improve rendering performance */
            skView.ignoresSiblingOrder = true
            skView.showsPhysics = true

            /* Set the scale mode to scale to fit the window */
            scene.scaleMode = .AspectFill

            skView.presentScene(scene)
        }
    }

Error : "Could not cast value of type 'UIView' (0x1097f2b20) to 'SKView' (0x108a4cad0)."

A: When creating a new scene,  you need to actually create a new scene file,  not just the code behind file.
To create new scene files, go to file, New, File,  then in your sections go to iOS, SpriteKit Scene.  This will create the sks file you need.
edit:
In the case you are getting the error Could not cast value of type 'UIView'  to 'SKView',  this is due to the fact that in your story board,  your ViewControllers main view does not have a custom class of SKView.  In your storyboard file, open up your view controller,  click the view for this controller,  make sure the right panel is visible, and select the identity inspector tab (It is probably the 3rd from left,  looks like a flag or an envelope with a window).  Under Custom Class, look for the class text box, and put in SKView

A: To create more SKScene in addition to GameScene

*

*Go to New File

*Select Coca Touch Class

*Click on Next

*SubClass : Type Manually SkScene

*create

*import SpriteKit


text:
Q: My jquery code is not running in the proper order and I can't tell if a file exists or not I wrote this code to check if a file exists and if it does, do one thing and if it doesn't, do another by creating a variable.

The problem with it is that for some reason, $.get runs after everything else, no matter what I do. Why is this happening and how do I solve it. I'm fine with a totally new method of checking if a file exists, but this is the best I could find. The $.get releases a 404 error if it does not find a file, meaning that the code inside of it only runs if it finds a file, which is why I had it set a variable inside of there and had the if statement be reliant on the variable.
PS: the code only works if it is uploaded to the internet, not as a file on a computer, which is really annoying.

A: Update:
I just figured it out and it works now. Thank you so much. Here is the code I'm using now from another question which didn't work when I tried it earlier, but it is all good now:


text:
Q: Em PHP, existe diferença entre Double e Float? Em algumas linguagens de programação, Float e Double, apesar de parecidos, não são a mesma coisa. Porém aparentemente no PHP não há diferença entre esses dois tipos.
Existe alguma razão especial para isso? Porque o cast de Double e Float resultam na mesma coisa?
 gettype( (double) '1.66' ); // double

 gettype( (float) '1.66' ); // double

 is_double(1.66); // true

 is_float(1.66); // true

A: Para completar a resposta do Francisco, é válido colocar o código fonte em C da implementação do PHP. Por exemplo, ao utilizar a função settype, a documentação recomenda:

Os valores possíveis para type são:

*

*"float" (somente para versões acima do PHP 4.2.0, para versões antigas use a variação depreciada "double")

Ou seja, você precisará definir como float ao invés de double, mas verificando a implementação da função, temos:
/* {{{ proto bool settype(mixed &var, string type)
   Set the type of the variable */
PHP_FUNCTION(settype)
{
    zval *var;
    char *type;
    size_t type_len = 0;

    ZEND_PARSE_PARAMETERS_START(2, 2)
        Z_PARAM_ZVAL_DEREF(var)
        Z_PARAM_STRING(type, type_len)
    ZEND_PARSE_PARAMETERS_END();

    if (!strcasecmp(type, "integer")) {
        convert_to_long(var);
    } else if (!strcasecmp(type, "int")) {
        convert_to_long(var);
    } else if (!strcasecmp(type, "float")) {
        convert_to_double(var);
    } else if (!strcasecmp(type, "double")) { /* deprecated */
        convert_to_double(var);
    } else if (!strcasecmp(type, "string")) {
        convert_to_string(var);
    } else if (!strcasecmp(type, "array")) {
        convert_to_array(var);
    } else if (!strcasecmp(type, "object")) {
        convert_to_object(var);
    } else if (!strcasecmp(type, "bool")) {
        convert_to_boolean(var);
    } else if (!strcasecmp(type, "boolean")) {
        convert_to_boolean(var);
    } else if (!strcasecmp(type, "null")) {
        convert_to_null(var);
    } else if (!strcasecmp(type, "resource")) {
        php_error_docref(NULL, E_WARNING, "Cannot convert to resource type");
        RETURN_FALSE;
    } else {
        php_error_docref(NULL, E_WARNING, "Invalid type");
        RETURN_FALSE;
    }
    RETVAL_TRUE;
}
/* }}} */

Onde destaca-se as linhas:
} else if (!strcasecmp(type, "float")) {
    convert_to_double(var);
}

Se o tipo for float, converte o valor para double. E o tipo definido como double foi tornado obsoleto sabe-se lá porquê (a buscar a informação no changelog).
O mesmo ocorre com a função floatval:
/* {{{ proto float floatval(mixed var)
   Get the float value of a variable */
PHP_FUNCTION(floatval)
{
    zval *num;

    ZEND_PARSE_PARAMETERS_START(1, 1)
        Z_PARAM_ZVAL(num)
    ZEND_PARSE_PARAMETERS_END();

    RETURN_DOUBLE(zval_get_double(num));
}
/* }}} */

Retornando o próprio tipo double.

O arquivo fonte completo pode ser visto no repositório oficial da linguagem.

A:
Existe diferença entre Double e Float ou Real?

Não, não existe diferença alguma entre o double, float ou real no php.

Existe alguma razão especial para isso?

Sim! Praticidade e para simplificar as coisas também. Em C, que é onde o PHP é feito, as variáveis são armazenadas em uma estrutura, que consiste em uma união entre vários tipos de dados que a variável poderia armazenar, como boolean, string, int, e double, que é como é armazenado todos os valores com casas decimais, independente se ele foi considerado double, float ou real, no php.
Você pode ver mais sobre isso aqui.

Porque o cast de Double e Float resultam na mesma coisa?

Como eu disse na resposta acima, por trás dos panos (em C), tudo acaba sendo transformado em double.


text:
Q: VS is telling me that "the name 'xxx' does not exist in the current context" regardless of container datatype even though I just had initialized it I'm doing a homework assignment in my ASP.net (core) class to make a simple MVC app that displays a list (or array or whatever) of students and will only display their names if the user is not of a high enough level (but this will come later). I've got the model named StudentModel finished and am trying to creating a global array of StudentModels inside of the controller so that I can use them to display the info inside it in the cshtml file where they are to be displayed.
Here is my StudentModel code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;

namespace CIS174_TestCoreApp.Models
{
    public class StudentModel
    {
        public string FirstName { get; set; }

        public string LastName { get; set; }

        public double Grade { get; set; }

        public void SetInfo(string firstName, string lastName, double grade)
        {
            this.FirstName = firstName;
            this.LastName = lastName;
            this.Grade = grade;
        }
    }
}

Here is my controller code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CIS174_TestCoreApp.Models;
using Microsoft.AspNetCore.Mvc;

namespace CIS174_TestCoreApp.Controllers
{
    public class StudentController : Controller
    {

        //List<StudentModel> students = new List<StudentModel>();

        public StudentModel[] S = new StudentModel[5];
        S[0] = new StudentModel;
        S[0].SetInfo("Harry", "Potter", 3.0);

        //students.Add(new StudentModel {FirstName = "Harry", LastName = "Potter", Grade = 3.0});

        public IActionResult Index()
        {
            StudentModel model = new StudentModel();
            return View(model);

        }

        [HttpPost]
        public IActionResult Index(StudentModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            return View(model);
        }
    }
}

Am I putting this array in the wrong place or something? I just wanna be able to use the array in my razor tags on the cshtml output page. You can see in the code where I tried to do the same thing with a list but it causes this exact same error regardless of what datatype I use to contain the objects. Even a single object does not work. Also, after this main question is figured out, if you could also point me in the right direction of using this array in the display page, that would be very nice too.

A:
Am I putting this array in the wrong place or something?

Yes. You are writing statements inside your class definition.
They need to be inside a method. You can put them in your constructor.
public class StudentController : Controller
{
    public StudentController()
    {
        StudentModel[] S = new StudentModel[5];
        S[0] = new StudentModel;
        S[0].SetInfo("Harry", "Potter", 3.0);
    }

    ... your actions
}

If you want this to be a member, you can define the member in your class definition, but the initialization happens in a method.
public class StudentController : Controller
{
    public StudentModel[] S;

    public StudentController()
    {
        S = new StudentModel[5];
        S[0] = new StudentModel;
        S[0].SetInfo("Harry", "Potter", 3.0);
    }

    ... your actions
}

If you want to initialize it in the definition, you need slightly different syntax.
public class StudentController : Controller
{
    public StudentModel[] S = new StudentModel[]
    {
         new StudentModel { FirstName = "Harry", LastName = "Potter", Grade = 3.0 }
    };

    ... your actions
}

...but doing it this way means you cannot call your SetInfo method, because everything needs to be known at compile time. You also cannot set the length of the array to 5, it will be set to 1 because you are initializing one value.


text:
Q: how to change the default redirect page of a url in sitemap in another page in C# asp.net I have two home pages which is different for users and admin. For users its Default.aspx and for admin its AdminDefault.aspx. In my Site.Master page it contains the default url for home page and other default pages as below,

Home

About

Contact

When a admin logges in, the admin redirect to the default home page

A: Given that you have the following function to determine wether a user is a member of the administrator group
bool IsInGroup(string user, string group)
{
    using (var identity = new WindowsIdentity(user))
    {
        var principal = new WindowsPrincipal(identity);
        return principal.IsInRole(group);
    }
}

It is then a simple matter of redirecting after an IF statement, like so:
if(IsInGroup(User.Name, "Administrators")
    return RedirectToAction("AdminDefault.aspx");

(Mind you the code example above is written from memory, and may not be exact. In fact, it probably isnt)

A: Check Role Using session and provide condition like this

    string Role="";

    on Login button click event check the role

   YourLoginMethod()
   {
      // Your Login Code and after check
     //Pass Role in string above or Use session
     if(Role=="admin")
     {
     Response.Redirect("~/Admin.aspx");
    }
    else{
     Response.Redirect("~/Index.aspx");
    }
   }


text:
Q: Infinite loop inside a thread not working Was going through some tutorials on multi-threading and wrote some code to create an infinite thread. However, the infinite loop doesn't seem to work. The print routine inside the loop just runs once. Find the code below for reference. Cant understand what I am doing wrong. I am using the MSVC compiler.
#include <Windows.h>
#include <iostream>

DWORD __stdcall ThreadProc(LPVOID lpParameter) {

    const char* StringToPrint = (const char*)lpParameter;

    //expected this block to run infinitely.
    while (1) {
        std::cout << StringToPrint << "\n";
        Sleep(1000);
    }

    return 0;
}

int main() {

    DWORD ThreadId = 0;
    const char *Param = "Inside Thread";
    LPVOID Param1 = (LPVOID)Param;

    HANDLE Threadhandle = CreateThread(0, 0, ThreadProc, Param1, 0, &ThreadId);
    std::cout << "Thread ID " << ThreadId << " started" << "\n";
    CloseHandle(Threadhandle);
    return 0;

}

A: The loop appears to run once because your program terminates just after you've started the thread.
If you want the thread to run forever, wait for it to finish in the main function:
    HANDLE Threadhandle = CreateThread(0, 0, ThreadProc, Param1, 0, &ThreadId);
    std::cout << "Thread ID " << ThreadId << " started" << "\n";
    WaitForSingleObject(Threadhandle, INFINITE);
    CloseHandle(Threadhandle);                    // it will never reach this


text:
Q: How do I force standard output on a C# Process when UseShellExecute == false? I am running processes from C# using the following code;
private static void ExecuteShellCMD(string workingDir, string commandWithArgs, bool bWait = true)
{
    ProcessStartInfo info = new ProcessStartInfo();
    info.Verb = "runas";
    info.FileName = "cmd.exe";
    info.WorkingDirectory = workingDir;
    info.Arguments = "/C " + commandWithArgs;
    info.UseShellExecute = false;
    using (Process myProcess = Process.Start(info))
    {
        if (bWait)
        {
            myProcess.WaitForExit();
        }

        int ExitCode = myProcess.ExitCode;

        //Log exit code here.
    }
}

It loads an elevated command window and executes the code/bat file I pass it, but without logging anything to the console. This doesn't appear to be consistent on other machines, and has worked in the past on my machine, and I wondered if anyone had any ideas about how I can consistently make this Process just print logs into the command window the process makes.
I can see logs if I set UseShellExecute = true but then can't use Verb without accepting the elevation prompt which is undesirable.
I have tried looking for solutions around the web, and I am aware that I can redirect the output using other settings. Most of the questions and tutorials on this subject seem to deal with redirecting the ouput to somewhere else but I want to be able to keep track of the progress in the command window itself.
Perhaps I have missed an command line argument or similar?

A: Turns out this was actually a bug in Unity Hub. The process and output were working fine, however when ran from a Unity instance that was launched from Unity Hub it took control of the output and didn't release it. This was solved by just launching Unity directly and a bug report has been filed against Unity hub.


text:
Q: Lucene 4.2 StringField

I'm new to Lucene. I have two documents and I would like to have an exact match for the document field called "keyword" (the field may occur multiple times within a document).
The first document contains the keyword "Annotation is cool". The second document contains the keyword "Annotation is cool too". How do I have to build the query such that only the first document is found, when I search for "Annotation is cool"?
I read something about "StringField" and that it is not tokenized. If I change the "keyword" field from "TextField" to "StringField" in the method "addDoc" then nothing will be found.
Here is my code:
private IndexWriter writer;

public void lucene() throws IOException, ParseException {
    // Build the index
    StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_42);
    Directory index = new RAMDirectory();
    IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_42,
            analyzer);
    this.writer = new IndexWriter(index, config);

    // Add documents to the index
    addDoc("Spring", new String[] { "Java", "JSP",
            "Annotation is cool" });
    addDoc("Java", new String[] { "Oracle", "Annotation is cool too" });

    writer.close();

    // Search the index
    IndexReader reader = DirectoryReader.open(index);
    IndexSearcher searcher = new IndexSearcher(reader);

    BooleanQuery qry = new BooleanQuery();

    qry.add(new TermQuery(new Term("keyword", "\"Annotation is cool\"")), BooleanClause.Occur.MUST);

    System.out.println(qry.toString());

    Query q = new QueryParser(Version.LUCENE_42, "title", analyzer).parse(qry.toString());

    int hitsPerPage = 10;
    TopScoreDocCollector collector = TopScoreDocCollector.create(
            hitsPerPage, true);

    searcher.search(q, collector);

    ScoreDoc[] hits = collector.topDocs().scoreDocs;

    for (int i = 0; i < hits.length; ++i) {
        int docId = hits[i].doc;
        Document doc = searcher.doc(docId);
        System.out.println((i + 1) + ". \t" + doc.get("title"));
    }

    reader.close();
}

private void addDoc(String title, String[] keywords) throws IOException {
    // Create new document
    Document doc = new Document();

    // Add title
    doc.add(new TextField("title", title, Field.Store.YES));

    // Add keywords
    for (int i = 0; i < keywords.length; i++) {
        doc.add(new TextField("keyword", keywords[i], Field.Store.YES));
    }

    // Add document to index
    this.writer.addDocument(doc);
}

A: You problem is not in how you are indexing the field.  The string field is the correct way to index the entire input as a single token.  The problem is how you are searching.  I really don't know what you are intending to accomplish with this logic, really.
BooleanQuery qry = new BooleanQuery();
qry.add(new TermQuery(new Term("keyword", "\"Annotation is cool\"")), BooleanClause.Occur.MUST);
//Great! You have a termQuery added to the parent BooleanQuery which should find your keyword just fine!

Query q = new QueryParser(Version.LUCENE_42, "title", analyzer).parse(qry.toString());
//Now all bets are off.

Query.toString() is a handy method of debugging, but it is not safe to assume that running the output text query through a QueryParser will regenerate the same query.  The standard query parser really doesn't have much capability to express multiple words as a single term.  The String version of this that you see will, I believe, look like:
keyword:"Annotation is cool"

Which will be interpreted as a PhraseQuery.  A PhraseQuery will look for three consecutive terms, Annotation, is, and cool, But the way you have indexed this, you have a single term "Annotation is cool".
The solution is don't ever use logic like
 Query nuttyQuery = queryParser.parse(perfectlyGoodQuery.toString());
 searcher.search(nuttyQuery);

Instead, just search with the BooleanQuery you already created.
 searcher.search(perfectlyGoodQuery);


text:
Q: postman request to upload a file I am at this site : https://www.free-ocr.com/ which allows you to upload a file and in response returns text from that file.
When I upload a file it creates a POST request with multi-part form data with the following headers.

In return it gets the folowing response, the one in which I am interested :

However, when I try to replicate this whole thing in POSTMAN using POST method and upload a file using form-data, I do not get the same response as it was intended. Can somebody help me sort out what am I doing wrong?

A:

you just need to select type as file in body
then select the file .


text:
Q: arm/disarm home security system arduino keypad lcd So I run into a problem when I am trying to disarm the system. When I upload the code to the arduino it asks me to enter a pin and then it activates the system right away. But then when I try to deactivate the system it takes the pin and just clears the screen and execute the mainScreen function that i have set.
The code is provided below:
#include "Keypad.h"
#include "LiquidCrystal.h"
#include "Password.h"
LiquidCrystal lcd(0,1,10,11,12,13);
char newPasswordString; //hold the new password
char newPassword[4]; //charater string of newPasswordString

//initialize password to 1234
//you can use password.set(newPassword) to overwrite it
Password password = Password("1234");

byte maxPasswordLength = 4;
byte currentPasswordLength = 4;
// keypad type definition
const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {9,8,7,6}; //Rows 0 to 3
byte colPins[COLS]= {5,4,3,2}; //Columns 0 to 3
int count=0;
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup()
{
  lcd.begin(16, 2);
  mainScreen();
}
void loop(){
   char key = keypad.getKey();
   if (key != NO_KEY){
      delay(60);
      switch (key){
      case 'A': activate(); break;
      case 'B': break;
      case 'C': break;
      case 'D': deactivate(); break;
      case '#':  break;
      case '*': break;
      default: processNumberKey(key);
      }
   }
}
void processNumberKey(char key) {
   lcd.print(key);
   currentPasswordLength++;
   password.append(key);
   if(password.evaluate()){
    activate();
   }
}
void activate() {
   if (password.evaluate()){
      lcd.clear();
      lcd.print("Activated.");
      delay(1000);
      mainScreen();
   } else {
      lcd.clear();
      lcd.print("Wrong Password!");
            mainScreen();
   }
}
void deactivate(){
    if (password.evaluate()){
      lcd.clear();
      lcd.print("Deactivated.");
      delay(1000);
   } else {
      lcd.clear();
      lcd.print("Wrong Password!");
      mainScreen();
   }
}
void mainScreen(){
  lcd.clear();
  lcd.print("Enter Pin:");
  keypad.getKey();
  }

A: As noted in Arduino keypad 4x4 to LCD activate/deactivate you have to keep current state and you have to CLEAR the password and currenPasswordLength. See the WORKING example in the answer.
It won't help that you set byte currenPasswordLength = 4. If you press first key, it will be incremented to 5, next key increments it to the 6 and so on.
You'll get 4 again after the 256 key-presses!!!!!!! And as you don't clear previously checked password, you'll get "wrong password" result (and eventually stack overflow).


text:
Q: BufferedReader sets the text file null I am trying to simply read in a line from a text file using BufferedReader. Here is the sample code:
try {
    BufferedReader reader = new BufferedReader( new FileReader( "data.txt") );

       while(reader.readLine() != null )
       {
          System.out.println(reader.readLine())
       }
    }
} catch (Exception e) {
    e.printStackTrace();
}

The code above seems to not only print out null, but sets the data.txt file to null (as in, the file data.txt would initially have 40kb, and a call to readLine() sets it to 0kb)?
I have no idea why this is occurring, it can locate the file, but sets the file to null?
Can anyone identify why this is occurring?
Thanks.
EDIT !!
The BufferedWriter code is below:
try{
  BufferedWriter writer = new BufferedWriter(new FileWriter("data.txt"))

  for(int x=0; x<64; x++)
  {
     writer.write(String.valueOf(data[x]));
  }
  writer.newLine();
  writer.newLine();
  }
  catch(IOException io)
  {};

A: Not sure why your file contents gets erased however you need to change your while loop to this since you're skipping lines if you use your code.
String line = null;

    while ((line = reader.readLine()) != null) {
       System.out.println(line);
    }

A: Your first readline() is used as while loop condition. Then you write the second readline() to System.out. So you're writing every 2nd line. What you need is this.
String str = null;
while((str=reader.readLine()) != null) {
    System.out.println(str);
}

A: You are printing every second line only, and may also print the end of file null terminator. This is because the while conditional reads the line from your file as well, and that you simply discard this line after checking against null.
Retain the line value in the variable:
   String s;
   while( (s = reader.readLine()) != null )
       {
          System.out.println(s);
       }

A: you are reading one line in while loop and then again reading next line in println statement. that means you are when you check the condition that time reader.readLine() does not equal to null, but when you read in println then it become null .`
while(reader.readLine() != null )
   {
      System.out.println(reader.readLine())
   }

you should write your code in this way:
String line = null;
while((line=reader.readLine()) != null)
   {
      System.out.println(line) ;
   }

did you close your writer object? you should close your writer object inside finally block this way.
this might help you to resolve your problem.
finally
{
    if(null != writer)
    {
        try
        {
            writer.close();
        }
        catch(IOException ioException)
        {

        }
    }
}

A: Here's a working sample, similar to your original. Note that closing resources is very important:
import java.io.*;
import java.util.*;

public class ReadFile
{
    public static final void main(String[] argv)
    {
        String fileName="data-2.txt";

        writeFile(fileName);
        readFile(fileName);
    }

    private static void writeFile(String fileName)
    {
        BufferedWriter writer = null;

        try
        {
            writer = new BufferedWriter(new FileWriter(fileName));

            for(int x=0; x<64; x++)
            {
                writer.write("some data\n");
            }
            writer.newLine();
            writer.newLine();
        }
        catch(IOException x)
        {
            x.printStackTrace();
        }
        finally
        {
            safeClose(writer);
        }
    }

    private static void readFile(String fileName)
    {
        BufferedReader reader = null;
        String line = null;

        try
        {
            reader = new BufferedReader( new FileReader( fileName ));

            while((line = reader.readLine()) != null)
            {
                System.out.println(line);
            }
        }
        catch(IOException x)
        {
            x.printStackTrace();
        }
        finally
        {
            safeClose(reader);
        }
    }

    private static void safeClose(Closeable closeable)
    {
        if(null != closeable)
        {
            try
            {
                closeable.close();
            }
            catch(IOException x)
            {
                //ignore -x.printStackTrace()
            }
        }
    }
}


text:
Q: Changing Picker.Item font family React native? <Picker
  // selectedValue={this.state.language}
  selectedValue="USD"
  style={{ height: 50, width: 100, marginRight: 10, justifyContent: 'flex-start'  }}
  itemStyle={{ fontFamily: 'Roboto_thin' }}
  // onValueChange={(itemValue, itemIndex) =>
  //   this.setState({ language: itemValue })
  // }
  >
  <Picker.Item label="USD" value="java" />
  <Picker.Item label="ETB" value="js" />
</Picker>

I want to change the font of the picker items, and i add a property itemStyle with fontFamily values. But the pickers items font is not changed.

A: As Robbie mentioned, you can use itemStyle prop.
However, the itemStyle is an advanced property only supported by iOS Platform, as you can see on React Native docs here. Therefore, for styling the Picker items, like changing the fontFamily, color, etc can be done only using Native Android styles, for now. Then it will work for both platforms.
With that in mind, you would add a new <style> tag with your resources to the style.xml file, usually localized in the path: android/app/src/main/res/values/styles.xml. And set it on AppTheme to count with the style added, e.g:
<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
     <item name="android:spinnerItemStyle">@style/SpinnerItem</item>
     <item name="android:spinnerDropDownItemStyle">@style/SpinnerDropDownItem</item>
    </style>

    <!-- Item selected font. -->
    <style name="SpinnerItem" parent="Theme.AppCompat.Light.NoActionBar">
     <item name="android:fontFamily">casual</item>
    </style>

    <!-- Dropdown options font. -->
    <style name="SpinnerDropDownItem" parent="Theme.AppCompat.Light.NoActionBar">
      <item name="android:fontFamily">casual</item>
      <item name="android:padding">8dp</item>
    </style>
<resources>

Useful links:

*

*React Native Picker Android git solved issue.

A: That code should work, but I'm curious about the font name you're providing. If you're using a google font as a linked asset, that should be Roboto-Thin unless you renamed it yourself. Double check that the font name linked to your project is correct.
Another thing to note is that the Android default font is already Roboto, so you can get it's thin version via the fontWeight property:
itemStyle={{ fontWeight: '100' }} // <-- 100 is thin, 300 is light, 400 would be regular

A: I solve it by adding this code on the android\app\src\main\res\values.\styles.xml
<resources>

    <!-- Base application theme. -->
            <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

                    <item name="android:spinnerItemStyle">@style/SpinnerItem</item>
                    <item name="android:spinnerDropDownItemStyle">@style/SpinnerDropDownItem</item>
            </style>

            <style name="SpinnerItem" parent="Theme.AppCompat.Light.NoActionBar">
                <item name="android:textAlignment">gravity</item>
                <item name="android:gravity">start</item>
                <item name="android:fontFamily">@font/arab_font</item>

            </style>
            <style name="SpinnerDropDownItem" parent="Theme.AppCompat.Light.NoActionBar">
                <item name="android:textAlignment">gravity</item>
                <item name="android:gravity">start</item>
                <item name="android:textColor">#000000</item>

            </style>

</resources>

But for the fonts names you need to create the font folder on this path android\app\src\main\res\font and the font file name should not start with capital letter all the name should include just small letters and you have to reload the Metro sever to se the changes (reload the project from the beginning).

A: Normal for Android
  {drinksArr.map((val, index) => (
 <Picker.Item
                style={{
                  fontSize: 30,
                  backgroundColor: Colors.Black,
                }}
                fontFamily="font_family"
                color={Colors.Gold}
                label={val.title}
                value={val.title}
                key={index}


text:
Q: How to combine outputs from two procedures into one output from different procedure? I have two procedures named validateChar and endingSpaces. My output for both these procedures are a value displayed in a MsgBox.
I want to combine the value of the 2 message boxes into 1 value to be displayed in a MsgBox. I created a new procedure tempValidate to handle all my procedures with MsgBox.
Is there a way that I can combine not just 2 MsgBox but multiple message boxes?
In below code, msg1 and msgSpaces are variables in the 2 procedures (validateChar and endingSpaces).
Public Sub tempValidate()

    validateChar
    endingSpaces

    MsgBox ActiveSheet.Name, msg1, msgSpaces, Title:="Call-outs"

End Sub

A: The vars you declare and assign values to in a sub procedure cannot be referenced by another sub procedure.
Either you need public vars that can be shared across multiple sub procedures or you need to pass along a var byRef from a main sub to companion subs.
In the following, a single msg string-type var is declared in the primary tempValidate sub procedure and given an initial value of the active worksheet's name. The var is passed to both validateChar and endingSpaces and each companion sub appends the same string with additional information. The end result is displayed in a msgbox from tempValidate before exiting the procedure.
Option Explicit

Public Sub tempValidate()

    Dim msg As String

    msg = ActiveSheet.Name & vbLf

    validateChar msg
    endingSpaces msg

    MsgBox msg, Title:="Call-outs"

End Sub

Sub validateChar(ByRef msg1 As String)

    'don't try to redeclare msg1 here
    'if you have Dim msg1 as string then get rid of it

    msg1 = msg1 & "The stuff from validateChar." & vbLf

End Sub

Sub endingSpaces(ByRef msgSpaces As String)

    'don't try to redeclare msgSpaces here
    'if you have Dim msgSpaces as string then get rid of it

    msgSpaces = msgSpaces & "The stuff from endingSpaces." & vbLf

End Sub

Another option would be to make those companion subs functions that returned strings. Perhaps another contributor can cover that scenario.

A: Here is an example of how you could use a public variable (here called message) to do what you want. In general, public variables are frowned upon, but they have some uses. In this case it would allow the rest of your code to be left almost alone (simply replace the any line Msgbox s by LogMessage s):
Public message As String

Sub LogMessage(s As String)
    message = message & IIf(Len(message) > 0, vbCrLf, "") & s
End Sub

Sub test1()
    LogMessage "Hello"
End Sub

Sub test2()
    LogMessage "World"
End Sub

Sub main()
    message = ""
    test1
    test2
    MsgBox message 'prints "Hello World" on two lines
End Sub

You could of course replace vbCrLf by some other delimiter such as ", ".


text:
Q: How to enable RedisJson module on Aiven Redis instances I do not see any option to enable modules in aiven Redis.
I tried
MODULE LOAD /usr/lib/redis/modules/rejson.so

MODULE LIST gives (empty array)

A: You cannot enable RedisJSON module on Aiven Redis as it is not supported on Aiven platform.
RedisJSON's license is Redis Source Available License (RSAL)


text:
Q: WIll the iphone simulator run a naked command line? Does the iphone simulator require a bundle? I tried to run it on a plain executable and got
Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain
   Code=1  UserInfo=0x1002336c0 "Unknown error."

using the open source iphonesim driver.

A: You need to give it the path of the bundle with the .app suffix that XCode generates. By default this is in the "build" subdirectory of an iphone project. Also, there is currently a bug in the project that requires you to use the absolute path.


text:
Q: ! LaTeX Error: File `moderncv.cls' not found I am trying to compile this simple file with the moderncv but I am getting the following error:
! LaTeX Error: File moderncv.cls not found.
Then I clicked program --> MiKTeX 2.9 --> Maintenance --> Upadte MikTeX
and after taking the default configuration and clicking nex I ma getting Sorry, but something wen wrong: HTTP Error ="HTTP/1.1 503 Service Unavailable"
So How can I solve this problem?
Code:
\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[red]{casual} %[blue, green, orange, red, grey]
\let\makeletterfoot\makecvfoot
\setlength{\hintscolumnwidth}{5cm} %Laenge link
\usepackage{lmodern}
\renewcommand{\baselinestretch}{1.5}
\usepackage[ngerman]{babel}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\begin{document}
Test
\end{document}

A: Do not update MiKTeX right now, as there seems to be a mess with the tools package. I suppose the problem will be settled very soon.
In the meantime, if you need moderncv, you can proceed as follows: download from CTAN or one of its mirrors, in /pub/tex/systems/win32/miktex/tm/packages the file moderncv.tar.lzma + these 3 files: pr.ini, miktex-zzdb1-2.9.tar.lzma, miktex-zzdb2-2.9.tar.lzma, store them in some directory and launch MiKTeX Package Manager. Open the Repository > Change Repository menu, then install from the directory  containing the downloaded files.
Added (04-06): The problem has been solved. You can update regularly now


text:
Q: Git: Show uncommited changes doesn't show? Hi I've this problem with git (it's all about problems)
I tried to sync my work this morning and got this:

and when I click "uncommited changes it doesn't show other than this. But I can't commit this either. It's a detached header.
What to do? :(

A: You could click on Tools -> Open a Shell Here.
From the shell, you can run

*

*'git checkout master' (or any other branch name you were in) to switch from the detached HEAD.

*'git pull' in the shell to pull down any new commits.

A: You're presaumbly in a detached HEAD state because, at some point, you checked out an arbitrary commit.
Is that the point at which you want to commit your changes?  Or do you want to commit them to the tip of an existing branch such as master?
To create a branch from your current point use git checkout -b <new branch name> ... then you can commit your changes to that branch.
To commit to the tip of some other branch, you first need to check it out (e.g. git checkout master).  However, depending on the changes you've made since being in a detached head state, this may revert those changes (git won't lose your changes from its repository but they'll be harder to find ... which is probably not where you want to be).
The simplest option for you might be to create a branch from your current point, commit your changes to that branch, then check out your intended branch and merge.  For example:-
git checkout -b newbranch
git commit -am 'my new changes'
git checkout master
git merge newbranch


text:
Q: why use accelerometer and magnetometer to get compass values I found several examples and I know HOW to get the compass bearing using accelerometer and magnetometer. The problem is that i don't know WHY these two sensors should be used.
can someone explain it to me? thanks

A: The need for a magnetometer is pretty obvious. What the compass (even a real one) shows as "north" is indeed the direction of magnetic field. Thus your Android needs to measure the magnetic field somehow in order to know in what direction to draw the arrow.
As per accelerometer, you need to know that accelerometers are not only used for measuring acceleration, as their name would suggest, but they also tell you in what direction gravity is pointing. Without one your device would not know where "down" is. For example, every smartphone capable of screen auto-rotation needs an accelerometer.
Now why need both for a compass? Because in determining the position of north, you need to know not only the direction of magnetic field but also the horizontal plane. You usually don't care whether north is above or below you. The knowledge of the "down" direction allows you to filter out the unneeded third coordinate.


text:
Q: WCF customization to work with OAuth & JWT's We're architecting a new commercial application.  We're layering everything and in the middle tier our CRUD & business workflows will be in their own assemblies.  This will allow us to use both WCF & Web Api's to allow consumers to interface with our data backend.
For our MVC UI, web service to web service, windows service to web services calls, we plan to use WCF with custom, Net.TCP or Named Pipe bindings as the case my be.
However, we also want to create Web Api interfaces as we need them in the future.  There may be times in our MVC applications where we have a specific need to may javascript service calls.
But mainly we want an avenue down the road should we need to support mobile devices interfacing with our back end.
Here is a mspaint diagram of what we're planning.

We plan to stick with mostly server side code first and only resort to javascript when absolutely necessary.
We plan to favor WCF & the most efficient form of binary serialization we can fit versus Web Api where possible.
With that, we're trying to come up with a Authentication & Authorization architecture we can use with all different layers our application.
Originally I was hoping to use something like DotNetOAuth or Thinktecture IdentityServer 3 to authenticate and hopeful generate token based claims.  It seems that if we could figure out how to create support in WCF for JSon Web Tokens, that would be the most flexible.
We plan to try and use Microsoft's Identity and Claims.
With that, is it possible with custom code to customize WCF to be able to use a solution like Thinktecture to authenticate and use tokens for claims based authorization?  If so is there any documentation/samples out there we're missing.
To be clear, a user authenticates from our MVC UI apps to IdentityServer3 or equivalent, gets a JWT claims token.  A call is made to a WCF service or WebApi and they both can use verify the claim and use it for authorization?
Or are we going to have to resort to something like WIF, create a custom STS and then have an OAuth service in parallel?
2/26/15 - Last night I found the following post.  http://www.thecoderblogs.com/2014/04/exercise-3-securing-a-wcf-service-using-windows-azure-active-directory/  It looks promising, however, the sample link doesn't work.  Need to figure out how to populate the WCF client with header with Authorize and the token.  Again any input would be GREATLY appreciated.

A: For now, I used information from several different places and we're using a custom IDispatchMessageInspector.
I created a 3 part blog series on what we did to accomplish this which can be found here.
We still need to figure out a way to authenticate/authorize an AccessToken returned by IdentityServices TokenResponse when making a call to RequestClientCredentialAsync().
Please if you review the log, leave comments if you have any improvements or have anything to add.


text:
Q: UITableViewController filling cells of different sections with Values I'm sure this question is asked before but I couldn't find a solution for it.
I have a UITableViewController with static cells, I have 4 sections (so far) and each section only has 1 cell.
this is a part of the first Cell of First section

and this is the corresponding TableViewCell file,

AllgemeineProduktdatenCell.swift

class AllgemeineProduktdatenCell: UITableViewCell{

    // MARK: - Outlets
    @IBOutlet weak var AngebotsnameTextF: UITextField!
    @IBOutlet weak var Referenznummer: UITextField!
    @IBOutlet weak var modelTextF: UITextField!
    @IBOutlet weak var bemerkungTextF: UITextView!
    @IBOutlet weak var extrasTextF: UITextView!
    @IBOutlet weak var ursprLadenPreisEuroTextF: UITextField!
    @IBOutlet weak var ursprLadenPreisCentTextF: UITextField!
    @IBOutlet weak var AngebotsPreisEuroTextF: UITextField!
    @IBOutlet weak var AngebotsPreisCentTextF: UITextField!

    // Bereich Möbel
    @IBOutlet weak var bereichMoebelLabel: UILabel!
    @IBOutlet weak var bereichMoebelPicker: UIPickerView!
    @IBAction func showHideBereichMoebelPicker(_ sender: Any) {
        if bereichMoebelPicker.isHidden{
            bereichMoebelPicker.isHidden = false
        } else{
            bereichMoebelPicker.isHidden = true
        }
    }

    // Hersteller
    @IBOutlet weak var chosenHerstellerLabel: UILabel!
    @IBOutlet weak var herstellerPickerView: UIPickerView!
    @IBAction func showHideHerstellerPicker(_ sender: UIButton) {
        if herstellerPickerView.isHidden{
            herstellerPickerView.isHidden = false
        } else{
            herstellerPickerView.isHidden = true
        }
    }

    // Anzeigen auch auf eigener Webseite
    @IBOutlet weak var anzeigenAuchAufEigenerWebseiteSwitch: UISwitch!
    @IBAction func anzeigenAufWebsiteSwitch(_ sender: Any) {
    }

    // Start des Angebot
    @IBOutlet weak var startDesAngebotChosenDateLabel: UILabel!
    @IBOutlet weak var startDesAngebotDatePicker: UIDatePicker!
    @IBAction func hideShowStartDesAngebotDP(_ sender: Any) {
        if startDesAngebotDatePicker.isHidden{
            startDesAngebotDatePicker.isHidden = false
        } else{
            startDesAngebotDatePicker.isHidden = true
        }
    }

    func setUpAllgemeineFields(product: ItemsClass){
        AngebotsnameTextF.text = "ABED"//product.title
        Referenznummer.text = product.artikel_nummer
        modelTextF.text = product.typ_kategorie
    }

}

Imagine that I have similar files for each of my cells.
and this is my main View file:

AddEditVC.swift

class AddEditVC: UITableViewController {

    var product_obj: ItemsClass!

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    // MARK: - Table view data source
    override func numberOfSections(in tableView: UITableView) -> Int {
        return 4
    }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        if let cell = tableView.dequeueReusableCell(withIdentifier: "AllgemeineProduktdaten") as? AllgemeineProduktdatenCell{
            cell.setUpAllgemeineFields(product: product_obj)
            return cell
        } else{
            print("FFFFFFAAAAAILD")
            return AllgemeineProduktdatenCell()
        }
    }
}

when I run this application the cell is blank and I even cannot see my Views but when I comment out the cellForRowAt function then I can see my outlets but the fields are empty.
How can I fill the fields of my cell with my object? how should I specify that which cell to be filled (I need it also for my other cells of other sections)
UPDATE:
this is an overview of my TableViewController

Thank you in advance and sorry for such a long question

A: Once you set up all prototype cell classes and reuse identifiers, you can use below code to generate the cells. Since you didn't include the exact code for your classes, this is just a skeleton code, but you should be able to fill in the gaps.
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    switch indexPath.section {
    case 0:
        let cell = tableView.dequeueReusableCell(withIdentifier: "AllgemeineProduktdaten") as! AllgemeineProduktdatenCell
        cell.setUpAllgemeineFields(product: product_obj)
        return cell
    case 1:
        let cell = tableView.dequeueReusableCell(withIdentifier: "OtherCellReuseIdentifier") as! OtherCellClass
        //set up cell content
        return cell
    default:
        return UITableViewCell()
    }
}

A: I managed to do it by asking another question with the help of André, I used a Vertical UIStackView and added a button in first row (and whatever element in the as other rows), then add an IBAction to the code for the UIButton as follow:
@IBAction func Section1Tapped(_ sender: Any) {
    guard let stackView = (sender as AnyObject).superview as? UIStackView else { return }
    guard stackView.arrangedSubviews.count > 1 else { return }
    let sectionIsCollapsed = stackView.arrangedSubviews[1].isHidden

    UIView.animate(withDuration: 0.25) {
        for i in 1..<stackView.arrangedSubviews.count {
            stackView.arrangedSubviews[i].isHidden = !sectionIsCollapsed
        }
    }
}

This will make the StackView to collapse, no need to go through complexity of TableViews


text:
Q: How to repeat / freeze a row (which is other than the top row) on every page in Google Sheets? I have a google sheet which contains some data on the first few rows and after that, the actual table starts. I want to freeze the row from where the table starts.
From my little research, it seems that Google sheets can only freeze the rows starting from the top.
Is it possible to freeze a separate row which is not at the top?
Any workarounds are welcome too.
Attached screenshot of my sheet for reference. I want to freeze the 8th and 9th row only.

A:
I want to print the sheet. So if it exceeds one page then the table headers should be repeated on every page

in that case freeze it till 10th and before print just hide 1-7


text:
Q: Full browser Jquery Carousel with different heights leaves gaps below footer I am using the Flexisel jQuery carousel as a portfolio site. I have gotten it to work like this so far:
http://www.frankotoole.com/flexisel/9bit/flexisel.html
I like how this site works (having a series of long pages of various lengths connected by arrows): http://www.ikeafamilylivemagazine.com/us/en/article/32269
How can I make the shorter pages on my portfolio site (after you click right or left from my landing slide) not have the white space below the footer? It seems like the browser is basing the height of the page on the longest slide in the carousel, but I don't want viewers to be able to scroll below the footer when there is a shorter slide.
Any help is appreciated. Thank you.


text: Q: Group Visualization objects of Kibana in Dashboard I am new to Kibana. I have a requirement to group, similar topic visual objects, in Dashboard. For Example: Suppose I have Pie Object for CARS,Bike and  Monitors, then I need to group the CARS,BIKES Pie under Automobiles Heading and Monitors under Computers Heading in Dashboard. Could you please help?


text:
Q: Android: remove title bar error Hello i'm trying to remove the title bar from my app with this code:
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

Under the onCreate method in the activity, but when i run the app it gives error and it closes (i'm sorry but i don't know how to see the error log).
Why it gives error? Thanks

A: You must call requestWindowFeature(Window.FEATURE_NO_TITLE); before setContentView().
@Override
protected void onCreate(
    final Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    getWindow().requestFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.main);

}

If you want to remove the title, just add this style into your manifest file.
android:theme="@style/Theme.Black.NoTitleBar"

A: Add requestWindowFeature(Window.FEATURE_NO_TITLE); before setContentView()
like:
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.your_activity);

A: You have 2 ways to do this:

*

*Simply you must use Activity instead of Appcompactactivity.

Or

*Add getActionBar.hide() instead of requestWindowFeature(Window.FEATURE_NO_TITLE); if you use Appcompactactivity
Hope this would help you.

A: try this
Write this lines before setcontentview your activity will be full screen
requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

A: Solution  1.
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    if (getSupportActionBar() != null) {
               getSupportActionBar().hide();
    }

    setContentView(R.layout.activity_main);

}

Solution 2.
Maybe the problem is due to your app theme. So check your activity type ( Appcompact Activity, ListActivity), Depend on the activity change theme for activity like this:
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTheme(R.style.No_Title_AppTheme);
}

In style.xml:
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

    </style>
    <style name="No_Title_AppTheme" parent="android:Theme.Light.NoTitleBar">

    </style>
</resources>


text:
Q: expl3/xparse: Having an **if check** in a command Maybe the question is not minimal enough - if so, please tell me.

I do not know what is the correct title since I do not understand
  the connection of the different packages.

Related
This question is somehow a follow up of

*

*Beamer / TIKZ / PGF: Using a Variable (Math / Calculations) as Part of a File Name for an External File
and also includes

*

*Calculating Beamer presentation progress excluding appendix.

Introduction
The basic idea is, that I calculate the progress (in percent) of a beamer presentation using
100*\insertframenumber/\inserttotalframenumber

I added a min(progress in percent,100) around that all because in the first run the \inserttotalframenumber is 1 and I do not want the progress to exceed 100.

At the moment I do not know which LaTeX package is responsible that I
  can use the min function here.

So it actually looks like
min((100*\insertframenumber/\inserttotalframenumber),100)

This fails if there is an appendix because I do not want that the appendix slides to be taken into account.
If there is an appendix then this approach
min((100*\insertframenumber/(\beamer@startpageofappendix-1))

works. The key is \beamer@startpageofappendix. But it fails if there is no appendix because then \beamer@startpageofappendix-1 is -1 (minus one).
Main Question

I thought that it would help if there was a check if
  \beamer@startpageofappendix is zero in the code. Depending on the result, approach a) (\inserttotalframenumber) or b)
  (\beamer@startpageofappendix-1) will be used.

Code
\documentclass[t]{beamer}

\usepackage{tikz}
\usepackage{calc}
\usepackage{xparse}

\ExplSyntaxOn
    \int_new:N \l_beamer_percentage_int
    \prop_new:N \g_beamer_percentage_prop
    \makeatletter
    \NewDocumentCommand{\myProgressPercent}{}{%
    \int_set:Nn  \l_beamer_percentage_int {
        \fp_to_int:n {
            \fp_eval:n {min((100*\insertframenumber/(\beamer@startpageofappendix-1)),100)}
            %\fp_eval:n {min((100*\insertframenumber/\inserttotalframenumber),100)}
            }
        }
    \prop_gput:NnV \g_beamer_percentage_prop {percentage} { \l_beamer_percentage_int }
    \prop_item:Nn \g_beamer_percentage_prop {percentage}
    }
    \makeatother
\ExplSyntaxOff

\begin{document}

\foreach \n in {1,...,10}{
%------------------
\begin{frame}
    \frametitle{Slide \n}
    Progress is \myProgressPercent\,\%
\end{frame}
%------------------
}

%  comment \appendix in and out to see the effect
\appendix

\foreach \n in {1,...,3}{
%------------------
\begin{frame}
    \frametitle{Appendix Slide \n}
    Progress is \myProgressPercent\,\% (Should always be 100\,\%)
\end{frame}
%------------------
}

\end{document}

It wokred!
Thanks all - here's illustration of what I am trying to achieve.

A: I'm not sure what's the need of using that indirection: the command can be even made fully expandable:
\documentclass[t]{beamer}

\usepackage{tikz}
\usepackage{calc}
\usepackage{xparse}

\ExplSyntaxOn
\DeclareExpandableDocumentCommand{\myProgressPercent}{}
 {
  \fp_to_int:n
   {
    min(
     100*\insertframenumber
     /
     (
      \use:c{beamer@startpageofappendix} - 1 > 0
      ?
      \use:c{beamer@startpageofappendix} - 1
      :
      \inserttotalframenumber
     )
     ,
     100
    )
   }
 }
\ExplSyntaxOff

\begin{document}

\foreach \n in {1,...,10}{
%------------------
\begin{frame}
    \frametitle{Slide \n}
    Progress is \myProgressPercent\,\%
\end{frame}
%------------------
}

%  comment \appendix in and out to see the effect
\appendix

\foreach \n in {1,...,3}{
%------------------
\begin{frame}
    \frametitle{Appendix Slide \n}
    Progress is \myProgressPercent\,\% (Should always be 100\,\%)
\end{frame}
%------------------
}

\end{document}

We check whether \beamer@startpageofappendix is set to some number (greater than one, of course) and, in this case we use it (less one). Otherwise we use \inserttotalframenumber.
Note that, for your intended application, you can even say
\includegraphics{\myProgressPercent.png}

because \myProgressPercent will just expand to a number.

A: \documentclass[t]{beamer}

\usepackage{tikz}
\usepackage{xparse}

\ExplSyntaxOn

\int_new:N \l_beamer_percentage_int
\prop_new:N \g_beamer_percentage_prop

\NewDocumentCommand \myProgressPercent { }
  {
    \int_set:Nn  \l_beamer_percentage_int
      {
        \fp_to_int:n
          {
            \tl_if_empty:cTF { beamer@startpageofappendix }
              {
                \fp_eval:n
                  {
                    min(100*\insertframenumber/\inserttotalframenumber,100)
                  }
              }
              {
                \fp_eval:n
                  {
                    min(100*\insertframenumber/(\use:c {beamer@startpageofappendix}-1),100)
                  }
              }
         }
      }

    \prop_gput:NnV \g_beamer_percentage_prop {percentage} { \l_beamer_percentage_int }
    \prop_item:Nn \g_beamer_percentage_prop {percentage}
  }

\ExplSyntaxOff

\begin{document}

\foreach \n in {1,...,10}{
  % ------------------
  \begin{frame}{Slide \n}
    Progress is \myProgressPercent\,\%
  \end{frame}
  % ------------------
}

%  comment \appendix in and out to see the effect
%\appendix

\foreach \n in {1,...,3}{
  % ------------------
  \begin{frame}{Appendix Slide \n}
    Progress is \myProgressPercent\,\% (Should always be 100\,\%)
  \end{frame}
  % ------------------
}

\end{document}

A little simplified version.
\documentclass[t]{beamer}

\usepackage{tikz}
\usepackage{xparse}

\ExplSyntaxOn

\DeclareExpandableDocumentCommand \myProgressPercent { }
  {
    \tl_if_empty:cTF { beamer@startpageofappendix }
      {
        \fp_to_int:n
          {
            min(100*\insertframenumber/\inserttotalframenumber,100)
          }
      }
      {
        \fp_to_int:n
          {
            min(100*\insertframenumber/(\use:c {beamer@startpageofappendix}-1),100)
          }
      }
  }

\ExplSyntaxOff

\begin{document}

\foreach \n in {1,...,10}{
  % ------------------
  \begin{frame}{Slide \n}
    Progress is \myProgressPercent\,\%
  \end{frame}
  % ------------------
}

%  comment \appendix in and out to see the effect
%\appendix

\foreach \n in {1,...,3}{
  % ------------------
  \begin{frame}{Appendix Slide \n}
    Progress is \myProgressPercent\,\% (Should always be 100\,\%)
  \end{frame}
  % ------------------
}

\end{document}


text:
Q: How to disable WSL password? I feel there is no need for a password on WSL because it is already protected from my Windows account. Nobody could use my WSL without first knowing my Windows password.
How can I disable the WSL password? I have tried passwd but it does not accept a NULL password.

A: In wsl add your username to a sudo config file.
Replace MY_USERNAME below to your username name.
sudo nano /etc/sudoers.d/MY_USERNAME
add the following line:
MY_USERNAME ALL=(ALL) NOPASSWD:ALL
If you don't replace MY_USERNAME with the target username you will receive an error no valid sudoers sources found.


text:
Q: Spring / Hibernate - DB results to a log file I can log the sql and input parameters by creating loggers for org.hibernate.SQL and org.hibernate.type.descriptor.sql.
However is it possible to log the actual db results?
I am on spring with a hibernate db.
Additionally is it possible in spring to log the Database host?

A: org.hibernate.SQL   - set to debug to log all SQL DML statements as they are executed
org.hibernate.type -enter code here- set to trace to log all JDBC parameters
Change in hibernate.cfg.xml :
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">true</property>

then in log4.properties :
log4j.logger.org.hibernate=INFO, hb
log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.type=TRACE

log4j.appender.hb=org.apache.log4j.ConsoleAppender
log4j.appender.hb.layout=org.apache.log4j.PatternLayout


text:
Q: Vagrant ssh doesn't display command prompt I have a computer that runs Windows 8.1 and for some projects I use Vagrnat and VirtualBox, however after upgrading VirtualBox and Vagrant, after running Vagrant ssh, vagrant doesn't display the command prompt. I thought that may be it's a problem related with old boxes so I've create a new VM but the results is the same.

Could you have a look please and give me an idea about how can I solve this problem?

A: I'm running a Windows 10 development environment (cygwin/babun + mintty) and had the same issue after upgrading Vagrant. While I haven't found a solution to the problem using vagrant ssh, I did find a workaround.
Turns out, I'm able to ssh into the virtual environments normally. Look at the assigned IP address in your Vagrantfile, say, 172.0.0.101. If you use the command:
ssh vagrant@172.0.0.101

you should be able to enter the password "vagrant" (standard for vagrant boxes) and use the machines normally. It is my understanding that this has something to do with passing along TTY interface to the terminal window. Prior versions of "vagrant ssh" used the ssh that was in the host's path, but looks like the newer versions have a version of ssh embedded that doesn't play nicely with Windows environments (this is from my limited experience and research yesterday).
If you want to access without using a username/password combination, there is a quick workaround there as well. I created the following function in my .babunrc file, though I imagine any .bashrc or .bash_profile would work:
# Vagrant ssh-config to file
function devConfig () {
    vagrant ssh-config > "PATH TO YOUR SSH CONFIG FILE"
}

This allows you to reconfigure your config each time you roll over your Vagrant boxes. Note that this will overwrite any config you currently have setup. You can switch to appending by using ">>", however you'll end up with a huge config file if your rolling your development environments frequently. Obviously that's not a solution that works for everyone.
Regardless, it's super curious that the newer versions have bundled this ssh package that can't pass along TTY. I'm not a strong enough user to understand why, but at least the problem can be identified.

A: I have the same problem on Windows 10 Home 64bit with Creators Update, Vagrant 1.9.6, VirtualBox 5.1.22r115126 and Cygwin.
Following https://github.com/mitchellh/vagrant/issues I read that this can happen with cygwin/babun/gitbash but not with the cmd-prompt.
So I booted another box with the Windows cmd-prompt and yes, I can confirm that after vagrant up and vagrant ssh you are getting the prompt inside your box.
Not ideal but workable for the time being.
Not sure what is causing this though, as I didn't update cygwin for a long time, and it had been working with Vagrant 1.9.6 .
Instead of using the Windows cmd-prompt, updating to Vagrant 1.9.7 also fixes this issue, at least for me :)

A: Try this: (In plain human non-techy English)

*

*Windows users always default to opening the command prompt with Administrative rights, because we only use cmd to fix Windows issues.

*Vagrant seems to prefer you just open cmd by clicking on the icon and going straight to your home directory which is displayed ( C:\Users\yourName ).

So:

*

*If you use cmd this way, all the vagrant commands work.

*If you try navigating to your home directory after signing in as an Admin, you're in a restricted area that I find sometimes blocks Vagrant commands.

Best of luck!


text:
Q: Creating a variable with sed in ksh I'm using Ksh88 on a Solaris 10 machine.
If I do the following:
foo="one two three"
for i in $foo; do
    echo $i;
done

The script executes as expected:
$ ./script.ksh
one
two
three

However if I replace the loop with this:
foo="one two three"
for i in $(sed -e 's/bar/$foo/' <(echo $1));
do
    echo $i
done

I execute it and this is what I get:
$ ./script.ksh bar
$foo

How can I make for expand the result of the sed command into a variable?

A: sed -e 's/bar/$foo/' <(echo $1) prints $foo. The result of a command expansion is not subject to shell syntax processing. It is only subject to field splitting (splitting into words) filename generation (i.e. globbing), when you use it this way outside double quotes.
In any shell, if you have the name of a variable in another variable, you can obtain the value of that variable with eval.
variable_name=$(sed -e 's/bar/foo/' <(echo $1))
case $variable_name in
  *[!0-9A-Z_a-z]*) echo 1>&2 "Invalid variable name: $variable_name"; exit 3;;
esac
eval variable_value="\${$variable_name}"
for i in $variable_value; do …

Note that $variable_value not only breaks up the value into whitespace-delimited parts, but also performs globbing (i.e. expands wildcards into file names) on the parts. To turn off globbing, call set +f beforehand.
In ksh93, there is a special flag you can use when defining a variable var, which tells the shell that the value of the variable is itself a variable name and that $var must expand to the value of the variable whose name is $var. Also, you should make foo an array, since it's really a list of strings and not a string.
foo=(one two three)
typeset -n variable_name="$(sed -e 's/bar/foo/' <(echo $1))"
for i in "${variable_name[@]}"; do …

A: foo=$(echo "$foo" | sed 's/[\\\/]/\\&/g') # only required if $foo can contain one of \/
set +f     # only required if $foo contains one of \[*?
for i in $(echo "$1" | sed -e "s/bar/$foo/"); do
    echo $i
done