logs
stringlengths
104
251k
[Test] void TestThatExceptionIsRaisedWhenStringLengthLargerThen100() [Test] void TestThatStringLengthOf99IsAccepted()
--Change to accent insensitive USE AdventureWorks; GO ALTER FULLTEXT CATALOG ftCatalog REBUILD WITH ACCENT_SENSITIVITY=OFF; GO -- Check Accentsensitivity SELECT FULLTEXTCATALOGPROPERTY('ftCatalog', 'accentsensitivity'); GO --Returned 0, which means the catalog is not accent sensitive.
--Change to accent insensitive USE AdventureWorks; GO ALTER FULLTEXT CATALOG ftCatalog REBUILD WITH ACCENT_SENSITIVITY=OFF; GO -- Check Accentsensitivity SELECT FULLTEXTCATALOGPROPERTY('ftCatalog', 'accentsensitivity'); GO --Returned 0, which means the catalog is not accent sensitive.
public class Foo { public static final int MAX_PASSWORD_SIZE = 7; public void setPassword(String password) { if (password.length() > MAX_PASSWORD_SIZE) { throw new InvalidArgumentException("password"); } } }
function hideSelected($one, $two) { $one.bind('change', function() { var val = $one.val(); $two.find('option:not(:visible)').show().end() .find('option[value='+val+']').hide().end(); }) } hideSelected($one, $two); hideSelected($two, $one);
Object problemMethod() { Object rtn = null; try { rtn = somethingThatThrewAnException(); } finally { doSomeCleanup(); return rtn; } }
/* buffer points to memory block that is bigger than the number of bytes to be read */ /* socket is open socket that is connected to a sender */ /* bytesToRead is the number of bytes expected from the sender */ /* bytesRead is a pointer to a integer variable that will hold the number of bytes */ /* actually r...
Integer('23') # => 23 Integer('0x23') # => 35 Integer('023') # => 19 Integer('0x23', 10) # => #<ArgumentError: invalid value for Integer: "0x23"> Integer('023', 10) # => 23
Integer('23') # => 23 Integer('0x23') # => 35 Integer('023') # => 19 Integer('0x23', 10) # => #<ArgumentError: invalid value for Integer: "0x23"> Integer('023', 10) # => 23
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(UnhandledExceptionCatcher); Thread.GetDomain().UnhandledException += new UnhandledExceptionEventHandler(Application_UnhandledException);
Sub ExportCode() If Not CanAccessVBOM Then Exit Sub ' Exit if access to VB object model is not allowed If (ThisWorkbook.VBProject.VBE.ActiveWindow Is Nothing) Then Exit Sub ' Exit if VBA window is not open End If Dim comp As VBComponent Dim codeFolder As String codeFolder = CombinePath...
private class Factory { public static IConfigurationObject Factory(List<string> keyValuePair) { switch (keyValuePair[0]) { case "x": return new x(keyValuePair[1]); break; /* etc. */ default: throw new ArgumentException("Wrong parameter...
public class PassByCopy{ public static void changeName(Dog d){ d.name = "Fido"; } public static void main(String[] args){ Dog d = new Dog("Maxx"); System.out.println("name= "+ d.name); changeName(d); System.out.println("name= "+ d.name); } } class Dog{ public ...
Public Class Book Implements iComparable #Region " Constructors " Private _BookId As Guid Private _RevisionId As Integer Private _Title As String Private _AuthorId As Guid Private _Price As Decimal Private _Deleted As Boolean ... Sub New(ByVal BookRow As DataRow) Try ...
Public Class Book Implements iComparable #Region " Constructors " Private _BookId As Guid Private _RevisionId As Integer Private _Title As String Private _AuthorId As Guid Private _Price As Decimal Private _Deleted As Boolean ... Sub New(ByVal BookRow As DataRow) Try ...
hg update -C development # hack hack hack hg commit -m "Made some changes" hg update -C production hg merge development hg commit -m "Merged from development"
hg update -C development # hack hack hack hg commit -m "Made some changes" hg update -C production hg merge development hg commit -m "Merged from development"
function swapAB(aValuesContainer:Object):void { if (!(aValuesContainer.hasOwnProperty("a") && aValuesContainer.hasOwnProperty("b"))) throw new ArgumentError("aValuesContainer must have properties a and b"); var tempValue:int = aValuesContainer["a"]; aValuesContainer["a"] = aValuesContainer["b"]; ...
if(Debug.Mode){ <link rel="stylesheet" type="text/css" href="error.css" /> <link rel="stylesheet" type="text/css" href="login.css" /> <link rel="stylesheet" type="text/css" href="menu.css" /> <link rel="stylesheet" type="text/css" href="page.css" /> } else { <link rel="stylesheet" type="text/css" href="site.css" /...
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern bool SetForegroundWindow(IntPtr hWnd);
def log_error(exception) message = '...' if should_log_exception_as_debug?(exception) logger.debug(message) else logger.error(message) end end def should_log_exception_as_debug?(exception) return (ActionController::RoutingError === exception) end
def log_error(exception) message = '...' if should_log_exception_as_debug?(exception) logger.debug(message) else logger.error(message) end end def should_log_exception_as_debug?(exception) return (ActionController::RoutingError === exception) end
public class UserInfo { [Category("change me!")] public int Age { get; set; } [Category("change me!")] public string Name { get; set; } }
protected void ddl_SelectedIndexChanged(object sender, EventArgs e) { XMLds.XPath = "/controls/control[@id='AuthorityType']/item[@text='" + ddl.SelectedValue + "']/linkedValue"; XMLds.DataBind(); }
Map<Thread,StackTraceElement[]> map = Thread.getAllStackTraces(); for (Map.Entry<Thread, StackTraceElement[]> threadEntry : map.entrySet()) { log.info("Thread:"+threadEntry.getKey().getName()+":"+threadEntry.getKey().getState()); for (StackTraceElement element : threadEntry.getValue()) { ...
Problem signature: Problem Event Name: BEX Application Name: iexplore.exe Application Version: 7.0.6001.18000 Application Timestamp: 47918f11 Fault Module Name: ntdll.dll Fault Module Version: 6.0.6001.18000 Fault Module Timestamp: 4791a7a6 Exception Offset: ...
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileS...
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileS...
System.ApplicationException: Something went wrong. at Adapter.WriteToFile(OleDbCommand cmd) in C:\Adapter.vb:line 35 at Adapter.GetDistributionDocument(Int32 id) in C:\Adapter.vb:line 181 ...
@echo off call :is_palindrome %1 if %ERRORLEVEL% == 0 ( echo %1 is a palindrome ) else ( echo %1 is NOT a palindrome ) exit /B 0 :is_palindrome set word=%~1 set reverse= call :reverse_chars "%word%" set return=1 if "$%word%" == "$%reverse%" ( set return=0 ) exit /B %return% :r...
SQL> select * from user_tables a, non_existent_table b where a.table_name = b.table_name; select * from user_tables a, non_existent_table b where a.table_name = b.table_name * ERROR at line 1: ORA-00942: table or view does not exist
SQL> select * from user_tables a, non_existent_table b where a.table_name = b.table_name; select * from user_tables a, non_existent_table b where a.table_name = b.table_name * ERROR at line 1: ORA-00942: table or view does not exist
Dim mailMessage As New System.Net.Mail.MailMessage() mailMessage.From = New System.Net.Mail.MailAddress(from) mailMessage.To.Add(New System.Net.Mail.MailAddress(recipent)) mailMessage.Subject = subject mailMessage.Body = body mailMessage.IsBodyHtml = True mailMessage.P...
Dim mailMessage As New System.Net.Mail.MailMessage() mailMessage.From = New System.Net.Mail.MailAddress(from) mailMessage.To.Add(New System.Net.Mail.MailAddress(recipent)) mailMessage.Subject = subject mailMessage.Body = body mailMessage.IsBodyHtml = True mailMessage.P...
bool HasRight(string rightName, DomainObject obj) { return _user.Rights.Contains(rightName); } void CheckRight(string rightName, DomainObject obj) { if (!HasRight(rightName, obj)) throw new Exception(); }
bool HasRight(string rightName, DomainObject obj) { return _user.Rights.Contains(rightName); } void CheckRight(string rightName, DomainObject obj) { if (!HasRight(rightName, obj)) throw new Exception(); }
SqlException: A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 1 - I/O Error detected in read/write operation)
import java.awt.*; import java.util.*; public class Hal{ public static void main(String[] args) throws Exception{ Robot hal = new Robot(); Random random = new Random(); while(true){ hal.delay(1000 * 60); int x = random.nextInt() % 640; int y = random.next...
public static String Combine(String path1, String path2) { if (path1==null || path2==null) throw new ArgumentNullException((path1==null) ? "path1" : "path2"); Contract.EndContractBlock(); CheckInvalidPathChars(path1); CheckInvalidPathChars(path2); return CombineNoChecks(path1, path2); } in...
public static string Combine(string path1, string path2) { if ((path1 == null) || (path2 == null)) { throw new ArgumentNullException((path1 == null) ? "path1" : "path2"); } CheckInvalidPathChars(path1); CheckInvalidPathChars(path2); if (path2.Length == 0) { return path1; ...
public void close() { try { prepStmt.close(); prepStmt = null; conn.close(); conn = null; } catch (SQLException SQLEx) { logger.warn("There was an error closing the database connection."); } } }
import java.io.*; import java.util.*; public class ExecTest2 { public static void main(String[] args) throws IOException { Process result = Runtime.getRuntime().exec("whois stackoverflow.com"); BufferedReader output = new BufferedReader(new InputStreamReader(result.getInputStream())); Stri...
def safeParse2(strToParse) if strToParse =~ /\A\d+\Z/ strToParse.to_i else raise Exception end end ["100", "1a", "b2", "t"].each do |number| begin puts safeParse2(number) rescue Exception puts "#{number} is invalid" end end
public class Mapper<K,T> : IEnumerable<T>, IEnumerator<T> { C5.TreeDictionary<K,T> KToTMap = new TreeDictionary<K,T>(); C5.HashDictionary<T,K> TToKMap = new HashDictionary<T,K>(); public void Add(K key, T value) { KToTMap.Add(key, value); TToKMap.Add(value, key); } public int...
private List<ErrorItem<A>> _itemsOfA = null; public IEnumerable<ErrorItem<A>> ItemsOfACached { if (_itemsOfA == null) _itemsOfA = new List<ErrorItem<A>>(ItemsOfA); return _itemsOfA; }
private List<ErrorItem<A>> _itemsOfA = null; public IEnumerable<ErrorItem<A>> ItemsOfACached { if (_itemsOfA == null) _itemsOfA = new List<ErrorItem<A>>(ItemsOfA); return _itemsOfA; }
String propFile = "/path/to/file"; Properties props = new Properties(); /*set some properties here*/ try { FileOutputStream xmlStream = new FileOutputStream(propFile); /*this comes out unsorted*/ props.storeToXML(xmlStream,""); } catch (IOException e) { e.printStackTrace(); }
String propFile = "/path/to/file"; Properties props = new Properties(); /* Set some properties here */ Properties tmp = new Properties() { @Override public Set<Object> keySet() { return Collections.unmodifiableSet(new TreeSet<Object>(super.keySet())); } }; tmp.putAll(props); try { FileOutputStream xml...
List<String> command = new ArrayList<String>(); command.add(someExecutable); command.add(someArguemnt0); command.add(someArgument1); command.add(someArgument2); ProcessBuilder builder = new ProcessBuilder(command); try { final Process process = builder.start(); ... } catch (IOException ioe) {}
string fileName = "MSIEXEC.exe"; string arguments = "/x {14D74337-01C2-4F8F-B44B-67FC613E5B1F} /qn"; ProcessStartInfo psi = new ProcessStartInfo(fileName, arguments) { CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true }; Process process = Process.Start(psi); string errorMsg = p...
<authentication mode="Forms"> <forms name=".cookiename" loginUrl="~/Login.aspx" timeout="30" path="/" /> </authentication>
$ svn info Path: . ... Last Changed Author: fak Last Changed Rev: 713 Last Changed Date: 2008-08-29 00:40:53 +0300 (Fri, 29 Aug 2008) $ svn up At revision 721. $ svn info Path: . ... Revision: 721 Last Changed Author: reuben Last Changed Rev: 721 Last Changed Date: 2008-08-31 22:55:22 +0300 (Sun, 31 Aug 2008)
$ svn info Path: . ... Last Changed Author: fak Last Changed Rev: 713 Last Changed Date: 2008-08-29 00:40:53 +0300 (Fri, 29 Aug 2008) $ svn up At revision 721. $ svn info Path: . ... Revision: 721 Last Changed Author: reuben Last Changed Rev: 721 Last Changed Date: 2008-08-31 22:55:22 +0300 (Sun, 31 Aug 2008)
SQL Error: ORA-03001: unimplemented feature 03001. 00000 - "unimplemented feature" *Cause: This feature is not implemented.
SQL Error: ORA-03001: unimplemented feature 03001. 00000 - "unimplemented feature" *Cause: This feature is not implemented.
} catch (XmlRpcException rpce) { Throwable cause = rpce.getCause(); if(cause != null) { if(cause instanceof ExceptionYouCanHandleException) { handler(cause); } else { throw(cause); } } else { throw(rpce); } }
@Test @SuppressWarnings("unchecked") public void someTest() { SomeClass<Integer> someClass = EasyMock.createMock(SomeClass.class); }
<select name="Products" id="Products" onchange="getHeadings(this.value);"> <option value="">Select Product</option> </select> function getProducts(Category) { $.ajax({ type: "GET", url: "getInfo.cfm", data: "Action=getProducts&Category=" + Category, success: function(result){ $("#Products...
--Grab the next message id begin tran declare @MessageId uniqueidentifier select top 1 @MessageId = ActionMessageId from UnacknowledgedDemands with(holdlock, updlock); --Acknowledge the message update ActionMessages set AcknowledgedTime = getdate() where ActionMessageId = @MessageId -- some error checking commit tr...
--Grab the next message id begin tran declare @MessageId uniqueidentifier select top 1 @MessageId = ActionMessageId from UnacknowledgedDemands with(holdlock, updlock); --Acknowledge the message update ActionMessages set AcknowledgedTime = getdate() where ActionMessageId = @MessageId -- some error checking commit tr...
namespace TimedReadLine { public static class Console { private delegate string ReadLineInvoker(); public static string ReadLine(int timeout) { return ReadLine(timeout, null); } public static string ReadLine(int timeout, string @default) { using (var process...
System.InvalidOperationException: BufferedGraphicsContext cannot be disposed of because a buffer operation is currently in progress. at System.Drawing.BufferedGraphicsContext.Dispose(Boolean disposing) at System.Drawing.BufferedGraphicsContext.Dispose() at System.Drawing.BufferedGraphicsContext.AllocBufferInTempMana...
OleDbCommand dbCmd = new OleDbCommand("CREATE TABLE [test$] (...)", connection); dbCmd.CommandTimeout = mTimeout; results = dbCmd.ExecuteNonQuery();
$.ajax({ url:"/url/file/", dataType:"json" data:{ 'id' : object.id } error:function(request){alert(request.statusText)} success:successFunction })
private IWebBase FindWebBase() { if (HttpContext.Current as IWebBase != null) { return (IWebBase)HttpContext.Current.; } throw new NotImplementedException("Crawling for IWebBase not implemented yet"); }
>>> import re >>> re.compile('he(lo') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python25\lib\re.py", line 180, in compile return _compile(pattern, flags) File "C:\Python25\lib\re.py", line 233, in _compile raise error, v # invalid expression sre_constants.error: unbal...
using (var reader = new BinaryReader(httpRequestBodyStream)) { try { while (true) { bodyByteList.Add(reader.ReadByte()); } } catch (EndOfStreamException) { } }
Private Sub ServiceQueuedMainCallback(ByVal state As Object) Dim args As String() = DirectCast(state, String()) Try Me.OnStart(args) Me.WriteEventLogEntry(Res.GetString("StartSuccessful")) Me.status.checkPoint = 0 Me.status.waitHint = 0 Me.status.currentState = 4 Cat...
[foo, goo, bar].each { |param| if param.class != Array puts "param_name wasn't an Array. It was a/an #{param.class}" return "Error: param_name wasn't an Array" end }
public enum ExampleEnum { FooBar, BarFoo } public class ExampleClass : INotifyPropertyChanged { private ExampleEnum example; public ExampleEnum ExampleProperty { get { return example; } { /* set and notify */; } } }
string path = "C:\\a"; string[] dirs = Directory.GetDirectories(path, "*.*", SearchOption.AllDirectories); string newpath = "C:\\x"; try { Directory.CreateDirectory(newpath); } catch (IOException ex) { Console.WriteLine(ex.Message); } for (int j = 0; j < dirs.Length; j++) { try { Directory.Creat...
*SNIP* maxActive="10" maxIdle="5" maxWait="7000" removeAbandoned="true" logAbandoned="false" removeAbandonedTimeout="3" *SNIP*
{"foo" => foo, "goo" => goo, "bar"=>bar}.each do |param_name, param| if param.class != Array puts "#{param_name} wasn't an Array. It was a/an #{param.class}" puts "Error: #{param_name} wasn't an Array" end end
' ---------------------- Directory Choosing Helper Functions ----------------------- ' Excel and VBA do not provide any convenient directory chooser or file chooser ' dialogs, but these functions will provide a reference to a system DLL ' with the necessary capabilities Private Type BROWSEINFO ' used by the function...
using System; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; using System.Collections; [assembly: CLSCompliant(true)] namespace Range { public static partial class UserDefinedFunctions { [Microsoft.SqlServer.Server.SqlFunction(DataAccess = DataAccessKind.None, IsDeterministic = true, SystemD...
#define throwException(message) \ { \ std::ostringstream oss; \ oss << __FILE __ << " " << __LINE__ << " " \ << __FUNC__ << " " << message; \ throw std::exception(oss.str().c_str()); \ }
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cascade_test/uncle`, CONSTRAINT `fk_child` FOREIGN KEY (`childid`) REFERENCES `child` (`id`))
if(file_exists($filename)) { header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: " . $content-type); header("Content-Disposition: attachment; filename=\"" . basename($filename)...
SetPassword(user, password) salt = RandomString() hash = Hashfunction(salt+password) StoreInDatabase(user, salt, hash) CheckPassword(user, password) (salt, hash) = GetFromDatabase(user) if Hashfunction(salt+password) == hash return "Success" else return "Login Failed"
rx{ ^ $<month> = (\d ** 1..2) { $<month> <= 12 or fail } '/' $<day> = (\d ** 1..2) { given( +$<month> ){ when 1|3|5|7|8|10|12 { $<day> <= 31 or fail } when 4|6|9|11 { $<day> <= 30 or fail } when 2 { $<day> <= 29 or fail } default { fai...
Debug.Assert(i > 3, "i must be greater than 3 because of the flibbity widgit status"); if (i <= 3) { throw new ArgumentOutOfRangeException("i", "i must be > 3 because... i=" + i.ToString()); }
Debug.Assert(i > 3, "i must be greater than 3 because of the flibbity widgit status"); if (i <= 3) { throw new ArgumentOutOfRangeException("i", "i must be > 3 because... i=" + i.ToString()); }
public string ToString() { Debug.Assert(Name != null); if ( Name == null ) { throw new InvalidOperationException("Name is null"); } return Name; }
public string ToString() { Debug.Assert(Name != null); if ( Name == null ) { throw new InvalidOperationException("Name is null"); } return Name; }
Imports System.Runtime.InteropServices Imports Microsoft.Office.Interop.Word Public Class Form1 Inherits System.Windows.Forms.Form Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strFileName As String Dim wordapp As New Microsoft.Office.Interop.Word.Ap...
Properties props = System.getProperties(); props.setProperty("mail.store.protocol", "imaps"); try { Session session = Session.getDefaultInstance(props, null); Store store = session.getStore("imaps"); store.connect("imap.gmail.com", "<username>@gmail.com", "<password>"); ... } catch (NoSuchProviderException e) {...
/** * Get all readers name for this current Report. <br /> * <b>Warning</b>The Report must have been published first. * @param aReaderNameRegexp filter in order to return only reader matching the regexp * @return array of reader names */ String[] getReaderNames(final String aReaderNameRegexp);
/** * Get all readers name for this current Report. <br /> * <b>Warning</b>The Report must have been published first. * @param aReaderNameRegexp filter in order to return only reader matching the regexp * (can be null or empty) * @return array of reader names * (null if Report has not yet been published, * e...
/** * Get all readers name for this current Report. <br /> * <b>Warning</b>The Report must have been published first. * @param aReaderNameRegexp filter in order to return only reader matching the regexp * @return array of reader names */ String[] getReaderNames(final String aReaderNameRegexp);
/** * Get all readers name for this current Report. <br /> * <b>Warning</b>The Report must have been published first. * @param aReaderNameRegexp filter in order to return only reader matching the regexp * (can be null or empty) * @return array of reader names * (null if Report has not yet been published, * e...
Public Sub LogExceptionChain(ByVal CurrentException As Exception) Dim innerException As Exception = CurrentException.InnerException Dim exception2 As Exception = CurrentException Debug.Print(exception2.Message) 'Log the Exception Do While (Not innerException Is Nothing) exception2 = innerExc...
Public Sub LogExceptionChain(ByVal CurrentException As Exception) Dim innerException As Exception = CurrentException.InnerException Dim exception2 As Exception = CurrentException Debug.Print(exception2.Message) 'Log the Exception Do While (Not innerException Is Nothing) exception2 = innerExc...
[DllImport(@"urlmon.dll", CharSet = CharSet.Auto)] private extern static System.UInt32 FindMimeFromData( System.UInt32 pBC, [MarshalAs(UnmanagedType.LPStr)] System.String pwzUrl, [MarshalAs(UnmanagedType.LPArray)] byte[] pBuffer, System.UInt32 cbSize, [MarshalAs(UnmanagedType...
public static class Enumeration { public static IDictionary<int, string> GetAll<TEnum>() where TEnum: struct { var enumerationType = typeof (TEnum); if (!enumerationType.IsEnum) throw new ArgumentException("Enumeration type is expected."); var dictionary = new Dictionary<in...
from xml.sax import saxutils from xml.dom.minidom import parseString from xml.parsers.expat import ExpatError xml = '''<?xml version="1.0" encoding="%s"?>\n <contents title="%s" crawl_date="%s" in_text_date="%s" url="%s">\n<main_post>%s</main_post>\n</contents>''' % (self.encoding, saxutils.escape(title), saxutils.es...
warning CS0472: The result of the expression is always 'false' since a value of type 'int' is never equal to 'null' of type 'int?'
warning CS0472: The result of the expression is always 'false' since a value of type 'int' is never equal to 'null' of type 'int?'
var c = 0 var t; function timedCount() { document.getElementById('txt').value = c; c = c + 1; t = setTimeout("timedCount()", 1000); }
for each (var node:XML in xml.node) { var textInput:TextInput = new TextInput(); var handler:Function = function(event:Event):void { node.setChildren(event.target.text); }; textInput.text = node.text(); textInput.addEventListener(Event.CHANGE, handler); this.addChild(pileHeightEdito...