text:
Q: Extract two fields by line with multiple separators I have a file like this
field01 field02 field03 field04 definition: field05; measure: field06; weight: field07;
field11 field12 field13 field14 definition: field15; measure: field16;
field21 field22 field33 definition: field25; weight: field27;
field31 field32 field03 field34 definition: field35; measure: field36; wight: field47;

the desired output is the second field and the field after 'definition:
field02 field05
field12 field15
field22 field25
field32 field35

The separator involves ' ','definition:' and ';'
the most I have done is
awk -F'definition:' '{print $2}' file |awk 'split($1, a, ");") {print substr(a[1],-5)}'

It gives me:
field05;
field15;
field25;
field35;

But it's not what I want. field05,field15 and field35 can be of different length

A: Try out this awk:
awk '
{
    split($0,temp,"definition: ") #Get everything after "definition: " in temp[2]
    split(temp[2],final,";")      #Get everything between "definition :" and ";" in final[1]
    print $2,final[1]
}'

One liner, as requested:
awk '{split($0,t,"definition: ");split(t[2],f,";");print $2,f[1]}'

A: Kind of hacky proposal:
awk -F'[:;]' '{ print $2,$1 }' file | awk -F' ' '{ print $2, $1 }'

Output
field01 field05
field11 field15
field21 field25
field31 field35

A: Late to the show but another awk solution just for fun
awk -F'[ ;]' '{f=3; while ($f!~"defin") f++; print $2, $(f+1)}' file1

A: Actually, the field separator is a regular expression, so this works as an example:
awk -F ' definition: |; measure: |; weight: |; wight: |[ :;]+' '{NF=NF};1' file

field01 field02 field03 field04 field05 field06 field07
field11 field12 field13 field14 field15 field16
field21 field22 field33 field25 field27
field31 field32 field03 field34 field35 field36 field47

I am pretty sure that wight on the last line is an error, but I included it to show the flexibility of the idea.
But given that all you need are fields 2 and 5. And that the number of field is not stable, we need to do two splits to get field 5, and one more for field 2. The first split breaks the line at definition:, the trailing part is split on the other delimiters to get the first field (which is always what you call field5 (the first after definition). The last split on [ ;:] is done to get the second field:
awk '{split($0,a," definition: "); split(a[2],b,"[ :;]");
      split($0,a,"[ ;:]");
      print a[2],b[1]}
    ' file

field02 field05
field12 field15
field22 field25
field32 field35

A: Tried with Below command and it worked fine
awk '{for (i=1;i<=NF;i++){if($i ~ /definition:/){gsub(";","",$(i+1));print $2,$(i+1)}}}' filename

output
field02 field05
field12 field15
field22 field25
field32 field35

A: I am posting this as a separate answer just because it is an alternative way of looking at the problem and I like it.... Not saying it's good practice. I just liked the alternation.... I think it's pretty.
sed "s/definition: /\n/" file1 | awk -F'[ ;]' '{printf $(NR%2+1)((NR%2==0)?"\n":" ")}'


text:
Q: Java Exception Handling via Catch Block When I am executing following code
1.    public class test {
2.      public static void main(String[] args) {
3.          try {
4.              int i = 10 / 0;
5.          } catch (Exception e) {
6.              int j = 10 / 0;
7.          } finally {
8.              int k = 10 / 0;
9.          }
10.     }
11.    }

I am getting an error:
Exception in thread "main" java.lang.ArithmeticException: / by zero
    at test.main(test.java:8)

I am not getting the reason why JVM is throwing exception from main() and not the catch block.

A: If you follow the step-by-step description of a try-catch-finally in the JLS, you see that (in summary) if catch throws an exception then finally is executed and (emphasis mine):

If the catch block completes abruptly for reason R, then the finally block is executed.
If the finally block completes abruptly for reason S, then the try statement completes abruptly for reason S (and reason R is discarded).

So the exception thrown by the catch block (which is executed before the finally block) is discarded and the reported exception is the one thrown in the finally block.

A: Because in every block - try/catch/finally you have a division by zero. Add another try-catch block inside catch and report an error in catch.
For example:
public class test {
    public static void main(String[] args) {
        try {
            int i = 10 / 0;
        } catch (Exception e) {
            try {
                int j = 10 / 0;
            } catch (Exception e) {
                // report an error here - do not do any business logic
            }
        } finally {
            int k = 10 / 0;
        }
    }
}

A: One interesting thing to note is that, if you comment your code in the finally statement, the ArithmeticException thrown will concern the code in your catch statement.
I believe what's happening here is that the Exception that should be thrown in your catch statement is ignored, because an Exception is thrown in your finally statement.

A: The exception
in  } catch (Exception e) {
              int j = 10 / 0;
             }

will be thrown to finally block, if you remove finally block, you will got an
Exception in thread "main" java.lang.ArithmeticException: / by zero
    at test.main(test.java:6)

All exception in catch block will be thrown to finally block
also finally block will be executed any way

A: try
{
     System.out.println("Try block 1");
     int i = 10 / 0; //First Exception
     System.out.println("Try block 2");
 } catch (Exception e) { //Catched the first Exception
      System.out.println("Catch block 1");
      int j = 10 / 0; //Again Exception -->  Who will catch this one
      System.out.println("Catch block 2");
 } finally {
       System.out.println("finally block 1");
       int k = 10 / 0; //Again Exception -->  Who will catch this one
       System.out.println("finally block 2");
 }

If an exception occurs within the try block, that exception is handled by an exception handler associated with it. To associate an exception handler with a try block, you must put a catch block after it.
You associate exception handlers with a try block by providing one or more catch blocks directly after the try block.
Each catch block is an exception handler and handles the type of exception indicated by its argument
The finally block always executes when the try block exits.

A: In Java Exception Handling, no matter the exception is caught or not, but if you have used finally block, it would always get executed.
Hence, what you are doing in your code is-

*

*Throwing exception object from main()

*Catching exception in catch block

*Throwing exception caught in catch block to the finally block (it would get executed anyway!)

In this code, either you use only catch or only finally, to get proper result.
and, since you want exception to be caught in catch, omit finally, just use catch.
Good luck!

redpajama_set_name: RedPajamaStackExchange


