text:
Q: Google Spreadsheet: "Authorisation needed" when clicking button I made a script that should insert two new rows in Google spreadsheets and copy paste the layout and values of two other rows.
But when I press the button I get a pop up window with "authorisation needed" and can't seem to fix it.

and this is the script that it should run:

function DuplicateSelectedRows() {
  var spreadsheet = SpreadsheetApp.getActive();
  //spreadsheet.getRange('B:B').activate();
 // spreadsheet.setCurrentCell(spreadsheet.getRange('A1'));

  //Insert rows before last training (row B and C)
  spreadsheet.getActiveSheet().insertColumnsBefore(spreadsheet.getActiveRange().getColumn(), 1);
  spreadsheet.getActiveRange().offset(0, 0, spreadsheet.getActiveRange().getNumRows(), 1).activate();
  spreadsheet.getActiveSheet().insertColumnsBefore(spreadsheet.getActiveRange().getColumn(), 1);
  spreadsheet.getActiveRange().offset(0, 0, spreadsheet.getActiveRange().getNumRows(), 1).activate();

  // merge cells top
  spreadsheet.getRange('B2:C2').activate()
  .mergeAcross();
  spreadsheet.getRange('B3:C3').activate()
  .mergeAcross();

  //spreadsheet.getRangeList(['B:B', 'C:C']).activate();
  //spreadsheet.setCurrentCell(spreadsheet.getRange('A1'));
  //spreadsheet.getRange('B4:C20').activate();

  //paste values in newly created rows
  spreadsheet.getRange('D4:E20').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
  spreadsheet.getRange('B3:C3').activate();
  spreadsheet.getRange('D3:E3').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
  spreadsheet.getRange('B2:C2').activate();
  spreadsheet.getRange('D2:E2').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
};

A: *

*go back to the script editor and press run button (triangle-shaped button)

*popup window will show up asking you to authorize the script for your spreadsheet

*continue and ignore all warnings

*when you finished authorizing your script go back to your spreadsheet and press your button


text:
Q: How can i add AppBar in Windows Phone 8.1 In windows phone 8, its very easy to add an App Bar and manage it, but now i test new windows phone 8.1 SDK to build a project with new Geofencing feature but i don't know how to add an App Bar in the App.

A: In Windows Phone 8.1, We can use BottomAppBar to add App Bar. Usually we use CommandBar to create basic BottomAppBar. CommandBar contains two collection: PrimaryCommands and SecondaryCommands, It's similar with shell:ApplicationBar.Buttons and shell:ApplicationBar.MenuItems in Windows Phone 8.
Read this demo please, we create a CommandBar with two buttons: ZoomOut and ZoomIn, and two menuItem:Test01 and Test02 :
<Page.BottomAppBar>
    <CommandBar IsSticky="True" x:Name="appBar">
        <CommandBar.PrimaryCommands>
            <AppBarButton Icon="ZoomOut" IsCompact="False" Label="ZoomOut"/>
            <AppBarButton Icon="ZoomIn" IsCompact="False" Label="ZoomIn"/>
        </CommandBar.PrimaryCommands>
        <CommandBar.SecondaryCommands>
            <AppBarButton Label="Test01"/>
            <AppBarButton Label="Test02"/>
        </CommandBar.SecondaryCommands>
    </CommandBar>
</Page.BottomAppBar>

Edit: Now the code is correct!

A: Here's another way. Scroll all the way to the top of the XAML afterwards, click on the first text/string <phone:PhoneApplicationPage you can either press F4 in order to bring up the "Common" selection or you can just click on it and just go to properties and press "Common" and there you will see a new option called "ApplicationBar". This way is much better, you can create a new fresh one this way.

A: Create Class with Method
public static void AddNewAppBarinPage(Page myPage)
{
   CommandBar cbar = new CommandBar { ClosedDisplayMode = AppBarClosedDisplayMode.Minimal };
   AppBarButton appBarButton = new AppBarButton { Label = "Audio" };
   cbar.PrimaryCommands.Add(appBarButton);
   myPage.BottomAppBar = cbar;
}

use in Page:
AppBarCustom.AddNewAppBarinPage(this);

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to insert footer dynamically in every page using HTML-Sheets-of-Paper? I would like to insert a custom footer in every page dynamically, showing date and page number.
I'm using css plugin HTML-Sheets-of-Paper to create a A4 format size.
I did a small code javascript to make the job. But, in print page the div container doesn't stay in wish position.
I know that this question can be easy to some guys, but I tried several alternatives that I could think, without success.
I got:
https://fiddle.jshell.net/gustavo_sdo/avr5jw41/2/show/
Somebody can help me?

A: Try changing .page-footer to
.page-footer {
  position: absolute;
  top: 25cm;
  width: 100%;
}

A: Thanks to @robert-eckhaus for the answer.
From this I got to the css that solved my question.
The final result and the code can be seen here:
https://fiddle.jshell.net/gustavo_sdo/avr5jw41/4/show/


text:
Q: Set header for specific folder (.htaccess) For some reason, Google is indexing some of my pages that are called via AJAX and return JSON data for my website. Those pages aren't meant to be visited so I don't want them to appear on Search.
so, in .htaccess, I'm trying to set a header for a particular folder that holds all the AJAX files.
I've tried both
<Files ~ "ajax\.php$">
  Header set X-Robots-Tag "noindex, nofollow"
</Files>

and
<Files ~ "\ajax\.php$">
  Header set X-Robots-Tag "noindex, nofollow"
</Files>

but none of those seem to work.
<Files ~ "\.php$">
  Header set X-Robots-Tag "noindex, nofollow"
</Files>

however works, but then all my php pages get this header, which is not what I'm looking for of course.

A: You should add the <Directory> tag to add it only to files in the ajax directory and then do <FilesMatch> to add it to .PHP files only.
<Directory "/ajax">
   <FilesMatch "\.php$">
        #put your header set stuff here
        Header set X-Robots-Tag "noindex, nofollow"
   </FilesMatch>
</Directory>

Check out this link for some more help.
https://httpd.apache.org/docs/2.4/expr.html#examples

A: You may use it like this:
SetEnvIfNoCase Request_URI "ajax\.php$" ROBOTAG
Header set X-Robots-Tag "noindex, nofollow" env=ROBOTAG


text:
Q: subtract the values of two columns using awk or bash I have some  text files as shown below. I would like to subtract the values of column 2 and 4 and need to create a  new column to the output.
co1  co2   co3    co4

r1  15.2  13.0   21.4
r2  23    15     15.7
r3  14    8      12

desired output
co1  co2   co3   co4   diff.

r1  15.2  13.0   21.4   -6.2
r2  23    15     15.7   7.3
r3  14    8      12     2

A: The one-liner by Taku Miyakawa can be simplified if you don't have a header:
awk '{ $5 = $2 - $4 } 1' input.txt > inputdiff.txt

Or with tab separation:
awk 'BEGIN { OFS = "\t" } { $5 = $2 - $4 } 1' input.txt > inputdiff.txt

A: Note: You could put the awk commands all on one line, but this is tidier (plus more transparent and easier to modify if need be).
This so.awk script:
NR==1{print $0, "   diff.\n"}
NR>2{printf("%s\t%5.1f\n", $0, $2-$4)}

gives:
co1  co2   co3   co4     diff.

r1  15.2  13.0   21.4    -6.2
r2  23    15     15.7     7.3
r3  14    8      12       2.0

Given your data in file data.txt issue this command:
 awk -f so.awk data.txt

(You may have to adjust the formatting to fit your exact needs)

A: This one-liner works:
awk 'NR == 1 { $5 = "diff." } NR >= 3 { $5 = $2 - $4 } 1' <input.txt

It gives:
co1 co2 co3 co4 diff.

r1 15.2 13.0 21.4 -6.2
r2 23 15 15.7 7.3
r3 14 8 12 2

If you want to separate fields by tabs, this is wat you want:
awk 'BEGIN { OFS = "\t" } NR == 1 { $5 = "diff." } NR >= 3 { $5 = $2 - $4 } 1' <input.txt


text:
Q: How to Determine # of Programmers needed for a project How do you know how many programmers a particular project needs to be successful?
The company I work for fulfills orders for client companies.  We have written an in-house  warehouse management system that handles location based inventory management, order processing, bill-of-lading generation, invoicing, freight auditing and reporting (probably 50 reports).  It also has barcode scanning functions and a client portal along with dozens of other smaller features.  It also includes a full employee timeclock.  It integrates with Quickbooks, UPS and FedEx.  It handles work for at least 50 clients all differing slightly in their functionality.  For example, we import orders from files the customers send but each customer sends a different file format (csv, excel, flat file and web services) so we have well over a dozen order conversion methods setup.  Exports are the same story.
The project is complex and growing in complexity every day with over a quarter million lines of code.  It's about 250,000 lines of VB.NET code, 6,200 lines of Ruby code and maybe 5,000 lines of PHP.  It also has a MySQL database with about 200 tables.
Because of the constantly changing requirements and differing needs of dozens of clients the code itself varies greatly in the quality from extremely poor to relatively good code.
Currently, this project has only a single programmer - myself.  I also currently do all the product support for our company of 75 people or so.  That includes troubleshooting and setting up new clients and any new features that are needed.  Plus, we're trying to rewrite the whole thing to be 100% Ruby on Rails based.  And we would like to market the whole system within the next year or so to be used by other companies.
Currently, we have only myself as a programmer but I don't believe that is sufficient.  Does anyone have any recommendations for how many programmers a project of this magnitude should have or how we should go about determining the answer to that question?  Particularly given the fact that management would like the product to be commercial quality by next year?

A: The success of the product / project will depend on the commitment of the company whose paying for it. If they're going to hire more programmers / support staff, there will be an inherent decrease of productivity from the one programmer, who know has to train, teach, manage, etc.. not that it's a bad thing.. but there will be a decrease before any increase is realized.. there's also the need for business analysts, managers, sales, and the support of the product once it's commercially available..
Hosting a commercial application is much more than just creating a solid platform. there's support requirements, technical support, bug fixing, user training, etc..
do you have any good analysis / spec / estimation procedure in place? if not, start now, you can do this by yourself.
are you working your brains out right now? If so, be prepared to work twice as hard if you're expected to manage this process and continue developing (raise due?) ..
and here's the answer from my previous experience being in a similar situation in the Southern California area pricing:
5-6 people && ~500k

*

*1 Lead Developer / manager wearer of all hats (~100k - 120k)

*2 Sr. (very capable, self driven) programmers with good DB understanding and Skills (2x ~80 - 100k)

*1 Project Manager to interface with Management ($$?) this person should also be able to understand the needs of the app, and communicate those needs directly to the programmers

*1? (HTML / UI) developer? with javascript skills (i hate programming UI / Markup code)

*1? Database person? however, most good programmers have no problem creating scalable data structures, however, if you're going to get into optimization concerns, you'll at least want to have a consultant

A: I would say at least 5 persons. One for test, one for spec, support and documentation and 3devs.
There is a lot of things to be tested in you case, so a 50% dedicated tester should not be unreasonable. A person writing down the requirements and having customer support setting up your infra structure for testing etc should be there. Three developers I feel is quite low for a project like this. A large back end that is integrated to many third party systems, and a complete fronted with extremely many customized reports. I would like to have.

*

*A good back end developer (persistence / business layer)

*A good middle end / front end developer making action classes and JavaScript CSS Design.

