text:
Q: WebRTC Screensharing 2650x1600 latency and freezes In my WebRTC one-to-many room I've started screensharing via Google Chrome browser extension.
The mouse cursor and the image are displayed with a low frame rate in player window. Also, when I move the cursor on the screen it has some lags and friezes.
Is it about my screen resolution? 2650x1600? Why it happens?

*

*Extension: https://tg-go.noyes.in/i/BQADAgADbQAD4yAYSAqdt16p76BfAg/3b04e02da2ac0c7e89958d00144e2ef9/1502017683

*Video of the lags: https://www.youtube.com/watch?v=5oqJEZiEPAw

*Where you can test it: live.rocketnet.pro:8443/?stream=a


text:
Q: What's the setter of a built_value's object I'm trying using built_value in flutter, and found if I declared a Type use built_value, I can commonly use dot syntax to assign value to it's properties:
my declaration is:
abstract class Post implements Built<Post, PostBuilder> {
    Post._();
    int get userId;
    int get id;
    String get title;
    String get body;
    factory Post([updates(PostBuilder b)]) = _$Post;
    static Serializer<Post> get serializer => _$postSerializer;
}

and use it like this:
Post p = Post();
p.titie = "hello world";

got error:

[dart] No setter named 'title' in class 'Post'.

I'm not familar the builder thing, even I found out that the PostBuilder have the setter of all properties:
    PostBuilder().title = 'hello world';
but how can I use it?

A: BuiltValue classes are immutable. That's one of its main features.
Immutability means you can't modify an instance. Each modification has to result in a new instance.
One of several ways is
p = (p.toBuilder().titie = 'hello world').build();

to get an updated instance.
Alternatively
p = p.rebuild((b) => b..title = 'hello world');

A: In fact, there's a full example alone with source code.
// Values must be created with all required fields.
final value = new SimpleValue((b) => b..anInt = 3);

// Nullable fields will default to null if not set.
final value2 = new SimpleValue((b) => b
..anInt = 3
..aString = 'three');

// All values implement operator==, hashCode and toString.
assert(value != value2);

// Values based on existing values are created via "rebuild".
final value3 = value.rebuild((b) => b..aString = 'three');
assert(value2 == value3);

// Or, you can convert to a builder and hold the builder for a while.
final builder = value3.toBuilder();
builder.anInt = 4;
final value4 = builder.build();
assert(value3 != value4);

redpajama_set_name: RedPajamaStackExchange


text:
Q: Binding several controls to combobox.selectedItem which is an Xml node in my application i have this code:
<Grid Name="BaseGrid">

        <Grid.Resources>
            <XmlDataProvider x:Name="ScenesXmlName" x:Key="ScenesXml" XPath="person" Source="myXml.xml"/>
        </Grid.Resources>
<ComboBox Grid.Column="0" Name="ScenariCombo" IsSynchronizedWithCurrentItem="True"
                  ItemsSource="{Binding Source={StaticResource ScenesXml}}" DisplayMemberPath="@name" />
</Grid>

Suppose my xml is:
<person name="John">
    <address>Some adress here</address>
    <work>Some work</work>
</person>

I'm planning to update several user controls when the selection changes.
the problem is that ComboBox.SelectedItem is not a custom object but an XmlNode as the Combobox is binded to an XmlDataSource.
How would you access an inner node ie: address of the SelectedItem item?

A: I built a little example for you. It works but i am sure you can do better than that.
my Xaml file:
<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:src="clr-namespace:WpfApplication1"
    Title="MainWindow" Height="350" Width="525">
<Grid Name="BaseGrid">
    <Grid.Resources>
        <XmlDataProvider x:Name="ScenesXmlName" x:Key="ScenesXml" XPath="person" Source="myXml.xml"/>
        <src:Xml2AdressConverter x:Key="Xml2AdressConv"/>
    </Grid.Resources>
    <ComboBox Name="ScenariCombo" IsSynchronizedWithCurrentItem="True"
              ItemsSource="{Binding Source={StaticResource ScenesXml}}" DisplayMemberPath="@name" Margin="0,0,272,264" />
    <Label Content="Address" Height="28" HorizontalAlignment="Left" Margin="12,110,0,0" Name="label1" VerticalAlignment="Top" Width="87" />
    <Label Content="Work" Height="28" HorizontalAlignment="Left" Margin="12,144,0,0" Name="label2" VerticalAlignment="Top" Width="87" />
    <TextBox Height="23" HorizontalAlignment="Left" Margin="134,115,0,0" Name="AddressTbx" VerticalAlignment="Top" Width="332"
             Text="{Binding ElementName=ScenariCombo, Path=SelectedItem, Converter={StaticResource Xml2AdressConv}, ConverterParameter=address}"/>
    <TextBox Height="23" HorizontalAlignment="Left" Margin="134,149,0,0" Name="WorkTbx" VerticalAlignment="Top" Width="332"
              Text="{Binding ElementName=ScenariCombo, Path=SelectedItem, Converter={StaticResource Xml2AdressConv}, ConverterParameter=work}"/>
</Grid>

my Xml2AddressConverter class
class Xml2AdressConverter : IValueConverter
{

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        XmlElement xmlElt = value as XmlElement;

