text:
The siege of Vicksburg (May 18 – July 4, 1863) was the final major military action in the Vicksburg campaign of the American Civil War. In a series of maneuvers, Union Maj. Gen. Ulysses S. Grant and his Army of the Tennessee crossed the Mississippi River and drove the Confederate Army of Mississippi, led by Lt. Gen. John C. Pemberton, into the defensive lines surrounding the fortress city of Vicksburg, Mississippi.

Vicksburg was the last major Confederate stronghold on the Mississippi River; therefore, capturing it completed the second part of the Northern strategy, the Anaconda Plan. When two major assaults against the Confederate fortifications, on May 19 and 22, were repulsed with heavy casualties, Grant decided to besiege the city beginning on May 25. After holding out for more than forty days, with their supplies nearly gone, the garrison surrendered on July 4. The successful ending of the Vicksburg campaign significantly degraded the ability of the Confederacy to maintain its war effort. This action, combined with the surrender of the down-river Port Hudson to Maj. Gen. Nathaniel P. Banks on July 9, yielded command of the Mississippi River to the Union forces, who would hold it for the rest of the conflict.

The Confederate surrender on July 4, 1863, is sometimes considered, when combined with Gen. Robert E. Lee's defeat at Gettysburg by Maj. Gen. George Meade the previous day, the turning point of the war. It cut off the Trans-Mississippi Department (containing the states of Arkansas, Texas and part of Louisiana) from the rest of the Confederate States, effectively splitting the Confederacy in two for the rest of the war. Lincoln called Vicksburg "the key to the war."

Background

Military situation

After crossing the Mississippi River south of Vicksburg at Bruinsburg and driving northeast, Grant won battles at Port Gibson and Raymond and captured Jackson, the Mississippi state capital, on May 14, 1863, forcing Pemberton to withdraw westward. Attempts to stop the Union advance at Champion Hill and Big Black River Bridge were unsuccessful. Pemberton knew that the corps under Maj. Gen. William T. Sherman was preparing to flank him from the north, and so had no choice but to withdraw or be outflanked. Pemberton burned the bridges over the Big Black River and devastated the countryside as he retreated to the well-fortified city of Vicksburg.

The Confederates evacuated Hayne's Bluff, which was subsequently occupied by Sherman's cavalry on May 19, and Union steamboats no longer had to run the guns of Vicksburg, now being able to dock by the dozens up the Yazoo River. Grant could now receive supplies more directly than by the previous route, which ran through Louisiana, over the river crossing at Grand Gulf and Bruinsburg, then back up north.

Over half of Pemberton's army had been lost in the two preceding battles and many in Vicksburg expected General Joseph E. Johnston, in command of the Confederate Department of the West, to relieve the city—which he never did. Large numbers of Union troops were on the march to invest the city. They repaired the bridges over the Big Black River and crossed on May 18. Johnston sent a note to his general, Pemberton, asking him to sacrifice the city and save his troops, something Pemberton would not do. Pemberton, a Northerner by birth, was probably influenced by his fear of public condemnation if he abandoned Vicksburg.

Fortifications
As the Union forces approached Vicksburg, Pemberton could put only 18,500 troops in his lines. Grant had over 35,000, with more on the way. However, Pemberton had the advantage of terrain and fortifications that made his defense nearly impregnable. The defensive line around Vicksburg ran for approximately , based on terrain of varying elevations that included hills and knobs with steep slopes which would require an attacker to ascend them under fire. The perimeter included many gun pits, forts, trenches, redoubts, and lunettes. The major fortifications of the line included: Fort Hill, on a high bluff north of the city; the Stockade Redan, dominating the approach to the city on Graveyard Road from the northeast; the 3rd Louisiana Redan; the Great Redoubt; the Railroad Redoubt, protecting the gap for the railroad line entering the city; the Square Fort (Fort Garrott); a salient along the Hall's Ferry Road; and the South Fort.

Opposing forces

Union

Maj. Gen. Ulysses S. Grant's Union Army of the Tennessee brought five corps to the siege:
 IX Corps, under Maj. Gen. John Parke;
 XIII Corps, under Maj. Gen. John A. McClernand;
 XV Corps, under Maj. Gen. William T. Sherman;
 XVI Corps (detachment), under Maj. Gen. Cadwallader C. Washburn;
 XVII Corps, under Maj. Gen. James B. McPherson.

Confederate

Lt. Gen. John C. Pemberton's Confederate Army of Mississippi inside the Vicksburg line consisted of four divisions, under Maj. Gens.:
Carter L. Stevenson;
John H. Forney;
Martin L. Smith;
John S. Bowen.

Siege

Assaults

Grant wanted to overwhelm the Confederates before they could fully organize their defenses and ordered an assault against the Stockade Redan for May 19. Troops from Sherman's corps had a difficult time approaching the position under rifle and artillery fire from the 36th Mississippi Infantry, Brig. Gen. Louis Hébert's brigade. They had to negotiate a steep ravine protected by abatis and cross a ,  ditch before attacking the  walls of the redan. This first attempt was easily repulsed. Grant ordered an artillery bombardment to soften the defenses and at about 2 pm, Sherman's division under Maj. Gen. Francis P. Blair tried again, but only a small number of men were able to advance even as far as the ditch below the redan. The assault collapsed in an exchange of rifle fire and hand grenades lobbing back and forth.

The failed Union assaults of May 19 damaged troop morale, deflating the confidence the soldiers had felt after their string of victories across Mississippi. They were also costly, with 157 killed, 777 wounded, and eight missing, versus Confederate casualties of eight killed and 62 wounded. The Confederates, assumed to be demoralized, had regained their fighting edge.

Grant planned another assault for May 22, but this time with greater care; his troops would first reconnoiter thoroughly and soften up the defenses with artillery and naval gunfire. The lead units were supplied with ladders to ascend the fortification walls. Grant did not want a long siege, and this attack was to be by the entire army across a wide front.

Despite their bloody repulse on May 19, Union troops were in high spirits, now well-fed with provisions they had foraged. On seeing Grant pass by, a soldier commented, "Hardtack". Soon all Union troops in the vicinity were yelling, "Hardtack! Hardtack!" The Union served hardtack, beans, and coffee the night of May 21. Everyone expected that Vicksburg would fall the next day.

Union forces bombarded the city all night, from 220 artillery pieces and with naval gunfire from Rear Adm. David D. Porter's fleet in the river. While causing little property damage, they damaged Confederate civilian morale. On the morning of May 22, the defenders were bombarded again for four hours before the Union attacked once more along a  front at 10 am.

Sherman attacked once again down the Graveyard Road, with 150 volunteers (nicknamed the forlorn hope detachment) leading the way with ladders and planks, followed by the divisions of Blair and Brig. Gen. James M. Tuttle, arranged in a long column of regiments. They hoped to achieve a breakthrough by concentrating their mass on a narrow front. They were driven back in the face of heavy rifle fire. Blair's brigades under Cols. Giles A. Smith and T. Kilby Smith made it as far as a ridge 100 yards from Green's Redan, the southern edge of the Stockade Redan, from where they poured heavy fire into the Confederate position, but to no avail. Tuttle's division, waiting its turn to advance, did not have an opportunity to move forward. On Sherman's far right, the division of Brig. Gen. Frederick Steele spent the morning attempting to get into position through a ravine of the Mint Spring Bayou.

McPherson's corps was assigned to attack the center along the Jackson Road. On their right flank, the brigade of Brig. Gen. Thomas E. G. Ransom advanced to within 100 yards of the Confederate line, but halted to avoid dangerous flanking fire from Green's Redan. On McPherson's left flank, the division of Maj. Gen. John A. Logan was assigned to assault the 3rd Louisiana Redan and the Great Redoubt. The brigade of Brig. Gen. John E. Smith made it as far as the slope of the redan, but huddled there, dodging grenades until dark, when they were recalled. Brig. Gen. John D. Stevenson's brigade advanced in two columns against the redoubt, but their attack also failed when they found their ladders were too short to scale the fortification. Brig. Gen. Isaac F. Quinby's division advanced a few hundred yards, but halted for hours while its generals engaged in confused discussions.

On the Union left, McClernand's corps moved along the Baldwin Ferry Road and astride the Southern Railroad of Mississippi. The division of Brig. Gen. Eugene A. Carr was assigned to capture the Railroad Redoubt and the 2nd Texas Lunette; the division of Brig. Gen. Peter J. Osterhaus was assigned the Square Fort. Carr's men achieved a small breakthrough at the 2nd Texas Lunette and requested reinforcements.

