text:
Q: how to remove duplicate values from MySQL table i am looking for the query, deletes the all duplicate values.
Example Table:

1 ABC
2 BBB
3 DAC
4 ABC
5 AAA
6 ABC

output required

1 ABC
2 BBB
3 DAC
5 AAA

thanks for your help, i Google it can't find exact solution.

A: If you want to do an actual DELETE operation of the duplicate values (while retaining the values having the lowest id), you can do it with the multiple table DELETE syntax:
DELETE a FROM tbl a
LEFT JOIN
(
    SELECT MIN(id) AS id, name
    FROM tbl
    GROUP BY name
) b ON a.id = b.id AND a.name = b.name
WHERE b.id IS NULL

See a demonstration of the DELETE operation

A: See @fvu answer here : https://stackoverflow.com/a/11249235/1166147
You can create a unique index that will remove duplicates and prevent future dupes all at once (MySQL 5.1 or higher):
ALTER IGNORE TABLE 'YOURTABLE'
ADD UNIQUE INDEX somefancynamefortheindex (Col1ID, Col2)

A: Assuming Tab is the name of your table containing duplicates, create a temporary table Tab_TMP with the same structure of Tab.
-- assuming `Tab` has same schema
CREATE TABLE Tab_TMP (
  id INT(2) PRIMARY KEY,
  name VARCHAR(8)
);

Fill Table_TMP with all Table entries.
INSERT INTO Tab_TMP(id, name) SELECT id, name FROM Tab;

Delete entries from Table.
DELETE FROM Tab;

Insert in Table entries from Table_TMP using SELECT DISTINCT.
INSERT INTO Tab(name) SELECT DISTINCT name FROM Tab_TMP;

A: *

*load distinct data in a file and delete or drop your table

SELECT DISTINCT col1,col2,col3,..coln FROM table name  INTO OUTFILE 'yourFilePathWIthFileName'
eg:
SELECT DISTINCT username,usernumber,usersalary,dateOFJoining,timeofJoining,datetimeOfJoining FROM asdf INTO OUTFILE 'C:/Users/ahmed.m/Desktop/modify.txt';

*

*create your table structure laod data back from file

LOAD DATA INFILE 'yourFilePathWIthFileName' INTO TABLE tableName
eg:
LOAD DATA INFILE 'C:/Users/ahmed.m/Desktop/modify.txt' INTO TABLE asdf


text:
Q: Writing a method ByteSwap but not working as planned so we need to write a method
byteSwap - swaps the nth byte and the mth byte

*

*Examples: byteSwap(0x12345678, 1, 3) = 0x56341278

*byteSwap(0xDEADBEEF, 0, 2) = 0xDEEFBEAD

*You may assume that 0 <= n <= 3, 0 <= m <= 3

*Legal ops: ! ~ & ^ | + << >>

also we cannot use loops/recursion
but my following code fails with this test case :
Test byteSwap(-2147483648[0x80000000],0[0x0],3[0x3]) failed...
...Gives -128[0xffffff80]. Should be 128[0x80]
not sure why though this is my code so far
int byteSwap(int x, int n, int m) {
int nBitShift = n << 3;
int mBitShift = m << 3;
int nByte = x & (0xFF << nBitShift);  //gets the byte at position n
int mByte = x & (0XFF << mBitShift);  //gets the byte at position m
int newX = x + ~(nByte + mByte) + 1; //make 0's in the nth and mth byte
nByte = nByte >> nBitShift; //shift back
nByte = nByte << mBitShift; //shift to the mth spot
mByte = mByte >> mBitShift;  //shift back
mByte = mByte << nBitShift; //shift to the nth spot

return nByte + mByte + newX;

}
edit:yes this is hw, but i need help

A: Arithmetic shift of a signed value sign-extends the operand. If you switch the type of your temporary variables to unsigned, your solution would avoid this problem.

A: How would this work?
int byteswap(int x,int n,int m)
{
    unsigned char *x_bytes = (unsigned char*)&x, tmp = x_bytes[n];
    x_bytes[n] = x_bytes[m];
    x_bytes[m] = tmp;
    return x;
}

I know it's probably not what your lecturer/somebody had in mind, but it was just to show an idea. If anything, it doesn't use loops nor recursion. ;)

