text:
Q: Github Pages: Page build failed I'm constantly getting the following error messages from github when I try to push my Jekyll site to their pages.

The page build failed with the following error:
Page build failed. For more information, see
  https://help.github.com/articles/troubleshooting-github-pages-build-failures.
If you have any questions please contact us at
  https://github.com/contact.

I ran jekyll serve to see if anything suspicious is going on, but the only thing it gives me is a warning: Build Warning: Layout 'default' requested in app/index.html does not exist.
Am I missing something? All my files are on Github: https://github.com/BobWassermann/confguide

A: Github pages is looking for your files at the root of your repository, then as it doesn't find _layouts and so on, at the right place, the build fails.
To avoid this, in config.yml add source: app.
Note: As your repository will be served at https://github.com/BobWassermann/confguide, all links to your assets will fail.
To avoid this, in config.yml add baseurl: /confguide.
And in default.html call your assets with {{site.baseurl}} like this :
<link rel="stylesheet" href="{{site.baseurl}}css/syntax.css">

and same for other assets (css/js/img).

A: Tried everything above, but nothing helped.
Went trough everything and found the bug. Github does not support a "_" folder in your images directory, even if it's in your copy task in Gruntfile.
Removing my "_posts" folder in the img folder solved this issue.


text:
Q: Jetty distribution vs hightide What exactly is the difference? I've been using Jetty 8.0.0 lately and when I try the distribution download I cannot get neither WebSockets nor Servlet 3.0 @WebServlet annotation to work. If I use hightide, it just works.
What is the point of the distribution?

A: I'm interested in the difference too, and what's online is confusing. Here's Jesse McConnell's ( https://stackoverflow.com/users/1185262/jesse-mcconnell ) answer to my just-posted question on the [jetty-users] mailing list ( http://jetty.4.n6.nabble.com/jetty-users-jetty-versions-tt3675449.html ):

yes, hightide is just the jetty-distribution with some additions that we can not distribute from eclipse do to their IP restrictions.

I did a lot of digging around before I got that answer, so I'll include the results below for reference. I hope this helps.
Description from eclipse.org: The Jetty Hightide application server is a distribution of the jetty Web Server assembled at codehaus with additional services like JNDI, XA & JDBC preconfigured. For jetty-hightide-6 this is an optimized, patched rebuild of jetty-6, while for jetty-hightide-7 it is distribution based on the standard jetty-7 artifacts combined with other third party integrations. -- http://www.eclipse.org/jetty/about.php
Description from docs.codehaus.org: Hightide is an optimized, versioned distribution of the Jetty open source web container. It comes pre-integrated with a number of services usually only found in J2EE application servers, or which you would otherwise have to craft together yourself: JNDI, an XA transaction service, a JMS message fabric, and a JDBC accessible database. Thanks to Jetty's light weight, pluggable architecture, Hightide allows you to easily choose which of these services you want to use, or even replace them with others. -- http://docs.codehaus.org/display/JETTY/Hightide+Documentation
FAQ: "What's the difference between Jetty from Mort Bay, Codehaus and/or Eclipse?" at wiki.eclipse.org: The latest releases of core jetty-7 and later are available from Eclipse, which use the org.eclipse.jetty packaging. For versions 6 of Jetty, plus some jetty-7 components such as RPMs, Debs, Hightide, use codehaus, which uses the org.mortbay packaging. -- http://wiki.eclipse.org/Jetty/FAQ
However, the contents of the two distributions (see 'Downloads' below) both use the o.e.j packaging, so I don't think the answer is entirely correct.
Mentions of features at http://wiki.eclipse.org/Jetty:

*

*The Hightide distribution of jetty contains an example webapp that uses JAAS. -- http://wiki.eclipse.org/Jetty/Feature/JAAS

*Jetty supports java:comp/env lookups in web apps. This is an optional feature and you need to do some setup. However, if you are using the Hightide distribution of Jetty, this feature is already fully enabled, so you can skip any setup steps, and just read the sections on how to put objects into Jetty's JNDI so that you can retrieve them at runtime.  -- http://wiki.eclipse.org/Jetty/Feature/JNDI

*Annotation processing is not enabled by default by the standard jetty distribution, only by the Hightide distribution. -- http://wiki.eclipse.org/Jetty/Feature/Annotations
Downloads: Version numbers seem in-sync:

*

*http://download.eclipse.org/jetty/8.1.4.v20120524/dist/

*http://dist.codehaus.org/jetty/jetty-hightide-8.1.4/
After a cursory look, the contents look extremely similar.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to get position of CCSprite added to CCParallaxNode? I have a CCparallaxNodeExtras that scrolls infinite (following the space game tutorial). I added as a child a CCSprite made of other CCSprite, like this:
_backgroundNode = CCParallaxNodeExtras::node();
this->addChild(_backgroundNode,-2);

    float acum = 0.0;
    back1 = CCSprite::create();
    for(int i = 0; i < num_repeats; ++i) {
        CCSprite *back = CCSprite::createWithSpriteFrameName("rock.png");
        back->setPosition(ccp(acum, 0));
        back1->addChild(back);
        acum+= back->getContentSize().width+150.0;
    }

    _backgroundNode->addChild(back1,  1 , ccp(0.1,0.1), ccp(0, winSize.height * 0.64));

now in my update I have this:
CCPoint backgroundScrollVert = ccp(-1024, 0);
_backgroundNode->setPosition(ccpAdd(_backgroundNode->getPosition(), ccpMult(backgroundScrollVert, dt)));

perfect, the background moves and disappears (that is what I want for now) but I need to get the collision between the sprites on that background and a fixed sprite as a child of the main node.
The problem is that whenever I try to get the collision by the simple way (intersecting the bounding boxes) it doesn't work, so I tried to just get the position of the sprites and all I get is the position fixed in the CCSprite (back1) composed by the sprites (back).
Now, is there a possible way to get the position of any individual sprite located in that parallax node? If i try something like:
CCSprite *tempsprite = (CCSprite*)_backgroundNode->getChildren()->objectAtIndex(0);
printf("%f\n", tempsprite->getChildren()->objectAtIndex(0)->getPositionX());

it prints always the same value, it is like the position is not being affected by the transformation of the parent in the background node... so, how do I get it correctly? how do I get the position relative to screen and not to the parent?

A: Use convertToWorldSpace function to get position in parent. If your nodes are nested then you need to query one by one.
    CGPoint pos1 = [back1 convertToWorldSpace: back.position];
    CGPoint pos2 = [_backgroundNode convertToWorldSpace: pos1];

A: I did like this and its working.
float xPosition = _backgroundNode->convertToWorldSpace(sprite->getPosition()).x;

float widthSize = sprite->getContentSize().width;

float heightSize = sprite->getContentSize().height;


text:
Q: TFS Build 2010 CodeActivity: Cannot Load Assembly in XAML I am attempting to add a custom "activitycode" to a TFS Build.  I wrote this months ago and had it working on a now defunct test environment.  I am attempting to resurrect the use of the code onto a new test platform, and am running into issues.
When I open my build.xaml, I receive the dreaded red-box of pain where my custom activity should be, stating "Assembly could not be loaded because of an error in the XAML."  In the ErrorList, I also have found "Could not find type '.DeploySSRSReportActivity' in assembly 'ReportingServicesDeploy'."
I have confirmed that my DLL is checked into source control and that the build controller is pointing to it.
Peeking into the raw XAML, I see that the build.xaml file defines the assembly as
    xmlns:rsd="clr-namespace:;assembly=ReportingServicesDeploy
The line where my custom activity (and where V.S. finds the error) is:
<rsd:DeploySSRSReportActivity CurrentBuild="[BuildDetail]"
SourcesDirectory="[SourcesDirectory]"
mtbwt:BuildTrackingParticipant.Importance="High"
xmlns:mtvc="clr-namespace:Microsoft.TeamFoundation.VersionControl.Client;assembly=Microsoft.TeamFoundation.VersionControl.Client"
xmlns:mtvco="clr- namespace:Microsoft.TeamFoundation.VersionControl.Common;assembly=Microsoft.TeamFoundation.VersionControl.Common"
xmlns:ras="clr-namespace:ReportingServicesDeploy;assembly=ReportingServicesDeploy"
xmlns:rsd="clr-namespace:;assembly=ReportingServicesDeploy"
xmlns:sad="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
xmlns:sad1="clr-namespace:System.Activities.Debugger;assembly=System.Activities" />

The DLL is named ReportingServicesDeploy.dll.  The namespace within the DLL is ReportingServicesDeploy, and the name of the activity class is DeploySSRSReportActivity.
Where is the linkage failing so that I am getting that error?

A: When your attempting to edit the xaml your doing this on your machine directly, tfs and sourcecontrol is not involved, the location on server for controller is where build agent will look for assemblies during the build and where VS will get them when opening build definition for config.
Your error possibly is coused by old version being used.
The assemblies must be available for visual studio on your machine - one option is to add them to GAC or to post in VS bin folders. Start new instance of studio afterwards
To intall into GAC run this from Visual Studio command line:
gacutil /i "Path\To\YourAssembly.dll"
To remove assembly run following from Visual Studio command line:
gacutil /u "YourAssembly"
For studio assemblies i believe this is the folder:
Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies


text:
Q: Creating a new webproject with MonoDevelop 2.1 under Mac OS X => exception I have a fresh install of MonoDevelop 2.1 and Mono-Framework 2.7. When I try to create a new project, the following exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of   an invocation. ---> System.InvalidOperationException: Add-in
'MonoDevelop.AssemblyBrowser,2.1.0' could not be loaded.
at Mono.Addins.ExtensionNode.get_Addin () [0x00081] in /tmp/monobuild/build/BUILD/mono-addins-0.4/Mono.Addins/Mono.Addins/ExtensionNode.cs:102
at Mono.Addins.TypeExtensionNode.get_Type () [0x00026] in /tmp/monobuild/build/BUILD/mono-addins-0.4/Mono.Addins/Mono.Addins/TypeExtensionNode.cs:62

What should I do?

A: At this stage both of those packages are probably "young" enough to be well understood by creator only, who may not be monitoring StackOverflow as carefully as their project's mailing lists. So I think it would be better to ask that question in MonoDevelop or Mono mailing lists.

A: I second what Piotr said -- I'm an MD developer, and I check Stack Overflow pretty infrequently. The best thing would be to report the bug to make sure it's tracked so it can be fixed in future releases.
Also, try "rm -r ~/.config/MonoDevelop/addin*" in a terminal, to force rebuilding the addin registry.
(BTW, I assume you mean Mono 2.4_7, not 2.7)


text:
Q: How to make generic navigation drawer and bottom navigation in flutter and accessible from any dart class I want to know how can i make generic  Navigation drawer and bottom navigation bar with app bar so just center content only change of screen. like in android fragment we make navigation drawer and bottom navigation in main activity and in all fragments they are accessible. when i call bottom on main its working fine but when i open same class from drawer its hide bottom navigation .. i just need any class will be called bottom navigation drawer and bottom navigation always be there and i don't have to set in every class.
class TabBarController extends StatefulWidget {
 @override
_TabBarControllerState createState() => _TabBarControllerState();
}

class _TabBarControllerState extends State<TabBarController> {
int _currentIndex = 0;

final List<Widget> _screens = [
HomeScreen(),
Helpers.hasPrivilege(Privileges.MONITORING)? MonitoringScreen() :  ShopsListScreen(),
NotificationsListScreen(),
ProfileScreen()
];

final List<Widget> _titleIcons = [
Text('HOME'),
Text('MENU'),
Text('NOTIFICATIONS'),
Text('PROFILE'),
];

@override
void initState() {
// TODO: implement initState
super.initState();

}

@override
Widget build(BuildContext context) {

return _screenView();
}

Widget _screenView() {
return Scaffold(

  body: IndexedStack(
    index: _currentIndex,
    children: _screens,
  ),
  bottomNavigationBar: BottomNavigationBar(
      showSelectedLabels: true,
      showUnselectedLabels: true,
      type: BottomNavigationBarType.fixed,
      selectedItemColor: appColor,
      unselectedItemColor: Colors.grey.withOpacity(0.5),
      currentIndex: _currentIndex,
      onTap: (index) {
        setState(() {
          _currentIndex = index;
          setState(() {});
        });
      },
      items: [

        BottomNavigationBarItem(
            icon: Icon(Icons.home), title: Text('Home')),
       BottomNavigationBarItem(icon: Icon(Icons.shop), title: Text('MENU')) ,
        BottomNavigationBarItem(
            icon: Icon(Icons.notifications), title: Text('Notifications')),
        BottomNavigationBarItem(
            icon: Icon(Icons.person), title: Text('Profile')),
      ]
  ),
  drawer: AppDrawer(),
);
}}

 class AppDrawer extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
 return Drawer(
  child: Container(
    color: Colors.red[900],
    child: Column(
      children: <Widget>[
        SizedBox(width: double.infinity,height: 200.0),
        ListTile(

          leading: Icon(FontAwesomeIcons.home,color: Colors.white),
          title: Text(AppStrings.home,style: TextStyle(color: Colors.white)),
            onTap: ()
            {
              Navigator.pop(context);
              Navigator.push(context,MaterialPageRoute(builder: (context) =>
 TabBarController()));

            }

        ),
        ListTile(

          leading: Icon(FontAwesomeIcons.user,color: Colors.white),
          title: Text(AppStrings.profile,style: TextStyle(color: Colors.white)),
            onTap: ()
            {
              Navigator.pop(context);
              Navigator.push(context,MaterialPageRoute(builder: (context) =>
 ProfileScreen()));
            }

        ),
        ListTile(

          leading: Icon(FontAwesomeIcons.store,color: Colors.white),
          title: Text(AppStrings.shops,style: TextStyle(color: Colors.white)),
            onTap: ()
            {
              Navigator.pop(context);
              Navigator.push(context,MaterialPageRoute(builder: (context) =>
 ShopsListScreen()));
            }

        ),
        ListTile(

          leading: Icon(FontAwesomeIcons.receipt,color: Colors.white),
          title: Text(AppStrings.orders,style: TextStyle(color: Colors.white)),
            onTap: ()
            {
              Utils.showToastShort(context, AppStrings.orders);
            }

        ),
        Divider(),
        Expanded(
          child: Align(
            alignment: FractionalOffset.bottomCenter,
            child:
            ListTile(

                leading: Icon(FontAwesomeIcons.powerOff,color: Colors.white),
                title: Text(AppStrings.logout,style: TextStyle(color: Colors.white)),
                onTap: ()
                {
                  Navigator.pop(context);

                  UserPreferencesManager.clearAll();
                   Navigator.push(context,MaterialPageRoute(builder: (context) =>
           LoginScreen()));
                }

                ),
          ),
          )
        ],
      ),
       ),
      );
      }
      }