By 11 am, it was clear that a breakthrough was not forthcoming and that the advances by Sherman and McPherson were failures. Just then, Grant received a message from McClernand, which stated that he was heavily engaged, the Confederates were being reinforced, and he requested a diversion on his right from McPherson's corps. Grant initially refused the request, telling McClernand to use his own reserve forces for assistance; Grant was mistakenly under the impression that McClernand had been lightly engaged and McPherson heavily, although the reverse was true. McClernand followed up with a message that was partially misleading, implying that he had captured two forts—"The Stars and Stripes are flying over them."—and that another push along the line would achieve victory for the Union Army. In fact, more than a dozen members of the 22nd Iowa Infantry Regiment had secured a tenuous foothold in a portion of the fortification known as the Railroad Redoubt, and forced Confederate defenders back from that point, though the Iowans could not advance further. Although Grant once again demurred, he showed the dispatch to Sherman, who ordered his own corps to advance again. Grant, reconsidering, then ordered McPherson to send Quinby's division to aid McClernand.

Sherman ordered two more assaults. At 2:15 pm, Giles Smith and Ransom moved out and were repulsed immediately. At 3 pm, Tuttle's division suffered so many casualties in their aborted advance that Sherman told Tuttle, "This is murder; order those troops back." By this time, Steele's division had finally maneuvered into position on Sherman's right, and at 4 pm, Steele gave the order to charge against the 26th Louisiana Redoubt. They had no more success than any of Sherman's other assaults.

In McPherson's sector, Logan's division made another thrust down the Jackson Road at about 2 pm, but met with heavy losses and the attack was called off. McClernand attacked again, reinforced by Quinby's division, but with no success. Union casualties for the day totalled 502 killed, 2,550 wounded, and 147 missing, about evenly divided across the three corps. Confederate casualties were not reported directly, but are estimated to have been under 500. Grant blamed McClernand's misleading dispatches for part of the poor results of the day, storing up another grievance against the political general who had caused him so many aggravations during the campaign.

Siege operations

Historian Shelby Foote wrote that Grant "did not regret having made the assaults; he only regretted that they had failed." Grant reluctantly settled into a siege. On May 25, Lt. Col. John A. Rawlins issued Special Orders No. 140 for Grant:  Grant wrote in his memoirs, "I now determined upon a regular siege—to 'out-camp the enemy,' as it were, and to incur no more losses."

Federal troops began to dig in, constructing elaborate entrenchments which the soldiers of the time referred to as "ditches". These surrounded the city and moved steadily closer to the Confederate fortifications. With their backs against the Mississippi and Union gunboats firing from the river, Confederate soldiers and citizens alike were trapped. Pemberton was determined to hold his few miles of the Mississippi as long as possible, hoping for relief from Johnston or elsewhere.

A new problem confronted the Confederates. The dead and wounded of Grant's army lay in the heat of Mississippi summer, the odor of the deceased men and horses fouling the air, the wounded crying for medical help and water. Grant first refused a request of truce, thinking it a show of weakness. Finally he relented, and the Confederates held their fire while the Union recovered the wounded and dead on May 25, soldiers from both sides mingling and trading as if no hostilities existed for the moment.

After this truce, Grant's army began to fill the  ring around Vicksburg. It soon became clear that even 50,000 Union soldiers would not be able to effect a complete encirclement of the Confederate defenses. Pemberton's outlook on escape was pessimistic, but there were still roads leading south out of Vicksburg unguarded by Union troops. Grant sought help from Maj. Gen. Henry W. Halleck, the Union general-in-chief. Halleck quickly began to shift Union troops in the West to meet Grant's needs. The first of these reinforcements was a 5,000-man division from the Department of the Missouri under Maj. Gen. Francis J. Herron on June 11. Herron's troops, remnants of the Army of the Frontier, were attached to McPherson's corps and took up position on the far south. Next came a three division detachment from XVI Corps led by Brig. Gen. Cadwallader C. Washburn on June 12, assembled from troops at the nearby posts of Corinth, Memphis, and LaGrange. The final significant group of reinforcements to join was the 8,000-man strong IX Corps from the Department of the Ohio, led by Maj. Gen. John G. Parke, arriving on June 14. With the arrival of Parke, Grant had 77,000 men around Vicksburg.

In an effort to cut Grant's supply line, Confederates in Louisiana under Major General John G. Walker attacked Milliken's Bend up the Mississippi on June 7. This was largely defended by recently enlisted United States colored troops. Despite having inferior weaponry, they fought bravely and repulsed the Confederates with help from gunboats, although at heavy cost; the defenders lost 652 to the Confederate 185. The loss at Milliken's Bend left the Confederates with no hope for relief other than from the cautious Johnston.

Pemberton was boxed in with plentiful munitions but little food. The poor diet was telling on the Confederate soldiers. By the end of June, half were sick or hospitalized. Scurvy, malaria, dysentery, diarrhea, and other diseases cut their ranks. At least one city resident had to stay up at night to keep starving soldiers out of his vegetable garden. The constant shelling did not bother him as much as the loss of his food. As the siege wore on, fewer and fewer horses, mules, and dogs were seen wandering about Vicksburg. Shoe leather became a last resort of sustenance for many adults.

During the siege, Union gunboats lobbed over 22,000 shells into the town and army artillery fire was even heavier. As the barrages continued, suitable housing in Vicksburg was reduced to a minimum. A ridge, located between the main town and the rebel defense line, provided lodging for the duration. Over 500 caves, known locally as "bombproofs", were dug into the yellow clay hills of Vicksburg. Whether houses were structurally sound or not, it was deemed safer to occupy these dugouts. People did their best to make them comfortable, with rugs, furniture, and pictures. They tried to time their movements and foraging with the rhythm of the cannonade, sometimes unsuccessfully. Because of the citizens' burrowing, the Union soldiers gave the town the nickname of "Prairie Dog Village". Despite the ferocity of the Union fire, fewer than a dozen civilians are known to have been killed during the siege.

Command changes
One of Grant's actions during the siege was to settle a lingering rivalry. On May 30, General McClernand wrote a self-adulatory note to his troops, claiming much of the credit for the soon-to-be victory. Grant had been waiting six months for him to slip, ever since they clashed early in the campaign, around the Battle of Arkansas Post. He had received permission to relieve McClernand in January 1863 but waited for an unequivocal provocation; McClernand was relieved on June 18. Grant so carefully prepared his action that McClernand was left without recourse. McClernand's XIII Corps was turned over to Maj. Gen. Edward Ord, who had recovered from an October 1862 wound sustained at Hatchie's Bridge. In May 1864, McClernand would be given a command in a remote area of Texas.

Another command change occurred on June 22. In addition to Pemberton in Vicksburg, Grant had to be aware of Confederate forces in his rear under the command of Joseph E. Johnston. He stationed one division in the vicinity of the Big Black River Bridge and another reconnoitered as far north as Mechanicsburg; both acted as covering forces. By June 10, the IX Corps, under Maj. Gen. John G. Parke, was transferred to Grant's command. This corps became the nucleus of a special task force whose mission was to prevent Johnston, who was gathering his forces at Canton, from interfering with the siege. Sherman was given command of this task force and Brig. Gen. Frederick Steele replaced him at XV Corps. Johnston eventually began moving to relieve Pemberton and reached the Big Black River on July 1, but he delayed a potentially difficult encounter with Sherman until it was too late for the Vicksburg garrison, and then fell back to Jackson. Sherman would pursue Johnston and recapture Jackson on July 17.

Louisiana operations

Throughout the siege Union and Confederate forces kept busy in a supporting role on the Louisiana side of the Mississippi River. Lt. Gen. Edmund Kirby Smith, commander of the Trans-Mississippi Department, received a telegraph from Pemberton on May 9 requesting that he move against Grant's communication lines along the Mississippi River. Grant had established important supply depots at Milliken's Bend, Young's Point, and Lake Providence, all within Smith's jurisdiction, but Smith failed to recognize the importance of Pemberton's situation. It was not until June when Smith finally took action on Pemberton's request, directing Maj. Gen. Richard Taylor to "do something" in support of the Vicksburg garrison. Taylor commanded the District of Western Louisiana and developed a three-pronged campaign against Grant's three supply depots. All three of Taylor's assaults were defeated at the Battle of Milliken's Bend, the Battle of Young's Point, and the Battle of Lake Providence.

In response to the growing Confederate activity in the area, Grant decided to dispatch troops from the Vicksburg trenches across the river. The presence of Maj. Gen. John G. Walker's Confederate division on the Louisiana side was of particular concern; its presence could possibly aid any Confederate attempt to escape from Vicksburg. Therefore, Brig. Gen. Alfred W. Ellet's Mississippi Marine Brigade and Joseph A. Mower's brigade from Sherman's corps were ordered to the vicinity of Milliken's Bend. Mower and Ellet were to cooperate against Walker's division, which was stationed in the vicinity of Richmond, Louisiana. Richmond was also an important supply line providing Vicksburg with food from Louisiana. On June 15, Ellet and Mower defeated Walker and destroyed Richmond.

