text:
Q: What cannot be tracked in Setup Audit Trail? I wonder what changes cannot be tracked in setup audit trail.
I mean that there is no info when:
 - someone deletes or edits a report
 - deletes something (Topics, Member Criteria, Rules) from Communities
 - change sender email address in Communities -> administration
How do you track these things?

A: Monitor Setup Changes explains what is tracked. If it's not on this list, it's not tracked in the Setup Audit Trail.
If you need other types of tracking, you might want/need Event Monitoring. This is a paid feature that does allow you to access additional logs, including modifications to reports and so on.

Company information, default settings like language or locale, and
  company messages
Multiple currency Users, portal users, roles, permission sets, and
  profiles
Email addresses for any user
Deleting email attachments sent as links
Email footers, including creating, editing, or deleting
Record types, including creating or renaming record types and
  assigning record types to profiles
Divisions, including creating, editing, and transferring and changing
  users' default division
Certificates, adding or deleting
Domain names
Enabling or disabling Salesforce as an identity provider
User interface settings like collapsible sections, Quick Create, hover
  details, or related list hover links
Page layout, action layout, and search layouts
Compact layouts
Salesforce1 navigation menu
Inline edits
Custom fields and field-level security, including formulas, picklist
  values, and field attributes like the auto-number field format, field
  manageability, or masking of encrypted fields Lead settings, lead
  assignment rules, and lead queues
Activity settings
Support settings, business hours, case assignment and escalation
  rules, and case queues
Requests to Salesforce Customer Support
Tab names, including tabs that you reset to the original tab name
Custom apps (including Salesforce console apps), custom objects, and
  custom tabs
Contract settings
Forecast settings
Email-to-Case or On-Demand Email-to-Case, enabling or disabling
Custom buttons, links, and s-controls, including standard button
  overrides
Drag-and-drop scheduling, enabling or disabling
Similar opportunities, enabling, disabling, or customizing
Quotes, enabling or disabling
Data category groups, data categories, and category-group assignments
  to objects
Article types
Category groups and categories
Salesforce Knowledge settings
Ideas settings
Answers settings
Field tracking in feeds
Campaign influence settings
Critical updates, activating or deactivating
Chatter email notifications, enabling or disabling
Chatter new user creation settings for invitations and email domains,
  enabling or disabling
Validation rules
Public groups, sharing rules, and org-wide sharing, including the
  Grant Access Using Hierarchies option
Password policies
Password resets
Session settings, like session timeout (excluding Session times out
  after and Session security level required at login profile settings)
Delegated administration groups and the items delegated admins can
  manage (setup changes made by delegated administrators are also
  tracked)
Lightning Login, enabling or disabling, enrollments, and cancellations
How many records a user emptied from their Recycle Bin and from the
  org's Recycle Bin
SAML (Security Assertion Markup Language) configuration settings
Salesforce certificates
Identity providers, enabling or disabling
Named credentials
Service providers
Shield Platform Encryption setup
Mass delete use, including when a mass delete exceeds the user's
  Recycle Bin limit on deleted records
Data export requests
Mass transfer use
Reporting snapshots, including defining, deleting, or changing the
  source report or target object on a reporting snapshot
Use of the Data Import Wizard
Sandbox deletions
Apex classes and triggers
Visualforce pages, custom components, and static resources
Lightning pages
Action link templates
Custom settings
Custom metadata types and records
Remote access definitions
Force.com Sites settings
API usage metering notification, creating
Territories Process automation settings
Approval processes
Workflow actions, creating or deleting
Visual Workflow files
Packages from Force.com AppExchange that you installed or uninstalled
Account team and opportunity team selling settings
Activating Google Apps services
Mobile configuration settings, including data sets, mobile views, and
  excluded fields
Users with the "Manage External Users" permission logging in to the
  partner portal as partner users
Users with the "Edit Self-Service Users" permission logging in to the
  Salesforce Customer Portal as Customer Portal users
Partner portal accounts, enabling or disabling
Salesforce Customer Portal accounts, disabling Salesforce Customer
  Portal, enabling or disabling
Creating multiple Customer Portals
Entitlement processes and entitlement templates, changing or creating
Self-registration for a Salesforce Customer Portal, enabling or
  disabling
Customer Portal or partner portal users, enabling or disabling


text:
Q: Received a 'repaired' drive under RMA replacement. Is this OK? The replacement drive I received in lieu of the one submitted under RMA (returned because BIOS detected 500GB as either 4GB or 0MB) carries a 'Repaired' drive sticker.
I'm confused about the 'repaired' sticker. The warranty on the original drive applies to this replacement received - so perhaps I'm only being paranoid ... but I thought I'd ask.
Is it standard practice for a Barracuda drive under RMA to be replaced by a 'repaired' drive? Does it impact the resale value of the system?

A: It depends on the company and rules of the country you are in.
Typically, under a manufacturers warranty, they will hardly ever give you a new drive, they nearly always give you the next repaired drive of same specification, then put yours on the pile to be repaired next and someone else will get it.
You can be sure that a repaired drive will meet the companies specifications and the warranty will always be the same (or in some situations, extended) and there is little to worry about, other than the feeling that you got a repaired drive.
Personally, I have got through (probably) thousands of drives across the years and typically, when there is a issue with returned drives, I personally use these myself or explain the situation to the customer and offer a discount (I really would not like someone to open a machine and read "repaired"), but I can tell you that I have not noticed any problems such as breaking early - all hard drives are as bad as the next one, random problems can break any time from 1 week to 5 years! I have seen no "extra" errors with a refurbed drive.
Next, regarding the country you are in. I have no idea about India's laws, but I can guess it would be similar - the only difference is in England it is actually confirmed/set in stone. In England - the contract of sale is with the company you purchased from, not the manufacturer. You are entitled to goods that meet the purpose they were sold for. If the hard drive breaks within a reasonable amount of time (accepted at around 6 months), you can state that the goods were not fit for purpose and demand a repair/replacement. They only need to ensure you have a working like-for-like part.

A: If not a standard practise amongst most manufacturers it is at least not uncommon to be honest.
It seems to be that some manufacturers have a policy whereby if a unit fails in the first month then a new replacement is given and if it fails after that time but before warranty expires then they they will issue a refurbished or repaired unit instead.
This is my experience with Dell and a couple of others at least...

A: It is standard practice for a manufacturer to replace warranty products with either new or repaired/refurbished at their discretion.  Usually there is little to no difference between a new or refurbished product.  However, it also happens on occasion that refurbished hard drives have not been reformatted so you will hear stories from time to time of people finding someone else's data on their refurbed drive.  So make sure your do a good format of it before you load anything.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to display a tabularray table in its entirety on specific slides of a Beamer frame? I saved the following LaTeX code in the file ~/Test.tex.
\documentclass{beamer}
\usepackage{tabularray}
\begin{document}

\begin{frame}
\begin{block}<1->{Hello}
world
\end{block}

\begin{tblr}{cc}
    \visible<2->{First cell} & \visible<2->{Second cell}
\end{tblr}
\end{frame}

\end{document}

The code creates a Beamer presentation consisting of a single frame that encompasses two slides. On the first slide appears a block. On the second slide appear the two cells comprising the single row of a table.
When the following commands are executed in the Terminal:
> cd ~
> lualatex Test
> lualatex Test

the compilation completes successfully, with no warnings written to ~/Test.log (in particular, no warnings to rerun), and the file ~/Test.pdf is generated. When opened in a PDF viewer, the file displays as follows.

The output is as expected, however in order to show the table on the second slide, I used two \visible commands: one for each cell of the table's single row.

Question
Is it possible to display the table starting from the 2nd slide by issuing a single command that would apply to the entire table, instead of issuing a \visible command for each cell individually?

A: This worked for me... Does it help?
\documentclass{beamer}
\usepackage{tabularray}
\begin{document}

    \begin{frame}
        \begin{block}<1->{Hello}
            world
        \end{block}

        \visible<2->{%
        \begin{tblr}{cc}
            First cell & Second cell
        \end{tblr}}
    \end{frame}

\end{document}

A: I'm normally not a big fan of the \pause macro (it is a rather crude command which does not provide a lot of flexibility), but for such a simple case:
\documentclass{beamer}
\usepackage{tabularray}
\begin{document}

\begin{frame}
\begin{block}<1->{Hello}
world
\end{block}
\pause
\begin{tblr}{cc}
    First cell & Second cell
\end{tblr}
\end{frame}

\end{document}


text:
Q: find a text from any column in csv using python i am trying to search for a specific text in a csv file i am using any(iteratable) to iterate through all columns in csv for this but it returns of true whatever i search for.. here's my code...
input_text_frmwebsite =" five41-613-four731  "
input_text = input_text_frmwebsite.strip()

with open('items2.csv', 'rt') as f:
            reader = csv.reader(f, delimiter=',')
            for line in reader:
                if any(input_text in col for col in line):
                    print "its in file"
                else:
                    print "not in file"

and my CSV file looks like this


text:
Q: How to leave out a part of programming code, in a programming code quote? How to leave out a part of programming code, in a programming code quote?
In particular I have the following code snippet (from the Lean proof assistant):
def single (a : α) (b : β) : α →₀ β :=
⟨λa', if a = a' then b else 0,
  finite_subset (@finite_singleton α a) $ assume a', by by_cases h : a = a';
  simp [h]⟩

And I want to leave out a part, like:
def single (a : α) (b : β) : α →₀ β :=
⟨λa', if a = a' then b else 0,
  [...]⟩

For text quotes I know that we can use the [...] for leaving out part of the quote.
But what do we use in the case of programming code quotes?

A: Lean has sorry, which is even syntactically-valid if the omitted part is an expression, as it is here. So if you are writing an exercise in Lean and you want provide a partially-filled answer that the reader could try to fill in:
def single (a : α) (b : β) : α →₀ β :=
⟨λa', if a = a' then b else 0,
  sorry⟩

It differs from _ in that Lean will not try to fill in the blank when you use sorry.


text:
Q: Matrix Transpose using R t() function For following argument
x <- c(1,3,4,24,1,2,2,2,1,3,3,1,1,0,8)
A <- matrix(x,nrow = 5)
n <- ncol(A)
t(A)
meancol <- colMeans(A)
meancol
t(t(meancol))

I am writing to ask why for t(A), I only need put t() to get what I want, but for meancol,I need to put t(t()) to get the results.

A: Notice that the output of meancol <- colMeans(A) isn't a matrix, then the function transpose interprets it as a vector.
From the Details of the function t() we have:

Details This is a generic function for which methods can be written.
The description here applies to the default and "data.frame" methods.
A data frame is first coerced to a matrix: see as.matrix. When x is a
vector, it is treated as a column, i.e., the result is a 1-row matrix.