text:
Q: How to wrap workflow foundation into API? I am looking for some simple and modern approach of hosting workflows in WCF or ASP.NET. Just some layer to receive data from outside and put it into workflow - or get and return data from some workflow on demand. The examples I've seen are so old they aren't even running on VS 2017.

A: Use App Fabric to instant deploy WF as a service.
https://msdn.microsoft.com/en-us/library/ee677312%28v=azure.10%29.aspx?f=255&MSPPError=-2147217396


text:
Q: How to fix Android "Connected but no internet" with static IP? I have set up a Pi-Hole, but my router doesn't allow setting it as global preferred DNS, so I have to set it for all my devices manually.
So I go to Android WiFi settings (Android 11), and set Static IP

*

*My default assigned IP was 192.168.0.115, so I leave that as is

*Default gateway was 192.168.1.1, also left as is

*DNS 1 I changed to my PiHole IP (which works from my desktop)

*DNS 2 left blank

I get "Connected but no internet" status, even if I change DNS 1 to Google (8.8.8.8) or Cloudfare (1.0.0.1). Turning on/off cellular data doesn't help either.
What could be causing this? How can I set custom DNS server when connected to this network?

A: Your network settings seem strange. The default gateway must be on the same subnet as the IP address - in typical home setups, the subnet mask is /24 and so the third octets of the IP addresses should be identical. You don't mention what you have the subnet set to, and you have 0 for the third octet of the IP address and 1 for that of the gateway. Are you sure that's correct?


text:
Q: EF Order by One to Many Relationship I Have two table : Products and ProductsRank that has one to many relationship. Users can do up vote and down vote to any product and for each user one row add to ProductsRank table whith true or false value.
In search bar when a user type product name I want to get list of products that has most rank.
 var products = _productsService.GetAllQuerable
            (
                x => x.ProductsRank.Where(y => y.TypeVote != null).OrderByDescending(y => y.TypeVote) &&
                x.Title.Contains(term)
            ).Take(5);

It all of I can do, and I know it's completely wrong. How can I do this?


text:
Q: Streaming video from server to mobile using base64 We are building an application that deals with images and videos and the privacy requirement is high , where users are not allowed to gain access to the images and videos at all time (privacy option) ,
therefore we went with the option of having a php api that clients request the file and the api returns a base64 encoded response that the client decode and display ,that is for image side ,as for video we are having a trouble finding the right logic .
does VideoView  in android helps me achieve this ?
does the api needs to send the video in chunks instead of one large base64 ?
is base64 even right for this requirement ,noting that user should not have direct access to the file at all times .
php api function :
function viewFile($data) {

$file = file_get_contents($data['file_path']);
$mime = mime_content_type($data['file_path']);

return ['status' => 200, 'file' => ['mime' => $mime, 'base64' => base64_encode($file)]];
}

A: Security with base64? That does not exist. I made a text (in Portuguese) that might help you. Read.
I do not recommend using a very large base64. The server will have a lot of load, the download will be slow, etc.
The ideal is to divide it into smaller pieces. For this you can use bento4 e o ExoPlayer.
For images, I recommend using Cipher. More information for Android and More information for PHP
I made this code to encrypt images. It is already quite old, but I think I can help you enteder this issue.
https://github.com/valdeirpsr/estudo-openssl/blob/master/library/OpensslEncrypt/OpensslEncrypt.php


text:
Q: Debug TYPO3 site configuration I have to update a complicated RealURL configuration to the new site configuration in V9. I get 404 errors and unwanted redirects, so I need something to debug the routing.
While debugging through core files I realized TYPO3 uses Symfony Routing, and Symfony has already a debug interface: https://symfony.com/doc/current/routing/debug.html
Is it possible to use it for debugging TYPO3 routes as well? If yes, can you tell me how to do this?
If not, some hints about the main routing classes/functions would be helpfull, so I can write myself some PHP debug output. My problems are with routeEnhancers and aspects.

A: Can you point to what is the issue exactly here?

*

*Redirects when calling "regular" pages?

*Issues with Route Enhancers? When resolving the URL?

As Symfony Routing works with static routes w/ modifiers by default ("I have a list of 100 URL endpoints"), and TYPO3 has dynamic routes (populated by the database) the simple debug tool from Symfony Routing does not work here.
When it comes to resolving, the "PageResolver" PSR-15 middleware and the "PageRouter" is a good start when debugging.

A: I had a similar problem recently. Due to a misspelling of "aspects" in my config.yaml, my aspect was not applied.
I ended up using a debugger and putting a breakpoint in the appropriate aspect class (StaticValueMapper) and then (because the breakpoint was not hit) another one in the ApectsFactory::createAspects() function. There, I noticed that my aspect never got created. Which eventually led to finding the typo.
I did not look in PageRouter as Benni suggested, will probably try that next time.
For most cases, just debugging was sufficient and it's not necessary to write additional debugging code. I work on a copy of the main site (this for reasons of not enabling any debug support on production) and being able to make changes without ugly results.
For non-developers or people who have no possibility to use a debugger or work on a development site for other reasons - this might be more difficult. In this case, it would be nice to be able to track the URLs, e.g. see source and target.
Additionally, being able to validate the config.yaml (based on a schema, beyond simple syntax check) would be cool. However, extensions can extend the settings so this will most likely not be such a trivial task.

A: I had my configuration in an included, external file.
In this case even Parsing-Errors are omitted!!
To test if its valid you can copy&paste it into the main config.yaml.


text:
Q: ListView - Data template and data source in xaml (instant changes in VS designer) I have something like this:
          <ListView >
              <Grid >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <SymbolIcon Symbol="SomeExistingSymbol" Margin="0,0,10,0" />
                <TextBlock Grid.Column="1">Some data</TextBlock>
            </Grid>
            <Grid >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <SymbolIcon Symbol="SomeExistingSymbol2" Margin="0,0,10,0" />
                <TextBlock Grid.Column="1">Some data 2</TextBlock>
            </Grid>
            <!--More list view items (grids)-->
         </ListView>

I don't want to copy Grids over and over. I know I can use binding and data templates.
But I want to have all data defined in xaml - is that possible?
The reason is that I need to see instant changes of data in VS designer, without building project.


text:
Q: Is there a way to know that iOS keyboard is really hidden (dismissed by user)? I need a way to detect the case when user dismisses iOS keyboard manually, using "keyboard" button on keyboard. I tried to use UIKeyboardDidHideNotification, but quickly discovered that this event is also fired when user splits the keyboard, leaving it on screen.
Is there a way to know for sure that keyboard was really hidden?

A: To get solution I had to slightly modify my original implementation: I've replaced assigning nil to inputView member of my main view with creating and destroying custom invisible UIView<UIKeyInput> view to show and hide keyboard correspondingly. This allowed me to override this view's resignFirstResponder method which is always called on keyboard resigning - either in normal or in split state, when user dismisses keyboard using special button or when I remove it programmatically.

A: I believe that UIKeyboardDidHideNotification is only sent when the keyboard is truly gone. From the Apple docs:

Posted immediately after the dismissal of the keyboard.

However, you could also look to see if any of your inputs are currently the first responder:
BOOL keyboardUp = NO;

for (UIView *view in self.textInputs)
{
  if (view.isFirstResponder)
  {
    keyboardUp = YES;
    break;
  }
}


text:
Q: google geocoding - get all possible localities for street Is there any way to look up a Street\Road and get all possible localities (suburbs) for it.
I.e. if a long street goes through multiple localities. Can I get a list of all of them?
Currently I just get what seems to be the most important locality.

A: Ending up contacting google maps technical support.  Short answer... No. Not current possible.

