text:
Q: Mass VirtualHost in vhost.conf question I'm sorry to ask this again, but I have a different variant of this question.
in my /var/www/vhosts/domain.com/conf/vhost.conf I want to automatically route subdomains to their own DocumentRoot and was wondering if I could use this type of set up
I used the keyword DYNAMIC_SUB to represent a domain that will be made automatically.
I have no idea how to make a vhost.conf entry to do what i want so I took this template from an already existing entry that points domain.com to my server and related directories, I modified it to show an idea of what I was looking for. I know some people might chuckle while looking at it ;-) but its a learning experience and we were all here at some point or another.
I'm trying to let users create accounts and to give them their own sub domain instead of the usual url segment.
so test.domain.com instead of domain.com/test
I use Plesk 10 for Linux, and the Plesk API is crap with making sub domains, so I figured making my own would be better, I just need it as a point of reference so a user can store small files while still being served the index.php files from the main directory using some PHP tricks.
Right, well to make long story short I'm trying to make
http://www.test.domain.com AND http://test.domain.com all point to their own sub domain folder while still going to either http://www.domain.com OR http://domain.com will point to the web root.
I have a DNS record in my Zone File
domain.com     with an A record pointing to my HOST_IP

*.domain.com   with an A record pointing to my HOST_IP

www.domain.com with an A record pointing to my HOST_IP

<VirtualHost HOST_IP:80>
    ServerName "DYNAMIC_SUB.domain.com:80"
        ServerAlias  "DYNAMIC_SUB.domian.com"
        UseCanonicalName Off

<IfModule mod_suexec.c>
    SuexecUserGroup "USER_GROUP" "psacln"
</IfModule>

    ServerAdmin  "admin@domain.com"

        DocumentRoot "/var/www/vhosts/domain.com/httpdocs/users/DYNAMIC_SUB"
    CustomLog /var/www/vhosts/domain.com/statistics/logs/access_log plesklog
    ErrorLog  "/var/www/vhosts/domain.com/statistics/logs/error_log"

<IfModule mod_userdir.c>
    UserDir "/var/www/vhosts/domain.com/web_users"
</IfModule>

    ScriptAlias  "/cgi-bin/" "/var/www/vhosts/domain.com/users/DYNAMIC_SUB/cgi-bin/"

    Redirect permanent /plesk-stat https://domain.com/plesk-stat
    Redirect permanent /webstat https://domain.com/webstat
    Redirect permanent /webstat-ssl https://domain.com/webstat-ssl
    Redirect permanent /ftpstat https://domain.com/ftpstat
    Redirect permanent /anon_ftpstat https://domain.com/anon_ftpstat
    Redirect permanent /awstats-icon https://domain.com/awstats-icon

    <IfModule mod_ssl.c>
        SSLEngine off
    </IfModule>

    <Directory /var/www/vhosts/domain.com/httpdocs/users/DYNAMIC_SUB/>

<IfModule mod_perl.c>
    <Files ~ (\.pl$)>
        SetHandler perl-script
        PerlHandler ModPerl::Registry
        Options ExecCGI
        allow from all
        PerlSendHeader On
    </Files>
</IfModule>
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir /var/www/vhosts/domain.com/httpdocs/users/DYNAMIC_SUB/:/tmp/
</IfModule>

<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir /var/www/vhosts/domain.com/httpdocs/users/DYNAMIC_SUB/:/tmp/
</IfModule>
<IfModule mod_python.c>
    <Files ~ (\.py$)>
        SetHandler python-program
        PythonHandler mod_python.cgihandler
    </Files>
</IfModule>
<IfModule mod_fcgid.c>
    <Files ~ (\.fcgi)>
        SetHandler fcgid-script
        Options +FollowSymLinks +ExecCGI
    </Files>
</IfModule>

        Options -Includes +ExecCGI

    </Directory>

Alias "/error_docs" "/var/www/vhosts/domain.com/error_docs"

    Include "/var/www/vhosts/domain.com/conf/vhost.conf"

</VirtualHost>

A: I'd recommend using the VirtualDocumentRoot directive (you'll need a NameVirtualHost directive, too).  I've reformatted the config file that you posted, so that it's a bit more readable (try to keep your tabs consistent!):
NameVirtualHost *:80

<VirtualHost *:80>
    ServerName domain.com
    ServerAlias www.domain.com
    ServerAdmin admin@domain.com
    CustomLog /var/www/vhosts/domain.com/statistics/logs/access_log plesklog
    ErrorLog  /var/www/vhosts/domain.com/statistics/logs/error_log
    DocumentRoot /var/www/vhosts/domain.com/httpdocs
    # You'll also need an SSL port listener for these to work.
    Redirect permanent /plesk-stat https://domain.com/plesk-stat
    Redirect permanent /webstat https://domain.com/webstat
    Redirect permanent /webstat-ssl https://domain.com/webstat-ssl
    Redirect permanent /ftpstat https://domain.com/ftpstat
    Redirect permanent /anon_ftpstat https://domain.com/anon_ftpstat
    Redirect permanent /awstats-icon https://domain.com/awstats-icon
    Alias /error_docs /var/www/vhosts/domain.com/error_docs
    # Commenting this out, since it's hopefully not doing anything...?
    #Include "/var/www/vhosts/domain.com/conf/vhost.conf"
</VirtualHost>

<VirtualHost *:80>
    ServerName dynamic.domain.com
    ServerAlias *.domain.com
    ServerAdmin admin@domain.com
    CustomLog /var/www/vhosts/domain.com/statistics/logs/access_log plesklog
    ErrorLog  /var/www/vhosts/domain.com/statistics/logs/error_log
    # This is telling it to use the third-to-last chunk of the name here,
    # the "test" in "test.domain.com" or "www.test.domain.com"
    # Note that "www.domain.com" will be caught in the static config above.
    VirtualDocumentRoot /var/www/vhosts/domain.com/httpdocs/users/%-3
</VirtualHost>

# We'll move this chunk out here, since it's applying
# to both configurations (static and dynamic)
<Directory /var/www/vhosts/domain.com/httpdocs/users/>
    # Drop these scripting languages if they aren't used.
    # I sure hope you don't want all of these running..
    <IfModule mod_perl.c>
        <Files ~ (\.pl$)>
            SetHandler perl-script
            PerlHandler ModPerl::Registry
            Options ExecCGI
            allow from all
            PerlSendHeader On
        </Files>
    </IfModule>
    <IfModule sapi_apache2.c>
        php_admin_flag engine on
        php_admin_flag safe_mode off
        # not sure how to make this work as desired
        #php_admin_value open_basedir /var/www/vhosts/domain.com/httpdocs/users/DYNAMIC_SUB/:/tmp/
    </IfModule>
    <IfModule mod_php5.c>
        php_admin_flag engine on
        php_admin_flag safe_mode off
        # not sure how to make this work as desired
        #php_admin_value open_basedir /var/www/vhosts/domain.com/httpdocs/users/DYNAMIC_SUB/:/tmp/
    </IfModule>
    <IfModule mod_python.c>
        <Files ~ (\.py$)>
            SetHandler python-program
            PythonHandler mod_python.cgihandler
        </Files>
    </IfModule>
    <IfModule mod_fcgid.c>
        <Files ~ (\.fcgi)>
            SetHandler fcgid-script
            Options +FollowSymLinks +ExecCGI
        </Files>
    </IfModule>
    Options -Includes +ExecCGI
</Directory>


text:
Q: Call a function continuously after key is pressed in C I want to be able to call my function that moves my propellers (OpenGL work) after I press the 'a' key. Here's what I have set up:
switch (key)
{
    case 'a':
        startShip = 1;
        while (1 (&& startShip == 1)) {
            spinPropeller();
        }
}

I get caught in an infinite loop. I've tried using a timer function but I'm not sure how to implement it properly. I want my propellers to spin and not stop until the program is closed.
edit: program should close after detecting a 'q' key

A: Game loops work like this:
while (true)
{
    get_input();   // get keyboard, mouse, and joystick input

    move_items();  // update the player position and all other items in the game, fire weapons, and update game state

    collision_detection();  // figure out what hit what and update game state

    render();   // draw your OpenGL scene
}

To make this happen, your get_input function or equivalent needs to read keyboard state in a non-blocking manner.  I think OpenGL or GLUT has a helper function for this, but the implementation will likely be platform specific.

redpajama_set_name: RedPajamaStackExchange


text:
Q: I want BottomNavigationBar as well as TabBar in flutter without having appBar I want BottomNavigationBar as well as TabBar in flutter without having appBar, Individually both widgets are working but when combined, it is saying The following assertion was thrown during performLayout():
RenderCustomMultiChildLayoutBox object was given an infinite size during layout.
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Haate Khori',
      theme: ThemeData.light().copyWith(
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage>
    with SingleTickerProviderStateMixin {
  int _selectedIndex = 0;
  static const TextStyle optionStyle =
      TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
  static List<Widget> _widgetOptions = <Widget>[
    Donation(),
    Text(
      'EXPENSES',
      style: optionStyle,
    ),
    Text(
      'ACTIVITIES',
      style: optionStyle,
    ),
    Text(
      'GALLERY',
      style: optionStyle,
    ),
    Text(
      'DONATE US',
      style: optionStyle,
    ),
  ];

  void _onItemTapped(int index) {
    setState(() {
      _selectedIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            Container(
              child: Padding(
                padding: const EdgeInsets.all(40.0),
                child: SizedBox(
                  height: 70.0,
                ),
              ),
              decoration: BoxDecoration(
                gradient: LinearGradient(
                    begin: Alignment.topLeft,
                    end: Alignment.bottomRight,
                    colors: [Colors.white, Colors.teal], // whitish to gray
                    stops: [0.0, 0.8]),
              ),
            ),
            Container(
              padding: EdgeInsets.all(10.0),
              child: Text(
                'Title goes here',
                style: TextStyle(color: Colors.white, fontSize: 25.0),
              ),
              color: Colors.teal,
            ),
            _widgetOptions.elementAt(_selectedIndex),
          ],
        ),
        bottomNavigationBar: BottomNavigationBar(
          items: const <BottomNavigationBarItem>[
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              title: Text('Home'),
              backgroundColor: Colors.teal,
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.receipt),
              title: Text('Expenses'),
              backgroundColor: Colors.teal,
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.fiber_smart_record),
              title: Text('Activities'),
              backgroundColor: Colors.teal,
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.collections),
              title: Text('Gallery'),
              backgroundColor: Colors.teal,
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.favorite),
              title: Text('Donate us'),
              backgroundColor: Colors.teal,
            ),
          ],
          currentIndex: _selectedIndex,
          selectedItemColor: Colors.white,
          unselectedItemColor: Colors.white,
          onTap: _onItemTapped,
        ),
      ),
    );
  }
}

class Donation extends StatefulWidget {
  @override
  _DonationState createState() => _DonationState();
}