The vector is read as a 1-column matrix, therefore the result is a 1-row matrix.


text:
Q: Extract two values from string using regex I have a string that looks like this:
'p10005c4'
I need to extract the productId 10005 and the colorId 4 from that string into these variables:
$productId
$colorId
productId is > 10000.
colorId > 1.
How can I do this clean and nice using regex?

A: If your string is always pXXXcXX, I would suggest you forego the regular expressions, and just use a couple of string functions.
list($productId,$colorId) = explode('c',substr($string,1),2);

A: You can use the following regex:
'/p(\d+)c(\d+)/'

If you want to make sure the product code is 5 digits:
'/p(\d{5})c(\d+)/'

A: This should be possible with the following regex:
/p(\d+)c(\d+)/

This basically means, match any string that consists of a p, followed by one or more digits, then followed by a c, then followed by one or more digits.
The parentheses indicate capture groups, and since you want to capture the two ids, they're surrounded by them.
To use this for your purposes, you'd do something like the following:
$str = 'p10005c4';
$matches = array();

preg_match('/p(\d+)c(\d+)/', $str, $matches);

$productId = $matches[1];
$colorId   = $matches[2];

For more information on getting started with regular expressions, you might want to take a look at Regular-Expressions.info.


text:
Q: What is the recommended architecture for using amazon neptune in a scalable way? I am building an application backed by a Neptune database. Because I want the application to be scalable, I am using AWS Lambda + API gateway to build a REST API to interact with the database. This seems to be a reasonable idea based on the fact that this use case is documented in the Neptune docs.
The Neptune docs recommend reusing the websocket connection to the database across the entire execution context of the function, which is what I am doing at the moment. The docs also recommend resetting the connection and retrying upon errors (see here), which I am also using. However, I am seeing exceptions every now and then (perhaps every 20 requests on average). One of the exceptions I get is

ConnectionResetError: Cannot write to closing transport

which seems to be the same as this issue.
The other one is:
Traceback (most recent call last):
  File "/var/task/chalice/app.py", line 1685, in _get_view_function_response
    response = view_function(**function_args)
  File "/var/task/app.py", line 57, in resource
    return Resource(app.current_request, g).process()
  File "/var/task/backoff/_sync.py", line 94, in retry
    ret = target(*args, **kwargs)
  File "/var/task/chalicelib/handlers/resource.py", line 106, in get
    values = resources.valueMap().with_(WithOptions.tokens).toList()
  File "/var/task/gremlin_python/process/traversal.py", line 57, in toList
    return list(iter(self))
  File "/var/task/gremlin_python/process/traversal.py", line 47, in __next__
    self.traversal_strategies.apply_strategies(self)
  File "/var/task/gremlin_python/process/traversal.py", line 548, in apply_strategies
    traversal_strategy.apply(traversal)
  File "/var/task/gremlin_python/driver/remote_connection.py", line 63, in apply
    remote_traversal = self.remote_connection.submit(traversal.bytecode)
  File "/var/task/gremlin_python/driver/driver_remote_connection.py", line 60, in submit
    results = result_set.all().result()
  File "/var/lang/lib/python3.7/concurrent/futures/_base.py", line 435, in result
    return self.__get_result()
  File "/var/lang/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/var/task/gremlin_python/driver/resultset.py", line 90, in cb
    f.result()
  File "/var/lang/lib/python3.7/concurrent/futures/_base.py", line 428, in result
    return self.__get_result()
  File "/var/lang/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/var/lang/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/var/task/gremlin_python/driver/connection.py", line 82, in _receive
    data = self._transport.read()
  File "/var/task/gremlin_python/driver/aiohttp/transport.py", line 104, in read
    raise RuntimeError("Connection was already closed.")
RuntimeError: Connection was already closed.

In case it is relevant, I am using gremlingpython==3.5.1
It seems to me that these issues are all ultimately a consequence of using AWS Lambda, namely due to the mismatch between the longevity of websocket connections and the ephemeral nature of lambda execution contexts. The question then is: Am I doing the wrong thing by trying to use AWS lambda for my API? Would it be more appropriate to setup an EC2 instance and deal with the scalability in some other way?
P.S. Previously I did create and close a connection in every function execution (as previously recommended in the Neptune docs), which did work fine but was naturally slow.

