« first day (676 days earlier)      last day (3640 days later) » 

@SimonAndréForsberg phone whistled, mug smiled :)
2
@RubberDuck Why are you selecting * in a stored procedure?
That's horrendous.
@nhgrif I'm not and I know.
So... anyone here good with .bat files?
I'm okay.
For someone born in '85 at least.
2
20:18
lol
What's up?
I need one that looks at directory A, and based on files that exist in directory A, if that file exists in directory B, we move the file from directory B to directory C (which directory C will take the name _YYYYMMDD), and then after this backup has been made, move the file from A to B.
Simple. User Powershell instead.
No..... seriously. Okay.
So.... I'm not that good.
lol
But mostly you just need the Copy and Move commands.
Errrr.... just copy I think.
Copy can do a rename as it copies. What I don't know how to do is check for file existence.
20:22
I don't need to rename anything.
use xcopy /y to overwrite existing
I need to 1) check file existence, 2) create folder (surely move command will create it for me?), 3) move file 4) move file
Well, turns out checking for existing files is easy.
257
A: How to check if a file exists from inside a batch file

Chris Jif exist {insert file name here} ( rem file exists ) else ( rem file doesn't exist ) Or on a single line (if only a single action needs to occur): if exist {insert file name here} {action} for example, this opens notepad on autoexec.bat, if the file exists: if exist c:\autoexec.bat ...

But I need to do all 4 steps in basically a foreach loop based on what exists in Directory A.
that's the part I'm stuck on.
mkdir directoryName
Will create the dir.
20:24
And there shouldn't be an existing.
I thought you only wanted to move B if B existed?
Anyway, here's how to loop over a directory
119
Q: How to do something to each file in a directory with a batch script

Brian R. BondyHow do you iterate over each file in a directory with a .bat or .cmd file? For simplicity please provide an answer that just echoes the filename or file path.

Let me explain this in a less abstract way...
lol. Okay.
Our client app looks at a network location, and if the dll at the network location has a modify date different from the local version of the dll, it downloads that to get an update.
So when we "release" to our beta sites, we move files into this network location
But before we release, we create a folder in the form of _YYYYMMDD, so today's would be _20150311
And any DLL we're going to release, we move the current version into this folder as a backup.
And because one of the beta sites is a couple states away (but still mapped on my local network) and to make releasing less confusing, there's also a "release" folder where we put the DLLs we want to release.
I want a BAT that look at the release folder
Move from the current folder to the date-named backup folder based on whats in the release folder
then move the new DLL into the current folder
So I have like...
That happiness when your code works... That sadness when you realize you didn't enable the new rewritten version, but was using the old version
20:29
Such questions are better posted at codereview.stackexchange.comHolger 53 secs ago
...\BetaLocation
...\BetaLocation\_20150311
...\BetaLocation\_Release
I need to look at _Release, based on what's in release, move from BetaLocation to _20150311, then move that file from _Release to BetaLocation
Is it okay to move the whole folder?
No.
I mean, I could move all of the files in it at once.
Right. Okay.
but I don't want to backup everything from \BetaLocation into \BetaLocation_Date
And I only want the date-named folder created if there are files in _Release
But I want the script to run every day at midnight
I know how to make the server run the .bat file on a schedule
20:31
Ugh. I could write it in 5 minutes in powershell. Not sure how to filter files in cmd.
It would be something like this I think.
And that way the server can move the files so I don't have to spend 30 minutes waiting for them to copy from 2-states-over-to-my-RAM-back-to-2-states-over
@nhgrif does it have to be a .bat? PS is meant to replace batch files after all...
It doesn't have to be a .bat... it just has to be a file (so the network admin has to do bare minimum) that can be set up as a scheduled windows task.
for /f %f in ('dir /b ...\BetaLocation') do if fileext = '.dll' (copy f% '...\betalocation\_YYYYMMDD)
I don't know what the options are on Windows.
20:33
PowerShell dude, PowerShell :)
Does the server need anything special to run PowerShell?
And is it just a text file I can edit in a text editor?
Or I guess editing in VS would be fine.
And it's a file that can be set up to run as a scheduled task on a Windows server?
yup. well there's the PS ISE to help write 'em, but notepad would suffice
I like the ISE. Most helpful.
If I create a file in Notepad++, just save it with... .ps extension? And I can double click it to run it locally to test?
.ps1
there's a bit of a security issue with being able to double-click a batch file to run it - PS addresses that, so no, you don't just double-click.
152
Q: How to run a PowerShell script?

Pekka 웃How do I run a PowerShell script? I have a script named myscript.ps1 I have all the necessary frameworks installed I set that execution policy thing I have followed the instructions on this MSDN help page and am trying to run it like so: powershell.exe 'C:\my_path\yada_yada\run_import_script.ps...

@nhgrif just like any other scheduled cmd.exe call
20:40
Can you make a PS script executable? Like on my Mac, a .sh file isn't executable. Double clicking it opens it up to edit, but there's a command you can run to make it double-click-executable
Meh, I guess I can just run through command line.
@nhgrif this should give you a really good start. It should do the first part of the copy.
(Get-ChildItem -Path 'C:\BetaLocation\' -Include *.dll) | ForEach-Object {Copy-Item -Path 'C:\BetaLocation\_YYYYMMDD'}
idk if it's the best way, but... ya know.
@RubberDuck there's CR for that ;)
PowerShell looks like it can do functions significantly easier/better than .bat perhaps.
and it can access all of .net
I don't need to access any of .NET
20:42
but it can. So the day you need to parallelize that loop, you can
@RubberDuck The files won't all necessarily be a .dll. Sometimes the .exe gets updated. And sometimes there are other things we push.
Yes. I mean.... VBScript replace .bat... and powershell replaced VBScript.... so yeah.
VBScript never actually replaced anything, mate ;)
@nhgrif Then you might want to check the file properties for the date modified, but you should be able to work through that on SO.
@Mat'sMug It was supposed to.
Well... all I need to know is whether or not it exists in the _Release folder.
It should actually move the files (from BetaLocation to _YYYYMMDD and then from _Release to BetaLocation)
20:44
Then maybe start by Get-ChildItem -Path '.\release\'
And, an item in _Release isn't guaranteed to be in BetaLocation.
If it's not in beta location, it doesn't need to back anything up, but it still needs to move it from Release to BetaLocation
This is pretty rare though.
I'll probably just work on this for however long it takes tomorrow at work.
I can't really do anything with it here now.
(I'm at home.)
And... I pretty much get to do whatever I want at work... and this, actually, would be extremely productive.
@nhgrif found your VB guy yet?
@nhgrif Here's how to filter by last accessed time. It might help.
No. Are you looking?
Get-ChildItem -Path C:\Users\users\Documents\ |Where-Object {$_.LastAccessTime -gt "11/18/14"}
20:49
lol nope
@nhgrif I am. Where you at?
lol
The access time doesn't matter.
We're in Fayetteville, AR.
@nhgrif Just an example, from what you were saying, you needed to check to see if it was updated.
Ahhh yeah. I'm in OH. That'd be a bit of a commute.
No it wouldn't. You'd move.
The desktop client checks to see if it was updated. But the desktop client only looks in \BetaLocation
Unfortunately not an option until our littlest one gets older.
Ahhhhh gotchya.
20:51
\BetaLocation_Release is like a staging area for us
Besides, you know my guilty pleasure.
Couldn't work for someone who knows I spend too much time here. =;)-
I don't think you'd actually be working for me so much as with me.
It depends, I guess.
so I figured out that the fake emails had the same domain as the SMTP server, so the connection knew right away that they were fake and kicked back in the code. outside Domains won't do this (as far as I know) and all the users of this application are going to be outside users. no issue.
I'm going to start wall-of-coding CR questions with the XML that my interface builder creates. — nhgrif 3 mins ago
lol. Well, I've gotta go. Good luck with your project. Cya guys.
20:55
@RubberDuck you turn 30 also
It is nice to work somewhere where on a weekly basis, your boss asks you, "What do you want to work on this week?"
2
@Holger I know, I noticed that your comment was an off-topic vote. It is better to vote to close as too broad and then add the comment. Because too broad is a valid close reason for this question, but "better posted at Code Review" is not a reason to close a question. — Simon André Forsberg 10 secs ago
@nhgrif you have that?
Yes.
Also, we're hiring.
Hello.
21:00
Hello.
@nhgrif E-mail me details?
@Malachi Remind me in about an hour?
does @Duga do that?
@Malachi yes!
I am walking to park with gf's kid... So on my phone
21:03
Arkansas wouldn't be so bad....
@Mat'sMug how?
@Malachi @SimonAndréForsberg's magic
3
My two cents on generated code:
0
A: Reviewing generated code

Simon André ForsbergIt depends... What generated code are we talking about? Are we talking about a whole game that has been generated? Good luck in making such a generator in the first place. But even if you did, I would have to say: No. I don't consider this really "your code", even if you did write the method or...

21:18
I'm not sure if they are still advertising for the opening
codereview.stackexchange.com (doesn't look bad to me) — Celeo 1 min ago
The "must have 1-2 years programming experience" is complete bullshit basically.
The one person we interviewed so far had 0-0 years experience.
I have about 1 total year, all said, but I don't know VB.
I don't even know C# at the required level yet :(
21:28
0
Q: Simplifying Multiple "For" Loops [Homework]

SyzorrI have an assignment for writing a Sudoku Solver and have achieved the functionality required but a lot of the code is "ugly" and I'm wanting to simplify it but unsure how to. def hiddenSingleCol(snapshot, cell): j = cell.getCol() # Get column number for cell co...

My 3 cents (assuming each list item is a cent):
0
A: Reviewing generated code

Hosch250 Definitely yes. The generated code can be reviewed as part of the generator's review to help improve the generator. If the question is otherwise on topic, I don't see why not. We can review the code for best practices, and the person can adjust their generator and its output to conform to the ...

0
Q: OOP design of a call center

giulioDesign the classes and data structures for a call center. Rules: Three types of employees: Respondent, Manager, Director. First allocate a call to a respondent. If no respondent is available or able to handle the call, then move to a manager. If no manager is available or able to handle the call,...

@nhgrif thank you
I will take a look at this tonight and talk to my Wife about it. we really want to move to Tennessee though.
It's about 4hr drive to Memphis from here.
public class Employee{
    private boolean isFree;
    private Title employeeTitle;
    public void markFree(){isFree=true;}
    public void markBusy(){isFree=false;}
    public boolean isAbleToHandle(Call call){...}
    public boolean getAvailability(){return isFree;}
    public boolean getAbilityToHandleCall(Call call){...}
    public void processCall(Call call){...}
}
^^ Is this acceptable in a data structure code review?
21:42
IsFree? Because isSlave is too controversial?
isAvailable would be better for sure
Or just "available"
Looks like stub code?
Obviously can't compile the way it's presented, so I'd say yes
I left a comment about it
I cast vtc
I feel like learning to play with arrays, any idea what I could try?
21:50
Chess?
Do the N-queens.
Use an array for the board.
... Phrancis, I will be home in a bit
Can you imagine the amount of money a solitary, proprietary code generator would bring in?
Cool no worries, I'll RTFM about them but if you think of anything LMK
I need to solve the N-queens sometime.
I did an 8-queens solver with a heuristic, but it didn't always finish (it didn't have a backtrack or look-ahead algorithm).
Wait, the 8-queens finished, the Knight's Tour didn't always finish.
Reminding @nhgrif about something about @Malachi
22:04
@Phrancis This will get arrays and file IO all at once.
gutenberg.org has .txt files of literary works in public domain
If you really want to go all-in, you could also incorporate network IO... but perhaps one step at a time..
Create a program that takes a text file and does the following...
1) Count the total number of words
2) generate a list of all unique words
3) For each word, create a list of every line it occurs on (and how many times it occurs on that line) and calculate the total frequency of that word (count/totalWordCount)
So just download any book in plain text and go from there?
Yeah. Pick one of those as the test. Make sure you got all the hardbits working, but then ideally, make your program let the user specify a text file to parse.
@Donald.McLean @rolfl I have been watched!
That should be one of the last (and optional) steps.
OK sounds like a fun challenge!
22:16
0
A: Reviewing generated code

