text:
Q: Vue 3 recommended TypeScript TSConfig compilerOptions TARGET setting? This question has puzzled me at several points when using Vue 2 and Vue CLI, and now again with starting a fresh Vue 3.0 beta project.
Even with the currently newest Vue CLI version 4.3.1, when choosing TypeScript option, the boilerplate code you are given has compilerOptions target set as esnext in tsconfig.json.
While Vue 2 TypeScript Guide is instructing:
# Recommended Configuration
// tsconfig.json
{
  "compilerOptions": {
    // this aligns with Vue's browser support
    "target": "es5",
    // this enables stricter inference for data properties on `this`
    "strict": true,
    // if using webpack 2+ or rollup, to leverage tree shaking:
    "module": "es2015",
    "moduleResolution": "node"
  }
}

Currently Vue Next repo is using esnext, although at this point IE11 support is not ready yet (but might not affect this config anyhow)...
What will be the recommended setting for this compiler target when using Vue 3?
I'm needing to support legacy browsers down to IE11, but this particular app project has plenty of time until it's initial release to wait for Vue 3's full release.

A: As Vue 3 repository states,

the current implementation requires native ES2015+ in the runtime environment and does not support IE11 (yet). The IE11 compatible build will be worked on after we have reached RC stage.

As it was noted, the target of Vue 3 is currently esnext, it relies on modern JS features and is currently aimed at the development in evergreen browsers and isn't supposed to be used in production. Vue 3 cannot be usable in legacy browsers even with lower target because it currently relies on proxies which are ES6 feature that cannot be polyfilled.
The project that uses existing Vue 3 build won't benefit from target lower than es2018 which is likely the least common denominator, object spread is among most popular recent additions that is used in Vue 3 codebase and cannot be polyfilled. TypeScript target can be experimentally lowered to es5 with downlevelIteration option enabled for early detection of some compatibility problems.
It's expected that separate versions of Vue 3 will be maintained for legacy (IE11) and modern browsers. The difference is how reactivity is handled because Proxy allows for advanced change detection but cannot be implemented in legacy browsers. The project should follow existing guidelines for Vue 2 reactivity in order to be compatible with legacy Vue 3 build.


text:
Q: Phoenix not connected on zookeeper from Cloudera CDH5 distribution I installed zookeeper, hbase-master, hbase-regionserver in theree different systems. And configured according to the CDH5 guideline. Able to start all the services. Added Phoenix-4.2.2 on zookeeper node. When trying to connect database by ./sqlline localhost , getting below error
ERROR: Can't get master address from ZooKeeper; znode data == null
please help

A: i assume you have copied phoenix-*-server.jar to all region server hbase lib.. check what is the zookeeper quorem server name giver hbase-site.xml .. if the machine name is given then you should map machine name to its ip address in /etc/hosts..hope this helps

redpajama_set_name: RedPajamaStackExchange


text:
Q: Switching debuggers I use Visual Studio C++ 97 for a project for my a employer. Yesterday I installed VS SDK 2008 for another project. Now, when I try to debug on 97 uses the newly installed debugger. Is there a way to switch with the original debugger? (the compiler has no problems)
Thanks,
Sun

A: Are you saying that you want to debug the program in VS 2008. What you need to do is run the program and then open VS 2008 and attach your application. Then you can put breakpoints and debug.

A: One can do it on SDK 97 by pressing Tools -> Options -> Debug and enabling 'Just-In-Time debugging' option.


text:
Q: Opengl context in flutter My Android project uses an opengl lib written in c++, I'm using an Android SurfaceView subclass, now I would like to recreate my app starting with a flutter project. Some of you know how can I achieve it?
Thanks.

A: You may find this article helpful which shows how to use Flutters  TextureRegistry to obtain SurfaceTextures that you can then render into.
But given you say you are using a SurfaceView at the moment, you'll need to find some way to wire up your c++ lib differently for Flutter.
In my use case I needed to do what you are trying to do, use a c++ library rather than Java GLES code as in the article I linked.
So what I did was use EGL call in Java side to create an EGLSurface
mEGL.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, texture, null)

which I could then make use of in C++ code that ran on the same thread, so I had access to the EGLSurface to render it into.


text:
Q: jquery modal dialog doesn't work with modal:true Not sure what I'm doing wrong here.  Just trying to make it a modal dialog (dim out the page content).  I thought it is as simple as modal:true.  A dialog comes up when I click the image but it doesn't dim out the page content.

A comment

<link rel="stylesheet" type="text/css" href="mycss/css/jquery-ui-1.8.20.custom.css" />

A: The syntax is wrong.
You should set this initially:
$(function() {
    $('.dialogplease').dialog({modal:true,autoOpen:false}); //init dialog
    $('.helpdetails').click(function(e) {
        $('.dialogplease').dialog('open');
    });
});


text: Q: Label properties not switching to selected layer for labelling In ArcGIS Pro my labelling properties is "stuck" on one layer i.e. not switching to allow other layers, fields and classes to be manipulated (the field do not change based on the selected layers attributes either). The attached screenshot even shows that this happens on projects where the layer "stuck" in layer properties isn't even within the project I have open. Is this a bug in the labelling?


text:
Q: How to set multiple initial jobs on Jenkins Pipeline View I am using Jenkins to manage build workflow. I have three projects ui, backend and release. The release project needs to be triggered either by ui and backend. In other words, ui and backend are upstream projects while release is the downstream project. I want to show them in Jenkins Pipeline view. But I can only select one project as the initial job. See below screenshot.

I know I can setup two pipeline views one for ui -> release the other is for backend -> release but I am looking for a better solution.
How can I select multiple initial jobs in the Pipeline view?


text:
Q: How to create an abstract activity class and extend it to all activities? I have navigation drawer menu and 6 activities. I want to create an abstract activity class, and move all my drawer menu code to it, and then extend it.
This is my Main activity.java and my drawer's code in this activity.
public class MainActivity extends AppCompatActivity {

private Toolbar toolbar;
protected DrawerLayout drawerLayout;
NavigationView navigationView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);

    TextView tv = (TextView)findViewById(R.id.textView);
    Typeface textfont = Typeface.createFromAsset(getAssets(),"fonts/B Roya_YasDL.com.ttf");
    tv.setTypeface(textfont);

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    drawerLayout = (DrawerLayout) findViewById(R.id.a1);

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_more_vert_black_24dp);
    navigationView = (NavigationView) findViewById(R.id.a2);
    navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            item.setChecked(true);
            drawerLayout.closeDrawer(Gravity.RIGHT);
            switch (item.getItemId()){
                case R.id.intro:
                    Intent i = new Intent(MainActivity.this, IntroActivity.class);
                    startActivity(i);
                    break;
            }

            return false;
        }
    });

}

public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.khat) {
        if (drawerLayout.isDrawerOpen(Gravity.RIGHT)) {
            drawerLayout.closeDrawer(Gravity.RIGHT);
        }

        else {
            drawerLayout.openDrawer(Gravity.RIGHT);
        }
        return super.onOptionsItemSelected(item);
    }
    else {
        Toast.makeText(getApplicationContext(),"somthing",Toast.LENGTH_LONG).show();
    }

    return true;
}

public void onBackPressed(){
    if (drawerLayout.isDrawerOpen(Gravity.RIGHT)){
        drawerLayout.closeDrawer(Gravity.RIGHT);
    }else {super.onBackPressed();}

}

and this is my second activity for example:
public class IntroActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_intro);
}

How can I create an abstract activity class and insert my drawer's code in there and call it from any activity that I want?

A: You have to create mainActivity like
public class MainActivity extends AppCompatActivity implements  NavigationView.OnNavigationItemSelectedListener{

    public NavigationView navigationView;
    public DrawerLayout drawer;
    public RelativeLayout content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.activity_main);
        drawer=(DrawerLayout) findViewById(R.id.drawer_layout);
        content = (RelativeLayout) findViewById(R.id.content);

        navigationView = (NavigationView)findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);

    }

    @Override
    public void setContentView(@LayoutRes int layoutResID) {
        LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View layout = inflater.inflate(layoutResID, null);
        //  var x = layout.LayoutParameters;
        content.addView(layout);
    }

    public void OpenDrawer()
    {
        drawer.openDrawer(Gravity.START,true);
    }

    @Override
    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
        switch (item.getItemId()){
            case R.id.navdrawer_item_first:
                Toast.makeText(this, "first item clicked", Toast.LENGTH_SHORT).show();
                break;
            case R.id.navdrawer_item_second:
                Toast.makeText(this, "second item clicked", Toast.LENGTH_SHORT).show();
                break;
        }
        drawer.closeDrawers();
        return true;
    }
}

And activity_main
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:drawer="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/content" />
    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        drawer:menu="@menu/navigation_drawer_items"
        drawer:headerLayout="@layout/drawer_header"
        android:background="#343a46"
        drawer:itemTextColor="#ffffff" />
</android.support.v4.widget.DrawerLayout>

then you will extend Mail Activity
public class SecondActivity extends MainActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.activity_second);

    }
}

and in Manifest make second activity is the launcher:
<activity android:name=".MainActivity">

        </activity>
        <activity android:name=".SecondActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

A: I don't recommend making a abstract activity for this purpose.
Instead you should have just one activity where your navigation drawer is attached.And replace your activities with fragments except for MainActivity which would contain the navigation drawer.
activity_main layout would looks like:
-DrawerLayout
   -FrameLayout
   -NavigationView
And in the main activity whenever user clicks on any of the item in NavigationDrawer just replace the fragment with the required one.

A: navigation_drawer_items
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <group android:id="@+id/group_feature"
        android:checkableBehavior="single">
        <item android:id="@+id/navdrawer_item_first"

            android:title="first item"/>
        <item android:id="@+id/navdrawer_item_second"

            android:title="second item"/>

    </group>

</menu>

drawer_header
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#343a46"

    android:orientation="vertical"
   android:padding="10dp"
    android:theme="@style/ThemeOverlay.AppCompat.Dark">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        />

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:gravity="center_horizontal"

        android:textColor="#dfba6b"
        android:textStyle="bold" />

</LinearLayout>


text:
Q: Opinion on GUI for a Battleship game in Python I am making a battleship game for a project. While I have completed the logic and the game works with text input. I was hoping make a (very basic) GUI while still use the methods created for the text.
The two options I've been looking at are PyGame and Tkinter. PyGame does not seem to have a text output/label function. Tkinter does, but it doesn't seem as easy (i feel) as PyGame is.
Though I would love to give either of these frameworks the time they deserve, I have just over 60hrs before this is due.
I wanted to know if anyone one has any experience or insights and if it is a realistic option.
Thanks as always!

