text:
Q: Can a C/C++ compiler inline builtin functions like malloc()? While inspecting the disassembly of below function,
void * malloc_float_align(size_t n, unsigned int a, float *& dizi)
    {
        void * adres=NULL;
        void * adres2=NULL;
        adres=malloc(n*sizeof(float)+a);
        size_t adr=(size_t)adres;
        size_t adr2=adr+a-(adr&(a-1u));
        adres2=(void * ) adr2;
        dizi=(float *)adres2;
        return adres;
    }

Builtin functions are not inlined even with the inline optimization flag set.
; Line 26
$LN4:
    push    rbx
    sub rsp, 32                 ; 00000020H
; Line 29
    mov ecx, 160                ; 000000a0H
    mov rbx, r8
    call    QWORD PTR __imp_malloc <------this is not inlined
; Line 31
    mov rcx, rax
; Line 33
    mov rdx, rax
    and ecx, 31
    sub rdx, rcx
    add rdx, 32                 ; 00000020H
    mov QWORD PTR [rbx], rdx
; Line 35
    add rsp, 32                 ; 00000020H
    pop rbx
    ret 0

Question: is this a must-have property of functions like malloc? Can we inline it some way to inspect it(or any other function like strcmp/new/free/delete)? Is this forbidden?

A: Typically the compiler will inline functions when it has the source code available during compilation (in other words, the function is defined, rather than just a prototype declaration)  in a header file).
However, in this case, the function (malloc) is in a DLL, so clearly the source code is not available to the compiler during the compilation of your code. It has nothing to do with what malloc does (etc). However, it's also likely that malloc won't be inlined anyway, since it is a fairly large function [at least it often is], whcih prevents it from being inlined even if the source code is available.
If you are using Visual Studio, you can almost certainly find the source code for your runtime library, as it is supplied with the Visual Studio package.
(The C runtime functions are in a DLL because many different programs in the system use the same functions, so putting them in a DLL that is loaded once for all "users" of the functionality will give a good saving on the size of all the code in the system. Although malloc is perhaps only a few hundred bytes, a function like printf can easily add some 5-25KB to the size of an executable. Multiply that by the number of "users" of printf, and there is likely several hundred kilobytes just from that one function "saved" - and of course, all other functions such as fopen, fclose, malloc, calloc, free, and so on all add a little bit each to the overall size)

A: A C compiler is allowed to inline malloc (or, as you see in your example, part of it), but it is not required to inline anything. The heuristics it uses need not be documented, and they're usually quite complex, but normally only short functions will be inlined, since   otherwise code-bloat is likely.

A: malloc and friends are implemented in the runtime library, so they're not available for inlining.  They would need to have their implementation in their header files for that to happen.
If you want to see their disassembly, you could step into them with a debugger.  Or, depending on the compiler and runtime you're using, the source code might be available.  It is available for both gcc and msvc, for example.

A: The main thing stopping the inlining of malloc() et al is their complexity — and the obvious fact that no inline definition of the function is provided.  Besides, you may need different versions of the function at different times; it would be harder (messier) for tools like valgrind to work, and you could not arrange to use a debugging version of the functions if their code is expanded inline.


text:
Q: Publish articles automatically I will be given url having XML that has information about some topic. I can extract that information easily but is it possible to post that article on a website if i am user of that website and fill the information got in the website using c#??

A: This depends very much on the web site. What protocol does it uses, does it require users to be authenticated in order to post articles, does the site provides a functionality to post articles at all?
With C# you can easily use a WebClient to post whatever you information want to any web site.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why task is unsuccessful for firebase authentication I tried to sign in with Firebase. I coded these codes but when I sign in on my app, I take the message from !task.isSuccessful at my code. How can I solve this problem basically? I'm new for the android studio.
I think I could code wrongly in this part when I click sign in button call this function
private void createAccount(){
    String email=userEmail.getText().toString();
    String password=userPassword.getText().toString();
    mAuth.createUserWithEmailAndPassword(email,password).
            addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
        @Override
        public void onComplete(@NonNull Task<AuthResult> task) {
        //when Authentication is successful
            if (task.isSuccessful()){
Log.d(TAG,"createUserWithEmail:onComplete"+task.isSuccessful());
                Toast.makeText(SignInActivity.this,"Registration was
provided",Toast.LENGTH_SHORT).show();
                Intent signIn= new
Intent(SignInActivity.this,UserMainActivity.class);
                startActivity(signIn);
            }//when Authentication is failed
             else {
                Toast.makeText(SignInActivity.
                        this,"Registration is unsuccessful! Please try
again...",Toast.LENGTH_SHORT).show();
            }

        }
    });
}


text:
Q: Excel - List data from 4 columns I have an excel sheet where I want to make a list based on data in 3 columns. See the image for how the basic things looks currently.

I have names in column A and then in column B,C and D is a mixture of colours.
How can I get excel to list the names of those who choose for example Red despite Red possibly being in B,C or D? So it looks a little like:

*

*Harry Red

*Sara Red

*Sue Red

When it's finished it will have something like 2500 rows and "colour" choice of 27.
The output hopefully would look like this image with the ability to choose which colour it looks for

A: We can use a "helper column" to gather all the names associated with the colour Red without using array functions.  In E2 enter:
=IF(OR(B2="Red",C2="Red",D2="Red"),1+MAX($E$1:E1),"")

and copy down.  Then in some other cell enter:
=IFERROR(INDEX(A:A,MATCH(ROWS($1:1),E:E,0)),"")

and copy down:

The "helper column" identifies the rows of interest.  Other colours can be handled in a similar fashion.


text:
Q: Network calls inside custom validations in spring boot I need to validate a number of fields in my REST Api. Is there a specific pattern to do this ? My api is cluttered with these validation calls.

*

*Check auth token in the http request against another service to verify access permissions.

*Validate a number of fields in request body such as category, type etc by making calls to another service.

*Generic null & empty checks. Currently I'm using spring validation to do this.

A:
Check auth token in the http request against another service to verify access permissions

I would suggest validating the token in a filter before the request reaches the controller.
Something like this

*

*Create a new token validation filter

    @Component
    public class TokenValidationFilter extends OncePerRequestFilter {
        private TokenValidationService tokenValidationService;

        @Override
        protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
                throws ServletException, IOException {

            final String authorizationHeader = request.getHeader("Authorization");

          boolean isValid = tokenValidationService.validate(authorizationHeader);
            //do authentication here
            chain.doFilter(request, response);
        }
    }

Add the filter to http filters
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class); // this just an example you might needed to added before a different filter
    }
}

Validate a number of fields in request body such as category, type etc by making calls to another service.