A: Here's a "fancier" solution.
unsigned int byteswap(const unsigned int x, unsigned int n, unsigned int m) {
    unsigned int mask;
    m <<= 3;
    n <<= 3;
    mask = ((x >> m) ^ (x >> n)) & 0xFFU;
    mask = (mask << m) | (mask << n);
    return (x ^ mask);
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Css visibility property will not toggle when click function triggered in Javascript (HTML/CSS/Javascript) I'm trying to make a responsive hamburger menu, however, I've run into a brick wall at the final part of the coding for the menu...
I've tried everything that I can think of trying. For some reason, my menu will not completely disappear or appear at all with the adjustments I've made to the code.
With the final adjustment, the menu is not visible, as I have specified for it not to be in the code, but when I click on the menu button the menu doesn't toggle.
Here is my code:

const ul = document.querySelector('.menu ul');

burger.addEventListener('click', () => {
  ul.classList.toggle('change');
});
.menu ul {
  position: absolute;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  visibility: hidden;
}

.change {
  visibility: visible;
}

.burger {
  cursor: pointer;
  display: inline-block;
  align-items: center;
  justify-content: flex-end;
  position: fixed;
}

Home

Men

Women

Accessories

About

Contact

Please anything helps :')

A: You need to increase the specificity of the menu, since you have declared the initial styles for the unordered list with greater specificity than the .change class.

const ul = document.querySelector('.menu ul');
const burger = document.querySelector('.burger');
burger.addEventListener('click', () => {
  ul.classList.toggle('change');
});
.menu ul {
  position: absolute;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  visibility: hidden;
}

.menu ul.change {
  visibility: visible;
}

.burger {
  cursor: pointer;
  display: inline-block;
  align-items: center;
  justify-content: flex-end;
  position: fixed;
}
.bar {
  display: inline-block;
  width: 20px;
  height: 20px;
  background: #000;
}

Home

Men

Women

Accessories

About

Contact


text:
Q: What does the CSS aspect-ratio property do that width declarations don't? I was following a blog post about images optimization where the author said that it's a good practice to use the CSS property aspect-ratio giving the following example:
<img style="aspect-ratio: 5 / 3; width: 100%" ...>

I was playing around with Chrome and found out that if we declare the width of an image with some responsive width (let's say 100%), Chrome automatically does the math and picks up the correct aspect ratio for our image on the page. So, if the original image has sizes of 800x400, the browser automatically (implicitly) picks up the aspect ratio 2/1 and resizes the height of the image correctly when we shrink its width.
Why would I need to explicitly declare the aspect ratio in an example like the one above? Are there browsers that don't follow that approach of implicit calculating of the aspect ratio based on the source image? Did the author give a wrong example trying to explain that property? Or there's another benefit of doing that way?

A: The reason for declaring an aspect ratio for an <img> element, is to stop the page content from shifting when the image is finished downloading and inserted.
The browser can only know the aspect-ratio for the image once it's done downloading, so giving browser an aspect-ratio "hint" will help the content on your page stop "jumping around" as things get loaded.
Note: either declaring an aspect-ratio or declaring the width and height properties of the image will stop the content shift. It's just that using aspect-ratio allows the image to fit its containing element at the proper dimensions when used with width:100% (as can be seen in your example).


text:
Q: Zulu docs for supported JRE flags Where can I find documentation on JAVA_OPTS / JRE flags supported by Zulu
I've looked here but cannot find anything https://docs.azul.com/zulu/zuludocs

A: Zulu is a build of the OpenJDK, so the flags on the command line are those for HotSpot, which is the Virtual Machine implementation.
Probably the best place to go for command-line flags is Foojay.io.  For example, the JDK 8 flags are listed here:
https://foojay.io/command-line-arguments/openjdk-8/?tab=alloptions
Other versions can be found under the OpenJDK Command Line Arguments section on the main page.


text:
Q: How to use reflection to pass the table name dynamically I've never use reflection and I need to query the database and pass the table name dynamically. All tables that I am querying have the same signature(the same columns). I tried to follow the example from Dynamically set the table name in LINQ query but I am stuck now. I tried to call the 'Example' method, but I cannot call it like that. Thank you in advance for the help. I am completely clueless with reflection, if there is a better way of achieving my goal please point me to the right direction.
public void Example(IQueryable<IFileTable> dataSource)
{
    var data = (from q in dataSource
            select new
            {
                ID = q.Id,
                FileName = q.FileName
            }).ToList();

     Console.Write(data);
}

public static void GetData()
{
    Example(DataConnection.Context.Test1.AsQueryable());
}

public interface IFileTable
{
    int Id { get; set; }
    string FileName { get; set; }
}

public partial class Test1: IFileTable
{
    public int Id { get; set; }
    public string FileName { get; set; }
}

public partial class Test2: IFileTable
{
    public int Id { get; set; }
    public string FileName { get; set; }
}


text:
Q: Mix up audio file and video file within a range Hello hope you having a good day, I'm mixing up a video file with an audio file using this method:
public String mix(String videoFile, String audioFile,String targetFile) {

    Movie video;
    try {
        video = MovieCreator.build(videoFile);
    } catch (RuntimeException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
    Movie audio;
    try {
        audio = MovieCreator.build(audioFile);
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    } catch (NullPointerException e) {

        e.printStackTrace();
        return null;
    }
    int size = audio.getTracks().size();
    com.googlecode.mp4parser.authoring.Track audioTrack = audio.getTracks().get((size - 1));
    video.addTrack(audioTrack);

    Container out = new DefaultMp4Builder().build(video);

    try {
        RandomAccessFile ram = new RandomAccessFile(new File(targetFile),"rw");
        FileChannel fc = ram.getChannel();
        out.writeContainer(fc);
        ram.close();
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
    return targetFile;
}

But I wonder how can I mix up the audio from a specific start time and an end time range? Thanks a lot

A: found the solution
public String mix(String videoFile, String audioFile,String targetFile,long start,long end) {

    Movie video;
    try {
        video = MovieCreator.build(videoFile);
    } catch (RuntimeException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
    Movie audio;
    try {
        audio = MovieCreator.build(audioFile);
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    } catch (NullPointerException e) {

        e.printStackTrace();
        return null;
    }
    int size = audio.getTracks().size();
    com.googlecode.mp4parser.authoring.Track audioTrack = audio.getTracks().get((size - 1));
    //video.addTrack(audioTrack);

    long currentSample = 0;
    double currentTime = 0;
    double lastTime = -1;
    long startSample1 = -1;
    long endSample1 = -1;

    for (int i = 0; i < audioTrack.getSampleDurations().length; i++) {
        long delta = audioTrack.getSampleDurations()[i];

        if (currentTime > lastTime && currentTime <= start) {
            // current sample is still before the new starttime
            startSample1 = currentSample;
        }
        if (currentTime > lastTime && currentTime <= end) {
            // current sample is after the new start time and still before the new endtime
            endSample1 = currentSample;
        }
        lastTime = currentTime;
        currentTime += (double) delta / (double) audioTrack.getTrackMetaData().getTimescale();
        currentSample++;
    }
    try {
        video.addTrack(new AppendTrack(new CroppedTrack(audioTrack, startSample1, endSample1)));
    } catch (IOException e) {
        e.printStackTrace();
    }

    //  video.addTrack(new CroppedTrack(audioTrack,start,end));
    Container out = new DefaultMp4Builder().build(video);

    try {
        RandomAccessFile ram = new RandomAccessFile(new File(targetFile),"rw");
        FileChannel fc = ram.getChannel();
        out.writeContainer(fc);
        ram.close();
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
    return targetFile;
}


text:
Q: SQL find and replace with wildcard Starting position: I have a SQL-DB, that contains several tables with hunderts or tousends of entries. Now in several fields (columns) there are URLs, that should be shortened (to a extract of the original URL) and added a new parameter. The thing is, that there is some «find & replace» to do:

*

*Find all (OLD) URLs inside all Fields/Columns of all Tables (stand-alone or inbetween text)…
http://www.domain.com/click?p(abcdef)a(123456)url(http://www.url.com)

*… and replace the old URL with the (NEW) URL:
http://www.url.com/?at=uvwxyz
… as you can see I need a wildcard inside the url-parameter … like http://www.domain.com/click?p(abcdef)a(123456)url(*) because the old url ends with a ) and I just need an extract of the old url (the second url) plus a new url-parameter.

*

*The url inside the ( and ) in the OLD url can vary … there are maybe hunderts or tousands of different urls.

*The URLs are in several fields in several tables … inside and mostly surrounded by text and not necessarily stand-alone (see table below).

*There could be more than one field/columns per entry with none, one or more than one URLs per field/column that should be changed.

Table Example:
+----------+---+-------------------+---------------+---+--------------+--------------+
| entry_id | … | field_id_1        | field_ft_1    | … | field_id_199 | field_ft_199 |
+----------+---+-------------------+---------------+---+--------------+--------------+
| 21364    | … | blabla URL blabla | NULL          | … | none         | none         |
| 21363    | … | text URL text     | text URL text | … | none         | URL          |
| …        | … | text URL text URL | NULL          | … | URL text     | none         |
+----------+---+-------------------+---------------+---+--------------+--------------+

Field/Column Value Example:
The new «App of the Week» is named «PopAGraph».
This App does this and that and bla bla bla kostenlos.
In the iOS Store there are «Editors Choise» like: «The Room Two» (CHF 3.00). And some more Text bla bla bla.

Update: rewrote the whole question because of lack of details

A: To find last URL portion of the old string, use substring_index and substr functions.
Example:
SET @old_value :=
         'http://www.domain.com/click?p(abcdef)a(123456)url(http://www.url.com)';
select @url := substr( @u := substring_index( @old_value, '(', -1 )
               from 1
               for ( length( @u ) - 1 )
       ) as url

This will return
+--------------------+
| url                |
+--------------------+
| http://www.url.com |
+--------------------+

To update the record using the new url value, you have to use concat to append query parameters to the url.
Example:
update my_table
    set url_col = concat( @url, '/?at=uvwxyz' )
where
    url_col = @old_value
    -- and  -- add more conditions if required
    -- ... ...

Refer to:

*

*MySQL: SUBSTRING_INDEX( str, delim, count )

*

*Returns the substring from string str before count occurrences of the
delimiter delim. If count is positive, everything to the left of the
final delimiter (counting from the left) is returned. If count is
negative, everything to the right of the final delimiter (counting
from the right) is returned. SUBSTRING_INDEX() performs a
case-sensitive match when searching for delim.


text:
Q: People api filter contacts If I understand it correctly Google recommend to use the people api instead of the contacts api if you only need read only access. I'm looking for an option to search for contacts on name or company is this possible with the people api or is this only possible with the contacts v3 api.

A: I don't think it's possible.  https://people.googleapis.com/$discovery/rest?version=v1.  if you look at the current schema, they don't provide you a method to do query.


text:
Q: How to perform Create with navigation in S/4 HANA SDK We are trying to perform POST operation using S4 HANA SDK.Our Use case is to add a child entity to an already created parent entity.
We are trying along these lines
final BusinessPartnerService service; // your BusinessPartner service
final BusinessPartner abcBusinessPartner; // fetched businessPartner
final BusinessPartnerRole newRole; // your role, for example created by: BusinessPartnerRole.builder(). ... .build();

abcBusinessPartner.addBusinessPartnerRole(newRole);

service.updateBusinessPartner(abcBusinessPartner);

We get back the following error from the on-premise system.
{
  "error": {
    "code": "/IWFND/CM_MGW/096",
    "message": {
      "lang": "en",
      "value": "PATCH requests require components to be updated"
    },
    "innererror": {
      "application": {
        "component_id": "MM-PUR-REQ",
        "service_namespace": "/SAP/",
        "service_id": "MMPUR_REQ_SSP_MAINTAIN_SRV",
        "service_version": "0001"
      },
      "transactionid": "94EEA58F4E630230E005D1A751652A34",
      "timestamp": "20190708061130.8418390",
      "Error_Resolution": {
        "SAP_Transaction": "For backend administrators: run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details",
        "SAP_Note": "See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"
      },
      "errordetails": []
    }
  }
}

A: Based on the blog :: https://blogs.sap.com/2018/09/17/sap-s4hana-cloud-sdk-version-2.4.1-is-available/
For the use case of creating a child entity we have to use the .asChildOf qualifier while creating .
Eg :: new DefaultBusinessPartnerService()
    .createBusinessPartnerAddress(addressToCreate)
    .asChildOf(parentBusinessPartner, BusinessPartner.TO_BUSINESS_PARTNER_ADDRESS)
    .execute();


text:
Q: Varieties with finitely cocomplete category of finite algebras
For which varieties $\mathbf{V}$ (in the sense of universal algebra) do the finite algebras in $\mathbf{V}$ form a finitely cocomplete category, or more strongly, are closed under finite colimits in $\mathbf{V}$?

Some examples:

*

*Sets

*(Left or right) $M$-sets where $M$ is any monoid

*Commutative (or abelian) semigroups

*Commutative (or abelian) monoids

*Abelian groups

*(Left or right) $R$-(semi)modules where $R$ is any ring (or rig)

*Boolean algebras

Some non-examples:

*

*Semigroups, monoids, groups, or rings (not necessarily commutative)

*Commutative rings (although the tensor product (coproduct) of two finite commutative rings is finite, the initial ring $\mathbf{Z}$ is infinite)


text:
Q: Robocopy ignores files that have the exact same size and timestamp (Truecrypt volumes) I'm backing up my documents, including a small Truecrypt container (.tc file). When I mount the Truecrypt countainer and modify files inside it, it does not change the file size or the date/time modified (or any other timestamps). It seems that Robocopy is using these conditions to skip the file without doing any byte comparison of the files.
Is there a way to force Robocopy to do a byte-for-byte file comparison? Or a viable workaround?


text:
Q: How to Fix Segmentation Fault for Google Cloud Vision? i'm using Google Cloud Vision API to detect a captured image taken from pi camera and if the picture detected as an animal, it will delete the picture and if it's not, it will running another function called: takePicture(image_name). My script works absolutely well, but most times i have a weird problem called Segmentation Fault and when this happened it doesn't interrupt my python program but my 4x4 keypad (connected to RPi) stop working and also automatically create another loop process of python program which is still running even with "keyboard interrupt".
def detectImage(self, image_name):
        path = '/home/pi/homesecurity/pictures/' + image_name
        max_results=1
        with open(path, 'rb') as image_file:
            content = image_file.read()
        image = vision.types.Image(content=content)
        objects = client.object_localization(image=image,max_results=max_results).localized_object_annotations
        for object_ in objects:
           if (object_.name == 'Animal' or object_.name == 'Cat' or object_.name == 'Dog' or object_.name == 'Bird' or object_.name == 'Insect'):
             print ('False Alarm: This is an animal!')
             os.remove('/home/pi/homesecurity/pictures/' + image_name) #Deletes the taken picture.
             print 'File', image_name, 'has beeen deleted'
             break
           else:
             Process(target=interact().takePicture(image_name)).start()
             print('Not an animal!')

Is it possible of the old hardware ?  because i'm using Raspberry Pi Model B and python 2.7
pi@raspberrypi:~ $ cat /proc/cpuinfo
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 000e
Serial          : 0000000095fec982

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

A: Segmentation Faults happen when your python program tries to use memory that is out of reach. Meaning it doesn't have the resources requested.
Check out this answer and try to find out at what point that is happening. I think it might be due to the low computational power your raspberry pi is providing. Maybe you can allocate more with this.


text:
Q: Use of the word 'so' I am confused about using the word 'so'.
Here is an example.

I had a fever so I did not go to work.

Question is, in the above sentence, do I really need a comma before 'so'?

A: Yes.  "So" is separating two sentences that could stand on their own.
It would be more correct to write, "Because I had a fever, I did not go to work."

A: Yes, you need to use a comma before "so" when it's acting as a conjunction to bring two independent clauses together.
You can find more information on Writer Domain here. Using that website as a reference, I created two examples for you.

The principal was sick, so he called out. — Independent, comma is needed.

The principal pretended to be sick so he wouldn't have to go to work. — Dependent, no comma is needed.


text:
Q: Add virtual network interface to limit internet traffic? The setup is as follows: I have a server with one network card in my LAN network. Now I want to limit the upload / download speed from / to the server but not the speed within the local network.
Wondershaper works perfectly fine but throttles all connections. Is it possible to create a virtual network interface, route the internet traffic through it, and throttle this interface? Will this work? Any hints how to do it or in general are appreciated.


text:
Q: What's that Unicode character in my clipboard? Is there a quick and easy way to find the Unicode code point for any character? For example, I see a funny character on a web page, or a PDF file, or some other document.
What I current do is copy the character to the clipboard, save it to a file, and look at the file with a hex viewer. Alternatively I can open Microsoft Word, paste and do Alt+X. Both of these methods are a bit cumbersome. Is there an easier way?
I use Notepad++ so if there's any way to do that with Notepad++, it would be a suitable answer (it's less cumbersome than having to open Word). Or maybe there's a way to do it with a small specialised application?

A: On a Unix-like system*:
unicode -s "$(xsel -ob)"

You can alias this or create a script to run it.
The output looks like this:
U+2672 UNIVERSAL RECYCLING SYMBOL
UTF-8: e2 99 b2 UTF-16BE: 2672 Decimal: ♲ Octal: \023162
♲ (♲)
Uppercase: 2672
Category: So (Symbol, Other)
Bidi: ON (Other Neutrals)

* It looks like the original poster is probably using Windows, but (a) this isn't specified, and (b) this solution might help others.

A: You can use PowerShell!
[char]::ConvertToUtf32((gcb), 0)

This prints the first Unicode code point of the text on the clipboard.
If you don't have to worry about characters outside the Basic Multilingual Plane (that would be represented in .NET strings as a high and low surrogate), you can use this instead:
[int](gcb)[0]

If you'd prefer it in hex, you can use a format specifier:
'0x{0:x}' -f [char]::ConvertToUtf32((gcb), 0)

A: A note for any Emacs users: you can type C-u C-x = and it will give you a bunch of information about the character under the cursor, including the Unicode code point, the name in the Unicode database and the categories etc.
             position: 146 of 147 (99%), column: 0
            character: ♲ (displayed as ♲) (codepoint 9842, #o23162, #x2672)
    preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x2672
               script: symbol
               syntax: w    which means: word
             category: .:Base
             to input: type "C-x 8 RET 2672" or "C-x 8 RET UNIVERSAL RECYCLING SYMBOL"
          buffer code: #xE2 #x99 #xB2
            file code: #xE2 #x99 #xB2 (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    xft:-PfEd-Mensch-normal-normal-normal-*-16-*-*-*-m-0-iso10646-1 (#x985)

Character code properties: customize what to show
  name: UNIVERSAL RECYCLING SYMBOL
  general-category: So (Symbol, Other)
  decomposition: (9842) ('♲')

A: I find Rishard Ishida's Unicode code converter (github link) very usefull for finding unicode charactercodes, amongst other things. It also provides translations/conversions to other codepoints, encodings and for instance escapes-sequences.

You may also want to checkout Richard Ishida's main webpage (rishida.net), as it contains (links to) alot of valuable tools and information, especially if you're interested in internationalisation and character-encoding. For instance, another very useful tool linked there, is his Uniview tool (github link).

And finally, also very useful i find, although mostly relevant to Mac-users, is macOS's Character Viewer, accessible through the Input Menu, which can be enabled in System Preferences → Keyboard
Although the Apple-support website mainly focusses on how-to insert emojies (…), the Character Viewer is actually very useful for looking-up specific ('special') characters and their codepoints in several different encodings, as well as for finding which fonts on your systen contain specific glyphs.

Cheers!

A: Notepad++ has a pre-installed plug-in called Converter that has a option to Convert ASCII to HEX and Vice-versa. This tool is quite useful as to convert data files that are in HEX format which are to be converted to ASCII to read:

That is how it works:

A: I work a lot with Unicode characters, so I have written a small Windows application specifically for this:
Unicode Character Informer (Documentation)

In addition, my text editor, Rejbrand Text Editor, has extensive Unicode character support.

A: Got Vim? Just paste it in, put your cursor on it, and hit ga. I use this all the time for weird characters.

A: I use http://unicode.scarfboy.com, which is simple and works well.

A: You can also use the following site: https://unicode-table.com/en/
Just paste your character, and you'll get a Unicode code point and HTML code as well.

A: When I'm faced with this problem, a quick Google search usually provides a quick answer.
For example, when I google " unicode", I get a result like this:

I like this method because:

*

*It works on any computer with internet

*You don't have to install anything

*The keypresses required (Ctrl+C & Ctrl+T & Ctrl+V & Enter) are muscle memory actions for me, and probably for most other developers/typists.

A: There's a nice little website called Unicode Character Inspector (built by  Tim Whitlock) that does just that. I find it way more convenient than a text editor or desktop program.

A: If you have Microsoft Word, paste the text there, select the character
(or click to the right of it), and press Alt+X.

A: I am going to mention http://amp-what.com/ as it is really easy to use with its quick search field and supports different notations (& code, Unicode codepoints, URI encode character sequence).
Example image

A: Here's one more answer using an idea from user202729:
Bookmark the URL javascript:alert(prompt().codePointAt(0).toString(16)) and use a browser to run it. (Works on Chrome and Firefox. Doesn't appear to work on IE but this may be due to security settings.)
Unlike other answers, no internet connection is required, no external utility to download, not OS-specific.


text:
Q: Different login page for every client (on one server) Scenario:
Currently, we have a website tool in asp.net MVC (www.tool.com/login).
Now, the client is looking into customizing the login page for several customers and they will have their own domain (but only one server for all).
for example:
www.client1.com/login,
www.client2.com/login,
www.client3.com/login
Yell at me if this is a stupid question.
But please help and give me an idea on how to implement it.
Should I create different login htmls for each client?

A: Related to my comment -
Create a Table with ClientInfo in DB:

*

*Title

*BackgroundColor

*Language

*URL --> This has to be unique for this to work [client1, client2]. Don't save the full URL -- Just the Host

Let's say you are passing a Model --> LoginModel to your LoginPage.cshtml
public class LoginModel
{
    public string UserName { get; set; }
    public string Password { get; set; }

    public StyleDTO ClientStyles { get; set; }

}

public class StyleDTO
{
    public string Title { get; set; }
    public string LogoPath { get; set; }
    public string BackGroundColor { get; set; }
}

In your controller when you load View:
    public ActionResult Login()
    {
        var clientUrl = HttpContext.Current.Request.Url.Host;

        var cs = dbContext.ClientInfo.First(s => s.Url == clientUrl);

        var model = new LoginModel()
        {

            ClientStyles = new StyleDTO()
            {
                Title = cs.Title,
                LogoPath = cs.LogoPath,
                BackGroundColor = cs.BackGroundColor
            }
        };
    }

then in your login View (LoginPage.cshtml):
@model LoginModel

@Model.Title

A: create a config file with variables for client1,  client2, client3
Keep same login page html and based on HTTP_referer pick one of the config variable and render the page based on that.


text:
Q: Unable to see Jenkins home page after installing it I successfully installed Jenkins 2.121.2 on Windows 10 using installer jenkins.msi. After it, opened http://localhost:8080/ which was expecting to open Jenkins home page but rather I can see following message there -
If you're seeing this, you've successfully installed Tomcat. Congratulations!

Can someone please help help what could have been wrong here and what else I need to do?

A: tail -f /var/log/jenkins/jenkins.log check logs to verify the actual issue, seems like tomcat is running on port 8080 as mentioned by @Shmuel
You have two option

*

*stop the tomcat or change the tomcat port to something else then 8080

*start Jenkins with other port then 8080
 java -jar -httpPort=8081 jenkins.war


text:
Q: "ValueError: could not convert string to float" in Python I'm getting "could not convert string to float" error while trying to implement the below mentioned code.
In the code, I am basically reading a CSV file and trying to convert the string values (all values are numeric) into float.
import csv
def loadCsv(filename):
    lines = csv.reader(open(filename, "rt"))
    dataset = list(lines)
    for i in range(len(dataset)):
        dataset[i] = [float(x) for x in dataset[i]]
    return dataset

filename = 'Pima Diabetes.csv'
dataset = loadCsv(filename)
print('Loaded data file {0} with {1} rows').format(filename, len(dataset))

A: The first row of your dataset contains the names of your features which are basically 'strings'. According to your code, you are converting each line in your dataset to float which also includes the feature names. What you want is to have your code read lines from the second row.

A: In most cases, using csv and open is going the hard way. You could simply
#pip install pandas
import pandas as pd

# read csv to a data frame
# sep is default to ','. You can change with sep='\t' for tab,
df = pd.read_csv('YOUR_CSV.csv')

# print the number of rows and columns
print(df.shape)


text:
Q: Scale and then scale to top? I'm trying to use transform to scale an image to fullsize.
This is how I try to calculate the top and position, it almost works, but the translation is based on the images original size, not the scaled size. Could I solve this by applying different css somehow or do I have to figure out another translation value?
  transformCarousel () {
    if (this.state.zoom) {
      const heightBefore = this.state.carousel.height
      const heightAfter = window.innerHeight * 0.792
      const scale = heightAfter / heightBefore
      const posBefore = this.state.carousel.top
      const posAfter = window.pageYOffset
      const translate = posAfter - posBefore
      return {
        zIndex: 1070,
        transform: 'scale(' + scale + ') translateY(' + translate + 'px)'
      }
    }
  }

A: I am just guessing what it's your problem.
It seems that the px value of the translation should be in the final scale and not the beginning scale.
This code would do it:
   transform:  'translateY(' + translate + 'px) scale(' + scale + ')'

The order in the transforms is right to left, so the scale will be applied and after this the translate will be


text:
Q: Remote access to postgresql server not getting configured I wanted to configure postgresql server on other terminal. so I accessed that terminal using ssh service.It worked successfully. On my terminal I have installed ubuntu 16.04 and other terminal has ubuntu server 16.04 installed on it.
So I wanted to install postgresql 9.6 on other terminal.I used command:
$ sudo apt-get install postgresql-9.6
as we can see that it installed successfully as port is set for localhost access.
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN
I wanted to configure remote access to the server made changes to the postgresql.conf file and pg_hba.conf file as given in following link:
https://blog.bigbinary.com/2016/01/23/configure-postgresql-to-allow-remote-connection.html
then I restarted the server using following command:
$ sudo service postgresql restart
still it shows that it is set to localhost at port 5432 as given below:
$tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN
I tried many times but still got same result. I don't know what is going wrong. Please help

A: ok I got the answer. Just had to uncomment the "listen_addresses = '*'". So stupid of me.thank you guys for your valuable time.


text:
Q: how to cancel a timer when using timerManager in veins omnet I'm using TimerManager class provided in veins to manage timers in my simulation.
I created a recurring timer that fires every 5 seconds and I want to cancel it when a specific msg is received but I don't know how to use the cancel method:
void cancel(TimerHandle handle)
I don't understand what is TimerHandle and what parameter should I pass to the method in order to cancel the timer
PS:i want to cancel a specific timer not the TimerManager instance

A: When creating a timer, TimerManager::create returns a TimerHandle. You can use this to cancel the timer by passing it to TimerManager::cancel.

A: @Horstinator this is my code : the RSU's application
    #ifndef RSUAPP_H_
    #define RSUAPP_H_
    #include <omnetpp.h>
    #include "veins/modules/application/ieee80211p/BaseWaveApplLayer.h"
    #include "ttr_m.h"
    #include "veins/modules/utility/TimerManager.h"

    using namespace omnetpp;
    using Veins::TimerManager;

    class rsuApp : public BaseWaveApplLayer {
    public:
    rsuApp();
    ~rsuApp();
    virtual void initialize(int stage);
    virtual void finish();
    protected:
    virtual void onBSM(BasicSafetyMessage* bsm);
    virtual void onWSM(WaveShortMessage* wsm);
    virtual void onWSA(WaveServiceAdvertisment* wsa);
    virtual void handleSelfMsg(cMessage* msg);
    virtual void handlePositionUpdate(cObject* obj);
//declaration of the TimerManager instance and the handle
    TimerManager timerManager{this};
    TimerManager::TimerHandle handle;
    };
   #endif

.
   #include "rsuApp.h"
   #include "ttr_m.h"
   #include "veins/modules/utility/TimerManager.h"
   #include <map>

   Define_Module(rsuApp);

   rsuApp::rsuApp(){}
   void rsuApp::initialize(int stage) {
   BaseWaveApplLayer::initialize(stage);
     auto ttrTimer = [this](){
                Ttr* ttr = new Ttr();
                populateWSM(ttr);
                sendDown(ttr);
          };
       auto ttrTimerSpec = Veins::TimerSpecification(ttrTimer).interval(1);
       handle=timerManager.create(ttrTimerSpec, "recurring timer");
   }

   void rsuApp::finish() {
     BaseWaveApplLayer::finish();
   }

   void rsuApp::onWSM(WaveShortMessage* wsm) {
     if(strcmp(wsm->getName(),"tip")==0){
       findHost()->getDisplayString().updateWith("r=60,red");
   //canceling the timer when a wsm message  is received
       timerManager.cancel(handle);
     }
   }

   void rsuApp::handleSelfMsg(cMessage* msg) {
    BaseWaveApplLayer::handleSelfMsg(msg);
     timerManager.handleMessage(msg);
   }

  void rsuApp::onBSM(BasicSafetyMessage* bsm) {}
  void rsuApp::onWSA(WaveServiceAdvertisment* wsa) {}
  void rsuApp::handlePositionUpdate(cObject* obj) {
   BaseWaveApplLayer::handlePositionUpdate(obj);
  }
  rsuApp::~rsuApp(){}


text:
Q: Is there a better way to generate rest api endpoints from an input file in python? I'm working on a project where I need to parse in a body of data which isn't necessarily going to be a static schema. Thus, I can't really hardcode API endpoints, and would like to generate them based on the data i parse in. I'm not very familiar with python & flask, but i think the usual way people would make a rest endpoint is like the following:
@app.route('/')
def index():
    return "Hello world!"

I'm interested in seeing if there is a way to generically define an API endpoint within a method, so that I could generate a multitude of endpoints based on the data i parse in.
def create_endpoint(string):
    @app.route(string: str)
    def new_route():
        return "This is a new route"

I'll have another endpoint which will list out all of the urls that will be generated so figuring out which routes to make requests to shouldn't be an issue imo. Is this bad practice in general? is there a better way to do this than I am currently thinking of?
Edit: to clarify,
So, i have a global dictionary, I'll call it "dataDict". When parsing my file, i put key value pairs into this dictionary. I want to create functions so that they return the corresponding values to a key; so, the path "/key1" would return the value at dataDict["key1"]

A: Rather than creating a route for each, cricket_007's suggestion to use path/query parameters probably works best here.


text:
Q: Trigger that inserts only updated column names I have created trigger that inserts names of the columns changed (insert, update, delete) in the audit table.
I have problem when I update columns. Lets say I have a table dbo.TABLE with columns COL1, COL2, COL3.
Further, lets say that I only have one row:
           COL1   | COL2   | COL3
          ---------------------------
           value1 | value2 | value3

If my update statement looks like this:
         Update dbo.TABLE set COL1 = 'test1', COL2 = 'test2';

In my audit table will be inserted:
         UPDATED
         -------
         COL1, COL2

This is OK, but lets say I have same table dbo.TABLE with first values (value1, value2, value3).
If my update statement looks like this:
         Update dbo.TABLE set COL1 = 'value1', COL2 = 'test2';

In my audit table same result will be inserted as above (COL1, COL2).
How can I alter my trigger so only updated column (COL2) will be inserted?
I need some kind of statement that will check value of column before updating.
My trigger is too big to put all of it here, so I will only put part of the code that returns columns updated.
SELECT  @idTable = T.id
FROM sysobjects P JOIN sysobjects T ON P.parent_obj = T.id
WHERE P.id = @@procid

SELECT @Columns_Updated = ISNULL(@Columns_Updated + ', ', '') + name
    FROM syscolumns t
    WHERE id = @idTable
    AND CONVERT(VARBINARY,REVERSE(COLUMNS_UPDATED())) & POWER(CONVERT(BIGINT, 2),  colorder - 1) > 0

This is original post from where I have taken the code:
SQL Server Update Trigger, Get Only modified fields

A: Are you able to prevent updates if the values are identical?  This would be the best approach, and allow you to use the same code you have in your trigger (not to mention far more efficient from an i/o perspective).
If the front end driving the updates is a UI, then I would drop a logging class in it to record before/after data using that.
Failing that, I think (someone else might correct me here) you'd need to use CDC (change data capture) to compare old/new values.


text:
Q: Generating a word list with Ruby I was wondering if there is way of creating an array that will create words with length n from a-z like:
n=3
    aaa
    aab
    aac
    ...
    xyz

and so on. I know that
   puts ('aa'..'zz').each { |letter| p letter }

will give me what I need but how can I implement it to where I dont have to change
   ('aa'..'zz')

every time and I can just change n (n being the numbers of a's and z's)

A: You were almost there
n = 3
(('a'*n)..('z'*n)).each { |letter| puts letter }

A: s = 'zz'
(26**3).times.map { s=s.next }
  #=> ["aaa", "aab",..., "zzy", "zzz"]


text:
Q: Awkward array add attributes in intervals I want to extract data out of a root file and get it into shape to end with a numpy array/tensor to fill  it into a neural-network. I am already able to get the track data I want in shape with a padding to convert it into a numpy array, but I want to extend my array with the data of the jet they are originated from. So I have the information of all the tracks, of each jet and the intervall of tracks they are corresponded too. My first instinc was to construct an array in the shape of the tracks and using something like np.dstack to merge those two.
import uproot4 as uproot
import numpy as np
import awkward1 as ak

def ak_into_np(ak_array):
    data=np.dstack([ak.to_numpy(x) for x in ak_array])
    return data

def get_data(filename,padding_size):
        f=uproot.open(filename)
        events= f["btagana/ttree;1"]
        track_data=events.arrays(filter_name=["Track_pt","Track_phi","Track_eta","Track_dxy","Track_dz","Track_charge"])
        jet_interval=events.arrays(filter_name=["Jet_nFirstTrack","Jet_nLastTrack"])
        jet_interval=jet_interval["Jet_nLastTrack"]-jet_interval["Jet_nFirstTrack"]

        jet_data=events.arrays(filter_name=["Jet_pt","Jet_phi","Jet_eta"])
        arrays_track=ak.unzip(ak.fill_none(ak.pad_none(track_data, padding_size), 0))
        arrays_interval=ak.unzip(ak.fill_none(ak.pad_none(jet_interval,padding_size),0))
        arrays_jet=ak.unzip(ak.fill_none(ak.pad_none(jet_data,padding_size),0))
        track=ak_into_np(arrays_track)
        jet=ak_into_np(arrays_jet)
        interval=ak_into_np(arrays_interval)

        return track,jet,interval

This is where I am so far. For efficiency reason I hope to be able to achieve this in awkward before going into numpy. I tried it in numpy with following:
def extend(track,jet,interval):
    events,tracks,varstrack=(np.shape(track))
    events,jets,varsjet=np.shape(jet)
    jet_into_track_data=[]
    for i in range(events):
        dataloop=[]
        for k in range(jets):
            if interval[i][k][0]!=0 :
                dataloop.append(np.broadcast_to(jet[i][k],(interval[i][k][0],varsjet)))
            else
    jet_into_track_data.append(dataloop)

    return jet_into_track_data

but it already takes about 3 seconds without even achieving my goal for only 2000 events. The aim is basically [track_variables] ->[track_variables,jet_variables if track is in intervall] and it shall be stored [(event1)[[track_1],...,[track_padding_size]],...,(eventn)[[track_1],...,[track_padding_size]]]

A: I don't get to see the structure of your original data and I don't have a clear notion of what the desired final state is, but I can give an example inspired by the above that you can adapt. Also, I'm going to ignore the padding because that only complicates things. You'll probably want to put off padding until you've finished the combinatorics.
The tracks and jets below come from the same set of events (i.e. the arrays have the same lengths and they're jagged, with a different number of tracks in each list and a different number of jets in each list). Since jets are somehow derived from tracks, there are strictly fewer jets than tracks, and I take it that in your problem, the link between them is such that each jet corresponds to a contiguous, non-overlapping set of tracks (the "intervals").
Real tracks and jets would have a lot more properties than these—this is a bare minimum example. I've given the tracks an "id" so we can tell one from another, but these jets only have the inclusive "start" index and exclusive "stop" index.
If your tracks don't come with identifiers, you can add them with ak.local_index.
>>> import awkward1 as ak
>>> tracks = ak.Array([[{"id": 0}, {"id": 1}, {"id": 2}],
...                    [],
...                    [{"id": 0}, {"id": 1}]])
>>> jets = ak.Array([[{"start": 0, "stop": 2}, {"start": 2, "stop": 3}],
...                  [],
...                  [{"start": 1, "stop": 2}, {"start": 0, "stop": 1}]])

If you had all combinations between tracks and jets in each event, then you could use a slice to pick the ones that match. This is particularly useful when you have imprecise matches (that you have to match with ΔR or something). The ak.cartesian function produces lists of combinations, and nested=True groups the results by the first argument:
>>> all_combinations = ak.cartesian([tracks, jets], nested=True)
>>> all_combinations.tolist()
[[[({'id': 0}, {'start': 0, 'stop': 2}),
   ({'id': 0}, {'start': 2, 'stop': 3})],
  [({'id': 1}, {'start': 0, 'stop': 2}),
   ({'id': 1}, {'start': 2, 'stop': 3})],
  [({'id': 2}, {'start': 0, 'stop': 2}),
   ({'id': 2}, {'start': 2, 'stop': 3})]],
 [[]],
 [[({'id': 0}, {'start': 1, 'stop': 2}),
   ({'id': 0}, {'start': 0, 'stop': 1})],
  [({'id': 1}, {'start': 1, 'stop': 2}),
   ({'id': 1}, {'start': 0, 'stop': 1})]]]

We can go from there, selecting "id" values that are between the "start" and "stop" values. I started writing up a solution, but the slicing gets kind of complicated, generating all Cartesian combinations is more computationally expensive than is strictly needed for this problem (though no where near as expensive as writing a for loop!), and the general view of the Cartesian product is more useful for approximate matches than the exact indexes you have.
Instead, let's write a for loop in Numba, a just-in-time compiler for Python. Numba is limited in the Python that it can compile (all types must be known at compile-time), but it can recognize read-only Awkward Arrays and append-only ak.ArrayBuilder.
Here's a loop that considers only tracks and jets in the same event, loops over tracks, and puts the first jet that matches each track into an output ArrayBuilder.
>>> import numba as nb
>>> @nb.njit
... def match(tracks_in_events, jets_in_events, output):
...     for tracks, jets in zip(tracks_in_events, jets_in_events):
...         output.begin_list()
...         for track in tracks:
...             for jet in jets:
...                 if jet.start <= track.id < jet.stop:
...                     output.append(jet)   # at most one
...                     break
...         output.end_list()
...     return output
...
>>> builder = match(tracks, jets, ak.ArrayBuilder())
>>> builder.snapshot().tolist()
[[{'start': 0, 'stop': 2}, {'start': 0, 'stop': 2}, {'start': 2, 'stop': 3}],
 [],
 [{'start': 2, 'stop': 3}, {'start': 0, 'stop': 2}]]

Notice that these jet objects are duplicated to match the appropriate track. (This "duplication" is actually just a pointer, not really a copy.) To attach this to the tracks, you can assign it:
>>> tracks["jet"] = builder.snapshot()
>>> tracks.tolist()
[[{'id': 0, 'jet': {'start': 0, 'stop': 2}},
  {'id': 1, 'jet': {'start': 0, 'stop': 2}},
  {'id': 2, 'jet': {'start': 2, 'stop': 3}}],
 [],
 [{'id': 0, 'jet': {'start': 2, 'stop': 3}},
  {'id': 1, 'jet': {'start': 0, 'stop': 2}}]]

Here, I've assumed that you want to attach a jet to each track—perhaps you wanted to attach the set of all associated tracks to each jet:
>>> @nb.njit
... def match2(tracks_in_events, jets_in_events, output):
...     for tracks, jets in zip(tracks_in_events, jets_in_events):
...         output.begin_list()
...         for jet in jets:
...             output.begin_list()
...             for track in tracks:
...                 if jet.start <= track.id < jet.stop:
...                     output.append(track)    # all tracks
...             output.end_list()
...         output.end_list()
...     return output
...
>>> jets["tracks"] = match2(tracks, jets, ak.ArrayBuilder()).snapshot()
>>> jets.tolist()
[[{'start': 0, 'stop': 2, 'tracks': [
      {'id': 0, 'jet': {'start': 0, 'stop': 2}},
      {'id': 1, 'jet': {'start': 0, 'stop': 2}}]},
  {'start': 2, 'stop': 3, 'tracks': [
      {'id': 2, 'jet': {'start': 2, 'stop': 3}}]}],
 [],
 [{'start': 1, 'stop': 2, 'tracks': [
      {'id': 1, 'jet': {'start': 0, 'stop': 2}}]},
  {'start': 0, 'stop': 1, 'tracks': [
      {'id': 0, 'jet': {'start': 0, 'stop': 2}}]}]]

(Since I did both, now there are links both ways.) Attaching jets to tracks, rather than tracks to jets, has the added complication that some tracks might not be associated with any jet, in which case you'd have to account for possibly-missing data. (Hint: make them lists of zero or one jet for "no match" and "yes match," then use ak.firsts to convert empty lists to Nones.)
Or you could make the output of the Numba-compiled function be plain NumPy arrays. Numba knows a lot of NumPy functions. Hint for building up a Numba-compiled function: start with a minimal loop over data that doesn't do anything, test-running it as you go add output. Numba complains with a lot of output when it can't recognize the types of something—which is allowed in non-compiled Python—so it's good to know which change caused it to complain so much.
Hopefully, these examples can get you started!


text:
Q: Define optional query parameters in serverless.yml I am fairly new to serverless framework (sls) and trying to define a function and deploy it to AWS.
While declaring a function in serverless.yml, I have defined the necessary parameters for a function along the lines of the following snippet but I am not able to define an optional query parameter in the http path of the new function:
function-name:
    handler: path/to/js/file.handler
    events:
      - http:
          path: api/v1/resource/{limit}
          method: GET

Desired behavior: The issue is that I am not able to declare an optional parameter in the path. I wish the endpoint would work as expected even if the limit parameter in not passed in the http GET request.
Note: I have tried path: api/v1/resource/{limit?} but no luck.

A: You can add another path for your Lambda to respond to.
function-name:
    handler: path/to/js/file.handler
    events:
      - http:
          path: api/v1/resource/{limit}
          method: GET
      - http:
          path: api/v1/resource/
          method: GET

Then, handle it properly inside your Lambda function.


text:
Q: React Native Node Could not start metro bundler
Getting following error while executing
command :  npx react-native start
Node Version : v17.3.0
Failed to construct transformer:  Error: error:0308010C:digital envelope routines::unsupported

A: You can find solution for this question Here
This error is occuring in Node.js 17. Downgrade your node version to an older version (~16).


text:
Q: Horizontal Div inside floats issue For some reason I cannot get the right menu to float right this is a horizontal div menu. the image and the left links are perfect.. the right just doesn't work, the are both in a single div.
I would like it to look like
logo--- link---link--link--link-----------------------------Date & Time
#menu {
    height: 37px;
    background-color: #000;
    border-bottom: 1px solid #1a1a1a;
    font-family: 'Lato', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

#left ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#left li {
    float: left;
}

#left li a {
    display: block;
    color: #777777;
    text-align: center;
    padding: 9px 14px;
    text-decoration: none;
}

#right ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#right li {
    float: right;
}

#right li span {
    display: block;
    color: #777777;
    text-align: center;
    padding: 8px 14px;
    text-decoration: none;
}

#menu img{
    margin-top: 6px;
    margin-right: 10px;
    margin-left: 10px;
    display: inline-block;
    float: left;
    height: 24px
}

link1

link2

link3

link4

Date & Time

A: You need to float your block level elements, otherwise they will still take up 100% width. So float #left and #right.

#menu {
    height: 37px;
    background-color: #000;
    border-bottom: 1px solid #1a1a1a;
    font-family: 'Lato', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

#left ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#left li {
}

#left li a {
    display: block;
    color: #777777;
    text-align: center;
    padding: 9px 14px;
    text-decoration: none;
}

#right ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#right li {
  padding-top: 9px;
}