A: The latest version of Neptune only supports Gremlin 3.4.11 (https://docs.aws.amazon.com/neptune/latest/userguide/engine-releases-1.0.5.1.html).  I would start by using gremlin-python 3.4.11 and see if that resolves your issue.  Gremlin-python 3.5 replaced Tornado with AIO HTTP (ref) for websocket connections and I suspect that change may be causing a slight change in behavior that a future release supporting Gremlin 3.5 will address.

A: I wonder whether the 'Connection was already closed' error message is not being treated as a retriable error by the retry logic?
What happens if you add this error message to the list of retriable_error_msgs in the Python example in the docs?


text:
Q: Why is Repl.it python turtle.tracer(n) limited to 150? I'm making a recursive drawing of a tree using repl.it py turtle.  This is my code
import turtle
import random
def about(x): return x * random.uniform(0.95,1.05)

# recursively draw a tree
def tree(t,a,s):
    if s<2: return
    t.left(a)
    t.fd(s)
    tree(t.clone(),about(30), s * about(.7))
    tree(t,about(-30), s * about(.7))

t = turtle.getpen()
t.ht(); t.speed(0); t.tracer(0)
tree(t,90,40)
t.update()

Also here. But it only draws part of the tree.  If I change it to
t.tracer(150)

then it works!  Also tracer(10) works, but tracer(200) does not work. Is there a limit to how high tracer can go?

A: First, let's discuss your drawing code.  Your tree consists of about 500 lines drawn by 500 different turtles!  This seems excessive, so let's rewrite your code to use a single turtle that undoes it's movements rather clone itself:
from turtle import Screen, Turtle
from random import uniform

def about(x):
    return x * uniform(0.95, 1.05)

# recursively draw a tree
def tree(t, a, s):
    if s < 2:
        return

    t.forward(s)
    t.left(a)
    tree(t, about(30), s * about(0.7))
    t.right(2 * a)
    tree(t, about(-30), s * about(0.7))
    t.left(a)
    t.backward(s)

screen = Screen()
screen.tracer(0)

turtle = Turtle()
turtle.hideturtle()
turtle.setheading(90)

tree(turtle, 15, 50)

screen.tracer(1)
screen.mainloop()

As far as tracer() is concerned, I wasn't able to reproduce your results but the image never completed either.  The argument to tracer() specifies that you only want to update the image on every nth graphic operation.  This is very specialized and I only recommend values of 0 and 1.  First, it's difficult to calculate what every nth update should be, based on the algorithm, and what makes sense visually to the user.  Second, in standard Python turtle, there are some operations that cause an update regardless of tracer() setting which throws off this calculation, unless you know when these extra update occur.
In your case, for speed purposes, set tracer(0) when the intense drawing begins, and set tracer(1) when you're done drawing.  Then everything should work fine.


text:
Q: How to determine a given function is reducible or not over GF(2^8).Need an easy understandable solution Suppose I have a polynomial
f(x) = x^8+x^4+x^3+x+1 over GF(2^8), how do i determine it is reducible or irreducible.
I assume the solution is to find whether the polynomial has roots over GF(2^8) , in that case how do i solve the above polynomial to find the roots.(request easy steps to find the roots with the above example )

A: $x^8 + x^4 + x^3 + x + 1 | x^{2^8}-x$, where we work in the coefficient field $\mathbb{F}_2$.  $f(x)$ is not divisible by the irreducible polynomials of $\mathbb{F}_2[x]$ of degrees 1, 2, or 4.  Therefore $f(x)$ is irreducible.
This follows from the theorem:
$g(x) = x^{p^n}-x$ is the product, as $d$ runs through the divisors of $n$, of the distinct irreducible polynomials of $\mathbb{F}_p[x]$ of degree $d$.
Consequently, if your polynomial divides $x^{2^8}-x$ and does not have a factor of order $1, 2, 4, 8, \dots$, it is irreducible.  By the rational roots test, it does not have a linear factor.  Since $\gcd(f,f')=1$ it has no repeated factor (which easily we could find via $\gcd$).  Using the theorem recursively, we find the irreducibles of degree $1$ are $x$ and $x+1$.  Of degree $2$, $x^2+x+1$.  Of degree $3$, $\frac{x^8}{(x)(x-1)} = (x^3+x+1)(x^3+x^2+1)$, neither of which we need since $3 \not | 8$.  Of degree $4$, $x^4+x+1$, $x^4+x^3+1$ and $x^4+x^3+x^2+x+1$.  This gives us a complete list of things to factor out of $x^{2^8}-x$ first.  Then we (1) know that the quotient has only degree 8 factors, and (2) if your polynomial divides the quotient, your polynomial is a degree 8 irreducible in $\mathbb{F}_{2^8}$.


text:
Q: Can not understand load returned by sysinfo To find the load average in linux I use sys/sysinfo.h which include linux/kernel.h, where the following structure is defined:
struct sysinfo {
long uptime;            /* Seconds since boot */
unsigned long loads[3];     /* 1, 5, and 15 minute load averages */
unsigned long totalram;     /* Total usable main memory size */
unsigned long freeram;      /* Available memory size */
unsigned long sharedram;    /* Amount of shared memory */
unsigned long bufferram;    /* Memory used by buffers */
unsigned long totalswap;    /* Total swap space size */
unsigned long freeswap;     /* swap space still available */
unsigned short procs;       /* Number of current processes */
unsigned short pad;     /* explicit padding for m68k */
unsigned long totalhigh;    /* Total high memory size */
unsigned long freehigh;     /* Available high memory size */
unsigned int mem_unit;      /* Memory unit size in bytes */
char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
};

but I think it doesn't give true load.
output :
   2552402, 3214049236, 134513148
What does this value mean?
We can find current load using the uptime command:
$uptime
13:00:14 up 35 min,  2 users,  load average: 1.07, 0.95, 0.80

I can't find any connection between above the two outputs.

I have searched on internet. This says that divide it by 2^16 (65536). and I have tried it too.
(or do shift 1 by SI_LOAD_SHIFT  i.e.   1 << SI_LOAD_SHIFT. because 65536 = 1 << 16)
I use computer which has four i3-2120 processor. Output of 'upitime' has connection with number of cpus. Wikipedia load_average

A: Looking at the link you gave, you should scale the loads according to the SI_LOAD_SHIFT constant (included by sys/sysinfo.h), and introduce the number of available CPUs to convert it into CPU usage %:
struct sysinfo sysinf;
memset(&sysinf, 0, sizeof sysinf);
if (!sysinfo(&sysinf)) {
    float f_load = 1.f / (1 << SI_LOAD_SHIFT);
    printf("load average (1 min): %.2f (%.0f%% CPU)\n",
        sysinf.loads[0] * f_load,
        sysinf.loads[0] * f_load * 100/get_nprocs());
    // process other loads as well of you need
}

A: The load averages are represented in fixed point arithmetic. See here for the relevant constants. We see that the last FSHIFT bits are used to represent the fractional part. To get the load averages, you can always do it like /proc/loadavg.

A: I got the solution.
I forgot to call sysinfo(&sysinfo_obj) function.


text:
Q: trouble understanding function pointers I struggle to understand the way function pointers work in the code I'm working with.
The code describes the IAP (in-application programming) of Flash memory on the LPC1768 Microcontroller from NXP.
unsigned int flashParamTab[5];
unsigned int flashResultTab[5];

// IAP entry function
#define IAP_LOCATION    0x1FFF1FF1

// In Application Programming function entry
typedef void (*IAP)(unsigned int[], unsigned int[]);
IAP flashIapEntry = (IAP)IAP_LOCATION;

This code is than being used with in various functions, like these two:
// Prepare a sector for write operation.
void flashPrepareSectors(unsigned int startSec, unsigned int endSec){
   flashParamTab[0] = IAP_PREPARE_WRITE;
   flashParamTab[1] = startSec;
   flashParamTab[2] = endSec;
   flashIapEntry(flashParamTab, flashResultTab);
 }
// Erase a sector.
void flashEraseSectors(unsigned int startSec, unsigned int endSec) {
   flashParamTab[0] = IAP_ERASE_SECTORS;
   flashParamTab[1] = startSec;
   flashParamTab[2] = endSec;
   flashIapEntry(flashParamTab, flashResultTab);
 }

As far as I understand:
        typedef void (*IAP)(unsigned int[], unsigned int[]);

defines an IAP datatype where IAP is a pointer to a function that takes two arrays of integers as arguments, and doesn't return anything.
In the next step the
    IAP flashIapEntry = (IAP)IAP_LOCATION;

declares a variable flashIapEntry of type IAP, that is a pointer to a specific location in the memory, where code for a function that takes two arrays of integers is located.
I can't really figure out what happens when this function is called.
In my opinion in both cases (when preparing and erasing a sector) the same function is called (the one located at 0x1fff1ff1), and the only difference is the first field of the array, the flashParamTab[0], that defines the behaviour of this function.
Am I correct with my understanding?

A: Correct.  As is also described in this NXP application note, in your example, flashIapEntry becomes a pointer to a function that takes two integer arrays as parameters and returns void. This means you would call that function as you would any other function in C, like this:
flashIapEntry(flashParamTab, flashResultTab);

"I can't really figure out what happens when this function is called."
The parameters are pushed onto the stack, as is the current program execution location, and then the program execution pointer is set to 0x1FFF1FF1. The command to be executed by the IAP entry function (at 0x1FFF1FF1) is defined by the values you set in the flashParamTab array, and whatever results this function produces are written to the flashResultTab memory area. Finally the program execution location is set to the value saved on the stack and the stack pointer is reset, and program flow continues after the call to flashIapEntry() allowing you to check the results in the flashResultTab array.

A: The IAP libraries on NXP controllers is hardcoded, ever-present source for a lib already inside the MCU upon delivery. This lib isn't linked so neither your compiler nor linker knows about it.
The IAP_LOCATION memory address is the physical address where the function is located and NXP guarantees that it has a certain format and calling convention. In order to call that function, we need to use a function pointer since the actual function isn't available anywhere in our source.
You can do it a bit more readable like this (from an IAP driver I once wrote) :
typedef uint32_t iap_func_t (const uint32_t*, uint32_t*);

static iap_func_t* const iap_entry = (iap_func_t*) IAP_ADDRESS;

The const keyword ensures that the function pointer gets stored in flash, so this is essentially just as if we had declared the function normally.
Then call the function with different parameters depending on what you want it to do.


text:
Q: admin on rest in create form - Generated the TextInput by loop. If I type anything in one text-box, it is reflecting in all other generated text-box I created the TextInput by loop. If I type anything in one text-box, it is reflecting in all other textbox's as well. How to prevent this reflecting one textbox value into others textbox's automatically.

A: You should set it's source property. But it's always best to show an example of your problem in a codesandbox.


text:
Q: How can I offer to others to show my website content in their website? I want to know the method by which I can offer others to show my website content in their website by embedding it either by a script tag or iframe. I have seen some websites showing some content for example a tournament fixture and offer visitor to embed the same content in their websites by copying and pasting the script tag or an iframe.
YouTube also offers to embed videos in other websites. Thus the content may be anything like div or table or a video. So how can I do this?
I think this question is related to somewhat I am searching. But it doesn't elaborate the solution in detail. I don't know how the external script file will show the content. Note that I am using PHP as a server-side language.

A: So you want to let other websites embed an iframe showing some content from your website but not the entire website. What you could do (though probably not the only solution) is to take the content you want to share, say a blog post, and make that into a standalone HTML page.
So create a page with URL foobar.com/blog/post1 but it only contains the post, not your entire website layout, navbar, footer etc. (This will be the case if you are using a MVC or making a SPA website). Make sure to include necessary styles and scripts with it too.
This can then be included in an iframe:
Another alternative is to write an API where the other websites can request your blog post (or pictures, content or whatever) as .JSON objects, possibly containing the HTML as a string.
Really there are quite a few options depending on it being static or dynamic content. For dynamic I would suggest to use an iframe containing the mini app, which gets updated data through an API, or maybe even websockets if it has to be live.
And don't forget to deal with CORS on your server.

EDIT
So you want to offer a JS file for other's to include in their code similarly to requesting a JS library from a CDN:
https://code.jquery.com/jquery-git2.js

In this case you can load a JS file from somebody's server. Similarly you offer a JS file for the other websites to include. This JS will load content from your server via a HTTP request. There are many libraries which facilitate this, try learning about JQuery Ajax(tutoriallink).
Then as @halfer suggested, you ask the website owner to have a div with a unique id, say 'your_website_name' which your JS script searches for and populates with data received from your server.

Note:
Your question was very vague so don't hate on the SO community trying to help. In the comments they added ideas to spur on other users' answers, otherwise they would have posted an answer.
I think what you are actually searching for is how to populate HTML via JS, and pull data via the network as you seem to know the rest. Read up on these terms, maybe look at some JS libraries such as JQUERY, Mootools or even MVC frameworks if your "applet" is quite complex.
If you want more help, post a new and more specific question about your use-case, any code you have written so far helps too.


text:
Q: Mistake in the code. Scikit-image, Spyder I got this warning but I cannot fix it. Code works.
Warning: Lossy conversion from float64 to uint8. Range [0, 1]. Convert image to uint8 prior to saving to suppress this warning.
from skimage.io import imread, imshow, imsave

img_grey = imread('C:/Lawn.png', as_gray=True)
imsave('Lawn22.png', img_grey)

img = imread('C:/Lawn.png')
imshow(img)

A: You need after reading image convert float64 to type uint8 like below for removing this warning message with this code:
img_grey = img_grey / img_grey.max() #normalizes img_grey in range 0 - 255
img_grey = 255 * img_grey
img_grey = img_grey.astype(np.uint8)

whole code without warning message:
from skimage.io import imread, imshow, imsave
img_grey = imread('C:/Lawn.png', as_gray=True)

# convert image to uint8
img_grey = img_grey / img_grey.max() #normalizes img_grey in range 0 - 255
img_grey = 255 * img_grey
img_grey = img_grey.astype(np.uint8)

imsave('Lawn22.png', img_grey)
img = imread('C:/Lawn.png')
imshow(img_grey)


text:
Q: Passing a String Array to a Function I have a couple of string arrays in C++ that are defined as const strings
const string ABC[5] = {"1","2","3","4","5"};
const string DEF[3] = {"1","2","3"};

I need to pass each of them to the same function similar to this pseudo code:
void doSomething(string strArray[])
{
    // loop to access all strings in the array and do something .
};

But when called it gives me an error about type when it is passed to the function
doSomethign(ABC);
doSomethign(DEF);

This is the error generated

Error C2664   'void roster::strInput1(std::string [])': cannot convert
  argument 1 from 'const std::string [5]' to 'std::string []'

I have tried to use the const type as well but I am not sure what I am doing wrong.

A: ABC and DEF when passed as parameters decay to a pointer of type const string* which is not compatible with the type of strArray[].
Moreover, if you want to loop through the arrays inside the doSomething function, you will also need to pass the size of the arrays so as to know the bounds of the arrays.
Since the sizes of ABC and DEF are different, what you need to use here is a function template.
Here is an example to loop through an array of T and print the elements.
template<typename T, size_t N>
void doSomething(T (&arr)[N])
{
    // loop to access all elements in the array and print them.
    for(auto const& var: arr)
        cout << var << '\n';
}

See Demo here.
If it is just a std::string array, you can just parameterize over the non-type parameter N which is the size of the array. The function template in this case will just be:
template<size_t N>
void doSomething(const std::string (&arr)[N])
{
    // loop to access all strings in the array and do something .
    for(auto const& str: arr)
        cout << str << '\n';
}

A: I disagree with the use of C-style arrays, I rather see std::array or std::vector. The 2 main issues with this are the loss of size-information and the decay to pointer behavior.
 That said, your underlying problem is const correctness.
For the purpose of simplicity, I'll rewrite your code to the equivalent based on std::vector next to the C-style variants. Please see the answer of P.W for why size information is important and how to deal with it. My answer is more focused on not introducing a templated method that requires you to expose the algorithm.
The following code defines a constant vector of strings. Once defined const, this should not change by the one receiving this object. (Ignoring mutable and const_cast).
const std::vector<std::string> ABC = {"1","2","3","4","5"};
const std::string ABC[] = {"1","2","3","4","5"};

As this object is created as const, it can never change and const_cast is undefined behavior. Mutable ain't used in std::string, so no internal state can change.
So what's happening with your function?
void doSomething(std::vector<std::string> &strArray);
void doSomething(std::string strArray[], size_t size);

This signature accepts a non-const vector of strings. Passing a const object to this function ain't allowed as this function signature allows modifications to the original instance.
So, how to fix: correct the signature to not allow any modifications. This is preferred if one doesn't modify its input arguments.
void doSomething(const std::vector<std::string> &strArray);
void doSomething(const std::string strArray[], size_t size);

Or if you need modifications, remove the const at creation:
 std::vector<std::string> ABC = {"1","2","3","4","5"};
 std::string ABC[] = {"1","2","3","4","5"};

As I've used std::vector instead of C-style arrays, we even get a third possibility that ain't possibles with the C-style arrays: pass by value.
void doSomething(std::vector<std::string> strArray)

In this case, the function gets a copy of the data. This could be useful if one has to do some manipulations to the vector without influencing the caller. For example: Convert all strings to upper case or sort the vector.

A: if you are passing const array try to write it in function too and put star instead of  brackets.
void doSomething(const string *strArray)
{
// loop to access all strings in the array and do something .
};


text:
Q: Initialize pageObject without creating @BeforeMethod Learning POM in selenium and trying to understand this behaviour. When I set up my test class like this:
public class HomePageTests extends BaseTest {
    private HomePage homePage;

    @BeforeMethod
    public void setupTest() {
        homePage = new HomePage(driver);
    }

    @Test
    public void checkPageTitleTest() {
        //act
        homePage.clickOnMainPageIconButton();

        //get
        String pageTitle = homePage.getMainPageTitle(driver);

        //verify
        assertThat(pageTitle).isEqualTo(HOME_PAGE_TITLE);
    }
}

Everything seems to be working as intended. However when I tried to create without @BeforeMethod
public class HomePageTests extends BaseTest {
    private HomePage homePage = new HomePage(driver);

    @Test
    public void checkPageTitleTest() {
        //act
        homePage.clickOnMainPageIconButton();

        //get
        String pageTitle = homePage.getMainPageTitle(driver);

        //verify
        assertThat(pageTitle).isEqualTo(HOME_PAGE_TITLE);
    }
}

I always receive this error: java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.SearchContext.findElement(org.openqa.selenium.By)" because "this.searchContext" is null
This is how my HomePage looks like:
public class HomePage extends BasePage{
    public HomePage(WebDriver driver) {
        super(driver);
    }

    @FindBy(className = "header__logo__link")
    WebElement mainPageLogo;

    public void clickOnMainPageIconButton(){
        mainPageLogo.click();
    }

    public String getMainPageTitle(WebDriver driver){
        return driver.getTitle();
    }

}

What can I do to get rid of this repeated block of @BeforeMethod. Link to my current repository with project if I miss something that might be crucial to described issue.
Tried to create initialize class within HomePage but this was already marked as error by IDE.

A: The issue is with the line
private HomePage homePage = new HomePage(driver);

you have to understand the logic of static and non-static variables.
you have initialised your non-static HomePage object on the class level.

After class loading, initialization of the class takes place which
means initializing all static members of the class. As a result
no-static method will not get initialize.

Here you are not using the java main method for execution, the actual execution is via TestNG framework.
Solution 1: Make HomePage static
 private static HomePage homePage = new HomePage(driver);

Solution 2: Initilize non-static object on @BeforeClass or @BeforeTest annotation
    public class HomePageTests extends BaseTest {
        private HomePage homePage;

        @BeforeClass
        public void setupTest() {
            homePage = new HomePage(driver);
        }

        @Test
        public void checkPageTitleTest() {
            //act
            homePage.clickOnMainPageIconButton();
            //get
            String pageTitle = homePage.getMainPageTitle(driver);
            //verify
            assertThat(pageTitle).isEqualTo(HOME_PAGE_TITLE);
        }
}

Your code:
https://github.com/mpaasternak/CeneoAutomation


text:
Q: Type 'Moment' is not assignable to type 'Date'. Property 'toDateString' is missing in type 'Moment' I have configure moment with my angular2 application, and when i tried to assign the date of this week saturday to a date type variable,
  case "weekend":
        this.fromDate =  moment().startOf('week');

It shows an error saying,
Type 'Moment' is not assignable to type 'Date'.   Property 'toDateString' is missing in type 'Moment'

I have imported moment in my component as follows,
import * as moment from 'moment/moment';

A: startOf:

Mutates the original moment by setting it to the start of a unit of time

so it returns a moment object. Use toDate() if you need to convert to JavaScript Date.
case "weekend":
    this.fromDate =  moment().startOf('week').toDate();


text:
Q: Kubernetes CRD versioning Kuberentes has a mechanism for supporting versioning of CRDs. See https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definition-versioning/. What is not clear to me is how you actually support an evolution of CRD v1 to CRD v2 when you cannot always convert from v1 <-> v2. Suppose we introduce a new field in v2 that can not be populated by a web hook conversion, then perhaps all we can do is leave the field null? Furthermore when you request api version N you always get back an object as version N even if it was not written as version N so how can you controller know how to treat the object?

A: As you can read in Writing, reading, and updating versioned CustomResourceDefinition objects

If you update an existing object, it is rewritten at the version that is currently the storage version. This is the only way that objects can change from one version to another.

Kubernetes returns the object to you at the version you requested, but the persisted object is neither changed on disk, nor converted in any way (other than changing the apiVersion string) while serving the request.
If you update an existing object, it is rewritten at the version that is currently the storage version. This is the only way that objects can change from one version to another.
You read your object at version v1beta1, then you read the object again at version v1. Both returned objects are identical except for the apiVersion field, Upgrade existing objects to a new stored version
The API server also supports webhook conversions that call an external service in case a conversion is required.
The webhook handles the ConversionReview requests sent by the API servers, and sends back conversion results wrapped in ConversionResponse. You can read about Webbooks here.
Webhook conversion was introduced in Kubernetes v1.13 as an alpha feature.
When the webhook server is deployed into the Kubernetes cluster as a service, it has to be exposed via a service on port 443.
When deprecating versions and dropping support, devise a storage upgrade procedure.

A: In the case you describe I think you are forced to define some kind of 'default' value for that new mandatory field being introduced, so custom objects created before that change can be converted to the updated spec.
But then it becomes a backward compatible change, so no need to define that v2, you can remain in v1.
If It Is not possible to define a default value for it nor to derive any value at all (for that mandatory introduced field) from other fields existing in a custom object compliant with current v1 (i.e. the schema to follow before introducing this update) then you should assure v2 to be the new stored versione and then manually update all existing v1 compliant custom objects to properly set that mandatory parameter.
Or even to define a new custom object ...

A: Let say you have CRD specification like below.
// API v6.
type Frobber struct {
  Height int    `json:"height"`
  Param  string `json:"param"`
}

Then you added some new spec called Width.
// Still API v6.
type Frobber struct {
  Height int    `json:"height"`
  Width  int    `json:"width"`
  Param  string `json:"param"`
}

So as long as you can handle this change using controller logic you do not need any version change. Which means this addition would be backward compatible.
But let say now you are changing the previous spec as below.
// Internal, soon to be v7beta1.
type Frobber struct {
  Height int
  Width  int
  Params []string
}

Here you change an existing spec which is not backward compatible. Also, you might not handle this change using controller logic. In these kinds of changes, it is better to use a version upgrade.
For more details about kubernetes API version changes, refer the following links.
[1] https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md
[2] https://groups.google.com/forum/#!topic/operator-framework/jswZUe1rlho


text:
Q: Перезагрузка страницы при закрытии модального окна Здравствуйте.
У меня следующая проблема на сайте. Есть кнопка "Оформить заказ", всплывает только тогда, когда там есть товар. Так вот, если я нажимаю оформить заказ, то в модальном окне подгружается iframe с оформлением. Но если я там удаляю все товары и закрываю модальное окно, кнопка "Оформить заказ" все еще висит, хотя по факту там уже нет товаров. Если перегрузить, то она пропадает. Как сделать такое принудительное обновление или сброс состояния? )))
Как я понимаю, можно использовать location.reload();, но все как-то медленно работает. Как можно ускорить все это действо? Чтобы на глаз как будто без перегрузки все работало.
A: Навесьте кнопке класс, например, .sending-button.
В нужном месте, например, после выполнения функции закрытия модального окна, выполните следующее:
$('.sending-button').hide();