Spring allows creating custom constraints. See spring doc.
Example:
UniqueUsername interface
@Documented
@Constraint(validatedBy = UniqueUsernameValidator.class)
@Target( { ElementType.METHOD, ElementType.FIELD,ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface UniqueUsername {
    String message() default "username is not unique";
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};
}

public class UniqueUsernameValidator implements ConstraintValidator<UniqueUsername, UserDto> {
    private final UserService usersService;

    @Override
    public void initialize(UniqueUsername constraintAnnotation) {

    }

    @Override
    public boolean isValid(UserDto value, ConstraintValidatorContext context) {
       return usersService.isUnique(value.getUsername());
    }

}

user dto:

@UniqueUsername(message = "Username is used")
public class UserDto {
    @DecimalMin(value = "0")
    private long id;
    @NotBlank(message = "Username can not be blank")
    private String username;
}

Note that the constraints could be class level like UniqueUsername or filed level like NotBlank.

Generic null & empty checks. Currently I'm using spring validation to do this.

spring validation/constraints is correct.


text:
Q: MPAndroidChart not drawing pie chart I am using mpAndroidChart library to draw pie-chart on android app. Library works when entries are more than two but it does not draw on single entries. Please advice where I am going wrong. I followed official example given in the repo.

A: I had an error in my code and finally removed it! Here Values were mistakenly not getting added in some cases, I have found and resolved the bug and code is now working perfect.

A: In my case, it didn't show up unless I changed the height of chart to "match_parent".
Since it was in the LinearLayout(LL), I added another LL in the original LL and set the value of LL as 300pd or 500pd.
Now I see the chart.


text:
Q: How to empty cart or clear session "externally" I have a unique workflow for redeeming vouchers on our site through Magento. I have a form that users use for inputting a series of vouchers to get products. It isn't "in" Magento as a CMS page or anything of that nature. The code I am using to achieve access to Magento's resources/models is as followed:
<?php

require_once('../app/Mage.php'); //Path to Magento
umask(0);
Mage::app();

// Now you can run ANY Magento code you want

/**
* Get the resource model
*/
$resource = Mage::getSingleton('core/resource');

I have several codes that can be used to clear session or cart contents but for whatever reason, I can't get them to work by just calling on Mage.php. Here are my codes:
Version 1:
// Empty shopping cart
Mage::getSingleton('checkout/cart')->truncate();

Version 2:
// Clear session data
Mage::getSingleton('checkout/session')->clear();

Version 3:
$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote->delete();

None of these will work with the method I listed above. I am placing it after the "$resource..." line. Is there a better way to do this?
The Goal: Everytime a user visits this "voucher form", which is the landing page - I want their shopping cart to be emptied. Thanks.

A: This one should work as it removes all items from the current quote:
Mage::getSingleton('checkout/cart')->truncate();

But you need to save it afterwards:
Mage::getSingleton('checkout/cart')->save();

By the way, you can remove the following line:
$resource = Mage::getSingleton('core/resource');

since you don't use the variable and instantiating this singleton doesn't do anything in particular.

A: You can't get result what you want through this code.
Mage::getSingleton('checkout/cart')->truncate();

You need to use ->save() to achieve what you want.
Mage::getSingleton('checkout/cart')->truncate()->save();

Hope this will help you.


text:
Q: Can we get previous tweet using Twitter Streaming API? I am working with Twitter REST API [PHP] for a month. Now I try STREAMING API because REST API has several downsides.
I use fennb/phirehose to work with Streaming API.
But after several trial and error, I realise that I can't got past/previous tweets using Streaming API.

*

*I run the script

*I post tweet

*console/cmd will catch my tweet immediately

*I stop the script

*I post tweet

*I run the script

*console not return any result.

The problem is, in programming and server, sometimes shit happen. Let's call it server down or lost internet connection. I will never get all previous tweet which posted when my server down. (I have 40 search term and more later).
So. i wanna ask:

*

*Can we get previous tweet using Streaming API?

*How to prevent/solve this case (console throw error, server restart, internet down, etc)?

A: Twitter's basic streaming API is realtime and about 1% of the actual firehouse of Tweets. You cannot retrieve older Tweets via the stream, and would need to fallback to the basic REST API to check for anything missed in the event of disconnection.
Twitter's enterprise data APIs include historical PowerTrack which can let you get older Tweets, as well as a replay capability in the event of disconnection, but these APIs are commercial.


text:
Q: Is it possible to use Android Studio AND Eclipse in a team Android Studio re-arranges the structure of projects imported from eclipse. I have just joined a team which is using Eclipse but I would like to use Android Studio and impact their current work practices as little as possible. Is there anyway it is possible for a team to use the 2 IDEs and share the same repo?

A: You'll need to set up a Gradle build file for use by Android Studio, and maintain the Eclipse project files separately; there will be no automated way of keeping the two synchronized.
Gradle-based projects like to have a different directory structure than old-style Eclipse projects; you'll need to adapt the Gradle project to use Eclipse-style directories.
There's some advice on how to do that at Maintaining directory structure during Android Studio import but the basic idea is to set up your build file like this:
android {
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}


text:
Q: Getting Axios error 500 (Internal Server Error) I have my django-rest-framework api running on port 80000. and my react project on port 3000. I have installed cors-headers in django and am making requests to api successfully, but there is one problem:
import axios from 'axios';
import { CART_ADD_ITEM } from '../constants/cartConstants';

export const addToCart = (id, qty) => async (dispatch, getState) => {
  const { data } = await axios.get(`/api/products/${id}`);

  dispatch({
    type: CART_ADD_ITEM,
    payload: {
      product: data.id,
      name: data.name,
      image: data.image,
      price: data.price,
      countInStock: data.count_in_stock,
      qty,
    },
  });

  localStorage.setItem('cartItems', JSON.stringify(getState().cart.cartItems));

so axios should be making request to get product data from /api/products/${id} this url and then update state in redux store which i'm calling in useEffect in CartPage component like this:
const CartPage = () => {
  const productId = useParams()
  const location = useLocation().search
  const qty = location ? Number(location.split("=")[1]) : 1

  const dispatch = useDispatch()

  useEffect(() => {
    if(productId) {
      dispatch(addToCart(productId, qty))
    }
  }, [dispatch, productId, qty])

  return (

Cart

  )
}

export default CartPage

but there is an axios error which says
GET http://127.0.0.1:8000/api/products/[object%20Object] 500 (Internal Server Error)
why am i getting this? and what is this object thing at the end after products/.
anny feedback would be much appreciated. thanks

A: I think you just miss one thing which needs to fix like this:
const { id } = useParams(); // you will get your product id like this

const productId = useParams() returns object that's why you get 500.


text:
Q: How to check iOS version delphi xe5/xe6 Is there a way to check the iOS version within a Delphi app? I would like to create specific piece of code for iOS7 and iOS6 in Delphi XE6.

A: You can use TOSVersion record in System.SysUtils.
if TOSVersion.Check(7, 0) then //Os is iOS 7

Also you can find sample for iOS here.


text:
Q: Optimizing and Parallel Computing for Large Dyadic Intervals I need help with the efficiency of my code i.e. less time so I can compute for large range of values.
My function n[x] takes in a number x and outputs the difference between t and w. The idea behind this code: t = residue class of prime numbers modulo 4, and w = residue class of prime numbers below 3. n[x] calculates the difference between t and w for prime numbers below x and returns the difference.
n = Compile[{{x, _Integer}},
  Module[{w = 0, t = 0, p = 3},
   While[p <= x, {
     If[Mod[p, 4] == 1, w += 1, t += 1];
     p = NextPrime[p]}
    ];
   Return[Round[t - w]]
   ], RuntimeAttributes -> {Listable}, Parallelization -> True,
  CompilationTarget -> "C", RuntimeOptions -> "Speed"]

n[x] is my base code. I use it to create my function ncom[a,b]. The idea behind ncom[a,b]: outputs the maximum and minimum differences of n[x] for values between [a,b].
ncom = Compile[{{a, _Integer}, {b, _Integer}},
  Module[{x = a, n0 = n[x], out = {}, cmax = n0, cmin = n0, p},
   While[x < b,
    {p = NextPrime[x];
     n0 = n0 - Mod[p, 4, -2];
     If[n0 > cmax, cmax = n0];
     If[n0 < cmin, cmin = n0];
     AppendTo[out, {p, n0}];
     x = p}]; Return[cmin, cmax]], RuntimeAttributes -> {Listable},
  Parallelization -> True, CompilationTarget -> "C"]

My goal is to create a table with five columns: a | b| b/a | Max[a,b] | Min[a,b], where the values of a and b are increasing by dyadic intervals. I generate the values for a and b using rand[x,y], where Min[a] = a & Max[a] = b.
rand[x_, y_] :=
 Do[For[k = {}; j = x, j < y, j++,
   a = {RandomInteger[{3 2^j, 3 2^(j + 1)}],
     RandomInteger[{3 2^j, 3 2^(j + 1)}]};
   AppendTo[k, {Min[a], Max[a]}]]; Return[k], 1]

My desired range of [a,b] (with greatest interval in powers of 10^12) occurs when I use rand[30,50]. However when I plug the a and b numbers I get from rand[x,y] into ncom[a,b], ncom fails to output because its too slow.
So far, I have tried to use floating numbers (which actually ended up insignificant to my code) and Compile (including many of its options such as parallelization).   Any other ways of improving the efficiency, aside from those mentioned above, would be of great help. Ideally, my goal is to use ncom for numbers up to 10^15.


text: Q: How to display webpages in tvos using webkit I was trying to submit my web based app to apple app store for tvOS, and they basically say that you should use webkit/webkitjs for web content. however, when I try to run a sample app; webkit doesn't load on apple tv. Now, I think I also read somewhere that apple tv doesn't support webkit. So, does tvOS support webkit? And id so, then why can I not find any help on displaying webpages in tvOS? The only help available is from many years ago which is also not applicable right now.


text:
Q: kdb+/q: Check if argument has been supplied to the function call Say we have function fun with two arguments, second one is optional.
How to check within the function whether the second, optional argument has been supplied and act accordingly?
fun: {[x;optarg] $["optarg was supplied" like "optarg was supplied";"behavior 1"; "behavior 2"] }
fun[1;2] / behavior 1
fun[1]   / behavior 2

```

A: I don't think this is possible. Supplying less than the specified number of arguments result in a projection.
A good alternative is to have your function accept one argument - a list. And then you can check for the existence of each element of the list.
f:{[l] $[1=count[l];
             / do something with first arg only;
             / do something with both args ]
}

Or you could have the function accept a dictionary (this allows you to set default values in the function).
q)f:{[dict] def:`a`b`c!10 20 30;
            def:def upsert dict;
            :def[`a] + def[`b] + def[`c] }

q)f[`a`b!5 10]
45

q)f[`a`c!5 10]
35

A: You can't check for number of arguments, kdb+ will report rank error when number of arguments is more than expected. But there is a workaround which will result in function which will accept any number of arguments:
q)func:('[{$[1=count x;"one";"more"]};enlist])
q)func[1]
"one"
q)func[1;2]
"more"
q)func[1;2;3]
"more"

Here is an example:
q)func:('[{$[1=count x;x[0];sum x]};enlist])
q)func[1]
1
q)func[1;2]
3
q)func[1;2;4]
7
q)func[1;2;4;7]
14

A:

func:('[{
         inputs:(`a_Required`b_Required`c_Optional`d_Optional);
         optionalDefaults:`c_Optional`d_Optional!(0b;1b);
         if[(count inputs)<count x;-1"Too Many input arguments";:()];
         data:inputs xcols optionalDefaults, (!) . (numInputs:count x)#'(inputs;x);
         show data;
         data
       };enlist]
     )


text:
Q: Is there a way to test Slash Commands in Slack without a signed cert? I'm attempting to follow this tutorial: https://api.slack.com/interactivity/slash-commands
However, it looks like, despite the documentation saying that a "non-distributed app" can send HTTP POST requests to an API, but in the menu where one defines a new slash command, under the URL, it keeps saying "use HTTPS for security" (and doesn't appear to take a self-signed cert, as is also mentioned in the documentation).
I don't want to buy a CA cert just to test this out, has anyone run into this issue before?

A: Resolved- just put "https://" before the host address, it'll let you submit the web form to create the bot, and then you can edit it back to normal HTTP afterward.


text:
Q: Search function returns strpos() warning I'm using this solution for searching phrases in wordpress. The function is this
function excerpt($text, $phrase, $radius = 100, $ending = "...") {

     $phraseLen = strlen($phrase);
   if ($radius < $phraseLen) {
         $radius = $phraseLen;
     }

     $phrases = explode (' ',$phrase);

     foreach ($phrases as $phrase) {
         $pos = strpos(strtolower($text), strtolower($phrase));
         if ($pos > -1) break;
     }

     $startPos = 0;
     if ($pos > $radius) {
         $startPos = $pos - $radius;
     }

     $textLen = strlen($text);

     $endPos = $pos + $phraseLen + $radius;
     if ($endPos >= $textLen) {
         $endPos = $textLen;
     }

     $excerpt = substr($text, $startPos, $endPos - $startPos);
     if ($startPos != 0) {
         $excerpt = substr_replace($excerpt, $ending, 0, $phraseLen);
     }

     if ($endPos != $textLen) {
         $excerpt = substr_replace($excerpt, $ending, -$phraseLen);
     }

     return $excerpt;

}
The thing is, since wordpress 4.0 this stopped working, and I'm getting Warning: strpos(): Empty needle warning.
I've tried with checking the $pos if it's empty, null, etc. Also with $text and $phrase, but no luck.
Anyone has a solution to this problem?
EDIT: The answer by VolkerK is ok, but I'd like to search not to return an error so I went with:
if(empty($phrase)){
    return;
}

In the beginning of the function. Works fine. :D

A: Somehow strtolower($phrase) must evaluate to an empty string when calling strpos, so let's use a function that filters out empty (sub-)strings and put in some more test.
$phrases = preg_split('!\s+!', $phrase, -1,  PREG_SPLIT_NO_EMPTY);
if ( empty($phrases) ) {
    trigger_error('empty phrase', E_USER_ERROR);
}

foreach ($phrases as $phrase) {
    $phrase = strtolower($phrase);
    if ( 0==strlen($phrase) ) {
        trigger_error('empty phrase', E_USER_ERROR);
    }
    $pos = strpos(strtolower($text), strtolower($phrase));
    if ($pos > -1) break;
}
// you probably should test ($pos > -1) here again

see also:
http://docs.php.net/preg_split
http://docs.php.net/trigger_error


text:
Q: Use begin and rescue in select syntax I want to select the task which won't get exception in the  following code,
How could I get it ?
if the task status contains the pid and the process is running on my system,
then it won't get exception.
This code is in my helper function, should I move some function to Model ? (I'm using ROR)
  def sanitize_running_tasks(tasks)

    sanitized_tasks = tasks.select do |task|
      begin
        Process.kill 0, task.status.to_i
      rescue Exception => e
        task.status = :FAIL
        task.save
      end
    end
  end

A: Please consider putting the kill method on Task.
  def sanitize_running_tasks(tasks)
    tasks.select &:kill
  end

  class Task
    def kill
      Process.kill 0, status.to_i
      true
    rescue Exception => e
      mark_failed!
      false
    end

    def mark_failed!
      update_attributes status: :FAIL
    end
  end


text:
Q: Express: Automatic View Routing Is it possible to create a route that automatically routes requests to a path that corresponds to a server side rendered template? Sort of like app.use(express.static(__dirname + '/public')) does for static content?
What I mean is that I use handlebars:
const expressHandlebars = require('express-handlebars');
app.engine('handlebars', expressHandlebars({
    defaultLayout: 'main'}))

what I find myself doing alot is doing this:
app.get('/home', (req, res) =>{
    res.render('home')})

app.get('/about', (req, res) =>{
    res.render('about')})

app.get('/staff/kathrin', (req, res) =>{
    res.render('staff/kathrin')})

//etc..

With my views being
/views/
   home.handlebars
   about.handlebars
   /staff/
      kathrin.handlebars

So I'm looking for a way to automate these routes if the requested path corresponds to a handlebars template within my /views/ directory. I obviously would need a way to deviate from that behaivour since some templates would need more/different context and also some paths have different functionality. Is there some kind of middleware that does this?

A: Well, you could write some fairly simple middleware that would do that for you:
function render(req, res, next) {
    let path = req.originalUrl;
    // remove any query string
    let index = path.indexOf("?");
    if (index >= 0) {
        path = path.slice(0, index);
    }
    // for safety purposes, need to also skip any paths with ".." in it
    if (path.indexOf("..") >= 0) {
        next();
        return;
    }

    // remove leading /
    path = path.slice(1);

    // let res.render() tell us whether the file exists or not
    res.render(path, (err, html) => {
        if (err) {
            next();
        } else {
            res.send(html);
        }
    });
}

app.use(render);

A: Trying to make jfriend00's answer more elegant/compact. The idea is his, not mine. So:
let viewsRouter = (req, res, next) => {
    // Path without the initial slash ("/") and removing the unsafe ".."
    let requestedPath = req.path.slice(1).replace(/\.\./g,'');
    // Now, try to render view
    res.render(requestedPath, (err,html)=>{
        if (err) {next()}       // Not found. Check if next route applies
        else {res.send(html)}   // Found. Render view
    });
};
app.use(viewsRouter)


text:
Q: Cannot see any blocks in Magento2 Magento version - Community Edition 2.1.1
Machine - AWS EC2
OS - Ubuntu - 14.04
Php - 5.6
MySql - 5.6
Theme - Default Luma
I have installed magento 2 without sample data.
Everything is working smoothly but I could not see any blocks under this tab.
Admin Login -> Content -> Blocks
It shows ' We could not found any records'
Is this the expected behaviour ? How can I add default blocks?
I have already explored this https://community.magento.com/t5/Theming-Layout-Design-Questions/No-default-Content-Elements-Blocks-listed-in-admin-backend-e-g/m-p/41872#M598 , but this is not exactly I am looking for.
Even my database cms-block table is empty.
I am new to magento2 and really stuck here.
Any help is really appreciated.

A: Yes this is expected behaviour.
Your blocks may depend on your theme.
For example if you purchase theme you may see more blocks.
Go ahead and create a block. This block can be imported using widgets in your pages(Home page for example) or even block inside another block.
Thanks

A: Magento without sample will not have default data.
So you should create cms block/pages for that or install a theme that will auto create default data for you.


text:
Q: hangfire database not created after install I installed the hangfire with Nuget.
PM> Install-Package Hangfire

Then updated the OWIN Startup class with the following lines:
public void Configuration(IAppBuilder app)
{
    GlobalConfiguration.Configuration.UseSqlServerStorage("MySqlConnection");

    app.UseHangfireDashboard();
    app.UseHangfireServer();
}

I named the connection string name on the web.config as the name of the connectionString In UseSqlServerStorage.
web.config:
<connectionStrings>
    <add name="MyEntities" connectionString="metadata=res://*/CRMModelContext.csdl|res://*/CRMModelContext.ssdl|res://*/CRMModelContext.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=xxx;persist security info=True;user id=sa;password=123;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
    <add name="MySqlConnection" connectionString="User ID=sa;Initial Catalog=xxx;Password=123;Integrated Security=False;Data Source=." />

SQL Server 2008 R2 is installed on the system but The database for the hangfire is not in it.
Finally, when I run the program, the error below.
My Job:
BackgroundJob.Enqueue<Receiver>(x=>x.EmailReceiving());
RecurringJob.AddOrUpdate<Receiver>(x => x.EmailReceiving(), Cron.MinuteInterval(15));

error:
 JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.

A: I had struggled to find the right solution online, then after asking around, I realized that I should create the datatable on the server by myself, then the tables will be created by hangfire after the application started.
Basically, there are 3 main lines of code that I put in my application to make the hangfire works:(.netcore web application) (in the startup.cs)
public void ConfigureServices(IServiceCollection services)
{
    ......
    string connectionString = "getYourConnectionStringHere";
    services.AddHangfire(x => x.UseSqlServerStorage(connectionString));
    services.AddHangfireServer();
    ......
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    ....
    app.UseHangfireDashboard("/hangfire"); //this is to set the url for hangfire, e.g. localhost://xxxx/hangfire
    ...
}

A: GlobalConfiguration.Configuration.UseSqlServerStorage("MySqlConnection"); is using MySqlConnection as a connection string, not the value of MySqlConnection!
Are you using MsSql Server or MySql Server?
Try :
GlobalConfiguration.Configuration.UseSqlServerStorage(ConfigurationManager.ConnectionStrings["MySqlConnection"].ConnectionString);


text:
Q: Why isn't MinGW's find command printing all files on drive C:? I'm using MinGW (as packaged by msysgit for Windows), and I'm trying to list all the files on my C drive. I would expect
find /c

to do this. However, this is not what I'm seeing (in an MinGW window):
$ find /c
 ...
/c/Program Files
/c/Program Files/7-Zip
/c/Program Files/7-Zip/7-zip.chm
...
/c/System Volume Information
find: /c/System Volume Information: Permission denied
/c/WINDOWS
/c/ZInstaller

Why are the files under WINDOWS and ZInstaller not showing up? If I find /c/windows or find /c/ZInstaller, all is well.

A: The 1.0.11 release specifically addresses this problem.  Make sure you using at least that version of msys.
Summary of relevant change:

Added: 2008.07.21
  Changes:
      Fix bug #1791494: find not reporting all expected matches.


text:
Q: How do you make an image change on click and revert upon release using HTML/CSS/JS I have an issue with Styling an object to make it look like a button and act as a functional link.
The effect i'm trying to achieve is to represent a button, so when clicked, it will begin to load the target page, but animate the object to visually represent a button being pressed.
Here is a (non-working) JS Fiddle as an example of the desired effect.
The first fiddle has no JavaScript in it for now, as i am currently a novice when it comes to manually typing it.
I have tried using pseudo classes, such as :hover as a temporary solution, but it doesn't work as desired, and from what i've tried, every possible solution i have seen on other questions don't seem to resolve my problem
This JS Fiddle i found in another question provides some coverage of the topic, but i can't seem to make it work for images, it only works for text and any changes i try just seem to break it or make the object not work or even appear.
Any help with this would be greatly appreciated as i have been trying different methods for a few weeks.
Thanks in Advance

A: You can use :hover in css.
https://jsfiddle.net/pmy74ox5/6/
In your case (without js), use background-url in img and change its url in img:hover

A: you could wrap the button in an empty anchor tag and then use the :active selector on the a tag.
a:active{
  //some styling
}

check out the selectors for a tags here:
http://www.w3.org/TR/selectors/#the-user-action-pseudo-classes-hover-act
the other way of doing it may be to use the checkbox hack:
https://css-tricks.com/the-checkbox-hack/
or in js, something like:
var my_button = getElementById('button')
var clicked = false;
var buttonClicked = function(e){
  if(!clicked){
    my_button.classList.add("downClass");
  }else{
    my_button.classList.remove("downClass");
  }
}

my_button.addEventListener('click',buttonClicked);

A: You can define the img in css and use a little jquery to have the desired effect :
.button{
    background:url(https://cdn.tutsplus.com/vector/uploads/legacy/tuts/000-2011/463-steel-buttons/35.jpg) no-repeat 0 top;
    width: 300px;
    height: 300px;
    display: inline-block;
}
.button.click{
    background:url(https://cdn.tutsplus.com/vector/uploads/legacy/tuts/000-2011/463-steel-buttons/35.jpg) no-repeat  -300px top;
}

here the js
$('.button').on("mousedown", function(){
    $(this).addClass('click');
})
$('.button').on("mouseup", function(){
    $(this).removeClass('click');
})

https://jsfiddle.net/pmy74ox5/7/
a solution with only jquery is possible too.


text:
Q: Drawing a square with colored hatched little subsquares I would like to draw a  as shown below. It is a square grid. Some regions are hatched in blue, others contain a red cross. Some edges are blue, others are red, but the red color don't reach the vertices, it stops just short of them, revealing the underlying thin black grid. Some vertices are colored red, others are colored blue.
I think I can draw the underlying grid myself, either by manually entering coordinates and instructions to link vertices by straight edges or using the grid command, and I think I should also be able to draw colored thick nodes that cover up whatever they lie on top of. however, I don't know how to draw the "hatched" region.
I want to include this drawing to lecture notes on homotopy theory I'm typing up. One defines a function by some fixed expression on the blue part of the grid, and inductively extends it to the whole square, first on the red vertices, then on the red edges, and lastly on the faces containing a red cross.
Thanks for your help!

A: With PSTricks just for fun! The remaining tedious parts can be easily added by yourself.
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node}
\addtopsstyle{gridstyle}{gridlabels=0pt,strokeopacity=.25}

\begin{document}
\begin{pspicture}[showgrid=top](8,8)
    \multips(0,.5)(0,1){8}{%
        \multips(.5,0)(1,0){8}{%
            \psline[linecolor=red](6pt;-135)(6pt;45)
            \psline[linecolor=red](6pt;135)(6pt;-45)}}
    \pscustom
    [
        dimen=middle,
        fillstyle=eovlines*,
        fillcolor=white,
        hatchcolor=blue,
        linecolor=blue,
    ]
    {
        \psframe(8,8)
        \pspolygon
        (3,1)
        (3,4)
        (1,4)
        (1,6)
        (2,6)
        (2,7)
        (7,7)
        (7,4)
        (6,4)
        (6,6)
        (5,6)
        (5,4)
        (6,4)
        (6,3)
        (7,3)
        (7,1)
        (6,1)
        (6,2)
        (5,2)
        (5,1)
    }
    \psset{linecolor=blue,nodesep=7pt}
    \pscircle*(4,2){2pt}
    \pscircle*(4,3){2pt}
    \pcline(4,2)(4,3)
\end{pspicture}
\end{document}

update
here is my response to barbara beeton's comment:

A:
MWE with Asymptote:
% topo.tex :
%
\documentclass{article}
\usepackage[inline]{asymptote}
\begin{asydef}
import patterns;

struct topoBoxPens{
  pen gridPen, borderPen, outlinePen, hatchPen;
  pen crossPen, redStrokePen, blueStrokePen;
  pen labelPen, bgPen;
  void operator init(
    pen gridPen=darkblue+0.4bp
   ,pen borderPen=deepblue+2bp
   ,pen outlinePen=deepblue+1bp
   ,pen hatchPen=paleblue+2bp
   ,pen crossPen=red+1.2bp
   ,pen redStrokePen=  deepred+3bp+opacity(0.7)
   ,pen blueStrokePen=deepblue+squarecap+3bp+opacity(0.7)
   ,pen labelPen=olive+fontsize(10pt)
   ,pen bgPen=paleyellow //white
  ){
    this.gridPen       = gridPen      ;
    this.borderPen     = borderPen    ;
    this.outlinePen    = outlinePen   ;
    this.hatchPen      = hatchPen     ;
    this.crossPen      = crossPen     ;
    this.redStrokePen  = redStrokePen ;
    this.blueStrokePen = blueStrokePen;
    this.labelPen      = labelPen     ;
    this.bgPen         = bgPen        ;
  }
}

struct topoBox{
  int n;
  real cellWidth;
  topoBoxPens Pens;
  pair ll, ur;
  int[][] mask;
  real dc;
  pair[] redDots;
  pair[] blueDots;
  guide[] redStrokes;
  guide[] blueStrokes;

  void drawGrid(){
    for(int i=0;i<n;++i){
      draw((0,i)*cellWidth--(n,i)*cellWidth,Pens.gridPen);
      draw((i,0)*cellWidth--(i,n)*cellWidth,Pens.gridPen);
    }
  }

  void drawGridLabels(){
    for(int i=0;i<n;++i){
      label("$"+string(n-i)+"$",(0,i+0.5)*cellWidth,W,Pens.labelPen);
      label("$"+string(n-i)+"$",(n,i+0.5)*cellWidth,E,Pens.labelPen);
      label("$"+string(i+1)+"$",(i+0.5,0)*cellWidth,S,Pens.labelPen);
      label("$"+string(i+1)+"$",(i+0.5,n)*cellWidth,N,Pens.labelPen);
    }
  }

  void drawBorder(){
    draw(box(ll,ur),Pens.borderPen);
  }

  void drawHatch(){
    add("hatch",hatch(2mm,Pens.hatchPen));
    fill(box(ll,ur),pattern("hatch"));
  }

  guide[] xcross(transform t){
     return t*((-dc,-dc)--(dc,dc))
      ^^(t*((dc,-dc)--(-dc,dc)));
  }

  void drawMask(){

    for(int i=0;i<n;++i){
      for(int j=0;j<n;++j){
        if(mask[i][j]==1){
          filldraw(
            box((j,n-i-1)*cellWidth,(j+1,n-i)*cellWidth)
            ,Pens.bgPen,Pens.gridPen
          );
        }
      }
    }
    for(int i=0;i<n;++i){
      for(int j=0;j<n;++j){
        if(mask[i][j]==1){
          draw(xcross(shift(j+0.5,n-i-0.5)),Pens.crossPen);
        }
      }
    }
  }

  void drawOutline(){
    for(int i=1;i<n-1;++i){
      for(int j=1;j<n-1;++j){
        if(mask[i][j]==1 && mask[i-1][j]==0){
          draw((j,n-i)--(j+1,n-i),Pens.outlinePen);
        }
        if(mask[i][j]==1 && mask[i+1][j]==0){
          draw((j,n-i-1)--(j+1,n-i-1),Pens.outlinePen);
        }
        if(mask[i][j]==1 && mask[i][j-1]==0){
          draw((j,n-i)--(j,n-i-1),Pens.outlinePen);
        }
        if(mask[i][j]==1 && mask[i][j+1]==0){
          draw((j+1,n-i)--(j+1,n-i-1),Pens.outlinePen);
        }
      }
    }
  }

  void drawDots(){
    for(int i=0;i<redDots.length;++i){
      fill(circle((redDots[i].x,n-redDots[i].y),2dc),Pens.redStrokePen);
    }
    for(int i=0;i<blueDots.length;++i){
      fill(circle((blueDots[i].x,n-blueDots[i].y),2dc),Pens.blueStrokePen);
    }
  }

  void drawStrokes(){
    for(int i=0;i<redStrokes.length;++i){
      draw(reflect((0,n/2),(n,n/2))*subpath(redStrokes[i],0.2,0.8),Pens.redStrokePen);
    }
    for(int i=0;i<blueStrokes.length;++i){
      draw(reflect((0,n/2),(n,n/2))*subpath(blueStrokes[i],0,1),Pens.blueStrokePen);
    }
  }

  void draw(){
    drawGrid();
    drawGridLabels();
    drawHatch();
    drawMask();
    drawDots();
    drawStrokes();
    drawOutline();
    drawBorder();
  }

  void copyMask(int[][]mask){
    for(int i=0;i<n;++i){
      if(mask.initialized(i)){
        for(int j=0;j<n;++j){
          if(mask[i].initialized(j)){
            this.mask[i][j]=mask[i][j];
          }
        }
      }
    }
  }

  void operator init(
     int n=8
    ,int[][] mask
    ,pair[] redDots
    ,pair[] blueDots
    ,guide[] redStrokes
    ,guide[] blueStrokes
    ,real cellWidth=1
    ,topoBoxPens Pens=topoBoxPens()
  ){
    assert(n>1);
    this.n=n;
    this.mask=array(n,array(n,0));
    copyMask(mask);
    this.redDots  = copy(redDots );
    this.blueDots = copy(blueDots);
    this.redStrokes  = copy(redStrokes);
    this.blueStrokes = copy(blueStrokes);
    this.Pens=Pens;
    this.cellWidth=cellWidth;
    this.ll=(0,0);
    this.ur=(n,n)*cellWidth;
    this.dc=0.0618cellWidth;
  }
}
\end{asydef}
%
\usepackage{lmodern}
\begin{document}
\begin{figure}
\begin{asy}
settings.outformat="pdf";

size(200);

topoBox tb=topoBox(
  mask=new int[][]{
    array(8,0),
    new int[]{0,0,1,1,1,1,1,},
    new int[]{0,1,1,1,1,0,1,},
    new int[]{0,1,1,1,1,0,1,},
    new int[]{0,0,0,1,1,1,},
    new int[]{0,0,0,1,1,1,1,},
    new int[]{0,0,0,1,1,0,1,},
    }
  ,redDots=new pair[]{(3,2),(4,3),(4,4),(5,5)}
  ,blueDots=new pair[]{(2,3),(3,3),(4,2),(4,5),(4,6)}
  ,redStrokes=new guide[]{
     (2,2)--(3,2)
    ,(3,2)--(4,2)
    ,(4,2)--(5,2)
    ,(6,2)--(7,2)
    ,(1,3)--(2,3)
    ,(3,3)--(4,3)
    ,(4,3)--(5,3)
    ,(6,3)--(7,3)
    ,(3,4)--(4,4)
    ,(4,4)--(5,4)
    ,(4,5)--(5,5)
    ,(5,5)--(6,5)
    ,(6,6)--(7,6)
    ,(2,2)--(2,3)
    ,(2,3)--(2,4)
    ,(3,1)--(3,2)
    ,(3,2)--(3,3)
    ,(3,3)--(3,4)
    ,(4,2)--(4,3)
    ,(4,3)--(4,4)
    ,(4,4)--(4,5)
    ,(4,6)--(4,7)
    ,(5,1)--(5,2)
    ,(5,4)--(5,5)
    ,(5,5)--(5,6)
    ,(6,1)--(6,2)
    ,(6,5)--(6,6)
   }
  ,blueStrokes=new guide[]{
    (4,1)--(4,2)
   ,(4,5)--(4,6)
   ,(2,3)--(3,3)
   ,(3,5)--(4,5)
   ,(3,6)--(4,6)
   ,(4,6)--(5,6)
   }
);
tb.draw();
\end{asy}
\end{figure}
\end{document}
%
% Process:
%
% pdflatex topo.tex
% asy topo-*.asy
% pdflatex topo.tex


text:
Q: Is there any way I can hide all files and folders from the OS X Desktop, but leave the Hard Drive(s), CD's, External Drives, Network Drives there? I was hoping there was a way I would be able to make all folders and files hidden on the OS X Desktop, but leave the Hard drive(s), network drives, CD's/DVD's, etc. But if I was to go into the Desktop Folder using Finder, the items would still be there. So, basically the opposite of the Finder Preferences of showing specific items on the desktop, to hide the files, etc. but leave the HDD's, CD's, etc.:

Thanks a lot

A: What I do is just have a folder on the desktop which I occasionally throw things into when the desktop gets too cluttered - at least you only have one thing visible on the desktop. You could also try https://www.macupdate.com/app/mac/48203/desktop-pirate

A: While the comments above are correct (the Desktop folder and the actual Desktop are the same thing), you still can choose to hide all your files/folders on your desktop if you wish to do so:
From the terminal:
defaults write com.apple.finder CreateDesktop -bool false

then you need to restart the Finder for it to reflect the modification:
killall Finder

To switch things back to the default:
defaults write com.apple.finder CreateDesktop -bool true

then you need to restart the Finder:
killall Finder

But - bear in mind that this method will hide everything on the Desktop.

A: From Terminal use
chflags hidden ~/Deskop/foldername/
for each of the folder (see man chflags), or even
chflags hidden ~/Deskop/*
This will make them disappear from Finder.


text:
Q: Navigation bar not being moved to the right? I'm trying to recreate the Google homepage as part of theodinproject and I'm having trouble trying to get the navbar across the top to the right.
I tried display: flex and float: right but I'm not sure how to get the Images, Gmail, and Sign In button to the right. I've been told  that my style isn't being applied also. Would anyone be willing to help? I'd greatly appreciate it. Below is a snippet of my html and css code and a link to how the page appears.
https://i.stack.imgur.com/pAgDn.png

<button>Sign in</button>

Images

Gmail

ul {
    list-style-type: none;
  }

  li {
    float: right;
  }

  li a {
    display: block;
    padding: 10px 10px;
  }```

A: Seems like your only mistake is not having a <style> tag around your css code. Try this.
<style>
ul {
    list-style-type: none;
  }

  li {
    float: right;
  }

  li a {
    display: block;
    padding: 10px 10px;
  }
</style>

A: Using float is not necessary for that, you can definitely use display: flex. The minimum to understand about flex is that it affects child elements only, so if you want to have a navbar which appears on the right for example, you need to use display: flex on the parent.

.header {
 display: flex;
}
<div class='header'>
 <div class='navbar'></div>
 <div class='logo'></div>
</div>

You can also use justify-content to choose how they align among the main axis (by default the horizontal one)
For something like this I'd add justify-content: space-around or justify-content: space-between.
I'd highly recommend reading more about Flex, as it's super useful.
Good resource:
https://css-tricks.com/snippets/css/a-guide-to-flexbox/

A: You need to wrap the css styling inside a  as in the example below:

<style>
  ul {
    list-style-type: none;
  }

  li {
    float: right;
  }

  li a {
    display: block;
    padding: 10px 10px;
  }
</style>

and also you need to remove the characters at the end ( ``` )

A: Try using:
header {
        width: fit-content;
        margin-left: auto;
    }

For example, I did the top part using this idea. This is how it looks.

html {
  font-family: sans-serif;
  color: #333;
}

header {
  width: fit-content;
  margin-left: auto;
}

li,
ul,
buttom {
  display: inline-block;
  padding: 0 1ch;
}

li {
  font-size: 0.85em;
  color: #555;
}

img {
  display: block;
  margin: 0 auto;
  width: 20em;
  padding-bottom: 1.5em;
}

main {
  padding: 20vh 0;
  width: fit-content;
  margin: 0 auto;
}

input {
  margin: 0 auto;
  display: block;
  border: 1px solid silver;
  border-radius: 2.8em;
  height: 2.8em;
  width: 40em;
}

Gmail

Images

  <button>Sign in</button>

  <input type="search">

I hope it works!


text:
Q: Users post my comments as answers EDIT After reading my own pcst again, I do not think it is constructive. I can't delete it so I flagged it as not constructive. This issue is too minor to be discussed in meta IMO.
I'm sorry if this was asked before, I've looked for it and couldn't find it.
Recently I've been running into the following scenerio:

*

*I look at a recently asked low-quality question. I vote to close it and do not post an answer, usually because it is not-constructive or it is a duplicate.

*I comment with the fix to the problem, prompting the user it was very easy to find with a search engine or leave a link to a duplicate question.

*Users come in, a few minutes after I voted to close the question and left the comment and use that comment to formulate a low quality answer, or posts something along the lines of that comment as their own.

*Original poster sees that answer, before/after the question is closed and up-votes it/accepts it, giving the guy who put the answer rep.

I've been noticing this pattern quite a lot recently. Here is the most recent example although I've seen it at least a dozen times before.
What can I do to improve in my approach to the problem?
In general, what should be done in such cases?

A: You could still submit the vote to close, and provide the solution as an answer, rather than a comment.


text:
Q: SQL query results not add up when using a WHERE clause What could be causing my second SQL query to return less than the expected count? I have an address table with 1000 entries, and my first query returns 100 when filtering for 'New York' city and 'Mainstreet' street. The second query should return 900, but it's not. Here are my queries:
select count(*)
from address_data
where city = 'New York' and street = 'Mainstreet'

select count(*)
from address_data
where not (city = 'New York' and street = 'Mainstreet')

A: --  S a m p l e   d a t a :
WITH
    tbl (ID, CITY, STREET) AS
        (
            Select 1, 'New York', 'Main Street' From Dual Union All
            Select 2, 'New York', 'NOT Main Street' From Dual Union All
            Select 3, 'NOT New York', 'Main Street' From Dual Union All
            Select 4, 'New York', Null From Dual
        )

-- Your 2nd query returns 2 instead of 3 as count
Select Count(*) "CNT"
From tbl
Where CITY = 'New York' and STREET = 'Main Street'

-- Options for your 2nd query that all return 3 as count

-- Posssible Null values replaced with '-' for comparison
-- using NOT (condition 1 And condition 2)
Select Count(*) "CNT"
From tbl
Where Not (Nvl(CITY, '-') = 'New York' And Nvl(STREET, '-') = 'Main Street')

-- Posssible Null values replaced with '-' for comparison
-- using negative Condition 1 OR negative Condition 2
Select Count(*) "CNT"
From tbl
Where Nvl(CITY, '-') != 'New York' OR Nvl(STREET, '-') != 'Main Street'

-- using negative Condition 1 OR negative Condition 2
-- additional testing for null values separately
Select Count(*) "CNT"
From tbl
Where CITY != 'New York' OR CITY Is Null OR STREET != 'Main Street' OR STREET Is Null

A: From the documentation:

A condition specifies a combination of one or more expressions and logical (Boolean) operators and returns a value of TRUE, FALSE, or UNKNOWN.

In the section on NULLs you'll find this clarification:

To test for nulls, use only the comparison conditions IS NULL and IS NOT NULL. If you use any other condition with nulls and the result depends on the value of the null, then the result is UNKNOWN. Because null represents a lack of data, a null cannot be equal or unequal to any value or to another null. However, Oracle considers two nulls to be equal when evaluating a DECODE function.

As long as where clause returns only rows where condition evaluates to TRUE (so it rejects FALSE and UNKNOWN), NOT (<condition>) will not provide you rows with UNKNOWN condition value.
Considering this sample data:

create table sample_tab(col) as
  select 'True' from dual union all
  select 'False' from dual union all
  select null from dual

You may use LNNVL function to catch everything that is not TRUE:
select *
from sample_tab
where lnnvl(col = 'True')

Or use pure set approach and calculate set complement with EXCEPT (MINUS in Oracle pre-19c) set operator:
select *
from sample_tab

except

select *
from sample_tab
where col = 'True'

In both cases you'll get the same result:

COL

False

null

fiddle

A: I think NULL values in the city and street columns are not identified in your second query. So may be can you try your second query like below; and see:
select count(*)
from address_data
where (NVL(city, '') != 'New York' OR NVL(street, '') != 'Mainstreet'))


text:
Q: Customize master page on modern/communication site I know that with the SharePoint Online publishing site we can develop a site where we can have the exact layout of my designed mock-up. So my question is will we be able to customize on some of the default components, such as the branding of O365 and navigation on top, to what we want?
For instance, removing the branding or changing the designing of the navigation.

A: Currently, customizing master page is not supported on modern sites.
More information, you can refer to the MSDN article:
https://msdn.microsoft.com/en-us/pnp_articles/modern-experience-customizations-customize-sites

A: New capabilities are being released to enable customising elements of modern pages, via the SharePoint Framework extensions.  So far the advice from Microsoft is we should only be targeting specific elements of a page with page placeholders as recommended here.
The general advice around supported customisations on modern sites is they will be made through browser-side code only; we probably won't know what the master page looks like into the future.

A: Good article. for activating Master pages, i followed this article to change the master page. http://sharepointsolutions-sudheer.blogspot.com/2020/04/custom-master-page-modern-site-sharepoint-online.html
and https://www.c-sharpcorner.com/article/create-a-custom-master-page-in-html-for-sharepoint-online/


text:
Q: how get session values from div of another page i have 3 jsp pages,namely a.jsp ,b.jsp and c.jsp,where in a.jsp i have a div where b and c will loads,now my requirement is  i have to send a  value form b.jsp and retrive in c.jsp,any idea?
    check my code
a.jsp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title>Tabs in HTML with CSS</title>

Tab 1

Tab 2

b.jsp

        <title>getQueryString() method of request object.</title>

                <form method="get">

                                        User Name:
                                        <input type="text" size="20" name="name" />

                                        <input type="button" id="NextBtn" value="Next" >

                       <%String name = request.getParameter("name");
                       session.setAttribute("name", name);
                     %>
                </form>

c.jsp

<%

out.println("Name : " + (String)session.getAttribute("name") + "
");

%>

A: There are two mistakes I notice:
In the b.jsp you have to correct this:
<form method="get" action="c.jsp">

and in your c.jsp, you have to correct this:
<%= (String)session.getAttribute("name") %>


text:
Q: Android swipe layout to dismiss I'm trying to make a swipeable layout so you can swipe it to dismiss like in Google now.
I managed to getting it worked on a view such as button using this codes:
SwipeDismissTouchListener:
public class SwipeDismissTouchListener implements View.OnTouchListener {
// Cached ViewConfiguration and system-wide constant values
private int mSlop;
private int mMinFlingVelocity;
private int mMaxFlingVelocity;
private long mAnimationTime;

// Fixed properties
private View mView;
private DismissCallbacks mCallbacks;
private int mViewWidth = 1; // 1 and not 0 to prevent dividing by zero

// Transient properties
private float mDownX;
private float mDownY;
private boolean mSwiping;
private int mSwipingSlop;
private Object mToken;
private VelocityTracker mVelocityTracker;
private float mTranslationX;

/**
 * The callback interface used by {@link SwipeDismissTouchListener} to inform its client
 * about a successful dismissal of the view for which it was created.
 */
public interface DismissCallbacks {
    /**
     * Called to determine whether the view can be dismissed.
     */
    boolean canDismiss(Object token);

    /**
     * Called when the user has indicated they she would like to dismiss the view.
     *
     * @param view  The originating {@link android.view.View} to be dismissed.
     * @param token The optional token passed to this object's constructor.
     */
    void onDismiss(View view, Object token);
}

/**
 * Constructs a new swipe-to-dismiss touch listener for the given view.
 *
 * @param view     The view to make dismissable.
 * @param token    An optional token/cookie object to be passed through to the callback.
 * @param callbacks The callback to trigger when the user has indicated that she would like to
 *                 dismiss this view.
 */
public SwipeDismissTouchListener(View view, Object token, DismissCallbacks callbacks) {
    ViewConfiguration vc = ViewConfiguration.get(view.getContext());
    mSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16;
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mAnimationTime = view.getContext().getResources().getInteger(
            android.R.integer.config_shortAnimTime);
    mView = view;
    mToken = token;
    mCallbacks = callbacks;
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
    // offset because the view is translated during swipe
    motionEvent.offsetLocation(mTranslationX, 0);

    if (mViewWidth < 2) {
        mViewWidth = mView.getWidth();
    }

    switch (motionEvent.getActionMasked()) {
        case MotionEvent.ACTION_DOWN: {
            // TODO: ensure this is a finger, and set a flag
            mDownX = motionEvent.getRawX();
            mDownY = motionEvent.getRawY();
            if (mCallbacks.canDismiss(mToken)) {
                mVelocityTracker = VelocityTracker.obtain();
                mVelocityTracker.addMovement(motionEvent);
            }
            return false;
        }

        case MotionEvent.ACTION_UP: {
            if (mVelocityTracker == null) {
                break;
            }

            float deltaX = motionEvent.getRawX() - mDownX;
            mVelocityTracker.addMovement(motionEvent);
            mVelocityTracker.computeCurrentVelocity(1000);
            float velocityX = mVelocityTracker.getXVelocity();
            float absVelocityX = Math.abs(velocityX);
            float absVelocityY = Math.abs(mVelocityTracker.getYVelocity());
            boolean dismiss = false;
            boolean dismissRight = false;
            if (Math.abs(deltaX) > mViewWidth / 2 && mSwiping) {
                dismiss = true;
                dismissRight = deltaX > 0;
            } else if (mMinFlingVelocity <= absVelocityX && absVelocityX <= mMaxFlingVelocity
                    && absVelocityY < absVelocityX
                    && absVelocityY < absVelocityX && mSwiping) {
                // dismiss only if flinging in the same direction as dragging
                dismiss = (velocityX < 0) == (deltaX < 0);
                dismissRight = mVelocityTracker.getXVelocity() > 0;
            }
            if (dismiss) {
                // dismiss
                mView.animate()
                        .translationX(dismissRight ? mViewWidth : -mViewWidth)
                        .alpha(0)
                        .setDuration(mAnimationTime)
                        .setListener(new AnimatorListenerAdapter() {
                            @Override
                            public void onAnimationEnd(Animator animation) {
                                performDismiss();
                            }
                        });
            } else if (mSwiping) {
                // cancel
                mView.animate()
                        .translationX(0)
                        .alpha(1)
                        .setDuration(mAnimationTime)
                        .setListener(null);
            }
            mVelocityTracker.recycle();
            mVelocityTracker = null;
            mTranslationX = 0;
            mDownX = 0;
            mDownY = 0;
            mSwiping = false;
            break;
        }

        case MotionEvent.ACTION_CANCEL: {
            if (mVelocityTracker == null) {
                break;
            }

            mView.animate()
                    .translationX(0)
                    .alpha(1)
                    .setDuration(mAnimationTime)
                    .setListener(null);
            mVelocityTracker.recycle();
            mVelocityTracker = null;
            mTranslationX = 0;
            mDownX = 0;
            mDownY = 0;
            mSwiping = false;
            break;
        }

        case MotionEvent.ACTION_MOVE: {
            if (mVelocityTracker == null) {
                break;
            }

            mVelocityTracker.addMovement(motionEvent);
            float deltaX = motionEvent.getRawX() - mDownX;
            float deltaY = motionEvent.getRawY() - mDownY;
            if (Math.abs(deltaX) > mSlop && Math.abs(deltaY) < Math.abs(deltaX) / 2) {
                mSwiping = true;
                mSwipingSlop = (deltaX > 0 ? mSlop : -mSlop);
                mView.getParent().requestDisallowInterceptTouchEvent(true);

                // Cancel listview's touch
                MotionEvent cancelEvent = MotionEvent.obtain(motionEvent);
                cancelEvent.setAction(MotionEvent.ACTION_CANCEL |
                        (motionEvent.getActionIndex() <<
                                MotionEvent.ACTION_POINTER_INDEX_SHIFT));
                mView.onTouchEvent(cancelEvent);
                cancelEvent.recycle();
            }

            if (mSwiping) {
                mTranslationX = deltaX;
                mView.setTranslationX(deltaX - mSwipingSlop);
                // TODO: use an ease-out interpolator or such
                mView.setAlpha(Math.max(0f, Math.min(1f,
                        1f - 2f * Math.abs(deltaX) / mViewWidth)));
                return true;
            }
            break;
        }
    }
    return false;
}

private void performDismiss() {
    // Animate the dismissed view to zero-height and then fire the dismiss callback.
    // This triggers layout on each animation frame; in the future we may want to do something
    // smarter and more performant.

    final ViewGroup.LayoutParams lp = mView.getLayoutParams();
    final int originalHeight = mView.getHeight();

    ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(mAnimationTime);

    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mCallbacks.onDismiss(mView, mToken);
            // Reset view presentation
            mView.setAlpha(1f);
            mView.setTranslationX(0);
            lp.height = originalHeight;
            mView.setLayoutParams(lp);
        }
    });

    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            lp.height = (Integer) valueAnimator.getAnimatedValue();
            mView.setLayoutParams(lp);
        }
    });

    animator.start();
}
}

Calling it:
    dismissableButton.setOnTouchListener(new SwipeDismissTouchListener(
            dismissableButton,
            null,
            new SwipeDismissTouchListener.DismissCallbacks() {
                @Override
                public boolean canDismiss(Object token) {
                    return true;
                }
                @Override
                public void onDismiss(View view, Object token) {
                group.removeView(dismissableButton);
             }
     }));

I want to make this code work on a layout so i could swipe the layout to dismiss, for example so i could place a RelativeLayout inside a ViewGroup and make the RelativeLayout swipeable to dismiss.

A: I just used the same SwipeDismissTouchListener class to implement a swipe gesture on a RelativeLayout, and at first had the problem of ACTION_MOVE never getting passed through, or any action other than ACTION_DOWN.
Found out that the problem is in ACTION_DOWN returning false. So just change your case ACTION_DOWN to return true, and it will work properly, as that will make other actions also get passed through.

A: you should know that if you return false for action_down , you will not get any further actions regarding this touch event
https://developer.android.com/training/gestures/detector#capture-touch-events-for-an-activity-or-view
"Beware of creating a listener that returns false for the ACTION_DOWN event. If you do this, the listener will not be called for the subsequent ACTION_MOVE and ACTION_UP string of events. This is because ACTION_DOWN is the starting point for all touch events."

A: This code worked for me. I was able to Swipe-dismiss Relative and Linear Layouts.  Just make sure you call the removeView() method from the correct immediate parent layout.
            @Override
            public void onDismiss(View view, Object token) {
            ViewGroup parent=(ViewGroup)dissmissableLayout.getParent();
            parent.removeView(dismissableLayout);
            }


text:
Q: Encoding very large numbers into Strings I have been trying to encode very large  integers into sequences of capital letters using PHP. assigning values from 0 to 25 to A~Z I have shortened 1 billion down to DGEHTYM. if a working algorithm is achieved, using different cases, numbers and even symbols the resulting string could be far shorter. my goal however is just strings of capital letters, perhaps with numeric characters too to make it shorter but not a must.
to encode using pen, paper and my phone's calculator:

*

*find the highest power of 26 lower than 1 billion (php has the function log for that). for 1 billion it's 6. so 26^6 = 308,915,776.

*1,000,000,000 by 308,915,776 is 3.237 with a lot of decimals

*3 is D. we got our first letter!

*now we will do the same thing over and over until we get an integer: take away the whole part and multiply the decimals left by 26. every whole we take out is a letter. for 1 billion I looped 6 times until I got 12, which is M.

maybe there is a smarter way to accomplish this but I haven't figured it out.
perhaps I should've done it differently but for the lack of a better way I tried to replicate my calculations in PHP, but I had problems: 1: it's very difficult to encode numbers that encoded would end with A (0) such as 1326 which would be BZA and 2: I couldn't manage to get PHP to detect whether a number has or doesn't have decimals. I had to keep converting it into a string and looking for a dot.
decoding the string is easier. from right to left, you multiply the value of each letter by 26 elevated to the power of its position, except for the first one, them sum it all:
D => 3 x (26^6) = 926,747,328
G => 6 x (26^5) = 71,288,256
E => 4 x (26^4) = 1,827,904
H => 3 x (26^3) = 123,032
T => 19 x (26^2) = 12,844
Y => 24 x 26 = 624
M => 12
926,747,328 + 71,288,256 + 1,827,904 + 123,032 + 12,844 + 624 + 12 = 1,000,000,000

there is a similar question here but those who answered didn't seem to understand what the OP was trying to accomplish.

A: You're converting from base 10 to 26, this is in the range that built-in functions like base_convert or gmp_strval can handle. They'll give digits in the form of 0-9 and a-p, so you just need to translate those into what you're after with strtr.
$translate = array_combine(
    array_merge(range(0, 9), range('a', 'p')),
    range('A', 'Z')
);

echo strtr(base_convert(1000000000, 10, 26), $translate), "\n";
echo strtr(base_convert(1326, 10, 26), $translate), "\n";

//Or if you're working with really big numbers (beyond PHP_INT_MAX):
echo strtr(gmp_strval(1000000000, 26), $translate), "\n";
echo strtr(gmp_strval(1326, 26), $translate);

Output:
DGEHTYM
BZA
DGEHTYM
BZA

Or to do it manually, which'll make it easy to add/remove symbols for different bases and encodings. Basically you divide your input number by the base, use the remainder to look up the appropriate symbol for that position, then repeat on the result of the division.
function base10_to_whatevs($num, array $digits)
{
    $result = '';
    $base = count($digits);
    while ($num > 0) {
        $remainder = $num % $base;
        $num = ($num - $remainder) / $base;
        $result = $digits[$remainder] . $result;
    }
    return $result;
}

$letters = range('A', 'Z');
echo base10_to_whatevs(1000000000, $letters), "\n";
echo base10_to_whatevs(1326, $letters);

DGEHTYM
BZA


text:
Q: Maven gpg plugin cant find artifact ive been trying to push my project into the maven repository and im trying to configure my maven gpg plugin correctly, im currently using it as
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>

but it doesnt seem to be able to find my artifact since it gives the rr
Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign (default-cli) on project fitnesse-bootstrap-plus-theme: The project artifact has not been assembled yet. Please do not invoke this goal before the lifecycle phase "package".

my jar gets generated in the root/target folder.

A: You should bind maven-gpg-plugin to phase verify which is executed after package phase and before install and deploy when you need signature to be installed / deployed.
So your configuration looks like:
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>

You can also ommit <phase>verify</phase> because maven-gpg-plugin is default bind to correct phase.


text:
Q: npm install  persistent error ? (node-gyp build ?) I try to install jsdom such:
$ sudo npm install -g jsdom
# OR
$ sudo npm install    jsdom

After some successfull command, the install quickly fails, with the first error message being after the [....] :
$ sudo npm install jsdom
npm http GET https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/jsdom
[....]

> contextify@0.1.7 install /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild

gyp: /home/yug/.node-gyp/0.10.25/common.gypi not found (cwd: /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify) while reading includes of binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.8.0-35-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm http 304 https://registry.npmjs.org/domhandler
npm http 304 https://registry.npmjs.org/domelementtype
npm ERR! contextify@0.1.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.7 install script.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.8.0-35-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "jsdom"
npm ERR! cwd /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE

npm http 304 https://registry.npmjs.org/qs
npm http 304 https://registry.npmjs.org/entities
....

Hint? This bug also appears for other modules :
 $sudo npm install -g topojson
 #bug with `contextify@0.1.7 install` error as well.

How to fix that ?

Edit: I tried sudo apt-get remove --purge nodejs npm topojson then reinstalling via various ways. Even when nodejs reinstall is successfull, the error stays, so I guess it's rather contextual (node.gyp ? cwd ? ...). Remove/reinstall ways tried :

*

*ubuntu_setup.sh

*

*with native outdated url

*with url updated to https://github.com/joyent/node.git,

*sudo add-apt-repository ppa:chris-lea/node.js,

*and handmade git clone https://github.com/joyent/node.git (trial canceled)

*using various other ways :

*

*way1 : ogoing

A: Seems I found a way by carefully deleting all node-related file and folder on my computer.
0. Context: I previously made several unsuccessful console clean-ups, with
sudo apt-get remove --purge nodejs npm topojson

followed by ~3 different ways to reinstall nodejs. I tried EACH way, from clean-up to reinstall, between 2 & 4 times.
1. Terminal purging: Let's first cleaned up my mess the deepest way possible:
npm cache clean; bower cache clean; grunt clean;
sudo apt-get remove --purge nodejs npm topojson

Yet, I just noticed that this deep purge does NOT purge/delete installed node modules, which stay persistent.
2. Hand purge: Also, I pushed the purge further with an hand purge for both nodejs and node_modules. I looked for ALL related folders on my computer, nearer the root (ubuntu: /home/<user>/) the better. I was careful to delete all previously installed global .../node-modules/ folders, without deleting local modules (specific local installations, which were still working).
3. Reinstall: Then the following consoles allowed a clean reinstall:
sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

sudo npm install -g topojson jsdom

Afterwhat, my file conversion via npm module topojson (depending itself on jsdom) worked fine :
cd /myfolder/
topojson -o output.topo.json input.geo.json

4. Conclusion: I can not identify why, which file/folder deletion allowed the successful sudo apt-get install nodejs + sudo npm install -g topojson reinstall. But thist deep cleanup via mouse and recursive remove sudo rm -r [node related folder/file] definitively unlocked my situation.
/!\ Be very careful with the rm -r recursive remove. /!\

A: As you're finding out from the comments, this is a very common issue. So common, in fact, that the authors of jsdom have documented it right in the README file for the project's git repository.

TL;DR
You need to have a C++ compiler and Python2.7 installed on your machine to install contextify which is a dependency of jsdom. Otherwise, the jsdom install will fail.

From the README on the Github page for jsdom:

Contextify
Contextify is a dependency of jsdom, used for running <script> tags within the page. In other words, it allows jsdom, which is run in Node.js, to run strings of JavaScript in an isolated environment that pretends to be a browser environment instead of a server. You can see how this is an important feature.
Unfortunately, doing this kind of magic requires C++. And in Node.js, using C++ from JavaScript means using "native modules." Native modules are compiled at installation time so that they work precisely for your machine; that is, you don't download a contextify binary from npm, but instead build one locally after downloading the source from npm.
Unfortunately, getting C++ compiled within npm's installation system can be tricky, especially for Windows users. Thus, one of the most common problems with jsdom is trying to use it without the proper compilation tools installed. Here's what you need to compile Contextify, and thus to install jsdom:
Windows

*

*A recent copy of the x86 version of Node.js for Windows, not the x64 version.

*A copy of Visual C++ 2010 Express.

*A copy of Python 2.7, installed in the default location of C:\Python27.

  There are some slight modifications to this that can work; for example full versions of Visual Studio usually work, and sometimes you can even get an x64 version of Node.js working too. But it's tricky, so start with the basics!
Mac

*

*XCode needs to be installed

*"Command line tools for XCode" need to be installed

*Launch XCode once to accept the license, etc. and ensure it's properly installed

  Linux
You'll need various build tools installed, like make, Python 2.7, and a compiler toolchain. How to install these will be specific to your distro, if you don't already have them.

Try installing jsdom again after satisfying the requirements mentioned above for your OS, and see if that solves it.
By the way, you are getting the same issue with topojson because it has a dependency on d3 which in turn depends on jsdom, so it is just the same problem installing jsdom. Hope this helps!
--EDIT--
Since it sounds like you're using Ubuntu, I would recommend starting with the following command:
sudo apt-get install build-essential

This will install make and g++ and some other tools. This package and Python2.7 is probably about all you'll need to successfully install contextify.

A: Solution 1b: I [suspect][1] the rm -r /home/<user>/local/lib/node_modules/ to be the key element unlocking the situation. You may list the global (-g) node_modules, then remove the relevant one(s) (topojson and/or jsdom and/or node-gyp) specifically, then reinstall it(them).
Commands: On ubuntu, try...
 cd /home/<user>/local/lib/node_modules/  #replace <user> by relevant user name to set your cwd
 ls -1      # give the list of global modules names
 rm -r /<module_name>    #replace <module_name> by relevant name to remove it
 sudo npm install -g <module_name>  #replace <module_name> by relevant name for global install

Note: topojson depends on jsdom and npm-gyp.
[1]: not tried, but makes sense according to my diagnostic.


text:
Q: Copy pasting of underscore When I use \textunderscore to print an underscore "_" character, the copy-paste functionality of Adobe Acrobat Reader does not appear to work properly. For instances,
when I copy
test_case

from Acrobat, and paste it in notepad, I get
test case

How to ensure that underscore is copied properly?

A: The fonts used with the "Original TeX" encoding (aka OT1) don't have an underscore character: they are only 7 bit fonts (128 characters) and some positions are hijacked to make room for more useful characters. For example in the position of the underscore there is the "dot accent", in place of < and > there are ¡ and ¿.
So with the default OT1 encoding, the command \textunderscore (or \_) is defined to produce a small rule, which is not recognized by PDF viewers as a character.
The problem doesn't show when T1 encoded fonts are used, because this encoding has all the printable ASCII characters in their slots. So the answer is
\usepackage[T1]{fontenc}

Make sure to have available the CM-Super font package, or the T1 fonts will be in bitmap form. An alternative is to use also
\usepackage{lmodern}

since the Latin Modern fonts are almost the same as the European Modern that are chosen by default with T1 and are surely available as Type1 fonts.


text:
Q: How to pass both props and a component as parameters of a functional component I'm trying to create a modal component that can display several different form components depending on which is passed to it, so I need to pass the child component as an argument, and I've got the correct syntax to do that, but I can't figure out the syntax for passing both props from the modal's parent and the child component as parameters. I can get either to work individually, but not together.
import React from 'react';
import useToggle from './hooks/useToggle';

function Modal(props, {children}) {
    const [hidden, toggleHidden] = useToggle(props.hidden);
return (
    <div style={{
        position: 'fixed',
        textAlign: 'center',
        width: '100%',
        height: '100vh',
        display: `${hidden ? 'none' : 'flex'}`,
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: 'rgba(0, 0, 0, .90)',
        zIndex: 1000
    }}>

                <button onClick={toggleHidden}>Close</button>

                {children}

)
}

export default Modal;

The code above doesn't work, but if I change the first line to:
function Modal({children}) {

then I get the functionality of passing a child component, and if I change it to
function Modal(props) {

I'm able to pass the props down.
If both can be passed as arguments to the same functional component what is the correct syntax? And if not what is the standard workaround? I've been using props to toggle the display of the modal but I'm wondering if there's a better way if I can't pass both.
Thanks!

A: Because the children property is a child property of "props". What you can do is use ...rest for the rest of the props. Like this
function Modal(props, {children})

to
function Modal({children, ...rest})


text:
Q: How to define a repeated array only once in a formula in Excel?
Shown above is a formula, where, in the highlighted parts, the same data values are entered manually as an array. My goal is to simplify the formula so that the array of values is entered only once in a formula.
The LET function looked like a possible solution but it is not available in older versions of Excel.
My question is how can I define only one array, so it can be used for multiple calculations in the same formula? The solution has to be supported by all Excel versions, including Excel Online and for Mac.

A: As suggested by Ron Rosenfeld in his comment, you can use a named formula to refer to the array by clicking on Formulas > Define Name, and typing in the array. Depending on the readability of your formula shown in the formula bar, you could choose to also name other parts of the formula, like this for example:
varArray = {0.5;7;9;5}
fxCount = COUNT(varArray)*0.25+0.5
fxSort = SORT(varArray,1)

Note that if you decide to later change the name varArray it will automatically be updated in the other named formulas. You can then insert these names into the formula:
=(INDEX(fxSort, CEILING(fxCount-0.5,1))+INDEX(fxSort, FLOOR(fxCount+0.5,1)))/2

Here is what it should look like in Excel with the Name Manager window open:

If you open the file in Excel Online, you can use the named formulas but you cannot edit them nor add new ones.


text:
Q: Comparing part of a filename in a windows batch file Consider this script:
SETLOCAL EnableDelayedExpansion
for /F "tokens=2 delims=." %%G in ("%1") do set partial_name = %%G
 if partial_name GEQ 9200 ( move I:\rosa\transfertmp\%1  L:\OSLDos\Tmp\ ) else  ( move I:\rosa\transfertmp\%1 L:\LdisOSLDos\Tmp\ )
ENDLOCAL

invoked as thisscript 11111.9100.csv
What I want to do is:
move the file to the correct folder, based on the second segment of the file name (9100), so if it is greater than 9200 move it to one folder and if it is not, move to another folder.
The problem seems to that the comparison does not work.

A: You're actually comparing the string partial_name to 9100, not the content of the variable.
Since p GEQ 9, this will evaluate to true.
Also, set partial_name = %%G sets partial_name  to  %%G (note trailing and leading spaces).
To fix both issues this, surround the variable name with percent signs (%) and remove the spaces surround the eual sign (=):
for /F "tokens=2 delims=." %%G in ("%1") do set partial_name=%%G
 if %partial_name% GEQ 9200 ( move I:\rosa\transfertmp\%1  L:\OSLDos\Tmp\ ) else  ( move I:\rosa\transfertmp\%1 L:\LdisOSLDos\Tmp\ )

A: Dennis identified one problem and provided a solution in his answer. But there are still other issues.
1) Your code set partial_name = %%G will include a trailing space in the variable name and a leading space in the value. The code should read set partial_name=%%G
2) Your %1 value may already be quoted, in which case you should remove the quotes before adding your own by using "%~1" instead of "%1".
3) Perhaps not a problem in your case, but it is generally a good idea to enclose file paths in quotes in case the name contains space or special characters.
4) I'm assuming you want to do a numeric comparison. The IF command uses almost the same rules as the SET /A command when it attempts to parse a number - Any number prefixed with 0 will be treated as hexadecimal notation. If it finds an invalid hex digit like 8 or 9, then the IF will revert to a string comparison instead of a numeric comparison.
For example if 09 lss 8 (echo true) else echo false returns true.
So if the 2nd segment of your file name has the potential to have leading zeros, then you need to do more work.
set "partial_name="
for /f "tokens=2 delims=." %%G in ("%~1") do (
  for /f "tokens=* delims=0" %%N in ("%%G") do set /a "partial_name=%%N"
  if not defined partial_name set "partial_name=0"
)
if %partial_name% GEQ 9200 (
  move "I:\rosa\transfertmp\%1" "L:\OSLDos\Tmp\"
) else (
  move "I:\rosa\transfertmp\%1" "L:\LdisOSLDos\Tmp\"
)


text:
Q: drop rows in Groupby python I want to get result
df3=df.groupby(['Region']).apply(lambda x: x[x['Region'].isin(["North", "East"])]['Sales'].sum()).reset_index(name='sum')

      Region    sum
0   East    455.0
1   North   665.0
2   South   0.0
3   West    0.0

I want to do drop rows with value = 0 or another conditions
   Region   sum
0   East    455.0
1   North   665.0

A: You can use df.loc

df[1]!=0 -> True/False filter

df.loc[df[1]!=0] # Apply the filter
df=pd.DataFrame([['East',  455.0],
['North',  665.0],
['South',  0.0],
['West',  0.0]])
df
Out[11]:
       0      1
0   East  455.0
1  North  665.0
2  South    0.0
3   West    0.0
df.loc[df[1]!=0]
Out[12]:
       0      1
0   East  455.0
1  North  665.0

Answer to the comment:
df.rename(columns={0:'region', 1:'sum'}).assign(**{'sum':lambda p:[q if q !=0 else pd.NA for q in p['sum']] }).dropna() (I am not sure if I understood it. Do you mean that?)

A: Using df.loc is the easiest method it comes to mind
filtered_df = df3.loc[df3["sum"] != 0]


text:
Q: Pandas Left Outer Join with Multiple columns without same name and Rename Could you please help me with this scenario.
I have 2 dataframes DF1 and DF2

I want to do a left outer join DF1 on DF2 and rename the column and final dataframe/result will look like this below
LEFT OUTER JOIN DF1 ON DF2
ON - DF1-VNAME = DF2-VNAME AND    DF1-OIL_DOI = DF2-DOI_NO ,  DF1-GAS_DOI = DF2-DOI_NO ,  DF1-NGL_DOI = DF2-DOI_NO  and rename the columns ALL_LEASES_OIL,ALL_LEASES_GAS,ALL_LEASES_NGL
Final Table should look like below


text:
Q: Xamarin.Forms Listview's ItemDisappearing event is not triggered when the item is removed from the list I am new with Xamarin.Forms, I have a listview with an item source.
The ItemSource of the ListView is an ObserverableCollection
Unfortuntaley, when I remove an item from the ItemSource, the ItemDisapperaing event is not trigged. Yes, the list item is removed from the UI in the Android device.
However I implemented the ItemAppearing and that works fine! It triggered.
Adding item working scenario:

*

*The ShopCart.Instance.AddItem(randomItem) called.

*ShopItemListView.ItemsSource is refreshed with the newly added item.

*TotalAmount's Text is updated with the right amount.
So the ShopItem_NewItemAdded function is called!
Clearing items from Shopcart scenario (not working)

*

*ShopCart.Instance.Clear() called.

*ShopItemListView.ItemShource will be empty! The items not on the UI!

*But the TotalAmount's text does not changed to 0.0! It still has the previous value.

It seems on the UI element the TotalAmount is not refreshed! In Debug I see after the Clear the ShopItemListView.ItemsSource list is empty.
So the ShopItem_ItemRemoved function is not called!
Here the Xaml.cs
public ShopView()
    {
        InitializeComponent();
        BindingContext = new ShopViewModel();

        ShopItemListView.ItemsSource = Shop.Instance.ShopItems;
        // This is triggered, it works
        ShopItemListView.ItemAppearing += ShopItem_NewItemAdded;
        // This event is not triggered, it does not work
        ShopItemListView.ItemDisappearing += ShopItem_ItemRemoved;
    }

    // This event is not triggered, it does not work
    private void ShopItem_ItemRemoved(object sender, ItemVisibilityEventArgs e)
    {
       // If I put a breakpoint here the debugger never comes into this method
        TotalAmount.Text = Shop.Instance.ShopItems.Sum(si => si.Price).ToString();
        if (Shop.Instance.ShopItems.Count == 0) {
            ShopInformation.IsVisible = false;
        }
    }

     // This is triggered, it works.
    private void ShopItem_NewItemAdded(object sender, ItemVisibilityEventArgs e)
    {
        TotalAmount.Text = Shop.Instance.ShopItems.Sum(si => si.Price).ToString();
        ShopInformation.IsVisible = true;
    }

Here is the shopcart singleton instance
public sealed class ShopCart : INotifyPropertyChanged
    {
        private static readonly ShopCart _instance = new ShopCart();

        private ShopCart()
        {
            ShopItems = new ObservableCollection<ShopCartItem>();
        }

        public static ShopCart Instance
        {
            get
            {
                return _instance;
            }
        }

        public ObservableCollection<ShopCartItem> ShopItems { get; set; }

        public void AddItem(ShopCartItem ShopCartItem)
        {
            ShopItems.Add(ShopCartItem);
            OnPropertyChanged("ShopItems");
        }

        public void Clear()
        {
            ShopItems.Clear();
            OnPropertyChanged("ShopItems");
        }

        #region INotifyPropertyChanged Implementation
        public event PropertyChangedEventHandler PropertyChanged;

        void OnPropertyChanged([CallerMemberName] string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        #endregion
    }

The ShopCart implement the INotifyPropertyChanged interface. But it seems the UI element is not notified.
How can I refresh the TotalAmount Label on the UI after I removed every shop items from the shop cart?

A: Maybe you mistake the usage of the ItemDisappearing. This method is for virtualization usage only. It is not guaranteed to fire for all visible items when the List is removed from the screen.
It means if you have a list of 100 items, but you can only see 10 at a time because of the size of the cells once you scroll down and a new cell comes into view, and the top cell scrolls off the screen the ItemDisappearing event will fire.
If you just want to show the listView's ItemsSource(in your case ShopItems's Count) count on the screen. You can use Binding and Converter:
Create a converter firstly:
public class ArrayToCountConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        ObservableCollection<ShopCartItem> collection = value as ObservableCollection<ShopCartItem>;

        return "There are" + collection.Count + "items";
    }

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

Then use it like:
<ContentPage.Resources>
    <ResourceDictionary>
        <local:ArrayToCountConverter x:Key="ArrayToCountConverter"/>
    </ResourceDictionary>
</ContentPage.Resources>

<Label Text="{Binding ShopItems, Converter={StaticResource ArrayToCountConverter}}"/>

Also you need to set the BindingContext:
public ShopCart shopCart = ShopCart.Instance;
public MainPage()
{
    InitializeComponent();

    this.BindingContext = shopCart;

    MyListView.ItemsSource = shopCart.ShopItems;
}

In this way when you add or clear the ShopItems in the ViewModel, the label will show the count.


text:
Q: Is it a poor practice or is it incorrect to create a new paragraph that directly continues from the previous paragraph? I am currently writing a test strategy for my sixth form Computing project. In order to meet the grading criteria I also have to justify my test strategy. I have the following text:

Although isolated, and although in this given scenario it is unlikely,
  the invocation of the other subroutines could cause the code that
  retrieves the system information to behave differently. There's no
  doubt that the system should be tested for this kind of behaviour
  using point-and-click testing, in addition to the unit-testing,  but
  the point here is that using a unit-test it would be clear that the
  problem lies with something external and not with the isolated code
  used for the unit-test if the test succeeds.
Also, the client software collects all of the system information
  required before sending the collected data back to the server. This
  can take anywhere up to 10 seconds which would give somewhat
  inaccurate results which might be bothersome if it was important that
  the data was very accurate.

I feel uncomfortable creating a new paragraph here because it is a direct continuation of the previous paragraph. I feel like I should create a new paragraph here because the paragraph is getting quite long.

A: Yes - create a new paragraph because of length, especially with such complex language. It's easier on the eye, and readers are only human. It might also be easier for them to refer to the second paragraph instead somewhere on this page....
You could use the more formal In addition instead of Also, which would help introduce the new paragraph on its own terms instead of as something which has broken away from the first paragraph.

A: There is nothing grammatically wrong with this. If the second paragraph focuses on a separate idea, or looks at the same idea in a different way, or that you want otherwise separated from the previous paragraph for any reason whatsoever, then it should be a separate paragraph.
Really, you can't go wrong with dividing paragraphs. If it feels too long, cut it in two. As long as you're not getting a sentence per paragraph, you should be fine.

A: The paragraph is kind of a mess and flows poorly. Furthermore, the voice is passive which further detracts from its readability. If you read it aloud and add a one second pause after each comma then you will see what I mean.
Although isolated, and although in this given scenario it is unlikely, **invoking** other subroutines could cause the code that retrieves the system information to behave differently. There's no doubt that the system should be tested for this kind of behaviour using point-and-click testing ((, remove this comma)) in addition to the unit-testing ((, change this to a period to seal the paragraph)) but the point here is that using a unit-test it would be clear that the problem lies with something external and not with the isolated code used for the unit-test if the test succeeds.

Also, the client software collects all of the system information required before sending the collected data back to the server. This can take anywhere up to 10 seconds which would give somewhat inaccurate results which might be bothersome if it was important that the data was very accurate.

Furthermore and 'in addition' are also acceptable transitions for the second paragraph.


text:
Q: "Address already in use" when trying to start a tcpListener after stoping it I'm starting this tcpListener to any ip on port 3000, so after i close my popup that runs this method i call tcpListener.Stop().
After when i rty to reuse again i got this exeption "Adress already in use" so im thinking how can i clean that adress or something like that so i can start listening to it again?
tcpListener = new TcpListener (IPAddress.Any, 3000);

Here's the code.
I already tried to clean that door anyway i could think, but didn't worked, no method from that tcplistener cleans that.
Any ideia?

A: I am not sure about your problem, but did you close the listener before you start to listen again?
I think the exception got raised because you want to listen on a reserverd port.
Try to close the listener before you start to listen again on the port 3000.
tcpListener.Close();

Greeds,
Lacky

A: A good habbit to get into is the using keyword which will close the connection automatically when done. For Example:
using (TcpClient tcpClient = new TcpClient())
{
     //operations
     tcpClient.Close();
}

If you need to forcibly free up the socket you can set the SO_REUSEADDR socket option. You need to do this before binding to the listening port.
SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);


text:
Q: Android Studio compileSdkVersion 25 не работает на Android 4 После обновления библиотек Android Studio столкнулся с тем, что программы не запускаются на Android-4.04, на Android-6 идёт нормально.
Создаю самый простой проект (Empty Activity).
В автоматически формируемом build.gradle:
compileSdkVersion 25
...
compile 'com.android.support:appcompat-v7:25.3.1

На устройстве сразу вылет.
Studio пишет: Could not find method android.support.v4.app... и кучу других ошибок Could not find method...
Меняю:
compileSdkVersion 23
...
compile 'com.android.support:appcompat-v7:23.1.1

Запускается нормально. Получается, версия 25 не поддерживает Андроид-4 или я чего-то не понимаю?

A: Проблема оказалась в том, что я обновлял библиотеки (SDK), но не обновлял саму Android Studio (стояла версия 1.4).
После обновления до последней Android Studio 3.0.1 новые библиотеки заработали нормально

A: Попробуйте добавить следующую строчку
compile 'com.android.support:support-v4:26.1.0'

Перезагрузите Android Studio