Wednesday, 11 September 2013

Any help on Mail.log file analysis appplications, graph representation of queues?

Any help on Mail.log file analysis appplications, graph representation of
queues?

once you start receiving about 5-10 emails/sec it becomes painful the
detailed analysis of mail.log. Out setup is quite standard: Ubuntu
12.04+postfix+postscreen+dovecot+postgrey+amavisd-new+rbl
Are there any software that facilitates the detailed mail.log analysis?
The perfect panel would be the graphical application that permits to
search among millions of email.log lines in the decent way, that is the
result can be represented in the form of a client-server handshake
procedure similar to TCP protocol

or by means of some sort of Graph, similar to git-gui

So I repeat we're not looking for packages which collects the statistics.
We're looking for the instrument that helps to make a fast insight on some
queue happened in the past to understand what was an obstacle in one
particular session.

Can I get audio data from microphone in background task of Windows Phone 8?

Can I get audio data from microphone in background task of Windows Phone 8?

I want to implement a feature in Windows Phone 8, let it calculate decibel
by using the audio data from microphone in background task. Is it
possible?

Tuesday, 10 September 2013

Android ExpandableListView or List Adaptor

Android ExpandableListView or List Adaptor

Android phone app. I will describe the situation and then pose my question
afterwards.
I want to give the user the ability to pick an option from an expandable
list, but when an option that has sub options (children), I want to just
display those child's option(s). So.. not the normal functionality for the
Expandable ListView list.
So... instead of "expanding" and showing a list, only the items from the
sub-menu/list would be displayed.
Example list
Item 1
Item 2
Item 3 >
---- Sub Item 1 for Item 3 (Item 6)
---- Sub Item 2 for Item 3 (Item 7)
---- Sub Item 3 for Item 3 (Item 8) >
-------- Item 9
-------- Item 10
Item 4
Item 5
In the above example, the user would initially see Items 1 to 5. If any of
an items from this top list are selected (user touches it).. except for
Item 3, you are done... selection made.
If Item 3 is selected... then a Sub list of items for item 3 is shown...
just Items 6,7,8.. I want Items 1 through 5 to no longer show on the
screen.
If Item 8 is then chosen, only Items 9 and 10 would be on the screen for
the choices.
Is an Expandable ListView the way to go or maybe a List Adaptor? or
something else.?
I have searched for hours to see something similar. Any possible solutions
are appreciated. I do not mind doing hours of legwork, just stuck and need
direction.
A bonus would be to show a ">" symbol to the right of a choice that has
sub choices under it. I have tried to show this for items 3 and 8.
I appreciate your time in reading this.
Thanks.

BadPaddingException : Data must start with zero

BadPaddingException : Data must start with zero

I implemented data encryption/decryption with RSA. It works if I just
encrypt/decrypt locally, however if I send my encrypted data I get
BadPaddingException: Data must start with zero.
In order to send my data over network I need to change it from byte array
to String (I'm sending it in a header) on the client side and then
retrieve it and change it back to byte array on the server side.
Here's my code for local encryption/decryption (I'm using private key to
encrypt and public key do decrypt):
// Encryption:
String message = "HELLO";
Cipher rsa = Cipher.getInstance("RSA");
rsa.init(Cipher.ENCRYPT_MODE, privateKey); // privateKey has type
java.security.PrivateKey
byte [] encryptedBytes = rsa.doFinal(message.getBytes());
// Decryption:
rsa.init(Cipher.DECRYPT_MODE, publicKey); // type of publicKey:
java.security.PublicKey
byte [] ciphertext = rsa.doFinal(encryptedBytes);
String decryptedString = new String(ciphertext, "UTF-8");
DecryptedString and message are the same and everything works fine.
Then I use the same code on the client side just for encryption plus I
change ciphertext to a String using:
String encryptedString = new String(ciphertext, "UTF-8");
And on the server side I do:
String message = request.getHeader("Message");
byte [] msgBytes = message.getBytes("UTF-8");
Cipher rsa = Cipher.getInstance("RSA");
rsa.init(Cipher.DECRYPT_MODE, publicKey);
byte [] decryptedMsg = rsa.doFinal(msgBytes);
String decryptedString = new String(decryptedMsg, "UTF-8");
This doesn't work and I get BadPaddingException.
I have tried using different instance of cipher, e.g.
"RSA/ECB/PKCS1Padding" or "RSA/ECB/NoPadding" but this didn't help. I also
tried converting Strings using BASE64 but then I get a different
exception: IllegalBlockSizeException.
I know I probably do sth wrong with converting Strings into byte arrays
and vice versa, but I just can't figure out the correct way of doing that.
Please help!

Python - setattr function without self parameter, 2 parameters instead of 3

Python - setattr function without self parameter, 2 parameters instead of 3

I have the following code where I need to use setattr to generate the
variable from the string and set it equal to amn.
for i in amenities:
if i in request.GET:
amn = request.GET.getlist(i)
propertiesList = Property.objects.filter(setattr(i+"__title__in",
amn))
It seems setattr takes 3 parameters, how can I do it with just these 2
parameters?

WPF Display of PDF Options (Print, Save, etc)

WPF Display of PDF Options (Print, Save, etc)

I'm creating a WPF application that has viewing of PFDs built into it.
I've noticed that when I view some files (such as electronic version of
books), the options and tools such as print, save, etc. will appear top as
such:

However, some other files that are.. let's say created from a Word
Document or sent to print to PDF will not have those options, but rather
will display them towards the bottom if you hover your mouse in that area:

I like the second better than the first; however, due to the fact that
some users might not know that hovering towards the bottom will display
those options, I want to be able to force those options to display. Is
there a way? Or will have I have to design a new set of buttons on top of
the PDF viewing control to do that....?

How can you tell if an android service is running in the foreground from code?

How can you tell if an android service is running in the foreground from
code?

From within a particular service I want to know if I'm already in the
foreground. I looked at:
ActivityManager.RunningServiceInfo
specifically RunningServiceInfo.foreground, but the documentation says,
"Set to true if the service has asked to run as a foreground process."
So can I rely on RunningServiceInfo.foreground? Or should I go about this
another way?