        if (xmlElt != null)
        {
            string str, attName;
            XElement xElt;

            attName = parameter as string;

            xElt= XElement.Load(xmlElt.CreateNavigator().ReadSubtree());
            str = "";
            foreach (XElement x in xElt.Descendants(attName))
            {
                 str = x.Value;
            }
            return str;
        }
        return "";
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

Have a look to this it shows a little bit how to query data from xml stuff using LINQ to XML.


text:
Q: Create a new EXE from within C Am working in VC++ 2008 (express) and I would like to write something in C that creates an "empty" exe that I can later call LoadLibrary on and use BeginUpdateResource, UpdateResource, EndUpdateResource to modify the contents.
Just writing a 0-byte file doesn't allow me to open it with LoadLibrary because it isn't a resource.

A: You can compile an empty .exe file with, for example,
int main() { return 0; }

and use it as a template. (Or an empty .dll, whatever)

A: The .EXE format is a complicated file format.  It has a bunch of required headers just to describe its basic execution properties (16 bit, 32 bit or 64 bit, and DOS/Win16/Win32/Win64 mode and EXE versus DLL).  After that, it has to have a correct table for address relocations.  Its not trivial, and you have do some amount of research into the .EXE file format to do this properly.

A: "Creating" an exe is something the compiler is very good at.  So why not have the compiler create the executable you want, and use that file (or a binary representation of it's contents) to copy around?


text:
Q: DOM breaks on loading lots of data in dialogue popup window in Excel? I am facing issue with table rendering. The table contains 3 columns with auto-complete dropdown, in which each dropdown contains more than 50 data. Hence if response gets more than 100 rows dom just crashes.
Is there any optimal way to render data in the dropdowns to resolve the issue?

A: for each keyboard enter one can hit the server, but I don't think that's a good way.


text:
Q: Reasons for my drawing thread to suddenly stop? @Override
public void run() {
    super.run();

    final float timePerFrame = 1000 / Options.MAX_FPS;
    float timeDiff;
    while(!isInterrupted() && isRunning) {
        timeDiff = System.currentTimeMillis();
        mController.refresh();
        timeDiff = timePerFrame - (timeDiff - System.currentTimeMillis());

        try {
               Thread.sleep(Math.max(Math.round(timeDiff), 0));
        } catch(InterruptedException e) {
            // do nothing
            e.printStackTrace();
        }
    }
    Log.e("GameThread", "Thread dead.");
}

This is what my thread is basically doing.
Options.MAX_FPS = 30;

To limit the frames per second, to have some sort of sleeping time between each refresh. The refresh method looks like this:
public synchronized void refresh() {
        int mRotation = Math.round((360 + ((-1)*mAccelerometer[0] * 4.5f)) % 360);
        mObject.setRotation(mRotation);
    // get canvas from surfaceview
    if(mSurfaceHolder != null) {
        // do all calculations.
        if(Looper.myLooper() == Looper.getMainLooper()) {
            log("on main thread!");
        } else {
            log("Not on main thread");
        }

        Canvas mCanvas = mSurfaceHolder.lockCanvas();
        if (mCanvas != null) {
            // shift x offset
            mScreenWidth = mCanvas.getWidth();
            mScreenHeight = mCanvas.getHeight();

            // draw black background, clear everything.
            mCanvas.drawRect(new Rect(0,0,mScreenWidth, mScreenHeight), mBlackPaint);

            // shift & draw all viewobjects if still visible

            for(ViewObject view: mViewObjectList.toArray(new ViewObject[mViewObjectList.size()])) {
                view.shiftX(-1 * Options.Gameplay.Environment.MOVING_SPEED);
                if(view.getX() + view.getWidth() < 0) {
                    mViewObjectList.remove(view);
                }
                if(view.getCurrentBitmap() != null)
                    mCanvas.drawBitmap(view.getCurrentBitmap(), new Rect(0,0,view.getCurrentBitmap().getWidth(), view.getCurrentBitmap().getHeight()), new Rect(view.getX(), view.getY(), view.getX()+ view.getWidth(), view.getY()+view.getHeight()), new Paint());

                view.nextFrame();
            }

            // draw object
            final Bitmap sBitmap = mObject.getCurrentBitmap();
            mObject.nextFrame();
            if(sBitmap != null) {
                mCanvas.drawBitmap(sBitmap, new Rect(0, 0, sBitmap.getWidth(), sBitmap.getHeight()), new Rect(mObject.getX(), mObject.getY(), sBitmap.getWidth(), sBitmap.getHeight()), new Paint());
            } else log("bitmap = null!");
        }

        mSurfaceHolder.unlockCanvasAndPost(mCanvas);
    }
}

The thread keeps running for some time, background elements are being drawn (even though my rotation does not work quite yet, but that's another story..), the background "seems" to move (like a side-scroller), but at some random point in time, without any ADB LogCat messages (not limited to the App but the whole LogCat output) - the thread simply stops. No more drawing. Nothing. I am not calling interrupt or setting isRunning to false, as the "Thread dead." message is not written into LogCat as well..
I do not know what's happening.
Thanks for your help.

A: You have:
timeDiff = System.currentTimeMillis();
// refresh, which takes some time I guess
timeDiff = timePerFrame - (timeDiff - System.currentTimeMillis());

so System.currentTimeMillis() will be later and therefore bigger than timeDiff. The term in brackets will be negative - so you will be adding onto the timePerFrame and timeDiff will grow not reduce.


text:
Q: Passport Authenticator complains of that 'this' could be instantiated with an arbitrary type I'm trying to type a function to accept both local and general passport authenticator. Unfortunately I'm getting a "this" Typescript error:
import { Passport, Authenticator } from 'passport';

const alternativePassport: Authenticator = new Passport();

Causes the error:
Type 'import("/home/max/workspace/npm/graphql-passport/node_modules/@types/passport/index").Authenticator<import("/home/max/workspace/npm/graphql-passport/node_modules/@types/express/index").Handler, any, any, import("/home/max/workspace/npm/graphql-passport/node_modules/@types/passport/index").AuthenticateOptions>' is not assignable to type 'import("/home/max/workspace/npm/graphql-passport/node_modules/@types/passport/index").PassportStatic.Authenticator<import("/home/max/workspace/npm/graphql-passport/node_modules/@types/express/index").Handler, any, any, import("/home/max/workspace/npm/graphql-passport/node_modules/@types/passport/index").Authenticate...'.
  The types returned by 'use(...)' are incompatible between these types.
    Type 'Authenticator<Handler, any, any, AuthenticateOptions>' is not assignable to type 'this'.
      'this' could be instantiated with an arbitrary type which could be unrelated to 'Authenticator<Handler, any, any, AuthenticateOptions>'.ts(2322)
const alternativePassport: Authenticator<express.Handler, any, any, passport.AuthenticateOptions>
No quick fixes available

Minor note: In the real code I want to pass the alternativePassport into a function with an optional passport object that is assigned to the passport.default export if object isn't provided.

A: There seems to be an issue with either the typings of Passport or some underlying issue with Authenticator. To be honest, I'm not sure what TS is complaining about, when I redefine the type exactly as it was before, just re-declaring use and unuse the error goes away. My only guess is that passport overlays the Authenticator interface somewhere or there is a typescript bug:
interface WorkingAuthenticator<
  InitializeRet = express.Handler,
  AuthenticateRet = any,
  AuthorizeRet = AuthenticateRet,
  AuthorizeOptions = AuthenticateOptions
> extends Omit<Authenticator<InitializeRet, AuthenticateRet, AuthorizeRet, AuthorizeOptions>,  'use' | 'unuse'> {
  // This is exactly the same as the `Authenticator` interface
  use(strategy: Strategy): this;
  use(name: string, strategy: Strategy): this;
}

const auth: WorkingAuthenticator = new Passport();

An issue on the passport Github page is probably the way to go here, you can use the WorkingAuthernticator type until the issue is fixed or maybe somebody working on passport knows why this error occurs.

A: Try
import passport, { Passport } from 'passport'

const alternativePassport: passport.Authenticator = new Passport()


text:
Q: Verbose response after install conda package I've encountered the following problem when I attempted to install a couple of packages. I'll use sqlite3 as an example.
When I entered conda install -c blaze sqlite3 in the Anaconda prompt ("base" environment), I received the output below.
I'm uncertain exactly when this problem started. I checked my revisions using conda list -r. Revision #35 - conda  {4.8.3 (conda-forge/win-64) -> 4.8.3 (anaconda/win-64)} - looks odd.
Therefore, I entered conda install revision 34. When I did so, I was informed that conda-forge/win-64 cannot be found, which seems strange. As mentioned earlier, I'm unclear if there's a correlation between revision 34 and this error.
The sqlite3 package listed in the "base" environment in the Anaconda Navigator.
How do I prevent conda from automatically running the additional code?
Collecting package metadata (current_repodata.json): done
Solving environment: /
Warning: 2 possible package resolutions (only showing differing packages):
  - anaconda/win-64::conda-4.8.3-py37_0
  - defaults/win-64::conda-4.8.3-py37done

## Package Plan ##

  environment location: C:\Users\morga\Anaconda3

  added / updated specs:
    - sqlite3

The following NEW packages will be INSTALLED:

  sqlite3            blaze/win-64::sqlite3-3.8.6-0

Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

C:\Users\morga>SET DISTUTILS_USE_SDK=1

C:\Users\morga>SET MSSdk=1

C:\Users\morga>SET platform=

C:\Users\morga>IF /I [AMD64] == [amd64] set "platform=true"

C:\Users\morga>IF /I [] == [amd64] set "platform=true"

C:\Users\morga>if defined platform (set "VSREGKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0" )  ELSE (set "VSREGKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0" )

C:\Users\morga>for /F "skip=2 tokens=2,*" %A in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0" /v InstallDir') do SET "VSINSTALLDIR=%B"
ERROR: The system was unable to find the specified registry key or value.

C:\Users\morga>if "" == "" (set "VSINSTALLDIR=" )

C:\Users\morga>if "" == "" (
ECHO "WARNING: Did not find VS in registry or in VS140COMNTOOLS env var - your compiler may not work"
 GOTO End
)
"WARNING: Did not find VS in registry or in VS140COMNTOOLS env var - your compiler may not work"
The system cannot find the batch label specified - End

<<<<EDIT - ADDITIONAL COMMENT>>>
I did more research it seems that the package  vs2015_win-64 is causing the problem. Others had similar experiences.
I executed conda uninstall  vs2015_win-64. The uninstallation was initiated then stopped and I received the error below.
The same thing occurred when I tried to install plotly using conda install plotly.
Error processing line 1 of C:\Users\morga\Anaconda3\lib\site-packages\matplotlib-3.1.0-py3.7-nspkg.pth:

  Traceback (most recent call last):
    File "C:\Users\morga\Anaconda3\lib\site.py", line 168, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<frozen importlib._bootstrap>", line 580, in module_from_spec
  AttributeError: 'NoneType' object has no attribute 'loader'

A: It is very unlikely this has anything to do with the change in the conda package in that revision (where it switched from sourcing at Conda Forge to Anaconda channel). Instead, some packages include additional installation scripts that must be run during installation for the package to function. There is currently not any way to prevent Conda from executing such scripts.
It might be worth reflecting here that this is a good example of why one should not install packages from channels that one does not explicitly trust. That is, searching Anaconda Cloud to find a package on a random user channel could lead to running arbitrary code that the user has included in the package build.


text:
Q: Best way to detect Text selection change on UWP WebView control I am using  a WebView control to show some html pages and now i have to support text selection feature on this
browser control. I am plannig to show some ActionMenus to user once he select some text

*

*User hit on control and start text selection by dragging

*User doubleclick on a text  and select the text

*If its a touch device user do tap event and might select the text
So how can i raise the event to show the Menus to end user
KeyDown
KeyUp
DragEnter
DragLeave
DoubleTapped
DO i need to use all these events to make it work on both keyboard/mouse interaction & touch interaction

A: WebView does not natively support the events that you have specified.
Refer : WebView Documentation - Events section.
Also read the Remarks section to find a workaround for your problem.
Quick read from documentation : WebView doesn't support most of the user input events inherited from UIElement, such as KeyDown, KeyUp, and PointerPressed. A common workaround is to use InvokeScriptAsync with the JavaScript eval function to use the HTML event handlers, and to use window.external.notify from the HTML event handler to notify the application using WebView.ScriptNotify.


text:
Q: Axios does not run - React JS I am using axios to make a POST request with React JS, specifically a POST request to the Sendinblue API, found here. I have tried multiple variations using axios however I have not had any luck with successfully completing the POST request.
The code is listed below:
var email = this.state.value;
var data = JSON.stringify({ "listIds": [5], "email": email, "attributes": { "SMS": "sms-Number" }, "emailBlacklisted": false, "smsBlacklisted": false, "updateEnabled": true });
var config = {
     method: 'post',
     url: 'https://api.sendinblue.com/v3/contacts',
     headers: {
         'api-key': 'API-key',
          'Content-Type': 'application/json'
     },
     data: data
};

axios(config)
.then(function (response) {
     alert(JSON.stringify(response.data));
})
.catch(function (error) {
      alert(error);
});

I have imported axios and the required libraries at the top.
Given this code, I never get an alert when axios is executed. That is, I never get an alert for success or error. So, it seems as if it is not even running the axios part.
Any ideas on why this may be? Thank you!

A: Thanks everyone for your help. I was able to solve this error by placing the button that triggers this code outside of the form tag.
OLD CODE (not working):
<form>
    <TextInput></TextInput>
    <button onClick={this.runCode}>Click here</button>
</form>

NEW CODE (working):
<form>
    <TextInput></TextInput>
</form>
<button onClick={this.runCode}>Click here</button>


text:
Q: How to Cache JSON Objects Into Single File for Faster Page Load Times I have been looking around for a solution to cache multiple JSON Objects into a single file on my server (without a database). The reason for this is because I am developing a site which has multiple JSON requests from users YouTube channels and the page takes a while to load because of this.
A short section of my PHP File which makes the JSON Requests from YouTube (there are a lot more JSON requests in this json-yt.php file:
// VNM Jar
$realUserName = 'TheEnijar';
$data = file_get_contents('http://gdata.youtube.com/feeds/api/users/' . $realUserName . '?v=2&alt=json');
$data = json_decode($data, true);
$TheEnijar = $data['entry']['yt$statistics'];

// VNM Jinxed
$realUserName = 'OhhJinxed';
$data = file_get_contents('http://gdata.youtube.com/feeds/api/users/' . $realUserName . '?v=2&alt=json');
$data = json_decode($data, true);
$OhhJinxed = $data['entry']['yt$statistics'];

// VNM Pin
$realUserName = 'ImGreenii';
$data = file_get_contents('http://gdata.youtube.com/feeds/api/users/' . $realUserName . '?v=2&alt=json');
$data = json_decode($data, true);
$ImGreenii = $data['entry']['yt$statistics'];

// VNM Zq
$realUserName = 'Zqonalized';
$data = file_get_contents('http://gdata.youtube.com/feeds/api/users/' . $realUserName . '?v=2&alt=json');
$data = json_decode($data, true);
$Zqonalized = $data['entry']['yt$statistics'];

Is this even possible, and if so, can anybody point me in the right direction or provide me with a solution to storing JSON requests prior to the user loading the page and JSON making the request to all the different YouTube channels.

A: To be honest, there is a LOT of different ways to do this. The simplest is to make an assoc array of your data, serialize it and write to the file.
$dataArray = array();

// ...
$data = file_get_contents('http://gdata.youtube.com/feeds/api/users/' . $realUserName . '?v=2&alt=json');
$dataArray['jinxed'] = $data;

$data = serialize($data);
file_put_contents('cache.txt', $data);

Than pull it back:
$data = unserialize(file_get_contents('cache.txt'));

But, as I said, there is a lot of another ways to cache requests. And chosing one of them depends on what else you need from your caching system.
UPD: Don't forget that cached info will become outdated sometime, so you must to update your cache every certain period. To not saving any additional values (like cached time) use filemtime() function for your cache file.

A: you can do something like:
<?php

function getCachableContent($url){
    $hash = md5($url);
    $cacheFile = "/tmp/foo-cache/$hash";
    if ( file_exists($cacheFile) and filemtime($cacheFile) < time() - 300 ) {
        $data = file_get_contents($cacheFile);
    } else {
        $data = file_get_contents($url);
        file_put_contents($cacheFile, $data);
    }
    return json_decode($data);
}

$data = getCachableContent('http://gdata.youtube.com/feeds/api/users/' . $realUserName . '?v=2&alt=json');

but I think it's better to use solutions like redis that provides expire time. also you can create a ramdisk for temp directory (if you're using linux) which makes it faster.


text:
Q: How to make sections have equal height? Here is a minimal working example of my code: https://codepen.io/SamHuguet/pen/xxZqNxK

*

*I have noticed that the 2 sections (each containing an h1 element) have different heights.

*I expected each section to have equal heights (the top section should extend to the top of the page). It looks like it's been cut off above the h1 element.

*Question 1: Why does the top section have a smaller height relative to the lower section?
I can use...
display: flex;
flex-direction: column;

... within the main  element to solve this issue. Here is a minimal working example to demonstrate this: https://codepen.io/SamHuguet/pen/BajWEEZ

*

*Question 2: Why do these 2 lines of code solve the differences in height?

Please structure answers in direct reference to each question.


text:
Q: Add algorithm label to list of algorithms I'm using the classicthesis package along with the algorithmic package.
I'm trying to get the list of algorithms to look the same as the list of figures/tables etc., but cant find a way to make it appear as:
Algorithm 1.1        First Algorithm
Algorithm 1.2        Second Algorithm
Algorithm 1.3        Third Algorithm

Instead it appears as:
Figure 1.1        First Algorithm
Figure 1.2        Second Algorithm
Figure 1.3        Third Algorithm

Any ideas?
edit #1: I've tried the following from this suggested post
\makeatletter
\let{\oldl@algocf}{\l@algocf}
\renewcommand{\l@algocf}[2]{\oldl@algocf{Algorithm #1}{#2}}
\makeatother

But that gives a number of errors beggining with:
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.276 \let{
\oldl@algocf}{\l@algocf}
Please don't say `\def cs{...}', say `\def\cs{...}'.

I'm using the following algorithm packages:
\usepackage{algorithm}
\usepackage{algpseudocode}

One comment on that post suggested replacing l@algocf with l@algorithmcf but that gives similar errors
edit #2: As requested heres a simplified example that produces the listing without the algorithm label, note you need classicthesis.sty and classicthesis-config.tex in the build directory, they can be found here. A sample pdf produced with this code can be found here
\documentclass[ twoside,openright,titlepage,numbers=noenddot,headinclude,%1headlines,%         letterpaper a4paper
            footinclude=true,cleardoublepage=empty,abstractoff, % <--- obsolete, remove (todo)
            BCOR=5mm,paper=a4,fontsize=11pt,%11pt,a4paper,%
            ngerman,american,%
            ]{scrreprt}

\input{classicthesis-config}

\usepackage{algorithm}
\usepackage{algpseudocode}

\numberwithin{algorithm}{chapter}

\begin{document}

\frenchspacing
\raggedbottom
\pagenumbering{roman}
\pagestyle{plain}

%********************************************************************
% Frontmatter
%*******************************************************
\listofalgorithms

%********************************************************************
% Mainmatter
%*******************************************************
\pagenumbering{arabic}

\begin{algorithm}
\caption{Test Algorithm}
\label{alg:test}
\begin{algorithmic}[1]
\For{$i \gets i + 1$}
\State $a = 2i$
\EndFor
\end{algorithmic}
\end{algorithm}

\cleardoublepage

\end{document}

A: You can try with
\listofalgorithms
\addtocontents{loa}{\def\string\figurename{Algorithm}}

How classicthesis manages added lists is not completely without problems.


text:
Q: Android - Bitmap Scale [QS Panel Background] First of all ... I apologize for my English.
I am trying to add a background to the notification panel, the issue is that I have already achieved it by modifying the file qs_background_primary.xml located in SystemUI/res/drawable
This is the code I am using:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@android:color/black"/> <!-- the image is very small, so add a black background -->
<item>
<bitmap android:scaleType="fitXY" android:src="@drawable/background_bg" android:gravity="center|bottom|clip_vertical" xmlns:android="http://schemas.android.com/apk/res/android" />
</item>
</layer-list>

Once the background with image and compilation is ready, one problem bothers me and it is that when I slide the navigation bar the image looks horribly, as if the size started from 0 to its original size once it was completely slid.
This is what the size looks like:

This is what the full size looks like:


text:
Q: My HTML Tags won't be stripped from $this->username I am trying to strip my tags because someone keeps hacking my website by using the old ">blah as their username. For some reason my strip_tags() is not stripping the tags, but the addslashes() is working.
I don't know if I left off a bracket - but here is the code:
     public function register() {
    $correct = false;
        try {
            $con = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
            $con->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
            $this->username = strip_tags($this->username);
            $this->username = addslashes($this->username);
            $sql = "INSERT INTO User_Agents(username, password) VALUES(:username, :password)";

            $stmt = $con->prepare( $sql );
            $stmt->bindValue( "username", $this->username, PDO::PARAM_STR );
            $stmt->bindValue( "password", hash("sha256", $this->password . $this->salt), PDO::PARAM_STR );
            $stmt->execute();
            return "Registration Successful
 Login Now";
        }catch( PDOException $e ) {
            return $e->getMessage();
        }
 }

This is what it turns out to when it goes into my database:

A: Simply disallowing usernames that can lead to problems might be a more simple/efficient solution. For example a preg_match("/^[a-zA-Z0-9\._]+$/", $username) would allow you to reject usernames that contain other characters than letters, digits, dots, or underscores.

A: The strip_tags() function is not the best way to go about this - I would not be sure it would strip a > closing tag if there is no corresponding < opening tag, for example.
In any case there's nothing inherently wrong with angle brackets and quote marks for usernames, as long as you render them correctly in your output code.
Something like this will do the trick (adjust the HTML type and character set to suit):
echo htmlspecialchars($username, ENT_HTML5, 'UTF-8');


text:
Q: quotes problems between freemarker, java and javascript i have a problem with single quotes, sending a word (for ex: patte't) from java to html (freemarker) then use the variable on a "onClick" js function
I have already tried to have an extra escape in java but the variable display will contains '\'(patte\'t). The onClick works fine in this case.
If i use a simple escape in java, the variable display is fine but the onClick deosn't work (parameter like: onClick('patte't')), i got an error in this case.

some

contact.name contains a single quote in his value

ex:
Java send: pette't
html displays: pette't
onClick: error(onClick('patte't'))

Thanks everyone

A: Two layer of escaping is needed in such case: JavaScript string escaping, and then HTML escaping.
For JavaScript string escaping, use ?js_string. With that, you get something like onclick="Ws('someId', 'patte\'t')". That still will be broken if the name contains ", as that will close the HTML attribute value, despite that ?js_string will escape it as \" (as \ has no special meaning in HTML). So the second layer is HTML escaping, which will replace " with " and so on. The good practice is to turn on HTML auto-escaping when generating HTML pages; if it's not turned on on application level, turn it on. (If you can't then start the template with <#ftl output_format='HTML'>.)


text:
Q: Terminal is not opening after xrdp session So i set up xrdp to connect to my ubuntu 20.04 from windows 10 and was able to work with it for quite a while. Initially i did face an issue wherein if I start a new terminal from my windows the terminal would open up inside my ubuntu and I wouldn't see it from my windows.
I fixed that my adding a line to the end of the xfce4 file.
Now, i closed off my rdp session and came back to my ubuntu. First thing I noticed is the reverse of the initial problem I faced. Opening terminals in my ubuntu opens them only in the rdp session presented to windows, but I wont get the terminal here in ubuntu.
I logged off the rdp and I was able to see the firebox tabs i had opened while working via xrdp, but the terminals are not opening up and I don't know what to do?
Please help me.. :(


text:
Q: GnuPG Error - GnuPG failed to start because of "unsafe permissions" Every time I start Kubuntu, I get same error. Here is the KSnapshot:

Any suggestions on how to fix it?

A: The error message already includes a detailed problem statement. You probably migrated your .gnupg folder from another machine, or tampered another way with the file permissions.
These two lines fix the permissions. The first one ensures that the ~/.gnupg folder (and everything in it) is actually yours. To possibly overtake ownership, it requires root privileges, thus the sudo. The second line makes sure nobody but you can read its contents (remove read, write and execute permissions for group and other users).
sudo chown -R ${USER}:${USER} ~/.gnupg
chmod -R go-rwx ~/.gnupg


text:
Q: jquery checkbox reset - inconsistent operation I want to use Jquery to reset checkboxes.  I've read the Q/A on the topic and came up with this:
<script>
$(document).ready(function(){
    $("#clearall").click(function(){
        alert('clearing checkboxes');
        $('input:checkbox').attr('checked',false);
    });
});
</script>
<input id="cb1" type="checkbox" checked>
<input id="cb2" type="checkbox" checked >
<button id="clearall">Click me</button>

On load, two checkboxes appear checked.  Clicking the button clears them.  This is as expected.  What is NOT expected is that if I check the boxes and click the button, the check boxes do NOT clear.  No javascript errors or warnings appear. I've checked the functionality in Firefox, Safari and Chrome - and all 3 operate the same way.  I inserted an alert which fires on every attempt, so the function is executing - but the checkboxes aren't getting reset after the first time. Can anyone offer any insight into why the check boxes do NOT clear if set by the user?

A: Tip: when dealing with boolean attributes (such as disabled, checked, selected, etc.), use .prop() and never use .attr(), .removeProp(), or .removeAttr(). Why? This is because this and this.

*

*.attr() and .removeAttr(): properties are dynamic and attributes are not--they reflect the initial value.

*.removeProp():

Note: Do not use removeProp() to remove native properties such as checked, disabled, or selected. This will remove the property completely and, once removed, cannot be added again to element.

$(document).ready(function(){
    $("#clearall").click(function(){
        $('input:checkbox').prop('checked',false);
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="cb1" type="checkbox" checked>
<input id="cb2" type="checkbox" checked >
<button id="clearall">Click me</button>

A: Try using .removeAttr('checked')


text:
Q: Copy Django App to a New Project but Model Data is Lost I made a development django project on my pc, and I added a bunch of data for one of the apps "things" by logging in the ADMIN panel. When I copy and paste this app folder into a new project on Ubuntu, add this app in setting, then I find all the data in the model is gone. I used "makemigrations, migrate". Still nothing. What should I do to have those data in this new project?

A: Based on the comments it seems that some kind of a solution has already been found. Here I'd like to give my 2 cents.
Django offers command line tools for exporting and importing data. With
python manage.py dumpdata app_label > backup.json

you can export all the data for the app app_label and save it into a file backup.json.
Later you can use this file to load the data:
python manage.py loaddata backup.json

There are many other options, please check the official documentation for further info, like for example using XML instead of JSON and much more.
EDIT:
If you search for dumpdata in the questions tagged with django here at SO, you'll get many hundreds results.


text:
Q: Tiny but strong russian issue Plugin Used : http://www.tinybutstrong.com/plugins.php
Russian characters are not displaying correctly.
In mysql database they are stored correctly collation is utf8_general_ci.
I used define('OPENTBS_ALREADY_UTF8','already_utf8');

A: It looks like an UTF-8 problem.
You have to check that all the data chain is UTF-8 :

*

*all your PHP scripts

*the data injected in the template (usually a database), but you also have to check that your PHP script retrieve the data as UTF8. See « How do I make MySQL return UTF-8? »

*the template (it is actually UTF8 since it is a LibreOffice or Ms Office template)

Since this chain is ok, you have to use the OPENTBS_ALREADY_UTF8 option to load the template.
$TBS->LoadTemplate('my_template.odt', OPENTBS_ALREADY_UTF8);

You can check that you chain is ok by a test like this :
echo "<!doctype html><title>Test</title><meta charset='UTF-8'>";
echo $my_data_from_database;
echo "";
exit;

where $my_data_from_database is a data item retrieve from the database and that contains special characters like Russian characters.


text:
Q: Java regular expression and "greedy" or early search for slash Text:
123/444_ab/alphanum/alphanum/alphanum.sss
256/333_123/alphanum/alphanum.fff
777/999_abcde/alphanum.ggg

I want two groups.

*

*first group matches: 123,256, and 77

*second group matches: 444_ab, 333_123, and 999_abcde.

The problems is any regexp I come up with is including extra slashes for the second group. e.g.333_123/alphanum
ex.
(\\d{3})/\\d{3}_.+)/.+[.].+

It should be just give first two groups with a following slash.

A: As an aside, a requirement like this can also easily be handled by any "split by string" function.  Split on '/' to obtain an array of values and go from there ...
I find that this is often much easier to read, and to debug, than "regular-expression chicken scratches," when the data has a format such as what you show here.  It will also "obviously" show what should happen when the data contains 5, 4, or 3 groups as you demonstrate in your post, and it will work for any number of groups.

A: ^(.*?)\/(.*?)\/.*

This regular expression should do the trick.

A: Converting my comment to answer so that solution is easy to find for future visitors.
You may use this regex with MULTILINE mode:
(?m)^(\\d{3})/(\\d{3}_[^/]+)

RegEx Demo
RegEx Details:

*

*(?m): Enable inline MULTILINE mode so that ^ matches start of each line

*^: Start of line

*(\\d{3}): First capture group to match 3 digits

*/: Match a /

*(\\d{3}_[^/]+): Second capture group to match 3 digits then _ then 1 or more of any character that is not a /

A: Use *? for a non-greedy match: ^(.*?)/(.*?)/.*.
.*? will match only as few characters as necessary for the whole expression to match.
import java.util.regex.*;

public class MyClass {
    public static void main(String args[]) {
        String a = "123/444_ab/alphanum/alphanum/alphanum.sss";
        String b = "256/333_123/alphanum/alphanum.fff";
        String c = "777/999_abcde/alphanum.ggg";
        Pattern p = Pattern.compile("^(.*?)/(.*?)/.*");

        Matcher m = p.matcher(a);
        if (m.matches()) {
            System.out.println("a:");
            System.out.println(m.group(1));
            System.out.println(m.group(2));
        } else {
            System.out.println("'a' doesn't match.");
        }

        m = p.matcher(b);
        if (m.matches()) {
            System.out.println("b:");
            System.out.println(m.group(1));
            System.out.println(m.group(2));
        } else {
            System.out.println("'b' doesn't match.");
        }

        m = p.matcher(c);
        if (m.matches()) {
            System.out.println("c:");
            System.out.println(m.group(1));
            System.out.println(m.group(2));
        } else {
            System.out.println("'c' doesn't match.");
        }
    }
}

Output:
a:
123
444_ab
b:
256
333_123
c:
777
999_abcde


text:
Q: django how show detail page in modal I have a problem. I'm a beginner in django and python and I need help.
I have a page with list of cars and all cars have a button with info. Now, this button redirects me to another page but I want to open this detail view not in a new page but in modal on the same page. I tried many solutions but none of them didn't work in my case.
This is my page with a list of cars car_list.html . It's about car_detailURL.
{% extends 'main/main.html' %}
{% block title %} Lista samochodów {% endblock %}
{% load static %}

{% block content %}
    {% for carTEMP in cars %}

            {{carTEMP}}

Data produkcji: {{carTEMP.car_date_of_prod}}

Numer rejestracyjny: {{carTEMP.car_registration_nr}}

    {% endfor %}

    {% include "main/pagination.html" with page=cars %}
{% endblock %}

And this is car_detail.html which I want to display in modal.
{% extends "main/main.html" %}
{% load static %}

{% block title %}
Szczególy
{% endblock %}

{% block content %}

Marka: {{ car.car_brand }}

Model: {{ car.car_model }}

Silnik: {{ car.car_engine }}

Rok produkcji: {{ car.car_date_of_prod }}

Numer rejestracyjny: {{ car.car_registration_nr }}

{% endblock %}

And my views.py wiht car_detail view.
@login_required
def car_detail(request, id):
    car = get_object_or_404(Car,
                            id=id,
                            car_available=True)

    return render(request, 'cars/car_detail.html',
                  {'car': car})

And urls.py file:
from django.urls import path, include
from . import views

urlpatterns = [
    path('all/', views.cars_list, name='cars_listURL'),
    path('available/', views.cars_list_available, name='cars_list_availableURL'),
    path('new/', views.new_car, name='new_carURL'),
    path('edit/<int:id>/', views.edit_car, name='edit_carURL'),
    path('delete/<int:id>/', views.delete_car, name='delete_carURL'),
    path('<int:id>/', views.car_detail, name='car_detailURL')
]

I don't need ready-made solutions. Carrot will be fine too. I need advice in which direction I must go

A: For things like this would be usefull if you work with bootstrap its pretty easy, otherwise, you have to wire Javascript to make the modal show and hide.
I will give you an example to make you an idea
in carlist.html ,
...
<button id="myBtn">Open Modal</button>
...
{% include "main/car_detail.html" %}
{% endblock %}

for car_detail.html i will give you an example which you could get insights,
<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1">

Crear Torneo

      ×

            ...


text:
Q: How to list SVN repos? Ideally in a browser. Is there a way I can list all repositories I have on my SVN server?  I've found I can do this using the SVNListParentPath directive for Apache according to the SVN documentation.  However, My SVN server is running IIS on a Windows Server 2003.
Is there any way you can do this?

A: I do not believe there is currently any IIS+svn integration.
See these posts:
how-can-i-serve-subversion-from-my-iis-7server
run-svn-repositories-under-iis


text:
Q: Execution times of subquery for an IN statement Is there any documentation about when or how often an select statement is executed when using it in combination with IN?
For example:
Table NumbersTable
Numbers
1
2
3
4
5

Table ObjectsTable
Objects    | NumbersForObjects
Lawnmower  | 4
Hammer     | 2
Cheese     | 12
Plant      | 5

With the following query:
SELECT *
FROM ObjectsTable
WHERE ObjectsTable.NumbersForObjects IN (
        SELECT Numbers
        FROM NumbersTable
        )

Is the subquery which gets the values for the IN statement executed everytime a new row is evaluated? Or is there a possibility to store it like in an array to save execution time?
Maybe the server is also more efficient then I think it to be and it is already as fast as a native array implementation. If there is some kind of general documentation how things are implemented in the background, and somebody wouldn't mind sharing it, this would also be most welcome.

A: It depends on the physical semi join type (Shown in the execution plan).
If it is a hash or merge join it is only evaluated once. If it is a nested loops it will be at least partially evaluated for each outer row (but each evaluation can stop as soon as the first matching value is found for that execution).
For this last case SQL Server may sometimes add a spool to the plan to store the subquery results (and avoid having to re-evaluate from the base tables each time) if it feels that will reduce the cost sufficiently.


text:
Q: Create bitmap from webView/Cordova I have a page loaded in webview/Cordova.
Is it possible to get bitmap object of a picture loaded in that webview with id/class XYZ ?
I know it is possible to pass the image url to java and load Image there and create bitmap object out of it. But in that case image has to be loaded again.

A: Finally I got a workaround for this problem.
It has 3 steps
1.convert image in Webview into base64String
   (This link will help you to do that.)
2.Pass base64String to java using cordova bridge.
3.Decode base64string in java to create a bitmap
(This link will help you to do that.)

A: android 2.3 can get image_file from cache,4.0+,useless


text:
Q: What is the general solution of the Associated Legendre differential equation when $A$ does not equal $\ell(\ell+1)$? I am sorry if this question isn't clear, I couldn't think of a better way to phrase it. I am a Physics student trying to solve the angular component of the wave function for a particle in a central potential. I am sure that most if not all of you are familiar with the problem. Here is what I get for the polar wave function.
$$
    \frac{\sin(\theta)}{\Theta(\theta)}\frac{\partial}{\partial \theta}\left(\sin(\theta)\frac{\partial \Theta(\theta)}{\partial \theta}\right) + A\sin^2(\theta) - m^2 = 0
$$
This is simply the differential equation for the Associated Legendre polynomial $P^m_{\ell}$ specifically where $A=\ell(\ell+1)$ for some integer, $\ell$ after a change of coordinates $x \rightarrow \cos(\theta)$. The original Associated Legendre differential equation is shown below.
$$
    \left(1-x^2\right) \frac{d^2 P_\ell^m(x)}{dx^2} - 2x \frac{d P_\ell^m(x)}{dx} + \left(\ell(\ell+1))-\frac{m^2}{(1-x^2)}\right)P_\ell^m(x) = 0
$$
My problem is that in all references I have read on the subject it isn't clear why $A$ must equal $\ell(\ell+1)$. I understand that the series solution for the polar equation when transformed to the $x$ variable, $\Theta(\theta) \rightarrow y(x)$ yields the important recurrence relation:
$$
\left(1-x^2\right) \frac{d^2 y(x)}{dx^2} - 2x \frac{d y(x)}{dx} + \left(A-\frac{m^2}{(1-x^2)}\right)y(x) = 0
\\
y(x) = \left(1-x^2\right)^{m/2} f(x)
\\
\left(1-x^2\right)  \frac{d^2f(x)}{dx^2} -2(m+1)x \frac{df(x)}{dx} + \left(A - m(m+1)\right)f(x) = 0
\\
f(x) = \sum_{k=0}^\infty f_k x^k
\\
f_{n+2} = \frac{(n+m)(n+m+1)-A}{(n+1)(n+2)}f_n
$$
And specifying that $A=\ell(\ell+1)$ for some positive integer, $l$ cuts off higher order components of $x$ which generates the associated Legendre polynomial; however, $x=\cos(\theta)$, $0\leq\theta\leq\pi$ so $-1\leq x\leq 1$. I cannot find any proof that demonstrates why this series diverges for all $x$ in this range if higher order $x$ terms are not cut off by $A$.
$$
f(x) = \sum_{k=0}^\infty f_k x^k \rightarrow \mathrm{diverge/converge?}
$$
Moreover the the actual solution to $\Theta(\theta)$ is $\left(1-x^2\right)^{\frac{m}{2}} f(x)$ due to the earlier substitution so I need to determine whether this diverges or converges for all $-1\leq x\leq 1$
$$
\Theta(\theta) = (1-x^2)^{\frac{m}{2}}\sum_{k=0}^\infty f_k x^k \rightarrow \mathrm{diverge/converge?}
$$
Thank you for reading this far and I hope I have explained my problem adequately, I have tried to be concise as I can. I got the impression from a similar question that the answer might have something to with Hilbert space so I have been reading about that topic but I would appreciate whatever pointers I could get in the right direction.

A:
What is the general solution of the Associated Legendre differential equation when $A$ does not equal $\ell(\ell+1)$?

When you allow $\ell$ and $m$ to be arbitrary complex numbers $\lambda$ and $\mu$, the general solution is a linear combination of the Legendre functions $P_\lambda^\mu(x)$ and $Q_\lambda^\mu(x)$, not associated Legendre polynomials.

My problem is that in all references I have read on the subject it isn't clear why $A$ must equal $\ell(\ell+1)$.

Any complex $A$ can be written in the form $\lambda(\lambda+1)$ for some complex $\lambda$, so there is no loss of generality. This form is chosen because when $\lambda$ is an integer (i.e. $A=0,2,6,12,\dots$) and $\mu$ is an integer, the $P$ functions become polynomials.


text:
Q: Is this design pattern logical? The following C# is abstract so you can see the structure of what I am trying to accomplish
This is the Composite (GoF) Pattern I am using to represent a FileSystem tree
interface IComponent
{
    void Render();
    void Add(INode);
    void Remove(INode);
}

class Folder : IComponent
{
    List<IComponent> filesAndFolders = new List<IComponent>();

    void Render()
    {
        Console.WriteLine("This is a folder, num childs: " +
    }

    void Add(IComponent add)
    {
        filesAndFolders.Add(add);
    }

    void Remove(IComponent rem)
    {
        filesAndFolders.Remove(rem);
    }
}

class File : IComponent
{
    void Render()
    {
        Console.WriteLine("This is a file");
    }

    void Add(IComponent add)
    {
    //do nothing... cant add folder to file
    }

    void Remove() { } //same as above
}

My problem with the above code is now I have File which does not implement Add or Remove...
I could:

*

*Remove the add and remove from Component, but then I believe I am breaking the pattern a bit.

*Use a complement pattern (decorator?) to change Add in the leaf and composite classes. For example, force Folder somehow to have a method Folder.AddFileOrFolder(Component) and File to have File.AddSibling(File).

*Look at a different pattern. Perhaps I am doing it wrong or trying to accomplish something impossible without knowing more about my requirements? For example some questions would be how is/should the pattern I use interact with the Viewing of the objects and how the user input affects the objects.

These files and folders are really representations of objects on a remote host, they are not acctual files and folders on the hard disk. One user interaction will be when a "file" in the application is dragged onto the desktop, a file is downloaded.
Bonus (some what related) question:
What would be a good trick or technique to cache the files in my application so that if the user does interact with the "virtual" file they see the result faster.
Thank You.

A: I would suggest simply having two classes, Folder and File. The Folder has two collections, Folders and Files. No need to complicate it with ill-fitting patterns. If Files and Folders have some common methods/properties (such as Name), you can create an appropriate interface for just the shared methods/properties.

A: I agree with @Brian. I would create an interface with information that exists both for files and folders.
interface IFileSystemItem
{
    string Name {get; set;}

    // folder for files, parent folder for folders, null for root folders.
    IFileSystemItem Parent {get;set;}

    DateTime CreatedAt {get;set;}

    DateTime ModifiedAt {get;set;}

    ISecurityInfo SecurityInfo {get;set;}
}

Don't try to use patterns without a reason, will only complicate things.

A: Using the composite pattern here is particularly useful if you plan on implementing the visitor pattern with it. In other words, over time you might want to add any number of unforeseen activities on your file/folder structure. For instance, you didn't know you needed the ability to inspect your filesystem for csproj files that contained a reference to EnvDTE or count the number of zero-length files. That is easy with the combination of these two patterns. Sometimes the patterns are useful. Sometimes they go down in history as "it looks like somebody was learning a pattern". Consider the larger business requirements with an engineering trade study. Particularly identify if there is a need for scalability or extensibility and make a decision.

A: I perceive the same problem with almost all patterns that use interfaces. The caller of an interface method has no assurance whatsoever that the implementer performs a particular task, or indeed does anything at all. This dissatisfies me, and I'm not sure I know of a pleasing resolution to this philosophical problem.
One idea I had is to expect every interface method to return an instance of a class - this class should have a private constructor and require certain steps to create it, to 'prove' that the creating method is doing something relevant. It would be like a 'report' of work done that a stranger - which an interface implementer is - can return to the caller for verification.
On the other hand, this could be considered an anti-pattern because the point of interfaces is that you don't care about the underlying implementation. This means that you have to structure your code so it's the implementer's problem if it doesn't expose the expected behaviour, not the caller's.


text:
Q: Is F4_1G belong to the google app engine free Tier? Based on the GCP document  Free Tier usage limits
App Engine has 28 hours per day of "F" Instancees.
I wonder does F4_1G type also belong to the free tier of 28 hours per day?
F1 and F4_1G is so different Instance classes

A: To answer your question, yes F4_1G is also under the free tier offered by Google Cloud Platform. The only difference of the F4_1G to the F1 is in terms of the amount of memory and CPU available to each instance, hence the cost. Here's an example:
F1 would cost $0.05 per hour per instance, while the F4_1G would cost $0.30 (based on the Iowa (us-central1) location). Check this pricing list to know the cost per region.
Therefore, when using F4_1G, you're using x6 of the usual default instance hours. In conclusion, you'll use "24 instance hours" if you run an F4_1G non-stop for 4 hours.


text:
Q: Collapsing toolbar layout collapses when try to scroll it but not when try to scroll recyclerview I am using an XML where there is a collapsing tollbar layout inside appbar layout and there is a recyclerview.
Now I successfully can collapse and emarge the collapsing toolbar layout when i touch and scroll it.
But similar situation does not occur when I touch and scroll the recyclerview.
Here is my code;
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#fff"
    tools:context=".HomeActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/AppBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="150dp"
            android:textAlignment="center"
            app:contentScrim="@color/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:title="Hero Title">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="150dp"
                android:background="#000000"
                app:layout_collapseMode="parallax"
                app:layout_collapseParallaxMultiplier="0.7" />

            <android.support.v7.widget.Toolbar
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Dark">

            </android.support.v7.widget.Toolbar>

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/notification_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </FrameLayout>

</android.support.design.widget.CoordinatorLayout>

I want the collapsing toolbar to collapse when scrolling the recyclerview. Not just when scrolling the collapsing toolbar itself.

A: add NestedScrollView to your layout after AppBarLayout
.
.
.
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior">
.
.
.

and in your java class add
YourRecyclerView.setNestedScrollingEnabled(false);

A: I was needed to erase this line to make it work:
YourRecyclerView.setNestedScrollingEnabled(false);


text:
Q: How to set a Image Button's image xcode aplescript OBJC I am trying to change an Image Button's image object with this code using applescript.
I have tried this:
property theButton : missing Value
on button_(sender)
set newImage to "example.png"
changeImage(newImage)
end button_
on changeImage(newImage)
set theImage to current application's NSImage's imageNamed_(newImage)
theButton's setImage_(theImage)
end changeImage

A: First clarify a few things:
Is the button connected properly? Do you want to change the image on click or before? That's what your code says. If you want to change image before do it in IB or in awakeFromNib method.
Is the buttons action linked properly? Either in IB if your on XCode or pure applescript objc:
theButton's setTarget:me
theButton's setAction:"changeImage:"

If linked you may use a log message to see if it works:
log "works"

This should bring you forward - otherwise please post more code

A: on changeSomeImage_(newImage, targetObjectOutlet, newText, targetLableOutlet)

set newImage1 to current application's NSImage's imageNamed_(newImage)
targetObjectOutlet's setImage_(newImage1)
targetLableOutlet's setStringValue_(newText)

end changeSomeImage_


text:
Q: Are json files added to WebApplicationBuilder checked for values in LIFO order? When trying to build a .Net Core app, I built appsettings.json files for Development, Staging, and Production. I was under the impression that the app would then automatically check the files for the matching environment (i.e. appsettings.ENVNAME.json).  However, my experience led me to believe:

*

*These files are not automatically loaded and must be added (e.g.

builder.Configuration.AddJsonFile("appsettings.json").AddJsonFile("appsettings.Development.json").AddJsonFile("appsettings.Staging.json").AddJsonFile("appsettings.Production.json")

*The files are then checked for values in LIFO order, i.e. if the files are added as above, the Production file will be checked first, regardless of what environment the app is running in

As such, I built my app with
builder.Configuration.AddJsonFile("appsettings.json").AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json")

which seems to be working.
Am I correct on this functionality? And is there any way to implement an automatic check based on environment without making it this explicit, similar to how the transforms are automatically performed in web.configs in Framework?

A: appsettings.json will be loaded automaticlly by default default JsonConfigurationProvider in your project,youc could check this doc,and if you add the customer json file contains the same key ,it would override the former value,It has been explained in the same document


text:
Q: Is $\nless$ standard notation in Mathematics I was recently told that $\nless$ symbol doesn't exist. I know $\nless$ is equivalent to $\geq$, but i wondered if $\nless$ exists, or rather, is used in some theorem or math paper or def, etc. Something to have a reference that it actually exists (or that it doesn't).

A: The symbol does exist and is used. In terms of real numbers, $\not <$ is equivalent to $\ge$, but this is not true for more general orders on sets like partial orders.
A good introductory example of a partial order is that $x<y$ for natural numbers $x,y$ if and only if $x$ is a proper factor of $y$. Here, it may be a useful notation. For instance, the true statement $4\not < 6$ ("$4$ is not a factor of $6$") is not equivalent to the false statement $6\le 4$ ("$6$ is a proper factor of $4$, or equal to $4$").
This is a somewhat contrived example, as we would likely use a different symbol to $<$ for any partial order involving natural numbers, to avoid confusion with the "normal" $<$ (and for divisibility we often use $|$ as a symbol). However, we would use $<$ when discussing partial orders in general, or where there is no "standard" usage of $<$ that already applies.
The only case where I would use $\not <$ for cases involving real numbers is informally, for emphasis. For instance, if someone had written $2.4<2.3$ I might write "the mistake here is that $2.4\not <2.3$" or something like that.


text:
Q: Why won't my Animated API component show in React Native? I'm trying to use the interpolate function in the Animated Api and when I use the Image component this works but when I use the Animated.Image nothing appears or if I hardcode rotate with a value it also doesn't work or throw an error.
import React from 'react';
import { StyleSheet, Text, View, Animated, Easing, Image} from 'react-native';

export default class App extends React.Component {
  state = {spinValue : new Animated.Value(0)}

  componentDidMount(){
    Animated.timing(
      this.state.spinValue,
      {
        toValue: 1,
        duration: 3000,
        easing: Easing.linear
      }
    ).start()
  }

  spin = this.state.spinValue.interpolate({
    inputRange: [0, 1],
    outputRange: ['0deg', '360deg']
  })

  render() {
    return (
      <View style={styles.container}>
        <Animated.Image
          style={{transform: [{rotate: "90deg"}] }}
          source={{uri: 'https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Square_-_black_simple.svg/1200px-Square_-_black_simple.svg.png'}} />
        <Text>Testing</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

A: From React-native documentation :

Note that for network and data images, you will need to manually specify the dimensions of your image!

You need to add a Width and Height in your style prop


text:
Q: How to style Angular Material autocomplete? I work with Angular and use Angular Material
[https://material.angular.io/components/autocomplete/api][1]
[1]: https://material.angular.io/components/autocomplete/api
I would like add a border radius in my md-autocomplete but it doesn't work:
<md-autocomplete  class="myclass">

.myclass{
    background-color: rgb(250, 250, 250);
     border-bottom-left-radius: 50px;
     border-bottom-right-radius: 50px
}

Do you have an explanation?

A: To change the drowpdown list styling, use .mat-autocomplete-panel classname:
::ng-deep .mat-autocomplete-panel{
  border-radius: 10px;
}

This will affect all the autocompletes. If you have more than one and wish to style them differently, you can set different variable name and style accordingly. For example for the second one:
HTML
<md-autocomplete #mauto="mdAutocomplete">

CSS
::ng-deep .mat-autocomplete-panel#md-autocomplete-0{  //for the first one

::ng-deep .mat-autocomplete-panel#md-autocomplete-1{ //for the second one

DEMO

A: Do you want to put a border around the md-autocomplete or do you want the border to be around the md-form-field?
I believe you want it around the form field.  See https://material.angular.io/components/autocomplete/examples for an example of the HTML.
If you open the following plunkr, it uses your css to style the md-form-field:
.example-full-width {
     background-color: rgb(255, 0, 0);
     border-bottom-left-radius: 50px;
     border-bottom-right-radius: 50px
}

https://plnkr.co/edit/DWzjsRNGXZsPRfjWRrI6?p=preview
I used red instead of 15% gray so it was more obvious.


text:
Q: Is it possible to select bluetooth audio codec in HFP profile? By enabling developer options in Android,it is possible to change A2DP audio codec(SBC/aptx/aptxHD...).
In the similar manner, Is it possible to change bluetooth audio codec(CVSD/mSBC) in HFP profile as well?

A: The general answer is NO.
When either side HFP want to make an audio channel, the two side will negotiate at the time and based on the many factors and run-time conditions to chose a best fit.


text:
Q: Isolate URL Parameters I'm trying to get the url parameter(device) and call it out in the body. the code below works great except it'll come out as iPhone+4s*. Is there any way to remove the + and * and just have it say iPhone 4s?
url - http://mydomain.com/click.php?device=[[device_name]]
<script>
function getURLParameter(name) {
return decodeURI(
    (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1] || ''
);
}
</script>

<body>
<script>document.write(getURLParameter('device'))</script>
</body>

A: You have to just replace all & + = because they aren't going to decode as they are allowed characters in url-encoding.
uri = decodeURIComponent(uri);
uri = uri.replace(/\+/g, '-');


text:
Q: Invoke a stage repeatedly from another stage I am currently writing a job that clones upstream docker images to my internal docker repo.
My job parameter page looks like

So it takes all the images and then generates the actual path on how it should look like
pipeline {
    agent none
    stages {
        stage('Create new image paths:tag'){
            steps {
                script {
                    params.IMAGES.split("\\r?\\n").each{ oldfullPath ->
                        def (path, tag) = oldfullPath.tokenize( ':' )
                        def app = path.tokenize('/')[-1]
                        println "App is ${app} and Tag is ${tag}"
                        switch(params.REPO) {
                            case "monitoring":
                                image = "eu.gcr.io/<PROJECT>/infra/monitoring"
                                break
                            case "apps":
                                image = "eu.gcr.io/<PROJECT>/infra/apps"
                                break
                        }
                        def newFullPath = "${image}/${app}:${tag}"
                        println "Full old image path is ${oldfullPath}"
                        println "Full new image path is ${newFullPath}"
                        // Pull and Push Image stage should be called here ! Using `${oldfullPath}` and `${newFullPath}`
                    }
                }
            }
        }

As you can see, since i have multi line input, I have to use a loop to go through each line, get the app name and the tag and using switch, I generate the newpath. So for every iteration, I get ${oldfullPath} and ${newfullPath}
Now I need to pull and push these docker images. I do not want to leverage dind, so Im making using of Kaniko. And to pull and push an image, I can use something like this:
stage('Pull and Push Image') {
    agent {
        label "kaniko"
    }
    steps {
        container(name: 'kaniko', shell: '/busybox/sh') {
            withCredentials([
                string(credentialsId: 'infra', variable: 'PASS')
            ]) {
                withEnv(['PATH+EXTRA=/busybox:/kaniko']) {
                    sh """#!/busybox/sh
                    echo "FROM <OLD-IMAGE-PATH-COMES-HERE>" | \
                    /kaniko/executor \
                        --dockerfile /dev/stdin \
                        --destination <NEW-IMAGE-PATH-COMES-HERE>
                    """
                }
            }
        }
    }
}

As you can see, this is a whole different stage. So i'm unsure of how can I call the Pull and Push Image stage repeatedly from the previous stage. Any help will be greatly appreciated.

A: There's quite a bit to process here.
First, if you just want to copy Docker images over to your registry, this can be done as follows:
me@vm:~$ docker pull alpine:latest
latest: Pulling from library/alpine
89d9c30c1d48: Pull complete
Digest: sha256:c19173c5ada610a5989151111163d28a67368362762534d8a8121ce95cf2bd5a
Status: Downloaded newer image for alpine:latest
me@vm:~$ docker tag alpine:latest my-registry.my-company.io/alpine:latest
me@vm:~$ docker push my-registry.my-company.io/alpine:latest
The push refers to a repository [my-registry.my-company.io/alpine]
77cae8ab23bf: Pushed
latest: digest: sha256:e4355b66995c96b4b468159fc5c7e3540fcef961189ca13fee877798649f531a size: 528

Second, your parsing can be done inside the container in the loop, instead of in a separate step:
stage('Pull and Push Image') {
    agent {
        label "kaniko"
    }
    steps {
        container(name: 'kaniko', shell: '/busybox/sh') {
            withCredentials([
                string(credentialsId: 'infra', variable: 'PASS')
            ]) {
                withEnv(['PATH+EXTRA=/busybox:/kaniko']) {
                    // RUN THE LOOP HERE
                    script {
                    params.IMAGES.split("\\r?\\n").each{ oldfullPath ->
                        def (path, tag) = oldfullPath.tokenize( ':' )
                        def app = path.tokenize('/')[-1]
                        println "App is ${app} and Tag is ${tag}"
                        switch(params.REPO) {
                            case "monitoring":
                                image = "eu.gcr.io/<PROJECT>/infra/monitoring"
                                break
                            case "apps":
                                image = "eu.gcr.io/<PROJECT>/infra/apps"
                                break
                        }
                        def newFullPath = "${image}/${app}:${tag}"
                        println "Full old image path is ${oldfullPath}"
                        println "Full new image path is ${newFullPath}"

                    sh """#!/busybox/sh
                    echo "FROM ${oldfullPath}" | \
                    /kaniko/executor \
                        --dockerfile /dev/stdin \
                        --destination ${newFullPath}
                    """
              // adjust closing brackets as needed

This, of course, would be running the building sequentially on a single node, which may be just OK for you, or it may be not.
Now, let's assume that your real question is, "How do I start yet unknown number of parallel stages in declarative pipeline?"
The answer to this is, you can programmatically build your pipeline, like this:
images_array = ["quay.io/one", "docker.io/two", "docker.io/three"] // or split params as needed

def getBuilders()
{
    def builders = [:]

    images_array.eachWithIndex { it, index ->
        // name the stage
        def name = 'Build image #' + (index + 1)
        builders[name] = {
            stage (name) {
                def my_label = "kaniko" // can choose programmatically if needed
                node(my_label) {
                    timeout(time: 2, unit: 'HOURS') {
                        try {
                            buildOneImage(it)
                        }
                        catch (err) { println "Failed to build ${it}"; throw err  }
                        finally {  }
                    }
                }
            }
        }
    };
    return builders
}

def buildOneImage(old_path) {
   // replace path as needed, build image
   // use scripted-style pipeline, not the declarative one
}

And later in your main pipeline
        stage('Build all images') {
            steps {
                script {
                    def builders = getBuilders()
                    parallel builders
                }
            }


text:
Q: "at all" in affirmative sentences without non-assertive words I know "at all" in affirmative sentences is typically licensed by non-assertive words such as "any" and "if," but the following use of "at all" seems okay without those words:

John is grateful to have a job at all.

John is grateful that he has a job at all.

John is grateful that he found a job at all.

I am curious about how the "at all" is licensed.

A: It wouldn't be licensed without the surrounding "John is grateful..." clause.
The following is unacceptable or ungrammatical for me (so marked with a preceding asterisk * per common convention):

*

**John has a job at all.

It isn't completely unimaginable to me that an English speaker could produce the above sentence, but my expectation upon hearing or reading it would be that the speaker might also ignore licensing requirements for any other negative polarity items. (I've encountered a few people online who seem to have this as a habit; I think it may have originally been a deliberately unusual stylistic feature that some people adopted in adulthood.)
I feel that "ever" can also be licensed by grateful, as in "I'm grateful to have ever met you"/"grateful that I ever met you".
However, "any longer/any more" doesn't seem to be licensed:
*"I'm grateful to have a job any more". I'm not sure why it is different from the other two NPIs mentioned.


text:
Q: Ordered map with independent key equality Is there any implementation of an ordered key-value collection data-structure (like TreeMap or ConcurrentSkipListMap) where the key equality is not dependent on ordering (compareTo / Comparator implementation)?
I agree that most times, these two concepts are connected (and allow for a more performant data structure), but when you want the concept of equality just to enforce key uniqueness it comes handy to separate the two.
Imagine having a class C with fields id and rank that is used as a key in a Map<C,?>. Is there a data structure that lets you enforce uniqueness on id (hashCode + equals) but have the map sorted by rank (compareTo/comparator)?
EDIT:
As Sotirios Delimanolis pointed out on his comment, this is conceptually impossible to do with these mechanisms (hashcode/equals/compareTo/comparator) as it would violate their contracts. I guess it would still be possible to do outside of these restrictions, so I'm leaving this open.


text:
Q: Loop ending early in trying to create XML using PL/SQL via concurrent programs in Oracle EBS This is my base code that has been working in the past.
I've been trying to create a XML file using PLSQL and concurrent programs for EBS. I have done successfully in the past using the first set of codes. but currently my second code stops at the line shipping address and only gets 1 row set.
 LOOP
      FND_FILE.put_line(FND_FILE.OUTPUT,'<ROW>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<ACCOUNT_NUMBER>'||rec.ACCOUNT_NUMBER||'</ACCOUNT_NUMBER>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<ACCOUNT_NAME>'||replace(rec.ACCOUNT_NAME,'&','and')||'</ACCOUNT_NAME>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<ADDRESS1>'||rec.ADDRESS1||'</ADDRESS1>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<CITY>'||rec.CITY||'</CITY>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<STATE>'||rec.STATE||'</STATE>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<GEOGRAPHY_NAME>'||rec.GEOGRAPHY_NAME||'</GEOGRAPHY_NAME>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<POSTAL_CODE>'||rec.POSTAL_CODE||'</POSTAL_CODE>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<TRX_DATE>'||rec.TRX_DATE||'</TRX_DATE>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<TRX_NUMBER>'||rec.TRX_NUMBER||'</TRX_NUMBER>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<DESCRIPTION>'||rec.DESCRIPTION||'</DESCRIPTION>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<receipt_date>'||rec.receipt_date||'</receipt_date>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<receipt_number>'||rec.receipt_number||'</receipt_number>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<CIMA_REV>'||rec.CIMA_REV||'</CIMA_REV>');

  FND_FILE.put_line(FND_FILE.OUTPUT,'</ROW>');
END LOOP;
FND_FILE.put_line(FND_FILE.OUTPUT,'</ROWSET>');

This is my current code that I've been making and it stops at <SHIP_ADDRESS1></SHIP_ADDRESS1>
 FOR REC IN C_DATA
    LOOP
      FND_FILE.put_line(FND_FILE.OUTPUT,'<ROW>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<INVOICE_NUMBER>'||rec.Invoice_Number||'</INVOICE_NUMBER>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<INVOICE_DATE>'||rec.Invoice_Date||'</INVOICE_DATE>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<INVOICE_AMOUNT>'||rec.Invoice_Amount||'</INVOICE_AMOUNT>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<INVOICE_TYPE>'||rec.Invoice_Type||'</INVOICE_TYPE>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<INVOICE_BALANCE>'||rec.Invoice_Balance||'</INVOICE_BALANCE>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<SHIP_TO>'||rec.Ship_to||'</SHIP_TO>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<SHIP_TO2>'||rec.Ship_to2||'</SHIP_TO2>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<SHIP_ADDRESS1>'||rec.Ship_address1||'</SHIP_ADDRESS1');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<SHIP_2ADDRESS2>'||rec.Ship_address2||'</SHIP_2ADDRESS2>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<BILL_TO>'||rec.Bill_to||'</BILL_TO>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<BILL_TO2>'||rec.Bill_to2||'</BILL_TO2>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<BILL_ADDRESS1'||rec.Bill_address1||'</BILL_ADDRESS1>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<BILL_ADDRESS2>'||rec.Bill_address2||'</BILL_ADDRESS2>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<DUE_DATE>'||rec.Due_Date||'</DUE_DATE>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<ORIGINAL_TOTAL_AMOUNT>'||rec.Original_Total_Amount||'</ORIGINAL_TOTAL_AMOUNT>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<AMOUNT_DUE>'||rec.Amount_Due||'</AMOUNT_DUE>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<DAYS_LATE>'||rec.Days_Late||'</DAYS_LATE>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<INVOICE_TAX>'||rec.Invoice_Tax||'</INVOICE_TAX>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<SHIP_AND_HANDLING>'||rec.Ship_and_Handling||'</SHIP_AND_HANDLING>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<CUSTOMER_NUMBER>'||rec.Customer_number||'</CUSTOMER_NUMBER>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<CUSTOMER_NAME>'||rec.Customer_name||'</CUSTOMER_NAME>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<LINE_NUMBER>'||rec.Line_Number||'</LINE_NUMBER>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<PRODUCT_CODE>'||rec.Product_Code||'</PRODUCT_CODE>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<DESCRIPTION>'||rec.Description||'</DESCRIPTION>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<QUANTITY>'||rec.Quantity||'</QUANTITY>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<UNIT_PRICE>'||rec.Unit_Price||'</UNIT_PRICE>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<ORDER_NUMBER>'||rec.Order_Number||'</ORDER_NUMBER>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<PO_NUMBER>'||rec.PO_Number||'</PO_NUMBER>');
                  enter code hereFND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<SHIPPING_INSTRUCTIONS>'||rec.Shipping_Instructions||'</SHIPPING_INSTRUCTIONS>');
                  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<AMOUNT>'||rec.Amount||'</AMOUNT>');

Anything I can do to stop this from happening?

A: It looks like you are missing > in your closing tag for '</SHIP_ADDRESS1' as well as in your opening tag for '<BILL_ADDRESS1'.
Instead of building your XML file with string concatenation (which could lead to malformed XML like you currently have), I would recommend building your XML using an XMLTYPE within your select statement.  This way, you could build your XML all at once, then write the entire contents to a file in one go. Changing your code to function like this would greatly reduce the amount of code you would need to write and remove the need to loop through each line potentially improving performance.
In the example below, I used an example query to generate some "invoice" data, but you can change that to whatever you are using for your cursor.
DECLARE
    l_xml   XMLTYPE;
BEGIN
    WITH
        invoice_data (invoice_number, invoice_date, invoice_amount)
        AS
            (    SELECT LEVEL, SYSDATE - LEVEL, ROUND (DBMS_RANDOM.VALUE (0, 10000), 2)
                   FROM DUAL
             CONNECT BY LEVEL <= 100)
    SELECT XMLELEMENT (
               "ROWSET",
               XMLAGG (
                   XMLELEMENT (
                       "ROW",
                       XMLCONCAT (XMLELEMENT ("INVOICE_NUMBER", invoice_number),
                                  XMLELEMENT ("INVOICE_DATE", invoice_date),
                                  XMLELEMENT ("INVOICE_AMOUNT", invoice_amount)))))
      INTO l_xml
      FROM invoice_data;

    DBMS_XSLPROCESSOR.clob2file (l_xml.getClobVal, 'TMP', 'testfile.txt');
END;
/

If for some reason you need to read the file back, you can read the file like this:
DECLARE
    l_clob   CLOB;
BEGIN
    l_clob := DBMS_XSLPROCESSOR.read2clob ('TMP', 'testfile.txt');
    DBMS_OUTPUT.put_line (DBMS_LOB.SUBSTR (l_clob, 32767, 1));
END;
/


text:
Q: Почему не удается пройти аутентификацию на сайте с моими cookies? У меня общий теоретический вопрос:
Почему, например, на сайте vk.com работает следующий способ(и на куче других сайтов тоже), а на другом такой метод не работает?
Способ:

*

*Залогиниться на сайт.

*Сохранить свои куки для этого домена.

*Залогиниться, используя эти куки с другой программы.

Я думал, что куки это единственный способ запомнить и идентифицировать пользователя, разве есть другие способы или я просто туплю?
Спасибо заранее!

A: Здравствуй. Есть Session которые хранятся на сервере и так же можно идентифицировать пользователя. Почитать пример тут php Session

A: Это зависит от того, как именно реализованы механизмы идентификации и аутентификации на конкретном ресурсе. Кто-то может хранить в сессии User-Agent например, и проверять его всякий раз. Может хранить некий хэш из каких-то данных. Тогда другому браузеру Вы уже эти куки не подсунете. Вы задали очень абстрактный вопрос.
P.S. Куки далеко не единственный способ :)


text:
Q: Center a relative element with Jquery animate I have a div  #sample with relative position and no predefined width; I want to center it after having moved it away, with the following commands:
$('#sample').animate({
    "left": -3000
}, 1500);
$('#sample').animate({
    'left': x
}, 1500);

My problem is I do not know how to calculate x. In case #sample would be absolute positioned I knew it. However, I want relative position and $("#sample").width() does not coincide with its real width as to use it for finding the center. Any idea for helping me?
Thank you very much

A: If you calculate the width of the element and its parent element then you can center it as follows,
var elemWidth = $('#sample').width();
var parentWidth = $('#sample').parent().width();
$('#sample').animate({ 'left': (parentWidth/2-elemWidth/2)}, 1500 );

example
http://jsfiddle.net/wQ3K7/
js
$(document).ready(function(){
    $('#sample').animate({ "left": -3000 }, 1500 );
    $('input[type="button"]').click(function(){
        var elemWidth = $('#sample').width();
        var parentWidth = $('#sample').parent().width();
        $('#sample').animate({ 'left': (parentWidth/2-elemWidth/2)}, 1500 );
    });
});

html

this is a test

<input type="button" value="animate"/>

css
div{
    position:relative;
    background-color:lightgrey;
    width:200px;/*random width*/
}


text:
Q: Which ubuntu AMI should I choose to create a new EC2 instance? What are the advantage and disadvantages? I want to set up an ec2 instance which runs Ubuntu 14.04
There are two possible set of candidates of AMI:
From the Quick Start menu

vs from Ubuntu

What should I consider before I make a choice? Are they basically identical?
One concern I have regarding the ubuntu community AIMs is this: As i can see in this url here, https://cloud-images.ubuntu.com/trusty/current/, the 14.04 TLS AMIs seem to be rebuilt regularly. Does it mean that, shall I decide to set up a new ec2 in the future, I might not be able to baseline on the same AMI as available now because they could be removed?

A: Once you create a host from an AMI you can create a snapshot of the volume (should be done before starting the instance to avoid having irrelevant state on the disk), and create a new AMI from that snapshot. Then you have your own AMI with the same contents.
As for which one to choose, there are only two 14.04 images available: EBS (presumably PV) and HVM. Which one is best for you depends on your requirements.


text:
Q: Understanding the difference between basis, topology, and open sets in finite products I understand that an open set is just a subset of a space that obeys the definition of a topology.
I understand that a basis is a collection of open subsets of a space such that every open set of the space is a union of members of the basis.
But I'm confused for product spaces:
Product spaces $(\prod X_i, T')$ are defined with a basis for $T'$ being generated by $\prod O_i$.  So by the definition of a basis, each $\prod O_i$ should be an open set in $(\prod X_i, T')$.  But to use a specific case:  If $(0,1)\times(0,1)$ and $(2,3)\times(2,3)$ are open sets then their union should be an open set in $R^2$.  But this defies the definition of a topology since no $O_1\times O_2$ equals this for $O_1, O_2$ being open subsets in $R$, respectively.
Can someone explain what I'm misunderstanding here?

A: The product topology on $X \times Y$ is specified by the base $$\mathcal{B} = \{O_1 \times O_2: O_1 \subset X \text{ open } ,O_2 \subset Y \text{ open }\}$$
and indeed all open sets of $X \times Y$ are by definition the unions of those basic open sets.
So $(0,1) \times (0,1) \cup (2,3) \times (2,3)$ is indeed open as a union of basic open sets. It's not in $\mathcal{B}$, but a base is not closed under unions, why would it be? Most bases in practice are not closed under unions.
You seem to think that $\mathcal{B}$ are all open sets, but there are way many more (e.g. the open circle in the plane is also a union of open squares).

A: Clarification: Most general, the product topology is generated by the sub-base of $\pi_i^{-1}(\theta_i)$, where $\theta_i$ is a open set of the $i^{th}$ space and $\pi_i$ the canonical projection in the respective space. A sub-base is a family of open sets s.t. any set in base is a finite intersection of sets in the sub-base. So the sets in base are finite intersection of pre-image of canonical projection; it's hard to imagine but it's like fixing finite coordinates in a open set and leaving the rest free in the respective component of the product.
Said, that, a open set of the product is a union (of any cardinal) of this pseudo-boxes from the base. The base is like lego pieces and topology it's like all you can build with the base.
Extra-information: The point of having sub-bases is that, with them, you can build a topology from almost nothing. I mean, what you get is the smallest topology that contains the sub-base, which don't need to have any property. That's hoy we can give a topology to a so ware space like product (any cardinal)


text:
Q: How Oracle ADF Faces renders HTML5 elements I found somewhere on the web the document below. Could somebody help me to find how Oracle ADF Faces renders HTML5 elements?

A: Your question is not clear. ADF Faces components generate markup at runtime and some of those markup components use HTML5.

A: note that using ADF Faces you wont be exposed to HTML 5 directly.
Instead the ADF Faces components would use HTML 5 in their rendering.
for example if you need a component with the canvas behavior then this need to be provided as an ADF Faces component.
please check this answer here
Hope that helps .


text:
Q: C++20 : How to calculate difference between year_month_date? Using C++20's <chrono>, how can I find the days difference of two year_month_day objects?
int main()
{
    using namespace std::chrono;
    const auto now = system_clock::now();
    const year_month_day today = floor<days>(now);
    const year_month_day xmas = today.year() / month(12) / day(25);

    const days days_till_xmas = xmas - today;
    // I want something like this ---^
}

A: You can use std::chrono::sys_days to convert to  std::chrono::time_point. For example,
auto diff = std::chrono::sys_days(xmas) - std::chrono::sys_days(today);
std::cout << "diff days: " << std::chrono::duration_cast<std::chrono::days>(diff).count() << "days\n";


text:
Q: How can I reference existing groups in my VBA code? I have already grouped cells in a spreadsheet using DATA>GROUP.
Based on a menu style system, I want to collapse/uncollapse a series of already created groups in a sheet, so that it only shows the selection chosen via the menu choices. I hope this makes sense.


text:
Q: MATLAB - Rotate an object with makehgtform - zrotate only around the origin I'm trying to use a slider and rotate a sphere in matlab. It works if the sphere is in the origin. but my sphere is at point (2.5,2.5,7.5) when I rotate it, the entire sphere rotates still around the origin. I want it to stay in the point and just spin.
My code: this is my slider function
function  slider_callback1(hObject, eventdata)
            s1 = get(slider, 'value');
            R1 = makehgtform('zrotate', s1);
            set(t1, 'Matrix', R1);
            drawnow;
  end

Where
t1 = hgtransform;
set(sphere_1, 'Parent', t1);

A: To rotate around an arbitrary point, you need three transforms; a translation to the origin, the rotation itself, and then a translation back.  These can of course be combined into a single 4D transform matrix.
I've never used makehgtform, but from the documentation it seems to have a 'translate' option, which sounds like what you need.

A: Thanks, this is how I solved it:
function slider_callback1(hObject, eventdata)
    s1 = get(cabin, 'value');
    R1 = makehgtform('zrotate', s1);

    R1(1,4) = 2.5;
    R1(2,4) = 2.5;
    R1(3,4) = 7.5;
    set(t1, 'Matrix', R1);

    s1 = floor(s1 * (180/pi) * 10)/10;
    set(sth1, 'String', num2str(s1));
    drawnow;
end


text:
Q: Facebook API: Get Replies for Posts I am trying to get the replies based on facebook posts. An example to this is a user publish question on a status and another user replies to that status.
So far I can use the following url and get the json https://graph.facebook.com/search?q=what&type=post but here I only get the status and don't have the option to capture the replies for it.
Here is the result at the time I execute, but when you execute again you will get a different results set yet I have no way to follow up with the any of the given id's.
id: "1512134078_2118135082256",
from: {
name: "Gracie Armijo",
id: "1512134078"
},
message: "What is going on with the Comedy Central Roast.  Is there a curse?  I work on the David Hasselhoff.  After that Greg Giraldo was gone.  Then I worked the Charlie Sheen roast and now Patrice O'neal.  He was so upset with all the remarks that was said about him too.  RIP Patrice..",
type: "status",
created_time: "2011-11-29T21:11:53+0000",
updated_time: "2011-11-29T21:11:53+0000"

I wish base on the id I could look up all the replies for this message. But so far I have not been able to do that.


text:
Q: python attribute error while calling method from a different class I have two classes in a package.
class a(object):

    def func1(self,param):
        return param.split(',')

    def func2(self,param):
        a=self.func1(param).upper()
        return a

from package_name.file_name import a
class b(object):

    def func3(self,param):
        b=a.func2(param)
        return b

When i call the func3, attribute error is returned which specifies that class b has no atttribute func2.
Any help appreciated!

A: This error is occurring because 'a' needs to be called from inside 'b' to access the attribute. Instead of saying class_name, tell it the name of the class, which is 'a'.
For
def func3(self,param):
        b=class_name.func2(param)
        return b

Try
def func3(self,param):
        b=a.func2(param)
        return b


text:
Q: runtime package installation in delphi I am using delphi 5 and have installed some custom components. When I try to open a form from the IDE I am getting the following error:

Class TdxButtonEdit not found. dxEdit.bpl package contains that
  TdxButtonEdit.

dxEdit.bpl is runtime package, how to install it? When I try I am getting the error:

Cant install because its not design time package.

A: TdxButtonEdit is from an old DevExpress Library because the new one as changed to TcxButtonEdit and is part of the ExpressEditors. They aren't free but for me are the best VCL components, very rich and powerful and great on support. You don't have any dcldxEdit.bpl?


text:
Q: How do you limit retry & rescue in this Ruby example? In the humble book of Ruby, an example of using Rescue and retry is provided of sending HTTP headers to a server using the following code:
def make_request
  if (@http11)
    self.send('HTTP/1.1')
  else
    self.send('HTTP/1.0')
  end
rescue ProtocolError
  @http11 = false
  retry
end

To limit an infinite loop in case it doesn't resolve, what code would I have to insert to cap the retries to say 5 times? Would it be something like:
5.times { retry }

A: I used this function to run and retry a command a limited number of times with an intermittent delay. It turns out the tries argument can simply be augmented in the function body and is passed on when retry is called.
def run_and_retry_on_exception(cmd, tries: 0, max_tries: 3, delay: 10)
  tries += 1
  run_or_raise(cmd)
rescue SomeException => exception
  report_exception(exception, cmd: cmd)
  unless tries >= max_tries
    sleep delay
    retry
  end
end

A: You could set a variable to 0 and increase it every time you retry, until your maximum is reached, like this:
def make_request
  limiter = 0
  ...
rescue ProtocolError
  @http11 = false
  if limiter < MAXIMUM
    retry
  end
end

Additionally you could try it yourself with this:
def make_request
  raise ProtocolError
rescue ProtocolError
  try_to_find_how_to_limit_it
end

A: You can just write a 5.times plus a break on success inside the loop, or  abstract the pattern to keep the logic separate from the looping. An idea:
module Kernel
  def with_rescue(exceptions, retries: 5)
    try = 0
    begin
      yield try
    rescue *exceptions => exc
      try += 1
      try <= retries ? retry : raise
    end
  end
end

with_rescue([ProtocolError], retries: 5) do |try|
  protocol = (try == 0) ? 'HTTP/1.1' : 'HTTP/1.0'
  send(protocol)
end


text:
Q: nhibernate saving a dictionary in a ternary relation Class:
class Track
{
    ...
    public virtual IDictionary<People, Role> PeopleRoles { get; set; }
}

Mapping:
<class name="Track" ...>
   ...
   <map name="PeopleRoles" table="track_people_role">
   <key column="track_id"/>
   <map-key-many-to-many column="people_id" class="People"/>
   <many-to-many column="role_id" class="Role"/>
  </map>
</class>

When I execute the code below I can see the row inserted in track_people_role table as 47637,10,1
    Person p = PersonManager.GetById(10);
    Role pr = RoleManager.GetById(1);
    Track t = TrackManager.GetById(47637);

    t.PeopleRoles.Add(p, pr);
    TrackManager.Save(t);

after when I execute the previous with a different role I get "An item with the same key has already been added" error
    Person p = PersonManager.GetById(10);
    Role pr = RoleManager.GetById(2);
    Track t = TrackManager.GetById(47637);

    t.PeopleRoles.Add(p, pr);
    TrackManager.Save(t);

Any ideas how i can manage to insert the second row.
EDIT:
Mapping:
<class name="TrackPersonRole, App.Data" table="trackpeoplerole" lazy="true">
    <composite-id>
    <key-many-to-one name="Person" class="Person" column="people_id"/>
    <key-many-to-one name="Role" class="Role" column="role_id"/>
    </composite-id>
</class>

<class name="Track" ...>
 ...
 <bag name="TrackPeopleRoles">
     <key column="track_id"/>
     <one-to-many class="TrackPersonRole"/>
 </bag>
</class>

    TrackPersonRole tpr = new TrackPersonRole();
    tpr.Person = PersonManager.GetById(10);
    tpr.Role = RoleManager.GetById(2);
    entity.PeopleRoles.Add(tpr);
    TrackManager.SaveOrUpdate(entity);

generates the below update statement, instead of an insert.
UPDATE trackpeoplerole SET track_id = 47637 /* ?p0 */
WHERE people_id = 10 /* ?p1 */ AND role_id = 2 /* ?p2 */

A: The error message is correct: you are adding a duplicate key to a dictionary.
It does not even come from NHibernate - it's generated by the Dictionary class.
If a Track can have the same Person in more than one Role, you'll have to map the track_person_role table as an entity:
class Track
{
    ...
    public virtual ICollection<TrackPersonRole> PeopleRoles { get; set; }
}

class TrackPeopleRole
{
    public virtual Person Person { get; set; }
    public virtual Role Role { get; set; }
}

Mapping:
<class name="Track" ...>
  ...
  <bag name="TrackPeopleRoles">
    <key column="track_id"/>
    <one-to-many class="TrackPersonRole"/>
  </map>
</class>

There are more details regarding inverse and cascade, but start with this.


text:
Q: remove a word from url and 301 redirect The actual link structure is as follows:

domain.com/browse-wordtoremove-string.html

we want to 301 redirect to

domain.com/browse-string.html

How can be his be achieved?
Thank you so much in advance.

A: You can use this rule as your very first rule in your root .htaccess:
RewriteRule ^(browse-)[^-]+-([^.-]+\.html)$ /$1$2 [L,R=301,NC]

A: demo here http://regex101.com/r/pS3pU4
search for this \-.*?\-
and replace with -
in javascript you can replace and redirect like this
var url = "domain.com/browse-wordtoremove-string.html";
var res = url.replace(/\-.*?\-/,'-');
location.href = res;

A: Try this one to remove the word.
RewriteRule ^(.*?)-wordtoremove-(.*\.html)$ /$1-$2 [L,R=301]

Assuming its between the hyphen(-). If not then remove the hyphens from everywhere on above(three times).