*A good alround developer acting architect but also making code in all layers with expert help from the two other. This developer can also do things like setting up JUnit framework Maven Jenkins Git branching and so on.

What happens if you leave, becomes sick take vacation etc. One person per project is never smart. Neither is it good to be alone as you don't evolve professionally without coworkers. I work quite often alone, setting up new architectures and so on, often in teams of say 5 developers but I never evolve as much as when I say to a coworker lets set up this together and we lock our self up a week talking, discussing and choosing frameworks. Pair programming is extremely giving and can not be done with one dev, and who will make code reviews if you feel uncertain? If you get stuck who will help you? I would only undertake a one person project if it was part of a larger scope and could get expert resources called in if needed. You as a developer should not be stressed from the outside therefore the customer support guy mentioned earlier could act as a Scrum Master blocking all external impediments and he could prioritize support, new CRs and reason with the end customer if they want to change requirements as you were afraid of.

A: 1 programmer on a large codebase with all the responsibility of configuring, testing, communicating, supporting, documenting and bug fixing isn't going to have much time for writing new code or adding features (or even refactoring old code).
Break your week down by the percentage of these mandatory tasks that don't expand the business and you'll be surprised at how fast management hires extra help.
Large projects have a certain amount of associated overhead that won't go away (especially if implementing/testing with new clients all the time as you seem to be).  This is the reason you have support rotations and support in general; so some of those on the team have time to work on new features.
You might also want to look into books on software estimation.  These books may not sound like they have much to say, but they contain interesting case studies from a variety of fields and back their claims up with evidence.

A: Welcome to the oft times difficult world of resourcing!
The issue isn't one of Project Size vs Team Size. That's a very common misconception which often hides other problems which are usually management related. The issue is all about Scope.  You need to decide what it is you can achieve with your current resources - aka you.  Then you need to decide if your capacity for handling the workload is sufficient to handle the task within the time frames you have been allocated. Thus your project needs must be identified and scoped.

*

*Do you want to spend time cleaning up the existing code base?

*Is this a fundamental requirement to ensure the success of the project?

*Do you have new features to add to the system? What are the most important aspects of your project that must be dealt with, and what are the minor items that are on the wish list?

*Can any of the requirements be either abandoned, or at least put off until the next maintenance release?

When you have an idea of the scope of your requirements, you can more easily determine the workload required to achieve a result within a certain time frame. If your resources are likely to be overutilized, then you will need more staff.  If your resources are likely to be underutilized, then you may find yourself able to either move your deadline closer, or increase the scope of your project.
If your gut-instinct tells you that you don't have enough staff to manage the project, you may be correct, but you need to understand why it is that you gut is telling you this.  It's not enough to simply have a feeling.  Instead, you need to be able to examine the problem scientifically in order to provide proof to back up your instincts, and you need to be prepared to face the possibility that you instincts might even be wrong. Once you have gathered your evidence - I.e.: scoped the project, then you really need to sit down with your management and make a case for either reducing the scope of the project, or increasing the resources available to ensure the success of the project, based on the evidence at hand.


text:
Q: How to detect different Windows target platforms? I would like to create a common header file for my C/C++ files. In that header file I would like to have compile-time detection of which platform I'm building for and what type of application I'm building for that platform.
The options are:

*

*Desktop App. OS: Win 7 / Win 8.x. CPU: Intel/AMD. Device: PC/Laptop

*Windows Phone App. OS: Windows: 8.x. CPU: ARM. Device: Windows Mobile Phone

*Desktop App. OS: Windows 8.x. CPU: Intel. Device: Tablet

*Store App. OS: Windows 8.x. CPU: Intel. Device: Tablet

*Desktop App. OS: Windows RT. CPU: ARM. Device: Tablet

*Store App. OS: Windows RT. CPU: ARM. Device: Tablet

I'm not sure if [3] and [5] are actual possibilities.
I have looked at winapifamily.h but I'm not sure how to interpret (or understand) the partition table in that header file, so some help would be greatly appreciated.
In the header file I wish to create, I would like something like this:
#ifdef SOME_PREPROCESSOR_DEFINE
/* Option 1*/
#endif

#ifdef SOME_PREPROCESSOR_DEFINE
/* Option 2*/
#endif

#ifdef SOME_PREPROCESSOR_DEFINE
/* Option 3*/
#endif

#ifdef SOME_PREPROCESSOR_DEFINE
/* Option 4*/
#endif

#ifdef SOME_PREPROCESSOR_DEFINE
/* Option 5*/
#endif

#ifdef SOME_PREPROCESSOR_DEFINE
/* Option 6*/
#endif

Thank you.

A: Window versions are defined by a number of macros, see this link.  You should be able to discriminate between different versions of windows by using these.
Other pre-defined macros for visual studio are listed here.  Some combination of them should be able to help you.  For example, _M_ARM is defined for an ARM processor.


text:
Q: Chain rule differentiation - what happens with summation? I am currently going through some derivation I made for computing an error term used in neural network, and bit confused on what happened to this summation, at the derivation?
\begin{equation} \label{eq:error_term_node_layer_output}
    \begin{split}
        c &= \frac{1}{2}||{y - a_{i}^{(l)}}||^2 \\
        \delta_{i}^{(l)} &= \frac{\partial c}{\partial z_i^{(l)}}  \\
        & = \frac{\partial c}{\partial z_{i}^{(l+1)}}  \frac{\partial z_{i}^{(l+1)}}{\partial z_i^{(l)}} \\
        z_i^{(l+1)} & =  \sum_{j=1}^{\text{nodes in layer} ~\text{l}} w_{ij}^{(l)} a_{i}^{(l)} + b_i^{(l)}\\
        \frac{\partial c}{\partial z_{i}^{(l+1)}} &= \delta_{j}^{(l+1)}\\
        %&= \sum_{j=1}^{s_{l+1}} w_{ji}^{(l)}  x_{j}^{l} + b^{(l)}\\
        \frac{\partial z_i^{(l+1)}}{\partial a_i^{(l)}} &= \frac{ \partial  }{ \partial z^{(l)}_i } \sum_j W_{ij}^{(l)} f(z_i^{(l)}) + b_i^{(\ell)} \\
        &= W_{ij}^{(l)} f'(z_i^{(l)})\\
        \delta_i^{(l)} &= \delta_{j}^{(l+1)}W_{ij}^{(l)} f'(z_i^{(l)})
        %\delta_i^{(l)} &= \sum_{j=1}^{s_{(l+1)}}\delta_j^{(l+1)}w_{ji}^{(l)} %\delta_i^{(l)} &= f'(z_i^{(l)})\sum_{j=1}^{s_{(l+1)}}\delta_j^{(l+1)}w_{ji}^{(l)}
    \end{split}
\end{equation}
The math is inspired from this http://bigtheta.io/2016/02/27/the-math-behind-backpropagation.html


text:
Q: Simple Sentiment Analysis Python I am trying to make a simple sentiment analysis program. Although it works perfectly in english when I try to translate greek to english so it can analyse it it's just doesnt work. Any ideas what's wrong? How can I have problems in lines 255, 78, 194 and 62 when my program is 19 lines lmao.
from textblob import TextBlob
import googletrans

with open('mytext.txt','r') as f:
    text = f.read()
text = TextBlob(text)
sentiment = text.sentiment.polarity
translator = googletrans.Translator()
translator.detect('mytext.txt')
translator.translate('mytext.txt', src='gr', dest='en')

print(sentiment)

if sentiment<0:
    print("Το κείμενο έχει αρνητικό αίσθημα")
elif sentiment==0:
    print("Το κείμενο έχει ουδέτερο αίσθημα")
elif sentiment>0:
    print("Το κείμενο έχει θετικό αίσθημα")

The errors are the following:
C:\Users\kosta\OneDrive\Υπολογιστής\C programming>py SentimentAnalysis.py
Traceback (most recent call last):
  File "C:\Users\kosta\OneDrive\Υπολογιστής\C programming\SentimentAnalysis.py", line 9, in <module>
    translator.detect('mytext.txt')
  File "C:\Users\kosta\AppData\Local\Programs\Python\Python310\lib\site-packages\googletrans\client.py", line 255, in detect
    data = self._translate(text, 'en', 'auto', kwargs)
  File "C:\Users\kosta\AppData\Local\Programs\Python\Python310\lib\site-packages\googletrans\client.py", line 78, in _translate
    token = self.token_acquirer.do(text)
  File "C:\Users\kosta\AppData\Local\Programs\Python\Python310\lib\site-packages\googletrans\gtoken.py", line 194, in do
    self._update()
  File "C:\Users\kosta\AppData\Local\Programs\Python\Python310\lib\site-packages\googletrans\gtoken.py", line 62, in _update
    code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'


text:
Q: Different Spring Annotation XML Declarations There seem to be multiple XML tags for telling Spring to use annotations:
<context:annotation-config/>

<context:component-scan base-package="org.example" />

<mvc:annotation-driven />

<tx:annotation-driven transaction-manager="transactionManager" />

I think the first tag says to scan for annotations, the second says which package to scan (and optionally, can exclude/include what to search for). Then maybe the third says to scan for controller classes. And the last one to scan for data access annotations.
My problem understanding is:

*

*I would think tags 1 and 2 could be combined into one. So I don't know why they are separated.

*Tags 3 and 4 seem redundant to 1 and 2.

Could anyone give me a breakdown of what each tag does, and why they're not redundant? And if there are any other annotation XML tags, let me know.
EDIT
After further  investigation, I believe I found some additional information:

*

*The <context:annotation-config/> tag allows you to use annotations on variables, constructors, and methods (e.g. @Autowired, @Resource, etc).

*The <context:component-scan base-package="org.example" /> tag allows you to use annotations on classes (e.g. @Repository, @Controller, etc).

*The <tx:annotation-driven transaction-manager="transactionManager" /> tag actually enables the @Transactional tag (the <context:annotation-config/> tag allowed the @Transactional tag, but it didn't do anything).

Still not completely sure on the <mvc:annotation-driven />. I think maybe it adds further support for JSON, etc.

A: *

*Difference between annotation-config and component-scan
a) <context:annotation-config/> only looks for annotations on beans in the same application context in which it is defined. This means that, if you put <context:annotation-config/> in a WebApplicationContext for a DispatcherServlet, it only checks for @Autowired beans in your controllers, and not your services. See Section 15.2, "The DispatcherServlet" for more information.
b) Spring provides the capability of automatically detecting 'stereotyped' classes and registering corresponding BeanDefinitions with the ApplicationContext. To autodetect these classes and register the corresponding beans requires the inclusion of the component-scan element in XML where 'basePackage' would be a common parent package (or alternatively a comma-separated list could be specified that included the parent package of each class).

*tx:annotation-driven
You do provide the transaction-manager instace directly within element. annotation-config and component-scan won't.

*mvc:annotation-driven
This tag registers the DefaultAnnotationHandlerMapping and AnnotationMethodHandlerAdapter beans that are required for Spring MVC to dispatch requests to @Controllers. The tag configures those two beans with sensible defaults based on what is present in your classpath. Read more at Spring doc.

A:
I would think tags 1 and 2 could be combined into one. So I don't know why they are separated.

For reasons of backwards compatibility. Old Spring apps have to keep working, and merging the tags (which were introduced in different versions of Spring) would break that by changing the default behaviour.

Tags 3 and 4 seem redundant to 1 and 2.