A: You could check Kivy, it's working in top of OpenGL, provide severals basics widgets (label, button, slider, textinput, layouts, ...), and you can create your own / display graphics etc. Works as a python framework, almost all platforms.
You can also check the recent game contest to see what you can do with it :)

A: This is a fairly trivial thing to do in Tkinter. A battleship game shows an array of coordinates which you can display as a grid of checkbuttons.

A: Why don't you try Cocos2D?
It's higher level, and it supports rich labeling (Class cocos.text.RichLabel)
http://cocos2d.org/

A: I suggest you use pyqt/pyside for this task. This lets you access the powerful Qt framework which has great documentation. If you design a game that does not need fast graphics you can simply use QGraphicsView/QGraphicsScene and related classes to display icons/numbers/whatever. Of course you can use OpenGL with Python and Qt as well.

A: You can render text on pygame, just use:
class pygame.font.Font
#create a new Font object from a file
pygame.font.Font(filename, size): return Font
pygame.font.Font(object, size): return Font

method Font.render
#method of Font() to draw text on a new Surface
Font.render(text, antialias, color, background=None): return Surface

Simple example how to use text on pygame:
from pygame import font as pgfont, sprite as pgspr
import pygame as pg

    class FontSprite(pgspr.DirtySprite):
        def __init__(self, text, x, y):
            '''self.image = surface'''
            pgspr.DirtySprite.__init__(self)
            self.text = text
            self.color = [0,0,0]
            self.image = self.get_image()
            self.rect = pg.Rect((x, y), self.image.get_size())

        def get_image(self):
            self.dirty = 1
            return pgfont.Font('fonts\\BRLNSR.TTF', self.size).render(self.text,
                                                                      True,
                                                                      self.color)


