text:
# PIC christmas morning

Status
Not open for further replies.

#### davidbball13

##### Member
Hello because of gramo's new site i really want to get into pic micro controllers. and now that i am PASSING 9th GRADE MATH!!!! . i know its crazy. i have compiled a shopping cart on Newark. this is what i have so far. please tell me if there is any more ideals i should get to get started in the crazy awesome world of PIC's.
shopping cart.

PICkit 2 Microcontroller Programmer
PIC18F452-I/P 8-Bit Microcontroller IC
LCM-S01602DSR/A LCD Dot Matrix Character Module
Ceramic Disc Capacitor; Capacitance:22pF
Crystal; Frequency:8MHz
PIC18F1320-I/P 8-Bit Microcontroller IC

i have a breadboad (actually i have 4)

If there is anything else i should please hit me up. i am waiting for my mom to fork over her credit card

#### blueroomelectronics

##### Well-Known Member
Switch the 18F452 to something with a built in OSC like the 18F4620. You won't need the crystal unless you're building something that needs better than 1% clock accuracy.

#### davidbball13

##### Member
The only reason i choose that PIC is because of the info frim gramo's site and it had all of the examples from it. i dont need to be accurate.

#### blueroomelectronics

##### Well-Known Member
Then get the 18F4620, the 18F1320 is a favorite too both have 8MHz internal osc, I use it on the Junebug. Skip the crystal for now.
Also make sure you've got Swordfish BASIC the free SE version is all you need to get started.

#### davidbball13

##### Member
yeah ill install it soon. and MPlab. but do you think i will need any more parts?

#### blueroomelectronics

##### Well-Known Member
Resistors, LEDs, switches...

#### davidbball13

##### Member
i have plenty of that..... i am very sorry for not buying a junebug.... i am sure i will get one in the future

#### blueroomelectronics

##### Well-Known Member
No problem you'll enjoy your PICkit2 it's a great programming tool and more. Make sure you use 0.1uF caps on your target PICs.

#### davidbball13

##### Member
i can get some stright header leads from a old video card.

#### killivolt

##### Well-Known Member
Keep up the good work !

David, this old man (kv)<-... just did his first hello world today in c.

I'm doing it because of the unix stuff at work I need to become familiar with it. Most of the programs we will be using will have some connections off it.

Good luck, I probably will be getting that setup soon. I just want to get some more of the c/c++ under my belt.

kv

Last edited:

#### futz

##### Active Member
PICkit 2 Microcontroller Programmer
Recommend you also get some 2-row header, 1-row header, a bunch (maybe 10 or so?) of 2x5 IDC female connectors and a bunch of shrouded 2x5 IDC male connectors for making programming cables and breadboard adapters. You'll also need some ribbon cable. For that, rip up an old floppy cable or old style 40-conductor IDE cable.

PIC18F452-I/P 8-Bit Microcontroller IC
Definitely scratch the obsolete 18F452. Get its replacement instead - the updated 18F4520. Same pinout. 18F452 code should mostly work, though there are some minor differences. Here's the 452-to-4520 migration document. Pay attention to the differences listed there to be sure you make any code changes necessary for 18F4520.

#### davidbball13

##### Member
David, this old man (kv)<-... just did his first hello world today in c.

I'm doing it because of the unix stuff at work I need to become familiar with it. Most of the programs we will be using will have some connections off it.

Good luck, I probably will be getting that setup soon. I just want to get some more of the c/c++ under my belt.

kv

yeah i actually ditched ubuntu for a few weeks untill 8.10 comes out soon then ill dual boot. i really like DevC++ in windows though. programing is fun. soon you will be about to do a full on calculator

#### davidbball13

##### Member
Recommend you also get some 2-row header, 1-row header, a bunch (maybe 10 or so?) of 2x5 IDC female connectors and a bunch of shrouded 2x5 IDC male connectors for making programming cables and breadboard adapters. You'll also need some ribbon cable. For that, rip up an old floppy cable or old style 40-conductor IDE cable.

Definitely scratch the obsolete 18F452. Get its replacement instead - the updated 18F4520. Same pinout. 18F452 code should mostly work, though there are some minor differences. Here's the 452-to-4520 migration document. Pay attention to the differences listed there to be sure you make any code changes necessary for 18F4520.

yeah ill hit up the 18F4520.

#### davidbball13

##### Member
any other words of advice. i dont think i am going to get the headers. i have the stright header leads from an old video card and i am sure i can do a lot with a old IDE cable.

#### davidbball13

##### Member
David, this old man (kv)<-... just did his first hello world today in c.

I'm doing it because of the unix stuff at work I need to become familiar with it. Most of the programs we will be using will have some connections off it.

Good luck, I probably will be getting that setup soon. I just want to get some more of the c/c++ under my belt.

kv

What compiler did you use. and what text editer. i use/used NANO. just type nano in the terminal. and i used the g++ compiler. what distro are you using. you said unix so you could even be using mac os.

#### philba

##### New Member
Having the µC is great but it's more fun if you can do interesting things like flashing LEDs and such.

I would get

• LEDs
• NPN & PNP transistors
• switches (SBB mountable)
• ceramic capacitors (.1 µF, .01µF to start with)
• a couple of linear regulators (7805s) for a power supply
• electrolytic caps - 100 uF, maybe 470 uF, 12V or greater for you power supply
• a 9V or higher wall wart (couple of $$from a thrift store) If you can get your parents to pay for an order from some place like electronic goldmine, all electronics or bg micro you can really stretch your$$s. The surplus places are a great way to find bargains though you have to be careful. Plus, it's a lot of fun to peruse through their online catalogs.

Check out mouser.com - they have pretty good prices on PICs.

By the way, real programmers use Vi or Emacs...

Last edited:

#### killivolt

##### Well-Known Member
What compiler did you use. and what text editer. i use/used NANO. just type nano in the terminal. and i used the g++ compiler. what distro are you using. you said unix so you could even be using mac os.

I haven't even came close to what your thinking. I'm still on baby steps right now. Just using notepad. (Caveman style) I'm cracking some rocks to see what happens.

The Compiler is GJGPP. I found it off the Howstuffworks website. However, now that you mention it. I see the connection between the Unix stuff and the Mac. Thanks for the Tip.

We have Mac Servers and that makes sense.

I know I'm simplistic but I do what is free. Just like your idea on the video card. Carnivores seem to find what they need to survive.

Good job on the intuition and continue making use of available assets.

kv

#### davidbball13

##### Member
Having the µC is great but it's more fun if you can do interesting things like flashing LEDs and such.

I would get

• LEDs
• NPN & PNP transistors
• switches (SBB mountable)
• ceramic capacitors (.1 µF, .01µF to start with)
• a couple of linear regulators (7805s) for a power supply
• electrolytic caps - 100 uF, maybe 470 uF, 12V or greater for you power supply
• a 9V or higher wall wart (couple of $$from a thrift store) If you can get your parents to pay for an order from some place like electronic goldmine, all electronics or bg micro you can really stretch your$$s. The surplus places are a great way to find bargains though you have to be careful. Plus, it's a lot of fun to peruse through their online catalogs.

Check out mouser.com - they have pretty good prices on PICs.

By the way, real programmers use Vi or Emacs...

i have like all of the things you have mentioned. actually i bought a regulated adjustable power supply from a local electronics store called trojan electronics. power options are 3 volts 4 volts 5 volts and 6 volts and 9 volts and 12 volts. its 2 amps. emacs and nano are about the same. iv used both. from what iv seem mouser and newark have about the same prices some are from 2 to 10 cents difference.

#### davidbball13

##### Member
I haven't even came close to what your thinking. I'm still on baby steps right now. Just using notepad. (Caveman style) I'm cracking some rocks to see what happens.

The Compiler is GJGPP. I found it off the Howstuffworks website. However, now that you mention it. I see the connection between the Unix stuff and the Mac. Thanks for the Tip.

We have Mac Servers and that makes sense.

I know I'm simplistic but I do what is free. Just like your idea on the video card. Carnivores seem to find what they need to survive.

Good job on the intuition and continue making use of available assets.

kv

yeah check out youtube i know it sounds juvenile but there are a lot of great C/C++ tut.

Status
Not open for further replies.

Replies
28
Views
13K
Replies
4
Views
985
Replies
4
Views
960
Replies
230
Views
13K
Replies
7
Views
822


text:
# zbMATH — the first resource for mathematics

Asymptotics for the wave equation on differential forms on Kerr-de Sitter space. (English) Zbl 1401.53057
Authors’ abstract: We study asymptotics for solutions of Maxwell’s equations, in fact, of the Hodge-de Rham equation $$(d+\delta)u = 0$$ without restriction on the form degree, on a geometric class of stationary spacetimes with a warped product type structure (without any symmetry assumptions), which, in particular, include Schwarzschild-de Sitter spaces of all spacetime dimensions $$n \geq 4$$. We prove that solutions decay exponentially to $$0$$ or to stationary states in every form degree, and give an interpretation of the stationary states in terms of cohomological information of the spacetime. We also study the wave equation on differential forms and, in particular, prove analogous results on Schwarzschild-de Sitter spacetimes. We demonstrate the stability of our analysis and deduce asymptotics and decay for solutions of Maxwell’s equations, the Hodge-de Rham equation and the wave equation on differential forms on Kerr-de Sitter spacetimes with small angular momentum.