nhgrifIf we were asking about any generated output other than code, the answer would be an obvious and resounding "No, you can't judge a program based on its output." And I know that's not exactly what's being asked here, but that's essentially the intent behind the first two scenarios described in th...

Downvotes, ahoy!
@Phrancis And realistically, the program could probably be made to present the user with the list of .txt files directly from gutenburg.org have them select one, and download it over the Internet rather than requiring the file be local.
TTGH!
You're basically doing this:
A concordance is an alphabetical list of the principal words used in a book or body of work, listing every instance of each word with its immediate context. Because of the time, difficulty, and expense involved in creating a concordance in the pre-computer era, only works of special importance, such as the Vedas, Bible, Qur'an or the works of Shakespeare or classical Latin and Greek authors, had concordances prepared for them. A concordance is more than an index; additional material, such as commentary, definitions, and topical cross-indexing make producing them a labor-intensive process, even...
0
Q: 301 redirect using .htaccess

luke_mclachlanI wonder if the following 301 redirect is the best way for my situation. I used this post on SO to give me the following 301 redirect: RewriteRule locations\.php$ compare-biomass.php [R=301] What we've done is changed a filename from locations.php to compare-biomass.php. The new URL should be...

22:40
Some more cents about the generation business...
Why don't you just ask the question and we'll see what we think about it and make a decision based on your specific question rather than trying to come up with a "one size fits all" general policy? — Simon André Forsberg 1 min ago
Personally, I think the best generator question would be one that included the generator (or parts of it) and some sample outputs for the section(s) included individually.
@Hosch250 the best one, yes.
Once the sections are done, he can post the code that pulls everything together and some sample programs of what the entire things is capable of.
unfortunately, the meta question doesn't ask about the best questions, just if they are on-topic
Code from third-party generators are always off-topic.
Code from first-party generators are a gray area for me.
22:43
Honestly, I don't think I can answer if it's on-topic or off-topic until I see the actual question.
I'm glad meta doesn't change our rep.
0
Q: PHP Code to Parse Config File