Чтобы ее отобразить, используйте
$('.sending-button').show();


text:
Q: Fire function when input[range] value changes / thumb dragging I'm wanting to fire a function whenever a input[range] value changes, however, I also want to fire this same function when the range thumb is dragged.
This example should make it clear.
The above example works fine, however I feel .on("click mousemove", is incredibly taxing on the DOM. Is there a better method of achieving the above without hitting the DOM on every mouse movement?
$('body').on("click mousemove", ".cropSlider", function() {

  var self = $(this),
      val = self.val(),
      min = self.attr('min'),
      max = self.attr('max'),
      pos = Math.round(((val - min) / (max - min)) * 100);

   style = "background-image: linear-gradient(to right, blue "+pos+"%, #eee 7%);";

    console.log(pos);

  $('.cropSlider').attr('style', style);
});

            <input class="cropSlider" type="range" value="1" min="1" max="4" step=".01">

EDIT: You may have to hit "run JS" on the example link, for the blue progress bar to show. Strange behaviour JSBin.

A: $('input[type=range]').on("input", function() {
 // blah
});

A: // Try This
$('#cropSlider').change(function(){
     //  Your Code
});


text:
Q: Possible combinations of a list I have an  arraylist of objects that I want to create all possible combinations (according to a simple set of rules). Each object that is stored in the list holds a squadNumber and a string. Here is an example of a typical list I am storing:
0: 1, A
1: 1, B
2: 2, A
3: 2, B
4: 3, C
5: 3, D
6: 4, C
7: 4, D

I want to get all the combinations where each squadNumber can only be present once, for example: (1,A),(2,A),(3,C),(4,C) then the next combination would be (1,A),(2,A),(3,C),(4,D).
How would I go about this in java? Usually I would use a nested loop, but the fact that it's all being stored in one list complicates things for me.
Thanks,
paintstripper

A: EDITED
Algorithm is following:

*

*Split all squads by numbers. So we have list with squads for 1,
another list for squads 2, etc.

*Run dfs. At nth step we add squads with nth number.

Code
// Split squads by numbers, so we can iterate through each number independently.
private Map<Integer, List<Squad>> splitSquadsByNumbers(List<Squad> squads) {
    Map<Integer, List<Squad>> res = new HashMap<Integer, List<Squad>>();
    for (Squad squad : squads) {
        if (res.get(squad.getNumber()) == null) {
            res.put(squad.getNumber(), new ArrayList<Squad>());
        }
        res.get(squad.getNumber()).add(squad);
    }
    return res;
}

List<Integer> squadNumbers;
Map<Integer, List<Squad>> squadsByNumbers;
Stack<Squad> stack;

// Iterating through each squad with number squadNumbers[position] and try to add to stack, at the end pop it from stack.

private void dfs(int position) {
    if (position == squadNumber.size()) {
        System.out.println(stack.toString());
    } else {
        for (Squad squad : squadsByNumbers.get(squadNumber.get(position))) {
            stack.push(squad);
            dfs(position + 1);
            stack.pop();
        }
    }
}

private void main(List<Squad> squads) {
    squadsByNumbers = splitSquadsByNumbers(squads);
    squadNumber = new ArrayList(squadsByNumber.keySet());
    Collections.sort(squadNumbers);
    stack = new Stack<Squad>();
    dfs(0);
}


text:
Q: I'm trying to write a c program for sin x using Taylor series but not being able to figure out my mistake while executing the program Firstly I have defined pi  and a function called fact for finding factorial values.
Using Taylor series we have sin(x)= x-(x^3)/3! + (x^5)/5! - ....... upto 10th term.
nemo is the abbreviation for numerator and deno for denominator for the following terms.
Value stores the value of sin(x).
Here's the code that I have tried writing:
#include<stdio.h>
#include<math.h>

#define pi 3.142

int fact(int);

int main()
{
    int i, j;
    float x, value, nume, deno;
    printf("Enter the value for sin x in degrees: \t");
    scanf("%f", &x);
    x= (pi * x)/100;
    value = 0;
    i=1;
    while(i== 1)
        value = value+ x;
    i = 2;
    for(i=2; i<=10; i++)
    {
        while (i%2 !=0)
        {

            nume = pow(x,i);
            deno = fact(i);
            for(j = 2; j<i; j++)

                if(j%2 == 0)
                value = value - (nume/deno);
            else
                value = value + (nume/deno);

            nume = 0;
            deno = 0;
        }

    }
    printf("value of sin x is : \t");
    printf("%f", value);
    return 0;
}

int fact(int n)
{
    if(n==0)
        return 1;
    else
        return (n*fact(n-1));
}

Not being able to figure out what's going wrong. When I'm executing it only prints Enter the value of sin x in degrees Please help me to fix this code.


text:
Q: Installing JCOSap using maven on springboot I have an issue when I use maven for installing an external jar from SAP.I'm using springboot and I've gotten 2 scenarios with no success.
1- Using maven dependency directly from folder I get an exception and the jar is not added in BOOT-INF/lib folder. But on eclipse the jar is added in Maven Dependency
<dependency>
<groupId>com.sap.conn.jco</groupId>
    <artifactId>sapjco3</artifactId>
    <version>3.0.19</version>
    <scope>system</scope>
             <systemPath>/home/eder/workspace/obsekium/TesteSelenium/sapjco3.jar</systemPath>
</dependency>

Caused by: java.lang.NoClassDefFoundError: com/sap/conn/jco/ext/DestinationDataProvider

2- Using "mvn install:install-file" Maven changes jar's name and it causes an exception
 Factory method 'sapConector' threw exception; nested exception is java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.ExceptionInInitializerError: Illegal JCo archive "sapjco3-3.0.19-3.0.19.jar". It is not allowed to rename or repackage the original archive "sapjco3.jar".

How do I solve this issue?

A: You can try to use the following dependency and check whether it works.
<dependency>
    <groupId>com.sap.jco</groupId>
    <artifactId>sapjco</artifactId>
    <version>3.0.14</version>
</dependency>

You can find the details from the following link.
https://mvnrepository.com/artifact/com.sap.jco/sapjco/3.0.14
If you want, you can download the jar file and you can set the dependency as system path in maven.


text:
Q: Tableview need to be reloaded twice to update the data from textfield? I have question about the tableView.
Here is my tableView code
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return tierCount
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cellIdentifier = "InterestRateTableViewCell"
    guard let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as? InterestRateTableViewCell else {
        fatalError("The dequed cell is not an instance of InterestRateTableViewCell.")
    }

    cell.interestRateTextField.delegate = self
    cell.rowLabel.text = "\(indexPath.row + 1)."

    if let interestText = cell.interestRateTextField.text {
        if let interest = Double(interestText){
            interestRateArray[indexPath.row] = interest
        } else {
            interestRateArray[indexPath.row] = nil
        }
    } else {
        interestRateArray[indexPath.row] = nil
    }
    return cell
}