text:
Q: bash to create process log for each file I am using bash to run several processes one after another.  I would like to create a log of each process, a log that the process started and completed, but the below only creates and empty log.  Thank you :).
So when the first process (# create BAM Index) is run a log is created with the time it was started and completed.
There could be several files for each process but only 1 log is needed with each of the files in it.
When the second process (# strip off @PG tags) is run a log is created with the time it was started and completed.  Thank you :).
bash
# create BAM Index
logfile=/home/cmccabe/Desktop/NGS/API/2-12-2015/log.log
for f in /home/cmccabe/Desktop/NGS/API/2-12-2015/*.bam ; do
 bname=`basename $f`
 pref=${bname%%.bam}
 samtools index $f
done > "$logfile"

# strip off @PG tags
logfile=/home/cmccabe/Desktop/NGS/API/2-12-2015/log.log
for f in /home/cmccabe/Desktop/NGS/API/2-12-2015/*.bam ; do
 bname=`basename $f`
 pref=${bname%%.bam}
 samtools view -H $f | sed '/^@PG/d' | samtools reheader - $f > /home/cmccabe/Desktop/NGS/API/2-12-2015/${pref}_newheader.bam
done > "$logfile"

A: As Mentioned in my comment:
I do not recommend that you define your output log file in the loop that you will be using using to generate said output.
Second to output data from the loop I would pipe the data at the end of the loop here: done > "$logfile"
I ran your script like below however, it does not actually output anything.
logfile=log.log

# create BAM Index
for f in *.bam ; do
 bname=`basename $f`
 pref=${bname%%.bam}
 samtools index $f
done > "$logfile"

# strip off @PG tags
for f in *.bam ; do
 bname=`basename $f`
 pref=${bname%%.bam}
 samtools view -H $f | sed '/^@PG/d' | samtools reheader - $f > ${pref}_newheader.bam
done > "$logfile"

If you want to achieve this add a line that will echo the starting and ending of the process like below. Please also notice that on the second loop that the output is appended to the log via syntax >> otherwise you will overwrite the log with >
logfile=log.log

# create BAM Index
for f in *.bam ; do
    echo "Start Index creation: $(date) - File: $f"
    bname=$(basename $f)
    pref=${bname%%.bam}
    samtools index $f
    echo "End Index  creation: $(date) - File: $f"
done > "$logfile"

# strip off @PG tags
for f in *.bam ; do
    echo "Start @PG tag strip creation: $(date) - File: $f"
    bname=$(basename $f)
    pref=${bname%%.bam}
    samtools view -H $f | sed '/^@PG/d' | samtools reheader - $f > ${pref}_newheader.bam
    echo "End @PG tag strip creation: $(date) - File: $f"
done >> "$logfile"

Log file look likes:
Start Index creation: Sat Feb 20 09:58:46 EST 2016 - File: wgEncodeUwRepliSeqBjG1bAlnRep1.bam
End Index  creation: Sat Feb 20 09:58:47 EST 2016 - File: wgEncodeUwRepliSeqBjG1bAlnRep1.bam
Start @PG tag strip creation: Sat Feb 20 09:58:47 EST 2016 - File: wgEncodeUwRepliSeqBjG1bAlnRep1.bam
End @PG tag strip creation: Sat Feb 20 09:58:47 EST 2016 - File: wgEncodeUwRepliSeqBjG1bAlnRep1.bam


text:
Q: MySQL query slow (DISTINCT WHERE on indexed column) Specs:

*

*MySQL version: 5.6.19 (Ubuntu)

*Also tried MariaDB, and got the same problem

Table:
CREATE TABLE `x` (
    `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `a` INT(10) UNSIGNED NOT NULL,
    `time` DECIMAL(16,6) NOT NULL,

    PRIMARY KEY (`id`),
    INDEX `a` (`a`),
    INDEX `time` (`time`),
    INDEX `time_a` (`time`, `a`)
)
COLLATE='utf8_unicode_ci'
ENGINE=InnoDB
AUTO_INCREMENT=298846
;

Query:
SELECT COUNT(DISTINCT `a`) c
FROM `x`
WHERE `time` >= (UNIX_TIMESTAMP()- (60 * 24));

This query is very SLOW, if there are a lot of rows with time in the given range. Also note that while there might be a lot of matching rows (thousands or tens of thousands or more), the amount of DISTINCT a's is always rather small (a few hundred).
The query is fast (basically instant), no matter the size of the table, when:

*

*there are only few rows with time in the given range or when

*there is no WHERE part (because of the index on a)

That makes me think that it is somehow unable to use the index on a when counting, even though EXPLAIN mentions all three indices in possibly_keys.
The issue remains even if:

*

*time is of type BIGINT or DATETIME (with corresponding changes to the query)

*ENGINE=MyISAM
Any suggestions?

A: SELECT COUNT(DISTINCT `a`)
    FROM `x`;

will leapfrog through INDEX(a).  See EXPLAIN FORMAT=JSON SELECT ... and look for "using_index_for_group_by": true.  This makes it quite fast when there are only a small number of distinct a values.
I suspect that using the WHERE clause will say "using_index_for_group_by": "scanning", implying that it is less efficient.  I suspect the implementers did the single-key case, but not the multi-key case.
Was that the entire table definition?  I see AUTO_INCREMENT without any index for it.  What's up?  About the only difference between MyISAM and InnoDB that is relevant to this discussion is the handling of the PRIMARY KEY.
The datatype of time is probably not significant.
If I have not satisfied your "Any suggestions?" question, please rephrase the question.

A: Try using index hinting to force the query to use the index you want it to use.
SELECT COUNT(DISTINCT `a`) c
FROM `x` FORCE INDEX (the_index_you_want_to_use)
WHERE `time` >= (UNIX_TIMESTAMP()- (60 * 24));

A: It is best not to do any computations in such where clauses.
var unixtime = UNIX_TIMESTAMP()- (60 * 24)

SELECT COUNT(DISTINCT `a`) c
FROM `x` FORCE INDEX (the_index_you_want_to_use)
WHERE `time` >= unixtime

A: If I had to guess, the problem is types.  UNIX_TIMESTAMP() returns an unsigned integer.  Your time variable is decimal.  These are not the same thing.  And, type mismatches can confuse the optimizer.
It sounds like the table is big, so changing the type is not feasible (you might want to test this, though, if you can by selecting the data into a new table with the right types).
The following might help:
WHERE `time` >= cast(UNIX_TIMESTAMP() - (60 * 24) as unsigned);

You could also declare a local unsigned variable and store the "constant" in the variable to see if that fixes the performance problem.
Finally, if the index on time, a is not being used, try this variation of the query:
SELECT COUNT(*) as c
FROM (SELECT DISTINCT a
      FROM `x`
      WHERE `time` >= CAST(unixtime - 24 * 60 as unsigned)
     ) ax

I have seen this re-structuring improve performance on other databases, although not on MySQL.


text:
Q: optimizing a web design for the iPhone OK, I'm having some issues with my site's mobile stylesheet on the iphone. I reworked the stylesheet to be similar to what http://m.facebook.com give the browser, only I'm getting an issue where the Safari on iPhone browser is still zooming the page out from like 960px, instead of constraining it to the native screen resolution. What gives?
Do you think it has to do with my .container960 class on the body element? I tried reseting those styles with the mobile stylesheet, but maybe it's not reseting the container styles properly.
The site is http://beta.cureinternational.org. You'll need to use username Guest and password guest to view the page.

A: Have you tried adding a meta-tag like this?
<meta name = "viewport" content = "width = device-width">

Or hard-coding in the dimensions yourself (see Viewport in https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html)


text:
Q: Extract lat long point values from EASE2 without reprojection I have the following file:
EASE2
and want to extract the values for this geographic location (148.1, -35.6) #lon lat.
How can I do this without the need for reprojecting the ease grid file into geographic projection?
Here is an example code:
library(raster)
r <- raster (file)
e <- data.frame(148.1, -35.6)
ext <- extract(r, e)

A: Transform the point to the coordinate system of the raster.
Make the point into a SpatialPointsDataFrame in the lat-long coordinate system:
> e <- data.frame(x=148.1, y=-35.6, id=1)
> coordinates(e)=~x+y
> projection(e)=CRS("+init=epsg:4326")

then transform to the coordinates of the raster:
> et = spTransform(e,projection(r))
> plot(r)
> points(et,col="red",pch=19)

Shows me the point is on the Australian south-east coast. Extract:
> extract(r,et)

1


text:
Q: Array Buttons Category Selection Like FLIPBOARD APP I'm trying to do a filtering, in which the user selects his/her interest in the category section. Just like FLIPBOARD .

Mine:simpleCategory.xml

My sample crop code: CategorySelection.java basis button Arrays sample
private List<Button> buttons;
private static final int[] BUTTON_IDS = {
        R.id.buttonOne,
        R.id.buttonTwo,
        R.id.buttonThree,
        R.id.buttonFour,
        R.id.buttonFive,
        R.id.buttonSix,
        R.id.buttonSeven,
        R.id.buttonEight

};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.game_board_view);

    buttons = new ArrayList<Button>();

    for(int id : BUTTON_IDS) {
        Button button = (Button)findViewById(id);
        button.setOnClickListener(this); // maybe
        buttons.add(button);
    }
}

@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.buttonOne:
            Log.d("TAG", "Pressed button one.");
            break;
        case R.id.buttonTwo:
            Log.d("TAG", "Pressed button one.");
            break;
        // ...
    }

*

*How do I make the button Highlight if press.

*Get the Text of the button position selected.

*And Store them in a temporaryVariable those that are selected.

I need to get the data that is stored in temporaryVariable so that I can used in my SQL Statement like this
$sql_filter = "SELECT orgName FROM orgData WHERE orgCategory = '$temporaryVariable'";


text:
Q: Data not inserting into MySQL I have a problem because when I try to insert data into my sql from minecraft plugin it does not insert but gives and error (Image) Image. I want to ID insert automaticly (I have Unique and Primary key set up in phpmyadmin) admin to be null or empty. reciever to be player (I can do it by myself) and priority to be set to 0 .
MyCode:
if(args[0].equals(args[0])) {
                StringBuilder message = new StringBuilder();
                for(int i = 0; i < args.length; i++) {
                    message.append(args[i]).append(" ");
                }

                try {
                    MySQL.ps("INSERT INTO `sawioreports`(id, admin, reciever, priority) VALUES ('', 'NULL', 'Sawio2001', '0');").executeUpdate();
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cWyslano Report"));
                }catch(SQLException ev) {
                    ev.printStackTrace();
                }
    }
            return true;
}


text:
Q: Installing rabbitmq through my wix installer and creating new user and host failed We install Erlang 22.3 and RabbitMQ 3.83 through Wix Installer. This installer runs redistributable from Erlang and rabbitMQ and then use the custom actions to create the host and user. While doing so we get the error :

System.AggregateException: One or more errors occurred. --->
System.Net.Http.HttpRequestException: An error occurred while sending
the request. ---> System.Net.WebException: Unable to connect to the
remote server ---> System.Net.Sockets.SocketException: No connection
could be made because the target machine actively refused it
127.0.0.1:15672

The problem we realised was it gets the different value for Erlang cookie on the locations - C:\Windows\System32\config\systemprofile and C:\Users\%USERPROFILE%.
Another observation is even though the Erlang cookies are different, the host and user get created on few VMs on the other hand even if the Erlang cookie is same the user does not get created few VMs. On a separate note both all these VMs are installed from same image.


text:
Q: Fatal error: Class 'http\Client' not found in I am trying to call Rest API using HttpClient but getting
error "Fatal error: Class 'http\Client' not found in"
PHP Code :
$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->addForm(NULL, array(
      array(
                'name' => 'attachment',
                'type' => null,
                'file' => REPORTPATH . $_SERVER['HTTP_DISTRIBUTORAPIKEY'] . "\\08122017123602.zip",
                'data' => null
            )
        ));

 $request->setRequestUrl('http://192.168.1.55/api/upload');
 $request->setRequestMethod('POST');
 $request->setBody($body);

 $request->setHeaders(array(
            'cache-control' => 'no-cache',
            'foldername' => '1HUBH',
            'distributorcode' => '1HUBH'
        ));

 $client->enqueue($request)->send();
 $response = $client->getResponse();

 echo $response->getBody();


text:
Q: Unable to get space between the 2 rows I need some space between the 2 rows. When I use
 nothing happens, If i use padding, nothing happens. If i don't use block styles in the div's only the text moves down with padding and br. The images just don't move.

The Team

Siddharth

Founder, CTO

Having invested bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla .

Zubin

Advisor

Zubin is a bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla .

As of now it looks like as below :

A: Where are  and  tags in your html?  padding-botom  is the correct way of using. Not  padding=bottom . Try using this CODE
    .photo {
       padding-right: 0%; width:30%;  float: left;
       padding-top:20%;
       height:50%
    }

Note: Using br tags for line spacing is a bad habit.

A:

Add an id or class for this and  use css
id/class
{
 padding:10px;
}

A: set am margin bottom for class photo
.photo {
padding-right: 5%; width:20%;  float: left; margin-bottom:40px;
}

as a demo : http://jsfiddle.net/parslook/Msxmp/

A: I have created a fiddle for you. http://jsfiddle.net/RL4q9/2/
  have a look at this.
   .photo
   {
     padding-right: 0%; float: left;width:100px;
     padding-top:20%;;
   }

I hope you wanted to achieve this.Please vote.

A: Your problem is your floats. Float takes the element out of the normal docment flow.
Add a class to you "staff" div and use that to clear the floats.
HTML

Siddharth

Founder, CTO

Having invested bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla .

Zubin

Advisor

Zubin is a bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla .

CSS
.staff
{
margin-bottom:10px;
clear:both;}

.photo {
    padding-right: 5%;
    width:20%;
    float:left;
}
.intro {
    width: 60%;
    padding-right: 10%;
    padding-bottom:0px;
}

Now you can put a margin on the bottom of the containing divs.
See this fiddle: http://jsfiddle.net/2rj9u/1/
You might also wan't to look at using display:inline-block instead of floats: http://robertnyman.com/2010/02/24/css-display-inline-block-why-it-rocks-and-why-it-sucks/.
On a side note don't use elements like h4 purely for styling purpose.


text:
Q: NuxtAuth devuelve siempre error 401 Utilizo Nuxt Auth para mi login, y veo que el login se realiza, y se guarda el token en el storage, pero al momento de tratar de obtener la informacion del usuario siempre me da un error 401. Por favor ayuda.
Esta es mi configuracion dentro de nuxt.config.js
auth: {
strategies: {
  local: {
    token: {
      property: 'token',
      global: true,
      // required: true,
      type: 'Bearer'
    },
    user: {
      property: 'user',
      // autoFetch: true
    },
    endpoints: {
      login: { url: '/auth/login', method: 'post', propertyName:'token'},
      user: { url: '/users/me', method: 'get', propertyName: 'data.attributes'},
      logout: false
    }
  }
}

},
Asi me llega en el storage:


text:
Q: Retrieval of RavenDb Etags is slow We're starting to use a distributed caching strategy on top of our central RavenDb database.
As a part of this strategy, we're retrieving Etag of a document from RavenDb and a value of the object from local Azure blob storage cache.
Our objects are changed extremely infrequently (10-100 object changes per day) but are retrieved extremely frequently (about 5000 object retrievals a minute and growing)
This is a multi-threaded environment, and internal RavenDb cache is not big enough to store all objects in the AggresiveCache mode.
Anyway, we're seeing terrible times with retrieval of Etags from Raven.  Between 1 and 10 seconds (!!!???) What are we doing wrong?  This is the code
return _session.Advanced.DocumentStore.DatabaseCommands.Head(id).Etag;

A: You are making a request per call, which means that you have to pay a lot of the cost of already fetching the document.
It will likely be cheaper to just load the document directly instead of doing the Head


text:
Q: Does BigQuery automatically replicate data across zones/regions? I'm reading through BigQuery doc and I'm confused by the point quoted below.
Source: Google Doc

BigQuery transparently and automatically provides highly durable,
replicated storage in multiple locations and high availability with no
extra charge and no additional setup.

Source: Google Doc

BigQuery does not automatically provide a backup or replica of your data in
another geographic region. You can create cross-region dataset copies
to enhance your disaster recovery strategy.

*

*Does BigQuery automatically replicate data across zones/regions?

*For long term data storage, given the options of Big Table, Big Query and Regional Persistent Disk, is it preferable to use Regional Persistent Disk to automatically replicate data across different geographical location?

A: *

*Yes, BigQuery automatically replicates data across zones/regions.

It's the part of Google doc

In either case, BigQuery automatically stores copies of your data in two different Google Cloud zones within the selected location.

But as you read, I think that you're missing some information. it mentions a hard regional failure.
What is hard regional failure? as Google Doc describe,

Hard failure is an operational deficiency where hardware is destroyed. Hard failures are more severe than soft failures. Hard failure examples include damage from floods, terrorist attacks, earthquakes, and hurricanes.

For example, in Asia-east1 (Taiwan), earthquake occurrence is quite frequent, if you're creating a dataset in this region, you might consider cross-region dataset copies to enhance your disaster recovery strategy.

*I think that you can export your table data to GCS for long term data storage

Because there are some storage classes. For example,

Archive Storage is the lowest-cost, highly durable storage service for data archiving, online backup, and disaster recovery.


text:
Q: Does Gatsby support MongoDB relationships? I am building a personal blog and chose Gatsby because of the obvious reasons(performance and easy to start out) and because I have some React background for the frontend. Also, I had built a simple app to create my content(html string) and store in a MongoDB database using express server. Now for the blog, I am just trying to pull the data from MongoDB using gatsby-source-mongodb plugin.
My MongoDB schemas have relationships. For instance, a 'Post' schema has a 'user' property which is an ObjectID that references a user from 'User' schema. My config for the gatsby-source-mongodb looks like:
    {
      resolve: 'gatsby-source-mongodb',
      options: {
          dbName: 'KathaDB',
          collection: 'posts',
          server: {
              address: "somecluster",
              port: 27017
          },
          auth: {
              user: 'someuser',
              password: 'somepasswd'
          },
          extraParams: {
            replicaSet: 'test',
            ssl: true,
            authSource: 'admin',
            retryWrites: true,
            preserveObjectIds: true
        }

      }
  }

I have a couple of questions:

*

*When I query, I get all the properties from my 'Post' schema but I don't have 'user' property in the response. I don't know if it is due to the type of the property. I dug up a bit and found a similar issue here. It seems like they have solved the issue by preserving the ObjectID but i didn't even get the property that is of type ObjectID.

*Another thing, does this plugin support relationships? For example, is it possible to get the 'user' data when its ObjectID is given?

A: It does.
MongoDB relies on ObjectIDs for relationships, so you might have to add preserveObjectIds: true to your plugin options:
{
  resolve: "gatsby-source-mongodb",
  options: {
    dbName: "KathaDB",
    collection: "posts",
    server: {
      address: "somecluster",
      port: 27017,
    },
    auth: {
      user: "someuser",
      password: "somepasswd",
    },
    extraParams: {
      replicaSet: "test",
      ssl: true,
      authSource: "admin",
      retryWrites: true,
      preserveObjectIds: true,
    },
    preserveObjectIds: true, // <= here
  },
};

I'm unsure whether gatsby-source-mongodb creates the relationships out of the box (I don't think it does, if my memory is correct), but with the ObjectIds, you can create foreign-key relationships using GraphQL.
There are two ways of doing this in Gatsby:

*

*Using mappings in gatsby-config.js

*Using a GraphQL @link directive through Gatsby's schema customization (from v2.2)

I recommend the second option, since it's a more GraphQL way of doing things, and happens in gatsby-node.js where most node operations are taking place. However, if you're starting out with Gatsby and GraphQL, the first option might be easier to set up.


text:
Q: Handling multiple JWTs on client side to access multiple resource endpoints I am trying to get a sense of how I can handle juggling multiple JWT tokens on the frontend that will be accessing the same user agnostic api endpoints.
For example, I am calling two endpoints to get a JWT for the PrimaryUser and JWT for the SecondaryUser. On the backend, they are tied together as DualUsers. Inside of these tokens, I have the userId for each user.
I have multiple resource endpoints that will update based on the userId that is given in the JWT. I have about 100 of these.
On the front-end, I am currently overwriting the Authorization header whenever I need update one resource:
// updateUser(payload: object, config: RequestConfig)
// will update the user with primary user (default) Authorization header w/ JWT token
updateUser({firstName: 'Bob'})

// secondaryUserRequestConfig(): returns config with overriding Authorization w/ JWT tokens
updateUser({firstName: 'Ted'}, secondaryUserRequestConfig)

The alternative would be to create a single JWT and have the backend handle explicit parameter for each PrimaryUser.userId and SecondaryUser.userId, but updating 100 endpoints seems like a lot. Is there a cleaner way to handle this case where I want to keep the backend endpoints relatively agnostic but also not have to pass in secondaryUserRequestConfig

A: you can use axios interceptors to dynamically change axios config request,
using the URLs as a scope for endpoint 1 and endpoint 2, you can change their configuration by looking at the current url being requested:
import * as axios from "axios";

function createAxios() {
  let instance = axios.create();
  instance.interceptors.request.use(
    function (config) {
      let [endpoint, url] = config.url.split("#");
      if (endpoint === "cat") {
        config.url = `https://api.thecatapi.com/${url}`;
        config.headers = {
          "X-Custom-Interceptor": "For Cat"
        };
      }
      if (endpoint === "anime") {
        config.url = `https://api.jikan.moe/${url}`;
      }
      return config;
    },
    function (error) {
      // Do something with request error
      return Promise.reject(error);
    }
  );
  return instance;
}

// Later in you code...
let remote = createAxios();

export default function App() {
  // ...
  return (
    <div>
      <button
        onClick={() => {
          remote.get("cat#v1/images/search")
        }}
      >
        Endpoint 1
      </button>
      <button
        onClick={() => {
          remote.get("anime#/v3/anime/1/episodes/1")
        }}
      >
        Endpoint 2
      </button>
    </div>
  );
}

from there, you can attached any headers that you want,
i built a working example in:
https://codesandbox.io/s/2021-03-26-axios-with-interceptor-zs2zg?file=/src/App.js:0-1614


text:
Q: Can't get onclick on a button to be accepted I currently have a link in the below form:
Change

In order to fit the look of the site in which I'm adding this link, I want to change it to a button input, as so:
<input type="button" value="Change" onclick="changeNumbers('Numbers', '@Url.Action("ChangeNumbers")')" />

However, I'm running into a snag with this second form:  the single quotes around @Url.Action("ChangeNumbers") are being flagged as Unterminated string constant.  Can anyone tell me what I'm doing incorrectly and how to fix it?
EDIT
It didn't occur to me to just try the page - it looks like the second form works.  So now my question is - why is Visual Studio flagging this as incorrect?

A: You're not doing anything "incorrectly" per se, it's just that Razor isn't perfect, and things like quotes within quotes tend to cause it to freak.
One quick fix would be to store the URL in a variable and then use the variable:
@{ var url = Url.Action("ChangeNumbers"); }
<input type="button" value="Change" onclick="changeNumbers('Numbers', '@url')" />

However, an even better fix is to not use the onclick attribute at all. Put this where it belongs: in JS.

Used jQuery above, since it's included in MVC by default

A: I've found that to make Visual Studio happy in this scenario, the easiest thing to do is simply change the <input /> element to a <button></button> element and the error will resolve itself:
<button type="button" onclick="changeNumbers('Numbers', '@Url.Action("ChangeNumbers")')">Change</button>

Otherwise, to continue using an <input /> the markup will need to be changed to the following:
<input type="button" value="Change" onclick="@("changeNumbers('Numbers', '" + Url.Action("ChangeNumbers") + "')")" />


text:
Q: Circle clip path I have a circular image. I want to cut the top of it as I have shown in the picture. Is it possible to do this with clip path?
Thanks.

.circle {
  width: 75px;
  height: 75px;
  background-color: red;
  border-radius: 50%;
}

A: Yes you could use the inset() CSS function :

.circle {
  width: 75px;
  height: 75px;
  background-color: red;
  border-radius: 50%;
  clip-path: inset(20px 0 0 0);
}

A: mask can also do it:

.circle {
  width: 75px;
  height: 75px;
  background-color: red;
  border-radius: 50%;
  -webkit-mask: linear-gradient(#0000 20%,#000 0);
}


text:
Q: Using a complex .d.ts file (chrome-app.d.ts) Most .d.ts files are straightforward to use, jQuery.d.ts for instance. But now I have hit up against chrome-app.d.ts and it isn't clear (to me!) how this typings file can be imported. chrome-app.d.ts comprises a series of module definitions, each containing interfaces and exported functions. Here is a snip:
declare module chrome.app.runtime {
    interface LaunchData {
        id?: string;
        ......
        ......
}

declare module chrome.app.window {
    interface ContentBounds {
        left?: number;
        ......
        ......
    export function current(): AppWindow;
    export function get(id: string): AppWindow;
    export function getAll(): AppWindow[];
}

and so on, seven modules in total. The module names are not quoted. There is no top level export declaration.
How can I use (i.e. import) this definition file in my ts? I would like to use chrome.app.window.get() and so on, staying with the JS definitions in the Goog documentation. SO answer Using a Typescript .d.ts file that doesn't declare a module nearly works for my problem. In that solution, add to a supplementary .d.ts file with a quoted module name:
declare module 'chrome.app.runtime' { export = chrome.app.runtime; }

and indeed I can use this:
import chromeAppRuntime = require('chrome.app.runtime');

but I cannot use this:
import chrome.app.runtime = require('chrome.app.runtime');

So would this be OK and preserve the tool chain:
import fooBar = require('chrome.app.runtime');
var chrome = {app: {runtime: fooBar}};

Is there anything simpler :)

A: The chrome object is a global namespace object, not some external module. This chrome-app.d.ts file describes the global object that exists within the scope of a Chrome extension. It uses the (discouraged/deprecated) module keyword, which is identical to the less confusing namespace keyword in newer versions of TypeScript. In other words, this d.ts file is declaring namespace objects in the global scope.
To use this d.ts file, you don't import it, you pass it directly to the compiler along with your own code:
tsc my/extension.ts chrome-app.d.ts

Your code then uses the chrome object directly just like you would use window or document directly from the global scope of a script that runs in the DOM. (The TypeScript compiler implicitly includes the bundled lib.d.ts when you run it, which exposes the DOM API.)


text:
Q: Clickable link in javascript alert box Is it possible to add an anchor tag in an alert box using jquery? I am trying to show a clickable link in the alert box of jquery, but I can only get text in the box.
alert('Please read the rules')

How do I get this done in jquery?

A: It's impossible to place any HTML code into alert dialogs. You'd better consider using some JavaScript based dialogs (for example from https://jqueryui.com/dialog/)


text:
Q: Python - Use same socket in multiple functions I'm trying to use a python socket across multiple functions, but i'm not sure how. I get the error:
Traceback (most recent call last):
  File "C:\Users\User\Desktop\PyBattle.py", line 169, in <module>
    client()
  File "C:\Users\User\Desktop\PyBattle.py", line 157, in client
    clientWait()
  File "C:\Users\User\Desktop\PyBattle.py", line 107, in clientWait
    data = s.recv(BUFFER_SIZE)
  File "C:\Python27\lib\socket.py", line 170, in _dummy
    raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor

Here's a section of the client function:
def client():
    print "Enter server IP."
    TCP_IP = raw_input(">")
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((TCP_IP, TCP_PORT))

Here's the clientWait function:
def clientWait():
    os.system("cls")
    print "Not your turn."
    print "Username:" + username + " HP:" + str(hp) + " Level:" + str(level) + " Attack:" + str(attack) + " Defence:" + str(defence) + " Speed:" + str(speed)
    print "Opponent:" + opponentUsername + " HP:" + str(opponentHp) + " Level:" + str(opponentLevel) + " Attack:" + str(opponentAttack) + " Defence:" + str(opponentDefence) + " Speed:" + str(opponentSpeed)
    data = s.recv(BUFFER_SIZE)
    clientProcess()

I believe it's to do with the fact that the socket isn't global? Thanks for all your help in advance.

A: Your error isn't specifically because the socket isn't "global".  It's because the s you're referring to in your clientWait function isn't the local variable s in your client function.  You've created it elsewhere (and haven't shown us where).
Please don't make your socket "global".  Just return if from your client function, and pass it into your clientWait function.
You should probably look into restructuring your code in terms of classes, and making most of your variables instance variables.  It looks like you're using global variables throughout which will make your program brittle, hard to understand, hard to test, hard to document, etc..

A: It turns out all I had to do was declare s as global before giving it a value. So:
global s
s = ...

Thanks again for all the answers, and thank you Gerrat for the help.


text:
Q: Loop as3; function intersects; onEnterFrame On the stage I have a three kind of movieclips
Few static movieclips whose name is: mc1; mc2; mc3....  them are visible on stage
Few static movielips" othermc1; othermc2l othermc3... and them have "visible = false"
One movieclip whose is moving on the stage and his name is "slider"
I have function when mc "slider" intersects one of the rest of mc1, mc2... to turn visible othermc1, othermc2
var alreadyHandled:Boolean = false;

addEventListener(Event.ENTER_FRAME, onEnterFrame);

function onEnterFrame(e:Event):void
{
    if(mc1.getRect(this).intersects(slider.getRect(this)))
    {
        if(!alreadyHandled)
        {
            show1();
            alreadyHandled = true;
        }
    }
    else
    {
        alreadyHandled = false;
        no1();
    }

function show1():void
{
    othermc1.visible = true;
}
function no1():void
{
    othermc2.visible = false;
}

How can i use this code in loop?
Thanks for help

A: If you want loop through mc1, mc2, mc3,... create an Array of MovieClips:
var movieClips:Array = [mc1,mc2,mc3/*,other...*/];

Then use for to iterate over the array elements:
for(var i:int=0; i<movieClips.length; i++){
   //do some thing with movieClips[i]
}

This code may help you:
var mc:Array = [mc1,mc2,mc3/*,...*/];
var omc:Array = [othermc1,othermc2,othermc3/*,other...*/];
addEventListener(Event.ENTER_FRAME, onEnterFrame);

function onEnterFrame(e:Event):void
{
    for(var i:int=0; i<mc.length; i++)
        if(mc[i].getRect(this).intersects(slider.getRect(this)))
            showMovieClip(i); //or omc[i].visible=true;
        else
            hideMovieClip(i); //or omc[i].visible=false;
}
function showMovieClip(i:int):void
{
    omc[i].visible = true;
}
function hideMovieClip(i:int):void
{
    omc[i].visible = false;
}


text:
Q: Text under brackets doesn't align correctly I'm trying to achieve what you see in the following picture:

But all I am getting is the following graphic:

I want the word SKOPUS under the underbrace.
Here is my code, can anyone please explain me what I am doing wrong and how could I fix this?
\[\underbrace{\[  %ex.26
\left\{\begin{array}{c}
    \text{always} \\
    \text{sometimes} \\
    \text{never} \\
    \text{usually} \\
    \text{\dots}
    \end{array}\right\}$_{\text{SKOPUS}}}$\]\]

Thank you very much.
PS: Picture B should say QUANTOR instead of SKOPUS.

A: Try with
\[\underbrace{  %ex.26
\left\{\begin{array}{c}
    \text{always} \\
    \text{sometimes} \\
    \text{never} \\
    \text{usually} \\
    \text{\dots}
    \end{array}\right\}}_{\mbox{SKOPUS}}\]

instead


text:
Q: SSH + Kerberos but WITHOUT DNS I was wondering if there's a way to set up SSH with Kerberos authentication without using a DNS server at all ?

A: You can avoid DNS by the following (assuming MIT Kerberos):
1) Give the KDCs in krb5.conf instead of locating them via SRV records, and do not do realm mapping via DNS TXT records:
[libdefaults]
dns_lookup_kdc   = no
dns_lookup_realm = no