text:
Q: Django CheckboxSelectMultiple override 'choices' from ModelForm I would like to be able to extract different information in my django form:
That's my form:
<form action="" method="post">{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Submit" />
</form>

class InstanceForm(ModelForm):
    class Meta:
        model = models.BaseAsset
        widgets = {
            'labels': LabelIconCheckboxSelectMultiple()
        }

The model:
class AssetClass(models.Model):
    default_labels = models.ManyToManyField(Label, null=True, blank=True)
    pass

the M2M reference field
class Label(models.Model):
    explanation = models.CharField(null=True, max_length=63)
    svgpreview  = models.CharField(null=True, max_length=31)
    def __unicode__(self):
        return unicode(self.explanation)
    pass

Now, the HTML code generated by the {{ form.as_p }} is as follows:

<input type="checkbox" name="labels" value="1" id="id_labels_0" /> Consult owner before using

<input type="checkbox" name="labels" value="2" id="id_labels_1" /> This item is broken

Which means it's clearly using the __unicode__ rendering of the model 'Label'. How can I change that behavior in the Select widget, so that it would use a different function to populate it's choices? I'm trying to get it, in the reasonably portable way, to print '' next to the checkbox?

A: You will override forms.widgets.CheckboxSelectMultiple class:
This is CheckboxSelectMultiple class and its render function:
class CheckboxSelectMultiple(SelectMultiple):
    def render(self, name, value, attrs=None, choices=()):
        if value is None: value = []
        has_id = attrs and 'id' in attrs
        final_attrs = self.build_attrs(attrs, name=name)
        output = [u'
']
        # Normalize to strings
        str_values = set([force_unicode(v) for v in value])
        for i, (option_value, option_label) in enumerate(chain(self.choices, choices)):
            # If an ID attribute was given, add a numeric index as a suffix,
            # so that the checkboxes don't all have the same ID attribute.
            if has_id:
                final_attrs = dict(final_attrs, id='%s_%s' % (attrs['id'], i))
                label_for = u' for="%s"' % final_attrs['id']
            else:
                label_for = ''

            cb = CheckboxInput(final_attrs, check_test=lambda value: value in str_values)
            option_value = force_unicode(option_value)
            rendered_cb = cb.render(name, option_value)
            option_label = conditional_escape(force_unicode(option_label))
            output.append(u'
%s %s
' % (label_for, rendered_cb, option_label))
        output.append(u'
')
        return mark_safe(u'\n'.join(output))

So what you will do :
class MyCheckboxSelectMultiple(CheckboxSelectMultiple):
    def render(self, name, value, attrs=None, choices=()):
        #put your code to have custom checkbox control with icon
        #...
        output.append(u'
%s %s
' % (label_for, rendered_cb, option_label)) # especially you will be working on this line
        #...

Then where you are using widgets=CheckboxSelectMultiple() it will become widgets=MyCheckboxSelectMultiple()

A: Reading django.forms.models.ModelChoiceField gives a hint:
# this method will be used to create object labels by the QuerySetIterator.
# Override it to customize the label.
def label_from_instance(self, obj):
    """
    This method is used to convert objects into strings; it's used to
    generate the labels for the choices presented by this object. Subclasses
    can override this method to customize the display of the choices.
    """
    return smart_unicode(obj)

ok, but how do I override it per-instance of ModelForm - this gets overridden in few places throughout django.forms
Considering the following code:
class InstanceForm(ModelForm):
    class Meta:
        model = models.BaseAsset
        widgets = {
            'labels': forms.CheckboxSelectMultiple()
        }

    def __init__(self, *args, **kwargs):
        def new_label_from_instance(self, obj):
            return obj.svgpreview

        super(InstanceForm, self).__init__(*args, **kwargs)
        funcType = type(self.fields['labels'].label_from_instance)
        self.fields['labels'].label_from_instance = funcType(new_label_from_instance, self.fields['labels'], forms.models.ModelMultipleChoiceField)

This is somewhat creepy - basically, it's a more bizzare implementation of this:
Override a method at instance level
Please read the comments in the referenced thread to understand why this might be a bad idea in general..

A: You don't have to do the "creepy" instance-level override to take proper advantage of the documented django.forms.models.ModelChoiceField.label_from_instance() method.
Building on the AssetClass and Label objects in the original post:
class AssetSvgMultiField(forms.ModelMultipleChoiceField):
    """
    Custom ModelMultipleChoiceField that labels instances with their svgpreview.
    """
    def label_from_instance(self, obj):
        return obj.svgpreview

class InstanceForm(forms.ModelForm):
    default_labels = AssetSvgMultiField(queryset=Label.objects.all())

    class Meta:
        model = models.AssetClass
        widgets = {
            'default_labels': forms.CheckboxSelectMultiple()
        }

A: This is explained in the Django documentation here:
https://docs.djangoproject.com/en/1.9/ref/forms/fields/#django.forms.ModelChoiceField.to_field_name
You can see the ModelChoiceField class calling the method on the field here:
https://github.com/django/django/blob/1155843a41af589a856efe8e671a796866430049/django/forms/models.py#L1174
If you're not overriding choices explicitly, then your code might look like this:
class RectificationAssetMultiField(forms.ModelMultipleChoiceField):
    def label_from_instance(self, obj):
        return '[{0.pk}] {0.label} ({0.location})'.format(obj)

class RectificationForm(forms.ModelForm):
    items = RectificationAssetMultiField(
        required=False,
        queryset=InspectionItem.objects.all(),
        widget=forms.CheckboxSelectMultiple,
        label="Non-compliant Assets"
    )

    class Meta:
        model = Rectification
        fields = ('ref', 'items', 'status')

Be careful that this will only work if you're not setting choices directly (see _get_choices in the above URL).
If instead you wanted to override choices (for a more efficient result than a queryset, or something better expressed as a ValuesList) then you would have something like this:
class RectificationAssetMultiField(forms.ModelMultipleChoiceField):
    def label_from_instance(self, obj):
        return '[{0.pk}] {0.label} ({0.location})'.format(obj)

class RectificationForm(forms.ModelForm):
    items = RectificationAssetMultiField(
        required=False,
        queryset=InspectionItem.objects.none(),
        widget=forms.CheckboxSelectMultiple,
        label="Non-compliant Assets"
    )

    def __init__(self, *args, **kwargs):
        super(RectificationForm, self).__init__(*args, **kwargs)
        self.fields['items'].choices = (InspectionItem.objects
            .active()
            .noncompliant()
            .filter(property_id=self.instance.property_id)
            .values_list('pk', 'label') # pass a key value pair
        )

    class Meta:
        model = Rectification
        fields = ('ref', 'items', 'status')

A: Don't use {{ form.as_p }} if you don't like that rendering.
Loop over the form instead:
<form action="/contact/" method="post">
    {% for field in form %}

            {{ field.errors }}
            {{ field.label_tag }}: {{ field }}

    {% endfor %}

<input type="submit" value="Send message" />

</form>

You are then free to use whatever HTML you want.
From: https://docs.djangoproject.com/en/dev/topics/forms/#looping-over-the-form-s-fields


text:
Q: What are fundamental mixers? Fundamental mixers (in the context of RF Electronics). What are they? What do they do?
http://www.hittite.com/products/view.html/view/HMC557LC4

A: Fundamental means that the local oscillator is simply the difference between the IF and the input frequency. The other type is termed a sub-harmonic mixer, which is driven at a lower frequency which is multiplied in the mixer. The latter is used at much higher input frequencies, making it easier to generate the local oscillator signal.

A: The particular device you linked to is an RF mixer. It can work as an upconverter or downconverter, depending on the filtering used after the device.
An RF mixer takes an intermediate frequency signal and a local oscillator signal, and mixes them together. The output from an RF mixer is 4 different frequecies: A, B, A+B, and A-B (or B-A).
By filtering for what frequency you want (either A+B or A-B) you determine if the device is upconverting or downconverting.
I'll admit that I don't fully understand the significance of "fundamental", but if it's like with crystal oscillators, it means that the device doesn't operate at some harmonic of the local oscillator frequency ("overtone" in crystals.) It simply mixes the two signals exactly as presented to it.


text:
Q: What's the regex expression to split string by these special characters (such as squared brackets [] and dashes / \)? I want to split some string such as "[MX0149/M4200], and total\test//now" this should output: MX0149 M4200 and total test now.
So far my regex expression is as follow: [\s@&.,;><_=()!?/$#+-]+ but I want it to include splitting string by squared brackets [] and dashes / .

A: You can use \W+ (which is same as [^a-zA-Z0-9_]) to split your string and get your desired output.
Check this Java code,
String s = "[MX0149/M4200], and total\\test//now";
Arrays.stream(s.split("\\W+"))
.filter(x -> x.length() > 0) // this is to remove empty string as first string will be empty
.forEach(System.out::println); // print all the splitted strings

Prints,
MX0149
M4200
and
total
test
now

Let me know if this works for you.


text:
Q: Why value is getting null on taking promise.all()? under quicksort function when I am using Promise.all() values list is taking null values sometimes,
while on taking promise independently on both quicksort
(in quicksort function) everything is working fine,
can't figure out the mistake.
and due to which the wrong visualization is happening, basically, this is a code for quicksort visualization. Which is working fine for separate awaits but not with await promise.all().
thanks in advance...
var w=20;
var values=[];
var state=[];

async function swep(pindex,end){
    await sleep(500);
    let k=values[pindex];
    values[pindex]=values[end];
    values[end]=k;
}

async function quicksort(start,end) {
    if(start>=end){
        return;
    }
    let pivot= await partition(start,end);
    await Promise.all([quicksort(start,pivot-1)
    ,quicksort(pivot+1,end)]);
    // await quicksort(start,pivot-1);
    // await quicksort(pivot+1,end);
    return;
}
async function partition(start,end){
    pindex=start;
    state[end]=-1;
    pvalue=values[end];
    for(let i=start;i<end;i++){
        state[i]=1;
        if(values[i]<pvalue){
            await swep(pindex,i);
            pindex++;
        }

    }
    for(let i =start;i<=end;i++){
        state[i]=0;
    }
    await swep(pindex,end);
    return pindex;
}

function setup(){
    createCanvas(windowWidth, windowHeight);
    values=new Array(floor(width/w));
    n=values.length;
    state=new Array(n);
    for(var i=0;i<values.length;i++){
        values[i]=random(20,height);
        state[i]=0;
    }
    quicksort(0,n-1);
}
function draw(){
    background(255, 153, 194);
    for(let j =0;j<values.length;j++){
    noStroke();
    if(state[j]==0){
        fill(255, 255, 0);
    }
    else if(state[j]==-1){
        fill(255,0,0);
    }
    else{
        fill(0,255,0);
    }
    if(values[j]==null){
        console.log(j);
    }
    rect(w*j,height-values[j],w,values[j]);
    }
}
function sleep(ms) {
    return new Promise((resolve) => {setTimeout(resolve, ms);});
}

A: This happens because you didn't define some variables as local variables, notably pindex and pvalue. As you have await in a loop that uses and mutates pindex, you risk that another asynchronous task that is also running this code, will get an undesired change in that variable.


text:
Q: increase number when I press arrow key on keyboard with javascript I have a textbox has a numeric value.
now what I want is to keep increasing that numeric value while im pressing and holding any of arrow keys.
I know how to do this if I was pressing only one time. it will be increased by 1 only. but what If I want to keep increasing the value while i'm holding the arrow keys. how to do that?
thanks

A: There's a small jQuery plugin for doing this:
https://github.com/nakupanda/number-updown
Usages:
$('#simplest').updown();

$('#step').updown({
    step: 10,
    shiftStep: 100
});
$('#minMax').updown({
    min: -10,
    max: 10
});
$('#minMaxCircle').updown({
    min: -10,
    max: 10,
    circle: true
});
View live demo here:
http://jsfiddle.net/XCtaH/embedded/result/
Keyboard and mousewheel events supporte

A: This is not fully tried and tested by me, but here is a thought - You might want to track KeyDown events because that's the event which is queued by the OS when the key is first pressed. You might also want to implement some sort of delay when incrementing this way so as not to overwhelm the client-side script and have numbers change at a speed to high for user to track.

A: If you don't care about supporting Opera, this is easy:
textbox.onkeydown = function(e)
{
    if (e.keyCode == 38)
    {
        incrementTextBox();
    }
}

However, Opera doesn't fire keydown for key repeats... you'll have to mimic that by calling incrementTextBox() at an interval, and stopping when the key is lifted.  I tested this in WebKit (Chrome 6.0), FF3, Opera 10.6, IE7, IE8, IE9, even IE Quirks:
var textbox = null;
window.onload = function()
{
    var timeoutId = null;
    var intervalId = null;
    var incrementRepeatStarted = false;
    function startIncrementKeyRepeat()
    {
        timeoutId = window.setTimeout(function()
        {
            intervalId = window.setInterval(incrementTextBox, 50);
        }, 300);
    }
    function abortIncrementKeyRepeat()
    {
        window.clearTimeout(timeoutId);
        window.clearInterval(intervalId);
        timeoutId = null;
        intervalId = null;
    }
    function endIncrementKeyRepeat()
    {
        abortIncrementKeyRepeat();
        incrementRepeatStarted = false;
    }
    textbox = document.getElementById("incrementer");
    textbox.onkeydown = function(e)
    {
        e = e || window.event;
        if (e.keyCode == 38)
        {
            if (!incrementRepeatStarted)
            {
                startIncrementKeyRepeat();
                incrementRepeatStarted = true;
            }
            else if (timeoutId || intervalId)
            {
                abortIncrementKeyRepeat();
            }
            incrementTextBox();
        }
        else if (incrementRepeatStarted)
        {
            endIncrementKeyRepeat();
        }
    }
    textbox.onkeyup = endIncrementKeyRepeat;
}
function incrementTextBox()
{
    var val = parseInt(textbox.value) || 0;
    val++;
    textbox.value = val;
}

A: ok after some tests I made here is how its done:
var setTimeoutId;
var keyIs = "up";

 function myIncrementFunction()
    {
            var num = parseFloat(myText.value)+1;
            myText.value = num;

    }

myText.onkeydown = function(e)
    {
    keyIs = "down";

    if(keyIs == "down")
        {
            var e = e || event ;
            if (e.keyCode == 38)
                {
                    for(var s=0; s<1; s++)
                        setTimeoutId = setTimeout('myIncrementFunction()',100);
                }
        }
    }

myText.onkeyup = function(e)
{
    keyIs = "up";
}

A: I wanted to do this, i just used input field with type="number"


text:
Q: Docker does not have a release file? When I run sudo apt update I get this error
E: The repository 'https://download.docker.com/linux/ubuntu \ Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

I am a complete Linux noob, so it would be appreciated for the answers be simplified.
There are a few things I have tried to fix the problem with, using ppa purge doesn't work because when I run it,
E: The repository 'https://download.docker.com/linux/ubuntu \ Release' does not have a Release file.
Warning:  apt-get update failed for some reason

for the most part, I get the same error. Even when I get this to work with a different type of command, as said before I am a Linux noob, and I cannot find the name of the ppa. So I run my command like this
sudo add-apt-repository --remove ppa:docker

As said before I need help understanding my answers, and I still need more help learning what the post means.
SYSTEM:
OS: PoP!OS, Based on Ubuntu 20.04 LTS. Here is a steam benchmark for more advanced info about my PC

A: Here is the error message:
E: The repository 'https://download.docker.com/linux/ubuntu \ Release' does not have a Release file.

*

*Run echo $(lsb_release -cs) to print your distribution's codename.

*Open /etc/apt/sources.list (or somewhere in /etc/apt/sources.list.d/) for editing in nano text editor with sudo nano /etc/apt/sources.list or sudo nano /path/to/somewhere-in-/etc/apt/sources.list.d/*.list) and change this line:
deb [arch=amd64] https://download.docker.com/linux/ubuntu \ stable

by replacing the backslash character \  with your distribution's codename.

*Run sudo apt update to refresh your package database.
Nano text editor keyboard shortcuts
Use the keyboard combination Ctrl + O and after that press Enter to save the file to its current location.
Use the keyboard combination Ctrl + X to exit nano.


text:
Q: Cakephp 3+ Save array in one filed of mysql I'm doing a contacts function to my app and i wanna put a Tags function on it. but I wont create a table only for this, I want to use a field of a row contacts like
id | Contact | Name | Tags
1  | test@...|Test  |["a","b"]

and in my contacts.ctp
<?php foreach($contacts as $contact){
echo "Name : $contact->name Contact : $contact->contact <br> tags:";
foreach($contact->tags as $tag){
echo $tag;
}}?>

A: I don't think saving array makes sense..
you can save a comma separated text by using Implode func. like
<?php

    $arr = array("test1","test2","test3");
    $str = implode(',',$arr);
    echo $str;
?>

*Assumed you have single dimensional array.


text:
Q: SASS is converting "at top right" to "right top" in my radial-gradient I am currently using the following property in CSS:
background: radial-gradient(at top right, rgba(0,0,0,0.1), rgba(0,0,0,0));

If I try this property in my browser, it works fine, though when I put it in my sass file, it is somehow converted to css incorrectly.
background: radial-gradient(right top, rgba(0,0,0,0.1), rgba(0,0,0,0));

at top right is converted to right top.
Anything I could do to prevent this ?
Thanks


text:
Q: How to fix this simple MySQL display order issue I'm very new to MySQL so I need some help please,
I have a table called "posts", this table has the following columns:
id - this is auto increment and primary key
title
content
I have a PHP page where I want to display all the posts from the database table. I want the title to show first and then the post content followed by the title of the next post and it's post content and so on... However if I do this:
$select = mysql_query("SELECT * FROM posts ORDER BY id DESC");

while ($result = mysql_fetch_array($select))
{
   echo $result['title'] . "
";
   echo $result['content'];
}

Of course I get a list of all my post titles followed by all my post contents. In other words it's like this:

DogsCats

Are also known as canines.Are also known as felines.

Instead of:

Dogs

Are also known as canines

Cats

Are also known as felines

What would I need to do to fix this?
Many thanks.

A: What about
while ($result = mysql_fetch_array($select))
{
   echo $result['title'] . "
";
   echo $result['content'] . "

";
}

You're missing a line break after your content, so first occurrence would be fine, but it'll merge first content with second title.

A: Try the following for your loop:
while ($result = mysql_fetch_array($select))
{
   echo $result['title'] . "
" . $result['content'] . "
";
}

Alternatively:
while ($result = mysql_fetch_array($select))
{
   printf("%s
 %s
", $result['title'], $result['content']);
}

A: You should tell PHP what kind of array you want (MYSQL_ASSOC, MYSQL_NUM, MYSQL_BOTH).
Since you are using column names as array subscripts, you should use MYSQL_ASSOC or MYSQL_BOTH:
while ($result = mysql_fetch_array($select, MYSQL_ASSOC))
    ...


text:
Q: Which has the higher absolute uncertainty and why? An electric vernier caliper or a micrometer? I was answering some questions in a textbook and it asked: Which one has the highest absolute uncertainty? A ruler, a voltmeter or vernier caliper?
I went with the ruler because the absolute uncertainty of a measurement (not a reading) is the same as its resolution and so the resolution of a ruler in 1mm. The vernier caliper I know has a resolution much less so why is the absolute uncertainty higher?
*I think maybe the question could have asked for the highest percentage uncertainty in which case I still wouldn't understand why it would be the vernier caliper and not the ruler.
The question I also wanted to ask was whether a micrometer has a larger uncertainty than a vernier caliper (I assumed after answering that question that larger measurements tend to have smaller uncertainties).
Thanks for any comments!


text:
Q: Hiding the scrollbar when it is not moving in CSS Is it possible to get the state of movement in CSS, without JQuery, and use it for hiding the scrollbar?

A: This should be achievable trough jQuery
Scrollevent with jQuery:
https://api.jquery.com/scroll/
Scrollevent Stop:
jQuery scroll() detect when user stops scrolling
Hide Scrollbar:
Hiding the scrollbar on an HTML page
In the end, the could may look like this (not tested):
<script>
$( window ).scroll(function() {
  //Show scrollbar
  $( "body" ).css( "overflow", "scroll" );

  // Check if we are still scrolling, else hide scrollbar
  clearTimeout($.data(this, 'scrollTimer'));
  $.data(this, 'scrollTimer', setTimeout(function() {
    // Scrollevent not happened, hiding Scrollbar
    $( "body" ).css( "overflow", "hidden" );
  }, 250));

});
</script>


text:
Q: Is this possible to automate the JMeter scripts running schedule? Is this possible to schedule the JMeter scripts.for example I want to run the same script every hour and want to automate this process.Is this possible?

A: Yes, there are many options:

*

*Linux : Use cron

*Windows Task Scheduler

*Jenkins


text:
Q: Need to implement the Rollback in release pipeline in Azure Devops I made one release pipeline with one stage for deployment and second stage of Selenium test case as per the image.

Please tell me how can i revert the deployment when Selenium test case got failed. Means when my second stage fails my first task also should be reverted. Please help.

A: You can run the previous successful deployment if something fails. Will that solve your case?
Below you can see an example of a post deployment condition and a rerun of the last successful release.

A:
Please tell me how can i revert the deployment when Selenium test case got failed.

The most effective way is that you could manually choose the previous record of successful release, then you could use the "Redeploy" option to deploy the stage (dev stage) again.

Additional info:
I set the "Auto-redeploy trigger" (Deployment to this stage fails) in Stage 2. When the stage 2 is failed, it only re-deploys the previous successful Stage 2. The Stage 1 will not roll back.

Hope this helps.


text:
Q: Method to create tableView with dynamic cell and programmatically design I have returned the problem in all directions and I do not find the right way to do what I want.
The problem is that I need to manage 6 type of cells who have their own design. For example I have a enum like that:
enum state {
    case buy
    case select
    case go
    case waiting
    case work
    case ended
}

I have a data source which is an array of the data I need to build the cell. This array is always update in my code and I want the array define the order and the cell display in the tableView.
Before I use one cell and display the design I need with a switch of the state in the cellForRowAt function. But the problem a have is the reuse system who keep in cache my old cell that I had replaced.
In my case I need to display sometimes 2 cell with the state [select, buy] and after insert the cell [go] at row 1 -> [select, go, buy] ... and after add 2 row like that [select, go, go, ended, buy].
But when I do that, the design of the old cell keep here. What is the best way to do that ?
Edit
This is what I have tried:
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return user.lobbySurvey.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier:"Celll", for: indexPath) as! CardCell
    for survey in user.lobbySurvey{
        let index = user.lobbySurvey.index(where: {
            //get the current index is nedeed else the cells reuse lazy
            $0 === survey
        })
        if indexPath.row == index{
            var surveyState : UserSurvey.state
            surveyState = survey.stateSurvey
            switch surveyState{
            case .selectPicture:
                cell.drawCard(statutOfCard: .selectPicture)
            case .goSurvey:
                cell.drawCard(statutOfCard: .goSurvey(picture: survey.picture))
            case .surveyEnded:
                print("survey Ended")
            case .surveyWork:
                print("survey in progress to vote")
            case .surveyWaiting:
                cell.drawCard(statutOfCard: .surveyWaiting(selfSurveyId: survey.id, timeLeft: survey.timeLeft, picture: survey.picture))
            case .buyStack:
                cell.drawCard(statutOfCard: .buyStack(bigView : self.view))
            }

        }
    }
    return cell
}

My function drawcard is a switch who redirect like this type of function:
func drawGoSurvey(image: UIImage){
    if(cardIsDraw == false){
        widthOfCard = UIScreen.main.bounds.size.width - (widthMarginConstraint*2)
        cardViewHeightCon.constant = widthOfCard!*ratioOfImage
        goSurvey.draw(countUserSurvey: user.surveyCount, cardView: self.cardView, widthOfCard : widthOfCard!, userPicture: image)
        goSurvey.delegate = self
        self.addCardShadow()
        cardIsDraw = true
    }
}

A: You seem to be trying to set up every single one of your cells when you should instead only be setting up the cell for that particular indexPath. The way a table view works is it will determine how many cells need to display and then call tableView(_:, cellForRowAt:) for however many cells it needs to render.
To fix your issue, you're going to want to do something closer to this:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   let cell = tableView.dequeueReusableCell(withIdentifier:"Cell", for: indexPath) as! CardCell
   let state = user.lobbySurvey[indexPath.row]
   switch state {
   case .selectPicture:
      // Customize for select picture

   case .goSurvey:
      // Customize for goSurvey

   case .surveyEnded:
      // Customize for surveyEnded

   case .surveyWork:
      // Customize

   case .surveyWaiting:
      // Customize

   case .buyStack:
      // Customize
   }
   return cell
}


text:
Q: CUDA - specifying optimum grid dimensions I understand that when specifying a threadblock, it is recommended to create it with number of threads equal to some multiple of 32, since warp size is 32. Is it then advisable also to specify grid dimensions multiples of 32?

A: Grids are processed in units of blocks.  There's no particular dependence on 32 for the number of blocks - all blocks are independent of each other.
It is usually advisable to have at least enough blocks to saturate the GPU if possible.  The rule of thumb here is a bit squishy, but shooting for at least 4-8 blocks for each SM in your GPU is usually a good starting point.    Problem sizes smaller than this may not saturate the GPU.


text:
Q: How to get the total number of AsyncTasks currently running in parallel in the thread pool? I need to check the number of AsyncTasks currently executing in parallel before scheduling a fresh AsyncTask so that the fresh task is scheduled only if the number of concurrent tasks is lesser than the maximum pool size.
What is the best way to get the count of all current tasks in the pool?

A: Returns the approximate number of threads that are actively executing tasks.
 threadPool.getActiveCount()


text:
Q: JQuery / Javascript - ".click()" method not entirely working? I have a table with empty divs at first and with Javascript and JQuery, I created an array of works and whatever words are in the Array, I put those words into the td. Here is my html:

and my Javascript array, if it were this
var tableHeadings = ['headingOne', 'headingTwo', 'headingThree'];

then the Javascript will hide #row3 till #row8 and the three headings will be inputted into #row0, #row1 and #row2 respectively. The td's take the size of the longest td in the row. This part of the code works! I also have two Javascript functions, one for hovering over the td and the other for when you click the td. The one where you hover over the td, the Javascript starts like this
$('#sideTable td').hover(

and the one where you click the td, the Javascript begins like this
$('#sideTable td').click( function() {

The problem is that when you hover over the word, the hover function is perfect, but when I go to click the td, even if the width of the td is really long / there is a lot of information inside the td (say the information in the td is so long that the width of the td becomes 200px), it only allows you to click the first I think 85px of the td. It's so weird. Even if I do
#sideBar td {
    width: 120px;
}

and make the width of every td 120px, it still would only allow me to click the first 85px of the td. The hovering is perfect, the moment I hover over a td, regardless of where I hover (regardless of if it is inside the first 85px of the td or not) and regardless of how long the td is, the hover function works and executes perfectly. However, for some reason, the click function only allows me to click inside the first 85px or so of the heading. Why is this?
Note: Even if I try setting the width of the td using Javascript like so
$('td').css('width','200');

it still only allows me to click in the first 85px of the td. If I hover over the rest 115px of the td, the cursor won't even change to a pointer. It doesn't recorgnize for some reason that there is a td there.
The CSS is this
    #sideBar td {
    font-size: 12px;
}

#sideBar {
    position: absolute;
    top: 90px;
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
}

Also note that I am using I.E8 and not CSS3 and that there is A lot of JS which I wrote and it is quite messy so if I uploaded it, this thread would get downvoted. The JS doesn't really effect the width or anything of the TD though, it is just "if td is hovered then do all of this and if td is click, do this". The problem isn't with the JS code, it's just that the "if td is clicked" only works for the first 85px or so of the td regardless of if the td is longer than that.

A: Try editing your CSS to handle overflow:
overflow-wrap: break-word
overflow-x: visible

Sounds like a CSS thing not a jquery problem. Inspect the elements and see if the mouse even makes it over the whole width of the td.


text:
Q: Can a foreign key index be part of another index or should it be standalone? I have an index organized table in Oracle 18 with the primary key
PRIMARY KEY
(ISSUE_ID, LOCATION_ID_FIN, PRODUCTNUMBER, LOCATION_ID_COMPONENT, LOCAL_PART_NUMBER)
There is an foreign key to the issues table (issue_id)
and two towards the locations table (LOCATION_ID_FIN and LOCATION_ID_COMPONENT).
I would not create a separate index on issue_id, because it is on first place,
but should I create separate foreign key indexes for LOCATION_ID_FIN and LOCATION_ID_COMPONENT
or is it enough that those columns are contained in the primary key?
(this question assumes that a foreign key index is needed to avoid any locking (tm-contention))
Database Version is 18, migrating to 19c the next weeks

A: Yes, you do need the index that starts with the foreign key columns.  A way to prove this (from Tom Kyte's book Expert One-On-One Oracle) is to do this:
alter table issues disable table lock;

Now if you try to update the parent table like this:
update locations set location_id_fin = <new value>;

you will get this error:

ORA-00069: cannot acquire lock -- table locks disabled for CHILD

However once you add the index that begins with the foreign key columns then you will get the expected error:

ORA-02292: integrity constraint (xxx) violated - child record found


text:
Q: How to use mutual authentication without CA in hyperledger fabric I want to use some certificateless mutual authentication methods in hyperledger fabric. but it seems fabric needs a CA. is there any solution for this? am i wrong or fabric really needs CA all the time?

A: CA provides certificates to fabric for MSP user which is used to perform transactions in network and it also issues certificates for other user as well. without MSP you cannot perform any transaction in fabric so CA is pretty much important although if you follow read the docs you can go through build your first network which uses binaries to generate certificates for MSP but that's only for test/dev environment you cannot run it for production env.


text:
Q: Icon on ui tabs (validate) I am trying to add an icon on ui tabs when validate fails.
Which method should i use (option is my guess).
Can anyone help me.
Thanks

A: How about have transparent or hidden icons (e.g. using background-image) to all tabs by default.
Use the validator to change the icon via css/class rather than adding/removing?


text:
Q: jQuery datepicker keeps reopening in IE jQuery's datepicker keeps reopening after clicking on a date in IE 8, even on their demo page:
http://jqueryui.com/demos/datepicker/
Does anyone know how to fix this? I don't know about the demo page, but I am having the exact same problem with jQuery 1.6.2 and jQuery UI 1.8.15.
Also, setting the minDate and maxDate options does not seem to have any effect in IE 8.
The above seems to also be true with IE 7.

A: The following resolved this issue for me (using jQuery 1.7.2 / jQueryUI 1.8.20)
var $input = $('#date');

$input.datepicker({
  /*
   * your other settings here
   */
  onSelect : function() { $input.blur(); },
  onClose  : function() { $input.change(); }
});

$input.on('change paste', function(evt) {
  // process new date input here
});

A: 1.8.14 works fine in IE8.
The re-opening seems to be a bug in 1.8.15, see broken demo.

A: I had the same issue with IE8 and the customized min version of Jquery UI 1.8.16 (all options selected)  When I used the full released version of 1.8.16 the problem went away.

A: We are facing the same problem for jquery ui 1.11.2. The following snippet solved the problem in our case:

var input = $('<input>');

input.datepicker({
  onSelect: function() {
    this.lastShown = new Date().getTime();
  },
  beforeShow: function() {
    var time = new Date().getTime();
    return this.lastShown === undefined || time - this.lastShown > 500;
  }
});


text:
Q: Linking libfftw3-3.lib in Visual Studio 2010 I am trying to get a simple project working with FFTW in Visual Studio 2010.  I am having trouble linking the library.
I've created 64 bit .lib files as directed on their Windows page
I unzipped the 64 bit version of their download and ran the specified tools in that directory.  I've unzipped it in a folder called "fftw" as a sibling of my project.
In Visual Studio I've created a C++ Console App with all the defaults.  The default build type is Debug Win32.  I've added this line to Configuration Properties→Linker:
C:\Users\XXXXX\Documents\Visual Studio 2010\Projects\fftw\libfftw3-3.lib
I've also added libfftw3-3.lib to Configuration Properties→Linker→Input and tried a full path there.
I include StdLib complex and FFTW:
#include <complex>
#include "..\..\fftw\fftw3.h"

My main function just has their example code:
int _tmain(int argc, _TCHAR* argv[])
{
  const int N = 1024;
  fftw_complex in[N], out[N];
  fftw_plan p;
  p = fftw_create_plan(N, FFTW_FORWARD, FFTW_ESTIMATE);
  fftw_one(p, in, out);
  fftw_destroy_plan(p);
  return 0;
}

When I try to build I get this:
1>------ Build started: Project: FFTTest, Configuration: Debug Win32 ------
1>  FFTTest.cpp
1>c:\users\XXXXX\documents\visual studio 2010\projects\ffttest\ffttest\ffttest.cpp(34): error C3861: 'fftw_create_plan': identifier not found
1>c:\users\XXXXX\documents\visual studio 2010\projects\ffttest\ffttest\ffttest.cpp(36): error C3861: 'fftw_one': identifier not found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Can someone show me the error in my ways?

A: Found it: fftw_create_plan() and fftw_one() are functions that have been removed from FFTW3.
You might have got the code from FFTW2 tutorial, see the FFTW3 tutorial instead.

A: Don't use backslash in paths:
#include "../../fftw/fftw3.h"

A backslash in C/C++ is interpreted as an escape character, to produce a backslash you need to double it, but generally always use / to make path separators.

A: I was trying to use FFTW v2 APIs with the FFTW v3 libraries.  A working example is on their v3 tutorial page.
The steps I have above to reference the library are fine.  You also might want to put the FFTW DLL into the directory where your executable is.


text:
Q: Close elapsed time I use collectionView to display time and price. Now it looks like this.

Me need close elapsed time. For example in screenShot time is 14:51, me need to close and fill color elapsed time (grey color) the time before 14:00. It's from 1:00 to 13:00.
For load price and time I use backend and firestore in func getDataFromBackend()
It's my code:
class BookTimeViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {

    var priceTime: [PriceTime] = []
    let curTime = Date()

    lazy var hourTimeFormatter: DateFormatter = {

        let formatter = DateFormatter()
        formatter.dateFormat = "HH"
        return formatter

    }()

    override func viewDidLoad() {
        super.viewDidLoad()

        getDataFromBackend()

    }

    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {

        return priceTime.count

    }

    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {

        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "timeCell", for: indexPath) as! BookTimeCell

        cell.timeLabel.text = "\(priceTime[indexPath.item].time):00"
        cell.priceLabel.text = "\(priceTime[indexPath.item].price) руб."

        return cell

    }

    func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {

    // I think on this i should close the time

    }

    func getDataFromBackend() {

        MBProgressHUD.showAdded(to: self.view, animated: true)

        let newDate = dateFormatter.date(from: selectedDate)
        let dateForURL = dateTimeFormatter.string(from: newDate!)

        let url = URL(string: "https:....")

        var request = URLRequest(url: url!)

        request.httpMethod = "GET"

        let task = URLSession.shared.dataTask(with: request, completionHandler: { (data, response, error) in

            if let err = error {

                print(err)

            } else {

                do {

                    if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: .allowFragments) as? [String: Any] {

                        if let prices = jsonResult["prices"] as? [[String: Int]]{

                            for price in prices {

                                self.priceTime.append(PriceTime(price))
                            }
                        }
                    }

                    DispatchQueue.main.async {

                        self.collectionView.reloadData()

                        MBProgressHUD.hide(for: self.view, animated: true)
                    }

                } catch {

                    print("error")
                }
            }
        })

        task.resume()
    }
}

A: Its suppose your price.time is an Int so that 10 etc. You can't compare time only so append Today's date string in this time.
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
let now = Date()
let todayDateStr = dateFormatter.string(from: now)
let priceTime = todayDateStr + " \(19):00"
print(priceTime)

Output: 04-05-2018 19:00

Now make a date object from this dateString.
dateFormatter.dateFormat = "dd-MM-yyyy HH:mm"
if let priceTimeDateObj = dateFormatter.date(from: priceTime) {
    if priceTimeDateObj < now {
        print("Close this")
    }
}

Or a more simple way you can convert both time into seconds and compare.
dateFormatter.dateFormat = "HH"
let hours = Int(dateFormatter.string(from: now)) ?? 0
dateFormatter.dateFormat = "mm"
let minutes = Int(dateFormatter.string(from: now)) ?? 0

/// This is current time in seconds for today. Example: 18:24 = 66240
let seconds = (hours * 60 * 60) + (minutes * 60)

let priceTimeSeconds = (priceItem.time * 60 * 60)
if  priceTimeSeconds < seconds {
    print("Close this")
}


text:
Q: Receiving pixelated and laggy rtsp stream on vlc when I'm trying to live stream my webcam from raspi4 using ffmpeg as a rtsp stream .
The command i'm using to do so :
ffmpeg -f v4l2 -framerate 30 -video_size 640x480 -i /dev/video0 -c:v mpeg4 -pix_fmt yuv420p -f rtsp -rtsp_transport tcp rtsp://stream
when I receive the rtsp stream using opencv , I get the desired output :
Desired output
When I try to receive the said stream using vlc , it's pixelated , gray and laggy :
Bad output
Edit:
Here's the log :

ffmpeg version 4.1.6-1~deb10u1+rpt2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
  configuration: --prefix=/usr --extra-version='1~deb10u1+rpt2' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
  WARNING: library configuration mismatch
  avutil      configuration: --prefix=/usr --extra-version='1~deb10u1+rpt2' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avcodec     configuration: --prefix=/usr --extra-version='1~deb10u1+rpt2' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avformat    configuration: --prefix=/usr --extra-version='1~deb10u1+rpt2' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avdevice    configuration: --prefix=/usr --extra-version='1~deb10u1+rpt2' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avfilter    configuration: --prefix=/usr --extra-version='1~deb10u1+rpt2' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avresample  configuration: --prefix=/usr --extra-version='1~deb10u1+rpt2' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  swscale     configuration: --prefix=/usr --extra-version='1~deb10u1+rpt2' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  swresample  configuration: --prefix=/usr --extra-version='1~deb10u1+rpt2' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  postproc    configuration: --prefix=/usr --extra-version='1~deb10u1+rpt2' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 44850.006539, bitrate: 147456 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, rtsp, to 'rtsp://stream':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: mpeg4, yuv420p, 640x480, q=2-31, 200 kb/s, 30 fps, 90k tbn, 30 tbc
    Metadata:
      encoder         : Lavc58.35.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame=   29 fps=0.0 q=2.0 size=N/A time=00:00:00.93 bitrate=N/A dup=23 drop=0 speeframe=   44 fps= 44 q=1.6 size=N/A time=00:00:01.43 bitrate=N/A dup=33 drop=0 speeframe=   59 fps= 39 q=2.0 size=N/A time=00:00:01.93 bitrate=N/A dup=43 drop=0 speeframe=   74 fps= 37 q=2.5 size=N/A time=00:00:02.43 bitrate=N/A dup=53 drop=0 speeframe=   77 fps= 36 q=1.6 Lsize=N/A time=00:00:02.53 bitrate=N/A dup=55 drop=0 speed= 1.2x


text:
Q: Email hosting on multiple servers I have a domain with hosting on godaddy while the domain is registered on BigRock. My email Ids are hosted on google apps, which was providing 10 free accounts some time ago. I wish to add few more email account, but that demands a business version of google apps. However, I have another hosting account which provides unlimited email hosting. I wanted to know if I can configure the MX records in such a way that my existing 10 accounts continue on google apps while the new ones are created on the new hosting account. So, any email addressed to this domain would be delivered on google apps if it exists there, otherwise on my new hosting.
thanks
bizdev

A: To the best of my knowledge there is no way to host some users on one mail server and the rest on the other, it's an all or nothing proposition.

A: MX records do not support the level of granularity you require. An alternative may be to use email aliases on your Google Apps accounts to create new addresses and configure these forward elsewhere.
For example, given an existing Google Apps account accepting mail for users @example.com, you may be able to create a second Google Apps account accepting mail for users @mail2.example.com, and use email aliases on your primary account to redirect to user accounts on your secondary account. This is not an ideal solution however and will probably require customer per user configuration on the second account to ensure that sent mail is sent from the correct addresses.


text:
Q: linq join 3 tables with or condition I need to create a statement in LINQ with 3 tables and OR condition.
My function receives an integer, lets call it intZ. I have 3 tables: tableA, tableB and tableC.
tableA has columns int1, int2 and intB. intB is related to tableB.
problem: int1 or int2 of tableA can be intZ and it has to match with one tableC record.
I need an OR condition, but I have no idea where to place it. Does it go in the where clause? Or in the equals clause?
At the moment, I know how to join 3 tables, but the condition is killing me.
What is the difference between the two ways to create statements in linq? Is there a performance impact?
edit: Okay, now I think it's more clear. intZ has to be related with intC from tableC, and this number can be int1 or int2 of tableA.

A: You can't use an "or" condition in joins in LINQ, as it only supports equijoins. But you should be able to do it in a where clause with no problems. For example:
var query = from rowC in tableC
            where rowC.intC == intZ
            from rowA in tableA
            where rowA.int1 == rowC.intC || rowA.int2 == rowC.intC
            join rowB in tableB on rowA.intB equals rowB.intB
            select new { rowA, rowB, rowC };

A: This may be helpful.
var locations = from r1 in
          (from a in context.A
          join b in context.B
          on a.ID equals b.ID
          select new
          {
            a.Prop1,
            a.Prop2,
            b.Prop3,
            b.ID
          })
          join c in context.C
          on r1.ID equals c.ID
          select new
          {
            r1.Prop1,
            r2.Prop2,
            r2.Prop3,
            c.Prop4
          };

A: Just add it to a Where. In Linq2Sql this will be translated to an inner join (with or) on tableB
from a in tableA
from b in tableB.Where(x => x.A == a.A || x.B == a.B)
select new { a, b };

A: For the life of me, I couldn't get the .Where to work in my query (perhaps it's how I'm using LinqPad) but I was able to get the following to work:

from s in Stores
join a in Areas on s.AreaID equals a.ROWID
join r in Regions on a.RegionID equals r.ROWID
join e in Employees on 1 equals 1     // <-- produces a cartesian product
join t in Titles on e.TitleID equals t.ROWID
where e.AreaID == a.ROWID || e.RegionID == r.ROWID // <--filters the data based on OR stmt
where s.StoreNum == 469
select new { r.RegionName, a.AreaName, s.StoreNum, s.StoreName, t.JobCode, e.FirstName, e.LastName }

A: Try this:-
var result= tableA.SelectMany(a => tableB.Where(x => x.A == a.A || x.B == a.B), (a, b) => new {a, b});


text:
Q: OpenGL ES : Using Texture: Blank White instead of Texture Image I'm coding on Android Platform. I'm trying to use texture (load image from Assets folder) for triangle. When my app run, it just blank white in triangle (not texture what I want).
I have read some other source that say image must be a power of two. And I have checked, my image is a power of two. (128 x 128). That a reason why make me headache.
Here is my code: (the main code that you should see in onDrawFrame method, It contains code that I use for Render)
package com.test;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.app.Activity;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.opengl.GLSurfaceView;
import android.opengl.GLSurfaceView.Renderer;
import android.opengl.GLUtils;
import android.os.Bundle;
import android.util.Log;

public class TextureTriangleTest extends Activity{

    GLSurfaceView glView;
    ByteBuffer byteBuffer;
    FloatBuffer vertices;
    AssetManager assets;

    @Override
    public void onCreate(Bundle savedInstanceState){

        super.onCreate(savedInstanceState);
        assets = getAssets();

        int VERTEX_SIZE = (2+2)*4;
        byteBuffer = ByteBuffer.allocateDirect(3*VERTEX_SIZE);
        byteBuffer.order(ByteOrder.nativeOrder());
        vertices = byteBuffer.asFloatBuffer();
        vertices.put(new float[] { 0.0f, 0.0f, 0.0f, 1.0f,
                                   319.0f, 0.0f, 1.0f, 1.0f,
                                   160.0f, 479.0f, 0.5f, 0.0f } );
        vertices.flip();

        glView = new GLSurfaceView(this);
        glView.setRenderer(new Render());
        setContentView(glView);

    }

    class Render implements Renderer{

        @Override
        public void onDrawFrame(GL10 gl) {

            try {

                Bitmap bitmap = BitmapFactory.decodeStream(assets.open("bobrgb888.png"));
                int textureIds[] = new int[1];
                gl.glGenTextures(1, textureIds, 0);
                int textureId = textureIds[0];

                gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId);
                GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
                gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
                gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST);
                gl.glBindTexture(GL10.GL_TEXTURE_2D, 0);

                bitmap.recycle();

            } catch (IOException e) {
                Log.d("", "FAILED LOAD FILE");
                throw new RuntimeException("Couldn't load asset!");
            }

            gl.glViewport(0, 0, glView.getWidth(), glView.getHeight());
            gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
            gl.glMatrixMode(GL10.GL_PROJECTION);
            gl.glLoadIdentity();
            gl.glOrthof(0, 320, 0, 480, 1, -1);

            gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
            gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

            int VERTEX_SIZE = (2+2)*4;
            vertices.position(0);
            gl.glVertexPointer(2, GL10.GL_FLOAT, VERTEX_SIZE, vertices);
            vertices.position(2);
            gl.glTexCoordPointer(2, GL10.GL_FLOAT, VERTEX_SIZE, vertices);

            gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 3);

        }

        @Override
        public void onSurfaceChanged(GL10 gl, int width, int height) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onSurfaceCreated(GL10 gl, EGLConfig config) {
            // TODO Auto-generated method stub

        }

    }

}