#right li span {
    display: block;
    color: #777777;
    text-align: center;
    padding: 8px 14px;
    text-decoration: none;
}

#menu img{
    margin-top: 6px;
    margin-right: 10px;
    margin-left: 10px;
    display: inline-block;
    float: left;
    height: 24px
}

#left {
  float: left;
}

#right {
  float: right;
}

#menu li {
  display: inline-block;
}

link1

link2

link3

link4

Date & Time

A: I would suggest you check out flexbox: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

A: You can get a real good understanding from https://css-tricks.com/all-about-floats/. Give it a read .. :D
/* align all direct child of menu, in same horizontal .... */
#menu > * {
  display: inline-block;
  color: #fff;
}

/* float the right component to right, and add a margin to top to bring all to same level */
#right {
    margin-top: 10px;
    overflow: hidden;
    float: right;
}

#menu {
    height: 37px;
    background-color: #000;
    border-bottom: 1px solid #1a1a1a;
    font-family: 'Lato', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 50px;
}

#menu > * {
  display: inline-block;
  color: #fff;
}

#left ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#left li {
    float: left;
}

#left li a {
    display: block;
    color: #777777;
    text-align: center;
    padding: 9px 14px;
    text-decoration: none;
}

#right {
    margin-top: 10px;
    overflow: hidden;
    float: right;
}

