text:
Q: How can I store encfs6.xml in another location (and still make it detectable)? How can I make encfs4win search for the encfs6 file in another location?
I tried  modifying the encfs_mount.cmd file  at the end, like so:
set ENCFS6_CONFIG=c:/test1/.encfs6.xml
%pathtoencfs%encfs -f -v -d "%crypt%" "%decrypt%"

where crypt = c:\test4 and decrypt = J:.
If I have the correct encfs6 file in c:\test4 then the volume mounts regardless of whether I add the set ... line. But if I move the encfs6 file in c:\test1 then the application will get to the point where it asks for the password and then kind of does nothing else and then I close it; the drive does not appear to be mounted. I'm sure the ENCFS variable is detected because if I use it like this: set ENCFS6_CONFIG=c:/test1/ I get something along the lines of "found config file c:\test1\ but failed to load" so the variable has some effect.
Thank you in advance.
edit1:
BTW if you intend to test make sure you run all commands/ executable  as  admin
edit2: i tried on another pc .
I created and mounted the drive using a slightly modified version of the encfs_mount.cmd file

@echo off
rem Batch file for mounting encfs encrypted folders
title encfs: Mount an encrypted folder to a decrypted one
rem Check if Windows XP or Windows 7
rem XP: C:\Documents and Settings (or language specific folder)
rem 7: C:\Users
set oprsystem=%appdata:~3,5%
if %oprsystem%==Users (
  set ops=win7
) else (
  set ops=winxp
)
set ininumber=1
rem An ini file will be created for future access
if not exist encfs.ini goto firsttime
set ininumber=0
rem List existing encrypted / decrypted folder pairs
echo Already existing encrypted / decrypted folder pairs:
echo.
for /F "tokens=1,2,3,4 delims=µ" %%i in (encfs.ini) do (
  echo No.: %%i Name:             %%j
  echo  Encrypted folder: %%k
  echo  Decrypted folder: %%l
  echo.
)
echo.
echo Choose which pair should be mounted.
echo Type the corresponding number and press ENTER
echo Just press ENTER if you want to create a new pair.
echo.
set /p ininumber=Type number:
set new=yes
for /F "tokens=1,2,3,4 delims=µ" %%i in (encfs.ini) do (
  if %%i==%ininumber% (
    set crypt=%%k
    set decrypt=%%l
    set pair=%%j
    set new=no
  )
  set number=%%i
)
if %new%==no goto mount
rem Increment ininumber for new folder pair
set /a ininumber= %number% + 1
:firsttime
rem First time use
rem Ask for folder locations
cls
echo Please enter the location for the folder
echo that will contain the encrypted files and press ENTER:
echo [e.g. d:\crypt - don't use a trailing backslash]
echo.
set /p crypt=
echo.
if %ops%==win7 echo Please enter the location for the drive
if %ops%==winxp echo Please enter the location for the folder
echo where you want to be able to access the decrypted files and press ENTER.
if %ops%==win7 echo [e.g. x: - don't use a trailing backslash]
if %ops%==winxp echo [e.g. d:\plain or x: - don't use a trailing backslash]
echo.
set /p decrypt=
echo.
echo Please enter a name for the encrypted / decrypted folder pair and press ENTER
echo [e.g. Secret Files]
echo.
set /p pair=
echo.
echo.
echo.
echo %ininumber%µ%pair%µ%crypt%µ%decrypt%>>encfs.ini
:mount
cls
echo Mount   "%crypt%"   to   "%decrypt%"
if not exist "%crypt%" md "%crypt%"
rem If decrypt folder is a drive and encfs is on its first run decrypt folder is set to a temp folder
set lastchar=%decrypt:~-1%
if "%lastchar%"==":" (
  if not exist "%crypt%.encfs6.xml" (
    set decrypt="%temp%\decrypttemp"
    if not exist "%temp%\decrypttemp" md "%temp%\decrypttemp"
    echo.
    echo IMPORTANT
    echo After initialising encfs for the first time
    echo please close this window and start "encfs_mount" again
    echo.
    pause
    echo.
  )
) else (
  if not exist "%decrypt%" md "%decrypt%"
)
rem Mount encfs
set pathtoencfs=M:\kit\encfs4w\encfs4win\
set pathtolog=M:\kit\encfs4w\encfs4win\
set pathtowtee=M:\kit_util\
echo.
set ENCFS6_CONFIG=M:\test4.encfs6.xml
(%pathtoencfs%encfs -f -v -d "%crypt%" "%decrypt%")  2>&1 | %pathtowtee%wtee.exe -a %pathtolog%log.txt
echo.

so on this new pc %crypt%=m:\test1 and %decrypt%=j:
and here is the log file

20:57:27 (main.cpp:521) Root directory: m:\test1/
20:57:27 (main.cpp:522) Fuse arguments: (fg) (threaded) (keyCheck) M:\kit\encfs4w\encfs4win\encfs C:\Users\dabb\AppData\Local\Temp\decrypttemp -f -d -s -o use_ino -o default_permissions
20:57:27 (FileUtils.cpp:177) version = 20
20:57:27 (FileUtils.cpp:181) found new serialization format
20:57:27 (FileUtils.cpp:199) subVersion = 20100713
20:57:27 (Interface.cpp:165) checking if ssl/aes(3:0:2) implements ssl/aes(3:0:0)
20:57:27 (SSL_Cipher.cpp:372) allocated cipher ssl/aes, keySize 24, ivlength 16
20:57:27 (Interface.cpp:165) checking if ssl/aes(3:0:2) implements ssl/aes(3:0:0)
20:57:27 (SSL_Cipher.cpp:372) allocated cipher ssl/aes, keySize 24, ivlength 16
20:57:27 (FileUtils.cpp:1621) useStdin: 0
EncFS Password: 20:57:31 (Interface.cpp:165) checking if ssl/aes(3:0:2) implements ssl/aes(3:0:0)
20:57:31 (SSL_Cipher.cpp:372) allocated cipher ssl/aes, keySize 24, ivlength 16
20:57:31 (openssl.cpp:49) Allocating 41 locks for OpenSSL
20:57:31 (FileUtils.cpp:1627) cipher key size = 44
20:57:31 (Interface.cpp:165) checking if nameio/block(3:0:1) implements nameio/block(3:0:0)

Dokan: debug mode on
Dokan: use stderr
device opened
mounted: C:\Users\dabb\AppData\Local\Temp\decrypttemp -> \Volume{i delete the guid}
DokanRemoveMountPoint C:\Users\dabb\AppData\Local\Temp\decrypttemp
DokanControl recieved DeviceName:\Volume{i delete the guid}
send release
^C

UPDATE3: woa i can't believe no one is having this problem with non-default locations for .encfs6.xml. Just to make it clear, despite the mounting done by DOKAN, the drive does not appear in my comp
UPDATE4: for now i found a workaround. Instead of storing the 'encfs6' file in a different location than the one where the encrypted files are, i store the encrypted content in a folder that is in another location.And i create a directory junction that points to the encrypted content, and store it  in the folder with the 'encfs6' file.
So first i have

Encryptedfolder|--- .encfs6.xml
               |--- file1 (scrambledname)
               |--- file2 (scrambledname)

then i create the folder
Encryptedfolder    |--- .encfs6.xml
                    |--- file1 (scrambledname)
                    |--- file2 (scrambledname)
                    |--- folder1 (scrambledname)

i move all content except for folder1 (scrambledname) to an external folder ( Dropbox )

Encryptedfolder|--- .encfs6.xml
               |--- folder1 (scrambledname)

afterwards i copy  folder1(scrambledname)s name and i use it to create a directory junction to  the dropbox wuala teamdriver etc. folder. Of course you have to delete folder1 before that, because the junction must take the folder's place and trick encfs4win.

Encryptedfolder|--- .encfs6.xml
               |--- folder1 (scrambledname; this a junction to dropbox folder)

i still want to solve the problem with ENCFS6_CONFIG

A: You should set ENCFS6_CONFIG with a relative path to Root directory.
For example, ENCFS6_CONFIG=../../Directory1/.encfs6.xml

A: It seems the configuration file cannot be opened because enc4fs reads quoted file name from environment variable and passes it to configuration reader unchanged. So it tries to open
"c:/test1/.encfs6.xml"
instead of
c:/test1/.encfs6.xml
Digging a bit it looks like a boost problem. Hope somebody will contribute a fix.

A: I just tried it and set ENCFS6_CONFIG as a system variable in the system settings. I've set it to
d:\.encfs6.xml

and after removing the xml file from the encrypted directory it still mounts it. Solved the problem for me.


text:
Q: send text to gmail via PHP form I have a question about PHP.
I want to create a really simple page with only one function.
a text box, and a button to send it to my e-mail address.
**/ I don't really even get the concept of a .php file, or how to implement it to a html file (or do I just create a php file?)
I've been surfing on the web for a way, but quite can't get it.
If you can give me some advice on it, I'd really appreciate it.
I wrote the program, but won't send it to the address("itoyanlifelog@gmail.com").
I'm running it on MAMP, local server.

A: 1) use php mail() function: http://fr2.php.net/manual/en/function.mail.php
2) if you are on a local machine be sure that you can send emails from local. Take a look here: http://wiki.uniformserver.com/index.php/PHP_mail_function

redpajama_set_name: RedPajamaStackExchange


text:
Q: What shall I use instead of OnMouseXXX event handlers? I've build a little app where I use OnMouseDrag and OnMouseDown in some objects. I thought that it would be the best option because this methods were out of the Update method. However at compiling the app Unity says "Game scripts or other custom code contains OnMouseXXX event handlers. Presence of such handlers might impact performance on handheld devices."
So... what should I use instead of OnMouseDrag and OnMouseDown?
I've seen that i could use Input.GetMouseButtonDown. But to do this I will have to add an Update method to every object that has the OnMouseDown. Isn't it worst than having the OnMouseDrag?
And, why are OnMouseXXX events bad for the performance in on handheld devices?

A:
And, why are OnMouse events bad for the performance in on handheld
  devices?

They are not bad for performance. I haven't experienced any bad performance with them but the reason you are getting that error is because it is likely that Unity is doing more work on mobile in order to get it working. It's not made for that but you should't notice any performance hit just by using them.

So... what should I use instead of OnMouseDrag and OnMouseDown?

The OnMouseDrag and OnMouseDown functions were specifically made for desktops. Yes, they work on mobile devices too but should be avoided.
They should be avoided because they don't work for all Objects. For example, they don't work on the new UGUI system.
You should be using OnBeginDrag and OnEndDrag which both requires you implement IBeginDragHandler and IEndDragHandler.
The OnBeginDrag and OnEndDrag functions will work on all GameObjects including 3D, 2D and the UI. For 2D you need to attach Physics2DRaycaster to the camera. For 3D, you have to attach PhysicsRaycaster to the camera.
See this post for how to get it work on any GameObject.
using UnityEngine.EventSystems;

public class Dragger: MonoBehaviour,
    IBeginDragHandler, IEndDragHandler
{
    public void OnBeginDrag(PointerEventData eventData)
    {
        Debug.Log("Drag Begin");
    }

    public void OnDrag(PointerEventData eventData)
    {
        Debug.Log("Dragging");
    }

    public void OnEndDrag(PointerEventData eventData)
    {
        Debug.Log("Drag Ended");
    }
}


text:
Q: ORA-00942: table or view does not exist with huge query is there a possible way to get more accurate error messages from Oracle?
I have this very large query, with many joins ( entity with multiple @oneToMany )
however, i keep getting
ORA-00942: table or view does not exist

Error.
I have no idea why and i have one by one re-granted what i think is every table in query, yet, this error still persists....
How do i find out where the query is actually failing? i have feeling it isnt even a missing about table...
i cant really share the query, but is there possible other things that can throw the same error?
I can also run SELECT on all the tables in query, tested them one by one..

A: Usually you should get the line of the error:
SQL> select err from so_59733262;
select err from so_59733262
                *
ERROR at line 1:
ORA-00942: table or view does not exist

and the * points to the last table which is missing.


text:
Q: Cassandra: how to create a trigger on a table whenever a row is INSERT or UPDATE In Cassandra database, I have a table with column: update_date. What i want is whenever i insert or update a record to the table, cassandra will have a trigger to update that column with current datetime or timestamp.
I know that in oracle we can create a trigger like that. But i am new to cassandra and want to know if we can do the same thing .

A: Cassandra supports triggers as well, but it's in general it's not recommended to use them until you know what you're doing - triggers in Cassandra aren't the general-purpose tool. You need to be very careful because it may hurt the performance. Plus you need to write it using Java or other JVM-based language.  There is not so much official documentation, only examples, like this.
But really, if you want to have a timestamp when row was modified, you can use the writetime function instead - it will return the timestamp with microsecond precision.  Although one potential drawback is that this value could be explicitly set when inserting/updating data.

A: In case you weren't aware, all mutations in Cassandra (inserts, updates, deletes) are written with an accompanying timestamp so having to save it separately might not be necessary depending on what you need to do.
You can use the native CQL function WRITETIME() to get the time when data was written. It returns the date/time in microseconds. For example:
cqlsh:community> SELECT email, name, colour, WRITETIME(name) FROM users_by_email ;

 email                   | name  | colour | writetime(name)
-------------------------+-------+--------+------------------
 alice@getvaccinated.now | Alice |    red | 1629445088015677

In the example above, 1629445088015677 is equivalent to August 20, 2021 7:38:08.015 AM GMT. Cheers!


text:
Q: Is manipulating natural numbers in this fashion valid? Say I have a natural number $ a \in \mathbb N$
It follows then that $ 7 \mid 7a $ and $ 7a = 7a $
And then moving on:
$ 49a^2 - 35 = 49a^2 - 35 $
$ 7(7a^2 - 5) = 7(7a^2 - 5) $
$ 7a^2 - 5 = 7 (\frac{7a^2 - 5}{7}) $
Would it make sense to say that $ \exists r \in \mathbb N, r = \frac{7a^2 - 5}{7} $ such that $ 7a^2 - 5 = 7 r $ ? Would it make sense to claim $r$ as being a natural number since its constituents are all natural?
In case r isn't a natural number, can anybody give me a situation where I can always be certain that the derived value is natural?
Sorry if this question insults the intelligence of the general math.stackexchange populace. I'm suffering a bit of brain fog right now.

A: There exists a natrual number $r$ with $7r=b$ if and only if $b$ is a natural number with $7|b$. (Note that $7|b$ is defined as: There exists an integer $r$ such that $b=7r$).

A: You cannot just claim that r is a natural number based on the fact that its constituents are all natural, like anything in maths you have to prove that r is natural and just stating that it is because its constituents are all natural will get you nowhere.

A: The natural numbers are closed under multiplication, but there is not a multiplicative inverse. They do not form a group.
As such, $7^{-1}$ is not in the natural numbers, so the step where you (implicitly) say
$$7^{-1}\cdot 7(7a^2-5) = 7^{-1} \cdot 7(7a^2-5) \implies 7a^2-5 = 7\left(\frac{7a^2-5}{7}\right)$$
does not preserve the desired property.
For example, if $a=4$, then your first identity holds, but $7(4)^2-5 = 107$ is not divisible by 7.


text:
Q: Aurelia checkbox inside a button I am trying to have a checkbox inside a button and both clicking on the checkbox or the button should toggle the checkbox and the boolean value bound to it from the view model.
app.html:
<template>

${heading}

  <button type="button" click.trigger="toggleIsChecked()">
    <input type="checkbox" checked.bind="isChecked"> ${isChecked}
  </button>
</template>

app.ts:
export class App {
  isChecked: boolean;

  toggleIsChecked() {
      this.isChecked = !this.isChecked;
  }
}

What happens is that when I click the button (outside the checkbox) everything works as expected. But when I click the checkbox the boolean value in the view model changes but the checkbox is not checked or unchecked. What could be causing this?
I have tried different approaches but they all produce similar results. While debugging I noticed the checkbox gets checked but something in the Aurelia framework removes it almost instantly. Seems like the event handling is not working properly?
EDIT: I made a gist so you can try it yourself: https://gist.run/?id=4a7b2c11db33bdb37213eb4ea1b5b2b0

A: It's not the Aurelia framework that is "removing" the checking. What is happening is that when you click the checkbox, the isChecked is automatically set to true, then toggleIsChecked() is fired and isChecked is set to false (isChecked is set twice when you click the checkbox). To solve this you have to not set isChecked if the target is the checkbox. Something like this:
JS
toggleIsChecked(event) {
  if (event.target.tagName === 'INPUT') {
    return true; //checkbox has been clicked, do nothing!
  }
  this.isChecked = !this.isChecked;
}

HTML
<button type="button" click.trigger="toggleIsChecked($event)">
  <input type="checkbox" checked.bind="isChecked"> ${isChecked}
</button>

A: Same explanation with Fabio Luz & going to do the same thing, but instead of checking event target tag name, You can use self binding behavior, like this
<template>
  <require from='./self'></require>

${heading}

  <button type="button" click.delegate="toggleIsChecked() & self">
    <input type="checkbox" checked.bind="isChecked"> ${isChecked}
  </button>
</template>

What self binding behavior does here is to ensure toggleIsChecked only fires when you click on button itself, not its descendant, same with this block of code:
toggleIsChecked(event) {
  if (event.target === this.button) {
    // Do your thing
  }
}

Note: self just got merged, but has not been released yet. I have included the code at this gist: https://gist.run/?id=5e66dfd996d852344a524010ae82a936
You can read more about the PR here: https://github.com/aurelia/templating-resources/pull/263

A: Kind people at the Aurelia Gitter chat provided me with an answer. What is happening in my gist is that the default event handler is not being called. Reason for this is that Aurelia automatically calls the event.preventDefault() function. In order for the default event handler to be called I must return true from my own event handler. Here's a working gist proving how it works: https://gist.run/?id=3cb545572065cffd737f98788a4105a1
Thank you all for your answers. I decided to answer this myself since I got the answer from the Gitter chat, but the kudos belongs to the awesome Aurelia community and especially @CasiOo.


text:
Q: How to remove element from array of json based on array? idArray= [  'cb53f7a1-107c-44fd-9df6-adeddaa5d3f0',  '428a1951-7519-421b-90ea-704002eb31dc'] issues=[
{    description: 'Necessitatibus unde ',    severity: 'Minor',    status: 'Open',    createdDate: '1974-09-07',    resolvedDate: '2014-06-06',    id: '3d90afa1-bbbe-4640-bf91-38b27f72279a'  },
{    description: 'In quidem praesentiu',    severity: 'Critical',    status: 'Close',    createdDate: '2010-06-30',    resolvedDate: '2003-07-26',    id: 'cb53f7a1-107c-44fd-9df6-adeddaa5d3f0'  },
{    description: 'Error eum excepturi ',    severity: 'Minor',    status: 'Open',    createdDate: '1985-12-04',    resolvedDate: '2012-02-04',    id: 'a926ce55-79a3-4d38-923b-59b92cb2164a'  },
{    description: 'Laborum Vitae provi',    severity: 'Critical',    status: 'Inprogress',    createdDate: '2021-08-27',    resolvedDate: '2011-04-06',    id: '428a1951-7519-421b-90ea-704002eb31dc'  },
{    description: 'In amet obcaecati e',    severity: 'Minor',    status: 'Open',    createdDate: '2003-10-17',    resolvedDate: '1979-04-25',    id: 'dc137785-c283-4e54-a8c9-176e80d07b97'  }
]```
how to remove elements of issues based on idArray?

A: Parse JSON incase not and filter() method to get a new array filled with elements that pass a test provided by a function. Here's the code,

const dArray = [
  "cb53f7a1-107c-44fd-9df6-adeddaa5d3f0",
  "428a1951-7519-421b-90ea-704002eb31dc",
];

const issues = [
  {
    description: "Necessitatibus unde ",
    severity: "Minor",
    status: "Open",
    createdDate: "1974-09-07",
    resolvedDate: "2014-06-06",
    id: "3d90afa1-bbbe-4640-bf91-38b27f72279a",
  },
  {
    description: "In quidem praesentiu",
    severity: "Critical",
    status: "Close",
    createdDate: "2010-06-30",
    resolvedDate: "2003-07-26",
    id: "cb53f7a1-107c-44fd-9df6-adeddaa5d3f0",
  },
  {
    description: "Error eum excepturi ",
    severity: "Minor",
    status: "Open",
    createdDate: "1985-12-04",
    resolvedDate: "2012-02-04",
    id: "a926ce55-79a3-4d38-923b-59b92cb2164a",
  },
  {
    description: "Laborum Vitae provi",
    severity: "Critical",
    status: "Inprogress",
    createdDate: "2021-08-27",
    resolvedDate: "2011-04-06",
    id: "428a1951-7519-421b-90ea-704002eb31dc",
  },
  {
    description: "In amet obcaecati e",
    severity: "Minor",
    status: "Open",
    createdDate: "2003-10-17",
    resolvedDate: "1979-04-25",
    id: "dc137785-c283-4e54-a8c9-176e80d07b97",
  },
];

const data_filter = issues.filter((element) => !dArray.includes(element.id));
console.log(data_filter);


text:
Q: Multiple updates or full document replace I need to make two updates to a mongodb document that can be loaded by key.
Two updates are $sets but one of the updates is unconditional and the other is conditional.
To my understand I've two options:

*

*Load all the document, do the updates and then do a complete document replace with the modified version

*Do two separate update commands, one with the condition and other without.

In general what is better in terms of performance?
Is there a big penalty on document replace? The penalty is only in network bandwitch and bson parsing? Or it's also on index updating and other hidden costs?
Note: The document can be about 10Kb of data and have 4 index. None of the index is affected by the update.


text:
Q: EXECUTE AS over Linked Servers I have a front end that logs into the DB as "logInA", and only has permission to "schemaA" stored procs, which use EXECUTE AS "logInB", (I have also tried EXECUTE AS 'DBO'), to handle all the business logic.
I have run into a problem though, where a query tries to access a table on a Linked Server, and returns the error:

Access to the remote server is denied because the current security context is not trusted.

If it helps, the source server is SQL 2008, and the linked server is SQL 2005.
Can any one help me as to how to resolve this?
Thanks in advance
C


text:
Q: html5 local storage so I'm trying to figure out where the client side db gets stored actually. If I create something like this
    var mcTasks = {};
    mcTasks.webdb = {};

    //OPENING THE DATABASE
    mcTasks.webdb.db = null;
    mcTasks.webdb.open = function() {
    var dbSize = 5 * 1024 * 1024; // 5MB
    mcTasks.webdb.db = openDatabase('todo', '1.0', 'todo manager', dbSize);
    }
Where does this get stored? in cache? and if so that means that if I clear the cache the info gets lost right?
I'm trying to figure out which solution is better sqlLite or window.localStorage, any help is appreciated. thanks!

A: It gets stored in a location on the client machine, as a persistent file.
This is separate from the cache, so clearing the cache shouldn't have an effect on the stored data.
Where exactly the file is stored depends on the implementation.


text:
Q: How to create a new print layout on macOS? Currently when printing a document the Layout Two-side options are Off, Long-Edge binding, Short-edge binding and Booklet, see image

I want to add the single page booklet, which works like the image below.

What options exist to customize this on macOS?

A: According to another stack exchange question thread, it looks like these options are in fact provided by the printer drivers rather than the app you use to print.
Here a user mentions:

That option will only be available for printers that offer duplexing and automatic booklet making. Booklets made by printer drivers may place each page inside the print area of the sheet, thus scaling the pages to be smaller than necessary.

and in this answer's comment thread one user claims that they don't have the booklet option. Another user then claims that the booklet option comes from the printer drivers at their work.
If you wanted to make a new layout, your best bet is to make a template document in your word processing app of choice (Pages, Word, LaTex, etc) and then save it. Then always open that document and save a copy, then create your one page booklet by adding images/text/etc to the copy, so you can keep using the original as a template.

A: The process of placing pages on a sheet is called Imposition. "Mutiple-fold" imposition of this kind is usually done only in commercial and large-scale printing, because the more pages on your sheet, the bigger the sheet needs to be. (An A3 sheet folded 3 times gives you a tiny A6 page. Your HP OfficeJet Pro 8600 only does A4!)
Large-scale printing devices may have options in their drivers to impose pages. There is also standalone Imposition software, which tends to manipulate PDFs as part of a pre-press workflow. That's probably your best bet for adding this feature.
There are plenty of cheap or free Imposition apps, which you can search for: though many of them will only do 4-page-per-sheet booklet, e.g. A4 page on A3 sheet. More complex imposition apps tend to be quite expensive (Imposition Wizard is $559, or $260 p.a.; Imposition Studio Digital on the Mac App Store is c. $250 -- and that's a 'Light' version of the $450 app!) because they are geared to commercial work.
Adobe's InDesign comes with Imposition built-in to its print options. There are also Adobe Acrobat imposition plug-ins.
If you are sending your PDFs to a commercial printer, then they will deal with the imposition that they need for their equipment.
It would be possible to write a script using MacOS CoreGraphics APIs (in python, AppleScriptObjC, or Swift) that would perform the necessary imposition on a PDF document.


text:
Q: Creating an iCloud email I'm trying to create an iCloud email account. After following the steps and get to the end, I get a message that says "Problem Turning On Mail". It says to try again later, but I keep getting the same message. What do I do now?

A: Lots of reasons why Apple doesn't allow mail creation. Best bet is to ask Apple Support about your case specifically:

*

*https://support.apple.com/contact
Sometimes it's because too many accounts were created from that device or location, sometimes it's a conflict reserving the alias or address, sometimes it's just that millions of requests across thousands of computers get stuck on the server side or break.
Support will know is the system is up or down or if you hit a specific roadblock.


text:
Q: How to query orchestrate.io I was searching for an easy and simple database for a little highscore system for a some games I'm developing in javascript.
I saw Orchestrate.io in github's student developer pack. I found a suitable drivermodule nodejs orchestrate and have integrated them.
The problem comes with querying orchestrate for my data. I have managed saving scores and querying them with db.list('collection'), but this seems to not responding with all data. It appered to me that some values are not returned.
I read about the db.search('collection','query') function. But I don't really understand how I could return all data because I don't want to query in a specific way.
My objects are as simple as follows:
{"name":"Jack","score":1337}

As I understand, one has to send a key, when putting such values to an orchestrate-collection. But I'd like to query the whole collection and get the values in a descendant order in regard to the score.
As for now I end up sorting the result on the client-side.
I hope you guys can give me some hints for a query that can sort for specific values!

A: You have the option to use a SearchBuilder
db.newSearchBuilder()           //Build a search object
       .collection('collection') //Set the collection to be searched
       .sort(score, 'desc')      //Set the order of the results
       .query("*")                //Empty search
       .then(function (res) {    //Callback function for results
                                 //Do something with the results
        })
Source

A: By default, .list uses a pagination limit of 10. You can either increase that, e.g.:
db.list('collection', { limit: 100 })

Or use .links, .links.next (from the docs):
db.list('collection', { limit: 10 })
.then(function (page1) {
  // Got First Page
  if (page1.links && page1.links.next) {
    page1.links.next.get().then(function (page2) {
      // Got Second Page
    })
  }
})


text:
Q: Удаление части html страницы в WebBrowser WPF Добрый день!
Вопрос: подскажите, как удалить часть страницы, которая открыта в компоненте WebBrowser, и отобразить ее?
Так понимаю нужно спарсить страницу и занести ее в dom-дерево?
Много примеров как это сделать в windows forms, но по Wpf найти не могу.
Cпасибо)

A: Пришлось прикрутить браузер Windows Forms, тогда:
  dynamic htmldoc = Browser.Document.DomDocument;
        dynamic Header = htmldoc.GetElementById("тэг");
        if (Header != null)
        {
            Header.parentNode.removeChild(globalHeader);
        }


text:
Q: For Loop only Looping Once js I'm a beginner with JavaScript. I'm trying to make my work easier by writing less code, so I coded this..
for (counta = 0; counta < 22; counta++)
{
    window["varEnemyType1" + counta] = document.getElementById("EnemyType1" + counta).options[document.getElementById("EnemyType1" + counta).selectedIndex].text;
    window["varEnemyType2" + counta] = document.getElementById("EnemyType2" + counta).options[document.getElementById("EnemyType2" + counta).selectedIndex].text;
}

Before this I have set global vars e.g. (var varEnemyType11 = "";)
I'm going though all vars with 'counta' and then assigning a value.
In my troubleshooting I found out the for loop is only counting '0' and nothing after even the rest of the function. Why is that?

A: You need use var in the  counta declaration for example:
   for ( var counta = 0; counta < 22; counta++ ){
       //your code......
   }

Regards

A: Your loop is "ok", but you need to catch exceptions to tell if that's why it's not getting past the first one:
for ( var counta = 0; counta < 22; counta++ )
{
    try
    {
        window["varEnemyType1" + counta] = document.getElementById("EnemyType1" + counta).options[document.getElementById("EnemyType1" + counta).selectedIndex].text;
        window["varEnemyType2" + counta] = document.getElementById("EnemyType2" + counta).options[document.getElementById("EnemyType2" + counta).selectedIndex].text;
    }
    catch (ex)
    {
        //You should be doing this, but you might not know how to get to the console
        console.log( ex );

        alert( ex );
    }
}


text:
Q: Is it items value or item values? It's always confusing when double nouns and where to put the "s" to determine the plural? There's not proper rule. Especially in this case.
items value or item values?

A: By 'double nouns' I presume you mean compound nouns.
As a general rule, you only pluralise the principal word of a compound noun. This is because a compound noun is still the name of one single thing and is treated as a single noun, so you pluralise the entire thing rather than every word in it.
The principal word in a compound noun is often the last word - for example, the principal word in 'garden shed' is shed. The word 'garden' is really acting as an adjective and telling what kind of shed it is. So, the plural would be 'garden sheds', not 'gardens sheds'. Likewise, in your example, the plural of 'item value' would be 'item values'. It is a value, not an item.
The principal word isn't always the last one - for example, the plural of 'brother in law' would be 'brothers in law'.
There are some exceptions, for example "children's clothes", in the context of naming a department at a store. Both words are plural, but there would be no singular equivalent for this context.


text:
Q: Best way to get objects from another microservice and mapping that on field I have 2 applications based on spring-boot framework. I need to map an object by id from another microservice to the field. My pojo class:
@Entity
@Table(name = "sample_object")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Data
@NoArgsConstructor
@EqualsAndHashCode(exclude = "id")
public class SampleObject {

    @Id
    @Column(name = "ID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Column(name = "SAMPLE_FIELD")
    private String sampleField;

    /**
     * ID to get large object from another microservice
     */
    @Column(name = "LARGE_OBJECT_ID")
    private String largeObjectId;

    /**
     * That object i will get from another microservice
     */
    @Transient
    private LargeObject objectFromAnotherService;
}

I don't want to get it through the rest requests, because I have around 60.000+ objects, and sending that much requests, I think, is not a good idea. So, my question is: what is the fastest way to get and map an object to my entity? It would've been great if this mapping could occur simultaneously with the process of object creating.

A: You can have a copy of this entity in your database and take care to maintain it synchronized (if necessary¹) with the another micro service.
So, you need to create a new entity with the same fields, making a relationship with SampleObject that makes more sense to the SampleObject entity. Like:
@ManyToOne
private LargeObject objectFromAnotherService;

The largeObjectId could be moved to this new entity. So, before create the SampleObject entity, you make a request to the another microservice to get the LargeObject data and create the SampleObject and LargeObject entities.
Another alternative is map all the fields from LargeObject directly to SampleObject, without create a exclusive class for that. I don't know the context of your problem, but this approach makes sense in a lot of scenarios.
But be careful with this scenario: if these two microservices need so much each other, maybe they need to be together and not separated.
¹. This is called eventual consistency. As the question not mentioned if is necessary or not, I'm just letting this footnote as reference


text:
Q: ¿Como capturar los usuarios relacionados a una tabla una vez? como puedo hacer para seleccionar todos los usuarios que esten relacionados a una tabla, se que se puede usar un join pero el problema es que por cada entrada con el id del usuario se repetira varias veces el nombre.
Para poner en contexto tengo una tabla trabajos y otra tabla users, la cosa es que en la tabla trabajos enlazo un usuario y un trabajo, posteriormente hago un foreach para que mande un email con cada trabajo al usuario de ese email, el problema es que no todos los usuarios tienen trabajos, lo que genera errores y evita que mande el resto de correo a los demas usuarios, entonces quisiera saber como puedo hacer para capturar a todos los usuarios que solo tengan un registro en la tabla.
En este momento mi consulta esta asi:
$systems = User::where('codarea','>',0)
     ->get();

Pero esto me devuelve:
1 usuario usuario@gmail.com
2 usuariodos usuariodos@gmail.com
3 usuariotres usuariotres@gmail.com

Donde como el usuariodos no tiene trabajos asignados y me aparece el error  Trying to get property 'email' of non-object.
Ahora uso:
$systems = User::where('codarea','>',0)
         ->join('patrabajo', 'patrabajo.usuario', '=', 'users.id')
         ->get();

Y ahora no tengo errores, pero sucede que:
1 usuario usuario@gmail.com
3 usuariotres usuariotres@gmail.com
3 usuariotres usuariotres@gmail.com
3 usuariotres usuariotres@gmail.com
1 usuario usuario@gmail.com

Provocando que mande 3 emails al usuariotres y dos emails al usuario. Que puedo hacer? espero puedan ayudarme.

A: Si solo estás obteniendo estás 2 columnas, entonces puedes:

*

*Indicarlo de forma explícita en el SELECT

*Hacer un agrupamiento para que renglones con valores iguales se fusionen

Consulta:
$systems = User::select('columna1', 'columna2')
         ->join('patrabajo', 'patrabajo.usuario', '=', 'users.id')
         ->where('codarea','>',0)
         ->groupBy('columna1', 'columna2')
         ->get();


text:
Q: Getting Select box value in Angular - without using ng-options? I'm trying to modify a form which is using a select box that is populate NOT using ng-options.
The form itself is bound to an angular controller. Is there still a way for me to know the selected value of the select box even though the select values were not build using ng-options?
I have the following
<select ng-model="country" ng-change="checkValue()"

but the checkValue function isn't even firing, apparently.
Any thoughts?

A: You don't need to use ng-options to get the selected value. As long as your select element uses ng-model the value will be stored there.
For example:
<select ng-model="mySelectValue">
  <option value="1">Option 1</option>
  <option value="2">Option 2</option>
  <option value="3">Option 3</option>
  <option value="4">Option 4</option>
</select>

Now in your controller you would be able to access the value of the select using $scope.mySelectValue.

A: You should always '.' your scope variables.
$scope.address =  {};

Then bind to
ng-model="address.country"


text:
Q: How to map AspNetUser table id as foreign key to another table public class UserInfo
{
  public int id {get;set;} //Primary key

  public string UserId {get; set;} // Foreign key to AspNetUser - Id

  public string FirstName {get;set;}
  public string LastName {get;set;}
  ......
  ......
}

How can I extend the AspNetUser table in the above fashion in EF6 code first approach?

A: Perhaps, the ForeignKey attribute this will help you:
public string UserId {get; set;}

[ForeignKey("UserId")]
public AspNetUser User {get; set;}


text:
Q: PyQGIS: make memory layer permanent I am working with QGIS 3.4 and I have written the next code in the Python editor. This aims to create a layer without geometry and save it as CSV file. This works fine but my problem concerns the two last lines: The layer displayed to the layer panel are not permanent despite the CSV file.
from qgis.core import *
from qgis.gui import *
from qgis.PyQt.QtCore import *

root = QgsProject.instance().layerTreeRoot()

# create memory layer
layer = QgsVectorLayer("Point", "tp2", "memory")
pr = layer.dataProvider()

# Enter editing mode
layer.startEditing()

# add fields
pr.addAttributes( [ QgsField("name", QVariant.String),
                QgsField("age",  QVariant.Int),
                QgsField("size", QVariant.Double) ] )

# Commit changes
layer.commitChanges()

# add a feature
feat = QgsFeature(layer.fields())
#feat.setGeometry( QgsGeometry.fromPointXY(QgsPointXY(10,10)))

feat.setAttribute('name', 'john')
feat.setAttribute('age', 10)
feat.setAttribute('size', 180)

pr.addFeatures( [ feat ] )

# Commit changes
layer.commitChanges()

# get absolute file path
projectPath = QDir(QgsProject.instance().absolutePath())
file =  QFileInfo(projectPath,"output.csv")

error = QgsVectorFileWriter.writeAsVectorFormat( layer,file.absoluteFilePath(), "utf-8",driverName="CSV")

if error[0] == QgsVectorFileWriter.NoError:
    print("success! writing new memory layer")
else:
    print("faillure! writing new memory layer,", error)

QgsProject.instance().addMapLayer(layer,False)
root.addChildNode(QgsLayerTreeLayer(layer))

Edit: erratum in the code

A: The following script exports your csv if successful and adds it to your QGIS project.
The point layer'tp2' is therefore not added. Replace your if block with mine and delete your last 2 lines.
if error[0] == QgsVectorFileWriter.NoError:
    print("success! writing new memory layer")
    uri = "file:///"+file.absoluteFilePath()+"?delimiter=%s" % (",") # path and delimiter of my csv
    layer_csv = QgsVectorLayer(uri, 'output_csv', 'delimitedtext') # Parameters of my csv
    QgsProject.instance().addMapLayer(layer_csv) # Add the csv

else:
    print("faillure! writing new memory layer,", error)

Tell me if this is the result you were expecting.

A: your last two lines of your script are just adding your in memory layer again. If you want to add the saved out csv, take a look at this post Using non-spatial csv with PyQGIS?


text:
Q: Security concerns of a slim restful api I am following this slim tutorial:
https://www.shift8web.ca/blog/2015/04/use-php-to-set-up-a-restful-api-with-simple-authentication/
I just want to get data from a database for a java app. Are there any obvious security issues with the approach put forward in the tutorial? If so, how would you go about stopping sql injection and DDos attacks?

A: Authentication
There is basically nothing wrong with the authentication approach in that tutorial many system work just as simple as that.
But if your app is running on many diffrent java clients, I would generate an access token for every device individually.
If you want a perfect implementation follow the OAuth2. But in most cases this will be an overkill. (Correct me if im wrong..)
SQL Injection
Well in the examples of the tutorial there are no parameters given to the SQL query string so there is no SQL Injection.
If stuff is getting more complex I would absolutely not recommend to work with that suspicious lib/mysql.php class.
If you don't want to implement a library to work with your database go with plain PDO.
There you can use prepared statements to prevent SQL Injection:
$statement = $connection->prepare("select * from `users` where age = :age");
$statement->bindParam(':age', '42');

If you are of the lazy kind you can also make use of a query builder (like Hydrahon or Pixie) which will take care of the the prepared statements itself.
$q->select('users')->where('age', 42)

DDos attacks
In case you are really afraid of DDos attacks there are many solutions.
If you have really heavy queries you can implement a simple rate limiter with PHP itself.
You could also use a service like Cloudflare which will automatically block attacks.
If you rely on a in house solution buy a firewall that supports a rate limit or use a varnish proxy for example.


text:
Q: Использование репозитория как директорию проекта на "боевом" сервере Имеем такую ситуацию: веб проект в гит репозиторий. Добавление новых фишек происходит в ветке dev. Текущий рабочий релиз находится в ветке main.
Хочется реализовать следующую идею. Подскажите, насколько она хороша и стоит ли воспользоваться ею. Возможно существует вариант лучше этого?
Текущее состояния репозитория в ветке dev находится на поддомене dev.domain.com. При совместной работе постоянно делаем туда комиты, что-то правим, откатываем, изменяем и т.д. Когда хотим показать клиенту результат работы, делаем git pull внутри нашего поддомена на dev.domain.com, и показываем ему результат. Если все ОК, то мержим эту ветку в main, после чего пулим ее с domain.com, тем самым выпустив релизную версию продукта.


text:
Q: Is it possible to have a single .resx file in a .NET Core project? The only documentation I can find regarding localization in .NET Core only covers the case with one .resx file per class/view. Is there no way to have a single .resx with all string resources in it? At least one per project.
For example, I'm using AddDataAnnotationsLocalization to get localization of validation errors. If I have a ViewModel A that inherits some base properties from another ViewModel B, I will need two resx files A.resx and B.resx where both of them will have the strings from B defined.
It would help me a lot if it was possible to just put all strings in a single file.


text:
Q: Javascript canvas one shadow with different strokeStyle I want to have one shadow for a large number of dots that over lap with different strokeStyles. I don't want to see the shadow on top of the other dots. So is there a way to have different strokeStyles for one path, or is there a way to apply one shadow to multiple paths?
JSFiddle

     var ctx = document.getElementById('canvas').getContext('2d');
     ctx.shadowColor = "black";
     ctx.shadowBlur = 10;
     ctx.lineWidth = 30;
     ctx.lineCap = 'round';

      //This is how I want the shadow to appear
     ctx.beginPath();
     ctx.moveTo(50, 50);
     ctx.lineTo(50, 50);
     ctx.moveTo(70, 50);
     ctx.lineTo(70, 50);
     ctx.strokeStyle = 'red';
     ctx.stroke();

      //But I want to have different strokeStyle.
      //And I don't want the shadow on top the other dot
     ctx.beginPath();
     ctx.moveTo(50, 100);
     ctx.lineTo(50, 100);
     ctx.strokeStyle = 'red';
     ctx.stroke();

     ctx.beginPath();
     ctx.moveTo(70, 100);
     ctx.lineTo(70, 100);
     ctx.strokeStyle = 'white';
     ctx.stroke();
<canvas id="canvas" width="150" height="150"></canvas>


text:
Q: Copy specific cell to a specific column Cell E8 and E6 are dependent dropdown lists and they are working.

*

*If I select Tool in cell E8, than cell E6 gives a list of all the tools.

*If I select Equipment in cell E8, than cell E6 gives me all the equipment.

The range of this dependent dropdown list comes from columns K to M.

Now I want to add automatically more names do my dependent dropdown list.

*

*If E8 = "Tool" then copy the name that is in cell E6 to last row of column "L"

*If E8 = "Equipment" then copy the name that is in cell E6 to last row of column "K"

*Same with if E8 = "Car"

A: Private Sub Move()
Dim row, column As Integer
Dim ws As Worksheet
Set ws = ActiveSheet

'Determine Column
Select Case ws.Cells(8, 5).Value

    Case "Equipment"
        column = 11
    Case "Tool"
        column = 12
    Case "Car"
        column = 13

End Select

If column = 0 Then
    Exit Sub
End If

'Determine row
row = ws.Cells(Rows.Count, column).End(xlUp).row + 1

'Put value in cell
ws.Cells(row, column).Value = ws.Cells(6, 5).Value

End Sub


text:
Q: React Native show vertically overflowing items in a horizontal ScrollView When I have a simple View with another View inside it that has a higher height, it looks like this:
<View horizontal={true} style={{height: 100, width: 100, backgroundColor: "red"}}>
    <View style={{height: 150, width: 50, backgroundColor: "blue"}}></View>
</View>

In other words, I can see the 50px of the blue View that overflow the red one.
When I change the parent View into a horizontal ScrollView however, the overflowing 50px of the blue one are clipped, like this:
<ScrollView horizontal={true} contentContainerStyle={{height: 100, width: 100, backgroundColor: "red"}}>
    <View style={{height: 150, width: 50, backgroundColor: "blue"}}></View>
</ScrollView>

I want the ScrollView to not clip the overflowing blue part of its child. How do I do this?
I already tried adding overflow: "visible" to the styles, but that didn't work.


text:
Q: Using ASM for bytecode analysis I am evaluating the possibility of using ASM as framework for implementing some bytecode analysis. So far I have been playing with a few examples but there are a couple of things that I need to sort out:
1) I don't see how I can detect a method fully signature with the MethodVisitor class (full argument type names and formal names).
2) In case the .class file being analysed has the java source associated, how to link bytecode instructions with the line numbers in the source
3) How to differentiate between instance fields and static fields in a ClassVisitor

A:
1) I don't see how I can detect a method fully signature with the MethodVisitor class (full argument type names and formal names).

You can't. The ClassVisitor receives a call like
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)

and before you return the MethodVistor, you need to capture the information from the parameters you are interested in.
If the code was compiled with debugging information, you can obtain the parameter and local variable names with visitLocalVariable

2) In case the .class file being analysed has the java source associated, how to link bytecode instructions with the line numbers in the source

The code in the method will have source information "instruction" in the form of a visitLabel

3) How to differentiate between instance fields and static fields in a ClassVisitor

By the access modifier. Use Modifier.isStatic(access)

A: 1) Actually I manage to extract detailed method signature (arguments types and names and return type) as part of a MethodVisitor implementation. Remark: this only works if the class file was compiled including debug info.
@Override
public MethodVisitor visitMethod(int access, String name,
        String desc, String signature, String[] exceptions) {

    try {
        final LinkedList<String> parameters;
        final boolean isStaticMethod;

        Type[] args = Type.getArgumentTypes(desc);
        Type ret = Type.getReturnType(desc);

        parameters = new LinkedList<String>();
        isStaticMethod = Modifier.isStatic(access);

        return new MethodVisitor(Opcodes.ASM5) {
            // assume static method until we get a first parameter name
            public void visitLocalVariable(String name, String description, String signature, Label start, Label end, int index) {
                if (isStaticMethod && parameters.size() < args.length) {
                    parameters.add(args[index].getClassName()+" " +name);
                } else if (index > 0 && parameters.size() < args.length) {
                    // for non-static the 0th arg is "this" so we need to offset by -1
                    parameters.add(args[index-1].getClassName() +" " +name);
                }
            }

            @Override
            public void visitEnd() {
                 System.out.println("Method: "+ret.getClassName()+" "+name+"("+String.join(", ", parameters)+")");
                super.visitEnd();
            }
        };
    } catch (Exception e) {
        throw e;
    }

Which will produce the following output for an standard main:

Method: void main(java.lang.String[] args)

2) The arguments Label start and Label end include information about the corresponding source as long as there is a source included when the compilation took place.
3) See @Peter Lawrey reply.


text:
Q: After upgrade to Ubuntu 12.04 from 11.10 screen hangs quite often I have recently upgraded from 11.10 to 12.04, I am experiencing a lot of problems ,the screen hangs quite a few times the cursor is moving  but nothing  seems to happen all what is possible is a forced shutdown. Also some of the 11.10 themes are not applying correctly  eg: orta oron ..etc
Please help me out on this ,or how can i upgrade it back to 11.10???


text:
Q: Steps in defining $\mathscr O_{Spec R}$ I'm trying to understand the definition of $\mathscr O_{Spec R}$ from a larger perspective. Here's what steps I was told about (I might be misinterpreting something). I'll write $\mathscr F$ for $\mathscr O_{Spec R}$.
(1) Define the presheaf on the base by $F(D(f))=R_f$
(2) Prove that this is a sheaf
(3) Define the stalks  by $F_P=R_P$
(4) For an open set $U$, define $\mathscr F(U)=\{(s_P\in R_P)_{P\in U}: s_P \text{ are compatible}\}$ (in our case, compatible means $\forall P\in U\ \exists f\in R\text{ s.t. } P\in D(f)\subset U \ \text{ and } \exists\ a/f^n\in \mathscr F(D(f))=R_f \text{ with } s_Q=(a/f^n)_Q \text{ for all } Q\in D(f)$)
(5) Prove that $\mathscr F(U)$ is isomorphic to $F(U)$
Here are my questions:

*

*Regarding (3), Vakil's Theorem 2.5.1 says that $F_P$ should be $colim F(D(f))$, if I understand correctly. So is it the case that $colim F(D(f))=R_P$? If so, what is the definition of the colimit map $R_f\to R_P$? If $P\in D(f)$, then $f\notin P$ and I guess this map can be defined as $a/f^n\mapsto a/f^n$, but do we know that $P\in D(f)$? This confusion may be coming from not fully understanding the notation $colim F(D(f))$ -- it is the colimit of which diagram $E:I\to \text{Ring}$? What is $I$?
Update: Is it true that $I$ depends on $P$, and $I=I_P$ contains (as objects) elements $f\in R$ such that $f\notin P$? And the coprojection maps are, I suppose the maps described here?

* (Continuation of the above question.) Suppose $D(f_j)\subset D(f_i)$. What is the map $R_{f_i}=F(D(f_i))\to F(D(f_j))=R_{f_j}$? My naive guess would be $a/(f_i)^n\mapsto a/(f_j)^n$, but how is the fact $D(f_j)\subset D(f_i)$ used? Vakil says that $F(D(f_j))$ is a further localization of $F(D(f_i))$, but I'm not sure if I understand this -- these rings, by definition are $R_{f_j}$ and $R_{f_i}$, and we only know that if $f_j\notin P$, then $f_i\notin P$, I don't see how this makes $F(D(f_j))$ a further localization of $F(D(f_i))$ (there's no reference to $P$ in, say, $F(D(f_j))=R_{f_j}$). This question is answered here (although I still don't understand why it is a "further" localization).

*Is (5) just a particular case of Vakil's theorem 2.5.1? For any sheaf on the base $F$, $\mathscr F(U)$ is isomorphic to $ F(U)$. (Also I suppose the fact that our $\mathscr F$ is a sheaf is a consequence of the same theorem.)

A: For your first question, I think it is easier to understand it using the concrete description of filtered colimits given in Vakil's exercise 1.4.C.
The diagram does depend on $P$. To make the connection, we treat the presheaf on a base $F$ as a contravariant functor $D \to \operatorname{Ring}$, where $D$ is the category of distinguished open sets containing $P$ (with morphisms given by inclusion). The induced functor $D^{\text{Op}} \to \text{Ring}$ will be our diagram in Ring.
We note that $D^{\text{Op}}$ is filtered. After all, if $U_1$ and $U_2$ are open sets containing $P$, then $U_1 \cap U_2 \subseteq U_1$ and $U_1 \cap U_2 \subseteq U_2$ so that there are 'morphisms' $U_1 \to U_1 \cap U_2$ and $U_2 \to U_1 \cap U_2$. The second condition follows similarly.
As such, we can consider $F_P$ as ordered pairs $[D(f), s]$ for distinguished neighborhood $P \in D(f)$ and $s \in F(D(f)).= R_f$ under the equivalence relation $[D(f), s] \sim [D(g), t]$ if there is some neighborhood $D(h) \subseteq D(f) \cap D(g)$ of $P$ where $s|_{D(h)} = t|_{D(h)}$.
With this description, we define a surjective homomorphism $F_P \to R_P$ given by $[D(f), s] \mapsto s$. This makes sense since $f \notin P $ by the definition of $D(f)$ and the fact that $s \in R_f$.
To show that this is an isomorphism, suppose $[D(f), s] \mapsto 0$. Then $s = t/f^n \in R_f$ is $0$ in $R_P$. Since $t/f^n = 0/1$ in $R_P$, there is a $g \notin P$ so that $$g(f^n * 0 - t * 1) = - gt = 0.$$ We then claim that $s|_{D(fg)} = \frac{tg^n}{(fg)^n} = 0$ in $F(D(fg)) = R_{fg}$. This follows from the above equation by multiplying each side by $g^{n - 1}$ to obtain $$(fg)^n * 0 - (tg^n) * 1 = - g^{n - 1}(gt) = 0.$$
This proves that $F_P \cong R_P$.
For your last question, I think the rest does indeed follow from the theorem 2.5.1 cited, and the fact that $\mathscr{F}_P \cong F_P$ follows quickly from the definition of a base.


text:
Q: how to get the source page which request other page in JSP I have a form
<form name=frmMain method="POST"  action="processUpload.jsp" enctype="multipart/form-data">

 Upload you excel file

 File:

 <input type="file" name="excelfile" size="40" >

                <input type="submit" name="process" value="Process">

            </form>

I submit this form to prcessUpload.jsp
in processUpload.jsp I do upload file, when upload file is finished, I want to redirect to source page which contains the form.
Problem: I want to make this processUpload.jsp generic, means I will reuse it in other web application. whatever page make a request to this jsp page, I will have the exact name of the source page.
any suggestions or solutions. Thanks in advance.
NathanPhan

A: I would add a hidden argument to the URL in the form that tells the uploadFile.jsp where to go back to when it is done.  You'd need to add a button or some javascript to the uploadFile page to make this happen at the appropriate time.
Another option would be for the JSP to pick up the redirect location from some a server-side configuration file; e.g. via the servlet context parameters.


text:
Q: How does an addressable LED in a strip work? Take an addressable LED strip (e.g. with chipset WS2801) that you might control with an Arduino. I understand that there are clock and data lines, and the data propagates through shift registers on each LED, extracting the information for that pixel (RGB).
I'd like to know more detail. How do the RGB values passed through the data line influence the intensity of the diodes? What logic is involved in doing this? Is it based on PWM or continuously changing the voltage of the diodes? I can't find a schematic.

A: You can see exactly how the WS2801 chip works by looking at the data sheet.
It shows that you serial data line and the clock to shift in an 8 bit value for red, for green, and for blue.  Then the chip generates a PWM pulse whose width is controlled by the 8-bit value.  And the chip outputs the PWM pulses to the Red LED, the Green LED, and the Blue LED.  Furthermore, it measures the amount of current through each LED and adjusts it based on the external feedback resistor (one each for Red, Green and Blue).

Datasheet: https://cdn-shop.adafruit.com/datasheets/WS2801.pdf

A: While your question stated the WS2801 I suspect you mean the WS2812, that is the part most commonly used in a addressable LED strip.
The WS2801 is an LED controller requiring external LEDs, the WS2812 is an LED and controller in one. Either way the two parts are very similar however they do use a different electrical connection for the data link.
The datasheet for the WS2812 can be found here (the data on the WS2801 is also on that site in the LED driver IC section).
These parts have a very simple 1 wire interface that allows them to be chained together:

It's not quire like a shift register, that would imply that the first data out from the processor was for the furthest LED in the chain. It's the exact opposite, the first data is for the nearest LED.
The first LED reads the first 24 bits of data (8 bits of Green then Red then Blue) on the Din line while keeping its Dout line idle and uses that data to set up PWM drivers for it's 3 internal LEDs. After 24 bits of data have been received the device goes into pass-through mode, any further data is sent onto the Dout pin without having any internal affect.
If the data line goes idle for over a fixed length of time then the device exits the pass-through mode and will read the next set of data it receives and update the internal PWM rates appropriately.
This system means that a theoretically unlimited number of LEDs can be chained together as long as the driver is able to keep spitting the data out without too long a pause (and you have a large enough power supply). However the maximum refresh rate possible drops as the chain gets longer.
The system  works very well if you want to refresh all the LEDs at once. It does not however allow you to change a single LED without changing any others (except the first one). e.g. If you only want to only update LED3 in a chain then as a minimum you must send the data for LED1, LED2 and LED3.

A: Generally speaking, any digital led controller works by taking a digital input in a fixed format, generally n bits for the Red channel,  n bits for G, then B, where n is the precision/steps of its PWM (typically bits 128 or 8 bits 255), possibly some value for all on/off or dot correction, and then uses a PWM timer to pulse the output at those values. Then it passes excess data to the next, if it's a shift register type IC.
The WS2801 isn't really addressable, as data is passed on in a dumb way.

A: The LEDs in a addressable strip will each be controlled by some sort of drive circuitry. There are a couple of standard methods for implementing this. The simplest method uses a pair of wires and timed sequences. Each LED driver chip has a decent amount of logic. This consists mainly of some timers, counters, and a shift register. The shift register is connected between the data input pin and data output pin. The counters are used to generate PWM signals to drive the LEDs. The state machine controls everything, commanding the shift register to shift data through and on to the next chip at the appropriate time and also to load the new data into the PWM registers once the entire string has been loaded with new data. Since the shift registers are connected end to end, the sequence in which the data is transferred down the string determines which drive chip it ends up in.


text:
Q: Changing the theme color value from user input on button click using ThemeProvider I would like to understand whether it is possible to change the theme value using ThemeProvider by getting an input from the user and managing state.
I have the app that is wrapped in a ThemeProvider to manage the theme.
import styled from 'styled-components'
import { ThemeProvider } from 'styled-components'
import appTheme from './theme'

function App(props, theme) {
  // const themeContext = useContext(ThemeContext)

  const [themePrimary, setThemePrimary] = useState(appTheme.primary)

  function changePrimaryColor(props) {
    setThemePrimary(props)
    appTheme.primary = props
  }

...

return (
    <ThemeProvider theme={theme}>
      <Router>
        <Switch>
          <Route
            path="/"
            exact
            render={({ match }) => {
              return (
                <Frame id="app-frame">
                  <AppHeader match={match} />

Home

                </Frame>
              )
            }}
          />
...

In the settings view the user must be able to enter a color value.
const ColorTest = styled.input`
  background: ${props => theme.primary};
  border: none;
  margin-left: 50px;
`

...
  const colorInputValue = useRef(null)

  const handleColorSubmit = (e) => {
    e.preventDefault()
  }

  const handleClick = () => {
    const color = colorInputValue.current.value
    props.changePrimaryColor(color)
    console.log(color)
  }

...

<PageSection>
    <Form onSubmit={handleColorSubmit}>

Change primary color

      <ColorInput placeholder="hex or string" ref={colorInputValue} />
      <SubmitFormBtn type="submit" onClick={handleClick}>Change</SubmitFormBtn>
      <ColorTest disabled></ColorTest>
    </Form>
</PageSection>

(The ColorTest component here is for testing purposes. It actually shows me that all the data is being passed correctly and the color changes.)
Here is my "theme"
const theme = {
  primary: '#0068B6',
  secondary: '',
  text_color: '#555',
  text_light: '#fff',
  border: '#e3e3e3',
  drop_shadow: '3px 3px 3px rgba(0, 0, 0, 0.3)',
  background: '#fff',
  background_secondary: '#f5f5f5',
}

export default theme

That new value must change the color value of the primary color and trigger the app component to re-render. How do I make that happen without using local storage or database, but just state?

A: You can try something like the following. You can now pass down the updateTheme function to other child components.
I'd potentially take the defaultTheme out of the component and pass it in as a prop (not an imported file). This would mean you could reuse the App component with several different default themes.
import React, { useState } from 'react';
import styled from 'styled-components';
import { ThemeProvider } from 'styled-components';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; // Not sure if this is your import

export default function App({
  defaultTheme={
    primary: '#0068B6',
    secondary: '',
    text_color: '#555',
    text_light: '#fff',
    border: '#e3e3e3',
    drop_shadow: '3px 3px 3px rgba(0, 0, 0, 0.3)',
    background: '#fff',
    background_secondary: '#f5f5f5',
  },
}) {
  const [theme, setTheme] = useState(defaultTheme);

  // update here is an object, e.g., { primary: '#333' }
  const updateTheme = (update) => {
    return setTheme({ ...theme, ...update });
  };

  const paint = () => {
    // If you're using something to generate the theme, you can put it here instead. For example () => createMuiTheme(theme).
    return React.useMemo(() => ({ ...theme }), [theme]);
  };

  return (
    <ThemeProvider theme={paint()}>
      <Router>
       <Switch>
         <Route
           exact
           path='/'
           render={() => <View theme={theme} updateTheme={updateTheme} />}
         />
       </Switch>
      </Router>
    </ThemeProvider>
  );
};

// Or use your hooks to get the theme
export default function View({ updateTheme, theme }) {
  return (
    <>

      <button
        onClick={() => updateTheme({ primary: '#333' })}
      >
        Change primary
      </button>
    </>

   );
};


text:
Q: How to skip a tag when using Beautifulsoup find_all? I want to edit an HTML document and parse some text using Beautifulsoup. I'm interested in <span> tags but the ones that are NOT inside a <table> element. I want to skip all tables when finding the <span> elements.
I've tried to find all <span> elements first and then filter out the ones that have <table> in any parent level. Here is the code. But this is too slow.
for tag in soup.find_all('span'):
    ancestor_tables = [x for x in tag.find_all_previous(name='table')]
    if len(ancestor_tables) > 0:
        continue

    text = tag.text

Is there a more efficient alternative? Is it possible to 'hide' / skip tags while searching for <span> in find_all method?

A: The way I would approach this would be to simply remove all tables from the html before doing my find_all on span.
Here is a thread I found on removing tables.  I like the accepted answer because .extract() gives you the opportunity to capture the removed tables, though .decompose() would be better if you don't care about anything in the tables.
Here is the code from this answer:

for table in soup.find_all("table"):
    table.extract()

A: You can use .find_parent():
for tag in soup.find_all("span"):
    if tag.find_parent("table"):
        continue
    # we are not inside <table>
    # ...


text:
Q: Uniswap swapRouter02 Error: Transaction reverted without a reason string I'm testing uniswap's swap transaction
my new contract swap() -> uniswap swapRouter02 contract exactInputSingle() which is not from wallet to contract swap
Specifically below code is trying swap my contract's 0.08 WETH to some UNI. and I checked my contract has 0.08 weth.
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 => WETH token address
0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984 => UNI  token address
0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 => Uniswap SwapRouter02 contract address

but error message when try
ISwapRouter02(0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45).exactInputSingle(params);

Error: Transaction reverted without a reason string at ~~

what does this message mean? and how can I debug this error?
My test environment is hardhat local forking mainnet. The error message is from hardhat forking mainnet
hardhat: {
  chainId: 31337,
  forking: {
    url: `https://mainnet.infura.io/v3/${INFURA_API_KEY}`,
    blockNumber: 14390000
  },
},

function swap() external payable override lock returns (uint256) {
    //approve
   address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2).call(abi.encodeWithSelector(IERC20.approve.selector, 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45, 0x011C37937E080000));

    //test
    uint256 amountOut;
    ISwapRouter02.ExactInputSingleParams memory params =
        IV3SwapRouter.ExactInputSingleParams({
            tokenIn: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2,
            tokenOut: 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984,
            fee: 0,
            recipient: msg.sender,
            //deadline: _params.deadline,
            amountIn: 0x011C37937E080000,   //0.08
            amountOutMinimum: 0x0,
            sqrtPriceLimitX96: 0
        });

    ISwapRouter02(0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45).exactInputSingle(params);

    return 1;
}

Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="Error: Transaction reverted without a reason string", method="estimateGas", transaction={"from":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","to":"0xd5a946A0C214d732a8cf5678be593d26E1bf2170","data":"0x50ac1dd900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb9226600000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000001c6bf526340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000021231000000000000000000000000000000000000000000000000000000000000","accessList":null}, error={"name":"ProviderError","code":-32603,"_isProviderError":true,"data":{"message":"Error: Transaction reverted without a reason string","data":"0x"}}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.6.8)

A: I found my fault,
reason was amountOutMinimum value must be not 0x0


text:
Q: Converting BINARY data to its equivalent BLOB (Text) value in Hive We have BLOB (text) data stored in Hive as Binary .Now this needs to consumed as its equivalent text value at the SRSS server sql server reporting services.
Is there any specific function available for the above scenario?
BASE64( column)

select BASE64(column) from hive_table;

A: Function decode(binary bin, string charset) Decodes the first argument into a String using the provided character set (one of 'US-ASCII', 'ISO-8859-1', 'UTF-8', 'UTF-16BE', 'UTF-16LE', 'UTF-16'). If either argument is null, the result will also be null. (As of Hive 0.12.0.)
All Hive String Functions


text:
Q: What is a JTAG? I'm pretty new to embedded systems, and I keep seeing this term used all the time, but I can't quite understand what is it. A quick search online yields this Wikipedia page: https://en.wikipedia.org/wiki/Joint_Test_Action_Group which describe it as some-kind of protocol for debugging. But in other contexts it used like it's able to program a chip's memory like a programmer. What is it?

A: JTAG is somewhat an odd term. To begin, the term can specify a specific connector and protocol, composed of a clock signal (TCK), mode-select (TMS), and data in/out (TDI/TDO). This comprises a network of devices, where each device's TDO is connected to the next device's TDI in a so-called scan chain. TMS is used to put all devices simultaneously into various modes.
The devices on the scan chain are typically connected as one large shift register comprised of registers in each individual device. When devices are in the SHIFT_IR or SHIFT_DR state, they connect to the scan chain one of two temporary registers: An instruction register, and a data register.
Once a value is shifted in, the UPDATE_IR or UPDATE_DR mode can be activated by setting TMS appropriately while toggling TCK. At this point, the value shifted into the register "takes effect". For example, shifting various sequences into the IR of an FPGA and transitioning into UPDATE_IR will cause the FPGA to enter various modes such as configuration, readback, normal runtime, or access specific user registers and JTAG-specific primitives instantiated in the design.
Likewise, capture states can be used to "read" a value from the device and put it into the IR or DR, to be shifted out through TDO and ultimately read by the JTAG programmer.

A: JTAG defines a serial protocol, and some commands, to allow access to internal registers within complex ICs. This allows a tester to get observability and controllability in a standard way using few pins.
The original use was for 'boundary scan', where all the I/O pins could be read and driven by a large shift register that circles the chip. However, it was quickly augmented to add further shift registers to access the internals of the chip, including memories.
You rarely bit-bang JTAG, access is usually through libraries, aka drivers, supplied by the IC manufacturer, and used by the test system and test access adapter.

A: There is what JTAG 'means' and there is what JTAG 'is'.  As others have pointed out JTAG 'is' a industry standard bus interface for manufacturing testing, as in Joint Test Action Group.
What JTAG 'means' to an embedded software developer is the debug interface on the SoC/microprocessor for external debug of embedded software running on the chip. Nearly every CPU/SoC on the market uses the JTAG interface not only for manufacturing tests, but for software debug support. You will find a JTAG interface on everything from server class x86 CPUs to under $50 home WiFi routers. With the right interface hardware, and the right software, these interfaces will grant you the ability to read/write memory, set breakpoints, and single-step code.
The key of course is getting the right hardware and software. Even though the basic JTAG interface is standardized, the specific software debug facilities available in a device may not be. JTAG is like TCP/IP. It exists in the middle of the application stack. You need the right physical layer to communicate with the equipment (i.e. what do you mean this thing uses 10-Base-2?!?!?), and you need the right application software above it (what do you mean I need a Gopher client?!?!?!). However the strength of the ARM ecosystem has lead some degree of standardization there (see OpenOCD).
You also asked about using JTAG to program flash. Yes, some software uses it for that purpose as well. The SoC may provide JTAG facilities to read/write from CPU memory address spaces, it may provide direct access to flash controllers, and at a minimum JTAG provides raw low-level access to I/O pins on the edge of the chip (this was the original purpose of JTAG, to enable continuity testing of chip to chip interconnections during manufacturing test, i.e. 'JTAG boundary scan'). Any of these facilities could be use by clever programmers to drive the signals necessary to reprogram a flash chip in case a device is accidentally 'bricked'.

A: It is like USB, SPI, I2C, and other "busses", and it has a number of popular uses, not limited to:

*

*One in particular is in testing of silicon before too much is invested in each part, for example while a chip is still on the wafer you can check most of the part.  Granted dicing the wafer can do damage so you want to test again but maybe you do that before packing, maybe after.

*You can use it to do boundary scan on boards.  You can take a board on a production line (granted the board has to be designed right and some percentage of the chips have to support this) but you can do low speed connectivity tests, stimulate the pin on one end of a trace and scan other parts to see that they are or are not connected per the design of the board.

*Since the chips already have these dedicated pins why not, for processors, use that same interface as a way to talk to an on chip debugger (OCD), design something into the processor and allow that to be talked to via jtag.
It is a generic-ish way to allow you to isolate things on the chain you want to send a series of bits to or get a series of bits from, in a way that each thing you want to talk to can be designed for various numbers of bits from a small number to a large number.  For a debugger you would naturally have it write to or read from a register-sized thing in your chip - maybe a 16 bit register or 32 bit.  But for silicon or board testing your scan chain might be dozens of bits.  Each individual thing you address can vary in size, if you want, from any other thing, making this a very versatile bus with a relatively small number of pins that is attractive for these types of use cases.
Perhaps because of the popularity for software debugging they now have some two pin solutions to save on pin count for microcontrollers and perhaps others will adopt that, perhaps not.

A: JTAG was originally an interface used for testing PCBs after assembly. The IO lines on the chips could be controlled and read via the JTAG ports allowing a board test sequence to be performed. Later on it also started to be used as a programming and debug interface. What functionality is available over JTAG will depend on the particular IC you are dealing with.
One advantage of JTAG over most other programming interfaces is that devices can be daisy chained. So one JTAG port can serve to program/debug/test multiple devices (though I would advise designing your systems so that different brands of chip can be split on to different chains, while the low level JTAG protocol is pretty standardised unfortunately the tools you need to program/debug the chips are not).


text:
Q: Need help using os.execute to perform a mysql insert I'm trying to get a lua script to perform a MySQL update.
However, the double quotes used with the -e "" part of the command are confusing lua (and me!).  I've already tried numerous combinations of quotes, such as the ones below:
os.execute(""mysql --host=1.1.1.1 --port=3308 --user=username --password=password db -e "insert into table (RecordDate, RecordMilliseconds, data1, data2, data3) values ('111', '222', '333', '444', '555')""")

stdin:1: ')' expected near 'mysql'

os.execute("mysql --host=1.1.1.1 --port=3308 --user=username --password=password db -e "insert into table (RecordDate, RecordMilliseconds, data1, data2, data3) values ('111', '222', '333', '444', '555')" ")

stdin:1: ')' expected near 'insert'

Any ideas what syntax I can use to allow os.execute work with this mysql command?
Update - OK, I can use Egor's os.execute[[...]] syntax but I now need to be able to substitute those example values '111', '222', etc. with variable names. Of course, when I do this they're getting interpreted literally because of the quotes presumably. For example:
os.execute[[mysql --host=1.1.1.1 --port=3308 --user=username --password=password db -e "insert into table (RecordDate, RecordMilliseconds, data1, data2, data3) values (value1, value2, value3, value4, value5)"]]

which results in an error along the lines of: ERROR 1054 (42S22) at line 1: Unknown column 'my_date' in 'field list'
Hopefully there's some way to reference variable names from within this os.execute[[mysql..."variable"]] structure?  Maybe using |variable| syntax?
Obviously in a regular linux shell, this is relatively easy to achieve...
mysql --host=1.1.1.1 --port=3308 --user=username --password=password db -e "insert into table (RecordDate, data1) values ($my_timestamp, $value1)"

Thanks in advance for any much needed help!

A: Ok - finally got around this issue by using string concatenation:
my_command = 'mysql --host=1.1.1.1 --port=3308 --user=username --password=password db -e "insert into table (RecordDate, RecordMilliseconds, data1, data2, data3) values ('..variable1..','..variable2..',')"  etc.