My code just a simple example. I have debug and all thing is true. (such as: successfully load image). But, I don't know how to debug OpenGL app. (It means : when debug, I can view parameter of variable, but I don't know how it be, because OpenGL is too complicated than Canvas- that you just use one line of code and has result :) )
thanks for help :)

A: Oh. I have fixed whole my solutions, and below is my full code. I posted here for whom try to read my long post (^^) and need a real solution :) Thanks to SteveL has suggested me :)
In my solution, I have some change:
   first.  Performance: I put code read texture in onSurfaceCreate.
   second. As SteveL say. I'm missing gl.glEnable and I have reseted again gl.glBindTexture.
Thinks again, I see that those error really silly. Just because I'm a newbie of OpenGL :(
package com.test;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.opengl.GLSurfaceView.Renderer;
import android.os.Bundle;

public class ColorTriangleTest extends Activity{

    GLSurfaceView glView;
    ByteBuffer byteBuffer;
    FloatBuffer vertices;

    public void onCreate(Bundle savedInstanceState){

        super.onCreate(savedInstanceState);

        int VERTEX_SIZE = (2+4)*4;
        byteBuffer = ByteBuffer.allocateDirect(3*VERTEX_SIZE);
        byteBuffer.order(ByteOrder.nativeOrder());
        vertices = byteBuffer.asFloatBuffer();
        vertices.put(new float[] { 0.0f, 0.0f, 1, 0, 0, 1,
                                   319.0f, 0.0f, 1, 1, 0, 1,
                                   160.0f, 479.0f, 1, 0, 1, 1 });
        vertices.flip();

        glView = new GLSurfaceView(this);
        glView.setRenderer(new Render());
        setContentView(glView);
    }