Ellet's men returned to De Soto Point and constructed an artillery battery targeting an iron foundry recasting spent Union artillery shells. Construction was begun on June 19, which placed a 20-pounder Parrott rifle in a casemate of railroad iron. The targeted foundry was destroyed on June 25 and the next day a second Parrott gun was added to the battery, which continued to harass the defenders until the garrison's surrender.

Additional Confederate activity in Louisiana occurred on June 29 at Goodrich's Landing when they attacked a plantation and an army training center run by former slaves. The Confederates destroyed the plantations and captured over a hundred former slaves before disengaging in the face of Ellet's Marines. Confederate raids such as these were disruptive and caused damage, but they were only minor setbacks and demonstrated that the Confederates could cause only momentary disturbances in the area.

Crater at the Third Louisiana Redan

Late in the siege, Union troops tunneled under the 3rd Louisiana Redan and packed the mine with 2,200 pounds of gunpowder. The explosion blew apart the Confederate lines on June 25, while an infantry attack made by troops from Logan's XVII Corps division followed the blast. The 45th Illinois Regiment (known as the "Lead Mine Regiment"), under Col. Jasper A. Maltby, charged into the  diameter,  deep crater with ease, but were stopped by recovering Confederate infantry. The Union soldiers became pinned down and the defenders rolled artillery shells with short fuses into the pit with deadly results. Union engineers worked to set up a casemate in the crater in order to extricate the infantry, and soon the soldiers fell back to a new defensive line. From the crater left by the explosion, Union miners worked to dig a new mine to the south. On July 1, this mine was detonated but no infantry attack followed. Pioneers worked throughout July 2 and 3 to widen the initial crater to be large enough for an infantry column of four to pass through for any future assault. However, events the following day negated the need for any further assaults.

Capture

On July 3, Pemberton sent a note to Grant regarding the possibility of negotiations for peace. Grant, as he had done at Fort Donelson, first demanded unconditional surrender. He then reconsidered, not wanting to feed 30,000 Confederates in Union prison camps, and offered to parole all prisoners. Considering their destitute and starving state, he never expected them to fight again; he hoped they would carry home the stigma of defeat to the rest of the Confederacy. In any event, shipping that many prisoners north would have occupied his army and taken months. Pemberton officially surrendered his army on July 4. Most of the men who were paroled on July 6 were exchanged and received back into the Confederate Army on August 4, 1863, at Mobile Harbor, Alabama. They were back in Chattanooga, Tennessee, by September and some fought in the Battles for Chattanooga in November and against Sherman's invasion of Georgia in May 1864. The Confederate government protested the validity of the paroles on technical grounds and the issue was referred to Grant who, in April 1864, was general in chief of the army. The dispute effectively ended all further prisoner exchanges during the war except for hardship cases. When the captured 26th, 27th, 29th, and 31st Louisiana Infantry Regiments were exchanged in 1863 and 1864, many of the paroled soldiers failed to report for duty and remained at their homes. Those Louisianans who returned to active duty were never again used in combat.

Surrender was formalized by an old oak tree, "made historical by the event". In his Personal Memoirs, Grant described the fate of this luckless tree:

The surrender was finalized on July 4, Independence Day, a day Pemberton had hoped would bring more sympathetic terms from the United States. Although the Vicksburg campaign continued with some minor actions, the fortress city had fallen and, with the surrender of Port Hudson on July 9, the Mississippi River was firmly in Union hands and the Confederacy split in two. President Lincoln famously announced, "The Father of Waters again goes unvexed to the sea."

Union casualties for the battle and siege of Vicksburg were 4,835; Confederate were 32,697, of whom 29,495 had surrendered. The full campaign, since March 29, claimed 10,142 Union and 9,091 Confederate killed and wounded. In addition to the men under his command, Pemberton turned over to Grant 172 cannons and 50,000 rifles.

Aftermath

Vicksburg was the last major Confederate stronghold on the Mississippi River; therefore, capturing it completed the second part of the Northern strategy, the Anaconda Plan. The successful ending of the Vicksburg campaign significantly degraded the ability of the Confederacy to maintain its war effort. This action, combined with the surrender of Port Hudson to Maj. Gen. Nathaniel P. Banks on July 9, yielded command of the Mississippi River to the Union forces, who would hold it for the rest of the conflict.

The Confederate surrender on July 4, 1863, is sometimes considered, when combined with Gen. Robert E. Lee's July 3 defeat at Gettysburg by Maj. Gen. George Meade, the turning point of the war. It cut off the states of Arkansas, Louisiana, and Texas from the rest of the Confederate States, effectively splitting the Confederacy in two for the duration of the war. The Union victory also permanently severed communication between the Trans-Mississippi Department and the balance of the Confederacy.

Folk tradition holds that the Fourth of July (Independence Day) holiday was not celebrated by Vicksburg until World War II. This claim is inaccurate, for large Independence Day celebrations were held as early as 1907.

Battlefield preservation
The works around Vicksburg are now maintained by the National Park Service as part of Vicksburg National Military Park. The park, located in Vicksburg, Mississippi, and Delta, Louisiana (flanking the Mississippi River), also commemorates the greater Vicksburg campaign which led up to the battle and includes reconstructed forts and trenches. The park includes 1,325 historic monuments and markers,  of historic trenches and earthworks, a  tour road, a  walking trail, two antebellum homes, 144 emplaced cannons, the restored gunboat USS Cairo (sunk on December 12, 1862, on the Yazoo River), and the Grant's Canal site, where the Union Army attempted to build a canal to let their ships bypass Confederate artillery fire.

The American Battlefield Trust and its partners have acquired and preserved  of the Vicksburg battlefield through 2021.

See also

Troop engagements of the American Civil War, 1863
List of costliest American Civil War land battles
Commemoration of the American Civil War
Commemoration of the American Civil War on postage stamps
Armies in the American Civil War
Mississippi River in the American Civil War

Notes

References

Ballard, Michael B. Vicksburg, The Campaign that Opened the Mississippi. Chapel Hill: University of North Carolina Press, 2004. .
Bearss, Edwin C. The Campaign for Vicksburg. 3 vols. Dayton, OH: Morningside House, 1985. .
Catton, Bruce. The Centennial History of the Civil War. Vol. 3, Never Call Retreat. Garden City, NY: Doubleday, 1965. .
Eicher, David J. The Longest Night: A Military History of the Civil War. New York: Simon & Schuster, 2001. .
Esposito, Vincent J. West Point Atlas of American Wars. New York: Frederick A. Praeger, 1959. . The collection of maps (without explanatory text) is available online at the West Point website.
Foote, Shelby. The Civil War: A Narrative. Vol. 2, Fredericksburg to Meridian. New York: Random House, 1958. .
Gabel, Christopher R., Staff ride handbook for the Vicksburg Campaign, December 1862 – July 1863.  Fort Leavenworth, Kan.: Combat Studies Institute Press, 2001. .
Grabau, Warren E. Ninety-Eighty Days: A Geographer's View of the Vicksburg Campaign. Knoxville: University of Tennessee Press, 2000. .

Kennedy, Frances H., ed. The Civil War Battlefield Guide . 2nd ed. Boston: Houghton Mifflin Co., 1998. .
Korn, Jerry, and the Editors of Time-Life Books. War on the Mississippi: Grant's Vicksburg Campaign. Alexandria, VA: Time-Life Books, 1985. .
McPherson, James M. Battle Cry of Freedom: The Civil War Era. Oxford History of the United States. New York: Oxford University Press, 1988. .
 Silkenat, David. Raising the White Flag: How Surrender Defined the American Civil War. Chapel Hill: University of North Carolina Press, 2019. .
Smith, Jean Edward. Grant. New York: Simon & Schuster, 2001. .
Simon, John Y., ed. The Papers of Ulysses S. Grant. Vol. 8, April 1 – July 6, 1863. Carbondale: Southern Illinois University Press, 1979. .
National Park Service battle description
CWSAC Report Update
Various resources from the University Libraries Division of Special Collections, The University of Alabama.
U.S. War Department, The War of the Rebellion: a Compilation of the Official Records of the Union and Confederate Armies. Washington, DC: U.S. Government Printing Office, 1880–1901.

Further reading

Ballard, Michael B. Grant at Vicksburg: The General and the Siege. Carbondale, IL: Southern Illinois University Press, 2013. .
Bearss, Edwin C. Receding Tide: Vicksburg and Gettysburg: The Campaigns That Changed the Civil War. Washington, DC: National Geographic Society, 2010. .

