How can I fill a wheelbarrow tire when the bead is gapped away from the rim?

Question: I have this wheelbarrow with tubeless tire, I had to replace it with the new one, however I don't see how to pump it! The tire is quite stiff, and it was tricky to put it on the rim, but now it looks like the tire isn't well adjusted to the rim. Did I do something wrong? How do people normally pump this type of tires?
Comment: If you are using a [hand tire pump you will not get enough volume to do the job](https://mechanics.stackexchange.com/a/57759/4694)
Comment: One solution is to fit a suitably sized tube.  Not really an answer though sorry.
Answer: Looks like the typical gap one gets when mounting a tubeless tire.  You'll need to get the bead to seat against the rim as you pump air (hopefully quickly) into the tire - a hand pump might not do it.
Sometimes you can jiggle the tire to effect a temporary seal around the bead as your compressor dumps air in.  Using a clip-on tire chuck will help.
Some folks "squeeze" the tire with a strap around the tread area.  I've seen a device called a bead expander, and this guy shows the use of some large tie-wraps to achieve the same thing.
Comment: Yeah, go to the gas station and use their compressor. A puff will force the tire walls outward and it'll seal.
Comment: I had this very problem this summer.  I used the squeeze method you mentioned.  Used a ratchet strap around the tread of the tire and tightened it down, then filled with the compressor.  The blast of air alone from the compressor did not work in my case, I had to squeeze it.
Comment: @isherwood, a lot of gas stations around me have the crappy tank less compressors, providing only low volume air.
Comment: @GaryBak Correction - crappy tankless compressors that require you insert the correct amount of change or currency at the right time.
Comment: @GaryBak : be careful about tightening down the strap *too* much.  I got whipped a bit when releasing one time.  Now I put some hair gel down on the rim, put the strap on to squeeze a little bit, then max out the pressure on my (small tank) compressor so it puts out lots of air quickly.
Answer: If you're not afraid of a little fire then this could work:
https://youtu.be/DJiqbAVsxRY

Put on some safety glasses, preferably tinted
Put on some rubber gloves
Put on some ear protection
Have a water hose ready
Spray some highly flammable aerosol into the rim of the tire such as carb & choke cleaner or WD-40 per the video

Place aerosol can at least 20 feet away from the tire
Remove your rubber gloves just in case they have any aerosol on them; melting rubber on your skin is not a pleasant feeling

Cover your eyebrows with a damp bandana or damp towel or something
Get some fire near the tire

Try closing your eyes or turning your face away from the tire right before ignition
I would advise against using your aerosol can as a flame-thrower but it does add a certain coolness factor
You can just toss a lit match in the general vicinity of the tire (try not to land the match inside the tire or else you'll get rattling noises when using the wheelbarrow)
You can light a stick or newspaper on fire and bring it close to the tire
You can fire up a propane torch if you feel comfortable

The aerosol remnants should immediately ignite drawing a vast amount of air directly into the tire; this is where that safety equipment comes in handy

If you chose the match ignition method or any other "toss a burning object at the tire" method then exercise extra caution because the tire's rapid expansion could send the burning object flying right back at you
You may need to squeeze the tire around a bit to introduce more air to the fire to achieve the desired woosh of air. You should do this by beating the tire with a long stick to avoid personal damage in the event of a tire explosion.
If this doesn't work then spray with water, let it dry, and go back to step #5

Once the tire seats itself then the fire will suffocate inside the tire
If the outside of the tire or rim is on fire then spray it with some water; you may wish to spray with water even if it is not burning
Inflate the tire to proper pressure
Comment: @Adonalsium Step 2a. Don't die. Haha j/k, I'll add some safety tips
Comment: As 'bubba' as this solution seems, it's also the one I see recommended and used the most often. I think this answer could be made even better by including some safety recommendations.
Comment: I've seen this done on Ice Road Truckers, and never understood exactly what they are doing. Thanks for explaining the process in a comical but educational way!.
Comment: I see this recommended a lot, and very little evidence of it being used successfully.  Perhaps explore the other options first.
Comment: @Criggie There's [plenty of video](https://www.google.com/search?tbm=vid&q=wd-40+tire+inflation), but I'd still use an air compressor.
Comment: My uncle did this a number of years ago with a tractor tire and broke a lot of bones in his hands when the tire exploded. Be very careful with this technique.
Comment: I've done this successfully on two tires. Given the YouTube evidence it CLEARLY does work, and fast. Don't be afraid of a little fire or whoosh sound.
Comment: @djsmiley2k I'm glad you enjoyed it! I've personally never had the need to use this method but I will always be on the lookout for my first opportunity!
Comment: This actually works very well. A propane torch tied to the end of a broomstick is a good way to ignite it while staying a safe distance away.  You also have to have the air hose ready and immediately pump air in while it's still sealed - if you wait too long the temperature drops and the seal will break.   That said, @PeteCons answer below is really a better one, though not as adventurous.
Comment: @Mark Good call about inflating the tire to the proper pressure while it's sealed; step #9 has been added. "better" is quite a subjective term though. If the nearest "tire shop" or bead-blaster machine is a 45 minute drive away then that's quite a trip just for air. If I am driving 45 minutes then I am getting an air-less tire :) https://www.amazon.com/Universal-Wheelbarrow-Wheel-Assembly-Adapter/dp/B000S6LFMI
Comment: Ha, yes, the hillbilly method. Not sure on the plastic rims though.  Soapy water can also help. Or you could go Havana and fill it with straw.
Comment: @Kylos What safety precautions would you advise to avoid breaking your hand or getting hurt in the event of a tire explosion? Use less aerosol? Keep hands at a safe distance while igniting?
Comment: @MonkeyZeus those sound like good starting points. People have done this safely for a long time, but it's important to be aware that it can go wrong if you aren't careful.
Comment: @Kylos Agreed. I hope you didn't think I was making light of your uncle's misfortune. I just want to create a comprehensive action plan in my answer.
Comment: I don't think this would work well with wheelbarrow tires, not to mention the safety aspect. (Although I have seen this done with truck tires) What they do at actual tire shops is have a 5 gallon compressed air tank with a large (3-4"), flat, duckbill type, nozzle that you slide in between the rim and the tire, then release **all** the air suddenly with a ball valve. I think the ratchet strap, tube, or tire shop ideas are better in this case though. Also if anyone wants to attempt this, straight ether (diesel starter fluid) is probably the best balance of volatility and safety!
Comment: Great method for times when it has to be done and no civilization in site. Very popular in third world countries where they have no other choice. Risk factor for the uninitiated but the flipside is if you get a buddy to video you and when it goes wrong it will get you on Youtube with a million hits. Just search kids playing with fire gone wrong. Oh another + you might not need haircuts for awhile.
Answer: Take it to the local tire store, and ask them to inflate it - they'll use their bead-blaster machine to mount it. Should be little to no cost.
The next time it happens, ask the tire store to put an innertube in the tire. That solves the problem forever. (Only do it the 'next time', because it may never happen again..)
Comment: +1 for having a tube put in, or doing it yourself. You'll need to remove the rim-mounted valve and let the tube's valve use the same hole.
Comment: When I worked at a gas station with a tire machine that had an air blaster to help set tires, it wouldn't fit a wheelbarrow tire. When someone brought one in that needed the bead to be set, we'd just use two people, one to hold our 100psi air compressor nozzle on while the other one squeezed the tire to try to get the bead to set. The tire filled quickly at that pressure, so as soon as the bead set, you had to take the air nozzle off. We also had an inflatable strap that went around a car tire tread to help squeeze  tires to help the bead set, but again, it wouldn't fit a wheelbarrow tire.
Comment: Hardly solves it forever. One reason cars have tubeless tyres is that tubes puncture easily - especially over rough garden ground - whereas tubeless often leak very slowly when punctured. Best solution is to buy an unpuncturable wheel. Those *do* last forever.
Comment: This is probably the safest solution. I once was in the same situation and took the tire to a nearby tire store. It took them 15 seconds to properly inflate the wheelbarrow tire and did not charge me anything.
Answer: I've had decent luck using a couple of plastic bags and even saran wrap. I rolled them up and placed them near the rim so that it fills in the gap enough to get a better seal. The pump then works well enough to expand the tire.
The gap shown in the photo is small enough for this trick to work.
Long term solution is to have it filled with foam.
Answer: The people who recommend a strap around the perimeter of the tire are correct, and such straps, often inflatable, are made for that purpose. However, a couple of times in a pinch, I have removed the belt I was wearing and wrapped it around the tire and pulled it in as tightly as I could. This has actually worked for me. You should probably remov
the valve stem to let the air in faster and thus with more force.
Comment: Don't remove the valve stem. Remove the valve core (innards) __from__ the stem.
Comment: I'd never heard of the valve core thing before. That's an excellent idea
Answer: I've likewise used my belt.  Put the belt around the tread of the tire, squeeze the tread inward to get the bead to push out and set against the rim. Then inflate the tire.
I've had to do it several times over many years, with the same tire.  The tire holds air just fine, for months, even under weight.  But after going un-used for several seasons it eventually leaks out, enough to loosen the bead and lose the rest.
A strap with a come-along ratchet is easier, but a regular waist belt works in a pinch.
Answer:
Invert wheelbarrow
Align the tire to the rim (as shown in the first photo, above)
While adding air using an air compressor, give the tire a sharp rap with your fist
Adjust tire to proper pressure
Answer: If the tire went flat it has a leak. Just reinflating the tire will not fix the problem. The most likely causes are a tire puncture, or a bead leak from either degraded rubber on the tire or rust on the wheel (not likely in your case with a plastic wheel). The easiest solution is to remove the wheel, the tire and the Schrader valve. Purchase an inner tube of the correct size. Most big box stores carry them. If you have trouble finding the correct size for a wheelbarrow look for a tube designed for a snow blower or lawnmower.
Comment: "Just reinflating the tire will not fix the problem" — The asker specified that they replaced the tire.
Comment: Was the tire replaced because it went flat?
Comment: "Was the tire replaced because it went flat" - this seems immaterial - the asker replaced the tire and now has an issue.
Comment: I've had more problems with plastic rims not sealing. than with metal ones. However, please read the question carefully.


Download dynamic XML/JSON file in Spring Boot

Question: I need to implement a feature where users can download their personal data in XML or JSON format file.
The file will be generated at run time and I have no idea how to implement this in Spring Boot in the corresponding @RestController of my application.
So far I've only implemented the creation of the appropriate XML or JSON String and at first I thought of sending it as a Response and let the front-end manage the rest but I don't think this is the way to go as a file download is required.
Answer: Since your file is created dynamically from a string, you will need to create an output stream and write the string content to it. I haven't tested any of this but I've used similar code in the past.
import org.apache.commons.io.IOUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RequestMapping("/downloadDocument")
public void downloadDocument(HttpServletResponse response, HttpServletRequest  request) throws IOException {
    //jsonPersonal is the string that you're going to create dynamically in your code
    final String jsonPersonal = " some json encoded data here";

    response.setCharacterEncoding("UTF-8");
    response.setHeader("Content-Transfer-Encoding", "binary");
    response.setContentType("application/json");
    response.setContentLength( jsonPersonal.length());
    response.setHeader("Content-Disposition", "attachment");

    //this copies the content of your string to the output stream
    IOUtils.copy(IOUtils.toInputStream(jsonPersonal), response.getOutputStream());

    response.flushBuffer();
}


Getting "Android resource linking failed" even though my code has not changed

Question: Recently I have been getting this error while running my app:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     C:\Users\Ved\.gradle\caches\transforms-2\files-2.1\17b6ef056be36c409382a0a8037faedc\core-1.7.0\res\values\values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

And:
Android resource linking failed
C:\Users\Ved\.gradle\caches\transforms-2\files-2.1\17b6ef056be36c409382a0a8037faedc\core-1.7.0\res\values\values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

When I click on it, it takes me to values.xml line 150:
<declare-styleable name="ColorStateListItem">

        <attr name="android:color"/>

        <attr format="float" name="alpha"/>
        <attr name="android:alpha"/>

        <attr format="float" name="lStar"/>
        <attr name="android:lStar"/>
    </declare-styleable>

I don't even use this styleable yet the error persists. I have read posts talking about the problem being with my compileSDK or with android-core:core-ktx:+
However when i change the SDK to 31 and android-core:core-ktx:1.7.0 it still doesn't work and gives me another error. I have been trying to find the answer but I haven't been able to and hopefully one of you can.
Here are my build gradles:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "com.suad.venttome"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 6
        versionName "1.5"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.core:core:1.3.2'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'com.google.android.material:material:1.3.0-alpha04'
    implementation 'com.jjoe64:graphview:4.2.2'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

    //Passcode view
    implementation 'com.hanks:passcodeview:0.1.2'

    //Material.io implementation
    implementation 'com.google.android.material:material:1.2.0-alpha04'

    //Android Jetpack Navigation
    def nav_version = "2.3.2"
    implementation "androidx.navigation:navigation-fragment:$nav_version"
    implementation "androidx.navigation:navigation-ui:$nav_version"
    implementation "androidx.core:core-ktx:+"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
    maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    mavenCentral()
}

