text:
Q: WPF View ListView Backwards I want to be able to maintain a list in the background that puts new items at the end of the list (to avoid Insert() pushing the items around on updates) but to be able to display it in the reverse order without "sorting".
I just want it to show up in the list view in the reverse order that it is in the list. Can I do this with a template or something similar?

A: You can change the ListView's ItemsPanel to be a DockPanel with LastChildFill set to false. Then in the ItemContainerStyle, set the DockPanel.Dock property to bottom. This will start filling at the bottom and work its way up to the top. I put the ListView in a grid with 2 rows, first's Height="Auto" and second's Height="*" and it acted just like a normal ListView, but with the items reversed.
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <ListBox Grid.Row="0">
    <ListBox.ItemContainerStyle>
            <Style TargetType="{x:Type ListBoxItem}"
                   BasedOn="{StaticResource {x:Type ListBoxItem}}">
                <Setter Property="DockPanel.Dock"
                        Value="Bottom" />
            </Style>
        </ListBox.ItemContainerStyle>
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <DockPanel LastChildFill="False" />
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
    </ListBox>
</Grid>

Idea taken from:
https://stackoverflow.com/a/493059/2812277

A: Update
Here is an Attached Behavior which will reverse any ItemsControl. Use it like this
<ListBox behaviors:ReverseItemsControlBehavior.ReverseItemsControl="True"
         ...>

ReverseItemsControlBehavior
public class ReverseItemsControlBehavior
{
    public static DependencyProperty ReverseItemsControlProperty =
        DependencyProperty.RegisterAttached("ReverseItemsControl",
                                            typeof(bool),
                                            typeof(ReverseItemsControlBehavior),
                                            new FrameworkPropertyMetadata(false, OnReverseItemsControlChanged));
    public static bool GetReverseItemsControl(DependencyObject obj)
    {
        return (bool)obj.GetValue(ReverseItemsControlProperty);
    }
    public static void SetReverseItemsControl(DependencyObject obj, object value)
    {
        obj.SetValue(ReverseItemsControlProperty, value);
    }

    private static void OnReverseItemsControlChanged(object sender, DependencyPropertyChangedEventArgs e)
    {
        if ((bool)e.NewValue == true)
        {
            ItemsControl itemsControl = sender as ItemsControl;
            if (itemsControl.IsLoaded == true)
            {
                DoReverseItemsControl(itemsControl);
            }
            else
            {
                RoutedEventHandler loadedEventHandler = null;
                loadedEventHandler = (object sender2, RoutedEventArgs e2) =>
                {
                    itemsControl.Loaded -= loadedEventHandler;
                    DoReverseItemsControl(itemsControl);
                };
                itemsControl.Loaded += loadedEventHandler;
            }
        }
    }
    private static void DoReverseItemsControl(ItemsControl itemsControl)
    {
        Panel itemPanel = GetItemsPanel(itemsControl);
        itemPanel.LayoutTransform = new ScaleTransform(1, -1);
        Style itemContainerStyle;
        if (itemsControl.ItemContainerStyle == null)
        {
            itemContainerStyle = new Style();
        }
        else
        {
            itemContainerStyle = CopyStyle(itemsControl.ItemContainerStyle);
        }
        Setter setter = new Setter();
        setter.Property = ItemsControl.LayoutTransformProperty;
        setter.Value = new ScaleTransform(1, -1);
        itemContainerStyle.Setters.Add(setter);
        itemsControl.ItemContainerStyle = itemContainerStyle;
    }
    private static Panel GetItemsPanel(ItemsControl itemsControl)
    {
        ItemsPresenter itemsPresenter = GetVisualChild<ItemsPresenter>(itemsControl);
        if (itemsPresenter == null)
            return null;
        return GetVisualChild<Panel>(itemsControl);
    }
    private static Style CopyStyle(Style style)
    {
        Style styleCopy = new Style();
        foreach (SetterBase currentSetter in style.Setters)
        {
            styleCopy.Setters.Add(currentSetter);
        }
        foreach (TriggerBase currentTrigger in style.Triggers)
        {
            styleCopy.Triggers.Add(currentTrigger);
        }
        return styleCopy;
    }

    private static T GetVisualChild<T>(DependencyObject parent) where T : Visual
    {
        T child = default(T);

        int numVisuals = VisualTreeHelper.GetChildrenCount(parent);
        for (int i = 0; i < numVisuals; i++)
        {
            Visual v = (Visual)VisualTreeHelper.GetChild(parent, i);
            child = v as T;
            if (child == null)
            {
                child = GetVisualChild<T>(v);
            }
            if (child != null)
            {
                break;
            }
        }
        return child;
    }
}

Otherwise, you can follow what's outlined in the following link: WPF reverse ListView
<ListBox ...>
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel VerticalAlignment="Top"  Orientation="Vertical">
                <VirtualizingStackPanel.LayoutTransform>
                    <ScaleTransform ScaleX="1" ScaleY="-1" />
                </VirtualizingStackPanel.LayoutTransform>
            </VirtualizingStackPanel>
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
    <ListBox.ItemContainerStyle>
        <Style TargetType="ListBoxItem">
            <Setter Property="LayoutTransform">
                <Setter.Value>
                    <ScaleTransform ScaleX="1" ScaleY="-1" />
                </Setter.Value>
            </Setter>
        </Style>
    </ListBox.ItemContainerStyle>
</ListBox>

A: After googling and trying things for half of a day I came across @ryan-west answer, and slightly modified it to fit my needs. I was able to get exactly what I wanted a listbox in  a scrollviewer that showed a list exactly as normally seen, but in reverse order.
      <ScrollViewer>
            <ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                     VerticalAlignment="Top"
                     ItemsSource="{Binding MyList, Mode=TwoWay}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <DockPanel>
                            <Image DockPanel.Dock="Left"
                                   Source="MyIcon.png"
                                   Width="16" />
                            <Label DockPanel.Dock="Left"
                                   Content="{Binding MyName, Mode=TwoWay}"/>
                        </DockPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
                <ListBox.ItemContainerStyle>
                    <Style TargetType="{x:Type ListBoxItem}"
                           BasedOn="{StaticResource {x:Type ListBoxItem}}">
                        <Setter Property="DockPanel.Dock"
                                Value="Bottom" />
                    </Style>
                </ListBox.ItemContainerStyle>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <DockPanel LastChildFill="False" />
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
            </ListBox>
        </ScrollViewer>

A: Assuming that the ItemsSource is an ObservableCollection, my solution was to implement a ReverseObservableCollection:
public class ReverseObservableCollection<T> : IReadOnlyList<T>, INotifyCollectionChanged, INotifyPropertyChanged
{
    #region Private fields

    private readonly ObservableCollection<T> _observableCollection;

    #endregion Private fields

    #region Constructor

    public ReverseObservableCollection(ObservableCollection<T> observableCollection)
    {
        _observableCollection = observableCollection;
        observableCollection.CollectionChanged += ObservableCollection_CollectionChanged;
    }

    #endregion

    #region Event handlers

    private void ObservableCollection_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
    {
        if (new[] { NotifyCollectionChangedAction.Add, NotifyCollectionChangedAction.Remove, NotifyCollectionChangedAction.Reset }.Contains(e.Action))
        {
            OnPropertyChanged(nameof(Count));
        }
        OnPropertyChanged(Binding.IndexerName); // ObservableCollection does this to improve WPF performance.

        var newItems = Reverse(e.NewItems);
        var oldItems = Reverse(e.OldItems);
        int newStartingIndex = e.NewItems != null ? _observableCollection.Count - e.NewStartingIndex - e.NewItems.Count : -1;
        //int oldCount = _observableCollection.Count - (e.NewItems?.Count ?? 0) + (e.OldItems?.Count ?? 0);
        //int oldStartingIndex = e.OldItems != null ? oldCount - e.OldStartingIndex - e.OldItems.Count : -1;
        int oldStartingIndex = e.OldItems != null ? _observableCollection.Count - e.OldStartingIndex - (e.NewItems?.Count ?? 0) : -1;
        var eventArgs = e.Action switch
        {
            NotifyCollectionChangedAction.Add => new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, newItems, newStartingIndex),
            NotifyCollectionChangedAction.Remove => new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, oldItems, oldStartingIndex),
            NotifyCollectionChangedAction.Replace => new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, newItems, oldItems, oldStartingIndex),
            NotifyCollectionChangedAction.Move => new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move, oldItems, newStartingIndex, oldStartingIndex),
            NotifyCollectionChangedAction.Reset => new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset),
            _ => throw new ArgumentException("Unexpected Action", nameof(e)),
        };
        OnCollectionChanged(eventArgs);
    }

    #endregion

    #region IReadOnlyList<T> implementation

    public T this[int index] => _observableCollection[_observableCollection.Count - index - 1];

    public int Count => _observableCollection.Count;

    public IEnumerator<T> GetEnumerator()
    {
        for (int i = _observableCollection.Count - 1; i >= 0; --i)
        {
            yield return _observableCollection[i];
        }
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return GetEnumerator();
    }

    #endregion

    #region INotifyCollectionChanged implementation

    public event NotifyCollectionChangedEventHandler? CollectionChanged;

    private void OnCollectionChanged(NotifyCollectionChangedEventArgs args)
    {
        CollectionChanged?.Invoke(this, args);
    }

    #endregion

    #region INotifyPropertyChanged implementation

    public event PropertyChangedEventHandler? PropertyChanged;

    private void OnPropertyChanged(string? propertyName)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }

    #endregion

    #region Private methods

    private IList? Reverse(IList? list)
    {
        if (list == null) return null;

        object[] result = new object[list.Count];
        for (int i = 0; i < list.Count; ++i)
        {
            result[i] = list[list.Count - i - 1];
        }
        return result;
    }

    #endregion
}