Maps Support: Currently, we do not offer that feature.
Maps Support: Nor do I personally know any reliable workarounds for
it.

:(


text:
Q: Telnet client for cisco router I am writing telnet client for cisco router using apache.commons.net.telnet. But i have problem. Here is code sample:
static TelnetClient telnetClient = new TelnetClient();

public static void main(String[] args) throws IOException {
    setOptionHandlers();
    telnetClient.connect("192.168.127.100");
    read();
    telnetClient.disconnect();
}

private static void setOptionHandlers() throws IOException {
    ArrayList<TelnetOptionHandler> optionHandlers =
        new ArrayList<TelnetOptionHandler>();
    optionHandlers.add(new TerminalTypeOptionHandler("VT100", false, false, true, false));
    optionHandlers.add(new EchoOptionHandler(true, false, true, false));
    optionHandlers.add(new SuppressGAOptionHandler(true, true, true, true));
    for (TelnetOptionHandler handler : optionHandlers) {
        try {
            telnetClient.addOptionHandler(handler);
        }
        catch (InvalidTelnetOptionException e) {
            System.err.println("Error registering option handler "
                    + handler.getClass().getSimpleName());
        }
    }
}

public static void write(byte[] data) throws IOException {
    telnetClient.getOutputStream().write(data);
    telnetClient.getOutputStream().flush();
}

public static void read() throws IOException {
    System.out.println("Read");
    byte[] buff = new byte[1024];
    int read;
    if((read = telnetClient.getInputStream().read(buff)) > 0) {
        System.out.println(new String(buff, 0, read));
    }
    System.out.println("read="+read);
}

In some cases it works correctly and shows prompt for password entering. But is other cases it works incorrectly - hangs by reading from telnet input stream. Run conditions are the same. Why do I get this situation?
If anyone has tips for writing cisco telnet client, i'll be glad to hear them!

A: I can reproduce this problem every time.
The problem can be worked-around by changing your read buffer size to 1 byte.
This accounts for why the readUntil() function from Looking for Java Telnet emulator works, at it simply calls read() for 1 byte.
That said, does this indicate a bug in org.apache.commons.net.telnet.TelnetClient?
Edit: Rolled back to an earlier version of Commons Net and the problem disappeared !


text:
Q: Subscribing SNS to SQS in AWS? Looking at this image :

The messages are really imporant hence I use a queue in the middle.
But now - On the right side SNS , I need to have multiple subscribers ( Lambdas).
But now, How can I subscribe the right side SNS to the SQS on the center ?
Question:
Is it possible to subscribe SNS to SQS ? ( meaning - passing the messages from SQS to an SNS)

A: SNS is a topic, it does not subscribe to anything. It cannot receive data, it needs to be published to.
However, you can publish to it from an application code. For this, you can attach a consumer to your SQS in the middle. This could be a Java application or a simple lambda code.
Here are a few references for doing it in various languages.

*

*Java and .NET

*Python

*Node JS

A: First of all create a new Lambda function to send message to a SNS topic .
Refer this - https://github.com/aws-samples/serverless-app-examples/tree/master/python/step-functions-send-to-sns
And then you can configure your queue to trigger that Lambda function on receiving of payload.


text:
Q: How use io.Writer in struct? Why when i try use Write() to writer from Writer nothing happens?
(I'm trying to implement the basic bufio methods myself)
package main

import (
    "io"
    "os"
)

type Writer struct {
    writer         io.Writer
    buferred_bytes []byte
}

func (w *Writer) Flush() {
    w.writer.Write(w.buferred_bytes)

    w.buferred_bytes = w.buferred_bytes[:0]
}

func (w *Writer) Write(data []byte) {
    for i := 0; i < len(data); i++ {
        if len(w.buferred_bytes) == cap(w.buferred_bytes) {
            w.Flush()
        }

        w.buferred_bytes = append(w.buferred_bytes, data[i])
    }
}

func NewWriter(writer_thread io.Writer, buffer_size int) *Writer {
    return &Writer{writer: writer_thread, buferred_bytes: make([]byte, 0, buffer_size)}
}

func main() {

    w := NewWriter(os.Stdin, 4)
    w.Write([]byte("Hello world my friend"))

}

I think i should use pointer to io.Writer, but im not sure

A: I found a problem. Im using os.Stdin instead os.Stdout


text:
Q: Create points on screen with PHP What I'm trying to do is load a website on a frame and then mark points on it depending on screen coordinates obtained via a function.
Do I need PHP GD?
Loading the website on the frame is not an issue. It's how to mark points on the screen that's causing my hair to fall

A: Checkout this post here.  It uses Mootools(a JavaScript framework), PHP, and MySQL.  I think it's very similar to what you are trying to do except you want to mark points on the iframe instead of doing it on an image.  The plugin can be attached to an element:
David Walsh's Mootools Heatmap

A: Nah, what you need are absolute positioned HTML elements.
You can grab the page with PHP with curl or file_get_contents() and inject some HTML/CSS into it that creates absolutely positioned
s or s or whatever.


text:
Q: using reference parameter for a web method in .NET I am working on a web application that consumes a web service. Web service is written in .NET.
I want to know whether using a reference parameter for a  Web method is a good practice or not?

A: You can use ref and out params with WCF services, but under the hood they're wrapped up.
Anything passed to a WebMethod or service has to be serialised - you can make it behave as if it is a ref or out by wrapping it in something that sets the values back, but this is messy.
You're better off with a record class - a simple serialisable class that's basically just a list of auto properties that's the return of the WebMethod.
This results in extra classes, but is much easier to maintain.

A: It is best to have the ws message based.
You can still be doing so implicitly when you use multiple parameters, there is still the message you are receiving with those. Just keep them separated, if you need multiple outputs return a simple result class for the operation.


text:
Q: Symfony 4 - two firewalls cause ERR_TOO_MANY_REDIRECTS I am writing this because previous answers to Using multiple firewalls cause ERR_TOO_MANY_REDIRECTS in Symfony 2 have not been helpful. "Main" firewall seem to work just fine, "Admin" is the one causing problems. Every time I try to enter the path "http://localhost:8000/admin" it redirects to"http://localhost:8000/admin_login" as it should, but goes into redirect loop and crashes with the error named above.
security.yaml
security:
encoders:
    App\Entity\User:
        algorithm: bcrypt
    Symfony\Component\Security\Core\User\User: plaintext
role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
    chain_provider:
            chain:
                providers: [in_memory, db_provider]
    in_memory:
        memory:
            users:
               theadmin:
                    password: iamadmin
                    roles: 'ROLE_SUPER_ADMIN'
    db_provider:
        entity:
            class: App\Entity\User
            property: email
firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    admin:
        pattern: /admin
        anonymous: ~

        form_login:
            username_parameter: _username
            login_path: /admin_login
            check_path: /admin_login
            provider: in_memory
            default_target_path: admin

        logout:
            path: /admin_logout
            target: /

    main:
        pattern: /
        anonymous: ~

        form_login:
            username_parameter: _email
            login_path: /login
            check_path: /login
            provider: db_provider
            default_target_path: welcome

        logout:
            path: /logout
            target: /
access_control:
- { path: ^/welcome, roles: ROLE_USER }
- { path: ^/admin, roles: ROLE_SUPER_ADMIN }
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin_login, roles: IS_AUTHENTICATED_ANONYMOUSLY }

AdminSecurityController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;

class AdminSecurityController extends AbstractController
{
    /**
     * @Route("/admin_login", name="admin_login")
     */

    public function admin_login(Request $request, AuthenticationUtils $utils)
    {
        $error = $utils->getLastAuthenticationError();

        $auth_checker = $this->get('security.authorization_checker');

        if ($auth_checker->isGranted('ROLE_SUPER_ADMIN')) {
            return $this->render('admin/dashboard.html.twig', [
                'controller_name' => 'AdminController',
            ]);
                } else{
                    return $this->render('admin_security/admin_login.html.twig', [
                        'error' => $error
                    ]);
        }
    }

    /**
     * @Route("/admin_logout", name="admin_logout")
     */

    public function admin_logout()
    {

    }
}

A: Access control entries are analyzed from the top to the bottom. So, you need to place the ^/admin_login entry before the ^/admin.
Imagine how the security component is currently set:

*

*You visit the login form then press submit

*You (guest) are redirected to the /admin_login path

*Security component goes through the entries and matches the /admin_login to the ^/admin entry

*Because it requires ROLE_SUPER_ADMIN, you thus end up with a loop

Remember to clear the cache afterwards.


text:
Q: Passing an url as parameter to controller action On my asp.net mvc page I need to render multiple images that are stored on third-party images hosting service. The service has some api which returns me a list of image urls.
In *.cshtml file a have the fallowing html markup:
@foreach (var img in Model.Images)
{

}

It's works perfectly. But for some reason I can't use direct URL to the image in the "src" attribute. Next, I have created new async controller that should return an image:
public class ImagesController : AsyncController
    {
        //
        // GET: /Images/
        public void GetImageAsync(string url)
        {
            AsyncManager.OutstandingOperations.Increment();
            WebRequest request = WebRequest.Create(url);
            WebResponse response = request.GetResponse();
            AsyncManager.Parameters["response"] = response;
            AsyncManager.OutstandingOperations.Decrement();
        }

        public FileResult GetImageCompleted(WebResponse response)
        {
            return base.File(response.GetResponseStream(), response.ContentType);
        }

    }

Now I need to pass a full image url to my controller action.
Something like this:
@foreach (var img in Model.Images)
    {

    }

how to create a new route for passing this parameter to action?
Thanks!

A: You mean this?
routes.MapRoute(
    "GetImage",
    "Images/GetImage/{*url}",
    new { controller = "Images", action = "GetImageAsync" }
);

I'm not sure why you need all that though. An AsyncController + routing in order to fetch all image url's seems to be overkill...


text:
Q: How to install addition package with extra data file download
Hi I have install flash package along with other packages on Synaptic Package Manager. After apply, I run the command
sudo dpkg-reconfigure libdvd-pkg

to install those packages. Then this notification appears. When I click into the box run this action now it appear the box for my password and it immediatelly disappear. I have try several times but it still happen.
Here the box when I click run this action now.

I have installed flashplugin package via Synaptic package manager, but there was a update information box which I cannot close. I closed it temporarily and then it reappeared the next day when I start the computer.

As I checked the syslog file in /var. Here are the results when I clicked the run this action now button :
Jul 28 15:21:25 TrinhHuy dbus-daemon[1475]: [session uid=1000 pid=1475] Activating via systemd: service name='org.gnome.Terminal' unit='gnome-terminal-server.service' requested by ':1.95' (uid=1000 pid=4035 comm="/usr/bin/gnome-terminal.real -- pkexec /usr/lib/up" label="unconfined")
Jul 28 15:21:25 TrinhHuy systemd[1463]: Created slice apps.slice.
Jul 28 15:21:25 TrinhHuy systemd[1463]: Created slice apps-org.gnome.Terminal.slice.
Jul 28 15:21:25 TrinhHuy systemd[1463]: Starting GNOME Terminal Server...
Jul 28 15:21:26 TrinhHuy dbus-daemon[1475]: [session uid=1000 pid=1475] Successfully activated service 'org.gnome.Terminal'
Jul 28 15:21:26 TrinhHuy systemd[1463]: Started GNOME Terminal Server.
Jul 28 15:21:26 TrinhHuy systemd[1463]: Started VTE child process 4049 launched by gnome-terminal-server process 4038.
Jul 28 15:21:26 TrinhHuy systemd[1463]: vte-spawn-b702640c-f872-4180-aa93-6cbeca1280e9.scope: Succeeded.
Jul 28 15:21:26 TrinhHuy systemd[1463]: gnome-terminal-server.service: Succeeded.


text:
Q: What are the dimensions for the Heaviside Step Function? The Heaviside step function is defined as
\begin{array}{ll}
H(x) = 0 && \text{if }x<0 \\
H(x) = 1/2 && \text{if } x=0 \\
H(x) = 1 && \text{if } x>0
\end{array}
However, the function can also be defined as
$$\int H(x) \phi'(x)dx = -\phi(0) \,. \tag{1}$$
It's clear that
$$-\int \delta(x) \phi(x)dx = -\phi(0), \tag{2}$$
and a property of distributions gives
$$\int \theta(x) \phi'(x)dx = -\int \theta'(x) \phi(x)dx  \, .\tag{3}$$
Finally, the delta function always has the same dimensions as the inverse of its argument.
Given these facts, what are the dimensions for the Heaviside Step Function?
The Heaviside step function is given (and sometimes defined I think) to be the integral of the Dirac delta. Does that mean that its dimensions are that of the Dirac Delta's multiplied by the dimensions of the variable of integration? That would make it dimensionless. What am I missing here?

A: The step function is dimensionless. We can immediately see this using its basic definition. We can also see it using the distribution definition,
$$\int H(x) \phi'(x) dx = -\phi(0).$$
The dimensions of the left-hand side are
$$[H] \frac{[\phi]}{[x]} [x] = [H] [\phi]$$
where $[x]$ is the dimension of the variable of integration. The right hand side has dimension $[\phi]$, so $[H]$ is trivial, and $H$ has no dimensions.


text:
Q: Почему глобальные переменные это зло, а поля класса нет? Я знаю про побочные эффекты. Меня интересует не почему глобальные переменные - это в принципе плохо, а почему постоянно говорят, что они зло, хотя про поля класса я такого не слышал никогда.
Хотя, по сути, поля класса ведь ничем не отличаются? Это такие же глобальные переменные, только в пределах класса.

A: *

*Глобальные переменные в большинстве случаев нарушают инкапсуляцию. К
ним открыт неконтролируемый доступ отовсюду.

*В большом проекте при обилии глобальных переменных возникает путаница в именах. Глобальную переменную же видно отовсюду, надо, чтобы отовсюду было понятно, зачем она.

*Глобальные переменные в большинстве случаев нарушают принцип инверсии зависимостей (или делают возможным его нарушение).

*Глобальные переменные ухудшают масштабируемость проекта.

*Глобальные переменные ухудшают читаемость кода (в каком-то конкретно взятом месте непонятно, нужна ли какая-то конкретная глобальная переменная, или нет).

*Глобальные переменные приводят к трудноуловимым ошибкам. Примеры: нежелательное изменение её значения в другом месте/другим потоком, ошибочное использование глобальной переменной для промежуточных вычислений из-за совпадения имен, возвращение функцией неправильного значения при тех же параметрах (оказывается, она зависима от глобальной переменной, а ее кто-то поменял).

*Глобальные переменные создают большие сложности при использовании модульного тестирования.

*Глобальные переменные увеличивают число прямых и косвенных связей в системе, делая её поведение труднопредсказуемым, а её саму - сложной для понимания и развития.

Поля - это такие же глобальные переменные, только в пределах класса.

А давайте одежду дома складывать прямо на пол в любом месте квартиры: ведь 30 кв. см ящика в комоде - это те же 30 кв. см поверхности, что и на полу, только в пределах ящика. И гаражи для машин не нужны, можно на улице ставить. Надеюсь, аналогия понятна.
Ключевая ошибка в утверждении автора заключается в том, что поля класса никаким образом не являются глобальными - они принадлежат объекту (экземпляру) класса, если они не статические. У одного объекта - одни значения, у другого - другие. А статические поля класса общие для всех экземпляров, и это чаще всего тоже не очень хорошо.


text:
Q: AngularJS - Call jquery after load I have an image slider on my page:
That is my call:

Somehow the slider doesn't work. I think I have to load the jQuery init after the images are loaded.
This is the call for the slider:
$('#slider').bjqs({
            height      : 420,
            width       : 130,
            responsive  : true
          });

How can I call this function after the images are loaded?

A: If you are sure that's the problem than you can use Nick Craver's solution
$(".bjqs img").one('load', function() {
   $('#slider').bjqs({
       height      : 420,
       width       : 130,
       responsive  : true
   });
}).each(function() {
   if(this.complete) $(this).load();
});


text:
Q: How to stop a stroke repeat animation in SwiftUI How to control the Rectangle animation repeat or not by assigning binding property isRepeatAnimation?
What I expect is that after assigning true to isRepeatAnimation, the border width animate from 5.0 to 0.0 and back and forth, and the repeat animation is off after assigning false to isRepeatAnimation.

import SwiftUI

struct ContentView: View {
    @Binding var isRepeatAnimation: Bool
    @State var lineWidth: CGFloat = 5

    var body: some View {
        Rectangle()
            .stroke(Color.blue, style: StrokeStyle(lineWidth: lineWidth))
            .frame(width: 100, height: 100)
            .animation(isRepeatAnimation ? repeatAnimation : Animation.easeInOut, value: lineWidth)
    }

    var repeatAnimation: Animation {
        Animation.easeInOut.repeatForever(autoreverses: true)
    }
}

struct ContentViewPreviewer: View {
    @State var repeated = false
    var body: some View {
        VStack {
            ContentView(isRepeatAnimation: $repeated)
            Button("Toggle") {
                repeated.toggle()
            }
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentViewPreviewer()
    }
}

A: To stop repeating animation it we should replace it with default one, and line width can be just toggled.
Tested with Xcode 13.4 / iOS 15.4

Here is main fixes:
Rectangle()
    .stroke(Color.blue, style: StrokeStyle(lineWidth: isRepeatAnimation ? 0 : lineWidth))
    .frame(width: 100, height: 100)
    .animation(isRepeatAnimation ? repeatAnimation : Animation.default, value: isRepeatAnimation)

Complete test module in project

A: If the purpose is to have the line width going from 5 to 0 to 5 and stop, this can be a solution. If the purpose is to manually stop animation, read Asperi's solution.
You can animate twice, first by changing the line width from 5 to 0 on the first half of the duration, then from 0 to 5 on the second half. You control this behaviour using two commands:

*

*on the .animation(), include a pre-defined (duration:)

*on change of the Boolean variable, change back from 0 to 5 using DispatchQueue.main.asyncAfter()
Here's the sample code:
struct ContentView: View {
    @Binding var animate: Bool
    @State private var lineWidth = 5.0

    var body: some View {
        Rectangle()

            .stroke(Color.blue, style: StrokeStyle(lineWidth: lineWidth))

            // Instead of repeating, make it with a pre-defined duration.
            // The value here (0.25) is half of the total duration
            .animation(.easeInOut(duration: 0.25), value: lineWidth)
            .frame(width: 100, height: 100)

            // Change the line width when animate changes
            .onChange(of: animate) { _ in

                // Make it zero immediately
                lineWidth = 0

                // On the second half of the duration, make it 5 again
                DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
                    lineWidth = 5
                }
            }
    }
}

struct ContentViewPreviewer: View {
    @State var animate = false
    var body: some View {
        VStack {
            ContentView(animate: $animate)
            Button("Toggle") {
                animate.toggle()
            }
        }
    }
}


text:
Q: Are SATA controllers SAS compatible? I have a couple old SAS drives that I want to wipe to resell, along with their RAID controller card.
However, the PC they came with is toast, and my personal rig has only SATA-III  ports. I can buy a physical adapter on amazon or reuse the old RAID card, but I am wondering if the SATA controller on my mobo can even make the connection?
relevant specs:
aorus ultra z390
i7-9700k
16gb ram
windows 10
nvidia gpu

A: No. An SAS (Serially Attached SCSI) controller is needed to make changes to an SAS drive, despite the partial similarity in connectors.
Often those controller cards need additional drivers installed to function with Windows 10. That's on a card-by-card basis, so for a particular make and model of card, consult its documentation.


text:
Q: Border input[type=radio]:checked для ie8 Пытаюсь сделать выбор цвета с помощью radio input, в верстаемый шаблон выбор цвета происходит по кусочку образца... я не знаю как объяснить посмотрите: http://jsfiddle.net/2xH8k/
Так вот, цвет рамки образца в ie8 не меняется когда мы выбираем определенный radio, хотя в остальных браузерах все нормально, помогите поправить? Желательно без js выкрутасов...
A: Боюсь без js в ie8 не обойтись, он не знает что такое :checked
A: Используйте http://selectivizr.com/ —  добавляет IE возможность работать с  новыми полезным селекторам :checked, nth-*() и т.д.
Размер сжатой — 4кб.


text:
Q: Let A and B be n*n matrices such that trace(A)<0Let A and B $n\times n$ such that trace(A)$\lt0\lt$trace(B).
Then, $f(t)=1-det(e^{tA+(1-t)B})$ has
1) infinitely many zeros in $0\lt t\lt1$
2) at least one zero in $\Bbb R$
3) no zeros
4) either no zeros or infinitely many zeros in $\Bbb R$.
According to my knowledge determinant is defined for square matrices not for exponential functions. So, I think something is wrong in the question. If this question is correct then how can I solve it? If it is not correct then try to correct the question and give a hint to solve it.
Thank you

