text:
Q: Add and remove html element by jquery How can I add new
 after a clicked
. On click of this
 and remove now created when click other
 (with repeat 1st scenario) by jQuery?
I tried like this, but it does not work:

$("#test_table tr").click(function() {
  $(this).prev().remove();
  $(this).closest('tr').append('
2.2
');
});

    1

    2

    3

A: Given your goal it seems that you want to replace the current tr with the new HTML snippet. To do that you just need to call after() to insert the new HTML, then remove() to clear the original tr:

$("#test_table tr").click(function() {
  $(this).after('
2.2
').remove();
});

    1

    2

    3

However, as the only effect of this is to change the text within the td, you can just call text() instead:

$("#test_table tr").click(function() {
  $(this).find('td').text('2.2');
});

    1

    2

    3


text:
Q: How to Change init-parameters at Runtime? If I modify the XML to change the value of init parameter
I see the changes only when web-app is redeployed.
My question is cant I get around this by setting the values at run time.Is there any API that allow me to change the values dynamically.

A: It's called init-parameter for a reason. So, you can't.
But you can change values at runtime, that's no problem.

*

*After reading the init parameters put them as attributes of the ServletContext (ctx.setAttribute("name", value))

*Create a small (password-protected) page that lists all attributes of the ServletContext and gives the ability to change them.

A: Maybe you could use apache commons configuration, specifically have a look at Automatic Reloading...

A: Make use of properties files instead and write code so that it 1) reads the value from it everytime, or 2) can reload the value on command, or 3) reloads the file automatically at certain intervals.
If you put the properties file somewhere in the webapp's runtime classpath or add its path to the webapp's runtime classpath, then you can easily access/load it as follows:
Properties properties = new Properties();
properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("filename.properties"));
String value = properties.get("key");

redpajama_set_name: RedPajamaStackExchange


text:
Q: Gitolite cannot push changes to a repo I made I have managed to setup gitolite on my server and I want push my app into it. So I am doing via:
git push amazon master

And I get the following response:
W access for home/git/repositories/webtags DENIED to git-admin
(Or there may be no repository at the given path. Did you spell it correctly?)
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

My gitolite config is
repo    gitolite-admin
        RW+     =   git-admin

repo    testing
        RW+     =   @all

repo webtags
    RW+ = pc_magas git-admin

And my remotes are:
amazon  mygitserver:/home/git/repositories/webtags.git (fetch)
amazon  mygitserver:/home/git/repositories/webtags.git (push)
openshift   ssh://57364a4c2d5271f0f500007b@webtag-pcmagas.rhcloud.com/~/git/webtag.git/ (fetch)
openshift   ssh://57364a4c2d5271f0f500007b@webtag-pcmagas.rhcloud.com/~/git/webtag.git/ (push)
origin  git@github.com:pc-magas/webtags.git (fetch)
origin  git@github.com:pc-magas/webtags.git (push)

Note that mygitserver is an alias for my server configured in .ssh/config:
Host mygitserver
Hostname ec2-52-30-197-137.eu-west-1.compute.amazonaws.com
IdentityFile ~/id_rsa.pub
User git

Do you know how to push on webtags repo.
Note: Both pc_magas git-admin have my keys.

A: You are pushing using a full path for a repo: /home/git/repositories/webtags.git
This is one of the "bypassing gitolite" issues.
If you want gitolite to refer to its managed webtags.git repo, the url should be:
amazon  mygitserver:webtags.git (fetch)
amazon  mygitserver:webtags.git (push)

Meaning:
cd /path/to/my/repo
git set-url amazon mygitserver:webtags.git

Then gitolite would look for the actual /home/git/repositories/webtags.git.


text:
Q: .globals is not a valid Plugin property I want to integrate the QR code scanner feature in my react-native-based applications.
so I am installing the react-native-vision-camera package.
According to documentation, I have to add globals __scanQRCodes inside babel.config.js

globals: ['__scanQRCodes']

But after adding globals __scanQRCodes inside babel.config.js.
I got BABEL TRANSFORM ERROR
.globals is not a valid Plugin property

A: we need to define the array as shown in the image below, you miss the square brackets like this:
plugins: [
  [
    'react-native-reanimated/plugin',
    { globals: ['__scanQRCodes'] }
  ]
]

see this image for proper understand

A: We need to do this 2 modifications:
  plugins: [
    [
      'react-native-reanimated/plugin',
      { globals: ['__scanCodes'] },
    ],
  ]

And finally:
npx react-native start --reset-cache


text:
Q: Load Data using ajax. Dots issue This is my JSON file:
{
    "d.3.o35.data": {
      "name": "level",
      "value": 113,
    },
    "d.3.o36.data": {
      "name": "level",
      "value": 255,
    },
    "d.3.o37.data": {
      "name": "level",
      "value": 255,
    },
  "updateTime": 1397565031
}

And this is my ajax script:
$.ajax({
    type: "GET",
    url: 'config/json',
    dataType: "JSON",
    async : false,
    success: function(answer) {

        var odp = answer.d.3.o37.data.value
        alert(odp);

    },
    error: function(answer) {
        alert("Error")
    }
});

I want to alert value of any of this but it is not working when dots are JSON objects. How to call objects with dots ?

A: Use brackets:
var odp = answer['d.3.o37.data'].value;

A: either:
var odp = answer['d.3.o37.data'].value;

or:
var odp = answer['d.3.o37.data']['value'];

Also, you should avoid ending JSON objects with a comma, for instance:
{ "name": "level", "value": 113 }

is better than:
{ "name": "level", "value": 113, }

because some JSON parsers will reject the latter and none will reject the former.


text:
Q: Regular expression grep fetch data between salary? E006:Jane:HR:9800:Asst
E005:Bob:HR:5600:Exe
E002:Barney:Purc:2300:PSE
E009:Miffy:Purc:3600:Mngr
E001:Franny:Accts:7670:Mngr
E003:Ostwald:Mrktg:4800:Trainee
E004:Pearl:Accts:1800:SSE
E009:Lala:Mrktg:6566:SE
E018:Popoye:Sales:6400:QAE
E007:Olan:Sales:5800:Asst
E019:Vish:Sales:3400:SE

3rd column is for salary.
List all employees whose salaries are between 2500 and 5500?

A: try:
awk -F: '$4>2500 && $4 < 5500' file


text:
Q: jquery, click on current li only Once clicked on it, I'd like to append a ul element to a li element.
My html is the following:

list 1

list 2

list 3

list 31

list 32

list 33

list 4

list 5

and my javascript:
$('ul').on('click', 'li', function (){
    $(this).append(
        '
'+
            '
list a
'+
            '
list b
'+
            '
list c
'+
        '
'
    )
});

My problem is when I click on a li instead of appending the  element to the current li, it appends it to all the li being in the same scope.
jsfiddle: https://jsfiddle.net/malamine_kebe/Lneyn80w/

A: You have to stop the event which gets bubbled up the DOM tree,
$(document).ready(function(e) {
  $('ul').on('click', 'li', function(e) {
    e.stopPropagation();
    $(this).append(
      '
' +
      '
list a
' +
      '
list b
' +
      '
list c
' +
      '
'
    );
  });
});

DEMO


text:
Q: Assign Table structure to variable in javascript Please consider this structure:
          1   |    2     |    3    | ....
----------------------------------------------------------
2016      100     2000       500
2015      540     450        1200
2014      120     230        660

I want to assign this values to an variable and access to value such this way: MyVar[2016][2] or call a function that return the value for year:2016 and month:2.
What is the best solution to convert that data to structure that can assign it to a variable?

A:

var MyVar = { "2014": [0, 120, 230, 660], "2015": [0, 540, 450, 1200], "2016": [0, 100, 2000, 500] };
console.log(MyVar["2016"][2]); //2000


text:
Q: How to add a paperclip style to 13k images (on AWS S3) without running out of memory? I added two styles (smallcard & mediumcard) to my paperclip attachment model Screenshot :
class Screenshot < ActiveRecord::Base
    has_attached_file :image,
    :styles => { :tiny => "x75", :small => "x245", :medium => "x480", :large => "1280x900>",
                 :smallcard => "280x245#", :mediumcard => "570x480#" },
    :storage => :s3,
    :s3_credentials => "#{Rails.root}/config/amazon_s3.yml",
    :path => "/screenshots/:id_partition/:style/:filename"
end

I hand created a public/system/paperclip_attachments.yml file to reduce processing of pre-existing styles:
---
:Screenshot:
  :image:
    - :tiny
    - :small
    - :medium
    - :large

But still when I run rake paperclip:refresh:missing_styles CLASS=Screenshot I get the following:
Regenerating Screenshot -> image -> [:mediumcard, :smallcard]
rake aborted!
Cannot allocate memory - identify -format %wx%h '/tmp/79a229e96ab52dfa760132958da47bf320120806-31260-1eleoww[0]'
Tasks: TOP => paperclip:refresh:missing_styles
[clip]

When I tail the logs, processing only gets up into the 500s (ids).
The server is admittedly a Linode 512 running Ubuntu and it's been rock solid at serving pages for 3 Rails apps and 1 PHP app for years.  I've never run out of memory on it before.
Monitoring the rake task process, it incrementally grows with each processed image until it eats up all available RAM.
Maybe it's time for my Linode to grow..but first I'm hoping for some other options.
How can I get around this memory issue and add these two styles to the pre-existing 13k images?
Thanks for your help!

A: You need to give your system a chance to free the memory properly.  A bold trick we used when confronted with a similar problem using an ORM for a PHP batch task is this: wrap your task in another task which calls the first task only for one item at a time.  In general, you should refactor the first task to take an argument for the base image. The second task should gather all images (in a memory-friendly way, e.g. object ids or something like that) and then loop through them and call the first task with each as argument.  When the first task ist completed it will return the memory to the os which can then free the memory.  The second or wrapper task on the other hand never needs as much memory at once.  In this way, maximum memory usage should be the maximum for processing one image and not all images.