Then, you just add a new property to the ViewModel and bind to it:
public class ViewModel
{
    // Your old ItemsSource:
    public ObservableCollection<string> Collection { get; } = new ObservableCollection<string>();

    // New ItemsSource:
    private ReverseObservableCollection<string>? _reverseCollection = null;
    public ReverseObservableCollection<string> ReverseCollection => _reverseCollection ??= new ReverseObservableCollection<string>(Collection);
}


text:
Q: Slick2d play audio at half speed leaving pitch unchanged Currently, in Slick2d, if I define a sound,
Sound s = new Sound("/res/music/concertAPiano.wav");
s.play(1.0f, 1.0f);

There doesn't seem to be a way to change the speed of the sound. If I set the pitch to lower, I can get the sound to last longer, but obviously this comes at a cost, because it doesn't sound the same. Is there a way that anybody knows of to play a sound in slick at a lower speed at the same pitch?

A: I don't think you can do that with Slick2d's Sound class, and I'm not sure of any audio class in slick that can, unfortunately.
Unless you're going to be needing to change the pitch of this particular sound often within your program it might be better to pull the clip into audio editing software like audacity and you can get your desired effect by using that.
Keep in mind though that the audio may sound distorted or weird because of the nature of music being a wave. It's going to be either stretched or condensed, and this wavelength is responsible for controlling the pitch and speed of the sound.
Check out this post maybe if you want to know more:
Is pitch and speed the same thing in audio programming context?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Context menu does not work with Javascript generated HTML My goal is to have a right-clickable link that shows a custom context menu. I am using this handy context menu plugin. I can get it to work for static HTML content, but when creating the html using javascript, the right clicking does not trigger my custom context menu. Does it have something to do with dynamically creating HTML?
My code to create the HTML is
$('.cmenu1content a').contextmenu();

$('#add_stuff').click(function () {
    var $html = '';
    $html += '
But this doesnt

Set Start Time

Set End Time

Center time (5 min)

Center time (30 min)

Center time (60 min)

Center time (6 hour)

'
    $(".not_working_link").empty().html($html);
});

Here is a JSFiddle of my situation. The context menu plugin is from lines 1 - 75, but my code starts at line 77.
http://jsfiddle.net/jonk1993/a2WYS/

A: Use on http://api.jquery.com/on/ for making it works with generated elements or live in older jquery http://api.jquery.com/live/

A: Unless you can use a delegate pattern and work from a parent element (the $.on() method with the second argument selector), you should add the $.contextmenu() call within the click handler; otherwise, the event handler has not been set on the new element, only on the ones that existed when you ran the (previous) call.
$('#add_stuff').click(function () {
    // This will create a documentFragment that after appended, can
    // still be worked on, as you see on the third line below.
    var $html = $('
<a ... blah blah ...
');

    // Note the use of `$.append()` instead of `$.html()`.
    $(".not_working_link").empty().append($html);

    $html.children('.cmenu1content a').contextmenu();
});

http://jsfiddle.net/a2WYS/7/


text:
Q: Fill out custom field with used coupon code WooCommerce Right now I'm working with a mailchimp plugin that needs a custom field for validating/segmenting.
For this segment I want to check what kind of coupon is used. So I scavenged the following code that should fill my custom field with the used coupons:
add_action( 'woocommerce_checkout_update_order_meta',
'my_custom_checkout_field_update_order_meta' );

function my_custom_checkout_field_update_order_meta( $order_id ) {
if ( empty( $_POST['my_field_name'] ) ) {
    $coupons = $order->get_used_coupons();
    update_post_meta( $order_id, 'my_field_name', $coupons);
}
}

Sadly this will only crash my site.
Any help would be greatly appreciated.

A: There are several problems with your code:

*

*You're not validating if the field has any information, so you need
to check if $_POST has the my_field_name key

*You need to load the $order variable in order to get the used coupons.

*What happens when there's a my_field_value? Do you store it?

Here's the modified code:
add_action( 'woocommerce_checkout_update_order_meta',
'my_custom_checkout_field_update_order_meta' );

function my_custom_checkout_field_update_order_meta( $order_id, $posted ) {
  if ( isset($_POST['my_field_name']) && empty( $_POST['my_field_name'])) {
    $order = new WC_Order( $order_id );
    $coupons = $order->get_used_coupons();
    update_post_meta( $order_id, 'my_field_name', $coupons);
  }

}


text:
Q: Only generate positive integers with QuickCheck We have two functions that compare two different power functions, and return true if they return the same value (on the same input).
Then we have two other functions that test these functions against two lists to see if there is any value that doesn't return true.
But instead of using lists that use a range [1..100], we would like to use QuickCheck.
Is it possible to make QuickCheck only return positive integers?
Code:
comparePower1 :: Integer -> Integer -> Bool
comparePower1 n k = power n k == power1 n k

comparePower2 :: Integer -> Integer -> Bool
comparePower2 n k = power n k == power2 n k

testing1 = and [comparePower1 n k | n <- [0..100], k <- [0..100]]
testing2 = and [comparePower2 n k | n <- [0..100], k <- [0..100]]

A: QuickCheck has support for Positive numbers, but for the sake of this tutorial I will show you how to create your own Generator. One of the main features of QuickCheck is that you can design your own generator to output just what you need. For instance
genPos :: Gen Int
genPos = abs `fmap` (arbitrary :: Gen Int) `suchThat` (> 0)

Then you can create your own list genereator
genListOfPos :: Gen [Int]
genListOfPos = listOf genPos

Finally you can use forAll, pass the generator and profit.
main :: IO ()
main = do
  quickCheck $ forAll genPos $ \x -> x > 0
  quickCheck $ forAll genListOfPos $ all (> 0)


text:
Q: Execute command with backquote in bash shell script I write up a little shell script in bash that allows me to execute commands in sub-directories. Here is the script
bat.sh:
#!/bin/sh

for d in */; do
  echo "Executing \"$@\" in $d"
  cd $d
  `$@`
  cd ..
done

With my following directory structures
/home/user
--a/
----x.txt
----y.txt
--b/
----u.txt
----v.txt

I expect the following command to list out the content of directories a and b when it is executed in the home directory
    bat.sh ls
The result is
Executing "ls" in a/
/home/user/bin/bat.sh: line 6: x.txt: command not found
Executing "ls" in b/
/home/user/bin/bat.sh: line 6: u.txt: command not found

Any idea on what is going wrong here?

A: You don't want the back quotes; you want double quotes.
#!/bin/sh

for d in */
do
    echo "Executing \"$*\" in $d"
    (cd "$d" && "$@")
done

You are trying to execute the output of the command you pass, whereas you simply want to execute the command.
The use of an explicit subshell (the ( … ) notation) may avoid some problems with symlinks that jump to other directories.  It is, in my (perhaps archaic) view, a safer way to switch directories for the purposes of executing commands.


text:
Q: Node.js Web Application running in Windows Azure Emulator I've been trying Node.js running in Windows Azure Emulator, but unfortunatelly it isn't working. Of course, I started from beginning, Hello World application, following steps in this tutorial.
I followed the steps below with 4 different computers and in all cases the page didn't show anything.

*

*I opened Windows PowerShell environment as Administrator.

*I created node directory

*I entered the command: PS C:\node> New-AzureService tasklist

*I entered the command: PS C:\node\tasklist> Add-AzureNodeWebRole

Here, my application was created with the code above:
var http = require('http');
var port = process.env.port || 1337;
http.createServer(function (req, res) {
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.end('Hello World\n');
}).listen(port);

*

*And finally, I entered the command: PS C:\node\tasklist\WebRole1> Start-AzureEmulator -launch

Now I was supposed to see my hello world page. The question is, if somebody had success with the given tutorial? And what Am I doing wrong?

A: I had your exact same error and looking for a long time on the Internet I found this post.
Just to summarize, the problem is that there's a script inside Node package for Azure that's trying to grant permissions for "Network Service" to the web root directory.
However my system language is it-IT, so I don't have a user called "Network Service".
So you need to edit the script. If your application path is C:\node\tasklist then the script is located at
C:\node\tasklist\local_package.csx\roles\WebRole1\approot\bin\setup_web.cmd

Just change this line:
icacls ..\ /grant "Network Service":(OI)(CI)W

with this:
icacls ..\ /grant "NetworkService":(OI)(CI)W

This worked for me!

A: You can try running the example directly in node using:
node server.js
and pointing a browser to http://localhost:1337. This takes the Windows Azure emulator out of the picture and might indicate if there is something else going on.

A: I think your case is similar with below article.
http://blogs.msdn.com/b/avkashchauhan/archive/2012/01/31/handling-two-known-issues-with-windows-azure-node-js-sdk-0-5-2.aspx
I hope you can solve the problem by this info.


text:
Q: hide show componant in adf I have 3 SelectOneChoice which are not to datacontrol, depending on the value of first SelectOneChoice the other 2 SelectOneChoice  should show and hide.
I used manged bean and i used valueChangeListener for the first SelectOneChoice to hide and show the other 2 SelectOneChoice based on the selection, and partial in the other 2 SelectOneChoice but it did not work
here is the first SelectOneChoice
<af:selectOneChoice label="acnt type"  id="soc10"  valueChangeListener="#{backingBeanScope.JasperBean.hideShowAccounts}"
              autoSubmit="true" required="true" contentStyle="width:118px">
           <af:selectItem label="Cultural Division Accounts" value="CA" id="si12"/>
           <af:selectItem label="Students Accounts" value="SA" id="si13"/>
</af:selectOneChoice>

here are the other 2 SelectOneChoice
 <af:selectOneChoice label="bb"
    valueChangeListener="#{backingBeanScope.JasperBean.storeAccount}"
        id="soc11" autoSubmit="true" partialTriggers="soc10">
      <af:selectItem label="Select Account" value="-1" id="si220"/>
      <f:selectItems value="#{backingBeanScope.JasperBean.accounts}" id="si1"/>
 </af:selectOneChoice>

 <af:selectOneChoice label="aa"
             valueChangeListener="#{backingBeanScope.JasperBean.storeAccount}"
                id="soc12" autoSubmit="true"
   partialTriggers="soc10"
            rendered="#{backingBeanScope.JasperBean.saShown}">
       <af:selectItem label="Select Account" value="-1" id="si221"/>
       <f:selectItems value="#{backingBeanScope.JasperBean.studentAccounts}"  id="si121"/>
</af:selectOneChoice>

here is the managed bean code.
    public void hideShowAccounts(ValueChangeEvent valueChangeEvent) {

    if(valueChangeEvent.getNewValue().toString().equals("CA"))
    {

        ddlCAaccounts.setRendered(true);
        ddlSAaccounts.setRendered(false);
    }
    else if(valueChangeEvent.getNewValue().toString().equals("SA"))
    {

        ddlCAaccounts.setRendered(false);
        ddlSAaccounts.setRendered(true);
    }

}

if it can be done using javascript also tell me how, not necessary that is done in managed bean

A: There is a two step solution for this:

*

*Add valuePassThru="true" for selectOneChoice component.

*Add valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance()); as first line in you value change listener code.
For details please refer to https://community.oracle.com/people/2623233/blog/2015/02/05/valuechangeevent-does-not-fire-for-afselectonechoice-in-adf