As you can see, I have the cellForRowAt method to get the value from the textfields in the cell, and assign to my arrays. (I actually have 2 textfields per cell.)
Basically, I let the users input and edit the textfield until they are happy then click this calculate button, which will call the calculation method. In the calculation method I call the "tableView.reloadData()" first to gather data from the textfields before proceed with the actual calculation.
The problem was when I ran the app. I typed values in all the textfields then clicked "calculate", but it showed error like the textfields were still empty. I clicked again, and it worked. It's like I had to reload twice to get things going.
Can anyone help me out?
By the way, please excuse my English. I'm not from the country that speak English.
edited: It may be useful to post the calculate button code here as someone suggested. So, here is the code of calculate button
     @IBAction func calculateRepayment(_ sender: UIButton) {

    //Reload data to get the lastest interest rate and duration values

    DispatchQueue.main.async {
        self.interestRateTableView.reloadData()
    }

    //Get the loan value from the text field
    if let loanText = loanTextField.text {
        if let loanValue = Double(loanText) {
            loan = loanValue
        } else {
            print("Can not convert loan value to type Double.")
            return
        }
    } else {
        print("Loan value is nil")
        return
    }

    tiers = []
    var index = 0
    var tier: Tier
    for _ in 0..<tierCount {
        if let interestRateValue = interestRateArray[index] {
            if let durationValue = durationArrayInMonth[index] {
                tier = Tier(interestRateInYear: interestRateValue, tierInMonth: durationValue)
                tiers.append(tier)
                index += 1
            } else {
                print("Duration array contain nil")
                return
            }
        } else {
            print("Interest rate array contain nil")
            return
        }
    }
    let calculator = Calculator()
    repayment = calculator.calculateRepayment(tiers: tiers, loan: loan!)
    if let repaymentValue = repayment {
        repaymentLabel.text = "\(repaymentValue)"
        totalRepaymentLabel.text = "\(repaymentValue * Double(termInYear!) * 12)"
    } else {
        repaymentLabel.text = "Error Calculating"
        totalRepaymentLabel.text = ""
    }
}

A: cellForRowAt is used for initially creating and configuring each cell, so the textfields are empty when this method is called.
UITableView.reloadData() documentation:
// Reloads everything from scratch. Redisplays visible rows. Note that this will cause any existing drop placeholder rows to be removed.
open func reloadData()

As it says in Apple's comment above, UITableView.reloadData() will reload everything from scratch. That includes your text fields.
There are a number of ways to fix your issue, but it's hard to say the best way without more context. Here's an example that would fit the current context of your code fairly closely:
class MyCustomTableViewCell: UITableViewCell {

    @IBOutlet weak var interestRateTextField: UITextField!

    var interestRateChangedHandler: (() -> ()) = nil

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        interestRateTextField.addTarget(self, action: #selector(interestRateChanged), for: UIControlEvents.editingChanged)
    }

    @objc
    func interestRateChanged() {
        interestRateChangedHandler?()
    }
}

and cellForRowAtIndex:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cellIdentifier = "InterestRateTableViewCell"
    guard let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as? InterestRateTableViewCell else {
        fatalError("The dequed cell is not an instance of InterestRateTableViewCell.")
    }

    cell.rowLabel.text = "\(indexPath.row + 1)."
    cell.interestRateChangedHandler = { [weak self] in
        if let interestText = cell.interestRateTextField.text {
            if let interest = Double(interestText){
                self?.interestRateArray[indexPath.row] = interest
            } else {
                self?.interestRateArray[indexPath.row] = nil
            }
        } else {
            self?.interestRateArray[indexPath.row] = nil
        }
    }

    return cell
}


text:
Q: Jodatime/Spring MVC/Jackson | DateTime formatting issue When I use the @ResponseData JodaTime is converted into it's full object state, even though I have a custom serializer in place.
Configuration:
Spring 3.1.2
Jackson 1.9.11
<dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-core-asl</artifactId>
    <version>${jackson.version}</version>
</dependency>
<dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-mapper-asl</artifactId>
    <version>${jackson.version}</version>
</dependency>

Custom Serializer:
public class JodaDateTimeJsonSerializer extends JsonSerializer<DateTime> {

    //TODO Bad (hard) code. This should be part of a global system setting through ConfigurationService
    private static final String dateFormat = ("dd/MM/yyyy");

    private static Logger logger = LoggerFactory.getLogger(JodaDateTimeJsonSerializer.class);

    @Override
    public void serialize(DateTime date, JsonGenerator gen, SerializerProvider provider)
            throws IOException, JsonProcessingException {

        String formattedDate = DateTimeFormat.forPattern(dateFormat).print(date);
        logger.debug("Converted date string: {}", formattedDate);
        gen.writeString(formattedDate);
    }
}

Dispatcher:
 <mvc:annotation-driven />

Usage:
@JsonSerialize(using=JodaDateTimeJsonSerializer.class)
    public DateTime getExpiryDate() {
        return expiryDate;
    }

