text:
Q: The buttons on my form are not showing up I need a help to make this code to work...I don't know what I'am doing wrong here. I'am making a program with many buttons in Windows form application. I'am with three classes, Form1.cs, easy.cs and Methods.cs. The Form1 class is just so you can click on a button to get another window up, like if you click on easy the easy class will pop up. I had created my buttons in the Methods class (see the code below). Now, here is the thing, I want to get the functions from my class Methods, it seem to be working but there is one thing, the buttons do not show. The function fylla_takka in Methods.cs is supposed to create the buttons, I guess it does, but doesn't show them. then the butt_click function, that is just that happens when you click on a button. I want to have these things in a class so I can use it again and again.
Sorry for commenting in Icelandic in my code, but I didn't expect to show the code to someone else :)
Form1.cs:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;

    namespace Samstæðuleikur
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();

            }

            easy easy = new easy();
            public void button1_Click(object sender, EventArgs e)
            {
                easy.Show();
            }

            private void button2_Click(object sender, EventArgs e)
            {

            }

        }
    }

easy.cs:
  using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Samstæðuleikur
{
    public partial class easy : Form
    {
        public easy()
        {
            InitializeComponent();
        }

        Methods methods = new Methods();
        private void easy_Load(object sender, EventArgs e)
        {
            methods.fylla_takka(3,3);//This one is working
        }
    }
}

Methods.cs:
    using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Samstæðuleikur
{
    public partial class Methods : Form
    {
        public Methods()
        {
            InitializeComponent();
        }

       int counter = 0;
       int teljari = 0;
       int counter2 = 0;
            Random rand = new Random();//Ný random tala
             int ragdomly_easy = 0;
             int ragdomly_easy1 = 0;
            int ragdomly_easy2 = 0;
            int snowy1 = 0;
            int snowy2 = 0;
            int snowy3 = 0;

        public void ragdmomly(int endir)//Bý til fall sem velur 3 random tölur frá 1 upp í enda
        {

            ragdomly_easy = rand.Next(1, endir);
            ragdomly_easy1 = rand.Next(1, endir);
            ragdomly_easy2 = rand.Next(1, endir);
            int snowy1 = ragdomly_easy;//Planta fyrsta snowy
            int snowy2 = (ragdomly_easy1);//Annað snowy
            int snowy3 = (ragdomly_easy2);//Þriðja snowy
        }

        List<Button> buttons = new List<Button>();//Skilgreini lista svo ég get haft eins marga takka og ég vil!
        public void fylla_takka(int lengd, int fjoldi)//Býr til takkana, eins marga og ég vil!
        {

            MessageBox.Show("Testing if my function works, you see this message so it's working.");
            int x = 50;
            int y = 35;

            for (int i = 0; i < fjoldi; i++)//Keyri hve_margir_takkar sinnum yfir listann
            {
                teljari++;
                buttons.Add(new Button());//Set takkann í listann svo að það sé hægt að velja ákveðinn takka
                buttons[i].Location = new Point(x, y);//Vel frá listanum takka nr i og gef honum staðsetningu x og y
                buttons[i].Size = new Size(50, 50);//Vel frá listanum takka nr i og breyti stærð hans

                x = x + 50;//Takkinn, næst þegar lúppan keyrir, fer 35 til hliðar.

                if (teljari == lengd)//Hversu margir takkar eiga að vera í hverri röð
                {
                    y = y + 50;//Ef að lengdinni er náð þá förum við í næstu línu
                    x = 50;
                    teljari = 0;
                }

                this.Controls.Add(buttons[i]);// <-- Something may be wrong here, the buttons are not showing up Set takkann á formið, lúppan keyrir x mörgum sinnum og þá koma x margir
                //takkar
                buttons[i].Click += new EventHandler(butt_Click);//Ef ýtt er á takkann þá fer forritið í
                //eventHandlerinn butt_Click
                buttons[i].Name = i.ToString();
                counter++;
                counter2++;
            }

        }

       public void butt_Click(object sender, EventArgs e)//Eventhandlerinn butt_Click
        {

            Button temp = (Button)sender;//Ef að eitthvað gerist í takkanum þá gerist eventið s.s. allt sem er inn í butt_Click
            //í þessu tilfelli.

            for (int i = 0; i < buttons.Count; i++)//Keyri í gegnum takka listann
            {

                if (temp.Name == Convert.ToString(snowy1))
                {

                    temp.BackColor = Color.Green;
                    counter = counter + 1;
                    temp.Text = "Snowy";
                }

                else if (temp.Name == Convert.ToString(snowy2))
                {
                    temp.BackColor = Color.Green;
                    counter = counter + 1;
                    temp.Text = "Snowy";
                }

                else if (temp.Name == Convert.ToString(snowy3))
                {
                    temp.BackColor = Color.Green;
                    counter = counter + 1;
                    temp.Text = "Snowy";
                }

                else
                {
                    temp.BackColor = Color.Red;//Breyti litnum í rauðann
                    counter2++;
                }
            }
            if (counter == 120)//Þegar ýtt er á takka þá bætist alltaf 30 við því takarnir eru 30 30*3=120
            {

                MessageBox.Show("SNOWY!");
            }

            if (counter2 == 840 || counter2 == 720)
            {
                MessageBox.Show("Sorry, No Snowy.");
            }
        }

    }
}

I hope someone out there could help :)

A: The thing was, that I was calling a wrong class in one of my form. The easy.cs doesn't even have to be there! Then I can use this again and again. The correct solution is then:
Methods methods = new Methods();//Take a "copy" of the class Methods
    public void button1_Click(object sender, EventArgs e)//When button is clicked:
    {
        methods.Show();
        methods.fylla_takka(3, 3);//This one is working
    }

and we don't have to use the easy class, and the Methods class remains unchanged.

A: Typically when controls are added to the layout they are done in the InitializeComponent() function.  You don't have to do it there but if you look at that built int function you will see that the calls to this.Controls.Add( ) are surrounded by suspending and resuming the layout.  These are expensive calls so to minimize try wrapping your entire for loop in them:
this.SuspendLayout();

for (int i = 0; i < fjoldi; i++)//Keyri hve_margir_takkar sinnum yfir listann
{
  . . .

this.Controls.Add(buttons[i]);

. . .

}

this.ResumeLayout(false);
this.PerformLayout();


text:
Q: XUnit test error : Cannot convert system.collections.generic.list <"filename.class"> to string When I try to build a xunit test my expected is ok but I'm giving my actual variable the wrong thing. I'm learning xunit and this is driving me nuts at the moment.
My test for the method below :
    [Fact]
        public void AddToKartMethod()
        {
            var expected = "item";
            var actual = AddToKart.PutItemInKart("item", 3, 4.5);
            Assert.Equal(expected, actual);
        }

My method :
  public static List<KartItem> PutItemInKart(string input, int inputNumber, double inputPrice)
        {
            List<KartItem> kart = new List<KartItem>();
            kart.Add(new KartItem() {
                Item = input,
                Pound = inputNumber,
                Cost = inputPrice
            });;
            return kart;
        }

My KartItem :
 public class KartItem
    {
        public string Item { get; set; }
        public int Pound { get; set; }
        public double Cost { get; set; }

        public KartItem(string item, int pound, double cost)
        {
            item = Item;
            pound = Pound;
            cost = Cost;
        }

        public KartItem()
        {

        }
    }

In my test actual is underlined red and error message reads "Argument 2: Cannot convert from Systems.Collections.Generic.List to string. I want to test just the String Item from the PutItemInKart.

A: You are trying to compare two different types. Extract the desired value from the KartItem object to compare to expected value
[Fact]
public void AddToKartMethod() {
    //Arrange
    string expected = "item";

    //Act
    List<KartItem> items = AddToKart.PutItemInKart(expected, 3, 4.5);
    string actual = items[0].Item;

    //Assert
    Assert.Equal(expected, actual);
}

Note the explicit types used for the variables. This is a case where using var has cause confusion because the type is not known to the user/coder.
Do note however that the logic of that function should be reviewed. It will only always return a collection with one item since the list is created and populated in the function.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Android - HttpResponse not executing I'm having trouble with sending data to my database. I'm using the same sort of code in another class and thats working fine, but somehow this isn't working.
This is the class with the HttpResponse. There are no errors, but when the code reaches
HttpResponse response = httpclient.execute(httppost);

it goes into the catch and returns "Klant not added")
public void StoreKlantInDatabase()
{

    EditText ETklantnaam = (EditText) dialog.findViewById(R.id.addKlantNaam);
    EditText ETlocatie = (EditText) dialog.findViewById(R.id.addKlantLocatie);
    EditText ETfabriek = (EditText) dialog.findViewById(R.id.addFabrieken);
    EditText ETmachine = (EditText) dialog.findViewById(R.id.addMachines);

    String klantnaam = ETklantnaam.getText().toString();
    String locatie = ETlocatie.getText().toString();
    String fabriek = ETfabriek.getText().toString();
    String machine= ETmachine.getText().toString();

    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost(urlInsertKlant);

    try
    {
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
        nameValuePairs.add(new BasicNameValuePair("klantnaam", klantnaam));
        nameValuePairs.add(new BasicNameValuePair("locatie", locatie));
        nameValuePairs.add(new BasicNameValuePair("fabriek", fabriek));
        nameValuePairs.add(new BasicNameValuePair("machine", machine));

        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));
        @SuppressWarnings("unused")
        HttpResponse response = httpclient.execute(httppost);

        Toast.makeText(getApplicationContext(), "Klant succesvol toegevoegd", Toast.LENGTH_LONG).show();
    }

    catch(Exception e)
    {
        e.printStackTrace();
        Toast.makeText(getApplicationContext(), "Klant NIET toegevoegd", Toast.LENGTH_LONG).show();
    }
}

this method is called from an dialog, like this (down in the last OnClick method):
btnAdd.setOnClickListener(new OnClickListener() {

      @Override
      public void onClick(View arg0) {

            // custom dialog
            dialog = new Dialog(context);
            dialog.setContentView(R.layout.addklant_layout);
            dialog.setTitle("Klant toevoegen");

            Button BTNannuleren = (Button) dialog.findViewById(R.id.dialogAnnuleren);
            // if button is clicked, close the custom dialog
            BTNannuleren.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();
                }
            });

            Button BTNtoevoegen = (Button) dialog.findViewById(R.id.dialogToevoegen);
            // if button is clicked, close the custom dialog
            BTNtoevoegen.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                        StoreKlantInDatabase();
                        dialog.dismiss();
                    }
            });
            dialog.show();
      }
    });

I've tryed to just do it all in the onClick method of the dialog, but that made no difference.
Ofcouse the dialog is initiated at the top of the code like:
Dialog dialog;