AND:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = '1.4.30-M1'
    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

If you have a possible solution I would love to her it. Thanks in advance!
Answer: just change
implementation "androidx.core:core-ktx:+"

to
implementation "androidx.core:core-ktx:1.6.0"

with version 1.7.0 it also does't work for me
Comment: Unfortunately this solution doesn't work either. Instead I get this error `Failed to transform core-1.6.0.aar (androidx.core:core:1.6.0) to match attributes {artifactType=android-dex, dexing-enable-desugaring=false, dexing-incremental-desugaring-v2=false, dexing-is-debuggable=true, dexing-min-sdk=15}.
           The dependency contains Java 8 bytecode. Please enable desugaring by adding the following to build.gradle
           android {
               compileOptions {
                   sourceCompatibility 1.8
                   targetCompatibility 1.8
               }
           }`


Autosar Software Component

Question: I have reading several AUTOSAR Documents. For now, my concern is just developing Software Component. I have two software component designs, take a look to the picture below.

Explanation:

I got a data from port 1 and 2. Each of ports will correspondence with RunnableEntity which running when a new data has come. Then, the RunnableEntity sets that data to InterRunnableVariable. The main RunnableEntity which is RunnableEntity 1 will process the InterRunnableVariable to make an output.
The data freely come to the port and waiting to be proceed in the buffer. Then, The only one RunnableEntity will process the data with some help by common global variable (The purpose of global variable is same with InterRunnableVariable).

My questions are,

Will design 1 and 2 work?
If design 1 and 2 are true, which one do you prefer according the time process, time to implement, etc.?
Are the codes right? how to handle event and InterRunnableVariable?

Thank you for your help.
====================Adding Code After Comment========================
Design 1
/* Runnable Entity 1*/
/* Event : TimeEvent 25ms */
void re1(void){
    data_output out;
    irv irv1 = Rte_IrvIread_re1_irv1();
    irv irv2 = Rte_IrvIread_re1_irv2();
    irv irv3 = Rte_IrvIread_re1_irv3();

    out = DataProcess(&irv1,&irv2,&irv3);

    Rte_Write_re1_port3_out();
}

/* Runnable Entity 2*/
/* Event : DataReceiveErrorEvent on port1 */
void re2(void){
    irv irv2 = Rte_IrvIread_re1_irv2();

    modify(&irv2);

    Rte_IrvIwrite_re1_irv2(irv2);
}

/* Runnable Entity 3*/
/* Event : DataReceiveEvent on port1 */
void re2(void){
    data_input1 in;
    Std_RetrunType status;

    irv irv1 = Rte_IrvIread_re1_irv1();
    status = Rte_Receive_re1_port1_input(&in);
    if (status == RTE_E_OK) {
        modify(&irv1,in);
        Rte_IrvIwrite_re1_irv1(irv1);
    }
}

/* Runnable Entity 4*/
/* Event : DataReceiveEvent on port2 */
void re2(void){
    data_input2 in;
    Std_RetrunType status;

    irv irv3 = Rte_IrvIread_re1_irv3();
    status = Rte_Receive_re1_port2_input2(&in);
    if (status == RTE_E_OK) {
        modify(&irv3,in2);
        Rte_IrvIwrite_re1_irv3(irv3);
    }
}

Design 2
/*Global Variable*/
global_variable1 gvar1; /* Equal with InterVariable 1 in Design 1*/
global_variable2 gvar2; /* Equal with InterVariable 2 in Design 1*/
global_variable3 gvar3; /* Equal with InterVariable 3 in Design 1*/

/* Runnable Entity 1*/
/* Event : TimeEvent 25ms */
void re1(void){
    data_output out;
    GetData1()
    GetData2()

    out = GetOutputWithGlobalVariable();

    Rte_Write_re1_port3_out(out);
}

/* Get Data 1*/
void getData1(){
    Std_ReturnType status; /* uint8  */
    data_input1 in;

    do {
        status = Rte_Receive_re1_port1_input1(&in);
        if (status == RTE_E_OK) {
            modifyGlobalVariable(in);
        }
    } while (status != RTE_E_NO_DATA && status != RTE_E_LOST_DATA);

    if(status != RTE_E_LOST_DATA){
        modifyGlobalVariableWhenError();
    }
    return;
}

/* Get Data 2*/
void getData2(){
    Std_ReturnType status; /* uint8  */
    data_input2 in;

    do {
        status = Rte_Receive_re1_port2_input2(&in);
        if (_status == RTE_E_OK) {
            modifyGlobalVariable2(in);
        }
    } while (status != RTE_E_NO_DATA && status != RTE_E_LOST_DATA);

    return;
}

Answer: I think both solutions are possible. The main difference is that in the first solution the generated Rte will manage the global buffer whereas in the second design, you have to take care of the buffers yourself.
Especially if you have multiple runnables accessing the same buffer, the 'Rte' will either generate interrupt locks to protected data consistency or it will optimize out the locks if the task context in that the ´RunnableEntities´ are running cannot interrupt each other.
Even if you have only one ´RunnableEntity´ as shown in the second design, it might happen that the ´TimingEvent´ activates the ´RunnableEntity´ and the DataReceivedEvent as well (although I don't understand why you left out the DataReceivedEvent in the second design). In this case the ´RunnableEntity´ is running in two different contexts accessing the same data.
To make it short: My proposal is to use interrunnable variables and let the Rte handle the data consistency, initialization etc.
It might be a little bit more effort to create the software component description, but then you just need to use the generated IrvRead/IrvWrite functions and you are done.
Comment: The second design looks bad to me. Especially the loop to wait for new data is busy waiting meaning that it could block the whole ECU. For this you should use DataReceivedEvents or configure a blocking Rte_Receive (Rte will wait via WaitEvent() instead of busy waiting). Also I'm still not sure if you could run into a concurrency problem if two different runnables are reading/modifiyng the same global buffer. All in all the first code looks much smaller too.
Comment: thank`s again for your answer. You are great at AUTOSAR.
1. I though that buffer in the first design and second design are handled by RTE.
2. Please take a look to second design's code, that is why I didn't use DataReceivedEvent. If I am right.
Comment: Actually, I thought that part of second design is using non-blocking Rte_receive. So, I didn't need wait point and DataReceivedEvents. Am I right? This event still confusing me.
Comment: You could try mutex in this case.
Answer: I'm actually prefering here the first one.
The second one depends a bit on your SWC Description, since there is the specification of the Port Data Access. From this definition it depends, if the RTE creates a blocking or non-blocking Rte_Receive.
[SWS_Rte_01288] A non-blocking Rte_Receive API shall be generated if a VariableAccess in the dataReceivePointByArgument role references a required VariableDataPrototype with 'event' semantics. (SRS_Rte_00051)
[SWS_Rte_07638] The RTE Generator shall reject configurations were a VariableDataPrototype with 'event' semantics is referenced by a VariableAccess in the dataReceivePointByValue role. (SRS_Rte_00018)
[SWS_Rte_01290] A blocking Rte_Receive API shall be generated if a VariableAccess in the dataReceivePointByArgument role references a required VariableDataPrototype with 'event' semantics that is, in turn, referenced by a DataReceivedEvent and the DataReceivedEvent is referenced by a WaitPoint.
 (SRS_Rte_00051)
On the other side, I'm not sure what happens with your blocking Rte_Receive vs your TimingEvent based RunnableEntity call.
Also consider the following:
RTE_E_LOST_DATA actually means, you lost data due to incoming data overflowing the queue (Rte_Receive only works with swImplPoliy = queued, otherwise if swImplPolicy != queued you get Rte_Read). This is not an excplicit Std_ReturnType value, but a flag added to that return value -> OverlayedError)
RTE_E_TIMEOUT would be for blocking Rte_Receive
RTE_E_NO_DATA would be for non-blocking Rte_Receive
you should then check as:
Std_ReturnType status;
status = Rte_Receive_..(<instance>, <parameters>);
if (Rte_HasOverlayedError(status)) {
    // Handle e.g. RTE_E_LOST_DATA
}
// not with Rte_Receive - if(Rte_IsInfrastructureError(status)) { }
else { /* handle application error with error code status */
    status = Rte_ApplicationError(status);
}

Autosar Software Component


synchronous fetch to replace synchronous ajax

Question: I understand that making synchronous calls are not recommended, but I have to make a synchronous call in ajax, since I am dealing with a device which requires user action before I get the response from it. My ajax() code below has been working great until now. I am getting the warning that "Synchronous XMLHttpRequest on the main thread is deprecated".
Synchronous call returns the response (from the device) and I pass it to my second call and output gets generated:

How can I change the synchronous call to keep this working.
Comment: `but I have to make a synchronous call in ajax` - no you don't. You never do. Show a modal spinner that prevents further UI interaction, do anything else, but don't make a synchronous request. Ever.
Comment: Your code is working. You get a *warning* that synchronous is deprecated. You ask us how to make a synchronous request?
Answer: Try this

Comment: Thank you Matt. Your answer helped me to solve the problem. I added an ajax-loader image to appear on beforeSend and disappear at complete.
Answer: Do your post request in the success callback of your get:
$.ajax({
    url: 'url',
    type: "GET"
})
    .then(function(responseText) {
        return $.post(...)
    })
    .then(function(postResponse) {
        ..do whatever
    })


