text:
Q: Why might Roger Penrose argue that Godel's incompleteness theorem(s) suggest that consciousness is non-algorithmic?
This past March, when I called Penrose in Oxford, he explained that his interest in consciousness goes back to his discovery of Gödel's incompleteness theorem while he was a graduate student at Cambridge. Gödel's theorem, you may recall, shows that certain claims in mathematics are true but cannot be proven. "This, to me, was an absolutely stunning revelation," he said. "It told me that whatever is going on in our understanding is not computational."
–"Roger Penrose On Why Consciousness Does Not Compute" (2017-05-04)

Why might Roger Penrose think/suggest that Godel's incompleteness theorem(s) show that consciousness is non-algorithmic?
Clearly in this case answers can be speculative... (soft question)

A: I'll give a simplified version of Penrose's reasoning.
In a sense this goes back to the "liar paradox" that has been known for thousands of years. Suppose I say "I'm lying"; then that should mean that I am telling the truth; but that would mean that I am lying. Statements that refer to themselves, or which refer to each other in circles, can create unresolvable contradictions.
Analogous paradoxes can be constructed for mathematics and computation.
You can have a computer program which predicts whether another computer program will eventually stop running, or run forever; and then it has a nemesis program which contains a copy of the prediction program and always does the opposite of what it predicts. The prediction program inherently cannot win. Either it makes no prediction, or it makes the wrong prediction.
Godel did something similar for a theorem-proving program. He was able to encode how the program works in arithmetic, and then write down an equation which implies that "The theorem prover says this equation is false". This nemesis sentence of the theorem prover is called the Godel sentence. Either the theorem prover "has no opinion" about whether the Godel sentence is true or false, or it gets caught in contradiction.
This is the incompleteness theorem. If the prover is always correct, it must avoid taking sides on Godel sentences, or else it will fall into contradiction. To remain consistent in its assertions, its power to deduce the truth must be incomplete.
The Godel sentence is possible because ordinary computation can be reduced to arithmetic operations on zeroes and ones, so facts about what a computer can and cannot do, can be expressed in arithmetic. However, you could have a special computer which, in addition to the usual logic gates, has a magic component which correctly outputs the answer to problems like "does this program halt" or "is this Godel sentence true". Mathematically, the magic component computes a function - it takes an input and produces an output - but it is not a function that can be implemented using arithmetic operations. Such a function can be called an oracle function.
Now consider the capacity of the human brain to reason about mathematics, under the assumption that the human brain follows laws of physics. The known laws of physics involve computable functions. One might then conclude that there must be Godel sentences for the human brain too, mathematical statements which, even if true, are beyond the power of human reasoning.
Penrose chose the other option. Human beings can reason correctly about Godel sentences, therefore the human brain must be able to employ oracle functions, and so physics must contain processes which require oracle functions for their definition. His concrete proposal (elaborated with Hameroff) is that human cognition employs quantum entanglement in the brain, and that quantum dynamics (especially the collapse of the wavefunction) is determined by subtle quantum-gravitational effects governed by an oracle-function law.

A: Penrose has long been an advocate of the non-computational view of consciousness, and he is famous in this regard for advocating the supposed quantum mechanical nature of consciousness. Of course, this has given cover to woo-hoo artists, i.e. Deepak Chopra. But Penrose tried to actually present an argument based on Godel's incompleteness theorems, as you stated, yet all of these arguments rest on faulty assumptions.
This article covers the history of Penrose's argument well (he was not the original author of the idea, and his ideas about it changed over the years), and gives a good survey for the various reasons Penrose thinks consciousness is non-computational. Penrose's arguments can be posed in various ways, but essentially they rest on the idea that consciousness emerges from some kind of heuristic abstraction inexpiable by classical physics. Similar to how intuitionist mathematics views math as an art, a non-linear, non-computational process, Penrose suggests something similar is at work with consciousness.

Why Penrose think/suggest that Godels incompleteness theorem(s) show that consciousness is non-algorithmic?

In the link above, the author states,

This is the clearest and most succinct formulation of the argument I know of): (1) suppose that "my reasoning powers are captured by some formal system F," and, given this assumption, "consider the class of statements I can know to be true."  (2) Since I know that I am sound, F is sound, and so is F', which is simply F plus the assumption (made in (1)) that I am F (incidentally, a sound formal system is one in which only valid arguments can be proven).  But then (3) "I know that G(F') is true, where this is the Gödel sentence of the system F'" (ibid).  However, (4) Gödel's first incompleteness theorem shows that F' could not see that the Gödel sentence is true.  Further, we can infer that (5) I am F' (since F' is merely F plus the assumption made in (1) that I am F), and we can also infer that I can see the truth of the Gödel sentence (and therefore given that we are F', F' can see the truth of the Gödel sentence). That is, (6) we have reached a contradiction (F' can both see the truth of the Gödel sentence and cannot see the truth of the Gödel sentence).  Therefore, (7) our initial assumption must be false, that is, F, or any formal system whatsoever, cannot capture my reasoning powers.

For a specific rebuke of the whole idea, Max Tegmark's paper here demonstrates that the hypothesis of quantum mechanical origin for consciousness suffers from the decoherence of the quantum state at body temperature. Thus, quantum mechanics alone, as we understand it, does not produce consciousness in humans.


text:
Q: How to Fill Tab Item Area with WPF Grid How does one get a grid to fill the lower portion of a tab item and make is size correctly? (personally I would call that area the page). As it stands right now I have a grid at my layout root and then a tab control with several tabs on it. I have tried to drag and drop a grid onto the tab control; however, it it's always set to the fixed size that I initially created it for.
  <Grid x:Name="LayoutRoot" Margin="0,0,-1,0" Grid.IsSharedSizeScope="True">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="4*"/>
        <ColumnDefinition Width="1497*"/>
        <ColumnDefinition Width="116*"/>
        <ColumnDefinition Width="36*"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="101*"/>
        <RowDefinition Height="24*"/>
        <RowDefinition Height="5*"/>
        <RowDefinition Height="27*"/>
        <RowDefinition Height="597*"/>
        <RowDefinition Height="0*"/>
    </Grid.RowDefinitions>
    <Rectangle Grid.ColumnSpan="4" Fill="#FF080808" Margin="-1,0,0,0" Stroke="#FF0061FF" Grid.RowSpan="3"/>
    <Image Source="LP_Script Logo_black.jpg" Margin="32,18,1206,27" Grid.Column="1" Stretch="Fill" MinWidth="250" MinHeight="56" ScrollViewer.CanContentScroll="True"/>
    <TextBox x:Name="ProgramSearchTextBox" TextWrapping="Wrap" Text="" KeyDown="ProgramSearchTextBox_KeyDown" PreviewKeyDown="ProgramSearchTextBox_PreviewKeyDown" Margin="2,1,2,0" HorizontalContentAlignment="Right" Grid.Column="2" Grid.Row="1" />
    <TabControl x:Name="mainMenuTabControl" VerticalAlignment="Stretch" Height="Auto" Width="Auto" PreviewKeyDown="mainMenuTabControl_PreviewKeyDown" Grid.ColumnSpan="4" Margin="-1,0,1,0" Grid.Row="3" BorderThickness="1,1,1,0" Grid.RowSpan="3">
        <TabItem x:Name="homeTab" Header="Home">
            <TabItem.Background>
                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                    <GradientStop Color="#FFF3F3F3" Offset="0"/>
                    <GradientStop Color="#FFEBEBEB" Offset="0.5"/>
                    <GradientStop Color="#FFC1C0C0" Offset="1"/>
                </LinearGradientBrush>
            </TabItem.Background>
            <DockPanel Height="Auto" Width="Auto" d:IsHidden="True">
                <Grid x:Name="dashboard" Background="#FFE5E5E5" RenderTransformOrigin="0.5,0.5" Width="1636">
                    <Grid.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleY="-1" ScaleX="-1"/>
                            <SkewTransform/>
                            <RotateTransform Angle="180"/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Grid.RenderTransform>
                </Grid>
            </DockPanel>
        </TabItem>
        <TabItem x:Name="fileMaintTab" Header="File Maintenance" KeyDown="fileMaintTab_KeyDown">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="0*"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0*"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="336*"/>
                    <ColumnDefinition Width="1316*"/>
                </Grid.ColumnDefinitions>
                <TreeView x:Name="FileMaintTreeView" Background="#FF747474" BorderThickness="1,1,5,1" BorderBrush="#FF0090FD" SelectedItemChanged="FileMaintTreeView_SelectedItemChanged" RenderTransformOrigin="0.5,0.5" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" Margin="0,0,1,0">
                    <TreeView.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </TreeView.RenderTransform>

A: Here is a small example to demonstrate this for you:
<Grid>
    <TabControl>
        <TabItem Header="Whole Row Tab">
            <Grid Background="Blue">
                <TextBlock Text="I'm in the whole of this tab" />
            </Grid>
        </TabItem>
        <TabItem Header="Half Row Tab">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid Grid.Row="1" Background="Red">
                    <TextBlock Text="I'm in the bottom half of this tab" />
                </Grid>
            </Grid>
        </TabItem>
        <TabItem Header="Another Half Row Tab">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid Grid.Row="1" Background="Red">
                    <TextBlock Text="I'm in the bottom half of this tab" />
                </Grid>
            </Grid>
        </TabItem>
        <TabItem Header="Varied Row Tab">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid Grid.Row="0" Background="Green">
                    <TextBlock Text="I'm in the top quarter of this tab" />
                </Grid>
                <Grid Grid.Row="3" Background="Green">
                    <TextBlock Text="I'm in the bottom quarter of this tab" />
                </Grid>
            </Grid>
        </TabItem>
    </TabControl>
</Grid>

A: For the Grid underneath your TabItem, try setting up your definitions, like this:
<Grid.RowDefinitions>
    <RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
    <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

For your TreeView definition, I changed it to the following:
<TreeView x:Name="FileMaintTreeView" Background="#FF747474" BorderBrush="#FF0090FD" SelectedItemChanged="FileMaintTreeView_SelectedItemChanged" Grid.Column="0" Grid.Row="0">