[realms]
FOO.COM = {
    kdc = kdc.foo.com
}

2) Make sure all your hostname->address and reverse mappings are in your /etc/hosts file, and perhaps just disable the use of DNS for gethostbyname() etc. in /etc/nsswitch.conf.
I do not agree with the previous answer's claim that "compromise of the DNS infrastructure does not (directly) compromise the Kerberos infrastructure." Using SRV records to locate KDCs does not, since clients can authenticate the KDC (they share a secret with the KDC, or the KDC must present a valid certificate if PKINIT is used), and in any case a bogus KDC will just produce bogus tickets which won't work when used. But DNS name canonicalization and realm mapping can be hazards. A DNS spoofer can cause a client to acquire a ticket for a different service than the one it intends to contact (by changing the hostname portion of a "hostbased service" name, the most common) -- perhaps a service whose keys the attacker has previously compromised. Similar comments apply to realm mapping, though it's harder to take advantage of misleading the client regarding the realm.

A: Sort of.
Kerberos will not work correctly unless the hosts can resolve each other properly.  This is almost always done with a DNS server.  Theoretically, however, it could be done by distributing a hosts file around to each machine that is going to be part of the Kerberos domain.  This is almost certainly not what you want to be doing.
Why the opposition to the DNS server?

A: I can't add comment yet due to my reputation and the question has been answered.
But if standard DNS is a security problem for you, maybe you can take a look at DNSSEC: http://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions


text:
Q: Percentage - How To Know The Original Value I'm practicing for SAT, and encountered this question:

The graph below shows the percentage of American households that owned landline telephones from 2000 to 2006.

According to the data above, the percentage of American households with landline telephones in 2001 was what percent greater than the percentage of American households with landline telephones in 2005?

I know that such a question should be solved like this: Difference / Original.
So I solved it like this: (Percentage in 2001 - Percentage in 2005) / Percentage in 2005.
= (80 - 60) / 60 = 20 / 60 = 0.33 = 33%.
But then when I reviewed the answers the right answer was: 25%. It said that 80 is the original number and not 60 so it becomes: 20 / 80 = 0.25 = 25%.
My question is: How to know which one is the original number? (it's obvious in some questions but here it's so confusing).

A: The answer you calculated is correct. In context, your answer allows us to answer the question as: "According to the data above, the percentage of American households with landline telephones in 2001 was $33.3$ percent greater than the percentage of American households with landline telephones in 2005". Which makes sense as $80=60\times\left(1+\frac{33.3}{100}\right)$. But with the given answer we instead have $60=80\times\left(1-\frac{25}{100}\right)$ which does not answer the given question.


text:
Q: Is it normal to have cli listening on port 41049? I never knew that cli (command line interface) needs a port to listen to. Why would command line interface need a tcp port open? Is cli something else?
Is it normal to have this port open on my Ubuntu 16.04?
Here is my netstat output:
$ sudo netstat -ntlp
    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      959/mysqld
    tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1474/dnsmasq
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      932/sshd
    tcp        0      0 127.0.0.1:41049         0.0.0.0:*               LISTEN      4811/cli
    tcp6       0      0 :::80                   :::*                    LISTEN      1058/apache2
    tcp6       0      0 :::22                   :::*                    LISTEN      932/sshd

I'm fine with the other ports because I need apache, ssh and mysql. After googling I found that it is normal to have dnsmasq but nothing about cli.

A: For check which process is listening on 41049 port you can run this command:
ps -o args= -p "$(sudo lsof -t -i:41049)"

As you said in this comment, the output is refer to keepass2 package. So look around this package:
I'm trying to install this package and check the output:
sudo apt install keepass2

And the output of sudo netstat -ntlp is:
tcp        0      0 127.0.0.1:40967         0.0.0.0:*               LISTEN      8393/cli

So after installing keepass2, cli is listening on local TCP port.
So, your outputs is quite normal.

Really I don't know why keepass2 is listening on this port. But it's may be a bug. For its description you can look at this link .

But because of that , keepass2 is available in Ubuntu's official repositories , it cannot be a threat for you.
You can see this package description on Ubuntu package.


text:
Q: Should I unit test methods that have a cyclomatic complexity of 1 if they are part of larger interactions? I'm kind of new to unit testing so please excuse a naive question.
I've heard the idea of not testing anything that has a cyclomatic complexity of 1. This is interesting to me b/c I do a lot of interaction testing between events. For example, button is pressed, fires an event, raises event on presenter, presenter modifies the model, and presenter calls method on the view. So I test to make sure that when the button event is raised, the right method on the view is called.
Each method in this sequence may have a cyclomatic complexity of 1. There is no branching. But if I want to test it as a "system" (i.e. view, presenter, model) cyclomatic complexity is higher -- adding up all the 1-valued methods in the event sequence.
So my question is when people suggest that I don't need to test methods that have a cyclomatic complexity of 1, are they not talking about interaction tests for testing interactions between classes like I've described above?
I've come across this idea twice this week - once in a Mark Seemann Pluralsight video and once here: http://webquali.com/blog/67/15-ways-to-write-beautiful-code.html.

A: Think of tests not in terms of prescriptive TDD, but as a harness that allows your developers to find out if the unexpected change in behaviour happens when your CI runs the integration.
As a simple example you were provided in comments, for a calculator method:
public int Minus(int a, int b) => a - b;
Not writing a unit test for it may result in someone accidentally changing the code like so:
public int Minus(int a, int b) => a + b;
which would inevitably break the whole app at runtime.
So typically the recommendation would be: for each line of code written by developers in your team where someone wrote it, there should be a corresponding implicit or explicit assertion.
When we say implicit assertion, we mean, for example:
public object ReturnMytype() => new MyType { MyProperty = "a" };
[TestMethod]
public void ReturnMytype_SetsMyPropertytoA(){
   Assert.AreEqual("a", (new MyClass().ReturnMytype as MyType).MyProperty);
}

In the above unit test the assertion that ReturnMytype returns correct type is implicit (typecast). This one test is sufficient to assert both behaviours of method under test - that it returns a MyType and that it sets MyProperty to "a".


text:
Q: Loading scripts async in next.js I have a very small page in next.js that simply says Finding you a game...
I need it to render almost instantaneously.
The problem is, it needs to load some heavy libraries to find the game in the first place.
Currently, next.js is loading those libraries before showing Finding you a game....
What I want to do is to mark all the dependencies as async or defer so that the page renders first and then the dependencies get loaded.
How do I do that?


text:
Q: How I can avoid caching of NSString instances in Objective-C runtime? Objective-C can to cache short strings. If you run modified code from original question, you'll get result, that strings is same (one instance) (Build for OS X Yosemite). How to avoid this behaviour?
NSString* value1;
NSString* value2;
__weak NSString* weakValue1;
__weak NSString* weakValue2;
NSMutableString* resultText = [NSMutableString new];

@autoreleasepool
{
    value1 = [[NSString alloc] initWithFormat:@"Heo: %d", 1];
    value2 = [[NSString alloc] initWithFormat:@"Heo: %d", 1];
    if (value2 == value1)
    {
        NSLog(@"same strings");
    }
    [self injectToString:value2];
    weakValue1 = value1;
    weakValue2 = value2;

    [resultText appendFormat: @"  value1 = %@", weakValue1];
    [resultText appendFormat: @"  value2 = %@", weakValue2];

    value1 = nil;
    value2 = nil;
}
[resultText appendFormat: @"  value1 = %@", weakValue1];
[resultText appendFormat: @"  value2 = %@", weakValue2];

NSLog( @"resultText = %@", resultText );

UPD
Problems:

*

*(value2 == value1) = true, but if you change @"Heo: %d" to @"Hellow: %d", it'll return false.

*weakValue1 and weakValue2 do not become nil (never), but if you change @"Heo: %d" to @"Hello: %d", then weakValue1 and weakValue2 become nil.  I think it is problem.

A: You're talking about avoiding implementation details, so whatever you come up with might become obsolete, but there's two things I can think of that are very unlikely to change.
First, you can go full-on wacko and re-build the string:
@interface NSString (WSSUncached)