See above. The 4 tags do slightly different, but complimentary things. Yes, if Spring were designed from scratch, there would be fewer of them, but the functionality needs to remain seperate.
To summarise:
<context:annotation-config/> enables annotation support in the context. This was added as part of Java 5 support, at a time when Spring still supported Java 1.4
<context:component-scan base-package="org.example" /> enables automatic scanning and configuration of beans, instead of using explicit declarations. This was added in Spring 2.5.
<mvc:annotation-driven /> is an odd one.  It is not required in order to support annotated controller (those work by default). What it does is to actually disable the old style of non-annotated controller, as well as adding support for things like JSON. This is required because older apps still use the older controller style.
<tx:annotation-driven> is required because Spring supports many different styles of transaction demarcation, one of which is the annotation style. This is most popular style, but by no means the only one.


text:
Q: Kafka does not react to listeners config Using kafka config:
# The address the socket server listens on. It will get the value returned from
# java.net.InetAddress.getCanonicalHostName() if not configured.
#   FORMAT:
#     listeners = listener_name://host_name:port
#   EXAMPLE:
#     listeners = PLAINTEXT://your.host.name:9092
listeners=PLAINTEXT://:9092

Netstat gives me this:
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp6       0      0 :::9999                 :::*                    LISTEN

Everything is default and kafka version is kafka_2.11-0.11.0.2.
I expected kafka to listen to port 9092

A: Port 9999 is JMX, and kafka does not start for other reasons.
I did this on my system:
sudo -u kafka /opt/kafka/bin/kafka-server-start.sh /etc/kafka/server.properties

And surely:
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)

which just means I don't have zookeeper running, and then zookeper logs:
Exception causing close of session 0x0 due to java.io.IOException: ZooKeeperServer not running

and now I need to start zookeeper on other node. Finally kafka has started.
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp6       0      0 :::9092                 :::*                    LISTEN


text:
Q: Google BigQuery SQL: Calculate users that come from other shops I need to count unique users by shops, where the first visit was in another shop.
I have two tables:
Visits
ShopID  UserID
10      1001
11      1002
12      1001
13      1002
14      1001
15      1003
16      1005
17      1002
18      1003
10      1005
11      1003
12      1002
13      1005

and
First_Visit:
UserID  First ShopID
1001       10
1002       13
1003       18
1005       16

Need Output as
ShopID  Total Users from other shops
10               0
11               2
12               2
13               1
14               1
15               1
16               0
17               1
18               0

I can calculate for a single ShopID , but can not calculate dynamically for each ShopID:
SELECT
shopid,
COUNT (DISTINCT UserID) AS TOTAL_USERS
FROM project.dataset.table_visits
WHERE shopid=12
AND UserID IN
(
    SELECT UserID
    FROM project.dataset.table_first_visit
    WHERE shopid<>12
)
GROUP BY shopid

How can this be done dynamically for each ShopID?

A: Hmmm . . . I am thinking you want a left join and aggregation:
select v.shop_id,
       count(*) as total_visits,
       count(distinct v.userId) as total_users,
       count(distinct case when fv.userId is null then v.userId end) as total_users_from_other_shops
from `project.dataset.table_visits` v left join
     `project.dataset.table_first_visit` fv
     on fv.userId = v.userId
group by v.shop_id

A: Try this one:
with visits as (
  select 10 as shopid, 1001 as userid union all
  select 11, 1002 union all
  select 12, 1001 union all
  select 13, 1002 union all
  select 14, 1001 union all
  select 15, 1003 union all
  select 16, 1005 union all
  select 17, 1002 union all
  select 18, 1003 union all
  select 10, 1005 union all
  select 11, 1003 union all
  select 12, 1002 union all
  select 13, 1005)
, first_visit as (
  select 1001 as userid, 10 as first_shopid union all
  select 1002, 13 union all
  select 1003, 18 union all
  select 1005, 16
)
select
  shopid,
  count(distinct if(shopid != first_shopid, userid, null)) as users_from_other_shop
from visits join first_visit using(userid)
group by shopid
order by shopid

A: Consider below join-less solution (which I expect to be more effective in terms of execution duration and orders more effective in terms of slot consumption)
select shopid, sum(flag) users_from_other_shop
from (
  select distinct shopid, userid, 1 flag
  from `project.dataset.table_visits`
  union all
  select distinct first_shopid, userid, -1
  from `project.dataset.table_first_visit`
)
group by shopid

if applied to sample data in your question - output is


text:
Q: How do I install themes? I am very new to Ubuntu and after spending a day or two with it, I think I really liked it. its very flexible and there is so much that you can do.
I want to install nice themes on machine. Whats the best place to get it?I found this link, but it talks about Ubuntu Jaunty? Will this work for me on Ubuntu 10.10?
If you have any other nice suggestions for themes please share.

A: Go to 'System --> Preferences --> Appearance' and press "Get more themes online".

Download something you like and then drop the file you downloaded to the Appearance window. The files you download are usually in the Downloads folder.

You can download other themes from other websites, just drop what you download to the Appearance window and in a few second you will have your new themes in Ubuntu.

A: That tutorial is for installing themes from one specific designer. Check out the site www.gnome-look.com for all sorts of other themes. Use the GTK2 filter to find ones better suited to Ubuntu's default Desktop Environment.
Most themes come in a .tar.gz format. To install them simply open up the Appearences app. (System > Preferences > Appearance) and click the themes tab. Once there, click on install new theme and a file browser should open. Navigate to where you saved the (theme).tar.gz file and select it. Ubuntu will then install the theme for you. If the install instructions happen to be different, the author usually posts them on the theme download page.
If you're looking for some cool themes, check out Elementary, Victory, and the
Faenza Icon Set. They are my favorites!

A: Best place to download themes (imo) is http://gnome-look.org
Click on the link that says GTK2.x in the left hand column.
Find one that you like and download it
Go to System->Preferences->Appearance and click the install theme button. Browse to your theme and install. That's all there is to it :)

A: Just install art manager (sudo apt-get install gnome-art) and choose from different categories of elements


text:
Q: redux-thunk fetch parse response I am new to redux and reactjs and I am trying to fetch some server side data to my code.
This is my thunk fetch:
fetch(`/WebApp/Dashboard/CreateAlert`).then(response => {
    console.log(response);
});

This is what I see in the console:

In fiddler I see the response is "Success" as expected.
Is this response valid and how do I parse it, I am a bit confused and there is very little info online.
EDIT:
I changed to:
fetch(url).
then(response => response.json())
.then(json => {
    console.log(json);
});

And I received the object. Now when I send a complex type(List), I see the bellow:

A: If you want to parse a json response:
fetch(`/WebApp/Dashboard/CreateAlert`)
    .then(response => response.json())
    .then(json => {
        console.log(json);
    });

See https://developer.mozilla.org/en-US/docs/Web/API/Body for all of the methods you can use to parse the response body.


text:
Q: How to lock a windows form in c# to be always be maximized? Im working on a windows form program and I want to make the main form always maximized ,I've tried setting the WindowState to Maximized and FormBorderStyle to FixedDialog/FixedSingle and it works but the maximize button is still there so I tried setting the MaximizeBox to false but then the form is full screen and it totally covers the taskbar which is the problem ,I don't want it to be over the taskbar.
If anyone knows a solution or ever an alternative solution to the problem please feel free to help me out.

A: Keep FormBorderStyle = Sizable. Set MaximizeBox = false and MinimizeBox = false. As code behind use
public partial class frmFixedMaximized : Form
{
    private bool _changing;

    public frmFixedMaximized()
    {
        InitializeComponent();
        WindowState = FormWindowState.Maximized;
    }

    private void frmFixedMaximized_Shown(object sender, EventArgs e)
    {
        // Make resizing impossible.
        MinimumSize = Size;
        MaximumSize = Size;
    }

    private void frmFixedMaximized_LocationChanged(object sender, EventArgs e)
    {
        if (!_changing) {
            _changing = true;
            try {
                // Restore maximized state.
                WindowState = FormWindowState.Minimized;
                WindowState = FormWindowState.Maximized;
            } finally {
                _changing = false;
            }
        }
    }
}

The reason for this code is that a user can still drag a window by holding its title bar. The _changing variable prevents the LocationChanged event handler to trigger itself in an endless loop.


text:
Q: Summing a Column of a Datatable I am trying to sum the column "salary." Below is my table.
public static void dataTable()
{
DataTable table = GetTable();
}
static DataTable table;
public static DataTable GetTable()
{
table = new DataTable();
table.Columns.Add("player", typeof(string));
table.Columns.Add("age", typeof(double));
table.Columns.Add("position", typeof(stats.pos));
table.Columns.Add("ovalue", typeof(double));
table.Columns.Add("dvalue", typeof(double));
table.Columns.Add("team", typeof(stats.team));
table.Columns.Add("salary", typeof(int));
table.Columns.Add("contractYears", typeof(int));
table.Columns.Add("active", typeof(bool));

table.Rows.Add("AG", 24, stats.pos.SP, 0, 4.2, stats.team.S, 1, 5, true);
table.Rows.Add("AR", 30, stats.pos.SP, 0, 2.6, stats.team.S, 7, 2, true);
table.Rows.Add("JK", 22, stats.pos.SP, 0, 3.2, stats.team.S, 1, 6, true);
}
public class stats
{
public enum pos { fiB, seB, SS, thB, OF, C, DH, SP, RP };
public enum team { S };
}

Here is my attempt at adding the salary column:
try
{
    object sumobject = (object)table.Compute("Sum(salary)", "active=true");
    double sumdouble = Convert.ToDouble(sumobject);
    payrollLabel.Text = Convert.ToString(sumdouble);
}
catch
{
    MessageBox.Show("Error in payroll");
}

However, the code always skips to the catch. It says that there is a null value in my column, but I didn't enter any. Any help would be greatly appreciated.

A: You could simplify it using LINQ:
Field as int:
var salarySum = table.AsEnumerable().Sum(x => x.Field<int>("salary"));

As double:
var salarySum = table.AsEnumerable().Sum(x => x.Field<double>("salary"));

A: you can do this
yourtable.AsEnumerable().Sum(datarow => datarow.Field<int>("salary"));

A: I am pretty sure it is something to do with the stats.pos or stats.team values.  I removed the references and it works just fine.  What do you have in stats object?
Wait... Are you initializing table before accessing it?


text:
Q: Table styling issue - column width Here I provided jssfidle
How it looks now:

What I want to achieve:

This is made through table and div with border and negative margins, and works really unpredictable in different browsers.
It should be one table, with three small menu columns on top, and below them 100% table width column with content. But in fiddle it works in different way, help me to fix that.
CSS:
#main_box{
    width:60%;
    box-sizing:border-box;

}
table#menu_table{
    position:relative;
     width:100%;
     border-collapse: collapse;

}
td.menu_item{

   width: 10%;
    border:solid 1px green;
}
tr#content_row{
    width:100%;
}
td#content{
 border:solid 1px green;

A: You need to use colspan and set up your table like this:
JSFiddle Demo

        Table Cell
        Table Cell
        Table Cell
        Table Cell
        Table Cell

        Table Cell

But using a table for this is a bit wrong - you could have a look at jQueryTools - Tabs

A: Use colspan. As you are you are yousing three column, use colspan="3"
Table Cell

Just replace your code with this:
See this: http://jsfiddle.net/wf6GR/1/

    publish
     edit
     delete

       The aid issue in in the 1960s
