Any tips?

J

James Kanze

[...]
Yeah, me too -- IMO python beats why bother with old scripting stuff
when it provides all the power, is portable and reads like a real
language instead of emulating the old modem output before NO CARRIER. :->
perhaps I need to look at Python again. I choose Perl for its
integration of regexps. It looked like the language awk should have
been to me.

AWK is the language AWK should have been. AWK is an excellent
language for what it was designed to do, and I still use it a
lot. Mainly in interactive mode, today---for one liners from
the command line, AWK still beats anything else I've seen. I've
tried Perl at various times, and each time, went away
disgusted---it's probably the worst real language I've seen.
Python's pretty good (although the way it handles iteration is
really, really bad), but for one liners from the command line,
you still have to import too many libraries (like re), and
explicitly loop over the input. It's also very easy (but quite
verbose) to create plug-ins for Python.
 
J

James Kanze

and what evidence do you have that this is easier with vim/bash/make
than VS? Just saying so isn't enough. As I say I've worked in both
environments I don't see the massive disparity you claim. I think
there's a little bit of unix bigotry.

Personal experience. And I do know Windows and VS now.
Originally, I put my lower productivity under Windows down to
the fact that I wasn't familar with it. Now, it's gotten to the
point where every time I want to do something, I can't find the
proper support in VS, and none of the so called experts seem to
know how to do it either---they often seem surprised that such
things actually can be done.
yep. And turn off a bunch of MS extensions and explain you want to use
ASCII and I think a couple of other things. Out of the box VS isn't a
C compiler.

Out of the box, neither is g++, nor Sun CC. The difference is,
perhaps, that in the Unix world, you expect to have to actually
read the compiler documentation, and determine what options you
need for your project. VS pops up with two default
configurations (Debug and Release), neither of which really
corresponds to what you might want to do in most cases. (My
personal libraries are developed with with something like eight
different configurations: optimized or not, profiling or not,
multi-threaded or not.)
not just beginners

It's a lot like C++. When you being, you're overwhelmed by how
much you need to know. With a little experience, however,
you've got a good tool set for your style of programming, and a
number of more or less standard idioms, and you can knock out
complex programs in very little time.
ok. I think you have me! The last VS project I worked on we avoided
such things (probably because it was hard). The only thing that did do
this seemed to rebuild everytime even then it wasn't necessary.

*Not* generating significant amounts of code by machine results
in an enormous loss of productivity. I'd have to go back 25 or
30 years to find a project in which there wasn't a lot of
machine generated code. Why should I waste my time doing things
the machine can do better?
really? What tools? sed and awk and such like?

Sed, awk and grep are the three standard ones. Each of which
has a subtly different form of regular expressions. (In the
case of grep, of course, there's grep, egrep and fgrep, each
with a different version of regular expressions.)

Once it gets too complicated to just type in at the command line
(say after about 10 lines of code), I'll switch to Python. It's
a bit of a shame that you need boilerplate to get os, sys and re
(since I almost always need them), and having to explicity loop
over each line (rather than implicitly, and is sed and awk)
makes for an extra line or two, but on the whole, it still
works pretty well.

Under Windows, I'll also use Python sometimes when C++ would be
better, simply to avoid having to create an extra project, and
project dependencies, just to get an .exe to generate my code.
 
W

woodbrian77

Under Windows, I'll also use Python sometimes when C++ would be

better, simply to avoid having to create an extra project, and

project dependencies, just to get an .exe to generate my code.

I suggest to bite the bullet in those cases. Long term
you'll be glad you did.
 
J

James Kanze

I suggest to bite the bullet in those cases. Long term
you'll be glad you did.

If it were just me...

The problem is that I'm producing low level support libraries,
which are used in a number of different solutions. If I
introduce an additional project (and I have in some cases), it
means that all of the solutions which use my library have to be
sure to add the correct dependencies. (The usual way of
specifying dependencies in VS is in the solution file. We've
been trying to wean people from this, and get them to use
references, rather than what VS calls dependencies, but it is
slow business.)
 
B

Balog Pal

