Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

For anyone who is having trouble with regular expressions, I suggest you have a look at this site by Jeff Avallone. It takes a regular expression in the native (cryptic) format and produces a visual display of the same expression. For example,

^[a-z0-9_-]{3,16}$

becomes

Screenshot_(10).png

and the pattern for an email address

^([a-z0-9_.-]+)@([\da-z.-]+).([a-z.]{2,6})$

becomes

Screenshot_(11).png

One caveat - you will see

\d{3,5}

expanded as

Screenshot_(12).png

which may seem incorrect at first glance, however, the 2...4 times refers not to the number of digits but the number of extra "trips" back through the loop so if you have three digits you require two extra trips back through. I recently suggested to the author that he consider labelling the iterators something like 3...5 occurrences which would be both clear and precise.

In any case, this is a valuable tool for debugging complex expressions.

rproffitt commented: 2..4 times or more useful. Molsen OK by you? +12
JamesCherrill commented: Wow - that's really useful. Thanks +15
cereal commented: thank you! +14
ddanbe commented: Great tip! Thanks :) +15
Nutster commented: Good link and explanation, but the Email address pattern needs to escape the period between groups 2 and 3. +7
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

How did this one slip under the radar? On April 7, Trump rescinded Obama wildlife protection legislation making it legal to shoot animals while hibernating (including bear cubs), shoot wolves while in their dens with cubs, trap bears with wire snares and lure bears with food for the purpose of shooting.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Temporary data, by definition, does not need to be saved. If you are referring to saving in one session, then restoring it in another, you would use either My.Settings (which you don't seem to want to use) or some other external store like a database or other file. Typically you would store "like" values in arrays. Holw you store the data depends on the format of the data. Can you give us more details please?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you want something relaxing while you recupe then check out Keeping up with the Kattarshians. You can pick a camera. Much more entertaining when everyone is awake.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

How do you want this to work? Your brief description leaves several possibilities. No point in suggesting the ones you don't want. For example, you could have a textbox with a text changed event handler that automatically populates a listbox based on what you type as you type it. This may or may not work depending on the dataset you are getting the matches from. It could be a database and if it is large and you can't use the index, the results may take too long to filter.

You say "display the data after inputting the ID" which does not imply auto-search but you don't want a button which sort of does imply auto-search.

You might even get away with a drop down combo box.

More detail means a better answer.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Trump is back to complaining about how NAFTA has been a total disaster for the US wrt Canada. He is attacking uson dairy, softwood lumber and energy.

Dairy:

In 2016 American dairies sold about $500,000 more milk in Canadian markets than Canadian in American markets. Winner: U.S.

Energy:

NAFTA requires that oil and gas sold to American markets must be tariff free. It also requires Canada to sell to the US even in times of oil/gas scarcity. Winner: U.S.

FYI: For Manitoba generated hydro-electricity (the only producer I am familiar with as an former employee of the Manitoba Hydro Control Centre), aside from long term contracts, we offer energy to a "pool" comprising Manitoba, Saskatchewan, Ontario and a number of MidWestern States at market prices. Buyers are free to buy or not based on their cost to produce the same power.

Softwood Lumber:

Yes, Canada charges low stumpage fees to the logging companies and this is one of the reasons our lumber is cheaper. However, if we were to stop selling lumber to the U.S, their housing construction would likely suffer a severe curtailment.

Likewise, if we were to shut off our export of power from BC, Manitoba, Ontario and Quebec, there would likely be a great hue and cry from down south (even though it was apparently OK for California power companies to create rolling blackouts to create artificial shortages and boost the prices/profits).

Trumps "disaster" talk is just more of his bluster. He sets his anchor point so …

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Are we feeling better yet?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I have no idea what that picture represents or how it relates to Sudoku.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I love doing Sudoku puzzles. What I don't like doing is doing them by hand with pencil and paper so I wrote a vb.net app that takes out the drudgery (writing, erasing, writing, erasing...). It doesn't have any smarts built in (that would take away the fun part). What it does do is eliminate numbers from all related cells when I solve for a single cell. To get you started, here is the elimination algorithm. Note that this is for regular Sudoku (I don't know what a triple Sudoku looks like). Each cell initially has a set of possible digits (1-9).

1.When a cell is solved, scan all cells to the left and right and eliminate the solved digit from the cell set.

  1. Scan all cells above and below and eliminate the solved digit from the cell set.
  2. Scan all cells in the local 9x9 grid and eliminate the solved digit from the cell set.
  3. Scan all cells to see if there are any new cells that have been reduced to a single element in the cell set (solved). If so then repeat these four steps.

To add some smarts (self-solving) requires more ingenuity. For example, if you find two cells in a row, column or local grid, both with the same two digits, you can eliminate those two digits from all other cells in the same row, etc. The same applies to three cells with three digits, etc.

You might want to have a look at

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I got the chest thing last winter and for the first time in years I managed to fight it off before it turned into bronchitis. Hope you are feeling better soon.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'll give that a look although I take issue with the "temporarily" part.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Or, in other words,

If you're going to shoot, shoot. Don't talk.

  • Tuco (TGTBATU)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Why do you insist on writing this in VBA? Why not vb.net which has more capabilities and less overhead?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Works for me here as well in Canada. Windows 10 & Chrome. Also works in Firefox. I might help if you told us what OS and browser, or even what device you are trying to view it on. It's kind of like saying "My car doesn't work. What is wrong with it?"

rproffitt commented: Location matters. Seems some parts of the galaxy block Vimeo. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What have you got so far?

rproffitt commented: Yes. "Show Me What You Got." +12
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Trump is now complaining about Canada's "unfair" dairy practices which he complains is hurting American dairies. Funny how he doesn't mention the billions of dollars that go to American agribusiness as an unfair subsidy. He also doesn't mention the uncountable times he shouted "America First" before and after the election. I guess only the US is allowed to protect its own industries.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Can you be a little more specific?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Why would the US lie just so they can make a mostly ineffectual show-of-force strike?

perhaps it was done as a warning to North Korea, like how the two nuclear strikes on Japan were not just a final strike at Japan but also a warning to Russia (two birds with one stone so to speak). I expect it will have the opposite effect on North Korea. Instead of capitulation it will just drive further posturing/aggression.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's seasonal. In the winter I like cross-country skiing. In the spring and fall it's roller skating, and in the summer it's biking and canoeing. And, of course, reading all year round.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Glad you were able to work it through. You can find me (and many other fine people, by the way) right here.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Back to my question. If you want to know how long it takes to do the add, doing it through vba is pointless. Just run the executable directly. Also, you are just going to get a value of 0 for testing one addition. Even if you put in a loop to do the operation a million times you won't be able to distinguish between the time it takes to do the addition and the time spent on the rest of the loop processing.

As for writing the text file, try putting the full path and file name of the file you want to write. It's entirely possible the file is being created, just not where you expect it to be.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I didn't claim that anyone was "as bad" as Assad. I just wanted to point out the hypocrisy of the "they shot him ten times but I only shot him once" type of argument. Dead is dead and dying by white phosphor or napalm is probably as bad as by Sarin, Zyklon B, Phosgene or mustard gas. They are all weapons of terror.

The there's MK Ultra. Nobody's hands are clean.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

PS: You should have read the thread that you originally posted in. It gave the same answer that I just posted.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm assuming it is powered by the USB connection. If so, does it work when you use a short cable? If it does than I'm guessing that it just barely gets enough power through the short cable and the power drop over the longer cable means it isn't getting enough power to work.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Rather than whether the US is sufficiently virtuous to be the one handing out the punishment

*cough*

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Possibly. I can't see anything useful in what OP is trying to do, but there is nothing overtly malicious either. I'm basically just trying to show him how two simple things work. At this point I think I'll just give up.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

As an afterthought, I still don't understand why you want to do this through vba. Who cares if it takes a while to build it theough the IDE? You only have to do that when the source code changes. You only have to automate something when it has to be done repeatedly. And if you are going to do it through vba, starting your vba app is going to be a manual process anyway (most likely) so what have you gained by adding in the extra step?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The command line you are executing with Shell has spaces in it so you have to add extra quotes just like you would if you were running it from the command line. For example, if you ran the following from the command line

C:> C:\Program Files\Folder\test.exe arg1

you would get an error so you would have to type it as

C:> "C:\Program Files\Folder\test.exe" arg1

Inside vba you would have to do

ret = Shell("""C:\Program Files\Folder\test.exe"" arg1", vbHide)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

if you've forgotten Vietnam as well

Yeah. I would think that any reasonable person would classify untold millions of gallons of Agent Orange as a chemical weapon.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Can you build the exe file from the command line?

Can you build the exe file using the same command but from within vba via the Shell command?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Or perhaps

for (int i = 1; i <= 10; i++)

or

for (int i = 1; i <= 10; i += 2)

depending on whether you need to increment by 1 or by 2. Also with i in lowercase because uppercase is typically used for consts.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

i used batch file in order to lauch Vs compiler

I still don't understand why you are doing that.

i dont know if it is possible directly through VBA or not

I don't have Microsoft Office so I can't test this so I suppose the best way to find out is to follow my steps above. Make a small test VBA that does nothing but run an exe.

but i didn't store the time process in the text file, how can you explain this

I can't. Mostly because your console application (which somehow has a form) is a black box and you didn't post the code. If you are going to give me the information I need to help in bits and pieces then one of two things is going to happen

  1. You might get an answer but it wiull take a very long time.
  2. I'll get tired of asking for more information and I'll just quit helping.
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm not clear on what you are asking but my usual approach when trying to automate something is to do it in stages rather than jumping immediately to the final step. What you are trying to do (from what I gather) is

vba -> batch file -> devenv -> build solution

The first thing I'd do is try running the build directly from the command line

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" "d:\my\Documents\Visual Studio Projects\ClipToJPG\ClipToJPG.sln" /build

then check to make sure the solution executable has been created. Once you know that works you can try shelling the same command line from within VBA (delete the solution executable first so you can see if it has been recreated).

Then you can create a simple batch file to do something like launch an app (like calc). Make sure this runs from the command line, then try to execute it from VBA. This will show that you can execute a batch file.

Once that works, try creating a batch file to execute the same vb.net build (although I don't see why you need to add this complication). Try running that from within VBA.

The trick (if you can call it that although it's just basic troubleshooting) is to see where the problem is. If you just throw all the parts together and it doesn't work then it's hard to figure out which part is the problem.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Funny how nobody has mentioned the use of chemical weapons by the US military. I guess it's OK when the "good guys" use them.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Try Shelling devenv instead of test.bat

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Aside from moving a few things around (again), missing the control panel (which they had already said was on the way out), and having an extra 8 gig free on my C drive, I don't see much difference.

Oh, yeah, one other thing. Even though I (re)disabled OneDrive, I started getting pop-ups recommending that I complete my OneDrive registration so I could get a "free" 5 gigs of online storage. I have about 14 TB of local storage so I really don't need another 5 gig. Plus, why would I want to give my data to someone else? Especially since Microsoft told everyone who used the (I think it was) 10 gig of OneDrive storage that they were shrinking it to 5 so "please download your stuff before it gets deleted".

I ended up stubbing out OneDrive.exe so it would stop pestering me. I expect it will be unstubbed with the next, and each subsequent round of Windows updates.

But I'm not bitter.~

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Read the message. It says you have a syntax error. I tried

devenv clipjpg.sln /build

on one of my projects and it compiled/built the executable with no problems.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can run devenv.exe and build your project from the command line. Type

devenv /?

to get the command line arguments/switches. You'll have to spawn it as an external process. Use the vba Shell call to do that

ret = Shell("command line with args", vbNormalFocus)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Assad just made a statement claiming that the photos of the dead babies following the chemical attack are fake. I'm waiting for Trump to issue a statement like "Who does he think he's fooling with this fake news crap?"

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If anyone is interested, you can still get at the old control panel by opening Explorer then pasting

Control Panel\All Control Panel Items

into the address bar.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Have a look at this and see if it helps.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I had heard it was being phased out. Most sub-items can still be run by executing the appropriate .cpl file.

I managed to clean out the windows.old folder by running Disk Cleanup but you have to select C: first, then click Clean Up System Files, then select C: again, then wait for it to scan your drive, then check the appropriate check boxes, then click OK.

God damned Microsoft. It would have been far easier to select the folder in Explorer and click delete or do

rd C:\Windows.old /s /q

from the command line.

And, by the way, the new driver got loaded in again. I set my connection to metered. At least the creator's update enabled that feature from the GUI. I put my old driver back in and made a disk image. However, this means I can no longer do any Windows updates unless I want to fight with the driver again.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In order to resolve a problem whereby Microsoft keeps updating my video driver (which works) with a newer version that is crippled, I installed the Windows 10 Creator's Update. So far it

  • Reset driver update back to auto (I had disabled it)
  • Re-enabled OneDrive (I had disabled that as well)
  • Re-installed the shitty video driver (screen rotate no longer works)
  • Disabled my Trend Micro anti-virus
  • Left me with a Windows.old folder which I am having fun trying to delete

I'll post more problems as I find them.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I found a setting (available AFAIK only from the old control panel - which MS is planning to remove) that allows me to disable automatic driver updates. I reloaded a system image from 09:00 today. When the system restarted, I went to the setting and set it to disable. However, by the time I had done that, MS had once again updated my driver. This time I disiabled my wifi, then uninstalled the new driver before re-installing the older one. Once Ii restarted and verified that the driver was workinig as expected (and that my auto-update was still disabled) I re-enabled my wifi. As I was typing a response to the Iintel support person, my display went black for several seconds so I knew that the f###ed up driver had been forced in yet again.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Microsoft is at it again. My video on the laptop is powered by Intel. It has a nice hotkey rotate feature that lets me quickly rotate the video. After a recent MS update, the rotate no longer worked. It even removed the rotate setting options from the Intel control panel. After contacting Iintel I got a fix. They linked me to the correct driver. Once installed everything was working again. And then Microsoft automatically downloaded the driver update again. So yesterday I put back the correct driver. This morning MS once again f###ed it up.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Yeah. I checked the link before I posted. WP could be Word Perfect (probably defunct) Word Pro, or any of a hundred other possible initialisms. I didn't want to assume. There's a lot of software out there.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

And what is WP?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Not sure how some of you can be so sure about the chemical attack.

I'm not completely sure but given Assad's history, he's used chemical weapons before. I'm willing to believe until there is any evidence otherwise. Then again, there are CIA documents that were declassified years ago that proved they had planned false flag attacks on American targets to justify an invasion of Cuba, so anything is possible.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Trump has asked PBS Kids and the Children's Television Workshop (at the last minute) if they could send characters from Sesame Street to the White House annual Easter Egg Roll. Please note that Trump has publicly stated he wants to cut all funding for the arts, including funding for PBS and Sesame Street.

The event has drawn as many as 35,000 attendees in years past but this year, schools, veterans and other groups have yet to receive their invitations. Look for a severely scaled-down party this year, followed by a Trump tweet declaring that it was the best and biggest attendance ever in the event's 140 year history.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Not really, airports can function with as little as just a runway which is not much more than a flat bit of land.

Then I have to wonder why they couldn't have made the same point with 5 missiles instead of 50.