George HI was asked to write PHP code that can be used to parse a config file on the same server(same directory as well) and output all configuration parameters, and have them all be cast to the correct type. its only 2 php files and 1 config files. I wasnt allowed to use any of the existing functions m...

@nhgrif Makes sense
My laptop is too hot to touch.
I guess I'd better take a (welcome) break from school.
See you.
23:02
@nhgrif and knoxville is.....give me a minute
like 10 hours
23:15
and also potentially something for World Building...?
23:27
Just so you know, stackexchange has several sites for programming related items. programmers would probably be the place to ask this. If you start development and have written code, but it's not working, here would be the place to ask. Once you've written successful code and want help cleaning it up or making it more efficient, codereview would be the stackexchange to go to. Don't worry, it's a common mistake. — guyfleeman 51 secs ago
I'm voting to close this question as off-topic because it belongs on CodeReviewGert Arnold 36 secs ago
23:46
This is how I decided to put something on the code behind :>
Hilarious. I like the one about airmailing sodas best.
@Hosch250 there's always something interesting to read on BBC, isn't there?
0
Q: isSubstr in C++

testI'm trying to implement a function to determine if a substring is indeed a substring of a string s this is what I came up with but I feel that there must be elegant way #include <iostream> bool isSubstr(std::string s, std::string sub) { if (s.size() < sub.size()) { return false; } for ...

I don't know.
I typically don't read the news.
BBC is my #1 news source.
23:58
I don't have time usually.
I have about 3 essays to write/finish writing, plus two papers.
Plus some videos to watch, and a few other things for school.
RELOAD!
There are 1208 unanswered questions
3
This is the busiest time, and it ALWAYS happens where all the classes start piling the material on.
Thanks @Duga. I like that info

« first day (676 days earlier)      last day (3640 days later) »