class _DonationState extends State<Donation>
    with SingleTickerProviderStateMixin {
  TabController tabController;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    tabController = TabController(length: 2, vsync: this);
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        backgroundColor: Colors.white,
        body: Column(
          children: <Widget>[
            SizedBox(
              height: 10.0,
            ),
            TabBar(
              labelColor: Colors.teal,
              controller: tabController,
              tabs: <Widget>[
                Tab(
                  child: Text('Tab1'),
                ),
                Tab(
                  child: Text('Tab2'),
                )
              ],
            ),
            Expanded(
              child: Container(
                child: TabBarView(
                  controller: tabController,
                  children: <Widget>[
                    Text(
                      'Hello',
                      style: TextStyle(fontSize: 20.0),
                      textAlign: TextAlign.center,
                    ),
                    Text(
                      'World',
                      style: TextStyle(
                        fontSize: 20.0,
                      ),
                      textAlign: TextAlign.center,
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Target : What I want
&
This is what I am getting

A: I have attached a code snippet which is from my unComplete web app same can be useful for you I haven't used TabBar in the scaffold tab instead created a row inside the scaffold and used it, you can look into my code and can figure out something for you hope it helps.
import 'package:flutter/material.dart';
import 'package:transportWeb/provider/dimensions.dart';
import 'package:transportWeb/screens/mainScreenViews/aboutUs.dart';
import 'package:transportWeb/screens/mainScreenViews/contactUs.dart';
import 'package:transportWeb/screens/mainScreenViews/home.dart';
import 'package:url_launcher/url_launcher.dart';
import '../constants.dart';

class MainScreen extends StatefulWidget {
  @override
  _MainScreenState createState() => _MainScreenState();
}

class _MainScreenState extends State<MainScreen>
    with SingleTickerProviderStateMixin {
  TabController _tabController;
  var _currentDateTime = DateTime.now();
  var _currentHours;

  @override
  void initState() {
    super.initState();
    _currentHours = _currentDateTime.hour;
    print(_currentHours);
    _tabController = TabController(length: 3, vsync: this, initialIndex: 1);
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    _tabController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    Dimensions(context);
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        tooltip: "Request Call",
        backgroundColor: Colors.deepPurpleAccent,
        onPressed: () {
          showDialog(
            context: context,
            builder: (BuildContext context) {
              return AlertDialog(
                title: Text(
                  "Enter your Phone no",
                  style: kh3,
                ),
              );
            },
          );
        },
        child: Icon(
          Icons.phone,
          color: Colors.white,
          size: 30,
        ),
      ),
      body: ListView(
        children: [
          Container(
            padding: EdgeInsets.symmetric(horizontal: 20, vertical: 0),
            height: 70,
            decoration: BoxDecoration(
              color: Colors.transparent,
              border: Border(
                bottom: BorderSide(
                  color: Colors.grey.shade200,
                  width: 3,
                ),
              ),
            ),
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.end,
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Padding(
                  padding: const EdgeInsets.only(bottom: 15),
                  child: RichText(
                    text: TextSpan(
                      style: kh2.copyWith(letterSpacing: 10),
                      children: <TextSpan>[
                        TextSpan(text: "JSSR "),
                        TextSpan(text: "Road"),
                        TextSpan(
                          text: "L",
                          style: kh2.copyWith(color: Colors.red),
                        ),
                        TextSpan(text: "ines"),
                      ],
                    ),
                  ),
                ),
                Expanded(
                  child: SizedBox(
                    width: 0,
                    height: 0,
                  ),
                ),
                TabBar(
                  isScrollable: true,
                  indicatorColor: Colors.black,
                  indicatorSize: TabBarIndicatorSize.label,
                  labelColor: Colors.black,
                  unselectedLabelColor: Colors.grey.withOpacity(0.6),
                  controller: _tabController,
                  tabs: [
                    Tab(
                      child: Padding(
                        padding: const EdgeInsets.only(bottom: 10),
                        child: Text(
                          "HOME",
                          style: kh5,
                        ),
                      ),
                    ),
                    Tab(
                      child: Padding(
                        padding: const EdgeInsets.only(bottom: 10),
                        child: Text(
                          "ABOUT US",
                          style: kh5,
                        ),
                      ),
                    ),
                    Tab(
                      child: Padding(
                        padding: const EdgeInsets.only(bottom: 10),
                        child: Text(
                          "CONTACT US",
                          style: kh5,
                        ),
                      ),
                    ),
                  ],
                ),
                GestureDetector(
                  onTap: () {
                    launch(
                        "https://pub.dev/packages/url_launcher#-installing-tab-");
                  },
                  child: Container(
                    margin: EdgeInsets.only(left: 15, bottom: 12),
                    padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(5),
                      color: Colors.deepPurpleAccent,
                    ),
                    child: Text(
                      "DOWNLOAD APP",
                      style: kh5.copyWith(color: Colors.white),
                    ),
                  ),
                ),
              ],
            ),
          ),
          Container(
            width: double.maxFinite,
            height: double.maxFinite,
            child: TabBarView(
              controller: _tabController,
              children: [
                Home(),
                AboutUs(),
                ContactUs(),
              ],
            ),
          )
        ],
      ),
    );
  }
}


text:
Q: Distinct - which items are taken? The first or the last occurance? If I use following query:
SELECT DISTINCT comment FROM table;

And I have for example following data: (IDs are just there to SHOW the order...)
ID | comment
-------------
1  | comment1
2  | comment1
3  | comment2
4  | comment1

What I could get back are following three results:
Result 1:
1  | comment1
3  | comment2

Result 2:
3  | comment2
4  | comment1

Result 3:
order is unpredicatable

Question 1:
Is the result independant from the platform? Can I make sure, that I always get a predictable result?
Question 2:
I want to distinct select all comments and get the NEWEST only, meaning I want to always get result 2. Is it possible to achive that? Maybe ordering by the key would affect the result?

A: Your query doesn't request the ID column, only the comment column:
SELECT DISTINCT comment FROM table;

In the result, the ID is not included, so the row each value comes from is irrelevant.
comment1
comment2

As for how it will sort them, I think it depends on index order. I'll do a test to confirm:
mysql> create table t (id int primary key, comment varchar(100));

mysql> insert into t values
    -> (1, 'comment2'),
    -> (2, 'comment1'),
    -> (3, 'comment2'),
    -> (4, 'comment1');

The default order is that of the primary key:
mysql> select distinct comment from t;
+----------+
| comment  |
+----------+
| comment2 |
| comment1 |
+----------+

Whereas if we have an index on the requested column, it returns the values in index order:
mysql> create index i on t(comment);

mysql> select distinct comment from t;
+----------+
| comment  |
+----------+
| comment1 |
| comment2 |
+----------+

I'm assuming the InnoDB storage engine, because everyone should be using InnoDB. ;-)

Your last question indicates that you really want a query that doesn't involve DISTINCT at all, but it's a greatest-n-per-group question. This type of question is very common, and it has been asked and answered hundreds of times on StackOverflow. Follow the link and read the many solutions.

A: You can experiment and see which of the unique rows is returned, and you can experiment and see which order they're returned in, but that will only show you how things turn out with your experimental table, today, under the current database engine version. Bottom line:

*

*If you SELECT DISTINCT comment the id is immaterial because it's not in your SELECT

*If you don't ORDER BY the database will determine the order.

If you want the most recent distinct comment with its ID, this will work every time (full disclosure: this replaces an earlier answer that works but was over-thinking the problem):
SELECT comment, MAX(id)
FROM myTable
GROUP BY comment
ORDER BY 2 DESC;

Note that the ORDER BY 2 DESC assumes that the higher the ID, the more recent the comment.

A: If you select a single distinct column, the other will not be returned.
select distinct column from table

is the same result as
select column from table group by column

In both these cases, the sort order of column is unpredictable, depending on the execution plan which may vary with larger amounts of data, diferent table structures, diferent database versions
to mimic your result, one would have to do :
select id, column from table group by column

which is an illegal grouping. If your SQL mode permits it to run, ID will be random.
if you mean select distinct * from table, then all distinct rows will be returned, in your case all the table.


text:
Q: Search Keywords in DataFrame by Column Value I need to know if every value of one column in a dataframe have some keywords from another column. For example:
ITEM Column1

Item1 A

Item1 B

Item1 C

Item2 A

Item2 B

Item2 C

Item3 A

Item3 B

Item3 D

I want to know for every item in the column item, if I have the values A and C from column 1. In that case, my output should be Item 1 and Item 2.
Thanks!

A: The following code will create a df with the Items that the value of Column1 of them is A or B:
filtered_df = df[df['Column1'] == A or df['Column1'] == B]

Now, you can select filtered_df['ITEM'] in order to take the corresponded items. In case you just want the set of items then select filtered_df['ITEM'].drop_duplicates().


text:
Q: Slow GridView question I have a GridView with textboxes and CompareValidators in its cells. The GridView has 40 columns and is very slow. I wonder if it is possible to avoid compare validators in every cell. Is it possible to have one instance   of a particular validator for e.g. the whole column?
Thanks.


text:
Q: Virtual address space in 64 bit systems running in compatibility mode I saw that on a 64 bit windows OS the user virtual address space available is 8 terra bytes. But if the program we are executing on this is running in 32 bit compatibility mode is this much of user space still available ? or does it behave like a normal 32 bit OS and gives only 2GB user address space?

A: Microsoft has a chart showing the various limits: Memory Limits for Windows Releases
To summarize just the user-mode virtual address space:

*

*32-bit Windows:

*

*32-bit process: 2 GB by default; 3 GB with /LARGEADDRESSAWARE:YES and 4GT

*64-bit Windows (x64 architecture):

*

*32-bit process: 2 GB by default; 4 GB with /LARGEADDRESSAWARE:YES

*64-bit process: 8 TB by default; 2 GB with /LARGEADDRESSAWARE:NO
4GT is 4-gigabyte tuning:

*

*XP: /3GB boot.ini switch

*Vista: bcdedit /set increaseuserva 3072
Mark Russinovich made a blog post explaining many these limits: Pushing the Limits of Windows: Virtual Memory

A: Your process will only see a 4GB virtual address space when it is running as a 32 bit process.  It will not be able to addresses anything higher.

A: If your program is running as a 32 bit process on the Wow64 subsystem, it will see the exact same address space that it would see on an actual 32 bit OS.  With no special options, a 32 bit process will have 2GB of memory available.
The only difference is the avaliable memory if you use the LargeAddressAware option.  In a normal 32 bit process this allows for 3GB of addressable memory.  In a Wow64 process it can see up to 4GB (Source)

A: My original answer was pretty bad.  Here is a link that explains what JaredPar was saying pretty well.
http://msdn.microsoft.com/en-us/library/ms189334.aspx

A: As far as the hardware is concerned, when you're running in compatibility mode (i.e. IA32_EFER.LMA is set and the L bit is clear in CS's segment descriptor) the segments behave like 32-bit segments.  That is:

*

*the segment base is limited to 32 bits.

*the segment limit is limited to 32 bits as well (using the G bit).

This effectively limits you to 4GB of virtual addresses.  I'm not familiar with how the OS partitions virtual memory in the various modes, but this is the hardware limit.  (sorry... I'm a hardware guy, not an OS expert)

A: It should be noted that running a 32-bit process on IIS 6.0+ with a 64-bit machine/OS, a process can address up to 4GB of memory.


text:
Q: Amazon Redshift: ERROR: 3F000: schema does not exist When I go to try to run a very simple query, using a stupid little test db that I set up in postgres testing out amazon's CDC:
SELECT * FROM schemastreamtest.testdatatable

I get the following:
/*
Current path set to $user, public */
/*
ERROR: 3F000: schema "schemastreamtest" does not exist */
SELECT * FROM schemastreamtest.testdatatable;

Again, this is not a dummy query, literally called them those, and the data is pushed from postgres to this DB using Data Migration's CDC.
I'm using the Aginity IDE for redshift, and pgAdmin3 for postgres if that matters. The data according to AWS is flowing into it, it just seems to be a retrieval issue.

A: Reloaded the db and it refreshed the schema and it works now.


text:
Q: How to safely remove HP bloatware in Windows 10 Home? I have Windows 10 Home in HP laptop which contains:-
1. HPCeement
2. HPJumpStartLaunch
3. HPRegistrationService
4. HPSupportAssistant
5. HPSureConnect
What are the uses of this softwares?
Is it safe to remove them?
How wll it affect my laptop if i remove?
Is it safe if I use Malwarebytes AdwCleaner 8.0.1 to remove them?
Or there is another software or manual way to remove them?

A: *

*CEEment - I'd remove this one!

CEEment stands for Customer Experience Enhancement. CEEment
  (HPCEE.exe) is the reporting tool that HP uses to collect and study
  anonymous data. You can activate CEEment when you set up your
  computer. Or, you can activate using HP Advisor or HP Support
  Assistant at any time. Some of the data reported using CEEment
  includes your model number, OS, region, locale, and BIOS version. If
  you wish to know specifically which data was collected, launch HP
  Support Assistant. Click Settings, scroll down to the bottom of the
  Health Analysis tab, and then click View information collected by HP.

*Jumpstart - You don't need this if you're going to remove McAfee and you're going to personalize the computer yourself.

HP JumpStart guides you through a multi-step welcome process that
  includes HP Registration, McAfee registration, HP Dropbox offer
  activation, and an HP JumpStart Concierge screen with tips to help you
  personalize your computer and install apps.

*HP Registration Service - Does what it says on the tin. You can use it to register your device with HP. If this doesn't provide additional support or warranty options, I'd remove/ignore.

*Support Assistant - Useful for BIOS updates and driver updates, although you can do these manually.

HP Support Assistant helps keep your HP computer in working order by
  finding updates and providing troubleshooting tools. Most HP computers
  come with HP Support Assistant. Click the app icon in the task bar, or
  search Windows for 'support assistant' to open the tool.

*HP Sure Connect - Looks to be a tool for fixing broken drivers...

HP Sure Connect (HP Wireless Rescue Tool) for supported models running
  a supported operating system. HP Sure Connect automatically recovers
  the driver of a communications device that has stopped functioning.

If AdwCleaner wants to remove them and is able to, then sure go ahead.


text:
Q: How do I save multiple small integers in one integer via bitshifting? I am working in an int[][][] array and I need to return an address of one field of that array from a static function.
Given the fact that the dimensions of the Array will stay small (int[32][32][32]) I had the idea to return one number containing all three Values, instead of using an Array containing the three numbers.
I already had a working solution, where i packed my number into a String and unpacked it in the receiving method via Integer.parseInt(String).
Unfortunately this didn't work quite, well in terms of runtime, so i thought of bitshifting.
I apologize for my bad english and hope this simple question is worth your time :)