A: Hopefully this can help someone else having the same issue.
As Chris suggested, I wrapped one rake task inside of another which is called using %x().  Each iteration fully releases the memory from the previous call.
namespace :screenshots do
  desc "Incrementally rebuild thumbnails. START=0 & BATCH_SIZE=10 & VERBOSE=false"
  task :reprocess_stepper => :environment do
    batch_size = (ENV['BATCH_SIZE'] || ENV['batch_size'] || 10)
    verbose    = (ENV['VERBOSE'] || ENV['verbose'] || nil)

    total = Screenshot.count
    start = 0

    while start < total
      puts "Spawning: bundle exec rake screenshots:reprocess_some START=#{start} BATCH_SIZE=#{batch_size} VERBOSE=#{verbose} RAILS_ENV=#{Rails.env}"
      puts %x{bundle exec rake screenshots:reprocess_some START=#{start} BATCH_SIZE=#{batch_size} VERBOSE=#{verbose} RAILS_ENV=#{Rails.env} }
      start = start + batch_size.to_i
    end
  end

  desc "Reprocess a batch of screenshots. START=0 & BATCH_SIZE=10 & VERBOSE=false"
  task :reprocess_some => :environment do
    start      = (ENV['START'] || ENV['start'] || 0)
    batch_size = (ENV['BATCH_SIZE'] || ENV['batch_size'] || 10)
    verbose    = (ENV['VERBOSE'] || ENV['verbose'] || nil)

    puts "start = #{start} & batch_size = #{batch_size}" if verbose
    puts "RAILS_ENV=#{Rails.env}" if verbose

    screenshots = Screenshot.order("id ASC").offset(start).limit(batch_size).all
    screenshots.each do |ss|
      puts "Re-processing paperclip image on screenshot ID: #{ss.id}" if verbose
      STDOUT.flush
      ss.image.reprocess!
    end
  end
end

You can then call this task as follows:
RAILS_ENV=production bundle exec rake screenshots:reprocess_stepper VERBOSE=true BATCH_SIZE=50


text:
Q: How to use variable's value instead of it's identifier? I'm making a program to output the scientific name of specific fruits from input. This is my source:
import time;

fruits={
    "apple":"Malus domestica",
    "banana":"Musa acuminata",
    "orange":"Citrus sinensis",
    "lychee":"Litchi chinensis",
};

fruit=input("Enter a fruit(either an apple, banana, orange, or lychee):");

if fruit in fruits:
    print("Your fruit's scientific name is "+fruits.fruit+"\n");
else:
    print("Sorry, the fruit you entered was not in the database");

But when I enter "orange" as my input into the console, the compiler throws an error message:
Traceback (most recent call last):
  File "<string>", line 13, in <module>
AttributeError: 'dict' object has no attribute 'fruit'
>

Is there any way to use the value of "fruit" rather than use it as a dict element?

A: Use []:
print(f"Your fruit's scientific name is {fruits[fruit]}\n")

A: You should update your code from this:
if fruit in fruits:
    print("Your fruit's scientific name is "+fruits.fruit+"\n");

to this:
if fruit in fruits:
    print("Your fruit's scientific name is "+fruits[fruit]+"\n");


text:
Q: Question Regarding Elementary Differentiation If f(x) and g(x) are two twice differential functions satisfying the following:
f ' (x) ≤ g ' (x) for all x<1 and f ' (x) ≥ g ' (x) for all x>1 then what conclusion(s) can be drawn?
A) if f(1) ≥ g(1) then f(x) ≥ g(x) for all x
B) if f(1) ≤ g(1) then f(x) ≤ g(x) for all x
C) f(1) ≤ g(1)
D) f(1) ≥ g(1)

A: $$f'\le g'\iff (f-g)'\le 0\implies f-g\;\;\text{monotonic descending on certain domain}$$
Try to complete from here.
Addition: thus, in $\;(-\infty,1)\;$ we have $\;f-g\;$ mon. descending, and $\;f-g\;$ mon.  ascending on $\;(1,\infty)\;$ . Can you now see why at $\;x=1\;$ the function $\;f-g\;$ has a global minimal point? And from here that
$$(f-g)(x)\ge (f-g)(1)\;,\;\;\forall x\in\Bbb R$$


text:
Q: The English word "and" Is it ok to start a sentence with the word "and"? Some of my students are challenging that using "and" at the beginning of a sentence is incorrect.

A: It is fine to use "and" or any conjunction in the beginning of a sentence .
Example: I Don't believe in ghosts! And I will stick to this belief until you show me one!

A: It is absolutely okay for someone to use "And" at the beginning of a sentence, so long as he/she has a good handle of the cadence of the English language.


text:
Q: Sigma algebra generated by product of sets = sigma algebra generated by the product of the sigma algebras generated by the sets under this condition? Suppose that $X, Y$ are given non empty sets. Let $C, D$ be collection of subsets of $X$ and $Y$ respectively. Suppose that there exists sequences $\{C_n\}$ (of elements of $C$) and $\{D_n\}$ (of elements of $D$) such that $\cup_n C_n= X, \cup_n D_n=Y$. Then,  $M(C\times D)=M(C)\otimes M(D)$, where $M$('set') means "$\sigma$ algebra generated by the set." $M(C)\otimes M(D)$ is the sigma algebra generated by $M(C)\times M(D)$.
I tried to prove it like this:
It is clear that $M(C\times D)\subset M(C)\otimes M(D)$. For containment in the other direction, define
$\scr E:$$=\{E\in M(C)\otimes M(D): E\in M(C\times D)\}$.
$\scr E$ is non empty as it contains $\emptyset$ and $X\times Y$.
$\scr E$ is an algebra:  For any $E_1, E_2\in \scr E$, $E_1\cup E_2\in \scr E$ and $E_1^c\in \scr E$.
$\scr E$ is a monotone class. So if it is shown that $\scr E$ contains all $A\times B, A\in M(C), B\in M(D)$, then we are done. But I'm not sure how to go from here and how to use $\cup_n C_n=C, \cup_n D_n=D$? Any hints on this please?


text:
Q: Vertical split view and quadrants? In OS X El Capitan is it possible to use split view in anything other than a horizontal configuration.
I usually work with two 1080p monitors side by side meaning that a horizontal split view has little use to me.
In the past I've used Spectacle which has been my go to, until this new feature was introduced (check it out if you're the kind of guy that needs pixel perfect window placement to satisfy your OCD).
Is it possible to have the new split view feature in El Capitan work vertically or even better allow for more split views inside split views (inception) similar to how iTerm2 splitting works?


text:
Q: How to reduce complexity of a long boolean expression? I have a boolean expression to evaluate that is pretty long with a lot of different cases:
return (a && b && c) ||
(d && e && f) ||
...

This should return a boolean!
a, b, c, d, e and f being simple equality comparison and being all different.
This continues for 12 lines and gives me a Cyclomatic Complexity of 44
I tried to look at the Map object in order to reduce the complexity but did not find a way to do it.
How could I reduce the complexity of such an expression ?

A: You can not reduce the complexity of the given expression.
A slower approach, but maybe a little more structured, is to group the expressions and evaluate with Array#some for the outer array and Array#every for the inner arrays with a short circuit.
return [[a, b, c], [d, e, f]].some(a => a.every(Boolean));


text:
Q: How to restart process/rerun code when "exit code 1" error? I have a code.
It works at times; but works when i rerun it a couple of times at times and sometimes the next rerun.
I want to either:

*

*Wait till the process is completely loaded like add a wait()

*Restart the process/rerun this code

Code:
import os
import re
import threading
from math import nan
from multiprocessing.pool import ThreadPool

import pandas as pd
from bs4 import BeautifulSoup as bs
from selenium import webdriver

class Driver:
    def __init__(self):
        options = webdriver.ChromeOptions()
        options.add_argument("--headless")
        # Un-comment next line to supress logging:
        options.add_experimental_option('excludeSwitches', ['enable-logging'])
        self.driver = webdriver.Chrome(options=options)

    def __del__(self):
        self.driver.quit()  # clean up driver when we are cleaned up
        # print('The driver has been "quitted".')

threadLocal = threading.local()

def create_driver():
    the_driver = getattr(threadLocal, 'the_driver', None)
    if the_driver is None:
        the_driver = Driver()
        setattr(threadLocal, 'the_driver', the_driver)
    return the_driver.driver

class GameData:
    def __init__(self):
        self.date = []
        self.time = []
        self.game = []
        self.score = []
        self.home_odds = []
        self.draw_odds = []
        self.away_odds = []
        self.country = []
        self.league = []

def generate_matches(table):
    tr_tags = table.findAll('tr')
    for tr_tag in tr_tags:
        if 'class' in tr_tag.attrs and 'dark' in tr_tag['class']:
            th_tag = tr_tag.find('th', {'class': 'first2 tl'})
            a_tags = th_tag.findAll('a')
            country = a_tags[0].text
            league = a_tags[1].text
        else:
            td_tags = tr_tag.findAll('td')
            if len(td_tags) > 5:  # or just if td_tags
                yield [td_tags[0].text, td_tags[1].text, td_tags[2].text, td_tags[3].text,
                       td_tags[4].text, td_tags[5].text, country, league]