##### MSC:
 53C50 Global differential geometry of Lorentz manifolds, manifolds with indefinite metrics 35Q61 Maxwell equations 83C22 Einstein-Maxwell equations 58A14 Hodge theory in global analysis
Full Text:

format: plain


text:
# Homework Help: Set problem

1. Aug 25, 2005

### mattmns

Give an example to show that $$A\in B$$ and $$B \in C$$ does not imply that $$A \in C$$

Maybe I am misunderstanding the problem, but it seems as though there may be an infinite amount of solutions. For example: A = {1}, B = {2, {1}}, C = {5, {2, {1}}}

Is that correct?

2. Aug 25, 2005

### lightgrav

Yes, they only wanted AN example.

You could try giving two of `em, or maybe a "rule".
How many different KINDS of rules can you come up with?

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Similar Threads for problem Date
Uniform rod pivoting and block/mass energy problem Yesterday at 12:42 PM
Biot-Savart Problem Tuesday at 1:25 PM
Direction of magnetic field problem (Right Hand Rule) Tuesday at 12:07 PM
Specific Heat problem Monday at 3:12 PM
Atomic Structure problem regarding interatomic spacing Sunday at 6:48 PM


text:
# zbMATH — the first resource for mathematics

## Yilmaz, Nazmiye

Compute Distance To:
 Author ID: yilmaz.nazmiye Published as: Yilmaz, N.; Yilmaz, Nazmiye; Yılmaz, Nazmiye
 Documents Indexed: 11 Publications since 2012

#### Co-Authors

 1 single-authored 10 Taşkara, Necati 5 Yazlik, Yasin 1 Uslu, Kemal
all top 5

#### Serials

 3 Selçuk Journal of Applied Mathematics 2 Advances in Applied Clifford Algebras 1 Abstract and Applied Analysis 1 Journal of Applied Mathematics 1 Mediterranean Journal of Mathematics 1 Contributions to Discrete Mathematics 1 TWMS Journal of Applied and Engineering Mathematics 1 Konuralp Journal of Mathematics

#### Fields

 11 Number theory (11-XX) 2 Linear and multilinear algebra; matrix theory (15-XX)

#### Citations contained in zbMATH

7 Publications have been cited 12 times in 9 Documents Cited by Year
Matrix sequences in terms of Padovan and Perrin numbers. Zbl 1397.15038
2013
On the bi-periodic Lucas octonions. Zbl 1417.11014
Yilmaz, Nazmiye; Yazlik, Yasin; Taskara, Necati
2017
Incomplete Tribonacci-Lucas numbers and polynomials. Zbl 1366.11037
2015
Binomial transforms of the Padovan and Perrin matrix sequences. Zbl 1294.11012
2013
On the properties of iterated binomial transforms for the Padovan and Perrin matrix sequences. Zbl 1367.11027
2016
On the $$k$$-generalized Fibonacci numbers. Zbl 1281.11017
Yılmaz, Nazmiye; Yazlık, Yasin; Taşkara, Necati
2012
On the sums of powers of $$k$$-Fibonacci and $$k$$-Lucas sequences. Zbl 1290.11031
Yazlik, Yasin; Yilmaz, Nazmiye; Taskara, Necati
2012
On the bi-periodic Lucas octonions. Zbl 1417.11014
Yilmaz, Nazmiye; Yazlik, Yasin; Taskara, Necati
2017
On the properties of iterated binomial transforms for the Padovan and Perrin matrix sequences. Zbl 1367.11027
2016
Incomplete Tribonacci-Lucas numbers and polynomials. Zbl 1366.11037
2015
Matrix sequences in terms of Padovan and Perrin numbers. Zbl 1397.15038
2013
Binomial transforms of the Padovan and Perrin matrix sequences. Zbl 1294.11012
2013
On the $$k$$-generalized Fibonacci numbers. Zbl 1281.11017
Yılmaz, Nazmiye; Yazlık, Yasin; Taşkara, Necati
2012
On the sums of powers of $$k$$-Fibonacci and $$k$$-Lucas sequences. Zbl 1290.11031
Yazlik, Yasin; Yilmaz, Nazmiye; Taskara, Necati
2012
all top 5

#### Cited by 14 Authors

 3 Taşkara, Necati 3 Yilmaz, Nazmiye 1 Arolkar, Suchita 1 Borges, Anabela 1 Catarino, Paula M. M. C. 1 da Graça Neto, Almir Cunha 1 da Silva, Robson 1 de Oliveira, Kelvin Souza 1 Flaut, Cristina 1 Kartal, Meral Yaşar 1 Khomovsky, Dmitry I. 1 Savin, Diana 1 Valaulikar, Yeshwant Shivrai 1 Yazlik, Yasin
all top 5

#### Cited in 8 Serials

 2 Integers 1 Chaos, Solitons and Fractals 1 Advances in Applied Clifford Algebras 1 Abstract and Applied Analysis 1 Journal of Integer Sequences 1 Mediterranean Journal of Mathematics 1 Asian-European Journal of Mathematics 1 $$p$$-Adic Numbers, Ultrametric Analysis, and Applications

#### Cited in 4 Fields

 9 Number theory (11-XX) 1 Combinatorics (05-XX) 1 Linear and multilinear algebra; matrix theory (15-XX) 1 Information and communication theory, circuits (94-XX)


text:
MathSciNet bibliographic data MR1937847 (2004h:03094) 03D45 (03C57) McCoy, Charles F. D. \$\Delta\sp 0\sb 2\$$\Delta\sp 0\sb 2$-categoricity in Boolean algebras and linear orderings. Ann. Pure Appl. Logic 119 (2003), no. 1-3, 85–120. Article

For users without a MathSciNet license , Relay Station allows linking from MR numbers in online mathematical literature directly to electronic journals and original articles. Subscribers receive the added value of full MathSciNet reviews.


text:
# semi complex integration

• Sep 28th 2008, 02:44 PM
armoni
semi complex integration
Hey, after taking a one year break of math (bad idea!) got this hw assignment that involves finding the integral of
(3)
l SQRT(4x^2 + 4 + (1/(x^2))) (the integral from one to three,
(1)T , the antiderivative would be perfect, and if you could walk me through the steps? Don't have my old calc book and havent been able to find it online. Thank you very much)
• Sep 28th 2008, 02:59 PM
galactus
I assume this is what you mean:

$\int\sqrt{4x^{2}+4+\frac{1}{x^{2}}}dx$

If so, it can be rewritten without the radical as:

$\int\sqrt{\frac{(2x^{2}+1)^{2}}{x^{2}}}dx=\int\fra c{2x^{2}+1}{x}dx=2\int xdx+\int\frac{1}{x}dx$

Now, you have two very easy integrals. Just integrate and use your limits of integration.
• Sep 28th 2008, 03:01 PM
armoni
thank you very much!


text:
+0

# Help..

0
228
1

The points (3,-2)  and (-2,3) lie on a circle whose center is on the x-axis. What is the radius of the circle?

THANK U

Jul 4, 2019

#1
+8852
+5

Let the center of the circle be  (h, 0)

distance between  (h, 0)  and  (3, -2)   =   distance between (h, 0)  and  (-2, 3)

$$\begin{array}{r} \sqrt{(-2-0)^2+(3-h)^2}&\ =&\ \sqrt{(-2-h)^2+(3-0)^2}\\~\\ (-2-0)^2+(3-h)^2&=&(-2-h)^2+(3-0)^2\\~\\ (-2-0)^2-(3-0)^2&=&(-2-h)^2-(3-h)^2 \end{array}$$

Notice here that if  h = 0  both sides of the equation are identical.

If you want to, you can expand both sides to also find that  h = 0.

So the center of the circle is  (0, 0)

And the radius  =  $$\sqrt{(-2-0)^2+(3-0)^2}\ =\ \sqrt{4+9}\ =\ \sqrt{13}$$

Here's a graph: https://www.desmos.com/calculator/najnuubd4e

Jul 4, 2019

#1
+8852
+5

Let the center of the circle be  (h, 0)

distance between  (h, 0)  and  (3, -2)   =   distance between (h, 0)  and  (-2, 3)

$$\begin{array}{r} \sqrt{(-2-0)^2+(3-h)^2}&\ =&\ \sqrt{(-2-h)^2+(3-0)^2}\\~\\ (-2-0)^2+(3-h)^2&=&(-2-h)^2+(3-0)^2\\~\\ (-2-0)^2-(3-0)^2&=&(-2-h)^2-(3-h)^2 \end{array}$$

Notice here that if  h = 0  both sides of the equation are identical.

If you want to, you can expand both sides to also find that  h = 0.

So the center of the circle is  (0, 0)

And the radius  =  $$\sqrt{(-2-0)^2+(3-0)^2}\ =\ \sqrt{4+9}\ =\ \sqrt{13}$$

Here's a graph: https://www.desmos.com/calculator/najnuubd4e

hectictar Jul 4, 2019


text:
# Answer Key For Triangular Prism Surface Area

answer key for triangular prism surface area

Answer key Surface Area of Triangular Prisms area Of prism. Author: Stout, Dave Created Date: 4/23/2020 8:47:44 AM

Surface Area of a Triangular Prism

Answer : B Explanation. Step 1: Area of triangle base A = $\sqrt{s\left ( s-a \right )\left ( s-b \right )\left ( s-c \right )}$ = $\sqrt{9.8\left ( 9.8-3 \right )\left ( 9.8 -9\right )\left ( 9.8-7.6 \right ) }$ = 10.83 sq in; height of prism h = 4.9 in. Step 2: Surface area of triangular prism = 2A + (a+b+c)h

Triangular Prism Surface Area Answers - Kiddy Math

A triangular prism is a three-sided prism with three faces joining corresponding sides. The formula for its surface area is SA = wh + lw + lh + ls, where l=length, h=height, w=width and s=side.

Surface area for a triangular prism - Answers

Surface Area of Triangular Prisms | Decimals Plug the decimal dimensions in SA = bh + (s1 + s2 + s3)H, where ‘b’ and ‘h’ are the base length and height of the triangle; ‘s1’, ‘s2’, and ‘s3’ are the lengths of three sides of the triangle; ‘H’ the prism's height, and find the surface area.

Surface area of Prisms (solutions, examples, worksheets ...

Welcome to the Surface Areas section at Tutorialspoint.com.On this page, you will find worksheets on nets of solids, surface area of a cube or a rectangular prism, surface area of a rectangular prism made of unit cubes, distinguishing between surface area and volume, using a net to find the surface area of a rectangular prism, word problem involving the surface area of a rectangular prism ...

cpb-us-e1.wpmucdn.com

Worksheets for finding the area of a triangular prism. Use the formula to complete the exercises on these worksheets. Common core grade 8 math worksheets for geometry. What is the surface area of these triangular prisms? Answers are on the second page of the worksheet.

Lesson 4 Surface Area Of Triangular Prisms Worksheets ...

11 2 Surface areas Of Prisms and Cylinders Worksheet Answers Along with Grade 10 Foundations Of Applied and Precalculus Volume and Su. Both surfaces have surfaces that are aligned with different number of degrees. This number of numbers helps them to perform different functions. It is very important to consider the surface areas of the prism ...

Surface Area of Triangular Prisms - Saylor Academy

6th Grade Surface Area Of Triangular Prism. Displaying all worksheets related to - 6th Grade Surface Area Of Triangular Prism. Worksheets are Surface areas of prisms, Grade 6 geometry work, Grade 6 geometry work, Volume and surface area work, Surface area, Eureka lessons for 6th grade unit six nets surface, Volume of triangular prism es1, Surface area of solids.

Quiz & Worksheet - Surface Area of a Triangular Prism ...

S2=Side 2 of triangle. S3=Side 3 of triangle. H=Prism height. Example: A prism have right triangle base. The triangle sides are as following: (3 m, 4 m, 5 m) The prism height is 10 m. Find the surface area of the prism. Answer: Triangle base=3 m. Triangle height=4 m. Prism height=10 m. Perimeter=(3+4+5)m=12 m. Surface area=bh + (S1+ S2 + S3)H ...

Surface Area of Prism and Pyramid Worksheet

On this page you can read or download 14 2 practice surface areas of prisms and cylinders answer key in PDF format. If you don't see any interesting for you, use our search form on bottom ↓ .

Finding The Surface Area Of A Triangular Prism Worksheets ...

Rectangular Prism Triangular Prism The surface area of a prism is the sum of the areas of all its faces. A two-dimensional representation of a solid is called a net. Lateral Face Base English Spanish. Section 6.2 Surface Areas of Prisms 257 Work with a partner. Find the surface area of the solid shown by the net. Copy the net, cut it out, and fold it to form a solid. Identify the solid. 4 5 3 ...

Surface Area of Rectangular Prisms Worksheets

So the total surface area of this triangular prism is 144 cm² . What Is the Perimeter of a Shape? The perimeter is the total distance around a two-dimensional shape. For example, a triangle whose sides are all 3 inches long has a perimeter of 9 inches (3 + 3 + 3, or 3 x 3). Using a Formula to Find the Surface Area. Now that we've covered the basics, it's time to introduce a less tedious ...

NAME DATE PERIOD Lesson 6 Skills Practice

Volume And Surface Area Of Triangular Prisms A. Welcome To The Volume And Surface Area Of Triangular Prisms A Math Worksheet From The Measurement Worksheets Page At Math Drills This Math Worksheet Was Created On 03 03 And Has Been Viewed 164 Times This Week And 448 Times This Month. Surface Area Of Triangular Prisms Teaching Resources

Quiz & Worksheet - Prisms | Study.com

3.4 + 54 = surface area 57.4 = surface area of the triangular prism Answer Key: Once you have completed the problems, check your answers here. 2 m9 m1.7 m 2 m 2 m Triangle Faces ½ b x h = area ½(2) x 1.7 = area 1 X 1.7 = area 1.7 = area of one triangle 1.7 x 2 = area of two triangles 3.4 = area of two triangles Rectangle Faces

Surface Area Worksheets

The Results for Triangular Prism Surface Area Worksheet. Free Worksheet. Atomic Structure Worksheet Answers

Total Surface Area of Prisms Maze by Amazing Mathematics | TpT

KEY Directions: 1. Cut out the net. 2. Record the area of each surface. Write the answers on each face. 3. Add the areas to find the total surface area of the 3-dimensional figure. 4. Record the total surface area of the triangular prism. 5. Answer the questions at the bottom of this page. 6. Cut along the dashed line, and be ready to turn in ...

Measurement Worksheet -- Volume and Surface Area of ...

Answers worked out for practice on surface area of rectangular prisms. Practice is matching 3-dimensional figures to their nets and calculations of their surface area.

Triangular Prism Surface Area Worksheet | Mychaume.com ...

What is the total surface area of the triangular prism shown? answer choices . 468 in 2. 540 in 2. 576 in 2. 700 in 2. Tags: Question 3 . SURVEY . 900 seconds . Q. Find the lateral surface area of the figure. answer choices . 96 ft 2. 192 ft 2. 84 ft 2. 108 ft 2. Tags: Question 4 . SURVEY . 900 seconds . Q. The base of the equilateral triangle is 5 inches. The length of the rectangle is 15 ...

SURFACE AREA AND VOLUME NOTES PACKET

Triangular Prisms . Find the surface area or the volume for each of the triangular prisms. Each worksheet has answers on the second page. These area and volume worksheets are common core standards for geometry for middle school grades.

(05.06)Use a net to find the surface area of the right ...

Students will be able to calculate the surface area of triangular and rectangular prisms, and apply this knowledge to real world situations. Big Idea Using data to immediately regroup, students are able to work on surface area of prisms at their own level – small group instruction, fluency practice, or applications of surface area.

LESSON 10.4 NOTES DAY 2 Surface Area of Any Prism

Triangular Prism Home . Triangular Prism Net . Triangular Prism Surface Area . Triangular Prism Volume. Triangular prism surface area is the sum of areas of its five faces. There is no need to be panic, and if kids know how to find the area of a rectangle and the area of a triangle, then they can easily find the surface area of a triangular prism.. The need is to know how to make the net of a ...

Volume of Triangular Prisms | Volume worksheets, Volume ...

Improve your math knowledge with free questions in "Volume of triangular prisms" and thousands of other math skills.

Surface Area and Volume of a Rectangular Prism Grade 7 Nelson Chapter 11 02:18:12

Area= ½ x b x h can now be used for surface area of a triangular prism . Area=bh+2ls+lb. Where b= base of triangle. h= height of triangle. l= length of prism. s=side of triangle. Discuss when finding the volume of an object or surface area may be necessary, such as painting a room, mailing a package, or liquid containers, material for a tent ...

Surface Area of a Triangular Prism Calculator

Answer: Surface area = bh/2 + (S1+ S2 + S3)H in general surface area of a prism is 2 × area of base + perimeter of base × H So in particular, for the triangular prism, we have the answer above.

MFM 2P1 Surface Area OfPrisms And Cylinders

Key Concepts: Terms in this set (12) ... What is the surface area of a rectangular prism with a length of 8.4, a width of 3.3 and a height of 6.1. 160. What is the volume of a rectangular prism with a length of 10, width of 8 and height of 2? YOU MIGHT ALSO LIKE... Volume of triangular prisms. 13 terms. cgaffer. Equations for Surface Area and Volume of… 24 terms. macydo TEACHER. Volume of ...

#### Answer Key For Triangular Prism Surface Area

The most popular ebook you must read is Answer Key For Triangular Prism Surface Area. I am sure you will love the Answer Key For Triangular Prism Surface Area. You can download it to your laptop through easy steps.


text:
Projection operator in Hilbert spaces

Let T be a bounded operator on the Hilbert space H with the property that $T^*(T-I)= 0$. Show that T is an orthogonal projection.

Im not really sure how to show that an operator is an orthogonal projection? If $A:X\rightarrow U$ is an projection onto a closed subspace of X, then $<x- Ax, u_i > = 0, \;\; \forall u_i \in U?$

Expanding we get $T'T = T' \Longleftrightarrow TT' = T\ (T'' = T$in hilbert spaces?) $$Tx = T'(Tx) \Longleftrightarrow y = T'y$$ Hence $T'$ has $\lambda = 1$ after $Tx$, does T' and T has the same eigenvalues? There are a lot of question marks here. Thanks for the help!

-

Your equation is $T^*T=T^*$. The key observation here is that $(T^*T)^*=T^*T$. Then $$T=(T^*)^*=(T^*T)^*=T^*T=T^*.$$ so $T$ is selfadjoint, and moreover now your original equation reads $T^2=T$, so $T$ is an orthogonal projection.

-

Here is one way to see this. We have

$T^*T - T^* = T^*(T-I) = 0 = (T^*(T-I))^* = (T^*-I)T = T^* T - T$

hence cancelling the $T^*T$ you get that $T$ is self-adjoint, in particular normal, and so you may appeal to the spectral theorem, which in this case tells you that the fuction $\bar{x}(x-1) = 0$ on the spectrum of $T$.

We want to show that $\sigma(T) \subset \{0,1\}$ for $T$ to be a projection.

Now we have $\bar{x}(x-1) = |x|^2 - \bar{x} = 0$ i.e., since $|x|^2$ is real that for all $x \in \sigma(T)$ you have $x = |x|^2$.

This can happen only if $x = 0$ or $x = 1$ as we wanted.

EDIT: Marc van Leeuwen pointed out nicely that after the first line we actually already have $T^* = T$ and using this $T^2 = T$ as well, hence the claim.

-
After the first display, could you not just say that because of $T^*=T$ it becomes $T^2=T$, so $T$ is a projection, and being self-adjoint an orthogonal projection? In any case any linear operator satisfying $T^2=T$ is diagonalizable with $\sigma(T)\subseteq\{0,1\}$. –  Marc van Leeuwen Dec 8 '12 at 10:33
for the first part, you are definitely right. In the second statement, why does an operator with $T^2 = T$ have spectrum contained in $\{0,1\}$? –  mland Dec 8 '12 at 10:52
If $T^2=T$ then every vector $v$ can be written as a sum $v=\frac12(v-T(v))+\frac12(v+T(v))$ of an eigenvector (if nonzero) with eigenvalue $0$ and an eigenvector (if nonzero) with eigenvalue $1$, so the eigenspaces of $T$ for $\lambda=0$ and for $\lambda=1$ span the whole space, whence my claim. –  Marc van Leeuwen Dec 8 '12 at 11:05
Yes. Obviously I think more in terms of the spectral theorem, which is absolutely not necessary here. Thanks for pointing this out. –  mland Dec 8 '12 at 11:24
@mland: $\sigma(T^2-T)=\{\lambda^2-\lambda:\ \lambda\in\sigma(T)\}$. –  Martin Argerami Dec 8 '12 at 11:54


text:
PoS(CKM2016)021

Experimental overview on $D_{(s)}$ purely leptonic decays

H. Ma

Contribution: pdf

Abstract

Up to now, much progress in the studies of the purely leptonic decays $D^+_{(s)}\to \ell^+\nu_\ell$ ($\ell=e$, $\mu$ or $\tau$) has been
reached in various experiments. This proceeding overviews the experimental studies of $D^+_{(s)}\to \ell^+\nu_\ell$ at the CLEO-c, Belle, BaBar and BESIII experiments in recent ten years.


text:
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This semester I started teaching introduction to statistics and data analysis with R, at Tel-Aviv university.

I put in a lot of efforts into bringing practical challenges, examples from real life, and a lot of demonstrations of statistical theory with R. This post is an example for how I’ve been using R code (and specifically Shiny apps) to demonstrate statistical theory, concepts and provide intuition.

## What’s the difference between confidence and prediction intervals?

Last week I taught multiple linear regression, and I noticed that students have a hard time comprehending the difference between confidence intervals and prediction intervals. The former being an interval for the model (i.e., interval for the underlying model), and the latter being an interval for a noval observation.

As the sample size increases, our uncertainty of the model’s parameters decreases, but the uncertainty in the value of a new observation, $$y_0$$ is associated with variance of $$Y$$ (the random variable from which $$y_0$$ is drawn). Hence, it has a lower bound, based on that variance.

In R, you can get a prediction or a confidence interval by using either

predict(object, newdata, interval = "prediction")

Or

predict(object, newdata, interval = "confidence")

For a prediction or for a confidence interval, respectively.

To help me illustrate the differences between the two, I decided to build a small Shiny web app. It shows the differences between confidence intervals, prediction intervals, the regression fit, and the actual (original) model.

The app is available here, and the source code is available on github.

With this app you can choose three types of models to demonstrate. Simple linear regression, and regression with a twist ($$\log$$ transformation on the $$y$$ or $$\sin$$ transformation on the $$x$$:

• Linear model $$y = a + bx + \epsilon$$

• Log-linear model $$\log(y)=a+bx+\epsilon$$

• Sine $$y = a + b\sin(x) + \epsilon$$

All the models are based on simple linear regression (lm function), for the latter two models with either a log or sin transformation.

The app allows you to play around with various values such as the $$x$$ range, the model’s parameters ($$a$$ and $$b$$), the error’s standard deviation ($$\epsilon$$), and show or hide any of the following elements, on the chart:

• The original function (i.e., the original model)

• The sampled points

• The confidence interval

• The prediction interval

• The model’s fit

Feel free to share the app or the app’s code. As mentioned above, the source code for the app is available here: https://github.com/adisarid/prediction_confidence_intervals_demo.

Here’s an example for what the app’s generating code and output looks like, for a model of the type $$\log(y) = 1 + \frac{x}{2} + \epsilon$$:

library(dplyr)
library(tidyr)
library(tibble)
library(ggplot2)

sample_size <- 90
x_range <- c(0, 1.5)
a <- 1
b <- 1.5
sigma <- 0.3

actual_function <- tibble(x = seq(x_range[1], x_range[2], by = 0.01)) %>%
mutate(actual_y = exp(a + b*x))

random_sample <- tibble(epsilon_err = rnorm(n = sample_size,
mean = 0,
sd = sigma),
x = runif(n = sample_size,
min = x_range[1],
max = x_range[2])) %>%
mutate(sampled_y = exp(a + b*x + epsilon_err))

linear_model <- lm(formula = log(sampled_y) ~ x, data = random_sample)

prediction_i <- predict(object = linear_model,
newdata = actual_function,
interval = "prediction") %>%
as_tibble() %>%
rename_at(vars(lwr,upr), ~paste0(., "_pi")) %>%
mutate_all(exp)

confidence_i <- predict(object = linear_model,
newdata = actual_function,
interval = "confidence") %>%
as_tibble() %>%
rename_at(vars(lwr,upr), ~paste0(., "_ci")) %>%
select(-fit) %>%
mutate_all(exp)

intervals <- actual_function %>%
bind_cols(prediction_i,
confidence_i)

ggplot() +
geom_line(data = actual_function, aes(x, actual_y, color = "Original Model"), size = 1) +
geom_point(data = random_sample, aes(x, sampled_y), alpha = 0.5) +
geom_line(data = intervals,
aes(x, fit, color = "Regression Fit"), size = 1) +
geom_line(data = intervals,
aes(x, lwr_pi, color = "Prediction Interval"),
linetype = 2, size = 1) +
geom_line(data = intervals,
aes(x, upr_pi, color = "Prediction Interval"),
linetype = 2, size = 1) +
geom_line(data = intervals,
aes(x, lwr_ci, color = "Confidence Interval"),
linetype = 2, size = 1) +
geom_line(data = intervals,
aes(x, upr_ci, color = "Confidence Interval"),
linetype = 2, size = 1) +
theme_bw() +
xlab("x") +
ylab("y") +
ggtitle("Log-linear: Model, Fit, Confidence and Prediction Intervals")

## Conclusions

Shiny apps are a great way to illustrate theoretical concepts, to provide intuition, and to let students experiment with parameters and see the outcomes. In this post I demonstrated how a Shiny app can be used to explain the concepts of a regression fit, confidence, and prediction intervals.

If you used Shiny for interesting educational demonstrations I’d love to hear about it! feel free to share in the comments or message me on twitter @SaridResearch.


text:
• 论文与研究报告 •

### 气象因子对长角血蜱寻觅活动的影响

1. 1. 北京林业大学自然保护区学院 北京 100083
2. 北京市林业保护站 北京 100029
3. 河北小五台山国家级自然保护区管理局 张家口 075700
4. 首都机场海关 北京 101300
• 收稿日期:2018-12-29 出版日期:2020-06-25 发布日期:2020-07-17
• 通讯作者: 李凯
• 基金资助:
北京市林业保护站项目

### Influence of Weather Factors on Questing Activity of Haemaphysalis longicornis

Xufei Liu1,Zaibao Zhou2,Wei Wang3,Jianxu Zheng3,Wanhong Wei4,Kai Li1,*

1. 1. College of Nature Conservation, Beijing Forestry University Beijing 100083
2. Beijing Forestry Protection Station Beijing 100029
3. Management Bureau of Hebei Xiaowutaishan National Nature Reserve Zhangjiakou 075700
4. Capital Airport Customs Beijing 101300
• Received:2018-12-29 Online:2020-06-25 Published:2020-07-17
• Contact: Kai Li

Abstract:

Objective: In this paper, we studied the population dynamics of the dominant hard tick (Haemaphysalis longicornis) in the forest environment in the western mountainous areas of Beijing, and investigated the influence of the weather factors on questing activity of H. longicornis, in order to protect tourists and forest workers from their bites. Method: Three experimental sites in the western mountainous scenic area of Beijing were selected, and the tick population in the sites was sampled every two weeks from 2017 to 2018, and the dragging method was used to investigate tick population for 3 hours in each site. During investigation, 9 weather factor data, such as temperature, relative humidity, dew-point temperature and solar radiation, were collected by hygrothermograph and automatic weather station. The principal component analysis, T-test and Pearson correlation coefficient were used to analyze the difference in the number of ticks between different sites and the effects of weather factors on questing activity of H. longicornis. Result: The results showed that:1) The annual population dynamics of the H. longicornis presented a bimodal pattern with the peaks occurred in May and September, respectively, and the number of peaks in May was 13.9 times of that in September. 2) There was a difference in the number of ticks among different sites. The average number of ticks collected in Tangjiachang, where animal husbandry was the main activity, was significantly greater than that collected in Donggou (t=-3.38, P < 0.01) with a small amount of agricultural activity, and also significantly greater than that collected in Beigou (t=-3.00, P < 0.01) with fewer human activity. However there was no difference in the number of ticks between Donggou and Beigou (t=-0.77, P>0.05). 3) The solar radiation, saturation difference and evaporation were positively correlated with questing activity of H. longicornis, while relative humidity, leaf-litter layer relative humidity and the dew-point temperature were negatively correlated to questing activity of H. longicorni. 4) Principal component analysis method was used to reduce the dimension of 9 weather factors, and 2 principal components were extracted, and their cumulative contribution rate was 78.32%. The first principal component was defined as the temperature factor, with the maximum contribution of sampling temperature, saturation difference, solar radiation and evaporation, reaching 42.39%; the second principal component was defined as the humidity factor, which contributed the most to the relative humidity, the leaf-litter layer relative humidity and the dew-point temperature, with 35.93%. Conclusion: The adult ticks of H. longicornis have two peak periods in spring and autumn, especially in spring when ticks are more active in warm and dry weather and its population is higher than that in autumn. The coupling of the two attributes makes spring a high incidence of invasion and bites of H. longicornis in northern China. In the livestock area, due to the large number of hosts, the population of H. longicornis significantly increases and therefore, the supervision of tick-borne diseases should be strengthened in the above-mentioned region and weather conditions, especially in spring.


text:
# Systems of linear equations (need help)

1. Mar 26, 2007

### pkitten2007

Ok i have a problem that i just cant solve.

It says: sam has collected fifty baseball cards. The Major league baseball cards are worth $3.50 and the minor leagure baseball cards are worth$2.00 each. sam`s collection is worth $122.50 Q: Write a system of equations that can be used to determine the number of each type of card sam has . Can anybody help me solve this problem? Last edited by a moderator: Mar 26, 2007 2. Mar 26, 2007 ### berkeman ### Staff: Mentor I moved this question from the Tutorials section to the appropriate Homework Help forum, and removed some font formatting that made it very difficult to read. pkitten2007, please be sure to post your homework and coursework problems in the appropriate Homework Help forum, and not in the general forums (and not in Tutorials). Please show us your work so far -- we do not provide answers here on the PF. But we are very willing to provide tutorial help if you show us your work so far. Also, please do not post in exotic bold fonts -- they make the posts difficult to read and deal with. 3. Mar 26, 2007 ### Feldoh What have you all ready tried doing to solve the problem? 4. Mar 28, 2007 ### Prim3 You have to show your work :). If somebody sees that you've at least tried to attempt it, they will surely help you. I can too, but need show you've attempted it at least. :) 5. Mar 29, 2007 ### symbolipoint Assign variables for number of major league cards and number of minor league baseball cards. Now write the equations. 6. Mar 29, 2007 ### VietDao29 Uhm... i think I can give you some hints, so that you know where to start your problem. If you call x to be the number of Major league baseball cards he has, and let y be his Minor league baseball ones. So x + y = ? (what's the number of cards he has totally?) How much are all his Major cards worth, if one costs$3.50 each?
How much are all his Minor cards worth, if one costs \$2.00 each?
How much are all his cards worth in terms of x, and y?
Can you go from here? :)


