Dave++ | Dave plus plus: Like Dave, but one louder.

Web Name: Dave++ | Dave plus plus: Like Dave, but one louder.

WebSite: http://davidcorne.com

ID:153204

Keywords:

Like,plus,Dave,

Description:

With the newer version of cygwin I am running, there are a few flaws. These mainly have to do with how it interacts with printing and user input from windows executables.e.g.The windows python prompt doesn t display. See here for more details.Using mercurial, it can t prompt me for a password. It comes up as abort: http authorization requiredThere are a few little niggly things like this which makes it handy to have the windows console available at your fingertips. You can launch cmd.exe from within cygwin, but that doesn t solve the problem as you are still using the same input/output from the terminal. So I wrote a very simple script which will launch cmd in the current working directory.Here it is:#!/bin/sh# Written by: DGC#==============================================================================usage() { cat EOFUsage: $(basename $0) options Opens a windows command window in the current working directory.Options:-h Display this message. exit#==============================================================================# Mainwhile getopts :h? option case $option in usage echo -e Invalid option: -$OPTARG \n usage esaccygstart 'C:\Windows\System32\cmd.exe'This is slightly overkill for essentially just cygstart 'C:\Windows\System32\cmd.exe', but I like to include a help with all my scripts.It was helpful to me, so I thought I d share it. UnitC++ has gone to version 1.1.0. The new feature is the addition of an interactive menu system. You run your tests declared using the TEST macro with the following code./=============================================================================int main(int argc, char** argv) return UnitCpp::TestRegister::test_register().run_tests_interactive( argc, argvThis will produce a menu which looks something like this;================================================================================0) All tests.================================================================================1) Maths 2) Maths:sqrt_results 3) Maths:is_square 4) Maths:sqrt_precondition ================================================================================5) MyString 6) MyString:length_test 7) MyString:validity_test The numbers which you run the tests with can be input on the command line also, so utest.exe 0 will always run all of the tests.See more at my sourceforge page It s nice to see that the C++ standard, while mostly dry, has a little humour in it. There is a limerick in section 14.7.3, 7. It goes like this;When writing a specialization,be careful about its location;or to make it compile will be such a trialas to kindle its self-immolation.And according to Mostly Buggy in version C++0x FCD there was an amusing footnote in Section 29 Atomic operations library29.1 General [atomics.general]1 This Clause describes components for fine-grained atomic access. This access is provided via operations on atomic objects.341[ ]341) Atomic objects are neither active nor radioactive.But sadly in my copy (ISO IEC 14882) this was not included. It must have been taken out before the official standard was released.There are according to Michael Wong two limericks in the standard, but I couldn t find the second one (in the document, or on the internet). This post is an introduction to a library I have written, UnitC++.UnitC++ is a modern, light weight, header-only c++ library for making unit testing easy. The intention of this library is to make it really easy to test c++ code in a portable way.  Continue reading UnitC++ Great article by Bartosz Milewski. I m always interested in applying different paradigms to C++. Here is my attempt at this.  Bartosz Milewski s Programming Cafe“Data structures in functional languages are immutable.”What?! How can you write programs if you can’t mutate data? To an imperative programmer this sounds like anathema. “Are you telling me that I can’t change a value stored in a vector, delete a node in a tree, or push an element on a stack?” Well, yes and no. It’s all a matter of interpretation. When you give me a list and I give you back the same list with one more element, have I modified it or have I constructed a brand new list with the same elements plus one more? Why would you care? Actually, you might care if you are still holding on to your original list. Has that list changed? In a functional language, the original data structure will remain unmodified! The version from before the modification persists — hence such data structures are called persistent (it has…View original post 4,199 more words This is just a quick note about a nice emacs feature. If you develop with emacs, you may have heard of/used ediff. This is a very handy diff program which runs inside emacs. We use this with a custom hook at work to work with our version control system. I found out that it works nicely with more standard version control systems as well.The main way to use ediff is the command ediff-buffersThis lets you choose two buffers to diff. To do this for different revisions of a file you can use the command ediff-revisionThis will ask for which file you want to view revisions of (default, the current buffer), and the two revisions to compare (default latest revision and the current state). The you will have the file you asked for loaded in the two revisions you asked for.Using mercurial personally I find this more informative than the output from hg diff in complicated cases. I believe this works for any version control system recognised by emacs, e.g. mercurial git and subversion. This is not as you might think, an article about implementing directed graphs in C++. The digraphs I am writing about are sequences of characters which act as a stand in for other characters. Digraphs and trigraphs exist in many languages, but I will be focusing on C++. The difference between digraphs and trigraphs is simple the number of characters, a digraph is 2 characters and a trigraph is 3 characters.Digraphs are part of the language because in the past special characters were hard to input. This was generally because they were not on the keyboard, but in a few cases, they were not even in the code page!So what use is this now, when modern keyboards have all the symbols we could want and we can use different encodings in source files?Here is a screenshot of the C++ standard where it defines the allowed digraphs.C++ standard digraphsThe first column are backwards compatible digraphs for C. The next two columns are rather interesting. For example. If you write the word or in a C++ source file, the compiler will replace that with ||. This means that the following code compiles and works.//=============================================================================int main() { bool a = false; bool b = true; std::cout a or b == (a or b) std::endl; return 0;Not only will this work for built in types, this works for user defined operators too. This is because the compiler simply substitutes the symbols.Here is an example class and calling code which uses all the C++ digraphs.ClassThis is just a stub class which defines a lot of operators which do nothing.//=============================================================================class Example {public: //=========================================================================== // logic operators bool operator (const Example t) { return true; bool operator||(const Example t) { return true; bool operator!() { return true; //=========================================================================== // bitwise operators bool operator (const Example t) { return true; bool operator|(const Example t) { return true; bool operator^(const Example t) { return true; bool operator~() { return true; //=========================================================================== // logic equals operators Example operator =(const Example t) { return t; Example operator|=(const Example t) { return t; Example operator^=(const Example t) { return t; Example operator!=(const Example t) { return t;Calling Code//=============================================================================int main() { bool a = true; bool b = true; if (a and b) { cout \ and\ is an operator. endl; if (false or b) { cout \ or\ is also an operator. endl; if (not false) { cout \ not\ is also an operator. endl; Example t_1, t_2; if (t_1 and t_2) { cout \ and\ even works for classes endl; if (t_1 or t_2) { cout \ or\ even works for classes endl; if (not t_1) { cout \ and\ even works for classes endl; if (t_1 bitand t_2) { cout \ bitand\ also works for classes endl; if (t_1 bitor t_2) { cout \ bitor\ even works for classes endl; if (compl t_1) { cout \ compl\ even works for classes endl; if (t_1 xor t_2) { cout \ xor\ even works for classes endl; t_1 and_eq t_2; cout \ and_eq\ even works for classes endl; t_1 or_eq t_2; cout \ or_eq\ even works for classes endl; t_1 xor_eq t_2; cout \ xor_eq\ even works for classes endl; return 0;This gives the output; and is an operator. or is also an operator. not is also an operator. and even works for classes or even works for classes and even works for classes bitand also works for classes bitor even works for classes compl even works for classes xor even works for classes and_eq even works for classes or_eq even works for classes xor_eq even works for classesThis file can be found here.This is an interesting feature, but is it useful? I think it is, I think that the code;if (not fail and ok) { // ...Is more readable than;if (!fail ok) { // ...However just because these are defined in the standard does not mean they can be used. These are largely considered a legacy part of the standard and there is limited support for it. In particular Microsoft s C++ compiler will not compile it. Both clang and g++ will compile it however, so if you are compiling using either of these you can use this nice feature.Thanks for reading. If you use shell scripting a lot from the command line, this will probably improve your experience of it. This is for users of linux/mac command line or of cygwin on windows. Anywhere you can use the bash cd command.Firstly (if you didn t know) cd remembers the last directory you went to. To access this use;This will change to the previous directory you were in. If you want to supercharge this you can add the following to your .bashrc/.profile/ customization file.# petar marinov, http:/geocities.com/h2428, this is public domaincd_func () local x2 the_new_dir adir index local -i cnt if [[ $1 == -- ]]; then dirs -v return 0 the_new_dir=$1 [[ -z $1 ]] the_new_dir=$HOME if [[ ${the_new_dir:0:1} == '-' ]]; then # Extract dir N from dirs index=${the_new_dir:1} [[ -z $index ]] index=1 adir=$(dirs +$index) [[ -z $adir ]] return 1 the_new_dir=$adir # '~' has to be substituted by ${HOME} [[ ${the_new_dir:0:1} == '~' ]] the_new_dir= ${HOME}${the_new_dir:1} # Now change to the new dir and add to the top of the stack pushd ${the_new_dir} /dev/null [[ $? -ne 0 ]] return 1 the_new_dir=$(pwd) # Trim down everything beyond 11th entry popd -n +11 2 /dev/null 1 /dev/null # Remove any other occurence of this dir, skipping the top of the stack for ((cnt=1; cnt = 10; cnt++)); do x2=$(dirs +${cnt} 2 /dev/null) [[ $? -ne 0 ]] return 0 [[ ${x2:0:1} == '~' ]] x2= ${HOME}${x2:1} if [[ ${x2} == ${the_new_dir} ]]; then popd -n +$cnt 2 /dev/null 1 /dev/null cnt=cnt-1 done return 0alias cd=cd_funcThis means that you can keep a history of the past 10 directories which you have visited and change between them.To access this list type cd --Which will print a list like.0 /e/projects/dgc/or14126h_31 /e/projects/dgc/or14126h_3/orthotics.dev2 /c/Users/dgc/Dropbox/Coding3 /e/projects/dgc4 /e/projects/dgc/or14126h_25 /e/devdisk/dcm/configs6 /e/devdisk/dcm7 /e/devdiskAnd thencd -5will take you to entry 5 in the list.To be clear I did not write this, I found it in the default cygwin .bashrc. The author of this was Petar Marinov. I have found this very helpful, particularly when using a new python module. This is the process;I would be in my working areadownload it from pypicd to my download areauntar itcd into itrun python setup.py installthen want to go back but cd would get me to my download area. This function removes that minor inconvenience and I have found it very useful.Thanks for reading. Muhamad Hesham s T-Blog"The The usual use is to write it at the very top of your .h/.cpp files to include other header files like (Windows.h, iostream, cstdio, etc..) to use the what is defined inside in your .h/.cpp file.The unusual use is to use it to initialize a data-structure like arrays by including a text file that contains the array initialization data between the array initializer list parentheses – e.g XX XXX[] = { HERE }. This is is illustrated in the sample program below. The same concept can be used to initialize an array of any dimension.// Declare and initialize a 1D array of Persons structs using PersonTableData text file// #include "PersonsTableData" will be expanded at COMPILE TIME to the content of PersonsTableData filePerson PersonsTable[] = { #include "PersonsTableData"View original post 73 more words Privacy Cookies: This site uses cookies. By continuing to use this website, you agree to their use. To find out more, including how to control cookies, see here: Cookie Policy

TAGS:Like plus Dave 

<<< Thank you for your visit >>>

Dave plus plus: Like Dave, but one louder.

Websites to related :
Britax - A Leader in Safety Tech

  One car seat for lifeGrows with your child 10 yearsThe only 10-year car seat with ClickTightJust Arrived!High-performance fabrics that stay cleanAvail

Spain Holidays 2021/2022: Holida

  In order to give you the best search results, please select a destination before searching, e.g. "Costa del Sol" or "Barcelona" Understood In order to

So City - The Ultimate City Guid

  Looking To Explore Your City? We've Got Your Back! From street food to the hottest new eateries in town, from trendy stores to the most happening even

Welcome Qatar - Qatar Informatio

  Find Best Jobs in Qatar, Bahrain, Egypt, Jordan, Lebanon, Morocco, Oman, Saudi ArabiaUnited Arab Emirates.Search for a job right now by entering a loc

The Visa Machine - Where

  From simple travel visas through to Letters of Invitation, we take the hassle of travel bureaucracy out of your business. Get in touch for more info.

Tellus A: Dynamic Meteorology an

  Publishes international open access research into meteorology and oceanography including data assimilation techniques, weather prediction and climate

Libraries // Mizzou // Universit

  TODAY S HOURS: (Ellis Library) Closed. MU ID required after 5 pm. more hours

InTranslation

  Translator's Note: “David and Orpheus” juxtaposes the archetypal musicians of Abrahamic and Graeco-Roman religion. David and Orpheus are paralleled

Deluxe Wifes. High Quality Free

  All models were 18 years of age or older at the time of depiction. Deluxewifes.com has a zero-tolerance policy against illegal pornography. This site

Jerk Room. Free Porn Pics Collec

  All models were 18 years of age or older at the time of depiction. Jerkroom.com has a zero-tolerance policy against illegal pornography. This site is

ads

Hot Websites