A: If your numbers are in the range 0...255, this example will encode three numbers into one int and then decode it again...
public class BitDemo {

    public static void main(String[] args) {
        int encoded = encode(20, 255, 10);
        int[] decoded = decode(encoded);

        System.out.println(Arrays.toString(decoded));
    }

    private static int[] decode(int encoded) {
        return new int[] {
                encoded & 0xFF,
                (encoded >> 8) & 0xFF,
                (encoded >> 16) & 0xFF
        };
    }

    private static int encode(int b1, int b2, int b3) {
        return (b1 & 0xFF) | ((b2 & 0xFF) << 8) | ((b3 & 0xFF) << 16);
    }
}

(b1 & 0xFF) - Gets the first 8 bits of b1
((b2 & 0xFF) << 8) - Gets the first 8 bits of b2 and shifts them left 8 bits
((b3 & 0xFF) << 16) - Gets the first 8 bits of b3 and shifts them left 16 bits
These three numbers are ORed together.
If you have negative numbers or number more than 255, you'll get different results.

A: Given N, M and O and assuming N * M * O doesn't overflow, you can pack and unpack your indices like this:
int packed = o * (N * M) + m * N + n;
int o = packed / (N * M);
int m = (packed % (N * M)) / N;
int n = packed % N; // is equal to (packed % (N * M)) % N

If you want to use bit-shifting, make sure you chose N, M, O as powers of 2. Let's say N = 2^NS, M = 2^MS and O = 2^OS packing and unpacking would look like this:
int packed = (o << (NS + MS)) | (m << NS) | n;
int o = (packed >> (NS + MS)) & ((1 << OS) - 1);
int m = (packed >> NS) & ((1 << MS) - 1);
int n = packed & ((1 << NS) - 1);

All of the above assume n=0..N-1, m=0..M-1 and o=0..O-1.


text:
Q: Flash website management on a Windows Terminal Server situation: 100users, over a dozen sites, all connected by thinclients to Windows Terminal servers on various 1.5/256 or 2m/2m links.
I have currently blocked the loading of flash content on websites in IE7 by group policy, to preserve bandwidth - ThinClients are not too good at rendering streaming video. This has been fine for the past 4 years, but now, more and more websites are neglecting to offer up non flash content in lieu to browse their sites.
Firefox has a plug-in to allow the user to CLICK ON flash content containers, to have them load on demand, but the plugin doesn't play nicely for all users and has to be added manually by each user it seems - anyone on a termserv environment done this?
is there any other options you know of that will make this possible (ie: to only load individual flash content on demand by the user, and therefor they will understand why their session is slow)? What about another browser? I have played with Opera, and Chrome, (but Chrome doesn't load on my terminal servers nicely, graphics appear truncated)
Or, is there a way to make flash content play nicely on lowspec, low bandwidth thin clients?
Any hints or tips for young players?

A: So first off, I do not like Firefox in any way for a TS environment. For us at least we have had nothing but heartache. The day that tabs came to IE, my life became easier because my users would then use IE.
My thought is this, find a plugin for IE that allows you to do the same thing you are doing in Firefox.
One I found with a quick search is called "Flash and Pics Control". The browser gets a new button and one of the options listed is the "enable/disable flash content". This is browser specific instead of by the site, meaning once turned on, surfing to other websites would still have flash enabled until they uncheck the box.
I have no idea how well this software works or if it works in TS. All I did was run "ie flash plugin" on yahoo, and saw what came up. Let me know if this is the solution you are looking for and I will look for other plugins and post them in the comments on this post.


text:
Q: Error "Your transaction cannot be completed" when testing google play purchase I am trying to purchase using a beta tester but i am getting this error.

This is an error that shows in google play window, after passing initial validations and after the user press subscribe button, so i guess it is not an code or configuration error.
Anyway i checked this link https://stackoverflow.com/a/22469253/2700303 and also downloaded the app from the store.
I check the "Learn more" link that comes with the error but nothing on that troubleshooting page helped.
The account used as a valid and active pay method.
I am running on a simulator, but google play comes with it for a reason, so i discard that also.
The rest of the suggestions say to use other device. My simulator is running API 28 so should be good enough.

A: *

*In-app purchase must be tested with production build on real device.

Steps

*

*Generate release build from Android studio.

*Uninstall debug app from your device, or use adb uninstall.

adb uninstall {yourdomain}.{yourpackagename}

*Install your release version to your device.

adb install app-release.apk

Update:
Check this answer for more details.
Update 2 :Please read more about Test Google Play Billing


text:
Q: How to return resultset from MySQL Stored Procedure using prepared statement? DELIMITER $$

CREATE PROCEDURE List_IL()

BEGIN

  DECLARE Project_Number_val VARCHAR( 255 );
  DECLARE Temp_List_val VARCHAR(255);
  DECLARE Project_List_val VARCHAR(255);
  DECLARE FoundCount INT;
  DECLARE Project_Number INT;
  DECLARE db_Name VARCHAR(255);

  DECLARE no_more_rows BOOLEAN;
  DECLARE loop_cntr INT DEFAULT 0;
  DECLARE num_rows INT DEFAULT 0;

  DECLARE   projects_cur    CURSOR FOR
    SELECT  Project_Id
    FROM    Project_Details;

  DECLARE CONTINUE HANDLER FOR NOT FOUND
    SET no_more_rows = TRUE;

  OPEN projects_cur;
  select FOUND_ROWS() into num_rows;

  the_loop: LOOP

    FETCH  projects_cur
    INTO   Project_Number_val;

    IF no_more_rows THEN
        CLOSE projects_cur;
        LEAVE the_loop;
    END IF;

SET Project_List_val = CONCAT(Project_Number_val, '_List');
SET db_Name='panel';

SELECT COUNT(1) INTO  FoundCount  FROM information_schema.tables WHERE table_schema = `db_Name`  AND table_name = `Project_List_val`;

 IF FoundCount = 1 THEN
SET @Project_Number=Project_Number_val;

SET @sql = CONCAT(' SELECT Panel_Id,', Project_Number_val,'
                    FROM ', @Project_List_val,' Where status=1');

PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;

    SET loop_cntr = loop_cntr + 1;
  END LOOP the_loop;

END $$

In the above stored procedure How can I get the all the rows selected during execution of prepared statement and after the loop terminates I want to return the entire result set whichever calls the stored procedure. Can you please help me how to do this?

A: I will suggest you a solution create a log table like this
CREATE TABLE log_records
(
Panel_Id INT,
Project_Number_val VARCHAR(255)
);

In your code add lines as follows here i will insert those record into log_table which you was selecting please look the line /**Added by abdul */
    IF FoundCount = 1 THEN
        SET @Project_Number=Project_Number_val;

        SET @sql = CONCAT(' SELECT Panel_Id,', Project_Number_val,'    FROM ', @Project_List_val,' Where status=1');

    /*--Added by Abdul*/
        SET @insert_sql = CONCAT ('INSERT INTO log_records' ,'SELECT Panel_Id,', Project_Number_val,'    FROM ', @Project_List_val,' Where status=1');
        PREPARE stmt_insert FROM @insert_sql;
        EXECUTE stmt_insert;
        DEALLOCATE PREPARE stmt_insert;
    /**--End**/

        PREPARE stmt FROM @sql;
        EXECUTE stmt;
        DEALLOCATE PREPARE stmt;
    END IF;

And then where loop end add line
SELECT * FROM log_records;

This will give you the desired result.
Also Write one line in your code before you open the cursor otherwise each procedure call will be appending data in that table.
TRUNCATE TABLE log_table;


text:
Q: AppCompat does not support the current theme features - nothing works I'm trying to use MaterialDesign in my project but I'm getting this error all the time:
Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false }
        at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:371)
        at android.support.v7.app.AppCompatDelegateImplV7.initWindowDecorActionBar(AppCompatDelegateImplV7.java:173)
        at android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(AppCompatDelegateImplBase.java:87)
        at android.support.v7.app.AppCompatDelegateImplV7.setSupportActionBar(AppCompatDelegateImplV7.java:197)
        at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:99)
        at de.memorian.playpal.MainActivity.afterInject(MainActivity.java:72)

