text:
Q: Understanding Git: Bundle vs Clone I cloned my remote using  --mirror:
git clone --mirror git-user@git-url.example.com:my-repo-name.git

Then I worked on the repo to remove some large files in the repo and some unwanted branches.  The overall repo size reduced about 10%.
I made a bundle of this reduced-size repo intending to push it.  Then I test-restored this bundle to see what it looked like.
git clone my-repo-name.bdl my-repo-name

The restored bundle is about 75% smaller but it contains all the branches, tags etc. and seems to have a complete history as I want.  Should I trust this method of "archiving" as I've been told?  The massively reduced file size makes me worry this is not correct.  What did the restored bundle potentially leave out?

A: The main purpose of a bundle is to communicate changes to a repo to which you can't push (or which can't fetch from you), e.g. because of lack of network access.  But, they can be useful for a number of other things.
When you cleaned up your original repo, what steps did you take to ensure that the removed items were really purged from the repo?  Since you got some reduction in size, I assume you ran git gc; but did you make sure to clear away any reflogs first, as well as all refs that might still point into the unwanted history?  The old repo may still have a bunch of the history for stuff you removed, and that might account for the discrepancy.
That is, since your bundle won't have the reflogs and wouldn't include "weird" refs - like maybe the backup refs created by filter-branch - it is more likely to be a true minimal history of the refs you put in it; plus it's possible that some space was saved by repacking.  (Similar clean-up can often be had by cloning the cleaned-up repo.)
If a ref is written to the bundle, and if you can apply the bundle to an empty repo, then you can rest assured that the full history of that rep (including the directory structure and file content at each commit point) is present.  It would be very surprising if that didn't account for the bulk of the required size of the repo.
If the history were somehow corrupt and missing data, git should've complained about it; but if you're worried, maybe git fsck on a repo to which you've applied the bundle would provide some additional assurance.
What could be missing?  Well, refs that you didn't bundle.  So: Tags that aren't reachable from any branch.  Notes refs maybe (if you use them).  Replacement refs maybe (if you use them).  Remote refs, I guess, though if you're doing a rewrite you probably don't want them.  Or, if you just gave too narrow a list of branches in creating the bundle.  I can't say that list is exhaustive; in general, like I said, "other refs".  You could run git for-each-ref in the old and new repos and compare the results to see what's not in the new one, if anything.
You could also have bundled a "shallow" history, but you'd have had to specify that you wanted it, and it wouldn't apply easily to an empty repo.  So if that's not what you're trying to do, it probably isn't what happened.


text:
Q: WordPress Borlabs Cookies: Modifiy "previewHTML" using filters I am using the Borlabs Cookie plugin for WordPress and i am trying to add filters to modify the preview html for content blocking as described here: https://borlabs.io/kb/action-filter-hooks/#ch_9. However, the return value does not seem to be used at all and just gets replaced with the default html.
This is my current code in my functions.php:
add_filter('borlabsCookie/contentBlocker/modify/content/vimeo', function ($content) {
    $contentBlockerData = BorlabsCookieHelper()->getContentBlockerData('vimeo');

    // example editing of previewHTML
    $contentBlockerData['previewHTML'] = '';

    // debug
    echo 'DEBUG';

    return $contentBlockerData['previewHTML'];
});

"Debug" gets printed so at this point the preview html should be empty, but in the frontend it still produces the default content blocker preview html:

...

Does anyone else have this problem? I know that this can easily be done in the admin area of the plugin but I would still like to be able to use filter hooks for this issue.

A: Found the solution! Was very easy actually.
For anyone interested: The plugin has a standard filter with a priority of 100. So in order to apply a custom filter after the default filter, a priority greater than 100 is needed:
add_filter('borlabsCookie/contentBlocker/modify/content/vimeo', function ($content) {
    ...
}, 1000, 1);

redpajama_set_name: RedPajamaStackExchange


text:
Q: Change rule associated with a node at runtime in ANTLR4 I have a rule called "variable" which is just associated with non-keyword text. During runtime I compile a list of strings that should be associated with the rule "special" which is also just normal text however it is defined below variable, hence is never actually reached as everything will match to variable first.
During runtime how can I use this list to change any tokens matching "variable" that are also in the list to match "special"?
Example:
Grammar
parent:
  variable |
  special;

variable:
  ID;

special:
  ID;

Text to be parsed: "one two three four"
Result: variable, variable, variable, variable
Later I calculate that I want "four" to be associated with special. So the result should change to: variable, variable, variable, special
This should happen without the text actually changing. I tried looking into listeners and visitors but I'm not sure how I would actually modify the rule associated with a node. I also found this example that seems similar but it's in ANTLR3: Dynamically create lexer rule

A: The perhaps most direct way of qualifying a token at run-time is to use a predicate to selectively falsify a rule.  This can be done in either in the parser or lexer.  Using your proto-grammar, and rearranging a bit:
@members {
    ArrayList<String> keyList = .... // get dynamic list of keywords

    public boolean inList(String id) {
        return keyList.contains(id) ;
    }
}

parent   : special   // dynamic keywords
         | variable  // everything else
         ;
special  : ID { inList($ID.getText()) }? ;
variable : ID ;

The predicate falsifies the special rule for any ID token not in the list of dynamic keywords.


text:
Q: Explicación negación lógica en un array tengo una duda de concepto, estoy intentando realizar una aplicación y me encuentro con un if que no me queda del todo claro como funciona, alguien me lo podría explicar?
     static $grande = array();
     for ($i=0; $i < 10; $i++) {
        $grande[$i] = false;
    }

Hasta aquí es un array con 10 valores = false
Ahora lo recorro:
        for ( $i = 0; $i < 10 ; $i++ ) {

             if(!$grande[$i]){    //QUE HACE ESTA INSTRUCCION?
             break;
             }
        }