#right ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

#right li span {
    display: block;
    color: #777777;
    text-align: center;
    padding: 8px 14px;
    text-decoration: none;
}

#menu img{
    margin-top: 6px;
    margin-right: 10px;
    margin-left: 10px;
    display: inline-block;
    float: left;
    height: 24px
}

link1

link2

link3

link4

Date & Time

A: Working Fiddle
Here is a simple hack. What I have done is added your right div inside left div, and it has done the trick.

link1

link2

link3

link4

Date & Time

CSS
#menu {
    height: 37px;
    background-color: #000;
    border-bottom: 1px solid #1a1a1a;
    font-family: 'Lato', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

#left ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#left li {
    float: left;
}

#left li a {
    display: block;
    color: #777777;
    text-align: center;
    padding: 9px 14px;
    text-decoration: none;
}

#right ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#right li {
    float: right;
    margin-top:10px;
}

#right li span {
    display: block;
    color: #777777;
    text-align: center;
    padding: 8px 14px;
    text-decoration: none;
}

#menu img{
    margin-top: 6px;
    margin-right: 10px;
    margin-left: 10px;
    display: inline-block;
    float: left;
    height: 24px
}


text:
Q: How to get the count of authentications in firebase console in the flutter app? How to get the count of Authentications in firebase console by using flutter for example:
1000 users are authenticated to my app. i can see the users who are authenticated to my application through firebase console.But I need to get the count of authentications (1000) in my flutter admin applications.
Now i'm getting the authentication count with the help of cloud firestore by simply create the collection and inside the document i'm incrementing the count of integer whenever the new user sign in.
Is there any way to do it without the help of cloud firestore.Kindly help me to solve this issue.
Thanks in advance..