Personal experience. And I do know Windows and VS now.
Originally, I put my lower productivity under Windows down to
the fact that I wasn't familar with it. Now, it's gotten to the
point where every time I want to do something, I can't find the
proper support in VS, and none of the so called experts seem to
know how to do it either---they often seem surprised that such
things actually can be done.

I have the same personal experience in the opposite direction. Though
that makes me stop the claims in either way, rather conclude that some
people are way more productive than others; and by all means shall be
left alone to use their tools, whatever those are.

A claim like "now I'm familiar" makes me even more skeptic -- I
personally keep finding better tools I missed every few weeks despite
working with VS for 2+ decades.
The difference is,
perhaps, that in the Unix world, you expect to have to actually
read the compiler documentation, and determine what options you
need for your project.

It's not a difference. You're supposed to know the walk and the talk.
Yet I see majority of people around never bother, just poke around and
experiment on the fly. Then draw conclusion on the system they use.
Independently on the environment.
VS pops up with two default
configurations (Debug and Release), neither of which really
corresponds to what you might want to do in most cases.

IME that makes perfect sense for most things, and proliferation of
configs is suspicious at best. While there are plenty of examples to
handle different config options inside the module -- along with checks
or alterations of settings. As you can do much with #pragma, and from
outside use just define-s.
(My
personal libraries are developed with with something like eight
different configurations: optimized or not, profiling or not,
multi-threaded or not.)

For libs it makes more sense, though to me profiling looks like a local
alteration rather than a config -- and ST I think I just never used --
does it have any actual advantage?

But AFAIK it is not hard to save your project as an appwizard template
so once you created your prototype with the 8 configs, can use it for
all subsequent projects.
It's a lot like C++. When you being, you're overwhelmed by how
much you need to know. With a little experience, however,
you've got a good tool set for your style of programming, and a
number of more or less standard idioms, and you can knock out
complex programs in very little time.

Yeah, but complex need not mean a certain way. I.e. code generation can
be used put in the build through a translator or a prebuild step -- but
you may just run it by hand and put the result in the sources directly.
Depending on the change probability the latter may be ways more
efficient. And simpler.
On windows the most prevalent generation step is related to COM, but
it's supported internally through #import. So you can travel many miles
before even the old-style, way limited VS project management becomes
insufficient.

The need to use makefile usually comes from non-native requirements,
cross-platform projects or people coming from other realm and bending
the system to their familiar way.

Or not really necessary. :) Actually with the msbuild-based way it's
not that hard, and examples can be found in OS projects.

Guess you did not specify inputs/outputs correctly. ;)
*Not* generating significant amounts of code by machine results
in an enormous loss of productivity. I'd have to go back 25 or
30 years to find a project in which there wasn't a lot of
machine generated code. Why should I waste my time doing things
the machine can do better?

IMO that should depend on the project nature. And with C++ you have a
plenty of internal mechanisms that work fine generating code (macros,
templates). The cases I recall related to generation had their substrate
changing only once in 2-4 weeks (database schema, XSD, message
descriptions), so executing the translators by hand was perfectly fair
game. And imposing it on every build be a waste of resources.
Sed, awk and grep are the three standard ones.

And with VS you have most of their use cases built-in. in advanced form
too, as you can select for scope "all files in project/solution" tuned
with extensions -- a thing that is hardly trivial from command line.

And hopefully everyone is aware of the native win32 build of all the gnu
tools that work fine from windoze command line -- and where the shell
rules are needed the easiest is to summon a git bash :)
 
B

Balog Pal

The problem is that I'm producing low level support libraries,
which are used in a number of different solutions. If I
introduce an additional project (and I have in some cases), it
means that all of the solutions which use my library have to be
sure to add the correct dependencies. (The usual way of
specifying dependencies in VS is in the solution file. We've
been trying to wean people from this, and get them to use
references, rather than what VS calls dependencies, but it is
slow business.)