Then I just use
os.execute(my_command)

Does the job just fine although there may be a more elegant way of doing this.


text:
Q: Finding strong numbers between 1-500? I'm stuck here. This program stops after giving 1 and 2 strong numbers just and doesn't do anything afterwardsoutput
#include <iostream>
using namespace std;

void main()
{
    int fac=1,rem=0,strong_num=0,store=0,loop=1;

    cout<<"The strong numbers in the range 1 - 500 are give below\n";
    while(1<=loop<=500)
    {

        store=loop;
        while(loop>0)
        {
            rem=loop%10;
            while(rem>0)
            {
                fac=fac*rem;
                rem--;
            }
            strong_num=strong_num+fac;
            loop=loop/10;
        }
        loop=store;
        if(strong_num==loop)
        {
            cout<<loop<<endl;
        }
        strong_num=0;
        loop++;
        fac=1;
    }
}

I know i have made a blunder but dont know how to resolve it ?
help me please ?

A: Change your first while loop.
while(1<=loop<=500)

To
while(1<=loop && loop<=500)

Change second while loop.
while(loop>0)
{
    fac=1;  // Add this line here and remove from the end.
    rem=loop%10;
    while(rem>0)
    {
        fac=fac*rem;
        rem--;
    }
    strong_num=strong_num+fac;
    loop=loop/10;
}