I've reade through similar problems but everytime I'm getting the same error.
MainActivity.java:
@EActivity(R.layout.activity_main)
public class MainActivity extends AppCompatActivity {

@ViewById
protected Toolbar toolbar;

@AfterInject
public void afterInject() {
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
}
}

styles.xml:
<style name="AppTheme" parent="AppTheme.Base"/>

<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

styles-v21.xml:
style name="AppTheme" parent="AppTheme.Base">
    <!-- enable window content transitions -->
    <item name="android:windowContentTransitions">true</item>
    <item name="android:windowAllowEnterTransitionOverlap">true</item>
    <item name="android:windowAllowReturnTransitionOverlap">true</item>
    <!-- specify shared element transitions -->
    <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
    <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style>

I've tried setting parent theme to any derivation of .NoActionBar, but still. I've also tried removing all code from AndroidAnnotations and doing it the regular way with setContentView and findViewById(R.id.toolbar). Only thing that bothers me is that I set windowNoTitle to true but in the log it says it is false.
Any help?

A: To anyone else having this problem, I just found the problem:
Apparently there exists another theme with name "AppTheme". I don't know why and how, but changing my theme's name solved the problem.
This was the answer to my problem.

A: Change:
<item name="android:windowNoTitle">true</item>

to:
<item name="windowNoTitle">true</item>

A: Add them on Activity MainActivity in your AndroidManifest.xml  file
like this

        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/Theme.AppCompat.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

A: In the theme.xml file, had set
<item name="windowNoTitle">false</item>

to false.
changed it to true.
<item name="windowNoTitle">true</item>

do that if you did this.

A: I got the same problem and just Rebuilding my project solved the issue. Hope it may help someone.

A: While migrating to Material3 I faced the same issue. What you need to do is extend the NoActionBar theme.
This:
<style name="Theme.AppDefault" parent="@style/Theme.Material3.DayNight">

Has to be changed to:
<style name="Theme.AppDefault" parent="@style/Theme.Material3.DayNight.NoActionBar">

A: Copy this code in your main style:
<style name="Theme.MyTheme" parent="Theme.AppCompat.NoActionBar">


text:
Q: Solving $a=\Big(1+\frac{b}{x}\Big)^x$ for $x$ How to solve this equation for $x$?
$$a=\Bigg(1+\frac{b}{x}\Bigg)^x$$
It's not a task that I was asked to solve by someone. I just have to solve it because it's a part of my project. If it's impossible to solve analytically, tell me how to solve it numerically.

A: First notice that $a^{\frac{1}{b}} = \Bigg(1 + \frac{b}{x}\Bigg)^{\frac{x}{b}} $. Now
$$\begin{align}\ln a = \ln\Bigg(1  +\frac{b}{x}\Bigg)^x &\Rightarrow \Bigg (1 + \frac{b}{x}\Bigg)^{\Big(1 + \frac{x}{b}\Big)}\ln a = \Bigg (1 + \frac{b}{x}\Bigg)^{\Big(1 + \frac{x}{b}\Big)} \ln\Bigg(1  +\frac{b}{x}\Bigg)^x\\&\Rightarrow \Bigg[\Bigg (1 + \frac{b}{x}\Bigg)^{\frac{x}{b}}\Bigg]^{\Big(1 + \frac{b}{x}\Big)}\ln a = \Bigg (1 + \frac{b}{x}\Bigg)^{\Big(1 + \frac{x}{b}\Big)} \ln\Bigg(1  +\frac{b}{x}\Bigg)^x\\&\Rightarrow e^{\frac{x}{b}\ln\Big(1 + \frac{b}{x}\Big)\Big(1 + \frac{b}{x}\Big)}\ln a = \Bigg(1 + \frac{b}{x}\Bigg)^{\frac{x}{b}}\Bigg(1 + \frac{b}{x}\Bigg)\ln a\\&\Rightarrow\ln a = a^{\frac{1}{b}}\ln a \Bigg(1 + \frac{b}{x}\Bigg)e^{-\frac{x}{b}\ln\Big(1 + \frac{b}{x}\Big)\Big(1 + \frac{b}{x}\Big)}\\&\Rightarrow\ln a = a^{\frac{1}{b}}\ln a \Bigg(1 + \frac{b}{x}\Bigg)e^{-\frac{1}{b}\ln a\Big(1 + \frac{b}{x}\Big)}\\&\Rightarrow -\frac{\ln a}{b\ \  a^{\frac{1}{b}}} = -\frac{1}{b}\ln a \Bigg(1 + \frac{b}{x}\Bigg)e^{-\frac{1}{b}\ln a\Big(1 + \frac{b}{x}\Big)}\\& \Rightarrow W\Bigg(-\frac{\ln a}{b\ \  a^{\frac{1}{b}}}\Bigg) = -\frac{1}{b}\ln a \Bigg(1 + \frac{b}{x}\Bigg)\\&\Rightarrow -\frac{1}{b}\ln a  - \frac{1}{x}\ln a = W\Bigg(-\frac{\ln a}{b\ \  a^{\frac{1}{b}}}\Bigg)  \\&\Rightarrow xW\Bigg(-\frac{\ln a}{b\ \  a^{\frac{1}{b}}}\Bigg) + \frac{x}{b}\ln a = - \ln a \\&\Rightarrow x = -\frac{\ln a}{W\Bigg(-\frac{\ln a}{b\ \  a^{\frac{1}{b}}}\Bigg) + \frac{1}{b}\ln a} \\& \Rightarrow x = -\frac{b\ln a}{bW\Bigg(-\frac{\ln a}{b\ \  a^{\frac{1}{b}}}\Bigg) + \ln a}\end{align}$$
Where $W$ is the Lambert W-Function.


text:
Q: How to get the value of an index in CheckedBoxList? C# I am trying to get a value of an index in checkedbox value but it seems to null.
 myCheckedListBox.Items.Add("bla1");
 myCheckedListBox.Items.Add("bla2");
 myCheckedListBox.Items.Add("bla3");
 myCheckedListBox.Items.Add("bla4");

Now I want to get the value of index 2
the code is
string value = myCheckedListBox.Items[2].ToString();

and I expect the value = bla3 but it is null?
What am I missing?

A: try
string value = myCheckedListBox.Items[2].ToString();

mhCheckedBox is not same as myCheckedListBox :)

A: ((DataRowView)checkedListBox1.Items[index])[0]


text:
Q: Nginx server : upstream timed out (10060: A connection attempt failed) We are running a service which will migrate the issues from Jira to test link.So I am using nginx server to communicate with mysql database and to run the testlink in the browser.
when I import more no of issue suddenly the nginx server get closed automatically.I am running my service and nginx server in Windows server 2008 R2 standard and 64 bit OS.
I checked the error.log file in the C:\nginx\logs and found the error as

upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 192.168.27.151, server: localhost, request: "GET /testlink/lib/general/frmWorkArea.php?feature=reqSpecMgmt HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "wo-qatestlink01", referrer: "http://wo-qatestlink01/testlink/lib/general/navBar.php?tproject_id=0&tplan_id=0&updateMainPage=1"

Thanks.
Log File
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    proxy_read_timeout 600;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index index.php;
        fastcgi_read_timeout 600;
            #The above line has been added and below line has been commented to use the php code.
            #index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #   proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        ########## Code added during Configuration By Anthony ################
        location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  c:/nginx/html/$fastcgi_script_name;
        include        fastcgi_params;
        }
        ######################################################################
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

A: This issue is due to nginx timing out before it gets a response from the backend (php). There are a few timeouts that be set in nginx to change this.
The default "response" timeout from fastcgi is 60s. You have it at 600s, which might not be enough time.
fastcgi_read_timeout 60s;

Nginx Documentation : FastCGI Module

A: in my case, I was running my Server inside a FreeBSD Jail (Nginx 1.6.2, PHP/5.6.6) using TCP-Port instead of socket. The problem resolved changing two settings in my

php-fpm.conf

file:
;listen.allowed_clients = 127.0.0.1 # comment out to listen to any
listen = 9000 # No IP-Address

It worked.


text:
Q: Correct way to interface with SelectedItems (IList / SelectedObjectCollection) in Listbox (view -> viewmodel) When interfacing with one item in a listbox, its simple enough to go:
  myClass citem = (myClass)myListBop.SelectedItem.
  viewModel.doSomethingWithItem(cItem)

Whats the correct way for multiple items? I have seen examples of simply copying the data to a List, but surely it would be best to avoid the copy and go for the correct cast? Resharper kindly informs me that I might be doing something wrong:

Where the suggestion is:
Suspicious case: there is no type in the solution which is inherited from both "Sytem.Windows.Forms.ListBox.SelectedObjectCollection" and "System,Collections.Generic.IList<myClass>"

Basically what is the intended usage of IList / SelectedObjectCollection?

A:
Whats the correct way for multiple items?

SelectedObjectCollection does not implement IList<T>. you can't just cast it. Instead you can use Cast method to cast all items to your type and put them in a list:
myListBop.SelectedItems.Cast<myClass>().ToList();


text:
Q: SpringBoot OAuth 2 with Mulple Login URL I'm following this article and my application is also the same pattern. But I need multiple Login URL like

*

*/loginUrl1

*/loginUrl2

*/loginUrl3