A: As Dharmaraj commented, you get get a list of all users from the Firebase Admin SDK. This SDK cannot be used directly in your Flutter app though, and is meant to be used only in trusted environments. I also don't think it's the best fit for your use-case, as listing all users is going to slow down as you add more users to your app.
Keeping a count of what you want to show in the database (as you already seem to be doing) is probably the right approach here, as it amortizes the cost of maintaining the counter over the user actions, makes the reads trivial, and allows you to track exactly the count of actions that fits with your use-case.


text:
Q: need Date Picker Set or cancel listener in Android i need DatePicker dialog cancel button or set button event listener  so that i can move to specific activity by pressing any button
any help will be welcomed.

A:    public void onDateSet(DatePicker view, int year, int month, int day) {

}

When Click on set or Done  (in some later OS) this Method is called and simply worked with it to handle my scenario


text:
Q: Should behavior of Cube[] and Cuboid[] be the same in these cases? Bug introduced in v12.0 (?) and fixed as of 12.3.1
While attempting to export a symbol with head Region (or Graphics3D) as an OBJ file, I run in to problems using Cube[] that are not readily apparent with Cuboid[].
c1 = Region[Cube[]];
c2 = Region[Cube[100]];
c3 = Region[Cuboid[]];
c4 = Region[Cuboid[{100, 100, 100}]];
Export["c1.obj", c1];
Export["c2.obj", c2];
Export["c3.obj", c3];
Export["c4.obj", c4];
Export["c1a.obj",
  TransformedRegion[c1, ScalingTransform[100 {1, 1, 1}]]];
Export["c3a.obj",
  TransformedRegion[c3, ScalingTransform[100 {1, 1, 1}]]];

In this example, file c1a.obj doe not get generated with two errors being thrown: Region cannot be exported to the OBJ format and RuleDelayed cannot be exported to the OBJ format.  The same behavior is observed if Graphics3D symbols are used.
Is this behavior working as intended?  I believe this to be a bug - I am using Version 12.0.0 at the moment.

A: Bug found in v12.0 and fixed as of 12.3.1.


text:
Q: How to run Ansible as synchronization way? I run a python script like this:
#!/usr/bin/env python
import subprocess,time

command = "ansible all -i /etc/ansible/hosts -m shell -a 'echo $(date)>>/tmp/111.txt && sleep 10 && echo $(date)>>/tmp/111.txt'"
subprocess.Popen(command, shell=True)
time.sleep(10)
print ("OK,DONE!")

This is a very sample script,just run a ansible and wait 10 seconds,that should take 20 seconds,but i found the result is only 10 seconds when i finish this script.
Why? How could i fix it?
by the way,my ansible is 2.5.4.

A: You are running your ansible command asynchronously. See this answer here which shows how to use subprocess in a synchronous way: https://stackoverflow.com/a/22698825/4276009


text:
Q: Inheritance of composition relationship in C++ I quite often confront myself to this problem. Let's say I have these classes:
class B
{
  public:
    virtual std::string className(){return "B";}
};

class A
{
  public:
    A()
    : _B(new B)
    {}

    virtual std::string className(){return "A";}

    virtual void desc()
    {
      std::cout << "I am " << className() <<
        " and I own: " << _B->className() << std::endl;
    }

  protected:
    B * _B;
};

Then, I want to extend A and B with new information. I am sure that SuperA and SuperB have a "is-a" relationship with A and B, respectively. The straightforward way would be to do try inheritance:
class SuperB: public B
{
  public:
    virtual std::string className(){return "SuperB";}
}

class SuperA: public A
{
  public:
    SuperA()
    : A()
    , _superB(new SuperB)
    {}

    virtual std::string className(){return "SuperA";}

    virtual void desc()
    {
      std::cout << "I am " << className() <<
        " and I own: " << _superB->className() << std::endl;
    }
  protected:
    SuperB * _superB;
};