Groom, Winston. Vicksburg, 1863. New York: Knopf, 2009. .

Shea, William L. and Terrence J. Winschel. Vicksburg is the Key: The Struggle for the Mississippi River. Lincoln, NE: University of Nebraska Press, 2003. .

Winschel, Terrence J. Triumph & Defeat: The Vicksburg Campaign. Campbell, CA: Savas Publishing Company, 1999. .
Winschel, Terrence J. Triumph & Defeat: The Vicksburg Campaign, Vol. 2. New York: Savas Beatie, 2006. .
Winschel, Terrence J. Vicksburg: Fall of the Confederate Gibraltar. Abilene, TX: McWhiney Foundation Press, 1999. .
Woodworth, Steven E.ed. Grant's Lieutenants: From Cairo to Vicksburg. Lawrence: University Press of Kansas, 2001. .
Woodworth, Steven E. Jefferson Davis and His Generals: The Failure of Confederate Command in the West. Lawrence: University Press of Kansas, 1990. .
Woodworth, Steven E. Nothing but Victory: The Army of the Tennessee, 1861–1865. New York: Alfred A. Knopf, 2005. .

External links

Vicksburg Campaign animated map  (Civil War Trust)
Vicksburg Virtual Museum Exhibit, National Park Service
Animated map of the siege of Vicksburg  (Civil War Trust)
C-SPAN American History TV Tour of Vicksburg National Military Park

Vicksburg, Siege of
Vicksburg
Vicksburg
Siege
Siege
Vicksburg
Vicksburg
Vicksburg
Vicksburg
Vicksburg
Vicksburg
Siege
Battles commanded by Ulysses S. Grant

redpajama_set_name: RedPajamaWikipedia


I had been through lots of pain and heartbreak in terms of love life and Family life. My parents got separated when I was still in my mothers tummy so I never knew who is my father til now. My mom has her new family now coz she got married nad had another kids. I was raised by my grandparents whom I have known as my real Mom and Dad. My life is full of Drama but I kept on giving myself with positives aspects in life. My dream is to meet the one for me and have my own family. To have kids and raised them together with my future Hubby. I dont want my future kids to experience what I have been through, not having a complete family.
I would love to meet that serious man, I can take care of and love for. and someone I can spend my whole life with. I will always pray for that someone. Hope to meet him here.
God bless and thank you for reading!
Vanessa is not available for a video chat at this time. Please try to send a request again after an hour.
You cannot start a live video chat with Vanessa because you are both FREE members.


Enchanted Park Jacksonville Real Estate. Homes for You. By analyzing information on thousands of single family homes for sale in Enchanted Park, Florida and across the United States, we calculate home They include pre-foreclosures, foreclosed homes and homes with a Make Me Move® price.


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sistemapagoimpuestos.Expert;

import exceptions.Excepciones;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;

import sistemapagoimpuestos.Dto.DTOTipoImpuesto;
import sistemapagoimpuestos.Dto.DTOCriterio;
import sistemapagoimpuestos.Entity.TipoImpuesto;
import sistemapagoimpuestos.Decorators.DecoradorGestionarEmpresaTipoImpuesto;
import sistemapagoimpuestos.Dto.DTOEmpresa;
import sistemapagoimpuestos.Dto.DTOItem;
import sistemapagoimpuestos.Dto.DTOTipoEmpresa;
import sistemapagoimpuestos.Entity.Empresa;
import sistemapagoimpuestos.Entity.EmpresaTipoImpuesto;
import sistemapagoimpuestos.Entity.Item;
import sistemapagoimpuestos.Entity.ItemEmpresaTipoImpuesto;
import sistemapagoimpuestos.Entity.TipoEmpresa;
import sistemapagoimpuestos.Entity.TipoUsuario;
import sistemapagoimpuestos.Entity.Usuario;
import sistemapagoimpuestos.Utils.FachadaPersistencia;
import sistemapagoimpuestos.Utils.Utils;
import sistemapagoimpuestos.Dto.DtoItemOrden;
import static sistemapagoimpuestos.Utils.Utils.existeDato;

public class ExpertoGestionarEmpresaTipoImpuesto {

    Usuario usuario = new Usuario();
    TipoUsuario admin = new TipoUsuario(0, "Administrador", null);
    TipoUsuario user = new TipoUsuario(1, "Usuario", null);

    public ExpertoGestionarEmpresaTipoImpuesto() {
        usuario.setTipoUsuario(admin);
    }

    // Metodo iniciar
    public List<DTOTipoImpuesto> iniciar(){
        List <DTOTipoImpuesto> lista = new ArrayList<>();
        if(usuario.getTipoUsuario().getNombreTipoUsuario() == "Administrador"){
            List<DTOCriterio> criterioFecha = new ArrayList();
            criterioFecha.add(new DTOCriterio("fechaHoraInhabilitacionTipoImpuesto", "IS", null));
            List tipoImpuestos = FachadaPersistencia.getInstance().buscar("TipoImpuesto", criterioFecha);

            DTOTipoImpuesto dTOTipoImpuesto;

            for (int i = 0; i < tipoImpuestos.size(); i++) {
                dTOTipoImpuesto = new DTOTipoImpuesto();
                TipoImpuesto tipoImpuesto = (TipoImpuesto)tipoImpuestos.get(i);
                String nombreTipoImpuesto = tipoImpuesto.getNombreTipoImpuesto();
                dTOTipoImpuesto.setNombreDTOTipoImpuesto(nombreTipoImpuesto);
                lista.add(dTOTipoImpuesto);
            }
        }
        else{
            System.out.println("No es posible");
        }

        return lista;
    }

    public List<DTOEmpresa> buscarEmpresas() {

        //Busqueda de Empresas habilitadas
        List<DTOCriterio> criterioEmpresa = new ArrayList();
        criterioEmpresa.add(new DTOCriterio("fechaHoraInhabilitacionEmpresa", "IS", null));
        List empresas = FachadaPersistencia.getInstance().buscar("Empresa", criterioEmpresa);

        List <DTOEmpresa> lista = new ArrayList<>();
        DTOEmpresa dtoEmpresa;

        for (int i = 0; i < empresas.size(); i++) {
            dtoEmpresa = new DTOEmpresa();
            Empresa empresa = (Empresa) empresas.get(i);
            String nombreEmpresa = empresa.getNombreEmpresa();
            dtoEmpresa.setNombreEmpresa(nombreEmpresa);
            lista.add(dtoEmpresa);
        }
        return lista;
    }