instead of single currently URL is /oauth/token
Here's also my similar AuthorizationServer
@Configuration
@EnableAuthorizationServer
 public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {

static final String CLIEN_ID = "devglan-client";
static final String CLIENT_SECRET = "devglan-secret";
static final String GRANT_TYPE = "password";
static final String AUTHORIZATION_CODE = "authorization_code";
static final String REFRESH_TOKEN = "refresh_token";
static final String IMPLICIT = "implicit";
static final String SCOPE_READ = "read";
static final String SCOPE_WRITE = "write";
static final String TRUST = "trust";
static final int ACCESS_TOKEN_VALIDITY_SECONDS = 1*60*60;
static final int FREFRESH_TOKEN_VALIDITY_SECONDS = 6*60*60;

@Autowired
private TokenStore tokenStore;

@Autowired
private AuthenticationManager authenticationManager;

@Override
public void configure(ClientDetailsServiceConfigurer configurer) throws Exception {

    configurer
            .inMemory()
            .withClient(CLIEN_ID)
            .secret(CLIENT_SECRET)
            .authorizedGrantTypes(GRANT_TYPE_PASSWORD, AUTHORIZATION_CODE, REFRESH_TOKEN, IMPLICIT )
            .scopes(SCOPE_READ, SCOPE_WRITE, TRUST)
            .accessTokenValiditySeconds(ACCESS_TOKEN_VALIDITY_SECONDS).
            refreshTokenValiditySeconds(FREFRESH_TOKEN_VALIDITY_SECONDS);
}

@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    endpoints.tokenStore(tokenStore)
            .authenticationManager(authenticationManager);
}

}
ResourceServerConfig
@Configuration
@EnableResourceServer
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {

private static final String RESOURCE_ID = "resource_id";

@Override
public void configure(ResourceServerSecurityConfigurer resources) {
    resources.resourceId(RESOURCE_ID).stateless(false);
}

@Override
public void configure(HttpSecurity http) throws Exception {
    http.
            anonymous().disable()
            .authorizeRequests()
            .antMatchers("/users/**").authenticated()
            .and().exceptionHandling().accessDeniedHandler(new OAuth2AccessDeniedHandler());
}

}
Here's my SecurityConfig.java
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
 public class SecurityConfig extends WebSecurityConfigurerAdapter {

@Resource(name = "userService")
private UserDetailsService userDetailsService;

@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}

@Autowired
public void globalUserDetails(AuthenticationManagerBuilder auth) throws Exception {
    auth.userDetailsService(userDetailsService)
            .passwordEncoder(encoder());
}

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .csrf().disable()
            .anonymous().disable()
            .authorizeRequests()
            .antMatchers("/api-docs/**").permitAll();
}

@Bean
public TokenStore tokenStore() {
    return new InMemoryTokenStore();
}

@Bean
public BCryptPasswordEncoder encoder(){
    return new BCryptPasswordEncoder();
}

@Bean
public FilterRegistrationBean corsFilter() {
    UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
    CorsConfiguration config = new CorsConfiguration();
    config.setAllowCredentials(true);
    config.addAllowedOrigin("*");
    config.addAllowedHeader("*");
    config.addAllowedMethod("*");
    source.registerCorsConfiguration("/**", config);
    FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
    bean.setOrder(0);
    return bean;
}

}


text:
Q: Place threeparttable next to figure I would like to place a threeparttable next to a figure and am unable to do so (I couldn't find an example that uses threeparttable). Here is what I was trying (though this doesn't work):
\begin{figure}\centering
    \begin{table}[h!] \small
    \begin{threeparttable}
    \caption{\textbf{X on Y} }
    \label{XYZ}
        \begin{tabular}{ p{4.1cm}  o{1.2cm} p{1.2cm}  }
        \hline
            &  (1) & (2)    \\
            &  (3) & (4)    \\
     \hline
    \end{tabular}
       \begin{tablenotes}
          \footnotesize
         \item \textbf{Note:} XXX \\
        \end{tablenotes}
    \end{threeparttable}
    \end{table}
  \qquad
  \rule{2cm}{3cm}% = graphic
  \caption{Double figure/table combo!}
\end{figure}

Thanks for any and all thoughts there.

A: Use the standard method with \captionof:
\documentclass{article}
\usepackage{graphicx,threeparttable,caption}

\begin{document}

\begin{table}
\centering

\begin{minipage}{0.3\textwidth}
\centering
\includegraphics[width=.8\textwidth]{example-image-9x16}
\captionof{figure}{The figure}
\end{minipage}%
\begin{minipage}{0.7\textwidth}
\small
\begin{threeparttable}
\caption{\textbf{X on Y}}
\label{XYZ}

\begin{tabular}{ p{4.1cm}  p{1.2cm} p{1.2cm}  }
\hline
A    &  (1) & (2)    \\
B    &  (3) & (4)    \\
\hline
\end{tabular}

\begin{tablenotes}
\footnotesize
\item \textbf{Note:} XXX
\end{tablenotes}
\end{threeparttable}
\end{minipage}

\end{table}

\end{document}

In the reverse order:
\documentclass{article}
\usepackage{graphicx,threeparttable,caption}

\begin{document}

\begin{table}
\centering

\begin{minipage}{0.7\textwidth}
\small
\begin{threeparttable}
\caption{\textbf{X on Y}}
\label{XYZ}

\begin{tabular}{ p{4.1cm}  p{1.2cm} p{1.2cm}  }
\hline
A    &  (1) & (2)    \\
B    &  (3) & (4)    \\
\hline
\end{tabular}

\begin{tablenotes}
\footnotesize
\item \textbf{Note:} XXX
\end{tablenotes}
\end{threeparttable}
\end{minipage}%
\begin{minipage}{0.3\textwidth}
\centering
\includegraphics[width=.8\textwidth]{example-image-9x16}
\captionof{figure}{The figure}
\end{minipage}

\end{table}

\end{document}

Note the % that kills the space which would be added by the end-of-line.


text:
Q: How to ctrl+scroll down in ppadb I'm trying to create a program that will open Bluestacks and I'm stuck at trying to get ppadb to ctrl+scroll down. Essentially to pinch scroll out as you would on an Android device.
I have tried device.shell(f'input ctrl+scrolldown) but it doesn't do anything.
Any help would be appreciated.
Cheers


text:
Q: Checking if an input is an int after slicing a str I'm working on a homework assignment (honestly been working for a while now) where we take input from the user, slice the string, and store the new strings in two different variables. The second part of the split string is supposed to be a number and I'm attempting to write an if statement to check if it is indeed a number. The problem is it's not because I split a string, so it's defined as a str. I know I could redefine the variable to an int() but that would produce an error if they weren't to enter an integer. Sorry if this isn't clear, this is my first question! (I can also post a screenshot of the instructions if that would be more helpful, I just don't know if that's encouraged on here.)
data_title = input("Enter a title for the data: ")
print("You entered: ", data_title)

column1 = input("Enter the column 1 header: ")
print("You entered: ", column1)

column2 = input("Enter the column 2 header: ")
print("You entered: ", column2)

data_point = input("Enter a data point (-1 to stop input): ")

while data_point != -1:
if ',' in data_point:
    if data_point.count(',') < 2:
        data_split = data_point.split(",")
        data_stg = data_split[0]
        data_int = data_split[1]
        if data_split[1].isdigit() is True:
            print("Data string: ", data_stg)
            print("Data integer: ", data_int)
            data_point = input("Enter a data point (-1 to stop input): ")
        else:
            print("Error: Comma not followed by an integer.")
            data_point = input("Enter a data point (-1 to stop input): ")
    else:
        print("Error: Too many commas in input.")
        data_point = input("Enter a data point (-1 to stop input): ")
else:
    print("Error: No comma in string.")
    data_point = input("Enter a data point (-1 to stop input): ")

The problem is in the in the 3rd if loop nested in the while loop. I have to make sure their input has an integer after the comma.
 if data_split[1].isdigit() is True:
                print("Data string: ", data_stg)
                print("Data integer: ", data_int)
                data_point = input("Enter a data point (-1 to stop input): ")
            else:
                print("Error: Comma not followed by an integer.")
                data_point = input("Enter a data point (-1 to stop input): ")

A: As you give me the captured image, I couldn't see the full requests.
So I made an example for you.
while True:
  a = input('please give me your data :')
  if ',' not in a:
    try:
       if int(a) == -1: break
    except:
      pass

    print( 'please give me the seperated inputs wiht ","')
  else:
    b, c = a.split(',')
    try:
      c = int(c)
    except:
      print( 'please give me int !!')
    else:
      print( b, c)

I believe this code would help you see what python is.


text:
Q: FPDF Multiply Table PHP PDO I need to print the curriculum data's in PDF file. On the Front-End got no problem.

But applying the same code on FPDF is kinda hard for me. I need to display the curriculum data's like on my front-end. I made this so far.

And here is the whole code for that script.
<?php
include "../../include/student_session.php";
$user_id = $_SESSION['student'];
$stmt = $DB_con->prepare("SELECT *, h.campus as 'h.campus', k.batch as 'k.batch', j.id as 'j.id', a.department_id as 'dept' FROM student_info a
                                    INNER JOIN section b ON b.id = a.section_id
                                    INNER JOIN course c ON c.id = a.course_id
                                    INNER JOIN year_tbl d ON d.id = a.year_id
                                    INNER JOIN batch_tbl e ON e.id = a.batch_id
                                    INNER JOIN department f ON f.id = a.department_id
                                    INNER JOIN scholarship g ON g.id = a.scholarship_id
                                    INNER JOIN campus h ON h.id = a.campus
                                    INNER JOIN school_year i ON i.id = a.sy_id
                                    INNER JOIN curriculum j ON j.department_id = a.department_id AND j.course_id = a.course_id
                                    INNER JOIN batch_tbl k ON k.id = j.batch_id
                                    WHERE a.id=:id");
$stmt->execute(array(":id"=>$user_id));
$userRow=$stmt->fetch(PDO::FETCH_ASSOC);
require('fpdf.php');

class PDF extends FPDF {
    function Header() {
        // Logo

        $this->Image('../../login-folder/assets/img/logo_ac_long.png',68,10,80);

    }
    function Footer() {
        // Position at 1.5 cm from bottom
        $this->SetY(-15);
        // Arial italic 8
        $this->SetFont('Arial','I',8);
        // Page number
        $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'R');
        //$this->Line(20, 45, 210-20, 45); // 20mm from each edge
        $this->GetY(15);
        $x=$this->GetY(15);
        //$this->Line(160,250,296-100,250);

        $this->Line(10,285,200,285);
        $this->Ln();
        $fech = time();
        $fecha = date( "m/d/y" ,$fech);
        $this->Text(10,288,$fecha);
    }
}

$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);

$pdf->Ln(30);
$pdf->Cell(10);
$pdf->SetFont('Arial','', 8);
$pdf->Cell(30,5,'Student Number: '.$userRow['student_no']);
$pdf->Cell(70);
$pdf->Cell(30,5,'Section Block : '.$userRow['section_code']);

$pdf->Ln(6);
$pdf->Cell(10);
$pdf->Cell(30,5,'Reference No  : ----------');
$pdf->Cell(70);
$pdf->Cell(30,5,'School Year   : '.$userRow['school_year']);

$pdf->Ln(6);
$pdf->Cell(10);
$pdf->Cell(30,5,'Name          : '.$userRow['student_name']);
$pdf->Cell(70);
$pdf->Cell(30,5,'Semester      : '.$userRow['semester']);

