text:
Q: Deploy Tkinter : error loading Python dll/ LoadLibrary I am trying to freeze my tkinter application. But I have this problem that suddenly appears. The apps I had freeze don't open either. How can I solve this problem?

I have a second question: if I freeze with cx_freeze, can I open it on another computer that doesn't have python?

A: Refer to this issue on Github,And I found a solution:

Solution: paths were missing from my PATH. Using the Anaconda Prompt fixed the issue. Then I copied the anaconda paths from echo %PATH%, and I can now run it everywhere, after adjusting the local PATH.

if I freeze with cx_freeze, can I open it on another computer that doesn't have python

If it could work normally in your PC, it could work well mostly on another computer with windows system.


text:
Q: Strange - select statement doesn't work with List and works with List In below code, we can observe that 'actionPlanTempList' contains an ID 'a076F00000uedBaQAI'. Also ap_Action_Plan_Task_Dependency__c object also contains records for Action_Plan_Template__c=a076F00000uedBa. However 3rd Select statement returns nothing.
System.debug('actionPlanTempList - '+actionPlanTempList);
//returns: actionPlanTempList - (a076F00000uedBaQAI)

List<ap_Action_Plan_Task_Dependency__c> allldependencyList
    = [Select ID, Action_Plan_Template__c, Dependent_Task__c, Dependent_On_Task__c From ap_Action_Plan_Task_Dependency__c];

System.debug('allldependencyList - '+allldependencyList);
//returns: allldependencyList - (ap_Action_Plan_Task_Dependency__c:{Id=a096F00002LKwSSQA1, Action_Plan_Template__c=a076F00000uedBa, Dependent_Task__c=a086F00002DtsfCQAR, Dependent_On_Task__c=a086F00002DtsfAQAR}, ap_Action_Plan_Task_Dependency__c:{Id=a096F00002LKwScQAL, Action_Plan_Template__c=a076F00000uedBa, Dependent_Task__c=a086F00002DtsfoQAB, Dependent_On_Task__c=a086F00002DtsfCQAR}, ap_Action_Plan_Task_Dependency__c:{Id=a096F00002LKwSIQA1, Action_Plan_Template__c=a076F00000uedBa, Dependent_Task__c=a086F00002DtsfBQAR, Dependent_On_Task__c=a086F00002DtsfAQAR}, ap_Action_Plan_Task_Dependency__c:{Id=a096F00002LKwShQAL, Action_Plan_Template__c=a076F00000uedBa, Dependent_Task__c=a086F00002DtsfoQAB, Dependent_On_Task__c=a086F00002Dtsf0QAB}, ap_Action_Plan_Task_Dependency__c:{Id=a096F00002LKwSXQA1, Action_Plan_Template__c=a076F00000uedBa, Dependent_Task__c=a086F00002DtsfoQAB, Dependent_On_Task__c=a086F00002DtsfBQAR})

List<ap_Action_Plan_Task_Dependency__c> dependencyList
    = [Select ID, Action_Plan_Template__c, Dependent_Task__c, Dependent_On_Task__c From ap_Action_Plan_Task_Dependency__c
       Where Action_Plan_Template__c IN :actionPlanTempList];

System.debug('dependencyList - '+dependencyList);
//returns: dependencyList - ()

Interestingly - actionPlanTempList is List of IDs. When I change it to List of String it works as expected.
Why?
Edit 1:
On ap_Action_Plan_Task_Dependency__c Object, the field Action_Plan_Template__c is a formula field and also on Task Object, the field Action_Plan_Template__c is a formula field.
actionPlanTempList is being generated list this.
for(Task t:Trigger.New) {
    actionPlanTempList.add(t.Action_Plan_Template__c);
}

A: Based on your comments:

On ap_Action_Plan_Task_Dependency__c Object, the field Action_Plan_Template__c is a formula field and also on Task Object, the field Action_Plan_Template__c is a formula field.

I would think that the data type of these formula fields are of type TEXT which signifies that these are not of type Id but String.
Here's my take - when you add the formula values to the List<Id>, the platform does not treat it as Ids based on the return type but String. However you are still able to add it in the list because the value is still a well constructed Id.
(There does seem to be an issue and possibly related to what @Pranay has mentioned, where adding a valid String value for Id into List<Id> does not work, I have tried to explain later with a quick finding)
This is the reason why your code works when you declare your actionPlanTempList as List<String>.
As a quick test, you can use the getSObjectType() method to verify that the value being added to the list is not actually an Id. So, where you are adding the formula field values in the iteration, if you put a debug statement as below:
for(Task t:Trigger.New) {
    actionPlanTempList.add(t.Action_Plan_Template__c);

    system.debug(t.Action_Plan_Template__c.getSobjectType());
}

You will get an error saying:

Method does not exist or incorrect signature: void getSObjectType() from the type String

UPDATE
Seems like casting or parsing the string value into an Id type just doesn't work in the IN clause of the query. I had earlier thought it worked but when verified again, it simply ignores anything added in List<Id>.
It looks like unless and until the field being returned from the query is not of type Id, List<Id> just doesn't work in IN clause.
So let's say if there's a query as below where mylookup__c is a lookup field (Id), creating the list of Id and using it in SOQL will just work fine.
List<myobj__c> listOfObjs = [select id, name, mylookup__c from myobj__c];
List<Id> mylookupList = new List<Id>();
for(myobj__c m : listOfObjs) {
    mylookupList.add(m.mylookup__c);
}

// ONLY NOW List<Id> WORKS HERE
List<myobj__c> newlistOfObjs = [select id, name from myobj__c where mylookup__c IN :mylookupList]

Its just not clear as how in run-time, the IN clause in SOQL works where there's a difference in behavior when String values are added in List<Id> vs. the same values added in List<String>.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Signals don't work when outside MQTT script inserts data to database I have django project and I have signals in model.py file. I created demo just to show what problem is

def func(sender, instance, created, **kwargs):

    try:
        if created:
           print("WORKED")
    except BaseException as e:
        import traceback
        print(traceback.format_exc())

post_save.connect(func, sender=MyTable,
                  dispatch_uid="IDDD")

When I insert data from admin panel, everything is OK, it prints,however, when I use simple script which inserts to MyTable by using psycopg, signal does not work, but data is saved to the table.

A: Solution:
I inserted data through api, everything worked.


text:
Q: OSError: [Errno 22] Invalid Argument with Pickle I wrote a small program that pickles a little dictionary to a file every hour, once on startup. I was using pickle.dump, and I originally did it on my macbook laptop. On there, I designated the filename I wanted, and the program just created the file to dump the data into.
However, the exact same code is done on my PC, and I got the titled error. I thought it was because pathing is different on PC, so I tried doing "C:/..../playerdata/filename" instead of just "./playerdata/filename" but to no avail.
This is the block of code:
def write_data(self,master_table,label,num):
  filename = './playerdata/'+str(master_table["num"])+' - '+label+' - data'
  with open(filename,"wb") as file:
    pickle.dump(master_table,file,protocol=pickle.HIGHEST_PROTOCOL)
  #masterlist[num] = [filename,label] #doesn't really matter for the problem

I'm assuming the error is coming about because there is no file called that, but when I ran it on my mac it just created it. I believe pickle does that, but the code never gets the chance to dump it because it needs to be opened first.
Am I missing some kind of formatting? How do I get the file to be created without error?

A: If your filename can contain slashes (which separate directories as you know), you'll need to make sure the intermediate directories exist too. That's easy enough to do in one fell swoop with os.makedirs().
For brevity's sake, I also changed this to use f-strings (Python 3.6+) for the filename generation.
def write_data(self, master_table, label, num):
    filename = f'./playerdata/{master_table["num"]} - {label} - data'
    os.makedirs(os.dirname(filename), exist_ok=True)  # <- New
    with open(filename, "wb") as file:
        pickle.dump(master_table, file, protocol=pickle.HIGHEST_PROTOCOL)


text:
Q: Восстановление данных со старой системы У меня стоял linux mint, я переустановил его на ubuntu, и затёр файловую систему.
Нужно возобновить папку со старой linux mint, делал анализ testdisc'ом, но он находит только мою систему и файлы, которые были удалени на ubuntu, что сейчас стоит...
Старую систему не находит.
Есть шанс восстановить?

A:
Есть шанс восстановить?

коротко: нет.
длинно: при некоторой доли везения и знании уникальных отрывков текста, хранившегося в этих файлах, вы, вероятно, сможете (после полного побайтового сканирования) найти места на диске, где эти отрывки текста встречаются.
но эти «находки», с огромной долей вероятности, абсолютно никак не помогут восстановить даже файлы (только фрагменты этих файлов). а уж про каталоги вообще, по-моему, речи быть не может.


text:
Q: completely remove phpmyadmin centos I removed phpmyadmin on my CentOS server by typing
yum erase phpmyadmin

Then I checked if it's still in the server by locate and it displayed this:
/etc/httpd/conf.d/phpmyadmin.conf
/usr/share/phpmyadmin
/usr/share/doc/phpmyadmin-2.11.11.3
/usr/share/phpmyadmin/Documentation.html
/usr/share/phpmyadmin/browse_foreigners.php
/usr/share/phpmyadmin/calendar.php
/usr/share/phpmyadmin/changelog.php
/usr/share/phpmyadmin/chk_rel.php
/usr/share/phpmyadmin/config.inc.php
/usr/share/phpmyadmin/config.sample.inc.php
/usr/share/phpmyadmin/contrib
/usr/share/phpmyadmin/db_create.php
/usr/share/phpmyadmin/db_datadict.php
/usr/share/phpmyadmin/db_export.php
/usr/share/phpmyadmin/db_import.php
/usr/share/phpmyadmin/db_operations.php
/usr/share/phpmyadmin/db_printview.php
/usr/share/phpmyadmin/db_qbe.php
/usr/share/phpmyadmin/db_search.php
/usr/share/phpmyadmin/db_sql.php
/usr/share/phpmyadmin/db_structure.php
/usr/share/phpmyadmin/docs.css
/usr/share/phpmyadmin/error.php
/usr/share/phpmyadmin/export.php
/usr/share/phpmyadmin/favicon.ico
/usr/share/phpmyadmin/import.php
/usr/share/phpmyadmin/index.php
/usr/share/phpmyadmin/js
/usr/share/phpmyadmin/lang
/usr/share/phpmyadmin/libraries
/usr/share/phpmyadmin/license.php
/usr/share/phpmyadmin/main.php
/usr/share/phpmyadmin/navigation.php
/usr/share/phpmyadmin/pdf_pages.php
/usr/share/phpmyadmin/pdf_schema.php
/usr/share/phpmyadmin/phpinfo.php
/usr/share/phpmyadmin/phpmyadmin.css.php
/usr/share/phpmyadmin/pmd
/usr/share/phpmyadmin/pmd_common.php
/usr/share/phpmyadmin/pmd_display_field.php
/usr/share/phpmyadmin/pmd_general.php
/usr/share/phpmyadmin/pmd_help.php
/usr/share/phpmyadmin/pmd_pdf.php
/usr/share/phpmyadmin/pmd_relation_new.php
/usr/share/phpmyadmin/pmd_relation_upd.php
/usr/share/phpmyadmin/pmd_save_pos.php
/usr/share/phpmyadmin/print.css
/usr/share/phpmyadmin/querywindow.php
/usr/share/phpmyadmin/readme.php
/usr/share/phpmyadmin/scripts
/usr/share/phpmyadmin/server_binlog.php
/usr/share/phpmyadmin/server_collations.php
/usr/share/phpmyadmin/server_databases.php
/usr/share/phpmyadmin/server_engines.php
/usr/share/phpmyadmin/server_export.php
/usr/share/phpmyadmin/server_import.php
/usr/share/phpmyadmin/server_privileges.php
/usr/share/phpmyadmin/server_processlist.php
/usr/share/phpmyadmin/server_sql.php
/usr/share/phpmyadmin/server_status.php
/usr/share/phpmyadmin/server_variables.php
/usr/share/phpmyadmin/show_config_errors.php
/usr/share/phpmyadmin/sql.php
/usr/share/phpmyadmin/tbl_addfield.php
/usr/share/phpmyadmin/tbl_alter.php
/usr/share/phpmyadmin/tbl_change.php
/usr/share/phpmyadmin/tbl_create.php
/usr/share/phpmyadmin/tbl_export.php
/usr/share/phpmyadmin/tbl_import.php
/usr/share/phpmyadmin/tbl_indexes.php
/usr/share/phpmyadmin/tbl_move_copy.php
/usr/share/phpmyadmin/tbl_operations.php
/usr/share/phpmyadmin/tbl_printview.php
/usr/share/phpmyadmin/tbl_relation.php
/usr/share/phpmyadmin/tbl_replace.php
/usr/share/phpmyadmin/tbl_row_action.php
/usr/share/phpmyadmin/tbl_select.php
/usr/share/phpmyadmin/tbl_sql.php
/usr/share/phpmyadmin/tbl_structure.php
/usr/share/phpmyadmin/themes
/usr/share/phpmyadmin/themes.php
/usr/share/phpmyadmin/transformation_overview.php
/usr/share/phpmyadmin/transformation_wrapper.php
/usr/share/phpmyadmin/translators.html
/usr/share/phpmyadmin/user_password.php
/usr/share/phpmyadmin/view_create.php
/var/lib/yum/yumdb/p/2c0c9042434bd52b58095c7d7d79477a9d5c45a3-phpmyadmin-2.11.11.3-2.el6.rf-noarch

