cgeier 187 Junior Poster

SQL Server 2008 R2 Data Types

nvarchar(n): Variable-length Unicode data with a length of 1 to 4000 characters. Default length = 1. Storage size, in bytes, is two times the number of characters entered.

DateTime: ...Stored as two 4-byte integers...

money: Storage size is 8 bytes.

I'm not well-versed on the stock market, so I'm not sure what "Open close dividend split" is. Is this a monetary value? Also what is the maximum length of the a stock symbol?

Stock symbol 2 x number_of_characters = # of bytes
Trading Date (DateTime): 8 bytes

Someone correct me if I'm wrong, but I think you can compute the space required by doing something similar to the following:

Example:

Stock Symbol (nvarchar(10)): 10 x 2 = 20 bytes
Trading Date (DateTime): 8 bytes
Opening Price (money): 8 bytes
Closing Price (money): 8 bytes
High Price (money): 8 bytes
Low Price (money): 8 bytes

Total bytes per record: 20 + 8 + 8 + 8 + 8 + 8 = 60 bytes / record

Total records (1 company): 5 yrs x (252 trading days / 1 yr) x (4 records / 1 day) = 5040 records

Total records (500 companies): (5040 records / 1 company) x 500 companies = 2,520,000 records

Total (Bytes): 2,520,000 records x (60 bytes / 1 record) = 151,200,000 Bytes

Total (KB): 151,200,000 bytes x (1 KB x 1024 bytes) = 147,656.25 KB

Total (MB): 144.19 MB

cgeier 187 Junior Poster

What is the "2 GB limit" that you mentioned? Also, how did you determine the size that your data would be (in the database)?

SQL Server Express:
SQL Server 2008 R2 Express Database Size Limit Increased to 10GB

mySQL:
mySQL - D.10.3 Limits on Table Size
Win32 w/ NTFS: 2TB (possibly larger)

cgeier 187 Junior Poster

How are you currently reading/"importing" the XML files? Perhaps you can post one or two of the XML files as well.

cgeier 187 Junior Poster

@stultuske is correct. At this stage passenger name is unnecessary. I was thinking ahead. If you continue to build on this project, in future lessons, you may need to add passenger name and some of the other things mentioned.

cgeier 187 Junior Poster

At a minimum, it should probably include passenger name, passenger weight, and luggage weight. Additionally, you might include address, phone number, and customer id. I don't know how many people would be honest about their weight though or be willing to step on a scale in public.

Also, are you entering the weight for each luggage separately or weighing all luggage together?

cgeier 187 Junior Poster

Also search for "data structures" or "data structures and algorithms". Here's a url that showed up: https://www.cs.auckland.ac.nz/~jmor159/PLDS210/searching.html

cgeier 187 Junior Poster

When you say "handwritten", do you mean "hard coded"?

If it contains a " - " after the number, read all directory names using one of the methods in System.IO.DirectoryInfo. To extract the property number, use stringVariableName.Substring(0, stringVariableName.IndexOf ("-") - 2).

cgeier 187 Junior Poster

