text:
Q: Tellraw or a message in chat at a certain  level in Minecraft Bedrock? I'm making a world where the sun basically kills you and if you go above sea level during the day you'll die. The problem is that it's really easy to accidentally mine above sea level (whether it be a mountain or a hill, etc) and just die without realizing you went too far up.
I want to display a message a couple of blocks before  63 to the player about to hit the death barrier. I'm on Bedrock.

A: You can target players within a volume by using the target selector arguments x, y, z, dx, dy, and dz.
First, to prevent the players from being spammed with tellraw messages, you need to create a scoreboard objective that keeps track of whether the player has been warned or not:
/scoreboard objectives add shownWarning dummy

Then, put the following command in a repeating, unconditional, needs redstone command block...
execute @a[scores={shownWarning=0}] ~ ~ ~ execute @s[x=~,y=63,z=~,dx=0,dy=-<number of blocks>,dz=0] ~ ~ ~ tellraw @s {"rawtext":{"text":"You are about to hit the death barrier."}}

...where <number of blocks> is the number of blocks before y=63 where you want to warn the players. This command shows the players who haven't been shown the warning and are in the warning volume the tellraw message.
Put the following in a chain, conditional, always active command block that the first command block is facing. This will set the shownWarning objective of the players who have been told the message to 1, which means they have been shown the warning.
execute @a[scores={shownWarning=0}] ~ ~ ~ execute @s[x=~,y=63,z=~,dx=0,dy=-<number of blocks>,dz=0] ~ ~ ~ scoreboard players set @s shownWarning 1

Finally, put the following in a repeating, unconditional, needs redstone command block. This will reset the shownWarning of the players who are outside of the warning zone.
execute @a[scores={shownWarning=1}] ~ ~ ~ execute @s[x=~,y=<62.90 - <number of blocks>>,z=~,dx=0,dy=-<number of blocks>,dz=0] ~ ~ ~ scoreboard players set @s shownWarning 0

For example, if the number of blocks is 5, the execute @s part of the command would be:
execute @s[x=~,y=57.90,z=~,dx=0,dy=-5,dz=0] ~ ~ ~

Link all of the repeating command blocks to a daylight sensor (using redstone) or whatever you are using to detect if it is daytime.

