IPython /bin/bash: /bin/bashfile.txt: Permission denied - ipython

This issue is inside IPython:
1) when i run the following, it works fine
for x in range(10):
!date
Tue Jun 12 13:25:18 EDT 2018
Tue Jun 12 13:25:18 EDT 2018
Tue Jun 12 13:25:18 EDT 2018
Tue Jun 12 13:25:18 EDT 2018
Tue Jun 12 13:25:18 EDT 2018
Tue Jun 12 13:25:18 EDT 2018
Tue Jun 12 13:25:18 EDT 2018
Tue Jun 12 13:25:18 EDT 2018
Tue Jun 12 13:25:18 EDT 2018
Tue Jun 12 13:25:18 EDT 2018
2) when i want to redirect it into the file, it gives the following error message:
for x in range(10):
!date > ${x}.txt
/bin/bash: /bin/bashfile.txt: Permission denied
Im honestly not sure why am i getting that error message. I don't understand it.

If you want to interpolate the value of the Python variable x into a shell command in IPython, the syntax for that is $x or {x}, not ${x}. When x is 0, ${x} expands to $0, which the shell then does its own expansion for. Your command should be
!date > {x}.txt
(It's unlikely that $0 would have expanded to /bin/bashfile, suggesting that you probably didn't actually run the code you posted.)

Not sure what exactly you are trying to do here, but you're trying to write to a file that you do not have write permission for.
Make a new file and try writing to it and you'll succeed.

Related

How to debug a splice operation in a Perl script?