    class Render implements Renderer {

        @Override
        public void onDrawFrame(GL10 gl) {

            int VERTEX_SIZE = (2+4)*4;

            gl.glViewport(0, 0, glView.getWidth(), glView.getHeight());
            gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
            gl.glMatrixMode(GL10.GL_PROJECTION);
            gl.glLoadIdentity();
            gl.glOrthof(0, 320, 0, 480, 10, -10);

            gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
            gl.glEnableClientState(GL10.GL_COLOR_ARRAY);

            vertices.position(0);
            gl.glVertexPointer(2, GL10.GL_FLOAT, VERTEX_SIZE, vertices);
            vertices.position(2);
            gl.glColorPointer(4, GL10.GL_FLOAT, VERTEX_SIZE, vertices);

            gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 3);

        }

        @Override
        public void onSurfaceChanged(GL10 gl, int width, int height) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onSurfaceCreated(GL10 gl, EGLConfig config) {
            // TODO Auto-generated method stub

        }

    }

}

A: Oh. I have fixed my problem. But I cannot explain why. (I can fixed because I do like some tutorial on the internet).
Here is my code. I have pointed some lines that I have changed. Please tell me why it works, please:
package com.test;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.app.Activity;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.opengl.GLSurfaceView;
import android.opengl.GLSurfaceView.Renderer;
import android.opengl.GLUtils;
import android.os.Bundle;
import android.util.Log;