    public List ingresarDatosETI(String nombreTipoImpuesto, String nombreEmpresa){

        //Busca instancia de TipoImpuesto
        TipoImpuesto tipoImpuesto = new TipoImpuesto();
        Empresa empresa = new Empresa();
        try{
        List<DTOCriterio> criterioTipoImpuesto = new ArrayList();
        criterioTipoImpuesto.add(new DTOCriterio("nombreTipoImpuesto", "=", nombreTipoImpuesto));
        criterioTipoImpuesto.add(new DTOCriterio("fechaHoraInhabilitacionTipoImpuesto", "IS", null));
        List ti = FachadaPersistencia.getInstance().buscar("TipoImpuesto", criterioTipoImpuesto);
        tipoImpuesto = (TipoImpuesto) ti.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Tipo de Impuesto");
        }
        try{
        //Busca instancia de Empresa
        List<DTOCriterio> criterioEmpresa = new ArrayList();
        criterioEmpresa.add(new DTOCriterio("nombreEmpresa", "=", nombreEmpresa));
        List e = FachadaPersistencia.getInstance().buscar("Empresa", criterioEmpresa);
        empresa = (Empresa) e.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Empresa");
        }

        //Busca instancia de EmpresaTipoImpuesto, aplicando la empresa y tipoImpuesto como criterio
        List<DTOCriterio> criterioEmpresaTipoImpuesto = new ArrayList();
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("empresa", "=", empresa));
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("tipoImpuesto", "=", tipoImpuesto));
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("fechaHoraInhabilitacionEmpresaTipoImpuesto", "IS", null));
        List eti = FachadaPersistencia.getInstance().buscar("EmpresaTipoImpuesto", criterioEmpresaTipoImpuesto);

        return eti;
    }

    public void modificarItem(String nombreItem,String cuitEmpresa,int codigoTipoImpuesto,String nombreTipoEmpresa, int orden, int ordenAnterior){

        TipoImpuesto tipoImpuesto = new TipoImpuesto();
        Empresa empresa = new Empresa();
        TipoEmpresa tipoEmpresa = new TipoEmpresa();
        Item item = new Item();
        EmpresaTipoImpuesto empresaTipoImpuesto = new EmpresaTipoImpuesto();

        try{
        //Busca instancia de TipoImpuesto
        List<DTOCriterio> criterioTipoImpuesto = new ArrayList();
        criterioTipoImpuesto.add(new DTOCriterio("codigoTipoImpuesto", "=", codigoTipoImpuesto));
        criterioTipoImpuesto.add(new DTOCriterio("fechaHoraInhabilitacionTipoImpuesto", "IS", null));
        List ti = FachadaPersistencia.getInstance().buscar("TipoImpuesto", criterioTipoImpuesto);
        tipoImpuesto = (TipoImpuesto) ti.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Tipo de Impuesto");
        }

        try{
        //Busca instancia de Empresa
        List<DTOCriterio> criterioEmpresa = new ArrayList();
        criterioEmpresa.add(new DTOCriterio("cuitEmpresa", "=", cuitEmpresa));
        List e = FachadaPersistencia.getInstance().buscar("Empresa", criterioEmpresa);
        empresa = (Empresa) e.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Empresa");
        }

        try{
        //Busca instancia de TipoEmpresa
        List<DTOCriterio> criterioTipoEmpresa = new ArrayList();
        criterioTipoEmpresa.add(new DTOCriterio("nombreTipoEmpresa", "=", nombreTipoEmpresa));
        List tE = FachadaPersistencia.getInstance().buscar("TipoEmpresa", criterioTipoEmpresa);
        tipoEmpresa = (TipoEmpresa) tE.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Tipo de Empresa");
        }

        try{
        // Busco Item
        List<DTOCriterio> criterioItem = new ArrayList();
        criterioItem.add(new DTOCriterio("nombreItem", "=", nombreItem));
        criterioItem.add(new DTOCriterio("fechaHoraInhabilitacionItem", "IS", null));
        List i = FachadaPersistencia.getInstance().buscar("Item", criterioItem);
        item = (Item) i.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Item");
        }

        try{
        // Busco EmpresaTipoImpuesto
        List<DTOCriterio> criterioEmpresaTipoImpuesto = new ArrayList();
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("empresa", "=", empresa));
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("tipoEmpresa", "=", tipoEmpresa));
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("tipoImpuesto", "=", tipoImpuesto));
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("fechaHoraInhabilitacionEmpresaTipoImpuesto", "IS", null));
        empresaTipoImpuesto = (EmpresaTipoImpuesto) FachadaPersistencia.getInstance().buscar("EmpresaTipoImpuesto", criterioEmpresaTipoImpuesto).get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Empresa Tipo Impuesto");
        }

        List<DTOCriterio> criterioItemEmpresaTipoImpuesto = new ArrayList();
        criterioItemEmpresaTipoImpuesto.add(new DTOCriterio("item", "=", item));
        criterioItemEmpresaTipoImpuesto.add(new DTOCriterio("ordenItemEmpresaTipoImpuesto", "=", ordenAnterior));
        criterioItemEmpresaTipoImpuesto.add(new DTOCriterio("empresaTipoImpuesto", "=", empresaTipoImpuesto));
        ItemEmpresaTipoImpuesto itemEmpresaTipoImpuesto = (ItemEmpresaTipoImpuesto) FachadaPersistencia.getInstance().buscar("ItemEmpresaTipoImpuesto", criterioItemEmpresaTipoImpuesto).get(0);

        List<DTOCriterio> criteriosItem = new ArrayList<>();
        criteriosItem.add(new DTOCriterio("ordenItemEmpresaTipoImpuesto", "=", orden));
        criteriosItem.add(new DTOCriterio("item", "=", item));
        criteriosItem.add(new DTOCriterio("fechaInhabilitacionItemEmpresaTipoImpuesto", "IS", null));
        if(!existeDato("ItemEmpresaTipoImpuesto", criteriosItem)){

        itemEmpresaTipoImpuesto.setOrdenItemEmpresaTipoImpuesto(orden);
        FachadaPersistencia.getInstance().guardar(itemEmpresaTipoImpuesto);

            System.out.println("Item modificado exitosamente");
        }else{
                Excepciones.getInstance().objetoExistente("Orden ingresado");
            }

    }

    // Método para recueprar los tipos de empresas
    public List<DTOTipoEmpresa> obtenerTipoEmpresas(){
        // Busco Tipos de empresas
        List<Object> listObject =  FachadaPersistencia.getInstance().buscar("TipoEmpresa", null);
        ArrayList<DTOTipoEmpresa> listDTOTipoEmpresa = new ArrayList<DTOTipoEmpresa>();
        for(Object obj : listObject){
            TipoEmpresa tipoEmpresa = (TipoEmpresa) obj;
            DTOTipoEmpresa dtoTipoEmpresa = new DTOTipoEmpresa();
            dtoTipoEmpresa.setNombreTipoEmpresa(tipoEmpresa.getNombreTipoEmpresa());
            listDTOTipoEmpresa.add(dtoTipoEmpresa);
        }
        return listDTOTipoEmpresa;
    }

        // Método para crear un ETI
    public void nuevoEmpresaTipoImpuesto(String cuitEmpresa, String nombreTipoImpuesto, String nombreTipoEmpresa, int frecuencia){
        Empresa empresa = new Empresa();
        TipoImpuesto tipoImpuesto = new TipoImpuesto();
        TipoEmpresa tipoEmpresa = new TipoEmpresa();
        EmpresaTipoImpuesto empresaTipoImpuesto = new EmpresaTipoImpuesto();

        try{
        List<DTOCriterio> criterioTipoImpuesto = new ArrayList();
        criterioTipoImpuesto.add(new DTOCriterio("nombreTipoImpuesto", "=", nombreTipoImpuesto));
        criterioTipoImpuesto.add(new DTOCriterio("fechaHoraInhabilitacionTipoImpuesto", "IS", null));
        List ti = FachadaPersistencia.getInstance().buscar("TipoImpuesto", criterioTipoImpuesto);
        tipoImpuesto = (TipoImpuesto) ti.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Tipo de Impuesto");
        }

        try{
        //Busca instancia de Empresa
        List<DTOCriterio> criterioEmpresa = new ArrayList();
        criterioEmpresa.add(new DTOCriterio("cuitEmpresa", "=", cuitEmpresa));
        List e = FachadaPersistencia.getInstance().buscar("Empresa", criterioEmpresa);
        empresa = (Empresa) e.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Empresa");
        }

        try{
        //Busca instancia de TipoEmpresa
        List<DTOCriterio> criterioTipoEmpresa = new ArrayList();
        criterioTipoEmpresa.add(new DTOCriterio("nombreTipoEmpresa", "=", nombreTipoEmpresa));
        criterioTipoEmpresa.add(new DTOCriterio("fechaInhabilitacionTipoEmpresa", "IS", null));
        List tE = FachadaPersistencia.getInstance().buscar("TipoEmpresa", criterioTipoEmpresa);
        tipoEmpresa = (TipoEmpresa) tE.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Tipo de Empresa");
        }

        List<DTOCriterio> criteriosEmpresaTipoImpuesto = new ArrayList<>();
        criteriosEmpresaTipoImpuesto.add(new DTOCriterio("empresa", "=", empresa));
        criteriosEmpresaTipoImpuesto.add(new DTOCriterio("tipoEmpresa", "=", tipoEmpresa));
        criteriosEmpresaTipoImpuesto.add(new DTOCriterio("tipoImpuesto", "=", tipoImpuesto));
        criteriosEmpresaTipoImpuesto.add(new DTOCriterio("fechaHoraInhabilitacionEmpresaTipoImpuesto", "IS", null));

    if(!existeDato("EmpresaTipoImpuesto", criteriosEmpresaTipoImpuesto)){
       // Creo la Empresa TipoImpuesto
        empresaTipoImpuesto.setFechaHoraAltaEmpresaTipoImpuesto(new Date());
        empresaTipoImpuesto.setEmpresa(empresa);
        empresaTipoImpuesto.setTipoImpuesto(tipoImpuesto);
        empresaTipoImpuesto.setTipoEmpresa(tipoEmpresa);
        empresaTipoImpuesto.setFrecuenciaLiquidacionEmpresaTipoImpuesto(frecuencia);
        FachadaPersistencia.getInstance().guardar(empresaTipoImpuesto);
        System.out.println("Tipo de Impuesto creado y vinculado a Empresa y Tipo de Empresa");
    }else{
            Excepciones.getInstance().objetoLaExistente("combinacion de Empresa, Tipo de Impuesto y Tipo de Empresa");
        }

}

    // Recuperar Items
    public ArrayList<DtoItemOrden> obtenerItems(String cuitEmpresa, int codigoTipoImpuesto, String nombreTE){

        Empresa empresa = new Empresa();
        TipoImpuesto tipoImpuesto = new TipoImpuesto();
        TipoEmpresa tipoEmpresa = new TipoEmpresa();
        EmpresaTipoImpuesto empresaTipoImpuesto = new EmpresaTipoImpuesto();

        try{
        List<DTOCriterio> criterioTipoImpuesto = new ArrayList();
        criterioTipoImpuesto.add(new DTOCriterio("codigoTipoImpuesto", "=", codigoTipoImpuesto));
        criterioTipoImpuesto.add(new DTOCriterio("fechaHoraInhabilitacionTipoImpuesto", "IS", null));
        List ti = FachadaPersistencia.getInstance().buscar("TipoImpuesto", criterioTipoImpuesto);
        tipoImpuesto = (TipoImpuesto) ti.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Tipo de Impuesto");
        }

        try{
        //Busca instancia de Empresa
        List<DTOCriterio> criterioEmpresa = new ArrayList();
        criterioEmpresa.add(new DTOCriterio("cuitEmpresa", "=", cuitEmpresa));
        List e = FachadaPersistencia.getInstance().buscar("Empresa", criterioEmpresa);
        empresa = (Empresa) e.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Empresa");
        }

        try{
        //Busca instancia de TipoEmpresa
        List<DTOCriterio> criterioTipoEmpresa = new ArrayList();
        criterioTipoEmpresa.add(new DTOCriterio("nombreTipoEmpresa", "=", nombreTE));
        criterioTipoEmpresa.add(new DTOCriterio("fechaInhabilitacionTipoEmpresa", "IS", null));
        List tE = FachadaPersistencia.getInstance().buscar("TipoEmpresa", criterioTipoEmpresa);
        tipoEmpresa = (TipoEmpresa) tE.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Tipo de Empresa");
        }

        try{
        //Busca instancia de EmpresaTipoImpuesto, aplicando la empresa y tipoImpuesto como criterio
        List<DTOCriterio> criterioEmpresaTipoImpuesto = new ArrayList();
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("empresa", "=", empresa));
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("tipoEmpresa", "=", tipoEmpresa));
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("tipoImpuesto", "=", tipoImpuesto));
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("fechaHoraInhabilitacionEmpresaTipoImpuesto", "IS", null));
        empresaTipoImpuesto = (EmpresaTipoImpuesto) FachadaPersistencia.getInstance().buscar("EmpresaTipoImpuesto", criterioEmpresaTipoImpuesto).get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Empresa Tipo Impuesto");
        }

        // Busca instancia de ItemEmpresaTipoImpuesto utilizando la empresatipoimpuesto
        List<DTOCriterio> criterioItemETI = new ArrayList();
        criterioItemETI.add(new DTOCriterio("empresaTipoImpuesto", "=", empresaTipoImpuesto));
        criterioItemETI.add(new DTOCriterio("fechaInhabilitacionItemEmpresaTipoImpuesto", "IS", null));
        List<Object> listObject =  FachadaPersistencia.getInstance().buscar("ItemEmpresaTipoImpuesto", criterioItemETI);
        ArrayList<DtoItemOrden> listDTOItem = new ArrayList<DtoItemOrden>();

        for(Object obj : listObject){
            ItemEmpresaTipoImpuesto itemETI = (ItemEmpresaTipoImpuesto) obj;
            Item item = itemETI.getItem();
            DtoItemOrden dtoItem = new DtoItemOrden();
            dtoItem.setNombreItem(item.getNombreItem());
            dtoItem.setOrden(itemETI.getOrdenItemEmpresaTipoImpuesto());
            listDTOItem.add(dtoItem);
        }

        return listDTOItem;
    }

    // Método para recueprar los items
    public List<DTOItem> obtenerTodosItems(){
        // Busco Items
        List<DTOCriterio> criterioItem = new ArrayList();
        criterioItem.add(new DTOCriterio("fechaHoraInhabilitacionItem", "IS", null));
        List<Object> listObject =  FachadaPersistencia.getInstance().buscar("Item", criterioItem);
        ArrayList<DTOItem> listDTOItem = new ArrayList<DTOItem>();
        for(Object obj : listObject){
            Item item = (Item) obj;
            DTOItem dtoItem = new DTOItem();
            dtoItem.setNombreItem(item.getNombreItem());
            listDTOItem.add(dtoItem);
        }
        return listDTOItem;
    }

    public void agregarItem(String nombreItem, String cuitEmpresa, int codigoTipoImpuesto, String nombreTE, int orden){
        Empresa empresa = new Empresa();
        TipoImpuesto tipoImpuesto = new TipoImpuesto();
        TipoEmpresa tipoEmpresa = new TipoEmpresa();
        EmpresaTipoImpuesto empresaTipoImpuesto = new EmpresaTipoImpuesto();
        Item item = new Item();

        try{
        List<DTOCriterio> criterioTipoImpuesto = new ArrayList();
        criterioTipoImpuesto.add(new DTOCriterio("codigoTipoImpuesto", "=", codigoTipoImpuesto));
        criterioTipoImpuesto.add(new DTOCriterio("fechaHoraInhabilitacionTipoImpuesto", "IS", null));
        List ti = FachadaPersistencia.getInstance().buscar("TipoImpuesto", criterioTipoImpuesto);
        tipoImpuesto = (TipoImpuesto) ti.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Tipo de Impuesto");
        }

        try{
        //Busca instancia de Empresa
        List<DTOCriterio> criterioEmpresa = new ArrayList();
        criterioEmpresa.add(new DTOCriterio("cuitEmpresa", "=", cuitEmpresa));
        List e = FachadaPersistencia.getInstance().buscar("Empresa", criterioEmpresa);
        empresa = (Empresa) e.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Empresa");
        }

        try{
        //Busca instancia de TipoEmpresa
        List<DTOCriterio> criterioTipoEmpresa = new ArrayList();
        criterioTipoEmpresa.add(new DTOCriterio("nombreTipoEmpresa", "=", nombreTE));
        criterioTipoEmpresa.add(new DTOCriterio("fechaInhabilitacionTipoEmpresa", "IS", null));
        List tE = FachadaPersistencia.getInstance().buscar("TipoEmpresa", criterioTipoEmpresa);
        tipoEmpresa = (TipoEmpresa) tE.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Tipo de Empresa");
        }

        try{
        //Busca instancia de EmpresaTipoImpuesto, aplicando la empresa y tipoImpuesto como criterio
        List<DTOCriterio> criterioEmpresaTipoImpuesto = new ArrayList();
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("empresa", "=", empresa));
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("tipoEmpresa", "=", tipoEmpresa));
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("tipoImpuesto", "=", tipoImpuesto));
        criterioEmpresaTipoImpuesto.add(new DTOCriterio("fechaHoraInhabilitacionEmpresaTipoImpuesto", "IS", null));
        empresaTipoImpuesto = (EmpresaTipoImpuesto) FachadaPersistencia.getInstance().buscar("EmpresaTipoImpuesto", criterioEmpresaTipoImpuesto).get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Empresa Tipo Impuesto");
        }

        try{
        // Busco Item
        List<DTOCriterio> criterioItem = new ArrayList();
        criterioItem.add(new DTOCriterio("nombreItem", "=", nombreItem));
        List i = FachadaPersistencia.getInstance().buscar("Item", criterioItem);
        item = (Item) i.get(0);
        } catch (IndexOutOfBoundsException exception) {
            Excepciones.getInstance().objetoNoExistente("Item");
        }

        List<DTOCriterio> criteriosItem = new ArrayList<>();

        criteriosItem.add(new DTOCriterio("item", "=", item));
        criteriosItem.add(new DTOCriterio("fechaInhabilitacionItemEmpresaTipoImpuesto", "IS", null));
        criteriosItem.add(new DTOCriterio("empresaTipoImpuesto", "=", empresaTipoImpuesto));
        if(!existeDato("ItemEmpresaTipoImpuesto", criteriosItem)){

            List<DTOCriterio> criteriosItem2 = new ArrayList<>();
            criteriosItem2.add(new DTOCriterio("empresaTipoImpuesto", "=", empresaTipoImpuesto));
            criteriosItem2.add(new DTOCriterio("fechaInhabilitacionItemEmpresaTipoImpuesto", "IS", null));
            criteriosItem2.add(new DTOCriterio("ordenItemEmpresaTipoImpuesto", "=", orden));
            if(!existeDato("ItemEmpresaTipoImpuesto", criteriosItem2)){
                ItemEmpresaTipoImpuesto itemETI = new ItemEmpresaTipoImpuesto();
                itemETI.setEmpresaTipoImpuesto(empresaTipoImpuesto);
                itemETI.setItem(item);
                itemETI.setOrdenItemEmpresaTipoImpuesto(orden);
                FachadaPersistencia.getInstance().guardar(itemETI);

                System.out.println("Item vinculado exitosamente");
            }else{
                Excepciones.getInstance().objetoExistente("Orden ingresado");
            }
        }else{
                Excepciones.getInstance().objetoExistente("Item ingresado");
        }
    }
}