$pdf->Ln(6);
$pdf->Cell(10);
$pdf->Cell(30,5,'Course          : '.$userRow['course_code']);
$pdf->Cell(70);
$pdf->Cell(30,5,'Year            : '.$userRow['year']);

$pdf->Ln(6);
$pdf->Cell(10);
$pdf->Cell(30,5,'Curriculum    : Ver.'.$userRow['j.id'].', '.$userRow['k.batch']);
$pdf->Cell(70);
$pdf->Cell(30,5,'Status        : Currently Enrolled');

$pdf->Ln(6);
$pdf->Cell(10);
$pdf->Cell(30,5,'Campus        : '.$userRow['campus']);
$pdf->Cell(70);
$pdf->Cell(30,5,'Scholarship   : '.$userRow['scholarship_type']);
$stmt5 = $DB_con->prepare("SELECT *,a.id as 'a.id', b.year_id as 'b.year_id' FROM year_tbl a INNER JOIN subjects b ON b.year_id = a.id AND department_id = :dept group by a.id order by a.id asc; ");
$stmt5->bindparam(":dept", $userRow['dept']);
$stmt5->execute();
$userRow5=$stmt5->fetchAll(PDO::FETCH_ASSOC);
if($stmt5->rowCount() > 0) {
    foreach ($userRow5 as $key) {
            $pdf->Ln(10);
            $pdf->Cell(10);
            $pdf->SetFont('Arial', 'B', 12);
            $pdf->Cell(30,5,$key['year']. ' - ' .$key['semester']);

            //set initial y axis position per page
            $y_axis_initial = 86;
            //Set Row Height
            $row_height = 6;

            //print column titles for the actual page
            $pdf->SetFillColor(255, 255, 255);
            $pdf->SetFont('Arial', '', 8);

            $pdf->SetY($y_axis_initial);
            $pdf->SetX(12);

            $pdf->Cell(30, 6, 'Subject Code', 1, 0, 'C', 1);
            $pdf->Cell(10, 6, 'Units', 1, 0, 'C', 1);
            $pdf->Cell(12, 6, 'Prelims', 1, 0, 'C', 1);
            $pdf->Cell(14, 6, 'Remarks', 1, 0, 'C', 1);
            $pdf->Cell(12, 6, 'Midterm', 1, 0, 'C', 1);
            $pdf->Cell(14, 6, 'Remarks', 1, 0, 'C', 1);
            $pdf->Cell(12, 6, 'Finals', 1, 0, 'C', 1);
            $pdf->Cell(14, 6, 'Remarks', 1, 0, 'C', 1);
            $pdf->Cell(12, 6, 'Average', 1, 0, 'C', 1);
            $pdf->Cell(14, 6, 'Equivalent', 1, 0, 'C', 1);
            $pdf->Cell(40, 6, 'Instructor', 1, 0, 'C', 1);

            $y_axis = $y_axis_initial  + $row_height;
            //initialize counter
            $i = 0;

            //Set maximum rows per page
            $max = 25;

            $stmt2 = $DB_con->prepare("SELECT *, d.id as 'b.section_id', c.id as 'b.subject_id', c.subject_code as 'c.subject_code', a.year_id as 'yid', a.batch_id as 'bid', (lec_units + lab_units) as 'total'  FROM student_info a
                                    INNER JOIN curriculum b ON b.department_id = a.department_id AND b.batch_id = a.batch_id AND b.course_id = a.course_id
                                    INNER JOIN curriculum_subjects f ON f.curriculum_id = b.id
                                    INNER JOIN subjects c ON c.id = f.subject_id AND c.year_id = :yid
                                    INNER JOIN section d ON d.id = a.section_id
                                    INNER JOIN batch_tbl e ON e.id = a.batch_id

                                    WHERE a.student_no = :value");
            $stmt2->bindparam(":value", $userRow['student_no']);
            $stmt2->bindparam(":yid", $key['a.id']);
            $stmt2->execute();
            $userRow2=$stmt2->fetchAll(PDO::FETCH_ASSOC);
            if ($stmt2->rowCount() > 0) {
                foreach ($userRow2 as $key2) {

                    if ($i == $max) {
                        $pdf->AddPage();

                        //print column titles for the current page
                        $pdf->SetY($y_axis_initial);
                        $pdf->SetX(33);

                        //$pdf->Cell(30, 6, 'Resident', 1, 0, 'L', 1);

                        $pdf->Cell($pdf->GetStringWidth('Subject Code')+3, 6, 'Subject Code', 1, 0, 'C', 1);
                        $pdf->Cell($pdf->GetStringWidth('Units')+3, 6, 'Units', 1, 0, 'L', 1);
                        $pdf->Cell($pdf->GetStringWidth('Prelims')+3, 6, 'Prelims', 1, 0, 'L', 1);
                        $pdf->Cell($pdf->GetStringWidth('Remarks')+3, 6, 'Remarks', 1, 0, 'L', 1);
                        $pdf->Cell($pdf->GetStringWidth('Midterm')+3, 6, 'Midterm', 1, 0, 'L', 1);
                        $pdf->Cell($pdf->GetStringWidth('Remarks')+3, 6, 'Remarks', 1, 0, 'L', 1);
                        $pdf->Cell($pdf->GetStringWidth('Finals')+3, 6, 'Finals', 1, 0, 'L', 1);
                        $pdf->Cell($pdf->GetStringWidth('Remarks')+3, 6, 'Remarks', 1, 0, 'L', 1);
                        $pdf->Cell($pdf->GetStringWidth('Average')+3, 6, 'Average', 1, 0, 'L', 1);
                        $pdf->Cell($pdf->GetStringWidth('Equivalent')+3, 6, 'Equivalent', 1, 0, 'L', 1);
                        $pdf->Cell($pdf->GetStringWidth('Instructor')+3, 6, 'Instructor', 1, 0, 'L', 1);
                        //Go to next row
                        $y_axis = $y_axis + $row_height;

                        //Set $i variable to 0 (first row)
                        $i = 0;
                    }
                    $semester = $key2['subject_code'];
                    $pdf->SetY($y_axis);
                    $pdf->SetX(12);
                    $pdf->Cell(30, 6, $semester, 1, 0, 'C', 1);
                    $pdf->Cell(10, 6, '', 1, 0, 'C', 1);
                    $pdf->Cell(12, 6, '', 1, 0, 'C', 1);
                    $pdf->Cell(14, 6, '', 1, 0, 'C', 1);
                    $pdf->Cell(12, 6, '', 1, 0, 'C', 1);
                    $pdf->Cell(14, 6, '', 1, 0, 'C', 1);
                    $pdf->Cell(12, 6, '', 1, 0, 'C', 1);
                    $pdf->Cell(14, 6, '', 1, 0, 'C', 1);
                    $pdf->Cell(12, 6, '', 1, 0, 'C', 1);
                    $pdf->Cell(14, 6, '', 1, 0, 'C', 1);
                    $pdf->Cell(40, 6, '', 1, 0, 'C', 1);
                    //Go to next row
                    $y_axis = $y_axis + $row_height;
                    $i = $i + 1;
                }
                $pdf->Output();
            }

    }
//    $pdf->Ln(10);
//    $pdf->Cell(10);
//    $pdf->SetFont('Arial','b', 8);
//    $pdf->Cell(30,5,'NOTE: THIS IS NOT VALID WHEN THERE IS NO SIGNATURE OF REGISTAR OFFICE.');

}
?>

What mistake did I do here? What I'm missing? I need help to achieve the front-end output like that.


text:
Q: Error while training mobile net Tensorflow model : Corrupt JPEG data: 53 extraneous bytes before marker 0xd9 I am training a currency detection model in tensorflow using mobilenet . I get the above error when i tried to feed the images as training and testing data set. I haved tried using the magick and mogrify approach using magick mogrify -strip *.jpg as well as magick mogrify -set comment "removed extraneous bytes" *.jpg but the error still persists.
I used this tutorial to make my model https://github.com/nicknochnack/TFODCourse


text:
Q: Swift - Creating a Parse Class with an Object that is a Pointer to an object in another class Excuse me if this is already explained somewhere in Swift, I know it is simple but I simply can't find the answer anywhere.
So essentially my problem is that I have a class in Parse called "Groups" that has a "title" object in it. Then in the code below, I am creating a new class called "RankedItems" that has it's own objects. One of the objects is "groupOwner" and the objective here is to assign it to a pointer to the "title" object in the "Groups" class.
My code is listed below. Clearly I have the wrong syntax in the line of code that attempts to create "groupOwner", I have been trying everything so I figured I would leave that in as a placeholder.
Can anyone point me in the right direction as to how I should create "groupOwner" as a pointer to an object in the "Groups" class? Thanks!
 // Add Parse Group Object
        var itemRank:PFObject = PFObject(className: "RankedItems")

        itemRank["itemName"] = newItem
        itemRank["groupOwner"] = PFObject(withoutDataWithClassName: "Groups", objectId: "title")
        itemRank.saveInBackgroundWithBlock {
            (success: Bool, error: NSError!) -> Void in
            if (success) {

            } else {
                // There was a problem, check error.description
                println("Error adding group to parse")
            }
        }

        self.typedItems.append(newItem)

        self.tableView.reloadData()

    }))

A: try this
// Add Parse Group Object
        var itemRank:PFObject = PFObject(className: "RankedItems")
    itemRank["itemName"] = newItem
    itemRank["groupOwner"] = PFObject(withoutDataWithClassName: "Groups", objectId: PFUser.current()?.objectId)
    itemRank.saveInBackgroundWithBlock {
        (success: Bool, error: NSError!) -> Void in
            if error == nil {
                if success {
                    // saved successfully

                } else {
                    // not error, and not saved for some reason... it could be impossible to reach this point
                }

            } else {

                // There was a problem, check error.description
                println("Error adding group to parse")
            }

    }

    self.typedItems.append(newItem)

    self.tableView.reloadData()

}))

I corrected
objectId: "Title"

to
objectId: PFUser.current()?.objectId