Explanation
Without the scoreboard objective, there would be no way to keep track if a player has already seen the warning. Otherwise, any player within the warning zone would be spammed with messages.
The reason why the commands are split up into execute @a[scores=... execute @s[x=~... and not combined like execute @a[scores=...,x=~...] is so that the ~ is set to the location of the player, not the command block.
First command

*

*execute @a[scores={shownWarning=0}] ~ ~ ~ Execute as all the players who have not been shown the warning (shownWarning=0).

*execute @s[x=~,y=63,z=~,dx=0,dy=-<number of blocks>,dz=0] ~ ~ ~ Execute if the player is also within the volume between y=63 and y=63 - <number of blocks>. As x, z, dx, and dz are also required when using y and dy, they are set to test if the player is in the x and z coordinates of the player (which will always be the case).

*tellraw @s {"rawtext":{"text":"You are about to hit the death barrier."}} The tellraw message.

Second command

*

*execute @a[scores={shownWarning=0}] ~ ~ ~ Same as the first command.

*execute @s[x=~,y=63,z=~,dx=0,dy=-<number of blocks>,dz=0] ~ ~ ~ Same as first command.

*scoreboard players set @s shownWarning 1 Sets the players who have not been shown the warning and are in the warning zone's shownWarning to 1. This is so they don't get spammed with messages. This command occurs after the first command (because it's a chain command block).

Third command

*

*execute @a[scores={shownWarning=1}] ~ ~ ~ Execute as all the players who have been shown the warning (shownWarning=1).

*execute @s[x=~,y=<62.99 - <number of blocks>>,z=~,dx=0,dy=-<number of blocks>,dz=0] ~ ~ ~ This is similar to the other commands except for the volume that it's testing. Instead of testing if the player is in the warning zone, it is testing if it is below it. The reason why y is 62.99 - <number of blocks> is because it is 0.01 blocks below the start of the warning zone.

*scoreboard players set @s shownWarning 0 Sets the players who are outside of the warning zone's shownWarning to 0, which allows them to see the warning again if they enter get close to the death barrier.

Because you mentioned that you're brand new to using command blocks, here are some pages on the Minecraft wiki that you can read for more information:

*

*Scoreboard

*execute

*tellraw (Raw JSON text in BE)


text:
Q: dependency injection with MEF in MVC3 seems abnormally slow I have an MVC3  web application where controllers use services to perform certain tasks.
I use to instantiate the needed services in each action separately,like so for example:
 public ActionResult Index()
    {
        ICustomService customService = new CustomService();
        var list = customService.ReturnSomething();
        .....
        return View(list)
    }

This was working fine. Then I decided to use MEF for dependecy injection in order to follow better design principles. So now I'm doing something like this:
   public class MyController : Controller
   {
    [Import]
    private ICustomService _customService;

    public MyController()
    {
        MEFManager.Compose(this);
    }

    public ActionResult Index()
    {
      var list = _customService.ReturnSomething();
      return View(list);
    }

Where Composition is done by MEFManage.Compose(this) which is the following function:
    public static void Compose(object o)
    {
        var container = new CompositionContainer(
                                                new DirectoryCatalog(Path.Combine(
                                                                       AppDomain.CurrentDomain.BaseDirectory, "bin"))
                                                                    );
        var batch = new CompositionBatch();
        batch.AddPart(o);
        container.Compose(batch);
    }

This actually WORKS but it is  6 to 7 times slower than when I wasn't using MEF.
Does anyone know why it is so slow? I am doing something wrong?

A: I suspect it's because each controller instance is rebuilding a CompositionContainer, which looks like it does some disk access.
Can you move the CompositionContainer initialisation into Application_Start?

A: I don't really use MEF but I think your solution scans every assembly in the bin folder to search for Import/Export attributes and compose the application.
I don't think it is the right way to use MEF, the controller should not call any MEF related method.
It seems something similar if you would configure a DI container for each request.
This article seems good: Using MEF 2 with ASP.NET MVC 3

A: Spinning up a CompositionContainer is not a resource intensive task, but, creating a DirectoryCatalog is, it has to scan all available assemblies to identify parts and analyse the composition elements for exports. You could improve this a number of ways:

*

*You could have a singular DirectoryCatalog (or preferably a ComposablePartCatalog) that all your containers use when constructing, this means that the catalog creation is only done once.

*You could avoid container creation in your constructor entirely and implement either an IControllerFactory to spin up your controller instances, or an IDependencyResolver to handle dependency resolution using MVC3's built in service location mechanism. There are many examples on the web if you search for MEF + MVC.

redpajama_set_name: RedPajamaStackExchange


text:
Q: IBM MobileFirst Worklight 8.0 : How to disable direct update? I'm trying to disable updates in my android application.
Is it possible to disable direct updates worklight 8.0?

A: Direct update is triggered only for Cordova applications. Direct update triggers when you make changes to the webresources and upload the updated webresources archive to the server.
This is done via the CLI command:
mfpdev app webupdate
Once the updated web package has been uploaded into the server, next time the Cordova application connects to the server, MobileFirst server triggers direct update.
If you do not want direct update, you should not upload the updated webresources archive to the server.
More details on this topic can be found here.


text:
Q: Python-Delete anything in quotes from line in text file I'm trying to remove any text inside of quotation marks (and the quotation marks themselves) from a file.
Basically I need this:
A A2A|"Dm"A2A "C"G2E|"Dm"D2D A,2D|

To turn into this:
A A2A|A2A G2E|D2D A,2D|

Here's a code snippet of what I originally tried:
def conversion():
    with open(abc + .'txt') as infile, open(abc + '.tmp', 'w') as outfile:
        for line in infile:
            #Delete anything inside of quotes after the header
            if '"' + '' in line:
                line = line.replace('"' + '', '')
                outfile.write(line)

            #Write everything else
            else:
                outfile.write(line)
conversion()

This removes the quotation marks, but it leaves everything that was inside of them.

If I change
line = line.replace('"' +'','')

To
line = line.replace('"' + "Dm" + '"', '')

I can get rid of anything containing "Dm", theoretically I could program this for each possible combination, but that would be a huge PITA and I want to allow for human error (e.g. Someone wrote "Dma" instead of "Dmaj").

I've also tried using regex, but I honestly have no idea what I'm doing with it.
def conversion():
    with open(abc + '.txt') as infile, open(abc + '.tmp', 'w') as outfile:
        for line in infile:
            #Delete anything inside of quotes after the header
            if '"' in line:
                re.sub('".+"', '', line)
                outfile.write(line)

            #Write everything else
            else:
                outfile.write(line)
conversion()

This seems to do nothing, I've looked through the python documentation, but there's no example to show how to use it in the context I'm trying to.

A: re.sub() returns the edited line, it doesn't edit in-place.
line = re.sub('".*?"', '', line)
outfile.write(line)

And your regex would match across quotes, so I edited it to make it non-greedy.


text:
Q: Non-interactive tar_visnetwork()/tar_glimpse()? Background: I work in terminal R on a remote system and don't have interactive graphical capabilities. Perhaps I could manage to get X11 working but so far I have been productive using some workarounds, rendering plots to file directly and mounting the remote image dir using sshfs.
Interactive graphics don't work for me but I'd like to visualize target dependencies. Is it possible to somehow render tar_visnetwork() to a static image? Something like the following (which doesn't work)?:
png('test.png')
tar_visnetwork()
dev.off()

A: tar_visnetwork creates a HTML widget. You can render this file in your local Browser:
library(targets)
library(htmltools)

save_html(html = tar_visnetwork(), file = "dag.html")


text:
Q: How can I get a random cell in OpenOffice Calc? I've perused the Stack Exchange list of sites, and I can only think that SO is the right place to ask this (I saw a few excel questions, at least).
I have an array of values Sheet1.B3:B9.  On another sheet, I'm trying to get a random value from one of those cells.
I suppose it has to be something with the RANK() function, but I'm grasping at straws.
How can I get the value of a random cell in that range?

A: In LibreOffice Calc to get a random cell between cells B3 and B9 of Sheet1 you can do:
=INDEX(Sheet1.B3:B9, RANDBETWEEN(1,5))

A: In Excel, this will give random lookup into the range
=INDEX(Sheet1!$B$3:$B$9,INT(RAND()*7)+1)

Or you can give your source data range a name
=INDEX(RandDataSource,INT(RAND()*ROWS(RandDataSource))+1)

Don't know if it applies to Openoffice


text:
Q: Log Analytics Query Ignores ysplit I am trying to write a query and render results with multiple y axis. To achieve that I am using ysplit option for render action:
|render timechart with (ysplit = panels)

However the resulting graph ignores this. Is it known limitation of log analytics queries? Does this option work only in DataExplorer? If so is there a way how to have more y axis?

A: Not all of the render operators are supported in every "client" of logs.
if you look at the docs for the render operator, there's actually 2 different versions:
Azure Data Explorer: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/renderoperator?pivots=azuredataexplorer
Azure Monitor: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/renderoperator?pivots=azuremonitor
You'll see that currently, ysplit and many other operators are not supported in the "Azure Monitor" version of the API.
(the Logs view and Workbooks view and Azure Resource Graph view all support different things.  We are trying to converge but is a long term process)


text:
Q: How to select only exact strings from a search in Python? I scrape a website with Scrapy. After that, the user can search the results on my website with algolia. My problem is in the precision of scraping for general results.
For example, when I scrape an item containing "Red wood bed", I scrape all objects with "Red wood bed" and it's accurate.
Then I look for "Red bed". The problem is that "Red wood bed" results are also scraped and I don't want that. I have 10 000 different "searchs" in my scraper.
How can I select strictly "Red bed" to be as accurate as possible in python ?
My first guess is to scrape all and then sort the results:
for x in "red wood items":
    if "bed" in "red wood bed":
       remove "result containing bed"

But it seems very long. Is there another way in Python ?


text:
Q: Linked-List remove after method java ive been working on a linked list and Im trying to remove a node after another node. Ive got how to remove before the current node but i now need the after and I cant seem to figure it out. I got it to work once but it removed every node after the current not just the one next to the current. Here is the code for inserting after and removing before:
// Remove the node containing item nVal
public void removeBefore(E curVal, E nVal) {
    // You implement this method for Assignment 2
    Node<E> newNode = new Node<E>(nVal);

    Node<E> curr = head;
    Node<E> prev = null;

    if (head.getNodeValue() == curVal) {
        newNode.setNext(head);
        head = newNode;
        return;
    }

    // scan until locate node or come to end of list
    while (curr != null) {
        // have a match
        if (curr.getNodeValue() == curVal) {

            newNode.setNext(curr);
            prev.setNext(newNode);
            break;
        } else {
            // advanced curr and prev
            prev = null;
            curr = curr.getNext();
        }
    }
}

// Insert new node nVal to the list after current node curVal
public void insertNodeAfter(E nVal, E curVal) {
    // You implement this method for Week 11 tutorial
    Node<E> newNode = new Node<E>(nVal);

    Node<E> curr = head;

    // scan until locate node or come to end of list
    while (curr != null) {
        // have a match
        // Replaced == with .equals
        if (curr.getNodeValue().equals(curVal)) {
            // insert node
            newNode.setNext(curr.getNext());
            curr.setNext(newNode);
            break;
        } else {
            curr = curr.getNext();
        }
    }
}

Any guidance is appreciated.

A: The code for removing an item containing a given in a singly linked list consists in :

*

*search the list from the head for the value, keeping track of previous node

*if the node is first (previous is null) start the list at next

*else, make previous point directly to next (also works for last node)

Code could be something like:
// Remove the node containing item nVal
public void remove(E curVal) {
    Node<E> curr = head;
    Node<E> prev = null;

    // scan until locate node or come to end of list
    while (curr != null) {
        // have a match
        if (curr.getNodeValue().equals(curVal)) {

            if (prev == null) {  // curr is first node: just start to next
                head = curr.getNext();
            }
            else {   // make prev point to next
                prev.setNext(curr.getNext());
            }
            break;
        } else {
            // advanced curr and prev
            prev = curr;
            curr = curr.getNext();
        }
    }
}


text:
Q: Returning all items on a MySQL join, not just ones that are matching checkouts
| item_id | user_id |

items
| item_id |

I want a query that will return ALL THE ITEMS with a column that if it exists in checkouts for a particular user_id, it returns a 1. Otherwise it will return a 0.
select *
from checkouts
right join items on items.item_id = checkouts.item_id
where checkouts.user_id = 10

The problem is that it only returns items that it joins on, not ALL the items.
Any ideas?

A: What about...
SELECT i.item_id, c.user_id, IF(c.user_id IS NULL, 0, 1) AS extra_column
FROM items i
LEFT JOIN checkouts c ON (c.item_id = i.item_id AND c.user_id = 10)

A: Try a left outer join:
select * from items left outer join checkouts using (item_id)
 where checkouts.user_id is null or checkouts.user_id = 10

Alternatively you can also use:
select * from items i
  left outer join checkouts c
    on (i.item_id=c.item_id and c.user_id=10)

A: try a right outer join, e.g.
select *
from checkouts c
right outer join items i on i.item_id = c.item_id
where c.user_id = 10


text:
Q: Trigger build when non-source files change Using CMAKE I added a custom command top copy LUA files from the source directory to the output directory when they are changed. However this command is only fired when Visual Studio decided to build a project (even though I used PRE_BUILD for the custom command). Visual Studio only decides to build when a source file (c++ in this case) changes so when I only change LUA files they are not added to the output directory.
Now in Visual Studio I can change the 'Item Type' in the property pages of the LUA files from 'Does not participate in build' to 'Text'. In that case Visual Studio does trigger a build when only the LUA files change. So how do I make sure that CMAKE assigns the correct Item Type to LUA files? (Or are there other solutions?)
The relevant parts of CMakeLists.txt
SET(LUA_Sources
  "lua/initialization.lua")

SOURCE_GROUP("lua" FILES ${LUA_Sources})

ADD_LIBRARY(engine
  ${LUA_Sources})

foreach(LuaFile ${LUA_Sources})
  ADD_CUSTOM_COMMAND(
    TARGET engine
    PRE_BUILD
    COMMAND ${CMAKE_COMMAND}
    ARGS    -E
      copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${LuaFile} ${EXECUTABLE_OUTPUT_PATH}/Debug/${LuaFile})
endforeach()

===========================
For reference the solution, closely inspired by Angew was
SET(LUA_Sources
  "lua/initialization.lua")

SOURCE_GROUP("lua" FILES ${LUA_Sources})

set(LUA_Outputs "")
foreach(LuaFile ${LUA_Sources})
  list(APPEND LUA_Outputs ${EXECUTABLE_OUTPUT_PATH}/Debug/${LuaFile})
endforeach()

add_custom_target(
  lua ALL
  DEPENDS ${LUA_Outputs}
  COMMENT "Copying LUA files"
  VERBATIM
)

foreach(LuaFile ${LUA_Sources})
  ADD_CUSTOM_COMMAND(
    TARGET lua
    COMMAND ${CMAKE_COMMAND}
    ARGS    -E
      copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${LuaFile}
endforeach()

I had to switch things around a bit because else the files would not always be copied if they were newer. Probably because of the OUTPUT directive in ADD_CUSTOM_COMMAND instead of the TARGET directive that I use now.

A: If the CMakeList excerpt is complete and the engine target is only supposed to serve as a placeholder to copy the Lua sources, then you're approaching the problem the wrong way. You should use a custom command + custom target combination instead, like this:
set(LUA_Sources
  "lua/initialization.lua")

source_group("lua" FILES ${LUA_Sources})

set(LUA_Outputs "")
foreach(LuaFile ${LUA_Sources})
  add_custom_command(
    OUTPUT ${EXECUTABLE_OUTPUT_PATH}/Debug/${LuaFile}
    COMMAND ${CMAKE_COMMAND}
    ARGS -E copy_if_different
      ${CMAKE_CURRENT_SOURCE_DIR}/${LuaFile}
      ${EXECUTABLE_OUTPUT_PATH}/Debug/${LuaFile}
  )
  list(APPEND LUA_Outputs ${EXECUTABLE_OUTPUT_PATH}/Debug/${LuaFile})
endforeach()

add_custom_target(
  engine ALL
  DEPENDS ${LUA_Outputs}
  COMMENT "Copying LUA files"
  VERBATIM
)

This CMakeList creates a custom command to copy each LUA file, and then a custom target which will drive those custom commands by depending on their outputs. Now dependency tracking will work fine.


text:
Q: REGEXP in .split() Ok, I am trying to find a the dom pattern:

from my contenteditable div which typically looks like this, with multiple spans:

    text
    text
    //and more spans maybe

The line of code that I am using is:
return string.split(/\r\n?|\n|
(.*?)
(.*?)<\/div>,gis/);

The problem is this portion of the regex
(.*?)
(.*?)<\/div>,gis.. it never matches, even though the pattern exists. Just for clarity sake, the return runs in a loop across the input text, triggered by the input change event on my contenteditable div. I need an array version of the text delimited every where the pattern is. No library for this please.

A: Here is a solution that does not involve any external library and is easy to understand.
For starters, let's grab the edit div's contents
var $edit = document.getElementById("edit")

Now, we create a small function to iterate through our DOM. There are plenty of ways to do this, here is the way Douglas Crockford did it in his book "JavaScript : The Good Parts" iirc:
function walkTheDOM(node, func) {
    func(node);
    node = node.firstChild;
    while (node) {
        walkTheDOM(node, func);
        node = node.nextSibling;
    }
}

This functions goes through every element in the dom of node and runs func on it.
The only thing remaining is to call it on our $edit div from before.
walkTheDOM($edit, function (node) {
    if (node.nodeName.toLowerCase()==="div") { // we got a div
        if(node.innerHTML.trim() === "
"){ //whose inner html is

           console.log("GOT",node);//print its name
        }
    }
});

Here is a fiddle of it all working
After you've done all the work of finding it, you can easily extract whichever text/data you want from the rest of the data. See this question on why parsing HTML with regular expressions is generally a bad idea.

A: The flags should go outside:
return string.split(/\r\n?|\n|
(.*?)
(.*?)<\/div>/gis);

I'm not very good with regex, but that seems too greedy to me also. I believe it will match any div that contains a br, not only the ones that just contain a br. And if they are nested, it should match the outermost one. I'd tackle this problem by traversing the DOM, as suggested in the comments.

A: I see a few potential issues: (1) You want your flags (gis) outside of the // marks. (2) Your first use of | needs parentheses to match \r, \n or \r\n. You probably don't need these at all though. (3) I'm not sure why you have an alternate here: \n|
. (4) s isn't a flag that I'm aware of.
This should do the trick:
/
(.*?)
(.*?)<\/div>/gi

A: 1) Regexp flags should be after closing "/"
2) Use [\S\s]* instead of .*
3) "<text" is erroneous html code because "<" should be replaced by "<"


text:
Q: Unable to connect to MySQL DB on Production I'm thinking that I've done up the database.yml file improperly. The file is as follows:
default: &default
  adapter: mysql2
  encoding: utf8
  pool: 5
  username: root
  password:
  host: localhost

development:
  <<: *default
  database: blog_development

test:
  <<: *default
  database: blog_test

production:
  <<: *default
  database: ENV['CLEARDB_DATABASE_URL']
  username: ENV['CLEARDB_DATABASE_USERNAME']
  password: ENV['CLEARDB_DATABASE_PASSWORDs']

When I run heroku run rake db:migrate I get:
Running `rake db:migrate` attached to terminal... up, run.8056
rake aborted!
Mysql2::Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I have ClearDB installed with mysql2.

A: The solution is in the environment variable. Renaming CLEARDB_DATABASE_URL to DATABASE_URL solved the problem.
Renaming occurred in the heroku config and in the database.yml.


text:
Q: How to reduce the length of regular expression I am using the following regular expression and i need to reduce its length while keeping the same behavior.
^\s*(John|Matt|Oliver|Tom)\s*(\|\s*(John|Matt|Oliver|Tom)\s*)*$

The expression validates a '|' separated list of specific names.

*

*KD

A: Since you have a PCRE regex, use a subroutine call (?1) in order not to repeat the whole Group 1 subpattern:
^\s*(John|Matt|Oliver|Tom)\s*(\|\s*(?1)\s*)*$
                                   ^^^^

See the regex demo.


text:
Q: MySQL dual master For my current project we are thinking of setting up a dual master replication topology for a geographically separated setup; one db on the us east coast and the other db in japan.
I am curious if anyone has tried this and what there experience has been.
Also, I am curious what my other options are for solving this problem; we are considering message queues.
Thanks!

A: Just a note on the technical aspects of your plan: You have to know that MySQL does not officially support multi-master replication (only MySQL Cluster provides support for synchronous replication).
But there is at least one "hack" that makes multi-master-replication possible even with a normal MySQL replication setup. Please see Patrick Galbraith's "MySQL Multi-Master Replication" for a possible solution. I don't have any experience with this setup, so I don't dare to judge on how feasible this approach would be.

A: There are several things to consider when replicating databases geographically.  If you are doing this for performance reasons, be sure your replication model supports your data being "eventually consistent" as it can take time to bring the replication current in both, or many, locations.  If your throughput or response times between locations is not good, active replication may not be the best option.

A: Setting up mysql as dual master does actually work fine in the right scenario done correctly. But I am not sure it fits very well in your scenario.
First of all, dual master setup in mysql is really a ring-setup. Server A is defined as master of B, while B is at the same time defined as the master of A, so both servers act as both master and slave. The replication works by shipping a binary log containing the sql statements which the slave inserts when it sees fit, which is usually right away. But if you're hammering it with local insertions, it will take a while to catch up. The slave insertions are sequential by the way, so you won't get any benefit of multiple cores etc.
The primary use of dual master mysql is to have redundancy on the server level with automatic fail-over (often using hearbeat on linux). Excluding mysql-cluster (for various reasons), this is the only usable automatic failover for mysql. The setup for basic dual master is easily found on google. The heartbeat stuff is a bit more work. But this is not really what you were asking about, since this really behaves as a single database server.
If you want the dual master setup because you always want to write to a local database (write to both of them at the same time), you'll need to write your application with this in mind. You can never have auto-incrementing values in the database, and when you have unique values, you must make sure that the two locations never write the same value. For example location A could write odd unique numbers and location B could write even unique numbers. The reason is that you're not guaranteed that the servers are in sync at any given time, so if you've inserted a unique row in A, and then an overlapping unique row in B before the second server catches up, you'll have a broken system. And if something first breaks, the entire system stops.
To sum it up: it's possible, but you'll need to tip-toe very carefully if you're building business software on top of this.

A: Because of the one-to-many architecture of MySQL replication, you have to have a replication ring with multiple masters: that is, each replicates from the next in a loop. For two, they replicate off each other. This has been supported from as far back as v3.23.
In a previous place I worked, we did it with v3.23 with quite a number of customers as a way of providing exactly what you're asking. We used SSH tunnels over the Internet to do the replication. It took us some time to get it reliable and several times we had to do a binary copy of one database to another (fortunately, none of them were over 2Gb nor needed 24-hour access). Also the replication in v3 was not nearly as stable as in v4 but even in v5, it will just stop if it detects any sort of error.
To accomodate the inevitable replication lag, we re-structured the application so that it didn't rely on AUTOINCREMENT fields (and removed that attribute from the tables). This was reasonably straightforward due to the data-access layer we had developed; instead of it using mysql_insert_id() for new objects, it created the new ID first and inserted it along with the rest of the row. We also implemented site IDs that we stored in the top half of the ID, because they were BIGINTs. This also meant we didn't have to change the application when we had a client who wanted the database in three locations. :-)
It wasn't 100% robust. InnoDB was just gaining some visibility so we couldn't easily use transactions, although we considered it. So there were race conditions occasionally when two objects tried to be created with the same ID. This meant one failed and we tried to report that in the app. But it was still a significant part of someone's job to watch over the replication and fix things when it broke. Importantly, to fix it before we got too far out of sync, because in a few cases the databases were being used in both sites and would quickly become difficult to re-integrate if we had to rebuild one.
It was a good exercise to be a part of, but I wouldn't do it again. Not in MySQL.


text:
Q: Why does a RolloverRenderer uses the wrong cell context The issue I have was hard to reproduce but I hope someone here can give me a hint on how to solve this.
I've written a ComponentProvider<JLabel> that takes a String value an creates an clickable cell decorated with a icon if the String contains a URL. If no URL is found in the String value, then no icon is set for the label and the cell shouldn't be clickable.
Here's the code:
public class ExternalLinkProvider extends ComponentProvider<JLabel> implements RolloverRenderer {

    private String url = null;

    @Override
    protected void format(CellContext context) {}

    @Override
    protected void configureState(CellContext context) {
        if (context.getValue() instanceof String) {
            String stringValue = (String) context.getValue();
            WwwLink link = new WwwLink(stringValue);

            // If this contains a valid Url, set a link icon.
            if (link.isValid()) {
                rendererComponent.setIcon(ExternalLink.WWW_LINK_ICON);
                url = link.getUrl();
            } else {
                rendererComponent.setIcon(null);
                url = null;
            }
            rendererComponent.setText(link.getString());
        }
    }

    @Override
    protected JLabel createRendererComponent() {
        return new JRendererLabel();
    }

    @Override
    public boolean isEnabled() {
        return url != null;
    }

    @Override
    public void doClick() {
        if (url != null) {
              // Follow the url
        }
    }
}

It looks like this:

The first cell should be clickable to follow the link that was in the string value and has been removed from the display text. The second cell didn't contain a link in the text and therefore shouldn't be clickable.
However, in this case both cells aren't clickable and if I store the string value and print it out to the console from the isEnabled() method I see that always the text from the second cell is printed regardless if i hover over the first or the second cell.
This is the only situation I noticed this behavior. I know that the one Provider instance is reused for every cell containing this type, but for some reason the RolloverRenderer doesn't seem to reconfigure this Provider properly in this case.
Am I doing something wrong here?

A: After a bit of playing: you might have hit an issue here - all our examples are clickable always. Basically, it's brittle to keep cell related state in the provider, as it might be called often and for other cells.
The api of RolloverRenderer is not really rich enough: the mechanism relies on the renderer being configured just before a click happens (so that the "old" state still lingers), not good enough for your use case :-) You might consider filing a bug report in the swingx issue tracker, so we don't forget looking into it. Thanks.
Snippet to play with, basically demonstrating which methods to override in a custom provider (but not solving the problem at hand - except with a user-unfriendly kludge to have the rollover enabled always ...):
public class ExternalLinkProvider extends LabelProvider implements RolloverRenderer {

    private URL url = null;

    /**
     * Overridden to check for valid URL.
     */
    @Override
    protected void configureContent(CellContext context) {
        url = convertValueToUrl(context.getValue());
        super.configureContent(context);
    }

    private URL convertValueToUrl(Object result) {
        if (!(result instanceof String)) return null;
        URL url = null;

        try {
            url = new URL(result.toString());
        } catch (Exception e) {
            // TODO: handle exception
        }
        return url;

    }

    @Override
    protected Icon getValueAsIcon(CellContext context) {
        return url != null ? XTestUtils.loadDefaultIcon() : null;
    }

    /**
     * conditional enabled isn't reliably supported. Returning true
     * uncondionally probably isn't option, as the cursor is changed ...
     */
    @Override
    public boolean isEnabled() {
        return true; //url != null;
    }

    @Override
    public void doClick() {
        if (url != null) {
              // Follow the url
            System.out.println("clicking");
        }
    }
}


text:
Q: Replacing HTML tags with text attributes I'm getting data from a web service and the result contains some HTML tags, that I'm then trying to convert. For example, I want to replace <P> tags with line breaks, and <STRONG> from HTML to bold text.
Can anyone help me? I've sort of worked out how I can replace text -- I'm halfway there, I think.
 if([key isEqualToString:@"Description"]){
            txtDesc.text=[results objectForKey:key];
            NSString * a = txtDesc.text;

            NSString * b = [a stringByReplacingOccurrencesOfString:@"<strong>" withString:@"STRONG TAG"];
            b =  [b stringByReplacingOccurrencesOfString:@"<\\/p>" withString:@""];
            b =  [b stringByReplacingOccurrencesOfString:@"</p>" withString:@""];

            txtDesc.text=b;

        }

A: Strings do not have attributes like bold. Strings contain only chars including line breaker. If you want to enrich your string with attributes, have a look at NSAttributedString.
Update:
For those of us, who cannot see, why attributed strings are the solution, a simple piece of code:
- (NSAttributedString*)attributedStringByReplaceHtmlTag:(NSString*)tagName withAttributes:(NSDictionary*)attributes
{
    NSString *openTag = [NSString stringWithFormat:@"<%@>", tagName];
    NSString *closeTag = [NSString stringWithFormat:@"</%@>", tagName];
    NSMutableAttributedString *resultingText = [self mutableCopy];
    while ( YES )   {
        NSString *plainString = [resultingText string];
        NSRange openTagRange = [plainString rangeOfString:openTag];
        if (openTagRange.length==0) {
            break;
        }

        NSRange searchRange;
        searchRange.location = openTagRange.location+openTagRange.length;
        searchRange.length = [plainString length]-searchRange.location;
        NSRange closeTagRange = [plainString rangeOfString:closeTag options:0 range:searchRange];

        NSRange effectedRange;
        effectedRange.location = openTagRange.location+openTagRange.length;
        effectedRange.length = closeTagRange.location - effectedRange.location;

        [resultingText setAttributes:attributes range:effectedRange];
        [resultingText deleteCharactersInRange:closeTagRange];
        [resultingText deleteCharactersInRange:openTagRange];

    }

    return resultingText;
}

But I did not test it well, because I had to prepare a risotto while programming that. ;-)