But this is obviously not good, since SuperA would have actually two Bs: the one from the A class, and the other from its SuperB class. And the override of desc is not so elegant.
I can see that I could have setters and getters on B* in A and override them in SuperA to use a SuperB instead of a B, and never refer to to B* directly and always use the getter, but this seems a bit intrusive for A.
Trying to compose, i.e. having SuperA owning an A* instance does not look better either.
And it gets even harder if A owns not a single B* but a say std::vector<B*>.
Is this a common problem? Is there an elegant solution that I don't see for it?

A: You could just have A have a protected constructor that takes a B*:
class A {
public:
    A()
    : _B(new B)
    { }

protected:
    A(B* b)
    : _B(b)
    { }
};

So that:
class SuperA : public A {
public:
    SuperA()
    : A(new SuperB)
    { }
};


text:
Q: BMO in each dimension uniformly implies BMO in higher-dimensional space I want to prove the following but don't know how. It is probably easy to generalize it to $\mathbb{R}^n$ if the case $n=2$ is proved.
Suppose $f(x, y)$, $(x, y) \in \mathbb{R}^2$ is for each $y$ a BMO($\mathbb{R}$) function in $x$, uniformly in $y$. Assume also that this holds when the roles of $x$ and $y$ are interchanged. Then $f \in BMO(\mathbb{R}^2$).


text:
Q: 4 lists into a list of tuples I have 4 lists;
[1,3,6][1,5,9][1,2,4]['A','B','C']

I want to create one list of tuples like so
[(1,1,1,'A'),(3,5,2,'B'),(6,9,4,'C')]

A: Use the built-in zip function:
>>> zip([1,3,6],[1,5,9],[1,2,4],['A','B','C'])
[(1, 1, 1, 'A'), (3, 5, 2, 'B'), (6, 9, 4, 'C')]

It works with other iterables too.


text:
Q: shortcode_unautop shortcode not functioning I have made my own theme with shortcodes to WordPress.
In my filters I have:
remove_filter('the_content', 'wpautop');
add_filter('the_content', 'wpautop', 99);
add_filter('the_content', 'shortcode_unautop', 100);

This should remove paragraph tags around and in my shortcodes.
My shortcode output (partial of the entire code):
$output .= '

                ' . $logo . '

Læs case

' . get_the_title() . '

' . get_post()->post_excerpt . '

';

// Script newlines whitespace, tabs etc.
return str_replace(["\r", "\n", "\t"], '', '
' . $output . '
');

This produces:

Læs case

Nori

Læs case

AN-IVY. Nyt gentleman brand med stor passion for fashion, og klassisk herretøj

AN-IVY er et brand startet i 2013. De designer herrekollektioner der er inspireret af Ivy Leagues tradioner og moderne fashion. De har en stor passion for mode og klassisk herretøj.

Læs case

Powderstore

Note the additional
 tags at line 15, 29 and 43.
The paragraph tags disappear if I remove the anchor tag in my shortcode, but that's not a solution I can use.

A: The above solution doesn't work if you're using Advanced Custom Fields. When using ACF, the following code does work:
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'acf_the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99);
add_filter( 'acf_the_content', 'wpautop' , 100);
add_filter( 'the_content', 'shortcode_unautop',110 );
add_filter( 'acf_the_content', 'shortcode_unautop',111 );

A: Maybe try removing all the newlines from the output itself, since this is what is ultimately being messed with...
$output .= '
';
$output .= '';
$output .= '
';
$output .= $logo;

...and so forth. If the newlines are gone maybe wpautop will leave the shortcode output alone.
otherwise, since it is a very specific and misformatted string output, you could always fix for it after the fact:
add_filter('the_content','shortcode_fix',110);
function shortcode_fix($content) {
    return str_replace('

','
',$content);
}

....

A: This is the solution:
function wpex_fix_shortcodes($content) {

    return strtr($content, [
        '
[' => '[',
        ']
' => ']',
        ']
' => ']'
    ]);

}

remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'do_shortcode', 11);

add_filter('the_content', 'wpautop', 100);
add_filter('the_content', 'wpex_fix_shortcodes', 105);
add_filter('the_content' , 'do_shortcode', 110);

This runs wpautop before do_shortcode, but removes the paragraph tags before and after the unformatted shortcodes, then runs do_shortcode.
EDIT
The solution above can also cause some HTML errors. Best practice would be to remove wpautop filter, and then add a shortcode which calls wpautop around content. Like this:
add_shortcode('text', function($attributes, $content = null)
{

    // Output
    return do_shortcode(wpautop($content));

});


text:
Q: OpenShift Git Clone error I am a newbie on OpenShift , I have a problem with it ,
When I do
rhc app git-clone mynewapp

Your public ssh key must be uploaded to the OpenShift server.  Would you like us to upload it for you? (yes/no) yes

You can enter a name for your key, or leave it blank to use the default name. Using the same name as an existing key will overwrite
the old key.

Since you do not have any keys associated with your OpenShift account,
your new key will be uploaded as the 'default' key

type: ssh-rsa
content:
AAAAB3NzaC1yc2EAAAADAQABAAABAQCuA9kdmq5Pf5JLyHeMpWQ+XYaEzw8UWziUfXohMR8Dt9ZwkIb4WSHLzcGKKpclZvWOi2UZMQCOp8wCij5VS/ps8/3YPQVYyg+GHAAZIr
WsGDnJdpRF/shUnvoPx6XTzzLFHxBOS92LktjvX/T+xqftS6aVugD0cQ0vVkA6e5FwIjwo4JHoJGRFzgdaSbC5nDiHvDX7zhtnQXe1TeTK5nhjDj/uZPaj5h0hRv4Zx0EzfDYu
Uig0GCoFrWsJ9MTw5F7WEeOtPNtp2uFubuDCDpoBtBBDDmL642AY8r9IV4REGSfUDzV+M0Ab33ubRYKmp+ok6MtBrlTKg94PaVvuf2V5
fingerprint: eb:41:87:1b:e8:4e:ec:c0:8d:c8:c6:5e:a2:6a:ad:b4
Uploading key 'default' from /home/toriq/.ssh/id_rsa.pub
Cloning into 'myapp'...
done

Suddenly an error appear:
Error in git clone - Agent admitted failure to sign using the key.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: The remote end hung up unexpectedly

Any solution for this ?

A: It could be similar to this GitHub help page:

For most users, simply running ssh-add to load your keys into the SSH agent will fix this issue.

$ ssh-add
# Enter passphrase for /home/you/.ssh/id_rsa: [tippy tap]
# Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa)

If your key does not have the default filename, you'll have to pass the path to ssh-add:

$ ssh-add ~/.ssh/my_other_key
# Enter passphrase for /home/you/.ssh/my_other_key: [tappity tap tap]
# Identity added: /home/you/.ssh/my_other_key (/home/you/.ssh/my_other_key)

A: You can install rhc openshift client tools
Then run setup which will then upload your ssh keys.
rhc setup


text:
Q: Which is the correct way to ensure you end up with an Array greater than 1 after Splitting? I am currently doing a big project (by big I mean, many processes) where every millisecond I save means a lot (on the long run), so I want to make sure I am doing it the right way.
So, what is the best way to ensure you will have an array greater than 1?

*

*a) use indexOf(), then if result is different than -1, split()

*b) split (regardless if characters exist), then do stuff ONLY if the
array.length is greater than 1

*c) another not listed above

A: Using jsPerf, it appears that omitting .indexOf() is roughly 23% more efficient that including it over 500,000 iterations  (11.67 vs. 8.95 operations per second):
Without indexOf():
var str = "test";
for (var i = 0; i < 500000; i++) {
    var test = str.split('.');
}

With .indexOf():
var str = "test";
for (var i = 0; i < 500000; i++) {
    if (str.indexOf('.')) {
        var test = str.split('.');
    } else {
        var test = str;
    }
}

http://jsperf.com/split-and-split-indexof
EDIT
Hmm... If the following line is:
if (str.indexOf('.') > -1)

http://jsperf.com/split-and-split-indexof-with-indexof-check
Or any other comparison, it's seemingly quite a bit faster (by about 69%).
The only reason I can think this is the case is that running .split() on every variable will perform two functions on each value (find, then separate), instead of just one when necessary. Note, this last part is just a guess.

A: We can see that even when there is something to split the best results come from doing the indexOf test against a value.  Still the improvement is worse that the cases where 100% of items don't need a split.   Thus as you have more items needing to be split testing returns less benefit (as would be expected).    So it really depends on the use case since the extra code takes up memory and uses resources.
http://jsperf.com/split-and-split-indexof/2

A: (b) is obviously more efficient than (a) because split uses the same logic as indexOf and that logic will not need to be repeated if there are indeed more than 2 elements. i cannot think of a more efficient way.


text:
Q: Enabling compile-time AspecJ for Spring Method Security Spring AOP runs everything through proxies which sadly can't be everywhere. For this reason Spring Security's annotations @PreAuthorize, @PostAuthorize, @PreFilter and @PostFilter (also @Secured) will not be taken into consideration when calls are not going through said proxies. Proxies are created only for singletons (@Beans) so We are greatly limited when We want to secure methods on specific objects (such as JPA @Entities) that are not beans. Proxies also won't be called within calling objects (bean calling its methods in context of self - this).
I know that Spring has suppot not only for Spring AOP but also real AOP - AspectJ. Not only that, but it SHOULD support AspectJ out of box. Testament to this is:
@EnableGlobalMethodSecurity(mode = AdviceMode.ASPECTJ, securedEnabled = true, prePostEnabled = true)

When enabled, Spring will require (crash on startup otherwise) aspectj dependency, which is provided within:
'org.springframework.security:spring-security-aspects'

After adding this dependency we will have AspectJ libraries in classpath and will get:
org.springframework.security.access.intercept.aspectj.aspect

with:
public aspect AnnotationSecurityAspect implements InitializingBean

But here it all ends. There is no documentation that I could find that would state how to further enable aspectj weaving. Setting @EnableGlobalMethodSecurity(mode = AdviceMode.ASPECTJ) certainly DOES something as we lose standard Spring AOP - security annotations stop working anywhere (on Beans) and at the same time they are not weaved with AspectJ.
Does anyone have some knowledge on Spring's support for this out of box (compile-time weaving) and what further configuration is needed? Maybe I need to weave it myself? Do I need some specific libraries for building?
Version: Spring 5.2.1.RELEASE (all packages).

A: @DimaSan comment helped me find few threads/issues I missed while doing my search and while many of them are too years-outdated I managed to setup my app.
Turns out I was actually very close and by making few updates and changing dependencies/plugins on gradle I have a working environment.
Gradle: 5.6.4

with:
plugins {
    id "io.freefair.aspectj.post-compile-weaving" version "4.1.6"
}
dependencies {
    aspect 'org.springframework.security:spring-security-aspects'
    runtime 'org.springframework.security:spring-security-aspects'
}

Spring setup at 5.2.1.RELEASE with
spring-boot-starter-
   web
   data-jpa
   security

With above setup this is actually only thing needed:
@EnableGlobalMethodSecurity(mode = AdviceMode.ASPECTJ, securedEnabled = true, prePostEnabled = true)

Finally if You are not using Gradle (e.g. want to use STS/Eclipse Run Configuration), you will add:
-javaagent:C:\Users\USER\.gradle\caches\modules-2\files-2.1\org.aspectj\aspectjweaver\1.9.4\<cache-string>\aspectjweaver-1.9.4.jar