text:
Q: node-gyp error with install npm node-sass - centos I want to install node-sass on centos I got this error:
npm install node-sass

npm ERR! code 1
npm ERR! path /***/node_modules/node-sass-middleware/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /root/.nvm/versions/node/v16.17.0/bin/node /root/sops-logger/node_modules/node-sass-middleware/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! make: Entering directory `/root/sops-logger/node_modules/node-sass-middleware/node_modules/node-sass/build'
npm ERR!   g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.5"' -I/root/.node-gyp/16.17.0/include/node -I/root/.node-gyp/16.17.0/src -I/root/.node-gyp/16.17.0/deps/openssl/config -I/root/.node-gyp/16.17.0/deps/openssl/openssl/include -I/root/.node-gyp/16.17.0/deps/uv/include -I/root/.node-gyp/16.17.0/deps/zlib -I/root/.node-gyp/16.17.0/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++14 -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
npm ERR! make: Leaving directory `/root/sops-logger/node_modules/node-sass-middleware/node_modules/node-sass/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   '/root/.nvm/versions/node/v16.17.0/bin/node',
npm ERR! gyp verb cli   '/root/sops-logger/node_modules/node-sass-middleware/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0

node version: 16.17.0
npm version:  7.6.0

A: node-sass has been deprecated so that's why you get the error
'node-sass' usage is deprecated and will be removed in a future major version


text:
Q: Capture the type of error it is returning (500,503,402, etc) and add that in the message? How do I make this script to capture the type of error it is returning (500,503,402, etc) and add that in the message?
#!/bin/bash
hostlist=(s-colin.coverhound.us s-joe.coverhound.us)
  for host in "${hostlist[@]}"; do
if nc -w 2 -z $host 80; then
    echo "INFO: ssh on $host responding [Looks Good]"
else
    echo "ERROR: ssh on $host not responding[Ooops something went
  wrong]"
fi
done

A: Your current script does not perform an HTTP request, so there is no HTTP response and thus no HTTP result code to report. nc -z simply attempts to establish a TCP connection, then immediately quits and tells you whether that succeeded or not. A proper HTTP client would not do that; it would send a valid HTTP GET or POST request once the TCP connection is established, and wait for the server's response to it, then report that back to the user somehow.
You should probably add another action to your script to connect using e.g. curl if the nc test succeeds. What exactly to test for is mildly unclear, but a common thing to check is that fetching the start page works.
if curl -s http://$host/ >/dev/null; then
    echo "INFO: fetching http://$host/ worked" >&2
else
    rc=$?
    echo "ERROR: fetching http://$host/ failed (curl exit code $rc)" >&2
    exit $rc
fi

There are still failure scenarios where no specific HTTP result code will be returned, so I didn't want to put that in. If you need it, it's not hard to get curl to report it when it's available.
Bottom line, you need to understand what you're testing, and what a complete HTTP transaction looks like on the network level if that's what you're trying to test.
Notice also that diagnostic output goes to standard error (the >&2 redirect).
A proper network test script is a drudge to write in shell script because there are so many things which could go wrong. Is there at least one physical network device? Is the cable plugged? Is there a route to the network? Can we resolve the remote host's name? Can we connect to it on a given port? (Your current script tests this.) Does whatever receives that connection speak the expected protocol? Does it handle a trivial request? Does it handle a specific nontrivial request? Is it handled correctly - are the results what we expected, both server-side and in the response the client received? (For example, if there is a database in the back end keeping state, is its state now different, in only the one aspect we are testing?)
A common annoyance is testing GET /static-page and not catching that the thing you really want to work is returning a 500 server error, but POST /dynamic-content with a test payload was too hard or tedious to automate so you never did.


text:
Q: How do I parse xml for multiple specific nodes how to retrieve/parse 2 or more only some specific node of xml using c++.
void queryNodes()
{
    HRESULT hr = S_OK;

    IXMLDOMDocument *pXMLDom = NULL;

    IXMLDOMNodeList *pNodes = NULL;
    IXMLDOMNode *pNode = NULL;
    IXMLDOMNode *pNode1 = NULL;
    BSTR bstrQuery1 = NULL;
    BSTR bstrQuery2 = NULL;
    BSTR bstrNodeName = NULL;
    BSTR bstrNodeValue = NULL;
    VARIANT_BOOL varStatus;
    VARIANT varFileName;
    VariantInit(&varFileName);
    //<siteid>123</siteid>
    CHK_HR(CreateAndInitDOM(&pXMLDom));
    CHK_HR(VariantFromString(L"stocks.xml", varFileName));
    CHK_HR(pXMLDom->load(varFileName, &varStatus));
    if (varStatus != VARIANT_TRUE)
    {
        CHK_HR(ReportParseError(pXMLDom, "Failed to load DOM from stocks.xml."));
    }
    // Query a single node.
    //bstrQuery1 = SysAllocString(L"//rebootexclusiondata[2]/*");
    bstrQuery1 = SysAllocString(L"//rebootexclusiondata//exclusion//");

    CHK_ALLOC(bstrQuery1);
    CHK_HR(pXMLDom->selectSingleNode(bstrQuery1, &pNode));
    if (pNode)
    {
        printf("Result from selectSingleNode:\n");
        CHK_HR(pNode->get_nodeName(&bstrNodeName));
        CHK_HR(pNode->get_xml(&bstrNodeValue));
        SysFreeString(bstrNodeName);
        printf("Node, <%S>:\n", bstrNodeName);
        printf("\t%S\n%S\n", bstrNodeValue);
        if (0 == wcscmp(bstrNodeValue, L"<exclusion>true</exclusion>"))
        {
            printf("\n exe exit \n\n");
        }
        else
        {
            printf("\n go further! lets reboot the system\n\n");
        }
        SysFreeString(bstrNodeValue);
        SAFE_RELEASE(pNode);
    }
}

in this it only check for 1 tag i.e exclusion tag similarly along with exclusion tag it must also check for some another tag in xml simultaneously.
how do i do this.


text:
Q: fire jquery .animate oninput only once http://jsfiddle.net/nFFuD/
I'm trying to animate the search field in this example using jquery, making it move to the top of it's containing div oninput. I was originally using scriptaculous effect.move to do this, but I couldn't make the event only fire once, so if someone kept typing after the first keystroke, the effect would stop and start again from it's current position in the animation for each additional keystroke, which is stupid. I'm new to new to using jquery so please, take it easy if I'm not making very much sense.
EDIT: The example that ocanal posted definitely works, but for some reason it's not working for me when I apply it - here's what I currently have so far - also trying to fade a div on the same event
<!doctype html>

<title>Untitled</title>

<meta charset="utf-8">

    <input id="search" type="text" autofocus="autofocus">

A: change works like blur, so you should do that with keypress event I think,
$('#search').keypress(function() {

    $(this).animate({
    top: '0',
  });
});

http://jsfiddle.net/ocanal/nFFuD/7/

EDIT:
the code you shared is not working, because you should initialize event functions when dom is ready, you don't need to use it in jsFiddle, because you can select the time when script will work.
$(document).ready(function() {
//your functions.
});

than it will work.
$(document).ready(function() {
  $('#search').keypress(function() {

      $(this).animate({
      top: '0',
    });

      $('#icon').fadeOut('slow', function() {

      });

  });
});

and here is your working code

A: There are a few errors with your syntax. Try this:
$('#search').change(function() {

    $(this).animate({
    top: '0'
  });

});