As we need to find factorial of every single digit separately. For example for the number 145, we need to find factorial of 1,4 and 5. First after getting the factorial of 5 you need to reset fac variable to 1. which you were not doing and getting problem.
After change I am getting this output.
1
2
145


text:
Q: what is the diff. between "->" and "=>" in php? What are the uses of -> and => in PHP.
I have been trying the same since long time.Please do someone answer with examples.
$data['student_last_name'] = $this->input->post('student_lastname');

A: -> is used to access object property and => is used to assign value to array key.
Example:
$name = $person->name;

$newArray = array(
    "name" => "John"
)


text:
Q: Can't access column pick_country_iso I have this query
SELECT pick_up_id, (select pick_name from pick_up_point where pick_up_point.pick_up_id = s.pick_up_id limit 1) as pick_name, total_boxes, (SUM(r_occupied) + SUM(s_occupied)) AS total_occupied, (total_boxes - (SUM(r_occupied) + SUM(s_occupied))) as free_boxes, round(((SUM(r_occupied) + SUM(s_occupied)) / total_boxes * 100),2) as pct_usage,(select  pick_country_iso from pick_up_point where pick_up_point.pick_up_id = s.pick_up_id limit 1) as pick_country_iso
        FROM(
            SELECT p.r_pick_up_id AS pick_up_id, COUNT(p.parcel_id) AS r_occupied, 0 AS s_occupied,
            (SELECT COUNT(rl.lookup_id) FROM racks r INNER JOIN rack_lookup rl ON rl.rack_type = r.rack_type WHERE r.pick_up_id = p.r_pick_up_id) AS total_boxes
            FROM v_last_parcel_event p
            WHERE p.event_type IN (2,3,6,8,16,18,26,27,101,102,104,105,107,112,122,124,127,151,152,153)
            AND p.box_size <= 3 AND IFNULL(p.overflow_parcel, 0) = 0
            AND p.r_pick_up_id IS NOT NULL
            GROUP BY p.r_pick_up_id

            UNION ALL

            SELECT p.s_pick_up_id AS pick_up_id, 0 AS r_occupied, COUNT(p.parcel_id) AS s_occupied,
            (SELECT COUNT(rl.lookup_id) FROM racks r INNER JOIN rack_lookup rl ON rl.rack_type = r.rack_type WHERE r.pick_up_id = p.s_pick_up_id) AS total_boxes
            FROM v_last_parcel_event p
            WHERE p.event_type IN (2,6,8,12,16,18,26,27,101,102,104,105,107,112,122,124,151,152,153)
            AND p.box_size <= 3 AND IFNULL(p.overflow_parcel, 0) = 0
            AND p.s_pick_up_id IS NOT NULL
            GROUP BY p.s_pick_up_id
        ) as s
        GROUP BY s.pick_up_id;