+ (instancetype)WSSUncachedStringWithString:(NSString *)s;

@end

@implementation NSString (WSSUncached)

+ (instancetype)WSSUncachedStringWithString:(NSString *)s
{
    NSMutableString * newS = [NSMutableString string];

    [s enumerateSubstringsInRange:(NSRange){0, [s length]}
                          options:NSStringEnumerationByComposedCharacterSequences
                       usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
                           [newS appendString:substring];
                       }];

    return newS; // or [NSString stringWithString:newS]; if you're feeling especially crazy
}

@end

This does not throw on the 10.9 SDK.
int main(int argc, const char * argv[])
{

    @autoreleasepool {

        NSString * s = @"Hello, world!";
        NSCAssert([NSString WSSUncachedStringWithString:s] !=
                    [NSString WSSUncachedStringWithString:s],
                  @"No good: even constructed strings are cached.");

    }
    return 0;
}

Variations on this are possible, of course: C array with ASCII values, or transfer to NSData first...
The more sensible option would probably be loading the strings from a file.
NSString * fileString = [NSString stringWithContentsOfFile:@"Helloworld.txt"
                                                  encoding:NSUTF8StringEncoding
                                                     error:NULL];
NSString * sameFileString = [NSString stringWithContentsOfFile:@"Helloworld.txt"
                                                      encoding:NSUTF8StringEncoding
                                                         error:NULL];
NSCAssert(fileString != sameFileString, @"Nope; file strings are cached too.");

Even with Helloworld.txt being empty, this assertion succeeds.


text:
Q: how to save captured photos within an app iOS? I am making an iphone application in which
1) i want to take the picture in an application that i know how to do
2) now i want to save that picture in specified folder of an application only. Is it possible to do so. Any help will be really appreciated.
Thank you

A: Try this
You can use the following code in UIImagePickerControllerDelegate delegate implementation
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

//obtaining saving path
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *imagePath = [documentsDirectory stringByAppendingPathComponent:@"latest_photo.png"];

//extracting image from the picker and saving it
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:@"public.image"]){
    UIImage *editedImage = [info objectForKey:UIImagePickerControllerEditedImage];
    NSData *webData = UIImagePNGRepresentation(editedImage);
    [webData writeToFile:imagePath atomically:YES];
}
}


text:
Q: How to convert integer into string gnuplot My code is the following, I would like a to assume iteratives values like '3' , '4' and so on. My code is like:
a=2
#perform some basic operation like:
b=a*2
#convert it to string
c=str(b)
p path1 u 1:($1<=0?$@c:1/0) w filledcurves y=0

The solution proposed on similar topic here so far did not work.

A: You should use this syntax
  c=''.b

c will be equal to 'b'

A: gnuplot provides both sprintf (as in the C language routine) and a private implementation gprintf that offers formatting options beyond the normal ones provided by the C language.   The full details with all supported format options are in the gnuplot documentation.   A very simple use would be:
c = sprintf("%8.3f", b)

However, it makes no sense to convert the value to a string if your intent is to use it in a plot command that expects a number.  There is no iteration in the pseudo-code you show so I can't guess exactly where you are headed with this but note that the operation @c to evaluate c as a macro expansion inside an iteration will always yield the content of c as it was prior to the iteration. So using the @ operator inside an iteration is almost always wrong.

A: If I correctly understand your minimal incomplete non-working example, I can only guess what you probably wanted to do, i.e. limit the plot of a dataset in a certain column which is selected by some variable. Correct? If my guess is true, I would do it the following way, no need for string conversion and the use of macros. Check help column.
a=2
# perform some basic operation like:
b=a*2
plot path1 u 1:($1<=0 ? column(b) : NaN) w filledcurves y=0


text:
Q: Insert SQL Entries sorted I have a very large sql table that I want to display. However, ist most cases I just want to have it sorted by my datetime-column.
Unfortunately, the regular select-query only displays the table ordered by the primary key (id) - therefore, I have to always manually add 'order by' to my select-query, which is a problem, because sorting the table takes several seconds, even with index.
So my question, is there a way to insert new entries sorted into the table? (by 'sorted', I mean, sorted by the datetime-column, instead of the id column). The incoming entry (id=50) should be sorted before id=49, because it has an earlier datetime-value
Then, using a SELECT * FROM myTable should already show everything sorted by datetime
I realize that it's a bad practice and that I should use order-by, but its not really feasible in my case, because I have millions of entries, which have to be sorted again and again for every select

A: When you have a MyISAM table, you can do
ALTER TABLE your_table ORDER BY whatever_column;

But the table does not stay this way, when you insert or update entries.
Read more about it here.
This does not make sense for InnoDB tables, however. They are sorted by the clustered index. In this case an option can be to extend your primary key to (datetime_column, column_thats_primary_key_so_far). This is untested, personally I would add an ORDER BY to the SELECT, just in case.

A: It won't keep the data sorted for future inserts, but you can change the table ordering like this:
ALTER TABLE myTable ORDER BY timestamp


text:
Q: How to preserve information when failing? I'm writing some code that uses the StateT monad transformer to keep track of some stateful information (logging and more).
The monad I'm passing to StateT is very simple:
data CheckerError a = Bad {errorMessage :: Log} | Good a
    deriving (Eq, Show)

instance Monad CheckerError where
    return x = Good x

    fail msg = Bad msg

    (Bad msg) >>= f = Bad msg
    (Good x) >>= f = f x

type CheckerMonad a = StateT CheckerState CheckerError a

It's just a Left and Right variant.
What troubles me is the definition of fail. In my computation I produce a lot of information inside this monad and I'd like to keep this information even when failing.
Currently the only thing I can do is to convert everything to a String and create a Bad instance with the String passed as argument to fail.
What I'd like to do is something like:
fail msg = do
    info <- getInfoOutOfTheComputation
    return $ Bad info

However everything I tried until now gives type errors, probably because this would mix different monads.
Is there anyway in which I can implement fail in order to preserve the information I need without having to convert all of it into a String?
I cannot believe that the best Haskell can achieve is using show+read to pass all the information as the string to fail.

A: Your CheckerError monad is very similar to the Either monad. I will use the Either monad (and its monad transformer counterpart ErrorT) in my answer.
There is a subtlety with monad trasformers: order matters. Effects in the "inner" monad have primacy over effects caused by the "outer" layers. Consider these two alternative definitions of CheckerMonad:
import Control.Monad.State
import Control.Monad.Error

type CheckerState = Int     -- dummy definitions for convenience
type CheckerError = String

type CheckerMonad a = StateT CheckerState (Either String) a

type CheckerMonad' a = ErrorT String (State CheckerState) a

In CheckerMonad, Either is the inner monad, and this means a failure will wipe the whole state. Notice the type of this run function:
runCM :: CheckerMonad a -> CheckerState -> Either CheckerError (a,CheckerState)
runCM m s = runStateT m s

You either fail, or return a result along with the state up to that point.
In  CheckerMonad', State is the inner monad. This means the state will be preserved even in case of failures:
runCM' :: CheckerMonad' a -> CheckerState -> (Either CheckerError a,CheckerState)
runCM' m s = runState (runErrorT m) s

A pair is returned, which contains the state up to that point, and either a failure or a result.
It takes a bit of practice to develop an intuition of how to properly order monad transformers. The chart in the Type juggling section of this Wikibook page is a good starting point.
Also, it is better to avoid using fail directly, because it is considered a bit of a wart in the language. Instead, use the specialized functions for throwing errors provided by the error transformer.  When working with ErrorT or some other instance of MonadError, use throwError.
sillycomp :: CheckerMonad' Bool
sillycomp = do
    modify (+1)
    s <- get
    if s == 3
        then throwError "boo"
        else return True

*Main> runCM' sillycomp 2
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
(Left "boo",3)

*Main> runCM' sillycomp 3
(Right True,4)

ErrorT is sometimes annoying to use because, unlike Either, it requires an Error constraint on the error type. The Error typeclass forces you to define two error constructors noMsg and strMsg, which may or may not make sense for your type.
You can use EitherT from the either package instead, which lets you use any type whatsoever as the error. When working with EitherT, use the left function to throw errors.


text:
Q: Pandasql conditional join with one result returned from right table I'm doing an analysis in Pandas which requires a few conditional joins for which it is very practical to switch over to SQL with pandasql. Unfortunately I'm having a problem with one of the joins where there are dates involved and the join requires only one result to be returned.
Having table1 where the ID, REGION require an exact match on table2 and DATE requires an approximate match where the DATE in table1 needs to be <= then the DATE in table2 and the closest one (smallest day difference).

ID
REGION
DATE

111
ABC
12.05.2021

111
ZDF
14.02.2021

222
DEF
31.12.2021

And table2 with the additional column INDIC which needs to be returned in the join

ID
REGION
DATE
INDIC

111
ABC
30.06.2021
Y

111
ABC
12.08.2021
X

111
ABC
15.10.2021
Z

222
DEF
08.10.2021
A

222
DEF
05.01.2022
B

222
DEF
13.04.2022
C

The result I would expect of the join should look like:

The code that I have for the moment is:
SELECT df_left.*, df_right.[INDIC]
FROM tbl1_df AS df_left
LEFT JOIN tbl2_df AS df_right
ON df_left.[ID] =  df_right.[ID]
AND df_left.[REGION] = df_right.[REGION]
WHERE  (df_left.[DATE] <= df_right.[DATE])

This will at the moment present an unwanted but expected result:

Can anyone suggest how the SQL part should look like?

A: I think I found the best solution so far with below code:
SELECT tbl1_df.*, tbl2_df.[INDIC]
    FROM tbl1_df
    LEFT JOIN tbl2_df
    ON tbl1_df.[ID] =  tbl2_df.[ID]
    AND tbl2_df.[DATE] = (
        SELECT MIN(DATE) FROM tbl2_df WHERE (tbl2_df.[ID] = tbl1_df.[ID]) AND (tbl1_df.[DATE] <= tbl2_df.[DATE]) AND (tbl1_df.[REGION] = tbl2_df.[REGION])
        )

Which gives a following result and I can easily deal with the NONE later on.

A: You can try pandas.merge_asof with forward search policy.
A forward search selects the first row in the right DataFrame whose on key is greater than or equal to the left's key.
To use merge_asof, you need ensure the merged on column is sorted.
df1['DATE'] = pd.to_datetime(df1['DATE'], dayfirst=True)
df2['DATE'] = pd.to_datetime(df2['DATE'], dayfirst=True)
df1 = df1.sort_values(by=['DATE'])
df2 = df2.sort_values(by=['DATE'])