A: As said before you need to use NSAttributedString
It implements the following method which you will pass an NSDictionary of attributes and a range (of characteres) to receive the attributes
- (void)setAttributes:(NSDictionary *)attributes range:(NSRange)range;

An example of NSDictionary would be:
@{ NSFontAttributeName: [UIFont systemFontOfSyze:24], NSForegroundColorAttributeName: [UIColor greenColor]}

You can look for more information on apple's documentation
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSAttributedString_Class/Reference/Reference.html
or on the Lecture 4 of the amazing iPhone Application Development course from Stanford
http://www.stanford.edu/class/cs193p/cgi-bin/drupal/downloads-2013-winter


text:
Q: Why can't I access open HTTP port of NiFi flow via Docker? I'm trying to do something very simple:  use the official NiFi docker image (https://hub.docker.com/r/apache/nifi/) to run a very simple NiFi "Hello World" tutorial (https://github.com/drnice/NifiHelloWorld).
The problem is that I cannot access the port of the HandleHttpRequest processor from that tutorial (called Nifi-WebServer-HandleHTTP).  The port is 6688.
I've mapped port 6688 to localhost, which I've confirmed in portainer:
Portainer Snapshot Showing port mappings
The URL localhost:8080 works fine, I can access the NiFi UI and interact with it.
But when I try localhost:6688, I get an error (empty response from server).
More info
1)  When I log in through Portainer to the "nifi3" container console, I can run "curl localhost:6688", and get the expected result (some HTML coming back).
2)  I've confirmed via netstat that nothing else is using 6688 on my host.
3)  Full container run command:
docker run --name nifi4 -d -p 8080:8080 -p 6688:6688 -p 9998:9998 -v `C:/temp/GitHub/NifiHelloWorld/Archive`:/mnt/nifi_hello_world -v C:/temp/nifi_out:/mnt/nifi_out nifi3 -v 4a8bd6cab08f08af457001810a312816757f40a7c16d2583dd6a9eabfd76db78:/opt/nifi/nifi-current/conf

So the HTTP server seems to be up on the correct port inside the container, the port mapping is there, but I cannot access it from outside.
Anyone know why?

A: It looks like you were hit with a bit of container inception.  The template you are using specifies a hostname for the HandleHttpRequest processor of "localhost".  Accordingly, it will only accept requests on the loopback interface internal to the container instance.

You will need to remove this from your template instance such that it can bind to all interfaces and allow the port forwarding to work as expected via the docker command arguments.


text:
Q: How to expose child id to parent using angualr I have the following code which using Material UI for toolbar with left menu:
<mat-sidenav-content>
    <mat-toolbar color='primary'>
      <button
        type='button'
        aria-label='Toggle sidenav'
        mat-icon-button
        (click)='leftmenu.toggle()'>
        <mat-icon aria-label='Side nav toggle icon'>menu</mat-icon>
      </button>
      Tool Bar
    </mat-toolbar>
    <router-outlet></router-outlet>
  </mat-sidenav-content>

    <mat-sidenav #leftmenu class="sidenav" fixedInViewport
               mode="side" opened="true">
    <mat-toolbar>

</mat-toolbar>
    <mat-nav-list>
      Home
      Home2
    </mat-nav-list>
  </mat-sidenav>

#leftmenu been used by button toggle, i would like to encapsulate the left menu into
 <app-leftmenu #leftmenu></app-leftmenu>

app-leftmenu contains the following:
@Component({
  selector: 'app-leftmenu',
  templateUrl: './leftmenu.component.html',
  styleUrls: ['./leftmenu.component.scss']
})
export class LeftmenuComponent implements OnInit {
  @ViewChild('drawer') drawer: ElementRef;