After the Second World War, Sweden's first sense of affiliation was with the other Nordic
countries. Its foreign policy was characterized  a will to decrease super power tensions by urging for patience and caution. Foreign Minister Östen Undén emphasised
the importance of strengthening international law and thereby backing up the rights of
small states. At the same time, Sweden was not believed to play a significant role in
world politics and should not take side in any important security .

A: Append another  tag on the menu items then apply colspan="4" on the #content.
You can add a class to the appended  tag so that you can style that to border: 0;
View example JSFiddle here.


text:
Q: Javascript Canvas Get images pixel data I have a two part question about javascript canvas:
Part 1:
I have a .jpg in the same file as my html document. I was wondering if there was a simple way of getting a pixel's color in that file without having to use context.getImageData().
Part 2:  (If part 1 is too complex to be useful.)
If I directly copy the code from this site: W3 schools getImageData() into an html file on my desktop, and add an image named img_the_scream.jpg to my desktop, then run it I get this error:
Unable to get image data from canvas because the canvas has been tainted by cross-origin data. test.html:15
Uncaught Error: SecurityError: DOM Exception 18

I don't really know why it works for the site but not for me.

A: That's a limit imposed by the Same Origin Policy : you can't read in JavaScript data served by another origin apart if the server explicitly allows it using CORS headers.
If you want to get the pixels of an image served by another server than yours and this server doesn't set this header, then you'll have to work on your server, either by using a kind of proxy or by fetching the image server side.
Note that browsers consider all files coming from file:// to be of different origin. If you try to do it locally, you must use an http server.


text: Q: Sharepoint 2013 site in Tablet Some of users wanted to access the SharePoint 2013 Document Library and list in Tablet device. The issue is some of the ribbon button and text for example "checkout" & "checkin" in Document library is very small and it's not so easy for the user using touching screen. What is different are Options to make big enough like edit document.


text:
Q: How to produce rotating movement electromagnetically with a coil and with a permanent magnet? I would like to know this:
To produce rotational motion by eletromagnetism, there are several ways and systems of doing it, but lets say I want to create rotational motion using a permanent magnet and a coil. The fixed magnet creates a constant magnetic field, and the coil, when current goes through it, creates a magnetic field, but this magnetic field has to change directions to create rotational motion, and it happens because current must change directions as well.
I know how it works, I've seen it, there are 2 brushes that current goes to and creates magnetic field. And there are 2 coils on the outside. So it doesn't matter if it is AC or DC, ok.
My question is because theoretically rotational motion is created if magnetic field changes direction, and I was wondering what would make it change direction.
If current must change directions, would it be used AC or DC to create rotational motion? Intuitively, It makes me think AC is always alternating directions and DC don't, so it would be AC.
So tools like eletric motors, drills, mixers, etc etc, use specifically Alternate Current or Direct Current?
And what current do speakers need to work?

A: You are asking about a very broad topic - let me just give a few pointers:
There are AC motors and DC motors. In principle, an AC motor may not need brushes if you tune it so the frequency of excitation matches the rotation frequency. In general, people will build these in a way that there are multiple poles on the windings - this provides more consistent torque (and guarantees a particular direction of rotation) where a "simple" coil and magnet may end up rotating either clockwise or counter clockwise.
It is possible to make a "brushless DC motor" by using an electrical circuit that reverses the direction of current through the coils; or you can uses brushes (so that when the coil reaches a certain position, the current is interrupted and current starts to flow in the next winding).
In the end, the concept for a motor is always this: turn on a current that causes attraction between two magnets (coil and permanent, or coil and coil); as the motor turns, you change which coil is energized, and what direction the current takes, to continue to generate torque in the same direction. Whether you need AC or DC for this depends in part on the operating characteristics of your motor (do you need variable speed/torque? How important is efficiency? Is your supply voltage AC or DC?).
As for speakers: they operate on AC (because they translate variations in current into variations in air pressure, which you perceive as sound). But typically you need an amplifier to take the weak electrical signal (for example, from a microphone) into the strong currents for the speaker - and that amplifier usually operate on DC (and converts the DC supply into an AC current - just like the electronic commutator of the brushless DC motor turns DC into AC).
A tech note on the "AC or DC" choice can be obtained at http://www.dartcontrols.com/2013/09/ac-and-dc-motor-drives-is-one-the-clear-choice/


text:
Q: TrayMenu cannot hide after clicking other place I have implemented tray icon menu for QT application. But the tray icon menu would not hide after clicking other places. Following is my code:
m_trayIconMenu = new QMenu(this);
m_trayIconMenu->addAction(m_restoreAction);
m_trayIconMenu->addAction(m_quitAction);
m_trayIcon = new QSystemTrayIcon(this);
m_trayIcon->setContextMenu(m_trayIconMenu);

A: Try to remove the this pointer as below.Tied you m_trayIconMenu to QSystemTrayIcon instead of parent this pointer.
m_trayIconMenu = new QMenu();
m_trayIconMenu->addAction(m_restoreAction);
m_trayIconMenu->addAction(m_quitAction);
m_trayIcon = new QSystemTrayIcon(this);
m_trayIcon->setContextMenu(m_trayIconMenu);

A: If you work in Windows, have to execute another win32 api SetForegroundWindow()
SetForegroundWindow(m_trayIconMenu->parent()->winId())

Recommend that execute it in slot 'aboutToShow' of QMenu.
This api work for me, you can try.


text:
Q: If $q$ is positive and $(q^{k+1} - 1)/({q^k}(q - 1)) < 5/4$ for all $k$, does it ever happen that $q > 5$ for some $k = K > 1$? Problem Statement

If $q$ is positive and $$\frac{q^{k+1} - 1}{{q^k}(q - 1)} < \frac{5}{4},$$
  for all $k$, does it ever happen that $q > 5$ for some $k = K > 1$?

(For my purposes, it would suffice to consider $K \equiv 1 \pmod 4$.)
My Attempts At Particular Values of $K$ (Using WolframAlpha)
$K = 5$: $q > 4.99871835823626641$
$K = 9$: $q > 4.9999979519924502095$
$K = 13$: $q > 4.9999999967231999721$
$K = 17$: $q > 4.9999999999947571200$
$K = 21$: $q > 4.9999999999999916114$
"Conclusion"
I conjecture that the answer to my question is NO, but I am currently unable to prove it.  Any helpful hints will be appreciated.

A: Assume that $q$ is greater than $1$ (since we are looking for $q$ greater than $5$). Then it follows that
$$q^{k+1}-1 \lt \frac{5}{4}(q^{k+1}-q^k)$$
$$4q^{k+1}-4 \lt 5(q^{k+1}-q^k)$$
$$5q^k-q^{k+1}-4 \lt 0$$
$$5-q-\frac{4}{q^k} \lt 0$$
$$5 \lt q+\frac{4}{q^k}$$
It seems that this will be true whenever $q \gt 5$, and for some values less than $5$ depending on the value of $k$. Is there some mistake here?


text:
Q: Perfect Forwarding Variadic Template to Standard Thread I'm trying to make a form of std::thread that puts a wrapper around the code executed in the thread. Unfortunately I can't get it to compile due likely to my poor understanding of rvalues and the Function templated type I'm trying to pass. Here's my code:
#include <vector>
#include <thread>
#include <utility>

void Simple2(int a, int b) {}

template <typename Function, typename... Args>
void Wrapper(Function&& f, Args&&... a) {
  f(std::forward<Args>(a)...);
}

class Pool {
 public:
  template <typename Function, typename... Args>
  void Binder(Function&& f, Args&&... a) {
    std::thread t(Wrapper<Function, Args...>,
                  std::forward<Function>(f), std::forward<Args>(a)...);
  }
};

int main() {
  Wrapper(Simple2, 3, 4);       // Works

  Pool pool;
  pool.Binder(Simple2, 3, 4);   // Doesn't compile
}

The Clang3.0 output that seems important here is:
/usr/include/c++/4.6/functional:1286:9: error: non-const lvalue reference to type 'void (int, int)' cannot bind to a value of unrelated type 'void (*)(int, int)'

and
note: in instantiation of function template specialization 'std::thread::thread<void (void (&)(int, int), int &&, int &&), void (&)(int, int), int, int>' requested here

Which I think is hinting at a mismatch between Wrapper<Function, Args...> and the rvalues f, a... being given to std::thread.
Curiously this compiles in GCC4.9 and newer Clang if I change the std::forward<Function>(f) to std::ref(f).

A: This is one of those rare cases where the difference between passing a function and passing a function pointer makes a difference.  If you do:
pool.Binder(&Simple2, 3, 4);

it should work.  Or alternatively you can have Binder decay its argument to a function pointer:
class Pool {
 public:
  template <typename Function, typename... Args>
  void Binder(Function&& f, Args&&... a) {
    std::thread t(Wrapper<typename std::decay<Function>::type, Args...>,
                  std::forward<Function>(f), std::forward<Args>(a)...);
  }
};

which in C++14 simplifies to:
class Pool {
 public:
  template <typename Function, typename... Args>
  void Binder(Function&& f, Args&&... a) {
    std::thread t(Wrapper<std::decay_t<Function>, Args...>,
                  std::forward<Function>(f), std::forward<Args>(a)...);
  }
};


text:
Q: Loading a Java .properties file, getting java.util.MissingResourceException: Can't find bundle for base name what am I doing wrong? I'm new to loading a custom .properties file and am doing so from within my Spring MVC app.
I have a properties file at: com.company.wtwebapp.properties.wtwebapp.properties
I have tried as below as well as a variety of combinations (leaving out the src.main.java, using "/" instead of ".") but nothing works.
          ResourceBundle rb = ResourceBundle.getBundle
          ("src.main.java.com.company.wtwebapp.properties.wtwebapp.properties");

On my classpath file I have:
<classpathentry kind="lib" path="src/main/java/com/company/wtwebapp/properties/wtwebapp.properties"/>

I always get the error:
java.util.MissingResourceException: Can't find bundle for base name src.main.java.com.company.wtwebapp.properties.wtwebapp.properties, locale en_US

I would appreciate any advice on the proper way / better way to accomplish the loading of the properties file. I have been doing a lot of searches but they are just leading to more confusion as from what I can tell what I am doing should be working (but obviously something is wrong). Thanks

A: From the javadoc:

getBundle attempts to locate a
  property resource file. It generates a
  path name from the candidate bundle
  name by replacing all "." characters
  with "/" and appending the string
  ".properties".

You are supposed to provide the basename only; remove the .properties suffix.  Also if the bundle is in the same directory as the class, remove all the path information.

A: Try loading your resource bundle like this:
ResourceBundle rb = ResourceBundle.getBundle("com.company.wtwebapp.properties.wtwebapp");

And modify your classpath entry like so:
<classpathentry kind="lib" path="src/main/java"/>


text:
Q: what is use of location while we create table in hive i created table in hive as
create table table1(id in,name string)
row format delimited
fields terminated by ','
stored as textfile
location'/home/training/desktop/shared/EMP_DATA.txt'

i want to know what is use of location even it does not load data into table
verified by
select * from table;

so what is use of location

A: Location is used to override default hive table directory. It tells where the data will be stored for a table.


text:
Q: Python-2.7 write to file I have this script:
f = open("/ggg/darr/file/", "r+")
a = 0
for line in f:
    if a ==58:
         print (line)
         line1 = "google.ca"
         f.write(line1)
         print line
    a = a+1
f.close()