Have you rebooted both the computer (that's connected to the printer and the one printing to the printer) and the printer? Btw, it isn't a good idea to pull paper from the printer when it's turned on.

cgeier 187 Junior Poster

If your program fails, how can you re-run it if you delete the original files or overwrite them?

cgeier 187 Junior Poster

If you need to append to a text file, there are many examples on the web of how to do it. Search the following using your favorite search engine: vb.net append to text file

cgeier 187 Junior Poster

It sounds like the Windows message that occurs during long running tasks. This occurs because you are executing the long running task on the main thread. The long running operation can occur for multiple reasons. One reason is because it takes that long to complete. Another reason could be resource contention. You should use BackgroundWorkerThread for long running operations.

See the following:
How to use BackGroundWorker to Create Threads

cgeier 187 Junior Poster

Check out XmlSerializer to see if it meets your needs. See this post for how to use it.

cgeier 187 Junior Poster

The following is a continuation of my above post.

To serialize the XML (write the XML to file), we will create a static class called "ClsXmlHelper" and add an instance of our "Table" class (ClsTable).

ClsXmlHelper.cs:

public static class ClsXmlHelper
{
    //create instance of root attribute (Table) class
    public static ClsTable myClsTable = new ClsTable();

}//class

Add the following "using" statements:

using System.IO;
using System.Xml;
using System.Xml.Serialization;

Serializing is quite simple:

public static class ClsXmlHelper
{

    //create instance of root attribute (Table) class
    public static ClsTable myClsTable = new ClsTable();

    public static void serializeToXml(string filename)
    {
        //writes Xml to file

        //create new instance of StreamWriter
        StreamWriter sw = new StreamWriter(filename);

        //create new instance of XmlSerializer(<your class>.GetType)
        XmlSerializer mySerializer = new XmlSerializer(myClsTable.GetType());

        //serialize - write data to file
        mySerializer.Serialize(sw, myClsTable);

        //close StreamWriter
        if (sw != null)
        {
            sw.Close();
        }//if

    }//serializeToXml
}//class

If you want to eliminate the namespaces and the XML declaration in the XML file, use the following instead:

public static class ClsXmlHelper
{

    //create instance of root attribute (Table) class
    public static ClsTable myClsTable = new ClsTable();

    public static void serializeToXml(string filename)
    {
        //writes Xml to file

        //create new instance of StreamWriter
        StreamWriter sw = new StreamWriter(filename);

        //create new instance of XmlSerializer(<your class>.GetType)
        XmlSerializer mySerializer = new XmlSerializer(myClsTable.GetType());

        //eliminate "xsd" and "xsi" namespaces
        XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
        ns.Add(string.Empty, "urn:none");

        //indent Xml and eliminate Xml declaration
        XmlWriterSettings myXmlWriterSettings = new XmlWriterSettings();
        myXmlWriterSettings.OmitXmlDeclaration = true;
        myXmlWriterSettings.Encoding = Encoding.UTF8;
        myXmlWriterSettings.Indent = true;

        //create instance of XmlWriter …
cgeier 187 Junior Poster

I haven't used Linq, but if you know how to use Linq with a List, then you should be able to use the following--it uses XmlSerializer. I see a discrepancy in what you posted above. There would be no need to do where GroupName="Name" if the file only contained one GroupName. So, I will assume an XML file that looks like the following:

Table.xml

<Table>
  <GroupPermissions>
    <Group GroupName="Group1">
      <ModuleRestrictions>
        <Module1>
          <Button1 value="true" />
        </Module1>
      </ModuleRestrictions>
    </Group>
    <Group GroupName="Group2">
      <ModuleRestrictions>
        <Module1>
          <Button1 value="false" />
        </Module1>
      </ModuleRestrictions>
    </Group>
  </GroupPermissions>
</Table>

To use XmlSerializer, we will use nested classes.

"Table", "GroupPermissions", "Group", "ModuleRestrictions", "Module1", and "Button1" are XML elements (these will be denoted by "XmlElement" or "XmlElementAttribute"). Each one of these will be it's own class.

"Group" contains an attribute named "GroupName". This will be denoted as an "XmlAttribute". Likewise, "Button1", contains an attribute named "value".

In the XML file "Table.xml", more than one "Group" element exists. So, we need to use something that allows for more than one instance of "Group"--we will use a List for this.

Let's get started.

Note: It is necessary to add using System.Xml.Serialization; statement to each class (file).

You can name the classes anything you want as long as you specify the actual name of the element in the XML file using "ElementName" (if "ElementName" isn't specified, XmlSerializer, will assume that the class name matches the element name). Likewise, with variable and class instance names.

I will start all of the class names with "Cls". …

ddanbe commented: Great! +15
cgeier 187 Junior Poster

If you're creating a new "child" form each time, it isn't necessary to use a property, data can be passed using a constructor.

Public Class Form2

    Private _studentId As Integer

    Public Sub New(ByVal studentId As Integer)
        _studentId = studentId
    End Sub

End Class

Use a property if you are creating the "child" form and need to update the data after the form has already been created.

cgeier 187 Junior Poster

"table" is a reserved word. I don't recommend using reserved words as column names, even if permitted by surrounding it with "[]". Check all of your column names to see if they are reserved words for the database that you are using.

cgeier 187 Junior Poster

What is contained in "reader.Start()"?

cgeier 187 Junior Poster

You can use the following utility from Sysinternals:

CoreInfo

Dump information on system CPU and memory topology

Resource:
How To Check If Your Processor Supports PAE, NX And SSE2 For Windows 8 Installation

cgeier 187 Junior Poster

Start by breaking the problem down.
1. Define a structure named "Ticket"--How do you define a structure in C++?
2. How do you define data items for/in a structure? Define the following:
-name of the carnival
-total amount of tickets
-price per ticket
-total tickets sold
-total sales
3. What is the formula to compute total sale using price per ticket and total tickets sold?
4. How do you use (input the data into) the structure?
5. How do you print the data contained in the structure to the screen?

cgeier 187 Junior Poster

Perhaps your teacher wanted you to write the code?

cgeier 187 Junior Poster

Is this a laptop or desktop? What is the brand and model number? Are you getting a blue error screen?

The following may be of use:
How to resolve automatic restarts problem when Windows 7 experiences an error (Easy Fix Article - Written by MVP)

"...It is recommended that you cancel automatic restart. If you restart after every system failure, then you will not be able to see some error messages..."

cgeier 187 Junior Poster

The documentation I saw says that longblob is stored as byte strings. Executescalar returns a single value.Look at this one http://www.dhirajranka.com/2011/05/image-to-database-and-from-database-to-picturebox-control-c/

cgeier 187 Junior Poster

Note: In the 2nd for loop above, the "sudo" in front of "tune2fs -l" may not be necessary.

Also in the "alternatively" section, if you have trouble running the commands, try adding "sudo" in front. Example: sudo fdisk -l

cgeier 187 Junior Poster

I think that the following should work (in bash shell):

To enter bash shell, type "bash" at the prompt:

# bash

Then enter the following on one line:

for i in $(fdisk -l | awk '/^\/dev/ {print $1}'); do echo ""; echo $i; tune2fs -l "$i" | head -3 | grep -v tune2fs; done | more

If that doesn't work, you may need to use "sudo":

for i in $(sudo fdisk -l | awk '/^\/dev/ {print $1}'); do echo ""; echo $i; sudo tune2fs -l "$i" | head -3 | grep -v tune2fs; done | more

What does it do? Basically, it runs fdisk -l and searches for lines that start with "/dev". For each of the results found (ex: /dev/sda1, /dev/sda2, etc...), it echo's (prints to terminal window) the partition name (ex: /dev/sda1, etc...) and then runs tune2fs -l on it--returning the first 3 lines of output and eliminating the line that has "tune2fs" in it. The "more" pauses it if there is more than one screen of data to give you time to read it.

The stuff between / /, is a pattern. The caret (^) means "starts with", and the "\" escapes the "/".

I tested it in linux.

Note: When using "more", use space bar or enter key to see more data.

Alternatively, you can do the following:

# fdisk -l | awk '/^\/dev/ {print $1}'

Note: You can just type fdisk -l and look through the output for the information (eliminating …

cgeier 187 Junior Poster

If fdisk -l doesn't work, try: sudo fdisk -l

cgeier 187 Junior Poster

Looking at the documentation for parted, I don't see that "-l" is an option.

The following article may be of use:
What's the best way to get info about currently unmounted drives?

Instead of using "parted -l" in the above, type parted print or fdisk -l (or sfdisk -l).

Linux fdisk command

cgeier 187 Junior Poster

It is important to either use "Using" statements and/or call the "Close" method for unmanaged code (such as COM objects). In short, if a "Close" method exists, use it.

Is this only occuring on one computer?

cgeier 187 Junior Poster

What happens when you do the following?

System.out.println(9/5);

You get 1.
32 x 1 = 32.

What you need to do is:

System.out.println(9.0/5.0);

You get 1.8.

When debugging computations that aren't working out, you can put the values into variables, print them out, do your computation and then print out the result.

So rather than doing:

System.out.println(myinput + 32 * (9/5));

In your original code, try the following:

Scanner input = new Scanner(System.in);
System.out.println("Celsius of your input is Fahrenheit degree ");
double myinput = input.nextInt();

double nineFifths = 9 / 5;

System.out.println(nineFifths);

System.out.println(myinput);

System.out.println(myinput + 32);
System.out.println (myinput + 32 * nineFifths);

This will help you figure out where your problems are.

Additionally, you have other problems. Hint: check your formula again. And then consider order of operations.

cgeier 187 Junior Poster

Also what database software are you using/accessing?

cgeier 187 Junior Poster

What OS is your computer using? Win7? What are the page file settings for your computer? You're going to probably have to post some of the code--the part that fires when you need to retrieve more rows and the part that retrieves the rows. Also some screen shots of what you are talking about may be useful.

cgeier 187 Junior Poster

Yes.

cgeier 187 Junior Poster

Have you looked at:
File.ReadAllText

and

File.WriteAllText

cgeier 187 Junior Poster

ListView.FocusedItem Property

"...Use the SelectedItems or SelectedIndices properties to obtain the selected items in the ListView control, the FocusedItem property is not necessarily selected..."

cgeier 187 Junior Poster

You didn't attach the XML document.

cgeier 187 Junior Poster

You might get more response if you post in the VB .NET forum.

Use parameterized queries

cgeier 187 Junior Poster

Where did you get the information regarding number of handles from?

cgeier 187 Junior Poster

Here's an online IQ test I found--it's 20 questions. Just something for fun.

And the Breakdown of IQ Scores

cgeier 187 Junior Poster

"People don't care how much you know until they know how much you care." -- Zig Ziglar

cgeier 187 Junior Poster

Sounds like a test question.

cgeier 187 Junior Poster

The information you've supplied is too general. If you want help, I suggest you be more specific. I don't believe that DSN's are used very widely anymore. It is preferrable to use DSNless connections. Additionally, you don't say what operating system you are using or the architecture (32-bit or 64-bit).

Connection Strings

cgeier 187 Junior Poster

@Reverend Jim: What if a last name contains a space?

http://public.wsu.edu/~brians/errors/multipart.html

cgeier 187 Junior Poster

Go to Intel website and search for "slb9u".

SLB9U specs
Looking at "Sockets supported", one sees "LGA775".

Look for motherboards that have "LGA775" processor socket.

Other things that you may need to change include:

-Memory (see what memory motherboard supports)
-Power Supply (check power requirements of motherboard)
-Case (depends on form factor of motherboard--ATX, microATX, etc...)
-Keyboard (depends on motherboard)
-Hard drive (depends on motherboard connections--IDE/EIDE/PATA/SATA/SATA II/SATA III)
-CD/DVD drive (depends on motherboard connections)
-Graphics card (depends if motherboard has onboard graphics)

In order to minimize cost, you may consider looking for a motherboard that works with some of the other hardware that you have.

Resources:
Difference between SATA I, SATA II and SATA III

cgeier 187 Junior Poster

Alternatively, read all text (the entire file). Then use split to split using the line delimiter--storing the result in an array. Then loop through the array as necessary.

cgeier 187 Junior Poster

The following would be a close translation:

Dim fn As String = "C:\MyTextFile.txt"
Dim sr As New StreamReader(fn)
Dim LineFromFile As String = Nothing
Dim textRowNo As Integer = 0
Dim arrival As String = Nothing
Dim status As String = Nothing

'...

While Not sr.EndOfStream
    textRowNo += 1
    LineFromFile = sr.ReadLine()

    If textRowNo > 8 Then
        arrival = Mid(LineFromFile, 1, 9)
        status = Trim(Mid(LineFromFile, 11, 3))

        '...

    End If

End While

sr.close()

Note: The above code is a translation of the code you posted and hasn't been reviewed for efficiency.

Click here for the resource code was translated from.

Santanu.Das commented: Fine work +4
cgeier 187 Junior Poster

Use the recovery disks that came with the computer and then repeat the upgrade.

cgeier 187 Junior Poster

First of all, I'd re-install the OEM drivers from the manufacturer's website. Then you could try the following:

How to Fix Slow USB 3.0 Problems in Windows 8.1

Article references MS Windows USB Core Team Blog which shows some images for the steps described in the article.

To get latest Intel drivers:
Intel Driver Update Utility

cgeier 187 Junior Poster

How are you measuring these speeds?

cgeier 187 Junior Poster

http://msdn.microsoft.com/en-us/library/ms184412(v=vs.110).aspx

Look at naming guidelines

cgeier 187 Junior Poster

You really should put your folder in %ProgramData% (or in one of the other Windows folders designated for user data).

cgeier 187 Junior Poster

Encoding should match the encoding of the file you're using. Using more try-catch blocks (as shown above) will help you to troubleshoot and will cause little to no performance issues since you're using such a small dataset.

Note: '7' and '(' have the same value above. You use the values as the keys for your second dictionary-latinka.