A: The exponent of a matrix is defined by a convergent infinite sum.
Use $\det e^A=e^{\text{Tr }A}$.
http://en.wikipedia.org/wiki/Matrix_exponential


text: Q: fs.createWriteStream - download and merge multiple file segments into single one I'm trying to use nodejs to create a single file from multiple fragments of an octet/stream. I'm using puppeteer to intercept requests and add each url like this one https://ipv4-c003-nap002-teleit-isp.1.oca.nflxvideo.net/... to an array. The urls in question points to small parts of a video file that is displayed using blob url in browser. Since I'm not so experienced with nodejs, I would ask if is possible to use the fs.createWriteStream() and https.get() functions to create a single file from those urls. Anyone can give me a suggestion about? After the file is downloaded, what is the correct file extension for an octet stream?


text:
Q: sqlite3 count occurrences where occurrences equals I am trying to get the count of all occurrences in my column then filter out the occurrences if it doesn't meet a number criteria. For example, I have a table(my_table) like so
fruit          variety
orange         29
orange         001
orange         89
apple          82
plum           38
plum           49

sql query:
select fruit, count(*) from my_table where count(*) > 1 group by fruit order by fruit

this gives me an error. I want the end result to be
fruit          total count
orange         3
plum           2

A: Aggregation functions cannot be used in a WHERE clause. To filter using aggregation functions use a HAVING clause.
SELECT fruit,
       count(*)
       FROM my_table
       GROUP BY fruit
       HAVING count(*) > 1
       ORDER BY fruit;