On above query on first line, i'm getting column pick_country_iso
(select  pick_country_iso from pick_up_point where pick_up_point.pick_up_id = s.pick_up_id limit 1) as pick_country_iso

The result is in following image.

Now i'm trying to add a where clause in the above query at the end
as s WHERE pick_country_iso="ABC"
        GROUP BY s.pick_up_id;

but I'm getting this error #1054 - Unknown column 'pick_country_iso' in 'where clause'.
Thank you for any help.


text:
Q: does = when declaring a variable the same as copy constructor c++? I made class time ,
and declared in main :
time a;
time b=a;

is this the same as :
time b(a);

???
 I also made function :
time f(time t)
{
  return t;
}

and used it in main after declaring a :
time b=f(a);

I printed messages when copy constructor called , the Result was only 2 calls to copy constructor ,one copying a to t, the other is copying t to return , here is my question there was no call to copy constructor to copy the value returned from function to b ?
thanks in advance !

A: The question in your header and the question at the bottom of your post are different.  For the one in your header:

does = when declaring a variable the same as copy constructor c++?

Not exactly.  First the expression on the right side is converted to the type on the left side, and then the copy constructor is called.  This requires an implicit conversion.  If one is not possible, the initialization will not compile.  If the expression on the right side is already the right type, then the first step is not necessary.
For your other question, this is return value optimization.

