Working on Bible Verse Tags for ASP.NET (C#)

To do:

  • build Regex to detect bible verses in tags
  • put in named back-references
  • find a way to choose different tables with LINQ
  • make it work for an entire chapter
  • add error messages
  • move it to a class file instead of in the page
  • run it from the filterText method if IndexOf(“[bible]”) !=-1
  • fix toVerse in case it goes out of range
  • fix misspelled or abbreviated bookName with value from database
  • change to Compiled Queries
  • add footnotes
  • pretty up error messages
  • clean up final code
public class bibleParts
{
	public static Func<bibleDataContext, string, IQueryable<bibleParts>>
		theVersion = CompiledQuery.Compile((bibleDataContext context, string bibleVersion) =>
			(from v in context.bibles_infos
			 where v.bibleName == bibleVersion
			 select new bibleParts
				 {
					 version = v.bibleID,
					 language = v.language,
					 copyright = v.copyright
				 }));

	public static Func<bibleDataContext, int, string, IQueryable<bibleParts>>
		theBook = CompiledQuery.Compile((bibleDataContext context, int bookLang, string book) =>
			(from b in context.book_names
			 where (b.book == book || b.abbreviation == book || b.alt == book) && b.language == bookLang
			 select new bibleParts
			 {
				 bookID = b.book_id,
				 book = b.book
			 }));
	public static Func<bibleDataContext, int, int, int, IQueryable<bibleParts>>
		theVerses = CompiledQuery.Compile((bibleDataContext context, int version, int book, int chapter) =>
			(from v in context.verses
			 where v.versionID == version && v.bookID == book && v.chapter == chapter
			 select new bibleParts
			 {
				 verseNum = v.verse1,
				 thisVerse = v.text
			 }));

	public int version {get;set;}
	public int language {get;set;}
	public string copyright {get;set;}
	public int bookID {get;set;}
	public string book {get;set;}
	public int verseNum {get;set;}
	public string thisVerse {get;set;}
}
</pre></pre>
<pre><pre>private string verseMod(string text)
{
	string textVal = text;
	string errorValue = "";
	string verseNumBegin = "<sup>";
	string verseNumEnd = "</sup>";
	string footerBegin = "<em> - ";
	string footerEnd = "</em>";
	string bibleVersion = "kjv";  //default version if none is specified
	string pat = @"\[bible[=]?(?<version>[a-zäëïöüæø]*)](?<entire>(?<book>([0-9][\s]?)?[a-zäëïöüæø]*[\s]{1}([a-zäëïöüæø]*[\s]?[a-zäëïöüæø]*[\s]{1})?)(?<chapter>[0-9]{1,3})(:{1}(?<verse>[0-9]{1,3})(-{1}(?<toVerse>[0-9]{1,3}))?)?)\[/bible]";

	Regex r = new Regex(pat, RegexOptions.IgnoreCase);

	MatchCollection m = r.Matches(textVal);
	foreach (Match match in m)
	{
		string verseVal = "";
		string errorText = "";
		if (!String.IsNullOrEmpty(match.Groups["version"].Value))
			bibleVersion = match.Groups["version"].Value;
		string thisBook = match.Groups["book"].Value;
		int fromVerse = 0;
		int toVerse;
		if (!String.IsNullOrEmpty(match.Groups["verse"].Value))
			fromVerse = Convert.ToInt32(match.Groups["verse"].Value);
		toVerse = fromVerse;
		if (!String.IsNullOrEmpty(match.Groups["toVerse"].Value))
			toVerse = Convert.ToInt32(match.Groups["toVerse"].Value);

		using (var bdc = new bibleDataContext())
		{
			var searchVersion = bibleParts.theVersion(bdc, bibleVersion).SingleOrDefault();
			if (searchVersion != null)
			{
				var searchBook = bibleParts.theBook(bdc, searchVersion.language, thisBook).SingleOrDefault();
				if (searchBook != null)
				{
					var searchVerses = bibleParts.theVerses(bdc, searchVersion.version, searchBook.bookID, Convert.ToInt32(match.Groups["chapter"].Value));
						if (fromVerse != 0)
						{
							searchVerses = from v in searchVerses
										   where v.verseNum >= fromVerse && v.verseNum <= toVerse
										   select v;
						}
							string realToVerse = "";
							verseVal += String.Format("{1}{0}{2}", match.Groups["entire"].Value.Replace(match.Groups["book"].Value.Trim(), searchBook.book), "<span class=\"bibleHead\">", "</span>");
							verseVal += "<span class=\"bibleContent\">";
							foreach (var theVerse in searchVerses)
							{
								string verseFormat = "{2}{1}{3}{0} ";
								if (String.IsNullOrEmpty(match.Groups["toVerse"].Value) && !String.IsNullOrEmpty(match.Groups["verse"].Value))
									verseFormat = "{0} ";

								verseVal += String.Format(verseFormat, theVerse.thisVerse, theVerse.verseNum, verseNumBegin, verseNumEnd);
								realToVerse = theVerse.verseNum.ToString();
							}
							verseVal += String.Format("{1}{0}{2}</span>", searchVersion.copyright, footerBegin, footerEnd);
							verseVal = verseVal.Replace(String.Format("-{0}", toVerse), String.Format("-{0}", realToVerse));
							verseVal = verseVal.Replace("-</span>", "</span>");
				}
				else
				{
					errorText = "The book \"{0}\" does not exist.  Please check the spelling and try again.";
					errorValue = match.Groups["book"].Value;
				}
			}
			else
			{
				errorText = "The version \"{0}\" is not installed on this server";
				errorValue = match.Groups["version"].Value;
			}
			if (String.IsNullOrEmpty(errorText))
			{
				textVal = textVal.Replace(match.Groups[0].Value, verseVal);
			}
			else
			{
				textVal = textVal.Replace(match.Groups[0].Value,String.Format(errorText,errorValue.Trim()));
			}
		}
	}
	return textVal;
}

Currently active at newcastlechurchofChrist.com.

Why I don’t do xmas

  1. It involves lying.
    • Do you tell your children “if you’re good Santa will bring you presents”? That’s a lie.
    • Do you tell your children that Santa exists? That’s a lie.
    • Do you tell your children that Santa actually flies in a sleigh and delivers gifts? That’s a lie.
    • It encourages children to lie. “Yes, I was good.”
  2. Xmas and Jesus’ birth are so closely tied that disbelief in one causes disbelief in both.
    • “Well, we lied to you about Santa but Jesus is real. Honest!”
    • When children are told “these gifts came from Santa but Jesus is the real reason for the season”. They can touch the gifts from Santa but what can they see from Jesus? The fraud wins. Forgiveness of sins and escape from damnation mean very little to a child.
  3. It encourages greed
    • What’s the first thing you think about when considering xmas? Some reading may say “Jesus’ birth” but most will say “presents”.
    • Ask a child for their reply.
  4. It’s a sad time for many, many people
    • Folks that have lost a loved one during this time feel miserable.
    • People that have no one during this time of year feel miserable.
    • People that can’t afford the gifts they are forced to give feel miserable a little bit later when the bills come in.
  5. Jesus’ birth wasn’t on December 25th.
  6. I’m not a catholic and don’t follow their traditions including valentine’s day, halloween and xmas, et al.

Look, friends, I don’t want you asking my son if he got anything from Santa. I don’t want you telling my son that if he’s good Santa will bring him presents. I’m not going to lie to him and I don’t want him lied to by others.

Happy passover

Luke 22:19-2019And he took bread, and gave thanks, and brake it, and gave unto them, saying, This is my body which is given for you: this do in remembrance of me.  20Likewise also the cup after supper, saying, This cup is the new testament in my blood, which is shed for you.   - King James Version

The New Covenant Passover is a memorial of the death of Jesus Christ as the true Passover Lamb. We eat the broken bread and drink the wine in remembrance (re-enactment) of the sacrifice of His beaten body and shed blood.

Be Berean

With the recent celebration of valentine’s day at the church I attend, I once again sit wondering why pagan rituals are not only accepted but openly celebrated in a church that is supposed to separate themselves from the practices and customs of the world.
2 Corinthians 6:16-1716And what agreement hath the temple of God with idols? for ye are the temple of the living God; as God hath said, I will dwell in them, and walk in them; and I will be their God, and they shall be my people.  17Wherefore come out from among them, and be ye separate, saith the Lord, and touch not the unclean thing; and I will receive you,   - King James Version

Including christmas, easter, halloween and Sunday “sabbath”, I just can not find biblical evidence that a Christian should observe or celebrate any of these generally accepted “religious” holidays. The only exception to the list is probably Pentecost, a day that should be observed, biblically speaking, and that is shunned by all save the “pentecostal movement” (and even they get the wrong day by calculating it from easter instead of the weekly sabbath in the Passover week).

I understand that most pastors and priests are teaching what they honestly believe is the truth but whatever happened to looking into what you are being taught as the Bereans did?
Acts 17:10-1110And the brethren immediately sent away Paul and Silas by night unto Berea: who coming thither went into the synagogue of the Jews.  11These were more noble than those in Thessalonica, in that they received the word with all readiness of mind, and searched the scriptures daily, whether those things were so.   - King James Version
They searched the scriptures daily to see if what they were being taught was truth. They even had it harder than we have it today. They didn’t have a New Testament, they had to interpret the Old Testament to see if what they are being told about the Messiah agreed with the old prophecies.

I think it is time to start weighing your customs, thoughts, sermons, teachings and beliefs against the Bible that you claim to believe is the inspired Word of God
2 Timothy 3:16All scripture is given by inspiration of God, and is profitable for doctrine, for reproof, for correction, for instruction in righteousness: - King James Version
and get rid of the things that don’t agree. All I ask is you consider what I’m saying, it’s not that hard, you have it a lot easier than the Bereans did. Do some research and pray about it. Be Berean!

If I’m wrong, I expect to be told and corrected. I will accept any correction as long as it is biblical and not based on “we’ve always done things that way” or “I know that the holidays aren’t biblical but we use them for that purpose now”.

Trackbacked to:
The Crazy Rants of Samantha Burns
The Liberal Wrong – Wing
Common Folk Using Common Sense
Conservative Cat
The Trouble with Angels

Bible verse tags 2.0

See here for more information on the new version of the Bible verse tags.

I hope that this plugin can be used to spread the good news throughout the earth.

Let me know if you need any help installing it.

John 3:16For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. - King James Version
1 John 11That which was from the beginning, that which we have heard, that which we have seen with our eyes, that which we beheld, and our hands handled, concerning the Word of life   2(and the life was manifested, and we have seen, and bear witness, and declare unto you the life, the eternal [life], which was with the Father, and was manifested unto us);   3that which we have seen and heard declare we unto you also, that ye also may have fellowship with us: yea, and our fellowship is with the Father, and with his Son Jesus Christ:   4and these things we write, that our joy may be made full.   5And this is the message which we have heard from him and announce unto you, that God is light, and in him is no darkness at all.   6If we say that we have fellowship with him and walk in the darkness, we lie, and do not the truth:   7but if we walk in the light, as he is in the light, we have fellowship one with another, and the blood of Jesus his Son cleanseth us from all sin.   8If we say that we have no sin, we deceive ourselves, and the truth is not in us.   9If we confess our sins, he is faithful and righteous to forgive us our sins, and to cleanse us from all unrighteousness.   10If we say that we have not sinned, we make him a liar, and his word is not in us.      - American Standard Version
1 Mosebog 3:12Adam svarede: "Kvinden, som du satte ved min Side, gav mig af Træet, og så spiste jeg." - Dansk bibel
Kolosser 3:1-31Seid ihr nun mit Christo auferstanden, so suchet, was droben ist, da Christus ist, sitzend zu der Rechten Gottes.   2Trachtet nach dem, was droben ist, nicht nach dem, was auf Erden ist.   3Denn ihr seid gestorben, und euer Leben ist verborgen mit Christo in Gott.    - Luther bibel

Trackbacked to:
Open Trackback @ Samantha Burns dot com
Cao’s Blog
Diane’s Stuff

Swan Songs – In Search of the Staffstone

Swan Songs – In Search of the Staffstone

“A blast of fire roared toward him. The clothes on his back burst into flames. Kyle dove into the river… The dragon dove into the river…” Swan Songs In Search of the Staffstone A Christian children’s fantasy-adventure story about…

  • An archaeologist uncle responsible for two world wars—maybe more…
  • A “watcher” owl that can talk and a boy that can understand it completely
  • A quest to return the staff of Moses to the Staffstone with help from a few kids, an eagle, and a flock of hummingbirds along with a diary full of riddles and rhymes, all clues about a waterfall, a door, and a dragon.

All for a song. Swan Songs: In Search of the Staffstone is the first in a series filled with cliffhangers, mystery, riddles, conflict, and adventure. Imagine another Narnia, another Sword in the Stone, another Hobbit (dragon included). It is here!

Prophecy through Gary Brooks 11/19/02

Father, I just thank you for Mark. I thank you for my brother. Lord, we bless him right now.

The Lord says, “Son, I’ve been working in you and working on you.” And yea, the Lord says, “I’m working through you now greater than ever before.” And the Lord says, “I’m doing some finalizing in your life and I’m taking that screwdriver and I’m tightening down and making some adjustments.” And yea, the Lord says, “It’s like a torque wrench going on you.” And yea, the Lord says, “I’m removing some things out of you and I’m putting some new things within you. I’m taking out the old and some of the religious mindsets and past traditions.” And yea, the Lord says, “and I’m filling you up with new revelation.” And the Lord says, “Son, get ready because you’re getting ready to jump out into the river as never before and walk on the water.” And yea, the Lord says, “I’m going to raise you up in the house. I’m going to raise you up,” says the Lord, “with some business opportunities in these next few years to come. I’m just making the man right now. I’m stirring your heart with desires.” And yea, the Lord says, “the resources will be there and you love to sow and you love to give and you love to minister and you love to plant.” And yea, the Lord says, “the day comes when you’re going to have much substance to give and sow and plant.” And yea, the Lord says, “but now the word of knowledge that’s on the inside of you that ministry gift shall flourish.” And yea, the Lord says, “you’re going to dance, you’re going to rejoice, you’ll not just be a worshipper, but you’re going to be a wild warrior for me,” says the Lord. And yea, the Lord says, “the day comes when you’ll get out from behind the sound system and you will run the aisles and you will jump and leap and twirl and as you dance on the devils head victory is going to be released not only in your life but in the lives of others, and I’m making you like a Holy Ghost whirlwind,” says the Lord, “and you’re going to be a centrifugal force of my anointing,” says God. And yea, the Lord says, “the day comes when you teach and you exhort and you minister to men and you’re going to minister to my people,” saith God, “in ways that you thought that you weren’t even capable or qualified because I’ve called you, you’re qualified,” says the Lord.

Father we bless Mark in Jesus’ name. Thank you Lord. Thank you Lord. Amen.

Prophecy through Mark Barclay 8/12/2002

Mark! Powerful name. God bless our mothers. (That your mama? Good choice mom. Praise God.)

Uh, you know, I don’t know what your life has been like so much but you know some names are dangerous. You know Mark means “Mighty Hammer”, so hope you haven’t spent as many years as I have beating things and hammering things and going after things.

Mark, the Lord says, “Supernatural help from heaven is coming upon you now.” Now, don’t over-interpret this, but the Lord says, “An angel is being dispatched to deal with issues and circumstances, because there’s something here that’s been warped and oblonged than man can’t bring back to the proper shape, but this angel will go to work out there and angels can maneuver things and man can’t do much about it because they’re invisible.” (Not man, angels. Make sure you understand that.) And the Lord said, “This thing is going to be put back into the right shape so that it’s proper and upright before the Lord.” And a breakthrough is coming to you! Relief! Say it everybody, “RELIEF!” is coming to you brother. Say it, “RELIEF!” is coming to you. Not a cease fire for this moment of time. No no no no no no no. A victory is coming to you to close this chapter of your life to shut this door once and for all so you can go on and have some nights where you sleep good. Let slumber come upon my brother. In the name of Jesus let him sleep, sleep, sleep. Let him sleep at night. Let his mind slow down. Let his nerves be stabilized and let him live that stable clear life that you’ve meant for him to live. I don’t care what the days gone past have done to him or said to him. I see his future and he has a breakthrough coming and has some of the freest years that he’s had yet. Raise our hand to him, pray for him.

Freedom. FREEDOM! And PEACE! In the name of Jesus.

[tongues]

Give the Lord a handclap everybody, hallelujah!

Prophecy through Gary Brooks 9/11/2000

Lord, I just thank you for Mark. And we bless Mark right now. And the Lord says, “Son, I’ve put a business mantle on your life.” And the Lord says, “I’m going to school you and I’m going to activate you. I’m going to season you. I’m going to have you in business association of relationships.” And the Lord says, “I’ve put a prophetic grace within you and a prophetic river. And you will prophesy the word.” And, yea, the Lord says, “You’re going to flow in the arts of drama and you’re going to dance before me. You’re going to be involved, you’re going to activate men and to be a warrior in expressive arts,” saith the Lord. And, yea, the Lord says, “I’m teaching you what it is to pray and hear and know my voice.” And the Lord says, “You’re going to be a voice of confirmation unto many.” Lord we bless him right now, in Jesus’ name.

Prophecy through Mark Barclay 7/18/2000

Supernaturally, I’m going to penetrate the perimeters that Satan has built around your life. Get ready for me to break through, you’re looking for a breakthrough, but I’m telling you I’m going to break through. And I’m going to reach you right where you are at and there is not an evil spirit or all of them put together that can stop me!

My hand is on you to bless you, to grow you, to equip you, to anoint you and to make you the son that I’ve always wanted you to be. Your hearts in doing that, the Lord says, you’ve just had some major interruptions. And the Lord says he wants you to stop taking credit for most of them. Sure, you’ve blown it once or twice…who hasn’t? But the Lord says you’ve been victimized as much as you’ve done anything wrong. You’re not subject and responsible to what other people do that’s goofy. Did you hear me? I said goofy. Like in GOO-FY!

But the Lord says, your day of stabilization has come upon you. You’re going to pick your chin up, put your shoulders back and march like a soldier of the cross and obey me!

Here comes that anointing…give me 3 holy men to pray over this brother, c’mon…

[tongues] everybody pray, c’mon…

[tongues] yeah, yeah, yeah, yeah, fix it and repair it. Advance and promotion. In his life/on him. In the name of Jesus, help him, help him Lord with tomorrow.

[tongues] In the name of Jesus…in the name of Jesus.

Prophecy through Gary Brooks 6/11/2000

Lord, I just thank you for Mark. Lay anointed hands on this man of God. We thank you, Lord, for what you’ve accomplished in his life.

And the Lord says, ‘Son, I’m giving you a financial grace. I’m giving you an economic/evangelistic anointing,’ says the Lord. ‘I’m giving you revelation and understanding in the realm of material blessings.’ And the Lord says, ‘You’re going to teach my people and feed my people. And I have put a crown of favor upon you, and wisdom and strategy and a spirit of excellency and I’m raising you up just like I did with Daniel and I did with Joseph,’ says the Lord. ‘And you’re going to teach revelation and you’re going to impart anointing unto my people. You’re going to teach them what it is to manage money and manage finances. And you’re going to put structure into their life and blessing into their life. And I’m going to have finances flowing into you and flowing through you,’ says the Lord. ‘And I am going to cause creative ideas to come in you.’ And, yea, the Lord says, ‘I’ve got business connections in your life that you don’t even know about that I’m going to work in you and through you,’ And the Lord says, ‘You’re going to associate and you’re going to relate to people in corporate executive positions as well.’ And the Lord says, ‘Because of your tenderness.’

And, yea, the Lord says, ‘You’re going to be involved in Christian business networks as well, and you’re going to pray.’ And, yea, the Lord says, ‘You’re going to be a vital tool in my kingdom, you’re going to prophesy the word of the Lord, you’re going to win souls into my kingdom,’ says the Lord. ‘You’re going to get people baptized in the Holy Ghost. Because I put you on the anvil and I’ve been making the man, and I’ve been preparing you, and I have chosen you out of the furnace of affliction for such a time as this.’ And the Lord says, ‘I’m raising you up to be a leader among my people, and a servants heart is getting ready to expand.’ And, yea, the Lord says, ‘The ministry of helps is going to come forth in your life, and you’re going to be an example unto many what it is to serve.’

And we bless Mark, Father. In Jesus’ name. Amen. Amen. Amen.