.gradle and 1.9.4 being case for my current setup/version.
Note that this is yet untested (but working with JPA/Hibernate) with e.g. Transaction management and I will comment on it once I start using complex transactions where weaving would create issues.


text:
Q: Why does my RandomForestClassifier train much more slowly when placed in a pipeline? I am working with a large data set (1.7 million samples) and am trying to train a classifier. I've had good results with scikit-learn's RandomForestClassifier, and now I want to perform permutation feature analysis on my classifier with scikit-learn's permutation_importance method. To do so I've put my preprocessing into a ColumnTransformer, and placed it into a Pipeline along with my classifier.
I have been doing my preprocessing and training my classifier as separate steps, and it takes about 6 seconds to train an individual tree. However, when set up in a pipeline, the same classifier takes about 5 minutes to train a tree. I'm using a very large number of trees (and please, I'm not looking for feedback on that), and this is not really practical for me to work with.
I've dug around on the web extensively, but apparently can't find the right combination of search terms. Here is the relevant code:
preprocessing = ColumnTransformer(
    [
        ('binary', OneHotEncoder(drop='if_binary'),
         binary_category_cols),
        ('complete', OneHotEncoder(),
         complete_category_cols),
        ('inc_cat', OneHotEncoder(drop=[-9]*len(incomplete_category_cols)),
         incomplete_category_cols),
        ('inc_ord', OneHotEncoder(drop=[-9]*len(incomplete_ordinal_cols)),
         incomplete_ordinal_cols),
        ('cmp_ord', OrdinalEncoder(),
         complete_ordinal_cols)
    ], verbose=True, n_jobs=10
)

rf_clf = RandomForestClassifier(
    n_jobs=10, verbose=3,
    n_estimators=1000, criterion='entropy',
    max_depth=None, max_features='sqrt',
    max_samples=None, class_weight='balanced_subsample'
)

clf = Pipeline(
    [
        ('preprocess', preprocessing),
        ('classifier', rf_clf)
    ]
)

X_train, X_test, y_train, y_test = \
    train_test_split(features, targets, test_size=0.1)

clf.fit(X_train, y_train)

'features' is a pandas DataFrame, and targets is a pandas Series. I can comment out the pipeline, fit and transform X_train with the ColumnTransformer, and then fit the RandomForestClassifier, and trees are built at about 50 times the speed.
I've tried feeding both configurations much smaller chunks of my data, and the difference is far less, so maybe there are limitations to Pipeline with respect to large data sets? If I set max_samples to 100,000, performance is manageable, but performance goes down substantially.
Any help would be much appreciated. I've been banging my head on my desk for about four hours on a stumbling block I had in no way anticipated.

A: Given that you are setting n_jobs to 10, my guess is that you are trying to do multiprocessing. In that case, you might want to consider running your script within a __name__ == "__main__" block.
See: https://scikit-learn.org/stable/auto_examples/model_selection/grid_search_text_feature_extraction.html#sphx-glr-auto-examples-model-selection-grid-search-text-feature-extraction-py
For an example pipeline that does hyperparameter search, but that uses the Pipeline object you are using, and explicitly sets n_jobs.
Also: Python scikit learn n_jobs
At least in my case, it has allowed me to decrease runtime when doing hyperparameter search for RandomForestClassifier.


text:
Q: Chained selectors in jQuery: apply selector in already filtered results IGNORE: http://jsfiddle.net/gulcoza/9cVFT/1/
UPDATED FIDDLE: http://jsfiddle.net/gulcoza/9cVFT/4/
The whole code is in the above fiddle, but I will explain here also:
HTML

1

2

3

4

5

6

7

8

9

10

jQuery
console.log(
    $('ul li:visible:nth-child(4n)')
);

My Expected result: li#e6, li#e10 - why? because I want the 4n elements only from the visible ones.
But
Actual Result: I get the 4n element from all only if they are visible.
console.log(
    $('ul li:visible').filter(function(index) {
        if ((index + 1) % 4 ==0) return true;
    })
);

I am interested in any nicer solution than the following one:
console.log(
    $('ul li:visible').filter(function(index) {
        if ((index + 1) % 4 ==0) return true;
    })
);

UPDATED FIDDLE:
http://jsfiddle.net/gulcoza/9cVFT/4/
Why doesn't number 4 work. At the moment filter is called the results should be filtered already, IMHO. :|
// 4 - could be a nice solution
console.log(
    $('ul li:visible').filter(':nth-child(4n)')
);

Why doesn't this work? At $('ul li:visible') moment only the visible one should be available.

A: That's because nth-child matches elements on the basis of their positions within a parent element's list of child elements not on the basis of jQuery Collection (selected elements), in this you have to use filter method, filter method is also faster that chained-string selectors.
This is how the selectors filter the elements:
$('ul li:nth-child(4n):visible')
//       ^            ^---- [li#e8]
//       |
//       | --- [li#e4.hidden, li#e8]

$('ul li:visible:nth-child(4n)')
//       ^            ^---- [li#e8]
//       |
//       | --- [li#e1, li#e3, li#e5, li#e6, li#e7, li#e8, li#e9, li#e10]
//             [1,     3,     5,     6,     7,     8,     9,     10]

A: As you now know - the best way to do this is your way.
The reason this was not working as you expected is because the :nth-child pseudo selector is selecting elements based on their position within the parent element.
Note also that the selector string is a string of CSS selectors, and are not to do with JavaScript.
I found a good answer on another question about JS/CSS here
I would suggest you create your own method like this:
$.fn.nthChildren = function(n){
    this.filter(function(index) {
        if ((index + 1) % n ==0) return true;
    })
}
console.log(
    $('ul li:visible').nthChildren(4);
);


text:
Q: c# Deserialize Json String I'm new to REST (moving from SOAP). I'm trying to deserialize a JSON string i'm getting as result to a REST API call.
This is the json string:
{
  "message": "SUCCESS",
  "result": "{\"code\":\"610a187f80e24542bd5342d93c810a04\",\"rtime\":\"2021-06-17 19:40:03\",\"data\":\"08000002=2021-06-17 19:42:06\",\"ref_code\":\"\",\"stime\":\"2021-06-17 19:40:03\",\"source\":\"inhe-iot-crw_192_168_0_201_7021\",\"cycle\":0,\"operator\":\"ADMIN\",\"head\":\"inhe-ami-center/51ad33de59bb44dda693ec9811cec826\",\"result\":\"S\",\"times\":0,\"dev\":{\"ptct\":\"1/1|1/1\",\"svn_type\":\"791f88ae4392a682eb74\",\"con\":\"\",\"scheme\":\"DLMS_WRAPPER_645\",\"svn_no\":12,\"id\":\"00036178fedf95aa8b68\",\"addr\":\"037222663645\"},\"op_content\":\"037222663645||0\",\"ptime\":\"2021-06-17 19:40:03\",\"op_times\":\"0\",\"module_type\":\"001\",\"ip\":\"\",\"params\":\"\",\"priority\":9,\"packet\":\"S:0001000100010018E6000508AAA4C5DD68453666227203681104D3343337CE16,R:FEFEFEFE6845366622720368910BD334333733395D464439482916\",\"cmd_type\":\"R-READ\",\"field\":\"08000002\",\"expire\":10,\"etime\":\"2021-06-17 19:40:04\",\"data_ptct\":\"08000002=2021-06-17 19:42:06\"}",
  "code": 0,
  "sign": "d488e1e531837929faeac2518c1659e6",
  "timestamp": 1623969605496
}

What i need in the value for rtime field.
This is my code:
var json_serializer = new JavaScriptSerializer();
        var routes_list = (IDictionary<string, object>)json_serializer.DeserializeObject(AMI_GetResult.GetResult(data));
        return string.Concat(routes_list["rtime"]);

I'm receiving this error:
System.Collections.Generic.KeyNotFoundException
I understand that rtime is not being found in the parse, my question is:
How can i get the timestamp value for rtime?
Thanks for your help.

A: Result property does not contain another json object it contains json string, you need to deserialize it again. For example using Json.NET it can look something like that:
public class Outer
{
    public string Result { get; set; }
}

public class Inner
{
    public string RTime { get; set; } // or even make it of type DateTime, but there can be some format related issues
}

var outer = JsonConvert.DeserializeObject<Outer>(json);
var inner = JsonConvert.DeserializeObject<Inner>(outer.Result); // RTime prop will contain needed data


text:
Q: Thumbnail pictures breaking early I have a group of thumbnails that display 3 at a time horizontally. When I my browser goes below 988 pixels, the 3 horizontal thumbnails go vertical even though there is plenty of space. Any idea how to avoid this?

                {{product.sale_title}} picked out by {{product.fashionista.full_name}}

{{product.fashionista.location}} {{product.released_at | date}}

                {{product.user}} | {{product.sale_price | currency}}

{{product.sale_description}}

A: You could use
col-xs-*

that will propagate up, so it's equivalent to having:
"col-xs-* col-sm-* col-md-* col-lg-*"

on your column element.


text:
Q: Undo checkin in TFS using visual studio 2012: rollback will not give me my pending changes back I accidentally pressed the Checkin button when I had a list of all my pending changes (in several solutions) open (and I had disabled the confirmation prompt a few years ago, have restored it now though).
I know I can do a rollback of the specific changeset, but this will not give me back my checked out items as it will just overwrite the changes of the changeset with new changes.
Does anybody know of a way to undo the checkin and get my checked out items and changes back?
Perhaps there is an extension to do a rollback, keep al the changes locally and check out those files again.
Or there is another automated way to keep al the changes and check out the files (manually checking out each file is to much work).

Edit
There doesn't seem to be a perfect way. For me the best solution was to 'Rollback the rollback'as stated in https://stackoverflow.com/a/24896432/1343595


text:
Q: MQQueueManager constructor fails when adding USER_ID_PROPERTY to Hashtable Basically, I was given a task at work that involves using IBM MQ and C#, and while I am good with C#, I am a total newbie when it comes to Network programming and IBM MQ (As in I barely started using IBM MQ yesterday).
Anyway, after reading through a lot of guides, and examples, and troubleshooting a lot of stuff I managed to make a C# solution that connects to a QueueManager, and successfully sends and reads messages. However, I only managed to do so by disabling the default Authorisation, and while that was good when all I needed to do was test my Adapter class, I now need to be able to specify an User Id and a Password, and eventually restore all the Authorisation settings I disabled.
Here is the problem though, whenever I try to add the USER_ID_PROPERTY property to the connectionProperties Hashtable the QMQueueManager constructor returns a Null reference System Exception.
Here is the code where I build the Hashtable;
Hashtable connectionProperties = new Hashtable();

        // Add the connection type
        connectionProperties.Add(MQC.TRANSPORT_PROPERTY, connectionType);

        // Set up the rest of the connection properties, based on the   connection type requested
        switch (connectionType)  {

            case MQC.TRANSPORT_MQSERIES_BINDINGS: break;

            case MQC.TRANSPORT_MQSERIES_CLIENT:
            case MQC.TRANSPORT_MQSERIES_XACLIENT:
            case MQC.TRANSPORT_MQSERIES_MANAGED:
                //connectionProperties.Add(MQC.USER_ID_PROPERTY, "newUser");
                connectionProperties.Add(MQC.HOST_NAME_PROPERTY, hostName);
                connectionProperties.Add(MQC.PORT_PROPERTY, 1421);
                connectionProperties.Add(MQC.CHANNEL_PROPERTY, channel);
                connectionProperties.Add(MQC.CONNECTION_NAME_PROPERTY, connectionName);
                break;

            default:
                Console.WriteLine(connectionType + " is not a valid connection type");
                break;
        }

        return connectionProperties;