With the sort requirements and the forward search, it can meet your needs:

DATE requires an approximate match where the DATE in table1 needs to be <= then the DATE in table2 and the closest one (smallest day difference)

out = pd.merge_asof(df1, df2, on='DATE', by=['ID', 'REGION'], direction='forward')
out['DATE'] = out['DATE'].dt.strftime('%d.%m.%Y')

print(out)

    ID REGION        DATE INDIC
0  111    ZDF  14.02.2021   NaN
1  111    ABC  12.05.2021     Y
2  222    DEF  31.12.2021     B


text:
Q: Not able to update react state with if else condition in child component? I have a component I want to update parent state from child component clicked. But there is if else condition due to this I'm not able to update state in parent component.
I have two boxes with if else condition & I want to update state in both boxes but its update in only one box. How to solve this?
Working sandbox code
Screenshot:-

App.js Code:-

import React, { useState } from "react";
import "./styles.css";
import Halfbox from "./Halfbox";

export default function App(props) {
  const [name, setName] = useState(false);
  if (props.type == "left-section") {
    return (

         {name ? <>right update</> : <>right not update</>}
        <Halfbox setName={setName} />

    );
  } else if (props.type == "right-section") {
    return (

         {name ? <>left update</> : <>left not update</>}

This is left box

    );
  }
}

Halfbox.js Code:-

export default function Halfbox(props) {
  const handleClick = (e) => {
    props.setName(true);
  };

  return (

Halfbox

      <button onClick={handleClick}>Click</button>

  );
}

Thanks for your efforts!

A: It seems that there are 2 instance of App, therefore each has its own name state. And the event is only updating the state for its parent App but not the other one.
To have both boxes updated, perhaps a very basic approach could be try moving them down as child components of the same App, so that they can share the name state passed down from it.
Example: (forked live on: codesandbox)
export default function App(props) {
  const [name, setName] = useState(false);
  return (
    <>

    </>
  );
}

export const Section = (props) => {
  if (props.type === "left-section") {
    return (

          {props.name ? <>right update</> : <>right not update</>}

        <Halfbox setName={props.setName} />

    );
  } else if (props.type === "right-section") {
    return (

          {props.name ? <>left update</> : <>left not update</>}

This is left box

    );
  }
};


text:
Q: Scala Trait type mismatch I have some Kafka Channel hierarchy that I am using in my project:
My base trait is:
trait SendChannel[A, B] extends CommunicationChannel {
  def send(data:A): B
}

Now I have a common kafka send Channel like
trait CommonKafkaSendChannel[A, B, Return] extends SendChannel[A, Return] {
val channelProps: KafkaSendChannelProperties
val kafkaProducer: Producer[String, B]
 override def close(): Unit = kafkaProducer.close()
}

Now there are 2 variants of CommanKafkaSendChannel, one is with callback and one is with Future:
trait KafkaSendChannelWithFuture[A, B] extends CommonKafkaSendChannel[A, B, Future[RecordMetadata]] {
override def send(data: A): Future[RecordMetadata] = Future {
  kafkaProducer.send(new ProducerRecord[String, B](channelProps.topic)).get
}
}

KafkaSendChannelWithCallback definition:
object KafkaSendChannelWithCallback {

def apply[A, B](oChannelProps: KafkaSendChannelProperties,
              oKafkaProducer: Producer[String, B],
              oCallback: Callback): KafkaSendChannelWithCallback[A, B] =
new KafkaSendChannelWithCallback[A,B] {
  override val channelProps: KafkaSendChannelProperties = oChannelProps
  override val kafkaProducer: Producer[String, B] = oKafkaProducer
  override val callback: Callback = oCallback
}
}

trait KafkaSendChannelWithCallback[A, B] extends CommonKafkaSendChannel[A, B, Unit] {

  val callback: Callback

override def send(data: A): Unit =
kafkaProducer.send(new ProducerRecord[String, B](channelProps.topic), callback)
}

Now based on the configuration value I select the proper type of channel on run time like below. I am creating actor with right type of channel which will send the data to kafka:
  val sendChannel = kafkaChannel.channel(config, actorSystem).fold(
    error => {
      logger.error("Exception while instantiating the KafkaSendChannel")
      throw error
    },
    success => success
  )

actor = actorSystem.actorOf(IngestionActor.props(config, sendChannel), name = ACTOR_NAME)

Actor definition:
object IngestionRouterActor {
  def props[V](config: Config, sendChannel: SendChannel[V, Unit]): Props =
Props(classOf[IngestionActor[V]], config, sendChannel)
}

The problem is when I use KafkaSendChannelWithCallback my code compiles properly however when I use KafkaSendChannelWithFuture it gives me below error on actor = declaration:

[error]IngestionActor.scala:32: pattern type is incompatible with expected type;
  [error]  found   : KafkaSendChannelWithFuture[String,V]
  [error]  required: SendChannel[V,Unit]

As both the channel definitions are extended from SendChannel, this code should have compiled without any error. I am not sure why it is not compiling. Thanks

A: The Props for IngestionActor takes a SendChannel[V, Unit]. Passing in a KafkaSendChannelWithCallback to this argument works because it's a SendChannel[V, Unit].
On the other hand, KafkaSendChannelWithFuture is a SendChannel[V, Future[RecordMetadata]]. A SendChannel[V, Future[RecordMetadata]] is not a SendChannel[V, Unit].
One option is to redefine the Props to take a SendChannel[V, Any], since Any is a supertype of both Unit and Future:
def props[V](config: Config, sendChannel: SendChannel[V, Any]): Props = ???

At this point, the compiler is still unhappy because SendChannel, being a generic type, is invariant by default. In other words, neither SendChannel[V, Unit] nor SendChannel[V, Future[RecordMetadata]] are of type SendChannel[V, Any].
To change that, make SendChannel covariant on the second type parameter (by adding a + in front of the B):
trait SendChannel[A, +B] extends CommunicationChannel {
  def send(data: A): B
}


text:
Q: Why is my transition vue 3 not working on "leave"? this is the second time I have this problem which is really annoying me. I created a modal component which I use in the main component. The problem is that the modal transition wasn't working until I added the appear . I jumped for joy but the transition only works if I open the modal but when I close it's like there is no transition class to close.
this is my modal component content:
<template>

        <Transition name="slide-fade" appear>

                    <slot>Titre du modal</slot>

                <slot name="content"></slot>

        </Transition>

</template>

and this is my main content :
<template>
....
....

    <Buttons @click="showModal = true"> Ajouter Type</Buttons>
    <Modal v-if="showModal" @close="showModal = false">
        Add Type
        <template v-slot:content>
            <form
                @keydown.enter="sumitAddType"
                @submit.prevent="sumitAddType"
                class="space-y-3"
            >
                <input
                    class="px-3 py-2 bg-dark-item-bg text-white border-none rounded-xl w-full placeholder-gray focus:focus:ring-blue/30"
                    type="text"
                    placeholder="Tapez le text le nom"
                    v-model="modalForm.name"
                />

                    <CancelButtons @click="showModal = false"
                        >Annuler</CancelButtons
                    >

                    <Buttons :disabled="modalForm.processing">

                            <Spinner />

Ajouter

                    </Buttons>

            </form>
        </template>
    </Modal>

....
....
</template>

Thank you in advance for your help.

A: The problem you're encountering with the modal transition might be related to the "appear" property in the "Transition" component. This property only triggers the transition when the component is first mounted, but not when it's updated later. To resolve this, you can add a "mode" property to the "Transition" component and set its value to "out-in". This will ensure that the transition works both when you open and close the modal.
<template>

    <Transition name="slide-fade" mode="out-in">

                <slot>Titre du modal</slot>

            <slot name="content"></slot>

    </Transition>


text:
Q: Primefaces: p:Wizard not working properly inside p:outputpanel My requirement is to display a wizard depending upon the product selected by User (using a drop down). So i using a p:wizard component containing few steps inside p:outpanel (with autoupdate true). When this is initially rendered everything looks fine i.e. all the tabs and navigation buttons are displayed properly.
But upon clicking on next button, the Navigation buttons and the header Tabs are disappearing.
PFB the sample code and screenshot that i created to verify this bug.
 <p:panel style="height: 100px;width:500px">
      <p:outputPanel autoUpdate="true">
         <p:wizard>
            <p:tab id="tab1" title="Tab 1">
                  Sample Tab 1
                  </p:tab>
            <p:tab id="tab2" title="Tab 2">
                  Sample Tab 2</p:tab>
            <p:tab id="tab3" title="Tab 3">
                  Sample Tab 3</p:tab>
         </p:wizard>
      </p:outputPanel>
      </p:panel>

Manual update is not refreshing the Data inside the Data Table. I have a pretty messed up requirement.
I have a form within which i have a datatable and two command buttons namely delete and update details.
On clicking delete, the selected record must get deleted from the datatable (DB is updating but not the UI). And on clicking "update Details", a wizard must be displayed under the data table which contains details regarding the selected record. User should be able to select different record from the data table and the wizard must get updated with the proper data.
Now i am facing multiple problems,

*

*if i make delete button to be ajax, then the datatable is not updating (without using outputpanel or updating the complete form).

*If i use the outputpanel then, the UI is getting messed up on filtering or sorting (due to viewstate not restored).

*If i create separate forms for datatable and the wizard, and try updating the wizard data from "update details" button. Then also
the wizard data is not getting updated.

*If i use the outputpanel then, the WIzard UI is getting messed up on clicking next (due to viewstate not restored).

PFB the dummy code for the scenario:
<h:form id="form1">
  <p:outputpanel id="panel1">
       <p:datatable value="#{someBeanMethod}" var="someData">
       //Some data Table columns
       <f:facet name="footer">
                  <p:commandbutton id="button1" value="delete"
                             actionListner="#{deletFuntion}" update="@(form1:panel1)"/>
                 <p:commandbutton id="button2" value="viewDetails"
                             actionListner="#{fetchViewMethod}" update="@(form1:panel2)"/>
       </f:facet>
       </p:datatable>
   </p:outputpanel>

   <p:outputpanel id="panel2">
      <p:wizard id="wizard1" rendered = "#{someFlag}">
                //Some Functionality
       </p:wizard>
   </p:outputpanel>
</h:form>