The output I'm getting is similar to this:
"dateCreated":{"monthOfYear":12,"yearOfEra":2012,"yearOfCentury":12,"centuryOfEra":20,"millisOfSecond":359,"millisOfDay":53080359,"secondOfMinute":40,"secondOfDay":53080,"minuteOfHour":44,"minuteOfDay":884,"hourOfDay":14,"weekyear":2012,"weekOfWeekyear":51,"year":2012,"dayOfMonth":19,"dayOfWeek":3,"era":1,"dayOfYear":354,"chronology":{"zone":{"fixed":false,"cachable":false,"id":"Asia/Riyadh"}},"millis":1355917480359,"zone":{"fixed":false,"cachable":false,"id":"Asia/Riyadh"},"afterNow":false,"beforeNow":true,"equalNow":false},"dateModified":{"monthOfYear":12,"yearOfEra":2012,"yearOfCentury":12,"centuryOfEra":20,"millisOfSecond":359,"millisOfDay":53080359,"secondOfMinute":40,"secondOfDa

Where I want a simple dd/mm/yyyy date.
Please advice.
Additionally, how can I set this formatting rule globally where I don't have to use @JsonSerialize all the time.

A: This link helped with the situation.
Basically you need a Serializer and custom object mapper for jackson.
The serializer:
public class JodaDateTimeJsonSerializer extends JsonSerializer<DateTime> {

    private static final String dateFormat = ("dd/MM/yyyy");

    private static Logger logger = LoggerFactory.getLogger(JodaDateTimeJsonSerializer.class);

    @Override
    public void serialize(DateTime date, JsonGenerator json, SerializerProvider provider)
            throws IOException, JsonProcessingException {

        String formattedDate = DateTimeFormat.forPattern(dateFormat).print(date);
        json.writeString(formattedDate);
    }
}

Custom Object Mapper:
public class CustomJacksonObjectMapper extends ObjectMapper {

    public CustomJacksonObjectMapper(){
        CustomSerializerFactory factory = new CustomSerializerFactory();
        factory.addSpecificMapping(DateTime.class, new JodaDateTimeJsonSerializer());
        this.setSerializerFactory(factory);
    }

}

Now register the Custom mapper with MVC
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:p="http://www.springframework.org/schema/p"
        xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
    <mvc:annotation-driven>
            <mvc:message-converters>
                <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
                    <property name="objectMapper" ref="customJacksonMapper" />
                </bean>
            </mvc:message-converters>
        </mvc:annotation-driven>

And that works.

A: There is a jackson-datatype-joda module which can be used for this - see my answer here: https://stackoverflow.com/a/14185077/125246

A: As paulcm mentioned there is jackson jodatype module which will allow serialization without @JsonSerializer. You can check working configuration here https://stackoverflow.com/a/14399927/1134683


text:
Q: Displaying count down timer in Sencha Touch 2 I need to display a countdown timer, implemented it using delayed task.
code as below:
var task = Ext.create('Ext.util.DelayedTask', function() {

if (sec < 1 && min > 0) {
    min--;
    sec = 60;
}
if (min == 0 && sec == 1) {
    task.cancel();
}
sec--;
Ext.getCmp('minute').setHtml(min);
Ext.getCmp('second').setHtml(sec);
console.log('minute is' + min + 'second is' + sec);

task.delay(1000);

}, this);

task.delay(1000);

With the above implementation, function gets called only once.
Looking at the discussion at this thread
Auto Refresh the List in Sencha Touch Application the above code should work. But, it is not working. What could be wrong in my code? Thanks.

A: As far as I know, Ext.util.DelayedTask is meant for delaying a task without executing it.
This can be useful for delaying an Ajax-call on a form, as you can see in the docs:

This method is especially useful for things like detecting whether a user has finished typing in a text field. [..] You can use this class to buffer the keypress events for a certain number of milliseconds, and perform only if they stop for that amount of time.

Why don't you just use a regular setTimeout? Something like http://jsfiddle.net/EreaP/ works perfectly.

A: Late response:
Ext.define('MyApp.view.TimerClock', {
    extend: 'Ext.Container',
    xtype: 'timerClock',
    duration: 3 * 60 * 60, //default to 3 hour
    paused: false,
    clockIntervalHook: undefined,
    config: {
        listeners: {
            initialize: function () {
                this.start();
            }
        }
    },
    start: function () {
        var me = this,
            duration = me.duration,
            updateClock = function () {
                if (me.isPaused()) {
                    return;
                }
                me.setHtml(me.formatTime(duration--));
                if (duration <= 0) {
                    me.stop();
                }
            };
        me.clockIntervalHook = setInterval(updateClock, 1000);
        return me;
    },

    pause: function () {
        this.paused = true;
        return this;
    },

    isPaused: function () {
        return this.paused == true
    },

    resume: function () {
        this.paused = false;
    },

    restart: function () {
        this.stop();
        this.start();
    },

    stop: function () {
        clearInterval(this.clockIntervalHook);
        return this;
    },

    //format the given seconds into "HH:MM:SS" format
    //override this if you need custom behavior
    formatTime: function (seconds) {
        var hours = Math.floor(seconds / 3600);
        hours = hours <= 9 ? "0" + hours : hours;
        seconds %= 3600;
        var minutes = Math.floor(seconds / 60);
        minutes = minutes <= 9 ? "0" + minutes : minutes;
        seconds %= 60;
        seconds = seconds <= 9 ? "0" + seconds : seconds;
        return hours + ":" + minutes + ":" + seconds
    }
});

Any other view, add the timer simply using
{ xtype : 'timerClock' }


text:
Q: Add content in to the Webview? Is any way to add the Html contents in to the webview through the Main Xml file.
I have a one problem.I'm new in the android field,I load the contents from the assets file and normally the webview contents visible but when i going to swipe the page ,that contents not visible only containing black page ,after swipe next page visible...
so ,anyone give me the tips how to solve this problem.
advance in Thanks...

A: Check this.....
https://developers.google.com/chrome/mobile/docs/webview/gettingstarted
how to show the html contents to the webview using android

A: I think this link can help you: Displaying Android asset files in a WebView?
However, you should give us more information. If you want to view an external URL, you will need to add permisions on the Android Manifest. If that is not your case and your content is local, maybe the problem is inside your Webpage.


text:
Q: Android RecyclerView not updating TextView I want to change asynchronous data in a recycler View.
When method SetText() is called, nothing happens until I scroll.
class MainAdapter extends RecyclerView.Adapter<MainAdapter.MyViewHolder> {
    private Context context;
    private SortedList<City> items;

    public MainAdapter(Context context) {
        this.context = context;
    }

    public void add(City item){
        items.add(item);
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View row = LayoutInflater.from(context).inflate(R.layout.row, parent, false);
        return new MyViewHolder(row);
    }

    @Override
    public void onBindViewHolder(final MyViewHolder holder, final int position) {
        holder.tvTitle.setText(String.format("%d %s", items.get(position).getId(), items.get(position).getName()));

        Observable<String> observable = Observable.create(new Observable.OnSubscribe<String>() {
            @Override
            public void call(Subscriber<? super String> subscriber) {
                try {
                    //Do somethin in Background
                    Thread.sleep(3000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                subscriber.onNext(items.get(position).name);
                subscriber.onCompleted();
            }
        }).subscribeOn(Schedulers.computation());

        observable.subscribe(new Subscriber<String>() {
            @Override
            public void onCompleted() {
            }

            @Override
            public void onError(Throwable e) {
            }

            @Override
            public void onNext(String text) {
                holder.tvRowText.setText(text);
            }
        });
    }

    @Override
    public int getItemCount() {
        return items.size();
    }

    @Override
    public void onAttachedToRecyclerView(RecyclerView recyclerView) {
        super.onAttachedToRecyclerView(recyclerView);
    }

    static class MyViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.row_title)
        public TextView tvTitle;

        @BindView(R.id.row_text)
        public TextView tvRowText;

        MyViewHolder(View row) {
            super(row);
            ButterKnife.bind(this, row);
        }
    }
}

What am I doing wrong?
Calling notifyDatachanged(i) in onNext() is not working.

A: try using below code:
holder.tvRowText.setText(text);

inside a post call (which will run it on UI thread) like this:
holder.tvRowText.post(new runnable... emitted for brevity){
holder.tvRowText.setText(text);
}


text:
Q: "too many arguments" in VSC terminal I am having "cd: too many arguments" in VSC terminal when I try to run simple helloworld (in C). This is the code. I am using code runner to run my code inside VSC.
#include<stdio.h>

int main()
{
   printf("Hello World");
   return 0;
}

And this is the error:
bash: cd: too many arguments

A: Used this settings.json to fix the problem. And it worked.
{
    "code-runner.saveAllFilesBeforeRun": true,
    "code-runner.saveFileBeforeRun": true,
    "code-runner.runInTerminal": true
    "C_Cpp.updateChannel": "Insiders",
    "http.proxySupport": "off"

}


text:
Q: request.getParameter() returns null while uploading file I'm trying to save a form info to a mysql database using J2EE and eclipse in Windows 10. I'm having this problem request.getParameter() returns null even though i used the same name in the form. The server shows no errors and I don't know what to do next. Here's my  HTML Code.
   <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
        <!DOCTYPE html>

   <meta charset="UTF-8">
   <title>Insert title here</title>

Don

        <form method="post" action="Fund" enctype="multipart/form-data">

                     Titre :
                    <input type="text" name="titre" size="50"/>

                     Cause :
                    <input type="text" name="cause" size="50"/>

                     Ammount :
                    <input type="text" name="ammount" size="50"/>

                     Story:
                    <input type="text" name="story" size="50"/>

                     Photo:
                    <input type="file" name="image" size="50"/>

                        <input type="submit" value="Save">

        </form>

Here's the Fund.java code
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.Part;

/**
 * Servlet implementation class Don
 */
@WebServlet("/Fund")
public class Fund extends HttpServlet {

    //database connection settings

    private String dbURL = "jdbc:mysql://localhost:3306/userdb";
    private String dbUser = "root";
    private String dbPass = "root";

    private static final long serialVersionUID = 1L;

    /**
     * Default constructor.
     */
    public Fund() {
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        response.getWriter().append("Served at: ").append(request.getContextPath());
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String titre = request.getParameter("titre");
        String cause = request.getParameter("cause");
        String ammount = request.getParameter("ammount");
        String story = request.getParameter("story");

        System.out.println(titre);

        InputStream inputStream = null;

        Part filePart = request.getPart("image");

        System.out.println(filePart);
        if(filePart != null) {
            System.out.println("here");
            System.out.println(filePart.getName());
            System.out.println(filePart.getSize());
            System.out.println(filePart.getContentType());

            inputStream = filePart.getInputStream();
        }

        Connection conn = null;
        String message = null;

        try {
            DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());
            conn = DriverManager.getConnection(dbURL,dbUser,dbPass);

            String querySetLimit = "SET GLOBAL max_allowed_packet=104857600;";  // 10 MB
            Statement stSetLimit = conn.createStatement();
            stSetLimit.execute(querySetLimit);

            String sql = "INSERT INTO don (title, cause, ammount, story, image) values (?,?,?,?,?)";
            PreparedStatement statement = conn.prepareStatement(sql);
            statement.setString(1, titre);
            statement.setString(2, cause);
            statement.setString(3, ammount);
            statement.setString(4, story);

            if(inputStream != null) {
                statement.setBlob(5, inputStream);
            }

            int row = statement.executeUpdate();
            if(row > 0) {
                message ="File uploaded and saved into database";
            }

        } catch (SQLException e) {
            message = "ERROR: " + e.getMessage();
            e.printStackTrace();
        }finally {
            if(conn != null) {
                try {
                    conn.close();
                } catch (SQLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            request.setAttribute("Message",message);

            getServletContext().getRequestDispatcher("/Message.jsp").forward(request, response);
        }

    }
}

Please help me out I don't know what to do thank you


text:
Q: Exporting diectory structure to csv/xl file my requirement is to  enumerate all directories and specific .tif files (that are at the end of the structure). Sample is
                         A (path selected from UI) <has>
                   B<has>             and              C<has>
       D <has>         E           F              G             H      I        J
K         L<has>
       1.tif   2.tif

In the above directory, A has B and C. Named as clients. B has D,E,F (as dated), D has K and L (family).
So Ineed your help in retrieving the directory structure in txt or excel file as
B                  D
                       K    0
                       L    2 (since there are two tif files)

                   E
                   F

Similary for c and other directories.

A: I am not sure that I understand what you want but here is something that to get you started
    private static void ProcessFolder(string folder, string level, string separator, StreamWriter output)
    {
        var dirs = Directory.GetDirectories(folder);
        foreach ( var d in dirs )
        {
            output.Write(level);
            output.WriteLine(d);
            ProcessFolder(d, level + separator, separator, output);
        }
        Console.WriteLine();
        var files = Directory.GetFiles(folder);
        foreach ( var f in files )
        {
            output.Write(level);
            output.WriteLine(f);
        }
    }

You will have to customize it to filter TIFF or whatever you want. You can call this function like this and it will generate the file
        using ( var output = new StreamWriter(@"C:\test.csv") )
        {
            ProcessFolder(@"c:\Program files", "", ";", output);
        }

Double-click on the generated file and Excel will probably open :)

A: Maybe this would do the trick (or give at least a good start point):
public void OutputStructureToFile(string outputFileName, string folder, string searchPattern)
{
    using (var file = new StreamWriter(outputFileName))
    {
        file.Write(GetStructure(new DirectoryInfo(folder), searchPattern));
    }
}

public string GetStructure(DirectoryInfo directoryInfo, string searchPattern)
{
    return GetStructureRecursive(directoryInfo, searchPattern, 0);
}

private string GetStructureRecursive(DirectoryInfo directoryInfo, string searchPattern, int level)
{
    var sb = new StringBuilder();

    var indentation = level * 5;

    sb.Append(new String(' ', indentation));
    sb.AppendLine(directoryInfo.Name);

    foreach (var directory in directoryInfo.GetDirectories())
    {
        sb.Append(GetStructureRecursive(directory, searchPattern, level+1));
    }

    var groupedByExtension = directoryInfo.GetFiles(searchPattern)
                                          .GroupBy(file => file.Extension)
                                          .Select(group => new { Group = group.Key, Count = group.Count() });

    foreach (var entry in groupedByExtension)
    {
        sb.Append(new String(' ', indentation));
        sb.AppendLine(String.Format("   {0,10} {1,3}", entry.Group, entry.Count));
    }

    return sb.ToString();
}

And if you need it for Excel as a .csv file you should instead use this recursive function
private string GetStructureRecursiveForCsv(DirectoryInfo directoryInfo, string searchPattern, int level)
{
    var sb = new StringBuilder();

    var indentation = level;

    sb.Append(new String(';', indentation));
    sb.AppendLine(directoryInfo.Name);

    foreach (var directory in directoryInfo.GetDirectories())
    {
        sb.Append(GetStructureRecursiveForCsv(directory, searchPattern, level+1));
    }

    var groupedByExtension = directoryInfo.GetFiles(searchPattern)
                                          .GroupBy(file => file.Extension)
                                          .Select(group => new { Group = group.Key, Count = group.Count() });

    foreach (var entry in groupedByExtension)
    {
        sb.Append(new String(';', indentation));
        sb.AppendLine(String.Format(";{0};{1}", entry.Group, entry.Count));
    }

    return sb.ToString();
}


text:
Q: Heuristic for lower bounding the time for integer factorization? I am posting this question here in hope that someone finds this heuristic useful, and maybe someone with more experience will make use of this:
As @GerryMyerson suggested here is a statement of what I am trying to prove:
There is no "simplified" algorithm, which can factor integers in polynomial time. The word "simplified" is described in more detail below.
First notice that $\exists d: 1 < d < n , d | n$ is equivalent to $\exists x: 1 < \gcd(x,n) < n$.
Let $A$ be a general purpose factorization algorithm which in every step $1,\cdots,t$ draws a number without replacement $a_i \in \mathbb{N}$ from the urn $\{m_n,m_n+1,\cdots,M_n-1,M_n\}$ and tests if $ 1 < \gcd(a_i,n) < n$ ($A$ = "simplified" algorithm).
Besides the heuristic, that the numbers are drawn without replacement, some general purpose algorithms operate this way, for example the Fermat - Factorization, trial divison, or even Quadratic sieve.
The point here is that the algorithm generates "candidate" numbers $a_i$ in each step and tests if those number represent a "solution". Let $Y$ be the waiting time until the first $a_i$ is found with $1 < \gcd(a_i,n) < n$, after which the algorithm stopps and prints $\gcd(a_i,n)$.
Let $d_n$ count the number of $k$, $m_n \le k \le M_n$ such that $1 < \gcd(a_k,n) < n$ and $N_n = M_n-m_n+1$. Then we will have
$$d_n \approx N_n ( \frac{1}{p}+\frac{1}{q}-\frac{1}{n})$$
if $n=pq$ is the prime decomposition of $n$. Letting
$$p \approx q \approx \sqrt{n}$$
we get
$$d_n \approx N_n ( \frac{2}{\sqrt{n}}-\frac{1}{n})$$
The random variable $Y$ is negatively hypergeometrically distributed with expected value:
$$t = E[Y] = \frac{N_n+1}{d_n+1} \approx \frac{N_n}{d_n}$$
a) Suppose $t \le \log(n)^c$ is an upper bound on the expected runtime of the algorithm. Then:
$$ 1 \le \log(n)^c (\frac{2}{\sqrt{n}}-\frac{1}{n}) \rightarrow 0$$
for $n \rightarrow \infty$, which is impossible. Hence no such upper bound can exist.
b) If $t\le \sqrt{n}$ is an upper bound, then
$$ 1 \le \sqrt{n}(\frac{2}{\sqrt{n}}-\frac{1}{n}) = 2 - \frac{1}{\sqrt{n}} $$
which has for $n \rightarrow \infty$ limit $=2$ and hence no contradiction arises.
c) If $t \le \exp(\sqrt{\log(n)\log(\log(n))})$ then we will get similar to a) a contradiction $1 \le 0$. Hence sub-exponential time can not be reached with "simplified" algorithms. (Since Quadratic Sieve has sub-exponential time, this means, either that "simplified" algorithms are too restrictive, or that one has first to do a de-randomization, if possible, of the "simplified" algorithm.)
My question is, if you can think of better ways, more rigorous, to replace various steps in this heuristic with more robust arguments?
Thanks for your help!