text:
Q: Override 'OR' and 'AND' functions I'm writing a class where I need to have an OR and an AND function declared. If I declare it the normal way i get the following error message:
Parse error: parse error, expecting `"identifier (T_STRING)"' in /Users/... on line 53

What's the correct way to achieve this in php? (Callable OR and AND functions)

A: PHP doesn't support operator overloading so you can't do that.


text:
Q: How to Connect to a device in android using WiFiP2p without discovering it I want to connect my tablet to my phone using WiFi direct in order to send some data like pictures etc from my phone to tablet.
But I do not want my phone to discover it first i.e I don't wanted to use discoverPeers() method of WiFiP2pManger.
How can I achieve this goal?

A: In your phone, use createGroups(). This makes your phone become the groupOwner. Then call discoverPeers() in your tablet, it will find your phone without your phone calling discoverPeers().
In your phone:
wifiP2pManager = (WifiP2pManager) context.getSystemService(context.WIFI_P2P_SERVICE);
channel=wifiP2pManager.initialize(context,context.getMainLooper(),null);
wifiP2pManager.createGroup(channel, new WifiP2pManager.ActionListener() {
        @Override
        public void onSuccess() {
            Log.i(TAG,"Creating p2p group");
        }

        @Override
        public void onFailure(int i) {
            Log.i(TAG,"Creating group failed, error code:"+i);

        }
});

In your tablet, discover peers, request peers and connect peers as normal

A: In order to establish a WiFi Direct connection both phones should be running WiFi Direct discovery. In other words, they will see each other when they are both scanning for WiFi direct connections at the same time. This is because the way WiFi Direct works is that when phones are scanning for WiFi Direct connections, they will negotiate with the other peers for the role of Access Point or Slave device. Hence both need to call discoverPeers() to become discoverable themselves and find nearby devices.
In your use case you could even  build your application using  wifi hotspot

A: This solution doesn't work. In Android both need to be on discovery mode in order to connect.


text:
Q: Index and query Unique Key URL Solr i indexed a collection of archived websites for querying using solr. As unique key i use the URL's of the sites. What i would like to do is to use the url field in filter queries to limit the search to a certain domain when needed. For example i want to query for "Barack Obama", but limit the results to the "whitehouse.gov" domain. Sounds like a pretty basic use case to me, however searches on the URL field do not return any results at all. Here is my config (schema.xml):
 .
 .
 .
 <field name="collection" type="string" indexed="true" stored="true"/>
 <field name="content" type="text_de" indexed="true" stored="true" multiValued="true"/>
 <field name="date" type="string" indexed="true" stored="true"/>
 <field name="digest" type="string" indexed="true" stored="true"/>
 <field name="length" type="string" indexed="true" stored="true"/>
 <field name="segment" type="string" indexed="true" stored="true"/>
 <field name="site" type="string" indexed="true" stored="true"/>
 <field name="title" type="text_de" indexed="true" stored="true" multiValued="true"/>
 <field name="type" type="string" indexed="true" stored="true"/>
 <field name="url" type="text_en_splitting" indexed="true" stored="true"/>
 .
 .
 .

<!-- Field to use to determine and enforce document uniqueness.
  Unless this field is marked with required="false", it will be a required field
-->
 <uniqueKey>url</uniqueKey>

And here is my query (simplified):
http://mysolrserver.com:8983/solr/select/?q=content:Barack+Obama&fq=url:whitehouse.gov

The query analyzer tells me, that my query should match:

Does anyone have an idea why this is not working? I highly appreciate any hints i can get! Thanks alot guys!!

A: The fq=url:whitehouse.gov filtering should work.
However I see the problem with the query q=content:Barack+Obama.
Whats your default search field ??
Does removing the query component and using q=*:* return results for you.  ??
q=content:Barack+Obama query would actually result into a query like content:barack defaultsearchfield:obama
As the default search field would not have obama this would not result in any results.


text:
Q: How to promote/ff branch to HEAD I have a protected branch that should only be promoted/fast-forwarded once the integration build on the integration build passes.
I currently try to solve this by having an integration build on pull requests to integration branch, that, once it succeeds, simply fast forwards the release branch to the tip of the integration branch.
However, when I build a branch on the TFS build system, it will checkout the commit at the head of the integration branch, leaving the build server in detached head state.
That should all be fine, but for some reason I can not do that without using multiple statements. To me, intuitively, there should be a simple command for this. I only want to fast-forward a branch point to the current commit.
For now though, I have found 2 ways to do it:
Saving HEAD commit with scripting

*

*Save HEAD commit to variable in current shell scripting language (here saved to %HEAD_commit_id%)

*git checkout release

*git merge %HEAD_commit_id%
Using throw-away branch

*

*git branch current-head

*git checkout release

*git merge current-head

*git branch -d current-head
Looking for better solution
Is it correct that the above is "the best" I can do to accomplish this? I would think a one-line exists for this? Both solution 1 and 2 has its caveats, so I would rather go with neither, but I will probably end up with using number 2 in the end.
Steps to reproduce scenario
To reproduce the exact scenario I have, you need 2 commits (C1 and C2) and 2 branches (release and integration).
Point release to C1, integration to C2 and HEAD to C2 (detached head state).
The end result should allow me to push the release branch, now pointing to the same commit as integration.

A: You have many options; which to use depends what you can guarantee about your environment.
You could use (tip of the hat to jthill):
git checkout release && git merge --ff-only @{1}

(with anything your shell requires to protect the braces from expansion).  That's equivalent to your first method, but does not need a temporary variable since @{1} means "the previous value of HEAD before the checkout".
You can, however, also use either of these rather tricky operations:
git push . HEAD:refs/heads/release

or:
git fetch . HEAD:refs/heads/release

as we'll see below.  This is more efficient in some ways.  Its main drawback is that almost no one groks it.
Background
Let's first note that each repository is self-contained, by which I mean each repository has its own branch names, and its own HEAD and index and work-tree.  (The latter three—HEAD, index, and work-tree—function as a unit.  If you have Git version 2.5 or later, you can use git worktree add to add independent work-trees, each of which comes with its own HEAD and index.)
git checkout name-or-ID will, assuming all goes well:

*

*Leave HEAD pointing to ID, usually through name (an "attached HEAD"), but directly if necessary (when you give it an ID, or use --detach to make sure it detaches HEAD from the name you give it).

*Fill in the index from the commit HEAD now names.

*Fill in the work-tree from this same commit.

Now, let's consider what git merge does when it's possible to fast-forward instead of actually merging.  This occurs when HEAD names a commit that is an ancestor of the target commit and you tell git merge to merge with anything that identifies that target commit.  The identifier you pass to git merge can be a raw hash ID (as in your %HEAD_commit_id% method), or a branch name (as in your git merge current-head method).  The only thing that is necessary is that git merge:

*

*find the target commit (e.g., receive its hash ID or resolve a name to its hash ID);

*compute the merge base of HEAD and the target commit; and

*discover that this merge base is the same commit that HEAD identifies.

These are the conditions under which a fast-forward merge is possible.  If a fast-forward merge is possible, and you have not forbidden it explicitly (git merge --no-ff) or implicitly (git merge -s ours for instance, or certain cases of merging using an annotated tag), git merge will do the fast-forward operation in this case.  You can even add --ff-only to the arguments to git merge to tell Git: Do a fast-forward if possible, and if it's not possible, give me an error instead of doing a real merge.
The fast-forward merge operation
Now let's look at what the fast-forward merge actually does.  There are multiple parts to this, because git merge affects the current (HEAD-attached) branch, or if HEAD is detached, HEAD itself.  Note that if something goes wrong partway through, Git attempts to back out the entire operation, so that it looks like either everything succeeds, or the fast-forward never even starts.  (In some particularly nasty cases, such as when the computer has caught fire, the messy internal state may show through, provided your computer survives the conflagration.)

*

*Git needs to make the index and work-tree match the merge result, which is of course the target commit.  So in effect, Git checks out the target commit.  However, HEAD remains connected to the current branch, if it's attached.  This checkout of the target commit updates the index and work-tree.

*If HEAD is attached, Git now changes the branch name to which HEAD is attached so that this name identifies the commit just checked-out—the target commit.  That is, if we had something we might draw this way:
...--o--o   <-- branch (HEAD)
         \
          o--o--o   <-- target_commit
                 \
                  o--...

we now have:
...--o--o
         \
          o--o--o   <-- branch (HEAD), target_commit
                 \
                  o--...

This is the fast-forward operation in play, when we are on the given branch.
(If HEAD is detached, simply imagine the same action without the name branch in front of it.)
Consider git fetch and git push
When you use git fetch to obtain new commits from another Git, or git push to give your own commits to another Git, you have the two Gits talk to each other and transfer any new commits.  Assume for the moment that this is a git fetch operation:
...--o--o--X

becomes:
...--o--o--X--Y--Z

where Y--Z are the new commits that link up with the tip commit X of our branch.  Quite typically, X has two names pointing to it, such as master and origin/master, at the start of the operation:
...--o--o--X   <-- master (HEAD), origin/master

and at the end, the corresponding origin/master name has moved, so we might draw the commits like this:
...--o--o--X   <-- master (HEAD)
            \
             Y--Z   <-- origin/master

Consider how the name origin/master just moved, and compare it to how branch moved when we did a fast-forward merge.  These are the same motions: the name origin/master moved in a fast-forward fashion, so that instead of pointing to commit X, it now points to commit Z.
This, too, is what happens during git push, except that instead of having our Git retrieve commits from their Git, we have our commit give commits to their Git.  But once we have done that, we don't want our Git to remember their Git's master, we want their Git to remember, as their master, our final commit.  So if they had:
...--o--o--X   <-- master

and we gave them --Y--Z that connect to X, we'd like them to make their master point to Z:
...--o--o--X--Y--Z   <-- master

This, too, is a fast-forward operation.
Note that if the request we make isn't a fast-forward, the other Git generally rejects our request:
...--o--o--X--W   <-- master
            \
             Y--Z   <-- (we request that they set their master here)

In this case, if they moved their name master to point to Z, they would "forget" commit W.  That's a non-fast-forward operation, and is the kind of thing that when we run git merge, causes us to get a true merge.  A Git that is receiving a git push won't run git merge, so it requires that our request be a fast-forward operation—well, requires this unless we tell it to force the change.
As long as we don't use --force or equivalent, this kind of git push won't make any change that is not a fast-forward operation.  The other Git will simply say: No, I won't do that, because it's not a fast-forward.
Note that unlike our fast-forward merge case, their Git—the other Git to which we are git pushing—doesn't run git checkout on any updated commit hashes.  This is why we must either push to a --bare repository, which has no work-tree, or push to a branch that the other Git doesn't have checked out.1
This means we can (ab)use fetch or push
We know that:

*

*git push will fast-forward a branch, as long as it's not checked out, and

*we're in "detached HEAD" mode, so we don't have branch release checked out, so

*what if we have our Git call up our own Git?  What if we ask them to set their release to some specific commit hash?

Our Git will ask their Git—which is really our Git, just wearing a different hat—to take any new commits—there aren't any; our Git has all the commits that our Git has—and then update its (our) release in a fast-forward manner, since we're not asking it to force anything.  Hence we can fast-forward our own release to the commit identified by HEAD if we just say: Hey, other Git, set your refs/heads/release to the commit identified by my HEAD!  We do that with a push refspec of the form:
HEAD:refs/heads/release

The only trick now is to call up ourselves.  Normally we might need a URL, but Git allows path names, including relative path names; and the relative path name . means the current directory.  So if we:
git push . HEAD:refs/heads/release

we'll have our Git call up own own Git, transfer nothing (no new commits), and ask our Git to set our refs/heads/release in a fast-forward fashion, to match our current HEAD.  Since our release is not checked out, this is allowed if and only if the operation is a fast-forward.
The fetch trick is exactly the same: we fetch from ourselves (which transfers no commits), then request that our own Git set our own refs/heads/release to a specific commit hash.  Since there is no leading + force-flag, this too verifies that the operation is fast-forward-only.  Because we do not use --update-head-ok, this does the same check that git push does, that the current HEAD does not name branch release.  Curiously, we get the hash ID from the other Git this time (but that's ourselves so it's the same hash ID either way).

1This actually depends on the setting of receive.denyCurrentBranch.  See also receive.denyNonFastForwards.  Newer Gits also support updateInstead with which we can have the target Git run git checkout, but only in certain circumstances; this allows non-bare repositories to be used with git push even with a branch occupying their work-tree-and-index pair.


text:
Q: Render data in other component when in select tag reactjs I am using reactjs, ant design and ant design pro for my project, I have a form like the code below. Option's data is loaded from api. How can I choose that each time I select an option ,the information of that option will appear down to ProDescriptions
 props.onInsertObjectFinish(value)} >
        <Form.Item  name="TopicId" label="ID chủ đề ">
          <Input id="TopicId"  type="hidden" value={currentRow?.id}/>{currentRow?.id}
        </Form.Item>

        <Form.Item name='ExhibitId' label="Tên hiện vật ">
          <Select placeholder="Chọn hiện vật muốn thêm" style={{ width: 120 }} onSelect={(value) => props.getvalue(value)}>
            {props.listObj.map((obj: any) => {
              return <Option value={obj.id} >{obj.name}</Option>
            })}
          </Select>
          <ProDescriptions
          />
        </Form.Item>

      </Form>

A: well, create a state
const [proDesc, setProDesc] = useState({});

create a function
 const handleSelectChange = (value) =>{
   props.getvalue(value)
   let index = props.listObj.findIndex(item => item.id == value)
   if(index > -1) setProDesc(props.listObj[index])
 }

call function onSelectChange
onSelect={(value) => handleSelectChange(value)}

and pass this state as prop to ProDescriptions
<ProDescriptions proDesc={proDesc}   />

now you have a full object of selected option in your ProDescription component, use it how ever you want

A: Here is the code of ProDescription that i can't using proDesc
 props.onInsertObjectFinish(value)}>
        <Form.Item  name="TopicId" label="ID chủ đề ">
          <Input id="TopicId"  type="hidden" value={currentRow?.id}/>{currentRow?.id}
        </Form.Item>

        <Form.Item name='ExhibitId' label="Tên hiện vật ">
          <Select
          placeholder="Chọn hiện vật muốn thêm"
          style={{ width: 120 }}
          onSelect={(value) => handleSelectChange(value)}
             >
            {props.listObj.map((obj: any) => {
              return <Option key={obj.id} value={obj.id} >{obj.name}</Option>
            })}
          </Select>
          <ProDescriptions
          column={1}
            request={async () => ({
            data: proDesc || {},
          })}
          columns={columns as ProDescriptionsItemProps<TableListItem>[]}
          />
        </Form.Item>
      </Form>

And here is the sample code running of ProDescription
const [currentRow, setCurrentRow] = useState();
   <ProDescriptions<TableListItem>
          column={1}
          title={currentRow?.name}
          request={async () => ({
            data: currentRow || {},
          })}
          params={{
            id: currentRow?.name,
          }}
          columns={columns as ProDescriptionsItemProps<TableListItem>[]}
     />


text:
Q: How to add custom widget above admin_footer What I am trying to accomplish is placing custom widget on an admin page (edit.php). I tried using these two functions:
Places custom html right below < body > (above all page content)
add_action( 'load-edit.php', 'your_function' );
function your_function() {
    include( plugin_dir_path( __FILE__ ) . 'quickpost/quickpost.php');
}

Places custom html below the < footer >
add_action('admin_footer', 'post_add_quickpost');
function post_add_quickpost() {
    include( plugin_dir_path( __FILE__ ) . 'quickpost/quickpost.php');
}

Here is were I am trying to place the widget, just above the posts table on the edit.php page. http://i.imgur.com/QKHkEqs.jpg
Is there a way I can specify where to place the code? I would prefer to work with the 'load-edit.php' action, but if that is not possible - it is okay with me. Thanks!

A: I think that add_action( 'load-edit.php', 'your_function' ); is the correct way to do it, since it's the only admin action designed to be fired only on a specific page. I would just style my metabox so that it's absolutely positioned at the bottom of the posts list.
You could also look at some other available actions available during an admin page load. If you find one that's more appropriate, you could use a basic page check to load your plugin on only the desired page, something like:
add_action( 'some-admin-action', 'your_function' );
function your_function() {
     global $pagenow;
     if (is_admin() && $pagenow=='edit.php')
           include( plugin_dir_path( __FILE__ ) . 'quickpost/quickpost.php');
}

A: As far as I know you have 2 options.

*

*Using admin_footer or load-edit.php and position with absolute or fixed, or use JavaScript.

*If you creating a completely new posts screen (not a default posts, pages, etc), you can extend WP_List_Table class, specifically the extra_tablenav function.
For example:
class My_Custom_Table extends WP_List_Table {

    function extra_tablenav( $which ) {

        if ( $which == "top" ){
            //The code that goes before the table is here
            echo "Hello, I'm before the table";
           }
        if ( $which == "bottom" ){
            //The code that goes after the table is there
            echo "Hi, I'm after the table";
           }
      }
}

As far as I can tell, extending this class can only work on a custom admin page, and not the current existing ones, as there are no hooks available. You can read more about it here: http://codex.wordpress.org/Class_Reference/WP_List_Table


text:
Q: Can I detect that a particular permission has been removed for my android app? So with the arrival of Android 4.3 comes the ability to selectively disable particular permissions for apps.
This could obviously cause problems where an app loses a permission it needs to operate correctly.
Does the system broadcast a message when a permission is revoked, or how could I tell that my app no longer has a certain permission? Ideally I would like to inform the user that turning off permission A will break xyz in the application.

A: There is no broadcast, but you can check permissions yourself on startup(or resume, etc). Context#checkCallingOrSelfPermission() is provided for this.
If you want to check all your permissions, you could do something like this:
public static boolean[] getPermissionsGranted(Context context, String[] permissions){
    boolean[] permissionsGranted = new boolean[permissions.length];
    for(int i=0;i<permissions.length;i++){
        int check = context.checkCallingOrSelfPermission(permissions[i]);
        permissionsGranted[i] = (check == PackageManager.PERMISSION_GRANTED);
    }
    return permissionsGranted;
}

Where the input Strings are the permissions' names, such as "android.permission.INTERNET".


text:
Q: Posting on facebook wall with offline permission without browser I'm developing a facebook application that post on the user wall with offline permission guaranteed. I'm using PHP with the facebook api (this code is in "index.php"):
$user = $_GET['user'];
(if(isset($_GET['publish'])) {
    $attachment = array(
                    'message' => "My message",
                    'link'    => "http://...",
                    'picture' => 'my_url_picture',
                    'name'    => "link_name",
                    'caption' => 'my_caption',
                    'description'=> 'my_description'
                    );
    $publishStream = $facebook->api("/$user/feed", 'post', $attachment);
}

Now, I use a Java servlet that, when an event occurs, has to post on the user wall in this way:
if(event) {
  Runtime rt = Runtime.getRuntime();
  String url_post = "http://apps.facebook.com/myapp/index.php?publish=1&user=user_id";
  rt.exec("rundll32 url.dll,FileProtocolHandler " + url_post);
}

All is ok. When the event occurs my server open the browser at the previous link and the post appears correctly on the user (with user_id) wall.
Is possible to "visit" the link without open a browser page? I'm using resin 4.0 for testing my app, Windows 7 Pro Service Pack 1 (but tested also in Windows XP).
Thanks for your attention.

A: if i've understood you right, you don't know how to post without opening system browser. Maybe you should look for programming browser like Snoopy (http://sourceforge.net/projects/snoopy/). You can make http requst without opening anything.

A: You should take a look at the apache httpclient project.


text:
Q: $welcome.css is not a function I'm trying to add a jQuery method to a variable that holds a string, but it does not work.  the purpose of it is to fade in letter by letter, I know that I can do it threw selecting the node so it is an object, but I try to do it from a variable. If someone can help me find the issue please.
This is the code:
function y() {
    var $welcome = allName.split("");
    $welcome.css({opacity: 0});
    $welcome.each().css({
    });

This is what I get back:

$welcome.css is not a function

There is a string stored in allname.

A: The split function will return an array. Since you are trying to call '.css' on on array you are getting an error


text:
Q: Bootstraping OpenUI5 from single JS file OpenUI5 documentation suggests starting work by using a library loaded from CDN:
<script id="sap-ui-bootstrap"
    type="text/javascript"
    src="https://openui5.hana.ondemand.com/1.42.6/resources/sap-ui-core.js"
    data-sap-ui-theme="sap_belize"
    data-sap-ui-libs="sap.m,sap.ui.table"></script>

Unfortunately, this approach means load cascading 4 scripts on startup:

*

*sap-ui-core.js

*sap/ui/core/library.js (why ?)

*sap/m/library.js

*sap/ui/table/library.js

Is there way to bundle this four libraries into one script file?

A:
Unfortunately, this approach means load cascading multiple scripts on startup:

The cascading behavior is mostly due to missing an option that tells the framework to load UI5-libraries and other modules asynchronously. In order to fix it, please add the following attribute too:
data-sap-ui-async="true" // available since 1.58.2 --> Replaces preload="async" *
data-sap-ui-preload="async" // for 1.58.1 and below
* Prerequisite: Is Your Application Ready for Asynchronous Loading?

Is there way to bundle these four libraries into one script file?

Yes; with a self-contained build (e.g. ui5 build self-contained --all ), you can reduce the size of your application as well as number of requests by bundling the required modules into a single file sap-ui-custom.js

In the above screenshot, for example, sap-ui-custom.js contains only the required modules from sap.ui.core-, sap.m-, sap.ui.table-, and sap.ui.unified-library, in addition to application related resources such as the controllers, views, etc..
See openui5-sample-app and the UI5 tooling for official documentation.


text:
Q: symfony 1.4 add custom fields to frontend form I need to add extra fields to my registration form in front end. I used this article to add it to back end, and it works. Now I can't add them to front end.

A: You'll need to add those fields to the form class used on your frontend.
For example let's say your frontend form class is called myClassForm, you would add your fields in lib/form/doctrine/MyClassForm.class.php
class MyClassForm extends BaseMyClassForm
{
  public function configure()
  {
    $this->setWidget('extra_field1', new sfWidgetFormInput());
    $this->setWidget('extra_field2', new ....);

    //set validators
    $this->validatorSchema['extra_field1'] = ...;
  }
}