Explore Public Snippets
Found 16k snippets matching: content
public by lbottaro 429407 14 7 3
HTML header - footer layout using CSS and DIV
<html> <head> <style type="text/css"> #maincontent { width:950px; height:100%; margin:0 auto; } #header { width:946px; height:150px; border:#000 solid; border-width:2px 2px 1px 2px; } #leftcolumn { width:395px; height:703px; border:#000 solid; border-width:1px 1px 1px 2px; float:left; } #toprow { width:549px; height:351px; border:#000 solid; border-width:1px 2px 1px 1px; float:left; } #bottomrow { width:549px; height:350px; border:#000 solid; border-width:1px 2px 1px 1px; float:left; } #footer { width:946px; height:150px; border:#000 solid; border-width:1px 2px 2px 2px; clear:both; } </style> <body> <div id="maincontent"> <div id="header">Header Content</div> <div id="leftcolumn">Leftcolumn Content</div> <div id="toprow">Toprow Content</div> <div id="bottomrow">Bottomrow Content</div> <div id="footer">Footer Content</div> </div> </body> </html>
public by skaggej 336446 3 6 0
SharePoint 2010 - Disable the "New" icon for newly added content
$webApp = Get-SPWebApplication http://sharepoint2010 $webApp.DaysToShowNewIndicator = "0" $webApp.Update()
public by cghersi 289916 2 8 0
How to read a file into a string in Java
private static String readFileAsString(String filePath) throws java.io.IOException{ StringBuffer fileData = new StringBuffer(1000); BufferedReader reader = new BufferedReader(new FileReader(filePath)); char[] buf = new char[1024]; int numRead=0; while((numRead=reader.read(buf)) != -1){ String readData = String.valueOf(buf, 0, numRead); fileData.append(readData); buf = new char[1024]; } reader.close(); return fileData.toString(); }
public by cghersi 283406 2 6 1
Remove HTML tags from text
static public string RemoveHtmlTag(string pageString, string tagName) { string output = pageString; int exprIni = 0; int firstChar = 0; int lastChar = 0; // find html element exprIni = output.IndexOf("<" + tagName, 0, output.Length, StringComparison.InvariantCultureIgnoreCase); while (exprIni >= 0) { // extract the html firstChar = exprIni; // find <tag ... /> lastChar = output.IndexOf("/>", (firstChar + 1)) + 1; int nextCloseTag = output.IndexOf('>', (firstChar + 1)); // closed with </tag> marker.. if ((lastChar <= 0) || (nextCloseTag < lastChar)) { // find </tag> lastChar = output.IndexOf("</" + tagName, (firstChar + 1), (output.Length - firstChar - 1), StringComparison.InvariantCultureIgnoreCase); lastChar = output.IndexOf('>', (lastChar + 1)); } if ((firstChar < 0) || (lastChar <= 0) || (firstChar == lastChar)) return output.Substring(0, firstChar); else { output = String.Format("{0} {1}", output.Substring(0, firstChar).Trim(), output.Substring((lastChar + 1), (output.Length - lastChar - 1)).Trim()); } exprIni = output.IndexOf("<" + tagName, 0, output.Length, StringComparison.InvariantCultureIgnoreCase); } return output; }
public by cghersi 185237 1 6 1
Use the Raw HTML content in XSLT transformations
<myXmlNode> <question> Some text <br/> separated < br/> by new lines </question> </myXmlNode> <span> <xsl:copy-of select="question"/> </span>
public by cghersi @ MailUp API DEV 206844 8 6 1
MailUp REST API - How to subscribe to a particular list several contacts with the "Confirmed Optin" Procedure
public static void SubcribeRecipientsWithDoubleOptin(string clientID, string clientSecret, string username, string password) { // 1) Setup the MailUp Client: MailUpClient client = new MailUpClient(clientID, clientSecret); try { client.RetrieveAccessToken(username, password); } catch (MailUpException ex) { Console.WriteLine("Unable to access the service due to " + ex.Message); return; } // 2) Subscribe recipients: int idList = 1; List<ConsoleRecipientItem> recipients = new List<ConsoleRecipientItem>(); ConsoleRecipientItem recipient1 = new ConsoleRecipientItem() { Email = "test1@mailup.com", Name = "First New Recipient" + DateTime.Now.ToFileTimeUtc(), MobileNumber = "3331234567", MobilePrefix = "39", Fields = new List<ConsoleRecipientDynamicFieldItem>() { new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name1_" + DateTime.Now.ToFileTimeUtc() }, new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName1_" + DateTime.Now.ToFileTimeUtc() } //here you can add all the fields you want to add... } }; ConsoleRecipientItem recipient2 = new ConsoleRecipientItem() { Email = "test2@mailup.com", Name = "Second New Recipient" + DateTime.Now.ToFileTimeUtc(), MobileNumber = "3337654321", MobilePrefix = "39", Fields = new List<ConsoleRecipientDynamicFieldItem>() { new ConsoleRecipientDynamicFieldItem() { Id = 1, Value = "Name2_" + DateTime.Now.ToFileTimeUtc() }, new ConsoleRecipientDynamicFieldItem() { Id = 2, Value = "LastName2_" + DateTime.Now.ToFileTimeUtc() } //here you can add all the fields you want to add... } }; recipients.Add(recipient1); recipients.Add(recipient2); int subscriptionResult = 0; try { subscriptionResult = client.AddRecipientsToList(idList, recipients, true); } catch (Exception ex) { Console.WriteLine("Cannot perform the operation due to " + ex.Message); return; } // 2.1) wait for the end of import task: if (subscriptionResult > 0) { Console.WriteLine("Recipients Import started; import ID:" + subscriptionResult); //optionally we can check the import status: bool completed = false; do { ConsoleImportStatus importStatus = client.CheckImportStatus(subscriptionResult); if (importStatus == null) { Console.WriteLine("Cannot check the import status for import task #" + subscriptionResult); return; } completed = importStatus.Completed; } while (!completed); Console.WriteLine("Recipients Added!"); } else { Console.WriteLine("An error occurred while adding the recipients."); return; } // 3) Retrieve the sendingID of the confirmation email related to the previous task: int sendingID = -1; try { sendingID = client.GetSendingIDForImport(subscriptionResult); } catch (Exception ex) { Console.WriteLine("Cannot retrieve sending ID due to " + ex.Message); return; } if (sendingID <= 0) { Console.WriteLine("Cannot retrieve sending ID."); return; } // 4) Send the confirmation email: EmailSendingItem sendingResult = null; try { sendingResult = client.SendEmailMessage(sendingID); } catch (Exception ex) { Console.WriteLine("Cannot send email due to " + ex.Message); return; } if (sendingResult == null) Console.WriteLine("Cannot send confirmation email."); else Console.WriteLine("Confirmation email sent!"); }
public by LongBeard 143324 2 3 0
Vertically Centered Content
.container { min-height: 6.5em; display: table-cell; vertical-align: middle; }
public by sherazam 182336 1 5 0
How to Delete Messages in Bulk or One by One from Outlook PST in .NET Apps
// Enter here the actual content of the snippet. //Deleting Messages from PST Files //The code snippets below delete messages from a PST file's Sent subfolder. //[C# Code Sample] // Get the Sent items folder FolderInfo folderInfo = pst.GetPredefinedFolder(StandardIpmFolder.SentItems); MessageInfoCollection msgInfoColl = folderInfo.GetContents(); foreach (MessageInfo msgInfo in msgInfoColl) { Console.WriteLine(msgInfo.Subject + ": " + msgInfo.EntryIdString); if (msgInfo.Subject.Equals("some delete condition") == true) { // Delete this item folderInfo.DeleteChildItem(msgInfo.EntryId); Console.WriteLine("Deleted this message"); } } //[VB.NET Code Sample] ' Get the Sent items folder Dim folderInfo As FolderInfo = pst.GetPredefinedFolder(StandardIpmFolder.SentItems) Dim msgInfoColl As MessageInfoCollection = folderInfo.GetContents() For Each msgInfo As MessageInfo In msgInfoColl Console.WriteLine(msgInfo.Subject & ": " & msgInfo.EntryIdString) If msgInfo.Subject.Equals("some delete condition") = True Then ' Delete this item folderInfo.DeleteChildItem(msgInfo.EntryId) Console.WriteLine("Deleted this message") End If Next msgInfo //Delete Items in Bulk from PST File //Aspose.Email API can be used to delete items in bulk from a PST file. This is achieved using the DeleteChildItems method which accepts a list of Entry ID items referring to the items to be deleted. //[C# Code Sample] using (PersonalStorage pst = PersonalStorage.FromFile(@"test.pst")) { FolderInfo inbox = pst.RootFolder.GetSubFolder("Inbox"); // find messages having From = "someuser@domain.com" PersonalStorageQueryBuilder queryBuilder = new PersonalStorageQueryBuilder(); queryBuilder.From.Contains("someuser@domain.com"); MessageInfoCollection messages = inbox.GetContents(queryBuilder.GetQuery()); IList<string> deleteList = new List<string>(); foreach (MessageInfo messageInfo in messages) { deleteList.Add(messageInfo.EntryIdString); } // delete messages having From = "someuser@domain.com" inbox.DeleteChildItems(deleteList); } //[VB.NET Code Sample] Using pst As PersonalStorage = PersonalStorage.FromFile("test.pst") Dim inbox As FolderInfo = pst.RootFolder.GetSubFolder("Inbox") ' find messages having From = "someuser@domain.com" Dim queryBuilder As New PersonalStorageQueryBuilder() queryBuilder.From.Contains("someuser@domain.com") Dim messages As MessageInfoCollection = inbox.GetContents(queryBuilder.GetQuery()) Dim deleteList As IList(Of String) = New List(Of String)() For Each messageInfo As MessageInfo In messages deleteList.Add(messageInfo.EntryIdString) Next ' delete messages having From = "someuser@domain.com" inbox.DeleteChildItems(deleteList) End Using
public by lbottaro 89653 679 8 8
How to collapse a div in html
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Test</title> <script language="javascript"> function toggle(elementId) { var ele = document.getElementById(elementId); if(ele.style.display == "block") { ele.style.display = "none"; } else { ele.style.display = "block"; } } </script> </head> <body> <div class="tree"> <div> BLA BLA </div> <a id="displayText" href="javascript:toggle('toggleText');">show</a> <== click Here <div onclick="javascript:toggle('toggleText');"> <h1>Hello!</h1> <div id="toggleText" style="display:none; border-width:2px; border-style:solid">Hidden data...</div> </div> <div> BLA </div> <div> BLA BLA </div> <div> BLA BLA 123 </div> <a id="displayText" href="javascript:toggle('toggleText2');">show</a> <== click Here <div id="toggleText2" style="display: none" href="javascript:toggle();"><h1>Hide!</h1></div> </div></body> </html>