redirect all views in django if a condition is met

Question: I have a field on my user profile model to see if a user:
class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, unique=True)
    ...
    password_change_required = models.BooleanField(default=True)

Is their a way I can redirect all views like this:
if request.user.profile.password_change_required:
     redirect(....)

Where can I put this logic so it hits all views?
Answer: Use Middleware:

During the request phase, before calling the view, Django applies
  middleware in the order it's defined in MIDDLEWARE, top-down.
You can think of it like an onion: each middleware class is a "layer"
  that wraps the view, which is in the core of the onion. If the request
  passes through all the layers of the onion (each one calls
  get_response to pass the request in to the next layer), all the way to
  the view at the core, the response will then pass through every layer
  (in reverse order) on the way back out.
If one of the layers decides to short-circuit and return a response
  without ever calling its get_response, none of the layers of the onion
  inside that layer (including the view) will see the request or the
  response. The response will only return through the same layers that
  the request passed in through.

Which should do what you want so long as your ordering is correct (e.g. after auth middleware so request.user is available).
Answer: class ProfileUpdateView(UpdateView):

def get(self, request, *args, **kwargs):
    if not request.user.profile.password_change_required:
        return super(ProfileUpdateView, self).get(request, *args, **kwargs)
    else:
        return redirect('/accounts/change-password/?next=%s' % request.path)

make sure you also import redirect
from django.shortcuts import redirect

Comment: Won't this only affect the ProfileUpdateView?
Comment: yes. It will only affect the ProfileUpdateView. If you want to apply it all Generic View classes, you may have to use Mixins
Comment: As stated in the question, I want it to apply to ALL views.


PHP & MySQL: list of table entries in a second one

Question: I'm developping a website with a MySQL database containing 2 tables, one containing users information, a second containing gifts information. I want to store the information of who paid a part of the differents gifts and with which amount to give him the possibility to change it later.
I would add an entry to the gifts table with an array of users who donated and the amount. If someone want to change it later, I change the amount or remove the entry and update the displayed gift remaining amount.
But I do not think it is optimal to start with variable length arrays. Maybe creating a new table in the database with the donating user and amount for each gift would be better but it would also be more complicated to code and to manage (I would prefer to have only two tables).
Does someone have any suggestion regarding my dilemma?
EDIT: Based on @Lighthart suggestion I found a solution. I will create a table with a field for each gift. If a user donates for gifts, I create a new entry for the user and set an amount for the concerned gift field. If the user changes the amount, I update the entry. I can easily calculate the remaining amount by adding all the entries for one gift. If you have idea to still improve my solution, do not hesitate!
Answer: This needs to be solved with a many-to-many table if you are opposed to variable length arrays.  This would be a special case of many-to-many  (called association class) where you have data in addition to just the foreign keys.
Comment: I'm not opposed to variable length arrays. I just think ressource needs are bigger when searching for user ID in each gift array than searching for user ID in each gift table. Isn't it? I found [this](http://www.tonymarston.net/php-mysql/many-to-many.html) about many-to-many, if you have tutorial/documentation suggestion about many-to-many or variable length arrays, please share!
Answer: You would probably want a number of tables for this.  Off the top of my head I can think of:
users -> people in system (gist donors and recipients)
gifts -> list of gifts that can be given.
users_gifts -> table relating gifts that have been (or are being) given to the user who will be receiving them
users_gifts_donors -> table relating items in users_gifts to donors (users) and also storing information about the amount of donation towards to gift

Answer: I agree with Lighthart - this really is a three table solution: a table for users, a table for gifts, and a table for donations:
USER(userID [PK], firstName, lastName, email, passwordHash)
GIFT(giftID [PK], title, description, totalCost, dateAdded, owner [FK])
DONATION(donationID [PK], donatingUser [FK], giftDonatedTo [FK], amount, date)

[PK] = Primary Key, [FK] = Foreign Key
That way if somebody wanted to change their donated amount later, you would perform a SQL UPDATE on the particular donationID record.


Proving that $(x^TAx)^2 - x^TA^2x \le 0$ for $x^Tx = 1$.

Question: Given arbitrary $x \in \mathbb{R}^n$ and $A = A^T \in \mathbb{R}^{n \times n}$ such that $x^Tx = 1$ prove that:
$$(x^TAx)^2 - x^TA^2x \le 0 $$
My attempt
Diagonalize $A$ as $A = L\Lambda L^T$. Thus $A^2 = L\Lambda^2 L^T$. Let $w = L^Tx$.
Thus we need to prove
$$(w^T\Lambda w)^2 - w^T\Lambda^2w \le 0 \quad \text{for} \quad w^Tw=1 $$
I'm stuck here.
Answer: Use the standard inner product space structure $(\cdot|\cdot)$ on $\mathbb R^n$, the LHS of your inequality regarding $w$'s is just
$$
|(w | \varLambda w)|^2 - |\varLambda w|^2.
$$
The assumption is $|w|^2 = 1$, so the inequality is just
$$
|(w | \varLambda w)|^2 - |\varLambda w|^2 |w|^2 \leqslant 0,
$$
which is true by the Cauchy--Schwartz inequality of inner products.
Answer: $w^{T}\Lambda w=\sum d_iw_i^{2}$ where $d_i$'s are the diagonal elements. What you need is $(\sum d_iw_i^{2})^{2} \leq \sum d_i^{2}w_i^{2}$. Apply Cauchy -Scawrtaz inequlaity $(\sum a_ib_i)^{2} \leq  \sum a_i^{2}\sum b_i^{2}$ with $a_i=d_iw_i$ and $b_i=w_i$.
Answer: Another approach.
The claim
$$(x^TAx)^2 - x^TA^2x \le 0 $$
would be proved if starting from a little transformed inequality
$$ x^TA^2x-(x^TAx)(x^TAx)= x^T(A^2- Ax x^TA)x \ge 0  $$
we could prove that $(A^2- Ax x^TA)$ is positive semi-definite.
Indeed $V= x x^T$ is projection matrix ( $x^Tx=1$ , it is   projection onto a line) hence we have $V=V^T$ and $V=V^2$.
$A^2- Ax x^TA= AIA-AVA=A(I-V)A^T$
But $P=I-V$ is also a projection matrix with $P=P^2=PP^T$.
Then $APP^TA^T=(AP)(AP)^T=BB^T  $ what means that
the matrix   $(A^2- Ax x^TA)$ is PSD  .


How to prove exponent laws for various number systems, including real exponents

Question: How could I prove following exponent laws for set of real, in the given order?
1) $a^m*a^n=a^{m+n}$
CaseI
a^m=a.a.a...to m factors
a^n=a.a.a...to n factors
a^ma^n=a.a.a...to m+n factors
a^ma^n=a^(m+n)
I have proved it for positive integers but I don't know how to prove it for negative integers without using 5)
But by using 5) I proved it
Let n be a negative integer and m be a positive integer and m+n>0
a^(m+n)a^-n=a^(m+n-n)=a^m [CaseI]
Dividing by a^-n
a^(m+n)=a^m/a^-n=a^ma^n
Let n be a negative integer and m be a positive integer and m+n<0
a^-(m+n)*a^m=a^(-m-n+m)=a^-n [Case I]
Dividing by a^-(m+n)a^-n
a^m/a^-n=1/a^-(m+n)
a^ma^n=a^(m+n)
But I still have to prove it for cases m,n being 0, rational and real
I proved for 0 by using 4)
m=0 and n is a positive or negative integer
L.H.S=a^0*a^n=1*a^n=a^n
R.H.S=a^(0+n)=a^n
L.H.S=R.H.S
n=0 and m is a positive or negative integer
L.H.S=a^m*a^0=a^m*1=a^m
R.H.S=a^(m+0)=a^m
L.H.S=R.H.S
m=0 and n=0
L.H.S=a^0*a^0=1*1=1
R.H.S=a^(0+0)=a^0=1
L.H.S=R.H.S
So I tried to prove them without 4) and 5) but I couldn.t do it and move forward for rational and real
2) $\dfrac{a^m}{a^n}=a^{m-n}$
a^m=a.a.a...to m factors
a^n=a.a.a...to n factors
Let m>n
a^m/a^n=(a.a.a...to m factors)/(a.a.a...to n factors)=a.a.a...to (m-n) factors=a^(m-n)
For m

3) $(a^m)^n=a^{m*n}$
I proved this only for positive integers
(a^m)^n=a^m.a^m.a^m...to n factrors=a^(m+m+m+...to n)=a^(m*n)
4) $a^0=1$
If I proved 1) for negative integers and 5)
m=-n
a^-n*a^n=a^(-n+n)
a^n/a^n=a^0
a^0=1
5) $a^{-n}=\dfrac{1}{a^n}$
If I proved 1) for negative integers and 4)
m=-n
a^-na^n=a^(-n+n)
a^-na^n=a^0=1
a^-n=1/a^n
And I don't know to do the rest for rationals and reals but proved for negative and positive integers
6) $a^{p/q}=(a^p)^{1/q}$
7) $(ab)^n=a^nb^n$
8) $(a/b)^n=\dfrac{a^n}{b^n}$
Here $a,b,m,n$ are real.
Is it necessary that $a>0, b>0$ ?
Are 4) and 5) definitions used in problems dealing with indices?
Although it is necessary to prove above over the set of real, what is meant by a term like $a^{\pi}$? Does that mean $a$ is repeated $\pi$ times?
Moreover, what is meant by $a^{-n}$ where $n$ is positive integer?
Comment: Only $8$ questions?
Comment: Too many questions for one post.
Comment: http://meta.matheducators.stackexchange.com/questions/93/mathjax-basic-tutorial-and-quick-reference
Comment: Any real analysis book (e.g. by Tao) which contains construction of reals must address these question.
Answer: The definition of an expression $a^x$ for real numbers base $a \gt 0$ and exponent $x$ must precede any proof of laws of exponents it satisfies.
The numerous parts of this problem then require a road map, to be sure that everything is addressed.  Many of the individual parts have duplicates of some kind that have been previously addressed, but it may be worth setting out a road map as Community Wiki.
We begin with the properties of real arithmetic, specifically multiplication of positive real numbers gives a unique positive real product, with real multiplication being both associative and commutative.
Then, as the poster has indicated, certain laws of exponents for positive integer exponents $x=n$ can be proved by induction, given the recursive definition that $a^1 = a$ and $a^{n+1} = a\cdot a^n$.
The definition is then extended to general integer exponents $x \in \mathbb{Z}$: $a^0 = 1$ and $a^{-n} = 1/a^n$.  This extended definition involves division, so note that we are relying on $a \gt 0$ for the specific condition that $a \neq 0$ to make the definition valid.  The original poster should note that cases where exponent $x$ is a negative integer are now expressed as $1/a^n$ where $n=-x$ is a positive integer.
Various laws of exponents are then to be proven for general integer exponents, using the previous properties of exponents for positive integers $x=n$ established by induction.
The next stage of extending the definition is to rational numbers $x=m/n$ as exponents.  Here it is very important that base $a \gt 0$ since $a^{1/n}$ will be defined as the principal $n$th root of $a$, and this definition relies on finding unique $b \gt 0$ such that $b^n = a$, again relating back to the case of exponents $n$ that are positive integers.
The final extension of definition is the passage from rational number exponents to real number exponents.  This extension is a matter of taking limits, and there is a substantial proof to be made that $a^x$ is well-defined by $\lim_{k\to \infty} a^{r_k}$ for any sequence of rational number $\{r_k\}_{k=1}^\infty$ such that $x=\lim_{k\to \infty} r_k$.  That is, we need to show both that the limit exists and that we get the same result for $a^x$ whatever sequence of rational numbers converging to $x$ is used.