text:
# Math Help - Set y = 0?

1. ## Set y = 0?

The question first tells me to graph the function to determine any x-intercepts.
y = 20(2/X+1 - 3/x)
When I put it in my calculator, I got x-intercept = (1,0)
Now it tells me to set y = 0 to confirm this result.
So,
0 = 20(2/X+1 - 3/x)
I started working in the brackets:
(2x)/(x)(x + 1) - (3x+1)/(x)(x+1)
(-x+1) / (x)(x+1)
Is this right?
If so, what do I do next? What do I do with the 20?

2. Originally Posted by tsmith
The question first tells me to graph the function to determine any x-intercepts.
y = 20(2/X+1 - 3/x)
When I put it in my calculator, I got x-intercept = (1,0)
Now it tells me to set y = 0 to confirm this result.
So,
0 = 20(2/X+1 - 3/x)
I started working in the brackets:
(2x)/(x)(x + 1) - (3x+1)/(x)(x+1)
(-x+1) / (x)(x+1)
Is this right?
If so, what do I do next? What do I do with the 20?
$\frac{2x}{x(x+1)} - \frac{3x+1}{x(x+1)} \neq \frac{2}{x+1} - \frac{3}{x} = \frac{2x}{x(x+1)} - \frac{3(x+1)}{x(x+1)}$ $= \frac{2x - 3(x+1)}{x(x+1)} = \frac{-x-3}{x(x+1)}$