text:
Q: Convert NSString to char str[] I am trying to convert NSString to char str[]
i have tried this
NSString *data = @"08052678744default0000000";
char mac [[data length]];
strncpy(mac ,[data UTF8String], [data length]);

But got the wrong result.
Your help is urgently needed in resolving this. Thanks

A: For example:
NSString *data = @"08052678744default0000000";
const char* utf8String = [data UTF8String];
size_t len = strlen(utf8String) + 1;

char mac [len];
memcpy(mac, utf8String, len);

Note the difference between string length and byte length!


text:
Q: How to average a matrix of lists? I have a complicated computation question about averaging a matrix of lists...
The matrix looks like
mat <- matrix(list(), 100, 10)

Each cell is filled with a list of 3 elements. For example, the mat[,1] will look like
mat[,1]

[[1]]
[1] 1.21 1.33 1.50
[[2]]
[1] 2.1 1.9 4.5
[[3]]
[1] 0.1 0.4 1.5
...
[[100]]
[1] 0.8 0.69 1.42
I hope to take average of all the first elements in the 100 lists. In other words, it's to compute (1.21 + 2.1 + 0.1 + ... + 0.8)/100. Similarly, it can apply to all the second elements, as (1.33 + 1.9 + 0.4 + ... + 0.69)/100. And the third elements too... If possible, it can apply this procedure to all the 10 columns in mat.
How can this be achieved using lapply or sapply function?

A: Using the dplyr function bind_cols to bind each of list in mat[, i],
and the take the row means.
res_in_cols <- apply(mat, 2, function(x) rowMeans(dplyr::bind_cols(x)))

The averages for mat[, i] is in the ith column of res_in_cols

A: Maybe you can try colMeans + rbind along with apply
as.matrix(asplit(apply(mat, 2, function(x) colMeans(do.call(rbind, x))), 2))


text:
Q: Specify allowed subclasses in interface Is there any way to specify the allowed subclasses for an interface?
Let's say I have this classes:
public interface IDoable // specify that only A or it's subclasses can implement IDoable
{
    void Do();
}

public class A : IDoable
{
    public void Do(){};
    public void Foo(){};
}

public class B : IDoable // implementing IDoable on something other than A or its sublcasses doesn't make any sense
{
    // public void Do();
}

So later I will be able to do this:
IDoable d = new A();
d.Do();
d.Foo(); // I'd like to be able to do this.

Does C# support this kind of feature?

A: No, it doesn't. An interface represents a contract, and any class that has access to it can implement it.
You can of course restrict the access to it by making it internal (so only the same assembly can access it).

A: You can cast d to A in order to be able to call Foo on it:
((A)d).Foo();

Note that if d is not A, this will throw an exception.
Other options are to test the type of d using is or as operators.
This of course goes against the point of using an interface to begin with.

A:
Is there any way to specify the allowed subclasses for an interface?

No, any class can implement an interface as long as it's accessible to it. The whole point of an interface is to hide the concrete type/implementation from it's consumer so for me it doesn't make sense to couple it in the way your suggesting.


text:
Q: What is HTML formatted data I have a project i'm working on and i'm allowed to use React and express. But rules are not to use any Html formatted data being exchanged between client and server. What is exactly meant by no Html formatted data. FYI, i plan on using json data to be sent between client and server.

A: HTML formatted data is a data that you get from HTML, for example: input type, hidden value, etc which you can retrieve using HTTP/REST method such as GET, POST on it's back end. JSON is not HTML formatted data, CMIIW.


text:
Q: I want to validate time field using joi I have taken date and time input field.
I have used joi library for input validation is that date and time can not be null seperately.
I am succesfull in applying date validation but i'm unable to apply time validation.
How can i achieve time validation.
Here is my code for html file for date and time input field.
html += '<input type="text" id="tier3City'+cnt+'"  readonly="readonly" name="tier3City"
class="form-control" />	';
html += '<input type="date" id="fromDate'+cnt+'" name="fromDate" class="form-control" />	';
html += '<input type="time" id="fromTime'+cnt+'" name="fromTime" class="form-control" />	';
html += '<input type="date" id="toDate'+cnt+'" name="toDate" class="form-control" />	';
html += '<input type="time" id="toTime'+cnt+'" name="toTime" class="form-control" />	';

Here is my code for ejs file.
  else if(stayOption == 'Stay')
  {
      schema=joi.object({
      stayOption:joi.string().required().label('Please Choose Stay Option'),
      projectTask:joi.string().required().label('Please select Activity Code.'),
      placeJourney: joi.string().required().label('Please select Place of Journey.'),
      fromDated:joi.date().required().label('Please select FROM(Departure Time from Residence)'),
      fromDat:joi.date().max('now').required().label('Please select FROM(Departure Time from Residence) less than or equals to Today'),
      fromTimes:joi.time().required().label('Please select FROM(Departure Time from Residence) Time'),
      toDated:joi.date().required().label('Please select TO(Arrival Time to Residence)'),
      toDate:joi.date().max('now').required().label('TO(Arrival Time to Residence must be less than or equals to Today'),
      fromDate:joi.date().required().less(joi.ref('toDate')).label('From(Departure Time from Residence) must be less than To (Arrival Time to Residence)'),
      toTimes:joi.time().required().label('Please select TO (Arrival Time to Residence)Time'),
      actualAMTForBL:joi.number().required().label('Please enter Actual Boarding lodging Amount'),
      imgpath:joi.string().invalid('demo').label('Please Upload File/Attachments').required(),
  })
  result=schema.validate({stayOption:stayOption,projectTask:projectTask,placeJourney:placeJourney,fromDated:fromDate,fromDat:fromDate,toDated:toDate,fromDate:fromDate,fromTimes:fromTime,toDate:toDate,toTimes:toTime,actualAMTForBL:actualAMTForBL,imgpath:imgpath});

A: You have to use RegEx to validate time(Joi.string().regex() instead of Joi.time()).
The solution to your problem is here.


text:
Q: polynomial which is zero for all values, has to have zero coeficients Let $k$ be an infinite field. and define the polynomial in $f \in k[x]$ to be
$f= a_n x^n + a_{n-1} x^{n-1} + ... + a_1 x$
If for all $x \in k$, we have $f=0$, then all $a_i$ have to be zero.
Could someone please help me to prove it? and also why being infinite is important here?

A: This is a consequence of the factor theorem, which states that a polynomial $f$ over a field $k$ has zero at $a \in k$ if and only if $x-a$ is a factor of $f$.
If $f$ is nonconstant then it has degree $m$ for some $m > 0$ and at most $m$ roots up to multiplicity, so the only way for $f$ to have infinitely many roots is for it to be identically zero.


text:
Q: Does $abc$ preclude very smooth solutions? Recall the $abc$-conjecture, which asserts that for any $\epsilon > 0$ there exists a positive number $C(\epsilon)$ such that for any coprime integers $a,b,c$ with $a + b = c$ and $\max\{|a|, |b|, |c|\} = |c|$ we have
$$\displaystyle |c| < C(\epsilon) \text{rad}(abc)^{1 + \epsilon}.$$
Here
$$\text{rad}(n) = \prod_{p | n} p,$$
where by convention all primes involved in the product are positive (even though $n$ may not be).
The best known (uncontroversial) result towards the $abc$-conjecture is due to Stewart and Yu, which gives the bound
$$\displaystyle |c| < \exp \left(C(\epsilon)\text{rad}(abc)^{1/3 + \epsilon} \right).$$
However, this is a corollary of their more refined results, which actually depends on the largest prime factor of $abc$. To quote their paper:
"An examination of our proof reveals that the impediment to a further refinement
of Theorem 1 is not the dependence on the number of terms in the estimates for
linear forms in logarithms but instead is the dependence on the parameter p in the
p-adic estimates. This fact is highlighted by our next result which shows that if the
greatest prime factor of one of x, y and z is small relative to G then the estimate
for z from Theorem 1 can be improved."
This motivates the following question: can the $abc$-conjecture be strengthened to only depend on the largest prime factor of $abc$? In other words, is it possible for there to be infinitely many triples of co-prime integers $a,b,c$ such that $a + b = c$ and each $a,b,c$ is very smooth compared to $\max\{|a|, |b|, |c|\}$?


text:
Q: convert default index to hashed mongodb I'd like to make sharding of my existing users collection. Users collection has already single ascending index by default  {"_id" : 1}. I want to convert this index to "hashed" and to shard based on this hashed key according to the documentation:
I've tried "brute-force" solution to delete default index and then recreate it with "hashed" parameter but it doesn't allow to do that.
UPDATE: I've also tried db.users.ensureIndex({_id: "hashed"}). But after I run this command nothing  really happens.
switched to db bg_shard_single
mongos> db.users.ensureIndex({_id:"hashed"});
mongos> db.users.getIndexes();
[
        {
                "v" : 1,
                "key" : {
                        "_id" : 1
                },
                "ns" : "bg_shard_single.users",
                "name" : "_id_"
        }
]

A: It does not allow you to do so because you can not create an index from _id field. Instead of this you can do something like this db.collection.ensureIndex( { _id: "hashed" } ) to create a hashing index on this field.
Then you will see "name" : "_id_hashed" as your hashed index which you can use for sharding purposes later.

A: I've found what was the problem. Apparently, I was using the old version of mongodb. That's why mongos didn't want me to update '_id' to "hashed". After I've updated to 2.4.8 as @Salvador-Dali mentions it becomes "name" : "_id_hashed".


text: Q: How do i figure out how to navigate portals? I'm new to the developer world and have a difficult time navigating the web and and thru app portals. Where can i go to get a walk thru on how to navigate and what to look for so that I'm not clicking any and everything in order to find something???


text:
Q: Image and audio lossless file format I know that JPG and MP3 always apply some kind of compression which losses data. Then I have to questions:
- Which are the lossless file formats for image, audio and video?
- Why, as far as I know, any photocamera does not offer the possibility to store images in a lossless file format?
- I know that the data lost is really small but, what can I do if HQ is extremely important? Can I take a picture in a lossless way?
THANKS

A: Audio: please consider FLAC (Free Lossless Audio Codec)
Image: please consider JPEG2000 that supports lossless encoding too.
I just came back from IBC Amsterdam, and I met some guys specialized in JPEG2000 lossless video compression. Impressive.

A: For audio .WAV is lossless format.In images .PNG is a lossless format.

A: For lossless compression of audio, FLAC is the encoder of choice.
Video, especially HD video is extremely data intensive with lossless data rates in excess of 40Mb/s. Outside of tape, it is pretty hard to sustain those data rates so mostly all digital video entails some compression scheme of which H.264 is becoming a dominant standard.

A: As previous answers have noted, FLAC is the most widespread format for lossless audio compression. WAV is lossless but uncompressed.


text:
Q: Showing a function is not a bijection Let $g: [1,2] \rightarrow (3,5)$ be one-to-one and continuous. Show that $g$ is not onto using the intermediate value theorem.
I figured I can show $g$ is a strictly increasing or decreasing function, but how should I proceed from there?

A: If $g$ is say increasing (a similar argument for decreasing), then $g(1)\in (3,5)$.  But then there are elements in $(3,5)$ that are less than $g(1)$.  Could these values (less than $g(1)$) be in the range of $g$?

A: We don't need the fact that $g$ is one to one. If $g$ is continuous on $[0,1]$, therefore $g([1,2])$ has to be an interval. Let denote $[a,b]:=g([1,2])$. Therefore $[a,b]\subset (3,5)$ by definition. Moreover $(3,5)$ is an open interval and thus, there is a $\delta>0$ such that $a-\delta\in (3,5)$, but $g^{-1}(a-\delta)=\emptyset$ and thus $g$ is not onto and thus not bijective.


text:
Q: Why PHP lose item value of array? I have the array with values:
$array1 = array('Boss', 'Lentin', 'Endless');
print_r ($array);

The result will be:
Array ( [0] => Boss [1] => Lentin [2] => Endless

It's ok.
But, if I add two elements to this array with a keys, the "Boss" element will be lost.
$array2 = array("1"=>'Doctor','Boss', 2=>'Lynx', 'Lentin', 'Endless');
print_r ($array2);

The result will be:
Array ( [1] => Doctor [2] => Lynx [3] => Lentin [4] => Endless )
//Where is "BOSS"???

Why?

A: When php create the array, set Doctor in index 1 and Boss in index 2, but 2=>'Lynx' cause php overwrite index 2 and set Lynx in it.
You can set it after setted index or use index for it. For example like
$array2 = array("1"=>'Doctor', 2=>'Lynx', 'Boss', 'Lentin', 'Endless');
// or
$array2 = array("1"=>'Doctor', 2=>'Boss', 3=>'Lynx', 'Lentin', 'Endless');

A: When $array is being created, 'Boss' will first be stored in index 2 (Array([2] =>'Boss') which is later overwritten by 'Lynx'

A: Your issue is index keys
$array2 = array("1"=>'Doctor','Boss', 2=>'Lynx', 'Lentin', 'Endless');
print_r ($array2);

This is because, on index 1 it is already doctor, boss will be second, which will be replaced by Lynx which have same index of 2 where boss will be replaced.
I hope I am clear.

A: This is expected behaviour from php (see http://php.net/manual/en/language.types.array.php#example-57). In case you need all the values in the array and don't need to work with keys, I recommend to use array_push($array $value). Otherwise you should add all the values with their keys and remember that for PHP 1 and "1" and true are the same values so they will overwrite each other.

A: array() is a construct with dynamic arguments representing literal arrays. The assignment of the given values to the array structure is done sequentially i.e. one by one from left to right. In your example:

*

*Doctor is assigned to index 1.

*Boss is assigned to index 2.

*Lynx overwrites index 2.

*Lentin and Endless are assigned to index 3 and 4 respectively.

A:
hey @Weltkind first of all i suggest you to read
  "http://php.net/manual/en/language.types.array.php",

now come to your answer In php the array key can be string or integer and if you do not mention the key then
default integer is set and the value of next array key is depending on the previous array integer key means
next array key = previous integer key + 1;
In PHP array the same key value will override by the same key

Now lets understand with your array2:

<?php
$array2 = array("1"=>'Doctor','Boss', 2=>'Lynx', 'Lentin', 'Endless');

1) as you started your array with key "1" so the
so for 1st key value is  [1] => 'Doctor'
current array like:   array([1] => 'Doctor')

now next key = previous integer key(that is 1) + 1 = 2;

2) for 2nd key value is [2] => 'BOSS'
current array like:   array([1] => 'Doctor', [2] => 'BOSS')
3) next key = previous integer key(that is 2) + 1 = 3 it will carry
  to next key but as next key is [2] => 'Lynx' as you mentioned so at
  key [2] the value will be override by value 'BOSS' to 'Lynx'; current
  array like : array([1] => 'Doctor', [2] => 'Lynx')

Now the next key we have is [3]

4) for next value the key is [3] => 'Lentin'
current array like :  array([1] => 'Doctor', [2] => 'Lynx', [3] =>
  'Lentin');