I want to keep my file but only to change what is written on line 58 to "google.ca"
then save it
using linux: mint-17.2

A: # Read data from file
with open('yourfile.txt', 'r') as file:
    # read all line in the file to data array
    data = file.readlines()

# change data on line 58 (array start from 0)
data[57] = 'Data you need to change'

# Write data back
with open('yourfile.txt', 'w') as file:
    file.writelines(data)

A: You need to decide whether you want to write a new file (with print) or change the old file (with r+ mode and f.write).  You will probably be happiest if you write a new file.

A: dataRead = []
f = open("/ggg/darr/file/", "r+")
a = 0
for line in f:
    if a == 58:
       line = "google.ca"
    dataRead.append(line)
    a = a+1
f.close()

f2 = open("/some/new/file","w")
for line in dataRead:
    f2.write(line)
f2.close()

A: With the answer of Adisak Anusornsrirung I wrote it like this:
with open('sss.txt','r') as file:
data = file.readlines()

print (data[14])
file.close()
data[14] = "some data here"+"\n"
with open ("sss.txt", 'w') as file:
    file.writelines(data)
file.close()
f = open("sss.txt", 'r')
print (f.read())
f.close()


text:
Q: Amazon PHP SDK Latest Exception Handling I am creating a service using Amazon SNS and I am stuck at exception handling with the latest SDK. Basically I am not sure how to know the specific details of an exception thrown: For example, the documentation says that when a notification is published (eg. $snsClient->publish(...);), it throws errors like:

*

*InvalidParameterException

*InvalidParameterValueException

*InternalErrorException

*NotFoundException

*EndpointDisabledException

*PlatformApplicationDisabledException

*AuthorizationErrorException
However there are no real classes like these in the SDK. I suppose the publish() method would throw an Aws\Sns\Exception\SnsException.  I'd like specifically know how to grab EndpointDisabledException and NotFoundException. Am I missing anything in the documentation?


text:
Q: Could we prove that neutrinos have mass by measuring their gravitational signature? It is now said that neutrinos have mass.  If an object has mass then it also emits  a gravitational field. I appreciate the neutrinos mass is predicted to be small, but as there are so many produced by our sun and gravity works collectivity should we not be able to detect neutrinos through gravitational differences?
An extract from Wikipedia states:-

"Most neutrinos passing through the Earth emanate from the Sun. About 65 billion ($6.5 \times 10^{10}$) solar neutrinos per second pass through every square centimeter perpendicular to the direction of the Sun in the region of the Earth."

That is a great deal of neutrinos. Would that many not produce a noticeable gravitational signature that we could detect? If we can't detect it does that mean that neutrinos are massless?

A: The gravitational field of a fast moving particle is from its energy, not its rest-mass. The source of the gravitational field is the energy divided by c2 if you are using unnatural units, or what used to be called "relativistic mass" before that term fell out of favor.
The neutrinos we observe are moving at essentially the speed of light, so we cannot distinguish their gravitational signature from that of a massless particle. Both a neutrino at 1KeV and an exactly massless fermion at 1KeV have pretty much the same gravitational field. The difference is suppressed by the ratio of the mass to the energy, and it is as hard to detect as the difference in the neutrino speed from the speed of light (which is a more direct way to measure the mass, but also impractical). There are not enough neutrinos which are moving slowly compared to the order .01 eV masses, so that the number of nonrelativistic neutrinos is too small to allow their mass to be measured gravitationally.
In short, the answer is just no.