text:
Q: Local file path does't work in Chrome browser I have an issue with my inline javascript which is in html page.
I'm using following code in the javascript.
ifrm.document.write('<link rel="stylesheet" type="text/css" href="file:///C:/Project-2/parent.css">');
This works perfectly fine on all the browsers, but not with Chrome.
Is there any workaround?
Thanks

A: Yes relative paths would be the way to go here. As of right now if you tried to deploy this page to the web then none of the links would work (assuming you're referencing files that reside on your PC via absolute paths).
Here is some good material explaining absolute vs. relative pathing: http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/


text:
Q: Imagen de fondo figura primero al hacer onclick Buenas no entiendo porque me figura la imagen de fondo al hacer onclick en una imagen es como si la opacidad me este dando en ambas fotos.
Este es el div que contiene la imagen

y este es la funcion cuando hace onclick
var src = document.getElementById("image").src;
                document.getElementById("divhidden").style.visibility="visible";
                document.getElementById("backimg").src=src;

y este el div que contiene la imagen que se abre

CSS

/*DIV que contiene image*/
.imgs:hover {
    width: 25%;
    border: 1px solid #FFFFFF;
    height: 557px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    float: left;
 background-color: orangered;
}
/*imagen*/
.image:hover{
 opacity: 0.8;
 cursor: zoom-in;

}
/*Figure*/
.figure{
    width: 30%;
    text-align: center;
 position: fixed;
}
/* container 2 que contiene figure y imagen a mostrar al hacer click*/
.container2{
    width: 100%;
    height: 100%;
    position: absolute;
    align-items: center;
 background: rgba(0,0,0,0.4);
 visibility: hidden;
 cursor: zoom-out;
}

queda asi
al sacar el puntero de la imagen queda bien

A: No creo entender muy bien como estás formulando tu pregunta, pero según entiendo leyendo el código, quieres que al hacer click en una imagen ésta se sustituya en el div divhidden

function imgvis(e){
  var src = e.src;
  document.getElementById("divhidden").style.visibility="visible";
  document.getElementById("backimg").src=src;
}


text:
Q: Как сделать такую фигуру
Помогите пожалуйста сделать такую фигуру особенно border такого цветас прозрачностью вначале

A: Как вариант:

body {
  background-color: rgba(0, 0, 0, 0.75);
  font-family: sans-serif;
}

.arrow {
  position: relative;
  border-style: solid;
  border-width: 7px 0;
  padding: 20px 30px;
  border-image: linear-gradient(to right, transparent, #c49107 15%);
  border-image-slice: 1;
  color: white;
  width: 320px;
}

.arrow:after {
  content: "";
  border-style: solid;
  border-color: transparent #c49107 #c49107 transparent;
  border-width: 6px;
  position: absolute;
  right: -25px;
  top: 3px;
  transform: rotate(-45deg);
  width: 40px;
  height: 40px;
}

Регистрируйся иначе все пропустишь


text:
Q: Show that a certain solution of an ODE is a stochastic process. I am working on an exercise as follows:

Let $v_{1}, v_{2}:\mathbb{R}^{2}\longrightarrow\mathbb{R}^{2}$ be $C^{\infty}$ vector fields over $\mathbb{R}^{2}$. Let $(X_{n})_{n\in\mathbb{N}}$ be an i.i.d positive sequence, and set $S_{n}:=X_{1}+\cdots+X_{n}$. Define $N_{t}:=\sup\{n:S_{n}\leq t\}$.
Let $i(n)=1$ if $n$ is odd and $i(n)=2$ if n is even. Let $Z_{t}$ denote the solution of ODE $$\dfrac{d}{dt}Z_{t}=v_{i(N_{t})}(Z_{t}),\ Z_{0}=x.$$ Show that $(Z_{t})_{t\geq 0}$ is a stochastic process.

To show $(Z_{t})_{t\geq 0}$ is a stochastic process, we need to show that $Z_{t}$ is a random variable for each $t$. That is, if the probability space is $(\Omega,\mathcal{F},\mathbb{P})$, we need to show $$\{\omega:Z_{t}(\omega)\leq r\}\in\mathcal{F}\ \text{for all}\ r\in\mathbb{R}.$$
But how could I connect this with the ODE??
Thank you!
Edit 1:
Okay I figured it out. This is not a really straightforward proof. Also this exercise is really loosely stated. I will talk about the reformulation of this exercise, and what we need to assume.
Also, I need to clarify that, any argument using the probability theory here is not really useful, since we don't really know if $Z_{t}$ is a random variable or not. So anything written out will be purely functional analysis, or ODE analysis. The thing similar to random walk will not be a random walk since $Z_{t}$ may not be random at all, so it is also not really doable by using SLLN or something like that.
In addition, the differential equation in the exercise is not stochastic differential equation. I think it is called Random ODE, or something like that.
I will answer my own question to post my proof.
It is also really appreciated if anyone could post their proof, since the bounty will otherwise be wasted...
I believe there must be a better proof than mine :)

A: I believe that, to make the notation less confusing, $Z_{t}$ should be stated as the solution of the ODE as $$\dfrac{dx}{dt}=v_{i(N_{t})}(x),\ \ x(t_{0})=x_{0}.$$
The RHS of the above equation can be written as $g(x, N_{t}(\omega))$.
Note that since counting process is right continuous, in this proof, for the argument using continuity, we can always pass the argument over the rational number,  conclude an almost surely result.
Therefore, let's just assume here $N_{t}(\omega)$ has continuous sample path. This can help us a lot since by hypothesis $v_{1}, v_{2}$ are both $C^{\infty}$ on $\mathbb{R}^{2}$, and therefore we can assume that $g$ is continuous in both $x$ and $t$.
Fix a sample path, i.e. $G(t,x):=g(x,N_{t}(\omega))$ and then we can consider the initial value problem (IVP) $$\dfrac{dx}{dt}=G(t,x),\ x(t_{0})=x_{0},$$ where $G$ is continuous.
In fact, the vector filed $G$ in the IVP also depends on $\omega$, so we should rewrite the IVP as $$\dfrac{dx}{dt}=G(\omega,t,x),\ x(t_{0})=x_{0}.$$ In particular, $G$ is measurable in $\omega$ and continuous in $(t,x)$, since $G(\omega, t,x):=g(x,N_{t}(\omega))$ and $g$ is continuous in both variables, and $N_{t}(\omega)$ is measurable in $\omega$ and has continuous sample path.

Now, suppose the $Z_{t}$ in the exercise is the unique solution of the
  IVP, denoted it by $x(t,\omega)$. Then I claim that the mapping
  $\Omega\longrightarrow\mathbb{R}$ defined by $\omega\mapsto
 x(t,\omega)$ is measurable for each $t$.

Proof:
Indeed, choose and fix a continuous function $x_{0}(t):[t_{0}, T]\longrightarrow\mathbb{R}$ such that $x_{0}(t_{0})=x_{0}$. Define a sequence of functions $x_{n}:[t_{0}, T]\times\Omega\longrightarrow\mathbb{R}$ by $$x_{n+1}(t,\omega):=x_{0}+\int_{t_{0}}^{t}G(\omega, s, x_{n}(s,\omega))ds.$$
Then it follows from Arzela Selection theorem (along with the equi-continuity) that $$x(t,\omega)=\lim_{n\rightarrow\infty}x_{n}(t,\omega)\ \text{for all}\ \omega\in\Omega.$$
(See any proof of Peano's Existence Theorem, the argument is similar).
Hence it suffices to prove that the mappings $x_{n}(t,\cdot):\Omega\longrightarrow\mathbb{R}^{d}$ are measurable for all $t\in [t_{0},T]$ and $n\in\mathbb{N}$, which can be done by induction.
Firstly, it is clear that the statement holds for $n=0$. Next, suppose that for some $n\in\mathbb{N}$ and all $t\in[t_{0}, T]$, the function $x_{n}(t,\cdot):\Omega\longrightarrow\mathbb{R}$ is measurable. Define $x_{n}^{(k)}:[t_{0}, t)\times\Omega\longrightarrow\mathbb{R}^{d}$ by $$x_{n}^{(k)}(s,\omega)=\sum_{i=0}^{k-1}\mathbb{1}_{[\frac{it}{k},\frac{(i+1)t}{k})}(s)\cdot x_{n}\Big(\dfrac{it}{k},\omega\Big),\ \text{for all}\ (s,\omega)\in [t_{0}, t)\times\Omega.$$
Using the fact that $G:\mathbb{R}^{d}\longrightarrow\mathbb{R}^{d}$ is a continuous function, we know that $$\lim_{k\rightarrow\infty}\int_{t_{0}}^{t}G(\omega, s, x_{n}^{(k)}(s,\omega))dx=\int_{t_{0}}^{t}G(\omega, s, x_{n}(s,\omega))ds.$$
Therefore, the mapping $\omega\mapsto \int_{t_{0}}^{t}G(s, x_{n}(s,\omega))ds$ is $\mathcal{B}(\mathbb{R})-$measurable for each $t\in[t_{0}, T]$, which implies that the function $x_{n+1}(t,\cdot)$ is $\mathcal{B}(\mathbb{R})-$measurable of each $t\in[t_{0}, T]$.
By induction, the mapping $x_{n}(t,\cdot)$ is $\mathcal{B}(\mathbb{R})-$measurable for all $t\in [t_{0}, T]$ and $n\in\mathbb{N}$.

Note that the above results also holds if the initial value is measurable, i.e., a random variable with values $x_{0}(\omega)$.


text:
Q: Change 'createOptions' of edgeAgent and edgeHub using code Is there a way to make changes to the createOptions of the "edgeHub" module using code?
I know how to do it using the Azure Portal: Set Modules -> Runtime Settings -> CreateOptions

Is there an API that I could use for that?
Example: The AzureCLI has az iot edge deployment create (but it does not let me edit system modules:
az iot edge deployment create --deployment-id $deploymentId --hub-name $hubName --content $contentPath --target-condition $targetCondition --layered
Maybe the C# Client has a way to do it or there is a REST API accessible. Any ideas?

A: just use this command and you are good to go: az iot edge set-modules --device-id $deviceId --hub-name $hubName --content $deploymentFilePath
Also check this link at https://learn.microsoft.com/de-de/azure/iot-edge/how-to-deploy-modules-cli

A: deployment.template.json has a key called createOptions where you can mention the same values as done in the portal. And then you can build and push your container image on container registry. After that, deployment can be done for that edge device.


text:
Q: SQL table1 row_id not show table2 row_id Below is my SQL query
select c.course_id,c.course_title,c.course_credits,c.course_status from
 course c,(select course_id from completed_course
 where student_id='1229CSE00241') as a
 where c.course_id!=a.course_id

But it show all row of a courses also but I want only courses of c which
 doesn't in courses of a.

A: select
c.course_id,
c.course_title,
c.course_credits,
c.course_status
from course c
where
c.course_id NOT IN (select course_id from completed_course where student_id='1229CSE00241');

A: select c.course_id,
c.course_title,
c.course_credits,
c.course_status
from course c where c.course_id not in
(select course_id from completed_course where student_id='1229CSE00241')


text:
Q: Making spaces irrelevant in a .bat file I am running into a bit of a problem in my batch script. I know that /I makes the IF statement not cap sensitive but is the something similar to making it not space sensitive?

A: After you have your talk variable defined, you can use string substitution to remove the spaces. Like following:
set "_temp=%talk: =%"

Then you use the %_temp% variable to make your IF comparison.
Hint: The double quotes around the full set command is just to make your variable declaration more precise, avoiding unwanted following spaces.
Source:
http://www.dostips.com/DtTipsStringManipulation.php

A: There is no need to remove the spaces. Just put double-quotes around both expressions to compare:
if /I "%talk%"=="How are you" goto HOWAREYOU

The double-quotes also avoid trouble with other characters special to command prompt (like SPACE, TAB, ,, ;, =, ^, &, (, ), <, >, |).

A: You could use findstr with conditional execution to perform a regular expression match.
setlocal enabledelayedexpansion
echo(!talk! | findstr /i "how *are *you" && (
    rem Match.
) || (
    rem No match.
)

Delayed expansion prevents premature evaluation of the contents of the variable (user entered an ampersand or whatever).  Using echo( with the parenthesis prevents evaluation of user entry of /?.


text:
Q: Does file() lock the file when reading? I'm using file() to read through a file like an array with tabs. I want to lock the file but I cannot seem to get flock() working on the file. Is it possible to do this? If so, how? If not, does the file() lock the file from the start and alleviate any potential sharing problems?

A: According to the documentation (specifically the comments), it won't read a file that was locked via flock.
You have 2 alternatives.

*

*Read the file with fgets (without checks for errors):
$f = fopen($file, 'r');
flock($f, LOCK_SH);
$data = array();
while ($row = fgets($f)) {
    $data[] = $row;
}
flock($f, LOCK_UN);
fclose($f);

*Read the file with file() and using a separate "lockfile":
$f = fopen($file . '.lock', 'w');
flock($f, LOCK_SH);
$data = file($file);
flock($f, LOCK_UN);
fclose($f);
unlink($file . '.lock');


text:
Q: If a harddisk has format errors, would running disk wipe on it still wipe everything? If a hardisk is connected via USB to Windows and I attempt to open it, Windows says it needs to be formatted before it can be used. If I ignore this message and run disk wipe on it (like the cipher command line tool from Microsoft), will it work? Or will the lack of formatting mean that not everything will be wiped?

A: Apparently cipher is a program the fill the unused space of a filesystem (by writing a file of random data that takes up all of that, I assume), so no, you can't get a block of the partition / disk overwritten with the program if it isn't considered "recognizably formatted" / a mountable volume by Windows.
If you really want to zero-fill every block of a disk, use clean all and diskpart.
If you want to on block-level zero-fill only a partition (so that you can keep the partition table, and maybe data on other partitions or the gaps, if any, in between), or random-fill instead, consider programs available in Cygwin / msys2, e.g. dd, shred or even openssl enc. (I'm not exactly a "keen" Windows user so I don't have "native" equivalence in my knowledge.)

A: For wiping purposes you can ignore that message.
To wipe a hard drive you don't need a formated partition on it. Once you have full access to the drive you just use a wiping program that is overwritting sector by sector. After reading the description of the "cipher" command in Windows 7 I do not consider this as a wiping tool.
The security of wipe actions like "ATA Security Ease" depend on its implementation.
when dealing with solid state drives it provides a certain hope that triggering that action might reach and wipe storage that your computer has no access to.
As for your comment:

The cipher has a /w switch to wipe so I think it works.

No that is just a partly wipe with one partition of a disk. This is far away from "disk wiping".


text:
Q: how to get selected rows values in angular infragistics grid UI I'm using angular Infragisics grid in angular typescript 12 and I want to display all the selected rows from the igx-grid when I click a button.
Here is what I tried but I get an empty array and no data is displayed.
Here is the HTML code
<igx-grid

#grid id="grid" [rowSelection] ='"multiple"'  primaryKey="prID" rowHeight="35px" displayDensity="compact" [data]="listeproduits"  [autoGenerate]="false" height="380px" [allowFiltering]="true" >

 <igx-column  field="code"  header="Code"></igx-column>
 <igx-column  field="name"   header="name"></igx-column>

 </igx-grid>

and here is where I try to print the selected value

export class productComponnet implements OnInit {

  @ViewChild("grid") public grid!: IgxGridComponent;

selected_rows()
  {
    console.log(this.grid.selectedRows);
  }
}