Can you solve $\frac{-3-x}{x(x+1)} = 0$ ?

3. -3/(x+1)?

4. Originally Posted by tsmith
-3/(x+1)?
$x = -3$

Take tsmith's final working:

$
\frac{-3-x}{x(x+1)} = 0
$

Multiply both sides by $x(x+1)$

$-3-x = 0$

Can you see $x = -3$ now?


text: Measurement of $$K_S^0$$KS0 and $$\Lambda ^0$$Λ0 production in $$t \bar{t}$$tt¯ dileptonic events in pp collisions at $$\sqrt{s} =$$s= 7 TeV with the ATLAS detector


text:
# Thread: convert .txt file in .csv format

1. Member
Join Date
Mar 2010
Posts
16
Rep Power
0

## convert .txt file in .csv format

Dear all,

I hope you are doing good.
I am looking to convert .txt file in .csv format.
The contents might have different names and values.
e.g.

start:
id:XXXX
name:abc

start:
age:29
height:5'9

start:
accountno:xxx
emailid:xxxxx

end:

I want export these contents to a .csv file. I am aware that I need to use delimiter. But I am not getting the exact out put I do wish to.
This is what I thought I should do.

1.look for the start:
2.once you catch first start:, look for the name:value pair using : delimiter.
3.store this name:value pair in local variable like string etc.
4.repeat the steps until we see end:
5.extract the name:value pair in a .csv file.