redpajama_set_name: RedPajamaGithub


Use only for its intended purposes. Do not overheat in the microwave or heat without water. Wash with care. Do not use abrasive cleansers or steel wool. Sudden temperature change may break or shatter the product. While the glass is hot, do not pour cold liquids into it and do not place it on a wet cloth or a wet surface. Be careful when drinking hot drinks. Even if the cup surface is cool, the drink may still be hot. Do not add ice with force as it may break the glass from the inside. Product size and shape varies in each item due to manufacturing process.
KRONOS makes drinks look like they are floating in air with a double wall structure. The ring supports your fingers for easy gripping, and the cup has an ideal angle for drinking.


text:
Q: asyncio task was destroyed but it is pending I am working a sample program that reads from a datasource (csv or rdbms) in chunks, makes some transformation and sends it via socket to a server.
But because the csv is very large, for testing purpose I want to break the reading after few chunks.
Unfortunately something goes wrong and I do not know what and how to fix it. Probably I have to do some cancellation, but now sure where and how. I get the following error:
Task was destroyed but it is pending!
task: <Task pending coro=<<async_generator_athrow without __name__>()>>

The sample code is:
import asyncio
import json

async def readChunks():
  # this is basically a dummy alternative for reading csv in chunks
  df = [{"chunk_" + str(x) : [r for r in range(10)]} for x in range(10)]
  for chunk in df:
    await asyncio.sleep(0.001)
    yield chunk

