Encrypt & Decrypt using PyCrypto AES 256

I’m trying to build two functions using PyCrypto that accept two parameters: the message and the key, and then encrypt/decrypt the message. I found several links on the web to help me out, but each one of them has flaws: This one at codekoala uses os.urandom, which is discouraged by PyCrypto. Moreover, the key I … Read more

Adding space/padding to a UILabel

I have a UILabel where I want to add space in the top and in the bottom. With the minimum height in constraints, I’ve modified it to: To do this I’ve used: override func drawTextInRect(rect: CGRect) { var insets: UIEdgeInsets = UIEdgeInsets(top: 0.0, left: 10.0, bottom: 0.0, right: 10.0) super.drawTextInRect(UIEdgeInsetsInsetRect(rect, insets)) } But I’ve to … Read more

Android: TextView: Remove spacing and padding on top and bottom

When I have a TextView with a \n in the text,, on the right I have two singleLine TextViews, one below the other with no spacing in between. I have set the following for all three TextViews. android:lineSpacingMultiplier=”1″ android:lineSpacingExtra=”0pt” android:paddingTop=”0pt” android:paddingBottom=”0pt” The first line of the left TextView lines up perfectly with the top right … Read more

Add padding on view programmatically

I am developing Android v2.2 app. I have a Fragment. In the onCreateView(…) callback of my fragment class, I inflate an layout to the fragment like below: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.login, null); return view; } The above inflated layout file is (login.xml): <?xml version=”1.0″ encoding=”utf-8″?> … Read more