Do I have to manually remove these? The reason is I want to fresh install it as something is messed up.

A: You do realise that locate looks at a database cache with filenames (created nightly/manually with the updatedb command) and not at your live file system.
locate does not reflect the actual state of your system.
You might want to use ls to look at /usr/share/phpmyadmin instead...


text:
Q: How to compare if an item in a list has the same value AND position as an item in another list? Python 2.7 eg.
l1 = [a,b,c,d]
l2 = [e,b,f,g]

A method that would return true when it sees that b is in both l1 and l2, and in position [1] in both lists. Preferably something that I can use in a for loop so that I can compare all the items in the list.
Many thanks :)

A: Try this code:
if 'b' in l1 and 'b' in l2: # Separated both statements to prevent ValueErrors
    if l1.index('b') == l2.index('b'):
        print 'b is in both lists and same position!'

Unlike Volatility's code, the length in either list doesn't matter.
The index() function gets the position of an element in a string. For example, if there was:
>>> mylist = ['hai', 'hello', 'hey']
>>> print mylist.index('hello')
1

A: You can do:
def has_equal_element(list1, list2):
    return any(e1 == e2 for e1, e2 in zip(list1, list2))

This function will return True when at least one element has the same value and position as in the other list. This function also works when the lists differ in length, you'll need to adjust the function if that's not desired.

A: Assuming the lists are the same length, you could use the zip function
for i, j in zip(l1, l2):
    if i == j:
        print '{0} and {1} are equal and in the same position'.format(i, j)

What the zip function does is something like this:
l1 = [1, 2, 3]
l2 = [2, 3, 4]
print zip(l1, l2)
# [(1, 2), (2, 3), (3, 4)]

If you want a function that returns True or False given an input, you could do this
def some_func(your_input, l1, l2):
    return (your_input,)*2 in zip(l1, l2)

(your_input,) is a one-tuple containing your_input, and multiplying it by two makes it (your_input, your_input) - which is what you want to test for.
Or if you want the return True if any satisfy the condition
def some_func(l1, l2):
    return any(i == j for i, j in zip(l1, l2))

The any function basically checks if any of the elements of a list (or in this case a generator) are True in a boolean context, so in this case it returns true if two lists satisfy your condition.

A: If you actually want a method to compare one position in two lists you can use the following:
def compare_pos(l1, l2, pos):
    try:
        return l1[pos] == l2[pos]
    except IndexError:
        return False

l1 = [0, 1, 2, 3]
l2 = [0, 2, 2, 4]

for i, _ in enumerate(l1):
    print i, compare_pos(l1, l2, i)

# Output:
# 0 True
# 1 False
# 2 True
# 3 False

If you want to test whether two lists have all the same elements in the same positions you can just check for equality:
print l1 == l2

A: I'd get common elements from both lists:
l1 = [a, b, c, d]
l2 = [e, b, f, g]
common_elements = [(i, v) for i,v in enumerate(l1) if l2[i] == v]

This will create a list of tuples: (index, value) and then you can just check if your desired value or index is in the list.


text:
Q: Is the derivative of the conditional expectation of Y on X equal to the least squares projection? Fix a probability space $(\Omega, \mathcal{F}, P)$. Let $Y,X$ be random variables from $\Omega \rightarrow \mathbb{R}$. Let $m(x): \mathbb{R} \rightarrow \mathbb{R}$ be defined by $\mathbb{E}[Y|X=x]$. For readers not satisfied with this definition of $m(x)$, I justify it at the end of the post.
Suppose the derivative $m'(x)\vert_{x=\mathbb{E}[X]}$ exists. Is it true that $m'(x)\vert_{x=\mathbb{E}[X]}$ equals the least squares projection coefficient
$$ \beta \equiv \frac{\mathbb{E}\left[\left( X-E[X] \right) \left( Y - E[Y] \right) \right]} {\mathbb{E}[X^2]}$$
of $Y$ on $X$?
I conjecture this since by a previous theorem, $\beta$ is the coefficient on $X$ in the best affine approximation to $m(X)$ w.r.t. mean squared error.
And can we say anything about higher order derivatives of $m(x)$ at $x=\mathbb{E}[X]$?
More on the definition of m(x):
Let $Z=\mathbb{E}[Y\vert \sigma(X)]$ be a conditional expectation of $Y$ given $\sigma(X)$. Thus $Z$ is a random variable from $\Omega \rightarrow \mathbb{R}$ measurable w.r.t. $\sigma(X)$, the sigma algebra generated by $X$; I write this as $Z \in \sigma(X)$. If I'm not mistaken, since $Z\in \sigma(X)$, the Doob-Dynkin Factorization Lemma implies that there exists a Borel-measurable function $g: \mathbb{R} \rightarrow \mathbb{R}$ such that $Z = g \, \circ X$.
We then define $m(x)=g(x)$.
$m(x)$ is not necessarily unique since the conditional expectation $Z$ is only unique up to measure zero, but I suppose this means $m(x)$ is essentially unique in some sense (not quite sure).
Thank you.

A: Consider the following joint density, $f(x,y)$, of $X$ and $Y$:
$\hspace{1.5cm}$
Here, $\mathsf{E}[X]=-1/3$ and $m(x)=0.5 + 1_{[0,1]}(x)\cdot x$ so that $m'(\mathsf{E}[X])=0$, but $\operatorname{Cov}(X,Y)> 0$.


text:
Q: Missing field error when adding fields to autopopulate new record I have a custom button that I'm using on a related list from either a contact or lead. The button will auto-populate some fields for the new record before saving.
Here is the syntax I'm using for the button:
{!IF(Lead.Id <> "",URLFOR('https://companyname--staging1.cs61.my.salesforce.com/a3S/e', null,[CF00N4C000000zqSV=Lead.Name,CF00N4C000000zqSV_lkid=Lead.Id]),URLFOR('https://companyname--staging1.cs61.my.salesforce.com/a3S/e',null, [CF00N4C00000104EI=Contact.Name,CF00N4C00000104EI_lkid=Contact.Id]))}

The above code works for the fields I have included. As soon as I add another field to auto-populate, I get this error:

Syntax error. Missing field name

Here is the code with the added field name:
{!IF(Lead.Id  <> "",URLFOR('https://companyname--staging1.cs61.my.salesforce.com/a3S/e', null,[CF00N4C000000zqSV=Lead.Name,CF00N4C000000zqSV_lkid=Lead.Id,00N4C000000zpTm=Lead.Name]),URLFOR('https://companyname--staging1.cs61.my.salesforce.com/a3S/e',null, [CF00N4C00000104EI=Contact.Name,CF00N4C00000104EI_lkid=Contact.Id,00N4C000000zpTm=Lead.Name]))}


