Search Results

Search found 1588 results on 64 pages for 'letter'.

Page 10/64 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Are swapped in hot-swap drives allocated the same Windows drive letter each time?

    - by Margaret
    We are intending on purchasing a dedicated machine to perform the company's backups. We were considering buying the Dell T310, with the theory that we could swap the drives in and out for offsite backup. (As in, take out a drive, put a version a couple of days' old in its place, the old backup is updated to the current version.) One thing that may stymie this, though, is the system changing drive letters as things get moved in and out. Does anyone know whether this happens?

    Read the article

  • How do I dynamically assign the Model for a .find in Ruby on Rails?

    - by Angela
    I am trying to create a Single Table Inheritance. However, the Controller must be able to know which class to find or create. These are based on another class. For example, ContactEvent with type = Letter needs to grab attributes from a corresponding Model called Letter. Here's what I've tried to do and hit a snag, labelled below. I need to be able to dynamically call assign a value of EventClass so that it can be Letter.find(:conditions =) or Calls.find(:conditions =) depending on which type the controller is acting on. def new @contact_event = ContactEvent.new @contact_event.type = params[:event_type] # can be letter, call, postcard, email @contact_event.event_id = params[:event_id] # that ID to the corresponding Model @contact_event.contact_id = params[:contact] @EventClass = case when @contact_event.type == 'letter' then 'Letter' when @contact_event.type == 'call' then 'Call' when @contact_event.type == 'email' then 'Email' SNAG BELOW: @event = @EventClass.find(@contact_letter.letter_id) #how do I make @EventClass actually the Class?SNAG # substitution of variables into the body of the contact_event @event.body.gsub!("{FirstName}", @contact.first_name) @event.body.gsub!("{Company}", @contact.company_name) @evebt.body.gsub!("{Colleagues}", @colleagues.to_sentence) @contact_event.body = @event.body @contact_event.status = "sent" end

    Read the article

  • C# A simple Hangman game

    - by Radostin Angelov
    I'm trying to create a simple Hangman game and i have gotten so far, to make it read all words from a text file, but I don't know how to make the code work for every single word. I have another project, working with 3/4 words but with repeating nested if statements. I want to make it as shorter as possible. This is the code i have so far : using System; using System.Linq; class Program { static void Main() { string[] words = System.IO.File.ReadAllLines(@"C:\Users\ADMIN\Desktop\Letters\Letters.txt"); int LengthOfArray = words.Length; Random rnd = new Random(); int random = rnd.Next(1, 3); char[] letters = words[random].ToCharArray(); bool WordIsHidden = true; char hiddenChar = '_'; char GuessedLetter = hiddenChar; var retry = true; while (retry = true) { Console.WriteLine(letters); letters = GuessedLetter.ToString().ToCharArray(); for (int i = 1; i <= LengthOfArray; i++) { Console.Write("{0} ", GuessedLetter); } Console.WriteLine("Enter a letter!"); char letter = char.Parse(Console.ReadLine()); if (words[random].Contains<char>(letter)) { WordIsHidden = false; GuessedLetter = letter; Console.Write(letters); } else { if (WordIsHidden == true) { Console.Write("You guessed wrong!"); } } } } } Also I'm trying to make the game show each letter, the user has guessed on it's corresponding position, but now the letter is one line higher than the rest of the word and it's not in it's right position. Edited: Here is the result : cat ___Enter a letter! a __ aaaEnter a letter! t aa tttEnter a letter! IF anyone have a clue for where does this come from and how can I fix it, any help will be greatly appreciated.

    Read the article

  • WTSVirtualChannelRead Only reads the first letter of the string.

    - by Scott Chamberlain
    I am trying to write a hello world type program for using virtual channels in the windows terminal services client. public partial class Form1 : Form { public Form1() { InitializeComponent(); } IntPtr mHandle = IntPtr.Zero; private void Form1_Load(object sender, EventArgs e) { mHandle = NativeMethods.WTSVirtualChannelOpen(IntPtr.Zero, -1, "TSCRED"); if (mHandle == IntPtr.Zero) { throw new Win32Exception(Marshal.GetLastWin32Error()); } } private void button1_Click(object sender, EventArgs e) { uint bufferSize = 1024; StringBuilder buffer = new StringBuilder(); uint bytesRead; NativeMethods.WTSVirtualChannelRead(mHandle, 0, buffer, bufferSize, out bytesRead); if (bytesRead == 0) { MessageBox.Show("Got no Data"); } else { MessageBox.Show("Got data: " + buffer.ToString()); } } protected override void Dispose(bool disposing) { if (mHandle != System.IntPtr.Zero) { NativeMethods.WTSVirtualChannelClose(mHandle); } base.Dispose(disposing); } } internal static class NativeMethods { [DllImport("Wtsapi32.dll")] public static extern IntPtr WTSVirtualChannelOpen(IntPtr server, int sessionId, [MarshalAs(UnmanagedType.LPStr)] string virtualName); //[DllImport("Wtsapi32.dll", SetLastError = true)] //public static extern bool WTSVirtualChannelRead(IntPtr channelHandle, long timeout, // byte[] buffer, int length, ref int bytesReaded); [DllImport("Wtsapi32.dll")] public static extern bool WTSVirtualChannelClose(IntPtr channelHandle); [DllImport("Wtsapi32.dll", EntryPoint = "WTSVirtualChannelRead")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool WTSVirtualChannelRead( [In()] System.IntPtr hChannelHandle , uint TimeOut , [Out()] [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder Buffer , uint BufferSize , [Out()] out uint pBytesRead); } I am sending the data from the MSTSC COM object and ActiveX controll. public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { rdp.Server = "schamberlainvm"; rdp.UserName = "TestAcct"; IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); secured.ClearTextPassword = "asdf"; rdp.CreateVirtualChannels("TSCRED"); rdp.Connect(); } private void button1_Click(object sender, EventArgs e) { rdp.SendOnVirtualChannel("TSCRED", "Hello World!"); } } //Designer code // // rdp // this.rdp.Enabled = true; this.rdp.Location = new System.Drawing.Point(12, 12); this.rdp.Name = "rdp"; this.rdp.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("rdp.OcxState"))); this.rdp.Size = new System.Drawing.Size(1092, 580); this.rdp.TabIndex = 0; I am getting a execption every time NativeMethods.WTSVirtualChannelRead runs Any help on this would be greatly appreciated. EDIT -- mHandle has a non-zero value when the function runs. updated code to add that check. EDIT2 -- I used the P/Invoke Interop Assistant and generated a new sigiture [DllImport("Wtsapi32.dll", EntryPoint = "WTSVirtualChannelRead")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool WTSVirtualChannelRead( [In()] System.IntPtr hChannelHandle , uint TimeOut , [Out()] [MarshalAs(UnmanagedType.LPStr)] StringBuilder Buffer , uint BufferSize , [Out()] out uint pBytesRead); it now receives the text string (Yea!) but it only gets the first letter of my test string(Boo!). Any ideas on what is going wrong? EDIT 3 --- After the call that should of read the hello world; BytesRead = 24 Buffer.Length = 1; Buffer.Capacity = 16; Buffer.m_StringValue = "H";

    Read the article

  • C# Regex - Replace multiple characters at once without overwriting?

    - by Everaldo Aguiar
    Hello guys, I'm implementing a c# program that should automatize a Mono-alphabetic substitution cipher. The functionality i'm working on at the moment is the simplest one: The user will provide a plain text and a cipher alphabet, for example: Plain text(input): THIS IS A TEST Cipher alphabet: A - Y, H - Z, I - K, S - L, E - J, T - Q Cipher Text(output): QZKL KL QJLQ I thought of using regular expressions since I've been programming in perl for a while, but I'm encountering some problems on c#. First I would like to know if someone would have a suggestion for a regular expression that would replace all occurrence of each letter by its corresponding cipher letter (provided by user) at once and without overwriting anything. Example: In this case, user provides plaintext "TEST", and on his cipher alphabet, he wishes to have all his T's replaced with E's, E's replaced with Y and S replaced with J. My first thought was to substitute each occurrence of a letter with an individual character and then replace that character by the cipherletter corresponding to the plaintext letter provided. Using the same example word "TEST", the steps taken by the program to provide an answer would be: 1 - replace T's with (lets say) @ 2 - replace E's with # 3 - replace S's with & 4 - Replace @ with E, # with Y, & with j 5 - Output = EYJE This solution doesn't seem to work for large texts. I would like to know if anyone can think of a single regular expression that would allow me to replace each letter in a given text by its corresponding letter in a 26-letter cipher alphabet without the need of splitting the task in an intermediate step as I mentioned. If it helps visualize the process, this is a print screen of my GUI for the program: http://img43.imageshack.us/img43/2118/11618743.jpg

    Read the article

  • .NET Regex - Replace multiple characters at once without overwriting?

    - by Everaldo Aguiar
    I'm implementing a c# program that should automatize a Mono-alphabetic substitution cipher. The functionality i'm working on at the moment is the simplest one: The user will provide a plain text and a cipher alphabet, for example: Plain text(input): THIS IS A TEST Cipher alphabet: A - Y, H - Z, I - K, S - L, E - J, T - Q Cipher Text(output): QZKL KL QJLQ I thought of using regular expressions since I've been programming in perl for a while, but I'm encountering some problems on c#. First I would like to know if someone would have a suggestion for a regular expression that would replace all occurrence of each letter by its corresponding cipher letter (provided by user) at once and without overwriting anything. Example: In this case, user provides plaintext "TEST", and on his cipher alphabet, he wishes to have all his T's replaced with E's, E's replaced with Y and S replaced with J. My first thought was to substitute each occurrence of a letter with an individual character and then replace that character by the cipherletter corresponding to the plaintext letter provided. Using the same example word "TEST", the steps taken by the program to provide an answer would be: 1 - replace T's with (lets say) @ 2 - replace E's with # 3 - replace S's with & 4 - Replace @ with E, # with Y, & with j 5 - Output = EYJE This solution doesn't seem to work for large texts. I would like to know if anyone can think of a single regular expression that would allow me to replace each letter in a given text by its corresponding letter in a 26-letter cipher alphabet without the need of splitting the task in an intermediate step as I mentioned. If it helps visualize the process, this is a print screen of my GUI for the program:

    Read the article

  • Hide All But First Matching Element

    - by Batfan
    I am using jquery to sort through multiple paragraphs. Currently I have it set to show only paragraphs that start with a current letter. But now, I would like to consolidate further. If the text between the paragraph tags has multiple instances, I would like all but the first hidden. This is what I have so far but, it is not working. var letter = '<?php echo(strlen($_GET['letter']) == 1) ? $_GET['letter'] : ''; ?>' function finish(){ jQuery('p').each(function(){ if(jQuery(this).text().substr(0,1).toUpperCase() == letter){ jQuery(this).addClass('current-series'); jQuery(this).html(letter + '<span class="hidden">'+jQuery(this).text().slice(1)+ '</span>'); } else{ jQuery(this).hide();} }) } Update: Sorry guys, I know this is kind of hard to explain. Here's a basic example: The selected letter is B The values returned are: Ball Ball Ball Boy Brain Bat Bat Each of these values is in a paragraph tag. Is there a way to consolidate to this? Ball Boy Brain Bat

    Read the article

  • how to uppercase date and month first letter of ToLongDateString() result in es-mx Culture ?

    - by Oscar Cabrero
    currently i obtain the below result from the following C# line of code when in es-MX Culture Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-mx"); <span><%=DateTime.Now.ToLongDateString()%></span> miércoles, 22 de octubre de 2008 i would like to obtain the following Miércoles, 22 de Octubre de 2008 do i need to Build my own culture?

    Read the article

  • LaTeX: How to change one of section numbers to a custom letter?

    - by user309937
    Hi, I have something like this: Section 1 ... Section 2 ... Section 3 Subsection 3.1 ... Section 4 ... And I would like to have something like this: Section 1 ... Section 2 ... Section A Subsection A.1 ... Section 4 ... In other words - change one of section numbers to something else 3 == A I need this for my thesis which is written in article class, and when I tired to add appendices the hyperref package broke, and "links" to section 1 directed to appendix A

    Read the article

  • Should .net comments start with a capital letter and end with a period?

    - by Hamish Grubijan
    Depending on the feedback I get, I might raise this "standard" with my colleagues. This might become a custom StyleCop rule. is there one written already? So, Stylecop already dictates this for summary, param, and return documentation tags. Do you think it makes sense to demand the same from comments? On related note: if a comment is already long, then should it be written as a proper sentence? For example (perhaps I tried too hard to illustrate a bad comment): //if exception quit vs. // If an exception occurred, then quit. If figured - most of the time, if one bothers to write a comment, then it might as well be informative. Consider these two samples: //if exception quit if (exc != null) { Application.Exit(-1); } and // If an exception occurred, then quit. if (exc != null) { Application.Exit(-1); } Arguably, one does not need a comment at all, but since one is provided, I would think that the second one is better. Please back up your opinion. Do you have a good reference for the art of commenting, particularly if it relates to .Net? Thanks.

    Read the article

  • Path with no slash after drive letter and colon - what does it point to?

    - by ya23
    I have mistyped a path and instead of c:\foo.txt wrote c:foo.txt. I expected it to either fail or to resolve to c:\foo.txt, but instead it seems to be resolved to foo.txt in a current user's home folder. Powershell returns: PS C:\> [System.IO.Path]::GetFullPath("c:\foo.txt") c:\foo.txt PS C:\> [System.IO.Path]::GetFullPath("c:foo.txt") C:\Users\Administrator\foo.txt PS C:\> [System.IO.Path]::GetFullPath("g:foo.txt") G:\foo.txt Running explorer.exe from commandline and passing it any of the above results in C:\Users\Administrator\Documents to be opened. I haven't found any documentation of that and I'm utterly confused, please explain the behaviour.

    Read the article

  • Method to sort MYSQL results by an arbitriary letter (ie, show all rows starting with F first)

    - by Buzz
    I have a column of states, and, depending on the query, I want to order by results by a particular state, then by id (Asc or Desc, depending). For instance, I might want to show all rows with state "HI", sorted by ID desc, and then all the other rows, sorted by id desc. I was hoping I could do this in one query, rather than getting all my favored state results, and then getting the rest. Can I?

    Read the article

  • I thought this parsing would be simple...

    - by Rebol Tutorial
    ... and I'm hitting the wall, I don't understand why this doesn't work (I need to be able to parse either the single tag version (terminated with /) or the 2 tag versions (terminated with ) ): Rebol[] content: {<pre:myTag attr1="helloworld" attr2="hello"/> <pre:myTag attr1="helloworld" attr2="hello"> </pre:myTag> <pre:myTag attr3="helloworld" attr4="hello"/> } spacer: charset reduce [#" " newline] letter: charset reduce ["ABCDEFGHIJKLMNOPQRSTUabcdefghijklmnopqrstuvwxyz1234567890="] rule: [ any [ {<pre:myTag} any [any letter {"} any letter {"}] mark: (print {clipboard... after any letter {"} any letter {"}} write clipboard:// mark input) any spacer mark: (print "clipboard..." write clipboard:// mark input) ["/>" | ">" any spacer </pre:myTag> ] any spacer (insert mark { Visible="false"}) ] to end ] parse content rule write clipboard:// content print "The end" input

    Read the article

  • A linq join combined with a regex

    - by Geert Beckx
    Is it possible to combine these 2 queries or would this make my code too complex? Also I think there should be a performance gain by combining these queries since I think in the near future my source table could be over 11000 records. This is what i came up with so far : Dim lit As LiteralControl ' check characters not in alphabet Dim r As New Regex("^[^a-zA-Z]+") Dim query = From o In source.ToTable _ Where r.IsMatch(o.Field(Of String)("nam")) lit = New LiteralControl(String.Format("letter: {0}, count: {1}<br />", "0-9", query.Count)) plhAlpabetLinks.Controls.Add(lit) Dim q = From l In "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToLower.ToCharArray _ Group Join o In source.ToTable _ On l Equals o.Field(Of String)("nam").ToLowerInvariant(0) Into g = Group _ Select l, g.Count ' iterate the alphabet to generate all the links. For Each letter In q.AsEnumerable lit = New LiteralControl(String.Format("letter: {0}, count: {1}<br />", letter.l, letter.Count)) plhAlpabetLinks.Controls.Add(lit) Next Kind regards, G.

    Read the article

  • shift reduce&& reduce reduce errors in build parser for python garmmer

    - by user366580
    i wanna build buttom up parser by java cup i write code in java cup , it is for python language so i used grammer was written in this site : but not all grammer , i choice partial set ,just while , identifer also i smiplified them when i did compile for the java cup that i write by write this command in command prompt window : java java_cup.Main -parser CalcParser -symbols CalcSymbol < javacupfile.cup i get conflict errors ,they are of type reduce-shift conflict and reduce-reduce conflict you can see to print screen of the errors in these links image 1 click here to see imge1 the grammer was in EBNF form in as refernce site and i convert it to BNF form maybe i make mistake in converting so i get such errors the origanl grammmer was // grammer in EBNF form identifier ::= (letter|"_") (letter | digit | "_")* letter ::= lowercase | uppercase lowercase ::= "a"..."z" uppercase ::= "A"..."Z" digit ::= "0"..."9 compound_stmt ::= if_stmt | while_stmt for_stmt ::= "for" target_list "in" expression_list ":" suite ["else" ":" suite] while_stmt ::= "while" expression ":" suite ["else" ":" suite] suite ::= stmt_list NEWLINE stmt_list ::= simple_stmt (";" simple_stmt)* [";"] simple_stmt ::= expression_stmt expression_stmt ::= expression_list expression_list ::= expression ( "," expression )* [","] expression ::= conditional_expression conditional_expression ::= or_test ["if" or_test "else" expression] or_test ::= and_test | or_test "or" and_test and_test ::= not_test | and_test "and" not_test not_test ::= comparison | "not" not_test comparison ::= or_expr ( comp_operator or_expr )* comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!=" | "is" ["not"] | ["not"] "in" or_expr ::= xor_expr | or_expr "|" xor_expr xor_expr ::= and_expr | xor_expr "^" and_expr and_expr ::= "&" | and_expr the grammer after converting to BNF form identifier ::=letterletter| letterdigit| letter"_"| "_"letter | "_"digit | "_""_" letter ::= lowercase | uppercase lowercase ::= "a"..."z" uppercase ::= "A"..."Z" digit ::= "0"..."9 while_stmt ::= "while" expression ":" suite "else" ":" suite |"while" expression ":" suite suite ::= stmt_list NEWLINE stmt_list ::= simple_stmt ";" simple_stmt stmt_list|";" simple_stmt ::= expression_stmt expression_stmt ::= expression_list expression_list ::= expression "," expression expression_list| "," expression ::= conditional_expression conditional_expression ::= or_test "if" or_test "else" expression |or_test or_test ::= and_test | or_test "or" and_test and_test ::= not_test | and_test "and" not_test not_test ::= comparison | "not" not_test comparison ::= or_expr comp_operator or_expr comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!=" | "is" ["not"] | ["not"] "in" or_expr ::= xor_expr | or_expr "|" xor_expr xor_expr ::= and_expr | xor_expr "^" and_expr and_expr ::= "&" | and_expr and the java cup file that i compile and get those errors is import java.io.*; terminal COMA; terminal ELSE; terminal WHILE; terminal NEWLINE; terminal SEMCOLON; terminal CAMMA; terminal IF; terminal OR; terminal AND; terminal NOT; terminal LESS; terminal GREATER; terminal EQUAL; terminal GREATERorE; terminal LESSorE; terminal NEQUAL; terminal OROP; terminal XOROP; terminal ANDOP; terminal Integer DIGIT; terminal java.lang.String LOWERCASE; terminal java.lang.String UPPERCASE; non terminal java.lang.String IDENTIFIER; non terminal java.lang.String LETTER; non terminal COMPOUND_STMT; non terminal WHILE_STMT; non terminal EXPRESSION; non terminal SUITE ; non terminal STMT_LIST; non terminal SIMPLE_STMT; non terminal EXPRESSION_STMT; non terminal EXPRESSION_LIST; non terminal CONDITITONAL_EXPRESSION; non terminal OR_TEST; non terminal AND_TEST; non terminal NOT_TEST; non terminal COMPARISON; non terminal COMP_OPERATOR; non terminal OR_EXPR; non terminal XOR_EXPR; non terminal AND_EXPR; IDENTIFIER ::=LETTER{: System.out.printf("lowercase"); :}| {: System.out.printf("uppercase"); :} LETTER{: System.out.printf("lowercase"); :}| {: System.out.printf("uppercase"); :}| LETTER{: System.out.printf("lowercase"); :}| {: System.out.printf("uppercase"); :} DIGIT; LETTER ::= LOWERCASE | UPPERCASE; COMPOUND_STMT ::=WHILE_STMT; WHILE_STMT ::= WHILE{: System.out.printf( "while"); :} EXPRESSION COMA {: System.out.printf(":"); :} SUITE ELSE {: System.out.printf("else" ); :} COMA{: System.out.printf( ":" ); :} SUITE |WHILE{: System.out.printf( "while" ); :} EXPRESSION COMA{: System.out.printf( ":" ); :} SUITE; SUITE ::= STMT_LIST NEWLINE{: System.out.printf( "newline" ); :}; STMT_LIST ::= SIMPLE_STMT SEMCOLON{: System.out.printf( ";" ); :} SIMPLE_STMT STMT_LIST|SEMCOLON{: System.out.printf( ";" ); :}; SIMPLE_STMT ::=EXPRESSION_STMT; EXPRESSION_STMT ::=EXPRESSION_LIST; EXPRESSION_LIST ::= EXPRESSION CAMMA{: System.out.printf( "," ); :} EXPRESSION EXPRESSION_LIST| CAMMA{: System.out.printf( "," ); :}; EXPRESSION ::= CONDITITONAL_EXPRESSION; CONDITITONAL_EXPRESSION ::= OR_TEST IF{: System.out.printf( "if"); :} OR_TEST ELSE{: System.out.printf("else"); :} EXPRESSION |OR_TEST; OR_TEST ::= AND_TEST | OR_TEST OR{: System.out.printf( "or"); :} AND_TEST; AND_TEST ::= NOT_TEST | AND_TEST AND{: System.out.printf( "and"); :} NOT_TEST; NOT_TEST ::= COMPARISON | NOT{: System.out.printf("not"); :} NOT_TEST; COMPARISON ::= OR_EXPR COMP_OPERATOR OR_EXPR ; COMP_OPERATOR ::= LESS{: System.out.printf( "<"); :} | GREATER{: System.out.printf(">"); :} | EQUAL{: System.out.printf("=="); :} | GREATERorE{: System.out.printf(">="); :} | LESSorE{: System.out.printf("<="); :} | NEQUAL{: System.out.printf("!="); :}; OR_EXPR ::= XOR_EXPR | OR_EXPR OROP{: System.out.printf("|"); :} XOR_EXPR; XOR_EXPR ::= AND_EXPR | XOR_EXPR XOROP {: System.out.printf("^"); :}XOR_EXPR; AND_EXPR ::= ANDOP{: System.out.printf("&"); :} | AND_EXPR; can any one told me how can solve this errors to build parser correcrtly??

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >