VS 2008 Auto-Format Curly Brace Code Too Slow
Apr 30, 2009
I have written a quick 'algorithm' that automatically formats curly brace code in the correct way:[code]It works quite simple, it loops through all the lines and keeps track of the brace count using a counter. The counter will be incremented by 1 if it finds an opening brace, and decremented by 1 if it finds a closing brace.Then, each line is trimmed, and a total of "n" tabs is inserted before the text, where "n" is the brace count as explained above.[code]So my question basically is, how can I avoid having to do the same thing (exchanging lines) twice? I have noticed that the actual exchanging of lines is very slow, so having to do it twice for each closing brace line is simply a very bad design..
View 6 Replies
ADVERTISEMENT
Apr 17, 2009
I need my application to do some fairly simple C-style curly brace text parsing. The text style is similar to C or C# in that it uses curly braces to define blocks of code.[code]As you can see it also uses C-style comments (//) and can (actually always will) use nested blocks, but only up to one level of nesting is allowed. As you can also see, the code does not have to be formatted neatly. There can be spaces before any opening or closing brace and it will still be valid.The text however is not similar to C or C# in a few ways:
- it does not need a semicolon ; after each 'statement' (abc, def)
- the block names will always consists of one single word except for the possibility of comments behind that word.
- the event names may contain more words
- the block and event names do not end in parentheses ()
I am telling you this because I have a C and C# parser which I can use (it came with the text editor control I am using) but it does not recognize the language I need as valid C or C#, because the block names do not end in parentheses, and the commands are not ended by semicolons. Therefore it keeps doing things wrong (it should automatically outline the text, auto indent it, smart format it etc) because it is expecting C syntax exactly, and it sees my language as loads of syntax errors (missing semicolons etc).So, I need a way to parse the language manually, and it needs to be pretty fast too. Some of the things I need include:
- Getting an entire block (including nested blocks) just from the block name (identifier?).
- Getting all block names (nearly had this working with the help you guys gave me but not completely there yet).
- Getting all event names in a specified block.
- Getting an entire block (or just the block name) just from the current cursor position (if the cursor position is somewhere in block2 I should be able to identify that and return 'block2').
- Probably more...
Then I thought, wait a minute, this C-style language is probably the most used language style, so there should be LOADS of examples online... So I started googling but did not find many relevant things.Is there anyone who has any knowledge about simple language parsers? Anyone who can help me do the things I wrote above..? I realize I am asking for a lot, but the language is pretty easy and I cannot imagine that it is extremely hard to parse it quickly. I also don't require any syntax error checking; all I need are the few things above (mainly retrieving the block names and event names).
View 12 Replies
Mar 20, 2010
So, today I was programming, and then right clicked and noticed a 'Insert Snippet' option. I've seen it before, but never clicked it. I thought this was an amazing thing. It had predefined code which auto inserts. Was just letting some of our other members know, that it does include some predefined things such as 'Write to a text file', etc.
View 4 Replies
Jan 5, 2010
I am using VS 2005 pro and VB.NET. How do you format the DataGridView.DefaultCellStyle.format property for zip codes and phone numbers. I have a zip code and phone number column(s) that I want to be formatted. I have tried a lot of different things:
Zip code: "99999-0000" or "Phone Number: "(999)000-0000" or "(000)000-0000" and the like So far nothing has worked. I can get my date columns formatted correctly, but not these. Can any one give me some examples that work?
View 2 Replies
Jun 5, 2011
I've got a vb.net 2005 form that calls a stored proc to load a combobox with eligible sales reps. There are approximately 40k sales reps available...I know that's a lot, but that's what I'm dealing with. I'm trying to figure out why it's taking this form 15 seconds to load.
Here's my code:
Want to load this in the most efficient way possible given the HUGE amount of data that my client is wanting to see.
Can you help me? :confused:
View 1 Replies
May 9, 2011
My stats:OS: XP Professional (2002) SP2Pentium 4 CPU, 3.2 Ghz, 2.98 G RAMApp: VS 2008 Pro. v 9.0.21022.8 RTM
View 3 Replies
Feb 28, 2008
How to convert jpg format into binary format using VB code ?
View 3 Replies
Jul 1, 2009
I've tried using the VS 2010 beta to edit some real projects, and it is next to unusable due to performance issues. The cpu is more or less constantly at 100%, and most often the code editor uses around 10 seconds to respond to any text input. If I introduce a couple of compile errors things get even worse. Are there some drastical performance improvements that are planned in the VB editor before release, or are there special things that might trigger this?
View 22 Replies
Oct 19, 2011
I am using DataSet.ReadXml() to create a DataSet from the following XML file, so that I can quickly query it using Linq.[URL]..I then use the following object to create a DataTable which can be used as a dictionary, with a ConvertToFriendlyFormat function that takes an Emulator_Id and and a string that corresponds to a DicEntry node's StoredFormat attributed, and return the same node's FriendlyFormat attribute.
This does work BUT it is extremely slow (~11 seconds to call it ~220 times). I have been unable to figure out how create the DataSet when the object is initialised and just query the simple DataTable in the ConvertToFriendlyFormat call. I guess this is what is slowing it down?
[Code]...
View 4 Replies
May 17, 2010
I have this url, [URL]. I need the {zip}, because in my code, when this page opens, I replace the {zip} with a zipcode say 10001. But in aspx, when i put validation for that txtbox, it wont let the {} pass through. This is the validation -
ValidationExpression="http://([w-]+.)+[w-]+(/[w- ./?%&=]*)?"
regularexpressionvalidator.
How can I get the curly brackets in sql server? Which is my db in backend.
View 1 Replies
Aug 18, 2010
I am facing an issue with my code the thing is i want to escape { in the string.format function Of course one way to escape it is to use {{ (2 curly braces)Is there any other way possible to escape without using the double curly braces.
View 4 Replies
Feb 15, 2012
My code: it is used to generate number in date format my problem is that it doesn't show any output in the textbox nor in the database. The last num in my database is 2012010001.
Dim i As Integer
Dim strSQL As String
Dim strMonth As String
Dim strYear As String
Dim strTheID As String
Dim today As Date
[Code] .....
View 7 Replies
May 29, 2012
I am trying to format the width of my gridview columns dynamically for easy of use in editing and updating. Is it possible to have multiple column widths defined? Here is the code I am using to create the gridview...
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
[code].....
View 1 Replies
Jan 26, 2012
I noticed that my application is running a bit slow. This is a Windows Service built using VB2010 with SQL Server as a back end. Its main function is to poll a folder looking for a text file. If found it reads the text file and imports the data into SQL Server.
While the slowness could be caused by a number of reasons, I am looking at my code to determine if it could be more efficient. Below I've pasted snippets of code where I initialize the DB connection and execute SQL statements. I've also included a snippet that illustrates how I am processing the text file.
I'd appreciate if the group could have a look at these and let me know if the method that I am using is the most efficient possible. At this time I am also focusing on other probable issues, but I can't rule out the possibility that the code that is in place might be a contributing factor.
[Code]...
View 4 Replies
Nov 14, 2011
I am trying to build an application which does the following :
1) write some text in a richtextbox
2) when user clicks a button, the app will replace the text with another text in {} braces.
what I want is that the next time, the regex searches for any text it should exclude those which are present in {}. for eg : my world is good world and a happy world and will be a better world for everyone. first pass - change word "world"
[Code]....
View 1 Replies
Jan 31, 2012
I have strings that look like this {/CSDC} CHOC SHELL DIP COLOR {17}
I need to extract the value in the first swirly brackets. In the above example it would be
/CSDC So far i have this code which is not working
[Code]...
View 3 Replies
May 3, 2012
I am manipulating xml with lots of date of birth. XMLs are already loaded onto datatable. The format we need is "dd/MM/yyyy" The dates are messy such as "dd-MM-yyyy" or "dd.MM.yyyy" so I am thinking to write a function that will auto correct on a set of predefined separators to a correct format. so I am thinking to do something like this but of course, this won't just work.i cannot use replace to replace an array. If i can just do that, everything would be fine. Hope someone can point out a way around. [code]
View 2 Replies
Feb 15, 2009
I have a program that runs some code when i click a button on a form when done running the application ends. I want to automaticaly run the code when the users clicks on the exe. I have put the code that i want to run in the startup forms load event but that doesn't start
View 2 Replies
Jan 18, 2012
I had a weird series of errors involving e.Graphics.DrawString() when painting a panel.I am using a barcode font [Code 128] with a library that converts text to the proper format for Barcode readers.That's fine, however, when I draw it to the panel, that's where things stop being fine:But, here's where things get funky. When I put it into a TextBox instead of drawing it via Graphics.DrawString(), everything is peachy:In fact, the TextBox one looks much better than the Graphics.DrawString() one! Am I doing something wrong?[code]
View 2 Replies
Dec 23, 2009
I have 2 workbooks( Book1 and Book2) with multiple sheets.I am only interested in one of the worksheets in the workbooks(both the worksheets names are the same).The thing is that the data is in the form of pivot tables, so each time i have to filter according to specific categories, copy and paste into another new workbook.The thing is column headings in both the worksheets are different,BUT BOTH the worksheets data must be combined into 1 single worksheet( row after row).
Meaning in Book1, my columns are in the form of Cost, revenue,margin and in book2, the columns are in the form of Cost,Revenue, Profit Margin %.... That means i must add a profit margin % column in Book1 and a Margin column in Book2 before I combine the data into a single worksheet. Each week, new data gets added into Book1 and Book2, so I wish to automate this by creating a code, so that when the source data changes, my new workbook's data also changes.
View 1 Replies
Feb 10, 2010
I'm upgrading my VB6 program to VB 2008 express .but the IDE is too slow. When I change something it takes 1-2 minutes before I can do anything else?
View 1 Replies
Jul 14, 2010
When I tested my code on the computers at school my program ran pretty smoothly, but when i took it home it ran far slower.
My computer is generally about 20 times as powerful as the school ones so naturally I'm a little peeved.
View 4 Replies
Aug 24, 2009
I have been developing an application using Visual Studio/VB and access 07 for my db. On the system I am developing my app. the db is local and the speed of the application is very good when I debug it. As I publish my application the db goes on a network server and the application is installed/used by 5-6 pc. The speed of the program drops alot as time passes and as is used, speed goes even more down. My problem is that I do not know what is making this change. Is it the server fault, the other pc, the many users, the lack of garbage collector ( other than the one vb does alone ), the existense of the db on the server? Based on the information I give does anyone has a tip on how to increase speed. I dont know how to begun to start fixing it as I do not know where the problem resides. One example of poor performance is the search I do on the program. For the first search I do they are ok then the more I make the slower they get.
View 16 Replies
Apr 5, 2009
I am having extremely slow build times in a VB project, in VS 2008 Express. Sometimes it takes as long as 10 mins. It's so bad that I almost want to try re-installing VS 2008 Express. It seems to only occur in the one project.
[Code]...
View 1 Replies
Oct 14, 2010
I am moving a lot of data to MS Excel from my application. I use a conditional statement to choose which Excel page the data is transferred into. Then a For Next statement to divide the data into various areas on the Excel sheet.The first sheet will always work correctly, but on the next conditional statement to chose the next Excel sheet no data transfers when running the program. If I step the program by hand all data all code works fine. I believe I need to pause between the conditional statements but I have been unable to get one to work.In the following code I have been trying to get a pause between to conditional statement to no avail.
[Code]...
View 7 Replies
Jul 27, 2009
here is part of the code i am working with at the moment:
Public Sub runbar(ByVal time As Integer)
sleep(2)
Dim i As Integer
i = 0
ProgressBar1.Maximum = time
[Code]...
The problem is that when i click the button to run this, it does the runbar animation BEFORE it updates the text box. I have even tried putting a loop around the TextBox1.Text = obj to see if that would force it to work, but it did not. I would like to know if there is anyway to get the text to update before the runbar animation runs, just seams weird as i have the text editing first lol.
View 5 Replies
Jan 30, 2011
I already made a code on vb.net to generate random numbers with letters using HEXA + date time. Now, all i want to know is how to set it to single use? Once they got it, they can no longer use it back. They have to request for new one..
View 10 Replies
Nov 5, 2010
Can i slow a task in the Background Worker down?
View 2 Replies
Sep 2, 2011
im using visual studio 2008 for my thesis. i have this mdi parent form as a container in my program and buttons in it to show different childforms. i am just wondering is it possible to show the childforms in slow motion manner, from left of the container to the center?
[Code]...
View 3 Replies
Apr 27, 2011
VS 2008 form.show in slow motion
View 4 Replies