(I removed things like margins and whatnot, you can put them back in if you want...
That will at least get your TreeView to fill up the entire TabItem.
If you wanted the TabItem to have something else on the page... let's say some control next to the TreeView, then you can add another ColumnDefinition. Width="*" means it will fill up the entire remaining space. Width="Auto" means it will only fill the size of the controls nested within that column/row.

A: For me, finally I found reason from TabControlStyle.xaml(which is a style file), by adding following settings:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style x:Key="TabControlStyle" TargetType="{x:Type TabControl}">
        <Style.Resources>
            <Style TargetType="{x:Type TabItem}">

                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="VerticalContentAlignment" Value="Stretch"/>

                </Setter>
            </Style>
        </Style.Resources>

    </Style>
</ResourceDictionary>

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I use JavaScript in my  options list? How do I use
          <select>
          <option>numbers1-100</option>
          </select>

I have to use 1 to 100 numbers in my option list.Typing all the options takes time and makes code bigger.I guess we have to use javascript to make it work using for loop and document write.But I dont know how to put the code in the right way.How do i list the options list using java script? I mean the java script should be beside my label;example
        number : 1-1oo \\ here the options list should be printed

and number can be anywhere but the script should print options list beside  the number.How do i make it ? Unable to figure it out.Been trying from an hour or so.

A: Place this function in your <script> tags or include it within a script. Than call the function, createSelectOption() whenever you need the select box to be created.
Here is how you would have it loaded on page load with just javascript: `

function createSelectOption() {
    var select_option = '<select>';
    for(i = 1; i <= 100; i++) {
       select_option += '<option value=' + i + '>' + i + '</option>';
    }
    select_option += '</select>';
    document.getElementById('div').innerHTML = select_option;
}

I have included a jsfiddle demo to show you that it should be working/

A: You shouldn't really use javascript for this, it would usually be better using a server-side language such as php. You could use a for loop or a while loop to do this quite easily

A: Here's one way to do this.
http://jsfiddle.net/ryh7k/1/
var selectEle = document.getElementById('mySelect'),
    optionEle = undefined;

for (var i=1;i<=100;i++) {
    optionEle = document.createElement('option');
    optionEle.setAttribute('value', i.toString());
    optionEle.innerText = i.toString();
    selectEle.appendChild(optionEle);
}

A: Simplest case:
<select>
<script>
for (var i = 1; i < 101; i++) {
document.write('<option value="'+i+'">'+i+'</option>');
}
</script>
</select>

But there are of course problems with this. First, people without JS will not see any options and having a SCRIPT tag inside a SELECT is not that nice either.
<select id="container"></select>
<script>
var s = document.getElementById('container');
var opts = '';
for (var i = 1; i < 101; i++) {
    opts += '<option value="'+i+'">'+i+'</option>';
}
s.innerHTML = opts;
</script>


text:
Q: For loop and 'numpy.float64' object is not iterable error I have a simple for loop to calculate RMS(root mean square) which is defined in sigma summation form:
for i in range(int(N-(n*periyot/delta)), N+1):
    sum = np.sqrt((1 / N) * (sum((Cl[i]**2))))

Then I got this error:
TypeError: 'numpy.float64' object is not iterable

Here are some information about my definitons:
N=40000, n=10.0, periyot=6.451290, delta=0.005

Cl=[-21.91969   -12.452671   -7.928303  ...,  -0.0833991  -0.0579686
  -0.0823822]

A: Remove that sum, each element of Cl is a float so you can't possibly call sum on them:
>>> sum(2.4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'float' object is not iterable

If you intend to invoke numpy's broadcasting to perform the power operation then you don't need to index the array.

A: The problem is that you overwrite sum function with sum variable. Try something like this:
my_sum = 0
for i in range(int(N-(n*periyot/delta)), N+1):
    my_sum += np.sqrt((1 / N) * (sum((Cl[i]**2))))

A: Replicating your calculation, a bit simplified:
In [1]: Cl = np.array([-21.91969  , -12.452671 ,  -7.928303 ,  -0.0833991,-0.0579686,-0.0823822])

To calculate a sum in a loop, initial a value, and add to it at each iteration:
In [2]: res = 0
In [3]: for i in range(len(Cl)):
   ...:    res += np.sqrt((1/3)*Cl[i]**2)
   ...:
In [4]: res
Out[4]: 24.551481812296061

Letting numpy calculate everything (slightly different)
In [5]: np.sqrt((1/3)*Cl**2).sum()
Out[5]: 24.551481812296064

Your range is a little more complicated, but I think that can be accommodated with:
s, e = int(N-(n*periyot/delta)), N+1  # start, end of range

for i in range(s, e): ....

or
np.sqrt((1/N) * Cl[s:e]**2).sum()

But I wonder why you started with that sum((Cl[i]**2))).  Where you hoping to square a range of Cl values and then sum them?  And repeat that for multiple ranges?
=============
There's a np.sum and a Python sum.  Python sum works nicely with a list of numbers, such as those generated by a list comprehension:
In [6]: [np.sqrt((1/3)*Cl[i]**2) for i in range(len(Cl))]
Out[6]:
[12.655338922053147,
 7.1895529539798462,
 4.5774078712669173,
 0.048150492835172518,
 0.03346818681454574,
 0.047563385346433583]

In [7]: sum([np.sqrt((1/3)*Cl[i]**2) for i in range(len(Cl))])
Out[7]: 24.551481812296061

The errors that result from trying to apply sum to a single value:
In [9]: sum(Cl[0])
....
TypeError: 'numpy.float64' object is not iterable
In [10]: sum(12.234)
...
TypeError: 'float' object is not iterable

In [11]: sum(Cl[:3])     # sum of several items
Out[11]: -42.300663999999998

==========
 RMS = ( (1 / N ) * (Cl[1]^2 + Cl[2]^2 + Cl[3]^2 + ... Cl[N]^2) ) ^0.5

is expressed, for lists as:
 rms = (1/n) * math.sqrt(sum([Cl[1]**2, Cl[2]**2, ....]))
 rms = (1/n) * math.sqrt(sum([Cl[i]**2 for i in range(len(Cl))]))
 rms = (1/n) * math.sqrt(sum([c**2 for c in Cl]))   # iterate on Cl directly
 rms = (1/n) * np.sqrt(np.sum(Cl**2))     # for array Cl


text:
Q: AvalonDock 2.0 Floating Window looses maximized state on MainWindow minimize / restore I am trying to achieve a VS style MainWindow + docking content host on secondary monitors. Avalon dock does the job gracefully.
Until minimizing the window, that is.
Upon restore, the maximized 'docking host"(LayoutAnchorablePane) resets it's size and location to the pre-maximizing ones.
This is because when maximizing an avalon dock LayoutAnchorablePane, the Property Changed event doesn't fire. Also, the floating width property doesn't get updated.
This is why my first try __
    public Window3()
    {
        InitializeComponent();

        // Intercept the minimize event and cancel it.
        this.SourceInitialized += OnSourceInitialized;

    }

    private void OnSourceInitialized(object sender, EventArgs e)
    {
        var source = (HwndSource)PresentationSource.FromVisual(this);
        if (source != null) source.AddHook(HandleMessages);
    }

    //These store the location and size of Left - the Layout Anchorable to be placed on a sec monitor
    private Point _location;
    private Size _size;

    private IntPtr HandleMessages(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
    {
        if (msg != 0x0112 || ((int) wParam & 0xFFF0) != 0xF020) return IntPtr.Zero;
        //This means a minimize for the Main Window. Cancel it.
        handled = true;
        //Get the sec monitor anchorable size and location
        _location = new Point(Left.FloatingLeft, Left.FloatingTop);
        _size = new Size(Left.FloatingWidth, Left.FloatingHeight);

        //finally minimize the window
        WindowState = WindowState.Minimized;

        return IntPtr.Zero;
    }

    private void Window3_OnStateChanged(object sender, EventArgs e)
    {
        //Restore the width and location for the sec monitor anchorable
        // Fail. Cry. Cry a lot...
        if (WindowState == WindowState.Maximized)
        {
            Left.FloatingLeft = _location.X;
            Left.FloatingTop = _location.Y;
            Left.FloatingWidth = _size.Width;
            Left.FloatingHeight = _size.Height;
        }
    }

__ doesn't work.
These maximize / restore events are unreachable. They're stored in Controls/Shell/SystemCommands.cs
    public static void MaximizeWindow(Window window)
    {
        Verify.IsNotNull(window, "window");
        _PostSystemCommand(window, SC.MAXIMIZE);
    }

    private static void _PostSystemCommand(Window window, SC command)
    {
        IntPtr hwnd = new WindowInteropHelper(window).Handle;
        if (hwnd == IntPtr.Zero || !NativeMethods.IsWindow(hwnd))
        {
            return;
        }

        NativeMethods.PostMessage(hwnd, WM.SYSCOMMAND, new IntPtr((int)command), IntPtr.Zero);
    }

I've read some tips on avalondock's codeplex discussion but I think they applied to previous versions and were no longer valid.
I am thinking of using user32 GetWindowRect and SetWindowPos to get the location and size on minimize and restore it on maximize.
But, i simply have no ideea how to get the handle for the floating anchorables.
Any suggestion , on the floater handle or otherwise, will be greatly appreciated.
Thank you for your time.

A: I also had the same issues (also visible in the WPF Toolkit sample) and found a solution !
The general idea is to ignore WindowState changes sent by Windows and always restore internal state :
protected override void OnStateChanged(EventArgs e)
{
    // Windows sometimes send unwanted state changes (when minimizing application for instance)
    // We force internal state to be used
    WindowState = IsMaximized ? WindowState.Maximized : WindowState.Normal;
    base.OnStateChanged(e);
}

The WM_SYSCOMMAND was not well handled (the 0xFFF0 mask was missing) :
case Win32Helper.WM_SYSCOMMAND:
    int command = (int)wParam & 0xFFF0;
    if (command == Win32Helper.SC_MAXIMIZE || command == Win32Helper.SC_RESTORE)
    {
        UpdateMaximizedState(command == Win32Helper.SC_MAXIMIZE);
    }

I also updated the UpdateMaximizedState to also change internal state:
void UpdateMaximizedState( bool isMaximized )
{
    foreach( var posElement in Model.Descendents().OfType<ILayoutElementForFloatingWindow>() )
    {
        posElement.IsMaximized = isMaximized;
    }
    IsMaximized = isMaximized;
    WindowState = isMaximized ? WindowState.Maximized : WindowState.Normal;
}

As a side note, IsMaximized is now a get / set property :
public bool IsMaximized
{
    get { return (bool)GetValue(IsMaximizedProperty); }
    set
    {
        SetValue(IsMaximizedProperty, value);
        UpdatePositionAndSizeOfPanes();
    }
}

And that's it !

A: Julien Richard is right and for those who are facing the same issue, but doesn't know where to go in the AvalonDock source code for fixing it, I would like to point to the detailed solution reported here:
http://wpftoolkit.codeplex.com/workitem/22296
There are different scenarios where the Maxmimized state of a LauoutFloatingWindowControl will fail in AvalonDock depending on its version for example:

*

*when an AvalonDock layout is deserialized

*when the main window is restored from the taskbar

*when dragging a maximized floating window

In my case, I've noticed the issue in AvalonDock v.2.6 and by following the istructions linked above along with checking the latest version of the file here in the repository I resolved the issue.


text:
Q: Formatting/separating names and dates from a string in java? So essentially what I want to do here is read in a text file line by line and format them like this:
Last name,   Title,   First name,   Middle  and then the birth/death date like MM/DD/YYYY
I read in dates like this:
Month, day, year
Mon.  day, year
Mon  day,  year
MMDDYY
M/D/year
M-D-year

and names like this:
Last,   Title   First   Middle  (comma after name needed)

OR
Title   First   Middle   Last

I've been working at this for a really long time and just cannot figure it out. Below is my pretty messy code that's been through a lot of changes in a desperate attempt to figure this out, thank you for your time anybody who wants to help me out (I'm a student) also here's an example of names that are read in:
Roger  Veium  MAY     12,  1908        JUNE 2, 1984
McDermott, James   D.     Jan.    4,  1914      Jul  1, 1970
Amy  Chamberlain   Sep.     28, 1975   09-06-95
Gross,  Adam M. 01-03-77
Joseph Lisota  April    9,  1964
Joseph   W. Eisel Sep   3, 1990

Code:
public String[] readLines(String filename) throws IOException {
    FileReader fileReader = new FileReader(filename);
    BufferedReader bufferedReader = new BufferedReader(fileReader);
    List<String> lines = new ArrayList<String>();
    List<String> names = new ArrayList<String>();
    String line = null;
    String name = "";
    int i;
    int ind;
    int indTemp;
    int indTemp2;
    boolean flag = false;
    String[] monthsLong = {"JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"};
    String[] monthsLongR = {" 01", "02", " 03", "04", "05", "06", "07", "08", " 09", "10", "11", "12"};
    String[] monthsLow = {"JAN\\.", "FEB\\.", "MAR\\.","APR\\.", "MAY", "JUN\\.", "JUL\\.", "AUG\\.", "SEP\\.", "OCT\\.", "NOV\\.", "DEC\\."};
    String[] monthsCaps = {"   JAN", "FEB", " MAR", "APR", "MAY", "JUN", "JUL", "AUG", " SEP", "OCT", "NOV", "DEC"};

    while ((line = bufferedReader.readLine()) != null) {
        line = line.replaceAll("null", "");
        line = line.replaceAll("-","/");
        line = line.toUpperCase() ;

        for(i = 0; i<12; i++)
        {
            line = line.replaceAll(monthsLong[i], monthsLongR[i]);
        }

        for(i = 0; i<12; i++)
        {
            line = line.replaceAll(monthsLow[i], monthsLongR[i]);
        }

        for(i = 0; i<12; i++)
        {
            line = line.replaceAll(monthsCaps[i], monthsLongR[i]);
        }

        line = line.replaceAll("\\s+", " ");
        if (Character.toString(line.charAt(0)).equals(" "))
            line = line.replaceFirst(" ", "");

 /*     name = line;

        ind = name.indexOf(".");
        indTemp = name.indexOf("0");
        indTemp2 = name.indexOf("1");

        if (ind > -1) {
            System.out.println(" period");
            ind = ind + 1;
            flag = true;
        }
        if(flag == false) {
            if(indTemp2 > indTemp){
                ind = indTemp2 -1;
                System.out.println(" 1");
            }
            if (indTemp > indTemp2){
                ind = indTemp - 1;
                System.out.println(" 2");
            }
        }
        flag = false;
    */
        // name = name.substring(0,ind);

        lines.add(line);
    }
    bufferedReader.close();
    return lines.toArray(new String[lines.size()]);
}

A: Ok, so then the only other way is go line by line and create a rule list for each different line format. There are some duplicates but there are many lines that are very different from others. Then you loop through the lines as you are doing and look for rule pointers so that you can apply that rule to the line.
As far as I can see, that is the best way to do this. I have had experience in these files and they can be a nightmare if not handled properly. While working through the rules, you may actually find a pattern that you can use, which is often the case.
I hope this helps.


text:
Q: How SBC instruction works in this case? Why the value of c flag is 0 in this case?
SEC
LDA #0
SBC #1

Since the C flag is 1 then borrow is 0 shouldn't the C flag remain 1

A:
The carry works as an inverse borrow. i.e., to subtract, first set the carry. If the carry is cleared by the operation, a borrow has occurred.

c64os.com instruction set

A: Normally x - y = x + (-y) = x + ~y + 1
Documentation says the carry bit is a not borrow, and to set to 1 for a normal subtract, so the carry in is not inverted on this architecture (some architectures the carry bit is a borrow if 1 and is inverted on the way into an sbc).
so 0 - 1 = 0 + 0xFE + 1
         1
  00000000
+ 11111110
==========

fill it in
 000000001
  00000000
+ 11111110
==========
  11111111

result 0xFF, carry out is 0 which indicates a borrow.


text:
Q: JAX-RS @PathParm which contains multiple slashes (some path) I need to pass value with multiple slashes as "somePath" @PathParam. Let's say I always need that param in each of endpoint methods.
Is it possible to achieve next endpoints:
@Path("/v1/demo/{somePath: .*}")
public class DemoController {

  @GET
  public Response getPath(@PathParam("somePath") String somePath) {
    return Response.status(200).entity(somePath).build();

    // GET /v1/demo/path/goes/here => should return "path/goes/here" => this works
  }

  @GET
  @Path("/{id}")
  public Response getId(@PathParam("somePath") String somePath, @PathParam("id") int id) {
    // some logic with somePath
    return Response.status(200).entity(id).build();

    // GET /v1/demo/path/goes/here/1 => should return 1 => not working
  }

  @GET
  @Path("/{id}/{name}")
  public Response getName(@PathParam("somePath") String somePath, @PathParam("id") int id, @PathParam("name") String name) {
    // some logic with somePath
    return Response.status(200).entity(name).build();

    // GET /v1/demo/path/goes/here/1/myName => should return "myName" => not working
  }

}


text:
Q: SharePoint Online - Get User Information & Location I have built a powerapp form for requesting access to certain groups. This app is then submitted into the SharePoint list. In this list it stores the information based on the user who has created the information however there is a need to find out where the user is located globally as a power bi report will be built based on the requests submitted.
How can this be possible? If you need to call to a rest api where could this be done? As i am new to rest api's. How can the information be stored into the list? Or does this need to be separate?
Thanks

A: Now I haven't been using powerapps a lot, but I beleive they do trigger normal Designer workflows. If that's the case you could create a workflow which hits this endpoint with the user id:
/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='i:0%23.f|membership|xx@siteurl.onmicrosoft.com'

From there it should be possible to get the user location - provided the location field is in fact filled out. Then you can update the item itself with the information.
You will have to fiddle a bit with it though, but it shouldn't be too complicated. For reference on how to trigger the rest api from a workflow take a look here: https://cann0nf0dder.wordpress.com/2017/06/25/sharepoint-designer-2013-workflows-and-get-rest-api/


text:
Q: Apollo Server - how to create and add object in resolver when type isn't available in namespace In the following example, I am attempting to create a post and add it to the Dictionary 'post'. How is the Mutation expected to create, add to the hash, and return the type of the item created when the item type isn't available to the namespace of the resolver?
mutation createPost {
  createPost(input: {name: "Post Name"}){
    name
  }
}

index.js:
const { ApolloServer, gql } = require('apollo-server');
const dictionary = {};
const typeDefs = gql`

    input PostSpecInput {
        name: String
    }

    type PostSpec {
        id: ID!
        name: String
    }

    type Mutation {
          createPost(input: PostSpecInput): PostSpec
    }

    type Query {
        post_specs: [PostSpec]
    }
`;

const resolvers = {
    Query: {
        post_specs: () => Object.keys(dictionary).map(function(key){
            return dictionary[key];
        })
    },
    Mutation: {
        createPost(parent, args, context, info) {
            var id = require('crypto').randomBytes(10).toString('hex');
                const postSpec = new PostSpec(id, args.input);
                posts_mock_database[id] =  args.input;
                return postSpec;
            }
      }
}

const server =  new ApolloServer({typeDefs, resolvers})

server.listen().then(({url}) => {
    console.log(`Server Ready at ${url}`);
})

Error:
{
  "errors": [
    {
      "message": "PostSpec is not defined",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "createPost"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "ReferenceError: PostSpec is not defined",
            "    at createPost (index.js:38:34)",

A: Type definitions are not classes nor object instances, they are just for enforcing type. Even if you were in the namespace, calling 'new' would not work. Here is the solution for your mock database:
 Mutation: {
        createPost(parent, args, context, info) {
            var id = require('crypto').randomBytes(10).toString('hex');
                const newPostSpec = { id: id, name: args.input.name }
                posts_mock_database[id] = newPostSpec;
                return newPostSpec;
            }
      }


text:
Q: how Express server can talk to React Js Component I am having express Server which needs to communicate with the React Component by passing a variable to the React JS Component.
Express server code:
app.all('/', ensureAuthenticated, function(req, res, next){
    var name = req.user['cn'];
    var emailaddress = req.user['emailaddress'];
    res.sendFile(BUILD+"/index.html");
});

Here ensureAuthenticated is the Single Sign-On function which authenticates the user before rendering the Page. I need to pass the name and emailaddress variables of the logged User to a React Component. How can I achieve this?
Thanks and Regards,
Ravi

A: you can't send a user object with sendFile but ideally what you can do is to send only the file as you did:
app.get('*', function(req, res){
    res.sendFile(BUILD+"/index.html");
});

and then on the react side  you can create an action creator to fetch the current user in the main component you have for example:
componentWillMount() {
   this.props.fetchUser();
}

the fetchUser action creator will be something like so:
export const fetchUser = () => async dispatch => {
    const res = await axios.get('/api/current_user');
    dispatch({ type: FETCH_USER, payload: res.data });
 };

and in your reducer you will have :
export default function(state = null, action) {
 switch (action.type) {
  case FETCH_USER:
     return action.payload || false;
  default:
    return state;
 }
}

and then you can setup a route handler in the express side for handling the react action :
app.get('/api/current_user', (req, res) => {
   res.send(req.user);
});

then in your react side you can save the user object in the localStorage
and then any route on the backend you want to make sure the user must be authenticated you can add your middleware ensureAuthenticated to the route handlers.
in my answer i assumed you're using redux-thunk and axios


text:
Q: Connect to Server using xamarin forms I'm developing Xamarin Cross platform application. I'm trying to connect to server (http://test.net/login/clientlogin), I need to send these fields (password = "xyz"; platform = iphone; (useremail) = "test@test.com";) along with the request. So that server will check these parameters and returns XML. But we don't know how to add these fields to the request.
When i open the above string url (http://*****/login/clientlogin) i am getting login screen, with in that we have username, password and platform text fields.
Thanks in advance!!!..

A: This should get you started presuming you are adding the values as headers in the request:
public class TestClient
{

    HttpClient client;

    public TestClient(){
        this.client = new HttpClient ();
    }

    public void AddHeadersAndGet(){
        client.DefaultRequestHeaders.Add ("username", "whatevertheusernameis");
        this.GetAsync<WhateverObjectTypeYouAreReceiving> ("theurloftheservice");
    }

    public async Task<T> GetAsync<T>(string address){
        HttpResponseMessage response = null;
        response = await client.GetAsync (address);
        if (response.IsSuccessStatusCode) {
            try {
                var responseString = await response.Content.ReadAsStringAsync ();
                return new T (Serializer.DeserializeObject<T> (responseString),
                    response.StatusCode);
            } catch (Exception ex) {

            }
        } else {

        }
    }
}

The key line for you is:
client.DefaultRequestHeaders.Add ("username", "whatevertheusernameis");


text:
Q: Does gitlab-runner or Docker cache the /builds Directory by Default? I am using gitlab-runner with Docker on my MacBook Pro. I'm using gitlab.com to host my git repositories. I have configured one repository to execute a pipeline whenever a commit has been pushed to the repo. The pipeline has two jobs: display some information, and clone a separate repository as a dependency.
Here is the output from the first job:
Running with gitlab-runner 12.2.0 (a987417a)
  on old_gen_runner 6fsjs96e
Using Docker executor with image gcc-arm_4_7-2013q3:3.0 ...
Using docker image sha256:5d4741a428654beb44a3c004822e4d2ceededc88f22ec1ec7f45dedf707a0302 for gcc-arm_4_7-2013q3:3.0 ...
Running on runner-6fsjs96e-project-13664495-concurrent-0 via my_laptop.local...
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/staging-fw/my-project/.git/
Created fresh repository.
From https://gitlab.com/staging-fw/my-project
 * [new branch]      master     -> origin/master
Checking out 722c2c38 as master...

Skipping Git submodules setup
$ python /scripts/info.py
Printing job info...

Builds dir: /builds

Commit Message:
Modified yml file.

Branch: master
Project dir: /builds/staging-fw/my-project
$ ls /builds
my-project

Here is the output from the second job:
Running with gitlab-runner 12.2.0 (a987417a)
  on old_gen_runner 6fsjs96e
Using Docker executor with image gcc-arm_4_7-2013q3:3.0 ...
Using docker image sha256:5d4741a428654beb44a3c004822e4d2ceededc88f22ec1ec7f45dedf707a0302 for gcc-arm_4_7-2013q3:3.0 ...
Running on runner-6fsjs96e-project-13664495-concurrent-0 via my_laptop.local...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/staging-fw/my-project/.git/
Checking out 722c2c38 as master...

Skipping Git submodules setup
$ git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/staging-fw/my-dependencies.git /builds/dependencies
Cloning into '/builds/dependencies'...
Job succeeded

As you can see, the first time the pipeline is created, it is successful.
If I run it again by pushing new changes, here is the output from the first job:
Running with gitlab-runner 12.2.0 (a987417a)
  on old_gen_runner 6fsjs96e
Using Docker executor with image gcc-arm_4_7-2013q3:3.0 ...
Using docker image sha256:5d4741a428654beb44a3c004822e4d2ceededc88f22ec1ec7f45dedf707a0302 for gcc-arm_4_7-2013q3:3.0 ...
Running on runner-6fsjs96e-project-13664495-concurrent-0 via my_laptop.local...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/staging-fw/my-project/.git/
From https://gitlab.com/staging-fw/my-project
   722c2c3..f321b75  master     -> origin/master
Checking out f321b75f as master...

Skipping Git submodules setup
$ python /scripts/info.py
Printing job info...

Builds dir: /builds

Commit Message:
Modified yml file.

Branch: master
Project dir: /builds/staging-fw/my-project
$ ls /builds
my-project
dependencies
Job succeeded

As you can see, the dependencies folder is still there? Not only that, but instead of saying Initialized empty Git repository as it did in the first run of the first job, it now says Reinitialized existing Git repository.
Here is what happens on the second job during the second run:
Running with gitlab-runner 12.2.0 (a987417a)
  on old_gen_runner 6fsjs96e
Using Docker executor with image gcc-arm_4_7-2013q3:3.0 ...
Using docker image sha256:5d4741a428654beb44a3c004822e4d2ceededc88f22ec1ec7f45dedf707a0302 for gcc-arm_4_7-2013q3:3.0 ...
Running on runner-6fsjs96e-project-13664495-concurrent-0 via my_laptop.local...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/staging-fw/my-project/.git/
Checking out f321b75f as master...

Skipping Git submodules setup
$ git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/staging-fw/my-dependencies.git /builds/dependencies
fatal: destination path '/builds/dependencies' already exists and is not an empty directory.
ERROR: Job failed: exit code 1

My questions are:

*

*Is the /builds directory created for each individual container in Docker? This was my original understanding, that each container within Docker would have its own separate /builds directory.

*Is the /builds directory shared for all Docker containers? I cannot find any information on this.
2a. If the /builds directory is shared for all Docker containers, then where is it and who created it?

A: The default Git strategy for GitLab CI/CD is 'fetch'. If the same static runner is used for the same pipeline over and over, GitLab won't do a fresh clone but will just fetch changes on subsequent runs.
If you want a fresh environment each time you want the 'clone' strategy. There are two ways you can change this behavior:

*

*Change the project default to 'clone' by going to project Settings -> CI/CD -> General pipelines -> Set 'Git strategy for pipelines' to git clone

*Change the strategy via .gitlab-ci.yml:

variables:
  GIT_STRATEGY: clone

You can learn more about this setting in the GitLab documentation - Git strategy

A:

*

*Is the /builds directory created for each individual container in Docker?
This was my original understanding, that each container within Docker
would have its own separate /builds directory.

Short answer: when using the docker executor, it depends on GIT_STRATEGY.
/builds is a docker volume, which is mounted from the host.
This is somehow mentioned in the doc:

*

*https://docs.gitlab.com/runner/executors/docker.html#the-builds-and-cache-storage

*https://docs.gitlab.com/runner/executors/docker.html#the-persistent-storage
Whether the volume persists or not depends on the GIT_STRATEGY of the job:

*

*if GIT_STRATEGY=="fetch" the volume persists and is shared with  successive single-use containers which run jobs (on this host, for this project).

*otherwise, the volume is considered "temporary" and removed at the end of the job.

This can be seen in  gitlab-runner's implementation:
func (e *executor) createBuildVolume() error {
    ...
    if e.Build.GetGitStrategy() == common.GitFetch {
        err = e.volumesManager.Create(e.Context, jobsDir)
        ...
    } else {
        err = e.volumesManager.CreateTemporary(e.Context, jobsDir)
    }
...
}

When your runner is building something, you can also inspect its container and find out which volumes are used (here on linux with gitlab-runner 14.10, running a job with GIT_STRATEGY=="fetch") :
# docker container ls
9c981d9ec900   7d926f4bcaec   "sh -c 'if [ -x /usr…"   8 minutes ago   Up 8 minutes             runner-dfciu5nh-project-3374-concurrent-0-b73d69d36b7291e4-build-2

# docker container inspect 9c981d9ec900 | jq .[0].Mounts
[
  {
    "Type": "volume",
    "Name": "runner-dfciu5nh-project-3374-concurrent-0-cache-3c3f060a0374fc8bc39395164f415a70",
    "Source": "/var/lib/docker/volumes/runner-dfciu5nh-project-3374-concurrent-0-cache-3c3f060a0374fc8bc39395164f415a70/_data",
    "Destination": "/cache",
    "Driver": "local",
    "Mode": "z",
    "RW": true,
    "Propagation": ""
  },
  {
    "Type": "volume",
    "Name": "runner-dfciu5nh-project-3374-concurrent-0-cache-c33bcaa1fd2c77edfc3893b41966cea8",
    "Source": "/var/lib/docker/volumes/runner-dfciu5nh-project-3374-concurrent-0-cache-c33bcaa1fd2c77edfc3893b41966cea8/_data",
    "Destination": "/builds",
    "Driver": "local",
    "Mode": "z",
    "RW": true,
    "Propagation": ""
  }
]

Hence, the docker volume named runner-dfciu5nh-project-3374-concurrent-0-cache-c33bcaa1fd2c77edfc3893b41966cea8 is mounted from /var/lib/docker/volumes/runner-dfciu5nh-project-3374-concurrent-0-cache-c33bcaa1fd2c77edfc3893b41966cea8/_data on the host to /builds in the container.

*Is the /builds directory shared for all Docker containers? I cannot find any information on this.

If GIT_STRATEGY=="fetch" the /builds volume does persist and is reused for subsequent builds of the same project. Note how the project id (3374 in my example) is in the volume name.
If you runner accepts several concurrent jobs, you runner might also have several /builds volumes per project (hence the concurrent id in the volume name).
If GIT_STRATEGY!="fetch", the volume does not persist and is not shared with any container.

2a. If the /builds directory is shared for all Docker containers, then where is it and who created it?

It is created by gitlab-runner itself, lazily (ie. if needed when running a given job).
By the way, in order to clear the build directory you can:

*

*use a GIT_STRATEGY different from "fetch".

*use GIT_STRATEGY=="fetch" and let gitlab-runner do it before running your job, when it checkouts the source. This is configurable with GIT_CLEAN_FLAGS. This can also be done at the end of the job with the FF_ENABLE_JOB_CLEANUP feature flag.

*configure your runner with the disable_cache docker-specific runner setting

*do rm -rf at the beginning and/or end of the job (in the .gitlab-ci.yml file)

*remove the docker volumes on the host. Either using or taking inspiration from the clearing-docker-cache script. This is more for garbage collection than for ensuring a fresh build environment though.

I also suspect you could tweak the builds_dir and volumes
runner settings
to use a tmpfs
(I haven't tried it).

A: Go to your Project menu : CI/CD -> Pipeline
And click to [Clear runner caches]
It's works for me !


text:
Q: User Interface Specification I have Read this one Graphical User Interface Specification Template..
can you guide me more in this context?
Means i want to say that is there any practical process professional follows in real life to implement the user interface successfully .
Thank You
Mihir Parekh

A: I liked Alan Cooper's book About Face.  Although my copy is a bit dated (I've got a first edition version), it had some great material. It's apparently now on the Fourth Edition (yikes, I bought my copy 19 years ago???), which you can get from Powell's (http://www.powells.com/biblio/1-9781118766576-0).  If you try getting it from Amazon, make sure it's the Fourth Edition, because when I searched on Alan Cooper it brought back the Third Edition at the top of the result list (at first I thought "Wow, that's a lot cheaper" until I realized it was not the latest version).
Oh, one other thing about Cooper - he can be entertaining as a writer.  One of his books (also definitely worth buying), The Inmates are Running the Asylum, is about usability, user experience, and product design in general and IIRC has some sections that are quite funny.
Also, do a web search for "user experience process".  One site that caught my eye was the UX Mastery site (http://uxmastery.com/).  I didn't really go too deeply into their site, but they've got a 'Resources' section that lists a ton of books that you might find useful (it depends on what kind of user interface requirements your app has, but it's a pretty broad selection).   Also in the 'Resources' section is a section covering process topics.


text:
Q: Not able to convert from string to int in java I have simple program which will convert string to int using parseInt but not able to convert getting NumberFormatException
public static void main(String[] args) {
    String invoiceNo = "3466002000";
    System.out.println(Integer.parseInt(invoiceNo));
}

Exception Trace :
Exception in thread "main" java.lang.NumberFormatException: For input string: "3466002000"
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at com.utils.ExcelFileUtil.main(ExcelFileUtil.java:159)

A: The value 3466002000 is too big to parse it to int. Use long instead:
public static void main(String[] args) {
    String invoiceNo = "3466002000";
    System.out.println(Long.parseLong(invoiceNo));
}


text:
Q: Is there any way to subtract one Object property value from another in multiple lists? I have several lists. Monthly lists. The objects contained in them have a value. The goal is to subtract the value of the first monthobject from the value of the second monthobject.
and save the new value
next step is to subtract the original value of the second month from the third month value. and safe the new third month value. the original value of the third month is to subtract from the fourth one etc. etc.
Now, what i have done among other variants, but I think that's the closest I get.
This is one of my attempts:
    //creates multiple ArrayLists in List, based on numbers of monthList
       for (int i = 0; i < monthList.size(); i++) {
           monthyList.add(new ArrayList<>());
       }

    List<Objecty> finalList = new ArrayList<>();

    for (int i = 0; i < monthyList.size(); i++) {
        List<Object> firstMonthList = monthyList.get(i);
        List<Object> nextMonthList = monthyList.get(i + 1);

        List<Object> copyOfNextList = List.copyOf(nextMonthList);

        for (int j = 0; j < firstMonthList.size(); j++) {
            Object firstMonthObject = firstMonthList.get(j);
            for (int k = 0; k < copyOfNextList.size(); k++) {
                Object nextMonthObject = copyOfNextList.get(k);
                if (nextMonthObject.getAccountNumber() == firstMonthObject.getAccountNumber()) {

                     nextMonthObject.setAmount(subtractAmount(firstMonthObject.getAmount(),nextMonthObject.getAmount()));
                    finalList.add(nextMonthObject);
                    break;
                }
        }
    }

    finalList.add....

}

So unfortunately I cannot get any further... does it have any advantages to use LinkedList for this case?
I hope the problem is understandably.
Can you help me improve the code?  Or are there better approaches to solve this problem?


text:
Q: is there any way to delete items of a list view along with the data of the table? I have created a list view and displaying the data from SQLite in the list view.
I need to delete, edit the specific row from the list view as well as the database table which the user pressed in the list view.
is there a way or any tutorial that explains a solution to this problem?
or else, I would like to know a way to display data from sqlite database along with editing deleting etc.


text:
Q: How to debug stored procedures in SQL server 2008 without CLR? How can I debug stored procedures in SQL Server 2008 management studio?
I am trying to put a break point on SQL query and then press start debugging but I get an error that debugging cannot be started on my machine:
Debug cannot be started at <machine name>.

I don't want to use CLR debugging.  How can I debug stored procedures?

A: Type exec YourStoredProcedure. Put break point next to it. Hit green (debug) arrow next to execute button. Debugger should start and hit your break point. Hit F11 to step into your stored procedure.
See debug menu for more options.
Here is very detailed blog post: T-SQL Debugger for SQL Server 2008

A: try with
TRY()... CATCH()... METHOD

Read the hints online based on your SP


text:
Q: QGIS 3.16.16 OGR error Coordinates I am editing shapefiles that are derived from data measured with a GPS. I have made several adjustments without problems. Suddenly when I want to add a point to a feature or want to add a new feature and save these changes, I get the following error: ''Coordinates with non-finite values are not allowed.''
Nevetheless I can change the locations of original points and save these changes.
This problem is also occuring in the original shapefiles.
Does anyone know how to fix this?


text:
Q: Generic state management function flow type react I have a question on how to make a generic state updater
type State = {
    name: string,
    age: number,
    contactInfo: ContactInfo
}

and in my component
onChangeField = (field: $Keys<State>) => (value: $ElementType<State, field>) => {
    this.setState({ [field]: value });
}

I'm getting an error cannot use literal 'contactInfo' as type because string literal 'contactInfo' is a value.
You can check in try flow playground here


text:
Q: IBM PCOMM with Java I'm totally new to this PCOMM things so I have a question. I'm using the "Personal Communications" Software by IBM. I also have an Visual Basic PCOMM sript which I want to rewrite in java.
Is there some kind of documentation of how to do this?

A: When I google with the query PCOMM Documentation I've got the Personal Communications for Windows, Version 5.6 - Quick Beginnings and when use Goolge Books I can come around 2 articles on InfoWorld.
Why not you can try for? I think it would be helpful...

A: I found some Links in my research to it...
I mostly struggled with having no javadoc in the past and explored the library to see what works but in the below links there is the javadoc for it ;-)
I've written a library to easily do testautomation on the mainframe but it's company specific and closed source, anyway you can get back to me if you have a question and I see if I can answer i.
Just one note on multithreading:
Basically it is possible but the native library gets loaded once and used for all threads and this lib is not thread safe.
If you do multithreading, you have totake care that you don't try to interact with two mainframe sessions at the same time.
I just implemented an managing wueue where the threads request for a slot and then go to wait state and the managing thread just loops over the queue, wakes the specific thread and waits until he gives the slot back (just make sure you can't get into a deadlock).
Due to stackoverflow hyperlinks restriction, find all link here: http://nopaste.info/ed31e94351.html
The most important one (at least for me) is the javadoc inside the hacl.zip file on the ftp:
ftp://public.dhe.ibm.com/software/webserver/hostondemand/library/

A: According to IBM's Personal Communications Host Access Class Library book:

The documentation for the HACL Java classes is provided in HTML
  format. These files are available in the ..\doc\hacl subdirectory of
  the Personal Communications installation image. To view the
  documentation, use a Web browser to view the ECLReference.html file,
  which is the first file of the softcopy HACL Java reference.


text:
Q: Dropdown Focus not changing I am using flutter for web. When I click on the dropdown but do not select any options, then when I click outside the dropdown menu, the focus is still there. But I have used Gesture Detector to change the focus by this-
onTap: () {
    FocusManager.instance.primaryFocus?.unfocus();
},

So whenever I click outside the dropdown, the focus needs to be changed. But it is not functioning.

Flutter doctor output:
    [✓] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-arm, locale en-US)
    [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    [✓] Chrome - develop for the web
    [✓] Android Studio (version 2021.2)
    [✓] IntelliJ IDEA Ultimate Edition (version 2022.1.1)
    [✓] VS Code (version 1.67.2)
    [✓] Connected device (3 available)
    [✓] HTTP Host Availability

    • No issues found!


text:
Q: Database design for dentist app So I'm doing a web app for my sister, as she recently received her degree on odontology.
I'm having a bit of a struggle with the database design though...
I'm obviously supposed to have an appointment table (tbl_appointment), appointments may have treatments associated to them, and those treatments all have different attributes (columns).
So I'm thinking I should have a tbl_appointment and also a tbl_treatment, I'm not sure on how to link those tables as to have multiple treatment types, with different treatment parameters and save the treatment data related to the appointment.
What do you think would be a good approach to this? I already have something drawn out but it definitely doesn't seem good as I end up having one table for each treatment type and I don't think thats the best solution.
EDIT
As this wasn't clear enough, here's a screenshot of how my actual db looks like.
If I implement the treatments as I did the periodontogram, I'm gonna end up with 20 tables one for each treatment type. I want to avoid that!

EDIT
@Ian Kenney, so if I got what you were suggesting right, this is how the portion of the database we're discussing should look like...

Am I right? Don't pay attention to the relation types as they're all 1:1, I am aware I should use some M:N in there, but it was just for the example.

A: One approach for the various treatment types would be to look at the attributes that are common between them, for example it may include:

*

*name

*description

*price

*time_required

These become the columns of tbl_treatment
Then use an additional table for other (treatment specific) attributes tbl_treatment_attributes with a structure like:

*

*treatment_id

*attribute_name

*attribute_value

Each treatment could have many additional attributes, the acceptable attributes (including defaults) could be managed in tbl_treatment_defaults

*

*treatment_id

*attribute_name

*field_type

*validations

*default_value

EDIT
+-------------------+              +--------------------+
| tbl_treatment     |              | tbl_treatment_type |
+===================+              +====================+
|*treatment_id      |              |*treatment_type_id  |
|+treatment_type_id |<-------------| treatment_name     |
|  ......           |              | ......             |
+-------------------+              +--------------------+
         |                                   |
         v                                   v
+--------------------------+       +------------------------+
| tbl_treatment_attributes |       | tbl_treatment_defaults |
+==========================+       +========================+
|*treatment_id             |       |*treatment_type_id      |
| attribute_name           |<------| attribute_name         |
| attribute_value          |       | default_value          |
| ........                 |       | .......                |
+--------------------------+       +------------------------+

A: The tbl_appointment appointment table should only have appointment data and patientId (foreign key into your tbl_Patient table)
You should have a 3rd table called tbl_Visit that contains a foreign key into the tbl_appointment. Then another table called tbl_Visit_treatment that has VisitId and TreatmentId. So this tbl_Visit_treatment is the many-to-many relationship table that tracks all the treatments done in each visit.
As for TreatmentType(s), that will simply be a type table called tbl_TreatmentType with ID, Name, Code and Description fields. The TreatmentId will be a foreign key in the tbl_Treatmenttable.


text:
Q: Cross browser datepicker for Angular2 I've tried using Pikday for cross browser datepicker but I'm seeing some issues with dynamically generated date inputs while using Pikaday. So I'm trying to find any other cross browser datepicker.
Any suggestions/recommendations? Thank you.


text:
Q: How to validate that I don't receive both values defined in @JsonProperty and @JsonAlias? I'm taking entity with child presented as numeric child_entity_id. But sometimes instead of child_entity_id I have to handle child_entity_selector json object instead. Which is sent for extracting the entity by some values from a database.
Parent entity has such annotations
@Entity
class Parent {
    @Id
    long id;

    @JsonDeserialize(using = EntityReferenceDeserializer.class)
    @JsonSerialize(using = EntityReferenceSerializer.class)
    @JsonProperty("child_entity_id")
    @JsonAlias("child_entity_selector")
    Child child;

For response json like
{
    "id" : 1,
    "child_entity_id": 1,
    "child_entity_selector": {
        "child_name": "I am a child"
    },
}

An exception should be thrown because only "child_entity_id" or "child_entity_selector" have to be simultaneously in one json.
When I receive such json, it parses correctly, but my deserializer handles both of child_entity_id and child_entity_selector and the last one remains in the result.
Currently I'm trying to obtain both of source json and entity to check that json has not duplicated references covered by aliases.
I've set up a SimpleModule and the custom deserializer
@Component
public class WebConfig {

    @Bean
    public SimpleModule simpleModule() {
        SimpleModule module = new SimpleModule();
        module.setDeserializerModifier(new BeanDeserializerModifier() {
            @Override
            public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deserializer) {
                if (beanDesc.getBeanClass() == Child.class)
                    return new ChildDeserializer(deserializer);
                return deserializer;
            }
        });
        return module;
    }
}

and deserializer
public class ChildDeserializer extends StdDeserializer<Child> implements ResolvableDeserializer {
    private final JsonDeserializer<?> defaultDeserializer;

    public ChildDeserializer(JsonDeserializer<?> defaultDeserializer) {
        super(Child.class);
        this.defaultDeserializer = defaultDeserializer;
    }

    @Override
    public Child deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        Child modelExecution = (Child) defaultDeserializer.deserialize(p, ctxt);

        // Can not correctly read raw json after parsing -- node becomes null now after deserialization above
        JsonNode node = p.getCodec().readTree(p);

        boolean duplication = node.has("child_entity_id") && node.has("child_entity_selector");
        if (duplication) {
            throw new RuntimeException("Duplicated!")
        } else {
            log("Not duplicated");
        }
            return child;
    }

    @Override
    public void resolve(DeserializationContext ctxt) throws JsonMappingException {
        ((ResolvableDeserializer) defaultDeserializer).resolve(ctxt);
    }

}

After the deserialization I can not access the JsonNode value. And vice versa after parsing JsonNode value can not obtain deserialized Child entity.
Expected behavior on
{
    "id" : 1,
    "child_entity_id": 1,
}

and
{
    "id" : 1,
    "child_entity_selector": {
        "child_name": "I am a child"
    },
}

is correctly parsed entity.
But on both of references
{
    "id" : 1,
    "child_entity_id": 1,
    "child_entity_selector": {
        "child_name": "I am a child"
    },
}

an exception should be thrown.

A: You could handle it with a @JsonCreator in the Parent class
    @JsonCreator
    public Parent(@JsonProperty("child_entity_id") Child childFromId, @JsonProperty("child_entity_selector") Child childFromSelector) {
        if (childFromId != null && childFromSelector != null) {
            throw new RuntimeException("Duplicated!");
        }

        this.child = (childFromSelector == null) ? childFromId : childFromSelector;
    }

There is a JsonParser.Feature.STRICT_DUPLICATE_DETECTION if you also need to check for duplicate fields:
{
    "id" : 1,
    "child_entity_id": 1,
    "child_entity_id": 2
}

Unfortunately it doesn't work with aliases


text:
Q: Unreal Material: RotateAboutAxis not producing the expected result This is a sphere, with the normals hooked up directly to the output color. I'm using the normals for now, because it's an easy way to test the ouput - this is what I expect to see:

Now, I'm trying to rotate all these normals around some axis. I thought the 'RotateAboutAxis' function would be perfect for this:

But apparently it's not. It seems to have killed the X component - you can see the dark spot, as expected, where all the components are negative, but you can't see a white spot directly opposite. The animation is weird too - it jumps back to the start after only 180 degrees, and the colors fade in and out in the first and last few degrees of rotation. Changing the axis doesn't help, it seems to kill the components of the position that are aligned with the axis. What am I missing?

I'm posting here as well as the Unreal forums, because the forums are horrible to use. My question won't even show up until it has been approved by moderators.

A: RotateAboutAxis documentation doesn't states that clearly, but this node is designed to work with World Position Offset material output. It means that output of this node is rotation 'offset' (vector you need to addd to the current vector in order to get desired rotated vector)
Try to add VertexNormalWS to the result of RotateAboutAxis:


text:
Q: win32com Outlook subfolder not always found I have a script that moves/saves/categorizes emails in a shared mail. And I'm encountering errors when sometimes mail folders are not found. I'm using below function to retrieve mail folders. And sometimes it works and othertimes it doesn't. I usually have to restart outlook to make it work once the error has been thrown. It sometimes fails to find the subfolders within the Inbox and it returns that it is empty.
Is there anyway to ensure that the subfolders are always found?
OUTLOOK = win32com.client.GetActiveObject('Outlook.Application') #This is how I dispatch outlook

Mapi - folders
['x', 'y', 'z',]

x - folders
['PersonMetadata', 'Yammer Root', 'Tasks', 'Sent Items', 'Outbox', 'Notes', 'Junk Email', 'Journal', 'Inbox', 'Files', 'ExternalContacts', 'Drafts', 'Deleted Items', 'Conversation History', 'Conversation Action Settings', 'Contacts', 'Calendar', 'Archive']

Inbox - folders
['a', 'b', 'c'] #THIS IS SOMETIMES EMPTY

FOLDERS = {"example": ["x", "Inbox", "a"]}

def get_folder(outlook_instance, *folders):
    target_folder = outlook_instance
    try:
        for folder in folders:
            print(folder_path)
            print([f.Name for f in target_folder.Folders])
            target_folder = target_folder.Folders[str(folder)]
    except Exception:
        raise ValueError("".join(f".Folders[{folder}]" for folder in folders))
    return target_folder

def get_outlook_folder(folder, outlook):
    mapi = outlook.GetNamespace("MAPI")
    return get_folder(mapi, *FOLDERS.get(folder))

I found this on an other post that I think relates to my issue, but I don't really understand what it is saying stackoverflow.com/a/40853098/10833061

A: Is Outlook always running on the system when your code is executed?
Otherwise, you need to create a new Outlook Application instance and logon to the profile to be able to access folders. I am not a python developer, so here is a C# sample code which illustrates the required workflow for you:
 Outlook.Application GetApplicationObject()
        {

            Outlook.Application application = null;

            // Check whether there is an Outlook process running.
            if (Process.GetProcessesByName("OUTLOOK").Count() > 0)
            {

                // If so, use the GetActiveObject method to obtain the process and cast it to an Application object.
                application = Marshal.GetActiveObject("Outlook.Application") as Outlook.Application;
            }
            else
            {

                // If not, create a new instance of Outlook and sign in to the default profile.
                application = new Outlook.Application();
                Outlook.NameSpace nameSpace = application.GetNamespace("MAPI");
                nameSpace.Logon("", "", Missing.Value, Missing.Value);
                nameSpace = null;
            }

            // Return the Outlook Application object.
            return application;
        }

The Outlook object model is common for all programming languages, so I hope there you won't find any difficulties in understanding the required approach. Read more about that in the Get and sign in to an instance of Outlook article in MSDN.
Finally, it is not clear what comes from where - I'd recommend clarifying all bits in the sample code posted, so we could suggest anything else.


text:
Q: javascript array to object transformation i want to build an object using this code
$("input").bind("keydown",function(e){
 var code = (e.keyCode ? e.keyCode : e.which);
 if (code == 13){
  var guess = $("input").val();
  guess = guess.split(" ");
  var oGuess = {};
  for (var x = 0; guess.length ; x++){
   oGuess[x] = oGuess[x] = {"text": guess[x]};
  }
  $("input").val("");
 }
});

this actually crashes my browsers(latest stable ff and chrome) upon hitting enter. heres the jsfiddle http://jsfiddle.net/kfqJC/1/
i need the object to be something like this
oGuess = {
"1": { "text" : string}
"2": { "text" : string}
...
}

what am I missing here?

A: Your loop never terminates. If guess has one element or more, guess.length will always evaluate to true.
I assume you want
for (var x = 0; x < guess.length ; x++){
//              ^^^

Also, what is this for?
oGuess[x] = oGuess[x] = {"text": guess[x]};

Just write
oGuess[x] = {"text": guess[x]};

And if you want the properties start with 1, you have to write
oGuess[x+1]

thought I don't see any advantage of using an object over an array in this case.


text:
Q: I cannot save into excel the result of entire loop but only the last iteration I would like to save the results of the entire iteration into an excel file but at the moment I save only the last run. Why is this happening and how to solve it?
I added a line 'append' but then I get an error message..
path = '../'
df1=[]

for file in os.listdir(path):
 if file.endswith('.txt'):
     with open(os.path.join(path, file)) as f:
         df = pd.read_csv(f, sep="\t", header=0,usecols=[0,11])
         df.columns = ["x", "y"]

         abs_PAR=[]
         mean1=[]

         for (x, y) in df.iteritems():

          abs_PAR = sum(y.iloc[49:350]) / len(y.iloc[49:350])

          mean1.append(abs_PAR)

          newrow = {0:abs_PAR}
          df1 = df1.append(newrow)
          print(newrow)

writer = ExcelWriter('df1.xlsx')
df1.to_excel(writer,'Sheet1',index=False)
writer.save()

Error message:
AttributeError: 'NoneType' object has no attribute 'append'
Thank you in advance

A: You should not use the assign operator (=) with append. Try changing
df1 = df1.append(newrow)

to
df1.append(newrow)


text:
Q: Changing Visual Studio Test discovery working directory I have a big project with hundreds of existing GTest tests, some of them require a specific working directory to work correctly. It's fine when executing them since I can switch the current working directory before execution.
When the working directory is wrong, the test executable crashes with an access violation, even when executing with --gtest_list_tests (some static variable initialization fails).
The problem is that the Visual Studio test discovery agent (testhost.x86.exe) is running with the testhost.86.exe parent folder working directory, therefore causing the discovery to fail with an access violation.
Is there any way to change the Visual Studio test discovery working directory?


text:
Q: Find Column and format as Date I have a several columns in my excel worksheets which are all named as "Date". I want to write a code which will find all date columns in all worksheets and format the values in that column as "dd/mm/yyyy;@" .
In the code below I tried writing Columns("Date").Select instead of Columns("E:E").Select but this is not working. Can anyone suggest me how to fix this?
Thanks for your time and suggestions.
Sub dateformat()
Dim ws As Worksheet
For Each ws In Worksheets
Columns("E:E").Select
Selection.NumberFormat = "dd/mm/yyyy;@"
Next ws
End Sub

A: Nupur, Is this what you are trying?
Option Explicit

Sub Sample()
    Dim aCell As Range, bCell As Range
    Dim ws As Worksheet
    Dim ExitLoop As Boolean

    For Each ws In ThisWorkbook.Sheets

        Set aCell = ws.Rows(1).Find(what:="Date", LookIn:=xlValues, _
        lookat:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False)

        ExitLoop = False

        If Not aCell Is Nothing Then
            Set bCell = aCell

            ws.Columns(aCell.Column).NumberFormat = "dd/mm/yyyy;@"
            Do While ExitLoop = False
                Set aCell = ws.Rows(1).FindNext(After:=aCell)

                If Not aCell Is Nothing Then
                    If aCell.Address = bCell.Address Then Exit Do
                    ws.Columns(aCell.Column).NumberFormat = "dd/mm/yyyy;@"
                Else
                    ExitLoop = True
                End If
            Loop
        End If
    Next
End Sub

FOLLOWUP
The reason you are getting those errors is because your column is formatted as text. Try this. This works :)
Option Explicit

Sub Sample()
    Dim aCell As Range, bCell As Range
    Dim ws As Worksheet
    Dim lastRow As Long, i As Long
    Dim ExitLoop As Boolean

    For Each ws In ThisWorkbook.Sheets
        Set aCell = ws.Rows(1).Find(what:="Date", LookIn:=xlValues, _
        lookat:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False)

        ExitLoop = False

        If Not aCell Is Nothing Then
            Set bCell = aCell

            ws.Columns(aCell.Column).NumberFormat = "dd/mm/yyyy;@"

            lastRow = ws.Range(Split(ws.Cells(, aCell.Column).Address, "$")(1) & _
            ws.Rows.Count).End(xlUp).Row

            For i = 2 To lastRow
                With ws.Range(Split(ws.Cells(, aCell.Column).Address, "$")(1) & i)
                    .FormulaR1C1 = .Value
                End With
            Next i

            ws.Columns(aCell.Column).AutoFit

            Do While ExitLoop = False
                Set aCell = ws.Rows(1).FindNext(After:=aCell)

                If Not aCell Is Nothing Then
                    If aCell.Address = bCell.Address Then Exit Do

                    ws.Columns(aCell.Column).NumberFormat = "dd/mm/yyyy;@"

                    lastRow = ws.Range(Split(ws.Cells(, aCell.Column).Address, "$")(1) & _
                    ws.Rows.Count).End(xlUp).Row

                    For i = 2 To lastRow
                        ws.Range(Split(ws.Cells(, aCell.Column).Address, "$")(1) & i).FormulaR1C1 = _
                        ws.Range(Split(ws.Cells(, aCell.Column).Address, "$")(1) & i).Value
                    Next i
                Else
                    ExitLoop = True
                End If
            Loop
        End If
    Next
End Sub

HTH
Sid

A: Can you incorporate some of this code(modify to fit your req's)?
varLookFor1 = Format(Date - 1, "[$-409]mmmm-yy;@")
ActiveWorkbook.ActiveSheet.Cells.Find(What:=varLookFor1, LookIn:=xlValues).Activate


text:
Q: Energy of Rod about pivot Consider a rod, with mass $m$ and length $l$, that is fixed about a pivot point at one of its ends.
Now imagine that we flick the rod so that the end of it attains a velocity of $v_{0}$.

Now, if we look at the instant of impact, the rod appears to be moving towards the right with a velocity of $v_{0}$ or with a kinetic energy of
$KE=\frac{1}{2}mv_{0}^2$
(I draw upon this idea as I often use this technique to find the velocity of a rod after a collision using conservation of momentum)
However, if we calculate the kinetic energy of the rod with respect to its moment of inertia and angular velocity, we attain a different answer:
$KE = \frac{1}{2}I\omega^2$
$KE = \frac{1}{2}\frac{1}{3}ml^2\omega^2$ (moment of inertia of a rod about a fixed end is $\frac{1}{3}ml^2$)
$KE = \frac{1}{2}\frac{1}{3}ml^2(\frac{v}{l})^2$
$KE = \frac{1}{6}mv^2$
However, these two values do not equal each other. What went wrong? Is it incorrect to imagine the rod as not being attached to the pivot for an instant? If so, why does conservation of linear momentum still hold when using this trick?

A: The speed of the rod varies from $0$ at the pivot to $v_0$ at the free end.
To find the total kinetic energy of the rod via the $\frac 12mv^2$ formula consider an element of the rod of length $dr$ at a distance $r$ from the pivot.
That element has a mass of $\frac m L dr$ and a speed of $\frac r L v_0$ and hence a kinetic energy of $\frac 12 \frac m L dr \left(\frac r L v_0 \right)^2$.
Integration along the length of the rod will give you the kinetic energy of the whole rod.

A: You can say that the translational K.E. Is (1/2)m$v_o^2$ where $v_o$ is the speed of the center of mass, but with that you must include the rotational energy about the center of mass.


text: Q: Finding a conformal map between an irregular region between two disks and an annulus If I am given a region $R$ defined as the the region between a unit disk $D_1(0)$ and $D_{ \frac{1}{4}}$$(\frac{1}{4})$, what is a strategy to conformally map this to an annulus $a \lt z \lt 1$? Specifically, where does the constraint on $a$ come from?


text:
Q: How to design step-by-step form in Django? I have been working on my Django web-app for quite some time now and due to initial poor planning, I have been constantly changing and moving things in my web app so it is a complete mess now. I decided to stop writing codes and reflect on how I want the things to work.
One of the questions that came up is the Application form that people would have to fill out.
models.py

class Contact(models.Model):
    ContactName = models.CharField(max_length = 250, default='',
verbose_name="Contact Name")
    Country = models.CharField(max_length = 250, default='')
    City = models.CharField(max_length = 250, default='')
etc.

I will have over a hundred fields in my form and I don't want them all to be displayed at once but rather make them step by step:
Personal Info -> General Info -> Upload supported documents -> etc.
I have two questions:

*

*Should I keep all 100 fields under one class (Contact) or break them down into a few classes and connect them all using the ForeignKey? What are the best practices?

*Once the Personal Info fields get filled out, an applicant will press Continue and will be moved to General Info and fill that out and so forth. Should this logic be taken care of in Django views.py or it is something that is going to be accomplished using JavaScript? Or is it the combination of both?
I am just trying to wrap my head around how everything works before I touch the keyboard again.

A: First of all never design your application based on the UI. The presentation layer is not unique, you can have different presentation layers like the web UI, the mobile UI and thirdy party API interface.
When you create your backend do not tailor it for the presentation. Is the presentation that must adapt.
Create your models on the paper using a ER diagrams and if you need to have a wizard form, you can use the former Form Wizard now Form tools https://django-formtools.readthedocs.io/en/latest/ to create a set of forms to collect and validate the data and create the models (plural) in your backend.
Using the formtools you don't need to use the javascript. The formtools lets you to create many different forms to run together. Every form has its own validation, but at the end you have a done function to manage all the data together to create what you need.
You don't need the JS, but you can improve the UX (user experience) using the proper JS tool. I would not care about that at the moment. Your current problem is to manage the design of your app, about the presentation(s) you can take care later.


text:
Q: How can I use crosshair in GFlot I know that flot has a crosshair plugin - but I can't see how to use it from Java in GFlot.
Can someone help me?

A: Take a look at the examples on this site:
http://1.gflot2.appspot.com/#tracking


text:
Q: DD-WRT router causing IP address conflicts across network My DD-WRT router has lost its mind!
(Caveat: technically neither of these devices are "routing". I'm going to call them routers anyway.)
I just set up two DD-WRT routers, one as a WAP (working fine) and one in Client Bridge (routed) mode (the problem). Not long after setup I started seeing IP address conflicts on other machines. The event log always points the finger at my Client Bridge router's MAC address.
Neighbour table overflow
The log on my router is flooded with Neighbour table overflow errors. These start a minute or two after boot. The network is rather large, with +200 IP addresses being used in this subnet. The other router shows no such errors.
Mass ARP requests from 1.1.1.1
I'm also seeing constant ARP requests (with the problem router's MAC address) from 1.1.1.1. Seems like it's bugging everything on the network for its MAC address and then promptly forgetting it (or never receiving a response).
Configuration:
Model: Buffalo N600
Firmware: DD-WRT v24SP2-MULTI (03/21/11)
Wireless Mode: Client Bridge (routed)
brctl show output:
bridge name      bridge id            STP enabled     interfaces
br0              80000.106f3f289f6a   no              eth0
                                                      eth1

Neither device is configured for DHCP, however there does seem to be a rogue DHCP server on the network right now...
I'm not sure what configuration details are relevant and I'd rather not have comments flooded, so just ping me in this chat if you want to know something.
Why is my router stealing IP addresses and how can I stop it?


text:
Q: How to add Security Features in marksheet using php I want to add UV and Corelation features in marksheet using php but did not get any solution i have marked with red circle that i want to add by php please checj attached image and let me know is it possible to add this features.
enter image description here


text:
Q: If vector space of all real functions is modified to have $cf(x) = f(cx)$, which axiom of vector space is broken? There is vector space $F$ of all real functions. $f(x) \in F$.
Now suppose that scalar multiplication of vector space $F$ is modified so that it is now defined as $cf(x) = f(cx)$.
In this case, which axiom of vector space is broken?

A: Given two field elements $c$ and $d$, and given a vector $f$, we must have:
$$(c+d)\,f=c\,f+d\,f.$$
But, instead, we get the vector
$$
x\mapsto f((c+d)\,x)\qquad\text{as our $(c+d)\,f$}
$$
and the vector
$$
x\mapsto f(c\,x)+f(d\,x)\qquad\text{as our $c\,f+d\,f$}
$$
The two are not necessarily equal.
For instance consider the square function $x\mapsto x^2$.
$$((c+d)\,x)^2\quad\text{is not the same as}\quad (cx)^2+(dx)^2\quad\text{for all $x$.}$$

A: Hint: What would happen with something like $(c+d)f(x)$?

A: When one multiplies a vector by$~0$, the result should be the zero vector; however, this definition gives $0f:x\mapsto f(0)$, a constant function, but not necessarily the zero function (neutral element for addition).
Now $\def\vv{\vec v}0\vv=\vec0$ is not a vector space axiom, at least not one in the usual list. However it can be proved using the fact that $\vec0$ is the unique solution to the vector equation $\vec x+\vec x=\vec x$, together with the identity $0\vv+0\vv=(0+0)\vv=0\vv$. The former property only involves vector addition, so it certainly (still) holds in the example. The latter part uses only the distributive law $a\vv+b\vv=(a+b)\vv$ (the simplification $0+0=0$ does not involce the vector space structure), so it is this law that must fail. Indeed if $\vv$ is for instance the constant function $1$, then $0\vv=\vv$, and $0\vv+0\vv\neq0\vv$ (LHS is constant$~2$, RHS is constant$~1$).


text:
Q: animation class in ng expression is not working ionic 3 I am new in ionic - angular world.
I am trying to put an animation class for my item but based on an expression the class is change. i.e odd item want to animate to left , even animate  to right.
  <ion-item class="{{'list_item slideInLeft'}}"

is not working, but
  <ion-item class="list_item slideInLeft"

animation works
I need the class in '' to work in order to be able to put is in expression:
class="{{i%2==0 ? 'list_item slideInLeft':'list_item slide-in-both-ways'}}"

I also tried:
ng-class-odd="'list_item slideInLeft'" ng-class-even="'list_item slideInLeft'"

and
ng-class ="{ odd: 'list_item slideInLeft', even:'list_item slideInLeft'}"

with no luck .
anybody has an idea, appreciated!
ionic info (if needed)
global packages:

@ionic/cli-utils : 1.4.0
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-ionic-angular : 1.3.1
Ionic Framework                 : ionic-angular 3.3.0

System:

Node       : v6.10.0
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 3.10.10

A: you can use ng class like below....i am just using my classes with colors so that you have to replace with your fields and values

var app = angular.module('plunker', []);

app.controller('MainCtrl', function($scope) {
   $scope.name=[];
  for(var i=0;i<10;i++){
    $scope.name.push(i);
  }
});
/* Put your css in here */

.red{
  color:red;
}
.blue{
  color:blue;
}
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>AngularJS Plunker</title>

    <link rel="stylesheet" href="style.css" />

{{i}}


text:
Q: Python - Send Integer or String to Spark-Streaming I can send my data through CSV file. First, write my random numbers into CSV file then send it, but is it possible to send it directly?
my socket code:
import socket
host = 'localhost'
port = 8080

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host, port))
s.listen(1)
while True:
    print('\nListening for a client at',host , port)
    conn, addr = s.accept()
    print('\nConnected by', addr)
    try:
        print('\nReading file...\n')
        while 1:
            out = "test01"
            print('Sending line', line)
            conn.send(out)
    except socket.error:
        print ('Error Occured.\n\nClient disconnected.\n')
conn.close()

spark streaming code:
from pyspark import SparkContext
from pyspark.streaming import StreamingContext

sc = SparkContext("local[2]","deneme")
ssc = StreamingContext(sc, 10)
socket_stream = ssc.socketTextStream("localhost",8080)

random_integers = socket_stream.window( 30 )

digits = random_integers.flatMap(lambda line: line.split(" ")).map(lambda digit: (digit, 1))

digit_count = digits.reduceByKey(lambda x,y:x+y)
digit_count.pprint()

ssc.start()

A: This is because socket blocks sending the data and never moves on. The most basic solution is to send some amount of data and close the connection:
import socket
import time

host = 'localhost'
port = 50007

i = 0

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.bind((host, port))
s.listen(1)

try:
    while True:
        conn, addr = s.accept()
        try:
            for j in range(10):
                conn.send(bytes("{}\n".format(i), "utf-8"))
                i += 1
                time.sleep(1)
            conn.close()
        except socket.error: pass
finally:
    s.close()

To get something more interesting check non-blocking mode with timeouts.


text:
Q: I'm trying to put a string of numbers into a TextView but my App crashes before showing it What I'm doing is, "ask" for a number in kilometers, and once you click the button to convert that number to centimeters and show the result in the TextView, but when you click the button, the App closes.
I'm using a Samsung Galaxy A70
Android version: 10
MainActivity.java
public void calcular(View v){
        EditText text = findViewById(R.id.pt_entrada);
        input = Integer.parseInt(text.getText().toString());
        valor = input * cm;
        Log.d("info", String.valueOf(valor)); // This actually gives me de log on the Logcat tab.
        TextView tv = (TextView)findViewById(R.id.tv_pantalla); // But once the app arrives here, it crashes.
        tv.setText(valor);
    }

activity_main.xml
<Button
        android:id="@+id/b_send"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="32dp"
        android:onClick="calcular"
        android:text="@string/calcular"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toEndOf="@+id/pt_entrada"
        app:layout_constraintTop_toTopOf="@+id/pt_entrada" />

    <TextView
        android:id="@+id/tv_pantalla"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="32dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.498"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/pt_entrada" />

    <EditText
        android:id="@+id/pt_entrada"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="32dp"
        android:layout_marginTop="32dp"
        android:layout_marginEnd="8dp"
        android:autofillHints="@string/kmacm"
        android:ems="10"
        android:hint="@string/kmacm"
        android:inputType="numberDecimal"
        app:layout_constraintEnd_toStartOf="@+id/b_send"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

This is the Error it shows on Logcat tab:
Process: com.example.conversor, PID: 12602
    java.lang.IllegalStateException: Could not execute method for android:onClick
        at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:414)
        at android.view.View.performClick(View.java:7862)
        at android.widget.TextView.performClick(TextView.java:15004)
        at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
        at android.view.View.performClickInternal(View.java:7831)
        at android.view.View.access$3600(View.java:879)
        at android.view.View$PerformClick.run(View.java:29359)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8167)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:409)
        at android.view.View.performClick(View.java:7862)
        at android.widget.TextView.performClick(TextView.java:15004)
        at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
        at android.view.View.performClickInternal(View.java:7831)
        at android.view.View.access$3600(View.java:879)
        at android.view.View$PerformClick.run(View.java:29359)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8167)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
     Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x64
        at android.content.res.Resources.getText(Resources.java:402)
        at android.widget.TextView.setText(TextView.java:6942)
        at com.example.conversor.MainActivity.calcular(MainActivity.java:29)
        at java.lang.reflect.Method.invoke(Native Method)
        at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:409)
        at android.view.View.performClick(View.java:7862)
        at android.widget.TextView.performClick(TextView.java:15004)
        at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
        at android.view.View.performClickInternal(View.java:7831)
        at android.view.View.access$3600(View.java:879)
        at android.view.View$PerformClick.run(View.java:29359)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8167)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
2021-10-11 17:20:20.010 12602-12602/com.example.conversor I/Process: Sending signal. PID: 12602 SIG: 9

A: You are passing an int as your argument when you do
tv.setText(valor);

You need to give it a ressource ID, or a String. You can convert your int to a string using
tv.setText(String.valueOf(valor));

A: more simpler is to just concatenate it with empty string.
                  tv.setText(valor + "");


text:
Q: If I purchase one ticket for a lottery game, what is my expected gain? We are given a total of 3,000,000 people buy lottery tickets for this game and each ticket costs $20. The layout for the prizes is as follows:
Prize | # Winners
20 |       522,000
40     | 261,000
50    |   195,000
500    |  4,000
10,000  | 300
1,000,000 | 3

*

*Calculate the the pmf of p = amount of prize for random ticket

*If I purchase one ticket what is my expected gain?

*If I pay an extra $10 my prize is multiplied by 2. What is my expected gain if  buy a ticket and pay an extra 10?

Solution: This is what I have so far
For the pmf I have
p(20) = 522,000/3,000,000 = .174
p(40) = 261,000/3,000,000 = .087
p(50) = .065
p(500) = .00133
p(10,000) = .0001
p(1,000,000)=.000001
To calculate expected gain I know i have to add up the probabilities of winning each of the prizes less the cost. So the expected gain of the $20 prize would be 0(.174) because the cost of the ticket is 20 and so on... thus the expected gain would be:
= 0(.174)+20(.087)+30(.065)+480(.00133)+9980(.0001)+999980(.000001)
Is that correct?
The question continues to ask:
Suppose that I continue to buy tickets until I win a prize (of any amount). After I win a prize, I will not buy any more tickets. Let T be the number of tickets that I will buy.

*

*Find the pmf of T if the tickets are not independent of each other

*Under the assumption of independence, what is the distribution of T? Write the pmf. How many tickets would I expect to buy?

Any suggestions for these last two questions?

A: Mostly.   You forgot to include "not winning any prize", which still costs the ticket price so has a very probable negative gain.


text:
Q: Dúvida Select Oracle - Duas condições Tenho esse select, onde retorna em uma coluna, as horas com a condição 'SIM'.
Eu fiz um CASE WHEN nos históricos que devem ser 'NÃO', eo ELSE no restante para que seja 'SIM'.
E na minha WHERE, coloquei para mostrar apenas as horas onde a condição é 'SIM'.
Como eu faço para colocar em outra coluna, as horas com a condição 'NÃO' ??
Segue o select:
SELECT
ROUND(HORAS_TOTAIS,3) HORAS_IMPRODUTIVAS_PPR
FROM(
SELECT
(TEMPO_APONTADO_SEGUNDOS /3600) HORAS_TOTAIS,
CASE CD_HISTORICO
             WHEN 3 THEN 'NÃO'
             WHEN 10 THEN 'NÃO'
             WHEN 11 THEN 'NÃO'
             WHEN 16 THEN 'NÃO'
             WHEN 18 THEN 'NÃO'
             WHEN 20 THEN 'NÃO'
             WHEN 27 THEN 'NÃO'
             WHEN 28 THEN 'NÃO'
             WHEN 29 THEN 'NÃO'
             WHEN 31 THEN 'NÃO'
             WHEN 32 THEN 'NÃO'
             WHEN 33 THEN 'NÃO'
             WHEN 38 THEN 'NÃO'
             ELSE 'SIM' END CONTABILIZA_PPR
FROM APONTAMENTO_ORDEM_SEQ)
WHERE CONTABILIZA_PPR = 'SIM'

A: Pelo que entendi acredito que essa tabela derivada não é necessária, acho que você pode utilizar um Case para cada coluna. Segue uma sugestão para testes:
SELECT
    CASE WHEN CD_HISTORICO NOT IN
            (3, 10, 11, 16, 18, 20, 27, 28, 29, 31, 32, 33, 38)
        THEN ROUND(TEMPO_APONTADO_SEGUNDOS / 3600, 3)
    END as HORAS_IMPRODUTIVAS_PPR,
    CASE WHEN CD_HISTORICO IN
            (3, 10, 11, 16, 18, 20, 27, 28, 29, 31, 32, 33, 38)
        THEN ROUND(TEMPO_APONTADO_SEGUNDOS / 3600, 3)
    END as NAO
FROM APONTAMENTO_ORDEM_SEQ


text:
Q: Redirect in PHP with condition How to redirect user when the user is logged in?

*

*User visits homepage, it loads custom PHP script at http://www.domain.com/index.php

*Index.php script - Verifies user is logged in with Get http://panel.domain.com/CheckUserLogin.aspx
CheckUserLogin.aspx response with text "True" when the current user is logged in, otherwise  "False"

*If True redirect to https://panel.domain.com else redirect to http://www.domain.com/cms

A: Instead of using PHP, you could do this on the client-side with JavaScript. Using jQuery, something like this:
$.ajax("CheckUserLogin.asxp", {dataType: "text"}).then(function(value) {
    if (value == "True") {
        window.location = "https://panel.domain.com";
    } else {
        window.location = "http://www.domain.com/cms";
    }
});

A: Well, basically PHP won't be able to get the text returned by the ASP page as both scripts are processed server side. The best way should be to do redirect from the ASPX instead of index.php. However if you have no way to change the ASP code, you could try doing a php cURL request passing the user's cookies to the asp server and fetching the results doing an if statement.