Mocked protected method not returning value set in mock

Question: I have a class called ModuleManifest with this constructor:
/**
 * Create a new instance of the ModuleManifest class.
 *
 * @param string $vendor The vendor of the module.
 * @param string $package The name of the package.
 * @return void
 */
public function __construct(string $vendor, string $package)
{
    $manifest = $this->manifestPath($vendor, $package);

    if (!File::exists($manifest))
    {
        throw new \InvalidArgumentException(sprintf(
            'Package %s from vendor %s does not contain a manifest',
            $package, $vendor
        ));
    }

    $this->manifest = $this->load($manifest);
}

This constructor loads a json file with the load method.
/**
 * Load a module manifest into an object.
 *
 * @param string $path The path to the module.
 * @return object
 */
protected function load(string $path) : object
{
    return json_decode(file_get_contents($path));
}

/**
 * Determine the path to the module manifest.
 *
 * @param string $vendor The vendor of the module.
 * @param string $package The name of the package.
 * @return string
 */
protected function manifestPath(string $vendor, string $package) : string
{
    return implode('/', [base_path('vendor'), $vendor, $package, 'resources/manifest.json']);
}

I want determine whether the method is returning an object:
/** @testdox Returns an object when the path exists */
public function test_manifest_returns_object() : void
{
    File::shouldReceive('exists')->once()->andReturnTrue();

    $this->mock(ModuleManifest::class, function (MockInterface $mock) {
        $mock->shouldAllowMockingProtectedMethods();
        $mock->shouldReceive('load')->once()->andReturn(
            json_decode('{"name": "testModule"}')
        );
    });

    $manifest = new ModuleManifest('vendor', 'package');

    $this->assertTrue($manifest->has('name'));
}

I get the error:

ErrorException: file_get_contents(...): Failed to open stream: No such file or directory

I would expect it to return the result of json_decode('{"name": "testModule"}'), but it tries to call the function normally. How to resolve this? I have tried to create a partial mock, but the issue remains.
Comment: I don't fully understand why your original method is called, but I can tell you that the testing approach is not sound. You are modifying the SUT (already a smell) and then asserting against something that is basically a fake (the `load` method is not the real one). Even if it worked, you'd be verifying your mock instead of the SUT. The design isn't testable. I suggest you avoid IO in the constructor, it should not "do" things. If you are writing unit tests, mock an (injected) IO collaborator. If it's an integration test, do not use mocks, create a real json file fixture and verify this works.
Comment: @istepaniuk This makes sense, what changes would you propose to make this code more testable?
Comment: Can you show the `manifestPath()` method?
Comment: @Olivier I added it to the post.
Comment: I think you need to type-cast the return value of `json_decode` to `(object)` in order to ensure that it returns an object and try it with `partialMock`, I can send you the rewritten function if you want.
Comment: You can use vfs to mock that file path as seen in this example: https://stackoverflow.com/questions/44774827/phpunit-how-can-i-mock-this-file-creation
Answer: Here is how I would do it. Add an optional $basePath parameter to the constructor whose default
value is base_path():
class ModuleManifest
{
    private object $manifest;

    public function __construct(string $vendor, string $package, string $basePath='')
    {
        if ($basePath=='')
            $basePath = base_path();
        $path = $this->manifestPath($vendor, $package, $basePath);

        if (!File::exists($path))
        {
            throw new \InvalidArgumentException(sprintf(
                'Package %s from vendor %s does not contain a manifest',
                $package, $vendor
            ));
        }

        $this->manifest = $this->load($path);
    }

    protected function manifestPath(string $vendor, string $package, string $basePath) : string
    {
        return implode('/', [$basePath, 'vendor', $vendor, $package, 'resources/manifest.json']);
    }

    protected function load(string $path) : object
    {
        return json_decode(file_get_contents($path));
    }

    public function has(string $key) : bool
    {
        return isset($this->manifest->$key);
    }
}

For the test, choose a test directory and create vendor/foo/bar/resources/manifest.json in it. Then the testing
code is simply:
public function test_manifest_returns_object() : void
{
    $manifest = new ModuleManifest('foo', 'bar', '/path/to/test/dir');
    $this->assertTrue($manifest->has('name'));
}

That's it. You don't need any mock. Also note that you should not test that ModuleManifest uses the File class because
it's just an implementation detail. It could very well do it another way (such as calling file_exists() directly).


How to use registers in kprobe?

Question: From kprobe document:
echo 'p:myprobe do_sys_open dfd=%ax filename=%dx flags=%cx mode=+4($stack)' > /sys/kernel/debug/tracing/kprobe_events

Per my understanding, on X86_64 platform, the arguments should be passed into registers (please refer X86_64 syscalls). So I think adding probe should like this:
echo 'p:myprobe do_sys_open dfd=%rdi filename=%rsi flags=%rdx mode=%rcx' > /sys/kernel/debug/tracing/kprobe_events

But execute the above statement, bash complains:
-bash: echo: write error: Invalid argument

So my questions is: how to use registers in kprobe? Which registers are valid?
Answer: After discussing with kprobe maintainer, I get the answer:
ftrace-kprobe interface does not accept bitwidth prefix like 'rax' instead it accepts 'ax'. The bitwidth is automatically chosen by architecture. So please remove 'r' from all arguments. If you'd like to access eax or ax, you can use typecast, like as %ax:u32.

How to use registers in kprobe?


Does ranked premade 5v5 MMR affect your 5v5 normal premade matchmaking?