  constructor() { }

  ngOnInit() {
  }

  toggle() {
    <?????????????>
  }
}

leftmenu.component.html contains the following:
<mat-sidenav #drawer class="sidenav" fixedInViewport
             mode="side" opened="true">
  <mat-toolbar>Menu</mat-toolbar>
  <mat-nav-list>
    First Page

  </mat-nav-list>
</mat-sidenav>

How can I toggle the #drawer inside the toggle function? / is there any other way to do so?

A: You can bind the opened attribute with an internal boolean value.
<mat-sidenav class="sidenav" fixedInViewport
             mode="side" [opened]="isOpen">
  <mat-toolbar>Menu</mat-toolbar>
  <mat-nav-list>
    First Page

  </mat-nav-list>
</mat-sidenav>

in the component change the value of that boolean on toggle.
@Component({
  selector: 'app-leftmenu',
  templateUrl: './leftmenu.component.html',
  styleUrls: ['./leftmenu.component.scss']
})
export class LeftmenuComponent implements OnInit {

  isOpen: boolean = false;

  constructor() { }

  ngOnInit() {
  }

  toggle() {
    this.isOpen = !this.isOpen;
  }
}

another approach would be to use the API https://material.angular.io/components/sidenav/api
call close or open on drawer.
For that you should use the correct type in the ViewChild:
@ViewChild('drawer') drawer: MatDrawer;

...

this.drawer.open();


text:
Q: Static and Dynamic Scoping Problem after reading few post in this forum on this topic i had better understanding on static and dynamic scoping.
However, i have encountered a problem from internet and seems to face issues to get around with that.
The code is as follows:
x : integer                   –– global
procedure set x(n : integer)
   x := n
procedure print x
   write integer(x)
procedure first
   set x(1)
   print x
procedure second
   x : integer
   set x(2)
   print x

set x(0)
first()
print x
second()
print x

What does this program will print if we use static scoping and What does it print if we use dynamic scoping?

A: It's not that easy to predict what will happen in some imaginary language after launching a pseudocode but expected result will be:
1 - procedure 'first' output
2 - procedure 'second' output
1 - 'main' output

P.S. those are not called static/dynamic. Those are global/local. At least in those languages I know.


text:
Q: Elixir - generate list of strings for navigational (breadcrumb purposes) I'm pretty new to Elixir (loving it so far) and have been trying to figure out how to take a simple String such as
"folder1/folder2/folder3/last_folder"

and turn it into a list of navigation links for each part of the path (except for the last_folder):
["https://wherever/folder1", "https://wherever/folder2",  "https://wherever/folder3"]
There must be a pretty simple way to do this - perhaps with recursion?

A: There's no need for explicit recursion. Just split the path by / and do an Enum.scan/3, concatenating the accumulator and the current part with "/" as separator:
path = "folder1/folder2/folder3/last_folder"
parts = String.split(path, "/")

Enum.scan(parts, "", fn part, acc ->
  acc <> "/" <> part
end)
|> IO.inspect

Output:
["/folder1", "/folder1/folder2", "/folder1/folder2/folder3",
 "/folder1/folder2/folder3/last_folder"]

If you don't want the last one, you can drop the last part from parts by doing this instead:
parts = String.split(path, "/") |> Enum.drop(-1)

["/folder1", "/folder1/folder2", "/folder1/folder2/folder3"]

If you modify the initial value of the accumulator, you can add the base URL if you want:
path = "folder1/folder2/folder3/last_folder"
parts = String.split(path, "/") |> Enum.drop(-1)
Enum.scan(parts, "https://wherever", fn part, acc ->
  acc <> "/" <> part
end)
|> IO.inspect

["https://wherever/folder1", "https://wherever/folder1/folder2",
 "https://wherever/folder1/folder2/folder3"]


text:
Q: How to capture app switch key using onKeyDown in Android? I am trying to capture app switch key and home key on android 3.1 and 4.0 but it doesn't seem like its working.
here is what I am doing
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
   if (KeyCode == KeyEvent.KEYCODE.KEYCODE_APP_SWITCH && event.getRepeatCount() == 0)
    {
        Log.d ("onkeydown","app switch key");
    }
   else if (KeyCode == KeyEvent.KEYCODE.KEYCODE_HOME && event.getRepeatCount() == 0)
    {
        Log.d ("onkeydown","home key");
    }
    //EDIT:
    return super.onKeyDown(keyCode, event);
}

My log.d statement is not printed. Is it possible to capture these 2 keys?
updated code with correct return statement

A: Um.
Well, no, you can't.

public static final int KEYCODE_HOME
Since: API Level 1
Key code constant: Home key.
This key is handled by the framework and is never delivered to applications.

http://developer.android.com/reference/android/view/KeyEvent.html

A: It can be achieved using reflection.
It is under class android.os.ServiceManager having an aidl com.android.internal.statusbar.IStatusBarService and it contains toggleRecentApps method
And also try this method here

A: The super.onKeyDown(keyCode, event) is missing, i think you should try this:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
super.onKeyDown(keyCode, event);

   if (KeyCode == KeyEvent.KEYCODE.KEYCODE_APP_SWITCH && event.getRepeatCount() == 0)
    {
        Log.d ("onkeydown","app switch key");
    }
   else if (KeyCode == KeyEvent.KEYCODE.KEYCODE_HOME && event.getRepeatCount() == 0)
    {
        Log.d ("onkeydown","home key");
    }
    return true;
}

Doing the same using switch statement:
@Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
    super.onKeyDown(keyCode, event);
        switch(keyCode)
        {
            case KeyEvent.KEYCODE_CAMERA:
             Toast.makeText(ListViewActivity.this, "Pressed Camera Button", Toast.LENGTH_SHORT).show();
                return true;
            case KeyEvent.KEYCODE_1:
             Toast.makeText(ListViewActivity.this, "Pressed 1", Toast.LENGTH_SHORT).show();
                return true;
            case KeyEvent.KEYCODE_HOME:
             Toast.makeText(ListViewActivity.this, "Pressed Home Button", Toast.LENGTH_SHORT).show();
                return true;

            case KeyEvent.KEYCODE_BACK:
             Toast.makeText(ListViewActivity.this, "Pressed Back Button", Toast.LENGTH_SHORT).show();
                finish();
                return true;
        }

        return false;
    }


