Tuesday, March 22, 2016

Python - function chaining

Implementing chaining of functions. This is reverse of python inbuilt map() function.

map() function works on each element of an iterable by applying the given function and returns the resultant list.

>>> map(int, ['1', '2', '3'])
[1, 2, 3]

In contrast the below implemented function would execute a chain of functions on a given argument.

function implementation:-
>>> fchain = lambda fnlist, argument: reduce( lambda x, fn: fn(x), [ argument ] + fnlist )

Example for running this:-

>>> def double(x):  
...   return x*2
...
>>> def triple(x):
...   return x*3

>>> fchain([double, triple, double, double], 10)

240






Friday, November 2, 2012

Tuesday, August 14, 2012

E-mail configuration for outlook express



Share on emai

iguration for outlook express

Share on favorite
Share on pShare on facebooShare on twitteShare on dig

To set up your Outlook Express client to work with G E-mail configuration for outlook Gmail:

  1. Enable POP in your email account. Don't forget to click Save Changes when you're done.
  2. Open Outlook or Outlook Express.
  3. Click the Tools menu, and select Accounts...
  4. Click Add, and then click Mail...
  5. Add mail account
  6. Enter your name in the Display name: field, and click Next.
  7. Enter your full Gmail email address (username@gmail.com) in the Email address: field, and clickNext. Google Apps users, enter your full address in the format 'username@your_domain.com.'
  8. Enter username
  9. Enter pop.gmail.com in the Incoming mail (POP3, IMAP or HTTP) server: field. Enter smtp.gmail.com in the Outgoing mail (SMTP) server: field. Google Apps users, enter the server names provided; don't add your domain name in this step.
  10. Enter server names
  11. Click Next.
  12. Enter your full email address (including '@gmail.com' or '@your_domain.com') in the Account name: field. Enter your email password in the Password: field, and click Next.
  13. Enter account name and password
  14. Click Finish.
  15. Highlight pop.gmail.com under Account, and click Properties.
  16. Highlight account
  17. Click the Advanced tab.
  18. Fill in the following information:*
    • Check the box next to This server requires a secure connection (SSL) underOutgoing Mail (SMTP).
    • Enter 465 in the Outgoing mail (SMTP): field.
    • Under Outgoing Mail (SMTP), check the box next to This server requires a secure connection (SSL).
    • Under Incoming mail (POP3), check the box next to This server requires a secure connection (SSL). The port will change to 995.
    • Highlight account
    *The order of Outgoing and Incoming mail server fields varies by version. Make sure you enter the correct information in each field.
  19. Return to the Servers tab, and check the box next to My server requires authentication.
  20. Highlight account
  21. Click OK.

Friday, June 8, 2012

svn propedit

After going through many useless posts to edit externals for a repo, google finally helped me to reach atsome useful point. I thought this may help many.

propedit to change externals on a repo.

~Checkout the repo on your machine.
>>>svn co svn+ssh://.....

~go to the directory which contains sub directories coming through external links.
>>>cd dir_containing_external_dirs/

~execute the command that will edit external links
>>>svn propedit svn:externals .
don't miss dot at the end.

~checkin your code.
>>>svn ci -m ""

~update your code with new external links.
>>>svn up

Monday, May 14, 2012

Include variables to a shell script from an external script

file1 include.sh

#!/bin/bash
var1="Hello there"

file2 includetest.sh

#!/bin/bash
. include.sh
echo $var1
#file2 has access to all variables defined in file1


>>>>Run file2 and you see the required output.
>>chmod +x includetest.sh
>>./includetest.sh

Mount a LAN resource in cmd

My need led me to think about this problem. I had to run an application from sources when I had the source code on a machine connected to my network(LAN). Due to some problem I didn't want to copy the source code on my machine. I took the following steps:-

 1)mount the LAN resource:-
 >>>net use z: \\192.168.x.x\shared_folder
 Now z drive is a virtual drive on your machine.

 2)Set all your environment variables referring z drive.

 The above two steps makes you all set to run the application from sources that is present on a LAN resource.
There are many other such utilities with "net" command. Check them, You may find them beneficial too.

Monday, October 10, 2011

something u must know if u r using DOCOMO(know ur call logs)

Recently I was really surprised to dat 1 of ma frnds had access to all my account details, my recent call logs n muh more. After some research I got to know some facts...

1)Docomo has an online support desk(link-Online Support). Many of the advanced queries which customer support guys at 121 cannot answer are all answered there.

2)Docomo has a "my accounts" page (link- My Account), where you can see all your account details.The details include...
a)Ur account info like ur name n address on which ur no. is registered.
b)Ur recent call logs.
c)Ur recharge information.
d)U can activate/deactivate DND. And some more information.

Hope u would like the post.Remember not to disclose ur passwd :)

~barun