text:
Q: Definition for non-degenerate module [QUESTION] If $R$ be a ring, what is the meaning of a non-degenerate $R$-module?
In a previous question post at (What is a non-degenerate module?), some experts said that if $M$ is a $R$-module such that $M=RM:=\{\displaystyle{\sum_{i=1}^n}r_im_i\mid r_i\in R,m_i\in M,n\in\mathbb{Z}_{>0}\}$, then $M$ is called non-degenerate $R$-module.
However, I read the lecture note "REPRESENTATION OF p-ADIC GROUPS" by professor Joseph BERNSTEIN (http://www.math.harvard.edu/~gaitsgde/Jerusalem_2010/GradStudentSeminar/p-adic.pdf), "non-degenerate module" first defined in DEFINITION 4 (2) on page 9, where $\mathcal{H}$ is an algebra and $M$ is a $\mathcal{H}$-module. Then $M$ is called a non-degenerate $\mathcal{H}$-module if $\mathcal{H}M=M$. However it seems that $\mathcal{H}M$ is defined as a set $\{hm\mid h\in\mathcal{H},m\in M\}$ instead of a submodule generated. There are at least two evidences in his note. One is in the proof of LEMMA 4 on page 13, and there is a sentence: "each element $M$ has the form $hm$"; the other is in the proof of LEMMA 7 on page 19, there is another sentence: "there exists an $h\in\mathcal{H}$ such that $hw_1=w_2$".
Hence, I shall be grateful if any expert here who read this note before gives any comment on this question. Thanks!

A: There are certainly omissions in the notes, but $\mathcal{H}M$ is not defined as a set; it's a module.  It is, however, equal to the set $\{hm\}$ in this context.
$\mathcal{H}$ is an idempotented algebra, which means that, for any finite collection $h_i\in\mathcal{H}$, there is an idempotent $e\in\mathcal{H}$ with $eh_i = h_i e = h_i$ for all $i$.  This last equality doesn't show up in these notes, which is likely to be an error.
Anyway, if $M$ is non-degenerate, and $m\in M$, then we have $m = \sum_i h_i m_i$.  But, by the definition, there is an idempotent $e\in\mathcal{H}$ such that $eh_i = h_i$ for all $i$.  Then $em = m$, so $m$ is of the required form.


text:
Q: React Native - Is extending a class acceptable in this scenario? So, I have read multiple times: Composition is Good. Extending is Evil.
Now, I do use composition, basically a lot of stateless components and higher order components, however I do have one particular case where I extend a class.
Instead of every stateless component extending from Component, I am extending from my own BaseComponent, which basically has some helper functions that I use in all of my components.
Like for example:

*

*Analytics helpers

*Loggers

*Data Fetchers

*Configuration

*Storage

*Theme management

*Actions

So far, I am happy with the result. I am looking for any good reason for me to actually break this pattern in the objective to pursuit great code.
Please no "React recommends composition" answers.

A: Well why not simply use HOC's for each of those pieces?
The big benefit of using HOC's for these kind of situations, is that you can apply them individually, or as a group.  You gain a ton of control in how you slice/dice these shared pieces of functionality.
As a simple, example, your logger as an HOC might look something like;
const function loggerHoc(WrappedComponent) {
    return class extends Component {
        log(message) {
            console.log(message); //or other implementation
        }

        render() {
            <WrappedComponent log={this.log} {...this.props}/>;
        }
    }
}

Now if you had a second HOC of this style for analytics, they can be wrapped on top of one another without issue;
ResultComponent = loggerHoc(analyticsHoc(ChildComponent));

Which you could also write a function to do all of;
const function wrapWithAll(WrappedComponent) {
    return loggerHoc(
        analyticsHoc(
            WrappedComponent
        )
    );
}

Or you can use individually, as your needs dictate.


text:
Q: Covert Virtual Directory to Application using ansible How can convert Virtual Directory to Application in ansible playbook
win_iis_virtualdirectory will only create a new virtual directory
And
Win_iis_webapplication will create a new application which is under site not under virtual directory.
I want to convert virtual directory to applications
Power shell we can do by convertTo-webapplication
But how this can be done in ansible

A: With the current windows ansible modules you have 2 ways to do this.
You can use win_iis_virtualdirectory to remove the virtual directory, and then use the win_iis_webapplication to create an application over the same physical path.
Or,
You can use the powershell and the script module to run it on the remote machine and convert it that way too.

A: Yes, you can do it in an intuitive way

*

*name: Add your app inside virtual dir
win_iis_webapplication:
application_pool: AppPoolName
name: YourAppName
site: YourSite/YourVirtualDir
state: present
physical_path: C:\physical\path


text:
Q: Android 4.4 WifiScan result I created a small test android app to do a scan of the surrounding wifi networks.
When I run the app on my galaxy nexus( jellybean) the result returns:
( SSID, BSSID, Capabilities, level, timestamp).

However when I run the same app on my Nexus 5( KitKat) the result returns:
( SSID, BSSID, Capabilities, level, timestamp, distance (cm), distanceSd(cm) ).

I can't seem to find anything about distance in the android WiFi API documentation. Does anyone know whats going on ???

A: If you check the ScanResult.java source code here, you can verify that in one of the ScanResult constructors, there are int distCm and int distSdCm parameters, for distance (cm) and distanceSd(cm), respectively.

A: Well noticed !
Android is probably already updating its API to a new revision on IEEE 802.11.
There is a new update to provide indoor positioning using TriLateration.
This new feature adds a timestamp on the package called Fine Timing Measurement (FTM), providing the capability to estimate the distance from an AP to a receiver.
If you want more info, you should search for IEEE 802.11 REVmc:
http://www.ieee802.org/11/Reports/802.11_Timelines.htm


text:
Q: Filter Websites via Squid I would like to install Squid to block all the websites and only allow a few websites (whitelist). Each department will have different rules.
For example on the Sales department - all the websites will be blocked and only allow a few whitelist websites. On the Customer Services department, all the websites will be open but facebook and youtube will be blocked.
If I use Squid, is it possible in this situation to filter on each department? I've done the network design that I am planning to setup. I could install Squid or pfsense for squid use on VM3 on the ESXi server.

PS: I do not have VLAN on switch

A:
If I use Squid, is it possible in this situation to filter on each department?

There are a couple methods.  Setup and require proxy authentication, possibly using Kerberos or NTLM if you have a Windows Domain.  With proxy authentication you can use the authenticated user in ACLs.
The other option is to make sure all the clients in a particular group are assigned an IP within a specific range.  That way you can build ACLs based on the source IP.
See the Squid ACL FAQ for details and other possibilities.

*

*http://wiki.squid-cache.org/SquidFaq/SquidAcl

A: You will have to create VLAN on switch, as if you dont,then the clients will be able to acces the gateway themselves and use internet without any restrictions.
Create on VLAN, in which only clients have access, and the other VLAN, which has access to gateway as well (which will be squid server).
And for squid server, i would recommend you to use dansguarian or squidguard for blocking or whistling websites.


text:
Q: How to call certain chord buttons instead of all the chord buttons from the chord library? I have been able to build a chord library that plays the chord and also says the chord name. I'm now trying to build upon the chord library. How can I have only a limited amount of chord buttons be displayed on the UI instead of all of the chords that are being populated?
The top portion of the code (that is below) is displaying the four buttons but not playing the chord sounds or saying the chord names.
The other code after is showing all the chord buttons and playing the chord sounds and chord names.
We're trying to combine the two portions of code from below so that they play the chord names and sounds for the four chords above.

 //In order to run in terminal insert the following code to activate localhost: npx parcel src/index.html
import { chordType, transpose, note } from '@tonaljs/tonal';
import { chord } from '@tonaljs/chord';
import { entries } from '@tonaljs/chord-dictionary';
import { Howler, howl } from 'howler';

const buttons = document.querySelector(".buttons");

const arrayOfChordNames = ["Major", "Minor", "Augmented", "Diminished"];

arrayOfChordNames.forEach((chord) => {
  let buttonElement = createElement("button", chord);
  buttons.appendChild(buttonElement);
});

function createElement(element, content) {
  let newElement = document.createElement(element);
  newElement.textContent = content;
  return newElement;
}

// code above is displaying the four buttons but not playing the chord sound and chord name
//code below is showing all the chord buttons and playing the chord sound and chord names
// we're trying combine the chord from below so that it plays the audio from the chord names and sounds for the four chords above

const sound = new Howl({
    src: ['assets/pianosprite.mp3'],
    onload() {
        console.log('Sound file has been loaded. Do something here!');
        soundEngine.init();
    },
    onloaderror(e, msg) {
        console.log('Error', e, msg);
    }
});

const startNotes = ['C', 'C#', 'Db', 'D', 'D#', 'Eb', 'E', 'F', 'F#', 'Gb', 'G', 'G#', 'Ab', 'A', 'A#', 'Bb', 'B'];

const startNoteSelector = document.querySelector('#start-note');
const octaveSelector = document.querySelector('#octave');
const buttons = document.querySelector('.buttons');
const intervalsInChord = document.querySelector('.intervals-in-chord');
const notesInChord = document.querySelector('.notes-in-chord');

let selectedStartNote = 'C';
let selectedOctave = '1';

const app = {
    init() {
        this.setupStartNotes();
        this.setupOctaves();
        this.setupButtons();
        this.setupEventListeners();
    },
    setupStartNotes() {
        startNotes.forEach(noteName => {
            let noteNameOption = this.createElement('option', noteName);
            startNoteSelector.appendChild(noteNameOption);
        });
    },
    setupOctaves() {
        for (let i = 1; i <= 6; i++) {
            let octaveNumber = this.createElement('option', i);
            octaveSelector.appendChild(octaveNumber);
        }
    },
    setupButtons() {
        const chordNames = entries().map(entry => {
            return entry.aliases[0];
        });
        chordNames.forEach(chordName => {
            let chordButton = this.createElement('button', chordName);
            buttons.appendChild(chordButton);
        });

    },
    setupEventListeners() {
        startNoteSelector.addEventListener('change', () => {
            selectedStartNote = startNoteSelector.value;
        });
        octaveSelector.addEventListener('change', () => {
            selectedOctave = octaveSelector.value;
        });
        buttons.addEventListener('click', (event) => {
            if (event.target.classList.contains('buttons')) {
                return;
            }
            selectedChord = event.target.innerText;
            this.displayAndPlayChord(selectedChord, event);
        });
    },
    displayAndPlayChord(selectedChord, event) {
        let chordIntervals = chord(selectedChord).intervals;
        intervalsInChord.innerText = chordIntervals.join(' - ');

        const startNoteWithOctave = selectedStartNote + selectedOctave;
        let chordNotes = chordIntervals.map(val => {
            return transpose(startNoteWithOctave, val);
        });
        notesInChord.innerText = chordNotes.join(' - ');
        soundEngine.play(chordNotes, event);
    },
    createElement(elementName, content) {
        let element = document.createElement(elementName);
        element.innerHTML = content;
        return element;
    }
}

const soundEngine = {
    init() {
        const lengthOfNote = 2400;
        let timeIndex = 0;
        for (let i = 24; i <= 96; i++) {
            sound['_sprite'][i] = [timeIndex, lengthOfNote];
            timeIndex += lengthOfNote;
        }

    },

    play(soundSequence, event) {
        const buttons =
        document.querySelector(".buttons");

        const chordNameTable = {
        "M": "Major",
        "m": "Minor",
        "dim": "diminished",
        "aug": "Augmented"

          }

          buttons.addEventListener("click", (event) => {

          })
          function textToSpeech(message, chord) {
            const speech = new SpeechSynthesisUtterance();
            speech.lang = "en-US";
            speech.text = message;
            speech.volume = 1;
            speech.rate = 1;
            speech.pitch = 1;
            window.speechSynthesis.speak(speech);
            // When speaking has finished
            speech.onend = function() {
              playChord(chord);
            }
          }

          function playChord(chord) {
            // Wait a second (1000 miliseconds) before playing the chord
            setTimeout(() => {
                const chordMidiNumbers = soundSequence.map(noteName => {
                    return note(noteName).midi;
                });
                sound.volume(0.05);
                chordMidiNumbers.forEach(noteMidiNumber => {

                    sound.play(noteMidiNumber.toString());
                });
              console.log("Chord to be played", chord);
            }, 500);
          }
          const sayThis = chordNameTable[event.target.textContent];
            textToSpeech(sayThis, event.target.textContent);
    }
}

app.init();

const allChordNames = entries()
chordEntries.map(entry => {
    return entry.aliases[0];
})
console.log(Array.isArray (allChordNames));
body {
    font-family: Lato, Sans-serif;
    color: #fff;
    background: #000000
}

.controls{
    display: flex;
    justify-content: center;
}
.controls select {
    margin: 0 10px;
}
.chord-notes {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.5em;
}
.chord-notes p {
    margin: 10px 0;
}
/*width makes the page more condensed towards the left*/
.buttons {
    display: flex;
    flex-wrap: wrap;
    width: 60%;
}
/*min-width divides columns into 3 instead of 4, max-width creates a set size for the button*/
.buttons button{
    flex-grow: 1;
    min-width: 20%;
    max-width: 20%;
    height: 50px;
    font-size: 1em;
    background: #7200CC;
    border: none;
    color: #fff;
    margin: 10px;
}
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Chord Dictionary</title>
    <link rel="stylesheet" href="styles.css">

Home

Lessons

Practice

Test

Demo

Triads

Sign Up

Login

This is the Triads page!

        Start note:
        <select name="start note" id="start-note">

        </select>

        Octave:
        <select name="Octave" id="octave">

        </select>

        Loops:
        <select id="Loops">
          <option value="1">1</option>
          <option value="2">2</option>
          <option value="3">3</option>
          <option value="4">4</option>
          <option value="5">5</option>
          <option value="loop">loop</option>
        </select>

C3 - D3 - E3 - F#3 - A3

P1 - M3 - P5 - M7


text:
Q: How to get flags returned by recvmsg() with recvfrom() I have to use recvfrom() to receive from multiple interfaces (unknown at compile-time, and also needed for preserving the exact order of messages as opposed to using individual syscalls to receive from each interface in turn), but I also need access to some flags that only recvmsg() provides (via the flags field of the message header that is modified by the call).
Is there a way to use recvfrom() to fill a msgheader similar to recvmsg()?

A: recvmsg() is a functional superset of recvfrom(), just as recvfrom() is a functional superset of recv(). In other words, recvmsg() is the most powerful of the three functions, and everything that you can do with the other two you can also do with recvmsg().
In particular, recvfrom()'s main feature is that it returns the address of the sender of the message that is received. The same information is available when you use recvmsg(): look at the msg_name and msg_namelen elements of the struct msghdr.


text:
Q: Getting list of stages for the current opportunity's RecordType From an order of operations, I need to:

*

*Get the Opportunity field values for RecordTypeId and StageName for the current Opportunity.

*Get the picklist values for Stage based on the RecordTypeId of the current Opportunity.

*Do some stuff with that data before displaying in my template

UPDATE: Thought I would share my revised code based on @sfdcfox's suggestion below...
import { api, LightningElement, track, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import { getPicklistValues } from 'lightning/uiObjectInfoApi';
import STAGE_FIELD from '@salesforce/schema/Opportunity.StageName';

const fields = [STAGE_FIELD];

export default class Stages extends LightningElement {
  @api recordId;
  @track stageNames;
  @track error;
  stageName;
  recordTypeId;

  @wire(getRecord, { recordId: '$recordId', fields })
  wiredOpportunity({ error, data }) {
    if (data) {
      this.recordTypeId = data.recordTypeId;
      this.stageName = data.fields.StageName.displayValue;
    } else if (error) {
      this.error = error;
      this.stageName = '';
      this.recordTypeId = '';
    }
  }

  @wire(getPicklistValues, {
    recordTypeId: '$recordTypeId',
    fieldApiName: STAGE_FIELD
  })
  wiredStage({ error, data }) {
    if (data) {
      this.stageNames = data.values;
      console.log('Now I have everything I need...');
      console.log('stageNames', JSON.parse(JSON.stringify(this.stageNames)));
      console.log(`Record Type Id: ${this.recordTypeId}, Stage: ${this.stageName}`);
      this.error = undefined;
    } else if (error) {
      this.error = error;
      this.stageNames = [];
    }
  }

}


text:
Q: Cisco VPN endpoints disconnecting from a VLAN I have a number of Cisco ASA 5505 and PIX 506e around the world acting as VPN endpoints.  They connect to a Cisco VPN Concentrator 3000 at HQ.  I am using Easy VPN to set up the VPN (i.e. most of the config is central on the VPN Concentrator)  The majority of endpoints work absolutely fine.
However, there are three that do not.  2 ASAs and 1 PIX get disconnected from one of the VLANs on our network.  This is the VLAN that my monitoring server runs on - so those endpoints look as if they have gone down.  However, I can still ping the endpoints from our user VLAN.  If I then SSH onto the endpoint, and do a ping to my monitoring server, the connection comes back.  Then after about 10 minutes it stops working again.
I've looked at the configuration of my endpoints, and I can't see any significant differences.  One common feature is that the affected endpoints are connecting to the internet via retail quality routers.  However, I don't see how this could affect traffic within a VPN tunnel.
Any ideas or suggestions?  I've also got a thread on Cisco's forums at https://supportforums.cisco.com/thread/344638.  One other person has reported the same problem.

A: I think you mean to say "subnet" every place you have "vlan".  I don't think the vpn3k even supported assigning vpn tunnels to vlans. if you are using split-tunneling and pushing out 2 different routes for each of those subnets, then on the pix you end up with 1 ipsec security-association per subnet.
It sounds like these are timing out for some reason..
I'm not sure why that would happen, but I do know that I've been using this configuration for years without issue:
vpnclient server server1 server2
vpnclient mode network-extension-mode
vpnclient nem-st-autoconnect
vpnclient vpngroup group password ********
vpnclient username user password ********
vpnclient management tunnel mana.geme.nt.subnet 255.255.255.0
vpnclient enable

Is that different from the configuration you are running?


text:
Q: Is a row automatically deleted if all the values are garbage-collected? Let's say there is a row that has a column family and a column in it. That column family has a gc policy and all the values in the column were just expired.
Then, what happens to that row? Would that row be deleted by the garbage collector? Or, would that still remain and be accessible?
I've checked documentation but only found some vague comment on that from https://cloud.google.com/bigtable/docs/overview#empty-cells

Empty cells in a Cloud Bigtable table do not take up any space. Each row is essentially a collection of key/value entries, where the key is a combination of the column family, column qualifier and timestamp. If a row does not include a value for a specific key, the key/value entry is simply not present.

In my case, the collection would be empty according to the above text. Then, my question is whether or not the empty collection still exists.
Ideally, I want an empty row to be automatically deleted to prevent the table has too many empty rows. If an empty row is not automatically deleted, is there any way to automate that, except writing a program for scanning and removing such rows?

A: If all cells are garbage collected for a row key, then the row is indeed deleted. Note that garbage collection is asynchronous, and it can take up to a week for data to be totally removed.


text:
Q: Angular2 Async call value undefined I have the below html and ts code - when I debug the typescript code I am not getting any values in params it is because when the value is passed the backend call is not made so it sends undefined. how can I delay the html call that way I can get the values?
html file:
   <button (click)="test()">
       <component [param]="param"></component>
   </button>

ts file:
   @Input param: any;
      test() {
        this.service.getData()
          .subscribe((val) => {
            this.param = val;
          });
    }

A: One way is to put an *ngIf on the component and only show it when param becomes truthy.
<button (click)="test()">
       <component *ngIf="!!param" [param]="param"></component>
</button>

Another way is to pass a default value until param becomes truthy;
<button (click)="test()">
       <component [param]="param ? param : 'hello world'"></component>
</button>

We are passing hello world as default but you can pass whatever you like.


text:
Q: Create list of Safari bookmarks I want to create a list of my Safari bookmarks (folder, webpage title, and URL) to put into Numbers or a database app. This will help me find duplicates, tell me where a certain bookmark is, and keep from saving bookmarks again and again.

A: Safari Bookmarks can be exported as an HTML file.  This file can be opened with any text editor and reviewed or even cleaned up with a little HTML know-how.  Then it can be reimported after clean up.  Recommend cleaning up a copy of the original in case you need to revert.

To export:

*

*From the Menu: File > Export Bookmarks...

*Choose a location to save the HTML file.

*Open in a text editor.  (Drag the file to the text editor's application icon or option+click and choose Open with

*Examine the file and make changes.

*Reimport using File > Import From > Bookmarks HTML File…

Alternatively, if one just wants to examine in a spreadsheet, Excel for Mac will open HTML files.  Even though the result is easier to read, the data is harder to manipulate unless you understand Hyperlinks.


text:
Q: bind text + ".jpg" as ImageUrl in  control I do have an Image control in a c# web.
I want to bind a value as "ImageUrl", but I do want to concat the string .jpg to this value first.
 <p><asp:Image id=Imagen1 runat="server" ImageUrl='<%# Bind("Id_product") %>'/>  </p>

I tryed +".jpg", also + '.jpg', but didn't work.
Thanks.

A: Try:
<asp:Image id="Imagen1" runat="server" ImageUrl='<%# Eval("Id_product") + ".jpg" %>' />

Updated the code. This has been tested and it works.


text:
Q: Blue screen of death while unlocking computer with Visual Studio 2010 running I have Visual Studio 2010 installed along with DevExpress 10.2. When I lock the machine and unlock it, a blue screen of death appears.
I also experience the same problem when the machine is kept running for about one to two hours.  The same software is installed on a desktop, but no problem there.
My laptop is a Dell Latitude E6410.

A: Solution/workaround for Dell Latitude E6410:
Upgrade the graphics driver XP32 Intel GMA HD Integrated Graphics Driver (Intel_multi-device_A05_R296698). The crash issue while locking and unlocking doesn't happen again.

A: Read some articles about finding root cause of BSOD, here are few:

*

*HOW TO: Debug Memory Dumps (Figure out what is causing a BSOD)

*How to debug a (BSOD) Blue Screen of Death – Part 1

*How to debug a Blue Screen of Death (BSOD)- Part 2

A: I'm getting the same problem on a Lenovo T410 (running xp 32bit). If I come out of vs2010 before locking the screen it does. Turning off hardware acceleration for WPF seems to have helped
http://msdn.microsoft.com/en-us/library/aa970912.aspx#disablehardwareacceleration
Your milage may vary though.

A: Any kernel mode exception (Blue Screen of Death) is caused by code running in mode.
And it's almost certainly not caused by Microsoft's own kernel code, but by a 3rd party driver that is also running in kernel mode.
The symptoms here suggest that the BSOD is almost certainly caused by a video card driver. I.e. a video mode switch, with 3D application (WPF) running. Your video card's driver wasn't expecting that, and it caused it to execute invalid code.

At the very least, you need to provide the stop error code, e.g.:
Stop: 0x00000050  (PAGE_FAULT_IN_NON_PAGED_AREA)

and the parameters that accompany the error code, e.g. in the case of PAGE_FAULT_IN_NON_PAGED_AREA:
0x8872A990: The memory addressed referenced
0x00000001: 0=Read, 1=Write
0x804F35D7: The address that referenced the memory
0x00000000: (reserved)

for whatever your stop error is, e.g.:

Other than that:

*

*update your video card's drivers; hopefully they fixed the bug

*update your video card; if they didn't fix the bug then certainly another manufacturer won't have the bug

*ask the video card to do less video-card stuff e.g.

*

*turn off WPF (3D video card stuff)

*turn off video card acceleration (video card stuff)

*lower the resolution (video card stuff)


text:
Q: MAC OS Awk - Syntax error when generating files with a variable The following command takes the file temp_practice.txt and split it into several files temp_output_1.txt, temp_output_2.txt, etc... based on the criteria $5~"?"

awk -v n=1 '{print > "temp_output_" n ".txt"} $5~"?" {n++}' temp_practice.txt

On Ubuntu, it works very smoothly and I get exactly what I want. However, when I try to run the same command on Mac, I get the following syntax error:
awk: syntax error at source line 1
context is
{print > "temp_output_" >>>  n <<<  ".txt"} $5~"?" {n++}
awk: illegal statement at source line 1

There seems to be a syntax error with the n variable that generates the name of the file. I know that there are differences between awk on Linux and on Mac but I cannot find any information about that particular problem. Do I need to use a different command or do I simply need to add something to the existing line?

A: I told you about this exact issue previously. Your next issue is unrelated to the one your question is about. ? is a regexp metachar meaning zero-or-one repetitions of the preceding expression but look at your regexp /?/ - you don't HAVE a preceding expression. So some awks might treat ? as literal and others might produce a syntax error. To match a literal ?, which I assume is what you're trying to do, is $5~/\?/ or $5~/[?]/ or index($5,"?") or maybe even $5=="?" depending on your input and requirements.


text:
Q: apply custom function to a pandas dataframe values I have a dataframe of two columns. Column 1 is a loan number, column 2 are tuples with dates and cashflows. I need to create 3rd column with npv, applying my custom function that I created, unfortunately when I want to apply to all loans , python shows an error, but when I slice a tuple of one loan , the function works. I can't understand how to apply to all set of loans, as there dozen of loans and i can't do it manually for each loan. Here is my dataset and code:
list1=df1['date'].tolist()
list2=df1['Inv_Total_CF'].tolist()
dates=[datetime.strptime(x,'%m/%d/%Y') for x in list1]
s=pd.Series(tuple(zip(dates, list2)), index =df.index)
df2=s.groupby(df1['loan_number']).apply(tuple).reset_index(name='cashflows')
print(df2)
loan_number        cashflows
1            ((2021-06-01 00:00:00, -177638.21405903128), (...
2            ((2021-07-15 00:00:00, 1499.224024), (2021-08-...
...

df2['XNPV']=df2.apply(lambda x: xnpv(0.12,df2['cashflows']))
n<ipython-input-87-df310ee10859> in <lambda>(x)
  6 df2=df2.iloc[1:]
  7
  ----> 8 df2['XNPV']=df2.apply(lambda x: xnpv(0.12,df2['cashflows']))
  9 #cf=df2['cashflows'].iloc[1]
 10 #cf

 <ipython-input-36-e09ab95d8640> in xnpv(rate, cashflows)
 22     chron_order = sorted(cashflows, key = lambda x: x[0])
 23     t0 = chron_order[0][0] #t0 is the date of the first cash flow
 ---> 24     return sum([cf/(1+rate)**((t-t0).days/365.0) for (t,cf) in chron_order])
 25
 26 def xirr(cashflows,guess=0.1):

 <ipython-input-36-e09ab95d8640> in <listcomp>(.0)
 22     chron_order = sorted(cashflows, key = lambda x: x[0])
 23     t0 = chron_order[0][0] #t0 is the date of the first cash flow
 ---> 24     return sum([cf/(1+rate)**((t-t0).days/365.0) for (t,cf) in chron_order])
 25
 26 def xirr(cashflows,guess=0.1):

 ValueError: too many values to unpack (expected 2)

However, If I slice it and apply xnpv function to one loan it wroks:
cf=df2['cashflows'].iloc[1]
print(xnpv(0.12,cf))
42983.47762946672

And here is my XNPV custom function:
def xnpv(rate,cashflows):
chron_order = sorted(cashflows, key = lambda x: x[0])
t0 = chron_order[0][0] #t0 is the date of the first cash flow
return sum([cf/(1+rate)**((t-t0).days/365.0) for (t,cf) in chron_order])

I would appreciate any help!
The dataframe Look like this:
{"1":[[1622505600000,-177638.2140590313],[1626307200000,3085.658271],[1628985600000,2556.15292],[1631664000000,7213.691688],[1634256000000,8529.293764],[1636934400000,9130.169221],[1639526400000,8155.381948],[1642204800000,11054.53224],[1644883200000,9578.962366],[1647302400000,9114.508608],[1649980800000,7863.10379],[1652572800000,6757.673243],[1655251200000,8700.934134],[1657843200000,12300.05361],[1660521600000,12912.04123],[1663200000000,12753.9491],[1665792000000,11423.29833],[1668470400000,9463.180073],[1671062400000,7748.722828],[1673740800000,6286.920039],[1676419200000,5001.63329],[1678838400000,3992.725525],[1681516800000,3029.329451],[1684108800000,2263.115023],[1686787200000,1627.195315],[1689379200000,868.400985],[1692057600000,643.826055],[1694736000000,474.8510724],[1697328000000,348.6340221],[1700006400000,254.9402172],[1702598400000,185.7620742],[1705276800000,134.9239515],[1707955200000,97.71764749],[1710460800000,70.58748469],[1713139200000,50.86929652],[1715731200000,36.58021428],[1718409600000,26.25289783],[1721001600000,18.80690661],[1723680000000,13.45015537],[1726358400000,9.604195486],[1728950400000,6.848044843],[1731628800000,4.876264821],[1734220800000,3.467862765],[1736899200000,2.46334669],[1739577600000,1.747873444],[1741996800000,1.238922499],[1744675200000,0.877312576],[1747267200000,0.620675664],[1749945600000,0.438729977],[1752537600000,0.309864925],[1755216000000,0.218679833],[1757894400000,0.154213894],[1760486400000,0.10867576],[1763164800000,0.07653341],[1765756800000,0.053863227],[1768435200000,0.037885183],[1771113600000,0.026631401],[1773532800000,0.018710153],[1776211200000,0.013138016],[1778803200000,0.00922064],[1781481600000,0.006468153],[1784073600000,0.004535195],[1786752000000,0.003178456],[1789430400000,0.002226633],[1792022400000,0.001559194],[1794700800000,0.001091384],[1797292800000,0.000763638],[1799971200000,0.000534117],[1802649600000,0.000373447],[1805068800000,0.000261018],[1807747200000,0.000182375],[1810339200000,0.000127386],[1813017600000,0.0000889491],[1815609600000,0.0000620912],[1818288000000,0.0000433302],[1820966400000,0.0000302293],[1823558400000,0.0000210836],[1826236800000,0.000014701],[1828828800000,0.0000102479],[1831507200000,0.0000071419],[1834185600000,0.0000049761],[1836691200000,0.0000034662],[1839369600000,0.000002414],[1841961600000,0.0000016808],[1844640000000,0.00000117],[1847232000000,0.0000008143],[1849910400000,0.0000005666],[1852588800000,0.0000003942],[1855180800000,0.0000002742],[1857859200000,0.0000001906],[1860451200000,0.0000001326],[1863129600000,0.0000000921],[1865808000000,0.0],[1868227200000,0.0],[1870905600000,0.0],[1873497600000,0.0],[1876176000000,0.0],[1878768000000,0.0],[1881446400000,0.0],[1884124800000,0.0],[1886716800000,0.0],[1889395200000,0.0],[1891987200000,0.0],[1894665600000,0.0],[1897344000000,0.0],[1899763200000,0.0],[1902441600000,0.0],[1905033600000,0.0],[1907712000000,0.0],[1910304000000,0.0],[1912982400000,0.0],[1915660800000,0.0],[1918252800000,0.0],[1920931200000,0.0],[1923523200000,0.0],[1926201600000,0.0],[1928880000000,0.0],[1931299200000,0.0],[1933977600000,0.0],[1936569600000,0.0],[1939248000000,0.0]],"2":[[1626307200000,1499.224024],[1628985600000,1012.362554],[1631664000000,2248.431091],[1634256000000,2508.331472],[1636934400000,2598.170958],[1639526400000,2242.086348],[1642204800000,6037.62068],[1644883200000,4452.626783],[1647302400000,3814.301903],[1649980800000,2874.283745],[1652572800000,2391.340011],[1655251200000,1820.379286],[1657843200000,1615.539185],[1660521600000,1247.933088],[1663200000000,1231.91721],[1665792000000,1051.469965],[1668470400000,760.6507882],[1671062400000,604.5499297],[1673740800000,496.9414505],[1676419200000,414.8423286],[1678838400000,344.5661213],[1681516800000,258.6103623],[1684108800000,202.7907663],[1686787200000,144.4798943],[1689379200000,67.73338014],[1692057600000,74.52646198],[1694736000000,80.76949288],[1697328000000,86.48308418],[1700006400000,91.68941693],[1702598400000,96.4114862],[1705276800000,100.6725919],[1707955200000,104.4959884],[1710460800000,107.904641],[1713139200000,110.9210545],[1715731200000,113.5671537],[1718409600000,115.864201],[1721001600000,117.8327412],[1723680000000,119.4925663],[1726358400000,120.8626956],[1728950400000,121.9613675],[1731628800000,122.8060387],[1734220800000,123.4133917],[1736899200000,123.7993458],[1739577600000,123.9790727],[1741996800000,123.9670149],[1744675200000,123.7769049],[1747267200000,123.421788],[1749945600000,122.9140439],[1752537600000,122.2654106],[1755216000000,121.4870076],[1757894400000,120.5893598],[1760486400000,119.5824207],[1763164800000,118.475596],[1765756800000,117.2777668],[1768435200000,115.9973114],[1771113600000,114.6421283],[1773532800000,113.2196568],[1776211200000,111.7368985],[1778803200000,110.2004372],[1781481600000,108.6164586],[1784073600000,106.9907693],[1786752000000,105.3288149],[1789430400000,103.635698],[1792022400000,101.9161944],[1794700800000,100.1747704],[1797292800000,98.41559745],[1799971200000,96.64256796],[1802649600000,94.85930915],[1805068800000,93.06919723],[1807747200000,91.27537017],[1810339200000,89.4807409],[1813017600000,87.68800896],[1815609600000,85.89967198],[1818288000000,84.11803721],[1820966400000,82.34523143],[1823558400000,80.58321133],[1826236800000,78.83377315],[1828828800000,77.09856152],[1831507200000,75.37907826],[1834185600000,73.67669073],[1836691200000,71.99263976],[1839369600000,70.32804685],[1841961600000,68.68392155],[1844640000000,67.06116816],[1847232000000,65.46059212],[1849910400000,63.88290621],[1852588800000,62.32873625],[1855180800000,60.79862666],[1857859200000,59.2930457],[1860451200000,57.81239036],[1863129600000,56.35699113],[1865808000000,54.92711637],[1868227200000,53.52297661],[1870905600000,52.14472846],[1873497600000,50.79247841],[1876176000000,49.46628643],[1878768000000,48.1661693],[1881446400000,0.0],[1884124800000,0.0],[1886716800000,0.0],[1889395200000,0.0],[1891987200000,0.0],[1894665600000,0.0],[1897344000000,0.0],[1899763200000,0.0],[1902441600000,0.0],[1905033600000,0.0],[1907712000000,0.0],[1910304000000,0.0],[1912982400000,0.0],[1915660800000,0.0],[1918252800000,0.0],[1920931200000,0.0],[1923523200000,0.0],[1926201600000,0.0],[1928880000000,0.0],[1931299200000,0.0],[1933977600000,0.0],[1936569600000,0.0],[1939248000000,0.0]],"3":[[1626307200000,2324.304451],[1628985600000,1566.987422],[1631664000000,3475.997451],[1634256000000,3873.187493],[1636934400000,4007.041298],[1639526400000,3453.613387],[1642204800000,9296.63324],[1644883200000,6846.666481],[1647302400000,5857.269396],[1649980800000,4407.932405],[1652572800000,3663.093754],[1655251200000,2785.114114],[1657843200000,2468.736219],[1660521600000,1904.781688],[1663200000000,1878.02413],[1665792000000,1601.051508],[1668470400000,1156.969113],[1671062400000,974.1668535],[1673740800000,913.4646029],[1676419200000,870.0247773],[1678838400000,823.1838831],[1681516800000,734.0328083],[1684108800000,674.78965],[1686787200000,598.8992325],[1689379200000,484.8785306],[1692057600000,488.5056825],[1694736000000,484.75681],[1697328000000,475.2443831],[1700006400000,461.3263337],[1702598400000,444.1364602],[1705276800000,424.6136372],[1707955200000,403.5287763],[1710460800000,381.5091289],[1713139200000,359.0598517],[1715731200000,336.5829378],[1718409600000,314.3936937],[1721001600000,292.7349907],[1723680000000,271.7895206],[1726358400000,251.6902849],[1728950400000,232.5295326],[1731628800000,214.3663453],[1734220800000,197.2330457],[1736899200000,181.1405921],[1739577600000,166.0830985],[1741996800000,152.0416054],[1744675200000,138.9872098],[1747267200000,126.8836508],[1749945600000,115.6894307],[1752537600000,105.3595452],[1755216000000,95.84688205],[1757894400000,87.10334228],[1760486400000,79.08072861],[1763164800000,71.73143947],[1765756800000,65.00900194],[1768435200000,58.86847141],[1771113600000,53.26672167],[1773532800000,48.16264553],[1776211200000,43.51728292],[1778803200000,39.29389056],[1781481600000,35.45796524],[1784073600000,31.97723059],[1786752000000,28.82159555],[1789430400000,25.96309141],[1792022400000,23.37579313],[1794700800000,21.03572932],[1797292800000,18.92078491],[1799971200000,17.01059925],[1802649600000,15.28646225],[1805068800000,13.73121046],[1807747200000,12.32912437],[1810339200000,11.06582834],[1813017600000,9.928193834],[1815609600000,8.904246672],[1818288000000,7.983078603],[1820966400000,7.154763602],[1823558400000,6.410278944],[1826236800000,5.741431127],[1828828800000,5.140786607],[1831507200000,4.601607248],[1834185600000,4.117790349],[1836691200000,3.683813072],[1839369600000,3.29468108],[1841961600000,2.945881154],[1844640000000,2.633337607],[1847232000000,2.353372214],[1849910400000,2.102667488],[1852588800000,1.878233044],[1855180800000,1.677374842],[1857859200000,1.49766712],[1860451200000,1.336926784],[1863129600000,1.193190094],[1865808000000,1.064691449],[1868227200000,0.94984411],[1870905600000,0.847222691],[1873497600000,0.755547287],[1876176000000,0.673669083],[1878768000000,0.60055732],[1881446400000,0.0],[1884124800000,0.0],[1886716800000,0.0],[1889395200000,0.0],[1891987200000,0.0],[1894665600000,0.0],[1897344000000,0.0],[1899763200000,0.0],[1902441600000,0.0],[1905033600000,0.0],[1907712000000,0.0],[1910304000000,0.0],[1912982400000,0.0],[1915660800000,0.0],[1918252800000,0.0],[1920931200000,0.0],[1923523200000,0.0],[1926201600000,0.0],[1928880000000,0.0],[1931299200000,0.0],[1933977600000,0.0],[1936569600000,0.0],[1939248000000,0.0]],"4":[[1626307200000,1216.27095],[1628985600000,957.6667518],[1631664000000,2350.867277],[1634256000000,2692.248066],[1636934400000,2844.863962],[1639526400000,2499.514738],[1642204800000,4020.940494],[1644883200000,3353.833167],[1647302400000,3162.786279],[1649980800000,2652.378239],[1652572800000,2272.005303],[1655251200000,1838.919383],[1657843200000,1672.218075],[1660521600000,1357.86331],[1663200000000,1383.405526],[1665792000000,1269.68702],[1668470400000,1017.096105],[1671062400000,878.0730806],[1673740800000,789.4555119],[1676419200000,712.7393866],[1678838400000,663.9907227],[1681516800000,575.9297277],[1684108800000,513.4751153],[1686787200000,449.9193382],[1689379200000,322.830868],[1692057600000,333.3469581],[1694736000000,341.380355],[1697328000000,347.1784994],[1700006400000,350.9720978],[1702598400000,352.9752359],[1705276800000,353.3858056],[1707955200000,352.3861277],[1710460800000,350.1436932],[1713139200000,346.8119673],[1715731200000,342.531225],[1718409600000,337.4293897],[1721001600000,331.6228608],[1723680000000,325.2173193],[1726358400000,318.3085022],[1728950400000,310.9829417],[1731628800000,303.3186688],[1734220800000,295.3858761],[1736899200000,287.247542],[1739577600000,278.9600165],[1741996800000,270.5735686],[1744675200000,262.1328966],[1747267200000,253.6776044],[1749945600000,245.2426425],[1752537600000,236.8587181],[1755216000000,228.5526744],[1757894400000,220.3478424],[1760486400000,212.2643635],[1763164800000,204.3194903],[1765756800000,196.5278608],[1768435200000,188.9017523],[1771113600000,181.4513151],[1773532800000,174.1847852],[1776211200000,167.1086817],[1778803200000,160.2279862],[1781481600000,153.5463071],[1784073600000,147.0660305],[1786752000000,140.7884573],[1789430400000,134.7139282],[1792022400000,128.8419386],[1794700800000,123.1712416],[1797292800000,117.6999428],[1799971200000,112.4255856],[1802649600000,107.3452292],[1805068800000,102.4555182],[1807747200000,97.75274658],[1810339200000,93.23291415],[1813017600000,88.89177859],[1815609600000,84.72490135],[1818288000000,80.72768905],[1820966400000,76.89543064],[1823558400000,73.22333028],[1826236800000,69.70653679],[1828828800000,66.34016966],[1831507200000,63.11934203],[1834185600000,60.03918101],[1836691200000,57.09484531],[1839369600000,54.28154083],[1841961600000,51.59453394],[1844640000000,49.0291631],[1847232000000,46.58084862],[1849910400000,44.24510111],[1852588800000,42.0175283],[1855180800000,39.89384088],[1857859200000,37.86985701],[1860451200000,35.94150602],[1863129600000,34.1048311],[1865808000000,32.3559913],[1868227200000,30.69126275],[1870905600000,29.10703928],[1873497600000,0.0],[1876176000000,0.0],[1878768000000,0.0],[1881446400000,0.0],[1884124800000,0.0],[1886716800000,0.0],[1889395200000,0.0],[1891987200000,0.0],[1894665600000,0.0],[1897344000000,0.0],[1899763200000,0.0],[1902441600000,0.0],[1905033600000,0.0],[1907712000000,0.0],[1910304000000,0.0],[1912982400000,0.0],[1915660800000,0.0],[1918252800000,0.0],[1920931200000,0.0],[1923523200000,0.0],[1926201600000,0.0],[1928880000000,0.0],[1931299200000,0.0],[1933977600000,0.0],[1936569600000,0.0],[1939248000000,0.0]],"5":[[1626307200000,1975.029434],[1628985600000,1624.997181],[1631664000000,5037.772977],[1634256000000,6041.18977],[1636934400000,6475.54598],[1639526400000,5783.187677],[1642204800000,8517.355611],[1644883200000,7308.835981],[1647302400000,6921.650519],[1649980800000,5898.886849],[1652572800000,5118.049332],[1655251200000,4204.493285],[1657843200000,3841.847069],[1660521600000,3151.57788],[1663200000000,3158.696558],[1665792000000,3085.218184],[1668470400000,2925.744282],[1671062400000,2929.345137],[1673740800000,2953.373271],[1676419200000,2931.392117],[1678838400000,2902.778999],[1681516800000,2728.860954],[1684108800000,2581.340651],[1686787200000,2394.354827],[1689379200000,2020.809113],[1692057600000,1970.639299],[1694736000000,1902.773617],[1697328000000,1822.149753],[1700006400000,1732.807966],[1702598400000,1638.023021],[1705276800000,1540.42154],[1707955200000,1442.084941],[1710460800000,1344.638809],[1713139200000,1249.329917],[1715731200000,1157.092153],[1718409600000,1068.602667],[1721001600000,984.3294432],[1723680000000,904.5714327],[1726358400000,829.4922483],[1728950400000,759.1483344],[1731628800000,693.5124121],[1734220800000,632.4928891],[1736899200000,575.9498511],[1739577600000,523.7081576],[1741996800000,475.5680949],[1744675200000,431.3139817],[1747267200000,390.7210535],[1749945600000,353.5609194],[1752537600000,319.6058279],[1755216000000,288.6319498],[1757894400000,260.4218529],[1760486400000,234.7663133],[1763164800000,211.4655903],[1765756800000,190.3302652],[1768435200000,171.1817324],[1771113600000,153.8524152],[1773532800000,138.1857645],[1776211200000,124.0360922],[1778803200000,111.2682784],[1781481600000,99.75738497],[1784073600000,89.38820532],[1786752000000,80.05476935],[1789430400000,71.65982283],[1792022400000,64.11429419],[1794700800000,57.33676028],[1797292800000,51.25291898],[1799971200000,45.79507523],[1802649600000,40.90164556],[1805068800000,36.51668347],[1807747200000,32.5894291],[1810339200000,29.07388375],[1813017600000,25.92841019],[1815609600000,23.11535897],[1818288000000,20.60072025],[1820966400000,18.35380068],[1823558400000,16.34692443],[1826236800000,14.55515733],[1828828800000,12.95605296],[1831507200000,11.52941958],[1834185600000,10.25710655],[1836691200000,9.12280895],[1839369600000,8.111889369],[1841961600000,7.21121535],[1844640000000,6.409011558],[1847232000000,5.69472541],[1849910400000,5.058905142],[1852588800000,4.493089295],[1855180800000,3.989706646],[1857859200000,3.541985725],[1860451200000,3.143873058],[1863129600000,2.789959366],[1865808000000,2.475413021],[1868227200000,2.195920077],[1870905600000,1.947630288],[1873497600000,1.727108532],[1876176000000,0.0],[1878768000000,0.0],[1881446400000,0.0],[1884124800000,0.0],[1886716800000,0.0],[1889395200000,0.0],[1891987200000,0.0],[1894665600000,0.0],[1897344000000,0.0],[1899763200000,0.0],[1902441600000,0.0],[1905033600000,0.0],[1907712000000,0.0],[1910304000000,0.0],[1912982400000,0.0],[1915660800000,0.0],[1918252800000,0.0],[1920931200000,0.0],[1923523200000,0.0],[1926201600000,0.0],[1928880000000,0.0],[1931299200000,0.0],[1933977600000,0.0],[1936569600000,0.0],[1939248000000,0.0]]}

A: You'll need to verify things are correct, but since these are lists of lists and not tuples, and the dates weren't converted, I took some liberties. In the end, if you create your code to call the function the same way I do here, there's no reason your code shouldn't work.
setting your dictionary example to data and reading it in...
df2 = pd.json_normalize(data).T
df2.rename(columns={0:'cashflows'}, inplace=True)

#note datetime function to convert the date
def xnpv(rate,cashflows):
    chron_order = sorted(cashflows, key = lambda x: x[0])
    t0 = chron_order[0][0] #t0 is the date of the first cash flow
    return sum([cf/(1+rate)**((datetime.fromtimestamp(t/1000)-datetime.fromtimestamp(t0/1000)).days/365.0) for (t,cf) in chron_order])

# this is the line you need fix in your code
df2['XNPV']=df2.apply(lambda x: xnpv(0.12,x['cashflows']), axis=1)

Output
                                           cashflows           XNPV
1  [[1622505600000, -177638.2140590313], [1626307...  -14092.197419
2  [[1626307200000, 1499.224024], [1628985600000,...   42989.007430
3  [[1626307200000, 2324.304451], [1628985600000,...   67357.553372
4  [[1626307200000, 1216.27095], [1628985600000, ...   46127.473827
5  [[1626307200000, 1975.029434], [1628985600000,...  112983.922505


text:
Q: How To Add JScrollPane Into Jpanel With Null Layout? Project Snapshot
i want to add jscrollpane into my panel to add some more content but it is not working with panel to can any one solve this problem please hurry.....
it is not appears in my panel i have tried many times but is it not working
import java.awt.Color;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

import java.awt.Font;

import javax.swing.JTextField;
import javax.swing.border.EtchedBorder;
import javax.swing.border.LineBorder;
import javax.swing.JTextArea;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JRadioButton;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import java.util.Random;

public class JavaProject2_15 {

    private JFrame frame;
    private JTextField textField_6;
    private JTextField textField_5;
    private JTextField textField_4;
    private JTextField textField;
    private JTextField textField_1;
    private JTextField textField_2;
    private JTextField textField_3;
    private JComboBox comboBox;
    private JTextArea textArea;
    private static Connection con;
    private PreparedStatement PStat;
    private ResultSet res;
    private String Gender;
    private String Combobox;
    private String query;
    private JTextField textField_7;
    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    JavaProject2_15 window = new JavaProject2_15();
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the application.
     */
    public JavaProject2_15() {
        initialize();
    }

    public void getDataJavaProject2_13()
    {
        frame.setVisible(true);
    }

    /**
     * Initialize the contents of the frame.
     */
    private void initialize() {

        frame = new JFrame();
        frame.setBounds(100, 100, 913, 700);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().setLayout(null);

        JPanel panel = new JPanel();
        panel.setBounds(10, 11, 877, 94);
        panel.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));
        panel.setBackground(Color.decode("#35485E"));
        frame.getContentPane().add(panel);
        panel.setLayout(null);

        JLabel lblNewLabel_1 = new JLabel("Customer Entry");
        lblNewLabel_1.setFont(new Font("Times New Roman", Font.BOLD, 20));
        lblNewLabel_1.setForeground(Color.WHITE);
        lblNewLabel_1.setBounds(380, 34, 179, 22);
        panel.add(lblNewLabel_1);

        JPanel panel_1 = new JPanel();
        panel_1.setBounds(10, 116, 689, 534);
        panel_1.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));
        frame.getContentPane().add(panel_1);
        panel_1.setLayout(null);

        JLabel lblNewLabel = new JLabel("Product Code :");
        lblNewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        lblNewLabel.setBounds(37, 29, 111, 14);
        panel_1.add(lblNewLabel);

        JLabel lblCustomerName = new JLabel("Product Name :");
        lblCustomerName.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        lblCustomerName.setBounds(37, 70, 111, 14);
        panel_1.add(lblCustomerName);

        JLabel lblAddress = new JLabel("Selling Price :");
        lblAddress.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        lblAddress.setBounds(37, 324, 111, 14);
        panel_1.add(lblAddress);

        JLabel lblCity = new JLabel("Cost Price :");
        lblCity.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        lblCity.setBounds(37, 284, 111, 14);
        panel_1.add(lblCity);

        JLabel lblState = new JLabel("Sub Category :");
        lblState.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        lblState.setBounds(37, 151, 111, 14);
        panel_1.add(lblState);

        JLabel lblPincode = new JLabel("Reorder Point :");
        lblPincode.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        lblPincode.setBounds(37, 364, 111, 14);
        panel_1.add(lblPincode);

        JLabel lblContactNo = new JLabel("Opening Stock :");
        lblContactNo.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        lblContactNo.setBounds(37, 401, 111, 14);
        panel_1.add(lblContactNo);

        JLabel lblEmailId = new JLabel("Discount :");
        lblEmailId.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        lblEmailId.setBounds(37, 439, 111, 14);
        panel_1.add(lblEmailId);

        JLabel lblRemarks = new JLabel("Remarks :");
        lblRemarks.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        lblRemarks.setBounds(37, 201, 111, 14);
        panel_1.add(lblRemarks);

        textField_6 = new JTextField();
        textField_6.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        textField_6.setColumns(10);
        textField_6.setBounds(135, 435, 202, 28);
        textField_6.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));
        panel_1.add(textField_6);

        textField_5 = new JTextField();
        textField_5.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        textField_5.setColumns(10);
        textField_5.setBounds(135, 396, 202, 28);
        textField_5.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));
        panel_1.add(textField_5);

        textField_4 = new JTextField();
        textField_4.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        textField_4.setColumns(10);
        textField_4.setBounds(135, 357, 202, 28);
        textField_4.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));
        panel_1.add(textField_4);

        textField = new JTextField();
        textField.setEditable(false);
        textField.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        textField.setColumns(10);
        textField.setBounds(135, 26, 202, 28);
        textField.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));
        panel_1.add(textField);

        textField_1 = new JTextField();
        textField_1.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        textField_1.setColumns(10);
        textField_1.setBounds(135, 67, 202, 28);
        textField_1.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));
        panel_1.add(textField_1);

        textField_2 = new JTextField();
        textField_2.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        textField_2.setColumns(10);
        textField_2.setBounds(135, 279, 202, 28);
        textField_2.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));
        panel_1.add(textField_2);

        textField_3 = new JTextField();
        textField_3.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        textField_3.setColumns(10);
        textField_3.setBounds(135, 318, 202, 28);
        textField_3.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));
        panel_1.add(textField_3);

        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setBounds(135, 181, 363, 87);
        panel_1.add(scrollPane);

        textArea = new JTextArea();
        scrollPane.setViewportView(textArea);
        textArea.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));

        comboBox = new JComboBox();
        comboBox.setFont(new Font("Times New Roman", Font.PLAIN, 14));
        comboBox.setModel(new DefaultComboBoxModel(new String[] {"States Of India", "Andhra Pradesh ", "Arunachal Pradesh ", "Assam", "Bihar ", "Goa ", "Gujarat ", "Haryana ", "Himachal Pradesh", "Jammu & Kashmir", "Karnataka", "Kerala ", "Madhya Pradesh ", "Maharashtra ", "Manipur ", "Meghalaya ", "Mizoram ", "Nagaland ", "Orissa ", "Punjab", "Rajasthan ", "Sikkim ", "Tamil Nadu ", "Tripura ", "Uttar Pradesh ", "West Bengal ", "Chhattisgarh", "Uttarakhand ", "Jharkhand ", "Telangana "}));
        comboBox.setBounds(135, 145, 202, 25);
        comboBox.setBorder(new EtchedBorder(EtchedBorder.RAISED, Color.decode("#0080AA"), Color.decode("#0080AA")));
        panel_1.add(comboBox);

        JComboBox comboBox_1 = new JComboBox();
        comboBox_1.setFont(new Font("Times New Roman", Font.PLAIN, 14));
        comboBox_1.setBorder(new EtchedBorder(EtchedBorder.RAISED, Color.decode("#0080AA"), Color.decode("#0080AA")));
        comboBox_1.setBounds(135, 109, 202, 25);
        panel_1.add(comboBox_1);

        JLabel lblCategory = new JLabel("Category :");
        lblCategory.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        lblCategory.setBounds(37, 116, 111, 14);
        panel_1.add(lblCategory);

        textField_7 = new JTextField();
        textField_7.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        textField_7.setColumns(10);
        textField_7.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));
        textField_7.setBounds(135, 474, 202, 28);
        panel_1.add(textField_7);

        JLabel lblVat = new JLabel("VAT :");
        lblVat.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        lblVat.setBounds(37, 481, 111, 14);
        panel_1.add(lblVat);

        JPanel panel_2 = new JPanel();
        panel_2.setBounds(723, 116, 164, 356);
        panel_2.setBorder(new LineBorder(Color.decode("#0080AA"), 2, true));
        frame.getContentPane().add(panel_2);
        panel_2.setLayout(null);

        JButton btnNewButton = new JButton("New ");
        btnNewButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                Customer_ID();
                textField_1.setText("");
                textField_2.setText("");
                textField_3.setText("");
                comboBox.setSelectedIndex(0);
                textField_4.setText("");
                textField_5.setText("");
                textField_6.setText("");
                textArea.setText("");
                lblVat.setText("");
            }
        });
        btnNewButton.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        btnNewButton.setBounds(35, 27, 89, 40);
        btnNewButton.setBackground(Color.decode("#2788D7"));
        btnNewButton.setForeground(Color.BLACK);
        panel_2.add(btnNewButton);

        JButton btnSave = new JButton("Save");
        btnSave.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                Create();
            }
        });
        btnSave.setForeground(Color.BLACK);
        btnSave.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        btnSave.setBackground(new Color(39, 136, 215));
        btnSave.setBounds(35, 80, 89, 40);
        panel_2.add(btnSave);

        JButton btnUpdate = new JButton("Update");
        btnUpdate.setForeground(Color.BLACK);
        btnUpdate.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        btnUpdate.setBackground(new Color(39, 136, 215));
        btnUpdate.setBounds(35, 134, 89, 40);
        panel_2.add(btnUpdate);

        JButton btnDelete = new JButton("Delete");
        btnDelete.setForeground(Color.BLACK);
        btnDelete.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        btnDelete.setBackground(new Color(39, 136, 215));
        btnDelete.setBounds(35, 185, 89, 40);
        panel_2.add(btnDelete);

        JButton btnGetdata = new JButton("Get Data");
        btnGetdata.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                JavaProject2_14 obj=new JavaProject2_14();
                obj.getDataJavaProject2_14();
            }
        });
        btnGetdata.setForeground(Color.BLACK);
        btnGetdata.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        btnGetdata.setBackground(new Color(39, 136, 215));
        btnGetdata.setBounds(35, 236, 89, 40);
        panel_2.add(btnGetdata);

        JButton btnClose = new JButton("Close");
        btnClose.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                frame.setVisible(false);
            }
        });
        btnClose.setForeground(Color.BLACK);
        btnClose.setFont(new Font("Times New Roman", Font.PLAIN, 13));
        btnClose.setBackground(new Color(39, 136, 215));
        btnClose.setBounds(35, 287, 89, 40);
        panel_2.add(btnClose);
    }
}