If I run the code as is, everything works out fine, I get connected to the Queue, send, read, and disconnect without an issue, the moment I uncomment the Use ID line, I get a Null Reference System Exception on the following line;
qmQueueManager =  new MQQueueManager(qManager, connectionProperties);

This is the exception message that pops up:

A System error occurred: System.NullReferenceException: Object reference not set to object instance.
  At IBM.WMQ.MQQueueManager.Connect (String queueManagerName)
     At IBM.WMQ.MQQueueManager..ctor (String queueManagerName, Hashtable properties)
     At MQNetworkClient.MQManager.ConnectMQ (String details) Location C: \ Users \ A440 \ Documents \ Visual Studio 2017 \ Projects \ MQNetworkClient \ MQNetworkClient \ MQManager.cs: Line 124
     At MQNetworkClient.MQManager.TryMQAction (MQSanityCheck sanityCheck, MQActionHandler mqAction, String details, String sanityFailMessage) Location C: \ Users \ A440 \ Documents \ Visual Studio 2017 \ Projects \ MQNetworkClient \ MQNetworkClient \ MQManager.cs: Line 95

The error message doesn't give me much to go on, and while I checked the QueueManager's AMQError Logs but nothing gets written there.
I would really appreciate any solution, work-around, or any help tracing the issue, basically, I would grateful to get any kind of advice that could potentially point me towards the right direction here.
In case it is somehow relevant, I am using IBM MQ v9, and Visual Studio 2017.
Thank you.

A: This is a product defect (I've also raised it as such). Basically if you provide a userid you MUST provide a password as the code dereferences the password field without first checking it is supplied... Sorry!

A: I think you have a different issue.  I set the UserId and Password as a Hashtable property all the time in C# .NET without any problems.  See my post HERE.
Try a different/lower .NET framework version.  i.e. You may be using one that is not supported by IBM.


text:
Q: Using JTable for a JTree cell editor I would like to use a JTable for editing a JTree, I extended DefaultTreeCellEditor and implemented isCellEditable getTreeCellEditorComponent, in getTreeCellEditorComponent I return a JTable. Everything works up to this point when a node is edited swing displays the JTable filled with the objects content however when editing is complete, valueForPathChanged of DefaultTreeModel never gets called. If I use a text field for editing which is the default everything works fine.

A: JTextField has a notifyAction, named "notify-field-accept" and typically bound to KeyEvent.VK_ENTER, that signals the CellEditor to stopEditing() and ultimately invokes  the DefaultTreeCellEditor method, valueForPathChanged().
It's not clear how you indicate that editing is complete for your JTable. You should be able to do something similar with the JTextField in a CellEditorListener that is added to your custom editor via addCellEditorListener().
Incidentally, valueForPathChanged() mentions that "If you use custom user objects in the TreeModel you're going to need to subclass this and set the user object of the changed node to something meaningful."


text:
Q: удаление пробела в php я загружаю данные из xml в базу SQL
при удалении пробела не удаляется как мне быть помогите пожалуйста решить проблему.
  $TYPE=$TICKET->TYPE;
  $x=$TICKET->SYSTEM->attributes();
  $bso_id=$x['bso_id'];
  $id=$x['id'];
  str_replace(" ", "", trim($session=$x['session']));

echo $sql="INSERT INTO TICKET ([TYPE],[bso_id],[id],[session])
      VALUES ('".$TYPE."','".$bso_id."','".$id."','".$session."')";
      $conn->execute($sql);

A: вы не сохраняете результат обработки строки в переменную
$session = str_replace(" ", "", trim($x['session']));


text:
Q: Spark scala Casting Unix time to timestamp fails I am having problem on converting unix time to timestamp.
I have a Dataframe, one column is PosTime. I would like to convert it to Timestamp, but it is half working. can you help?
scala> adsb.printSchema()
root
 |-- Icao: string (nullable = true)
 |-- Alt: long (nullable = true)
 |-- Lat: double (nullable = true)
 |-- Long: double (nullable = true)
 |-- PosTime: long (nullable = true)
 |-- Spd: double (nullable = true)
 |-- Trak: double (nullable = true)
 |-- Type: string (nullable = true)
 |-- Op: string (nullable = true)
 |-- Cou: string (nullable = true)

scala> adsb.show(50)
+------+------+---------+----------+-------------+-----+-----+----+--------------------+--------------------+
|  Icao|   Alt|      Lat|      Long|      PosTime|  Spd| Trak|Type|                  Op|                 Cou|
+------+------+---------+----------+-------------+-----+-----+----+--------------------+--------------------+
|ABECE7|  4825|40.814442| -111.9776|1506875131778|197.0|356.0|B739|     Delta Air Lines|       United States|
|4787B0| 38000|     null|      null|         null| null| null|B738|           Norwegian|              Norway|
|D3B18A|  4222|     null|      null|         null| null| null|null|                null|Unknown or unassi...|
|3C3F78|118400|     null|      null|         null| null| null|null|                null|             Germany|
|AA1C45|   -75|40.695969|-74.166321|1506875131747|157.4| 25.6|null|                null|       United States|
 scala> val adsb1 = adsb.withColumn("PosTime", $"PosTime".cast(TimestampType))

scala> adsb_sort.show(100)
+------+-------+---------+---------+--------------------+-------+-------+----+----+--------------------+
|  Icao|    Alt|      Lat|     Long|             PosTime|    Spd|   Trak|Type|  Op|                 Cou|
+------+-------+---------+---------+--------------------+-------+-------+----+----+--------------------+
|FFFFFF|   null|     null|     null|                null|   null|   null|null|null|Unknown or unassi...|
|FFFFFF|1049093|      0.0|      0.0|49800-05-04 14:39...|28672.0| 1768.7|null|null|Unknown or unassi...|
|FFFFFF|  12458|      0.0|      0.0|49800-12-11 06:39...|    0.0| 2334.4|null|null|Unknown or unassi...|

A: Spark interprets Long as timestamp in seconds but it looks like data is in milliseconds:
scala> spark.sql("SELECT CAST(1506875131778 / 1000 AS timestamp)").show
+-------------------------------------------------------------------------+
|CAST((CAST(1506875131778 AS DOUBLE) / CAST(1000 AS DOUBLE)) AS TIMESTAMP)|
+-------------------------------------------------------------------------+
|                                                     2017-10-01 18:25:...|
+-------------------------------------------------------------------------+

If I am right, just divide by 1000:
adsb.withColumn("PosTime", ($"PosTime" / 1000).cast(TimestampType))


text:
Q: How does nested powers work? Sir Roger Penrose has quantified the "very special" nature of the big bang as being "1 part in 10 to the 10 to the 243", but I do not understand what this really means - my apologies but I cannot even write the figure properly, either using notation, as my phone only copes with 1 line of superscript, or by employing solely regular numerals, as apparently even if I could fit each zero onto it's own proton there would still not be enough protons in the observable universe for me to complete it, (or have I misconstrued Sir Roger here? Presumably he at least understands the basics of scientific notation!)

A: You can interpret the number you mentioned, $10^{10^{243}}$, as '1 with $10^{243}$' zeros behind it, where $10^{243}$ is 1 with 243 zeros behind it. It's a very big number. E.g. even $10^{10^2}$ is 1,000,000,...[with 94 more zeros].


text:
Q: With pandas, how to resample and apply a function to add a column? I'm totally new to pandas and doing my first steps. I'm stuck even researching brings nothing up, most likely I'm not using the right terms.
I have initial data in the following form
           datetime    counter
2019-06-01 17:57:54  159411631
2019-06-01 17:57:54  159411642
2019-06-01 17:57:54  159411642
2019-06-01 17:58:03  159411642
2019-06-01 17:58:03  159411643

This represents the cumulative total value of my electric consumption directly read from the counter.
I would now like to calculate the consumption per day from this data.
I'm trying to resampling the data per date:
res = df.resample('D').max() - df.resample('D').min()

This does not work as pandas does not know how to subtract the date column. I don't know how to select just one column... and I'm not sure selecting a column explicitly is the pandas'ish way to do.
What would be the right way to get the daily consumption from the above data?
      date  consumption
2019-06-01         3968
2019-06-02         9491
2019-06-03        20444

A: Use to_datetime and add parameter on to resample:
df['datetime'] = pd.to_datetime(df['datetime'])
res = (df.resample('D', on='datetime')['counter'].max() -
       df.resample('D', on='datetime')['counter'].min())

Or create DatetimeIndex:
df['datetime'] = pd.to_datetime(df['datetime'])
df = df.set_index('datetime')
res = (df.resample('D').max() -
       df.resample('D').min()).reset_index().rename(columns={'counter':'consumption'})

df['datetime'] = pd.to_datetime(df['datetime'])
df = df.set_index('datetime')
res = df.resample('D').agg(lambda x: x.max() - x.min())

And last convert Series to DataFrame:
res = res.reset_index(name='consumption')
print (res)
    datetime  consumption
0 2019-06-01           12


text:
Q: Add Gmail Sending Permission I was trying to send an email based on onEdit() trigger. But getting these exceptions. It's not asking me for any permission. Where can I add those gmail.send and gmail.compose permissions?

Aug 14, 2020, 9:29:23 PM  Error   Exception: The script does not have
permission to perform that action. Required permissions:
(https://www.googleapis.com/auth/gmail.send ||
https://www.googleapis.com/auth/gmail.compose ||
https://www.googleapis.com/auth/gmail.modify ||
https://mail.google.com/ ||
https://www.googleapis.com/auth/gmail.addons.current.action.compose)
at emailSender(Code:54:13)
at onEdit(Code:70:6)

If I run the following function it sends email to my desired mail address using the same script.
function testEmail(){
  GmailApp.sendEmail("shahrearbinamin1@gmail.com",
                      "Price Changed",
                     "test");
}

But the following email sending function does not work end up with the previous error.
function emailSender(website,name, price){
   GmailApp.sendEmail("shahrearbinamin1@gmail.com",
                      "Price Changed",
                      website+"'s "+name+" New Price : "+price);
}

function onEdit(e){
  var row = e.range.getRow();
  var column = e.range.getColumn();
  var currentSheetName = e.source.getActiveSheet().getName();

  if(currentSheetName==="Coles"){
    if(column===5)
    {
     var name = e.source.getActiveSheet().getRange(row,2);
     emailSender("Coles",name,e.value);

    }
  }
  else if(currentSheetName==="Woolworths"){
     if(column===6 && e.oldValue.length!==0){
        var name = e.source.getActiveSheet().getRange(row,2);
        emailSender("Woolworths",name,e.value);
     }
  }

}

Here I've found permission under File->Project Properties. Tried to add permission here Script Properties tab. But it's not adding along with following permission.

A: Simple triggers are not able to send emails. Use an installable trigger.
Reference

*

*https://developers.google.com/apps-script/guides/triggers
Related

*

*Google-apps-script will not send email inside an onEdit function

*Sending an Email on Dropdown Change, GAS won't Progress