A: Neither do we know the speed of the neutrinos. Since mass=energy, anything with energy gravitates as well. Light gravitates in that manner. Neutrinos could have zero mass, but they'd still gravitate if they went at the speed of light (energy=$\frac{m_0c^2}{\sqrt{1-v^2/c^2}}$. If $m_0=0,v=c$, energy is not necessarily zero). Since their speed is disputed as well, knowing their gravitational effects doesn't help. If the "faster than light" thing pans out, they may even have complex mass (which you can see directly from the above equation). So we can't really measure if they have mass if they go faster than light by looking for a signature.
OK, if you're talking about measuring the exact mass-energy of the neutrino (which is unknown atm), that would be theoretically possible, practically impossible. Mass of $$\nu_e<2.2 eV$$ $$\nu_\mu<0.17 eV$$$$\nu_\tau<15.5  MeV$$
Pretty tiny. Multiply by 65 billion and it's still tiny. Taking only the tau neutrinos (IIRC 1/3rd of them) into account, a safe assumption as the others have negligible mass; we get $65\times10^{15} eV/c^2=1.1\times10^{-19} kg$. That may be measurable in a laboratory, but impossible to measure around the Earth. Earth's mountains, irregulatiries in the crust/mantle, and other cosmic rays would create a larger effect. The main issue is that we can't "turn off" the neutrinos to get a control case so that we can eliminate the other effects. If we do this in an accelerator, a few neutrinos have even less mass, and it's even more uncertain. Add quantum mechanics to it and I think you could say that there are no gravitational effects at all (becomes less than the planck length, &c; though mashing GR and QM like this isn't exactly accepted)
Edit: As @dmckee pointed out in the comments, I've used obsolete neutrino masses. The actual masses are much smaller, though that doesn't change the final conclusion.

A: The neutrino masses are probably on order of $1\text{ eV}$, but we need to consider their total energy (I feel like a dunce having to wait for Ron to point that out in the comments).
The solar neutrinos have energies on order of $1\text{ MeV}$.
So 65 billion neutrinos accordingly have  mass of $6.5 \times 10^{16} eV = 65 \times 10^8\text{ GeV}$ which is about the mass of a million atoms of zinc or about $65 \text{ g/mole}* (10^8\text{ atoms})/(6 \times 10^{23}\text{atoms/mole}) \approx 1 \times 10^{-15}\text{ g}$. The volume occupied is 1 square centimeter times $300,000,000$ m (lightspeed times 1 second), or about $30,000$ cubic meters. This gives us a total density of $3 \times 10^{-20} \text{ g}/\text{m}^3$.
So, short answer: In principle yes, in practice no.


text:
Q: Consume Wep Api with Header Parameter I wrote web api and consume it with postman succesfully, in header there is variable and its value.
Parameter name is ApiKey and i loaded value in the postman, So web api return answer succesfully.
But I could not consume with jquery,
It returns 401 code. I tryed bottom code but it is not worked.
$.ajax({
    url : 'http://XXX:8020/getPer/1010',
    dataType : "jsonp",
    headers: { "Content-Type":"application/json","Accept": "application/json" },
    type : 'GET',
    contentType: "application/json",
    beforeSend : function( xhr ) {
        xhr.setRequestHeader( "ApiKey", "xxxyyyzzz" );
    },
    success : function (data) {
      console.log(data);
    },
    error : function (data, errorThrown) {
      alert(3);
    }
});

I put postman result also in bottom.
SuccesfullyReturnedFromPostman

A: Postman has support to generate code for multiple languages.
check here
Dothttp also has similar option and works well with developers.
Thanks


text:
Q: no python27.dll to copy into Scripts directory I have installed python2.7.3 in d:\Python27\python  ,and
mkdir in g:\microblog, downloaded virtualenv.py in  g:\microblog,when
cd into g:microblog, i want to install flask in the g:\microblog to do it as the web
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
g:\microblog>d:\Python27\python  virtualenv.py flask
Overwriting flask\lib\orig-prefix.txt with new content
New python executable in flask\Scripts\python.exe
Traceback (most recent call last):
  File "g:\microblog\flask\lib\site.py", line 67, in <module>
    import os
  File "g:\microblog\flask\lib\os.py", line 397
    yield from walk(new_path, topdown, onerror, followlinks)
             ^
SyntaxError: invalid syntax
ERROR: The executable flask\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is u'g:\\microblog' (should be u'g:\\microblog\\flas
k')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for
 "Only this user" or have multiple versions of Python installed. Copying the app
ropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.

I can not find Python27.dll in my D:\Python27\DLLs
 Directory of D:\Python27\DLLs

08/18/2014  09:36 AM    <DIR>          .
08/18/2014  09:36 AM    <DIR>          ..
04/10/2012  11:31 PM            59,904 bz2.pyd
03/08/2011  09:39 AM            19,790 py.ico
03/08/2011  09:39 AM            19,790 pyc.ico
04/10/2012  11:31 PM           103,424 pyexpat.pyd
04/10/2012  11:31 PM             9,728 select.pyd
04/10/2012  11:31 PM           337,920 sqlite3.dll
08/28/2010  02:42 PM           867,840 tcl85.dll
08/28/2010  02:42 PM             8,192 tclpip85.dll
08/28/2010  02:45 PM         1,320,448 tk85.dll
04/10/2012  11:31 PM           686,592 unicodedata.pyd
04/10/2012  11:31 PM             8,704 winsound.pyd
04/10/2012  11:32 PM           877,056 _bsddb.pyd
04/10/2012  11:31 PM            74,240 _ctypes.pyd
04/10/2012  11:31 PM            13,824 _ctypes_test.pyd
04/10/2012  11:31 PM            70,656 _elementtree.pyd
04/10/2012  11:31 PM           285,184 _hashlib.pyd
04/10/2012  11:31 PM            46,080 _msi.pyd
04/10/2012  11:31 PM            23,552 _multiprocessing.pyd
04/10/2012  11:31 PM            40,960 _socket.pyd
04/10/2012  11:31 PM            41,984 _sqlite3.pyd
04/10/2012  11:31 PM           721,920 _ssl.pyd
04/10/2012  11:31 PM            29,184 _testcapi.pyd
04/10/2012  11:31 PM            30,208 _tkinter.pyd
              23 File(s)      5,697,180 bytes
               2 Dir(s)   5,159,092,224 bytes free

how can i fix this problem?

A: It is in c:/windows/system32/python27.dll


text:
Q: Why am I seeing "ufunc 'subtract' cannot use operands with types dtype('I have two pandas dataframes, both with datetime indices; sample output:
l1_with_nonlimiting_trace_gas_df.index:
DatetimeIndex(['2018-03-25 11:13:41+00:00', '2018-03-25 11:17:40+00:00',
               '2018-03-25 11:21:38+00:00', '2018-03-25 11:25:23+00:00',
               '2018-03-25 11:29:03+00:00', '2018-03-25 11:34:06+00:00',
               '2018-03-25 11:37:47+00:00', '2018-03-25 11:48:48+00:00',
               '2018-03-25 11:59:23+00:00', '2018-03-25 12:08:32+00:00',
               ...
               '2018-03-25 22:31:00+00:00', '2018-03-25 22:45:34+00:00',
               '2018-03-25 22:55:34+00:00', '2018-03-25 23:04:55+00:00',
               '2018-03-25 23:12:44+00:00', '2018-03-25 23:16:38+00:00',
               '2018-03-25 23:20:38+00:00', '2018-03-25 23:24:33+00:00',
               '2018-03-25 23:28:32+00:00', '2018-03-25 23:33:36+00:00'],
              dtype='datetime64[ns, UTC]', length=124, freq=None)

l1_with_limiting_trace_gas_df.index:
DatetimeIndex(['2018-03-25 11:11:38+00:00', '2018-03-25 11:15:39+00:00',
               '2018-03-25 11:19:38+00:00', '2018-03-25 11:23:27+00:00',
               '2018-03-25 11:27:11+00:00', '2018-03-25 11:32:21+00:00',
               '2018-03-25 11:35:55+00:00', '2018-03-25 11:40:09+00:00',
               '2018-03-25 11:49:39+00:00', '2018-03-25 12:00:05+00:00',
               ...
               '2018-03-25 22:46:17+00:00', '2018-03-25 22:56:26+00:00',
               '2018-03-25 23:05:53+00:00', '2018-03-25 23:10:49+00:00',
               '2018-03-25 23:14:42+00:00', '2018-03-25 23:18:42+00:00',
               '2018-03-25 23:22:36+00:00', '2018-03-25 23:26:31+00:00',
               '2018-03-25 23:31:33+00:00', '2018-03-25 23:35:34+00:00'],
              dtype='datetime64[ns, UTC]', length=130, freq=None)

When I do the get_loc operation:
index_location=l1_with_nonlimiting_trace_gas_df.index.get_loc(l1_with_limiting_trace_gas_df.index[i],method='nearest')

I get the ufunc error:
UFuncTypeError: ufunc 'subtract' cannot use operands with types dtype('<M8[ns]') and dtype('O')
That used to work in the past.  Now it no longer works.  Here are my versions:
pd.version
Out[152]: '1.0.1'
np.version
Out[154]: '1.18.1'
Some help here would be greatly appreciated.

A: Take a look at Pandas get_loc with datetimeindex failing
Just the same problem has been reported and the last comment contains explanation
that this problem occurs in Pandas version 1.0.1 (just your version).
I have version 1.0.3 and e.g. the following code works:
start = pd.Timestamp('2019-12-12 00:00')
end   = pd.Timestamp('2019-12-12 00:03')
testindex = pd.date_range(start, end, freq='10s')
findtime = pd.Timestamp('2019-12-12 0:01:16')
testindex.get_loc(findtime, method='nearest')

I got result 8.
So upgrade your Pandas.


text:
Q: How to go through a double for loop randomly in python Consider the following code:
for i in range(size-1):
    for j in range(i+1,size):
        print((i,j))

I need to go through this for-loop in a random fashion. I attempt to write a generator to do such a thing
def Neighborhood(size):
    for i in shuffle(range(size-1)):
        for j in shuffle(range(i+1), size):
            yield i, j
for i,j in Neighborhood(size):
    print((i,j))

However, shuffle cannot be applied to whatever object range is. I do not know how to remedy the situation, and any help is much appreciated. I would prefer a solution avoid converting range to a list, since I need speed. For example, size could be on the order of 30,000 and i will do perform this for loop around 30,000 times.
I also plan to escape the for loop early, so I want to avoid solutions that incorporate shuffle(list(range(size)))

A: You can use random.sample.
The advantage of using random.sample over random.shuffle, is , it can work on iterators, so in :

*

*Python 3.X you don't need to convert range() to list

*In Python 2,X, you can use xrange

*Same Code can work in Python 2.X and 3.X

Sample code :
n=10
l1=range(n)
for i in sample(l1,len(l1)):
    l2=range(i,n)
    for j in sample(l2,len(l2)):
        print(i,j)

Edit :
As to why I put in this edit, go through the comments.
def Neighborhood(size):
    range1 = range(size-1)
    for i in sample(range1, len(range1)):
        range2 = range(i+1)
        for j in sample(range2, len(range2)):
            yield i, j

A: A simple way to go really random, not row-by-row:
def Neighborhood(size):
    yielded = set()
    while True:
        i = random.randrange(size)
        j = random.randrange(size)
        if i < j and (i, j) not in yielded:
            yield i, j
            yielded.add((i, j))

Demo:
for i, j in Neighborhood(30000):
    print(i, j)

Prints something like:
2045 5990
224 5588
1577 16076
11498 15640
15219 28006
8066 10142
7856 8248
17830 26616
...

Note: I assume you're indeed going to "escape the for loop early". Then this won't have problems with slowing down due to pairs being produced repeatedly.

A: I don't think you can randomly traverse an Iterator. You can predefine the shuffled lists, though
random iteration in Python
L1 = list(range(size-1))
random.shuffle(L1)
for i in L1:
    L2 = list(range(i+1, size))
    random.shuffle(L2)
    for j in L2:
        print((i,j))

Of course, not optimal for large lists


text:
Q: continuous real-valued functions $f=g$ $\lambda$-a.e. ($\lambda$ is the Lebesgue measure) implies $f=g$ everywhere I want to show that if $f$ and $g$ are continuous real-valued functions on $\mathbb{R}$ such that $f=g$ $\lambda$-a.e. ($\lambda$ is the Lebesgue measure) then $f=g$ $\,$ everywhere.
I think that using the following fact is necessary:
FACT: If $N\subseteq \mathbb{R}$ is $\lambda$-null, then $N^c$ is dense in $\mathbb{R}$.
Since $f=g$ $\lambda$-a.e. then I know that $f(x)=g(x)$ for all $x\in \mathbb{R}\setminus N$, where $N$ is a $\lambda$-null set. I will have to show that $f(x)=g(x)$ for all $x\in N$ as well. How could I apply the fact above? Thank you

A: Note that if $\lambda(N)=0$ then $R\setminus N$ is everywhere dense in $R$. Indeed, if assume the contrary then there will be $(a,b)$ such that $(R \setminus N)\cap (a,b)=\emptyset$. This means that $N$ contains the set $(a,b)$ and hence $N$ is not of $\lambda$-measure zero.
Since $f(x)=g(x)$ for $x \in R \setminus N$, $\lambda(N)=0$  and $R\setminus N$  is  everywhere dense in $R$, for $y \in N$  you can choose $(x_k)$ from $R \setminus N$ such that $\lim_{n \to \infty}x_k=y$. Then we get $f(y)=\lim_{n \to \infty}f(x_k)=\lim_{n \to \infty}g(x_k)=g(y)$.


text:
Q: Push notification dose not work when APP is in background but not suspended and when APP is open In android and iOS push notification doesn't pop up when a new push is received on the APP when App is in foreground/ Open or when it is in background but not suspended( Not killed).
To receive a new push pop up I need to kill the app then only i would receive it.
I'm using the following plug-in for cordova:
https://github.com/phonegap/phonegap-plugin-push
Cordova version:
5.3.1
I did try to find a solution for this if anyone could point me in right direction then it would be very helpful.

A: Yes, this plugin works this way, the onreceived javascript event is triggered, but the notification is not displayed in the notification bar when the app is in foreground.
In android, in the last version, you can change this behaviour, doing your init like this:
that.push = PushNotification.init({
                        "android": {
                            "senderID": that.GOOGLE_SENDER_ID,
                            "iconColor": "gray",
                            "icon": "icon_notification",
                            "forceShow": true
                        },
                        "ios": {},
                        "windows": {}
                });

the forceShow, allows the app to show the notification when the app is in foreground.
In IOS is not possible in this moment, there is a pull request to achieve that, for the 1.6 version, but I tryied the code and I have been unable to make it work
Here you have the link
https://github.com/phonegap/phonegap-plugin-push/pull/383
By the moment, I did a workarround in IOS, showing fake notifications via JS, with this library
http://taitems.github.io/UX-Lab/iOSNotification/index.html
Also, I dont know why the notification doesn't show when the APP is suspended, This happens in both Android and IOS?
In IOS, you have to add the capabilities of push notifications, and background modes -> background fetch and remote notifications. Maybe this is your problem.
Happy coding!

A: i have not used cordova but answer you for clue that may help you.
Click here for more detail
Notifications are delivered to the notification tray when the app is inactive. For an active iOS app, notifications are instead passed to didReceiveRemoteNotification:. For an active Android app, notification payloads are passed to onMessageReceived() under the notification key in the data bundle.
So the json sending from server you should follow this
specially key "click_action".


text:
Q: Exporting content from Joomla as XML for Flash use I was wondering if anyone know how I could output content from Joomla
as XML which I can then use in Flash? I would like to be able to use
Joomla as the backend CMS and a Flash frontend which pulls and
article's content from the CMS and outputs it as XML.
Something like this:
http://www.goforgold.org.za/scripts/News.php
Many thanks,
James

A: You can do this using views. Most pages in a Joomla site are output as HTML, but you can easily change the 'view' to output XML. Where you see your files in com_component/views/view.html.php, you can use view.feed.php or even view.raw.php.
http://developer.joomla.org/tutorials/165-understanding-output-overrides-in-joomla.html
and
http://docs.joomla.org/Understanding_Output_Overrides

A: Hmmm, your example doesn't work on my side. I get a blank page. You could try using Joomla's RSS feeds


text:
Q: why does this code throw java.lang.StackOverflowError private static double convertCentimeterToInches(double d) {
    double feetPart = 0;
    double inchesPart = 0;
    if (String.valueOf(d) != null && !String.valueOf(d).trim().isEmpty()) {
        feetPart = Math.floor(convertCentimeterToInches(d) / 12);
        inchesPart = Math.ceil(convertCentimeterToInches(d) - (feetPart * 12));
    }
    return inchesPart;
}

06 - 01 02: 25: 08.037: E / XXX(1099): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java: 352)
06 - 01 02: 25: 08.037: E / XXX(1099): at java.util.concurrent.FutureTask.setException(FutureTask.java: 219)
06 - 01 02: 25: 08.037: E / XXX(1099): at java.util.concurrent.FutureTask.run(FutureTask.java: 239)
06 - 01 02: 25: 08.037: E / XXX(1099): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java: 230)
06 - 01 02: 25: 08.037: E / XXX(1099): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java: 1080)
06 - 01 02: 25: 08.037: E / XXX(1099): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java: 573)
06 - 01 02: 25: 08.037: E / XXX(1099): at java.lang.Thread.run(Thread.java: 856)
06 - 01 02: 25: 08.037: E / XXX(1099): Caused by: java.lang.StackOverflowError
06 - 01 02: 25: 08.037: E / XXX(1099): at java.lang.RealToString.longDigitGenerator(RealToString.java: 269)
06 - 01 02: 25: 08.037: E / XXX(1099): at java.lang.RealToString.convertDouble(RealToString.java: 111)
06 - 01 02: 25: 08.037: E / XXX(1099): at java.lang.RealToString.doubleToString(RealToString.java: 59)
06 - 01 02: 25: 08.037: E / XXX(1099): at java.lang.Double.toString(Double.java: 317)
06 - 01 02: 25: 08.037: E / XXX(1099): at java.lang.String.valueOf(String.java: 1625)

I am just thinking on why its throwing stackoverflow error, when everything seems to be perfect in double. There is no conversion happening from double to int or float which could result in stackoverflow.

A: You have an infinite loop, you keep on calling:
convertCentimeterToInches(d)

with no clause to end the recursion. I have not done this in a while but the correct conversion from centimeters to inches would be:
d / 2.54

As one of the answers in this previous thread What is a stack overflow error? says:

The common cause for a stack overflow is a bad recursive call.

A: StackOverflow has nothing to do with conversion from double to int or float. It happens when there's a recursive call that does not have a base condition. A function keeps calling itself again and again and the stack frames keep building up until the time that there is no more space on the stack, thus causing a StackOverflow.
Make sure that your recursive functions have a base case.

A: if (String.valueOf(d) != null && !String.valueOf(d).trim().isEmpty())

will always be true, so the method will keep calling itself, until it reaches a stack overflow error...
You need to find a condition that will break the recursion at some point.
And if you really want to convert centimeters to inches, it should probably look like:
private static double convertCentimeterToInches(double d) {
    return d / 2.54;
}