*

*There shouldn't be a +=. This means that you will add zero to the current top position and animate to that. 0 animates to the actual top.

*There shouldn't be a comma after the top property

*You need to close the parenthesis on the animate function.

*$('this') should be $(this). If you pass it in quotes, it will actually look for an <this> element which is of course not anywhere on your page because that isnt valid HTML.

A: You had a few syntax errors going; when writing code, I would suggest the use of Firebug or even the Developer Tools in Chrome/IE9 to catch this errors. This code works just fine:
$('#search').on('keyup',function(){
    $(this).animate({
        top:0
    });
});

A: You had a few problems with your script. Here's a working version for what I think you want to do: jsfiddle
$('#search').change(function() {
 $(this).animate({
   top: '0'
 })
})

First, to call the element inside the function, it's $(this) not $('this'). When something's in quotes, it's referencing a specific element. Without quotes, it's a variable.
You also need to get rid of the trailing comma after top: '0'. It will work fine in modern browsers but IE will not allow it.
You were also missing a closing bracket inside your animate function. You should be using console to spot these errors. Firebug in Firefox or, if you're using Chrome, right click the page and click "Inspect element." Console helps you debug by showing you errors. You can also send alerts there using console.log().


text:
Q: como salir de un bucle infinito con c# Quiero saber la forma de salir de un bucle el cual debe de redireccionarme a otra parte son dos formas que necesito que es la siguiente:

*

*Si encuentra vacía una consulta que tengo , entrara al bucle hasta que encuentre llena pero dejara 3 segundos entre cada retorno pero si pasan 4 veces y sigue vacío este lo sacara a otra pagina al inicio.

*En caso de que si este lleno la consulta pues continuara con mis demás datos.

Aquí dejo el fragmento infinito de mi código, cabe mencionar que tengo un while que es la consulta y el otro sale del do:
        validate.Open();
            OdbcDataReader DbReader = Dbastq.ExecuteReader();

            int laagregacion =1 ;
            do
            {

                while (DbReader.Read())
                {

                    if (DbReader["MERCHANTID"] != DBNull.Value && laagregacion < 4)
                    {

                        laagregacion++;
                        Console.WriteLine(laagregacion);
                        pause (4 segudnos)
                    }
                    else
                    {
                       // Response.Redirect("https://www.kyocode.com");
                    }

                }

            } while (laagregacion == 0 );

            if (str_nbResponse != null && (str_nbResponse.Equals("Aprobado") || str_nbResponse.Equals("approved")))
                {
                    commando = "pay";
                    str_nb_merchant = Request.QueryString["nb_merchant"];        //16
                    if (str_nb_merchant.Length > 16)

A:
si pasan 4 veces y sigue vacío este lo sacara a otra pagina

No entiendo por qué planteas un bucle infinito cuando está claro que quieres un bucle finito.

La mejor forma salir de un bucle infinito es no entrando. Dado que quieres hacer una operación hasta cuatro veces, usa un bucle for:
bool consulta_vacia = true;
for (int intento = 0; consulta_vacia && (intento != 4); ++intento)
{
    // Intentar rellenar la consulta.
    if (/* consulta tiene datos */)
        consulta_vacia = false; // Sale del bucle prematuramente
    else
        esperar_segundos(3);
}

// Llegaremos a este punto si la consulta se rellenó o se agotaron los intentos
// lo sabremos mirando la variable 'consulta_vacia'.


text:
Q: How to write unit test methods for aspx.cs files in VS 2008? How to write unit test methods for VS 2008?
- On Submission of User Name and Password, i have called the method which is .aspx.cs file.I need to write the unit test for the methods which are defined in .aspx.cs file.
-From .aspx.cs file, i have called the methods which is in separate file.
- So i need to cover the code which is in .aspx.cs file and also in .cs file.
So my question is, can we write test methods .aspx.cs file?

A: I would take the code which you want to test, and move it to a seperate class. It sounds like this method belongs in a class which is responsible for validating users. Then your aspx.cs file can use this class to validate users.
If you really want to do it, then this might help you:
http://social.msdn.microsoft.com/Forums/en-US/vststest/thread/5c984f7f-31c9-48ef-b8e5-c9c8357431ae


text:
Q: keycloak, angular: Authorization on demand I wonder how to implement Angular app secured by Keycloak, the way that only some resources will be secured.
eg.:

*

*unauthorised user access http://localhost:8000/#/public -> user is NOT redirect

*unauthorised user access http://localhost:8000/#/private  -> user is redirrect to keycloak login page

A: You can use Angular ngRouter or uiRouter to do this. Both of these have the resolve function in their route/state definitions.
Every time a URL is hit, you can verify with your backend (Keycloak) using a token if the path is secure, and route the user accordingly.
You can use  interceptors to add auth tokens and such to each request like so
$httpProvider.interceptors.push('authInterceptor');

This is a great tutorial for Auth using Angular and JWT, and the concepts can be extended for any auth mechanism, whether it is oAuth or Keycloak


text:
Q: template id="1921" from inside editor doesnt work? I have inherited management of a WordPress based site.
And suddenly something like this [template id="1921"] typed in the editor isn't working.
Been looking in the DB and there are posts with a post_type template. But I can't find any plugin or documentation to get these bracket template calls to work again. All I can find is PHP options, but I would rather just fix whatever used to work.
EDIT: Isn't [display-posts id="x"] suppose to be an official WP shortcode? All it displays on the site where content of post with id x is suppose to be is "[display-posts id="x"]". Why would it do that?


text:
Q: PostgreSQL - Use a function to name a column in a select query I'm trying to set the name of a column in a 'select .. from' query dinamically. So I created a function to return the name of the column and tried to use it in a select query.
The function is this one:
CREATE OR REPLACE FUNCTION get_column_name(iddoc int, campo text) RETURNS text
AS $$
#print_strict_params on
DECLARE
campoid text;
BEGIN

    SELECT campo_id INTO STRICT campoid
    FROM campos_td c
    JOIN (SELECT field4, field3
        FROM frm7
        WHERE iddocumento = iddoc) f ON c.tema_id = f.field3

    RETURN 'field10' || campoid;
END
$$ LANGUAGE plpgsql;

And I've tried things like:
SELECT get_column_name(2, 'Size') FROM frm7
SELECT f.get_column_name(2, 'Size') FROM frm7 as f

But none of them works.

A: The pgsql EXECUTE command lets you run an arbitrary SQL string, in particular, one you have built up with column names passed in at runtime.

A: I am not well versed in sql but you may try this:
DECLARE @query NVARCHAR(MAX);

set @query = 'SELECT ' + get_column_name(2, 'Size') + ' FROM frm7';

execute @query;

Example:
DECLARE @query NVARCHAR(MAX);
DECLARE @colName NVARCHAR(MAX) = 'col1';
set @query = 'SELECT ' + @colName + ' FROM frm7';

execute @query;


text:
Q: Update Linux Path permanently
Possible Duplicate:
How do I set a user environment variable? (permanently, not session)

How can I permanently modify the PATH variable in Ubuntu? Is it possible to do it without modifying any files?
I currently use export PATH=${PATH}:/usr/local/cuda/bin but each time I open a new terminal I have to type it again.

A: Your PATH comes from a text file (usually ~/.bash_profile).  There really isn't a way to edit it without changing your profile short of doming something like
echo 'PATH=$PATH:/usr/local/cuda/bin' >> ~/.bash_profile

A: Usually I just throw that exact command you have in my ~/.bash_profile.

A: put this line into you .bashrc or .profile file in ~/
Then it is loaded whenever you start your console session

A: You can't do it with just a command.
You have to edit the bashrc file for either the system installation or your personal one for permanent changes to take effect.


text:
Q: How to deny access from parent folder to child folder, but still let child folder be accessed directly? I'm setting up some domains on a hosting account I recently purchased and the way the hosting service works is it has a main domain, and then lists the other domains on the account or 'addon' domains as subfolders to the main domain.
So I have maindomain.com which I want to protect, noindex, no follow, only accessible by password etc, but maindomain.com/anotherdomain is really anotherdomain.com which is fine to be accessible by anyone. Is there a way I can deny access to maindomain.com/anotherdomain while still allowing direct access to anotherdomain.com?

A:
Is there a way I can deny access to maindomain.com/anotherdomain while still allowing direct access to anotherdomain.com?

You can have this rule in doc root .htaccess of maindomain.com:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.com$ [NC]
RewriteRule ^ - [F]


text:
Q: RECEIVE_BOOT_COMPLETED doesn't work on Huawei devices API 28 and above I want to run a service when the device restarts. But I couldn't achieve this on API 28 and above. The code below works fine under API 28 and below, but is not responsive at all in higher versions. I haven't looked through many answers, but I couldn't come to a conclusion. I would be glad if you help.

AndroidManifest.xml

    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

    <application
         //...
     <service
        android:name=".Services.NotificationService"
        android:label="@string/app_name"
        android:enabled="true"
        android:exported="true">
        <intent-filter>
            <action
                android:name = "app.tutorialspoint.com.notifyme.NotificationService" />
            <category android:name = "android.intent.category.DEFAULT" />
        </intent-filter>
    </service>

         <receiver
            android:name=".Receivers.DeviceBootReceiver"
            android:enabled="true"
            android:exported="true"
            android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.ACTION_BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
                <action android:name="android.intent.action.REBOOT" />
                <action android:name="android.intent.action.ACTION_SHUTDOWN" />
                <action android:name="android.intent.action.ACTION_BOOT_COMPLETED" />
                <!--For HTC devices-->
                <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>
    </application>

My Receiver

public class DeviceBootReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {

   Intent intentService = new Intent(context,NotificationService.class);
    intentService.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        context.startForegroundService(intentService);
    } else {
        context.startService(intentService);
    }

        //i added it for testing bot doesnt work
        /*if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
             //do something...
        }*/
   }
}