def parse_data(url, return_urls=False):
    browser = create_driver()
    browser.get(url)
    soup = bs(browser.page_source, "lxml")
    div = soup.find('div', {'id': 'col-content'})
    table = div.find('table', {'class': 'table-main'})
    h1 = soup.find('h1').text
    print(h1)
    m = re.search(r'\d+ \w+ \d{4}$', h1)
    game_date = m[0]
    game_data = GameData()
    for row in generate_matches(table):
        game_data.date.append(game_date)
        game_data.time.append(row[0])
        game_data.game.append(row[1])
        # Score present?
        if ':' not in row[2]:
            # No, shift a few columns right:
            row[5], row[4], row[3], row[2] = row[4], row[3], row[2], nan
        game_data.score.append(row[2])
        game_data.home_odds.append(nan if row[3] == '-' else row[3])
        game_data.draw_odds.append(nan if row[4] == '-' else row[4])
        game_data.away_odds.append(nan if row[5] == '-' else row[5])
        game_data.country.append(row[6])
        game_data.league.append(row[7])

    if return_urls:
        span = soup.find('span', {'class': 'next-games-date'})
        a_tags = span.findAll('a')
        urls = ['https://www.oddsportal.com' + a_tag['href'] for a_tag in a_tags]
        return game_data, urls
    return game_data

if __name__ == '__main__':
    results = None
    pool = ThreadPool(5)  # We will be getting, however, 7 URLs
    # Get today's data and the Urls for the other days:
    game_data_today, urls = pool.apply(parse_data, args=('https://www.oddsportal.com/matches/soccer', True))
    urls.pop(1)  # Remove url for today: We already have the data for that
    game_data_results = pool.imap(parse_data, urls)
    for i in range(8):
        try:
            game_data = game_data_today if i == 1 else next(game_data_results)
            result = pd.DataFrame(game_data.__dict__)
            if results is None:
                results = result
            else:
                results = results.append(result, ignore_index=True)
        except ValueError:
            game_data = game_data_today if i == 1 else next(game_data_results)
            result = pd.DataFrame(game_data.__dict__)
            if results is None:
                results = result
            else:
                results = results.append(result, ignore_index=True)
    print(results)
    # print(results.head())
    # ensure all the drivers are "quitted":
    del threadLocal
    import gc

    gc.collect()  # a little extra insurance

print(results)

# noinspection PyTypeChecker because for some reason pycharm shows a warning here.
results.to_csv()

error:
Next Soccer Matches: Sunday, 27 Mar 2022
Next Soccer Matches: Tuesday, 29 Mar 2022
Next Soccer Matches: Saturday, 26 Mar 2022
Next Soccer Matches: Yesterday, 23 Mar 2022
Next Soccer Matches: Tomorrow, 25 Mar 2022
Traceback (most recent call last):
  File "C:/Users/harsh/AppData/Roaming/JetBrains/PyCharmCE2021.2/scratches/scratch_4.py", line 114, in <module>
    game_data = game_data_today if i == 1 else next(game_data_results)
  File "C:\Users\harsh\AppData\Local\Programs\Python\Python37\lib\multiprocessing\pool.py", line 748, in next
    raise value
  File "C:\Users\harsh\AppData\Local\Programs\Python\Python37\lib\multiprocessing\pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "C:/Users/harsh/AppData/Roaming/JetBrains/PyCharmCE2021.2/scratches/scratch_4.py", line 80, in parse_data
    game_date = m[0]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/harsh/AppData/Roaming/JetBrains/PyCharmCE2021.2/scratches/scratch_4.py", line 128, in <module>
    game_data = game_data_today if i == 1 else next(game_data_results)
  File "C:\Users\harsh\AppData\Local\Programs\Python\Python37\lib\multiprocessing\pool.py", line 748, in next
    raise value
  File "C:\Users\harsh\AppData\Local\Programs\Python\Python37\lib\multiprocessing\pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "C:/Users/harsh/AppData/Roaming/JetBrains/PyCharmCE2021.2/scratches/scratch_4.py", line 80, in parse_data
    game_date = m[0]
TypeError: 'NoneType' object is not subscriptable
Process finished with exit code 1

I have observed that when the process is completed, the
Process finished with exit code 1

switches to 0.
How can I restart a loop before this in my code?
How can I do this job better?
But in SO's case, how can I add either wait() or restart the process

A: The problem is in your parse_data function where you are attempting to access the first result of a regex search, when there may have been none found.
To make this more robust, you should add a check, fall back if there are no results and handle nothing being returned.
m = re.search(r'\d+ \w+ \d{4}$', h1)
if m == None:
 return
game_date = m[0]

if it is expected there should always be a result, it may be that the element has not yet loaded and you should implement a wait using WebDriverWait


text:
Q: Successor commands to cy.window not running/working We use d3 components for visualization and moving them around is tricky since they are svg elements and not html elements (for the most part). Thanks to this answer and another link. Following both links I was able to get the nodes moving as expected. This is what worked for me:
const options = { log: false, force: true };

Cypress.Commands.add("moveNode", (nodeIdToBeMoved, targetNodeId) => {
  cy.window().then(options, (win) => {
    cy.getByDataAutomationId(`hierarchy_node_${nodeIdToBeMoved}`)
      .trigger("mousedown", {
        view: win,
        which: 1,
        ...options,
      })
      .wait(1000, options)
      .trigger("mousemove", {
        view: win,
        which: 1,
        ...options,
      })
      .get(
        `g[aut-id="hierarchy_node_${targetNodeId}"] .drop-rect.bottom`
      )
      .trigger("mouseover", {
        view: win,
        which: 1,
        ...options
      })
      .trigger("mouseup", {
        view: win,
        which: 1,
        ...options
      });
  });
});

Running any command right after the moveNode command chained using . operator (and YES both the commands are mentioned in the index.d.ts file) doesn't work. Would like to mention that moveNode works perfectly fine but the successor commands don't work. If I switch the order other way around then everything works but unfortunately I need to make assertions only after move has happened.
The test looks like the following:
    cy
                .clickNode(subChild)
                .getActiveFromInNodeEditor()
                .then((activeFromCtrl) => {
                    let valueBeforeMove = activeFromCtrl.val();
                    cy
                        .moveNode(subChildPos1_OfSubChild1GlobalId, rootPositionGlobalId)
                        .clickNode(parent) // this doesn't work. Any interaction event such as click etc. doesn't work hence the click is still left on the child which was done before moveNode command
                        .getActiveFromInNodeEditor()
                        .should('have.value', valueBeforeMove)
                })

Cypress.Commands.add("clickNode", (id) => {
  cy
  .get(`[aut-id=hierarchy_node_${id}]`)
  .click({
    force: true,
    ...options,
  })
  .wait(100);
});

Running the test using cypress runner, I can see the command was executed but it does nothing. Even hovering over it the Before and After states are exactly the same. The test just passes silently without any error  . Everything works when trying to perform same operations manually.
Any help would be appreciated, thanks!


text:
Q: Regex to extract address street from completed Address I want to extract (address street) from the complete Address. I tried a couple of Regex but it doesn't work for all the Address formats.
I tried with this Regex pattern : (^[0-9]+[\sA-Za-z0-9]+)
pattern1 = r"(^[0-9]+[\sA-Za-z0-9]+)"
addressRegex = re.compile(pattern1)
text = "9207 ASTORIA BLVD, East Elmhurst, NY 11369"
match = addressRegex.search(text)
match.group(0)
>>> 9207 ASTORIA BLVD

but this failing in some cases, can have look at this regex_tester
Below are the samples Address in my documents. I've highlighted the Address street part present in the whole address.
9207 ASTORIA BLVD, East Elmhurst, NY 11369

601 B SURF AVE APT 13N BROOKLYN NY 11224

2241 WESTERN AVE. NORCO CA 92860

89 MILFORD ST BUFFALO NY 14220

5550 SPRING VALLEY RD. G-25. DALLAS. TX 75254

865 Branford Lane NW Lilburn, GA 30047

273-A MONMOUTH STREET, JERSEY CITY, NJ 07302

1501 OCEAN AVENUE, UNIT 2605, ASBURY PARK, NJ 07712

879 TOMPKINS AVE STATEN ISLAND NY 10305

601 B SURF AVE BROOKLYN NY 11224

3301 NORTH 88TH STREET MILWAUKEE WI 53222

2012 RICHVIEW RD MOUNT VERNON IL 62864

A: Maybe the below can capture the street part of your address. You can try capture your alternatives into an alternation:
^.*?\b(?:BLVD|AVE(?:NUE)?|ST(?:REET)?|R(?:OA)?D|LANE)\b

Expand these alternations if need be, see the online demo.

*

*^ - Start string anchor.

*.*? - Lazy match of any character other than newline upto;

*\b - Word-boundary.

*(?: - Open non-capture group:
BLVD|AVE(?:NUE)?|ST(?:REET)?|R(?:OA)?D|LANE - All currently given alternatives of streetname endings.

*

*) - Close non-capture group.

*\b - Word-boundary.

A: I assume the first number that comes in the address is street no, below code extract first no from the string. I am sending you an example
str = "601 B SURF AVE APT 13N BROOKLYN NY 11224"
import regex as re
addressNo = []
addressNo.append(re.search(r'\d+', str).group())

You can extract all street numbers using a loop.


text:
Q: How to get user list of my FB application? (v2.8) My FB application only ask basic permission(uesr_id, user_name), and I want to get the user list of who gives permission to my FB application. (version 2.8)
Further, the final purpose is if I get a user_id today, through compare with my application user list, I can know if this guy is my application user or not.
To get this purpose, I tried Graph API and ask extra permission, if the user didn't show extra value, then he/she isn't my application user.
But, I don't wanna ask user extra permission on my online application, so I only have basic one(id and name), which could get them from any user...
I'm a little bit good at javascript but suuuuuper bad at php or other server-side language, so if the answer could be handle by javascript will be nice, but I think it can't, though.


text:
Q: Removing columns from query I have several tables with 4 columns which are always present, and an indeterminate number of columns generated automatically with random names. Given that "SELECT * EXCEPT xyzcol" doesn't exist, what would be the easiest way to go about retrieving only the automatically-generated columns?