public class TextureTriangleTest extends Activity{

    GLSurfaceView glView;
    ByteBuffer byteBuffer;
    FloatBuffer vertices;
    AssetManager assets;

    @Override
    public void onCreate(Bundle savedInstanceState){

        super.onCreate(savedInstanceState);
        assets = getAssets();

        int VERTEX_SIZE = (2+2)*4;
        byteBuffer = ByteBuffer.allocateDirect(3*VERTEX_SIZE);
        byteBuffer.order(ByteOrder.nativeOrder());
        vertices = byteBuffer.asFloatBuffer();
        vertices.put(new float[] { 0.0f, 0.0f, 0.0f, 1.0f,
                                   319.0f, 0.0f, 1.0f, 1.0f,
                                   160.0f, 479.0f, 0.5f, 0.0f } );
        vertices.flip();

        glView = new GLSurfaceView(this);
        glView.setRenderer(new Render());
        setContentView(glView);

    }

    class Render implements Renderer{

        @Override
        public void onDrawFrame(GL10 gl) {

            int a = 0;
            try {

                Bitmap bitmap = BitmapFactory.decodeStream(assets.open("bobrgb888.png"));
                int textureIds[] = new int[1];
                gl.glGenTextures(1, textureIds, 0);
                int textureId = textureIds[0];
                a= textureId;

                gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId);  //this line
                GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
                gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
                gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST);
                gl.glBindTexture(GL10.GL_TEXTURE_2D, 0);  //and this line