A: I have found my Answer instead of using absolute layout I preferred to use GroupLayout because in this we can layout component to its absolute position in JPanel and we can also add JScrollPane to the JPanel Easily.


text:
Q: Mathematicians who overcame academic failure to achieve success Does anyone have any story of mathematicians who overcame "academic failure" or setbacks to achieve success later as a result of their perseverance? This is a soft question, that hopefully can inspire aspiring students.
New edit: I am especially interested in academic failure (e.g. failure of exams, failure in proof/ wrong proof, failure in getting academic jobs).  This is to narrow down the question so it is not too broad. There is another related question on blind/disabled mathematicians which is very good: Who are some blind or otherwise disabled mathematicians who have made important contributions to mathematics?
My ideal accepted answer is a relatively less well known answer (so that we all learn something new), supported by factual evidence (e.g.  a hyperlink to a page or a quote).
Some that I can list are:
1) Zhang Yitang, who worked in Subway (arguably a sort of a setback) but later proved a result related to the Twin Prime Conjecture.
2) Robion Kirby, who failed his oral Ph.D. qualifying examination (http://www-groups.dcs.st-and.ac.uk/history/Biographies/Kirby.html) but later proved the "torus trick".
Thanks! (Hope this question is on topic for Math Stackexchange..)

A: Andrew Wiles with his Fermat proof is an example of massive struggle. He worked on the topic for 9 years and got demolished when presenting an erroneous proof after 7 years. There were several additional problems, but I forgot the details. You can read about it on Wiki and in much detail in the very accessible "Fermat's Last Theorem" by Simon Singh.

A: John Nash struggled with significant mental health issues when he should have been in the twilight of his mathematical journey. He and his wife spent many difficult years battling with this illness. Slowly, Nash started to get back in touch with the mathematical community in Princeton; engaging with the students, his passion for mathematics never died. It was in his latter years that he was awarded the nobel prize in economics for his contribution to game theory.

A: The analytic number theorist Hua Loo-Keng overcame abject poverty, handicappedness, political persecution; for more information refer to one of his faithful biography.
Charles Hermite overcame much too, but in different aspects; he failed nearly every math exam that he was to take.
To supplement, the analytic number theorist Chen Jing-Run, the man closest to Goldbach conjecture (who proved "1 + 2") and a student of Hua Loo-Keng, overcame unemployment, poverty, and political persecution; the serial political persecution done unto him was even more violent. But he survived anyway.

A: Srinivasa Ramanujan was such a mathematician. He failed to got admitted to college but he became one of the best mathematician of $20$th century.
Evariste Galois failed to enter to Ecole Polytechnique twice.

A: Grigori Perelman who possibly proved a generalization of the Poincare Conjecture - the Thurston Geometrization Conjecture  ( has anyone claimed to show any flaw in the proof yet? ).
That being said, it seems that it's not very uncommon with odd behaviour amongst great mathematicians. They have a huge uphill struggle. Anything they discover could overshine or put others' work in the shadows with all the nasty responsive behaviours which that could provoke in any community. Especially if they are also a political nuisance (like Galois was).


text:
Q: get_headers() not returning Content-Length element Function get_headers() does not give an array with the same indexes when I make a change in domain. When and why does this occur?
I want Content-Length value for hundreds of domains. What changes do I need to make?
<?php
$url = 'http://www.ecomexpomelbourne.com.au/sponsors/';
echo "<pre>";
$domain_data[] = array();
$domain_data = get_headers( $url, 1 );
print_r($domain_data);
echo $domain_data['Last-Modified'];
?>

When used for current page url I get Content-Length index

A: Sometimes the server just does not send the Content-length header, and you should expect and treat properly such cases, as there are such provisions described in RFC2616.
In some situations, when the page is dynamically generated (with PHP or other language), the length of the body is not known yet at the stage of the sending of headers, so there is no way for the server to generate proper Content-length header in advance. But there are also cases when the Content-length header is explicitly forbidden to be sent.

A: PWS is hopelessly outdated, use IIS instead. I'm not sure that PWS allows to configure response headers and I can't find any docs. This is what it sends now:
Cache-Control:private
Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/html; charset=utf-8
Date:Tue, 09 Dec 2014 09:46:13 GMT
Expires:Mon, 08 Dec 2014 09:46:13 GMT
Server:PWS/8.1.20.5
Set-Cookie:www.ecomexpomelbourne.com.au_trackingData=; path=/
Transfer-Encoding:chunked
Vary:Accept-Encoding
X-AspNet-Version:4.0.30319
X-Powered-By:ASP.NET
X-Px:nc h0-s4.p1-hyd ( h0-s2.p6-lhr), nc h0-s2.p6-lhr ( origin)

there is no Content-length


text:
Q: Adding IDs based on groups I'm trying to find a solution using tidyverse syntax to solve the following issue.
Given a table of video frame types and sizes, I'd like to group them into "Groups of Pictures". A GOP starts whenever an I-frame occurs. So, given this data:
d.test <- tribble(
  ~frame_type, ~frame_size,
  "I", 960,
  "B", 23,
  "P", 48,
  "B", 58,
  "I", 501,
  "B", 23,
  "P", 48,
  "B", 58
)

I would like the first four frames to belong to group 1, the next four to group 2, etc. Groups can be of different lengths, so just using a trick with modulo four is not enough.
I first tried this:
d.test %>%
    mutate(group = group_indices(., frame_type))

… but it repeats the group index over the entire dataframe.
I also tried the my_rleid function suggested here:
my_rleid <- function(x) {
  1L + cumsum(dplyr::coalesce(x != dplyr::lag(x), FALSE))
}

… but this includes all frame types, so returns group IDs of 1, 2, 3, 4, and so on.

A: I could get it working by calculating the cumulative sum of a comparison of the frame type against I:
d.test %>%
  mutate(group = cumsum(frame_type == "I"))

This returns:
  frame_type frame_size group
  <chr>           <dbl> <int>
1 I                 960     1
2 B                  23     1
3 P                  48     1
4 B                  58     1
5 I                 501     2
6 B                  23     2
7 P                  48     2
8 B                  58     2


text:
Q: Lazy man logging I have a spring application serving web requests. Each request method looks like this
@RequestMapping(value = someUri, method = RequestMethod.POST)
Response someUriProcessor (SomeRequestModelMethod request) throws Exception {

    try (JsonLogger logger = new JsonLogger(request, loggingTest1Uri)){
        // get actual result
        Response result = getSomeResultMethod(request);
        // feed result to special logging object
        logger.setResult (result);
        // return result to client
        return result;
    }
}

JsonLogger class generate JSON object in close method and log it via standard slf4j logging framework which is uploaded to log analyzer tool (Splunk), it logs request, response, response time and so on.
During execution of getSomeResultMethod which does a lot of work lots of useful logs are generated using standard slf4j with logback binding in production.
I want these logs to be included in JsonLogger without touching all the underlying classes (there are LOTS of them), say using method JsonLogger.appendToResultLog(String txt). My first thought is create my own wrapping slf4j binding, unwind stacktrace on each call to logger.info, logger.error and so on methods using reflection up to rest controller method and append log string JsonLogger in it.
I have strong feeling that I'm inventing a bicycle. Are there any more-or-less standard way to achieve results required?

A: Ended up with no aspects and reflection - just custom logback appender.
public class JsonInnerLogsAppender extends AppenderBase<ILoggingEvent> {
    public JsonInnerLogsAppender () {
        this.setName("JSON_LOGGING_INTERNAL");
    }
    @Override
    protected void append(ILoggingEvent eventObject) {
        JsonLogger.putLogInfo(eventObject.getFormattedMessage());
    }
}

And JsonLogger like this
public class JsonLogger implements AutoCloseable {

    /**
     * Contains mapping between current thread id and corresponding JsonLogger object
     */
    private static transient ConcurrentHashMap<Long, JsonLogger> loggersMap = new ConcurrentHashMap<>();

    /**
     * Should be configured with special appender pattern, like
     * <encoder>
     *     <pattern>%date{ISO8601} [%-18thread] %-5level %msg %logger{70}%n</pattern>
     * </encoder>
     */
    private transient Logger logger = LoggerFactory.getLogger(getClass());
    private transient static Gson gson = new Gson();

    /**
     * Container that would be serialized to JSON after close and added to JSON log
     */
    private final JsonLogContainer logContainer;

    public JsonLogger (Object request, HttpServletRequest servletRequest) {
        this.logContainer = new JsonLogContainer(gson.toJson(request), servletRequest.getRequestURI());
        // request is started
        loggersMap.put(Thread.currentThread().getId(), this);
    }

    /**
     * @param logString formatted log string, called from custom appender
     */
    public static void putLogInfo (String logString) {
        // find appropriate JsonLogger instance (if any) and append log to it
        JsonLogger jsonLogger = loggersMap.get(Thread.currentThread().getId());
        if ( null != jsonLogger ) {
            jsonLogger.putLogToContainer(logString);
        }
    }

    private void putLogToContainer (String logString) {
        logContainer.putLog(logString);
    }

    @Override
    public void close() throws Exception {
        String log = this.logContainer.getLog(new Date());
        // request is completed
        loggersMap.remove(Thread.currentThread().getId());
        // put record to JSON log
        logger.info(log);
    }

    public void setResult(Object result) {
        logContainer.setResponse(gson.toJson(result));
    }
}

A: There are indeed a few simpler alternatives. I think the cleanest way with spring is to create a custom Interceptor (which is pretty much like a servlet filter, but with more refined functionality).
You can read a bit more about them in the Spring documentation.
I forgot to add that there might be a even simpler solution using Logback Access, which is a tiny libray from logback to log information about request and responses.


text:
Q: i am working with a userscript here and i'm trying to bypass a linkvertise im new to coding i dont know how to write javascript i only know how to change a few things like values and stuff i am trying to bypass linkvertise but the website the linkvertise redirects me to is invalid unless i wait 15 seconds i found code to make it think i have waited 15 seconds when in reality its only 1 second (i dont even know if it actually does that or not because i haven't tested it) (function() {setTimeout(() => {console.log("Redirecting")}, 15100);
and i am trying to put it inside of this code !async function(){"use strict";let e=new XMLHttpRequest;e.responseType="json",e.open("GET",https://bypass.bot.nu/bypass2?url=${document.location.href.slice(0,-1)},!0),e.onload=function(n){4===e.readyState&&(document.location.href=this.response.destination)},e.send(null)}(); to make it bypass the linkvertise and make it think i waited 15 seconds and when i try to put it in the code it doesn't work so can someone put it inside for me and fix the code that makes it think i waited 15 seconds if there is anything to fix in it.
this is the link of where i got the code that makes it think i waited 15 seconds that i dont even know if it makes it think i waited 15 seconds https://greasyfork.org/en/scripts/450331-krnl-bypass/code
and this is the code i am trying to put it in https://greasyfork.org/en/scripts/435099-linkvertise


text:
Q: Launching another activity from a 'screen pinned' activity http://florent-dupont.blogspot.ro/2015/02/android-5-screen-pinning.html

From a pinned app, you cannot start a secondary app, unless this one
  has the same shared user ID (which means that the sharedUserIdis set
  in the AndroidManifest.xml and that second application is packaged
  with the same certificate). Other apps' Activities won't be allowed to
  be started and doing so (by using Context.startActivity()) will simply
  be ignored.

I have done just those two things above but startActivity() is still getting ignored.
From https://developer.android.com/reference/android/R.attr.html#lockTaskMode:

If the system is already in lockTask mode when a new task rooted at
  this activity is launched that task will or will not start depending
  on whether the package of this activity has been whitelisted.

It looks tome like I have taken the necessary steps for this to work.
Anybody out there who got this working ?
    @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    ComponentName deviceAdmin = new ComponentName(this, AdminReceiver.class);
    mDpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);

    if (!mDpm.isAdminActive(deviceAdmin)) {
        Toast.makeText(this, getString(R.string.not_device_admin), Toast.LENGTH_SHORT).show();
    }

    if (mDpm.isDeviceOwnerApp(getPackageName()))
    {
        mDpm.setLockTaskPackages(deviceAdmin, new String[]{getPackageName(), "com.that.other.package"});

        try
        {

            enableKioskMode(true);

            PackageManager pm = this.getPackageManager();
            Intent it = pm.getLaunchIntentForPackage("com.that.other.package");

            if (null != it) {
                this.startActivity(it);
                Log.d(_TAG, "Started activity for com.that.other.package");
            }
        }

        catch (Exception e)
        {
            Log.e(_TAG, e.getMessage());
            finish();
        }

    } else {

        Toast.makeText(this, getString(R.string.not_device_owner), Toast.LENGTH_SHORT).show();
    }

}

private void enableKioskMode(boolean enabled) throws Exception
{
    if (enabled)
    {
        if (mDpm.isLockTaskPermitted(this.getPackageName()))
        {
            startLockTask();
            mIsKioskEnabled = true;
            mButton.setText(getString(R.string.exit_kiosk_mode));

        } else {

            Toast.makeText(this, getString(R.string.kiosk_not_permitted), Toast.LENGTH_SHORT).show();
        }

    } else {

        stopLockTask();
        mIsKioskEnabled = false;
        mButton.setText(getString(R.string.enter_kiosk_mode));
    }
}

A: Turned out I was missing the android:taskAffinity tag. Point it to the same strings in both packages and startActivity() should start behaving.