A: Since you don't know the column names, you should go dynamic.
DECLARE @SQL VARCHAR(MAX)='';

SELECT @SQL = @SQL+QUOTENAME(COLUMN_NAME)+',' FROM (
SELECT COLUMN_NAME,ORDINAL_POSITION FROM
INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME ='ADDRESS'
AND ORDINAL_POSITION>4 --SKIPPING FIXED 4 COLUMNS HERE
)A
ORDER BY ORDINAL_POSITION

SELECT @SQL = 'SELECT '+LEFT(@SQL,LEN(@SQL)-1)+ ' FROM [ADDRESS]'

EXEC(@SQL)

I will always keep a dynamic script for creating INSERT script handy for a quick insert in support days.


text:
Q: SQL server 2016 Getting distinct results when only limited to a where statement I am looking for a distinct list of the CUSTOMER_NAME field from my table. Normally I would simply do
SELECT

      distinct
         [CUSTOMER_NAME]

  FROM [iData3].[dbo].[N241650]

or
SELECT

         [CUSTOMER_NAME]

  FROM [iData3].[dbo].[N241650]

Group by [CUSTOMER_NAME]

But I am limited in my query. Due to software restrictions, the query can only be of the form
SELECT * from
[iData3].[dbo].[N241650]
where ...

How do I get a distinct list of customer names given these restrictions? I essentially need to cram everything into the WHERE clause. I'm thinking possibly WHERE EXISTS or NOT EXISTS but I haven't used those conditions before so I'm not certain if they'd be useful.
This is not possible because... is acceptable if the disappointing answer.

A: You can use row_number() function :
SELECT TOP (1) WITH TIES [CUSTOMER_NAME]
FROM [iData3].[dbo].[N241650]
ORDER BY ROW_NUMBER() OVER (PARTITION BY CUSTOMER_NAME ORDER BY ?)

? indicates something identity or primary/unique column which you have.

A: You need something unique in each row.  If you have that, you can use:
SELECT CUSTOMER_NAME
FROM [iData3].[dbo].[N241650]
WHERE pk = (SELECT MIN(n2.pk)
            FROM [iData3].[dbo].[N241650] n2
            WHERE n2.CUSTOMER_NAME = N241650.N241650
           );

pk is the unique column.

A: You can group by that column to achieve the same result.
select CUSTOMER_NAME
from ...
group by CUSTOMER_NAME
order by CUSTOMER_NAME;

Another alternative is to use a stored procedure.

A: If you can't escape from the *, then you can't GROUP BY and if you just have a WHERE then you will need a key (unique set of columns) to be able to filter correctly or else you can't differentiate dupicates (and end up selecting more than 1 row with the same customer name).
It's a bit convoluted, but try with this. It will get you 1 row per each CUSTOMER_NAME.
SELECT
    *
from
    [iData3].[dbo].[N241650]
where
    [N241650].KeyColumn IN
    (
        SELECT
            Z.KeyColumn
        FROM
            (
                SELECT
                    X.KeyColumn,
                    Ranking = ROW_NUMBER() OVER (PARTITION BY X.CUSTOMER_NAME ORDER BY X.KeyColumn ASC)
                FROM
                    [iData3].[dbo].[N241650] AS X
                WHERE
                    X.KeyColumn IS NOT NULL
            ) AS Z
        WHERE
            Z.Ranking = 1
    )

The ORDER BY inside the OVER will determine which row you get for each CUSTOMER_NAME.
If you have multiple columns for your key, then you will have to switch the IN for an EXISTS against multiple columns (you can't do a multiple column IN in SQL Server).
SELECT
    *
from
    [iData3].[dbo].[N241650]
where
    EXISTS (
        SELECT
            'key columns match'
        FROM (
            SELECT
                X.KeyColumn1,
                X.KeyColumn2,
                Ranking = ROW_NUMBER() OVER (PARTITION BY X.CUSTOMER_NAME ORDER BY X.KeyColumn1 ASC)
            FROM
                [iData3].[dbo].[N241650] AS X
            ) AS Z
        WHERE
            Z.Ranking = 1 AND
            [N241650].KeyColumn1 = Z.KeyColumn1 AND
            [N241650].KeyColumn2 = Z.KeyColumn2
    )


text:
Q: flutter project - calling kotlin native code to flutter hi im getting this error while putting a native code to flutter native side . seems like a java error but i tried several methods to clear out the error but couldn't do it . now i'm getting this error
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDevDebugJavaWithJavac'.
> Could not resolve all files for configuration ':app:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: C:\Users\yasmitha_local\AppData\Local\Android\Sdk\platforms\android-33\core-for-system-modules.jar.
         > jlink executable C:\Program Files\Java\jdk1.8.0_301\bin\jlink.exe does not exist.

android {
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.google.gms:google-services:4.3.13'
        classpath 'com.android.tools.build:gradle:7.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.epic.digiface">

    <application
        tools:replace="android:label"
        android:name="${applicationName}"
        android:label="digiface"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="false"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"


text:
Q: Dynamic provider for singleton - Angular 7 I have an angular application which can display lists of videos or articles and video's details or article's details.
I got ContentListPage and ContentDetailsPage which are the same for videos or articles .
The only difference is located on services layer which basically get data from youtube or from worpress.
I would like to have only one generic service dynamically provided depending on current content type.
I'm able to have dynamic provider but as I'm using factory provider, A new service instance is created each time a component is created.
My main attempt was based on factory provider
So I define what kind of service should be provided into the useFactory.
This is working well but when I navigate from ContentListPage to ContentDetailsPage a new instance of the service is be created.
I know that this is due to the way I provide service
@Component({
  . . .
  providers: [contentServiceProvider]
})

But I can't find how to provide on another level without back side effect.
content.service.provider.ts
const contentServiceFactory = (http: HttpService, metaMediaService: MetaMediaService) => {

  let contentService;
  if (metaMediaService.currentMetaMedia.type === MetaMediaType.WORDPRESS) {
    contentService = new MediasService(http, metaMediaService);
  } else {
    contentService = new YoutubeService(http, metaMediaService);
  }
  return contentService;
};

export let contentServiceProvider = {
  provide: ContentService,
  useFactory: contentServiceFactory,
  deps: [HttpService, MetaMediaService]
};

@Component({
  . . .
  providers: [contentServiceProvider]
})
export class ContentListPage implements OnInit {

  constructor(public mediasService: ContentService<IContent>) {

content-details.page.ts
@Component({
  . . .
  providers: [contentServiceProvider]
})
export class ContentDetailsPage implements OnInit {

  constructor(public contentService: ContentService<IContent>) { }

content.service.ts
@Injectable({
  providedIn: 'root'
})
export abstract class ContentService<T extends IContent> {
  abstract getContentById(id: number): Observable<T>;
  abstract  getContents(): Observable<T[]>;
  abstract loadMore(): Observable<T[]>;
}

A: Asking to a friend some advice, we conclude on using injector:
const contentServiceFactory = (metaMediaService: MetaMediaService, injector: Injector) => {
  if (metaMediaService.currentMetaMedia.type === MetaMediaType.WORDPRESS) {
    return injector.get(MediasService);
  } else {
    return injector.get(YoutubeService);
  }
};

export let contentServiceProvider = {
  provide: ContentService,
  useFactory: contentServiceFactory,
  deps: [MetaMediaService, Injector]
};


text:
Q: Nginx config order of operations Apologies if this is answered or documented already but I was confused on this so I'm hoping the community can provide some insight.
The below example is specifically for proxy_pass and proxy_set_header config directives, but my overall question is more of a "How does Nginx config handle ordering in general?" type of question.
I came across some working nginx config, with a location block such as this:
  location / {
    proxy_pass http://internal.example.com/req;

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header X-Forwarded-User $auth_resp_x_user;
  }

This confused me since I've always been under the impression that ordering matters, and the headers would need to be set BEFORE the proxy_pass line. Such as this:
  location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
    proxy_set_header X-Forwarded-User $auth_resp_x_user;

    proxy_pass http://internal.example.com/req;
  }

Questions:

*

*Does the ordering actually matter?

*If it doesn't matter here, is that specific to proxy_pass? It does matter in other nginx config lines, correct?

*Is this type of ordering/precedence documented anywhere? (Sorry if it is, I'm not seeing it)

Thank you for any insight and help.

A: In general, nginx configuration is declarative. This means, every configuration directive has an effect of certain separately defined processing step in handling a request.
This means that in general the order of directives inside a specific scope does not matter.
However, there are exceptions to the general rule:

*

*location blocks that match regular expressions are dependent on order. The first matching block is used to process the request.

*rewrite module processes directives imperatively
The only reference for this fact I could find is in IfIsEvil article.


text:
Q: How to return a custom HTTP code in a Restler request? I would like to return code 201 Created in some cases in my API. How can I do this?

A: I discovered accidentally that adding @status «code» to the method documentation alters the success response code, as follows:
/**
 * Creates a post.
 * @status 201
 *
 * @param string $title {@from body} Post title
 * @param string $message {@from body} Post body
 */
protected function post($title, $message) {
    return Posts::create(compact('title', 'message'));
}

A: Disclaimer - As I have been informed not the correct way to do it for restler but in general with php for custom status messages this is what you would do:
User header
header("HTTP/1.0 201 Created");


text:
Q: Workaround for more REST verbs I'm developing a game website where accounts have characters. I'm using the routes:
account/{action} //execute `action` on the current account
character/{name}/{action} //execute `action` on specific character

But I need to delete and undelete (they are soft-deleted) characters, and while using a form is the right way for delete, it becomes unnecessary (is it?) bloat when I can use just a GET link to character/{name}/delete. Also, there is no verb for undeleting/restoring.
What is the correct and easy way (or both if there isn't the perfect way) to workaround this?

A: You could have a RESTful version if your URLs have nouns instead of verbs, such as :
character/{name}/achievements or

character/{name}/travels

To solve your active/inactive account problem, you could do :
GET/PUT account/activity

A: Already not restful, in which you are determining the action based on the route, not based on the verb. So that said, make a new route that is undelete (i.e. character/{name}/undelete), your already not REST so another route shouldn't matter. If you are looking for RESTful then the route should stay account/{character} and the verb determines the action(i.e. GET,PUT, POST DELETE to the same route). Now since you are not actually deleting, I would learn towards a POST (or perhaps PUT) for both i.e. updaing the entity to delete (or inactive), or updating it to undelete (active again)


text:
Q: :checked not working in css with pseudo elements I am working on project where my html is generated by drupal so I  cant modify my Html files.i am stuck at problem where I need to make a customize check box ,though I made a checkbox but I am not able to make a check mark on it.
Here is my code

#login-nav input[type="checkbox"] {
    display: none;
}

#login-nav input[type="checkbox"] label:before {
    padding: 0;
    position: absolute;
}

#login-nav input[type=checkbox]+label:before {
    background-color: #fff;
    border: 1px solid #444;
    content: "";
    font-family: "Arial";
    font-style: normal;
    height: 16px;
    left: 0;
    line-height: 16px;
    margin-right: 0;
    padding-left: 2px;
    position: absolute;
    top: 3px;
    width: 16px;
    font-size: 12px;
}

#login-nav input[type=checkbox]:checked~label::after {
    background-color: rgb(107, 194, 0);
    color: rgb(255, 255, 255);
    content: "✔";
    border-width: 1px;
    border-style: solid;
    border-color: rgb(107, 194, 0);
    border-image: initial;
    position: absolute
}
<form class="form" id="login-nav">

    <input type="checkbox">
    Remember me
      Forgot password?

 </form>

A: Instead of using display: none on your input, use opacity: 0 to hide the checkbox. This way, the checkbox is still clickable. Then, set the dimensions of your input[type="checkbox"] to match your styled input (16px width and height) and make sure that the actual checkbox is rendered on top of the styled one (using position: relative and z-index : 1) so it can still receive click events.

#login-nav .checkbox {
  position: relative;
}

#login-nav input[type="checkbox"] {
    position: relative;
    opacity: 0;
    z-index: 1;
    width: 16px;
    height: 16px;
    margin-top: 3px;
}