Does anyone see where i'm going wrong? I'm a bit lost.
Edit: This happens in the catch:
09-30 09:36:52.452: W/System.err(14665): android.os.NetworkOnMainThreadException
09-30 09:36:52.482: W/System.err(14665):    at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1186)
09-30 09:36:52.482: W/System.err(14665):    at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84)
09-30 09:36:52.482: W/System.err(14665):    at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
09-30 09:36:52.482: W/System.err(14665):    at libcore.io.IoBridge.connect(IoBridge.java:112)
09-30 09:36:52.482: W/System.err(14665):    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
09-30 09:36:52.482: W/System.err(14665):    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
09-30 09:36:52.482: W/System.err(14665):    at java.net.Socket.connect(Socket.java:872)
09-30 09:36:52.482: W/System.err(14665):    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
09-30 09:36:52.482: W/System.err(14665):    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
09-30 09:36:52.482: W/System.err(14665):    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
09-30 09:36:52.482: W/System.err(14665):    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
09-30 09:36:52.482: W/System.err(14665):    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
09-30 09:36:52.482: W/System.err(14665):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:591)
09-30 09:36:52.482: W/System.err(14665):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:510)
09-30 09:36:52.482: W/System.err(14665):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:488)
09-30 09:36:52.482: W/System.err(14665):    at com.example.emmtec.FirstScreen.StoreKlantInDatabase(FirstScreen.java:272)
09-30 09:36:52.482: W/System.err(14665):    at com.example.emmtec.FirstScreen$10$2.onClick(FirstScreen.java:236)
09-30 09:36:52.482: W/System.err(14665):    at android.view.View.performClick(View.java:3538)
09-30 09:36:52.492: W/System.err(14665):    at android.view.View$PerformClick.run(View.java:14330)
09-30 09:36:52.492: W/System.err(14665):    at android.os.Handler.handleCallback(Handler.java:608)
09-30 09:36:52.492: W/System.err(14665):    at android.os.Handler.dispatchMessage(Handler.java:92)
09-30 09:36:52.492: W/System.err(14665):    at android.os.Looper.loop(Looper.java:156)
09-30 09:36:52.492: W/System.err(14665):    at android.app.ActivityThread.main(ActivityThread.java:4977)
09-30 09:36:52.492: W/System.err(14665):    at java.lang.reflect.Method.invokeNative(Native Method)
09-30 09:36:52.492: W/System.err(14665):    at java.lang.reflect.Method.invoke(Method.java:511)
09-30 09:36:52.492: W/System.err(14665):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-30 09:36:52.492: W/System.err(14665):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-30 09:36:52.492: W/System.err(14665):    at dalvik.system.NativeStart.main(Native Method)

Thanks in advance!

A: Android does not support network operation on main/worker thread to HoneyComb and later versions. So perform network operation on other thread then main thread.
AsyncTask is a good option for performing that.

A: Use AsyncTask to do network operations...
Another Solution is add below lines in your code above your network operation code
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);

A:
09-30 09:36:52.452: W/System.err(14665): android.os.NetworkOnMainThreadException

You're doing a network request on the main thread which is not supported by the Android Version you're using.
You can use an AsyncTask to make any network requests using the UI thread. The Android Developer Page gives a very good example of how to use it.
Now why to use an AsyncTask ?
Assuming we are doing network operation on a button click in our application. On button click a request would be made to the server and response will be awaited. Due to single thread model of android, till the time response is awaited our screen is non-responsive. So we should avoid performing long running operations on the UI thread. This includes file and network access.
You'll need to create a private class inside your Activity. Then create a Object of the AsyncTask Class inside your button click listener and execute.
BTNtoevoegen.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                    asyncTask task = new asyncTask();
                    task.execute(url1);
                }
        });

You might also want to show ProgressDialogs while making the network request. You can handle that in the onPreExecute() and onPostExecuteMethod().
You can check out an implementation here :
https://github.com/vshivam/privly-android/blob/master/src/ly/priv/mobile/Login.java#L184


text:
Q: Cannot install autotest-fsevent or rs-fsevent; getting ld error but xcode is installed Here's what I'm getting:

$ sudo gem install autotest-fsevent
  Password: Building native extensions.
  This could take a while... ERROR:
  Error installing autotest-fsevent:
  ERROR: Failed to build gem native
  extension.