async def send(row):
    j = json.dumps(row)
    print(f"to be sent: {j}")
    await asyncio.sleep(0.001)

async def main():
    i = 0
    async for chunk in readChunks():
        for k, v in chunk.items():
            await asyncio.gather(send({k:v}))
        i += 1
        if i > 5:
            break
        #print(f"item in main via async generator is {chunk}")

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

A: Many async resources, such as generators, need to be cleaned up with the help of an event loop. When an async for loop stops iterating an async generator via break, the generator is cleaned up by the garbage collector only. This means the task is pending (waits for the event loop) but gets destroyed (by the garbage collector).
The most straightforward fix is to aclose the generator explicitly:
async def main():
    i = 0
    aiter = readChunks()      # name iterator in order to ...
    try:
        async for chunk in aiter:
            ...
            i += 1
            if i > 5:
                break
    finally:
        await aiter.aclose()  # ... clean it up when done

These patterns can be simplified using the asyncstdlib (disclaimer: I maintain this library). asyncstdlib.islice allows to take a fixed number of items before cleanly closing the generator:
import asyncstdlib as a

async def main():
    async for chunk in a.islice(readChunks(), 5):
        ...

If the break condition is dynamic, scoping the iterator guarantees cleanup in any case:
import asyncstdlib as a

async def main():
    async with a.scoped_iter(readChunks()) as aiter:
        async for idx, chunk in a.enumerate(aiter):
            ...
            if idx >= 5:
                break

A: This works...
import asyncio
import json
import logging

logging.basicConfig(format='%(asctime)s.%(msecs)03d %(message)s',
                    datefmt='%S')
root = logging.getLogger()
root.setLevel(logging.INFO)

async def readChunks():
  # this is basically a dummy alternative for reading csv in chunks
  df = [{"chunk_" + str(x) : [r for r in range(10)]} for x in range(10)]
  for chunk in df:
    await asyncio.sleep(0.002)
    root.info('readChunks: next chunk coming')
    yield chunk

async def send(row):
    j = json.dumps(row)
    root.info(f"to be sent: {j}")
    await asyncio.sleep(0.002)

async def main():
    i = 0
    root.info('main: starting to read chunks')
    async for chunk in readChunks():
        for k, v in chunk.items():
            root.info(f'main: sending an item')
            #await asyncio.gather(send({k:v}))
            stuff = await send({k:v})
        i += 1
        if i > 5:
            break
        #print(f"item in main via async generator is {chunk}")

##loop = asyncio.get_event_loop()
##loop.run_until_complete(main())
##loop.close()

if __name__ == '__main__':

    asyncio.run(main())

... At least it runs and finishes.

The issue with stopping an async generator by reaking out of an async for loop is described in bugs.python.org/issue38013 and looks like it was fixed in 3.7.5.
However, using
loop = asyncio.get_event_loop()
loop.set_debug(True)
loop.run_until_complete(main())
loop.close()

I get a debug error but no Exception in Python 3.8.
Task was destroyed but it is pending!
task: <Task pending name='Task-8' coro=<<async_generator_athrow without __name__>()>>

Using the higher level API asyncio.run(main()) with debugging ON I do not get the debug message. If you are going to try and upgrade to Python 3.7.5-9 you probably should still use asyncio.run().

A: The problem  is simple. You do early exit from loop, but async generator is not exhausted yet(its pending):
...
if i > 5:
    break
...

A: Your readChunks is running in async and your loop. and without completing the program you are breaking it.
That's why it gives asyncio task was destroyed but it is pending
In short async task was doing its work in the background but you killed it by breaking the loop (stopping the program).

redpajama_set_name: RedPajamaStackExchange