A: Yes, time b = a is equivalent to time b( a ) because you are declaring the object and assigning its value at the same time.
For the second part of your question, the compiler will in general remove unnecessary object copies where it can, depending on the optimization level.

A: when an object is being created from another object, the copy constructor is called like
time b = a;
   or time b(a);
but when the object is already created and you want to copy items to it, then the operator=
is called
the difference is like when you are using dynamically allocated memory
if you use copy constructor, that means that you are not already created, therefore you don't need any cleanup of your memory management
but when you assign an object to another, first it has to deal with the dynamically allocated elements of its own, like free memory, then copy them to its own

A: no, b=a uses the assignment operator (operator=) to create a new, blank time object and then call the operator to move the values into it (or whatever else you tell operator= to do).
Often you'll find the compiler-generated versions of this will call the copy constructor, but it doesn't have to.
For reference, look up the explicit keyword. As copying an object can be done in 2 ways (copy ctor, and assignment operator), this tells the compiler to only use the copy ctor when explicitly invoked, not implicitly.
Create your class with all the different constructors (including the new c++0x move one) and the assignment operator and look what happens when you run it through the debugger.


text:
Q: What is the difference let o1.prototype = Object.create(o2.prototype) and o1.prototype = o2.prototype? So I'm trying to understand the difference between o1.prototype = Object.create(o2.prototype) and o1.prototype = o2.prototype.
According to the answer to this question, the former sets obj2.prototype to by the prototype for obj1.prototype, but I'm having a hard time grasping why you would want that (the prototype of a new prototype for example is just Object.prototype since the prototype IS an Object without further inheritance). Furthermore, it doesn't seem to quite work the way the answer to that question suggests all the time.
In the following code, for example:
function o1(){}
o1.prototype.test = "test";
function o2(){}
o2.prototype = Object.create(o1.prototype);
let instance1 = Object.create(o1);
console.log(o2.prototype.test, instance1.prototype.test);