now next key = previous integer key(that is 3) + 1 = 4;
5) for next value the key is [4] => 'Endless'
current array like :  array([1] => 'Doctor', [2] => 'Lynx', [3] =>
  'Lentin', [4] => 'Endless');

and that is why the final array is like below :
array(
        [1] => 'Doctor',
        [2] => 'Lynx',
        [3] => 'Lentin',
        [4] => 'Endless'
    );


text:
Q: well-posedness of the transport equation I asked this question before on math exchange but did not have any luck with an answer. I would like to consider a simple example but get a thorough understanding of the theory behind it. I am considering the hyperbolic equation of the form $$w_t+\frac{x}{T-t}w_x=0, x\in[0,1]$$ and some continuous initial data $w(x,0)=w_0(x)$. I would like to claim that this is a well posed problem on $[0,T]$. One can analytically solve this equation and obtain the unique solution but I am stuck with "continuous dependence" on the initial data. So I did the following. Choose $L^2$ space and use energy methods for an equation of the form $w_t-a(x)w_x=0, \; y \in [0,1]$:
$$
\frac{d||w||^2}{dt}=(w_t,w)+(w,w_t)=(a(y)w_x,w)+(w,a(x)w_x)
$$
$$
=(a(x)w_x,w)-(w_x,a(x)w)-(w,a_x(x)w)+a(x)ww|^1_0
$$
$$
\leq max_{x\in [0,1]}|a_x(x)|||w||^2+a(x)ww|^1_0
$$
Thus, the energy estimate boils down to the bound of $a_x$ provided boundary conditions are bounded. In my case $a(x)=-\frac{x}{T-t}$ and $a_x=\frac{1}{T-t}$. Thus, I can't show that inequality for any $t$ only for $t\in [0,T-\epsilon]$. However, I do know the solution at $t=T$ being $u(x,T)=u_0(0,0)$ and it is constant so the $L^2$ norm is perfectly bounded. Thus, please suggest me some ways to make a complete statement about this problem, is that well posed in $L^2$?
If I take $L^{\infty}$ instead to show such a dependence on initial data it directly follows from method of characteristics and clearly it is well posed in $L^{\infty}([0,T])$ but I am not sure I can have some "limiting statement" in $L^2$ as so far I have only on $[0,T-\epsilon]$


text:
Q: How to create dynamically class in Android In my application, I should use Material Stepper and for this, I want to use this library : https://github.com/ernestoyaquello/VerticalStepperForm
But I want to add this dynamically from server.
For connecting with server I used Retrofit library and I should check the type of items from server.
when this type is "penny" show one of this steps and when the type is "best" show another step.
I create this steps from library tutorials, but i want when type is penny show me StepDynamicTxt and when the type is best show me StepDynamicEdt!
I write below codes but just add one of the items from each step!
But in API, I have 2 item of penny types and 3 items of best type!
Should show me 5 step, but show me 2 step!
My codes :
public class StepperActivity extends AppCompatActivity {

    private ApiServices apiServices;
    private ProgressBar loader;
    private VerticalStepperFormView stepper;

    private StepDynamicEdt stepDynamicEdt;
    private StepDynamicTxt stepDynamicTxt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bidzila_stepper);
        //Initialize
        apiServices = ApiClient.ApiClient().create(ApiServices.class);
        loader = findViewById(R.id.bidStepper_loader);
        stepper = findViewById(R.id.bidStepper);

        //Api
        callAPi();
    }

    private void callAPi() {
        loader.setVisibility(View.VISIBLE);
        Call<TodayResponse> call = apiServices.TODAY_RESPONSE_CALL(5);
        call.enqueue(new Callback<TodayResponse>() {
            @Override
            public void onResponse(Call<TodayResponse> call, Response<TodayResponse> response) {
                if (response.isSuccessful()) {
                    if (response.body() != null) {
                        if (response.body().getRes() != null) {
                            if (response.body().getRes().getToday().size() > 0) {
                                loader.setVisibility(View.GONE);
                                //Foreach
                                for (int i = 0; i < response.body().getRes().getToday().size(); i++) {

                                    if (response.body().getRes().getToday().get(i).getType().equals("penny")) {

                                        stepDynamicEdt = new StepDynamicEdt(response.body().getRes().getToday().get(i).getName());

                                    } else if (response.body().getRes().getToday().get(i).getType().equals("best")) {

                                        stepDynamicTxt = new StepDynamicTxt(response.body().getRes().getToday().get(i).getName());
                                    }
                                }

                                stepper.setup(new StepperFormListener() {
                                    @Override
                                    public void onCompletedForm() {

                                    }

                                    @Override
                                    public void onCancelledForm() {

                                    }
                                }, stepDynamicEdt, stepDynamicTxt)
                                        .allowNonLinearNavigation(false)
                                        .displayCancelButtonInLastStep(false)
                                        .displayBottomNavigation(false)
                                        .confirmationStepTitle("Confirm")
                                        .stepNextButtonText("Continue")
                                        .lastStepNextButtonText("Finish")
                                        .includeConfirmationStep(false)
                                        .init();
                            }
                        }
                    }
                }
            }

            @Override
            public void onFailure(Call<TodayResponse> call, Throwable t) {
                Log.e("ResponseErr", t.getMessage());
            }
        });
    }

    @Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
    }
}

I think this problem for this line:}, stepDynamicEdt, stepDynamicTxt) because just add 2 step.
How can i add this step dynamically in Android?

A: In your code, you are making a very fundamental mistake. And that is, you are using the same variable each time in your loop to store dynamic edit type and dynamic text type, which will replace any previously created fields. And hence when you finally create them, you end up with single last values of each type.
What you can do is, create a List with type Step, add new type every time you get them, and finally pass that list to the builder.
The builder accepts a list too, you should check implementation when its open source.
// before the for loop, create a list of type Step
List<Step> steps = new ArrayList();
// your loop on response received from server
for (int i = 0; i < response.body().getRes().getToday().size(); i++) {
    if (response.body().getRes().getToday().get(i).getType().equals("penny")) {
        StepDynamicEdt stepDynamicEdt = new StepDynamicEdt(response.body().getRes().getToday().get(i).getName());
        // add to list
        steps.add(stepDynamicEdt);
    } else if (response.body().getRes().getToday().get(i).getType().equals("best")) {
        StepDynamicTxt stepDynamicTxt = new StepDynamicTxt(response.body().getRes().getToday().get(i).getName());
        // add to list
        steps.add(stepDynamicTxt);
    }
}
// finally create them
stepper.setup(new StepperFormListener() {
    @Override
    public void onCompletedForm() {

    }

    @Override
    public void onCancelledForm() {

    }
}, steps) // pass the list
        .allowNonLinearNavigation(false)
        .displayCancelButtonInLastStep(false)
        .displayBottomNavigation(false)
        .confirmationStepTitle("Confirm")
        .stepNextButtonText("Continue")
        .lastStepNextButtonText("Finish")
        .includeConfirmationStep(false)
        .init();


