padding

How to remember in CSS that margin is outside the border, and padding inside

I don't edit CSS very often, and almost every time I need to go and google the CSS box model to check whether padding is inside the border and margin outside, or vice versa. (Just checked again and padding is inside). Does anyone have a good way of remembering this? A little mnemonic, a good explanation as to why the names are that wa...

Best way to handle block ciphers in C++? (Crypto++)

Good day :) I'm pretty new to both C++ and Block Cipher encryption, and I am currently in the process of writing a decryption function for AES (16 byte seed / 16 byte blocks). All is going well, but my total data size is not always a multiple of my block size. I'm wondering what the best way to handle left-over data at the end of my dat...

Padding - Encryption algorithm

Hello, I'm writing an implementation of the XXTEA encryption algorithm that works on "streams", ie, can be used like: crypt mykey < myfile > output. One of the requisites is that it doesn't have access to the file at all (it only reads an fixed size block until find an EOF). The algorithm needs that the data bytes is multiple of 4, so i...

String Padding in C

I wrote this function that's supposed to do StringPadRight("Hello", 10, "0") -> "Hello00000". char *StringPadRight(char *string, int padded_len, char *pad) { int len = (int) strlen(string); if (len >= padded_len) { return string; } int i; for (i = 0; i < padded_len - len; i++) { strcat(string, pad); ...

Java Cipher - AES Padding Problem

Hi all I am using a AES cipher with a 16 byte block size. If I try and encrypt a 16 byte string I have no problems, but any other length not a multiple of 16 is throwing an exception. I know with 3-DES you can specify a padding type as part of the algorithm and it's handled with no extra work (e.g. DES/CBC/PKCS5Padding), but is the...

detecting true border, padding and margin from Javascript

Is there a way to detect the true border, padding and margin of elements from Javascript code? If you look at the following code: <html> <head> <style> <!-- .some_class { padding-left: 2px; border: 2px solid green; } --> </style> <script> <!-- function showDetails() { ...

Individual Character Padding in XAML

Is there a way in XAML to add padding around individual characters? Preferably before and after the character. I have a textbox that I would like the input to be spaced out a bit more (so it aligns with a background image). It would be ideal to be able to do something like: Any ideas how one can accomplish this? It looks like one c...

Google Chrome Bug with CSS Padding style applying to empty cells

Hello there. I have a problem only in Google Chrome (Firefox, IE, Netscape, Safari and Opera are Okay) where a padding property which should be applied to text in a cell, is being applied to all empty cells aswell. It's easy to solve by adding more specific styles to my affected perimeter cells and using different styles, but that uses a...

Padding Strings in Java

Is there some easy way to pad Strings in Java. seems like something that should be in some stringUtil like api but i cant find any. ...

Regex to add padding zeroes

I am working on this yahoo pipe Regex and I found a bug I'm unable to wrap my mind around it. I have a URL, from which I extract digits, cat them and make a img html tag and embed it. The issue is that, the URL is presented in a non padded way, but the image linked has the zeroes. Therefore, when there is a day or a month with single di...

How to add padding bytes to a bitmap?

Lets say I have some raster data I want to write to a file.. Now I want to write it as a bmp file.. This data happens to be not DWORD aligned, which, if I understand correctly, needs to be padded with enough bytes to reach the next DWORD.. However, when I try to pad it with this code: bmFile.Write(0x0, (4-(actualWidth%4))); I get an...

Minimizing use of explicit padding style attributes

I am finding I'm writing a lot of code that looks like this: <div id="leftCol"> <div style="padding-top:10px"> <asp:Image ID="imgRazor1" ImageUrl="http://www.example.com/dynimg.aspx?imageKey=XXX" runat="server" /> </div> <div style="padding-top:10px"> ...

Are Margin and Padding implemented by ContentControl?

Hi, I am developing a custom control derived from System.Windows.Controls.ContentControl. In the controls default template (themes\generic.xaml), I use a Border element that wraps the actual content. Does my custom control already implement margin and padding (i.e., shrink the border according to the padding set on the custom control) ...

Pad a number with starting zero in .Net

Hi, I have a requirement to pad all single digits numbers with a starting zero. Can some one please suggest the best method? (ex 1 -> 01, 2 -> 02, etc) ...

How to use a blank space as padding character to form a string that initializes a control in VB.NET

I want to right pad my string with blank spaces. The following function works for all characters except the blank. myString.PadRight(50,"x") Edit: myString.PadRight(50) does pad a string with blank spaces, but when this string is used in the following statement, the blank padding is gone. myCheckBox.Text = myString.PadRight(50) ...

padding making links not work?

The link only works when i click on the actual text not the area around it even though the hover effect is working so i know the button is being targeted? this is also happening on a list within the site where I'm using left-padding and placing images there, if i click where the padding is it doesn't work? could .js scripts effect this...

Pad left or right with string.format (not padleft or padright) with arbitrary string

Can I use String.Format() to pad a certain string with arbitrary characters? Console.WriteLine("->{0,18}<-", "hello"); Console.WriteLine("->{0,-18}<-", "hello"); returns -> hello<- ->hello <- I now want the spaces to be an arbitrary character. The reason I cannot do it with padLeft or padRight is because I w...

Can you tweak the left and right padding on an HTML input button?

The longer an input button's text (value) is, the wider the left and right padding seems to get (IE). Explicit CSS padding seems to have no effect. Does anyone have a hack for this? ...

CSS box model (margins and padding) for vertical spacing between paragraphs

How should CSS 'margin' and 'padding' be used for vertical inter-paragraph spacing: Can the vertical space between paragraphs be defined using padding and/or using margins? If it can be done with either, then which is the better or more normal one to use? Do you tend to define non-zero padding and non-zero margins, and if so then how m...

Click on span with padding

I have a span with no text, it looks like an image, it has background and padding. But it doesnot execute onclick event. What to do? Do I need obviously change span to everything else? ...