text:
Q: issues importing c++ class I have a class A(has a.h and a.cpp file) which I am importing to main.cpp. I created an object of the class A and trying to access the methods in class I get undefined reference to `A::Reset(unsigned int*, unsigned int*)'.
I am not sure whats wrong in my code
//a.h
#ifndef _A_H_
#define _A_H_

class A
{

    public:

        A();
        void Reset();
};
#endif

//a.cpp:
#include "A.h"

A::A()
{

    Reset();
}

void A::Reset()
{

}

//main.cpp
#include "A.h"
int main(int argc, const char * argv[])
{

    A *aObj = new A;
    aObj->Reset();
}

Any help would be appreciated.

A: Correct you main.cpp file as this:
#include "a.h"

int main(int argc, const char * argv[])
{

    A *aObj = new A;
    aObj->Reset();

/*
or
   A aObj;
   aObj.Reset()
*/
}

A: First of all, you need to compile and link both A.cpp and main.cpp when building the executable. For example:
g++ -o main A.cpp main.cpp

As to the missing compare() function, make sure that it's declared in A.h:
class A {
   ...
   int compare(unsigned int*, unsigned int*);
}

and defined in A.cpp:
int A::compare(unsigned int*, unsigned int*) {
   ...
}


text:
Q: Making sidebar 100% of page height I've been working in a blog-like layout and everything was going very well until I decided to implement a very simple and minimalist User dashboard that wouldn't follow the very same structure as the whole layout already built as it would have a (real) sidebar.
I've extracted as much as I could from the huge CSS file Hugo compiles to me (besides the Bootstrap 5, which is imported) and made a Pen with it. It's still huge, but I hope it's not a problem

I've only made one modification, manually, in this Pen (last block) to show that there's a coloured wrapper for the main body because, somehow, it didn't end visible

So, my intention was to make the left sidebar extend along with the whole page height, positioning the footer above it, without losing the spacing around the (here depicted) red box
But I can't for the life of me get rid of that bottom spacing between the sidebar and the footer.

Change the  bottom property or add a negative margin-top to pull it up

I've tried, but doing so adds a spacing below the footer
I've searched for solutions and I actually found tutorials and even other questions here but not along with Bootstrap 5 I'm using

A: You can give footer element margin:0 and give the wrapper
element wrapper-box class and give this class margin-bottom: -15px in negative value. Thus you keep your boxes out of further problem.
You can update your CSS with the following code
a:hover {
  color: inherit
}

#comments {
  scrollbar-color: initial!important
}

#comments::-webkit-scrollbar {
  width: initial
}

#comments::-webkit-scrollbar-track {
  background: initial
}

#comments::-webkit-scrollbar-thumb {
  background-color: initial
}

:root {
  --darker-gray: 22, 22, 22;
  --dark-gray: 31, 31, 31;
  --mid-gray: 89, 89, 89;
  --light-gray: 200, 200, 200;
  --lighter-gray: 250, 250, 250;
  --dark-d-red: 51, 2, 11;
  --mid-d-red: 85, 0, 22;
  --light-d-red: 166, 0, 41;
  --dark-l-red: 99, 0, 0;
  --mid-l-red: 115, 0, 5;
  --light-l-red: 179, 0, 0;
  --dark-purple: 51, 5, 51;
  --mid-purple: 64, 5, 64;
  --light-purple: 115, 11, 115;
  --dark-blue: 18, 28, 50;
  --mid-blue: 21, 35, 61;
  --light-blue: 45, 68, 113;
  --dark-d-green: 3, 33, 36;
  --mid-d-green: 5, 43, 46;
  --light-d-green: 0, 78, 85;
  --dark-l-green: 3, 33, 0;
  --mid-l-green: 5, 44, 0;
  --light-l-green: 0, 78, 0;
  --dark-brown: 36, 20, 19;
  --mid-brown: 51, 23, 23;
  --light-brown: 76, 42, 41;
  --kuro: 26, 26, 26;
  --shiro: 235, 235, 235;
  --mid-white: 107, 107, 107;
  --light-text: 165, 165, 165;
  --danger: 220, 53, 69;
  --warning: 255, 193, 7
}

a {
  color: inherit;
  text-decoration: none;
}

  a:hover {
    color: inherit;
  }

html,
body {
  font-family: quicksand, sans-serif;
  font-size: 1.12rem
}

h1 {
  font-family: zoinks;
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin: .75rem 0 .25rem;
  text-transform: uppercase
}

#page h1 {
  font-family: quicksand, sans-serif;
  font-size: 2rem;
  font-weight: 700
}

h2 {
  font-family: zoinks;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 0;
  text-transform: uppercase
}

h2 a {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 50vw;
  white-space: nowrap
}

h3 {
  font-size: 1.1rem;
  margin-bottom: 0
}

h5>span {
  font-weight: 700
}

h6 {
  font-size: 1.3rem;
  font-weight: 700;
  -webkit-mask-image: url(/assets/images/ui/icons.svg#bubble);
  mask-image: url(/assets/images/ui/icons.svg#bubble);
  padding: 0 0 .3rem .15rem;
  height: 5.5rem;
  width: 5.5rem
}

h6+span {
  font-size: 1.5rem;
  font-weight: 700;
  margin-left: 1rem;
  position: relative;
  top: -.2rem
}

#comments .editor a {
  font-size: 1rem
}

#comments .editor a.toggle {
  cursor: pointer;
  font-weight: 700
}

footer {
  font-size: .9rem
}

footer li:not(:last-child):after {
  font-size: 1rem
}

.icon {
  -ms-flex-item-align: center;
  align-self: center;
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center
}

.icon.loading {
  height: 200px;
  width: 200px
}

.icon.search {
  fill: rgba(var(--mid-gray));
  height: 2.25rem;
  width: 2.25rem
}

.icon.home,
.icon.preferences {
  fill: rgba(var(--mid-white));
  height: 2rem;
  width: 2rem
}

.active .icon.home,
.active .icon.preferences {
  fill: rgba(var(--shiro))
}

.icon.home {
  transform: scale( .75)
}

.icon.preferences {
  transform: scale( .6)
}

body {
  margin-top: 4.5rem
}

body::-webkit-scrollbar {
  width: auto
}

button[type=submit] {
  font-weight: 700;
  margin-bottom: 2rem;
  padding: .5rem 1rem
}

article {
  background-color: #fff;
  border-radius: .5rem;
  margin-top: 2.25rem;
  padding: 2rem
}

article p {
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  -ms-hyphens: auto;
  hyphens: auto
}

article .picture {
  margin: 2rem 0
}

article figure {
  margin: 0;
  max-width: 80%;
  position: relative
}

article figure figcaption {
  bottom: 3rem;
  position: absolute;
  right: -4.25rem;
  transform: rotate( -90deg)
}

article iframe,
article .embed img,
article figure img {
  border: 2px solid rgba( var( --darker-gray));
  height: 100%;
  width: 100%
}

article .meta img {
  border-radius: .5rem;
  width: 5rem
}

nav.pagination {
  margin: 1.5rem 0
}

nav.pagination div {
  background-color: #fff;
  border: 1px solid #fff;
  border-radius: .5rem;
  padding: 1rem
}

footer {
  bottom: -1rem;
  -webkit-box-shadow: 0 -4px 5px -2px #000;
  box-shadow: 0 -4px 5px -2px #000;
  margin: 0 ;
  position: relative
}

footer a:hover {
  text-decoration: underline
}

footer li:not(:last-child):after {
  content: "●";
  font-size: .65rem;
  margin-left: .6rem;
  vertical-align: 2px
}

.avatar img {
  border-radius: .5rem;
  height: 5rem;
  width: 5rem
}

header.top {
  background-color: rgba( var( --darker-gray));
  -webkit-box-shadow: 0 4px 5px -2px #000;
  box-shadow: 0 4px 5px -2px #000;
  color: rgba( var( --light-text));
  height: 4.6rem;
  padding: 0 2.5rem;
  position: fixed;
  top: 0;
  z-index: 999;
  width: 100%
}

#search input {
  background: 0 0;
  border: none;
  color: rgba( var( --mid-gray));
  cursor: pointer;
  display: inline-block;
  font-size: 2rem;
  height: 3.75rem;
  left: 2.5rem;
  outline: none;
  position: absolute;
  top: 0;
  transition: width .5s, z-index .5s;
  width: 0;
  z-index: 3
}

#search svg {
  cursor: pointer;
  left: 0;
  position: relative;
  top: 4px;
  transition: left .5s, top .5s
}
.wrapper-box{
  margin-bottom: -15px;
}
#search .wrapper:hover input,
#search .wrapper:focus input,
#search .wrapper:focus-within input {
  border-bottom: 1px solid rgba( var( --mid-gray));
  cursor: text;
  width: 24rem;
  z-index: 1
}

#search .wrapper:hover svg,
#search .wrapper:focus svg,
#search .wrapper:focus-within svg {
  left: 22rem;
  top: -3px
}

#user {
  background-color: rgba( var( --dark-gray));
  cursor: pointer;
  font-size: .75rem;
  padding: 0 1rem
}

#user,
#user div {
  width: 10.5rem
}

#user img {
  width: 2rem
}

#user svg {
  fill: rgba( var(--mid-gray));
  margin: 0 -10px 0 5px
}

#user svg.user {
  margin-top: -3px;
  height: 14px;
  width: 14px
}

#user svg.logout {
  margin: 3px 0 0 7px;
  height: 20px;
  width: 20px
}

#user .info,
#user .icon.user+span {
  margin-left: 1rem
}

.dropdown-menu {
  border-top-right-radius: 0;
  border-top-left-radius: 0;
  color: rgba( var(--mid-gray));
  margin: -3px 0 0 -1rem!important;
  padding: 0;
  width: 10.5rem
}

.dropdown-item:last-child:focus,
.dropdown-item:last-child:hover {
  border-bottom-right-radius: .25rem;
  border-bottom-left-radius: .25rem
}

.dropdown-menu a {
  color: #6c757d;
  padding: .75rem
}

html.shiro,
.shiro body {
  scrollbar-color: #c8c8c8 #fafafa!important
}

.shiro body::-webkit-scrollbar-track {
  background: #fafafa
}

.shiro body::-webkit-scrollbar-thumb {
  background-color: var#C8C8C8
}

.shiro body {
  background-color: rgba( var(--shiro))
}

.shiro h1 {
  color: rgba( var(--mid-white));
  text-shadow: -2px -2px 0 rgba( 0, 0, 0), 2px -2px 0 rgba( 0, 0, 0), -2px 2px 0 rgba( 0, 0, 0), 2px 2px 0 rgba( 0, 0, 0)
}

.shiro #page h1 {
  text-shadow: none
}

.shiro h2 {
  color: rgba( var(--mid-white))
}

.shiro h3 {
  color: rgba( var(--mid-gray))
}

.shiro h5>span {
  color: rgba( var(--shiro))
}

.shiro h6 {
  background: rgba( var(--mid-white));
  color: #fff
}

.shiro h6+span {
  color: rgba( var(--shiro))
}

.shiro #sidebar {
  background-color: rgba( var(--lighter-gray))
}

.shiro #sidebar .nav-link,
.shiro #sidebar .nav-link.active,
.shiro #sidebar .nav-link:hover {
  color: rgba( var(--dark-gray))
}

.shiro #sidebar .nav-link:hover svg,
.shiro #sidebar .nav-link.active svg {
  fill: rgba( var(--darker-gray))
}

.shiro #login h2 {
  color: rgba( var(--light-text))
}

.shiro #login input:focus {
  border: 4px solid rgba( var(--kuro))
}

.shiro #comments .name {
  color: rgba( var(--kuro))
}

.shiro #comments .markdown {
  border: 1px solid #ccc
}

.shiro #comments .editor a.toggle:hover {
  background-color: rgba( var(--darker-gray));
  color: #fff
}

.shiro #comments .editor .icon.help {
  fill: rgba( var(--mid-white))
}

.shiro #comments .comments .message a,
.shiro #comments .comments .author .display {
  color: rgba( var(--kuro))
}

.shiro footer {
  background-color: rgba( var( --darker-gray));
  color: rgba( var(--light-text))
}

.shiro #comments .icon.loading {
  fill: rgba( var(--darker-gray))
}

.shiro .icon.arrow-right,
.shiro .icon.arrow-left {
  fill: rgba( var(--mid-gray))
}

.shiro .btn.btn-primary {
  background-color: rgba( var(--mid-white));
  border-color: rgba( var(--mid-white));
  color: rgba( var(--shiro))
}

.shiro .danger {
  background-color: rgba( var( --mid-white), 0.15)!important;
  border-color: rgba( var( --mid-white))!important;
  color: rgba( var( --mid-white))!important
}

.shiro article,
.shiro #comments,
.shiro nav.pagination div {
  border: 1px solid rgba(var(--mid-white), 0.75)!important
}

.shiro h6+span {
  color: rgba( var(--mid-white))!important
}

.shiro #comments p.disclaimer {
  color: rgba( var(--kuro))!important
}

#dashboard {
  margin-right: .8rem
}

#dashboard .row:first-child>.col {
  margin-bottom: 2rem
}

#sidebar {
  box-shadow: 0 0 5px -2px rgba(var(--darker-gray));
  height: 100%;
  left: -1.7rem;
  padding: 1rem 1rem 0;
  position: relative
}

#sidebar .nav-link {
  color: rgba( var(--light-text))
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
  color: rgba( var(--shiro))
}

#sidebar .nav-link:hover svg {
  fill: rgba( var(--shiro))
}

#panel {
  background-color: #f00;
  color: #fff;
  border-radius: .5rem;
  margin-top: 1.8rem;
  padding: 2rem
}

And update your HTML with follwoing

          <input placeholder="Search" type="text" />
          <svg class="icon search button">
            <path d="M9.516 14.016q1.875 0 3.188-1.313t1.313-3.188-1.313-3.188-3.188-1.313-3.188 1.313-1.313 3.188 1.313 3.188 3.188 1.313zM15.516 14.016l4.969 4.969-1.5 1.5-4.969-4.969v-0.797l-0.281-0.281q-1.781 1.547-4.219 1.547-2.719 0-4.617-1.875t-1.898-4.594 1.898-4.617 4.617-1.898 4.594 1.898 1.875 4.617q0 0.984-0.469 2.227t-1.078 1.992l0.281 0.281h0.797z"/>
          </svg>

Site Title

              Username
              @username

              <svg class="icon user"  xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28">
                <path d="M23.797 20.922c-0.406-2.922-1.594-5.516-4.25-5.875-1.375 1.5-3.359 2.453-5.547 2.453s-4.172-0.953-5.547-2.453c-2.656 0.359-3.844 2.953-4.25 5.875 2.172 3.063 5.75 5.078 9.797 5.078s7.625-2.016 9.797-5.078zM20 10c0-3.313-2.688-6-6-6s-6 2.688-6 6 2.688 6 6 6 6-2.688 6-6zM28 14c0 7.703-6.25 14-14 14-7.734 0-14-6.281-14-14 0-7.734 6.266-14 14-14s14 6.266 14 14z" />
              </svg>
              Profile

              <svg class="icon logout">
                <use xlink:href="/assets/images/ui/icons.svg#logout" />
              </svg>
              Logout

<wrapper class="d-flex container-fluid wrapper-box">

        <svg class="icon home">
          <path d="M22 15.5v7.5c0 0.547-0.453 1-1 1h-6v-6h-4v6h-6c-0.547 0-1-0.453-1-1v-7.5c0-0.031 0.016-0.063 0.016-0.094l8.984-7.406 8.984 7.406c0.016 0.031 0.016 0.063 0.016 0.094zM25.484 14.422l-0.969 1.156c-0.078 0.094-0.203 0.156-0.328 0.172h-0.047c-0.125 0-0.234-0.031-0.328-0.109l-10.813-9.016-10.813 9.016c-0.109 0.078-0.234 0.125-0.375 0.109-0.125-0.016-0.25-0.078-0.328-0.172l-0.969-1.156c-0.172-0.203-0.141-0.531 0.063-0.703l11.234-9.359c0.656-0.547 1.719-0.547 2.375 0l3.813 3.187v-3.047c0-0.281 0.219-0.5 0.5-0.5h3c0.281 0 0.5 0.219 0.5 0.5v6.375l3.422 2.844c0.203 0.172 0.234 0.5 0.063 0.703z"/>
        </svg>
        Home

        <svg class="icon preferences" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
    <path d="M11.366 22.564l1.291-1.807-1.414-1.414-1.807 1.291c-0.335-0.187-0.694-0.337-1.071-0.444l-0.365-2.19h-2l-0.365 2.19c-0.377 0.107-0.736 0.256-1.071 0.444l-1.807-1.291-1.414 1.414 1.291 1.807c-0.187 0.335-0.337 0.694-0.443 1.071l-2.19 0.365v2l2.19 0.365c0.107 0.377 0.256 0.736 0.444 1.071l-1.291 1.807 1.414 1.414 1.807-1.291c0.335 0.187 0.694 0.337 1.071 0.444l0.365 2.19h2l0.365-2.19c0.377-0.107 0.736-0.256 1.071-0.444l1.807 1.291 1.414-1.414-1.291-1.807c0.187-0.335 0.337-0.694 0.444-1.071l2.19-0.365v-2l-2.19-0.365c-0.107-0.377-0.256-0.736-0.444-1.071zM7 27c-1.105 0-2-0.895-2-2s0.895-2 2-2 2 0.895 2 2-0.895 2-2 2zM32 12v-2l-2.106-0.383c-0.039-0.251-0.088-0.499-0.148-0.743l1.799-1.159-0.765-1.848-2.092 0.452c-0.132-0.216-0.273-0.426-0.422-0.629l1.219-1.761-1.414-1.414-1.761 1.219c-0.203-0.149-0.413-0.29-0.629-0.422l0.452-2.092-1.848-0.765-1.159 1.799c-0.244-0.059-0.492-0.109-0.743-0.148l-0.383-2.106h-2l-0.383 2.106c-0.251 0.039-0.499 0.088-0.743 0.148l-1.159-1.799-1.848 0.765 0.452 2.092c-0.216 0.132-0.426 0.273-0.629 0.422l-1.761-1.219-1.414 1.414 1.219 1.761c-0.149 0.203-0.29 0.413-0.422 0.629l-2.092-0.452-0.765 1.848 1.799 1.159c-0.059 0.244-0.109 0.492-0.148 0.743l-2.106 0.383v2l2.106 0.383c0.039 0.251 0.088 0.499 0.148 0.743l-1.799 1.159 0.765 1.848 2.092-0.452c0.132 0.216 0.273 0.426 0.422 0.629l-1.219 1.761 1.414 1.414 1.761-1.219c0.203 0.149 0.413 0.29 0.629 0.422l-0.452 2.092 1.848 0.765 1.159-1.799c0.244 0.059 0.492 0.109 0.743 0.148l0.383 2.106h2l0.383-2.106c0.251-0.039 0.499-0.088 0.743-0.148l1.159 1.799 1.848-0.765-0.452-2.092c0.216-0.132 0.426-0.273 0.629-0.422l1.761 1.219 1.414-1.414-1.219-1.761c0.149-0.203 0.29-0.413 0.422-0.629l2.092 0.452 0.765-1.848-1.799-1.159c0.059-0.244 0.109-0.492 0.148-0.743l2.106-0.383zM21 15.35c-2.402 0-4.35-1.948-4.35-4.35s1.948-4.35 4.35-4.35 4.35 1.948 4.35 4.35c0 2.402-1.948 4.35-4.35 4.35z"/>
  </svg>
        Preferences

Ullamco amet aute Lorem exercitation sunt commodo aliquip sit. Minim ea dolore exercitation tempor culpa consequat commodo deserunt sint ad veniam qui. Nisi est in duis nostrud id. Pariatur reprehenderit nisi consequat deserunt dolor laboris duis dolore consectetur id ea laboris pariatur. Irure eiusmod do aute reprehenderit amet.

Ut ipsum ullamco anim aliquip officia ex irure duis. Duis deserunt ut voluptate irure elit culpa ea non exercitation cillum fugiat est. Occaecat minim commodo adipisicing pariatur sint cillum laborum duis eu nostrud laboris magna do.

Ad sunt duis excepteur nisi ea sunt nulla. Ullamco quis qui reprehenderit duis enim elit ea duis velit consequat fugiat. Enim reprehenderit minim ea non. Magna pariatur dolore elit consequat voluptate esse incididunt aliqua ad pariatur nostrud. Sit ad Lorem commodo sint sunt ex.

Laboris dolor Lorem pariatur dolore. Irure fugiat qui ipsum ullamco consectetur. Est sint anim id magna cillum commodo incididunt proident id ad aliquip ipsum.

Deserunt dolor ea consequat non esse. Aliqua laboris velit nisi voluptate incididunt aliquip cupidatat aliquip mollit sit reprehenderit. Tempor ipsum ex cupidatat irure est. Duis duis cillum do velit nisi enim incididunt.

Excepteur quis ullamco dolor ut laboris deserunt ea mollit. Sunt amet nulla nostrud dolor dolor mollit anim amet ad amet. Culpa qui nostrud minim do consectetur laboris duis duis.

Ex proident aliquip id nostrud minim eiusmod excepteur reprehenderit mollit deserunt amet quis. Nisi culpa quis ullamco labore id sit velit non consequat. Non qui est nulla adipisicing consequat. Duis amet pariatur incididunt eu commodo consequat et aute.

Adipisicing elit incididunt proident amet ea do irure esse. Cupidatat anim nisi in mollit esse exercitation non ipsum excepteur. Mollit eiusmod fugiat fugiat ad eu mollit proident.

</wrapper>

            Terms

            Help

      Some rights reserved

            <svg class="icon help">
              <use xlink:href="/assets/images/ui/icons.svg#help" />
            </svg>

            <svg class="github">
              <use xlink:href="/assets/images/ui/icons.svg#github" />
            </svg>

LOGIN

            <input type="username" class="form-control username">
            Usuário

            <input type="password" class="form-control token">
            Token de Acesso

            <button type="submit" class="btn btn-primary btn-lg">Login</button>


text:
Q: How do I run RDD operations after a groupby in Spark? I have a large set of data that I want to perform clustering on. The catch is, I don't want one clustering for the whole set, but a clustering for each user. Essentially I would do a groupby userid first, then run KMeans.
The problem is, once you do a groupby, any mapping would be outside the spark controller context, so any attempt to create RDDs would fail. Spark's KMeans lib in mllib requires an RDD (so it can parallelize).
I see two workarounds, but I was hoping there was a better solution.
1) Manually loop through all the thousands of users in the controller (maybe millions when things get big), and run kmeans for each of them.
2) Do the groupby in the controller, then in map run a non-parallel kmeans provided by an external library.
Please tell me there is another way, I'd rather just have everything || as possible.

A: Edit: I didn't know it was pyspark at the moment of the response. However, I will leave it as an idea that may be adapted
I had a similar problem and I was able to improve the performance, but it was still not the ideal solution for me. Maybe for you it could work.
The idea was to break the RDD in many smaller RDDs (a new one for each user id), saving them to an array, then calling the processing function (clustering in your case) for each "sub-RDD". The suggested code is given below (explanation in the comments):
// A case class just to use as example
case class MyClass(userId: Long, value: Long, ...)

// A Scala local array with the user IDs (Could be another iterator, such as List or Array):
val userList: Seq[Long] = rdd.map{ _.userId }.distinct.collect.toSeq  // Just a suggestion!

// Now we can create the new rdds:
val rddsList: Seq[RDD[MyClass]] = userList.map {
  userId => rdd.filter({ item: MyClass => item.userId == userId })
}.toSeq

// Finally, we call the function we want for each RDD, saving the results in a new list.
// Note the ".par" call, which is used to start the expensive execution for multiple RDDs at the same time
val results = rddsList.par.map {
  r => myFunction(r)
}

I know this is roughly the same as your first option, but by using the .par call, I was able to improve the performance.
This call transforms the rddsList object to a ParSeq object. This new Scala object allows parallel computation, so, ideally, the map function will call myFunction(r) for multiple RDDs at once, which can improve the performance.
For more details about parallel collections, please check the Scala Documentation.


text:
Q: how to change the border colour of ng-select component to red? The select component in my angular html template is displaying fine. However I want to display this component with a red border, currently it is displayed in grey color. I am not able to achieve this.
I'm using Angular 5
<ng-select class="custom" [searchable]="true" formControlName="contactList" [items]="contactLists"
     bindLabel="name"
     placeholder="{{ 'PLACEHOLDERS.CONTACT_LIST' | translate }}" [compareWith]="compareResource">
</ng-select>

the custom css is defined in file and it is as follows
.ng-select.custom {
    min-height: 0px;
    max-width: 350px;
}
.ng-select.dropdown {
    border: 1px solid black;
}

A: What you're probably looking for is called ::ng-deep*.
check the documentation for further details.
*be aware that it's in a deprecated state at the moment.
::ng-deep .ng-select.custom {
        min-height: 0px;
        max-width: 350px;
}

::ng-deep .ng-select.dropdown {
    border: 1px solid black;
}

A: You can also override the SCSS variable in your styles.scss
$ng-select-highlight: #6200ee !default;
@import "~@ng-select/ng-select/scss/material.theme";

A: In your css you are targeting ".ng-select", have you tried targeting it as an element and not a class?
 ng-select.custom {
     min-height: 0px;
     max-width: 350px;
 }

 ng-select.dropdown {
     border: 1px solid black;
 }

A: I think is a problem realted to angular viewencapsulation and browser css specificy.
I aslo seen that you use  border: 1px solid black; and not red as you mentioned in the question.
https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
https://dzone.com/articles/what-is-viewencapsulation-in-angular

A: <ng-multiselect-dropdown #multiSelect [placeholder]="'Select Service'" [settings]="dropdownSettings" class="custom-dropdown"
  [data]="dropdownList">
</ng-multiselect-dropdown>

Provide a custom class  e.g. custom-dropdown and then in your styles.scss override it, for example
.custom-dropdown .multiselect-dropdown {
    position: relative;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    color: #757575 !important;
    font-family: "Gilroy-SemiBold", "Arial", serif !important;
    .dropdown-btn {
        border: 1px solid #red !important;
    }
}

A: add this style in css/scss file of your component.
get more info
/*
    go red when touched when touched
*/

/* Border Color */
.ng-select.ng-invalid.ng-touched .ng-select-container{
    border-color: red;
}

/* Arrow Color */
.ng-select.ng-invalid.ng-touched .ng-arrow-wrapper .ng-arrow{
    border-color: red transparent transparent
}
/* Placeholder Color */
.ng-select.ng-invalid.ng-touched .ng-select-container .ng-placeholder{
    color: red;
}


text:
Q: How to cover lambda function in coverage kotlin I am using jococo for test coverage. I want to cover every package, but I added this code
@Retention(AnnotationRetention.BINARY)
annotation class NoCoverageGenerated

to not excluded that class which I don't want to cover. But there is problem inside that class if we have any lambda function it not covering that lambda function. How can we cover lamda function ?
@NoCoverageGenerated
class ABC {

   private val OnSuccessListener: (any: Any?) -> Unit = { _ ->
      xyz()
   }
}


text:
Q: how to set-up (very) simple sendmail I've been trying to get command line sendmail to work, but no success. I need this to output my anacron error somewhere.
I've installed the sendmail package. Configured /etc/aliases with:
root: me@gmail.com

But whenever I'm trying to send an email to any address (root, me@gmail.com) the sendmail log keeps telling me its relayed to 'localhost' and sent. Never to be found again. Some files get made in /var/mail/mqueue.
Log output:
root@tok:/var/mail# sendmail me@gmail.com test37

Feb 27 13:35:40 tok sendmail[23616]: r1RCZanW023616: from=tys, size=7, class=0, nrcpts=1, msgid=<201302271235.r1RCZanW023616@tok.mydomain.nl>, relay=root@localhost
Feb 27 13:35:40 tok sm-mta[23617]: r1RCZe41023617: from=<tys@tok.mydomain.nl>, size=289, class=0, nrcpts=1, msgid=<201302271235.r1RCZanW023616@tok.mydomain.nl>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Feb 27 13:35:40 tok sendmail[23616]: r1RCZanW023616: to=me@gmail.com, ctladdr=tys (1000/1000), delay=00:00:04, xdelay=00:00:00, mailer=relay, pri=30007, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (r1RCZe41023617 Message accepted for delivery)

Why does it decide that me@gmail.com should be delivered to localhost and does it never try to actually connect to gmail.com?
How should I configure this? I rather don't have any mailserver running at all. I just want the sendmail command to work and to forward my local root mails to mail address.
Can't sendmail just lookup the MX record for the rcpt domain on itself and just deliver it there?
I've also tried putting the alias in /root/.forward, tried forwarding to local file. All without success. I've ran newaliases after editing /etc/aliases. I've tried restarting init.d/sendmail.

A: I believe you mail is queued.  Just try mailq and then sendmail -q or sendmail -q -v.
Possible is also, that email is being held because of unknown host. You need to have set localhost and your hostname in /etc/hosts
You normally don't need to use sendmail from command line to send emails, because it's not very convenient. You should use mailx or mutt
With mailx
echo you message  | mail -s subject user@host


text:
Q: ODBC driver for MS Access seems missing (Windows 64 bit) I am simply trying to connect a java application to MS Access in the Eclipse IDE. From what I have read and done on other computers I need to go to the ODBC Data source administrator and add user DSN MS Access Database. The problem I have is that I recieve an error indicating that the ODBC Driver is not installed.
Now I assumed it would be as simple as downloading and installing it like say MySQL ODBC driver, this doesnt seem to be the case. From what I have read it is somthing to do with 32 and 64 bit windows 7 o.s.
I would appreciate if someone could identify the problem.
Thanks in advance
S

A: Could this help?
http://social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/685eacc1-a670-42d4-8392-924230fa90cb

A: solution found on this website: https://stackoverflow.com/questions/6721702/windows-7-64-bit-odbc-drivers-for-ms-access-missing
It's likely the shortcut for setting ODBC data sources is pointing to the 32bit data sources instead of 64bit.
Go to control panel -> administrative tools --> select data sources(ODBC) --> then right click on that file --> go to properties --> in the shortcut tab -> change the path from %windir%\System32\odbcad32.exe to
%windir%\SysWOW64\odbcad32.exe
and make your connection. the driver for MS Access will work fine now.


text:
Q: Android - Running tasks in the background in order of request It's my first time here. I hope I'm clear enough with my question.
I want to have a Decoder object initialized at the start of an Activity and stays idle until it is request to do Decoder.decode(int x), which I want to run in the background and in the order of request.
For example, Decoder.decode(int x) takes more than 1 second to finish but I call request it to run once every second. I want a call to Decoder.decode(int x) waits for the previous call to finish before it starts executing.
Currently, I'm using Service and bind it to my activity. The initialization part is done in onBind(). Every time a request is made, the service creates an AsyncTask and run Decoder.decode(int x) inside its doInBackground method. Is that the right approach or should I do something else?
Thank you for your help.

A: You can use a blocking queue of AsyncTasks or threads to perform operations in order. You can also use a library such as this:
https://github.com/path/android-priority-jobqueue


text:
Q: android annotation after checkout from svn i set up the project using android annotation, then check in to the svn after the checkout from the SVN ,the problem started ,please do something if anybody experienced in this
08-14 13:02:31.097: W/dalvikvm(16362): threadid=1: thread exiting with uncaught exception (group=0x41948ba8)
08-14 13:02:31.097: W/System.err(16362): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{}: java.lang.ClassNotFoundException: Didn't find class "com.MainActivity" on path: DexPathList[[zip file "/data/app/"],nativeLibraryDirectories=[/data/app-lib/com-2, /vendor/lib, /system/lib]]
08-14 13:02:31.097: W/System.err(16362):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
08-14 13:02:31.097: W/System.err(16362):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
08-14 13:02:31.097: W/System.err(16362):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
08-14 13:02:31.097: W/System.err(16362):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
08-14 13:02:31.097: W/System.err(16362):    at android.os.Handler.dispatchMessage(Handler.java:102)
08-14 13:02:31.097: W/System.err(16362):    at android.os.Looper.loop(Looper.java:136)
08-14 13:02:31.097: W/System.err(16362):    at android.app.ActivityThread.main(ActivityThread.java:5001)
08-14 13:02:31.097: W/System.err(16362):    at java.lang.reflect.Method.invokeNative(Native Method)
08-14 13:02:31.097: W/System.err(16362):    at java.lang.reflect.Method.invoke(Method.java:515)
08-14 13:02:31.097: W/System.err(16362):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
08-14 13:02:31.097: W/System.err(16362):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
08-14 13:02:31.097: W/System.err(16362):    at dalvik.system.NativeStart.main(Native Method)
08-14 13:02:31.107: W/System.err(16362): Caused by: java.lang.ClassNotFoundException: Didn't find class ".MainActivity_" on path: DexPathList[[zip file "/data/app/com.-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.-2, /vendor/lib, /system/lib]]
08-14 13:02:31.107: W/System.err(16362):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-14 13:02:31.107: W/System.err(16362):    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
08-14 13:02:31.107: W/System.err(16362):    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
08-14 13:02:31.107: W/System.err(16362):    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
08-14 13:02:31.107: W/System.err(16362):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2101)
08-14 13:02:31.107: W/System.err(16362):    ... 11 more

A: latter i found this answer

->Right click the project
->select Property
->select Java Compiler
->select Annotation processing
->Select Factory Path

 there remove the jar file and re add the jar file, the do Apply, then give OK


text:
Q: retrieving value of select after posting form The select tag is being generated from the database through PHP echo command.
After I post the form including my select element, I want to be able to retrieve the content (between option tag) as well as the value in the option tag. So if I chose Volvo and submitted the form. I want to retrieve Volvo and 1.
<select name='car'>
  <option value='1'>Volvo</option>
  <option value='2>Saab</option>
  <option value='3>Mercede</option>
  <option value='4>Audi</option>
</select>

This will only retrieve the value.
$_POST['car']

how can I retrieve both?

A: You can't. But you know that 1 is always Volvo.
Just keep it in an array:
$cars = array('Volvo', 'Saab,' 'Mercede', 'Audi');
$car_name = $cars[$_POST['car']];

This way you can also generate the select from the array:
<select name='car'>
  <? foreach ($cars as $key => $car_name): ?>
    <option value='<?= $key ?>'><?= $car_name ?></option>
  <? endforeach; ?>
</select>

A: Unless you're using jQuery to manipulate your submission, you can just modify the value attribute to include the same word as the content of the option. You wouldn't be able to submit POST data extracted from the content of the option, though.

A: you can get like this
<select name='car'>
  <option value='1,Volvo'>Volvo</option>
</select>

and
$value = explode(",",$_POST['car']);

you get
$value[0]= 1
$value[1]= Volvo


text: Q: How to develop offline map in android application? Hello Android developer i will develop offline map in Android using mapbox library and refer there example but in example give static LatLng. How can give dynamically LatLng? please help me. Thank you in advance.


text:
Q: Is there any way to disable the screenshot to the particular website? image can't be save in any format I want to create a website, From there no one can steal my photos by screenshot or any kind of download method. if they try to screenshot the particular image also they unable to save any photo format. Is that possible?
Please Let Me Know...
Thanks!!!

A: Preventing screenshots is not possible

A:  {(function() {
var startingTime = new Date().getTime();
// Load the script
var script = document.createElement("SCRIPT");
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
script.type = 'text/javascript';
document.getElementsByTagName("head")[0].appendChild(script);

// Poll for jQuery to come into existance
var checkReady = function(callback) {
    if (window.jQuery) {
        callback(jQuery);
    }
    else {
        window.setTimeout(function() { checkReady(callback); }, 20);
    }
};

// Start polling(Add jquery logic here)
checkReady(function($) {
    $(document).keyup(function(e){
      if(e.keyCode == 44) return false;
    });
});
})()
}


text:
Q: How to split array of objects into arrays of objects connected with the same value for some property? So I have this array of objects:
var users =
 [
  { action: 'search', time: 1487098109, name: 'Charlie' },
  { action: 'search', time: 1487184715, name: 'Charlie' },
  { action: 'search', time: 1487184755, name: 'John' },
  { action: 'search', time: 1487271527, name: 'John' },
  { action: 'search', time: 1487271527, name: 'Mark' },
  { action: 'search', time: 1487271537, name: 'Mark' },
  { action: 'c', time: 1487098139, name: 'Mike' },
  { action: 'b', time: 1487098169, name: 'Mike' },
  { action: 'a', time: 1487098199, name: 'Mike' },
  { action: 'login', time: 1487098300, name: 'Mike' },
  { action: 'search', time: 1, name: 'Robert' },
  { action: 'search', time: 2, name: 'Robert' },
  { action: 'search', time: 1487098169, name: 'Woody' },
  { action: 'search', time: 1487271467, name: 'Woody' }
 ]

And I want to convert it into this structure which is an array of arrays of objects connects by the same name property:
[
  [
    { action: 'search', time: 1487098109, name: 'Charlie' },
    { action: 'search', time: 1487184715, name: 'Charlie' }
  ],
  [
    { action: 'search', time: 1487184755, name: 'John' },
    { action: 'search', time: 1487271527, name: 'John' }
  ],
  [
    { action: 'search', time: 1487271527, name: 'Mark' },
    { action: 'search', time: 1487271537, name: 'Mark' }
  ],
  [
    { action: 'c', time: 1487098139, name: 'Mike' },
    { action: 'b', time: 1487098169, name: 'Mike' },
    { action: 'a', time: 1487098199, name: 'Mike' },
    { action: 'login', time: 1487098300, name: 'Mike' }
  ],
  [
    { action: 'search', time: 1, name: 'Robert' },
    { action: 'search', time: 2, name: 'Robert' }
  ],
  [
    { action: 'search', time: 1487098169, name: 'Woody' },
    { action: 'search', time: 1487271467, name: 'Woody' }
  ]
]

So how can I accomplish this? Thank you in advance!

A: You can sort and then execute the function reduce to group the objects by name.

var users = [   { action: 'search', time: 1487098109, name: 'Charlie' },  { action: 'search', time: 1487184715, name: 'Charlie' },  { action: 'search', time: 1487184755, name: 'John' },  { action: 'search', time: 1487271527, name: 'John' },  { action: 'search', time: 1487271527, name: 'Mark' },  { action: 'search', time: 1487271537, name: 'Mark' },  { action: 'c', time: 1487098139, name: 'Mike' },  { action: 'b', time: 1487098169, name: 'Mike' },  { action: 'a', time: 1487098199, name: 'Mike' },  { action: 'login', time: 1487098300, name: 'Mike' },  { action: 'search', time: 1, name: 'Robert' },  { action: 'search', time: 2, name: 'Robert' },  { action: 'search', time: 1487098169, name: 'Woody' },  { action: 'search', time: 1487271467, name: 'Woody' }  ];

var result = Object.values(users.sort((a, b) => a.name.localeCompare(b.name)).reduce((a, c) => {
  (a[c.name] || (a[c.name] = [])).push(c);
  return a;
}, {}));

console.log(result);
.as-console-wrapper { max-height: 100% !important; top: 0; }


text:
Q: Activiti assign/reassign process I am a beginner on Activiti BPM. I would like to implement a ticket process flow.
Say for example:
Start event ->
Any user can create ticket. (User task)
This ticket will be emailed to Manager identified by ticket type. (Service task)
- I am using service task here instead of email task as I would be using Spring/Velocity template.
- In this email a URL similar to this will be sent along:
/ticket/123/assign

Now this ticket will be claimed by the Manager who received the email. (User task)
However he could decide to reassign this task to some other Manager.
This delegation process is indefinite and can be repeated any number of times by any Manager during the workflow.
How do I implement this assign and reassign process in Activiti? Is there any suitable BPMN constructs/pattern or examples on how to achieve this in Activiti? Thanks.

A: *

*Create process definition like this:

*

*For sending email to manager use TaskListener with event type create. More info in http://activiti.org/userguide/#taskListeners

*If the process arrives to the UserTask in Activiti database is created instance of ACT_RU_TASK. There are three attributes:

*

*OWNER_ user who owns the task

*ASSIGNEE_ user who solves the task

*DELEGATION_ delegating to another user, with keeping original assignee
More info in http://activiti.org/userguide/#bpmnUserTask
For your purposes, you can use Owner for first manager (who is notified by email, you can set owner in TaskListener) and Assignee for assigned manager. You can change assignee any number of times you want.
Activiti engine solves only process flow not UI.


text:
Q: Tv Series (Humans) - Do I have a False Memory? When the TV show "Humans" first aired, I caught a fraction of an episode while channel surfing. I've just watched Season 1 in a marathon session, and there's no sign of the scene I remember...
In the scene [something] has gone missing. Parents Joe & Laura ask Synth Anita / Mia about it, and she leads them directly to the missing object. After chastising her, we discover the item was actually stolen by daughter Mattie.
Does anyone else remember this? Am I remembering a scene that was actually in Season 2, were episodes edited [and this scene cut from the set I watched]? Did actress Gemma Chan, or someone who looks a lot like her, do a similar TV show? Or do I just have a massive case of "false memory" ?

A: I only saw the first season, and I don't remember that scene, I think you have false memory :)
I don't think it is from the second season, as Mia take control of the body at the end of first season, and Anita doesn't exist anymore.
By the way, the seriesHumans is a remake of Swedish series Real Humans, maybe the scene you saw is from there?


text:
Q: 301 page to page Redirect Directive not working I have never worked with .htaccess before and was going through the documentation of Redirect Directive here :  http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect .I wanted a 301 redirect from http://localhost/testing/about.html to  http://localhost/testing/about-me.html . I created a .htaccess file in http://localhost/testing/ like below :
<IfModule mod_rewrite.c>
RewriteEngine On
Redirect 301 /about.html http://localhost/testing/about-me.html

</IfModule>

The redirect is not working . I am sure I am doing something wrong . Could somebody please tell me why the redirect is not working ?

A: Make sure mod_alias is loaded. There is the other way of making the same redirect, but with mod_rewrite:
<IfModule mod_rewrite.c>
RewriteEngine On #Use RewriteEngine only once
RewriteRule ^about.html http://localhost/testing/about-me.html
</IfModule>

Or: (With mod_alias loaded)
<IfModule mod_alias.c>
Redirect 301 "/about.html" "http://localhost/testing/about-me.html"
</IfModule>


text:
Q: XML schema - how to bind existence of one attribute to existence of another attribute I have the following xml lines:
<customer id="3" phone="123456" city="" />  <!--OK-->
<customer id="4" />                         <!--OK-->
<customer id="3" phone="123456" />          <!--ERROR-->
<customer id="3" city="" />                 <!--ERROR-->

"phone" and "city" attributes are optional, but if "phone" exists, also "city" should exists and vise versa. Is it possible to insert such restriction to XML schema?
Thanks.

A: The concept of dependencies (which you are calling "binding") in XML is managed through nesting. So if you want two fields to be dependent on one another, you should define them as mandatory attributes of a nested, optional element.
So if you have full control over the schema's structure, you could do something like this:
<customer id="1">
  <contact city="Gotham" phone="batman's red phone" />
</customer>

Where the contact element is optional within customer, but city and phone are mandatory within contact.
The corresponding XSD for that structure would be something like this:
  <xs:element name="customer">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="contact" minOccurs="0">
          <xs:complexType>
            <xs:attribute name="city" type="xs:string" use="required"/>
            <xs:attribute name="phone" type="xs:string" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="id" type="xs:string"/>
    </xs:complexType>
  </xs:element>


text:
Q: Some members are not showing in Visual Studio 2013 Object Browser I have Googled this question, but didn't find any appropriate answer.
I have searcher for System.Web.UI.MasterPage in VS2013's Object Browser and then in MSDN.
Object Browser result

MSDN Result

You can see MSDN is showing a big list of methods but Object Browser shows only few of them.
My question is: Why some members are not showing in Object Brower? However, they are showing in MSDN.
Note: I am using Visual Studio 2013 Community Edition.


text:
Q: Show which php scripts Apache is currently running When I run ps -ef from the Linux command line I don't see the php scripts currently being run by Apache web users, I just see the process as:
/usr/bin/php5-cgi -q -b 127.0.0.1:9000 -c /etc/php5/cgi/php.ini

Is there a command line that will show which script is being run, rather than just the fact the Apache user is using php?

A: You can get the current working directory and opened files using lsof.
Sadly this does not include the script being run, but if scripts are in
different directories, or open different files, you can distinguish between
them. Eg the following shows a script in /var/www/stuff/php is running:
sudo lsof -c http | grep cwd
httpd   24475  id  cwd DIR 8,3     4096 1123403 /var/www/stuff/php

You can configure apache to let you have the information. Add an entry like
<Location /server-status>
    SetHandler server-status
    ...
</Location>

in your conf ensuring it is only made available to restricted remotes.
Then browse to http://localhost/server-status and you will have a "ps" of
running jobs. For example, this output shows gg.php is running (I've
removed some columns):
Srv PID     Acc     M CPU     SS Slot Client  VHost  Request
0-0 23688   0/0/262 W 0.50    2  4.48 ::1     xxx:80 GET /php/gg.php HTTP/1.1
1-0 23743   0/0/187 W 0.00    0  3.30 ::1     xxx:80 GET /server-status HTTP/1.1


text:
Q: Bash - Input to a while loop #!/bin/bash

kommando="java -jar '/home/git/yuicompressor-2.4.7/build/yuicompressor-2.4.7.jar'"
gitdir='/home/git/repositories/gitosis-admin.git/gitosis-export/dev/www/res/'

echo "Vil Du versionere ? (ja/nej)"
read yesno
    if [yesno="ja"]
then
    echo "Hvad vil du kalde denne version:"
read version
else
    echo "ok - surethang !"

while
  IFS=$'\n' read linje
do
  case "$linje" in
    *.css )
      $kommando "$gitdir/$linje" --type css >> "$gitdir/`basename \"$linje\" .css`."version".css" ;;
    *.js  )
      $kommando "$gitdir/$linje" --type js  >> "$gitdir/`basename \"$linje\" .js`."version".js" ;;
    ?*)
  esac