#login-nav input[type="checkbox"] label:before {
    padding: 0;
    position: absolute;
}

#login-nav input[type=checkbox]+label:before {
    background-color: #fff;
    border: 1px solid #444;
    content: "";
    font-family: "Arial";
    font-style: normal;
    height: 16px;
    left: 0;
    line-height: 16px;
    margin-right: 0;
    padding-left: 2px;
    position: absolute;
    top: 3px;
    width: 16px;
    font-size: 12px;
}

#login-nav input[type=checkbox]:checked~label::before {
    background-color: rgb(107, 194, 0);
    color: rgb(255, 255, 255);
    content: "✔";
    border-width: 1px;
    border-style: solid;
    border-color: rgb(107, 194, 0);
    border-image: initial;
}
<form class="form" id="login-nav">

    <input type="checkbox">
    Remember me
      Forgot password?

 </form>


text:
Q: JavaScript Create Calendar Table in DOM I have created a table with 6 rows and  5 cols. The table is created for each month having presumably  different number of days. I would like each col to display a date from 1-30 or 1-31 (depending on the month).
This is what  I have so far:
function daysOfMonth(){
  var table= " ";
  var rows= 3;
   var cols=6;
  var number= 31;
  for(var r=0; r<rows; r++){
    table+= "
";
        for(var c=0; c<=cols; c++){
                table+= "" + c +"	"
      // each col should display number for(var i=0l i<=number; i++)
    }

table+= "
"
 }
document.write('
' + table +"
")

};// func end

Here is a codepen   http://codepen.io/cb42/pen/KNJWrd

A: As i've see your code get two little bugs, solved in my simple example.
By this poin could you try to make it better. But i expect it helps you to understand how to make a calendar.
https://jsfiddle.net/cyzbhkjs/
function daysOfMonth(){
  var _table= "
jol
 ";
  var rows= 5;
   var cols=6;
  var c= 1;
  var daysMonth =31;
  for(var r=0; r<rows; r++){
    _table+= "
";
        for(var i=0; i<=cols; i++){
        if(c<=daysMonth){
            _table+= "" + c +"	";
        }else{
        break;
        }

          c++;
      // each col should display number at i
    }

_table+= "
";

 }
 document.getElementById('calendar').innerHTML = '
hola' + _table +'
';

};
  daysOfMonth();

Thanks


text:
Q: search filter add priority to post_type and add order to some post_type I don't want to change the core SEARCH function. I have default search function and only updating search.php file in the theme. I added search_filter function into functions.php.
function search_filter($query)
{
    if (!is_admin() && $query->is_main_query()) {
        if ($query->is_search) {
            $query->set('post_type', array('page', 'post', 'fsgallery'));
            $query->set('order', array('post_date' => 'DESC'));
        }
    }
}
add_action('pre_get_posts', 'search_filter');

I have 3 post_type in my Wordpress and I want to show all page result first and then combine POST and GALLERY results with ordered by date.
Right now order by DESC result shows everything by ordered and could not show page first.
What I need is:
I want to show all page result first. After that I want to show post and gallery ordered by date.

A: Here is the code from the provided link after adaptation.
add_filter( 'posts_orderby', 'se344727_custom_search_order', 10, 2 );
function se344727_custom_search_order( $orderby, $query )
{
    global $wpdb;

    if (!is_admin() && $query->is_main_query())
    {
        if ($query->is_search)
        {
            // -- sort by: type, title, date --
            // " ELSE 2 END ASC, " . $orderby;

            // -- sort by: type, date --
            // " ELSE 2 END ASC, {$wpdb->prefix}posts.post_date DESC;

            $orderby =
                " CASE WHEN {$wpdb->prefix}posts.post_type = 'page' THEN 1 " .
                " ELSE 2 END ASC, " .
                $orderby;
        }
    }
    return $orderby;
}


text:
Q: How to add border-radius to an embedded youtube video? This is what I have so far. No matter how I add the border-radius property, it has no effect.

    .videotar_video
    {
        border: solid white;
        border-top-width: 15px;
        border-bottom-width: 15px;
        border-left-width: 28px;
        border-right-width: 28px;
        position: relative;
        padding-bottom: 56.25%; /* 16:9 */
        padding-top: 5px;
        height: 0;
    }
    .videotar_video iframe
    {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

http://jsfiddle.net/FUBnc/

A: You can do something like this
.videotar_video
{
border: 1px solid #000000;
border-top-width: 15px;
border-bottom-width: 15px;
border-left-width: 28px;
border-right-width: 28px;
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 5px;
height: 0;
marging: 10px;
border-radius: 10px;
background: #000000
}
.videotar_video iframe
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

http://jsfiddle.net/4Vqp3/

A: Use Border-radius in your css
.videotar_video
    {
border-radius:5px 5px 5px 5px;
}

A: Small but beautiful trick.
iframe,
object,
embed{
    border:5px solid rgba(255,255,255,0);
    -webkit-border-radius: 20px !important;
    -ms-border-radius: 20px !important;
    -o-border-radius: 20px !important;
    border-radius: 20px !important;
}

DEMO


text:
Q: SELECT a value and store it in a PHP $_SESSION variable before I leave a page? Is there a way of having a user select an item from an HTML SELECT dropdown and then store it in a $_SESSION variable before they navigate away from a page?  I know the obvious way is to get the FORM to return to the same page and then check for the variable being set, but I'm trying to modify something that someone else has done without a major rewrite!
I.e. can a session variable be set whose value changes depending on the user's SELECT option without reloading the page?
All help much appreciated.

A: That is called AJAX.
http://nl.wikipedia.org/wiki/Asynchronous_JavaScript_and_XML
But there is no pure PHP way because PHP is serverside only.
So you will have to resort to javaScript.

A: You would need to use AJAX to do this.

A: The only way you can modify the $_SESSION variable without reloading the page is to do an async request (i.e. AJAX).
Technically, you can't modify the session variable from the client side. This means that one way or another you need to make a request to the server - either by reloading the page, posting to a different page, or making an out of bound request using Ajax.

A: You will need to make a AJAX request to the script from the HTML, you could use jQuery*
$(document).ready(function()
{
    $("#dropdown").change(function()
    {

       var link = 'updateSession.php?value_to_update='.$(this).val();

        $.ajax({
        url: link,
        type: "GET",
        dataType: "html",

        success: function(html)
        {
               $('#message').html(html);
        }
   });
    });
});

*other JavaScript libraries are available

A: On your HTML file you have this jquery / javascript code:
    $(document).ready( function() {
        $("#my_select").change( function() {
            // alert($(this).val());
            url = "MyPage.php";
            var myData = {};
            myData['my_select'] = $(this).val();
            jQuery.get( url, myData, function(data)
            {
                // console.log(data);
                // the placeholder where you wanted to show it
                $("#my_session_select_value").html(data);
            });
        });
    });

and on your php file (which stores the session value) you have this code:
    session_start();
    $_SESSION['my_select'] = $_GET['my_select'];
    // if you wanted a json encoded result
    // echo json_encode($_SESSION);
    // if you wanted a direct value
    echo $_SESSION['my_select'];


text:
Q: ClassCastException when using HQL See the following mapping
public class SomeClass {

    private Integer someField;

}

When i call the following query
select someField, count(*) from SomeClass inner join OtherClass... group by ...

And i proccess the query as follows
Map<Integer, Integer> result = new HashMap<Integer, Integer>();

List<Object> objectList = query.list();
for(Object object: objectList) {
    Object [] objectArray = (Object []) object;

    result.put((Integer) objectArray[0], (Integer) objectArray[1]);
}

I get ClassCastException: can not convert Long to Integer
Question: what should i do to retrieve the values returned by the HQL as Integer instead of Long ????

A: If you don't know which it will be (Integer or Long), you can cast to Number and call intValue() or longValue().  This way an Integer or a Long will work.
result.put((Integer) objectArray[0], ((Number) objectArray[1]).intValue() );

The small downside with this is you end up unboxing the Number and reboxing it to put in the map.

A: I guess the second column in the result - i.e. count(*) returns Long. You can get its int value by ((Long) objectArray[1]).intValue()
Or (as suggested), better change your map to Map<Integer, Long>, so that no information is eventually lost.


text:
Q: Value outside function doesn`t match inside function, C Please, I got a problem and I need help.
Got struct (stack):
struct sAddress {
    tBSTNodePtr *data;
    struct sAddress *pointer_next;
}*ads_stack;

then I have PUSH function
void pushAds(tBSTNodePtr hodnota)
{
    struct sAddress *temp;
    temp = (struct sAddress*)malloc(sizeof(struct sAddress));
    temp->data = &hodnota;
    if (ads_stack == NULL) {
        ads_stack = temp;
        ads_stack->pointer_next = NULL;
    }
    else {
        temp->pointer_next = ads_stack;
        ads_stack = temp;
    }
    printf("PUSH ADS KEY: %s\n", ads_stack->data->Key->str);
}

When I push something (in tBSTNodePtr ofcourse) it will print value of Key->str properly. But when I try to printf the same outside the function like this:
printf("STACK DATA: %s\n", ads_stack->data->Key->str);

It will give me segfault (tried on Win 8.1 under codeblocks, and under Fedora using makefile). What I do wrong? Are pointers wrong? ads_stack is not NULL outside push function.

A: The problem is that
temp->data = &hodnota;

is refering to the address of the local variable hodnota (which is a param received).
could you explain what tBSTNodePtr is?
temp->data is a tBSTNodePtr *, and in your function you receive a tBSTNodePtr, not a tBSTNodePtr *. if you use &hodnota you will be referencing the address of the local parameter, when you leave your function it is out of scope, that variable doesn't exist anymore.
You should:

*

*Pass a pointer to tBSTNodePtr

*create a copy of hodnota inside your function

But maybe it all depends on what tBSTNodePtr is if it is a pointer to a BSTNode, then probably you should change other things. Probably changing the struct removing the * in data and changing temp->data = &hodnota; to temp->data = hodnota;
As a side note:
temp = (struct sAddress*)malloc(sizeof(struct sAddress));

The cast to struct sAddress * isn't mandatory in C. You can avoid it. Maybe something like:
temp = malloc(sizeof *temp);

looks better.

A: replace void pushAds(tBSTNodePtr hodnota)  by void pushAds(tBSTNodePtr *hodnota)
if you want to use hodnota struct to read parameter in your main function
but if you want to change hodnota struct you have to use void pushAds(tBSTNodePtr **hodnota)
and then replace temp->data = &hodnota; by temp->data = *hodnota;


text:
Q: Flutter textfield design like image I need to know, how do I make a textfield or textformfield like the image.

A: I have put together a simple code just to give you an idea.
  Container(
    decoration: BoxDecoration(
      border: Border.all(width: 1, color: Colors.purple),
      borderRadius: BorderRadius.circular(radius),
    ),
    child: IntrinsicHeight(
      child: Row(
        children: <Widget>[
          Container(
            decoration:
                BoxDecoration(color: Colors.purple, borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius))),
            child: Center(
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("BROWSE"),
              ),
            ),
          ),
          Flexible(
            child: Padding(
              padding: const EdgeInsets.symmetric(horizontal: 8.0),
              child: TextField(
                decoration: InputDecoration(border: InputBorder.none, hintText: "Choose your pic", hintStyle: TextStyle(color: Colors.purple.shade400)),
              ),
            ),
          ),
        ],
      ),
    ),
  )

which looks like

A: I will give you tips how to make it , You can use card widget and List tile , the rest of it is easy .
for example :
Card(
    child: Column(
      mainAxisSize: MainAxisSize.min,
      children: <Widget>[
        const ListTile(
          leading: here to put image,
          title: Here to put textfild,
          subtitle: extra text,
        ),
      ],
    ),
  );


text:
Q: how do i Assigning Timage bitmap to jpg correctly? i am doing the following to resize a Timage graphic and save it as jpg . the image saved blank .
here is how i assign the Timage
begin
 with TOpenDialog.Create(self) do
    try
      Caption := 'Open Image';
      Options := [ofPathMustExist, ofFileMustExist];
      Filter  := 'JPEG Image File (*.jpg)|*.jpg|JPEG Image File (*.jpeg)|*.jpeg|Bitmaps (*.bmp)|*.bmp';
      if Execute then
        image1.Picture.LoadFromFile(FileName);
    finally
      Free;
    end;
end;

and here is how i resize the timage and assigning it into a jpg .
 with Image2.Canvas do begin
    Lock;
    try
      try
        Image2.Picture.Graphic.Width := 50;
        Image2.Picture.Graphic.Height := 50;
        FillRect(ClipRect);
        StretchDraw(rect(0, 0, 50, 50), image1.Picture.Bitmap);
      except
        on E: Exception do
//log

      end;
    finally
      Unlock;
    end;
  end;

Jpg := TJPEGImage.Create;
try

Jpg.Performance := jpBestSpeed;
Jpg.ProgressiveEncoding := True;
Jpg.ProgressiveDisplay := True;
Jpg.Assign(image2.Picture.Bitmap);
Jpg.CompressionQuality := 90;
Jpg.Compress;
jpg.SaveToFile('screena.jpg');

finally
Jpg.Free;
end;

The saved jpg becomes blank what i am doing wrong ? all i needed to do is load image from disk into Timage then adjust the width and height and assign it again into a jpg

A: The reason your image is blank is because you are using the Picture.Bitmap property when drawing Image1 onto the canvas of Image2:
StretchDraw(rect(0, 0, 50, 50), image1.Picture.Bitmap);

If you have NOT loaded a .bmp file into Image1, accessing the Bitmap property will wipe out the current image and replace it with a blank image.  This is documented behavior:

Use Bitmap to reference the picture object when it contains a bitmap. If Bitmap is referenced when the picture contains a Metafile or Icon graphic, the graphic won't be converted (Types of Graphic Objects). Instead, the original contents of the picture are discarded and Bitmap returns a new, blank bitmap.

The TCanvas.StretchDraw() method accepts any TGraphic object in its 3rd parameter.  You should be passing in the Picture.Graphic property instead of the Picture.Bitmap property:
StretchDraw(rect(0, 0, 50, 50), image1.Picture.Graphic);

On a side note: When assigning the TOpenDialog.Filter property, consider using the VCL's GraphicFilter() function in the Graphics unit:

Returns a file filter compatible with the Filter property of an Open or Save dialog.
Call GraphicFilter to obtain a value for the Filter property of an Open, Open Picture, Save Picture or Save dialog box. The GraphicClass parameter can specify one of these values: TBitmap, TGraphic, TIcon, TMetafile, or a user-defined descendant of TGraphic.

For example:
Filter := GraphicFilter(TGraphic);

If you are going to populate the Filter manually, then at the least, don't have separate entries for the different JPEG extensions.  Group them together in a single entry, eg:
Filter  := 'JPEG Images (*.jpg, *.jpeg)|*.JPG;*.JPEG|Bitmap Images (*.bmp)|*.BMP';


text:
Q: Upgrade Laravel 5.3 to Laravel 8 What is the easiest and fastest way to upgrade code from Laravel 5.3 to Laravel 7.3 or 8 ? Is there a tool which can do that for me ? How long does it take to do that?
Please help .
Regards

A: The easiest way is to follow the documentation by laravel, best way is to upgrade to the next version, for example in your situation upgrade to 5.4, when everything is working, and all composer packages are upgraded to the right version, then move on to 5.5 etc...
heres a place to start : https://laravel.com/docs/5.4/upgrade#upgrade-5.4.0
and you can just change version in top right corner to get upgrade for the next version.
keep in mind you gonna have to keep upgrading manually packages versions in your composer.json to the proper versions, so just analyze the error codes you gonna be getting.
if theres a tool to help with that, then I dont know about it, hopefully next person does.


text:
Q: Not able to execute Selenum Grid for Chrome Windows I am using Workspaces. A glimpse of my code is as:
@BeforeMethod:
driver= gridChrome();

WebDriver gridChrome() {
System.setProperty("webdriver.chrome.driver","/absolute/path/to/chrome/driver");
DesiredCapabilities chromeCapabilities = DesiredCapabilities.chrome();
chromeCapabilities.setPlatform(Platform.WINDOWS);
chromeCapabilities.setVersion("67.0");
return (new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), chromeCapabilities));
}

Workspace INFO:
OS: Windows Server 2008 R2
Local IP:172.xxx.xxx.xxx
Hub:
(selenium-server-jar-directory)>java -jar selenium-server-standalone-3.13.0.jar -role hub
(The IP shown is: 198.xxx.xxx.xxx)
Node:
(selenium-server-jar-directory)>java -jar selenium-server-standalone-3.13.0.jar -role node -hub http://localhost:4444/grid/register
The hub and node are created effectively. The thing is, I am able to execute the same piece of code in my local system, but not in my workspaces. Also I find two different IP's. I tried creating hub and node with them too, but to no fruition.
The Exception thrown is:
org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities {browserName: chrome, platform: WINDOWS, version: 67.0}.
Another question:
The function call DesiredCapabilities.setVersion(), for which parameter it sets version to, i.e Selenium Driver or Browser or Platform?
Any help would be appreciated.
Thanks.

A: Try to execute this command while connecting node to hub on workspace.  :
I have tried it on AWS workspace and it is working.
java -Dwebdriver.chrome.driver="C:\Users\jk001119\Desktop\LATEST-SET-UP-GRID\chromedriver.exe" -jar selenium-server-standalone-3.3.1.jar -role node -hub http://192.168.11.28:4444/grid/register -browser "browserName=chrome,version=56,platform=WINDOWS"

For connecting with different set of browsers you can use command like this :
java -Dwebdriver.chrome.driver="C:\Users\jk001119\Desktop\LATEST-SET-UP-GRID\chromedriver.exe" -Dwebdriver.ie.driver="C:\Users\jk001119\Desktop\LATEST-SET-UP-GRID\IEDriverServer.exe" -Dwebdriver.gecko.driver="C:\Users\jk001119\Desktop\LATEST-SET-UP-GRID\geckodriver32bit.exe" -jar selenium-server-standalone-3.3.1.jar -role node -hub http://192.168.11.28:4444/grid/register -browser "browserName=chrome,version=56,platform=WINDOWS", -browser "browserName=internet explorer,version=11,platform=WINDOWS", -browser "browserName=firefox,version=52,paltform=WINDOWS"

You can remove DesiredCapabilities :
chromeCapabilities.setPlatform(Platform.WINDOWS);
chromeCapabilities.setVersion("67.0");
Hope it helps you.


text:
Q: Are there cases when the word "best" as an adjective could be used without "the"? That is an advertisement of one company, a banner. They write the name of the company and the second line goes like this "best ad designs".
Is this line correct? or should there be a "the"? Is there a general rule to put "the" before the adjective "best" or are there cases when "the" is not needed?

A: Superlative adjectives are normally preceded by the, but for reasons of brevity and snappiness, headlines, slogans and banners often omit words that would occur in formal prose. That seems to be what is happening here.

A: Banner English is similar to headline English: it's telegraphic and filled with omissions because the point of the language is to communicate the key concepts as quickly and briefly as possible, not to produce a grammatically correct complete sentence. For the banner, the English is perfect. For a formal written sentence, you'd probably want to say These are the best {advertisement designs / designs from advertisements}. [I see that Barrie England and I agree 100% on this one.]
If the noun phrase modified by best follows best, then you normally use the article, e.g., "Here are the five choices. This is the best choice". If it doesn't, then you can omit the article, e.g., "Here are the five choices. This is {best / the best}".

A:
"I am so nervous about asking a question on that tough ELU site. What is going to happen?
"Best case scenario, you will simply get a helpful answer. My best guess is that you may also get a bit of attitude."

A: I know there are cases when we do not use the definite article before best (as an adjective) and it is not in headlines and the noun is not omitted:
NerdWallet's list of best 529 plans by state is available for those who live in these states. here are the examples, I am trying to figure out the general rule for this:
ONE of best things about East 50's is that it is as ordinary as it is extraordinary.
You may be asking yourself what kind of dog or cat would be best for your lifestyle.
You have a lot of options for cooking oils. Some are better at certain temperatures, others are best with certain types of food. MyFitnessPal's chart goes through the best oils to use for different types of cooking, then details what types of cooking uses they're best for and some extra nutritional information.
For example, avocado oil's great for searing meat and has a good amount of vitamin E, while sesame oil is best for low-heat stir fry but doesn't have much in the way of vitamins..
Any idea about how to generalize this?


text:
Q: What makes NSdata advantageous? I've been looking through the apple documentation for the NSdata class, and I didn't really find it too enlightening. I know how to use the class but I don't really understand the gravity of the advantages that it may or may not provide. I know its a simple question but perhaps it would be good to have such information as a reference.

A: Advantages over what? Certainly, it's useful to represent an arbitrary block of data as an object just as it's useful to represent a string, a number, or a value as an object. Memory management becomes simpler and is consistent with memory management for all other objects, and there are a number of useful methods defined.
Say you want to read a binary file into memory. We won't worry about the reasons why -- there are as many reasons as there are data file formats. You'll have to:

*

*Check the size of the file

*Allocate a block of memory of the proper size

*Open the file

*Read the contents into memory

*Close the file

*Remember to free the memory when you're done with it (a condition that can sometimes be tricky to detect)

*(Optional) Worry about whether the block of memory has been modified

With NSData, you can just create a new instance from a path or URL and not have to think about the rest.


text:
Q: C++ Method called by JNA How can I convert C++ method :
public (void) BinToSlices (BSTR Bin,LPSAFEARRAY FAR *Slices)

in JNA Method ?
I know that in VB6 it's BinToSlices(ByVal Bin as String, ByRef Slices as Integer())
I know nothing about C++
thanks


text:
Q: Outlook unable to handle bracket > in e-mail correctly I have an external system feeding draft e-mail in outlook.
The e-mail address is in format:
Username <abcd@gmail.com; efgh@gmail.com>
When I preview e-mail in outbox, the outlook wrongly treated the e-mail as "Username <abcd@gmail.com" and "efgh@gmail.com>"
But, if I type the above wordings manually, Outlook 2016 check name feature can correctly recognize:
Username abcd@gmail.com; efgh@gmail.com
Any thoughts why Outlook cannot check names properly for system generated e-mail? The external system correctly transfer the string to Outlook "Username <abcd@gmail.com; efgh@gmail.com>"

A: Use the Recipient.Resolve method which attempts to resolve a Recipient object against the Address Book.
Sub AssignTask()
 Dim myItem As Outlook.TaskItem
 Dim myDelegate As Outlook.Recipient
 Set MyItem = Application.CreateItem(olTaskItem)

 MyItem.Assign

 Set myDelegate = MyItem.Recipients.Add("Eugene Astafiev")

 myDelegate.Resolve

 If myDelegate.Resolved Then
   myItem.Subject = "Prepare Agenda For Meeting"
   myItem.DueDate = Now + 30
   myItem.Display
   myItem.Send
 End If

End Sub

You may also find the How To: Fill TO,CC and BCC fields in Outlook programmatically article helpful.

A: Username <abcd@gmail.com; efgh@gmail.com> format is incorrect. It must be Username <abcd@gmail.com>; Username <efgh@gmail.com>


text:
Q: simple drag across from left to right with touch functionality I was wondering if there's a drag functionality for touch that's not using jQuery UI that can be used alongside this code below, or if this code may be modified to include code for touch.
The plugin, modified for personal use:
(https://github.com/scazzy/jQuery-Draggable)
$.fn.draggable = function (opt) {
    var prevX=0;
    var base = this;
    var settings = {
        handle: "",
        cursor: "move",
        axis: null,
        containParent: false
    };
    opt = $.extend(settings, opt);

    if (opt.handle === "") {
        var $el = base;
    } else {
        var $el = base.find(opt.handle);
    }
    return $el.css('cursor', opt.cursor).on("mousedown", function (e) {
        if (opt.handle === "") {
            var $drag = $(this).addClass('draggable');
        } else {
            var $drag = $(this).addClass('active-handle').parent().addClass('draggable');
        }
        var z_idx = $drag.css('z-index'),
            drg_h = $drag.outerHeight(),
            drg_w = $drag.outerWidth(),
            pos_y = $drag.offset().top + drg_h - e.pageY,
            pos_x = $drag.offset().left + drg_w - e.pageX;
        var parent = $(this).parent();
        var parW = parent.width(),
            parH = parent.height();
        var parX1 = parseInt(parent.offset().left) + parseInt(parent.css('padding-left').replace('px', '')),
            parX2 = parX1 + parW,
            parY1 = parseInt(parent.offset().top) + parseInt(parent.css('padding-top').replace('px', '')),
            parY2 = parY1 + parH;
        $drag.css('z-index', 1000).parents().on("mousemove", function (e) {
            var off_top = e.pageY + pos_y - drg_h,
                off_left = e.pageX + pos_x - drg_w,
                offst = null;
            if (opt.containParent === true) {
                if (off_left > parX2 - drg_w) {
                    off_left = parX2 - drg_w;
                    window.location = $('.draggable').attr('href');
                }
                if (off_top < parY1) {
                    off_top = parY1;
                }
                if (off_top > parY2 - drg_h) {
                    off_top = parY2 - drg_h;
                }
                if(prevX < off_left) {
                    prevX = off_left;
                }
                if(prevX >= off_left) {
                    off_left = prevX;
                }
                if (off_left < parX1) {
                    off_left = parX1;
                }
                if (off_left < parX2 - drg_w) {
                    var imgWidth = $('.draggable').position();
                    $('.draggable').siblings('img').css('width', imgWidth.left);
                    var imgHeight = $('.draggable').siblings('img').height();
                    $('.draggable').parent('.divider').css('height', imgHeight+'px');
                }
            }

            if (opt.axis == "x") {
                offst = {
                    left: off_left
                };
            } else if (opt.axis == "y") {
                offst = {
                    top: off_top
                };
            } else {
                offst = {
                    left: off_left,
                    top: off_top
                };
            }
            $('.draggable').offset(offst);
            $('.draggable, html').on("mouseup", function () {
                $drag.parents().off('mousemove');
                $($el).removeClass('draggable').css('z-index', z_idx);
            });
        });
        e.preventDefault(); // disable selection
    }).on("mouseup", function () {
        if (opt.handle === "") {
            $(this).removeClass('draggable');
        } else {
            $(this).removeClass('active-handle').parent().removeClass('draggable');
        }
        $el.off('mousedown', function (e) {
            e.preventDefault()
        });
    });
}

Calling the plugin:
/* end scissors plugin, start scissors */
$('.scissors').click(function(e){e.preventDefault();});
$(".scissors").draggable({
    containParent: true,
    axis: 'x',
    cursor: 'e-resize'
});

The HTML:

';

The CSS:
.divider { margin: 40px 0; border-top: 1px dashed #1abff0; background: #fff; position: relative; }
.scissors { position: relative; display: inline-block; top: 0; }
.scissors:after { width: 22px; height: 16px; content: "\e606"; font-family: 'icomoon', Arial, Helvetica, sans-serif; font-size: .7em; position: absolute; left: -22px; top: -29px; color: #232323; z-index: 1000; }
.scissors.draggable:after { content: "\e605"; }
.divider img { position: absolute; top: 0; max-height: none !important; z-index: 0; }

You may see it in action here (drag the scissors):
http://playfuldevotions.com
This works well with mouse gestures but not touch.
Thanks in advance!

A: Here's the answer I found:
Javascript Drag and drop for touch devices
I ended up deleting the event.preventDefault(); So like this:
function touchHandler(event) {
    var touch = event.changedTouches[0];

    var simulatedEvent = document.createEvent("MouseEvent");
        simulatedEvent.initMouseEvent({
        touchstart: "mousedown",
        touchmove: "mousemove",
        touchend: "mouseup"
    }[event.type], true, true, window, 1,
        touch.screenX, touch.screenY,
        touch.clientX, touch.clientY, false,
        false, false, false, 0, null);

    touch.target.dispatchEvent(simulatedEvent);
}

function init() {
    document.addEventListener("touchstart", touchHandler, true);
    document.addEventListener("touchmove", touchHandler, true);
    document.addEventListener("touchend", touchHandler, true);
    document.addEventListener("touchcancel", touchHandler, true);
}

Then I called init() in document.ready before the draggable plugin that I mentioned in my initial question. That works like a charm.


text:
Q: What is the best color combination for readability, easy of use, and reduced eye strain? I am trying to pick out the optimal set of colors for a new website project.
I want to do a traditional black on white look and feel for the main content.  However my partner on the project wants to do a color combination that more looks like the traditional Windows Forms look and feel.
Is there any research available on the best color combination's to use for readability, ease of use, and reduced eye strain?

A: *

*Here are some tips and a study on color-scheming for the color-blind or visually impaired.

*If you want to use complementary colors, or more than two colors, here are some good guidelines [pdf].

*Here are some tools from the NIST to automatically evaluate website usability.

And if the above just will not do, this page has more useful Links than the entire Zelda series.

A: I would recommend Kuler to find which color scheme to use on your site. If you search for "Windows" on that site you will get some windows schemes that you might want to use.... generally speaking from a marketing aspect, white backgrounds tend to be more accepted than backgrounds with a specific color.

A: You might also consider using a color matcher ,
I use it and find it very helpful to find complementary color that make your text readable and you design make sense.

A: White strains my eyes really badly I find.
When it comes to vast amounts of text I typically prefer black on off-white. Some very light shade of gray. Still plenty easy to read, but not burning my retinas.

A: You can always check your decisions to make sure they are ADA compliant.  This is a good place to start

A: Black text on an off white background works for me. And no background image or color on the desktop

A: I read about a study that concluded that the readability of a particular color scheme is dependent on the subject's personality.  In fact, it was found that some people with a reading disability were instantly able to read faster once a color filter was placed over the pages on a book.  I suggest you pick a color scheme that you find easiest on the eyes, and make the font a reasonable size.  Something to avoid is the color yellow.  The same study found that yellow is a generally irritating color to most people, so even if you find it easy on the eyes, your audience might not.  Some people find darker backgrounds easier on the eyes, but if your audience isn't already using their own color scheme, your site will be seen a nuisance, since most of the web is dark-on-light.

A: Windows Forms look will only keep visitors who like that look. So say goodbye to all the Mac, Linux, and other Windows haters.
Personally, I prefer black on white.

A: There aresome resources out there that explain the topic.
As a rule, you should avoid black background with white text, it's anoying to a lot of people.

A: in the past I liked vert much turbo pascal 7 default color scheme: yellow on blue. I'm not sure about it's scientific relevance however I think it is better than black on white.

A: I personaly use C0DCC0 (greenish) instead of white for background color in windows. Easy on the eyes when you have to stare at the screen whole day. Consider this to be one datasample study :).
(Imagine my disgust at OSX with fixed colors...)


text:
Q: Why does the background of my container/wrapper not extend behind all content Im working on a portfolio for uni and the background of my container / wrapper does not extend vertically enough in order for all its content to have a back ground color. I'll post code below, any help would be appreciated.
HTML

            <hgroup class="title">

Matt Murphy

Personal Portfolio | University of Leeds | BA New Media

           </hgroup>

                Home
                About Matt

Modules Studies To Date

Year 1

History of Communications

Academic Skills and Contemporary Issues

Interface Design

Design For New Media

Basic Camera and Editing

Animation For New Media

Year 2

Dynamic Web Programming

Communications Research Methods

Working in New Media/p>

Media Policy

New Media Narrative and Gaming

Visual Communications

CSS
body{
    color:#000;
    background-image: url(images/canvas.png);
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
}

a:link {
    text-decoration:none;
    color:#000;
}
a:visited {
    text-decoration:none;
    color:#000;
}
a:hover {
    text-decoration:none;
    color:#000;
}
a:active {
    text-decoration:none;
    color:#000;
}

#wrapper {
    background-color:#FFF;
    padding:3%;
    -webkit-border-radius: 25px;
    -moz-border-radius: 25px;
    border-radius: 25px;
    display:block;
    margin:auto;
    width:60%;
    margin-top:2%;
}

header {
    text-align:right;
}

#modules {
    width:100%;
    display:block;
    margin:auto;
}

#year_1 {
    float:left;
}

#year_2 {
    float:left;
}

A: To fix your problem you just need to add overflow: auto to #wrapper.
#wrapper {
    background-color:#FFF;
    padding:3%;
    -webkit-border-radius: 25px;
    -moz-border-radius: 25px;
    border-radius: 25px;
    display:block;
    margin:auto;
    width:60%;
    margin-top:2%;
    overflow: auto; /* add this line */
}

However, another issue is that you are using HTML5 elements and the HTML5 shiv but you have not used the HTML5 doctype:
<!DOCTYPE html>

A: I assume you are having problems in IE? You are missing a doctype declaration. If you add a transitional doctype as per the example on W3Schools below it should work.
HTML doctype declaration

A: Basically the css-property 'float' on the section#year is the bad guy here.
If I replace your sections with div's and add an extra div to clear block rendering it works:
http://jsfiddle.net/hoedinie/537sL/1/


text:
Q: Struts2 How to get selected value from dropdownlist to other jsp page This is register.jsp page. Here setting the countryList in dropdownlist from Action class
 <s:select name="country" list="countryList" listKey="countryId"  listValue="countryName"  headerKey="0" headerValue="Country"  label="Select a country">

Here I am getting all the list from Action;
when I submit action , I am getting key instead of value on success.jsp.
<s:property value="country"/>

Here I am getting selected key like 0,1,2 instead of country value.
My Action class
   public class RegisterAction extends ActionSupport {
   private List<String> communityList;
   private List<Country> countryList;
   private String country;
   private String userName;
   private String password;
   private String gender;
   private String about;
   private String[] community;
   private boolean mailingList;

       public String execute() {
       return SUCCESS;}
       public String populate(){
       communityList = new ArrayList<String>();
       countryList  = new ArrayList<Country>();
       countryList.add(new Country(1,"India"));
       countryList.add(new Country(2,"US"));
       countryList.add(new Country(3,"UK"));
       communityList.add("JAVA");
       communityList.add(".NET");
       communityList.add("SOA");
       community=new String[]{"JAVA",".NET"};
       mailingList = true;
       return "populate";
    }

public List<String> getCommunityList() {
    return communityList;
}
public void setCommunityList(List<String> communityList) {
    this.communityList = communityList;
}

public String getUserName() {
    return userName;
}
public void setUserName(String userName) {
    this.userName = userName;
}
public String getPassword() {
    return password;
}
public void setPassword(String password) {
    this.password = password;
}
public String getGender() {
    return gender;
}
public void setGender(String gender) {
    this.gender = gender;
}
public String getAbout() {
    return about;
}
public void setAbout(String about) {
    this.about = about;
}
public String[] getCommunity() {
    return community;
}
public void setCommunity(String[] community) {
    this.community = community;
}
public boolean isMailingList() {
    return mailingList;
}
public void setMailingList(boolean mailingList) {
    this.mailingList = mailingList;
}

public List<Country> getCountryList() {
    return countryList;
}

public void setCountryList(List<Country> countryList) {
    this.countryList = countryList;
}

public String getCountry() {
    return country;
}

public void setCountry(String country) {
    this.country = country;
}
 }

Country.java
public class Country {
  private String countryName;
  private int countryId;
  public Country(){}
  public Country(int countryId,String countryName){
      this.countryId=countryId;
      this.countryName=countryName;
  }
public String getCountryName() {
    return countryName;
}
public void setCountryName(String countryName) {
    this.countryName = countryName;
}
public int getCountryId() {
    return countryId;
}
public void setCountryId(int countryId) {
    this.countryId = countryId;
}
  }

A: You can get the value from the request object.
HttpServletRequest request = (HttpServletRequest)(ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST));
Country value = (Country)request.getParameter("country");

A: use listKey="countryName"  listValue="countryName" in this way you will receive value


text:
Q: Magento 2 Rest API Shipping I am currently trying to integrate Magento with an already existing ERP system. It is going well so far except I have a problem when I am trying to ship an order.
I need Magento to ignore quantity when I am Shipping order via Rest API as quantity is getting an update from ERP system and not on Magento itself.
Does anyone have an idea how I could do that?
Thanks in advance!
Eddie