#! usr/bin/perl
#months=('Jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec');
#new=('1','2');
print "#months\n";
splice(#months,0,1,#new);
print "#months\n";
When I run this I expect output to be as
Jan feb mar apr may jun jul aug sep oct nov dec
1 2 mar apr may jun jul aug sep oct nov dec
But I am getting output as
Jan feb mar apr may jun jul aug sep oct nov dec
1 2 feb mar apr may jun jul aug sep oct nov dec
The Feb should also be replaced by 2, right? But why it isn't happening.
Syntax of splice command is
splice ARRAY,OFFSET,LENGTH,LIST
You specify LENGTH to be 1, so only one element is removed from the original list (that element is Jan). If you want feb to be removed too, then you must use a LENGTH of 2
splice(#months, 0, 2, #new);

MongoDB natural sort returns data with ObjectIDs shuffled in time

I perform the following query:
db.preference.find({}, {_id: 1}).sort({$natural: 1}).forEach(function(d) {
print(d._id.getTimestamp())
})
Here's part of the output:
Thu Mar 26 2015 12:39:06 GMT+0100 (CEST)
Thu Mar 26 2015 12:41:07 GMT+0100 (CEST)
Thu Mar 26 2015 12:48:55 GMT+0100 (CEST)
Mon Mar 30 2015 17:08:44 GMT+0200 (CEST)
Tue Mar 31 2015 12:34:36 GMT+0200 (CEST)
Tue Mar 31 2015 12:35:01 GMT+0200 (CEST)
Tue Mar 31 2015 12:34:47 GMT+0200 (CEST)
Thu Nov 20 2014 10:55:07 GMT+0100 (CEST)
Wed Apr 29 2015 10:02:33 GMT+0200 (CEST)
Wed Apr 29 2015 10:02:53 GMT+0200 (CEST)
Wed Apr 29 2015 10:03:13 GMT+0200 (CEST)
Wed Apr 29 2015 10:00:11 GMT+0200 (CEST)
Wed Apr 29 2015 10:18:23 GMT+0200 (CEST)
Mon Feb 23 2015 11:54:11 GMT+0100 (CEST)
Tue May 12 2015 16:40:45 GMT+0200 (CEST)
Fri May 15 2015 17:04:04 GMT+0200 (CEST)
Wed May 14 2014 18:13:40 GMT+0200 (CEST)
Tue Jun 09 2015 14:17:11 GMT+0200 (CEST)
Tue Jun 16 2015 16:03:31 GMT+0200 (CEST)
Tue Nov 04 2014 21:15:21 GMT+0100 (CEST)
Fri Mar 14 2014 10:16:48 GMT+0100 (CEST)
Wed Jun 17 2015 11:14:57 GMT+0200 (CEST)
Fri Mar 14 2014 10:15:30 GMT+0100 (CEST)
It's easy to see that the dates are seriously shuffled, while I expected strictly ascending order.
Collection is not capped, and the documents are often modified. ObjectIds are never generated in the code explicitly. Collection is not shared.
Any ideas why natural sorting works this way?
Can someone explain while natural ordering works in.
What did you expect?
Use the $natural operator to use natural order for the results of a
sort operation. Natural order refers to the logical ordering of
documents internally within the database.
The $natural operator uses the following syntax to return documents in
the order they exist on disk: ...
See MongoDB documentation.

How to setup new SOAPUI project to Office 365 Exchange (trouble accessing WSDL)

I'm trying to create a new SoapUI project for testing against Exchange Web Services in Office 365.
Attempt 1)
For the initial WSDL I specify https://outlook.office365.com/ews/services.wsdl.
SoapUI then prompts me for Basic Authentication for outlook.office365.com:443
If I enter the credentials that I use to login to Office365, this fails.
The login screen then comes back asking for Basic Authentication for outlook.office365.com:-1
Attempt 2)
Then I found this detailed guide How to get services.wsdl for Office 365?:
Using the Microsoft Remote Connectivity Analyzer I could extract https://pod51046.outlook.com/ews/exchange.asmx
So I next tried that, but then SoapUI responds:
"There was something wrong with the WSDL you are trying to import"
Error loading [https://pod51046.outlook.com/ews/exchange.wsdl]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Unexpected end of file after null
SoapUI Log says:
Tue Oct 14 13:35:48 CEST 2014:DEBUG:Getting wsdl component from [https://pod51046.outlook.com/ews/exchange.wsdl]
Tue Oct 14 13:35:48 CEST 2014:INFO:pod51046.outlook.com:443 requires authentication with the realm 'null'
Tue Oct 14 13:36:14 CEST 2014:ERROR:Failed to load url [https://pod51046.outlook.com/ews/exchange.wsdl]
Tue Oct 14 13:36:14 CEST 2014:ERROR:An error occurred [com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException], see error log for details
HTTP log says:
Tue Oct 14 13:35:48 CEST 2014:DEBUG:>> "GET /ews/exchange.wsdl HTTP/1.1[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:>> "Host: pod51046.outlook.com[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:>> "Connection: Keep-Alive[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:>> "Cookie: ClientId=LGJVIJZECEJQYUIHP0RW; X-BackEndCookie=jan#[snip].onmicrosoft.com=u56Lnp[snip]Fys0=; exchangecookie=0fe18[snip]ad43d[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:>> "Cookie2: $Version=1[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:>> "[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "HTTP/1.1 401 Anonymous Request Disallowed[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "Server: Microsoft-IIS/8.0[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "request-id: fadbe60a-008b-4f16-859a-719aaa8794bc[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "X-WSSecurity-Enabled: True[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "X-WSSecurity-For: Logon[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "X-FederationTrustTokenIssuerUri: urn:federation:MicrosoftOnline[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "X-WSSecurity-SymmetricKey-Enabled: True[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "X-WSSecurity-X509Cert-Enabled: True[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "X-OAuth-Enabled: True[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "X-Powered-By: ASP.NET[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "X-FEServer: AM2PR02CA0041[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "WWW-Authenticate: Basic Realm=""[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "Date: Tue, 14 Oct 2014 11:35:55 GMT[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "Content-Length: 0[\r][\n]"
Tue Oct 14 13:35:48 CEST 2014:DEBUG:<< "[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:>> "GET /ews/exchange.wsdl HTTP/1.1[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:>> "Host: pod51046.outlook.com[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:>> "Connection: Keep-Alive[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:>> "Cookie: ClientId=LGJVIJZECEJQYUIHP0RW; X-BackEndCookie=jan#[snip].onmicrosoft.com=u56Lnp2ejJ[snip]vFys0=; exchangecookie=0fe1867420a243b5993d336bbbead43d[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:>> "Cookie2: $Version=1[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:>> "Authorization: Basic amFuQFR[snip]RCVg==[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:>> "[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "HTTP/1.1 404 Not Found[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "Cache-Control: private[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "Server: Microsoft-IIS/8.0[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "request-id: 0bdf26cb-0fe3-418e-816f-a07324900119[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "X-CalculatedBETarget: db3pr02mb203.eurprd02.prod.outlook.com[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "X-DiagInfo: DB3PR02MB203[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "X-BEServer: DB3PR02MB203[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "X-AspNet-Version: 4.0.30319[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "Set-Cookie: X-BackEndCookie=jan#[snip].onmicrosoft.com=u56Lnp2ejJqBy[snip]7FzMnFzc4=; expires=Thu, 13-Nov-2014 11:36:21 GMT; path=/ews; secure; HttpOnly[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "X-Powered-By: ASP.NET[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "X-FEServer: AM2PR02CA0041[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "Date: Tue, 14 Oct 2014 11:36:20 GMT[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "Content-Length: 0[\r][\n]"
Tue Oct 14 13:36:14 CEST 2014:DEBUG:<< "[\r][\n]"
Error log says:
Tue Oct 14 13:36:14 CEST 2014:ERROR:com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException
com.eviware.soapui.impl.support.definition.support.InvalidDefinitionException
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.makeInvalidDefinitionException(WsdlLoader.java:142)
at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.loadXmlObject(WsdlLoader.java:129)
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:539)
at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:528)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionCache.update(AbstractDefinitionCache.java:101)
at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionContext$Loader.construct(AbstractDefinitionContext.java:240)
at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:50)
at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:153)
at java.lang.Thread.run(Unknown Source)
Attempt 3)
If I put https://pod51046.outlook.com/ews/exchange.wsdl into the IE address bar it keeps prompting me for a login in IE.
That repeated prompting is mentioned in a comment here: How to access a wsdl URL in SoapUI, which requires username/password?, but after 3 logins (each time telling IE to remember my references) the returned page is blank:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>
I'm using the free SOAPUI 5.0.0 (latest version), with Java 7 (then 8) in a Win7/64 environment.
I have also cloned my VM and tried the SOAPUI Pro version as suggested in To create a SOAPUI project using a wsdl, but this did not help.
Any suggestions how to get this to work?
The right URL to use for Office 365 EWS WSDL is the first one you tried: https://outlook.office365.com/ews/services.wsdl. You should use this URL to get the WSDL. From the browser, when I enter my email address and password, I am able to get the WSDL without any problems.
I am not familiar with SOAPUI, so I am not sure why this URL + Basic auth isn't working with SOAP UI. Let me know if you have any questions or need more info.
[Additional notes by OP]
Thanks Venkat, that was the solution. There were additional complications why I did not get this correct in the first place. I'm writing them in the answer, because it's too much for comments.
I accidentally entered https://pod51046.outlook.com/ews/***exchange***.wsdl
instead of https://pod51046.outlook.com/ews/***services***.wsdl (which Oleg's blog actually mentioned, and I overlooked). This immediately gave the correct results in IE. Your suggestion of inputting the generic https://outlook.office365.com/ews/services.wsdl also works.
(I think that after having read somewhere that the actual URL is a pod... one, I doggedly kept trying that one after resolving it).
So this is why attempts 2 and 3 failed.
SOAP UI asks me 2 times 3 = 6 times for the login credentials when setting up the test project. I just was not persistent enough.
And this is why attempt 1 failed.

Looking for Google Apps script to find and highlight dates from past month in red

I have a Google spreadsheet with columns I and J with data as headers Est Closing Month and Est Closing Calendar Year respectively, I need a script which will loop through columns I and J and find dates which are in the past month of this year and highlight them in Red.
Following is example data
ColI ColJ
Aug 2014
Nov 2014
Aug 2014
Jul 2014
Jul 2014
Dec 2014
Dec 2014
After I run the script the output put should be
Aug 2014
Nov 2014
Aug 2014
Jul 2014 -> Both Cells should be in red
Jul 2014 -> Both Cells should be in red
Dec 2014
Dec 2014
Thank you for all the help.
have you tried conditional formatting ?

Meteor: Couldn't deploy

I deployed a site successfully a few days ago and was able to configure logins and do other stuff but today it is down. The strange thing is I deploy to a different location without any changes and now I couldn't even access the page to configure stuff. I don't really know how to debug these things. Here is the logs
[Wed Sep 11 2013 15:19:16 GMT+0000 (UTC)] INFO STATUS waiting -> starting
[Wed Sep 11 2013 15:19:16 GMT+0000 (UTC)] INFO STATUS starting -> running
[Wed Sep 11 2013 15:19:17 GMT+0000 (UTC)] WARNING timers.js:103
[Wed Sep 11 2013 15:19:17 GMT+0000 (UTC)] WARNING ^
[Wed Sep 11 2013 15:19:17 GMT+0000 (UTC)] WARNING if (!process.listeners('uncaughtException').length) throw e;
[Wed Sep 11 2013 15:19:17 GMT+0000 (UTC)] WARNING Error: Could not locate any valid servers in initial seed list
at MongoClient.connect.connectFunction (/meteor/containers/6c32717b-367c-bd8f-b229-ad69088fe830/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/mongo_client.js:281:52)
at Db.open (/meteor/containers/6c32717b-367c-bd8f-b229-ad69088fe830/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/db.js:267:16)
at Server.connect.connectionPool.on.server._serverState (/meteor/containers/6c32717b-367c-bd8f-b229-ad69088fe830/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/connection/server.js:499:7)
at EventEmitter.emit (events.js:126:20)
at connection.on._self._poolState (/meteor/containers/6c32717b-367c-bd8f-b229-ad69088fe830/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:168:15)
at EventEmitter.emit (events.js:99:17)
at Socket.timeoutHandler (/meteor/containers/6c32717b-367c-bd8f-b229-ad69088fe830/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/connection/connection.js:463:10)
at Socket.EventEmitter.emit (events.js:93:17)
at Socket._onTimeout (net.js:188:8)
at Timer.list.ontimeout (timers.js:101:19)
[Wed Sep 11 2013 15:19:17 GMT+0000 (UTC)] ERROR Application crashed with code: 1
[Wed Sep 11 2013 15:19:17 GMT+0000 (UTC)] INFO STATUS running -> waiting
Given the timing, looks like the very brief outage from this morning. Could you check it again and let me know if everything is back to normal?