done < manifest.conf

when i run the script it gives me and error at line 36 (end) (when i serve the manifest to the while loop).

A: I see following errors in your code:

*

*you not enclose if statement by fi

*missed spaces in if header

*use $ when you wanted to get variable value

So, instead of
read yesno
if [yesno="ja"]
then
    echo "Hvad vil du kalde denne version:"
    read version
else
    echo "ok - surethang !"

you should write
read yesno
if [ $yesno = "ja" ]
then
    echo "Hvad vil du kalde denne version:"
    read version
else
    echo "ok - surethang !"
fi

A: You have at least stray ?*) with no terminating ;;. Also, the [yesno="ja"] comaprison is wrong, you lost one dollar and due to the dollar shortage cut down on space program. Try [[ "$yesno" = "ja" ]] instead.
Otherwise description of the error might be helpful.


text:
Q: Excel: How to dynamically change text within a formula using text from a reference cell I have the following line I am working on:
=VLOOKUP(B16,PI_Rank_Ferox,2,FALSE)
I am trying to take text in the formula (the example shows the word Ferox) and make it dynamically changed based on what's happening in another cell (the text in the cell H3).
So if H3 shows the word Griffin, I want the cell to change to this:
=VLOOKUP(B16,PI_Rank_Griffin,2,FALSE)
If H3 shows the words Slasher II, I want it to look like this:
=VLOOKUP(B16,PI_Rank_Slasher_II,2,FALSE)
Any advice?