Question: I've wondered if my 5v5 Ranked team MMR affects my 5v5 premade normal matchmaking.
Since soloqueue MMR influences the matchmaking of soloqueue normal games (i'm currently G1 and i always play vs G2 - P3 in normal and ranked games when i'm soloqueue), would it be possible that the team Ranked mmr also affect your normal games if you are 5 premades?
I mean if you are playing with 4 of your friends the enemy team will also have 5 premades. And it would be kinda unfair (although it's almost impossible) if a team that only consists of silver players but has a 5s ranked rating of like plat/diamond plays vs 5 other silver players.
Comment: ranked solo que doesnt affect normal solo que MMR. just as ranked team games dont affect normal team games.
Comment: Well i think soloqueue mmr does affect your solo normal games... I can't explain why i was playing vs silver and bronze when i was silver and bronze and now i play vs gold and plat... also pro players always play vs diamond plat when they play normals. You can look that up in lolking
Comment: That could be simply be because as you do better in ranked you're also doing better in normal meaning your MMR for both would be about the same.
Comment: @Jutschge its because your as skilled as you are in ranked as you are in normal. and unless you screw around in every normal game you will play against players your skill level.
Comment: I have many friends near a platinum level, but we get matched nearly always vs. unranked-silver level players.  (Usually 1bronze, 2gold, 2plat/diamond). Don't know specifics though.
Comment: basically what Paralytic said.
Answer: No.
Ranked MMR and normal MMR are definitely not synchronized.
You can see it when mostly any LoL pro (or anyone who improved in rankeds since last normal game) plays normals - they stomp hard, because their normal MMR is much lower than their more accurate assessment of their skill - their ranked MMR. If in such game their enemy team has ranked players, their ranks would reflect that unless they are in similar position (i.e. improved since last normal game) - their ranks would be much lower than that of said pro/high-elo player.
Kinda related: Solo queue MMR does not affect Team MMR in no way way; besides maybe placement matches.
There are ways to test this hypothesis in a way - see http://op.gg/ for soloq and ranked team MMR or if you don't trust it's algorithms, just find a team with ranking severely below individual rankings (due to lack of communication etc), which is pretty common in lower divisions (higher up discrepancy is a bit less, by my observations)
Sources:

followed high-elo/pro NA/EUW/KR scene for several years
saw effects of this in action as described above
was interested in MMR innerworkings myself
currently can not find Riot's information regarding this but remember reading it
some minimal research shows that it is common knowledge.
Comment: @Lerkes, I fixed answer and provided what sources I have behind it
Comment: Could you provide some source or explanation from where you have this information please?


Download Firebase files from Flutter

Question: I have some files in the assets folder in order to use them offline.
Now, I need to download files from firebase, but need to check if these files exist or not.
Need sample code and Thanks in advance.
Please Help with sample code.
Comment: A quick search turns up this: https://github.com/firebase/flutterfire/issues/11620. You might want to give the code in that issue report a try to see if it works for you. If not, report back with what you tried and what result (and error, if any) you got.
Answer: You have said that you need to check whether the files exist or not. Just trying to download the images to local file on the device and doing error handling should work well.
Code -
<code>final islandRef = storageRef.child("images/island.jpg");

final appDocDir = await getApplicationDocumentsDirectory();
final filePath = "${appDocDir.absolute}/images/island.jpg";
final file = File(filePath);

final downloadTask = islandRef.writeToFile(file);
downloadTask.snapshotEvents.listen((taskSnapshot) {
  switch (taskSnapshot.state) {
    case TaskState.running:
      // TODO: Handle this case.
      break;
    case TaskState.paused:
      // TODO: Handle this case.
      break;
    case TaskState.success:
      // TODO: Handle this case.
      break;
    case TaskState.canceled:
      // TODO: Handle this case.
      break;
    case TaskState.error:
      // TODO: Handle this case.
      break;
  }
});
</code>
the last case should be the one that will tell you whether the file is there.

Download Firebase files from Flutter


Intel wireless controller 8260 unclaimed on Ubuntu 15.10

Question: After I installed Ubuntu 15.10 on a new Thinkpad carbon, I had to add the two kernel parameters i915.preliminary_hw_support=1 and nolapic to get Ubuntu working. The installation seems to be fine, but the wifi controller won't work.
Here is the output of lshw -C network, lspci -nnk | grep 0280 -A2 and dmesg | grep iwl:
$ lshw -C network
WARNING: you should run this program as super-user.
  *-network UNCLAIMED
       description: Network controller
       product: Wireless 8260
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:04:00.0
       version: 3a
       width: 64 bits
       clock: 33MHz
       capabilities: cap_list
       configuration: latency=0
       resources: memory:f1100000-f1101fff
  *-network
       description: Ethernet interface
       product: Ethernet Connection I219-LM
       vendor: Intel Corporation
       physical id: 1f.6
       bus info: pci@0000:00:1f.6
       logical name: enp0s31f6
       version: 21
       serial: 54:ee:75:90:ec:ac
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.5-k firmware=0.13-4 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:11 memory:f1300000-f131ffff
  *-network
       description: Ethernet interface
       physical id: 1
       logical name: enx00eb4e68052d
       serial: 00:eb:4e:68:05:2d
       size: 1Gbit/s
       capacity: 1Gbit/s
       capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8152 driverversion=v1.08.1 (2015/07/28) duplex=full ip=192.168.178.87 link=yes multicast=yes port=MII speed=1Gbit/s
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
fabian@PizCavradi:~$ lspci -nnk | grep 0280 -A2
04:00.0 Network controller [0280]: Intel Corporation Wireless 8260 [8086:24f3] (rev 3a)
    Subsystem: Intel Corporation Device [8086:0130]
05:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd Device [144d:a802] (rev 01)
fabian@PizCavradi:~$ dmesg | grep iwl
[    2.598435] iwlwifi 0000:04:00.0: enabling device (0000 -> 0002)
[    2.681639] iwlwifi 0000:04:00.0: pci_enable_msi failed(0Xffffffda)
[    2.747142] iwlwifi 0000:04:00.0: invalid TLV len: 3180/4294967295
[    2.747259] iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-14.ucode failed with error -2
[    2.749072] iwlwifi 0000:04:00.0: Driver unable to support your firmware API. Driver supports v15, firmware is v421399808.
[    2.749672] iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-12.ucode failed with error -2
[    2.749674] iwlwifi 0000:04:00.0: request for firmware file 'iwlwifi-8000C-12.ucode' failed.
[    2.749847] iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-11.ucode failed with error -2
[    2.749849] iwlwifi 0000:04:00.0: request for firmware file 'iwlwifi-8000C-11.ucode' failed.
[    2.749856] iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-10.ucode failed with error -2
[    2.749857] iwlwifi 0000:04:00.0: request for firmware file 'iwlwifi-8000C-10.ucode' failed.
[    2.749858] iwlwifi 0000:04:00.0: no suitable firmware found!
[    2.751430] iwlwifi 0000:04:00.0: Unsupported splx structure

sudo modprobe iwlwifi doesn't return anything and the ethernet connection works fine. So it seems like there is a problem with the firmware for my wifi controller. I already did some updates and tried suggestions from other posts but nothing was successful.
So does anyone has a solution for my problem? Many thanks in advance!

Thanks for your responses! uname -a returns
Linux PizCavradi 4.2.0-34-generic #39-Ubuntu SMP Thu Mar 10 22:13:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

The wireless controller is not unclaimed anymore, but it still won't work. The output of dmesg | grep iwl now is
$ dmesg | grep iwl
[    2.690951] iwlwifi 0000:04:00.0: enabling device (0000 -> 0002)
[    2.691504] iwlwifi 0000:04:00.0: pci_enable_msi failed(0Xffffffda)
[    2.820257] iwlwifi 0000:04:00.0: loaded firmware version 15.195093.0 op_mode iwlmvm
[    2.824280] iwlwifi 0000:04:00.0: Unsupported splx structure
[    2.863303] iwlwifi 0000:04:00.0: Detected Intel(R) Dual Band Wireless AC 8260, REV=0x208
[    2.867954] iwlwifi 0000:04:00.0: L1 Enabled - LTR Enabled
[    2.868894] iwlwifi 0000:04:00.0: L1 Enabled - LTR Enabled
[    2.874298] iwlwifi 0000:04:00.0: can't access the RSA semaphore it is write protected
[    9.574405] iwlwifi 0000:04:00.0: Failed to load firmware chunk!
[    9.574406] iwlwifi 0000:04:00.0: Could not load the [0] uCode section
[    9.574408] iwlwifi 0000:04:00.0: Failed to start INIT ucode: -110
[    9.574875] iwlwifi 0000:04:00.0: Failed to run INIT ucode: -110
[    9.574895] iwlwifi 0000:04:00.0: L1 Enabled - LTR Enabled

Interestingly, when I run sudo modprobe -r iwlwifi and then sudo modprobe iwlwifi my notebook freezes and I have to press the power button until it switches off. After restarting, sudo modprobe iwlwifi works.
Comment: Please add output of `uname -a` command.
Answer: You are missing the latest firmware. You can install it by opening a terminal and doing:
sudo apt-get update
sudo apt-get install git
git clone https://github.com/OpenELEC/iwlwifi-firmware.git
cd iwlwifi-firmware/firmware
sudo cp iwlwifi-8000*  /lib/firmware
sudo modprobe -r iwlwifi
sudo modprobe iwlwifi

Your wireless should be working. It might take a reboot, however.
If this firmware is ineffective, please try:
wget http://mirrors.kernel.org/ubuntu/pool/main/l/linux-firmware/linux-firmware_1.157_all.deb
sudo dpkg -i linux-firmware*.deb

Reboot.
I suggest we temporarily try a newer version of the driver. Please download this file to your desktop: https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v4.4.2/backports-4.4.2-1.tar.gz Right-click it and select 'Extract Here.' Now, back to the terminal:
cd ~/Desktop/backports-4.4.2-1
make defconfig-iwlwifi
make
sudo make install

Reboot. If this and the firmware are effective, I will suggest that we install an entire 4.4.6 kernel.
NOTE: This assumes that your install is English; if not, and if Desktop is named something different, substitute above. For example:
cd ~/Escritorio/backports-4.4.2-1

Let's try even newer firmware files:
cd /lib/firmware
sudo wget https://git.kernel.org/cgit/linux/kernel/git/iwlwifi/linux-firmware.git/plain/iwlwifi-8000C-19.ucode
sudo wget https://git.kernel.org/cgit/linux/kernel/git/iwlwifi/linux-firmware.git/plain/iwlwifi-8000C-21.ucode

Reboot. Then paste again:
dmesg | grep iwl

Reviewing your last paste, I am very concerned about this:

[    2.678204] iwlwifi 0000:04:00.0: pci_enable_msi failed(0Xffffffda)

I think this bug report is related: https://bugzilla.kernel.org/show_bug.cgi?id=114101 It suggests adding a boot option irqpoll.
Please do:
gksudo gedit /etc/default/grub

Use nano or kate or leafpad if you don't have the text editor gedit. Find the line that starts with GRUB_CMDLINE_LINUX_DEFAULT and add irqpoll to the end.  it should result in something like:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash irqpoll"

Proofread carefully, save and close the text editor. Now do:
sudo update-grub

Reboot and show us again:
dmesg | grep iwl

Comment: Op has a non-standard kernel. Firmware 13 has a wrong API for it. It can be fixed by changing a kernel, or by installation of a newer firmware from that github or from `linux-firmware` for xenial.
Comment: Okay, now the wifi controller is not unclaimed anymore. However, it is still not working. I posted the new output of `dmesg | grep iwl` in a new answer, down here.
Comment: Is this after installing the first firmware file, from github, or the second, by installing linux-firmware? If you have lengthy logs to post, paste them here and give us the link: http://paste.ubuntu.com Thanks.
Comment: Sorry, I'm new to ask ubuntu...I will use paste.ubuntu.com in future! This is after installing the firmware from github. I think the linux-firmware didn't change it at all.
Comment: @Pilot6 As far as I can tell, the firmware blobs common to both linux-firmware and github, namely -13 and -16, are identical. Also, 4.2.0-34 is not a non-standard kernel.
Comment: Please see my edit above in a few minutes.
Comment: 13 and 16 are not identical, they have different API. The kernel looks OK.
Comment: Unfortunately, this also didn't work. I get the same error message as before.
Comment: Please run these commands and paste them as I outlined above. Give us the link. `dmesg | grep iwl` and also: `ls -al /lib/firmware | grep 8000`
Comment: Alright, here is the output: http://paste.ubuntu.com/15568179/
Comment: Please see a further edit in a few moments.
Comment: Again, this did not change much: http://paste.ubuntu.com/15574830/. Thanks for your patience!
Comment: Please see a further edit in a few minutes.
Comment: It didn't change the output of `dmesg | grep iwl` much (http://paste.ubuntu.com/15576846), but wifi works now! Thanks a lot!
Comment: Maybe I was a bit hasty. It turned out that `irqpoll` as kernel parameter often makes my installation to freeze at startup. I. e. when I enter my password, just before I reach the desktop. Any solutions for that?


PHP Warning: file_get_contents(http://ipecho.net/plain): failed to open stream: Connection timed out in

Question: I have an error here and I don't know where the problem is exactly.
I am trying to make a PHP file and deny anyone to use the script except the IP that I have entered into the code:
$pass = '192.168.x.x'; //here is the ip of the client
if (file_get_contents('http://ipecho.net/plain') !== $pass) {

When I use the code Ii have problem
PHP Warning:  file_get_contents(http://ipecho.net/plain): failed to open stream: Connection timed out

Comment: Is `allow_url_fopen` enabled ?
Comment: Does it get the contents of the URL? Firewalls etc. If so - what is the contents
Comment: the contents  must be just  a ip
Answer: Why you use that site for getting the client's IP?
You can use this PHP function for getting the client's IP address.
whenever the application is behind a proxy(e.g, Cloudflare):
function get_client_ip() {
    $ipaddress = '';
    if ($_SERVER['HTTP_CLIENT_IP'])
        $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
    else if($_SERVER['HTTP_X_FORWARDED_FOR'])
        $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
    else if($_SERVER['HTTP_X_FORWARDED'])
        $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
    else if($_SERVER['HTTP_FORWARDED_FOR'])
        $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
    else if($_SERVER['HTTP_FORWARDED'])
        $ipaddress = $_SERVER['HTTP_FORWARDED'];
    else if($_SERVER['REMOTE_ADDR'])
        $ipaddress = $_SERVER['REMOTE_ADDR'];
    else
        $ipaddress = 'UNKNOWN';
    return $ipaddress;
}

and when the application isn't behind a proxy:
function get_client_ip() {
    return $_SERVER['REMOTE_ADDR'];
}

Final code should be like this:
$pass = '192.168.x.x'; //here is the ip of the client
if (strcmp(get_client_ip(),$pass) == 0 ) {

Comment: This is bad advice. Nobody has to be behind a proxy, just send in an http header and they could pretend to be localhost.
Comment: You are right! This function should always be used for applications behind a proxy
Comment: It would still be incorrect even if behind a proxy. Nginx, Cloudflare etc they just add multiple X-Forwarded-For headers instead of dropping source one, not to mention internal proxies on a cloud deployment
Answer: if (file_get_contents('http://ipecho.net/plain') !== $pass)

Please note that using this code you are comparing ip of your SERVER with pass not your CLIENT !
so your code is wrong. another problem is in using '!==', it's something that you should only use on boolean types not strings
so the quick fix is :
if ($_SERVER['REMOTE_ADDR'] != $pass)


How can i get the values of asp textbox control in UpdatePanel

Question: I got a trouble with my ascx control. I cannot get the values of textbox normally when it in an Updatepanel.
<asp:UpdatePanel ID="UpdatePanel" runat="server">
    <ContentTemplate>

            <asp:TextBox ID="txtDescription" runat="server" CssClass="form-control" TextMode="MultiLine"></asp:TextBox>
            <button type="button" runat="server" id="btnCreateDomain" onserverclick="btnCreateDomain_ServerClick" class="btn btn-primary">Save</button>

    </ContentTemplate>
</asp:UpdatePanel>

In code, in the "btnCreateDomain_ServerClick" function, i wrote as below to get value of this textbox:
string desc = txtDescription.Text;

But the values always return is empty value!
Who can help me?
Comment: try to refer this link.. http://stackoverflow.com/questions/5896807/how-to-update-textbox-using-update-panel-in-asp-net
Comment: Have you tried with asp button?
Answer: I tried your code and there is mistakes. so try following code. It works for me.
     <asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel" runat="server">
            <ContentTemplate>

                    <asp:TextBox ID="txtDescription" runat="server" CssClass="form-control" TextMode="MultiLine"></asp:TextBox>
                    <asp:Button runat="server" ID="btnCreateDomain" OnClick="btn_click" class="btn btn-primary" Text="Save"></asp:Button>

            </ContentTemplate>
        </asp:UpdatePanel>

and in .cs file,
     protected void btn_click(object sender, EventArgs e)
    {
        string desc = txtDescription.Text;
    }


Debug Java program by executing "gradle run"

Question: I have a Gradle project in Eclipse IDE and I usually use the option gradle run to run my Java application.
I have an error in my Java code and I want to debug it, but when I execute gradle run, the debugger doesn't stop in the breakpoints. In the "Debug as" menu, I don't have anything like gradle debug.
How can I debug my application?
Comment: Have you tried `gradle run --debug-jvm` ?
Comment: I will try it, but I wanted to debug using the eclipse IDE
Comment: There is a discussion on https://discuss.gradle.org/t/how-do-you-attach-a-debugger-to-gradle-so-that-i-can-debug-it-running-a-task/7526 on how to debug in eclipse using gradle tasks.
Answer: Even though the accepted answer should work, you can achieve it in a much easier way.

Just run gradle run --debug-jvm. This starts the application in remote debug mode, and you can attach with any remote debugger, e.g., Eclipse, on port 5005.
Assuming you use Eclipse as IDE: In Eclipse, go on your Project -> Debug as... -> Debug Configuration -> Remote Java Application. As host set localhost, as port 5005, and you are free to go.

For more information see the official Gradle Java plugin doc regarding testing.

[...] can also be enabled at invocation time via the --debug-jvm task option (since Gradle 1.12).
Comment: this works, but not the accepted answer. The gradle one is the one actually works.
Comment: this works indeed. to change the default port, in the build.gradle file test section add like this: test {
jvmArgs=["-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5099"]
}
Comment: If you have gradle in your project as a wrapper (and you likely don't have gradle installed by itself on your system) and you're using Eclipse:
1) Locate the `gradlew` file in your project
2) Open up a new terminal in Eclipse by going into the package explorer and right clicking the project containing `gradlew` > Show in Local Terminal > Terminal
3) Within the newly created terminal, enter `gradlew run --debug-jvm`
4) Perform step 2 in the answer above.
Comment: Is there a commandline switch to make this suspend when Eclipse connects, which doesn't require changing `jvmArgs` in `build.gradle`?
Comment: Here is the Gradle official guide. https://docs.gradle.org/current/userguide/java_testing.html#sec:debugging_java_tests
Comment: Some IDE-s use a debug task.  Which could work before Gradle 7 if you add some code tweaks to the task.  Instead replace the IDE `debug` operation `project:debug` with something like: `project:run --debug-jvm`.  Then the IDE works correctly.  Oh and similarly for debugging a test.
Answer: To debug a Gradle project in Eclipse follow these steps:
Step 1:
Put these in the build.gradle file:
tasks.withType(JavaExec) {
    if (System.getProperty('DEBUG', 'false') == 'true') {
        jvmArgs '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9099'
    }
}

Step 2:
From the root of your project run:
gradle -DDEBUG=true run

You will now see something like this in the console:
Listening for transport dt_socket at address: 9099

Step 3:
Now set breakpoints in Eclipse in your source files.
Step 4:
As last step, now right-click in Eclipse on Project > Debug as > Debug configuration > Remote Java application.
There you have to set these fields:
1. Project (this should be set to name of your Eclipse project)
2. Host (here it's localhost)
3. Port (in this example it will be 9099)

Click "Debug". Now your program will stop whenever it hits a breakpoint in Eclipse.
To see details of these steps with an example project see this gradle example on GitHub:
Comment: This worked for me but I needed to change `debug_socket` to `dt_socket`. `jvmArgs '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9099'`
Comment: Hey, when I try your steps, setting the debug configuration for remote application results in the error message Failed to connect to remote VM. Connection refused.
I am trying to run a task that executes my cucumber tests from gradle, and stop at a breakpoint in the Java code. Any tips?
Comment: Hey @themathmagician, Im havent used cucumber tests but if its some kind of unit test you need to change the gradle function a little.Follow this example for unit tests: https://github.com/ayonious/gradle-tutorial/tree/master/remote-debugging2
Comment: @Jerinaw thanks for mentioning it updating my answer
Comment: Xrunjdwp is for Java 1.4 or less
Answer: I wasn't able to run the gradle task in debug mode through adding the following code in build.gradle file.
tasks.withType(JavaExec) {
    if (System.getProperty('DEBUG', 'false') == 'true') {
        jvmArgs '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'
    }
}

Instead I did the following steps and managed to run it automatically in debug mode :

All you need to to do is to go to $GRADLE_HOME/bin.
Edit the file gradle or gradle.bat depending on your OS.
Set the JVM parameter in the OS-specific way. For example:

gradle(UNIX) case :
DEFAULT_JVM_OPTS="-Xdebug-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"

gradle.bat(NT) case :
set DEFAULT_JVM_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005

.
 4. Run the Gradle command from the console.


TREE(3) and the Goodstein sequence

Question: TREE(3) is an extremely large number that requires ordinal arithmetic to prove it is finite.  For what value of n would $G(n)>TREE(3)$?  The length of the
Goodstein sequence $G(n)$ is how many numbers in the sequence beginning with n are traversed in reaching 0. Proving that $G(n)$ is finite for all n also requires ordinal arithmetic and I'm more familiar with the Goodstein sequence.
For $n\ge8$, an $\omega^{\omega+1}$ sequence of decreasing ordinals is required to describe the Goodstein sequence and $G(12)$ is greater than Graham's number. For $G(16)$; $n\ge16$ a sequence beginning with $\omega^{\omega^\omega}$ iteration is required, and numbers that large are difficult to imagine even in terms of Graham's number type iterations.  $G(65536)$ requires $\omega\uparrow\uparrow 4$ iteration.
How large a value of n would be required so that
$G(2\uparrow\uparrow n)>TREE(3)$?  I chose the $2\uparrow\uparrow n$ notation on the assumption that using $G(n)>TREE(3)$ might require an extremely large value for $n$.
I found this How large is TREE(3)? post on mathoverflow.net, which should be useful in putting a lower bounds on the answer to this question, but I'm still trying to understand the post on mathoverflow.  A partial answer with the lower bounds answer would also be appreciated!
I also found this related mathstack question giving a lower bound for Kruskal's weak tree function, which along with the wikipedia TREE(3) article may give a lower bounds for this answer.
EDIT: The Fast-growing hierarchy along with another Tree(n) mathstack question provides a possible answer.  Here is the Goodstein sequence written exactly in terms of the fast growing hierarchy; hopefully my notation here is correct:

$G(4)=f_3(3)-2$
$G(8)=f_{\omega+1}(3)-2$
$G(16)=f_{\omega^\omega}(3)-2$
$G(2\uparrow\uparrow n) = f_{\omega\uparrow\uparrow(n-1)}(3)-2$

The mathoverflow Tree3 link gives this inequality:
TREE(3) $\geq H_{\vartheta (\Omega^{\omega}, 0)}(n(4))$
Based on the links, the Fast-growing hierachy can be written in term's of Hardy's H function but I don't understand the $\Omega^\omega$ notation term in the inequality.  The implication seems to be that *more * layers of diagonalization are required and perhaps $TREE(3) > G(2\uparrow \uparrow n)$ for any value of n that could possibly be written down!
Comment: It's worth trying the Googology Wiki.
Comment: Thanks for the link Benjamin!  On the one hand, it appears that this  is a very difficult question, yet on the other hand, Friedman writes, "Also, numbers derived from Goodstein sequences or Paris/Harrington Ramsey theory, although bigger than n(4), are also completely UNNOTICEABLE in comparison to TREE[3]."  So perhaps $G(2\uparrow\uparrow n)<TREE(3)$ for any value of n that we could hope to write down as a decimal integer ....
Answer:
How large a value of n would be required so that
$G(2\uparrow\uparrow n)>TREE(3)$?

perhaps $TREE(3) > G(2\uparrow \uparrow n)$ for any value of n that could possibly be written down!

Yes, and this should not be surprising! Using the fast-growing hierarchy with fundamental sequences defined as in the reference below at Footnote(2), we have, for all $n\gt 2,$
$$G(2\uparrow\uparrow n) = f_{\omega\uparrow\uparrow(n-1)}(3)-2 \lt f_{\epsilon_0}(n)$$
whereas$^\dagger$
$$TREE(3) \gt f_{\epsilon_0+1}(k)
$$
where $k$ is Graham's number. (Using $\epsilon_0+1$ here is an extremely conservative choice.)
If $n^*$ denotes the least $n$ s.t. $G(2\uparrow\uparrow n)>TREE(3),$ then $n^*$ must be greater than the least $n$ s.t.
$$f_{\epsilon_0}(n)\gt f_{\epsilon_0+1}(k)=f_{\epsilon_0}^{k}(k),
$$
i.e., $$n^* \gt f_{\epsilon_0}^{k-1}(k).$$
The decimal digits of Graham's number $k$ are already impossible to "write down", let alone doing so for the digits of $\underbrace{f_{\epsilon_0}(f_{\epsilon_0}(\dots f_{\epsilon_0}(k)\dots ))}_{k-1 \text{ applications of } f_{\epsilon_0}}.$
NB: The cited references prove (rigorously) that $TREE(3) > f_{\Gamma_0}(k).$ Thus $f_{\epsilon_0}(n^*)\gt f_{\Gamma_0}(k),$ from which we could derive much stronger results of the form $n^*>f_{\epsilon_0}^{-1}f_{\Gamma_0}(k);$ but nothing stronger than our very weak bound is needed to answer your question.

$^\dagger$ This extremely weak lower bound is proved by combining the following two facts that are established at the cited links:
(1) https://mathoverflow.net/a/95588/20307:
$$TREE(3) \gt tree(n(4))\gt tree(5)$$
(2) https://recursion-theory.blogspot.com/2020/05/lower-bounds-for-tree4-and-tree5.html:
$$tree(5) > f_{\Gamma_0}(\text{Graham's number}) \gt f_{\epsilon_0+1}(\text{Graham's number}) $$
Comment: @SheldonL  I prefer to answer your question (the one I quoted) without addressing any controversy about the lower bound $H_{\vartheta (\Omega^{\omega}, 0)}(n(4)).$ Thus, I've edited my answer to avoid using that lower bound altogether.
Comment: Are there any differences in the definitions of the Hardy fast growing hierarchy for the goodstein function and for the Tree function that would make it difficult to prove:  $$TREE(3) \ge H_{\vartheta (\Omega^{\omega}, 0)}(k) \gg f_{\epsilon_0+1}(k)
$$
In the https://googology.fandom.com/wiki/TREE_sequence footnote 3 says that estimates for a lower bounds of TREE(3) cannot be made rigorous.
Comment: The equations are brilliant, and I especially like the approach in $G(2\uparrow\uparrow
 n)$ in terms of $f_{\epsilon_0(n-1)}-2$ and then showing that Tree(3) is at least $f_{\epsilon_0+1}$.  Thanks!

TREE(3) and the Goodstein sequence


httr POST request error: upstream connect error or disconnect/reset before headers. reset reason: connection termination

Question: I am currently trying to upload a CSV file to a proprietary service via httr::POST(). Unfortunately the Admins are not experienced in R and can give only little support.
This is an example on how it should look like in the command line:
curl -X POST --header 'Content-Type: multipart/form-data' \
-F file=@"member-1-test.csv.gz"  'https://some/api/endpoint'

So, in the following code I just try to stick with the example (and additionally provide a token).
> library(tidyverse)
> library(httr)

# Provide some test data with characters specifically quoted
> test_file <- tibble::tribble(
   ~keytype, ~key, ~action, ~segment,
   6,"\"https://www.google.com\"", 0, 37372818,
   6,"\"https://www.sport1.de\"" , 0, 37372818
 )

> data.table::fwrite(test_file, "test.csv", quote = FALSE)

> file <- upload_file(path = "C:/R/projects/DefaultWorkingDirectory/test.csv")

> res <- POST(

   url = "https://some/api/endpoint",

   body = list(file = file),

   add_headers(.headers = c('Content-Type' = "multipart/form-data", "Authorization" = token))
 )

This gives me the follwing error:
> res
Response [https://some/api/endpoint]
  Date: 2020-11-18 09:35
  Status: 503
  Content-Type: text/plain
  Size: 95 B

> content(res, encoding = "UTF8")
"upstream connect error or disconnect/reset before headers. reset reason: connection termination"

Any help or guidance on how to move forward with this issue is very much appreciated. Thanks!
Answer: Directly after posting the question it was already solved by one of the Admins :)
The issue was that the encoding needs to be set to "multipart" and that a specific content type needs to be provided which is similar to JSON but needs to be added to the "Accept"-header field.
Here the answer for any future references:
> res <- POST(

    url = "https://some/api/endpoint",

    body = list(
      file = upload_file("test.csv")
    ),

    add_headers(c(
      "Authorization" = token,
      "Accept" = "specific_format_for_the_application"
   )),

   encode = "multipart",

   verbose()
 )


How do you defeat the two huge snakes that come out of the wall?

Question: In Ben 10: Alien Force – Vilgax Attacks (Xbox 360), how do you defeat the two huge snakes that come out of the wall?
Answer: This video demonstrates a walkthrough of the boss. It seems that you have to wait until one of the snakes opens their mouth, transform into the form that throws fireballs, and attack at this opportune moment; currently my internet is being slow so I will edit this answer if it turns out to be a multiple step procedure as the battle wears on.


Showing items in a list with limited space

Question: We have a list of items for a chart legend, and some other lists where there are items hidden below. We have several areas in the UI where we have a constrained space, and items that are hidden below.
Our current solution is that on hover there's a scrollbar visible, plus we have a white to transparent gradient at the bottom, so the last it fades, to suggest the list continues. We're in the process of refining this gradient...

There are suggestions and pressure (not from users!) to put buttons at the bottom to make it explicit that you can scroll down, but that is adding more chrome to the UI, which I don't want to do. We already have a good amount of chrome that's necessary, but I don't want to add more controls if possible. I am wondering if I'm leaving some other options on the table.
I'm sure people have come across this before. Any help on subtle (or other) solutions are welcome.
Comment: @Mike I'm not getting it. It's a desktop application and you want the user know they can scroll but you're not showing them an scroll bar? Why?
Comment: Is this list always big or it can sometimes have only 3 items? I think the size of the list (item count) must be taken in consideration before looking other solutions.
Comment: It would really help to know: 1) what sort of application is this? Desktop? Web? 2) Are you to support mobile or tablets? 3) Roughly what sort of target audience we are talking about?
Comment: 1. It is desktop only. 2. we're not concerned w/ supporting mobile 3. Our audience is API developers.