                bitmap.recycle();

            } catch (IOException e) {
                Log.d("", "FAILED LOAD FILE");
                throw new RuntimeException("Couldn't load asset!");
            }

            gl.glViewport(0, 0, glView.getWidth(), glView.getHeight());
            gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
            gl.glMatrixMode(GL10.GL_PROJECTION);
            gl.glLoadIdentity();
            gl.glOrthof(0, 320, 0, 480, 1, -1);

            //Here two lines that I added. Two lines I have declared above in try_catch
            //So, WHY I NEED TO DECLARE AGAIN ??!!!
            gl.glEnable(GL10.GL_TEXTURE_2D);
            gl.glBindTexture(GL10.GL_TEXTURE_2D, a);

            gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
            gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

            int VERTEX_SIZE = (2+2)*4;
            vertices.position(0);
            gl.glVertexPointer(2, GL10.GL_FLOAT, VERTEX_SIZE, vertices);
            vertices.position(2);
            gl.glTexCoordPointer(2, GL10.GL_FLOAT, VERTEX_SIZE, vertices);

            gl.glDrawArrays(GL10.GL_TRIANGLES, 0, 3);

        }

        @Override
        public void onSurfaceChanged(GL10 gl, int width, int height) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onSurfaceCreated(GL10 gl, EGLConfig config) {
            // TODO Auto-generated method stub

        }

    }

}