A: A use for the INDIRECT function.
Try:
=VLOOKUP(B16,INDIRECT("PI_Rank_" & H3),2,FALSE)

Note that INDIRECT is a volatile function, and if you have a large number of formulas using this, it may slow down your worksheet calculations

A: Please try this:
=VLOOKUP(D2,IFS($F$13="Ferox",PI_Rank_Ferox,$F$13="Griffin",PI_Rank_Griffin,$F$13="Slasher II",PI_Rank_Slasher_II),2,FALSE)
Please note that PI_Rank_Ferox, PI_Rank_Griffin and PI_Rank_Slasher_II are added as table range instead of text.

A: Another possibility is:
= VLOOKUP(B16, CHOOSE(H4, PI_Rank_Ferox, PI_Rank_Griffin, PI_Rank_Slasher_II), 2, FALSE)
where cell H4 contains the index number 1-3 of your selection in cell H3.
If you want to make it really beautiful and easily extendable, make a table with 1 column that contains all the values you want your user to be able to select.
Create a named reference (Formulas->Name Manager->New) and in the Refers to you type: =INDEX(<your table name[Column name]>, 0).
Now, make cell H3 a data validation cell,which values are based on a list. In the source field, type the name of the named reference you just created.
And at last, cell H4, type: IFERROR(Match(H3, <your table name[Column name]>, 0), 1)