EDIT
The code also works on api 28 and above. I tested it on different
devices and found it working. Doesn't work on Huawei devices only!


text:
Q: How to display symbols i.e. degree (°) same in all systems Our application has database Oracle 12c and Client in Java.
I wonder when using plsql developer for oracle then symbols i.e.° (degree) are displayed using system's language setting or plsql developer setting or oracle server character setting?
We have some symbols like degree which are displayed correct in some machine and some machine shows garbage character. How to do this setting to display symbols same in all systems?
I tried to store chr(176) instead of degree symbol (°) in database still no luck. It shows correct in my systems but shows null in my colleague's machine.


text:
Q: How to get JqueryUI to work with ASP.Net Master Pages and multiple paths? I have a simple ASP.Net 4.0 website that uses a master page that I would like to include JqueryUI.
The Head looks like this.
<head runat="server">
<title></title>
<link href="~/css/Main.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.6.2.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
<link href="js/jquery-ui-1.8.16.custom/css/cupertino/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
         $(function () {
             $("#accordion").accordion();
         });
</script>
 <asp:ContentPlaceHolder ID="HeadContent" runat="server">

</asp:ContentPlaceHolder>

Everything works fine for content pages that inherit from the Master Page as long as it is in the same directory. So if the content page is /Home.aspx alls good, but if it is /Sales/Home.aspx the the styles are never applied to the accordion that is desfined n the Master Page.

A: By using ... "js/jquery-ui-1.8.16.custom/ .. you're redirecting to the JS folder, relativily (is that a word?) to the folder of the current page. If that's in Sales/..., it's looking for the JS-folder in Sales/ but it probably isn't there. You can prevent this by using an absolute link to the root:
<script src="/js/jquery-1.6.2.min.js" type="text/javascript"></script>

This way it will look for the JS folder in the root of the site.


text:
Q: Minimum number of AND operations to make all array elements zero I came across this question in a programming contest:

We are given an array consisting of n elements. At each iteration, you can select any two elements ai and aj and replace ai with ai & aj. & is the bitwise AND operator.
  Find the minimum number of AND operations needed to make all array elements zero.
Suppose that there is a solution for the given inputs. What is the optimal solution for this problem?

Edit:
I've added my DP solution for the problem which takes more than 1 second to run. Any suggestion for speeding it up?

0 < n < 65535
D: maximum number of digits in base 2 (0 < D < 17)
GOAL: 2^D - 1
T[i][X] => minimum number of elements from {n_0, n_1, ..., n_i} that make X zero
T[i][0] = 0
T[0][X>0] = INF
T[i][X] = min( 1 + T[i-1][X & n_i] , T[i-1][X] )
T[n][GOAL] -> min number of AND operations

A: This seems to me like the set cover problem. We need to find the smallest subset that covers zeros in every position. Once that subset is found, the "absolute" zero that's generated can be used to convert other elements to zero. In the example below, any of the three elements in the subset can be used to become the first zero.
1001
0101<
0011<
1110<
0111

A: If the problem has a solution for a given input, you can perform these operations:

*

*Choose an index i between [0,n-1](assuming array indexing is zero based).

*For every j between 0 and n that is not i, perform ai <- ai & aj. At this point you are guaranteed a_i equals 0, otherwise the problem is unsolveable because you performed bitwise and on all items in the array.

*For every j between 0 and n that is not i, perform aj <- ai & aj. This performs and on all items in the array with 0, making them 0 also.
You perform the and operation n-1 times for the first loop and n-1 times for the second loop, so in total 2n-2 and operations.
Edit:
This is assuming you cannot look at the values in the array.

A: My guess is that you can get the needed speedup by making your DP table sparse. We can think of the resulting algorithm as doing a breadth-first search from 2^D-1 to 0 on a graph where the nodes are 0..2^D-1 and the edges go from x to x&y where y is an array element. In fact, due to the commutativity/associativity of bitwise AND, we can tighten the edge set by requiring that x&y clear the lowest bit set in x. In the Python code below, this is achieved somewhat efficiently by using a map zero_index, but in C I would use an array (and replace the sets with bitmaps or arrays as appropriate).
import collections
import random

def min_and(seq):
    lst = list(seq)
    zero_index = collections.defaultdict(lambda: set(lst))
    for x in lst:
        y = x
        while y:
            zero_index[y & ~(y - 1)].discard(x)
            y &= y - 1
    visited = set()
    fringe = set(lst)
    i = 0
    while 0 not in fringe:
        visited.update(fringe)
        fringe = {
            x & y
            for x in fringe for y in zero_index[x & ~(x - 1)]
            if x & y not in visited
        }
        i += 1
    return i + len(lst) - 1

print(min_and(
    random.randrange(2**18) | random.randrange(2**18) | random.randrange(2**18)
    for i in range(100)))


text:
Q: HP Wifi not working in Ubuntu 19.04 in Secure Boot Output of lspci:
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 08)
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 08)
00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 (rev f1)
00:1c.4 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #5 (rev f1)
00:1c.5 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #6 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Intel(R) 100 Series Chipset Family LPC Controller/eSPI Controller - 9D4E (rev 21)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)
01:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Topaz XT [Radeon R7 M260/M265 / M340/M360 / M440/M445] (rev 83)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
03:00.0 Network controller: Intel Corporation Dual Band Wireless-AC 3168NGW [Stone Peak] (rev 10)
I have dual boot of Windows 10 and ubuntu 19.04.
My Wifi icon is missing in ubuntu if I boot with Secure Boot enabled.But it works perfectly if it is disabled.
In case of windows Wifi works perfectly irrespective of whether it is in secure boot or not.
My Wifi adapter is:Intel Corporation Dual Band Wireless-AC 3168NGW.
Model No:HP 15g br106tx.
Edit:It was working fine for 4 months before this problem occured.
Output of sudo lshw -C network