/Volumes/SSD/Users/Ross/.rvm/rubies/ruby-1.9.2-p136/bin/ruby
  extconf.rb ld: can't open output file
  for writing: /Volumes/Macintosh
  HD/Users/Ross/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/gems/1.9.1/gems/autotest-fsevent-0.2.4/bin/fsevent_sleep,
  errno=2 collect2: ld returned 1 exit
  status extconf.rb:30:in `':
  Compilation of fsevent_sleep failed
  (see README) (RuntimeError)

The README says this:

TROUBLESHOOTING:
Compilation of fsevent_sleep Failed
Make sure you have Xcode (Mac OS X
  Development Suite) installed.

I have installed the latest xcode and even re-installed it just in case something was missing.
Anyone know how to at least troubleshoot this further.  I did hear some someone it it could be path related.  But here's the information on the path. I have two drives in the machine, an SSD with the OS on it and a HDD with all my data. I have a symlink on the SSD for my home directory so /Volumes/SSD/Users/Ross/ points to /Volumes/Macintosh HD/Users/Ross
Is that the issue? Is the space in the Volume name an issue maybe?  How could I get around this?

A: Have a look at Zen Spiders Blog. A lot has changed when it comes to Autotest and Growl. I normally simply add this to my Gemfile (or rvmsudo gem install) depending on?
  gem "ZenTest"
  gem "autotest-rails-pure"
  gem "autotest-growl"
  gem "autotest-fsevent"

Then add the following to .autotest
  require 'autotest/growl'
  require 'autotest/fsevent'

Let us know how you get on. All the Best. Remember when you are using RVM you do not SUDO anything. If permissions are denied then simply use RVMSUDO GEM INSTALL.


text:
Q: KeyError when trying to access column of a Pandas DataFrame This is the first time I used stackoverflow so please forgive me if my question doesn't not follow proper conventions.
I'm trying to create a function to find the station with the maximum riders on the
first day, then return the mean riders per day for that station. Also
return the mean ridership overall.
However, when I executed the following codes, a KeyError Exception was raised as below. Please advise what went wrong. Thank you very much!
import pandas as pd

def mean_riders_for_max_station(ridership_df):

    overall_mean = ridership_df.mean()

    max_station = ridership_df.iloc[0].argmax()
    mean_for_max = ridership_df[max_station].mean()
    return (overall_mean, mean_for_max)

ridership_df = pd.DataFrame(
    data=[[   0,    0,    2,    5,    0],
          [1478, 3877, 3674, 2328, 2539],
          [1613, 4088, 3991, 6461, 2691],
          [1560, 3392, 3826, 4787, 2613],
          [1608, 4802, 3932, 4477, 2705],
          [1576, 3933, 3909, 4979, 2685],
          [  95,  229,  255,  496,  201],
          [   2,    0,    1,   27,    0],
          [1438, 3785, 3589, 4174, 2215],
          [1342, 4043, 4009, 4665, 3033]],
    index=['05-01-11', '05-02-11', '05-03-11', '05-04-11', '05-05-11',
           '05-06-11', '05-07-11', '05-08-11', '05-09-11', '05-10-11'],
    columns=['R003', 'R004', 'R005', 'R006', 'R007']
)

print(mean_riders_for_max_station(ridership_df))

I received the following Error message:
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
   2894             try:
-> 2895                 return self._engine.get_loc(casted_key)
   2896             except KeyError as err:

pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 3

The above exception was the direct cause of the following exception:

KeyError                                  Traceback (most recent call last)
<ipython-input-23-60b53dc0106e> in <module>
     37 )
     38
---> 39 mean_riders_for_max_station(ridership_df)

<ipython-input-23-60b53dc0106e> in mean_riders_for_max_station(ridership_df)
     17
     18     max_station = ridership_df.iloc[0].argmax()   #difference between argmax() for an array (--returning a location)
---> 19     mean_for_max = ridership_df[max_station].mean() #and argmax() for a series: returning index (or column name of the dataframe)
     20     return (overall_mean, mean_for_max)
     21

~\anaconda3\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
   2900             if self.columns.nlevels > 1:
   2901                 return self._getitem_multilevel(key)
-> 2902             indexer = self.columns.get_loc(key)
   2903             if is_integer(indexer):
   2904                 indexer = [indexer]

~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
   2895                 return self._engine.get_loc(casted_key)
   2896             except KeyError as err:
-> 2897                 raise KeyError(key) from err
   2898
   2899         if tolerance is not None:

KeyError: 3

A: The argmax() method of a pandas Series returns the position of the maximum value (as in integer index in the array).
What you want is max_station = ridership_df.iloc[0].idxmax().
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.argmax.html

A: max_station will be 3, but ridership_df[max_station] will give a key error since there is no column name 3.


text:
Q: Get categories, cache problem with getStoreCategories I have two different template blocks (extends Mage_Core_Block_Template). Both query some categories.
First:
    $_helper = Mage::helper('catalog/category');
    $children = $_helper->getStoreCategories(false, true, false)
        ->addAttributeToSelect('product_slider')
        ->addAttributeToFilter('product_slider', array('neq' => ''))
        ->addOrderField('product_slider')
        ->addOrderField('name');

Second:
    $children = $_helper->getStoreCategories(false, true, false)
        ->addAttributeToSelect('themen_teaser')
        ->addAttributeToSelect('thumbnail')
        ->addAttributeToFilter('themen_teaser', array('neq' => ''))
        ->addOrderField('themen_teaser')
        ->addOrderField('name');

Problem is that first query is cached and second query returns the same values. You can see the caching in getStoreCategories().
How do I get those categories?

A: Ah got it. Use
$children = Mage::getModel('catalog/category')->getCollection()
->...

Instead of
$_helper = Mage::helper('catalog/category');
$children = $_helper->getStoreCategories(false, true, false)
->...


text:
Q: Unknown threads in Java and JavaFX I have 5 threads in my application.
I am suprise to have so many of them because I though I will have only a main thread and a JavaFX thread for the UI.
Could you tell me what are the 3 other threads ?
Thread [main]
Deamon Thread [QuantumRenderer-0]
Deamon Thread [Thread-1]
Thread [JavaFX Application Thread]
Thread [JavaFX-Launcher]

Thank you in advance,
Edit:
My environment is Eclipse Luna. I am running the application in Eclipse debug.
I have other thread that I am starting myself that I am not writting in the list.

A: Thread [main] - The thread that invoked main(), essentially the thread that started your java application. Every java application has this thread at the very least.
Deamon Thread [QuantumRenderer-0] - Extract from Oracle documentation

Quantum Toolkit ties Prism and Glass Windowing Toolkit together and
  makes them available to the JavaFX layer above them in the stack. It
  also manages the threading rules related to rendering versus events
  handling.

Deamon Thread [Thread-1] - The name suggests that it might be a user thread or some internal thread, someone just forgot to properly name it, as far as I'm concerned Thread-# is the default name.
Thread [JavaFX Application Thread] - This is the JavaFX UI Thread, all running JavaFX applications will have this. Any changes to JavaFX UI must be done on this thread
Thread [JavaFX-Launcher] - The 'main' thread doesn't start JavaFX applications directly. They are instead started on this thread.


text:
Q: list(of byte) to Picturebox I have a jpeg file that is being held as a list(of Byte)
Currently I have code that I can use to load and save the jpeg file as either a binary (.jpeg) or a csv of bytes (asadsda.csv).
I would like to be able to take the list(of Byte) and convert it directly to a Picturebox without saving it to disk and then loading it to the picturebox.
If you are curious, the reason I get the picture file as a list of bytes is because it gets transfered over serial via an industrial byte oriented protocol as just a bunch of bytes.
I am using VB.net, but C# example is fine too.

A: You could do this:
   var ms = new MemoryStream(byteList.ToArray());
   pictureBox.Image = Image.FromStream(ms);

A: The Image class has a FromStream method and you can create a MemoryStream from a byte array.  So:
MemoryStream ms = new MemoryStream(byteList.ToArray());
Image image = Image.FromStream(ms);

A: What you need to do is take the bytes and read them into a stream.  You can then use the stream to load the picture box image.
using( MemoryStream ms = new MemoryStream( byteList.ToArray() ) )
{
   this.pictureBox1.Image = Image.FromStream( ms );
}


text:
Q: How can I save the fatalError message to the iOS crash log? I have an iOS application written in Swift 2 in Xcode 8.2.1, that's built for iOS 10.2.
I've had a number of crash reports from TestFlight and despite symbolication, none of the crash logs show any program state besides the stack-traces (no argument values, no locals, no heap objects, etc).
...but inside those functions I can see code which is likely to fail (e.g. a forced unwrap) but the crash log isn't telling me where or why it's failing.
When debugging in Xcode, I can use fatalError(message: String) where I can put my own message like "functionFoo returned nil" or "variable bar == \"" + bar + "\"", except when deployed using TestFlight or the App Store the fatalError will be hit and the program terminates, but the message value is not saved to the crash log, making it pointless.
In other environments, like C#/.NET and Java I can simply throw new SomeExceptionType("my message") and all information is available in whatever global catch(Exception) handler I have.
How can I achieve the same goal in iOS / Swift?

A: Swift does support error handling. You can create your own error type by confirming to Error protocol or use existing error types and then throw an error by invoking throw error.
But Swift forces you add error handling to any code that can throw an error. There are multiple way you can handle error in swift.

*

*Apply throws keyword to your function, this indicates that the function can throw an error when invoked and the error should be handled by the caller.
func canThrowErrors() throws -> String

*When invoking methods with throws keyword you have to add try keyword at the beginning of the invocation. All these try invocations should be handled either by applying throws to method to just propagate the errors or wrapping inside a do-catch block:
do {
    try canThrowErrors()
    try canThrowOtherErrors()
} catch is SpecificError {
    // handling only specific error type
} catch let error as SpecificError {
    // catches only specific error for type
} catch {
    // catches all errors
}

*Additionally you can use try? and try! for throwing function invocation to disable error propagation and retrieve optional result that returns nil in case of error and runtime assertions respectively.
By forcing you to handle all the errors at compile time swift avoids any undefined runtime behavior and debugging nightmare.
I would suggest to use fatalError or any other runtime assertion only if scenarios when there is no way to recover from a state without crashing the app. Unfortunately, there is no way to handle errors from fatalError as its use is only reserved for such scenarios only. Also, in your crashlog you will only get the line number that caused the crash to get additional info for the cause of crash I would suggest to use custom logging or analytics.


text:
Q: Avoid page refresh I have to avoid page refresh. Every time I click the submit button, page is refreshed. How do I avoid that?
protected void Button1_Click(object sender, EventArgs e)
{
    string firstname = DropDownList1.SelectedItem.Text;

    if (firstname == "All")
    {
        da = new SqlDataAdapter(query, con);
    }

    dt = new DataTable();
    dt = ds.DataTable1;
    da.Fill(dt);
    rdc.Load(Server.MapPath("CrystalReport.rpt"));
    rdc.SetDataSource(ds);
    CrystalReportViewer1.ReportSource = rdc;
    CrystalReportViewer1.RefreshReport();
}

A: I would suggest putting everything that needs to be updated in an <asp:UpdatePanel>.
You can find that control in the Ajax Control Toolkit
You will also have to add a <asp:ScriptManager> on top of your page.

A: if you do not want a full page refresh either use UpdatePanel for partial rendering or proper ajax approach.
the way you are doing now with a server side button click is the slowest and generates a full page postback and refresh unless you use an UpdatePanel at minimum.
check here for a discussion on how to use the Crystal Report viewer with Ajax: using AJAX with crystal report viewer


text:
Q: PHP try-catch supports short notation? Is this legal? Not near my work computer so can't test
try
    someClass::someStaticFunction();
catch(Exception $e)
    $e->getMessage();

Specifically the lack of brackets, similar to an if-else statement
if(someBool)
    someClass::someStaticFunction();
else
    someClass::someOtherFunction();

Cheers!

A: No you must use the brace brackets. Note that you can catch exceptions by type :
try {
  someClass::someStaticFunction();
} catch (MyException $e) {
  // do specific stuff for this exception
} catch (Exception $e) {
  // do stuff for other exceptions
}

A: No, doesn't seem like it works.
Check my example here: http://codepad.org/BpSBiPDY

A: No it isn't, there's no alternative syntax for try/catch... it's only 8 characters plus the Exception $e... that's not exactly long

A: try-catch require mandatory brackets in all the languages that I know (C#, JavaScript, etc.);
I think the reason is to avoid since the begin the (little or big) mess up that come, for example, from the if() construct because it supports the lack of brackets AND the OPTIONAL else part;
for example, in the code:
if(a==0) if(b==3) ++a; else ++b;

to which if() is referring the else part?
We all surely know that, in the above code, the else part refer to the 2nd if() (the nearest if()), but sometime it make confusion when you are fast typing code (or fast checking code that is already typed), and all know this too.
So, because in try catch (and finally), the catch and the finally parts are optional, and the catch part can even be repeated (I mean, you may put more catch parts for different kind of errors to be caught), I think the designers of the languages wanted to avoid since the begin the potentially ambiguities that can come from the missing of brackets is some critical cases.


text:
Q: How to get a trigger when a Google app is deleted by a domain This query is related to Google Apps. Is there a way we can get a trigger or a callback or force the user to visit a page from my app when user deletes my app from his domain?
I want to perform some operations when a user deletes the app from his domain.
Please help.

A: No. Mappings are completely independent of the app - they just 'point' at it. You can't get notifications when a user adds or deletes them.

A: The license notifications API allows you to retrieve a list of license-related events that have occurred for customers of your application. These events may be of four types:
provisions — A new license of the application has been provisioned.
expiries — A license of the application has expired.
deletions — An application has been deleted from a domain.
reassignments — An administrator has assigned or revoked a seat license for the application on the provided domain.
The license notification API allows several optional parameters:
timestamp — The time, measured in milliseconds since the UNIX epoch, to begin querying for notifications. The API will return results that occurred approximately after this time, but occasionally may return results that occurred prior to the timestamp. If you must have a list of notifications that only contains results after the timestamp, it is recommended that you apply a second filter in your code. The timestamp may not be used simultaneously with a start-token.
start-token — A continuation token, returned from a previous query, that may be used to continue retrieving notifications after the previous result set stopped. The start-token may not be used simultaneously with a timestamp.
max-results — The maximum number of notifications to return.
For a complete description of all response fields and possible values for those fields, see the reference.
For more : http://code.google.com/googleapps/marketplace/v2/developers_guide.html#license_notifications


text:
Q: remove end-of-line comments unless quoted I need a Perl regex to remove end-of-line comments. I feel like I've Googled around for this and couldn't find just the right thing. Here are the details:
EOL comment is indicated using a pound sign (#)
Anything can be quoted using vertical bars (|)
So the following has a comment:
foo bar #baz

But the following doesn't:
foo |quoted###with bars|

The following has a comment and a quote that contains the comment character:
foo |quoted###with bars| #comment here

The first thing I tried was s/#(?=[^|]*$).*$//, which unfortunately removes quoted pounds. The next thing that doesn't work is /#(?=[^|]*$).*$//, because it fails on multiline quotes, like the following:
foo |quote begins here ##still going
        ##and it's still going| #this is a quote, though.

I feel like I may be able to glean something from the regex for C/C++ comments in perlfaq6, but it's too complicated for me grab just the stuff I need (don't need multiline comments;).
Can anyone provide a regex which removes EOL comments but ignores quoted comment characters?

A: One approach:

s/(\|[^|]*\|)|#.*/$1||''/eg

This replaces |...| (including |...#...|) with itself, and #... with nothing.

A:   private static int find(String s, String t, int start) {
    int ret = s.indexOf(t, start);
    return ret < 0 ? Integer.MAX_VALUE : ret;
}

private static String removeLineCommnt(String s) {
    int i, start = 0;
    while (0 <= (i = find(s,"//", start))){ //Speed it up
        int j = find(s,"'", start);
        int k = find(s,"\"", start);
        int first = min(i, min( j, k));
        if (first == Integer.MAX_VALUE) return s;
        if (i == first) return s.substring(0, i);
        //skipp quoted string
        start++;
        if (j == first) { // ' asdasasd '
            for (int p = s.indexOf("\\'", start); p >= 0; p = s.indexOf("\\'", start)) {
                start += 2;
            }
            start = s.indexOf("'",start);
            if (start < 0) return s;
            start++;
            continue;
        }
        // " asdasdasd "
        for (int p = s.indexOf("\\\"", start); p >= 0; p = s.indexOf("\\\"", start)) {
            start += 2;
        }
        start = s.indexOf("\"", start);
        if (start < 0) return s;
        start++;
    };
    return s;
}

private static String removeLineCommnts(String s) {
    if (!s.contains("//")) return s; //Speed it up

    return Arrays.stream(s.split("[\\n\\r]+")).
            map(CommonTest::removeLineCommnt).
            collect(Collectors.joining("\n"));
}


text:
Q: Byte and Bit addressable 8051 8051 SFRs
'P0,SP, DPL & DPH' have their byte addresses 80h,81h,82h,83h. Since P0 is bit addressable, P0.0 - P0.7 has bit addresses 80h - 87h. But, how it's gonna distinguish the addresses P0.1(81h) & SP(81h), P0.2(82h) & DPL(82h), P0.3(83h) & DPH(83h) …?

A: Byte addresses and bit addresses are never used in the same instruction.
So while
mov SP, #5    ; mov 81h, #5
mov P0.1, C     ; setb 81h

both have the address 81h and both are written as mov, the first one is assembled as 0x75 0x81 0x5 and the second 0x91 0x81. To the processor, 0x75 and 0x91 mean entirely different things, namely, move the the value in the 3rd byte of this instruction to the address in the second byte of this instruction, and move the carry flag to the bit address in the second byte of this instruction. The assembler knows that mov addr, #imm and mov bit, C need to be encoded differently, and the processor really doesn't care how they're written because it doesn't see the source code at all.


text:
Q: order by 1.99.10 and 1.99.9 sql server Sorry about my mistake, I should provide the real sample for the question, my ID included characters inside:
sample code:
select ID from student order by ID

Expected output from mine          but system output
-------------------------          -----------------
JAD.1.99.9                             JAD.1.99.10
JAD.1.99.10                            JAD.1.99.9

and this ID is of nvarchar type.

A: Yesterday there was a similar question where i have learned that you can use hierarchyid for version sorting(if you use at least SQL-Server 2008):
SELECT id
FROM   student
ORDER  BY Cast('/' + Replace(id, '.', '/') + '/' AS HIERARCHYID)

DEMO

A: You need to order by the substring of the part after any dot. This is going to be a DB specific SQL query and since you didn't mention which one you're using I can't give a detailed SQL example.
This is how you can cast a decimals values
http://www.w3resource.com/sql/aggregate-functions/avg-decimal-places-using-cast-within-avg.php
The answer from Tim is best..
But I am giving one more solution for order varchar values --
SELECT id
FROM   student
ORDER  BY ID desc


text:
Q: Android Studio Logcat not showing anything I implemented all techniques using stackoverflow but none of them worked for me.
i have android studio version 2.2.i have enable adb integration as well as DDMS setting etc all solutions. i restarted logging and restart app,Android studio and Laptop restart as well but  nothing worked for me. i am attaching my error dialog Verbose and info images with this post.

A: In my case it was not an android studio problem but a phone problem - try to restart your phone or emulator.

A: Kill ADB from Task Manger, And run an application and check filter as 'Show only selected application' in Android monitor.

A: I have solved this issue by enabling "Use libusb backend" option in Android Studio -> Preferences -> Debugger -> Android Debug Bridge (adb).

A: I have solved that issue through applying no filter at filter section.

A: *

*File ->Invalidate Cache
2.Restart your phone or emulator

*Run. It should work

A: For me simply restarting Android Studio solved the issue. I was even able to see the logs which were hidden to me previously.

A: In my case it was solved by simply deattaching and attaching my mobile phone and hope so this will work for all of you

A: In my case i was using Log methods without properly initializing the TAG parameter.


text:
Q: (ReactJS-Laravel) JWT Authentication Header (Getting User Information) I'm currently on the page of login, How to get the token information that i need to send it to the header? badly i got error (CORS)

Failed to load http://127.0.0.1:8000/api/auth/me?token=: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.

Installation: I already install npm install cors --save
Target Goal: How to get the email,name of user who login
I already store the token to the localstorage however I don't know how to get the Bearer of that token, I have here my function
componentDidMount()
{

    let token = localStorage.getItem("token");

    let url = 'http://127.0.0.1:8000/api/auth/me?token=';

    const headers = {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'Authorization': 'Bearer ' + token
    }

    axios.post(url,{headers:headers}).
    then(response => {
        console.log(response);
    })

}

In my Postman (I try to watch youtube and I got this as result in my body)
 {
        "id": 1,
        "name": "testuser",
        "role": 2,
        "email": "content@gmail.com",
        "created_at": "2018-05-23 15:28:47",
        "updated_at": "2018-05-23 15:28:47",
        "Status": "Active"
    }

A: *

*First thing : CORS at your client is a good choice, but I suggest using https://github.com/barryvdh/laravel-cors, it's save your time and make easy to config because you are using Laravel.

*Second thing : axios.defaults.headers.Authorization is a good way to add Bearer into your request. Check it out at : https://github.com/axios/axios.


text:
Q: Theming Material Light I've been trying to port my website https://lavanoid.github.io to a more "Google Standard" but it's been really frustrating (thanks to Google, not well documenting stuff, as far as I can see :/).
I've been trying to theme this template: https://github.com/google/material-design-lite/tree/master/templates/text-only  but it isn't going so well. I can't even find how to change the color, which is the most important part.
So, how do I change the purple color to the hex value of #2196f3 ?
Any help would be appreciated. Thanks!

A: Looks like you would need to change:
.mdl-color--primary {
    background-color: #5e35b1 !important;
}

To this:
.mdl-color--primary {
    background-color: #2196f3 !important;
}


text:
Q: JQuery addClass not working properly $("div#pay-by-this-method ul li a").click(function(){
  $("div#pay-by-this-method ul li").removeClass("selected");
  $(this).parent("li").addClass("selected");
});

Credit/Debit Card

Net 30 Account

This function applies to two links. The first link is chosen by default and has the 'selected' class already chosen. The removeClass works when I click the other link, but addClass does not fire for the other link, nor when i click the first link again (it should).
I don't see any reason why this function would not be working, there's not much to it. Am I missing something here?
BTW, there is more code (an if else statement I can't post publicly) inside the function as well that is working just fine. i can fire alerts and pretty much do anything else in this function and it works perfectly. The removeClass works fine, too, it's just the addClass that isn't firing.

A: You may want
$(this).closest('li').addClass('selected');

The ".parent()" function only applies to the direct parent of an element, and when you pass it a selector that doesn't match the actual parent you get an empty jQuery list.  The ".closest()" function finds the first ancestor that matches the selector, no matter how far up the DOM it is.


text:
Q: Como fazer essa busca de Query? Estou tentando desenvolver um webService Rest no Netbeans(Java).Para tal segui esse tutorial...
https://rafaelsakurai.gitbooks.io/desenvolvimento-distribuido/content/chapter10.1.html
Porem, na hora de rodar eu tenho um erro:

Eu depurei o projeto e encontrei o ponto de erro.Eu só não sei como resolver(todo meu conhecimento relacionado a webService vem do próprio tutorial).
O ponto de erro:
Classe DAO
public class PalestraDAO {
    private EntityManager em;

    public PalestraDAO(EntityManager em) {
        this.em = em;
    }

     public List<Palestra> consultarTodos() {
            Query q = em.createNamedQuery("TipoProduto.consultarTodos"); //<- Linha de erro
            return q.getResultList();
     }
}

Classe Entidade
@Entity
@NamedQueries({
    @NamedQuery(name = "TipoProduto.consultarTodos",
            query = "SELECT tpprod_nome FROM tipoproduto ORDER BY tpprod_nome")

        //String sql = "select tpprod_id, tpprod_idExt, tpprod_nome, tpprod_descricao, tpprod_imagem, tpprod_visibilidade, tpprod_configurado, tpprod_imagem64 from tipoproduto order by tpprod_nome;";

})
@SequenceGenerator(name = "tipoProduto_seq", sequenceName = "tipoProduto_seq", allocationSize = 1, initialValue = 1)

public class TipoProduto implements Serializable {

    private static final long serialVersionUID = -2806694270931063283L;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE,
      generator = "tipoProduto_seq")
    //private Long idEntidade;

    private int id;
    private int idExt;
    private String nome;
    private String descricao;
    private int imagem;
    private boolean visibilidade;
    private boolean configurado;
    private String imagem64;

    public boolean isConfigura() {
        return configurado;
    }

    public void setConfigura(boolean configura) {
        this.configurado = configura;
    }

    public String getImagem64(){
        return imagem64;
    }

    public int getId() {
        return id;
    }

    public void setImagem64(String imagem64){
        this.imagem64 = imagem64;
    }
    public void setId(int id) {
        this.id = id;

    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public int getImagem() {
        return imagem;
    }

    public void setImagem(int imagem) {
        this.imagem = imagem;
    }

    public boolean isVisibilidade() {
        return visibilidade;
    }

    public void setVisibilidade(boolean visibilidade) {
        this.visibilidade = visibilidade;
    }

    public int getIdExt() {
        return idExt;
    }

    public void setIdExt(int idExt) {
        this.idExt = idExt;
    }

}

A: Mas tá subindo a aplicação?
A @NamedQuery ainda tá errada.
@NamedQuery(name = "TipoProduto.consultarTodos",
        query = "SELECT tpprod_nome FROM tipoproduto ORDER BY tpprod_nome")

Deveria ser
@NamedQuery(name = "TipoProduto.consultarTodos",
        query = "SELECT tpprod.nome FROM tipoproduto tpprod ORDER BY tpprod.nome")


text:
Q: Boosting matched documents in Elasticsearch which have a certain tag I have an index of documents that look this:
{
    url: "/foo/bar",
    html_blocks: [
       "
hi
"
    ],
    tags: [
        "video",
        "text"
    ],
    title: "My title"
}

I'd like to query these documents on the title and html_blocks fields, and for any matches add a boost if they have a video tag.
So far, my query looks like this:
{
    "query": {
        "query_string": {
            "query": "foo",
            "fields": [
                "title",
                "html_blocks"
            ]
        }
    }
}

How do I modify it so that it continues to only return results if a match is found in the existing query, but a boost is added to any of the results which have a video tag? Thanks!

A: You want a custom_filters_score which will just boost on matches. Note that filter input is not analyzed, so you might wrap that in a query if you need it analyzed. Your other options to boost, while not really for this case are the boosting query, which is good for demoting results and the custom_score_query which is good for added boosts based on some calculated value.
See: Custom_filters_score
{
    "query": {
        "custom_filters_score": {
            "query": {
                "query_string": {
                    "query": "foo",
                    "fields": [
                        "title",
                        "html_blocks"
                    ]
                }
            },
            "filters": [
                {
                    "filter": {
                        "term": {
                            "tags": "video"
                        }
                    },
                    "boost": 3
                }
            ]
        }
    }
}

Edit:
This is what I mean by wrapping in a query using a filter query. Trust me, once you get the hang of ES, you'll be nested so knee deep that you'll produce some of the most satisfying queries ever.
{
    "query": {
        "custom_filters_score": {
            "query": {
                "query_string": {
                    "query": "foo",
                    "fields": [
                        "title",
                        "html_blocks"
                    ]
                }
            },
            "filters": [
                {
                    "filter": {
                        //here comes the filter query, and I changed term to match
                        //since match analyzes
                        "query":{
                            "match": {
                                "tags": "video"
                            }
                         }
                    },
                    "boost": 3
                }
            ]
        }
    }
}


text:
Q: open firewall for multiple IPs I am trying to give the following IPs access t0 post data to mysql installed on VM google cloud (drupal8) i cannot figure out how to write the format correctly. error Invalid IP address or range. Use CIDR notation and enter the lowest IP address in the subnet.
174.129.249.162|65.17.248.|68.71.103.|184.73.155.222|184.72.56.152|184.72.56.199|184.73.192.230|184.169.131.85|52.0.132.63|52.71.25.2|52.71.19.16|52.71.25.60|52.71.25.97|52.11.235.107|52.35.106.209|52.32.146.111|52.25.210.125|52.33.176.145

A: The format should be 174.129.249.162/32 184.73.155.222/32 etc


text:
Q: How to run separate threads in pygtk I have a pygtk application which runs as soon as my python script is opened. Along with gtk.main() I have a thread which is started at the beginning of the script, which refreshes a gtk.TextView() instance:
def listen(self):
    while True:
        print "refreshing"
        data = self.socket.recv(buffer_size)
        if data:
            self.txtBuffer.insert(self.txtBuffer.get_end_iter(), data + "\n")
            print data

thread.start_new_thread(self.listen, ())
self.set_up_gui() # gtk.main()

However, when I run the program, the gui opens, but no "refreshing" text is printed, nor is any data printed when sent to the socket. I have attempted to use glib.add_idle() to thread this program, however that only runs the separate thread when the gui is idle (which is infrequent). Thank you!

A: You are accessing the text buffer from a different thread without any synchronization, which is unsupported. To fix that, replace self.txtBuffer.insert(...) with gobject.idle_add(lambda: self.txtBuffer.insert(...)). That tells the GUI thread to update the text buffer at the next main loop iteration, which is guaranteed to work without explicit synchronization.
You should make sure that the GUI thread  is not blocked, i.e. that it's running gtk.main() and only processing GUI updates such as the above textBuffer.insert. Long-running/blocking tasks should be delegated to other threads or processes, as your code already tries to do. When this is implemented, GUI updates will appear to happen instantaneously.
See this answer for additional details on PyGTK and threading.


text:
Q: Get Page Title In Master Page Code Behind I want to get the page title in c# master page code behind.
I tried using Page.Header.Title; property but it return null.
Please help me to get the title.
Thanks in advance.
Shibin V.M

A: You can set the page title on Page_Load Event like this
protected void Page_Load(object sender, EventArgs e)
 { Page.Title = "Page Title"; }

and get the page title using
string title = Page.Title;

A: try this in your master page
string Title = "Your Site: " + this.Page.Title;

A: Set Title attribute of content pages <%@ Page Title="Contact us" ../> and handle the Master page's Load or Init event to get Page.Title or Page.Header.Title.

A: In your page head include runat="server" then you can easily get the Page title by
string Title = Page.Title;

EDIT:
Using the Title property of Page requires a header control on the page. (e.g. ).

A: Use this in your html tag, it has worked for me <%: Page.Title %>.
For eg:
<%: Page.Title %>
.


text:
Q: Merge two sets of returned json data for loop Is it possible to merge two sets of data data.posts and data.comments so they all come under response in my loop?
    success: function(data) {
    datas =  data.posts;
    datas =  data.comments;
    $.each(datas, function(i, response) {
    )}
    }

A: Of course:
success: function(data) {
var datas = {};
datas =  data.posts;
datas =  data.comments;
for (var postIndex in data.posts) {
    datas[postIndex] = data.posts[postIndex];
}
for (var commentIndex in data.comments) {
    datas[commentIndex] = data.comments[commentIndex];
}
$.each(datas, function(i, response) {
)}
}

But you must know that if posts and comments have some similar keys, the latter will overwrite the former in the merge result. If you are not ok with that, then please add more information.


text:
Q: Не обновляется вся строка в PostgreSQL через Hibernate + JSON PUT-запросом передаётся 1 объект JSON для обновления всей строки, которая уже есть в БД PostgreSQL, на новую с обновленными данными. Появляется ошибка:
org.hibernate.property.access.spi.PropertyAccessException: Error accessing field [private java.lang.Long com.av.model.CnflEmp.rowId] by reflection for persistent property [com.av.model.CnflEmp#rowId] +
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Long field com.av.model.CnflEmp.rowId to com.av.model.CnflEm
Интересно то, что при использовании RESTEasy такой ошибки не было и строка в БД обновлялась! Все GET запросы работают корректно. Частично обновлять столбцы нельзя.
Использую:
Spring-Boot (2.7.0.),
Hibernate (5.6.5.Final),
PostgreSQL (42.3.5),
Postman
Классы и поля в БД (ошибка на 80 строке):

A: День мучений, а надо было всего лишь удалить в pom.xml зависимость spring-boot-devtools


text:
Q: Lim $x^{(x^x)}$ as $x$ approaches zero from the right I tried this problem and I first found the lim of $x^x$ as $x$ approaches zero from right to be 1 (I did this by re-writing $x^x$ as an exponential) and when I repeated the same process to find lim of $x^{(x^x)}$, I found 1 again but the final answer should be ZERO. Could I have an explanation on why it's a zero?

A: Using $\lim_{x\to 0^+}x^x = 1$, we have:
$$\lim_{x\to 0^+}x^{(x^x)} = 0^1 = 0.$$

A: Note that
$$x^{x^x}=e^{x^x\log x}\to0$$
indeed
$$x^x\log x\to -\infty$$

A: As $x\to 0^+$, we see $x^x\to 0^0$, which evidence suggests is $1$ for $x \in \Bbb R$.
Thus for $x^{x^x}$, as $x\to 0^+$ we get $0^1$, which is certainly $0$.
Incidentally, this implies that the limit of $x^{x^{x^x}}=1$, and $x^{x^{x^{x^x}}}=0$, etc...
Graphed for your perusal here


text:
Q: Plotly Express bar chart fails with datetime as x axis input I am desperately trying to find a solution for creating a bar chart with plotly express and datetime values as x axis input. The graph is created but remains empty. Without determining the axis I get a proper graph. Does anyone know a solution for that?
import plotly.express as px
print(type(df.index))

fig = px.bar(df, x=df.index, y=df['moneyness'])
fig.show()

My dataframe looks like the following:
 {'trade_seq': {Timestamp('2022-01-01 00:16:21.725000+0000', tz='UTC'): 3,
  Timestamp('2022-01-01 00:19:23.104000+0000', tz='UTC'): 227,
  Timestamp('2022-01-01 00:23:27.841000+0000', tz='UTC'): 228,
  Timestamp('2022-01-01 00:28:56.438000+0000', tz='UTC'): 183,
  Timestamp('2022-01-01 00:43:06.220000+0000', tz='UTC'): 184},
....
'moneyness': {Timestamp('2022-01-01 00:16:21.725000+0000', tz='UTC'): -4310.019999999997,
  Timestamp('2022-01-01 00:19:23.104000+0000', tz='UTC'): 761.9400000000023,
  Timestamp('2022-01-01 00:23:27.841000+0000', tz='UTC'): 631.0899999999965,
  Timestamp('2022-01-01 00:28:56.438000+0000', tz='UTC'): -355.2699999999968,
  Timestamp('2022-01-01 00:43:06.220000+0000', tz='UTC'): -646.7200000000012}}


text:
Q: how solve ERROR: No reverse DNS (PTR) entries. The error MX records are: i have remote access to my windows server 2008 r2(DNS-IIS-FTP-MAIL),
please see the link below for my web site :
http://www.intodns.com/polyafzar.com
how can i fix the error below in my server :

ERROR: No reverse DNS (PTR) entries. The problem MX records are:
  234.60.7.31.in-addr.arpa -> no reverse (PTR) detected
  233.60.7.31.in-addr.arpa -> no reverse (PTR) detected
  You should contact your ISP and ask   him to add a PTR record for your ips

thanks in advance

A: Just like it says:

"You should contact your ISP and ask him to add a PTR record for your
  ips"

You have to get whomever looks after your hosting to provide rDNS records in order to eliminate this error.

A: If you are using DigitalOcean VPS, the solution is this below:
Reverse DNS (PTR) records are automatically created based on the name that you give your droplet in the Control Panel. If you want to rename a droplet, go to its page in the Control Panel, click directly on the existing Droplet name, and enter a new name there.
There are two things to keep in mind. That new name has to be a fully-qualified domain name - that means that example.com will generate a valid PTR record, but a name like my-ubuntu-droplet will not generate a PTR record. Also, if you're using IPv6 on your droplet, a PTR record will only be generated for the first IPv6 address assigned to the droplet, not all 16 IPv6 addresses which are available to the droplet.
I hope it helps!


text:
Q: Getting the major number of Android version with php I want to log the Majorn number of the Android version (first number) of a user.
I'll use a PHP-script, but it don't work. The string stills empty. What do I wrong?
$txt = $_SERVER['HTTP_USER_AGENT'];
$reg = '/Android (\d+).(\d+)\s+/';
$a   = array();

preg_match($reg, $txt, $a);

$str_version = $a[1];

Thanks in advance!

A: Remove the whitespace escape sequence (\s) at the end of your regex, as most Android versions consists of 3 numbers separated by decimal points, for example 4.4.2:
$reg = '/Android (\d+)\.(\d+)/';

A: Versioning is a critical component of your app upgrade and maintenance strategy. To define the version information for your app, set values for the version settings in the Gradle build files. These values are then merged into your app's manifest file during the build process.
Two settings are available, and you should always define values for both of them:

*

*versionCode — A positive integer used as an internal version number. This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions.

*versionName — A string used as the version number shown to users. This setting can be specified as a raw string or as a reference to a string resource.
If you use Gradle, there is an easier way to get build version, since it is available in BuildConfig for you:
String version = BuildConfig.VERSION_NAME;


text:
Q: Regex to match any words except words with given pattern I want to match all words except following words :
1) any-random-word
2) any-random-word/
3) any-random-word/123
4) any-random-word/abcdef

so that following similar words can be matched.
1) any-random-word123
2) any-random-word(any non-word character other than '/')123
2) any-random-wordabcdef
4) any-random-word(any non-word character other than '/')abcdef

In fact any number or any word can be appened after 'any-random-word/'.
I tried with
^(?!any-random-word(\/?)(\w+)$|any-random-word$)

but its escaping all words having any-random-word in it.
Thanks.

A: You can change your current regex a little:
^(?!.*\bany-random-word\b)

And if you want to actually match something, add .+ at the end:
^(?!.*\bany-random-word\b).+

regex101 demo
\b (a word boundary) ensures that there's no other \w character around the word you don't want to match.

Edit: As per your further clarification, I would suggest this regex:
^(?!.*\bany-random-word(?:/|$)).+

The main part of the regex is the negative lookahead: (?!.*\bany-random-word(?:/|$)). It will cause the whole match to fail if what's inside matches.
.*\bany-random-word(?:/|$) will match any-random-word at the end of a string or followed by /, anywhere in the string that it is being tested against.
So, if you have any-random-word/, it will match, and cause the whole match to fail. If you have the string ending in any-random-word, again, the whole match will fail.


text:
Q: AttributeError: can't set attribute in appium-python import time
import unittest
from appium.webdriver.webdriver import WebDriver as AppiumDriver
from appium import webdriver
desired_caps = dict(
platformName='Android',
deviceName='Android Emulator',
app=('C:/Users/Asus/Desktop/h.a/asan.apk')
)
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

i recieved this error: appium-python
i got this message:
how can i fix it?
am using appium and android studio emulator to simulate and automation test of android application.
Traceback (most recent call last):
  File "C:\Users\Asus\workspace\top web\complete.py", line 19, in <module>
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\appium\webdriver\webdriver.py", line 151, in __init__
    super().__init__(
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 268, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python39\lib\site-packages\appium\webdriver\webdriver.py", line 229, in start_session
    self.capabilities = response.get('value')
AttributeError: can't set attribute

A: I had this same issue and it got fixed by re-installing appium with python instead of npm.
I installed appium from source https://github.com/appium/python-client


text:
Q: Composing Option with closures that pattern-match arguments I have an enum with two different possible "types" and a function that may return any of them, wrapped in an Option:
enum Possibilities {
    First(i32),
    Second(String),
}
use Possibilities::*;

fn some_poss() -> Option<Possibilities> {
    Some(Second(String::from("hi")))
}

I want to apply an operation to the result of some_poss, but this operation only makes sense for one of the possibilities of the enum, otherwise it should return None. For example:
let a: Option<i32> = some_poss().and_then(|poss| if let First(x) = poss {
    Some(x * 2)
} else {
    None
});

How can I concisely combine this operation? Would it be possible to write this in a way similar to the following?
// Compile error: pattern `Second(_)` not covered
let b: Option<i32> = some_poss().map(|First(x)| x * 2);

A: The best way to handle this specific case would be to create a method on the enum specifically for retrieving the one variant. Somewhat like Result::ok.
enum Possibilities {
    First(i32),
    Second(String),
}
use Possibilities::*;

impl Possibilities {
    fn first(self) -> Option<i32> {
        match self {
            Possibilities::First(x) => Some(x),
            _ => None,
        }
    }
}

This would allow you to implement your function like:
some_fun().and_then(|p| p.first()).map(|x| x * 2)
// or, if you prefer this style:
some_fun().and_then(Possibilities::first).map(|x| x * 2);

This makes it explicit what each step is doing - some_poss gets an Option<Possiblities>, then first() gets an Option<i32> from that Possibilities, and then and_then collapses Option<Option<i32>> into Option<i32>.


text:
Q: what is wrong with this part of c++ code? int f =0;
    std::cout << " do you want to use 1. component y or n " << std::endl;
    std::cin >>f;
    if(f == 'y' || f =='n'){
        if (f =='y'){
            this->decisionvector[0] = 1;
        }else
            this->decisionvector[0] = 0;

    }

    std::cout << " do you want to use 2. component y or n " << std::endl;
    std::cin >>f;
    if(f == 'y' || f=='n'){
        if (f =='y'){
            this->decisionvector[1] = 2;
        }else
            this->decisionvector[1] = 0;
        f= 0;
    }
    std::cin.clear();
    std::cout << " do you want to use 3. component y or n " << std::endl;
    std::cin >>f;
    if(f == 'y' || f =='n'){
        if (f =='y'){
            this->decisionvector[2] = 4;
        }else
            this->decisionvector[2] = 0;
        f= 0;
    }
    std::cin.clear();
    std::cout << " do you want to use 4. component y or n " << std::endl;
    std::cin >>f;
    if(f == 'y' || f =='n'){
        if (f =='y'){
            this->decisionvector[3] = 8;
        }else
            this->decisionvector[3] = 0;
        f= 0;
    }

why I can set f only in the first if statement the program doesn't stop at the others ?

A: You should change int f to char f

A: int f =0;
std::cin >>f;

std::cin reads and interprets the sequence of character.
If f is an int, it will use the int overload of the extraction operator operator>>. This operator will try to format the input as an integer.
If the user pass the character 'y', the operator will fail to interpret it as a integer and will store 0 in f. You can check the error state of the stream with cin.fail().
if you want to read a character, you have to use a char.

A: In the second block you're reading k but using y...
std::cin >>k;
if(k == 'y' || k=='n'){
    if (f =='y'){
        this->decisionvector[1] = 2;
    }else
        this->decisionvector[1] = 0;
    f= 0;
}


text:
Q: What is the purpose of Windows style flags like WS_TILED and WS_ICONIC that are just renaming of others? (Windows/C++) I was looking at the various windows styles flags, and I noticed that a few flags are defined as such:
#define WS_TILED            WS_OVERLAPPED
#define WS_ICONIC           WS_MINIMIZE
#define WS_SIZEBOX          WS_THICKFRAME
#define WS_TILEDWINDOW      WS_OVERLAPPEDWINDOW

What is the purpose of defining new flags that are literally identical to other flags?

A: Its purpose is backwards compatibility.  WS_TILED and WS_ICONIC probably date back to Windows version 1.
One of Microsoft's great burdens, once they put a #define or function in an SDK header file, they can never delete it again.


text:
Q: Fresco dependency ломает aar библиотеку Я импортирую unity3d проект как aar библиотеку в android проект.
Изначально для ускорения работы я завел пустой android и отлаживал связь с юнити в нем, все работало, когда пришло время соединить unity aar с моим основным проектом получил ошибку при запуске юнити :

No implementation found for void
  com.unity3d.player.UnityPlayer.nativeRestartActivityIndicator()

Тогда я копировал все dependencies из основного проекта в пустой и получил ту же ошибку, затем я вычислил  что ошибка происходит когда включена библиотека Fresco, при этом она даже не используется нигде в коде.
Вот как выглядит конечный Gradle dependencies пустого проекта
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.facebook.fresco:fresco:1.11.0'// так не работает, если удалить, то работает.
    implementation project(':UnityAar')
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.google.code.gson:gson:2.8.5'
}

Как такое вообще может быть? И что делать?
PS просто удалить Fresco нельзя, на ней работает основной проект.

A: Починил так:
Build.gradle(Module app)
android{
   //....
   defaultConfig {
        //...
        ndk {
            abiFilters  "armeabi-v7a", "x86" // такие же и в unity
        }
    }
}

Хотя размер apk вырос в разы. Но думаю google play разделит их.
Как я понял Fresco, также как и unity,  использует нативный код и видимо где-то произошла не стыковка, как вариант ABI unity не совпадал с ABI fresco(хотя я об этом ничего не знаю)... В общем вопрос "Как такое вообще может быть?" - остается открытым.


text:
Q: How to determine who may have reset git brach? We are using git (with Bitbucket and SourceTree). We lost 6 months of check ins in our master branch and I wander if there is a way to determine what happened. Is there command in git and or  Bitbucket/SourceTree that can tell me if the reset was performed and/or all the commands/operations on the (remote) branch.

A:
We lost 6 months of check ins in our master branch and I wander if there is a way to determine what happened.

No, there is no way in pure git to know who did it. Perhaps in some logs or audit on bitbucket but chances are little.
But the more important is more to email developers to explain them that force push should not be made on master ( perhaps you should consider protecting your master branch https://blog.bitbucket.org/2013/09/16/take-control-with-branch-restrictions/) and very carefully on other branch (only allowed in feature branches!?!)

We lost 6 months of check ins in our master branch

I hope this is a pure rhetoric  sentence!
The history could be easily retrieved from local repositories using the reflog.

A: No, neither git nor bitbucket include an audit log of push events:

*

*https://confluence.atlassian.com/bitbucketserver/audit-logging-in-bitbucket-server-776640417.html

*https://bitbucket.org/site/master/issues/8322/add-clones-and-pushes-to-audit-logging-bb
However by accessing the BitBucket server DB, there might be a possibility:
https://confluence.atlassian.com/bitbucketserverkb/missing-commits-in-bitbucket-server-785327849.html


text:
Q: Make the official WPF RibbonTextBox look like a PasswordBox I'm developing an application with the official WPF Ribbon system, and I'd like to have a password field up in the ribbon. Is there any way I can modify the RibbonTextBox control to display dots instead of characters, the way a PasswordBox does? Thanks in advance.

A: Can't you just use the key up event, and take the value out of the box, store it in a variable, and replace it with the character you want?
User presses "A" on key up, you grab the value, store it in a variable, and then replace it with an "*". Keep doing this until they stop typing in the box?


text:
Q: How do I make CSS grid stack on mobile? I have a CSS grid that has grid template columns set to grid-template-columns: repeat(auto-fit, minmax(225px, 1fr))
When I check the responsiveness of the site for mobile, the grid elements just get smaller and don't stack. I am trying to get them to stack into a 1fr column on mobile. I have tried using a media query to set the grid template columns to 1fr at a break-point and that didn't work.
Here is a link to a CodePen of what I have https://codepen.io/Swildman/pen/ZEzqvXK

/* variables for colors */

:root {
  --highlight-color: #ff7264;
  --white-color: #fff;
  --text-color: #7f7f7f;
  --dark-bg-color: #2e2e2e;
  --light-bg-color: #fff;
  --gray-bg-color: #666;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* services section */

.services-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  grid-template-rows: repeat(3, 200px);
  grid-gap: 5px;
  margin: 5px;
}

.cell {
  background: var(--highlight-color);
  text-align: center;
  color: var(--white-color);
  padding: 10px;
}

.cell h3 {
  font-size: 20px;
}

.cell p {
  line-height: 1.4em;
}

.cell-1 {
  grid-column: 1/3;
  grid-row: 1/3;
  padding: 10px;
}

.cell-1 p,
.cell-4 p {
  font-size: 20px;
  line-height: 1.4em;
}

.cell-1 h3,
.cell-4 h3 {
  font-size: 30px;
}

.cell-1:hover {
  background-image: url("https://picsum.photos/460");
}

.cell-1:hover p,
.cell-1:hover h3 {
  opacity: 0;
  transition: 1000ms;
}

.cell-2 {
  background-image: url("https://picsum.photos/225");
}

.cell-2 h3,
.cell-2 p {
  opacity: 0;
}

.cell-2:hover {
  background: var(--highlight-color);
}

.cell-2:hover h3,
.cell-2:hover p {
  opacity: 1;
  transition: 1000ms;
}

.cell-3 {
  background-image: url("https://picsum.photos/225");
}

.cell-3 h3,
.cell-3 p {
  opacity: 0;
}

.cell-3:hover {
  background: var(--highlight-color);
}

.cell-3:hover h3,
.cell-3:hover p {
  opacity: 1;
  transition: 1000ms
}

.cell-4 {
  grid-column: 3/5;
  grid-row: 2/4;
  padding: 10px;
}

.cell-4:hover {
  background-image: url("https://picsum.photos/460");
  background-repeat: no-repeat;
  background-size: cover;
}

.cell-4:hover p,
.cell-4:hover h3 {
  opacity: 0;
  transition: 1000ms;
}

.cell-5 {
  background-image: url("https://picsum.photos/225");
}

.cell-5 h3,
.cell-5 p {
  opacity: 0;
}

.cell-5:hover {
  background: var(--highlight-color);
}

.cell-5:hover h3,
.cell-5:hover p {
  opacity: 1;
  transition: 1000ms;
}

.cell-6 {
  background-image: url("https://picsum.photos/225");
}

.cell-6 p,
.cell-6 h3 {
  opacity: 0;
}

.cell-6:hover {
  background: var(--highlight-color);
}

.cell-6:hover p,
.cell-6:hover h3 {
  opacity: 1;
  transition: 1000ms;
}

#services-section {
  text-align: center;
  margin-top: 30px;
  max-width: 900px;
  margin: 30px auto;
}

.services-title {
  font-size: 2em;
  text-shadow: 1px 1px var(--text-color);
  color: var(--highlight-color);
}

@media screen and (max-width: 768px) {
  grid-template-columns: 1fr;
}

Services

Creative Web Design Services

Our web design services will greatly enhance your business's presence on the Internet. Our designers mix a potent combination of brand strategy with a generous splash of creative juices and blend in the latest trends in Website UX and UI design.
        Since 2019, S&E has designed and built over 25 Websites from e-commerce, b2c, b2b, non-profit, to social networks. We even create custom web applications.

Digital Marketing

Our digital marketing services are driven not only by passion, but also a driving desire to deliver exceptional sales conversions.

App Development

Our app development services are sought after from venture capital start-ups to fortune 100 companies.

Website Maintenance

Extend your Website's Lifespan

By subscribing into a website maintenance plan with S&E, we can help your website keep up with the ever-changing and evolving industry.

S&E is one of the leading website maintenance agencies. Our web maintenance packages cover everything that your website may need – from simple content updates to extensive design updates.

Web Development

If you're looking for custom Internet applications or complex web development solutions, you've come to the right place.

Branding

Branding has never been more expansive, adventurous and agile than it is today

A: One of the biggest problems was in your media query - you didn't specify any element to apply the property to.
Here's the important part of the CSS that I changed:
@media screen and (max-width: 768px) {
  .services-container {
      grid-template-columns: 1fr;
      grid-template-rows: 1fr;
   }

  .cell-1, .cell-2, .cell-3, .cell-4, .cell-5, .cell-6 {
    grid-column: auto;
    grid-row: auto;
  }
}

You can see, I also reset all of your .cell to auto for placement.

/* variables for colors */

:root {
  --highlight-color: #ff7264;
  --white-color: #fff;
  --text-color: #7f7f7f;
  --dark-bg-color: #2e2e2e;
  --light-bg-color: #fff;
  --gray-bg-color: #666;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* services section */

.services-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  grid-template-rows: repeat(3, 200px);
  grid-gap: 5px;
  margin: 5px;
}

.cell {
  background: var(--highlight-color);
  text-align: center;
  color: var(--white-color);
  padding-top: 10px;
}

.cell h3 {
  font-size: 20px;
}

.cell p {
  line-height: 1.4em;
}

.cell-1 {
  grid-column: 1/3;
  grid-row: 1/3;
  padding: 10px;
}

.cell-1 p,
.cell-4 p {
  font-size: 20px;
  line-height: 1.4em;
}

.cell-1 h3,
.cell-4 h3 {
  font-size: 30px;
}

.cell-1:hover {
  background-image: url("https://picsum.photos/460");
}

.cell-1:hover p,
.cell-1:hover h3 {
  opacity: 0;
  transition: 1000ms;
}

.cell-2 {
  background-image: url("https://picsum.photos/225");
}

.cell-2 h3,
.cell-2 p {
  opacity: 0;
}

.cell-2:hover {
  background: var(--highlight-color);
}

.cell-2:hover h3,
.cell-2:hover p {
  opacity: 1;
  transition: 1000ms;
}

.cell-3 {
  background-image: url("https://picsum.photos/225");
}

.cell-3 h3,
.cell-3 p {
  opacity: 0;
}

.cell-3:hover {
  background: var(--highlight-color);
}

.cell-3:hover h3,
.cell-3:hover p {
  opacity: 1;
  transition: 1000ms
}

.cell-4 {
  grid-column: 3/5;
  grid-row: 2/4;
  padding: 10px;
}

.cell-4:hover {
  background-image: url("https://picsum.photos/460");
  background-repeat: no-repeat;
  background-size: cover;
}

.cell-4:hover p,
.cell-4:hover h3 {
  opacity: 0;
  transition: 1000ms;
}

.cell-5 {
  background-image: url("https://picsum.photos/225");
}

.cell-5 h3,
.cell-5 p {
  opacity: 0;
}

.cell-5:hover {
  background: var(--highlight-color);
}

.cell-5:hover h3,
.cell-5:hover p {
  opacity: 1;
  transition: 1000ms;
}

.cell-6 {
  background-image: url("https://picsum.photos/225");
}

.cell-6 p,
.cell-6 h3 {
  opacity: 0;
}

.cell-6:hover {
  background: var(--highlight-color);
}

.cell-6:hover p,
.cell-6:hover h3 {
  opacity: 1;
  transition: 1000ms;
}

#services-section {
  text-align: center;
  margin-top: 30px;
  max-width: 900px;
  margin: 30px auto;
}

.services-title {
  font-size: 2em;
  text-shadow: 1px 1px var(--text-color);
  color: var(--highlight-color);
}

@media screen and (max-width: 768px) {
  .services-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }
  .cell-1,
  .cell-2,
  .cell-3,
  .cell-4,
  .cell-5,
  .cell-6 {
    grid-column: auto;
    grid-row: auto;
  }
}

Services

Creative Web Design Services

Our web design services will greatly enhance your business's presence on the Internet. Our designers mix a potent combination of brand strategy with a generous splash of creative juices and blend in the latest trends in Website UX and UI design.
        Since 2019, S&E has designed and built over 25 Websites from e-commerce, b2c, b2b, non-profit, to social networks. We even create custom web applications.

Digital Marketing

Our digital marketing services are driven not only by passion, but also a driving desire to deliver exceptional sales conversions.

App Development

Our app development services are sought after from venture capital start-ups to fortune 100 companies.

Website Maintenance

Extend your Website's Lifespan

By subscribing into a website maintenance plan with S&E, we can help your website keep up with the ever-changing and evolving industry.

S&E is one of the leading website maintenance agencies. Our web maintenance packages cover everything that your website may need – from simple content updates to extensive design updates.

Web Development

If you're looking for custom Internet applications or complex web development solutions, you've come to the right place.

Branding

Branding has never been more expansive, adventurous and agile than it is today

Here's a working CodePen:
https://codepen.io/chrislafrombois/pen/xxKyYPN

A: First, you forgot to put the style rule in your media query. You had:
@media screen and (max-width: 768px) {
    grid-template-columns: 1fr;
}

Should be:
@media screen and (max-width: 768px) {
  .services-container {
    grid-template-columns: 1fr;
  }
}

Second, you need to reset the grid-column and grid-row style rules for all of the grid items:

/* variables for colors */

:root {
  --highlight-color: #ff7264;
  --white-color: #fff;
  --text-color: #7f7f7f;
  --dark-bg-color: #2e2e2e;
  --light-bg-color: #fff;
  --gray-bg-color: #666;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* services section */

.services-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  grid-template-rows: repeat(3, 200px);
  grid-gap: 5px;
  margin: 5px;
}

.cell {
  background: var(--highlight-color);
  text-align: center;
  color: var(--white-color);
  padding: 10px;
}

.cell h3 {
  font-size: 20px;
}

.cell p {
  line-height: 1.4em;
}

.cell-1 {
  grid-column: 1/3;
  grid-row: 1/3;
  padding: 10px;
}

.cell-1 p,
.cell-4 p {
  font-size: 20px;
  line-height: 1.4em;
}

.cell-1 h3,
.cell-4 h3 {
  font-size: 30px;
}

.cell-1:hover {
  background-image: url("https://picsum.photos/460");
}

.cell-1:hover p,
.cell-1:hover h3 {
  opacity: 0;
  transition: 1000ms;
}

.cell-2 {
  background-image: url("https://picsum.photos/225");
}

.cell-2 h3,
.cell-2 p {
  opacity: 0;
}

.cell-2:hover {
  background: var(--highlight-color);
}

.cell-2:hover h3,
.cell-2:hover p {
  opacity: 1;
  transition: 1000ms;
}

.cell-3 {
  background-image: url("https://picsum.photos/225");
}

.cell-3 h3,
.cell-3 p {
  opacity: 0;
}

.cell-3:hover {
  background: var(--highlight-color);
}

.cell-3:hover h3,
.cell-3:hover p {
  opacity: 1;
  transition: 1000ms
}

.cell-4 {
  grid-column: 3/5;
  grid-row: 2/4;
  padding: 10px;
}

.cell-4:hover {
  background-image: url("https://picsum.photos/460");
  background-repeat: no-repeat;
  background-size: cover;
}

.cell-4:hover p,
.cell-4:hover h3 {
  opacity: 0;
  transition: 1000ms;
}

.cell-5 {
  background-image: url("https://picsum.photos/225");
}

.cell-5 h3,
.cell-5 p {
  opacity: 0;
}

.cell-5:hover {
  background: var(--highlight-color);
}

.cell-5:hover h3,
.cell-5:hover p {
  opacity: 1;
  transition: 1000ms;
}

.cell-6 {
  background-image: url("https://picsum.photos/225");
}

.cell-6 p,
.cell-6 h3 {
  opacity: 0;
}

.cell-6:hover {
  background: var(--highlight-color);
}

.cell-6:hover p,
.cell-6:hover h3 {
  opacity: 1;
  transition: 1000ms;
}

#services-section {
  text-align: center;
  margin-top: 30px;
  max-width: 900px;
  margin: 30px auto;
}

.services-title {
  font-size: 2em;
  text-shadow: 1px 1px var(--text-color);
  color: var(--highlight-color);
}

@media screen and (max-width: 768px) {
  .services-container {
    grid-template-columns: 1fr;
  }
  .services-container > div{
     grid-column: auto;
     grid-row: auto;
  }
}

Services

Creative Web Design Services

Our web design services will greatly enhance your business's presence on the Internet. Our designers mix a potent combination of brand strategy with a generous splash of creative juices and blend in the latest trends in Website UX and UI design.
        Since 2019, S&E has designed and built over 25 Websites from e-commerce, b2c, b2b, non-profit, to social networks. We even create custom web applications.

Digital Marketing

Our digital marketing services are driven not only by passion, but also a driving desire to deliver exceptional sales conversions.

App Development

Our app development services are sought after from venture capital start-ups to fortune 100 companies.

Website Maintenance

Extend your Website's Lifespan

By subscribing into a website maintenance plan with S&E, we can help your website keep up with the ever-changing and evolving industry.

S&E is one of the leading website maintenance agencies. Our web maintenance packages cover everything that your website may need – from simple content updates to extensive design updates.

Web Development

If you're looking for custom Internet applications or complex web development solutions, you've come to the right place.

Branding

Branding has never been more expansive, adventurous and agile than it is today

A:
I have tried using a media query to set the grid template columns to 1fr at a break-point and that didn't work.

*

*You didn't specify a selector in your media query. You just posted code, with no where for it to be applied.
@media screen and (max-width: 768px) {
  grid-template-columns: 1fr; /* selector missing */
}

*You didn't reset the column and row spans you defined.
.cell-1 {
  grid-column: 1/3;
  grid-row: 1/3;
}

.cell-4 {
  grid-column: 3/5;
  grid-row: 2/4;
}

Try this instead:
@media screen and (max-width: 768px) {

  .services-container {
    grid-template-columns: 1fr;
  }

  .cell-1, .cell-4 {
    grid-column: auto;
    grid-row: auto;
  }
}

/* variables for colors */
:root {
  --highlight-color: #ff7264;
  --white-color: #fff;
  --text-color: #7f7f7f;
  --dark-bg-color: #2e2e2e;
  --light-bg-color: #fff;
  --gray-bg-color: #666;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* services section */
.services-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  grid-template-rows: repeat(3, 200px);
  grid-gap: 5px;
  margin: 5px;
}

.cell {
  background: var(--highlight-color);
  text-align: center;
  color: var(--white-color);
  padding-top: 10px;
}

.cell h3 {
  font-size: 20px;
}

.cell p {
  line-height: 1.4em;
}

.cell-1 {
  grid-column: 1/3;
  grid-row: 1/3;
  padding: 10px;
}

.cell-1 p, .cell-4 p {
  font-size: 20px;
  line-height: 1.4em;
}

.cell-1 h3, .cell-4 h3 {
  font-size: 30px;
}

.cell-1:hover {
  background-image: url("https://picsum.photos/460");
}

.cell-1:hover p, .cell-1:hover h3 {
  opacity: 0;
  transition: 1000ms;
}

.cell-2 {
  background-image: url("https://picsum.photos/225");
}

.cell-2 h3, .cell-2 p {
  opacity: 0;
}

.cell-2:hover {
  background: var(--highlight-color);
}

.cell-2:hover h3, .cell-2:hover p {
  opacity: 1;
  transition: 1000ms;
}

.cell-3 {
  background-image: url("https://picsum.photos/225");
}

.cell-3 h3, .cell-3 p {
  opacity: 0;
}

.cell-3:hover {
  background: var(--highlight-color);
}

.cell-3:hover h3, .cell-3:hover p {
  opacity: 1;
  transition: 1000ms
}

.cell-4 {
  grid-column: 3/5;
  grid-row: 2/4;
  padding: 10px;
}

.cell-4:hover {
  background-image: url("https://picsum.photos/460");
  background-repeat: no-repeat;
  background-size: cover;
}

.cell-4:hover p, .cell-4:hover h3 {
  opacity: 0;
  transition: 1000ms;
}

.cell-5 {
  background-image: url("https://picsum.photos/225");
}

.cell-5 h3, .cell-5 p {
  opacity: 0;
}

.cell-5:hover {
  background: var(--highlight-color);
}

.cell-5:hover h3, .cell-5:hover p {
  opacity: 1;
  transition: 1000ms;
}

.cell-6 {
  background-image: url("https://picsum.photos/225");
}

.cell-6 p, .cell-6 h3 {
  opacity: 0;
}

.cell-6:hover {
  background: var(--highlight-color);
}

.cell-6:hover p, .cell-6:hover h3 {
  opacity: 1;
  transition: 1000ms;
}

#services-section {
  text-align: center;
  margin-top: 30px;
  max-width: 900px;
  margin: 30px auto;
}

.services-title {
  font-size: 2em;
  text-shadow: 1px 1px var(--text-color);
  color: var(--highlight-color);
}

@media ( max-width: 600px ) {

  .services-container { grid-template-columns: 1fr; grid-template-rows: auto; }

  .cell-1 {
  grid-column: auto;
  grid-row: auto;

}

.cell-4 {
  grid-column: auto;
  grid-row: auto;

}

}

Services

Creative Web Design Services

Our web design services will greatly enhance your business's presence on the Internet. Our designers mix a potent combination of brand strategy with a generous splash of creative juices and blend in the latest trends in Website UX and UI design.
        Since 2019, S&E has designed and built over 25 Websites from e-commerce, b2c, b2b, non-profit, to social networks. We even create custom web applications.

Digital Marketing

Our digital marketing services are driven not only by passion, but also a driving desire to deliver exceptional sales conversions.

App Development

Our app development services are sought after from venture capital start-ups to fortune 100 companies.

Website Maintenance

Extend your Website's Lifespan

By subscribing into a website maintenance plan with S&E, we can help your website keep up with the ever-changing and evolving industry.

S&E is one of the leading website maintenance agencies. Our web maintenance packages cover everything that your website may need – from simple content updates to extensive design updates.

Web Development

If you're looking for custom Internet applications or complex web development solutions, you've come to the right place.

Branding

Branding has never been more expansive, adventurous and agile than it is today

jsFiddle demo


text:
Q: Does not implement inherited abstract member Java.Util.TimerTask Error I have this code but I have also this error:
Does not implement inherited abstract member Java.Util.TimerTask
namespace App21
{
    class DTime :TimerTask
    {
        private long time = Java.Lang.JavaSystem.CurrentTimeMillis();
        public void run()
        {
            time += 1000; //add 1 second to the time
        }
        public long getTime()
        {
            return time;
        }
    }
}

I saw Showing current time in Android and updating it?

A: You are missing the override keyword on the Run method, also this method has the "R" in capital, remember Xamarin is C#.
Change you implementation to this:
public class DTime : TimerTask
{
    private long time = Java.Lang.JavaSystem.CurrentTimeMillis ();

    public DTime ()
    {

    }

    public override void Run ()
    {
        time += 1000;
    }

    public long GetTime ()
    {
        return time;
    }
}


text:
Q: System::Drawing::Text::PrivateFontCollection not working when the font is not installed I tried to add font from memory (embedded resource) and use it for my windows form (c++/cli) application... The code is working, but when the specified font is not installed on the computer the textbox is using the default font instead of my custom font. CompatibleTextRenderingDefault is set to true.
    System::Drawing::Text::PrivateFontCollection^ privateFont = gcnew System::Drawing::Text::PrivateFontCollection();

    IO::Stream^ fontStream = Reflection::Assembly::GetExecutingAssembly()->GetManifestResourceStream("textfont.otf");
    array<Byte>^ fontData = gcnew array<Byte>(fontStream->Length);
    fontStream->Read(fontData, 0, (int)fontStream->Length);
    fontStream->Close();

    pin_ptr<byte> fontAddress = &fontData[0];
    privateFont->AddMemoryFont((IntPtr)fontAddress, fontData->Length);

    this->TextBox_Username->Font = gcnew System::Drawing::Font(safe_cast<System::Drawing::FontFamily^>(privateFont->Families[0]), 9.749999F, System::Drawing::FontStyle::Bold);
    this->TextBox_Password->Font = gcnew System::Drawing::Font(safe_cast<System::Drawing::FontFamily^>(privateFont->Families[0]), 9.749999F, System::Drawing::FontStyle::Bold);

A: Both methods (AddFontFile, AddMemoryFont) available to load font into PrivateFontCollection do not fully support OpenType fonts. Use TrueType font instead.
See also https://social.msdn.microsoft.com/Forums/en-US/40834a16-2378-4aeb-a499-25f835fe5738/opentype-font-as-embedded-resource?forum=winforms


text:
Q: Why does pd.Series([np.nan]) | pd.Series([True]) evaluate to False? Why does the following code return False?
>>> pd.Series([np.nan]) | pd.Series([True])
0    False
dtype: bool

A: I think this is because np.nan has metaclass of float and I guess overrides __bool__ to be non-zero:
np.nan.__bool__() == True

In the same way:
>>>np.nan or None
nan

A solution in pandas would be:
pd.Series([np.nan]).fillna(False) | pd.Series([True])

EDIT ***
For clarity, in pandas 0.24.1 in the method: _bool_method_SERIES on line 1816 of .../pandas/core/ops.py there is an assignment:
    fill_bool = lambda x: x.fillna(False).astype(bool)

which is where the behaviour you are describing is coming from. I.e. it's been purposefully designed so that np.nan is treated like a False value (whenever doing an or operation)

A: Compare your case (with the explicit dtype to emphasize the inferred one):
In[11]: pd.Series([np.nan], dtype=float) | pd.Series([True])

Out[11]:
0    False
dtype: bool

with a similar one (only dtype is now bool):
In[12]: pd.Series([np.nan], dtype=bool) | pd.Series([True])

Out[12]:
0    True
dtype: bool

Do you see the difference?

The explanation:

*

*In the first case (yours), np.nan propagates itself in the logical operation or (under the hood)
In[13]: np.nan or True
Out[13]: nan

and pandas treated np.nan as False in the context of an boolean operation result.

*In the second case the output is unambiguous, as the first series has a boolean value (True, as all non-zero values are considered True, including np.nan, but it doesn't matter in this case):
In[14]: pd.Series([np.nan], dtype=bool)

Out[14]:
0    True
dtype: bool

and True or True gives True, of course:
In[15]: True or True
Out[15]: True


text:
Q: Is there a way to run C++ Unit Tests tests in parallel? I'm using Boost Test for a long time now and I ends up having my tests running too slowly. As each test is highly parallel, I want them to run concurrently with all my cores.
Is there a way to do that using the Boost Test Library ? I didn't found any solution. I tried to look a how to write custom test runner, but I didn't much documentation on that point :(
If there is no way, does someone know a good C++ Test Framework to achieve that goal ? I was thinking that Google Test would do the job but apparently it cannot run test in parallel either. Even if the framework has less features than other more known framework, it is not a problem, I just need simple assertions and multi-threaded execution.
Thanks

A: What google is hinting at in the gtest documentation is test sharding - letting multiple machines run the tests by just using command line parameters and environment variables. You could run them all on one machines in separated processes, where you set the GTEST_SHARD_INDEX and GTEST_TOTAL_SHARDS environment variables appropriately.
In principle, nothing is preventing you from starting multiple processes of the test executable with a different filtering parameter (Boost.test, gtest)
Update 2014: https://github.com/google/gtest-parallel

A: Split the suite to consist of multiple smaller sets each launched with individual binary, and add .PHONY target test to your build sysem depending on all of them. Run as (assuming you are using make) make -jN test

A: You could use CTest for this.
CTest is the test driver which accompanies CMake (the build system generator), so you'd need to use CMake to create the build system using your existing files and tests, and in doing so you would then be able to use CTest to run the test executables.
I haven't personally used Boost.Test with CMake (we use GoogleTest), but this question goes into a little more detail on the process.
Once you have the tests added in your CMakeLists file, you can make use of CTest's -j argument to specify how many jobs to run in parallel.

A: Given that the third bullet point on the open issues list is currently thread safety, I don't believe there's a way to tell Boost test to run tests in multiple threads.
Instead, you will need to find an external test runner that supports running tests in parallel (I would expect this to work by forking off new processes).


text:
Q: How to compare this date and time 15 AUGUST at 8:00 PM IST ( GMT + 5:30) to current date and time in PHP How to compare this date and time

15 AUGUST at 8:00 PM IST ( GMT + 5:30)

to current date and time in PHP
15 AUGUST at 8:00 PM IST ( GMT + 5:30) this date stored in db and need to compare with current time and if current time is 15 minutes less then need to fire my logic.

A:             $dateTime    = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
            $classDate   = explode(' ', '27 AUGUST at 8:00 PM IST ( GMT + 5:30)');
            $currentDate = explode(' ',date("d F")." at ".$dateTime->format("h:i A").' '.'IST ( GMT + 5:30)');

            if ($currentDate['0'] == $classDate['0']) {
                if ($currentDate['1'] == $classDate['1']) {
                    if ($currentDate['4'] == $classDate['4']) {
                        $minutes = (strtotime($classDate['3']) - strtotime($currentDate['3']))/60;
                        if ($minutes <= 15 && $minutes >= 0) {
                            echo "Your class is ready, Join now";
                        }
                    }
                }
            }
Here i have exploded the dates and compared the date month as well compared time
converting to `strtotime()` and boom.......