That works for me now :) Who can explain why ??!!


text:
Q: Clone Server to home windows computer My goal is to clone my ubuntu 12.04.5 - Server and send the files compressed to my windows computer over the internet. I am using ssh/putty to connect to my server.
How do I compress and send the files at the same time to my home computer without taking up much space on my server?

A: With the tool WinSCP you can copy it to your windows machine. It might be a little slow though.
To create only one big file which would drastically increase the speed you would just need to create a tar.gz file of the files you want to transport.
tar -czf backup.tar.gz /path/to/file /path/to/file ....
Connect with WinSCP and copy it to your local drive.
You can also preserve permissions with -p etc. if you want more information look up the manual of tar with man tar.


text:
Q: How do you count the total number of hard links within a directory? I've been trying to use the -ls and find commands to total the number of hard link occurrences within a directory.
Is there a simple way to accomplish this beyond physically counting all of the link counts >2 using the ls -li command?

A: With zsh:
(){echo $#} *(NDl+1)

Note that it doesn't count . nor ...
If you don't want to count directories (which on most file systems are always hard links), change to *(NDl+1^/).

*

*(){echo $#} anonymous function which outputs its number of arguments

**(...) glob with glob qualifiers

*N: enable nullglob for that glob (expand to nothing when there's no match)

*D: enable dotglob for that glob (includes hidden files, but never . nor ..)

*l+1: select files with a number of links strictly greater than 1.

*^/: exclude files of type directory.

POSIX equivalent:
find .//. ! -name . -prune -links +1 | grep -c //

(add a ! -type d after -prune to exclude directories).
Or with ls:
(export LC_ALL=C; ls -Aqn | awk 'NR > 1 && $2 > 1 {n++}; END {print n}')

To exclude directories, add && $1 !~ /^d/ after $2 > 1.

A: ls -qAi | awk '{print $1}' | sort | uniq -d | wc -l

That counts inodes that are duplicated in the current directory (one of each, replace -d with -D to count all occurrences), so not counting hard links where all the other links live outside the current directory. . and .. are excluded. Replace -A with -a to add them back (though it's very unlikely they would have hard links in the current directory anyway).
There may be a shorter way but this is very illustrative.
Mr. Pipe | is your friend.
(man too)
Have fun!

A: Given the Linux environment, you could use the stat command on each file and ask for the link count. You can decide if you want to include or exclude dot-files from the count with shopt -s dotglob.  In the loop below, I intentionally skip directories.
shopt -s dotglob
i=0
for f in ./*
do
  [ -d "$f" ] && continue
  if [ $(stat -c %h "$f") -gt 1 ]
  then
    i=$((i+1))
  fi
done

Alternatively, with GNU find:
find . -maxdepth 1 \! -type d -links +1 -printf . | wc -c

This asks find to look, starting in the current directory (.):

*

*only in the current directory (-maxdepth 1)

*skipping directories (! -type d, where the ! is escaped from the shell)

*where the number of links is greater than 1

*in which case, print a period (.)

*... and then count the number of periods emitted

A: I've used the following one-liner to find the file with the highest hard links number:
find . -type f -exec ls -l {} \; | sort -nrk 2 | head -n 1

Hope this helps anyone else looking for the same.


text:
Q: Extraneous _msdcs. forward lookup zone failing replication, how do I check what uses it? and can I delete it? We run Active directory on windows server 2008 and 2008 R2 in 2008 AD mode.
Our DNS is part of the AD and runs on the same servers as the Global Catalogue.
My predecessor created the environment within domain.local (domain is a substitution, .local is not)
In the forward lookup zones we have a container called domain.local and this contains a working _msdcs container.
However at the top level we have a container called _msdcs.domain.net (note its the same domain but .net tld rather than .local) this container mostly contains the same records as the working _msdcs container inside domain.local but with some minor differences.
Example of layout in DNS manager (Not enough reputation points to post an image)
+ Forward Lookup Zones
    - _msdcs.domain.net
        + dc
        + domains
        + gc
        + pdc
    - domain.local
        - _msdcs
            + dc
            + domains
            + gc
            + pdc

I want to find what is using it? I want to know how it got there? and I want to delete it or fix it.
All the MS documentation I can find on _msdcs describes its use and what it contains but not why there would be a separate one at the top of my forward lookup zone for a domain other than my AD's.
================
Update
Looks like the AD has been renamed using rendom but not cleaned up / completed.
To confirm this use sysinternals Active Directory Explorer (BE CAREFUL THERE BE DRAGONS IN THIS TOOL)
then look in this container (not all containers shown, asuming your domain is domain.local)
-servername [servername.domain.local]
    -CN=Configuration,DC=domain,DC=local
          -CN=Partitions
               CN=DOMAIN

for an attribute called msDS-DnsRootAlias
In my case this showed domain.net
Not certain how to fix but that's for another Question.

A: If anything thinks your domain is domain.net instead of domain.local (really you shouldn't use .local, but that's another conversation entirely), it will look for your DCs at _msdcs.domain.net.
There is no telling what this might break (kerberos comes to mind, as well as dynamic DNS updates), so I'd imagine little or nothing is using it.  However, if you like, do a packet capture (use wireshark, or better yet clone the port and use wireshark on something else so you don't have to run wireshark on a production server) filtering for DNS records, and search the resultant data for queries involving _msdcs.domain.net.  If you happen to find one, inspect the device querying to see what it is that is so misconfigured.
Perhaps you also have, or had, an AD domain with that name.  If so, and it no longer exists, you can purge those records.  This will make your life easier when eventually someday you migrate away from .local.

A: The _msdcs.domain.local under the domain.local (which is  the first domain in the forest) is delegated authority by right-clicking the domain.local and choosing "New Delegation..." wizard. Run the wizard to point to the same PDC as the SOA. It may seem fruitless to do, but it has a definite purpose.
Normally, domain controllers throughout the network contain a replica of the DNS zones and are authoritative only in that domain. The Delegation wizard creates a new _msdcs.domain.local at the same level as domain.local as a new domain. It is a copy of all the zones, and causes the Name Servers throughout the Forest to become authoritative. The purpose is for large networks over WAN connections that have domain controllers at each site. These domain controllers are each a DNS replication server with a replica of the whole AD DNS (all the zones), but performing the Delegation wizard allows them, as authoritative, to be writeable. No longer does dynamic updating of system records have to be done between all PCs in the domains to the PDC, but just to their local DC, which will update the PDC on its regular update cycle.
By default, the replication scope for Name Servers (NS) in _msdcs is set to all DNS servers in the domain, but now the NS's in _msdcs.domain.local are authoritative for the forest. This allows LDAP queries to interface locally in their domain on their local DC as a minor reason. But, even if all the DNS replica's are at headquarters, until this delegation is done, the name servers (NS) are only authoritative about AD details that are in domain.local (or better written as domain1.local) not authoritative to domains (i.e. domain2.local) at the same level as the first domain in the forest.
Some make the mistake to assume that child domains of the first domain in the forest also need this. But Name Servers are authoritative for their domain, even if child.domain.local resides inside domain.local.
As far as the _msdcs.domain.net name being different, from the domain at the same level it came from, domain.local? That was probably a rookie admin who thought that _msdcs.domain.local domain would conflict with _msdcs name (FQDN:_msdcs.domain.local) that was under domain.local, since it would be identically named and possibly cause corruption.


text:
Q: Changing the stroke color of map overlay on tap I have a map view and I am generating a bunch of mkcircle overlays. These have a stroke width and fill color.
I also have a tap gesture set up that determines if the tap is on one of the mkcircles. What I would like to do now is change the stroke width and fill color so the user knows which mkcircle was tapped and then change it back on any other tap.
The code I have is below.
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
    let circleRenderer = MKCircleRenderer(overlay: overlay)
    circleRenderer.fillColor = UIColor.blue.withAlphaComponent(0.1)
    circleRenderer.strokeColor = UIColor.blue
    circleRenderer.lineWidth = 2
    return circleRenderer
}

func handleMapTap(_ gestureReconizer: UITapGestureRecognizer) {
    let tapPoint = gestureReconizer.location(in: mapView)
    let tapCoordinate = mapView.convert(tapPoint, toCoordinateFrom: mapView)
    let point = MKMapPointForCoordinate(tapCoordinate)
    if mapView.overlays.count > 0 {
        for overlay: MKOverlay in polygonArray {
            if (overlay is MKCircle) {
                let circle = overlay
                let circleRenderer = (mapView.renderer(for: circle) as! MKCircleRenderer)
                let datapoint = circleRenderer.point(for: point)
                circleRenderer.invalidatePath()

                if circleRenderer.path.contains(datapoint) {

                    let circleIndex = polygonArray.index{$0 === circle}!
                    print(circleIndex)
                }
            }
        }
    }
}

I have done some searching but I have not been able to find a solution yet. I am able to get the circleIndex of the tapped circle.
Any guidance is appreciated.

A: Just in case anyone else comes across this here is the answer which was actually pretty easy in the end.
func handleMapTap(_ gestureReconizer: UITapGestureRecognizer) {
    let tapPoint = gestureReconizer.location(in: mapView)
    let tapCoordinate = mapView.convert(tapPoint, toCoordinateFrom: mapView)
    let point = MKMapPointForCoordinate(tapCoordinate)
    if mapView.overlays.count > 0 {
        for overlay: MKOverlay in polygonArray {
            if (overlay is MKCircle) {
                let circle = overlay
                let circleRenderer = (mapView.renderer(for: circle) as! MKCircleRenderer)
                let datapoint = circleRenderer.point(for: point)
                circleRenderer.invalidatePath()

                circleRenderer.fillColor = UIColor.blue.withAlphaComponent(0.1)
                circleRenderer.strokeColor = UIColor.blue

                if circleRenderer.path.contains(datapoint) {

                    circleRenderer.fillColor = UIColor.black
                    circleRenderer.strokeColor = UIColor.black
                    let circleIndex = polygonArray.index{$0 === circle}!
                    print(circleIndex)
                }
            }
        }
    }
}


text:
Q: Converting date of format yyyy-MM-dd'T'HH:mm:ss.SSS I have few NSDate objects which contain values compliant to this format yyy-MM-dd'T'HH:mm:ss.SSS
When I try to convert to a different format such as MMM dd, yyyy HH:mm the formatter always returns nil.
However, if I hardcode the string value I get through the NSDate object , it is transformed to the new format without a problem.
I populate my NSDate object in the model using the setValue:forKey: method, and I feel the problem is here where the JSON library passes a string value. However, the debugging shows that the NSDate has contains the value returned via JSON.
Any idea what's causing this strange behavior?
This is my conversion code:
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS"];
NSString *createdDateStr = [format stringFromDate:modelObj.createdDate];
[format setDateFormat:@"MMM dd, yyyy HH:mm"];

NSDate *formattedDate = [format dateFromString:createdDateStr];
NSLog(@"========= REal Date %@",[format stringFromDate:formattedDate]);

A: The problem is that you are creating string from date with one format and then trying to convert it back to date with different format. To create date from string you should use the same format as you've used to create that string otherwise you'll get nil. If you do need formatted string with other format, then first create date from string with correct format and then convert it back to string with format you want. The issue is the order.
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS"];
NSString *createdDateStr = [format stringFromDate:modelObj.createdDate];

NSDate *formattedDate = [format dateFromString:createdDateStr];

[format setDateFormat:@"MMM dd, yyyy HH:mm"];
NSLog(@"========= REal Date %@",[format stringFromDate:formattedDate]);

Other approach is to use different formatters as Jon Skeet suggest just to avoid confusion...

A: EDIT: Rereading your question, I think you've got a conceptual misunderstanding aside from anything else:

I have few NSDate objects which contains values compliant to the following format

As far as I'm aware (I'm not an Objective-C programmer, admittedly) an NSDate object doesn't know anything about formatting. It just represents an instant in time. It isn't aware of whether it was parsed from text or created in some other way.
It's like an int - an int variable isn't in decimal or hex, it's just a number. It's when you format and parse that you specify that. Likewise, you use NSDateFormatter to describe the format you want at the point of parsing and formatting.

You've currently only got one NSDateFormatter - you're setting the format to "yyyy-MM-dd'T'HH:mm:ss.SSS" then resetting it before you've called dateFromString. The code snippet you've given formats modelObj.createdDate into ISO-8601 format, but then tries to parse it using the "MMM dd, yyyy HH:mm" format.
I suggest you have two separate NSDateFormatter objects:
NSDateFormatter *isoFormat = [[NSDateFormatter alloc] init];
[isoFormat setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS"];
NSString *createdDateStr = [format stringFromDate:modelObj.createdDate];

NSDateFormatter *shortFormat = [[NSDateFormatter alloc] init];
[shortFormat setDateFormat:@"MMM dd, yyyy HH:mm"];

NSDate *parsedDate = [isoFormat dateFromString:createdDateStr];
NSLog(@"========= REal Date %@",[shortFormat stringFromDate:parsedDate]);

Note that I've changed your formattedDate variable to parsedDate, as that's what it really is - an NSDate which has been created by parsing text.
As noted in comments, unless you actually need to format and parse like this, you shouldn't. I included all of your original code just to show how you can format a date and then reparse it with the same NSDateFormatter. You'll get the same result with just:
NSDateFormatter *shortFormat = [[NSDateFormatter alloc] init];
[shortFormat setDateFormat:@"MMM dd, yyyy HH:mm"];
NSLog(@"========= REal Date %@",[shortFormat stringFromDate:modelObj.createdDate]);

In general, you should avoid unnecessary conversions. Convert from text to the more natural data type (NSDate in this case, but the same applies for numbers etc) and use that data type for as much of your code as possible, only converting to text at the last moment.

A: You've got an NSDate, modelObj.createdDate, and you want to format it as a string in a certain format, MMM dd, yyyy HH:mm. You don't need to convert the date to a string and then back to another NSDate and then back to a string again. If you use the same formatter for both operations, you'll just end up with the same date you started with.
You only need to format the date once, to your final desired appearance:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MMM dd, yyyy HH:mm"];
NSLog(@"========= REal Date %@",[format stringFromDate:modelObj.createdDate]);

The NSDate itself is not "compliant to the following format". It has no format -- it's a moment in time, an offset from a reference date. If you NSLog() it, it will indeed format itself into a human-readable string (probably using a date formatter behind the scenes), but that is just one representation that it chooses.
Right now, you're getting nil from the second formatting operation, NSDate *formattedDate = [format dateFromString:createdDateStr]; because the format of the string you pass in to the formatter has to exactly match what the formatter expects. In this case, it doesn't, because you created the string using the format yyyy-MM-dd'T'HH:mm:ss.SSS, but have told the formatter to expect MMM dd, yyyy HH:mm. The formatter thus can't parse the string, and returns nil to indicate failure.