text:
Q: Installing Realtek ALC662 sound drivers on Ubuntu 12.10 Following the answer in Do I need any extra drivers for the Realtek waves maxx audio on my Dell XPS 17?,
I'm trying to install audio driver for Dell XPS 15(L502X) from RealTek site.
But I'm getting the following errors:
# ./install
.....Decompress Driver source v1.0.2x-5.18
Compile Driver........
./install: 19: ./install: ./configure: not found
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `install'.  Stop.
./install: 23: ./install: ./snddevices: not found

Whats wrong?

A: What is wrong is that the install script has a very small bug in it which is very easy to correct.
If you run it, it will indeed display errors.
What to do ?

*

*open the install script in an editor

*change line 1  from #!/bin/sh to #!/bin/bash (just to be shure)

*change line 18 from cd alsa-driver-RTv5.18 to cd alsa-driver-RTv5.18/alsa
Save it and run sudo ./install

A: First check if you don't overload any parts in the mixing path by setting everything at 75% and check if the "bad-sound" problem is solved.
If not: read on.
One of the underestimated problems in Linux sound is samplerateconversion.
Let's say that you try to play a file with samplerate 48000, this will be converted by pulseaudio to 44100 and will be converted by ALSA to 48000 again because your sounddevice can't do 44100.
The pulseaudio samplerateconversion is OK, but the samplerateconversion of ALSA is of bad sound quality.
So best thing you can do is to set the output of pulseaudio to 48000 so that ALSA won't use samplerateconversion.
Edit the pulseaudio config: /etc/pulse/client.conf
change this:
; default-sample-format = s16le
; default-sample-rate = 44100
; default-sample-channels = 2
; default-channel-map = front-left,front-right

to this:
; default-sample-format = s16le
default-sample-rate = 48000
; default-sample-channels = 2
; default-channel-map = front-left,front-right

If all else fails, use OSS4 instead of ALSA+Pulseaudio.
( The soundquality of OSS4 is extremely good but expect some inconveniences)


text:
Q: x-requext-id header propagation in keycloak I am using keycloak to implement OAuth2 code authorization flow in a kubernetes cluster governed by an API gatware Ambassador, I am using Istio Service mesh to add all the tracability, mTLS features to my cluster. One of which is Jaeger which requires all the services to forward x-request-id header in order to link the spans into a specific trace.
When request is sent, Istio's proxy attached to ambassador will generate the x-request-id and forward the request keycloak for authorization, when the results are sent back to the ambassador, the header is dropped and therefore, the istio proxy of keycloak will be generating a new x-header-id. The following image shows the problem:

Here is a photo of the trace where I lost the x-request-id:

Is there a way I can force Keycloak to forward the x-request-id header if passed to it?
Update
here is the environment variables (ConfigMap) associated with Keycloak:
kind: ConfigMap
apiVersion: v1
metadata:
  name: keycloak-envars
data:
  KEYCLOAK_ADMIN: "admin"
  KC_PROXY: "edge"
  KC_DB: "postgres"
  KC_DB_USERNAME: "test"
  KC_DB_DATABASE: "keycloak"
  PROXY_ADDRESS_FORWARDING: "true"

A: You may need to restart your keycloak docker container with the environment variable PROXY_ADDRESS_FORWARDING=true.

*

*ex: docker run -e PROXY_ADDRESS_FORWARDING=true jboss/keycloak


text:
Q: 64bit Java does not work, 32bit does I had 32 and 64bit versions of Java installed (versions 7 and 8 of both JDK and JRE [it was useless installing it twice, but installed it anyway]).
When I would exe java.exe in all of the 64bit installs (\Program Files), it would give me something like "Java SE has stopped Working" and just wouldn't do anything. Although, all of the 32bit installs would work perfectly (\Program Files (x86))
I have a 64bit install of Windows 8.1
http://i.stack.imgur.com/IMPa0.png
It doesn't bother me that much, but id like to take advantage of all my RAM, and not just some of it.
Thank you for any replies in advance.

A: You need to have the path set correctly for the java binaries to run.
From JDK Installation for Microsoft Windows:
Updating the PATH Environment Variable

If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it, such as:

C:\> "C:\Program Files\Java\jdk1.8.0\bin\javac" MyClass.java

It is useful to set the PATH variable permanently so it will persist after rebooting.

To set the PATH variable permanently, add the full path of the jdk1.8.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.8.0\bin. Set the PATH variable as follows on Microsoft Windows:

    Click Start, then Control Panel, then System.
    Click Advanced, then Environment Variables.

    Add the location of the bin folder of the JDK installation to the PATH variable in System Variables. The following is a typical value for the PATH variable:

    C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0\bin

Note:

    The PATH environment variable is a series of directories separated by semicolons (;) and is not case-sensitive. Microsoft Windows looks for programs in the PATH directories in order, from left to right.
    You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored.
    If you are not sure where to add the JDK path, append it.
    The new path takes effect in each new command window you open after setting the PATH variable.

You need to have the classpath set correctly for javac to compile.
See Setting the class path

A: Install  JDK 32 bit version of latest java and set JAVA_HOME and PATH variables like below.
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_131
PATH : C:\Program Files\nodejs\;%JAVA_HOME%\bin;C:\Program Files\TortoiseGit\bin

Hope this would be help

A: Both JRE 32-bit and 64-bit needs to be installed, then IE will detect Java Plug-in Helper as compatible.
See release notes for Java 7 Update 55:
https://www.java.com/en/download/faq/release7_changes.xml
"There is a special case for 64-bit Windows - EPM (Enhanced Protected Mode)requires both 32-bit and 64-bit Plug-in installed. Please make sure you have both 32-bit and 64-bit JRE installed, otherwise there will be a warning from IE, but Java Plug-in will still run under EPM."


text: Q: Do I get anything for finding all the Toads or doing the other collectable tasks? There are hidden Toads and collectables and holes to fill in and there are ? Blocks to hit in each area of the world, and the game lets you know when you have done 100 percent of each thing (found all the Toads, etc) in an area. Do I get anything for accomplishing these tasks? Or is it all just for the glory of having 100 percent completion?


text:
Q: p:dataGrid does not align multiple columns I would like to display a list of label/input using <p:dataGrid>. My code is so simple, but I can't get the expected result.
This is my code:
<p:dataGrid columns="2" value="#{scriptManagerForm.params}" var="conf">
    <p:column>
        <p:outputLabel value="#{conf.name}" />
    </p:column>
    <p:column>
        <p:inputText value="#{conf.value}" required="true" />
    </p:column>
</p:dataGrid>

And this is the result that I get now:

And this is what I need to get:

A: You need the property layout="grid" in the dataGrid

A: I am sure you need a panelGrid instead of a dataGrid.
Inside you can also work with <p:row> and <p:column> if you want.
http://www.primefaces.org/showcase/ui/panel/panelGrid.xhtml
I hope this helps!


text:
Q: $ is undedined in Mvc4 view I am getting an error in JSConsole saying $ is undefined. However when I look at the page source, I see jQuery is included but it is included at the end of the page.
BundleConfig
 public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                        "~/Scripts/jquery-ui-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.unobtrusive*",
                        "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

            bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                        "~/Content/themes/base/jquery.ui.core.css",
                        "~/Content/themes/base/jquery.ui.resizable.css",
                        "~/Content/themes/base/jquery.ui.selectable.css",
                        "~/Content/themes/base/jquery.ui.accordion.css",
                        "~/Content/themes/base/jquery.ui.autocomplete.css",
                        "~/Content/themes/base/jquery.ui.button.css",
                        "~/Content/themes/base/jquery.ui.dialog.css",
                        "~/Content/themes/base/jquery.ui.slider.css",
                        "~/Content/themes/base/jquery.ui.tabs.css",
                        "~/Content/themes/base/jquery.ui.datepicker.css",
                        "~/Content/themes/base/jquery.ui.progressbar.css",
                        "~/Content/themes/base/jquery.ui.theme.css"));
        }

_Layout.cshtml
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")

    @RenderBody()
    @Scripts.Render("~/bundles/jquery")
    @RenderSection("scripts", required: false)

View
@model MvcWebAPI.Models.ComputerStatus

@{
    ViewBag.Title = "Index";
 }

Index

Rendered Source
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <link href="/Content/site.css" rel="stylesheet"/>

Index

A: It appears that your scripts in your view are not being placed in the scripts section.  Make sure you wrap those in
@section scripts
{

}

A: Changing your body to this will solve the problem

   @Scripts.Render("~/bundles/jquery")
   @RenderBody()
   @RenderSection("scripts", required: false)

A: Make sure your _ViewStart is pointing to:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}

If this is the case, then you can take out the script tag on the page.  The problem could be that the file is not being loaded on document ready and thus, you get the error. If you don't have a _ViewStart, just make sure your view is pointing to the _Layout for styling.
[EDIT]
Also try putting your script tag on the head or anywhere else besides the end of the document. It's a thing the loading of the document see if that helps.
Hope it helps.


text:
Q: Calling function in javascript Google API I am using Google JavaScript API with geocoding and heatmap. But I am having some trouble.
Here is my script:
content of coords.js:
eqfeed_callback()

My question is, why I can not call the function heatMapVisualize() anywhere else except the eqfeed_callback function. When I put the function call of heatMapVisualize() somewhere else, it will not do it. How ever the eqfeed_callback is empty.
My second question which is depending on the first one. How can I get rid of this function theese lines:
var script = document.createElement('script');
script.src = 'https://www.stud.fit.vutbr.cz/~xhalin01/BP/coords.js';
document.getElementsByTagName('head')[0].appendChild(script);

I dont need them anymore. There I used to store the locations for heatmapdata, but now I do it via Google Geocoder. I am new to Javascript so excuse my dumb question But I will put bounty on this.

A: If you call it outside the callback the variables used WITHIN that function are only initialized to the defaults set at the top of your script - basically nothing/empty - undefined and empty array.
Put that script in as a tag ABOVE the others with src= attribute set.


text:
Q: How to dynamically load a jquery library if not present? I know, thanks to this tutorial, how to dynamically load jQuery (such as calling <script src="/widget/widget.js?type=normal" type="text/javascript"></script>) if the host website doesn't have it :
(function () {
    var jQuery;

    if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') {
        var script_tag = document.createElement('script');
        script_tag.setAttribute("type", "text/javascript");
        script_tag.setAttribute("src", pathWidget + "/scripts/jquery-1.7.min.js");

        if (script_tag.readyState) {
            script_tag.onreadystatechange = function () { // For old versions of IE
                if (this.readyState == 'complete' || this.readyState == 'loaded') {
                    scriptLoadHandler();
                }
            };
        } else {
            script_tag.onload = scriptLoadHandler;
        }
        (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
    } else {
        jQuery = window.jQuery;
        main();
    }

    function scriptLoadHandler() {
        jQuery = window.jQuery.noConflict(true);
        main();
    }

    function main() {
        jQuery(document).ready(function ($) {

        });
    }
})();

Well, now I'd like to do the same things for a jquery library. Let's says jQuery Cycle.
I've tried with :
var script_cycle = document.createElement('script');
script_cycle.setAttribute("type", "text/javascript");
script_cycle.setAttribute("src", pathWidget + "/scripts/jquery.cycle.all.js");

after :
script_tag.setAttribute("src", pathWidget + "/scripts/jquery-1.7.min.js");

but when I load the cycle into the document ready, I get this error :
$("#myRotator").cycle is not a function

Where am I wrong?

A: try to check if the plugin is loaded:
if(!jQuery().cycle) {
  var script_cycle = document.createElement('script');
  script_cycle.setAttribute("type", "text/javascript");
  script_cycle.setAttribute("src", pathWidget + "/scripts/jquery.cycle.all.js");
  (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_cycle);
}

A: You can use $.getScript() for load external Javascript file.
if(!jQuery().cycle) {
    $.getScript('/scripts/jquery-1.7.min.js',
    function() {});
}


text:
Q: Flexbox justify-content: space-around clickable area is content width only. Could it expand? I want to distribute menu items evenly, so use justify-content space-around. But clickable area is content width only.
If use pure CSS can expand clickable area? (Project will change menu content in the future.)

.menu {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  justify-content: space-around;
}

.menu__link {
  display: block;
}

ABC

DEFGHI

JKLMNOPQ

RSTUV

WXYZ

A: Yet another example.

.menu {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
}

.menu__link {
  display: block;
  border-bottom: 2px solid transparent;
  color: blue;
  text-align: center;
  text-decoration: none;
}

.menu__link:hover {
  border-bottom: 2px solid blue;
}

.menu__item {
  flex: 1;
}

ABC

DEFGHI

JKLMNOPQ

RSTUV

WXYZ

A: The issue with the code is that, youe li items are not fitting to the space of your ul
Just add flex: 1; text-align: center; to your li items to make the li items grow to the container dimension.

.menu {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    justify-content: space-around;
}

.menu__link {
    display: block;
}

.menu__item {
    flex: 1;
    text-align: center;
}

ABC

DEFGHI

JKLMNOPQ

RSTUV

WXYZ

A: You can add a padding to both right and left area of your a tag to expand it. I used padding-inline to add 2rem to both. Or you can do it manually by using padding: 0 2rem;, either works. See the snippet below for your reference (added a background-color for you to see the area expanded clearly).

.menu {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  justify-content: space-around;
}

.menu__link {
  display: block;
  padding-inline: 2rem;
  background: grey;
}

ABC

DEFGHI

JKLMNOPQ

RSTUV

WXYZ

Or as @Nitheesh answered, you can use flex-grow: 1; or flex: 1; for short to expand the menu__item to the available space equally, then add a gap property to the parent container if you want space in-between items. The advantage of this is that you'll have n equal containers.


text:
Q: Regular expression to find email address pattern of  We have an application that we suspect is getting spam/clickfarm email addresses signing up. A lot of them follow the pattern:

*

*firstName:number:lastName@example.com
For example,

*

*tommy8512shira@example.com

*tommy785young@example.com

*tommy3265schmitt@example.com
RegEx
/(\w+)(\d+)(\w+)/g gets me close to what I want but also captures numbers at the end of the string

A: The \w shorthand character class also matches digits and letters. You may either replace it with [a-zA-Z] or subtract the digits using a reverse char class - [^\W\d].
Use either
([a-zA-Z]+)(\d+)([a-zA-Z]+)

(see demo) or an anchored version:
^([^\W\d]+)(\d+)([^\W\d]+)
^

See another demo. The ^ will anchor the pattern at the start of the string.


text:
Q: Andriod Studio Gradle sync failed: Could not run JVM from the selected JDK.2
Gradle sync failed: Could not run JVM from the selected JDK.
            Please ensure JDK installation is valid and compatible with the current OS (Windows 7 6.1, x86).
            If you are using embedded JDK, please make sure to download Android Studio bundle compatible
            with the current OS. For example, for x86 systems please choose a 32 bits download option. (31 ms)


text:
Q: (C++) Direct3D 11 Draw() function doesn't work, despite checking all HRESULTs I'm sorry for not summarizing the code, but I have no clue where the error might be.
As the code shows, I have used the debugging flag for the device and I have fixed all the errors that showed up in the output window of Visual Studio (2017).
This is all the C++ code:
#pragma once
#pragma comment(lib, "d3d11")
#pragma comment(lib, "D3DCompiler")

#include <Windows.h>
#include <string>
#include <d3d11.h>
#include <d3dcompiler.h>
#include <wrl\client.h>
#include <comdef.h>

using namespace Microsoft::WRL;

#define CHECK_OK(hr) if (hr == S_OK)
#define CHECK_FAIL(hr) if (hr != S_OK)

#define CLASS_NAME "d3dwindow"

bool running = 1;

DXGI_SWAP_CHAIN_DESC CreateSwapChainDesc(HWND window, int width, int height) {
    DXGI_SWAP_CHAIN_DESC scd = {};
    scd.BufferDesc.Width = width;
    scd.BufferDesc.Height = height;
    scd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
    scd.BufferDesc.RefreshRate.Numerator = 0;
    scd.BufferDesc.RefreshRate.Denominator = 0;
    scd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
    scd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
    scd.SampleDesc.Count = 1;
    scd.SampleDesc.Quality = 0;
    scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
    scd.BufferCount = 1;
    scd.OutputWindow = window;
    scd.Windowed = 1;
    scd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
    scd.Flags = 0;
    return scd;
}

LRESULT CALLBACK WindowProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) {
    switch (message) {
    case WM_DESTROY:
        running = 0;
        break;
    default:
        break;
    }
    return DefWindowProcA(window, message, wparam, lparam);
}

HWND CreateHwnd(const char *name, int width, int height, HINSTANCE instance = 0) {
    WNDCLASSA window_class = { 0 };
    window_class.lpfnWndProc = WindowProc;
    window_class.lpszClassName = CLASS_NAME;
    RegisterClassA(&window_class);
    HWND window = CreateWindowA(CLASS_NAME, name, WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, width, height, 0, 0, instance, 0);
    UpdateWindow(window);
    return window;
}

struct Vertex {
    float x, y;
};

int WINAPI WinMain(HINSTANCE instance, HINSTANCE prev_instance, LPSTR cmd_line, int arg_num) {
    ComPtr<ID3D11Device> device;
    ComPtr<IDXGISwapChain> swap_chain;
    ComPtr<ID3D11DeviceContext> context;
    ComPtr<ID3D11RenderTargetView> target;

    HWND window = CreateHwnd("D3D", 800, 600, instance);
    DXGI_SWAP_CHAIN_DESC swap_chain_desc = CreateSwapChainDesc(window, 800, 600);
    HRESULT hr;

    UINT device_flags = 0;
    device_flags |= D3D11_CREATE_DEVICE_DEBUG;
    // Creating the device and swap chain
    hr = D3D11CreateDeviceAndSwapChain(
        0,
        D3D_DRIVER_TYPE_HARDWARE,
        0,
        device_flags,
        0,
        0,
        D3D11_SDK_VERSION,
        &swap_chain_desc,
        &swap_chain,
        &device,
        0,
        &context
    );
    CHECK_FAIL(hr) {
        OutputDebugString("Failed: ");
        _com_error err(hr);
        OutputDebugString(err.ErrorMessage());
        OutputDebugString("\n");
    }

    // Getting the back buffer
    ComPtr<ID3D11Resource> back_buffer;
    hr = swap_chain->GetBuffer(0, __uuidof(ID3D11Resource), &back_buffer);
    CHECK_FAIL(hr) {
        OutputDebugString("\nFailed to get the back buffer.\n");
        return 0;
    }
    // Creating the render target view
    hr = device->CreateRenderTargetView(
        back_buffer.Get(),
        0,
        &target
    );

    // Binding the render target view
    context->OMSetRenderTargets(1, target.GetAddressOf(), 0);

    CHECK_FAIL(hr) {
        OutputDebugString("\nFailed to create the render target.\n");
        return 0;
    }

    const float color[] = { 0.1f, 0.2f, 0.4f, 1.0f };

    Vertex vertices[] = {
    {  0.0f,  0.5f },
    {  0.5f, -0.5f },
    { -0.5f, -0.5f }
    };

    ComPtr<ID3D11Buffer> vertex_buffer;
    D3D11_BUFFER_DESC buffer_desc = { 0 };
    buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    buffer_desc.Usage = D3D11_USAGE_DEFAULT;
    buffer_desc.CPUAccessFlags = 0;
    buffer_desc.MiscFlags = 0;
    buffer_desc.ByteWidth = sizeof(vertices);
    buffer_desc.StructureByteStride = sizeof(Vertex);
    D3D11_SUBRESOURCE_DATA subres_data = { 0 };
    subres_data.pSysMem = vertices;
    hr = device->CreateBuffer(&buffer_desc, &subres_data, &vertex_buffer);
    CHECK_FAIL(hr) {
        OutputDebugString("Failed to create vertex buffer.\n");
        return 0;
    }
    // Bind the vertex buffer
    UINT stride = sizeof(Vertex);
    UINT offset = 0;
    context->IAGetVertexBuffers(0, 1, vertex_buffer.GetAddressOf(), &stride, &offset);

    // Creating the pixel shader
    ComPtr<ID3D11PixelShader> pixel_shader;
    ComPtr<ID3DBlob> blob;
    hr = D3DReadFileToBlob(L"PixelShader.cso", &blob);
    CHECK_FAIL(hr) {
        OutputDebugString("Failed to read the pixel shader.\n");
        return 0;
    }

    hr = device->CreatePixelShader(
        blob->GetBufferPointer(),
        blob->GetBufferSize(),
        0,
        &pixel_shader
    );
    CHECK_FAIL(hr) {
        OutputDebugString("Failed to create the pixel shader.\n");
        return 0;
    }
    // Binding the pixel shader
    context->PSSetShader(pixel_shader.Get(), 0, 0);

    // Creating the vertex shader
    ComPtr<ID3D11VertexShader> vertex_shader;
    hr = D3DReadFileToBlob(L"VertexShader.cso", &blob);
    CHECK_FAIL(hr) {
        OutputDebugString("Failed to read the vertex shader file.\n");
        return 0;
    }
    hr = device->CreateVertexShader(
        blob->GetBufferPointer(),
        blob->GetBufferSize(),
        0,
        &vertex_shader
    );
    CHECK_FAIL(hr) {
        OutputDebugString("Failed to create the vertex shader.\n");
        return 0;
    }
    // Binding the vertex shader
    context->VSSetShader(vertex_shader.Get(), 0, 0);

    // Creating the input layout
    ComPtr<ID3D11InputLayout> input_layout;
    const D3D11_INPUT_ELEMENT_DESC input_layout_desc[] = {
        {
            "Position",
            0,
            DXGI_FORMAT_R32G32_FLOAT,
            0,
            0,
            D3D11_INPUT_PER_VERTEX_DATA,
            0
        }
    };
    hr = device->CreateInputLayout(
        input_layout_desc,
        (UINT)std::size(input_layout_desc),
        blob->GetBufferPointer(),
        blob->GetBufferSize(),
        &input_layout
    );
    CHECK_FAIL(hr) {
        OutputDebugString("Failed to create the input layout.\n");
        return 0;
    }
    // Binding the input layout
    context->IASetInputLayout(input_layout.Get());

    // Creating a viewport
    D3D11_VIEWPORT viewport;
    viewport.Width = 800;
    viewport.Height = 600;
    viewport.MinDepth = 0;
    viewport.MaxDepth = 1;
    viewport.TopLeftX = 0;
    viewport.TopLeftY = 0;
    // Binding the viewport
    context->RSSetViewports(1, &viewport);

    // Setting the draw mode / topology
    context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

    MSG message;
    while (running) {
        if (PeekMessageA(&message, window, 0, 0, PM_REMOVE)) {
            TranslateMessage(&message);
            DispatchMessage(&message);
        }
        else {
        }

        context->ClearRenderTargetView(target.Get(), color);
        context->Draw(3, 0);
        // Getting the error info from Present()
        CHECK_FAIL(hr = swap_chain->Present(1, 0)) {
            if (hr == DXGI_ERROR_DEVICE_REMOVED) {
                hr = device->GetDeviceRemovedReason();
                _com_error err(hr);
                OutputDebugString("\n");
                OutputDebugString(err.ErrorMessage());
            }
            else {
                _com_error err(hr);
                OutputDebugString("\n");
                OutputDebugString(err.ErrorMessage());
            }
        }
        Sleep(1);
    }
    return 0;
}

Here is the vertex shader code:
float4 main(float2 pos : Position) : SV_Position
{
    return float4(pos.x, pos.y, 0.0f, 1.0f);
}

And here is the pixel shader code:
float4 main() : SV_Target
{
    return float4(1.0f, 0.0f, 0.0f, 1.0f);
}

Finally, this the output window:
'D3D.exe' (Win32): Loaded 'C:\Users\alexb\source\repos\D3D\Debug\D3D.exe'. Symbols loaded.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\win32u.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32full.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp_win.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d3d11.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\D3DCompiler_47.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ucrtbased.dll'
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dxgi.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptsp.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DXCore.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\TextInputFramework.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreUIComponents.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreMessaging.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntmarta.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinTypes.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinTypes.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\WinTypes.dll'
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\iertutil.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DXGIDebug.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ResourcePolicyClient.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ResourcePolicyClient.dll'
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\umpdc.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvam.inf_amd64_2dd4c250764257ac\nvdlist.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\version.dll'
'D3D.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvam.inf_amd64_2dd4c250764257ac\nvdlist.dll'
'D3D.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvam.inf_amd64_2dd4c250764257ac\nvldumd.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imagehlp.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rsaenh.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcrypt.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvam.inf_amd64_2dd4c250764257ac\nvwgf2um.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
The thread 0x2a20 has exited with code 0 (0x0).
'D3D.exe' (Win32): Loaded 'C:\Program Files\NVIDIA Corporation\Ansel\Tools\NvCameraWhitelisting32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\shell32.dll'
'D3D.exe' (Win32): Unloaded 'C:\Program Files\NVIDIA Corporation\Ansel\Tools\NvCameraWhitelisting32.dll'
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d3d11_3SDKLayers.dll'. Cannot find or open the PDB file.
DXGI WARNING: IDXGIFactory::CreateSwapChain: Blt-model swap effects (DXGI_SWAP_EFFECT_DISCARD and DXGI_SWAP_EFFECT_SEQUENTIAL) are legacy swap effects that are predominantly superceded by their flip-model counterparts (DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL and DXGI_SWAP_EFFECT_FLIP_DISCARD). Please consider updating your application to leverage flip-model swap effects to benefit from modern presentation enhancements. More information is available at http://aka.ms/dxgiflipmodel. [ MISCELLANEOUS WARNING #294: ]
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\igdlh64.inf_amd64_28d80681d3523b1c\igd10iumd32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ncrypt.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntasn1.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\igdlh64.inf_amd64_28d80681d3523b1c\igc32.dll'. Cannot find or open the PDB file.
'D3D.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
The thread 0x3914 has exited with code 0 (0x0).
The thread 0x2ec0 has exited with code 0 (0x0).
The thread 0x2150 has exited with code 0 (0x0).
The thread 0x1714 has exited with code 0 (0x0).
The thread 0x262c has exited with code 0 (0x0).
The thread 0x1718 has exited with code 0 (0x0).
The thread 0x19e4 has exited with code 0 (0x0).
The thread 0x2790 has exited with code 0 (0x0).
The thread 0x2bc4 has exited with code 0 (0x0).
The thread 0x5f8 has exited with code 0 (0x0).
The thread 0x19fc has exited with code 0 (0x0).
The thread 0x1f88 has exited with code 0 (0x0).
The thread 0xbe0 has exited with code 0 (0x0).
The thread 0x1fb4 has exited with code 0 (0x0).
The thread 0x2928 has exited with code 0 (0x0).
D3D11 WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Producer at 0x0374E91C, Refcount: 2. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x0375A848, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BBB288, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BC153C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BC198C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BC1BB4, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BC1F14, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BA3344, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BC3068, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BC3B2C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BC84AC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BC8654, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BCC384, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BCA2BC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x00BCA9BC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x037BE304, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x037BE42C, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x0BCCD164, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live                         Object :     17 [ STATE_CREATION WARNING #0: UNKNOWN]
DXGI WARNING: Live Producer at 0x00B5FA2C, Refcount: 5. [ STATE_CREATION WARNING #0: ]
DXGI WARNING:   Live Object at 0x00B630E0, Refcount: 2. [ STATE_CREATION WARNING #0: ]
DXGI WARNING:   Live Object at 0x00BCC980, Refcount: 1. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live                         Object :      2 [ STATE_CREATION WARNING #0: ]
The program '[9440] D3D.exe' has exited with code 0 (0x0).

Any ideas for debugging or possible errors in my code are welcome.
Again, I apologize for how lengthy all the code is.
Thank you for you time!

A: Basically I wrote IAGetVertexBuffers instead of IASetVertexBuffers. Yep. Such an idiot.
If you're having problems with direct3d/directx you should totally check for this kind of stuff. Now it works.


text:
Q: Getting the url of an uploaded file in django admin I have an application in which I am uploading a file using Django's admin site. I need to return the url of the file so that it can be used by another function. The process works just fine apart from the fact that I am able to get the name of the original file and not the file that is saved by the application. For instance if the file to be uploaded is named somefile.xxx and django saves it as somefile_1.xxx because that somefile.xxx already exists on the server I am not able to return somefile_1.xxx but I am geting the original file name. this is my code at the moment.
admin.py
def add_view(self, request, form_url="", extra_context=None):
        ...

        ModelForm = self.get_form(request)
        if request.method == 'POST':
            form = ModelForm(request.POST, request.FILES)
            if form.is_valid():
                url = MEDIA_URL+'files/'+request.FILES['filename'].name
                url = iri_to_uri(url)
                title = form.cleaned_data['title']
                name = request.FILES['filename'].name
                newname = os.path.splitext(request.FILES['filename'].name)[0]
                data = utils.convert(url, title, newname)
                print data

        return super(FileAdmin, self).add_view(request, form_url="", extra_context=extra_context)

Solution:
def save_model(self, request, obj, form, change):

        ...

        obj.save()

        url = obj.video.url

        title = obj.title

        newname = str(obj.id)

        data = utils.convert(url, title, newname)
        print data

A: FileField has an url function to retrieve exactly what you want i guess
https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FileField.storage
See the point 3 under the storage section

A: The add_view is pre save - so the files should be in memory and thus no filenames should be set yet.
You'd need to override ModelAdmin.save_model and access the file after calling obj.save() to account for the possibility that django renamed your file.


text:
Q: android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference.
public class MainActivity extends AppCompatActivity {

    Button yrebtn;
    Button yrebtn1;
    Button yrebtn2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        yrebtn = (Button) findViewById(R.id.yrebtn);
        yrebtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, MainActivity1.class);
                startActivity(intent);
            }
        });

        yrebtn1 = (Button) findViewById(R.id.yrebtn1);
        yrebtn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, MainActivity2.class);
                startActivity(intent);
            }
        });

        yrebtn2 = (Button) findViewById(R.id.yrebtn2);
        yrebtn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, MainActivity3.class);
                startActivity(intent);
            }
        });
    }
}


text:
Q: Add up two array variables I have $product['price'] and $option['price'] and I want to add these two together and echo the result. These are in two separate arrays eg $product = array { price => 1 } and $option = array { price => 1 }
Is this possible?

A: For one option, like you mentioned:
$total = $product['price'] + $option['price'];
echo $total;

For multiple options, assuming you have an array of $options:
$total = $product['price'];
foreach ($options as $option) {
    $total = $total + $option['price'];
}
echo $total;

A: $sum = $product['price'] + $option['price'];

if there are many prices, like $option['price'][0], $option['price'][1] and so on, then to add all the prices, we can do the following:
$sum = $product['price'];
foreach ($option['price'] as $key => $value) {
    $sum = $sum + $value;
}

echo $sum;


text:
Q: Tunnelblick OpenVPN client on x64 Snow Leopard? Apparantly the Tunnelblick OpenVPN client doesn't work on x64 Snow Leopard.  Does anyone have a workaround or know of a timeline when it will be updated?

A: If you have the nine bucks to spare, Viscosity is superior in any way. It does even import your old Tunnelblick connections.