A: You have infinite recursion. To fix ...
Replace this
    feetPart = Math.floor(convertCentimeterToInches(d) / 12);
    inchesPart = Math.ceil(convertCentimeterToInches(d) - (feetPart * 12));

with this
    feetPart = Math.floor(d / 12);
    inchesPart = Math.ceil(d - (feetPart * 12));


text:
Q: ASP.NET: Forms authentication across applications: matching password encryption settings I have two websites that both create users in their own separate ASP.NET authentication databases.  Below is the Web.configs for both. I also made the aspnet_Applications database records identical on both solutions. When I create a user, the encrypted passwords are not identical, nor are the password salts.
Any idea how to make two websites create the same password hashes when both systems have the same user name and password?
<configuration>
  <system.web>
    <authentication mode="Forms" >
      <!-- The name, protection, path, validationKey, validation, decryptionKey,
           and decryption attributes must be identical across all applications.
      -->
      <forms loginUrl="~/Account/Login"
             name=".ASPXAUTH"
             protection="All"
             path="/"
             domain="contoso.com"
             timeout="2880"
             requireSSL="false"
             cookieless="UseCookies"
             enableCrossAppRedirects="true" />
    </authentication>
    <!-- Validation and decryption keys must exactly match and cannot
         be set to "AutoGenerate". The validation and decryption
         algorithms must also be the same. -->
    <!-- The validationKey is not wrapped in the solution -->
    <!-- These keys are examples -->
    <machineKey
         validationKey="C50B3C89CB21F4F1422FF158A5B42D0E8DB8CB5CDA1742572A487D940
                        1E3400267682B202B746511891C1BAF47F8D25C07F6C39A104696DB51
                        F17C529AD3CABE"
         decryptionKey="8A9BE8FD67AF6979E7D20198CFEA50DD3D3799C77AF2B72F"
         validation="SHA1"
         decryption="Auto" />
  </system.web>
</configuration>

A: The SqlMembershipProvider, which it sounds like you are using, generates a random 128-bit value as the salt. I.e., it includes this value when it hashes the user's password as a security measure. In order to ensure two independent systems produce the same hash, you would need to ensure that the PasswordSalt column value is the same for the same user. There is no property on the MembershipUser for setting the PasswordSalt. That means you either have to go directly to the db to set it, build a custom MembershipUser with this property and the ability to save it or build a custom class or method that provides this ability.


text:
Q: Postfix reject messages *without* attachments? I know this is a bit unusual, but due to circumstances beyond my control, is there anyway to tell postfix to reject messages without attachments?  I know how to reject specific attachments, but basically I only want to accept 1 or 2 attachment types, and reject all other messages (including those without any attachments, as those are clearly spam to me).

A: it's standard regex, just take what you know and reverse it.
postfix conf
mime_header_checks = regexp:/etc/postfix/mime_header_checks

/etc/postfix/mime_header_checks
!/name=[^>]*\.(pdf)/ REJECT

OR
/etc/postfix/mime_header_checks
/name=[^>]*\.(pdf)/ ACCEPT
/name=.* REJECT

https://www.cyberciti.biz/tips/postfix-block-mime-attachment-files.html


text:
Q: Пропало место после установки Kryptex Я сначала установил kryptex, он мне установил какие-то компоненты то-ли для cpu то-ли для gpu и у меня пропало около 15 гб на диске. После удаления самого kryptex'а это место не освободилось. Где могут лежать файлы, которые не удалились? Я скачал 100% не вирус, т.к качал с оф. сайта

A: Kryptex возможно докачал блокчейны. Скачай и глянь через эту программу https://wiztreefree.com/ где лежит самый большой файл с названием XMR ETH ZCH и т.п. А для майнинга на GPU используй Phoenixminer ; T-rex . А для CPU XMRIG

A: Меня зовут Дмитрий, я один из агентов Поддержки Криптекса.
При установке Криптекс просто скачивает майнеры. Криптекс автоматически увеличивает файл подкачки, который хранится на диске С. Файла подкачки может попросту не хватить, чтобы майнеры работали корректно. Удалите или уменьшите файл подкачки и место вновь "вернется".


text:
Q: What can I add to the code so that it recognizes larger or smaller text? The following code causes the WordPress plugin to have bold or italic text from Google docx, actually displayed as bold or italic
What can I add to the code so that it also recognizes larger or smaller text?
I need to set any 1-99% text size to be replaced with: 'Smaller',
And 101-199% will be changed to: Larger
I hope you understood me correctly
Code copied at the following link:
https://wordpress.org/support/topic/fix-for-missing-bold-and-italic-styling
        $raw = str_replace( '}', "}\r\n", $raw );

    preg_match_all( '#.c(?P<digit>\d+){(.*?)font-weight:700(.*?)}#', $raw, $boldmatches );
    preg_match_all('#.c(?P<digit>\d+){(.*?)font-style:italic(.*?)}#', $raw, $italicmatches);

    if( !empty( $boldmatches[ 'digit' ] ) ) {

        foreach( $boldmatches[ 'digit' ] as $boldclass ) {
            $raw = preg_replace( '#(.*?)#s', '$3', $raw );
        }

    }

    if( !empty( $italicmatches[ 'digit' ] ) ) {

        foreach( $italicmatches[ 'digit' ] as $italicclass ) {
            $raw = preg_replace( '#(.*?)#s', '$3', $raw );
        }

    }

Thanks in advance for the answers


text:
Q: Enclosing brackets when setting variables Why does this command destroy the search path?
PATH=($PATH:$HOME/bin)

The PATH appears unchanged, but the shell cannot find commands.
It was entered in error for
PATH=$PATH:$HOME/bin

Probably confused with
PATH=$(echo $PATH:$HOME/bin)

A: Using parentheses you create an array:
$ a=(x:y:z v:w:x)
$ echo ${a[0]}
x:y:z
$ echo ${a[1]}
v:w:x

In your case you created an array with one element (the whole path).  This is then not interpreted anymore as the path to search for executables.  This PATH has to be a string of directories separated by colons, not an array.

A: If you want to acheive PATH=$PATH:$HOME/bin
Try PATH=(\$PATH:\$HOME/bin)


text:
Q: PHP foreach with two 'as'? Hi there i am trying to combine two loops of foreach but i have a problem.
The problem is that the  is same to all results but they must be different.
Here is the code that i am using:
<?php
$feed = file_get_contents('http://grabo.bg/rss/?city=&affid=16090');

$rss = simplexml_load_string($feed);

$doc = new DOMDocument();
@$doc->loadHTML($feed);

$tags = $doc->getElementsByTagName('link');

foreach ($tags as $tag) {
    foreach($rss as $r){
        $title = $r->title;
        $content = $r->content;
        $link = $tag->getAttribute('href');
        echo "$title
 $content";
    }
}

?>

Where i my mistake? Why it's not working and how i make it work properly?
Thanks in advance!

A: Both loops were going through different resources so you are just simply cross joining all records in them.
This should work to get the data you need:
<?php
$feed = file_get_contents('http://grabo.bg/rss/?city=&affid=16090');
$rss = simplexml_load_string($feed);

foreach ($rss as $key => $entry) {
    if ($key == "entry")
    {
        $title = (string) $entry->title;
        $content = (string) $entry->content;
        $link = (string) $entry->link["href"];
        echo "$title
" . $content;
    }
}


text:
Q: Disadvantages of Sql Cursor I was studying cursor and I read somewhere that. Each time you fetch a row from the cursor, it results in a network round trip whereas normal select query makes only one round trip however large the resultset is.
Can anyone explain what does that means? And what does network round trip and one round trip means in detail with some example. And when we use cursor and when we use while loop?

A: Unfortunately, that reference is incorrect.
A "normal SELECT" creates a cursor that the client fetch from.  The mechanics are exactly the same as if you open and return a SYS_REFCURSOR (or any other mechanism for opening a cursor).  In both cases, the client will fetch a number of rows over the network every time it requests data from the database.  The client can control the number of rows that are fetched each time-- it would be exceptionally rare for the client to fetch 1 row or to fetch all the rows from a cursor in a single network round-trip.
What actually happens when a client application fetches from a cursor (no matter how the cursor is opened), the client application sends a request over the network for N rows (again, the client controls the value of N).  The database sends the next N rows back to the client (generally, Oracle has to continue executing the query in order to determine the next N rows because Oracle does not generally materialize an entire result set).  The client application does something with those N rows and then sends another request over the network for the next N rows and the pattern repeats.

A: In virtually all database systems, the application that uses the data; and the DBMS that is responsible for storing and searching the data; live on separate machines.  They talk to each other over a network.  Even when they are on the same machine, there is still effectively a network connection.
This matters because there is some time between when an application decides that it's ready to read data, when that request arrives over the network at the database server, when the database server actually gets the response for that, and when the response finally arrives over the network on the application side.
When you do a query for a whole set of data, you only pay this cost once;  Although it may seem wasteful; in fact it's much more efficient to put the burden of holding on to all of the data on the application, because it's usually easier to give more resources to an application than to do the same on a database server.
When your application only fetches data one row at a time, then the cost of the round trip between application and database is paid once per row; If you want to show the titles of 100 blog posts, then you're paying the cost of 100 round trips to the database for that one report.  Whats worse is that the database server has to some how keep track of the partially completed result set.  That usually means that the resources that could be used for querying data for another request are instead being retained by an application that hasn't happened to ask for all of the data it originally asked for.
The basic rule is to talk to the database only when you absolutely have to, and to make the interaction as short as possible;  This means you only ask for the data you really need (have the database do as much filtering as possible, instead of doing it in the application) and accept all of the data as quickly as possible, so that the database can move on to another task.


text:
Q: Example/How-To create calendar appointment using Exchange 03 Webdav and PHP? I've been trying to figure this out for about two weeks. I'm able to create email items in people's folders, read the folders, all that stuff but for the life of me I can not get anything to work with the calendars.
I can provide examples of the XML I'm sending to WebDav but hoping someone out there has done this and has an example?