Our users are super technical. And I've not seen evidence in usability testing that people are missing the list items. That's why I'm pushing against adding more chrome to the UI. I can't show more of the screens (nda), but we have some IDE screens, plus analytics pages that use this device currently.
Comment: Hi rewobs,
Very sorry if i was unclear. We do have a scroll on hover, but I don't want to make it persistent, as some of our ui is very cramped, and we lose real estate to labels.

Since our users are advanced devs, I see no reason to not go w/ hover scroll, but I posted this in hopes of if there's any other devices I haven't considered. I'm trying to keep a crowded UI as pared down as possible.
Comment: It seems like an invalid argument to say that the ui is very cramped and that you lose real estate to labels when there is so much whitespace to the right of the rows that you are not making use of.
Comment: a scroll bar could be like 10px wide...could your UI not accommodate that? If it's so busy that 10px of scroll bar is going to overcrowd it i.e. the straw that broke the camels back...then maybe you should reduce the amount of content on the page more generally?
Comment: @MichaelLai Whitespace is not the same as _wasted_ space. In a cramped UI, a little whitespace can be very valuable. I can certainly imagine that a screen would look a little messier with a scroll bar there. The designer is in good company, since Apple decided years ago to also hide their scrollbars this way.
Comment: @Peter I am certainly not suggesting that whitespace is wasted space, only pointing out that you can say that there is no room left when there are still space that can be used.
Answer: Putting buttons at the bottom and top of the widget is a bad idea. In my opinion that would signal to the user that scrolling is not an option, and reduce the discoverability of the scrolling feature. You have advanced users, and a complicated interface, so I'm guessing that learnability is not as important as efficiency.
Personally, I think your design is a great option. My first advice would be to stand your ground. Don't fix it until you know for sure that it's a problem. Do user tests, record them and show them to your boss. Figure out what's actually going of before you redesign on the insistence of some stakeholder who's overstepping his bounds.
If you do lose the argument, the best option I can think of is an extremely minimal scrollbar. Basically the OSX scrollbar, without the hiding feature. Use a light gray and show nothing but a slim rectangle. It should add almost no clutter to the interface but make your boss happy:
Answer: Show the scrollbar
Usability must come first, and the scrollbar is necessary to show users how to use the legend.
Once you establish the UX priority, you can then work to calm the layout.
Your legend has different colors, fonts sizes, font weights, shades, and difficult non-grid alignment.  All of these create UX clutter, which is why you feel like the scrollbar adds too much chrome.
Instead, de-chrome the interface.
Here are a couple examples of scrolling lists.  The left one is adapted from an example in Google's Material Design.  The right one is a sketch for calming your dialog:


UI automation seems to run in background without launching browser

Question: I'm trying to setup Jenkins to execute our UI automation(Ranorex) tests.  When the job runs, the IE browser does NOT launch, thus the tests don't run.
Is there some setting that I'm missing here?
The UI automation code is built into a .exe, which is called from a .bat file.
Thanks for any help.
Comment: If you're running Jenkins as a service, make sure desktop interaction is enabled for that service.
Comment: I finally figure this out.  Now I'm having other problems with the automation tool.  Thanks for the reply.
Answer: Have you already read the blog Integrating Ranorex Automation in Jenkins CI Process on the Ranorex website?
Comment: yes - I have read the blog and followed all steps.  I thought the solution of running Jenkins via the command line would have fixed it, but still not running the browser.


PHPUnit + Selenium: How to set Firefox about:config options?

Question: When running Selenium tests remotely with PHPUnit and Firefox, onChange events are not fired as they are when a user is operating the browser.
The solution to this seems to be to set the focusmanager.testmode option to true in Firefox's preferences (i.e. about:config), as suggested in a Selenium bug report.
However all the examples are using Selenium directly, while I am using PHPUnit which has its own API hiding the Selenium internals.  I can't figure out how to set this Firefox option using PHPUnit, so I'm hoping someone else can tell me how this can be done!
(No, I can't go into about:config and set it myself manually because the tests create a new clean browser profile each time the tests are run, so any manual config changes are lost.)
Answer: Thanks to the Selenium developers I have a solution!
Short version
Put this in your test so that it gets called in the setUp() function:
// Firefox mini-profile that sets focusmanager.testmode=true in about:config
define('FIREFOX_PROFILE',
'UEsDBAoAAAAAADqAxkSBK46tKgAAACoAAAAIABwAcHJlZnMuanNVVAkAA1BZkVM6WZFTdXgLAAEE
6AMAAARkAAAAdXNlcl9wcmVmKCJmb2N1c21hbmFnZXIudGVzdG1vZGUiLCB0cnVlKTsKUEsBAh4D
CgAAAAAAOoDGRIErjq0qAAAAKgAAAAgAGAAAAAAAAQAAAKSBAAAAAHByZWZzLmpzVVQFAANQWZFT
dXgLAAEE6AMAAARkAAAAUEsFBgAAAAABAAEATgAAAGwAAAAAAA==');

protected function setUp()
{
    $this->setDesiredCapabilities(Array('firefox_profile' => FIREFOX_PROFILE));
}

This sets focusmanager.testmode to true.
Long version
You need to create your own mini Firefox profile with the preferences you want set, and pass it along at the start of your tests.  Here's how to do it:

Create a new folder and put the files you want in the Firefox profile in there.  This can be anything (bookmarks, extensions, a copy of your own profile, etc.) but all we need here is a file called prefs.js which stores our about:config settings.
Create prefs.js in this folder with the following content:
user_pref("focusmanager.testmode", true);

Zip up the folder (prefs.js should be in the root of the archive), and base64 encode it.

If you're using Linux, you can do it all like this:
mkdir firefox-profile
cd firefox-profile
echo 'user_pref("focusmanager.testmode", true);' >> prefs.js
zip -r ../firefox-profile.zip *
base64 < ../firefox-profile.zip

Then take the base64 value and set it as the "firefox_profile" capability as per the short version above.
Comment: Tank you. I spent 2 days searching for this solution. Now I was able to connect Firefox to the proxy server :)


How do I pass Jan's sneak test in Outcast?

Question: It appears that I can't make any progress before I complete some simple tutorial quests, which should presumably teach me how to control my character. The last quest teaches how to use sneak mode. It has an NPC, Jan, place an object on the ground, which I have to pick up without being seen.
The problem is, even after I successfully half-run/half-sneak up that object, pick it up, and wait for the NPC to turn around and see me standing there gloriously, he still then goes all "I have seen you, PC, you have failed the quest" on me. What am I doing wrong?
Comment: Have you tried moving away after picking it up, so that when the NPC turns around you remain unseen? I haven't played this game, but that's what I'd suggest trying.
Answer: Hmm, I just recently played Outcast for the first time. Not sure I'm a real help, though. While my initial thought on that task was "that's never going to work well on this engine", I actually completed it after the third try or so.
I don't think you're doing anything wrong in particular, so maybe it's a small glitch and you should just keep trying a few more times.
IIRC, there was a crate on the left, a stone on the right and a longer stone on the far right. I waited for him to turn around, then ran to the first crate. Waited again, ran to and ducked behind the first stone. Same with the second, then picked it up.
Maybe he spots you while picking up the object (on the last step)? Maybe you're running there and that makes more noise so he can hear you? (I don't remember if sounds are taken into account regarding detection in Outcast.)
While Grace Note's idea sure is worth a try, I don't remember having to hide again after grabbing the object. I might be mistaken, though.
Comment: Well, now that I know that it's actually doable, I'll try again on my next playthrough. After 10 or so failed attempts, the NPC told me that it's all right and "it'll be our little secret that you failed". Arrogant twit. Let's see what the rest of the game brings.
Comment: Heh, funny that they thought of that 'backdoor'. I didn't expect that.
Answer: Had the same problem myself with the test, Jan would not notice the fruit missing and tell me that the test was done. Somehow managed to fix it though, not sure what exactly fixed the bug.
What did i do before the bug was fixed:
1. I fiddled with my AA settings on my radeon control panel(pretty sure this didnt fix it)
2. Changed my keybinds(possible fixing effect?)
3. Changed both exes to run in admin mode from compatibility mode(possible fix?)
After these the test was finished as it should and now it keeps working as intended, all i can think is that either the keybinds screwed it somehow or that the admin mode allowed the game to access some files it couldnt before?