text:
Q: Function App not getting executed for all messages in the service bus queue I have 2 functions created in a function app

*

*Function 1 adds messages to a service bus queue (Queuename - TestQueue)

*Function 2 gets triggered whenever there is a message in the service bus queue (Queuename - TestQueue) and adds that received message to a mongo DB table.

Function 1 successfully added 5K messages into the Queue, and the queue also shows 5K messages received and sent. But Function 2 got executed only 3964 times and I see only those many entries into the mongo DB table as well.
Code of the Function 1
const { ServiceBusClient } = require("@azure/service-bus");
const {MongoClient} = require('mongodb');
const uri = "mongodb://XXXXXXXXX:27017";

// Define connection string and related Service Bus entity names here
const connectionString = "Endpoint=sb://XXXX";
const queueName = "XXXX";

module.exports = async function(context, mySbMsg) {
    context.log('JavaScript ServiceBus queue trigger function processed message', mySbMsg);
    const sbClient = ServiceBusClient.createFromConnectionString(connectionString);
    const queueClient = sbClient.createQueueClient(queueName);
    const sender = queueClient.createSender();

try {
    var client = await MongoClient.connect(uri,{ useUnifiedTopology: true });
    var db = client.db("test_users");
    var response = await db.collection("users").find({"batch_id":mySbMsg}).toArray();
    for (let i = 0; i < response.length; i++) {
    const message= {
        body: response[i].email
    };
        context.log(`Sending message: ${response[i].email} Timestamp: ${new Date()}`);
        await sender.send(message);
    }
    await client.close();
    await queueClient.close();
}
catch(e)
{
    context.log(e);
}
finally
{
    await sbClient.close();
}

};

Code of Function 2
const {MongoClient} = require('mongodb');
const uri = "mongodb://XXXXXX:27017";

module.exports = async function(context, mySbMsg) {

try
{
    context.log(mySbMsg);
    context.log(JSON.stringify(mySbMsg));

    var client = await MongoClient.connect(uri,{ useUnifiedTopology: true });
    var db = client.db("test_users");
    var message = {
        "email": mySbMsg,
        "created_at": new Date(),
        "updated_at": new Date()
    };
    var response_of_adding = await db.collection("users_emails").insertOne(message);
    await client.close();
    context.log(response_of_adding);
    context.log('JavaScript ServiceBus queue trigger function processed message', mySbMsg);
    context.log('Node.js ServiceBus queue trigger function processed message', mySbMsg);
    context.log('EnqueuedTimeUtc =', context.bindingData.enqueuedTimeUtc);
    context.log('DeliveryCount =', context.bindingData.deliveryCount);
    context.log('MessageId =', context.bindingData.messageId);
    context.done();
}
catch(e)
{
    context.log(e);
}
};

I am unable to understand the cause of this. Any help would be appreciated.
Thanks.


text:
Q: Put multiple datasets names into a list saved as objects of class pointer I have a function that saves dataframes as pointers. This saves time and space to execute large dataframes.
newPointer=function(inputValue){
object=new.env(parent=globalenv())
object$value=inputValue
class(object)='pointer'
return(object)
}
df1<-newPointer(data.frame(col1=c(1:10),col2=c(1:10)))
df2<-newPointer(data.frame(col1=c(11:20),col2=c(11:20)))

So to retrieve the value I have to type
`dataframe1<-df1$value`

I have number of such dataframes with pattern "dataframe".
I have this command to combine the dataframes into a list by pattern:
datalist <- lapply(ls(pattern="dataframe"), function(x) get(x))

But this gives list of pointers
I try to do get(x$value).  Gives an error-
datalist <- lapply(ls(pattern="dataframe"), function(x) get(x$value))
Error in x$value : $ operator is invalid for atomic vectors

My final aim is to append all dataframes into one dataframe using
big_data = bind_rows(datalist)

How do I get the list of dataframes instead of the pointers using laaply() or is there any better way to do combine dataframes (not pointers) and append together.