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

I've been a Windows user right from the start and I've seen many problems that resulted in the infamous checking for a solution to the problem. I'm curious. Can anyone tell me if they have ever had an instance where Windows has actually found a solution?

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

You can start by reading the Daniweb Posting Rules. Then you can Read This Before Posting a Question. You also might want to read everything that has already been posted in this thread.

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

I don't know how you'd do that in a query (or if it is even possible. What I would do is go through the table and build a dictionary using val(b1) & "," & val(b2) as the key and the frequency as the value. Then I would scan the dictionary and pick the keys with the highest frequencies. Implementation depends on the language you are using.

Sometimes, even if you can do it in a query, the query can be so convoluted that it is cleaner to do it in code.

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

My next question is "most common pairs of what?"

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

Probably not going to happen with such a bare-bones description. How about giving us the schema, some sample data and what you expect to see as a result? How do you define "most common pairs"? Do you mean the two most common, five most common?

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

Please start a new thread for your question.

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

Glad to help.

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

Let me get back to you with the a-b.jpeg variant. The above code won't handle that yet. Before I do that, how does the other file name work? According to your original spec, this allows for something like

john-doe.jpg

Basically, only one file per person. How many files of this type do you have?

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

when i dubleclick the sortfiles.vbs exactly nothing happens

That's because you didn't read the instructions. I told you to run it by

cscript sortfiles.vbs

Apparently I was unclear in that you do this from the command line. vbScript files are executed by either cscript.exe (console) or wscript.exe (window). The default is wscript.exe and when run with the default, each echo pops up a msgbox. If you run it the way that I suggested you force it to run under cscript.exe and each echo writes a line to the console window. You can force cscript.exe to be the default by running (from a console window as Administrator)

cscript //h:cscript //nologo //s

Following that you can run the script from the command line by simply typing

sortfiles

It will take longer to run with all the echo statements but it's worthwhile in case something goes wrong - you can see exactly where it stops.

Okay i got it, but it sems like i have titles with just a-b.jpeg is it possible to process like that also ?

It certainly is but you didn't include that in the original spec. You could change the code to

set fso = CreateObject("Scripting.FileSystemObject")

for each file in fso.GetFolder(".").Files

    ext = lcase(fso.GetExtensionName(file.Name))

    if ext = "jpg" or ext = "jpeg" Then
        flds = Split(file.Name,"-")
        if Ubound(flds) >= 2 Then
            folder = flds(0) & "-" & flds(1) & "\"
            if not fso.FolderExists(folder) Then
                Wscript.Echo "Creating folder",folder
                fso.CreateFolder(folder)
            end if
            Wscript.Echo "Moving:",file.Name
            Wscript.Echo "    To:",folder …
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The script looks at all jpg files in the folder. If the file name has at least three fields separated by "-" then it creates a folder name from the first two fields and moves the file. In other words, it will process

a-b-c.jpg
a-b-c-d.jpg
a-b-c-d-e.jpg
etc

but not

a-b.jpg

If you replace

fso.MoveFile file.Name, folder

with

'fso.MoveFile file.Name, folder

(commented out) then you can run the script to see what files would be moved without actually moving them. When you say "nothing happens" what exactly do you mean? What is echoed back in the command window? Did you save the script file in the same folder as your jpg files? I tested the script by creating the files

Stefan-Rafa-400x500-123uirjht5-1.jpg
Stefan-Rafa-300x300-12a32s-1.jpg
Stefan-Rafa-100-123uirjht5-1.jpg
John-Doe-400x500-123uirjht5-1.jpg
John-Doe-3-1423555-400x200.jpg
John-Doe-300x300-123uirjht5-1.jpg

and running the script. It worked as I understand you wanted it to.

D:\test>dir /s
 Volume in drive D is D-Data
 Volume Serial Number is 366A-6FA3

 Directory of D:\test

2017-08-21  08:14    <DIR>          .
2017-08-21  08:14    <DIR>          ..
2017-08-21  08:14                 0 John-Doe-300x300-123uirjht5-1.jpg
2017-08-21  08:14                 0 John-Doe-3-1423555-400x200.jpg
2017-08-21  08:14                 0 John-Doe-400x500-123uirjht5-1.jpg
2017-08-21  08:14               613 sortfiles.vbs
2017-08-21  08:14                 0 Stefan-Rafa-100-123uirjht5-1.jpg
2017-08-21  08:14                 0 Stefan-Rafa-300x300-12a32s-1.jpg
2017-08-21  08:14                 0 Stefan-Rafa-400x500-123uirjht5-1.jpg
               7 File(s)            613 bytes

     Total Files Listed:
               7 File(s)            613 bytes
               2 Dir(s)  916,313,260,032 bytes free

D:\test>cscript sortfiles.vbs
Creating folder John-Doe\
Moving: John-Doe-3-1423555-400x200.jpg
    To: John-Doe\
Moving: John-Doe-300x300-123uirjht5-1.jpg
    To: John-Doe\
Moving: John-Doe-400x500-123uirjht5-1.jpg
    To: John-Doe\
Creating folder Stefan-Rafa\
Moving: Stefan-Rafa-100-123uirjht5-1.jpg
    To: Stefan-Rafa\
Moving: Stefan-Rafa-300x300-12a32s-1.jpg
    To: Stefan-Rafa\
Moving: Stefan-Rafa-400x500-123uirjht5-1.jpg
    To: Stefan-Rafa\

D:\test>dir /s
 Volume in drive D is D-Data
 Volume Serial Number …
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I don't normaly just provide code but

  1. It's pretty simple
  2. I'm really bored

Copy the following code into a file named SortFiles.vbs in the same folder containing your images. If you run it by

cscript sortfiles.vbs

the script will create the required folders under the current folder and move the files into each folder as requested. I suggest that you make a copy of the images in another folder for safe-keeping before you run the script. You can always delete the copy after you see if the results are what you wanted.

set fso = CreateObject("Scripting.FileSystemObject")

for each file in fso.GetFolder(".").Files
    if lcase(fso.GetExtensionName(file.Name)) = "jpg" Then
        flds = Split(file.Name,"-")
        if Ubound(flds) >= 2 Then
            folder = flds(0) & "-" & flds(1) & "\"
            if not fso.FolderExists(folder) Then
                Wscript.Echo "Creating folder",folder
                fso.CreateFolder(folder)
            end if
            Wscript.Echo "Moving:",file.Name
            Wscript.Echo "    To:",folder
            fso.MoveFile file.Name, folder
        end if
    end if
next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If it's not replacing then it's not the right code.

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

Can't see what he did to deserve it this time.

Consider it like a lifetime achievement Oscar for his accumulated body of work.

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

If you have "world beating" ideas, you don't actually have to reveal them to be successful, at least in the short term. You just have to find enough idiots who believe you. Example "I have a secret plan to defeat ISIS"."

Then again, that same person said in his book, "You can't con people, at least not for long. You can create excitement; you can do wonderful promotion and get all kinds of press, and you can throw in a little hyperbole. But if you don't deliver the goods people will eventually catch on."

Eventually people just learn to ignore you.

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

How is it in a thriller/suspense movie or show, whenever someone turns on the TV to see if there is anything about them on the news, when the TV comes on, not only is it on a news channel, the story they are interested in is the one currently airing?

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

most electricity is generated by burning fossil fuels (and renewables cost about the same for electricity generation anyway) I'm not surprised there isn't much difference.

Even if the electricity is generated by burning fossil fuels, consider that it is cheaper to generate the power centrally at one plant and distribute that power than it is to generate the power at hundreds of thousands of ICEs. It is far easier and more cost effective to put scrubbers on a smokestack than on each vehicle. Power plant generators also burn fuel much more efficiently than cars.

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

Not to mention that when you are stuck in traffic, waiting for lights to change, trains, etc. you are using zero power as opposed to idling in your ICE.

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

Well, first I would learn how to program in C++. What I would not do is ask someone else to do it without showing that I had put some effort into doing it myself first.

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

Hold the phone Chuck. What if we feed the tuna fish mayonnaise before we kill them and put them in the can?

  • Bill Blaze - Night Shift [1982]
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

how else will governments deal with their revenue shortfall

In Manitoba, the bulk of our power is hydro-electric. Government already charges tax on every kwh I use. On top of that, the provincial government charges Manitoba Hydro a hefty fee every year for "water rental". Basically MH pays for the right to use the waterways for generation. They will collect less in taxes from gasoline but more in taxes from electricity.

Personally, I'm hoping to get one of those solar roofs Elon Musk has been touting.

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

If you are running windows 7 you can do a freeze to free up a good chunk of space. Windows keeps around a lot of old crap after installing service packs in case you want to do a rollback. Doing a freeze removes the uninstall files. To do a freeze, open a command shell as Administrator and do

DISM /online /Cleanup-Image /SpSuperseded

Be prepared to leave your computer alone for up to an hour. You might want to do a dir before and after to see how much space is freed up.

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

Based on a news story from Winnipeg this week there are also other things to be considered. A woman in a condo here in Winnipeg has been charging her electric vehicle in the condo parking lot. In response, the condo association has turned off the power to the lot figuring (and rightly so, IMO) that the rest of the condo owners should not be subsidizing her driving.

Currently (pun intended) apartment, condo and employee parking lots provide power for cars in the cold winter months. They typically allow for one block heater per vehicle and some even allow for an interior car warmer (although I have never used one). As electric cars become more prevalent, infrastructure will have to evolve to allow residents/employees to charge their vehicles with some type of auditing to determine how much power is personally used.

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

I don't know if this is an option, but shouldn't electric cars have solar panels built in to the roof so that they would charge in the daylight without having to be plugged in? I would think that sitting in the employee parking lot for 8 hours would allow some significant charging. Any electrical engineers out there who could add some numbers to that thought?

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

I think it is inevitable. Our next vehicle will definitely be electric as will my younger son's. Our elder son has a Prius that he swears by. As battery technology evolves, older, lower capacity batteries could be swapped out with newer ones without the expense of a complete car replacement. Swapping would be a matter of minutes rather than the hours it takes to replace a conventional engine.

Elon Musk will continue to revolutionize the solar/electric industry. He just released the cost of his new solar tile roof system. It will be about 20% cheaper than a conventional tile roof and will be durable enough that he is willing to guarantee it for the life of the house.

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

Are you looking for something like teracopy?

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

Y'all might want to have a look at this article.

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

If it's created to the standards of most software overall, absolutely not.

Ah yes. The old "we skip the testing and pass the savings on to you" business model.

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

As I understand it, his response to the troll label is "it's a silly sounding word so it doesn't apply to me." A Trump-worthy counter-argument if I ever heard one.

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

Have you tried listening to something like Delta Waves?

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

I just got through three nights where I was wide awake from 1-4am. One of them was a beautiful, war[m], clear night with a full moon so I went down to the lake and sat on a rock for 1/2 hour. Much better than lying in bed, tossing and turning.

<embarrassing typo corrected>

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

Please read the Daniweb Posting Rules. Pay particular attention to the sections about posting in old threads and posting in all caps.

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

nobody should store their backups in compressed form

I use Macrium Reflect for my imaging and I alwys use compressed. However, I also use verify. Before that I used Acronis for years (corporate as well as personal). In all they years I have never had a backup image refuse to restore because of a corruption. In any case, I do a full image (automatically) on the first of every month and a differential every other day. Even if one were to get corrupted I would only lose out on one day.

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

I have had the odd project get corrupted like this and the only solution I could find (if you can call it a solution) is to rebuild the project from scratch. Fortunately you should still have all the code (.vb) files to copy/paste into the new project. You might even be able to recreate the form easily by copy/paste into the designer file. Make sure to keep a copy of the old project files as a backup.

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

You'll increase the odds of getting an answer if you start a new thread rather than hijacking an old and already solved thread.

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

the entity most at fault or most negligent should be held responsible

That's the way it is supposed to work but we all know the lawyers go for the deep pockets. No point in sueing the guy who is making minimum wage.

I think you hit the nail on the head WRT the medical devices analogy.

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

How about letting the potential owner fill out an ethical questionaire with choices in common scenarios. The car would decide based oion the weights assigned from the answers. That way the car is acting as the agent of the owner and the owner can thereby be sued for damages, wrongful death, etc. These questionaires already exist online for ethical research.

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

only the 1% will be able to afford their own cars anyway

If you are in the 1% then you probably don't drive your own car anyway. Having a human driver is just one more person you can feel superior to on a regular basis. Unless its a $250,000 Ferrari in which case you don't want it to drive itself.

As for the emergency braking, I believe that is a feature in some non self-driving cars already.

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

In 1981 while driving past Moosejaw, Saskatchewan just before sunrise, a deer ran out in front of my car. I swerved to avoid it (not entirely successfully). My swerving was not a choice. There was no conscious decion made. It was an instinctive reaction just like when you blink when something is coming at your face suddenly.

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

Username is a text field so the comparison value must be quoted. Compare

SELECT * FROM table where username= hai

with

SELECT * FROM table where username= 'hai'
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
If TextBox4.Text == TextBox10.Text Then
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

than it would be if it would drive through my little home town Mechelen

So that would make you the Mechelen Man? (probably different pronounciation). Appropriate for a thread abour cars.

download.jpg

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

Why not just compare the string values?

rproffitt commented: Sounds equivalent to the intent. +12
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

HG would crash to avoid an animal.

I believe HG said it would be an "instinctive" reaction rather than a conscious choice. You are incorrectly (or incompletely) restating his position.

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

Do you really think that if people can't even be bothered to post in the Programming section that they'd bother to post in a specific language forum?

rproffitt commented: My observation is many think the Community Forum is for all questions. "Ask the community?" Yes. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Fine. You?

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

Please start a new thread for your question. Please provide more information than "Code broke. Please help" if you want a meaningful answer.

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

If possible, show us what you have so far.

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

Lawsuits for injury or wrongful death would have to filed against the software companies instead of the (former) driver. At least they'd be going after the deeper pockets.

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

they treat every word of online communication with the same amount of deliberate thought and intent as you treat your primary form of communication.

When I'm shooting the sh!t with my friends, then, yes, you are probably correct. But shooting the sh!t is not my primary mode. The problem is when these same people communicate as if all conversations should be had on that level. When someone is seeking my assistance I expect a higher level of conversation than "Dude. Code broak. Plz hlp."

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

You can do it using AutoIt (free). If you create the AutoItX object within your program you can get the value in the calculator by

calc = "Calculator"

If aut.WinExists(calc) Then
    result = aut.WinGetText(calc)
Else
    MsgBox(calc & " window not found")
End If