Yesterday, our son officially turned a year old!
It's been one beautiful journey, with little bumps here and there for me (mostly breastfeeding-related), but really, it's been the most wonderful year for me and my husband so far, obviously because our little one is finally in it!
We were never big on parties, so even though thoughts of a big party to celebrate crossed our minds, our wish for an intimate and intentional celebration won in the end. We wanted to celebrate him, his one year here with us. We wanted to celebrate the child, and celebrating him did not need a big party.
So, on the day of his birth, we tried to make it as familiar as possible to him, with bits and pieces of special touches.
We started the day by waking up at 06:42 AM, his birth hour. Although we were all still up at 12:00 midnight that day (he was miraculously up, as if he knew it was his special day), we did not celebrate just yet. We wanted to celebrate on his official hour.
Do you see the little monkey on the tree? P was born on the Year of the Monkey.
Well, 06:42 AM came, and it was only me and the hubby up. P was in deep sleep. We decided not to wake him up and possibly put him in a bad mood. I just made sure his birthday candle and table were setup for when he wakes up. My husband and I went back to sleep.
We woke up when his cake arrived, and so did P. We first gathered around the table in our jammies and told him his birthday story. Then we went down to checkout his cake.
It turned out it was my friend who delivered the cake herself, Nikki. She did the cake for one of my baby showers, so I ordered again for Pthis time.
I wanted a cake that my son could eat – with sugar, yes, but not too much that we'd have to keep stopping him in case he liked the taste. So, I looked for a baby-friendly recipe and fortunately found one in a baby recipe book. I gave the recipe to Nikki and asked her to layer it with her buttercream icing. This is what it looked like.
Shortly after Nikki left, another dear friend arrived, Jamie. She is P's godparent, and was in charge of designing P's cake. She went around the garden to look for plants for styling, and also asked for whatever chocolate we had so she could grate it for the "soil effect".
P's Birthday Cake styled by Ninang Jamie using his Animal Planet toys, some twigs and plants, and grated chocolate. We also did the buntings using regular paper, twine, and barbecue sticks. For the final touch, I thought LettergramPH's letters for their letterboard also fit perfectly – and they did!
After a while, P wanted to nurse, so nurse we did. My husband, on the other hand, set up the garden for his movement area.
We went down hoping P could play, but of all days, it was on his birthday that it rained (more blessings, yey!). So, we packed up his movement area while waiting for the rain to stop. When we went upstairs, he fell asleep.
That's when I started wrapping his gifts.
To be honest, we have a loooot of unopened toys and materials that I could have wrapped as presents. But I wanted something that would surely make him happy.
So….I wrapped some of his favorite things! Yes, not new stuff. It doesn't matter to him at this point. I wanted gifts I was sure would light him up!
Crayola Blocks, Flower, Grimms Stacker Bowels, Cat Board Book by, and Toob Travel Toys – coming soon in the Philippines! Watch out for my announcement!
When the rain stopped, we decided to bring him down for a shoot. He was still asleep when we started shooting (Ninang Jamie, a really good photographer, took our photos), but woke up shortly after.
Then, P got in the mood to play in his movement area. We followed his lead.
After moving around, he eventually climbed to me and grabbed my top, a signal for nursing.
So nurse again, we did. Meanwhile, they set up the cake so we could sing Happy Birthday to him. But first, family photo!
Our little family in my side of the family – my sister was in Malaysia for work. My other niece was still at work. The rest of our family are living abroad. His Ninang Jamie was present (she was the one who took the photo), and his Tito Volt passed by but left for work. So P had few but very familiar guests, a setup we all loved.
Then we all gathered around him to sing the Birthday Song. He likes this song because my mom-in-law would always sing it to him starting maybe a month ago. So he was prepared. He gladly listened to us sing it for him.
And then it was time to open his gifts!
I helped him by ripping the first part, then let him rip off the rest. From time to time, he still needed help in unwrapping the boxes completely. But unwrapping gifts is great fine motor skill practice for children, so we just really let him do it as much as possible.
Representation of his real gift. Soon.
When it came to his favorite CAT board book, oh…he didn't want to open more. He just wanted to read it again and again.
First, he took out the toppings one by one. He would give it to me or his Papa.
It was almost dinner, and we scheduled dinner at his grandparents' house (just a few houses away from ours). Lunch was for my side of the family, and dinner was for my husband's side since my mom can't stay for dinner, and many of my in-laws had work till a few hours before dinner.
The best part was…we were able to still use P's smashed cake! We sliced off the uppermost layer and worked with the remaining layers, and used another set of animals so it was a completely different theme!
So, that's it. Daday cooked noodles, my mom brought some food, and we ordered food. Nothing fancy, just all comfort birthday food.
My in-laws also sang Happy Birthday to him, and his cousins helped him blow the cake.
It was a full day, so he was asleep shortly after dinner.
He woke up a few hours after, though, so we were able to spend time with him (just us three) – playing in the bedroom and showering him with hugs and kisses.
What a wonderful day it was. Special but familiar, just how we all wanted it.
Cake – Miss Buttercream by Nikki Valdez (we paid her PHP 2000 for our customized cake, but she did not charge us delivery fee anymore since we're good friends). Our baby cake + her buttercream icing customized combination was a winner! We all loved the cake. In fact, as of writing, Jamie is messaging me that she's craving for the cake. Haha. My brother-in-law said it tastes like the "beach". In a good way. Because of the desiccated coconuts!
Styling – Jamie is a dear friend, so she just did the cake and shoot for P and for us (most of the photos here were taken by her), but she and her partner Love do amazing styling for events. She is also a family/ baby photographer, but she is currently on leave and will resume for that kind of work next year.
Letterboard – Letterboard may be used for everyday, or for any event! Instant decor – even just the letters are so useful. Our friend Rhiza sent us our letterboard!
What a blissful and meaningful first birthday celebration ever I have pictured out. If truth be told, you all celebrated Pablo. Nothing fancy yet it was indeed a true meaning of simple celebration, special and familiar as surrounded by the celebrant's dear loved ones. Happy 1st birthday Pablo cheers to more joyful years ahead. God bless your parents for raising you well.
love it. minimal but not lacking emotions!
Happy Birthday Pablo Where did you get your matching clothes?


text:
Marilyn Monroe Kingsley was coveted on the pageant circuit. Winning Miss California set her up to compete in the Miss America competition this year. Anyone who knew anything about pageant life knew she was going to win it, too. She had the looks, the skills, and the brains.
But was it what Monroe wanted?
She had private dreams of normalcy, family, and living a life she'd only seen on T.V. Dreams she knew she'd never see come to fruition.
At least until a stalker sent her to the Crazy Mountains of Montana and straight into the arms of retired Delta operative Shaw Remington.
Shaw craved a simple life. He was drawn to the quietness of Eagle Rock, Montana, and a life of serving a community long forgotten. He had grand plans to open a ranch for the disabled but guarding some pampered pageant queen was just a favor for his old Delta buddy, Duke Morrison, to break up the humdrum aspects of his life as he planned his future.
Monroe turned out to be anything but pampered or humdrum and was unlike anyone he had ever met. She was searching for a life as far removed from the one she'd known. But mystery surrounded her, and when Shaw solved the case, he knew that as soon as she was safe, he was going to make her his.
But would their dreams of a future together come true?
Join USA Today Bestselling Author KL Donn on her first journey in the Brotherhood Protectors World as she gives you one pageant queen, a scarred soldier, and a cow who thinks she's a human.
Buckle up, buttercups, it's about to get Crazy!
Cowboy Bodyguard
Who would you like the book signed to? (optional)
Standard and expedited shipping options available.
If shipping cost is not as high as quoted, refunds will be given for $3 or more.
© 2017 by KL Donn. Proudly created with Wix.com

redpajama_set_name: RedPajamaCommonCrawl


When couples announce to their friends that they're getting married, friends of the bride-to-be normally react emotionally and begin the chat and planning for the perfect wedding. The friends of the groom-to-be, on the other hand, have only one thought on their minds, the stag party! That time honoured tradition, the rite of passage that every groom must go through and the excuse for every member of the groom's party to act like a teenager once again. Ibiza has become a stag party haven in recent years and not just because it offers unparalleled nocturnal options with all of the biggest DJs and club brands on the planet descending on it during the summer season, but because it also offers multiple options for large groups of guys, resulting in the best stag adventure you could ever have.
When it comes to organising a schedule of events for the stag, our experience here at Essential HQ is that guys are not the most efficient, while the girls usually have a good idea of all the things they want to do, guys need a little bit more direction, that's where our service is invaluable to the best man or men, normally charged with putting the whole thing together. We will make you look like a superstar to all of your friends with options for every second of the trip to make sure your groom has the most memorable stag party for all the right reasons. Arriving at the famous Ibiza airport, where countless global superstars and world famous DJs have stepped before you, the last thing you want to do is stand in a long taxi queue in the sweltering heat. So, like the stars before you, let us put you in a VIP car, a Mercedes or something similar, depending on the size of your party, and have you checked into your accommodation and enjoying your first cold beer while the rest of your flight still stands in line for a cab!
When it comes to the stag party the priorities change slightly from the hen, accommodation is equally important to both but while the hen places a premium on the type of accommodation, the stag is more worried about the location. Either way, we have a range of properties and hotels that suit every stag and budget, from the boutique cool of Es Vive hotel, the beachfront convenience of the Garbi hotel or the Ushuaia Hotel and a balcony that gives you front row seats to the biggest parties on the island. For those that prefer to look after themselves, we have you covered, from a penthouse apartment in the heart of the action to a villa looking out to sea. Once you have settled into your accommodation, it's time to check out Ibiza at night and the reason that it is known as the clubbing capital of the world. Whether you want to be in the heart of the main room dancefloor in Amnesia as Marco Carola delivers a thumping techno groove at Music On, catch Above & Beyond destroy the Cream Ibiza dancefloor, check out Tinie Tempah hold court on the Ibiza Rocks stage in the heart of San Antonio or check out David Guetta in Pacha from the comfort of the VIP section, all these options and much more are open to you when you turn to Essentialibiza to help you plan the biggest trip of your best friends life.
After a night or two on the town, it's time to relax and recharge the batteries and where better than in one of the island's premier beach clubs. Enjoy a delicious lunch and a few hours soaking up the sun on Bossa beach where you can relive the madness of the night before and remind some of the boys exactly how they got home. Bossa has a string of five star establishments to help you get your second wind, from Sirocco, Coco Beach, Sands, Ushuaia Beach club and Nassau Beach. For those that want to go a little further afield then Cala Jondal and Blue Marlin or Ocean Beach in San Antonio offer two different but enjoyable experiences where the soundtrack will get you back in the game and leave you ready for the next round of parties. One of the most popular parts of our stag packages is the day out on the boat and, again, there are a few options depending on your budget. Mamboats offers a day out on a luxury Mastercraft speedboat where you can explore the coastline, dive under some of the most dramatic rock faces, enjoy some white knuckle watersports off the back of the craft and have a day that you will all remember long after the bride and groom's first anniversary.
For the adrenalin junkies amongst you, Ibiza is blessed with numerous adventures that will get your heart rate going. From parasailing high above the island, to careering through the sea hanging on to a high-powered sea bob, or a jet ski if you prefer being the master of your own destiny. Out of the water we can organize your very own F1 race, using one of the islands challenging go-cart courses or if you are the outdoors type that prefers to fire paint pellets at your mates, paintballing is also an option. One of the more popular days out for our stags is the last supper. We have a few great options where you and your mates can enjoy a last meal before the big day, we make sure that our photographer drops in and captures the occasion for you and your group. Tagomago is a favourite, where we whisk you over to the island with only one restaurant on it, meaning you take full control of the place for the day, resulting in yet another memory of a lifetime. No matter what your budget and preference of you and your mates, Essentialibiza has a plan to suit, meaning the stag party is run to perfection and you will have successfully fulfilled one of the most important tasks of your best man duty as well as giving you plenty to talk about in your speech!