A: En PHP, ! pertenece al grupo de los Operadores lógicos y significa Not, como explica el Manual de PHP. Y, por su definición, devuelve true si el valor evaluado no es true.
Concretamente en tu código:
         if(!$grande[$i]){    //QUE HACE ESTA INSTRUCCION?

Lo que se pregunta es si el valor de $grande[$i] no es verdadero, o, lo que es lo mismo, si es falso.
Sería similar a esto:
         if($grande[$i]===false){    //QUE HACE ESTA INSTRUCCION?

Ese operador se puede usar también con funciones que devuelvan valores booleanos, por ejemplo:
#Si $grande No(t) está vacío
var_dump(!empty($grande));   #bool(true)

Que sería lo contrario de:
#Si $grande está vacío
var_dump(empty($grande));    #bool(false)

Se puede usar también con comparaciones (que como tales devuelven valores booleanos). Por ejemplo:
#¿1 No(t) es mayor que 2?
$a=!(1 > 2);
var_dump($a);    #bool(true)

Y sin negación:
#¿1 es mayor que 2?
$a=(1 > 2);
var_dump($a);    #bool(false)


text:
Q: alignment and 'right-pull' Somehow the button on the right is not centered (vertically) anymore when pull-right is used.
How can it be placed in the middle?

https://jsfiddle.net/1mawa84n/2/

A: Remove the line-height give padding to li
Try this:
CSS:
 li {
    background: rgba(254, 255, 251, 0.91) none repeat scroll 0 0;
    border: 1px solid black;
    border-radius: 3px;
    display: block;
    /* line-height: 3;*/
    margin: 0 0 -1px;
    padding: 10px;
    max-width: 100%;
    vertical-align: middle;
}


text:
Q: Databricks Unity Catalog multiple metastore for same region We have 3 databricks workspaces , one for dev, one for test and one for Production. All these workspaces are in the same region WestEurope.
All of our data is in the datalake, meaning external tables in databricks references the data in the data lake (Azure data lake gen 2).
Each of these workspaces thus have a different datalake associated with it (as they are for different environments).
Now, this does not cater for the usual Unity Catalog use case, where you have multiple workspaces referring to the same metastore, as e.g. we would have different access requirements for each environment, along with data. In some cases, certain tables may exist in lower environments and not in Prod.
Also, looking here, I see the following sentence
You can create one metastore per region and attach it to any number of workspaces in that region.

All our Databricks workspaces (for different environments) are in the same region , but different subscription.
Is it then that Unity Catalog, does not apply for this use case? Because that would mean, we create 3 different metastore for the same region.
If not, then how can we get goodies like

*

*Terraform capabilities which are only for unity catalog, e.g. create schema.

*Data Lineage

A: This is how Unity Catalog works (at least right now) - each region may have only one Unity Catalog Metastore and all workspaces in that region could be attached to it.
Right now the problem with environment separation could be solved with the user groups. And you can set Azure Storage Firewall to limit access from the workspaces specific to a given environment.
And later this year there will be a feature that will allow to attach specific catalogs only to specific workspaces, so you can clearly separate environments.  It was mentioned in the last quarter product roadmap and you can attend upcoming product roadmap webinar to get more updates about Unity Catalog.


text:
Q: CRAN policy on use of global variables In the CRAN repository policy documentation, it is explicitly stated: "Packages should not modify the global environment (user's workspace)."
When I run
R CMD check

via
devtools::check(),

it merely states "no visible binding for global variable x." as a NOTE rather than a WARNING.
CRAN will not accept user-contributed packages containing ERRORS and/or WARNINGS. My package has none of these. NOTES, on the other hand, are admissible.
This said, I have a few
assign(..., envir = .GlobalEnv)

instances in a function within my R package which I intend to submit to CRAN.
Given that globals are frowned upon, the following questions arise:
(1) Why doesn't R CMD check issue WARNINGS regarding global variables?
(2) Will the CRAN maintainers complain to me regarding the use of globals in my package?


text:
Q: How to solve Unexpected token p in JSON at position 3 using angular2 or typescript
When i go to save the survey content after editing, i get this error,
SyntaxError: Unexpected token p in JSON at position 3
at JSON.parse (<anonymous>)

Please anyone help me to solve this issue, I am hereby pasting my codes, please help.
ts code:
   Surveypost = () => {
    let token = this.auth.getAccessTokenId();
    console.log(token)
    let currentUser = this.auth.getCurrentUserData();
    console.log(this.editor.text)
    console.log(this.survey_val)
    // let survey_json = JSON.parse(this.editor.text);
    let survey_json:any;
   try{
   survey_json = JSON.parse(this.editor.text);
} catch(e) {
    /*Handle the error scenario here*/
}
    let survey_data = {
      "value": survey_json,
    };
    console.log(survey_data)
    this.AdminAPI
      .createandSet(survey_data, token)
      .subscribe(
        survey => {
           console.log(survey)
        }, error => {
          console.log(error);
        }

      );
  }

I am getting the consoled output till, console.log(this.editor.text), then error comes.
The consoled output of  console.log(this.editor.text) starts like this,
{
 pages: [
  {
   name: "page1",
   elements: [
    {
     type: "radiogroup",
     name: "price",
     title: "How long have you been a customer at {companyname}?",
     isRequired: true,
     choices: [
      {
       value: "less",
       text: "0 - 3 months."
      },
      {
       value: "medium",
       text: "3 - 12 months."
      },
      {
       value: "High",
       text: "12 + months."
      }
     ]

A: this.editor.text contains an invalid JSON.
When trying to parse that invalid JSON the error occurs. So in short terms, the following line is the one that crash: let survey_json = JSON.parse(this.editor.text);
Grab the output from the console.log(this.editor.text), run it trough a JSON validator/formatter like:
https://jsonformatter.curiousconcept.com/
And then you should be able to easily see why the error occurs, and why the program is not able to parse the JSON
EDIT FROM WHEN JSON HAS BEEN ADDED
AS you can see from the link mentioned above, the JSON is not valid, and that is the reason for the error message on the line: let survey_json = JSON.parse(this.editor.text);.
For instance a basic JSON should have the following structure:
{
 "key" : "value",
 "key2" : "value2"
}

You are also not ending the JSON correctly. I've formatted the JSON to a valid JSON here:
{
"pages":[
  {
     "name":"page1",
     "elements":[
        {
           "type":"radiogroup",
           "name":"price",
           "title":"How long have you been a customer at {companyname}?",
           "isRequired":true,
           "choices":[
              {
                 "value":"less",
                 "text":"0 - 3 months."
              },
              {
                 "value":"medium",
                 "text":"3 - 12 months."
              },
              {
                 "value":"High",
                 "text":"12 + months."
              }
           ]
        }
     ]
  }
 ]
}

A: When you are trying to parse some text sent from a 3rd party source, it is a good idea to wrap the parse logic with a try catch block.
But do remember that this should be done only after fixing the trivial bugs in the remote source(that is, if you have access, of course).
replace,
let survey_json = JSON.parse(this.editor.text);

with,
let survey_json;
try{
   survey_json = JSON.parse(this.editor.text);
} catch(e) {
    /*Handle the error scenario here*/
    /*Lets assign an empty object(or possibly a default value) instead*/
   survey_json = {};
}


text:
Q: Extract value from string in file powershell I am trying to search through the newest log file in directory for a particular string. The string reads Number of days since last service= and after the equals sign is a number. I want to extract that number for use later in my powershell program. This is what i have so far
$logDir= "C:logs\"
$latest = Get-ChildItem -Path $logdir | Sort-Object LastAccessTime -Descending | Select-Object -First 1
$findStr = Select-String -Path $latest.name -Pattern "Number of days since last service="

but now i am stuck. This is what it actually looks like in the log
<Msg>Number of days since last service =18</Msg>

so what i don't know how to do is extract the number between the equals sign and the < for this particular string

A: You can use Select-String with regex capture groups.
 $Matches = Select-String -Path $latest.name -Pattern "last service =(\d+)" | % {$_.Matches.Groups[1].Value}

A: You've probably got your answer by now, but "Imma giv eya more!"
Assuming we have these defined ahead of time:
$Log = "<Stuff><Msg>Number of days since last service =18</Msg></Stuff>"
$StringHint = "Number of days since last service ="

1. Your typical Select-String method of doing things with Regexes. yep.
Select-String -InputObject $Log -Pattern "(?<=$StringHint)\d{1,}(?=<)" -AllMatches | % {$_.Matches.Groups[0].Value}

2. Doing the splits:
((($Log -split $StringHint)[1]) -split "<")[0]

3. The XML way.  This only works for XML log files and if there is no other MSG tag (which is unlikely in this case).
I chose to include this because I think it's cool how a simple type cast can dramatically alter how we can work with the data. Plus, it's a really easy way of stripping the nasty <'s and >'s away.
$xml = [xml]$Log
$EqualsLoc = $xml.Stuff.Msg.IndexOf("=")
$xml.Stuff.Msg.Substring($EqualsLoc+1)

The above would have been even better if you had a log file like this (yes, I know this is a configuration file and not a log file):
$XML = [xml]"<Application>
    <version>1.3.53</version>
    <AdvancedSettings>
        <Network>
            <InternetForWeebs>False</InternetForWeebs>
            <HackAllTheSystems>True</HackAllTheSystems>
            <L33tHandle>Gingervitis</L33tHandle>
        </Network>
    </AdvancedSettings>
    <BasicSettings>
        <Controls>
            <TheAnyKeyDesignation>0x42</TheAnyKeyDesignation>
            <CanHazCheeseburgerMode>True</CanHazCheeseburgerMode>
        </Controls>
    </BasicSettings>
    <Diagnostics>
        <DaysSinceLastService>18</DaysSinceLastService>
    </Diagnostics>
</Application>"

Then, getting the entry you needed would be something as easy as this:
$XML.Application.Diagnostics.DaysSinceLastService

A: Since you know the string before and after the data you want, you could just the -Replace operator to remove the unwanted text:
$Days = $findStr -replace '<Msg>Number\ of\ days\ since\ last\ service\ =','' -replace '</Msg>',''

Alternatively, since the information is the only number in the string, you could use -Match with \d+ (one or more numbers) to get the value.
$findStr -match '\d+'
$Days = $Matches.Values

A: I was able to do it like this
$result =[regex]::Match($findStr, '=([^/)]+)<').Groups[1].Value


text:
Q: Как установить отступ только для  внутри , и убрать у ссылок подчеркивание?

body{
    margin: 0px;
    text-decoration: none;
}
ul.nav li{
    margin-top: 20px;
    padding-left: -5px;
    padding-top: -5px;
    text-decoration: none;
}
ul.nav {
    position: absolute;
    overflow: auto;
    margin: 0px;
    margin-top: 80px;
    padding: 0;
}
header {
    background-color: black;
    height: 90px;
    padding: 0px;
    color: white;
    background-color: #3d3d3d;
}
header ul.name {
    background-color: #3d3d3d;
    padding: 0px;
    margin-left: 10px;
}
header h1 {
    margin-top: 20px;
}
hr {
    margin: 0px;
    position: absolute;
    margin-left: 150px;
}

AutoService

Каталог

Корзина

Контакты

О нас

A: a {
    text-decoration: none;
}
.nav {
    line-height: (размер отступа);
}


text:
Q: How to upgrade to Swift 4 with Xcode 10? Currently i am using Swift 3.x and I made code compatible to Xcode 10 with swift 3.x
So how to convert to Swift 4.0 with Xcode 10 as there is only option Convert to Current Syntax
I am trying following two way:
1. Edit -> Convert -> To Current Swift Syntax...
2. Conversion to Swift 4.2 is available

A: I am assuming that, you only want to upgrade to particular version from your current version. Please check this link below. You can do what you are expecting.And it wont convert totally to upgrade version through converter. If your have more files, it bit you to check which is deprecated and which is available on your upgrade version.If you want to change only some particular syntax, please post here.So that other can help you out.

https://medium.com/@hanif.awan2007/tips-upgrading-your-code-from-swift-3-to-swift-4-dbcba128b48b


text:
Q: How to make externalized properties file available to spring boot integration tests? I am developing an application using Spring Boot. I have an externalized properties file on file system. Its location is stored in an environment variable as below--

export props=file://Path-to-file-on-filesystem/file.properties

Properties from this file are loaded on classpath and are made available to application like below--
List<String> argList = new ArrayList<>();
String properties = System.getenv().get("props");

try (InputStream is = BinaryFileReaderImpl.getInstance().getResourceAsStream(properties)) {
    if (is != null) {
        Properties props = new Properties();
        props.load(is);
        for(String prop : props.stringPropertyNames()) {
            argList.add("--" + prop + "=" + props.getProperty(prop));
        }
    }
} catch(Exception e) {
    //exception handling
}

This argList is passed to SpringBootApplication when it starts like below--
SpringApplication.run(MainApplication.class, argList);

I can access all the properties using ${prop.name}
However, I do not have access to these properties when I run JUnit Integration Tests. All my DB properties are in this externalized properties file. I do not want to keep this file anywhere in the application eg. src/main/resources
Is there any way I can load these properties in spring's test context?

A: I could finally read the externalized Properties file using @PropertySource on linux machine. Could not get it working on Windows instance though.
Changes done are as below-
export props=/path-to-file

Note that file:// and actual file name has been removed from environment variable.
@Configuration
@PropertySource({"file:${props}/file-test.properties", "classpath:some_other_file.properties"})
public class TestConfiguration {

}

Keep this configuration class in individual projects' src/test/java folder. Thank you Joe Chiavaroli for your comment above.


text:
Q: Emacs `apropos' programmatically? Is there a function I can run to return all functions, variables etc, like the apropos command, but without the side-effects of opening a buffer for user-interaction? I just want a list or similar returned, not a buffer opened and presented to the user.
Or perhaps it's trivial to implement manually? If so, pointers in the right direction would be excellent :)

A: Here's the way I found about apropos-internal.

*

*C-h fapropos

*In the *Help* buffer, moved the point to the apropos.el and RET.

*The later opened apropos.el at the function definition, which, all it does, basically, it calls the apropos-internal. M-. (requires elisp-slime-nav), or you could repeat the C-h f procedure. Will take you to the C Emacs sources, where apropos-internal is defined.

A: Programmatically, you normally do it via mapatoms which let you iterate over all the symbols, after which you can check fboundp and other properties to select the symbols you want.


text:
Q: Symfony 2 Doctrine memory usage I'm creating a query with an entity repository and it seems to have memory leaks.
In my Entity repository class:
echo 'mem 1 : ' . (memory_get_usage()/1024/1024) . "
\n";
$query = $this->createQueryBuilder('a')->select('a','b','c','...');
echo 'mem 2 : ' . (memory_get_usage()/1024/1024) . "
\n";
$r = $query->getQuery()->getResult();
echo 'mem 3 : ' . (memory_get_usage()/1024/1024) . "
\n";
$this->clear(true);
$query->getQuery()->free(true);
unset($r);
echo 'mem 4 : ' . (memory_get_usage()/1024/1024) . "
\n";

Output:

mem 1 : 5.0805282592773
  mem 2 : 5.0998611450195
  mem 3 : 91.49528503418
  mem 4 : 77.939567565918

Why is the memory not back to the initial size (5 MB) after freeing the memory?
And only pass from 91 to 77.

A: Doctrine caches certain aspects of Entities it has loaded. Use
$em->clear();

to detach all objects from the current entity manager.


text:
Q: Ruby on Rails login & logout issue I'm newbie on ruby on rails application, from last few days I'm suffering about Login & Logout issue, now I have reached a solution, but now created a new issue. When I give invalid password then it showing Invalid email/password combination
when I give valid password then it showing Logged In.
But not working on after login logic.
This is my sessions_controller:
def new
end

def create
  user = Jobseeker.find_by(email: params[:session][:email].downcase)
  if user && user.authenticate(params[:session][:password])
    redirect_to home_path
    flash[:notice] = 'Logged In'
  else
    # Create an error message.
    flash[:notice] = 'Invalid email/password combination'
    render 'new'
  end
end

def destroy
  log_out
  redirect_to home_path
end

This is my model:
before_save { email.downcase! }

validates :first_name, :presence => true, :length => { :in => 3..20 }
validates :last_name, :presence => true, :length => { :in => 3..20 }
validates :email, :presence => true, :uniqueness => true, format: { with: /\A[^@\s]+@([^@.\s]+\.)+[^@.\s]+\z/ }

has_secure_password
validates :password, presence: true, length: { minimum: 6 }

This is my View:
<%= form_for(:session, url: login_path) do |f| %>
  <%= f.email_field :email %>
  <%= f.password_field :password%>

  <%= f.submit "Log in" %>
<% end %>

This is my sessions_helper:
# Logs in the given user.
 def log_in(user)
   session[:user_id] = user.id
 end

# Returns the current logged-in user (if any).
 def current_user
   @current_user ||= Jobseeker.find_by(jobseeker_id: session[:user_id])
 end

 # Returns true if the user is logged in, false otherwise.
def logged_in?
  !current_user.nil?
end

# Logs out the current user.
def log_out
  session.delete(:user_id)
  @current_user = nil
end

This is my application_controller:
protect_from_forgery with: :exception
include SessionsHelper

This is my layout:
<% if logged_in? %>
  <%= link_to "Profile", current_user.first_name %>
  <%= link_to "Log out", logout_path, method: :delete %>
<% else %>

<%= link_to "Login", login_path %>

<% end %>

How can I fix this issue?
I'm using ruby 1.9.7 Rails 4.2.5 & mysql2
That would help me a lot, please.

A: In your create method, you are not setting the session variable which will mark the "Logged In" state of the user when he moves across the pages.
your "current_user" in session_helper.rb uses session[:user_id], which should be user_id of the current user, set by you after login.
so, you should set session[:user_id] = user.id on your create method at session_controller.rb.
your modified session_controller#create should look like,
def create
  user = Jobseeker.find_by(email: params[:session][:email].downcase)
  if user && user.authenticate(params[:session][:password])
    login(user)
    flash[:notice] = 'Logged In'
    redirect_to home_path
  else
    # Create an error message.
    flash[:notice] = 'Invalid email/password combination'
    render 'new'
  end
end

Hope this will fix your issue.
Edit:
Modifying session key names to match your context.


text:
Q: How to avoid null values in jasper reports I have a field in my jasper report which has a expression value like
$F{address_street1}+" "+$F{address_street2}+ " " +$F{address_state} + " "+$F{address_country}+ " "+$F{address_zip}

My problem is that if any of the fields in here is null I get the null value between other things like
101 Main St****null****ILUnited States12345

Notice the highlighted null. Is there any way I can avoid that?
I have tried checking the null value for a particular field in it using boolean expression and replacing it with blank, but that doesn't seem to work.

A: To solve this problem  first, check field properties Blank when null checkbox in IReport or if it is Jasper jrxml file: <textField isBlankWhenNull="true"> .
Then I found two ways to solve this. Choose one way describes in  below.
1. Use expression syntax like this
$F{variableName}.equals( "0" )? "" : $F{variableName}
and you can use code like
$F{address_street1}.equals("0")? "" : $F{address_street1} + " " +
$F{address_street2}.equals("0")? "" : $F{address_street2} + " " +
$F{address_state}.equals("0")? "" : $F{address_state} + " " +
$F{address_country}.equals("0")? "" : $F{address_country} + " " +
$F{address_zip}.equals("0")? "" : $F{address_zip}

2. Use expression syntax like
$F{variableName}== null ? "" : $F{variableName}
and you can use code like
$F{address_street1} == null ? "" : $F{address_street1} + " " +
$F{address_street2} == null ? "" : $F{address_street2} + " " +
$F{address_state} == null ? "" : $F{address_state} + " " +
$F{address_country} == null ? "" : $F{address_country} + " " +
$F{address_zip} == null ? "" : $F{address_zip}

A: Set the property isBlankWhenNull to true.

*

*In iReport check the Blank When Null checkbox when your field is selected.

*In jasper jrxml file: <textField isBlankWhenNull="true">

A: In The Expression You are allowed to use the Java code.
So what You need to do is to check that the value of field is null if is then replace it with empty string.
$F{address_street1} == null ? "" : $F{address_street1}+ " " +
$F{address_street2} == null ? "" : $F{address_street2}+ " " +
$F{address_state} == null ? "" : $F{address_state}  + " " +
$F{address_country} == null ? "" : $F{address_country}+ " " +
$F{address_zip} == null ? "" : $F{address_zip}

A: ($F{address_street1}.equals(null) ? "" : $F{address_street1}+ " ") +
($F{address_street2}.equals(null)l ? "" : $F{address_street2}+ " ") +
($F{address_state}.equals(null) ? "" : $F{address_state}  + " ") +
($F{address_country}.equals(null) ? "" : $F{address_country}+ " ") +
($F{address_zip} .equals(null) ? "" : $F{address_zip})

A: Try following:
$F{address_street1}.toString() == null ? "" : $F{address_street1}+ " " +
$F{address_street2}.toString() == null ? "" : $F{address_street2}+ " " +
$F{address_state}.toString() == null ? "" : $F{address_state}  + " " +
$F{address_country}.toString() == null ? "" : $F{address_country}+ " " +
$F{address_zip}.toString() == null ? "" : $F{address_zip}

Or
Set reports property:
   When resource missing type : Type Empty
both works in my case.

A: @Vash, Yes that is what I would do except I think you might want to put each expression inside of parentheses so that each expression is independent of the others. Like this:
($F{address_street1} == null ? "" : $F{address_street1}+ " ") +
($F{address_street2} == null ? "" : $F{address_street2}+ " ") +
($F{address_state} == null ? "" : $F{address_state}  + " ") +
($F{address_country} == null ? "" : $F{address_country}+ " ") +
($F{address_zip} == null ? "" : $F{address_zip})

A: if you can use jasperreports-functions and you want to output String value, you can do it with function T() which returns text String or empty String.

T($F{firstName})

A: I have the option (Blank when Null) checked for every field in the report and still seeing nulls on the fields. So, I used report expressions.
Since every report variable is a string, to check for null use:
$F{address_stree2}.equals("null")

A: If you are working in ecliple+jasper softReports you just fallow below steps
1.select field + rightclick and select showProperties option
2.click TextField select BlankWhenNull
3.Compile and Rebuild check it.

A: i have similar case that i want to avoid showing null in the output if i have null parameter

i use T($P{city}) in Expression editor, it evaluate to empty string if you did not pass parameter to it

T() return the text string if the value is a string, otherwise an empty
  string is returned

example usage:
$P{name} + " " + (T($P{city}).isEmpty() ? "" : " from " )+ (T($P{city}).isEmpty() ? "" : "\"" +  T($P{city}) + "\"")

if i pass parameter to $P{city}
the result is :

abdulkahliq from "Riyadh"

if i don't pass parameter to $P{city} the result is :

abdulkahliq

Thanks and Regards,

A: You can create a new Style
mark it as Default Style
go to: Advanced > Blank When Null > true
That's it!
All TextField's will 'inherit' this setting
(unless they 'touched' this property. right-click > Reset To Default)

A: You can write a java Code
 package com.xyz

 Class ReportUtil
  {
      public static String getMyString (String str1 , String str2)
         {
             if((str1!=null) && (str2!=null))
                 return str1 + " " + str2 ;
             else if str1==null
                  return str2 ;
             return str1 ;
          }

   }

In JRXML , you can use the following expression in the textbox
com.xyx.ReportUtil.getMyString ($F{firstName},$F{lastName})

Set "Is blank When null" property to true
Regards,
Ankush

A: if
your fields are Strings just tick the property on (BLANK WHEN NULL).
Otherwise use the ternary operator

if null print something else print the field.

field==null?whatever:field
field=null?false:true

These both ought to solve the issue.

A: You can set the textfield height as 1,
set the Stretch with overflow flag as true and Blank when null as true so when field value is blank it will not leave blank space between.

A: ($F{address_street1} + " " + $F{address_street2} + " " + $F{address_state} + " " +
    $F{address_country} + " " + $F{address_zip}).replaceAll("null", "")


text:
Q: basic search ranking with regex in javascript Currently I am using the below for search.
I assume each and every term the user types must appear at least once in the article.
I use the match method with regex
^(?=.*one)(?=.*two)(?=.*three).*$

with g, i, and m
At the moment I use matches.length to count the number of matches, but the behavior is not as expected.
example:
"one two three. one two three"
would give me 2 matches, but it should really be 6.
If I do something like
(one|two|three)

then I do get 6 matches, but if I have the data:
"one two. one two"

I get 4 matches, when in reality I want it to be 0, since not every word appears at least once.
I could do the first regex to check if there's at least one "match". If there is, I would subsequently use the second regex to count the real number of matches, but this would make my program run much slower than it already is. Doing this regex against 2500 json articles takes anywhere from 60 to 120 seconds as it is.
Any ideas on how to make this faster or better? Change the regex? Use search or indexOf instead of matches?

note:
I'm using lawnchair db for local persistance and jquery. I package the code for phonegap and  as a chrome packaged app.

A: var input = '...';
var match = [];
if (input.match(/^(?=.*\bone\b)(?=.*\btwo\b)(?=.*\bthree\b)/i)) {
  match = input.match(/\b(one|two|three)\b/ig);
}

Test this code here.


text:
Q: Visual studio 2010 Asynchronous Programming I ran the below code in VS2010, but i have faced the issue like
id = 1, status = waitingforactivation, method = "{null}", result = "{not yet computed}"

Then I searched and found, needs to enable the async and await in VS2010.
Then by using AsyncCtpLibrary dll reference, I have enabled it. But still vs2010 does not return the response.
I got the response in VS2012 but I need to implement that one in the project which is developed in VS2010.
static void Main(string[] args)
{
Task<string> task = GetCustomerDetails(); //PushCustomerDetails();
task.Wait();
var x = task.Result;
}

static async Task<string> GetCustomerDetails()
{
    var httpClientHandler = new HttpClientHandler()
    {
        Credentials=new NetworkCredential("demo","demo"),
    };

    var httpClient = new HttpClient(httpClientHandler);
    httpClient.DefaultRequestHeaders.Accept.Clear();
    httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
    var result1 = await httpClient.GetStringAsync("URL")
    return result1.ToString();
}

A: static void Main(string[] args)
{
  Task<string> task = GetCustomerDetails(); //PushCustomerDetails();
   var x = task.Result; //Result is already waiting
}

static Task<string> GetCustomerDetails()
{
   var httpClientHandler = new HttpClientHandler()
   {
      Credentials=new NetworkCredential("demo","demo"),
   };

   var httpClient = new HttpClient(httpClientHandler);
   httpClient.DefaultRequestHeaders.Accept.Clear();

   httpClient.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/json"));
   return httpClient.GetStringAsync("URL")
}


text:
Q: Comparing two images with pillow I have two images A and B

Both images are of same size(184,184) and I have converted them to mode 'RGB' from 'RGBA'
from PIL import Image, ImageChops
A = Image.open('A.png').convert('RGB')
B = Image.open('B.png').convert('RGB')

flip = A.transpose(Image.FLIP_LEFT_RIGHT)
diff = ImageChops.difference(flip,B)

# Expected
diff.getbbox() is None

# output
diff.getbbox() == (28,28,156,156)

How do I compare two shapes in pillow


text:
Q: MAX function not bringing me my desired results I Have 4 columns I am interested in creating a list. We collected weekly data from our third party vendor. We sort it by the DataCollection week. They do not always submit this data. So, there will be times where a Vender submitted one week but not the next. I need to have a running total of total enrollments by the collection week broken down by the name. I did the MAX function but that only gives me the latest date in the whole table, I want the max for each districts individual date. How do I accomplish this so that say, if the latest week is 2/21/2020 for Name A, and the latest week for Name b was 2/14/2020, I can have both dates and enrollment totals, because as it stands I get only the max date which is 2/21/2020 but the names of those other districts that submitted the data are not coming back.
The code below is what I have.
SELECT DATACOLLECTIONWEEK, NAME,DISTSCH,TOTALENROLLMENTS
FROM DB.SCHEMA.TEST
WHERE datacollectionweek = (SELECT MAX(datacollectionweek)
                            FROM DB.SCHEMA.TEST)

A: SELECT DATACOLLECTIONWEEK, NAME,DISTSCH,TOTALENROLLMENTS
FROM DB.SCHEMA.TEST as DB1
WHERE DB1.datacollectionweek = (SELECT MAX(datacollectionweek)
                                FROM DB.SCHEMA.TEST AS DB2
                                WHERE DB1.NAME = DB2.NAME)


text:
Q: WCF - Transport Security Mode: which user accesses the database? In WCF, Net.TCP, a client calling a service with Transport security and client credentials="Windows" (basically the following scenario: https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/transport-security-with-windows-authentication), if the service then accesses a database and the connection string is using Integrated Security, which user is accessing the database? Is it the user running the client or the user running the service, for ex. a service account?

A: OP:

if the service then accesses a database and the connection string is using Integrated Security, which user is accessing the database?

The DB connection will be in the context of the WCF service.  To open the DB on their behalf you may need to impersonate them.
That linked example is only describing the authentication used to call the service
See also

*

*WindowsImpersonationContext Class

*Impersonating and Reverting


text:
Q: Snap to div horizontal on slide or swipe I have a horizontal set of Divs each holding a score table from a game. The intent is to have the user on a phone slide / swipe the game table and when the user removes his finger, the program will snap to the next div. For example, if Game 1 appears, the user swipes quickly and lifts the finger when Game 1 and Game 2 are both showing, the program will advance to Game 2, not continuing sliding. The code is below and a demo here. Any and all help appreciated.

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />

Game 1

      Swing#
      start
      H-Dis
      S-Dis
      SG
      Flags

      1
      T
      400
      300
      0

      2
      F
      100
      90
      0

      3
      G
      10
      10
      SG
      HO

Game 2

      Swing#
      start
      H-Dis
      S-Dis
      SG
      Flags

      1
      T
      400
      300
      0

      2
      F
      100
      90
      0

      3
      G
      10
      10
      SG
      HO

Game 3

      Swing#
      start
      H-Dis
      S-Dis
      SG
      Flags

      1
      T
      400
      300
      0

      2
      F
      100
      90
      0

      3
      G
      10
      10
      SG
      HO

Game 4

      Swing#
      start
      H-Dis
      S-Dis
      SG
      Flags

      1
      T
      400
      300
      0

      2
      F
      100
      90
      0

      3
      G
      10
      10
      SG
      HO

Game 5

      Swing#
      start
      H-Dis
      S-Dis
      SG
      Flags

      1
      T
      400
      300
      0

      2
      F
      100
      90
      0

      3
      G
      10
      10
      SG
      HO


text:
Q: Unix Syslog not working properly I am using UNIX in cygwin (in Windows 7). I have a syslog.conf file consisting of this line initially:
*.*                                     /var/log/messages

All information is logged to this "messages" file. Now when I changed the path to a new file (logtest):
*.*                                     /var/log/logtest

I restarted the syslog-ng daemon, but the information is still getting logged to /var/log/messages
What could be the problem?


text:
Q: invalid user-defined conversion error I am creating simple program that stores kids that attends to certain classroom , each kid has an array that defines their friends.
I am experiencing

error: invalid user-defined conversion from 'Kids*' to 'Kids&&' [-fpermissive]|

error.
i am using this  code
struct Kids{
    int *friends;
    Kids(){};
    Kids( int n ){
        friends = new int[n];
    }
};
class Classroom{
    Classroom(){
        cin >> size;
        kids = new Kids[ size ];
        for(int i = 0; i < size ; i++){
            kids[i] = new Kids(i);
        }
    }
private:
    int size;
    Kids *kids;
};

Why is this line
kids[i] = new Kids[i];

considering by compiler as attempt to convert Kids* to Kids&& while i am creating a new instance of node e.g dynamicly allocating it thus passing it as Kids*?
Thanks for help!

A: new Kids(i) creates a Kids object initialized by i and returns pointer to it.
kids[i] is a Kids object (lvalue), not a pointer.
Those types are simply not compatible.
The kids array is already allocated by the first instruction (kids = new Kids[ size ];), there's no need to do it again.
If you want to initialize each kid with it's index, you should be able to just type:
kids[i] = Kids(i);

But you seem to breaking the rule of three/fize/zero, so YMMV.
By the way, instead of doing all the hard work yourself, you should let the library do it for you and use a collection/smart pointer instead of managing your resources manually. Use std::vector<Kids> or std::unique_ptr<Kids[]>, whichever fits your needs.


text:
Q: Fatal error: Call to undefined function validation_errors() Error was Fatal error: Call to undefined function validation_errors() in C:\xampp\htdocs\payroll\application\views\dtr_timerecord_overtime.php on line 5.
i tried to out the error message to other views and it was ok but when im trying to its original view it always error
view

                 <?php echo validation_errors(); ?> </td?

            OT APPLICATION NO

            <input type="text" id="txtOtApplication" name="txtOtApplication" />

            DATE
            <input id="labelDateTodayOvertime" disabled/>

            <input type="hidden" id='txtDateTodayOvertime' name="txtDateTodayOvertime"/>

            DESCRIPTION

            <input type="text" id="txtDescription" name="txtDescription" />

            EMPLOYEE
            DATE
            TIME FROM
            TIME TO

            <input type="text" id="txtEmployee" name="txtEmployee" size="30"/>

            <input type="date" id="txtDate" name="txtDate" />

            <input type="time" id="txtTimeFrom" name="txtTimeFrom" />

            <input type="time" id="txtTimeTo" name="txtTimeTo" />

            <input type="button" id="btnAddLine" name="btnAddLine" value="ADD LINE" />

            <input type="submit" name="btnSaves" value="SAVE AND SUBMIT">

            <input type="button" name="btnReset" value="RESET" onclick='ClearFields();'>

            <input type="button" name="btnGenerate" value="GENERATE">

controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Dtr_controller extends CI_Controller {

    function __construct()
    {
        parent::__construct();
        $this->load->helper(array('form', 'url'));
    }
public function saveovertime(){

        $this->load->library('form_validation');
        $this->form_validation->set_rules('txtOtApplication', 'Overtime Application No.', 'required');
        $this->form_validation->set_rules('txtDescription', 'Description', 'required');
        $this->form_validation->set_rules('txtEmployee', 'Employee', 'required');
        $this->form_validation->set_rules('txtTimeFrom', 'Time From', 'required');
        $this->form_validation->set_rules('txtTimeTo', 'Time to', 'required');
        $this->form_validation->set_rules('txtDate', 'Date', 'required');

        if ($this->form_validation->run() == FALSE)
        {
            $this->load->view('dtr_timerecord_overtime');
        }
        else
        {
        $this->load->model('dtr_model');
        $this->dtr_model->saveovertime();
        $this->load->view('success_overtime');

        }

    }
}

model
class Dtr_model extends CI_Model {

    public function __construct(){
            parent::__construct();

    }

    function saveovertime(){
        $value = array(
                        'OT_APPLICATION_NO'=>$this->input->post('txtOtApplication'),
                        'DESCRIPTION'=>$this->input->post('txtDescription'),
                        'DATETODAY'=>$this->input->post('txtDateTodayOvertime'));

        $query = $this->db->insert('dtr_timerecord_overtime',$value);
        $value = array(
                        'EMPLOYEE'=>$this->input->post('txtEmployee'),
                        'TIME_FROM'=>$this->input->post('txtTimeFrom'),
                        'TIME_TO'=>$this->input->post('txtTimeTo'),
                        'DATE'=>$this->input->post('txtDate'));
        $query = $this->db->insert('dtr_timerecord_overtime_line',$value);
    }
}

A: Ok, here's my workaround:
First I had this in my View:
<?php
    echo validation_errors();
?>

It didn't work. I kept receiving Fatal error: Call to undefined function validation_errors()...
Then I did this:
<?php
    $this->load->library('form_validation');
    echo validation_errors();
?>

And it worked!

A: You have not loaded form_helper in application\config\autoload.php, please load form helper in autoload file
Or on the controller
$this->load->helper("form");

validation_errors() function is inside form helper.

A: $this->load->library('form_validation');

write this in the constructor of your controller, or better autoload it. perhaps, in the method, you are posting this form, you accidentaly not loading the form validation library


text:
Q: Ruby on Rails Calculations I'm new to Rails and coding in general, and I'm trying to teach myself by working on an app for a delivery driver.  I have a table called loads, and included are the columns for Gross Weight, tare weight and net weight.  The way it is currently, the driver would have to type in all 3 weights manually.  I'm trying to figure out the best way to have the app calculate the net weight (by subtracting the tare weight from the gross weight)and add it to the net column. This would cut down on the driver making a simple math mistake.  I'm using MySQL, can someone point me in the right direction?

A: I would add a before_validation callback to the model and let is calculate the missing value. Something like this:
# in your model
before_validation :calculate_net_weight

private
def calculate_net_weight
  self.net_weight = gross_weight - tare_weight
end

Btw. I would argue that is makes sense to store all three values in the database even if you could calculate one from the other two. But having all three values in the databse might help to fix problems or might make calculation or statistics easier.

A: why keep that logic in the database? You could simply have it in the model.
Let's say you have a Load model
simply add the following method
def net_weight
  gross_weight - tare_weight
end

A: I would also ask why you have to store it in the database. If you do want to store it none the less:
You can create the before_create lifecyle hook of a model to calculate and set values before saving it to the database.


text:
Q: I would like to use a regular expression to grab everything after, with the replace string function "Sub" string = "\\20141014 - Philippe Morion [SPN]\\FRA-LYO-RICL-026\\FRA-LYO-RICL-026.L01\\FRA-LYO-RICL-026\\C\\Philippe 21 Mai 2014\\Classement\\SOC Department\\AOC\\2014"

Firstmod = string.sub /.*C\\/i, 'f|C:\\'

puts "#{Firstmod}"
# f|C:\2014

What i want is
 f|C:\\Philippe 21 Mai 2014\\Classement\\SOC Department\\AOC\\2014"

A: You can actually make use of the context: the C\ you want to find is actually preceded with another \. You can add it to the pattern that will look like /.*\\C\\/:
string = "\\20141014 - Philippe Morion [SPN]\\FRA-LYO-RICL-026\\FRA-LYO-RICL-026.L01\\FRA-LYO-RICL-026\\C\\Philippe 21 Mai 2014\\Classement\\SOC Department\\AOC\\2014"
Firstmod = string.sub /.*\\C\\/i, 'f|C:\\'
puts "#{Firstmod}"

See IDEONE demo.
Or use @CasimirEtHippolyte's suggestion to use lazy matching: /.*?C\\/i.


text:
Q: Find all natural numbers $n$ such that $21n^2-20$ is a perfect square. Find all natural numbers $n$ such that $21n^2-20$ is a perfect square.
I have got the following solutions via programming:
$n=1,2,3,9,14,43,67$ but how can I find these manually?  How can I guarantee there are no more solutions?

A: Note that
$$
x^2−5xy+y^2+5=0
$$
is equivalent to
$$
21x^2-20=(2y-5x)^2.
$$
Hence all solutions of the first equation are also solutions of $21n^2-20=m^2$.
This explains that the solutions given at OEIS (see the above comment) are also solutions here.
In general, it is well known how to solve the quadratic equations $ax^2+bxy+cy^2=k$ over the integers. In particular, we can solve the generalised Pell's equation
$$
21x^2-y^2=20.
$$

A: Now that I see we can drop the discriminant, this is better, and very similar to what Dietrich wrote:
IF
$$ x^2 + xy - 5 y^2 = -5, $$
then
$$ 4 x^2 + 4xy - 20 y^2 = -20, $$
$$ (2x+y)^2 - 21 y^2 = -20.  $$
Notice that this gives everything, because if $u^2 - 21 v^2 = -20,$ then $u \equiv v \pmod 2.$
So, to get fewer orbits with the nicer recursion: we get
$$ y_{k+2} = 5 y_{k+1} - y_k $$ in two threads
$$ 1, 3, 14, 67, 321, 1538, 7369,...  $$
$$ 2, 9, 43, 206, 987, 4729, 22658,... $$
A really careful proof of this is a Conway Topograph, which is easy enough for this problem that I will probably draw it and post it here.

jagy@phobeusjunior:~$  ./Pell_Target_Fundamental_A
2  5
1  3

  5^2 - 21 1^2 = 4

1 x^2 + 1 x y -5 y^2 = -5

Thu May  5 14:14:32 PDT 2016

x:  0  y:  1 ratio: 0  seed
x:  3  y:  2 ratio: 1.5  seed
x:  5  y:  3 ratio: 1.666666666666667  seed
x:  16  y:  9 ratio: 1.777777777777778
x:  25  y:  14 ratio: 1.785714285714286
x:  77  y:  43 ratio: 1.790697674418605
x:  120  y:  67 ratio: 1.791044776119403
x:  369  y:  206 ratio: 1.79126213592233
x:  575  y:  321 ratio: 1.791277258566978
x:  1768  y:  987 ratio: 1.79128672745694
x:  2755  y:  1538 ratio: 1.791287386215865
x:  8471  y:  4729 ratio: 1.79128779868894
x:  13200  y:  7369 ratio: 1.791287827384991
x:  40587  y:  22658 ratio: 1.791287845352635
x:  63245  y:  35307 ratio: 1.791287846602656
x:  194464  y:  108561 ratio: 1.791287847385341
x:  303025  y:  169166 ratio: 1.791287847439793
x:  931733  y:  520147 ratio: 1.791287847473887
x:  1451880  y:  810523 ratio: 1.791287847476259
x:  4464201  y:  2492174 ratio: 1.791287847477744
x:  6956375  y:  3883449 ratio: 1.791287847477848

Thu May  5 14:14:52 PDT 2016
2  5
1  3
Inverse of given automorphism of quadratic form:
3  -5
-1  2
jagy@phobeusjunior:~$

A: From theory of Pell equation $$21\Bigl(\frac{(55+12\sqrt{21})^n(1+\sqrt{21})-(55-12\sqrt{21})^n(1-\sqrt{21})}{2\sqrt{21}}\Bigr)^2-20=\Bigl(\frac{(55+12\sqrt{21})^n(1+\sqrt{21})+(55-12\sqrt{21})^n(1-\sqrt{21})}{2}\Bigr)^2.$$


text:
Q: Display Loading.. gif in angular-blockUI plugin I have used blockUI PLUGIN from https://github.com/McNull/angular-block-ui
Problem i'm facing is that i want to dislay loading gif along with Saving Synids... Message.
So how can i do that.
$scope.saveDefSynId = function(item, event) {
        if($rootScope.savedSynids.length!==0){
            **blockUI.start({message: 'Saving Synids...'});**
            var toSaveSynid=[];

            angular.forEach($rootScope.savedSynids, function(value){
                if(value.isSaved=='Y'|| value.isUpdated=='Y'){
                    toSaveSynid.push(value);
                }
            });

            var clientId=$scope.selClient;
            var responsePromise = $http.post("defineSaveSynId/"+clientId,toSaveSynid);

            responsePromise.success(function(data, status, headers, config) {
                $rootScope.savedSynids=[];
                $scope.eMsg="Synids Saved Successfully";
                 **blockUI.stop();**
            });
            responsePromise.error(function(data, status, headers, config) {
                alert("AJAX failed!");
            });
    }

No changes has been done to jsp for this plugin.

A: As per the documentation, you need to change the default value.
// Change the default overlay message
blockUIConfig.message = 'Saving Synids...';

example
angular.module('myApp').config(function(blockUIConfig) {

  // Change the default overlay message
blockUIConfig.message = 'Saving Synids...';

// Change the default delay to 100ms before the blocking is visible
blockUIConfig.delay = 100;

});

source: http://angular-block-ui.nullest.com/#!/examples/documentation


text:
Q: How to implement PoE with WIZnet W5500? I want to implement a PoE solution and I started to design the board based on WIZnet's W5500 reference designs. I am using the design with the external transformer.
My questions are:

*

*How to adapt the schematic to use 2 pairs for PoE and be compatible with both modes of PoE? In DFRobot's Ethernet shield (see schematic at bottom of page), the pairs were filtered with an C-R-C network, but, correlating with WIZnet's schematic, should these components support 2kV? Also, for me it is not clear if DFRobot's design works in both modes of PoE.

*I've seen RJ45 jacks with integrated magnetics and WIZnet gives a separate reference design which uses this type of jack. Can that design be adjusted for PoE? How?

*I've found many types of jacks which integrates PoE magnetics such as:
MagJack SI-52008-F
Wurth 7499210121A
Why do some jacks, like Wurth, integrate diode bridges when PoE is DC? Also, see Silvertel's PoE 9600 module which integrates diode bridges.

*In the schematic from DFRobot, a PoE PD interface and regulator circuit is used. Can't I just take the 48 V DC and use that voltage in a simple DC-DC converter? Why does such an interface is required?

*Would it be better to use a jack with metallic enclosure, than a plastic one?

*Would the PoE design work if I used a lower voltage, 5-12 V, instead of 48V?

*Relating to the WIZnet designs, why does the center tap on the TX transformer, on the chip side, needs to be connected to 3.3V?
Thank you!
UPDATE
Thanks to your answers I managed to obtain a working design.

A: The diode bridge looks to be reverse polarity protection when using the jack to power your circuit. The jacks with these diodes in it can not be used to provide power to a remote device.
Additionally the W5500 seems to require independent center taps to match the reference designs which limits the selection further. We found the following to fit the requirements but it is so far untested:
https://www.digikey.com/product-detail/en/abracon-llc/ARJ-199/535-13149-ND/5430434
As far as power - you should use a regulated supply. 48 is part of the POE "standard" but some devices do not conform to that. You would need to figure out what device you plan to use if you plan to use a lower voltage. That said, lower voltage means higher current for the same power output.
The actual standard involves some sensing and ability to adjust or remove power under certain circumstances but will require more circuitry to implement.


text:
Q: IE7  and  weird styling? IE is driving me crazy.
See the following page: http://goo.gl/uRGsh
In IE8+ the buttons in the content looks and behaves relatively ok, but for some reason the buttons are given a white border and thick black outline when focused in IE7. I've tried removing the outline with outline: none;, which does absolutely nothing for me.
Another disturbing thing is that the text in the buttons kind of jump down on focus. I'm not sure what causes this; it can't be padding, can it? Because then the button would grow in size. Am i missing something? The buttons jump in all IE for me. I have custom hover/focus states with backgrounds, so i don't want the jumpyness.
Any ideas how to get rid of the border/outline and the jumping?

A: Try this
Remove outline from image link
    a img {outline : none;}

Remove border from image link
    img {border : 0;}

Good Luck..)

A: Also - for this type of issue consider using the html5 shiv
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->


text:
Q: How do Mnemonics work with Radio Buttons I was expecting that when I use Alt+mnemonic that the related radio button would become focused and selected. My expectations are based on my knowledge of how mnemonics work in Swing. Are my expectation wrong?
In my example code below I set the number of each radio button to be the mnemonic.

*

*"Option 1" is selected when the program starts.

*When I use Alt+3, the program beeps at me, all the mnemonics become underlined and "Option 3" becomes focused but NOT selected. The GUI now looks like this:

*If I just type 2, "Option 2 becomes focused, but NOT selected.

Here is the code:
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.image.*;
import javafx.scene.input.*;
import javafx.scene.effect.*;
import javafx.scene.paint.*;
import javafx.beans.value.*;
import javafx.geometry.*;

import javafx.event.*;

public class RadioButtonSSCCE extends Application
{
    public Parent createScene()
    {
        ToggleGroup group = new ToggleGroup();

        RadioButton rb1 = new RadioButton( "Option _1" );
        rb1.setUserData("Option 1 selected");
        rb1.setToggleGroup( group );

        RadioButton rb2 = new RadioButton( "Option _2" );
        rb2.setUserData("Option 2 selected");
        rb2.setToggleGroup( group );

        RadioButton rb3 = new RadioButton( "Option _3" );
        rb3.setUserData("Option 3 selected");
        rb3.setToggleGroup( group );

        VBox root = new VBox(5);
        root.setAlignment(Pos.CENTER);
        root.getChildren().addAll(rb1, rb2, rb3);

        ChangeListener<Toggle> cl = new ChangeListener<Toggle>()
        {
            @Override
            public void changed(ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle)
            {
                if (group.getSelectedToggle() != null)
                {
                    String text = group.getSelectedToggle().getUserData().toString();
                    System.out.println( text );
                }
            }
        };
        group.selectedToggleProperty().addListener(cl);

        rb1.setSelected( true );

        return root;
    }

    @Override
    public void start(Stage primaryStage)
    {
        Scene scene = new Scene(createScene(), 125, 125);
        primaryStage.setScene(scene);
        primaryStage.setTitle("Radio Button SSCCE");
        primaryStage.show();
    }

    public static void main(String[] args)
    {
        launch(args);
    }
}

I have found that in order to invoke the mnemonic I have to:

*

*press and release the Alt key. Now the mnemonic of each radio button is underlined.

*press the number and the radio button becomes focused. However, I now need to use the space bar to select the radio button.

Why do I need to press the space bar? Should the radio button not be selected when the mnemonic is pressed?
Also, why can't I just use Alt+mnemonic as a single key combination to select a radio button?
Is my code wrong?
Edit:
The action is the key to selecting the radio button. I created a generic action to be shared by all buttons:
EventHandler<ActionEvent> onAction = new EventHandler<ActionEvent>()
{
    @Override
    public void handle(ActionEvent e)
    {
        RadioButton button = (RadioButton)e.getSource();
        button.setSelected(true);
    }
};

rb1.setOnAction( onAction );
rb2.setOnAction( onAction );
rb3.setOnAction( onAction );

Since the radio buttons are part of a button group I didn't want the ability to unselect a button.

A: The Mnemonic in JavaFX fires an ActionEvent targeted at the registered Node. In the case of RadioButton, the ActionEvent doesn't toggle selection. You can add a generic handler to the RadioButton to toggle on the ActionEvent like this (assuming this is JavaFX 8).
rb1.setOnAction(event -> rb1.setSelected(!rb1.isSelected()));

A: As OttPrime notes in his answer and in the Mnemonic Javadoc:

When a Mnemonic is registered on a Scene, and the KeyCombination reaches the Scene unconsumed, then the target Node will be sent an ActionEvent.

Now I think this is kind of an issue, because you don't really want to have only an ActionEvent sent to the radio button, instead you want to fire() the radio button.

Toggles the state of the radio button if and only if the RadioButton has not already selected or is not part of a ToggleGroup.

Note: firing a radio button will also send an ActionEvent to the button.
Here is the Java 8u40 code for Button::fire
@Override public void fire() {
    if (!isDisabled()) {
        fireEvent(new ActionEvent());
    }
}

Here is the code for ToggleButton::fire
@Override public void fire() {
    // TODO (aruiz): if (!isReadOnly(isSelected()) {
    if (!isDisabled()) {
        setSelected(!isSelected());
        fireEvent(new ActionEvent());
    }
}

And here is the code for RadioButton::fire
@Override public void fire() {
    // we don't toggle from selected to not selected if part of a group
    if (getToggleGroup() == null || !isSelected()) {
        super.fire();
    }
}

Note: RadioButton is a ToggleButton, so the super.fire() call will invoke the ToggleButton fire() code.
So, a mnemonic for a button will be fine: All the mnemonic is doing is sending an ActionEvent to the button (which is exactly the same as the fire implementation for the button).  However, ToggleButtons and RadioButtons do extra stuff in their fire methods for manipulating the selection state of the ToggleButton, so mnemonic invocations aren't going to do that.
Now, you might say, well that's OK, I'll just implement OttPrime's workaround:
rb1.setOnAction(event -> rb1.setSelected(!rb1.isSelected()));

This will be great when you select the button via a mnemonic, but (as far as I can see), it will break other functionality for button selection (for example, if you programmatically fire the radio button and, probably, also if you click on the radio button with a mouse).  This is because the selection state of the button will change twice (once in the fire() code and again in your action code) and you probably don't want that.  Unfortunately, I can't actually test this theory as I don't have access to a machine which can use mnemonics.
So, to answer your original question "How do Mnemonics work with Radio Buttons"? => They don't (at least in IMO, not in any way that really makes sense).
I'd advise just disabling Mnemonic parsing for radio buttons and toggle buttons.


text:
Q: IBM OpenJPA NullPointerException in getResultList() I have spent all day trying to get native SQL to run with JPA, for a legacy migration project.  I've simplified the query to something that should work.
Query query = localEm.createNativeQuery("SELECT ID FROM TABLE");
List results = query.getResultList();

But I get a NPE from within the JPA code, via query.getResultList():
NullPointerException at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:328)
It's driving me crazy.  I've scoured the QueryImpl source.  I'm using IBM WebSphere, (WSJPA 2.1.1-SNAPSHOT and OpenJPA 2.1.1-SNAPSHOT), so the line numbers don't help, but it doesn't look like anything significant has changed in that part of the code for 2.2.0.  But I don't see anything wrong in their code.  My other JPA calls with my localEm (Entity Manager) are working fine.
Does anyone have an idea?

A: Ok I solved it.
If I place the code in my Remote bean (the Dao), it works.
If I place the code in my Session bean (which injects the Dao), it doesn't work.
I guess the reference to the EntityManager must probably be severed at some point when returning from a Remote bean.
It was an EJB problem (or rather my poor understanding of EJB problem), however the NPEs thrown from the OpenJPA code still seems like a bug to me.


text:
Q: How to display variable values in resultset I am unable to transform below T-SQL script to ORACLE.
DECLARE @ABC VARCHAR(50) = 'SOME VALUE'
SELECT @ABC

A: If you are working in SQL and would like to return the result-set return like in T-SQL you can use SP with out sys_refcursor parameter at Oracle side. The result-set in such a case can be returned and processed in various ways. Please follow the example below for one of the solutions:
create or replace  procedure sp_ret_res_set(ref1 out sys_refcursor)
is
v_ABC VARCHAR2(50) DEFAULT 'SOME VALUE';
begin
open ref1 for select v_ABC from dual;
end;
/
var c refcursor;
/
execute sp_ret_res_set(:c);
/
print c;

A: I think you just need a plain SELECT.
For example,
SQL> SELECT CAST('SOME VALUE' AS VARCHAR(50)) str FROM dual;

STR
--------------------------------------------------
SOME VALUE

SQL>

You could directly use the DUAL table without explicitly casting to VARCHAR2,
SQL> SELECT 'SOME VALUE' str FROM dual;

STR
----------
SOME VALUE

SQL>

However, if you do not explicitly cast it, it would be CHAR and not VARCHAR2. So, if you want the datatype to be VARCHAR2, then use CAST.


text:
Q: android google+ authorization I am trying to loggin to my app via google+ on device without google play services. I use org.scribe.oauth to do this. I create OAuthService and call method getRequestToken(). As responce i see Response body is incorrect. Can't extract token and secret from this: 'Consumer is not registered.
But I register my app on developer console. What i do wrong? How should i register my app? Like Android application or I should choose Installed->Otheritem when I trying to get api key and secret.

A: To create an API key:

*

*Go to the Google Developers Console.

*Create or select a project.

*In the sidebar on the left, select APIs & auth.

*In the displayed list of APIs, find the Google+ API and set its status to ON.

*In the sidebar on the left, select Credentials.

*Create an API key by clicking Create New Key. Select the appropriate kind of key: Server key, Browser key, Android key, or iOS key. Then click Create.

For more details, please refer here.


text:
Q: Selenium Python, How to control an already opened webpage with selenium "Hi, I'm trying to use selenium(Python) to perfrom some actions for me. The problem is; I want  it to control a webpage that I have already opened and signed in to. I don't want it to go through the signing in procedure again and again which is very complicated. So is there a way I can control the webpage that is already opened and not opened by the driver itself?"

A: use cookies or session
for example You can save the current cookies as a python object using pickle.
import pickle
import selenium.webdriver

driver = selenium.webdriver.Firefox()
driver.get("https://www.youtube.com")
pickle.dump( driver.get_cookies() , open("cookies.pkl","wb"))

then get them back
import pickle
import selenium.webdriver

driver = selenium.webdriver.Firefox()
driver.get("https://www.youtube.com")
cookies = pickle.load(open("cookies.pkl", "rb"))
for cookie in cookies:
    driver.add_cookie(cookie)


text:
Q: mocha sidebar is not showing tests I'm developing a very simple typescript project and I added a very tiny test with mocha. I installed mocha sidebar on VS Code and all it's dependencies, but test are not showing in the left panel.
The strange is that when I press debug button, my test run without problem (?)
I want to distribute this package on NPM, and only distribute .js, .d.ts, js.map and d.ts.map files.
I think the problem is in my project.json, but I cannot figure what is it. The source code is here

A: The only change I needed was in the VS code workspace settings: Under extensions I pointed the 'mocha glob files'-setting to my test scripts

A: One thing that I notice from your repo is you have package.json, test folder and another src folder inside type-exception/src.
I can run the mocha sidebar plugin successfully.
My solution is to open the project in vscode from the type-exception/src folder not type-exception folder.
My file structure

My mocha sidebar

I also saw that you have correct vscode workspace settings that set mocha files to
{
    "mocha.files.glob": "lib/test/**/*.js"
}

Hope it helps

A: I had the Testing view showing Jest tests and realised that for Mocha I needed to install another VSCode Extension called "Mocha Test Explorer": https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-mocha-test-adapter
Once installed I created/edited a .vscode/settings.json file in my project folder and added the following clues to tell Mocha to find my tests under the tests folder:
{
  "mochaExplorer.files": "tests/**/*.ts"
}


text:
Q: Am I using the best SQLAlchemy query? I've got an Opportunity table and an Owner table. The Opportunity table has a many to one relationship with Owner. I'm using Python, SQLAlchemy, FLask-Alchemy and SQLite on this project. I need to do an inner join on the Opportunity table against the Owner table and return a single result set (with fields from both tables).
I need to build a dictionary out of the result set so that I can easily generate Json. The following code all works... but... It took a ton of debugging to figure out how to transform the result set returned (which, in this case is a generator object) into a dictionary.
Did I make this harder than I needed to? Is there a better way to do this using SQLAlchemy? (such as using the expression language instead of the ORM)
owner = db.session.query(Owner).filter(Owner.id == owner_id).first()
if owner is None:
    return None

result = {'data': []}
report_date = datetime.datetime.strptime('2016-05-01', '%Y-%m-%d')

rows = db.session.query(Opportunity)\
                 .filter(Opportunity.status == 'Won',
                         Opportunity.owner == owner,
                         or_(Opportunity.actual_close_date_iso_year_week == '2016/16',\
                             Opportunity.actual_close_date_iso_year_week == '2016/17'),
                         Opportunity.report_date == report_date)\
                 .order_by(Opportunity.account)\
                 .join(Owner, Owner.id == Opportunity.owner_id)\
                 .values(Opportunity.account,
                         Opportunity.report_date_iso_year_week,
                         Opportunity.report_date,
                         Owner.first_name)

for row in rows:
    result_row = {}
    fields = getattr(row, '_fields')
    for field in fields:
        result_row[field] = getattr(row, field)
    result['data'].append(result_row)

A: I think that basically this is the way to get what you need, however I would suggest few minor changes:

*

*You don't really need to join, as after .filter(Opportunity.owner==owner) all the rows that you get from the Opportunity table have the same owner_id.

*I think it's better to define the list of needed fields once, instead of trying to get it from each row tuple.
So, the code may be like this:
required_fields = ('account','report_date_iso_year_week','report_date')
owner = db.session.query(Owner).filter(Owner.id == owner_id).first()
if owner is None:
    return None

result = {'data': []}
report_date = datetime.datetime.strptime('2016-05-01', '%Y-%m-%d')

rows = db.session.query(Opportunity)\
                 .filter(Opportunity.status == 'Won',
                         Opportunity.owner == owner,
                         or_(Opportunity.actual_close_date_iso_year_week == '2016/16',\
                             Opportunity.actual_close_date_iso_year_week == '2016/17'),
                         Opportunity.report_date == report_date)\
                 .order_by(Opportunity.account)\
                 .values(*[getattr(Opportunity,f) for f in required_fields])

for row in rows:
    result_row = {'first_name':owner.first_name}
    for field in required_fields:
        result_row[field] = getattr(row, field)
    result['data'].append(result_row)


text:
Q: what are you thinking about this car? The norm is "What do you think about this car?"
But would it not make any sense to say:
"What are you thinking about this car?" to mean "what is that that you are thinking about my car?"

A: They have slightly different implications, at least in US English.
What do you think about this car? means something like "What is your opinion of this car?" or "What do you think in general about this car?"  You might use this if you and your friend were looking at used cars together, and you pointed to one that you were thinking of buying.
What are you thinking about this car? means "What are you thinking right now about this car?", like "What thoughts are in your head at this moment about this car?"  This is a less common phrasing.  You might use it if you said to your friend, "I think am going to buy this car here," and they said, "Hm, OK, but..." and then stopped with a frown on their face.


text:
Q: Nginx will not listen on ipv4 port 443 Nginx will not listen on ipv4 port 443.  It listens on ipv4/6 port 80 and ipv6 port 443 but not ipv4 port 443.
Debian Stretch 9.8 - currently updated
Installed nginx-full package with apt
root@loadbalance01:/etc/nginx# nginx -v
nginx version: nginx/1.10.3

After doing:
systemctl stop nginx
systemctl start nginx

root@loadbalance01:/etc/nginx# !166
netstat -anop | grep LISTEN | grep nginx
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      13533/nginx: master  off (0.00/0/0)
tcp6       0      0 :::80                   :::*                    LISTEN      13533/nginx: master  off (0.00/0/0)
tcp6       0      0 :::443                  :::*                    LISTEN      13533/nginx: master  off (0.00/0/0)

Conspicuously absent is port 443 on tcp.
Just to be sure nothing else is listening on tcp 443
root@loadbalance01:/etc/nginx# netstat -anop | grep LISTEN | grep ':443'
tcp6       0      0 :::443                  :::*                    LISTEN      13533/nginx: master  off (0.00/0/0)

Nope only tcp6.
The only errors in /var/log/nginx/error.log are old errors that have been corrected.
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

My config:
I am just trying to create a simple load balancer with 1 node till I can show this works.
nginx.conf
Note this is only modified by removing the sites-enabled line, I am using a conf.d config.
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
}

The only other file modified is:
root@loadbalance01:/etc/nginx# cat conf.d/loadbalance.conf

upstream example {
    server 192.168.1.250;
}

server {
    server_name example.com

    listen 443 ssl;
    listen [::]:443 ssl;

    ssl on;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    location / {
        proxy_pass http://example;
    }
}

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name _;

    return 301 https://example.com;
}

NOTE: renamed to example.com

A: Thanx to Alexy Ten,
The configuration was missing a semi colon after the server name directive.   It passed syntax check, but was still wrong.
Thanx

A: I have not had huge experience with nginx but i have used the following configuration file successfully for reverse proxying / load balancing.
Hopefully something in this will help you
# HTTP Server redirect to HTTPS
server {
    listen 80;
    server_name <WEB_NAME>.example.com;
    return 301 https://$host$request_uri;
}

# HTTPS Server
server {
    listen 443;
    server_name <WEB_NAME>.example.com;

    # It is best to place the root of the server block at the server level, and not the location level
    # any location block path will be relative to this root.
    root /site/<WEB_NAME>;

    access_log /var/log/nginx/<WEB_NAME>.access.log;
    error_log /var/log/nginx/<WEB_NAME>.error.log;

    ssl on;
    ssl_certificate /etc/nginx/ssl/<WEB_NAME>/example.com.cer;
    ssl_certificate_key /etc/nginx/ssl/<WEB_NAME>/example.com.nopass.key;
    ssl_protocols TLSv1.1 TLSv1.2; # don't use SSLv3 ref: POODLE
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;

    location / {
        proxy_pass http://backend/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forward-Proto http;
        proxy_set_header X-Nginx-Proxy true;

        proxy_redirect off;
    }
}

# Uncomment other server entries if Loadbalance Configuration is required
upstream backend {
    server 127.0.0.1:80;
#    server <BACKEND_SERVER2>:<PORT>;
#    server <BACKEND_SERVER3>:<PORT>;
}

**NOTE: also renamed to example.com ;)


text:
Q: Facebook Deeplink not taking to iOS application I have integrated required Facebook pods and completed all steps as mentioned in the Facebook guide for Ads Deep linking
ANd write Below code in didFinishLaunchingWithOptions
    Settings.isAutoInitEnabled = true
    ApplicationDelegate.initializeSDK(nil)
    AppLinkUtility.fetchDeferredAppLink { (url, error) in
        if let error = error {
            print("Received error while fetching deferred app link %@", error)
        }
        if let url = url {
            if #available(iOS 10, *) {
                UIApplication.shared.open(url, options: [:], completionHandler: nil)
            } else {
                UIApplication.shared.openURL(url)
            }
        }
    }

I am using format for deeplink : example://category=Proctology
However, when I send the test deeplink from FB Ads console, clicking on the Ads opens the app page on AppStore instead of opening my app.
Please help


text:
Q: convert from 2D point on a plane to 3D Given a 2D point that is on the surface of a triangle, where each corner of the triangle is a 3D point, how can you compute the corresponding 3D point of the 2D point?

A: To get the 3D location of a particular 2D point on a triangle, use barycentric coordinates to interpolate the locations of the 3D vertices:
2D coordinates:  u,v such that 0 <= u,v <= 1  and  u+v <= 1
  ->  barycentric coordinates:  add t such that  t+u+v = 1  ->  t = 1-(u+v)

3D vertices:  V1, V2, and V3
  ->  result = u*V1 + v*V2 + t*V3


text:
Q: SSRS optional parameters don't work I am building report in SSRS 2008 which queries Oracle.
I have 3 text parameters build into dataset query - they should work in a way that if left blank they should include everything. If I put a value in each parameter - report returns value. But as soon as I remove one of the values - leaving box blank - report returns nothing (where in fact it should return more resulting rows).
See query below. I was trying to troubleshoot it for some last 2 days , trying to find some onswers in the internet, looking at session details - no luck.
I would appreciate any help, thanks.
select  WI_NUM , COMPONENT_NUM , LOT_NUM
from CONS
where
(:WI_NUM = '' OR WI_NUM = :WI_NUM)
and
(:COMP_NUM  = '' OR COMPONENT_NUM = :COMP_NUM)
and
(:LOT_NUM  = '' OR LOT_NUM = :LOT_NUM)

I also tried  that but same problem:
where
(:WI_NUM is NULL OR WI_NUM = :WI_NUM)
and
(:COMP_NUM  is NULL OR COMPONENT_NUM = :COMP_NUM)
and
(:LOT_NUM  is NULL OR LOT_NUM = :LOT_NUM)

All parameters are set as data type text, allow blanks, not allow nulls(not ticked).

A: The report was build by modyfying previous report. I decided to build report from scratch and it worked straight away. Must have been something wrong with the template.
Thanks @Mike. D , @Aftab and @tbone for all your suggestions - they were good pieces of advice.


text:
Q: Como fazer buscas usando jquery por atributo TITLE? Espero que esta mensagem os encontre bem.
Possuo o um código jquery que realiza buscas em tabela em tempo real. Este código faz buscas nesta tabela pelos valores das células, mas preciso que ele busque ao mesmo tempo por valores e valores do atributo title.
Exemplo se eu possuir o nome de uma empresa na tabela, ele encontrará esta empresa, todavia, se eu possuir a logo da empresa o nome dela estará no atributo TITLE e não como valor da célula.
Preciso que este código busque por ambos, tanto as empresas que só possuem o nome registrado e também as que possuem logo na tabela, mas que o nome está no TITLE.
Já antecipando os meus agradecimentos, segue o código abaixo.
Forte abraço a todos!

A: <!DOCTYPE html>

This is a paragraph.

This is a paragraph.

This is a paragraph.

This is a paragraph.

This is a paragraph.

This selector selects all elements with a title attribute value equal to 'Tomorrow', or starting with 'Tomorrow' followed by a hyphen.

Neste trecho é que tá o "segredo" da coisa
$(document).ready(function(){  $("p[title|='Tomorrow']").css("background-color", "yellow");});

Ai eu consigo procurar a tag p e com um nome title específico e adicionar o background amarelo no elemento cujo o title é "Tomorrow", acho que é isso que quer.
Edit 1: você pode substituir também, e outro exemplo disto é este abaixo
<!DOCTYPE html>

    <title>Esconder titulos</title>

    <input type="text" name="texto" id="texto">
    <button id="btn">Aplicar Titulo</button>

Script.js:
document.addEventListener('DOMContentLoaded',function() {
document.querySelector('#btn').addEventListener('click', function() {
    let text = document.querySelector('#texto').value;
    document.title = text;
});
});


text:
Q: Calculating the number of combinations in a list expansion How would you calculate the total unique combinations given a list of M elements padded with N additional elements (all the same) at any indexes within the list?
For example, say you have the list m = [a, b, c], and you want to generate all combinations padded with elements n = [z], this would generate 4 combinations, [z, a, b, c], [a, z, b, c], [a, b, z, c], [a, b, c, z].
For m = [a, b, c, d] and n = [z, z], it becomes more complex, with the result having 15 unique combinations, like, [z, z, a, b, c, d], [z, a, z, b, c, d], etc.
I'm trying to write a formula, f(m,n), that will return the total number of combinations, but I'm not sure how to handle the uniqueness factor. At first I thought it was simply f(m,n) = (m+1)*n. That predicts correctly for m=3,n=1 and m=4,n=1 but that fails to predict for m=4 and n=2, which results in 15 unique combinations.
So then I thought it was a summation of these functions, like:
f(m,n) = sum((m+1)*(n-i) for i in range(n))

This correctly predicts 15 for the inputs of m=4,n=2, but again fails for m=4,n=3, which is 35.
What am I missing?

A: *

*Assuming the order of the $m$ distinguishable elements is fixed, the function $f$ can be written as
$$
f(m,n)
=
{\small{\binom{m+n}{n}}}
=
\frac{(m+n)!}{m!{\,\cdot\,}n!}
=
\frac{\displaystyle{{\prod_{k=0}^{m-1}(m+n-k)}}}{m!}
=
\frac{\displaystyle{{\prod_{k=0}^{n-1}(m+n-k)}}}{n!}
$$
Explanation: Choose the locations of the $n$ indistinguishable "other" elements:$\;{\large{\binom{m+n}{n}}}\;$ choices.

For example: $f(4,2)={\large{\binom{6}{2}}}=15$, and $f(4,3)={\large{\binom{7}{3}}}=35$.

*If the order of the $m$ distinguishable elements is allowed to vary, the function $f$ can be written as
$$
f(m,n)
=
{\small{\binom{m+n}{n}}}{\cdot\,}m!
=
\frac{(m+n)!}{n!}
=
\prod_{k=0}^{m-1}(m+n-k)
$$
Explanation:

*

*Choose the locations of the $n$ indistinguishable "other" elements:$\;{\large{\binom{m+n}{n}}}\;$ choices.

*Choose the order of the $m$ distinguishable elements:$\;m!\;$choices.


text:
Q: SSLError when running python script on Windows Server I am trying to run a python script on my Windows server hosted on AWS. The server sits behind a proxy which directs traffic to the internet.
From my account, I can pip install any packages, and it works fine if I set my proxy on inetcpl.cpl. I can also run the python script without any issues.
However i have a user on the same server (let's call him john doe), when he tries to pip install a package, he gets the error message Your proxy appears to only use HTTP and not HTTPS. We found a way around this to use pip install --proxy but when he runs the python script, he gets the error SSLError Max retries exceeded with url [SSL: Wrong Version Number]. He also has the proxy setup in inetcpl.cpl
I want him to be able to run the script and the pip commands without the --proxy or without having to continuously set http_proxy variables like I am able to run the script just fine.
Can someone help out as to why we are getting this SSL error even though he has proxy setup on his user profile ?


text:
Q: How to select all non-distinct rows from a DB? This will give me all unique entries:
select distinct (origin, destination) from mytable
but how can I select all routes that are non-unique instead? So I get the rows that are dublicate regarding these 2 fields?

A: Try this:
SELECT origin, destination
FROM mytable
GROUP BY origin, destination
HAVING COUNT(*) > 1


text:
Q: Sync Wordpress Articles from Local to Remote? I am starting a Blog and I am trying to keep my Localhost version as up to date as possible with my Remote server version on the web.
I would really like to be able to make a post/article on my Localhost install and have it somehow post the same article/post to my Web version (remote version) once I hit publish.
Does anyone know if there is a plugin or other method to easily automate or help with such a task?  My main goal is that I will have a Local and Remote version of all articles when I post them, I would prefer to be able to post first on my Local version and then publish the end result to my website/remote install

A: You can easily use Windows Live writer and manage several blogs
from your home and get a preview on how the post would look like
in your blog pre-publish
Try it you gona love it!


text:
Q: Command-line dependency tree for BitBake recipes For some reason, my Yocto image build is pulling in xserver-xorg along with several other GUI-related dependencies such as GTK3+ and Wayland. I want to understand where this dependency is being declared, but there doesn't seem to be an easy mechanism to do this with BitBake. Things I have tried so far:

*

*Starting the Toaster server, so that I can search and navigate recipes a little easier - for some reason, I get connection refused when trying to access the page. Perhaps it's down to firewall... - at the end of the day, I don't really want a bulky webserver for this.

*I tried bitbake -g xserver-xorg -u ncurses, but this just gave me ncurses showing that it has written a .dot file...

*I tried rendering the .dot file into something useful with Graphviz, but it is so massive it is of no help.
All I want is to say "Hey BitBake, give me the recipes which have a direct dependence on package X, and that are active in this image, please."

A: It is a bit of a cheat but if you "break" the dependency you want to remove, e.g. remove the recipe, it will then tell you what is depending upon it.


text:
Q: Compute $(\frac{\partial w}{\partial z})_x$ I came across the following question and am uncertain whether my result can be further developed (I don't really see the interest in the question, if my answer is the final form - it doesn't seem particularly revealing, as a question). Am I missing anything?

Let $w = f(x,y,z)$ be a function subject to $xy = kz$, where $k$ is a
  constant. Find $\big(\frac{\partial w}{\partial z}\big)_x$.

My attempt:
$\big(\frac{\partial w}{\partial z}\big)_x$ implies that we have $w = w(x,z)$ and $y = y(x,z)$. Applying the chain rule, we have:
$$ \Big(\frac{\partial w}{\partial z}\Big)_x
      %
      =  \Big(\frac{\partial f}{\partial y}\Big) \Big(\frac{\partial y}{\partial z}\Big)_x
      %
      + \Big(\frac{\partial f}{\partial z}\Big), $$
where, for $x \neq 0$,  $y = k \tfrac{z}{x}$, so $\Big(\frac{\partial y}{\partial z}\Big)_x = \frac{k}{x}$, as such:
$$\Big(\frac{\partial w}{\partial z}\Big)_x
      %
      =  \Big(\frac{\partial f}{\partial y}\Big) \frac{k}{x}
      %
      + \Big(\frac{\partial f}{\partial z}\Big).$$


text:
Q: View home screen in iOS application (Swift) How can I make the background of a UIView translucent so that the user can see their (blurred) home screen?
If this is not possible, perhaps I can screenshot the home screen and add a translucency effect. In this case, how do I take a screenshot of the user's home screen?
Apple has tight privacy views (which I support) so I understand that none of the above may be permitted.

A: 1. For having background of previous UIViewController, present next controller with presentationStyle as overFullScreen.
let vc = ViewController()
vc.modalPresentationStyle = .overFullScreen
self.present(vc, animated: true, completion: nil)

If need translucent effect use,
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.dark)
blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(blurEffectView)

2. To take screenshot.
func takeScreenshot(view: UIView) -> UIImageView {
     UIGraphicsBeginImageContext(view.frame.size)
     view.layer.render(in: UIGraphicsGetCurrentContext()!)
     let image = UIGraphicsGetImageFromCurrentImageContext()
     UIGraphicsEndImageContext()
     UIImageWriteToSavedPhotosAlbum(image!, nil, nil, nil)
     return UIImageView(image: image)
}

let view = HomeScreen().view
let image = taketakeScreenshot(view)


text:
Q: Mean square speed from mean square displacement? Consider a distribution of particles in space with a mean square displacement defined in each spatial direction $q$ as $\langle d_q^2 \rangle = \langle |q(t) - q_0|^2 \rangle$, where $q_0$ is the initial position along the given axis. If the displacement occurs over a time $\Delta t^2$, does it make sense to say that the mean square speed in each direction is $\langle v_{q}^2 \rangle= \langle d_q^2 \rangle/\Delta t^2$? More precisely, is such a definition of the mean square speed equivalent to the usual one derived via the Maxwell-Boltzmann distribution?

A: Consider a particle moving according to a Langevin equation,
$$m\frac{\mathrm d\mathbf{v}}{\mathrm dt} =\frac{\mathbf{v}}{\mu}+\boldsymbol{\eta}(t)$$
where $\boldsymbol{\eta(t)}$ represents the stochastic white noise. The general solution for this is,
$$\mathbf{v}(t)=\mathbf{v}(0)\mathrm{e}^{-t/\tau}+\frac{1}{m}\int_0^t\boldsymbol{\eta}(t')\mathrm{e}^{-(t-t')/\tau}\,\mathrm{d}t' \tag{1}$$
where $\tau=m\mu$ is the relaxation time. The mean square of Eq (1) is found to be,
$$\boxed{\langle v^2(t)\rangle=\langle v^2(0)\rangle\mathrm{e}^{-2t/\tau}+\frac{kT}{m}\left(1-\mathrm{e}^{-2t/\tau}\right)}\tag{2}$$
where the $kT$ comes from the equipartition theorem and the autocorrelation of the noise term, $\langle\eta(t)\eta(t')\rangle=2kT\delta(t-t')$.
We can integrate Eq (1) again to find the displacement from the original position,
$$\mathbf{d}(t)=\mathbf{v}(0)\tau\left(1-\mathrm{e}^{-t/\tau}\right)+\mu\int_0^t\boldsymbol{\eta}(t')\left(1-\mathrm{e}^{-(t-t')/\tau}\right)\,\mathrm{d}t'$$
From which the average distance is equal to the first term on the right. If you want the mean square displacement, then you need to square this and after some work, you'd find,
$$\boxed{\langle d^2(t) \rangle = v^2(0) \tau^2 \left(1 - e^{-t/\tau}\right)^2 - \frac{3kT}{m}\tau^2f\left(t,\,\tau\right)+\frac{6kT}{m}\tau t}\tag{3}$$
where $f(t,\tau)$ is some function of $\exp(-t/\tau)$ that isn't exactly important right now. The $kT$ terms also arise due to the same reasons in Eq (2).
Direct comparison of Eq (2) and Eq (3) clearly show that it is not generally true that $\langle d^2\rangle=\langle v^2\rangle\,t^2$. However, we can look at two limiting cases to see if it could be the case.
Short time scales
For $t\ll\tau$, Eq (2) reduces to,
$$\langle v^2(t\ll\tau)\rangle\approx\langle v^2(0)\rangle$$
while Eq (3) reduces to,
$$\langle d^2(t\ll\tau)\rangle\simeq \langle v^2(0)\rangle t^2,\tag{4}$$
This is close to your wanted equation (if we integrated from $t_1$ to $t_2$ and defined $\Delta t=t_2-t_1$, then I think it'd be an exact relation), but as Eq (4) is valid only for short timescales, then the wanted relation doesn't hold for particularly long.
Long time scales
The long time solution to the Langevin equation should replicate the Boltzmann distribution. Hence, in this limit Eq (2) reduces to,
$$\lim_{t\to\infty}\langle v^2(t)\rangle=\frac{kT}{m},$$
as it should. Eq (3) in this limit, the last term dominates,
$$\lim_{t\to\infty}\langle d^2(t)\rangle=\frac{6kT}{m}t\tau =6\langle v^2(t)\rangle\,t\tau$$
which also isn't quite the relationship you were expecting, due to the relation being linear with time $t$ (with $\tau$ providing the other unit of time to make the units match).
Where your derivation goes wrong
Your derivation ends with an incorrect assertion:1 that $\langle d^2\rangle=\langle v^2\rangle/\Delta t^2$ is valid for (arbitrary) finite time changes due to the "product property of kernels". While this is correct for kernels, it is not correct for the definition of the velocity,
$$v\overset{\text{def}}{=}\lim_{\Delta t\to0}\frac{x(t+\Delta t)-x(t)}{\Delta t}\equiv\frac{\mathrm{d}x}{\mathrm{d}t}.$$
This relation is valid only for infinitesimal increments, it is incorrect for the finite durations (which is why calculus prefers using $\mathrm{d}$ to denote the infinitesimal and $\Delta$ for the finite, to avoid such confusions). Since your derivation required the use of infinitesimal durations to replace the velocity with $\Delta x/\Delta t$ in the MB distribution, then your are still bound by this condition.
Hence, at best, your relation only works for short timescales, which agrees with my Eq (4) & surrounding text.

1. Master Drifter has since deleted their answer, but the solution they proposed was based on matching the heat kernel to the Maxwell-Boltzmann distribution by using a Wick rotation and assuming that the change in time was sufficiently small that $v=\mathrm{d}x/\mathrm{d}t\equiv\Delta x/\Delta t$ to use a change in variables in the Boltzmann distribution. This allowed them to show that $\langle d^2\rangle\sim\langle v^2\rangle\Delta t$, but extended this small-time scale comparison to arbitrary $\Delta t$ due to the product property of the heat kernel, forgetting that the match to the MB distribution required small $\Delta t$.


text:
Q: Balancing of 18650 battery with parallel cells Does a 1S4P 18650 battery need balancing? I read a lot about balancing around the internet. To me it seems like this only applies to the cells connected in series. An all parallel setup would not need balancing. Is this correct?

A:
Does a 1S4P 18650 battery need balancing?

No. In parallel they are electrically a single cell. You can't 'balance' a single cell.
However before connecting the cells together you should make sure that they all have close to the same voltage. If they are new then they should do, but if they are used then you may need to 'balance' them before making the pack.
Don't make a pack from cells of different capacity, type, age, or condition, as they will not share the load equally.