both o2.prototype.test and instance1.prototype.test print "test". So it doesn't seem to matter weather you assign the o2 directly to Object.create(o1.prototype) or set the o2's prototype to Object.create(o1.prototype).
Also, if I'm understanding this correctly, according to the answer in the linked question, if o1 is empty (which is it in this case) then setting o2 = o1 would be the same as setting setting o2 = Object.create(o1) which would also be the same as
function o1(){};
function o2(){};
o2.prototype = o1.prototype;

Is there any significant difference between those three? Also, if o2.prototype = Object.create(o1.prototype) creates an empty object with o1.prototype's prototype as it's own prototype, if o1's prototype is not empty, then how do the members of o1's prototype get imported into o2's prototype?

A: If you directly assign Parent.prototype to a child's prototype, they'll both be pointing to the same object. So, if you add a method, which only applies to the child class, Parent objects will also have access to them because Parent.prototype === Child.prototype
Example:

function Animal() {};
Animal.prototype.Eat = function() {
  console.log("Eating")
}

function Human() {};
Human.prototype = Animal.prototype; // both point to the same object

Human.prototype.Drive = function() {
  console.log("Driving")
}

var animal = new Animal();
var human = new Human();

animal.Eat();
human.Eat();

animal.Drive(); // Animals shouldn't be driving
human.Drive();