configure gwibber for twitter

Question: I wanted to use gwibber for both facebook as well as for twitter. While I have configured properly for facebook, I am unable to do so for twitter. After giving add account, selecting twitter and authorizing, the following page opens (which is blank) and then nothing.

How to resolve this problem?
Answer: You need to install the gwibber-service-twitter package:
sudo apt-get install gwibber-service-twitter

Comment: Didn't work. Probably, the services were already installed. However, I still executed the above commands and then once again tried to configure gwibber for twitter and once again the same blank screen was staring at me.

configure gwibber for twitter


XMLSerializer in C# not including all attributes of a Class

Question: Hello I have this two classes that I want to serialize using the XMLSerializer in C#:
Paquete.cs
using UnityEngine;

using System.Collections;
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.IO;

[XmlRoot("Paquete")]
public class Paquete {

    //El identificador del paquete. Aqui ira la accion que se esta enviando en el juego
    public enum Identificador
    {
        moverIzquierda,
        moverDerecha,
        moverArriba,
        moverAbajo,
        avanzar,
        disparar,
        Null
    }
    public Identificador identificadorPaquete;
    public int jugador;

    //[XmlArray("B"),XmlArrayItem("Bullet")]
    public List<Bullet> bullets = new List<Bullet> ();

    // Default Constructor
    public Paquete()
    {
        this.identificadorPaquete = Identificador.Null;
        this.jugador = -1;
        this.bullets = new List<Bullet> ();
    }

    // Convierte un paquete a un data stream para enviar y recibir datos
    //Tambien lo debemos modificar para que se acople a las acciones del juego
    public string GetDataStream()
    {
        string result = "";
        XmlSerializer serializer = new XmlSerializer (typeof(Paquete));
        StringWriter writer = new StringWriter ();
        serializer.Serialize (writer, this);
        result = writer.ToString ();
        Debug.Log ("El xml: "+result);
        return result;

    }

}

Bullet.cs
using System.Collections;
using System.Xml;
using System.Xml.Serialization;
using System.IO;

public class Bullet  {

    //[XmlAttribute("id")]
    int id;
    //[XmlAttribute("px")]
    float px;
    //[XmlAttribute("py")]
    float py;
    //[XmlAttribute("pz")]
    float pz;
    //[XmlAttribute("rx")]
    float rx;
    //[XmlAttribute("ry")]
    float ry;
    //[XmlAttribute("rz")]
    float rz;

    public Bullet(){
        this.px = 0;
        this.py = 0;
        this.pz = 0;
        this.rx = 0;
        this.ry = 0;
        this.rz = 0;
    }
    public Bullet(int id,float px,float py, float pz,float rx,float ry,float rz){
        this.id = id;
        this.px = px;
        this.py = py;
        this.pz = pz;
        this.rx = rx;
        this.ry = ry;
        this.rz = rz;
    }

}

This is what I´m using to test my code:
Paquete p = new Paquete ();
p.jugador = 6;
string s;
p.bullets.Add (new Bullet(0,1,1,1,1,1,1));
p.bullets.Add (new Bullet (1,2, 2, 2, 2, 2, 2));

s = p.GetDataStream ();

and the xml I get is this:
<?xml version="1.0" encoding="utf-16"?>
<Paquete xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <identificadorPaquete>Null</identificadorPaquete>
  <jugador>6</jugador>
  <bullets>
    <Bullet />
    <Bullet />
  </bullets>
</Paquete>

As you can see, the Bullet array does not contain any of the attributes I defined in my class.
Can anyone help me out?
Comment: You need to make the fields public (or better yet use public properties).  `XmlSerializer` only serializes public fields and properties.
Comment: Thank you very much, that solved my problem :)
Answer: XmlSerializer doesn't take the private fields into account that's why they don't appaer in the output. If you make those variables public and mark them with XmlAttribute you can see them in the result XML:
If you change it like this
[XmlAttribute("id")]
public int id;

you'd get:
<?xml version="1.0" encoding="utf-16"?>
<Paquete xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <identificadorPaquete>Null</identificadorPaquete>
  <jugador>6</jugador>
  <bullets>
    <Bullet id="0" />
    <Bullet id="1" />
  </bullets>
</Paquete>


How do Ubuntu LibreOffice builds differ from vanilla LibreOffice builds?

Question: I've got a question about LibreOffice that's been bugging me since OpenOffice:
The versions of LO that come on the Ubuntu disc or from the PPA always have nice font rendering, but whenever I download and install the debs from the LO website, the font rendering in those versions looks terrible.
I know the Ubuntu builds include various patches and tweaks that aren't in the vanilla debs, but could anyone help educate me about exactly how the Ubuntu builds of LO differ from the vanilla debs of LO, and if there is an easy way to apply those changes to the vanilla debs so I don't have to wait so long for the PPA to update with the new version?
Comment: is this a general "what are the diffs" question, or are you asking specifically about fonts? None of the answers are satisfactory if the former, and the fonts tags should be removed. However, if it's the latter, the question should be rephrased to make explicit that it's asking a specific question about fonts.
Answer: You can see how the distro builds are done by using the:
apt-get source libreoffice

command. That said, up to LibreOffice3.4/Oneiric both Debian and Ubuntu used the go-oo build system, which is scary for the uninitiated (and perhaps even more so for the initiated).
Since LibreOffice-3.5, we (Debian/Ubuntu) are using the native build system of LibreOffice and have most of our patches upstreamed, while keeping only a smaller set of truely vendor-specific patches in our packaging. This should also make the packaging much more transparent for everyone.
Ongoing work of Debian and Ubuntus packaging can be followed at:
http://anonscm.debian.org/gitweb/?p=pkg-openoffice/libreoffice.git;a=summary
Active development for Precise is in the branch ubuntu-precise-3.5.
Comment: see http://sweetshark.livejournal.com/10977.html for an update: tl;dr: there is little vendor patching left in 3.5
Answer: I cannot explain the differences between the two nor am I aware that there were any however this may be do to using a FONT manager that keeps my system fonts and editor fonts the way I want them.
Font Manager is not intended to be a professional-grade font management solution, but rather a simple application suitable for the needs of most desktop users.
Although designed with the GNOME desktop environment in mind, it should work well with most major desktop environments such as Xfce, KDE, and even Enlightenment.
wget http://font-manager.googlecode.com/files/font-manager_0.4.4-1_all.deb

Now you need to install .deb package by double clicking or run the the following command from your terminal
sudo dpkg -i font-manager_0.4.4-1_all.deb

Answer: I found that by deleting the user directory in $HOME/.libreoffice/3/ fixed the font rendering issue in LO 3.5 installed from the LibreOffice website debs.  Not sure exactly why that worked, but it makes me think the problem might be more to do with preferences from the preinstalled/ppa version conflicting with the vanilla deb version or something like that.


What happens if you have no money in missions that requires money?

Question: There are certain missions in RDR 2 that requires you to give away money to complete them, such as "Do Not Seek Absolution II" and others. But what happens in these missions if your bank account is empty and Arthur does not have any money to give?
Comment: I haven't played RDR2, but I have played GTA V. When your character does not have enough money for a mission in GTA a side character will usually provide some cash and make a snarky comment you being broke. It would probably be the same here too.
Answer: You have good friends. Even if you are without money on missions that require it you will find prices are lower than they would normally be, there's a cheaper version of the necessary item, you can choose an alternate course of action, or friends will give you cash.
Minor spoilers below for three Chapter 2 missions, but nothing too far into the game's storyline.
For instance, one of the earliest missions in the game A Quiet Time culminates in you running from the police while thoroughly inebriated. If you are caught you won't have to pay the $10 bounty because your buddy pays it off for you.
Two missions later you're invited to shop for horses in Exit Pursued by a Bruised ego. You are obligated to sell off a horse and purchase a new one with the money. There are three options available: A Morgan horse for $15, an American Standardbred for $150, or a Dutch Warmblood for $450. If you are (unsurprisingly) unable to afford the $450 horse, and the moderately expensive $150 horse. You may notice that the sale price of the draft horse you sold ($5) will not be enough to allow you to purchase the cheap $15 Morgan.
If you are so insolvent you cannot supply the other $10 to afford the $15 horse you will have to reload the save and instead choose to stable the draft horse rather than sell it.
Lastly, in one of the mission The Sheep and The Goats you will need to purchase a Rolling Block Rifle - an expensive weapon typically selling for $189! Thankfully your buddy John Marston will call in a favor and have the gunsmith sell it for free, thereby saving your wallet and ensuring you can purchase the firearm.
There are a variety of ways to continue a mission even if you don't have the requisite cash. In most cases it will not require reloading a mission's checkpoint, but it is not impossible to force that hand either. No matter what, the game will make accommodations for Arthur Morgan.


Why HWND_NOTTOPMOST cannot bring the window foreground in xp?

Question: I am using
SetWindowPos(m_hParsent, HWND_NOTOPMOST, 0, 0, 0, 0,
             SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE)

to bring the window foreground, but it does not work in XP System, it work well in my win7.
Comment: Um, you passed the `SWP_NOACTIVATE` flag. This means "Don't bring the window to foreground."
Comment: but it can bring the window foreground on my win7 machine
Comment: um,I just try to remove the NOACTIVE flag, but it still can't bring the window foreground
Comment: Does your process have foreground permission? If all you want to do is set foreground, then why not just call `SetForegroundWindow`?
Comment: I know the SetForegroundWindow, but it will rob the focus, that doesn't meet my requirement.
Comment: Now I'm confused. You say that you want "to bring the window foreground" and now you say that you don't want the window to be foreground?
Answer: HWND_NOTOPMOST doesn't move a window to the foreground per-se, it simply removes the topmost status from a window that has it, and a side effect of this is that the window will be left above other non-topmost windows. But the docs also say "This flag has no effect if the window is already a non-topmost window."
Use HWND_TOP to specifically move a window to the top of the z-order, or call SetForegroundWindow.
Comment: And I tried the HWND_TOPMOST and HWND_TOP just now, they does not work either.
Comment: But it bring the window foreground on win7 system,and how can I check the window if it is non-topmost.