text:
Q: How to redirect from one page to another one with changing wp query and without reloading page? The problem
There is a URL:
https://example.com/my-category/category
Need to create another one
https://example.com/shop
Behavior to achieve:
By visiting https://example.com/shop content and all query variables need to be identical like for https://example.com/my-category/category
https://example.com/my-category/category and https://example.com/shop - need to be the same.
Meta tags, title, and other content need to be identical.
Need to create an inner redirect
from https://example.com/shop
to https://example.com/my-category/category without reloading page.
This is the snippet what I've tried
flush_rewrite_rules();
add_rewrite_rule(
  '/shop?$',
  'index.php?product_cat=my-category',
  'top'
);
I expect to see the same page for these two URLs
https://example.com/my-category/category
and
https://example.com/shop
The second one needs to be redirected to the first one.

A: The easiest way to achieve this is to edit your .htaccess file (on your server, at the root folder for http://example.com) and add a 301 Redirect as follows:
Redirect 301 /shop /my-category/category

This means that when someone enters http://www.example.com/shop in the browser, it will be automatically redirected to http://www.example.com/my-category/category, and latter page will load.

A: I have found a solution via request filter
function example_rewrite_request($query){
    $request_uri = urldecode( $_SERVER['REQUEST_URI'] );

    $parsed_url = parse_url( $request_uri );

    if (  preg_match( '/^\/shop/', $parsed_url['path'] ) ) {
        $query['product_cat'] = 'my-category';
        unset( $query['post_type'] );

        return $query;
    }

    return $query;
}

add_filter( 'request', 'example_rewrite_request', 9999, 1 );


text:
Q: How to apply lazy loading to react-router-dom? I have a basic routing with two pages: home and about. I've imported both pages with react.lazy and wrapped each of them with a suspense fallback.
The homepage loads well, but when I want to navigate to /about, the page becomes blank, without any error in the console. How so?
Also, how can I see in local development that the about page is not loaded before I call it?
Here is the route and the code:

const Home = lazy(() => import("./pages/Home"));
const About = lazy(() => import("./pages/About"));

export default function App() {
  return (
    <>
      <BrowserRouter>
        <Switch>
          <Suspense fallback="loading home...">
            <Route exact path="/" component={Home} />
          </Suspense>
          <Suspense fallback="loading about...">
            <Route path="/about" component={About} />
          </Suspense>
        </Switch>
      </BrowserRouter>
    </>
  );
}

export default function Home() {
  return (
    <>

HOME

      <Link to="/about">about</Link>
    </>
  );
}

export default function About() {
  return (
    <>

About

      <Link to="/">home</Link>
    </>
  );
}

Thanks!


text:
Q: CORS issue on NativeScript Facebook authentication with Node.js and Passport I've implemented Facebook OAuth on Noje.js via Passport library. The URL that invokes Facebook OAuth /auth/facebook and the Facebook callback URL /auth/facebook/callback are as follows:
loginRouter.get('/auth/facebook', passport.authenticate('facebook', { scope : 'email' }));

loginRouter.get('/auth/facebook/callback', passport.authenticate('facebook', {successRedirect: "/rs/login/me"}));

I have two front-end applications, one is on the web (Angular2) and the other is on mobile (Nativescript). Firstly, I tried implementing the front-end on Angular2 and made an Ajax call to /auth/facebook, which received no response. Further research have revealed that although I've set the Express.js properties to handle CORS properties like this:
app.use(function(req, res, next) {
    res.setHeader('Access-Control-Allow-Origin', '*');
    res.setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,HEAD,DELETE,OPTIONS');
    res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With, Access-Control-Allow-Origin');
    next();
});

the response from facebook doesn't have the CORS headers set (stackoverflow link). Therefore the solution I've adapted was simply to use <a href> element which does not check the CORS header on response (solution is here), which made everything run perfectly on Angular2.
But when it comes to NativeScript, I cannot find any way to avoid this CORS problem. I'm using the fetch module to make an Http GET request to Node.js with the URL /auth/facebook like this:
public loginFB() {
    return fetchModule.fetch("http://[MY_SERVER_IP]/auth/facebook", {
        mode: 'no-cors',
        method: 'GET'
    }).then(handleErrors);
};

Although I've set the request mode to "no-cors", this solution simply doesn't work. I've tried to set the CORS headers again on preflight, either at /auth/facebook and /auth/facebook/callback methods, but still, nothings happening. My HTTP request enters the /auth/facebook method but as far as I observed, neither of the middleware and the callback of /auth/facebook/callback method is invoked. What might be the solution?

A: I managed to use Facebook GraphAPI by being inspired via https://github.com/AntonioCuevaUrraco/nativescript-facebook-login. By using this approach, I've imported the Facebook GraphAPI for Android and used it that way.


text:
Q: Gitlab 8.2.1 '110: Connection timed out' attempting to view merge_request We recently upgraded from Gitlab 7.14.0 to Gitlab 8.2.1 on a 16GB/8cpu VM at DigitalOcean. We have one Merge Request with 55 comments that simply won't load in the browser. All other merge_requests load fine. We get the following error from NGINX:
2015/12/02 14:49:02 [error] 9094#0: *62 upstream timed out (110: Connection timed out) while reading response header from upstream, client: x.x.x.x, server: gitlab.domain.com, request: "GET /group/project/merge_requests/854 HTTP/1.1", upstream: "http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket/group/project/merge_requests/900", host: "gitlab.domain.com"

In config/unicorn.rb we have set timeout 1200  (up from an original 30, then tried 300 and 600). 600 was working well with Gitlab 7.14.0. We have worker_processes 12 also set in config/unicorn.rb.
Gitlab 8.2.1 uses gitlab-workhorse, but I'm not familiar enough with gitlab-workhorse to know if there are settings for it.
Our workhorse settings in Nginx:
upstream gitlab {
  server unix:/home/git/gitlab/tmp/sockets/gitlab.socket fail_timeout=0;
}

upstream gitlab-workhorse {
  server unix:/home/git/gitlab/tmp/sockets/gitlab-workhorse.socket fail_timeout=0;
}

location @gitlab-workhorse {
    client_max_body_size 0;
    gzip off;

    proxy_read_timeout      600;
    proxy_connect_timeout   600;
    proxy_redirect          off;
    proxy_buffering off;
    proxy_set_header    Host                $http_host;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-Ssl     on;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto   $scheme;
    proxy_pass http://gitlab-workhorse;
}

Output from free:
         total       used       free     shared    buffers     cached
Mem:      16433928   11946992    4486936     119052     236972    8130620
-/+ buffers/cache:    3579400   12854528

We've restarted Gitlab with service gitlab restart in the hopes there was a hungry resource, but we saw no difference.
Any suggestions on how we figure out what is going on and fix this issue?


text:
Q: Netbeans, unicode identifier with c++/11 CLang breaks code assistance?
Even if I disable Code Assistance, à is still highlighted in red.
Is there a way to make Netbeans works with Unicode identifiers?

*

*OS Ubuntu 14.04 LTS.

*Compiler is set to CLang.

*In Project.Properties.General: Under sources, Encoding is UTF-8.

*This simple project compile/run without errors.


text:
Q: Seamless SSO with Kerberos, IE, Firefox, LDAP Active Directory Alias /students /var/www/students

<Location /students>
  KrbServiceName HTTP
  KrbMethodNegotiate On
  KrbMethodK5Passwd On
  KrbSaveCredentials off
  KrbAuthRealms DOMAIN.LOCAL
  Krb5KeyTab /etc/httpd/keytab
  KrbAuthoritative off

  AuthType Kerberos
  AuthName "Please Login"
  AuthBasicProvider ldap
  AuthzLDAPAuthoritative on
  AuthLDAPURL "ldap://dc.domain.local:389/OU=Domain Users,DC=domain,DC=local?userPrincipalName?sub?(objectClass=*)"
  AuthLDAPBindDN "CN=ldapsearchuser,CN=Users,DC=domain,DC=local"
  AuthLDAPBindPassword ldapsearchuserpass
  require ldap-group CN=Students,CN=Users,DC=domain,DC=local
  require ldap-group CN=Staff,CN=Users,DC=domain,DC=local
</Location>

This allows all users who are members of either the Students/Staff AD groups access to pages behind http://intranetsite/students without needing to specify login credentials provided their IE/Firefox are configured properly.
The userPrincipalName was used instead of sAMAccountName because the kerberos module was passing the username@REALM to the ldap module.
Now I have the problem where if someone isn't authorized they are presented with:
Authorization Required This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Does anyone know how to have it pop up a username/password dialog box so they could try alternate credentials? After unsuccessfully gaining authorization, the only way I can get it to ask for credentials is to clear out my cache. If I am logged in to the PC as an authenticated user but one that isn't authorized to this resource I have no way of suppying alternate credentials (which may be a good thing).

A: We faced a very similar problem.  We eventually concluded that while integrated NTLM logon support in Internet Explorer and Firefox is convenient, there are so many exception cases which result in failure that we changed our approach.
The problem with integrated authentication is that it works only when the currently logged on username and password are still correct and properly authorized to access the resource.
There are more circumstances where it doesn't work however:

*

*If the username and/or password are incorrect, there's no way to use alternate credentials as you stated above

*If the account and/or password have expired or if the password is wrong, the browser will return an "unauthorized" message with no clue as to which of the problems it is

The approach we standardized on was to put up a username/password logon web page (in front of the application) which accepts the credentials.  When the credentials are submitted, the application would in turn validate those credentials against the directory and then respond accordingly (in a .NET world you could use Forms Authentication http://msdn.microsoft.com/en-us/library/aa480476.aspx to force access to the application via this login page).  Since the application is doing the credential validation, you get rich information as to the nature of the login failure.  In addition, even if the login succeeds but there's relevant information to display to the user, e.g. their password will expire shortly, etc., this provides an opportunity to do so.
UPDATE:  I forgot to mention that if you adopt this approach, you'll need to allow anonymous access to the IIS application root.  This will allow access to the login web page without first attempting the automatic NTLM authentication.  It's up to you whether you leave NTLM authentication enabled; perhaps you do want some clients to still automatically log in.


text:
Q: "(...) afford stuff for a good joke to anybody, (...)" - what does it mean? I'm not sure what does Melville exactly mean by afford stuff for a good joke to anybody in chapter five of Moby-Dick.

However, a good laugh is a mighty good thing, and rather too scarce a good thing; the more's the pity. So, if any one man, in his own proper person, afford stuff for a good joke to anybody, let him not be backward, but let him cheerfully allow himself to spend and be spent in that way.

From the research I did and the context of the passage methought, can it be money? How would you rephrase it without using stuff?

A: *

*So, if any one man, in his own proper person, afford stuff for a good joke to anybody . . . let him cheerfully allow himself to spend and be spent in that way.*

afford stuff for = provide the material for
to spend and be spent = to be used