I am interested in message at console. At the same time, I also want the stored name:value pairs should be exported to .csv file and I should be able to display contents of the .csv file.

This is what I have written so far.
Java Code:
import java.util.regex.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

{
public static void main(String[] args)
{
File file = new File("C:\\source1.txt");
StringBuilder sb = new StringBuilder();
String line=null;

try
{
String text = null;

// repeat until all lines is read
{
if(!line.trim().equals(""))
{
if(line.startsWith("begin:"))
{
String[] data = sb.toString().trim().split("\n");

for(String chunk : data)
{
String[] parts = chunk.split(":");
System.out.println(parts[0] + " : " + parts[1]);
}

sb.setLength(0);
}
else
{
sb.append(line).append("\n");
}
}
/*String splitarray[] = line.split(":");
String firstentry = splitarray[0];
String secondentry = splitarray[2];
System.out.println(firstentry + " " + secondentry);*/

}
} catch (FileNotFoundException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
} finally
{
System.out.println("Out");
}
}

// show file contents here
//System.out.println(str.toString());    }
}
It would be a great help anyone has got an idea for further development. Thanks in advance.

Best regards.

2. Senior Member
Join Date
Mar 2010
Posts
952
Rep Power
5
I'm not sure I understand what you want here, so let's back up for a second.

Typically, a .csv file has a heading line (not always) and then many lines of records, all in the same format -- something like this:

Java Code:
"id","name","address"
1,"Barack H. Obama","1600 Pennsylvania Ave."
2,"Gordon Brown","10 Downing St."
3,"Herman Munster","1313 Mockingbird Ln."
Your example specifies different kinds of records. Do you know how many different kinds there will be? Do you know their record format ahead of time, or will you need to interpret everything from the .txt file? Do you want a separate .csv file for each record type (that would make the most sense to me) or should all the different record types be mixed together in one .csv file (doesn't make much sense)?

Don't try to do everything in main(). Your code is already about six indents deep, and you've barely gotten started. Break things up into methods. Think about your data structures before you start coding. If you know exactly what the different record types will be, you might consider writing a class for each type.

Tell me whether what I've said so far makes sense, and then we can work from there.

-Gary-

3. Member
Join Date
Mar 2010
Posts
16
Rep Power
0
@gcalvin

Thank you very much for your reply. Yes you are right, I should not write everything in main. Now about .txt and .csv.

1. Text file contains several key:value pairs format after begin:.
2. It contains several begin: followed by key:value pairs.
for e.g.
begin:
name:xxx
age:22
sex:xx

begin:
id:xx
accountNo:xxx

begin:
id:xx
age:xx
name:xx

end:
3. Key means labels like name,id,address which eventually go in the headers of the .csv files.
4. I want take these key(labels) out and place them in a string and then I will export them to the .csv file.
5. I don't want duplication of the labels. For e.g. if key called name, repeats several times after begin:
6. Therefore, I believe I should use set to avoid duplication.
7. First I have to check for begin:(begin and delimiter ":". at first i tried to take "begin:" as a delimiter) then read start reading file.
8. Check for the key:value pairs delimited by ":"
9. store keys in header and then store respective values in the .csv file.
10. repeat this until the End:.

This is for what I have been trying. Let's see how far I get with it. I will post my modified code which is not working.

Java Code:
import java.util.*;
import java.util.regex.*;
import java.io.*;
import com.sun.java.util.*;
import org.apache.commons.lang.StringUtils;

{
public static void main(String[] args)
{
File file = new File("C:\\source1.txt");
StringBuilder sb = new StringBuilder();
String line=null;

try
{

// repeat until all lines are read
Set<String> s=new HashSet<String>();
int size=s.size();

{
if(!line.trim().equals(""))
{
if(line.startsWith("BEGIN:"))
{
String[] data = sb.toString().trim().split("\n");

for(String chunk : data)
{
String[] parts = (String[])chunk.split(":");
System.out.println(parts[0] + " : " + parts[1]);
Iterator<String> it = s.iterator();
while (it.hasNext())
{
//Object element=it.next();
size=s.size();
}

}

sb.setLength(0);

}
else
{
sb.append(line).append("\n");
}

}

}
System.out.println(s);
}
catch (FileNotFoundException e)
{
e.printStackTrace();
} catch (IOException e1)
{
e1.printStackTrace();
} finally
{
System.out.println("out");
}
// show file contents here
System.out.println(sb.toString());
}
}
Thank you very much.
P.S. About data structure, i think i will have start on paper with pen as I am a beginner and It's learning curve for me.

4. Senior Member
Join Date
Mar 2010
Posts
952
Rep Power
5
OK, I think I understand a little better now. You don't have different record types -- there's only one record type -- but each record in the .txt file may be missing some fields. And I think you suggested that some records might even have duplicate fields, but I'll ask about that later.

So if you have this .txt file:
Java Code:
begin:
name:Barack H. Obama
age:48
sex:M

begin:
id:100023
accountNo:12398765478236

begin:
id:100028
age:23
name:Ed "Kookie" Burns

end:
...you want to end up with this .csv file:
Java Code:
"name","age","sex","id","address","accountNo"
"Barack H. Obama",48,"M",,"",""
"",,"",100023,"1313 Mockingbird Lane","12398765478236"
"Ed ""Kookie"" Burns",23,"",100028,""
Note that I'm assuming that age and id are numeric values, and all other fields are strings. You can treat age and id as strings also, which will make things simpler, but I like a challenge. Also note the handling of strings that have double quotes in the text.

So I hope I'm understanding correctly so far? Now what happens if you get a record like this?:
Java Code:
begin:
id:100375
name:Alfred E. Neuman
sex:M
id:100485
What do you want to do about the duplicate field? The easiest thing is to discard all but the last appearance of the field name. The safest thing is to raise an error and reject the entire record (maybe even the entire .txt file). Maybe the specification says to write one record with one id and another record with the other id, all other fields staying the same.

This post is getting long, so let me know if we're on the right track, and we can talk about data structures next.

-Gary-

5. Member
Join Date
Mar 2010
Posts
16
Rep Power
0
@gcalvin

Thanks a lot Gary. Yes. We are on right track. This is exactly for what I am looking. I have changed some logical steps now. I am way behind for what I am looking but I believe now I am on right track. Here is my new code. Sorry I have not added comments in this code.

Java Code:
import java.util.*;
import java.util.regex.*;
import java.io.*;

import com.sun.java.util.*;
import org.apache.commons.lang.StringUtils;

{
public static void main(String[] args)
{
File file = new File("C:\\source1.txt");
String line=null;
String end="END:";
String begin="BEGIN:";
StringBuffer str = new StringBuffer();

try
{
String text=null;
Set<String> s=new HashSet<String>();
try {
{

if(line.equalsIgnoreCase(begin))
{
for(String parts:line.split(":"))
{
String columnFile=StringUtils.substringBefore(line, ":");
String dataValue=StringUtils.substringAfter(line, ":");
Object o= (String)columnFile.toString();
if(!s.equals(o))
{
}
else
{
System.out.println("\n Duplicate labels are not allowed");
}
}
}
System.out.println(s.toString());
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}catch(IOException e)
{
e.printStackTrace();
}
}
}

6. Member
Join Date
Mar 2010
Posts
16
Rep Power
0
@gcalvin

Good thing is that with this modified code, i am taking keys (labels) out of the file and duplication is skipped.

Java Code:
import java.util.*;
import java.util.regex.*;
import java.io.*;

import com.sun.java.util.*;
import org.apache.commons.lang.StringUtils;

{
public static void main(String[] args)
{
File file = new File("C:\\source1.txt");
String line=null;
String end="END:";
String begin="BEGIN:";
StringBuffer str = new StringBuffer();

try
{
String text=null;
Set<String> s=new HashSet<String>();
try {
{

if(!line.equalsIgnoreCase(begin))
{
for(String parts:line.split(":"))
{
String columnFile=StringUtils.substringBefore(line, ":");
String dataValue=StringUtils.substringAfter(line, ":");

if(!s.contains(columnFile))
{
}
}
}

}
System.out.println(s.toString());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}catch(IOException e)
{
e.printStackTrace();
}
}
}

7. Senior Member
Join Date
Mar 2010
Posts
952
Rep Power
5
Take a look at this, and see if it gives you some ideas:
Java Code:
import java.io.*;
import java.util.*;

public class Txt2Csv {
private String filename;
private boolean moreRecords;
private Set<String> fieldNames;
private ArrayList< Map<String, String> > records;
private static final String BEGIN = "begin:";
private static final String END = "end:";

/**
* @param filename the name of the .txt file we want to parse
*/
public Txt2Csv(String filename) {
this.filename = filename;
fieldNames = new HashSet<String>();
records = new ArrayList< Map<String, String> >();
moreRecords = false; // openInputFile() should set it to true if all goes well
}

private void generateCsv() {
// TODO Auto-generated method stub

}

private void parseRecord(String record) {
// TODO Auto-generated method stub

}

String record = "";
String line = "";
while (true) {
try {
} catch (IOException e) {
e.printStackTrace();
}
if (line.toLowerCase().startsWith(BEGIN)) {
break;
} else if (line.toLowerCase().startsWith(END)) {
moreRecords = false;
break;
} else {
record += line + "\n";
}
}
return record;
}

private void openInputFile() {
try {
} catch (FileNotFoundException e) {
e.printStackTrace();
}
String line = "";
while (!moreRecords) {
try {
} catch (IOException e) {
e.printStackTrace();
}
if (line.toLowerCase().startsWith(BEGIN)) {
moreRecords = true;
} else if (line.toLowerCase().startsWith(END)) {
break;
}
}
}

public void parseFile() {
openInputFile();
while (moreRecords) {
parseRecord(record);
}
generateCsv();
}

/**
* @param args
*/
public static void main(String[] args) {
// TODO: add code to get file name from args or
//       prompt user for it
Txt2Csv myApp = new Txt2Csv("input.txt");
myApp.parseFile();
}
}
I haven't really written any code that you didn't already write, but by breaking it down into methods, I think I've made it a little easier to read and understand. I've also given you a big data structure hint for handling your parsed records. You have two methods left to implement, and you might want to break up generateCsv() into multiple methods as well.

Your parseRecord() method should create a new HashMap<String, String> for the new record you're generating, then add that to the records ArrayList. Meanwhile, it should add the field names to the fieldNames Set. You need to parse all of your records into memory, and then generate your .csv file at the end, because you need to know what all the field names are when you write the first heading line of your .csv file.

Keep your try{} blocks as tight as possible, and you should write better exception handlers than what we have right now.

-Gary-
Last edited by gcalvin; 03-12-2010 at 05:43 PM.

8. Senior Member
Join Date
Feb 2009
Posts
307
Rep Power
6
Why are you trying to do this all in one class? I would suggest breaking this down even further. Make yourself three classes, a Reader class, a Record class, and a Writer class.

You should first READ all the RECORDS from the file. Then using these RECORDS, WRITE to the file.

This design allows you to easily add methods in the code to read and write different types in which the record might be laid out differently(Example: Read the records from the CSV file and write to a Txt File).

9. Senior Member
Join Date
Mar 2010
Posts
952
Rep Power
5
Originally Posted by StormyWaters
Why are you trying to do this all in one class? I would suggest breaking this down even further. Make yourself three classes, a Reader class, a Record class, and a Writer class.

You should first READ all the RECORDS from the file. Then using these RECORDS, WRITE to the file.

This design allows you to easily add methods in the code to read and write different types in which the record might be laid out differently(Example: Read the records from the CSV file and write to a Txt File).
Hi Stormy,

I don't necessarily disagree with you, especially about having a separate Record class. If we break it up as you suggest, which class would hold the collection of records? Both the Reader and the Writer need it. Which class would take care of parsing the text into Records (I think the Record class should do it, but an argument could be made that the Reader class should do it)? Which class would generate the CSV lines?

I'm not sure that the Reader and Writer classes offer us much advantage, at least at this stage, but I could be convinced otherwise. A Record class is probably a good idea, and is definitely a good idea if you know all of the fields ahead of time.

-Gary-

10. Senior Member
Join Date
Feb 2009
Posts
307
Rep Power
6
Originally Posted by gcalvin
If we break it up as you suggest, which class would hold the collection of records? Both the Reader and the Writer need it.
The way I would picture it is that the Reader class would return a List of Records and whichever class is using it should manage it. If you are testing the Test class would take care of it by doing something like this

Java Code:
public class Test {

public static void main(String[] args) {
try {
Writer writer = new Writer();
writer.writeToCSVFile("C:\\out.csv");
} catch (Throwable e){
e.printStackTrace();
}
}

}

Originally Posted by gcalvin
Which class would take care of parsing the text into Records (I think the Record class should do it, but an argument could be made that the Reader class should do it)?
The record class is just an object that can have values set. It should not be responsible for the process of parsing the text. This should be handled by the Reader class with a method that would parse the .txt file and return a List of Records.

Originally Posted by gcalvin
Which class would generate the CSV lines?
That would be the purpose of the Writer class, to output the information in the desired format.

Originally Posted by gcalvin
A Record class is probably a good idea, and is definitely a good idea if you know all of the fields ahead of time.
You don't even need to know the fields ahead of time, just keep a List of all the Field Names you've added and a Hashtable to hash the Field Name to the data. Then create a getFieldNames() method that would return the names of the Fields stored in the Record and couple this with a getFieldValue(String fieldName) method that would return the data for the Field.

11. Senior Member
Join Date
Mar 2010
Posts
952
Rep Power
5
OK, I see what you're saying. I was thinking that the Record (or actually, more specific subclasses of Record) would know about its own fields and their types, and would be better suited to create and parse the different possible textual representations. I think we'd need to know more about the full project to determine which is the better approach. For what we have so far, I think I'd stick with the single-class implementation. It's still pretty simple -- the record is a simple HashMap -- and there aren't enough methods to warrant breaking it up yet, in my judgment. But I can certainly understand why you'd take a different approach.

-Gary-

12. Member
Join Date
Mar 2010
Posts
16
Rep Power
0
@gcalvin
@StormyWaters

Thank a lot for your guidance and suggestions guys.

Best regards.

13. Member
Join Date
Mar 2010
Posts
16
Rep Power
0
@gcalvin

Hello Gary,

Sorry to ask you again for the same post. This is getting very confusing for me. I went through your code. It's good but I am not getting few concept. I am making my code simple at the present situation.

Java Code:
import java.util.*;
import java.util.regex.*;
import java.io.*;
import com.sun.java.util.*;
import org.apache.commons.lang.StringUtils;

{
public static void main(String[] args)
{
File file = new File("C:\\source3.txt");
String line=null;
boolean moreRecords;
ArrayList<String> records;
String end="END:";
String begin="BEGIN:";

try
{
String columnFile="",columnFileTemp="",dataValue="";
int size=0;
Set<String> s=new HashSet<String>(); //to get the key values in header only once, declare set
records = new ArrayList<String>();
boolean flag=false;
try
{
{

if(!line.equalsIgnoreCase(begin))	//ignore the begin: delimiter and start reading contents
{
//to extract contents separate variables after and before the colon
columnFileTemp = StringUtils.substringBefore(line, ":");
dataValue=dataValue+(dataValue.equals("")?"":",")+StringUtils.substringAfter(line, ":");
System.out.println(dataValue);
if(!s.contains(columnFileTemp))
{
columnFile=columnFile+(columnFile.equals("")?"":",")+StringUtils.substringBefore(line, ":");
s.add(columnFileTemp);//to avoid duplication check it with previously entered keys.
s.size();
}
else
{
System.out.println("\n duplicate values");
}

//System.out.println(records);//print the value on console
}
else
{
if(flag)
{
if(records.contains(dataValue))
{

}
dataValue="";
}
flag=true;
}
}
System.out.println(s.size());
//dataValue="\n"+dataValue;
System.out.println(records);
//create new .csv file and write the contents (keys:value) in the file
String element="";
File file1 = new File("c:\\write.csv");
FileWriter writer = new FileWriter(file1,true);
writer.write(columnFile);
Iterator<String> itr= records.iterator();
while(itr.hasNext())
{
writer.write(System.getProperty("line.separator"));
element=itr.next();
writer.write(element);

}

writer.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}catch(IOException e)
{
e.printStackTrace();
}
}
}
now my .txt file.

BEGIN:
name:abc
id:123
gender:m
BEGIN:
dob:09/11/83
BEGIN:
accountno:1234
name:xyz
id:1230
gender:f
END:

My problem is, i am getting keys in the header but when it comes to data(value),it doesn't match with corresponding keys (fieldnames). I am trying everything i could. using set to avoid duplication of the fieldnames and am using arraylist for the values(data). but i am not getting desired result.like,

column1,column2,column3,column4
,@,@,@
@,,@,,
,@,@,

14. Senior Member
Join Date
Mar 2010
Posts
952
Rep Power
5
This is not simple. This is a mess with everything crammed back into main(). Break it up into methods. I'm not even going to try to read it like this. Also you're trying to put your records into an ArrayList<String> after I explained that they need to go into an ArrayList<Map<String, String>>.

Break it up into methods again, and then tell me what concepts you're not getting.

-Gary-

15. Senior Member
Join Date
Mar 2010
Posts
952
Rep Power
5
Sorry, I didn't mean to get harsh. But seriously, do the parseFile(), openInputFile() and readFile() methods, and then try to implement parseRecord() and show me what you can come up with, and I'll try to help. We can tackle generateCsv() after that.

-Gary-

16. Member
Join Date
Mar 2010
Posts
16
Rep Power
0
@gcalvin

Actually, I should have split the code earlier. I am sorry about that. I will work on it and I will send you fresh code again. Fact is once I start to get results, I don't do the edition. I should do it though. Thanks for your attention.

Best regards.

17. Member
Join Date
Mar 2010
Posts
16
Rep Power
0
@gcalvin

I have split my code now. I am sending you what I have actually done. I have changed lots of things. I am stuck now while writing writeToCsv() method where in I am trying to get key values from hashmap.

Java Code:
import java.io.*;
import java.util.*;

import org.apache.commons.lang.StringUtils;

public class textToCsv
{
//Set<String> s = new HashSet<String>(); //to get the key values in header only once, declare set
String begin = "begin:";
String end = "end:";
String columnFileTemp,dataValue="";
String record = "";
String line = "";
ArrayList< Map<String, String> > records=new ArrayList<Map<String,String>>();
/**
* @param filename the name of the .txt file we want to parse
* @throws IOException
*/
public textToCsv()
{
super();
}

private Map<String,String> getColumn(String fileName) throws IOException

{
Map <String,String> columnName=null;
File file = new File(fileName);
try
{
columnName=new HashMap<String,String>();
{
if(!line.equalsIgnoreCase(begin))	//ignore the begin: delimiter and start reading contents
{
//to extract contents separate variables after and before the colon
columnFileTemp = StringUtils.substringBefore(line, ":");
if(!StringUtils.equalsIgnoreCase(columnFileTemp, "END"))
columnName.put(columnFileTemp,"");
}
}
System.out.println(columnName);
}catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
System.out.println("ending.....");
}
return columnName;
}
private ArrayList<Map<String,String>> getData(String fileName,Map<String, String> columns) throws IOException
{
Map <String,String> dataRecord=null;
File file = new File(fileName);

try
{
int i=1;
while (line != null && !line.contains(end))//start reading the contents and between end of contents
{
if(StringUtils.containsIgnoreCase(line, "begin:"))	//ignore the begin: delimiter and start reading contents
{   System.out.println(i);
i++;
dataRecord=new HashMap<String,String>();
Collection c = columns.keySet();
Iterator itr= c.iterator();
while(itr.hasNext())
dataRecord.put((String)itr.next(),"");

}else{
while(StringUtils.indexOf(line, "BEGIN:")==-1 && line != null){
columnFileTemp = StringUtils.substringBefore(line, ":");
dataValue= StringUtils.substringAfter(line, ":");
if(columnFileTemp!="END")
dataRecord.put(columnFileTemp, dataValue);
}
continue;
}
}
System.out.println(records);
}catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
System.out.println("ending datavalue.....");
}
return records;
}
/**
* @param args
* @throws IOException
* @throws IOException
*/
private void writeToCsv() throws IOException
{
try
{
File file1=new File("c:\\write.csv");
FileWriter writer = new FileWriter(file1,true);
Iterator<Map<String, String>> itr= records.iterator();
while(itr.hasNext())
{
writer.write(System.getProperty("line.separator"));
}
writer.close();
}catch(IOException e){}
}

public static void main(String[] args) throws IOException
{
// TODO: add code to get file name from args or
//       prompt user for it
textToCsv myApp = new textToCsv();
String fileName="c:\\source3.txt";
Map<String,String> columnMap=myApp.getColumn(fileName);
ArrayList<Map<String,String>> dataList=myApp.getData(fileName,columnMap);
myApp.writeToCsv();
}
}

in source3.txt i am parsing following records.
BEGIN:
name:abc
id:123
gender:m
BEGIN:
dob:07/01/89
BEGIN:
accountno:1234
name:xyz
id:1230
gender:f
END:

Please let me know your suggestions or ideas to get key values from hashmap.

Best regards.

18. Senior Member
Join Date
Mar 2010
Posts
952
Rep Power
5
OK, let's start at the top:
Java Code:
import java.io.*;
import java.util.*;

import org.apache.commons.lang.StringUtils;
You probably don't need the Apache StringUtils, as you're not doing anything difficult with your strings.
Java Code:
public class textToCsv
Start your class name with an upper-case letter. Remember that your source code file name has to match.
Java Code:
[COLOR="RoyalBlue"]public class TextToCsv
[/COLOR]
Java Code:
{
//Set<String> s = new HashSet<String>(); //to get the key values in header only once, declare set
You have this commented out, I believe because you declared a similar collection in your main() method, and confused yourself. You do want this to be an instance variable, but give it a useful name, like "fieldNames" and not a useless name like "s".
Java Code:
[COLOR="RoyalBlue"]        private Set<String> fieldNames;
[/COLOR]
Java Code:
	String begin = "begin:";
String end = "end:";
These are constants, so they should be declared like this:
Java Code:
[COLOR="RoyalBlue"]        private static final String BEGIN = "begin:";
private static final String END = "end:";
[/COLOR]
private means only methods in this class have access
static means there is only one copy that is shared by all instances of this class
final means the value cannot be changed
And we give them names in ALL CAPS to remind ourselves that they are constants. Style is important -- learn good habits now.

Java Code:
	String columnFileTemp,dataValue="";
String record = "";
String line = "";
I'm not sure what these are yet, or whether they ought to be instance variables, but in any case, it's generally better practice to declare your ivars here and initialize them in your constructor.
Java Code:
	ArrayList< Map<String, String> > records=new ArrayList<Map<String,String>>();
This one should definitely be initialized in the constructor, but it looks like instead you created yourself a local variable in the constructor and ignored this.
Java Code:
[COLOR="RoyalBlue"]        private ArrayList<Map<String, String>> records;
[/COLOR]
I think you should have ivars for your file names too, and it will be convenient to keep a boolean moreRecords as well.
Java Code:
[COLOR="RoyalBlue"]        private String inFileName;
private String outFileName;
private boolean moreRecords;
[/COLOR]
Now we get to your constructor:
Java Code:

/**
* @param filename the name of the .txt file we want to parse
* @throws IOException
*/
public textToCsv()
{
super();
}
You've taken all the code out of the constructor, so the javadoc comments are no longer accurate, and the super() call is superfluous. As it is now, you should remove the constructor altogether, but actually you should be initializing your instance variables here.
Java Code:
[COLOR="RoyalBlue"]        public TextToCsv(String inputFileName, String outputFileName) {
fieldNames = new HashSet<String>();
records = new ArrayList<Map<String, String>>();
inFileName = inputFileName;
outFileName = outputFileName;
moreRecords = false; // we're not ready to read moreRecords until we've opened the input file
}
[/COLOR]
After this you really start to go off the rails, so let me skip down to your main() method:
Java Code:
	public static void main(String[] args) throws IOException
No, don't let main() throw any exceptions -- catch them and deal with them.
Java Code:
[COLOR="RoyalBlue"]        public static void main(String[] args)
[/COLOR]
Java Code:
	{
// TODO: add code to get file name from args or
//       prompt user for it
textToCsv myApp = new textToCsv();
String fileName="c:\\source3.txt";
We've changed the class name and constructor, so:
Java Code:
[COLOR="RoyalBlue"]                TextToCsv myApp = new TextToCsv("c:\\source3.txt", "c:\\dest.txt");
[/COLOR]
Java Code:
		Map<String,String> columnMap=myApp.getColumn(fileName);
ArrayList<Map<String,String>> dataList=myApp.getData(fileName,columnMap);
myApp.writeToCsv();
System.out.println("Your file is written");
Move the rest of this code out of main() and into a separate method.
Java Code:
[COLOR="RoyalBlue"]                myApp.parseFile();
}
}
[/COLOR]
The reason why you want to do this is that in practice, you will rarely use a class's main() method. This TextToCsv class will be used from within some other class that's part of a larger application. That other class will want to do just what our main() method does -- get an instance of TextToCsv and then call that object's parseFile() method. Even if you think your class will never be used by another class, this is just a good habit to get into.

So let's write parseFile()
Java Code:
[COLOR="RoyalBlue"]        public void parseFile() {
BufferedReader br = openInputFile(); // should set moreRecords to true
while (moreRecords) {
parseRecord(nextRecord); // writes key/value pair to records ArrayList and also updates fieldNames Set
}
closeInputFile(); // TODO write this
writeToCsv();
}
[/COLOR]
I showed you code you can use for openInputFile() and readNextRecord() in a previous example. It's very important that each method does just one easy-to-understand thing. Your openInputFile() method should just open the file and return a BufferedReader, dealing with any exceptions in the process. My example also read into the file as far as the first "begin:" string and set moreRecords to true. Am I breaking my own rule about "do just one thing"? Maybe. Feel free to write a separate positionToFirstRecord() method.

Your readNextRecord method should just read lines from the file and concatenate them into a String. The first time it's called, the String nextRecord should be set to "name:abc\nid:123\ngender:m". Then parseRecord() needs to turn that string into a HashMap<String, String> that we can store in the records ArrayList.
Java Code:
[COLOR="RoyalBlue"]        private void parseRecord(String recordString) {
Map<String, String> record = new HashMap<String, String>();
String[] lines = recordString.split("\n");
for (String line : lines ) {
String fieldName = line.substring(0, line.indexOf(':'));
String fieldValue = line.substring(line.indexOf(':') + 1);
record.put(fieldName, fieldValue);
// update fieldNames Set
}
}
[/COLOR]
So when we're done with parsing all the records, we have our fieldNames Set that has exactly one copy of each fieldName we found, and our records ArrayList, that has a Map of fieldName/fieldValue pairs for each record.

Now we're ready to tackle writeCsv(). It's probably not a bad idea to model it after our parseFile() method.
Java Code:
[COLOR="RoyalBlue"]        public void writeCsv() {
BufferedWriter bw = openOutputFile();
for (Map<String, String> record : records) {
String recordString = generateCsvRecord(record);
writeCsvRecord(bw, recordString);
}
closeOutputFile(); // TODO write this
}

String result = "";
boolean firstField = true;
for (String fieldName : fieldNames) {
if (!firstField) result += ",";
firstField = false;
result += "\"";
result += fieldName;
result += "\"";
}
try {
bw.write(result + System.getProperty("line.separator"));
} catch (IOException e) {
// TODO: handle exception gracefully
}
}

private String generateCsvRecord(Map<String, String> record) {
String result = "";
boolean firstField = true;
for (String fieldName : fieldNames) {
// TODO: finish this -- I've done too much of it for you
//   already. For each fieldName you need to check if
//   you have it in your current Map, and if so, get
//   the value, quote it, and concatenate it to result.
//   If the fieldName is not in your current Map, you
//   need to concatenate a quoted empty String to the
//   result, as a placeholder. Add commas before all
//   but the first field.
}
return result;
}

private BufferedWriter openOutputFile() {
// TODO: write this method
}

private void writeCsvRecord(BufferedWriter bw, String recordString) {
// TODO: write this one too
}
[/COLOR]
That's a whole lot to digest. Look at it carefully. Resist the temptation to cram it all back into main(). Ask me specific questions.

-Gary-
Last edited by gcalvin; 03-17-2010 at 10:08 PM.

19. Member
Join Date
Mar 2010
Posts
16
Rep Power
0
@gcalvin

Indeed it's a exact technical analysis. I will improve my code writing skills.

Best regards.

20. Senior Member
Join Date
Mar 2010
Posts
952
Rep Power
5
Just be patient with yourself. Break your work into small pieces rather than trying to do it all at once. Do you understand how the ArrayList<Map<String, String>> works now?

-Gary-

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•