console.log("animal instanceof Human: ", animal instanceof Human) // true

If you use Object.create(Animal.prototype) instead, it creates a new object with the [[Prototype]] (also, but deprecated, __proto__) set to Anima.prototype. So, if any methods are not found on Human.prototype, it will fall back to Animal.prototype (In this case Eat)

function Animal() {};
Animal.prototype.Eat = function() {
  console.log("Eating")
}

function Human() {};
Human.prototype = Object.create(Animal.prototype)
Human.prototype.constructor = Human; // update the constrcutor

Human.prototype.Drive = function() {
  console.log("Driving")
}

var animal = new Animal;
var human = new Human;

animal.Eat();
human.Eat();
human.Drive();

try {
   // This will throw an error because Animal.prototype doesn't have a Drive method
  animal.Drive();
} catch {
  console.log("Animals can't drive")
}

console.log("animal instanceof Animal: ", animal instanceof Animal) // true
console.log("animal instanceof Human: ", animal instanceof Human) // false
console.log("human instanceof Animal: ", human instanceof Animal) // true
console.log("human instanceof Human: ", human instanceof Human) // true

console.log(animal.constructor)
console.log(human.constructor)

When you access, human.Eat(), first the method will looked up directly under the human object. If not found, this will be searched in its prototype which is Human.prototype.
Object.getPrototypeOf(human) === Human.prototype;

Since, Eat method is not found there, the method will be looked inside the prototype of Human.prototype which is Animal.prototype
Object.getPrototypeOf(Human.prototype) === Animal.prototype

The method is found here and it will be executed.

Let's say you want to use human.hasOwnProperty('eyes'). It goes through the similar chain as above. If hasOwnProperty is not found on human object, Human.prototype or Animal.prototype, it will check inside Object.prototpye because
Object.getPrototypeOf(Animal.prototype) === Object.prototype

Object.prototype has a method called hasOwnProperty and that will be executed


text:
Q: Select name from system table and select from this table I need dynamically obtain table name from system table and perform a select query on this table example:
SELECT "schema"+'.'+"table" FROM  SVV_TABLE_INFO WHERE "table" LIKE '%blabla%'
it returns my_schema.the_main_blabla_table
And after I get this table name I need to perform :
SELECT * FROM my_schema.the_main_blabla_table LIMIT 100
Is it possible to in a single query?

A: If you are talking about select subquery after "from" i can say that you can do this.
You will get something like this:
SELECT * FROM
(
  SELECT "schema"+'.'+"table" FROM  SVV_TABLE_INFO WHERE "table" LIKE '%blabla%'
)
LIMIT 100

Unfortunately, i can't test it on yor data, but i very interested in result because i have never done something like this. If i get your question incorrect, tell me pls.

A: Amazon Redshift does not support the ability to take the output of a query and use it as part of another query.
Your application will need to query Redshift to obtain the relevant table name(s), then make another call to Redshift to query that table.


text:
Q: Select hebrew from mysql database honestly I am coming here after trying everything I could find online in order to fix that problem but nothing worked..
I have a phpmyadmin database table that encoded to utf_general_ci, when I insert data in Hebrew into it it works fine and I can see the Hebrew in the table on PhpMyAdmin, but when I need to retrieve the Hebrew data from the table that's when the problem starts...
right now I am using a simple sql query to select data from the table and I tried every code that should fix it I could find online but nothing seems to work.
my current code is:
<?php

    $db = "android";
    $username = "root";
    $password = "";
    $host = "localhost";

$sql = "select * from sample;";

$conn = mysqli_connect($host,$username,$password,$db);
$conn->set_charset('utf8');

$result = mysqli_query($conn,$sql);

$response = array();

while($row = mysqli_fetch_array($result))
{
    array_push($response,array($row[0],$row[1]));
}
$str = json_encode(array($response));
echo $str;
mysqli_close($conn);

?>

and the output of the Hebrew word is \u05d4\u05d9\u05d9 what seems like a different encoding, my php file is encoded to UTF-8 and I am using npp to write it.
please try helping me out on this one cause I couldn't find an answer

A: This is a json_encode() behaviour, by default Unicode char are escaped as \u...
Try with JSON_UNESCAPED_UNICODE flag :
<?php
echo json_encode($arr, JSON_UNESCAPED_UNICODE);


text:
Q: active-mq artemis springboot clustered topic load balancing (round robin) issue After spending a lot of time in configuring and trying a lot of solutions to make Artemis work in a cluster mode like the local mode in a publish-subscribe (topic).

So, I 've prepared 3 consumers on different nodes and a producer that publish messages on only one node.

I expect that the 3 consumers receives their own copy of messages like described in  here!

The problem is the cluster (Core Bridge) still round robin messages between the 3 nodes.

My project Github Repo

spring-boot-artemis-clustered-topic

Broker Cluster Config

<!-- Using STRICT is like setting the legacy forward-when-no-consumers
parameter to true-->
<!-- Using ON_DEMAND is like setting the legacy forward-when-no-consumers
parameter to false.-->
<cluster-connections>
     <cluster-connection name="my-cluster">
     <address>jms</address>
        <connector-ref>netty-connector</connector-ref>
        <retry-interval>500</retry-interval>
        <use-duplicate-detection>true</use-duplicate-detection>
        <message-load-balancing>ON_DEMAND</message-load-balancing>
        <max-hops>1</max-hops>
        <discovery-group-ref discovery-group-name="my-discovery-group"/>
     </cluster-connection>

</cluster-connections>

Consumers behavior
  artemis-b1-b2-b3

A: In your ConnectionFactoryClusteredConfig.pubSubFactory() method, try moving factory.setPubSubDomain(true) after configurer.configure(factory, connectionFactory) as explained here: https://stackoverflow.com/a/44416121/832268.


text:
Q: What is the ~> in a functor explanation? I'm trying to understand Ramda docs so I looked up what a functor is here, but what is the ~> in this mean?
map :: Functor f => f a ~> (a -> b) -> f b

A: It's already written there :
Type signature notation

~> (squiggly arrow) Method type constructor. When a function is a
  property of an Object, it is called a method. All methods have an
  implicit parameter type - the type of which they are a property. a ~>
  a -> a is a type satisfied by methods on Objects of type a which take
  a type a as an argument and return a value of type a.


text:
Q: Windows loopback adapter takes over my WiFi adapter connection I work on my desktop which has WiFi connection to the Internet, and follow this link to create Windows loopback adapter (SSH tunnel on Windows 10 to Linux Samba).
After the loopback adapter is created, I lose Internet and cannot reconnect WiFi unless I disable the loopback adapter. Is there a way for them to co-exist in harmony?


text:
Q: How do I add a delete button next to my task list? This is what i have right now, what code do i add to make buttons next to my tasks, so with every new task there must come a remove button as well

document.getElementById('submit').addEventListener('click', withClick);

function withClick(e) {
  const li = document.createElement('li')
  document.getElementById('listid').appendChild(li);
  li.appendChild(document.createTextNode(document.getElementById("text-area").value))
  li.id = 'list'
  li.className = 'collection-item'
  const button = document.createElement('button')
  document.getElementById('list').appendChild(button);
  button.appendChild(document.createTextNode('x'))
  button.className = "button"
}

<input id="text-area">
<button id="submit">submit</button>

This is what it looks like in browser

A: id needs to be unique in HTML.
Currently every
 element you create has id="list".  So when you do this:
document.getElementById('list')

Which one do you expect it to find and why?  The behavior is likely undefined, but what you're observing is that it finds the first one with that id and then stops searching.  Because why wouldn't it?  Once it finds the element with the target id, as far as the browser is concerned it has found the one target element you're looking for.
Instead of fetching the element by its id, you already have a reference to it in the li variable.  Just use that:

document.getElementById('submit').addEventListener('click', withClick);

function withClick(e) {
  const li = document.createElement('li')
  document.getElementById('listid').appendChild(li);
  li.appendChild(document.createTextNode(document.getElementById("text-area").value))
  li.className = 'collection-item'
  const button = document.createElement('button')
  li.appendChild(button); // <---- here
  button.appendChild(document.createTextNode('x'))
  button.className = "button"
}

<input id="text-area">
<button id="submit">submit</button>


text:
Q: Weird error when reversing the contents of an array I'm trying to reverse the contents of this array, but the result is subtracting 2 from the values in the array for some reason.
Any ideas on why this is happening?
Code:
function reverseArray(array) {
  var newArray = [];
  for (i = array.length-1; i >= 0; i--) {
    newArray.push(array.indexOf(i));
  };
  return newArray;
};

var testArray = ["Zach", 2, 3, 4, 5];
var result = reverseArray(testArray);
console.log(result);

A: newArray.push(array.indexOf(i)); pushes the index of the value in i in the array (if it's there), or -1 if not. E.g., it's looking for the values 4, 3, 2, 1 and 0 and, if it finds them, pushing the index at which it found them into the new array.
To understand this better, change your function slightly and then step through it in the debugger:
function reverseArray(array) {
  var newArray = [];
  for (i = array.length-1; i >= 0; i--) {
    var newValue = array.indexOf(i);
    newArray.push(newValue);       // <=== Put a breakpoint on this line
  };
  return newArray;
}

Then step through that with the debugger and, on the indicated line, look at the value of newValue each time through the loop. (There's a powerful debugger built into your browser.)
You just want newArray.push(array[i]);

Side note: You also want to declare your i variable; currently, you're falling prey to The Horror of Implicit Globals.
Side note 2: You don't put a ; after a function declaration, or after the block attached to a for loop.