text:
Q: Is it possible to select json data with where clause statement? I have a problem with my JSON data. I have a string like this:
  data: [
    {
     groupid: "1449550897156TWTJ3UJNUR0CPTQ",
        voting_id: "14510478525898WTJUQX2FEJF0BU",
     answer_name: "081911112222",
     answer_code: "1",
     answer_content: "Hoka2Bento",
     datetime: "2015-12-25 19:51:12.075"
     },
     {
     groupid: "1449550897156TWTJ3UJNUR0CPTQ",
     voting_id: "14510478525898WTJUQX2FEJF0BU",
     answer_name: "085718733340",
     answer_code: "0",
     answer_content: "Hanamasa",
     datetime: "2015-12-25 19:52:42.862"
     },
     {
     groupid: "1449550897156TWTJ3UJNUR0CPTQ",
     voting_id: "14510478525898WTJUQX2FEJF0BU",
     answer_name: "081911113333",
     answer_code: "1",
     answer_content: "Hoka2Bento",
     datetime: "2015-12-25 20:19:51.643"
     },
     {
     groupid: "1449550897156TWTJ3UJNUR0CPTQ",
     voting_id: "14510478525898WTJUQX2FEJF0BU",
     answer_name: "087815254524",
     answer_code: "2",
     answer_content: "Korean Barbeque",
     datetime: "2015-12-25 20:30:46.418"
     }
     ],

I want to select count data with the parameter answer_name = 1. How would I go about doing that?

A: Please run this code,
<?php
$data = '[
        {
         "groupid": "1449550897156TWTJ3UJNUR0CPTQ",
            "voting_id": "14510478525898WTJUQX2FEJF0BU",
         "answer_name": "081911112222",
         "answer_code": "1",
         "answer_content": "Hoka2Bento",
         "datetime": "2015-12-25 19:51:12.075"
         },
         {
         "groupid": "1449550897156TWTJ3UJNUR0CPTQ",
         "voting_id": "14510478525898WTJUQX2FEJF0BU",
         "answer_name": "085718733340",
         "answer_code": "0",
         "answer_content": "Hanamasa",
         "datetime": "2015-12-25 19:52:42.862"
         },
         {
         "groupid": "1449550897156TWTJ3UJNUR0CPTQ",
         "voting_id": "14510478525898WTJUQX2FEJF0BU",
         "answer_name": "081911113333",
         "answer_code": "1",
         "answer_content": "Hoka2Bento",
         "datetime": "2015-12-25 20:19:51.643"
         },
         {
         "groupid": "1449550897156TWTJ3UJNUR0CPTQ",
         "voting_id": "14510478525898WTJUQX2FEJF0BU",
         "answer_name": "087815254524",
         "answer_code": "2",
         "answer_content": "Korean Barbeque",
         "datetime": "2015-12-25 20:30:46.418"
         }
         ]';

        $array=json_decode($data);
        $count = 0;
       foreach($array as $arraydata)
       {
           if($arraydata->answer_code==1){
                $count++;
           }
       }

       echo "Count is" .($count);
 ?>

This way you will get all the answer count where code is = 1
please let me know if you need further help.
Thanks
Amit

A: Try this,decode the json data in php.
 $array=json_decode($data);

   foreach($array as $arraydata)
   {
    $count[] = $arraydata['answer_name'];
   }

   echo "Count is" .count($count);


text:
Q: Unique item in SharePoint list Can I create a unique item in a SharePoint list to prevent duplication of entries, without deploying any app to the server?
Also if it can be done through SharePoint Designer, how it can be done??
Thanks.

A: Well not really sure but, I think you can use JQuey here and check for items when added to the library.

A: Well good news. SharePoint 2010 seems to have this feature available.
Link showing this feature in SP 2010
Codeplex has project that has this feature along with others.
Codeplex Features Project
But if you want to do it yourself, you could possibly try this link? It seems to use an event handler to check if  the item exists. Seems simple enough, although I have not tried it but I am curious if you get it to work.
Preventing Duplicate Items


text:
Q: ASP.NET MVC 3 jQuery Unobtrusive Valdiation - Field Error Reset I noticed in one of the forms I am working on, for example a Textbox of type "number" and another of type "jquery UI datepicker", when form is submitted and no values in those fields, a red border appears putting those two fields in error state.
I change the values and remove focus from those fields, the fields are still showing red border, however, when i submit again, it works.
Other fields behave as follows, in case a field is in error state, I add some data, step out of the field, the red border is removed.
Any idea?
Thanks


text:
Q: Tomcat 7 not producing log output to catalina.out on RHEL7 I have a RHEL7 server with Apache Tomcat 7.0 installed and after a recent update to RHEL7.1 all of the logging to ${catalina.base}/logs/catalina.out was stopped. However I am receiving the logs inside journalctl.
If I type journalctl -u tomcat I do get the logging. Is there any way for me to get the logging also to catalina.out?
cat /usr/share/tomcat/logs/catalina.out
no output

journalctl -u tomcat

Aug 20 10:07:14 server.example.com server[26435]: at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
Aug 20 10:07:14 server.example.com server[26435]: at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
Aug 20 10:07:14 server.example.com server[26435]: at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
Aug 20 10:07:14 server.example.com server[26435]: at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
Aug 20 10:07:14 server.example.com server[26435]: at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
Aug 20 10:07:14 server.example.com server[26435]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
Aug 20 10:07:14 server.example.com server[26435]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
...

A: Creating a new file /etc/rsyslog.d/tomcat.conf containing the next two lines did the trick for me:
programname,contains,"server" /var/log/tomcat/catalina.out
programname,contains,"server" ~

Afterwards restart your rsyslog daemon:
service rsyslog restart

A: Jamie's answer is correct that you can force rsyslog to log what's going on with tomcat. However, that doesn't answer why tomcat 7 on rhel 7 does not log to catalina.out. Or if it does, why does it log to both catalina.out and a catalina with a date (if you are not using an RPM install).
First, in the past around 7.0.42, Red Hat's scripts used catalina.out because their scripts were mimicking behavior of RHEL 6. As far as I'm aware, they were using "forking" for the service for systemd. When 7.0.56 was released, they changed that entirely by making new scripts and wrappers in /usr/libexec/tomcat to force tomcat to run in simple mode instead of forked, allowing systemd to have control of the PID and stdout and stderr to go to the journal. There is still a catalina.$DATE.log file in /var/log/tomcat, but the information is more limited from a normal catalina.out.
Second, let's look at /etc/tomcat/logging.properties. You'll see it sorts out the logs in a specific way between catalina, localhost, manager, host-manager. You'll also notice that it has rsyslog facility support too, and basically how it "deals" with it. What it comes down to is the ConsoleHandler in that file. Changing those would change the behavior of the logs in /var/log/tomcat.
journalctl -u tomcat will show you everything that catalina.out is supposed to have. As far as I'm aware, without modifying Red Hat's wrappers in /usr/libexec/tomcat, there isn't a sure fire way to make everything go to just catalina.out. If you do modify those scripts and an update comes out, your changes will be overwritten.
If you want catalina.out for sure, go with Jamie's rsyslog example configuration. Just know that it will not only fill that, but the systemd journal will also have the same information.

A: It seems the rsyslog syntax changed with the newer versions. Running 8.24.0 on RHEL 7.4, the following syntax in /etc/rsyslog.d/tomcat.conf got it to work for me:
if ($programname contains "server") then {
    action(type="omfile" file="/var/log/tomcat/catalina.out" flushOnTXEnd="off")
    stop
}

Then, as Jaimie points out restart of rsyslog was needed:
service rsyslog restart


text:
Q: Avoid repeating data in GridView so i've a gridview table binded from Microsoft SQL. Datatable (Adresses) looks like this:
adress_id
user_id
street
town
zip-code

User_id in "AddNew" RowCommand is selected via dropdownlist (from another table "users") but the problem is that i don't know how to prevent repeating of this user_id in my table. I just want to check if "x" user_id is already in table and if it exists i want to display a message "User already exists" otherwise add it.
My OnRowCommand code:
protected void GvAdress_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {

            if (e.CommandName.Equals("AddNew"))
            {

                ObAdress obdod = new ObAdress();
                string idp = (GvAdress.FooterRow.FindControl("ddFooter") as DropDownList).SelectedValue;
                obdod.userid = Convert.ToInt32(idp);
                obdod.street = (GvAdress.FooterRow.FindControl("txtstreetFooter") as TextBox).Text.Trim();
                obdod.town = (GvAdress.FooterRow.FindControl("txttownFooter") as TextBox).Text.Trim();
                obdod.zip = (GvAdress.FooterRow.FindControl("txtzipFooter") as TextBox).Text.Trim();
                obdod.Add();
                PopulateGridView();
                lblSukces.Text = "added";
                lblError.Text = "";

            }
        }
        catch (Exception ex)
        {
            lblSukces.Text = "";
            lblError.Text = ex.Message;
        }
    }

If some1 was wondering ObAdress is my objector that creates query, and obdod defines values.


text:
Q: Request Mapping method not running when data validation fails (Spring MVC) I'm currently learning Spring MVC and data validation looks simple enough, my problem is the following: When I enter data that is not valid and press the submit button, the request mapping method does not fire at all, it sends me to "HTTP Status 400 – Bad Request". My goal is to look if there are any errors using "BindingResult" but the method body does not run if the entered data is invalid. (Using hibernate-validatior). Here is some code.
User object:
public class User {
    @NotNull
    @Size(min = 4, max = 25, message = "Must be between 4 and 25 characters")
    private String firstName;

    @NotNull
    @Size(min = 4, max = 25, message = "Must be between 4 and 25 characters")
    private String lastName;

    @Email
    private String email;

    @Size(min = 8)
    private String userPassword;
}

Controller: To open form page
@RequestMapping("createAccount")
public String register(Model model) {
    model.addAttribute("newUser", new User());
    return "register";
}

Here's the problem. This method should run when I press the submit button, and when the data is valid it does return the userinteface.jsp with all the entered data, but when the entered data is invalid it sends me straight to HTTP Status 400 - Bad Request.
@RequestMapping("signUp")
public String signUp(@Valid @ModelAttribute("newUser") User user,
    Model model, BindingResult bindingResult) {

    model.addAttribute("dbUser", user);

    if (bindingResult.hasErrors()) return "register";

    return "userinterface";
}

Here is my register.jsp
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Register</title>
        <meta name="description" content="An interactive getting started guide for Brackets.">
        <link rel="stylesheet" type="text/css" href="resources/css/main.css" />
        <link href="https://fonts.googleapis.com/css2?family=Nova+Round&display=swap" rel="stylesheet">

- Register -

            <form:form action ="signUp" modelAttribute="newUser">

                <form:input path="firstName" class = "cred" placeholder="First Name"/>
                <form:errors path="firstName" cssClass="error"/>

                <form:input path="lastName" class = "cred" placeholder="Last Name"/>

                <form:errors path="lastName" cssClass="error"></form:errors>

                <form:input path="email" class = "cred" placeholder="E-mail"/>
                <form:errors path = "email" cssClass="error"/>

                <form:password path="userPassword" class = "cred" placeholder="Password"></form:password>

                <form:errors path="userPassword" cssClass="error"/>

                <form:input path="age" type = "number" class = "cred" placeholder="Age"/>

                - <input type ="submit" class = "submitButton" value = "Add User"> -

                cancel

            </form:form>