A: I did this in a Java program a few years back, and the way I did it was to PUT a VCALENDAR document into the folder.  One quirk is that the VCALENDAR had to be enclosed within an RFC822 message.  It's a bizarre combination of WebDAV, email, and iCAL/VCAL, but it worked at the time on Exchange 2003 hosted at Link2Exchange.
I'm sure there is an easier way, but this is what worked for me.  Below I show a tcpdump packet trace of what happened.  You should probably use ngrep/tcpdump on your own Outlook/Entourage client to see what it does.
Note that "Cal2" is the name of my test calendar folder.  You'd use "Calendar" for the main calendar folder.
T 10.0.1.95:59741 -> 66.211.136.9:80 [AP]
PUT /exchange/yourname.domainname.com/Cal2/CC1.1163646061548.0.eml HTTP/1.1.
translate: f.
Content-Type: message/rfc822.
Pragma: no-cache.
Accept: */*.
Cache-Control: no-cache.
Authorization: Basic NOYOUCANTSEEMYPASSWORDYOUBASTARDS.
User-Agent: Jakarta Commons-HttpClient/2.0final.
Host: e1.exmx.net.
Cookie: sessionid=29486b50-d398-4f76-9604-8421950c7dcd:0x0.
Content-Length: 478.
Expect: 100-continue.
.

T 66.211.136.9:80 -> 10.0.1.95:59741 [AP]
HTTP/1.1 100 Continue.
.

T 10.0.1.95:59741 -> 66.211.136.9:80 [AP]
content-class: urn:content-classes:appointment.
Content-Type: text/calendar;.
.method=REQUEST;.
.charset="utf-8".
Content-Transfer-Encoding: 8bit.
.
BEGIN:VCALENDAR.
BEGIN:VEVENT.
UID:E1+1382+1014+495066799@I1+1382+1014+6+495066799.
SUMMARY:Voice Architecture Leads Meeting.
PRIORITY:5.
LOCATION:x44444 pc:6879.
DTSTART:20061122T193000Z.
DTEND:20061122T203000Z.
DTSTAMP:20061110T074856Z.
DESCRIPTION:this is a description.
SUMMARY:this is a summary.
END:VEVENT.
END:VCALENDAR.

T 66.211.136.9:80 -> 10.0.1.95:59741 [AP]
HTTP/1.1 201 Created.
Date: Thu, 16 Nov 2006 03:00:16 GMT.
Server: Microsoft-IIS/6.0.
X-Powered-By: ASP.NET.
MS-Exchange-Permanent-URL: http://e1.exmx.net/exchange/yourname.yourdomain.com/-FlatUrlSpace-/122cda661de1da48936f9
44bda4dde6e-3af8a8/122cda661de1da48936f944bda4dde6e-3f3383.
Location: http://e1.exmx.net/exchange/yourname.yourdomain.com/Cal2/CC1.1163646061548.0.eml.
Repl-UID: <rid:122cda661de1da48936f944bda4dde6e0000003f3383>.
Content-Type: text/html.
Content-Length: 110.
Allow: OPTIONS, TRACE, GET, HEAD, DELETE, PUT, COPY, MOVE, PROPFIND, PROPPATCH, SEARCH, SUBSCRIBE, UNSUBSCRIBE, PO
LL, BDELETE, BCOPY, BMOVE, BPROPPATCH, BPROPFIND, LOCK, UNLOCK.
ResourceTag: <rt:122cda661de1da48936f944bda4dde6e0000003f3383122cda661de1da48936f944bda4dde6e0000003f4671>.
GetETag: "122cda661de1da48936f944bda4dde6e0000003f4671".
MS-WebStorage: 6.5.7638.
Cache-Control: no-cache.

.
T 66.211.136.9:80 -> 10.0.1.95:59741 [AP]

/exchange/yourname.yourdomain.com/Cal2/CC1.1163646061548.0.eml was created successfully
.

You can verify that it worked using something like Cadaver to query the object's properties via WebDAV like so:
dav:/exchange/yourname@yourdomain.com/Cal2/> propget CC1.1163646061548.0.eml
  Fetching properties for `CC1.1163646061548.0.eml':
  textdescription = this is a description
  contentclass = urn:content-classes:appointment
  supportedlock = <lockentry><locktype><transaction><groupoperation></groupoperation></transaction></locktype><locks
  cope><local></local></lockscope></lockentry>
  permanenturl = http://e1.exmx.net/exchange/yourname@yourdomain.com/-FlatUrlSpace-/122cda661de1da48936f944bda4dde6e-
  3af8a8/122cda661de1da48936f944bda4dde6e-3f3383
  getcontenttype = message/rfc822
  id = AQEAAAAAOvioAQAAAAA/M4MAAAAA
  mid = -8992774761696198655
  uid = E1+1382+1014+495066799@I1+1382+1014+6+495066799
  isfolder = 0
  resourcetype =
  method = PUBLISH
  getetag = "122cda661de1da48936f944bda4dde6e0000003f4671"
  lockdiscovery =
  outlookmessageclass = IPM.Appointment
  creationdate = 2006-11-16T03:00:16.549Z
  outlookmessageclass = IPM.Appointment
  creationdate = 2006-11-16T03:00:16.549Z
  ntsecuritydescriptor = CAAEAAAAAAABAC+MMAAAAEwAAAAAAAAAFAAAAAIAHAABAAAAARAUAL8PHwABAQAAAAAABQcAAAABBQAAAAAABRUAAAC
  nkePD6LEa8iIT/+gqDAAAAQUAAAAAAAUVAAAAp5Hjw+ixGvIiE//oAQIAAA==
  dtstamp = 2006-11-10T07:48:56.000Z
  lastmodified = 2006-11-16T03:00:16.565Z
  dtstart = 2006-11-22T19:30:00.000Z
  location = x44444 pc:6879
  duration = 3600
  htmldescription = <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">

  <META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
  <TITLE>this is a summary</TITLE>

this is a description

  ishidden = 0
  parentname = http://e1.exmx.net/exchange/yourname@yourdomain.com/Cal2/
  meetingstatus = TENTATIVE
  subject = this is a summary
  getcontentlength = 631
  normalizedsubject = this is a summary
  isstructureddocument = 0
  repl-uid = rid:122cda661de1da48936f944bda4dde6e0000003f3383
  timezoneid = 0
  displayname = CC1.1163646061548.0.eml
  href = http://e1.exmx.net/exchange/yourname@yourdomain.com/Cal2/CC1.1163646061548.0.eml
  nomodifyexceptions = 1
  patternend = 2006-11-22T20:30:00.000Z
  isreadonly = 0
  instancetype = 0
  uid = AQEAAAAAPzODAAAAAAAAAAAAAAAA
  getlastmodified = 2006-11-16T03:00:16.565Z
  created = 2006-11-16T03:00:16.549Z
  sensitivity = 0
  dtend = 2006-11-22T20:30:00.000Z
  hasattachment = 0
  iscollection = 0
  read = 1
  resourcetag = rt:122cda661de1da48936f944bda4dde6e0000003f3383122cda661de1da48936f944bda4dde6e0000003f4671
  patternstart = 2006-11-22T19:30:00.000Z
  priority = 0
  sequence = 0

A: have a look at this
http://golemlab.wordpress.com/2009/09/13/php-owa-2003-calendar-fun/


text:
Q: Is every Jordan block diagonalisable?
Is every Jordan block diagonalisable?

I need to also give a short justification. Can anyone lend a hand?

A: if every Jordan block would be diagonalizable, then every matrix would be diagonalizable, and then nobody would care about Jordan blocks.
Pick the smallest possible non-trivial Jordan block and try to diagonalize it. Just a tiny amount of work would had solved the problem for you.


text:
Q: Allow downloading images via registry/GPO in Outlook As part of the great wisdom of Microsoft, O365 Business doesn't have GPO available so we have to use workarounds.
How do I allow downloading images using GPO but by editing registry on my win7/10 x64 machines? Are there settings that can be changed and then pushed to all clients?


text:
Q: Gspread library function worksheet.findall('string') isn't working properly I Was wondering if anyone using gspread for google sheets api.
When I run worksheet.findall('string'), it only returns the matched cells in the very first column that the cells were encountered in.
For example, my column 9 has a cell called 'hi' & column 10 also has a cell called 'hi'. It returns only the col9 cell since col9 cell was encountered first.
Anyone can help please?
It should've returned all the matched cells with 'hi' when I run worksheet.findall('string') byt this isn't happening.


text:
Q: How to properly structure class in Node.js I have a class called TileStreamer that I am currently defining as follows:
function TileStreamer {

};

This class has constants, which I define as follows:
// Tiles are 256 x 256 pixels
TileStreamer.prototype.TILE_SIZE = 256;

// Header size in bytes
TileStreamer.prototype.HEADER_SIZE = 28;

// Various table entry sizes in bytes
TileStreamer.prototype.RESOLUTION_ENTRY_SIZE = 12;
TileStreamer.prototype.TILE_COUNT_SIZE = 4;
TileStreamer.prototype.TILE_ENTRY_SIZE = 12;

// Offsets within header
TileStreamer.prototype.WIDTH_OFFSET = 3;
TileStreamer.prototype.HEIGHT_OFFSET = 4;
TileStreamer.prototype.NUM_TABLES_OFFSET = 7;
TileStreamer.prototype.UNPOPULATED_OFFSET = 12092;

There also other variables.  These variables are important because they need to be accessible from other classes.  They get their values within the methods of this class.  This is what I am unsure of as far as structure. What I'm currently trying is:
TileStreamer.prototype.header;
TileStreamer.prototype.resolutionEntry;
TileStreamer.prototype.resolutionTable;
TileStreamer.prototype.filepath;
TileStreamer.prototype.s3;
TileStreamer.prototype.level;
TileStreamer.prototype.ncols;
TileStreamer.prototype.nrows;
TileStreamer.prototype.nlevels;
TileStreamer.prototype.toffset;
TileStreamer.prototype.tsize;
TileStreamer.prototype.modifiedTime;
TileStreamer.prototype.tile;
TileStreamer.prototype.host;
TileStreamer.prototype.bucket;

This class also has methods such as:
TileStreamer.prototype.Init = function(filepath, index, s3config){
   var retval = false;
   AWS.config.update({accessKeyId: s3config.access_key, secretAccessKey: s3config.secret_key});
   var blc = new BlockLibraryConfigs();
   var awsConfig = blc.awsConfig;
   AWS.config.update({region: awsConfig.region});

   var aws = new AWS.S3();
   var params = {
       Bucket: s3config.bucket,
       Key: s3config.tile_directory + filepath,
       Range: 'bytes=0-' + (this.HEADER_SIZE - 1)
   };

    aws.getObject(params, function(err, data){
       if(err == null){
            TileStreamer.modifiedTime = data.LastModified;
            var header = bufferpack.unpack('<7I', data.Body);
            TileStreamer.header = header;
            TileStreamer.nlevels = header[TileStreamer.NUM_TABLES_OFFSET];

            if(TileStreamer.nlevels == 5){
                TileStreamer.level = 0;
                TileStreamer.ncols = Math.ceil((header[TileStreamer.WIDTH_OFFSET] * 1.0) / TileStreamer.TILE_SIZE);
                TileStreamer.nrows = Math.ceil((header[TileStreamer.HEIGHT_OFFSET] * 1.0) / TileStreamer.TILE_SIZE);

            }
       }

    });

};

The method above should set some of the values of the variables, such as modifiedTime so that I can access it in another class such as:
TileStreamer = require('tilestreamer.js');
var ts = new TileStreamer();
ts.Init(parPath, index, config);
var last_modified = ts.modifiedTime;

A: Just put any public properties you want to initialise when the object is created, directly in the init function.  Here's a small example...
function TileStreamer() {
};

TileStreamer.prototype.Init = function() {
    this.modifiedTime = new Date();
};

var ts = new TileStreamer();
ts.Init();
console.log(ts);

jsfiddle example
https://jsfiddle.net/v6muohyk/
To get around the issue you're having with setting the object properties in a callback from an asynchronous function, just create a locally accessible variable to reference the object that you are creating at that time...
TileStreamer.prototype.Init = function() {
    var thisTileStreamer = this;
    asynchFunction(function(err, data) {
        thisTileStreamer.modifiedTime = data.lastModified;
    });
};

To take it one step further, if you need to execute some code after the init function has completed, then that will require waiting for the asynchronous function to complete, as well.  For that, pass a further parameter to init, that is a function to be executed after all the work is done...
TileStreamer.prototype.Init = function(callback) {
    var thisTileStreamer = this;
    asynchFunction(function(err, data) {
        thisTileStreamer.modifiedTime = data.lastModified;
        callback();
    });
};

var ts = new TileStreamer();
ts.Init(function() {
    // put code here that needs to be executed *after* the init function has completed
    alert(ts.modifiedTime);
});