Hm, IMO using the 'project dependencies' is a thing that should be
banned (except for C# mix and similar handicapped stuff). And project
reference be the only allowed way.
 
B

Balog Pal

I'm not so proficient in msbuild to provide actual counterexample code
but am 99% positive that claim is false. You can use a wide range of
string manipulation and other functions -- I do in practice. [it was a
year ago when I had to fix the build of or project]. I recall i could
use anything you can do with a C# String.

I'm basing my statement on the reference
(http://msdn.microsoft.com/en-us/library/7szfhaft.aspx).

That is certainly true, but only half of it. The condition itself is
only == but you can use expressions with lhs and rhs.
If
some form of regular expressions are supported, Microsoft isn't
documenting the syntax needed to use it.

Just try the expressions I referred to in previous post. I definitely
used them in my common .props -- could post example from a different
machine only.
In practice, I have no idea what solution files are being used.

Well, I see your case from the other branch -- indeed it has some
challenges.
I deliver library components, which other groups merge into
their final product. I can't make an exhaustive list of all
solutions, because I don't even know all of my clients.

I recall two approaches for such situations. One compiles the component
in several versions, distribute the binaries (that have suffixes for
versions) and .h, the latter has magic to figure out the proper variant
and sets it as defaultlib.

The other is to compile from source -- with that it is natural
expectation to follow all the prescribed steps to add the project or
project group.

And here it's possible to map configs in the build manager -- the
solution has the usual 2 (debug/release), and for your project selects
the desired variant of the 8).

The problem with the .h file seems to be fixed in 2012.

Wow at least some progress in a decade.
On the
other hand, VS parallelizes the builds, and error messages from
different projects are mixed in the output.

You have Build and Build order variant for the output window. (in
regular workflow it's rarely needed, enter a failed build I hit the
"build-project only" variant immediately.
For the moment, if
I can't find the error quickly, I'll copy paste the entire
output pane into vim, then run a Python script
(SortOutputByProject.py) over it, then search for error. Once
I know which project isn't building correctly, I can build only
it, and get some usable error output.

The project itself is properly noted in the 'error list' that should be
the primary source of navigation, output is only for the weird cases.
There's a convenient option to auto-switch error list on errors too.
It only seems to be an issue when you create new projects.
Except for VS completely rewriting your filter files whenever
you add or remove a file.

It rewrites everything. Fortunately Git Extensions provide convenient
way to reset unintended lines from change or post-edit the file.
We do. The problem is that the conditionals only support ==, !=
and HasTrailingSlash for strings.

Do you say '$(solutionname).Endswith("64")' == 'true' does not work?
This seems to apply to the MSBuild framework, and not to the
project files; at least, it talks of tasks, which aren't present
in the .vcxproj files (at least not that I've seen).

The vcxproj file is just a top level thing that includes the real
content from other .props and .targets files. You probably should read
the Microsoft.Cpp.targets to see how the build is arranged (including
details of prebuild step), then add your own .targets that define your
code generator in the native way, dropping prebuild madness for good.
 
B

Balog Pal

Do you say '$(solutionname).Endswith("64")' == 'true' does not work?

And if it doesn't directly for any reason, you can use a property to do
the job. I.e. I have in a propertygroup:

<PROJ_UPPER>$(projectname.Replace(' ','_').ToUpper())</PROJ_UPPER>
that is later used as $(PROJ_UPPER) for useful things.

In a similar way you can set properties derived from solutionname and
use them in the conditions.
 
J

James Kanze

On 3/15/2013 6:18 PM, James Kanze wrote:
I'm not so proficient in msbuild to provide actual counterexample code
but am 99% positive that claim is false. You can use a wide range of
string manipulation and other functions -- I do in practice. [it was a
year ago when I had to fix the build of or project]. I recall i could
use anything you can do with a C# String.
I'm basing my statement on the reference
(http://msdn.microsoft.com/en-us/library/7szfhaft.aspx).
That is certainly true, but only half of it. The condition itself is
only == but you can use expressions with lhs and rhs.
[reordered...]

Do you say '$(solutionname).Endswith("64")' == 'true' does not work?

Brilliant. That is exactly what I was looking for. In
practice, I have two known variants I have to support, one of
whose solution files always ends with a common string. (There's
still the third party library issues, but generally, they should
be using the other variant&mdash;there is one which even uses
a completely different version of Visual Studios, but they
accept that they're on their own there, and I do document what
I've done, so that they can duplicate the effects if they need
them) So basically, I'll end up with something like:

<MyAttribute Condition="'$(solutionname).Endswith("ABC")' == 'true'>for IFG</MyAttribute>
<MyAttribute Condition="'$(MyAttribute)' == ''>not for IFG</MyAttribute>

(The set of solutions whose name ends with "ABC" is open, and
has been added to more than once. This used to be a pain, but
I think you've given me the solution. A thousand thanks.)

[...]
Well, I see your case from the other branch -- indeed it has some
challenges.

Yes. What I can do, sort of, however, is impose naming
conventions and suggest default configurations (which we know
work). Beyond that... different groups who want to do just
anything are sort of on their own anyway. We can't test that
the code works in a configuration we've never heard about.
I recall two approaches for such situations. One compiles the component
in several versions, distribute the binaries (that have suffixes for
versions) and .h, the latter has magic to figure out the proper variant
and sets it as defaultlib.
The other is to compile from source -- with that it is natural
expectation to follow all the prescribed steps to add the project or
project group.

Our solution has been for the clients to integrat our library
into their solution files, and compile from source. I don't
really agree with this&mdash;I think it would make sense to
establish a company wide policy with regards to what variants we
support, and how we deliver them (generally in a separate
directory for the DLLs, and of course, the headers are
independent of this). But for various reasons, this doesn't fly
politically.
And here it's possible to map configs in the build manager -- the
solution has the usual 2 (debug/release), and for your project selects
the desired variant of the 8).

We are actually moving to supporting thre configurations. It
turns out that when you have iterator debugging active, some of
parts of the library are so slow that you cannot effectively
debug with real data sets. (You can't debug if it takes you four
hours to reach a breakpoint.) So our debug builds have iterator
debugging disactivated (which in turn means that until VS 2010,
we couldn't use std::string). Still, we've seen more than a few
problems which would have been caught immediatly by iterator
debugging. (Including one case where end() was dereferenced,
which caused one, and only one machine to give wrong results.)
So we want two different Debug configurations, one for tracking
down errors that only show up with real data, and another with
iterator debugging (which hopefully will cause most such cases
to show up in our test suite).

[...]
It rewrites everything. Fortunately Git Extensions provide convenient
way to reset unintended lines from change or post-edit the file.

We're not using git, but I would like to see a Subversion plugin
used to rewrite the filter file. (It's easy to do---just throw
out all of the ItemGroup except the first.)

[...]
The vcxproj file is just a top level thing that includes the real
content from other .props and .targets files. You probably should read
the Microsoft.Cpp.targets to see how the build is arranged (including
details of prebuild step), then add your own .targets that define your
code generator in the native way, dropping prebuild madness for good.

I'm aware of the .props. I'll have to look into the .targets.
Maybe that's the answer.

And thanks again for the tip with regards to how to use the
expressions in a conditional. That's already made my life
significantly simpler.
 
J

James Kanze

Brilliant.

Except that it doesn't work. This is part of the definition of
a property:

<MyProp Condition=" '$(SolutionName).Endswith("ABC")' == 'true' ">xxx</MyProp>

VS won't load the file&mdash;from the error message (something
about token ABC not acceptable), I gather that it doesn't like
the " character in the condition. I've tried replacing the
"ABC" with &quot;ABC&quot;. In that case, the solution loads
correctly (this is in a property file included in almost all of
the projects in the solution), but the condition is never
met&mdash;MyProp is never xxx.

I'm probably missing something obvious, but I can't find it in
the Microsoft documentation.
 
T

Tobias Müller

Balog Pal said:
Hm, IMO using the 'project dependencies' is a thing that should be banned
(except for C# mix and similar handicapped stuff). And project reference
be the only allowed way.

In VS 2005, 'project dependencies' were the only possible way C++ projects.

Specifying dependencies in the solution has also advantages, especially if
multiple libraries share the same interface. You can then compile and link
against different libraries in different solutions.

But in 99% of the cases project 'references' are what you want. But I don't
understand why the referenced projects are not implicitly added to the
solution.

Tobi
 
B

Balog Pal

Except that it doesn't work. This is part of the definition of
a property:

<MyProp Condition=" '$(SolutionName).Endswith("ABC")' == 'true' ">xxx</MyProp>

That's what I hinted in the other message -- I guess the quotes cause
the problem. But the simple workaround must work fine:

<MyPropTest>'$(SolutionName).Endswith("ABC")</MyPropTest>
....
VS won't load the file&mdash;from the error message (something
about token ABC not acceptable), I gather that it doesn't like
the " character in the condition. I've tried replacing the
"ABC" with &quot;ABC&quot;. In that case, the solution loads
correctly (this is in a property file included in almost all of
the projects in the solution), but the condition is never
met&mdash;MyProp is never xxx.

I'm probably missing something obvious, but I can't find it in
the Microsoft documentation.

My guess is the grammar is simplistic, so quotes are hosed. But as
there's no limit on properties, should not matter so much.
 
P

pasa

Except that it doesn't work.

I tried this sln.props:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/
developer/msbuild/2003">
<PropertyGroup Label="UserMacros">
<SLNU>$(SolutionName.ToUpper())</SLNU>
<ST1>$(SolutionName.EndsWith("st"))</ST1>
<ST2>$(SolutionName.EndsWith("ab"))</ST2>
<ST3>$(SolutionName.IndexOf("vs"))</ST3>
<ST4>$(SolutionName.IndexOf("ab"))</ST4>
</PropertyGroup>

<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>SLN="$(SLNU)";ST1="$(ST1)";ST2="$
(ST2)";ST3="$(ST3)";ST4="$(ST4)";%(PreprocessorDefinitions)</
PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$
(ST1)'=='True'">COND1="First";%(PreprocessorDefinitions)</
PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(ST1)'!
='True'">COND1="Not First";%(PreprocessorDefinitions)</
PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(ST3)'!='-1'">COND2="vs
found";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(ST3)'=='-1'">COND2="vs
not found";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>

</Project>

included in a project, in pvst.sln and abab.sln -- works fine and
changes the options as expected
 
W

woodbrian77

In my opinion Solaris (and the numerous OpenSolaris derivatives) have

better developer tools than Linux, especially for analysing applications

(and the OS) in a production0n environment.

I asked about this subject on a Linux newsgroup
here in Minnesota. Here's the reply from Florin Lucha.

Dtrace is a better system performance evaluation tool, and that's
about the only thing that *Solaris has 'better' than Linux at this
point. The Sun^WOracle Studio C/C++ compilers runs just fine under
Linux as well, if you need second set of diagnostics (it usually helps
to keep code clean and portable).

I used to run it in a KVM virtual machine, just for testing purposes.
I tried to run it on bare metal, but the lack of hardware support
reminds me of Linux circa '97. Case in point, I have motherboard
(EVGA with dual onboard Gigabit 3COM/Marvell controllers) that Linux
runs smoothly on. Solaris works as well, and even has driver for the
family of NICs that include my particular model, but my NICs PCI ids
are blacklisted due to some bug that was sitting in a bugzilla for two
years. It did not reach critical mass with enthusiasts so it does
have a bleak future for hobbyists.

OpenSolaris is slowly becoming like MacOS - it only runs on certain
hardware configurations. The 'uber' UNIX hackers at Sun wanted to
keep all the goodness for themselves... now, they can have it, since
nobody else can run it, should they want to. The *BSDs have much
better hardware support.

-------------------------------------------------
 
I

Ian Collins

I asked about this subject on a Linux newsgroup
here in Minnesota. Here's the reply from Florin Lucha.

Dtrace is a better system performance evaluation tool, and that's
about the only thing that *Solaris has 'better' than Linux at this
point. The Sun^WOracle Studio C/C++ compilers runs just fine under
Linux as well, if you need second set of diagnostics (it usually helps
to keep code clean and portable).

DTrace can make a big difference and is one of the main reasons we (my
clients and I) use Solaris bases OSs. Being able to probe a running
application without having to restart or mess about with logging levels
is a huge win. It also helps keep the source free of messy logging
code. An excellent real world example is PostgeSQL:

https://wiki.postgresql.org/wiki/DTrace
OpenSolaris is slowly becoming like MacOS - it only runs on certain
hardware configurations. The 'uber' UNIX hackers at Sun wanted to
keep all the goodness for themselves... now, they can have it, since
nobody else can run it, should they want to. The *BSDs have much
better hardware support.

It runs on just about anything modern and I always fit a decent NIC if
the motherboard has a grotty one...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top