A: The problem was with the method arguments. I've put User, Model, BindingResult. Where it should be User, BindingResult, Model So basically the Binding Result has to be right after the User object.
Wron way:
@RequestMapping("signUp")
public String signUp(@Valid @ModelAttribute("newUser") User user,
                     Model model, BindingResult bindingResult){

Right way:
public String signUp(@Valid @ModelAttribute("newUser") User user,
                     BindingResult bindingResult, Model model){

I wonder why these kind of problems keep happening only to me!


text:
Q: How do we group monospace font families with regards to their serif property? I am studying the font-family CSS property and I understand that the font families are grouped into 3 categories, which are called General Families:

*

*Serif

*Sans-Serif

*Monospace

The question here is how do we group monospace font families with regards to their serif property? Is it always "serif"? Is it always "sans-serif"? Can I have monospace font families that are "serif" and some others that are "sans-serif"? Does a monospace font family use the "serif" property consistently on all of its characters so that it can be categorised as "serif" or "sans-serif"? Is there an official resource or specification about this subject?

A: The CSS font-family property is only a practical implementation of a very broad and ancient art, namely Typography.
The generic font-family is a fallback for when the specified font is not installed on the system that's rendering the element, or for when the specified font file could not be loaded for any reason, in which case the generic font will be used.
Currently there are not 3, but 5 generic font-families commonly used by browsers:

*

*serif

*sans-serif

*monospace

*cursive

*fantasy

The default font used for each generic family varies depending on various browser/OS/device settings.
All this system was designed in the days when specifying an external (font-file) resource for rendering the text was not in practice and websites relied solely on fonts installed on the user's machine, so you have to regard it as a practical solution to decently cover all possible situations and, by no means, as an exhaustive or complete classification of fonts.
While most font types can be easily classified as belonging to one generic font family or another, others are displaying characteristics from multiple categories, much like a musical piece can belong to more than one genre.


text:
Q: VisualStudio.Net reference not working
*

*I create a new solution called "WordpressAutomation"

*I create a new project, a class library, called "WordpressAutomation" in this solution

*I create a new project, a unit test project, called WordpressTests in this solution

*I add a reference to the project WordpressAutomation in the project WordpressTests"

This should be ok, shouldn't it?
However, as can be seen from the screenshot, when adding this using line in a class in the project WordpressTests,
the reference doesn't work. Even though it is there, as can plainly be seen.
When entering "using", the class library "WordpressAutomation" doesn't appear among the alternatives.
And I get this error message when trying to run:
"The type or namespace "WordpressAutomation" could not be found (are you missing a using directive or an assembly reference?)"
Why is this happening? The reference is clearly there?
http://i.stack.imgur.com/L0g5R.png

A: Your project isn't actually including the .cs files to compile; they are only shown for information (they should appear as solid files with the C# logo):

Right click on these files and include them in the project. Then check what namespace they declare inside them. At the moment, your WordpressAutomation project simply doesn't contain any types.


text:
Q: On Inno Setup License page, replace checkboxes by "I agree" button I'd like to remove the checkboxes "I accept the agreement" / "Don't accept" and replace the text of the "Next" button by a simple "I agree", after all, it looks more clear and straight.
Can you point me to some sample or where to look in the documentation?

A: As @Ken pointed out, do not do this, if you need user to really accept the license. As clicking, what seems to be a mere "Next" button, hardly constitutes a conscious agreement.
A different thing is, when the user is actually not required to accept the license, like is the case of GPL (which actually explicitly forbids being required to be accepted). Then your approach might be ok. Except maybe that you should not change the button to "I agree" then.
[Code]

procedure InitializeWizard();
begin
  { Hide radio buttons and pre-select "accept", to enable "next" button }
  WizardForm.LicenseAcceptedRadio.Checked := True;
  WizardForm.LicenseAcceptedRadio.Visible := False;
  WizardForm.LicenseNotAcceptedRadio.Visible := False;
  WizardForm.LicenseMemo.Height :=
    WizardForm.LicenseNotAcceptedRadio.Top +
    WizardForm.LicenseNotAcceptedRadio.Height -
    WizardForm.LicenseMemo.Top - ScaleY(5);
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  { Dubious, but you have asked for it }
  if CurPageID = wpLicense then
  begin
    WizardForm.NextButton.Caption := '&I agree';
  end;
end;


text:
Q: About $ \lim_{n \to \infty}na_{n} $ Consider a non-monotonic sequence $ \left \{ a_{n} \right \}$, $a_{n} \geq 0$ for all $n \in \mathbb{N}$.
If, the series $\sum_{n=1}^{\infty}a_{n}$ converges
then is it necessary to have $\lim_{n \to \infty}na_{n} = 0$?
I am able to prove that $ \liminf na_{n} = 0 $ using Pringsheim's theorem, but how can I confirm or counter the convergence of $ \left \{ na_{n} \right \}$?

A: Consider the sequence
$$
a_n=\cases{\frac1n& if $n$ is a power of 2\\0& otherwise}
$$
Its sum is $2$. Yet $na_n$ is equal to $1$ whenever $n$ is a power of $2$, and $0$ otherwise, so $na_n$ doesn't converge.

A: Take $a_n=\frac 1 n $ when $n=m^{2}$ for some $m$ and $0$ otherwise.


text:
Q: How to compile with both C++17 and C++20 using CMake I've used both C++20 and boost in my project. But some boost header files can't be compiled with C++20 as they use is_literal_type or something else that were removed in C++20.
So is it possible to use C++17 to compile the boost header files and use C++20 for other project files? If yes, how should I configure it in CMake?


text:
Q: Why is the variable YourName = input("What is your name?") printing the user input question rather than the users input I've created a program to display some pre-set variables followed by variables which take user input. I was under the impression that after the user inputs their name that the following print() function would simply use the input of the user rather than repeating the question alongside the variable input.
#Setup the required variables for Dialog1 and Dialog 2
MyName = "Shawn"
MyNumber = "seven"

#Sting varibles that will the print() function.
s = "Hello, my name is " + MyName + "."
ss = "My lucky number is " +MyNumber + "."

# Alternative method for both (s) and (ss) to be combined on one line.
## s = "Hello, my name is " + MyName + ". My lucky number is " +MyNumber + "."

#Print() function for the first dialog.
print(s)
print(ss)

#Dialog2 that includes user input
YourName = input("What is your name?")
print("Your name is " +YourName)
##YourNumber = input("What is your lucky number?")
##print("Your lucky number is " +YourNumber + ".")

The output in Eric IDE(Linux Mint 20.x) is:
What is your name?Jason
Your name is What is your name?Jason

What I wanted was the output from print() to simply be Your name is Jason

A: Your code works well. As @Mick commented, may be something wrong with your IDE.
Here I have added few simple modifications that may be useful to you over the time.
MyName = "Shawn"
MyNumber = "seven"

print(f"Hello, my name is {MyName}.")
print(f"Hello, my name is {MyNumber}.")

YourName = input("What is your name?")
print(f"Your name is {YourName}")

I have removed your comments just to make this clear. Adding f'string goes here', you can do string formatting by placing variable in it.


text:
Q: Avoiding running aux file many times My main tex has the structure as below;
Main.tex
 \input{preamble.tex}

 \begin{document}

 \include{ch1.tex} within ch1.tex => \bibliographystyle{agsm}, \bibliography{ch1.bib}

 \include{ch2.tex} within ch2.tex => \bibliographystyle{agsm}, \bibliography{ch2.bib}

 \include{ch3.tex} within ch3.tex => \bibliographystyle{agsm}, \bibliography{ch3.bib}

\end{document}

My compiling order:
xelatex => Main.tex
Bibtex => ch1.aux, Bibtex => ch2.aux, Bibtex => ch3.aux
xelatex  1 or 2 times.
to make bibliography correctly at the end of each chapter.
My question:

*

*Is there another way to compile that without running every aux files for each chapter? Using something to detect all aux files automatically and run them all.

*Alternative ways are welcome.


text:
Q: Awk one liners into script I got some one liners in awk. How can i figure this three line into a script?
awk -F":|," 'FNR==NR && /INFO  - AId:/ {a[$6$8]=$0;next} END {for (i in a) print i "|" a[i]}' log >t1
awk  '/<?xml version/ {f=1} /<\/iSig>/ {f=0;print $0 "\n" } f' log  >t2
awk -F\| 'FNR==NR {a[$1]=$2;next} FNR==1 {RS="\n\n"} { for (i in a) {if ($0~i) {print a[i] $0 > i".log";close(i".log")}}}'  t1 t2

Thanks for helping!

A:
How can I figure this three line into a script?

By learning awk! The best place to start is by reading Effective Awk Programming.

A: $ cat > myscript.sh <<EOF
#!/bin/sh
awk -F":|," 'FNR==NR && /INFO  - AId:/ {a[$6$8]=$0;next} END {for (i in a) print i "|" a[i]}' log > $1
awk  '/<?xml version/ {f=1} /<\/iSig>/ {f=0;print $0 "\n" } f' log  >$2
awk -F\| 'FNR==NR {a[$1]=$2;next} FNR==1 {RS="\n\n"} { for (i in a) {if ($0~i) {print a[i] $0 > i".log";close(i".log")}}}'  $1 $2
EOF
$ chmod +x myscript.sh
$ ./myscript.sh file1 file2

A: First as bash you could do it like this:
awk -F\| 'FNR==NR {a[$1]=$2;next} FNR==1 {RS="\n\n"} { for (i in a) {if ($0~i) {print a[i] $0 > i".log";close(i".log")}}}' <(awk -F":|," 'FNR==NR && /INFO  - AId:/ {a[$6$8]=$0;next} END {for (i in a) print i "|" a[i]}' log) <(awk  '/<?xml version/ {f=1} /<\/iSig>/ {f=0;print $0 "\n" } f' log)


text:
Q: How to call a javascript function once on page load, page reloads, don't call it again On a Magento shopping cart, there are 2 forms that need to be filled out: shipping estimate and coupon code. Each refreshes the page after submitting the form. The shipping estimate form needs to be submitted before the coupon form so that the coupon can validate the country.
What I'd like to do is to call the shipping form's coShippingMethodForm.submit() on load. That way the country is loaded, and then the coupon form will check the country. This has the added advantage that the initial shipping rates are displayed without requiring the user to submit the form.
My challenge: if I call coShippingMethodForm.submit() on load - it will refresh the page and then continuously refresh b/c the coShippingMethodForm.submit() keeps submitting and refreshing.
How do I call that function once, page refreshes, and not run again (unless the user clicks the submit button).
Example Magento cart page I'm referring to

A: I see you're using PHP, why not just have a hidden form
<input type='hidden' name='countrySubmitted' value='true' />
and then when php renders the page check to see if the value is set, if not then call the function to submit.
echo "<script type='text/javascript'>";
if (isset($_POST['countrySubmitted']))
echo "document.coShippingMethodForm.Submit();";
echo "</script>";

A: You can use cookie to prevent resumbit on reload.
Function js for broswer cookie can be found here http://www.quirksmode.org/js/cookies.html
In your JS function coShippingMethodForm.submit
coShippingMethodForm.submit = function(){
     //check cookie here
     if(readCookie('already_submit')==1)
          return;
     createCookie('already_submit', 1, 1); //for 1 day
     //old code here
}

And on submit button, add eraseCookie line:
<input type="submit" id="your_submit_button"
       onclick="eraseCookie('already_submit');" />