So after fighting with typo a little, idleing in the typo irc chan on freenode and diffing the current source tree I've managed to patch togeather typo that works the way I wanted. The culperate: a missing "only_path => true" on to_url for the comments form. So all is well and people can comment about things....
Edit: atom and rss should be working correctly now to(ive put my code samples in code sample boxes)
Welcome to the new home of my blog. I’ve moved to typo from live journal, mostly because I’m ramping up archverse hosting and have a nice platform availible to me.
So far typo seems nice but I think I’m going to need to hack in an OpenID client/server. I would really like to have OpenID as the primary means of identification in everything I do. The reason for this is two fold, first stackoverflow.com has a perfect implementation as far as I’m concerned, so good that everyone should have it. Secondly it’s really cool and I wish it was the primary form of ID everywhere on the net.
As a side note the install of typo went a lot smoother once I learned to stop worrying and love lighttpd/fcgi. In fact I like fcgi(really the concept of multiple worker processes for a web server) that me next synergy enews article is on how you can serve wcf hosted in worker dbr processes.
here is a bit of code from AV, don't think of this as c++, really it should be thought of as an AV built ins scripting DSL that happens to get compiled by the c++ compiler.
void somemethod() { class PhilosophersStone { public: PhilosophersStone(vector<uint32_t> buildings, Project&; proj) { buildings.push_back(proj.Id()); proj.OnUpdateTurn = OnUpdateTurn; } static void OnUpdateTurn(Council& council, Player& player, Territory& territory, ControlModel& controlModel) { controlModel._commandAndControl += 5; } } philosophersStone(philosophy._buildings, PROJECT_TABLE.CreateProject(5000, 10000, "Philosophers Stone", "its super cool and stuff", list_of( PREREQUISITE_TABLE.TechRequisite(philosophy)))); }
as you look at this you may notice that ive managed to get way to much code into a class declaration, yes infact the last ';' you see there is the ';' you normally see on class rawr {}; <---- that one. You might be saying to your self "holy shit wtf is he doing", well one of the features inherited from C is that you can create an instance of a struct/class directly after the definition of the type. well since this is c++, i can add a constructor and put that sucker on the end. Next up I create a project with mostly simple parameters but wait!!!! wtf is this list_of thing? list_of comes from boost.Assignment and it allows me to define a collection inline. the somewhat odd syntax for multiple elements would be list_of(5)(4)(3)(2)(1), just a bit of an eye-full there with all the overloaded operator() action. Still this once again demonstrates to me how vastly superior C++ is to every other language on the planet(that includes spoken languages).
One of the more interesting features in C++ template(IMHO) is being able to bake a compile time constant value directly into a template instance. One nice thing about function pointers is that they have a constant for an address. I'm not 100% sure what I can really use this for but it certainly looks cool! Of certain interest is template deduction on a function pointer, I was very surprised(pleasantly) to find this code compile.
#include<iostream> #include<string> using namespace std; template<typename T, T (*F)(T)> class rawrg { public: rawrg(T val) { F(val); } }; template<typename T> T method(T t) { cout<< t << endl; return t; } int main() { rawrg<const string&, &method> rawr("trivial"); rawrg<float, &method> rawrg(5.5); }
Great title if somewhat deceiving. reading around on stackoverflow I noticed this block
- Joel's response to forum comment: "Thinking of Leaving the Industry"
- Jeff's blog (which he admits was inspired by Joel's forum comment): "Programming: Love It or Leave It"
Ive read all the arguments and comments and ive come to the conclusion that almost all programmers are terrible. Im not really sure why I havent encountered more of them in my daily life( maybe I am just oblivious). I am getting the distinct feeling that anyone who doesnt love programming, is terrible and shouldnt be doing it. Some people who love programing are terrible and shouldnt be doing it. Most people who bitch and moan about how xyz project got canned because of poor management are terrible and shouldnt be programming. people who go on an on about how all my co-workers are bad at their jobs and i have to clean up after them...... you guys suck to, gtfo away from the keyboard and go do something less important. occasionally it is possible for other people to destroy a project but really..... if you were better you could have saved it(or not gotten involved in the first place) and provided a shining example to your apparently less fortunate fellow employees.
Also any programmer that thinks maybe they should go into management.... get the hell out of my industry, you dont belong here. Programming is not middle management, we do things, productive things. As for the question, "Are we in demand", yes but only if you're not a whiny, incompetent moron that comforts their own ego by going on and on about how much better you are then some other person at work. Another thing, many of the nay sayers seem to be ashamed of their geekdom. Saying things like, "Get a life nerd." . Alternatively all good programmers are "usually the ones that are unmarried and don't seem to have any non-geek friends or hobbies" wow.... way to be closed minded or something like that.
As for me, I figure if I keep finding ways to cleverly (ab)use language features and throw out enough TLA's(blinded by science!) no one will ever know :p Up next, more things I love about boost;
This is a snip of code from AV and I am about to tell you once again, the single coolest thing in C++ is member pointers(function and data). oh and local class declarations are also THE shit. I suppose this isnt neccisarily the most readable code in the world but.... the most awsome things rarely are. Now if only synergy supported this :d
void MessageBox::SendMessage(ArchverseCore::Game::DiplomaticMessage &message) { Player sendingPlayer, recivingPlayer; if(PLAYER_TABLE.Exists(message._senderId) && PLAYER_TABLE.Exists(message._targetId)) { class PushMessage { private: uint32_t _messageId; vector<uint32_t>& (MessageBox::*_target)(); public: PushMessage(uint32_t messageId, vector<uint32_t>& (MessageBox::*target)()) : _messageId(messageId), _target(target) {} bool operator()(Player& player) { (player.Messages().*_target)().push_back(_messageId); return true; } }; MESSAGE_TABLE.SaveMessage(message); PLAYER_TABLE.LockedTransaction(message._senderId, PushMessage(message._id, &MessageBox::Sent)); PLAYER_TABLE.LockedTransaction(message._targetId, PushMessage(message._id, &MessageBox::Inbox)); } }
Yes it is possible to do the basics of functional programming in Synergy. It is missing some of the conveniences of C++ or ML but still it works. sometime in the future I will explain how this is useful to the average user.
import System.Collectionsnamespace functor ;;; <summary> ;;; The main entry point for the application. ;;; </summary> main record al, @ArrayList ii, int proc al = new ArrayList() for ii from 0 thru 100 begin data iii, @int iii = (@int)ii al.add(iii) end open(1, o, "tt:") for_each.Call(al, new MyFunctor()) endmain class for_each public static method Call, void al, @ArrayList func, @SimpleIntFunctor endparams record ii, int proc for ii from 0 thru al.Count - 1 begin func.Call((int)al[ii]) end endmethod endclass abstract class SimpleIntFunctor public abstract method Call, void i, int proc endmethod endclass class MyFunctor extends SimpleIntFunctor public override method Call, void i, int proc writes(1, %string(i)) endmethod endclass endnamespace
template<typename T> class MemberPointerContainer { typedef int T::* MEMPTR; public: MemberPointerContainer(MEMPTR element) { _element = element; } template<typename R> static MemberPointerContainer CreateMemberPointer(R T::* element) { return MemberPointerContainer(reinterpret_cast<MEMPTR>(element)); } template<typename R> void Set(T& t, R value) { typedef R T::* MEMPTR_SPECIALIZED; t.*(reinterpret_cast<MEMPTR_SPECIALIZED>(_element)) = value; } MEMPTR _element; }; class NetworkEntity { public: int field1; int field2; double field3; }; #include<vector> void main() { std::vector< MemberPointerContainer<NetworkEntity> > vect; vect.push_back(MemberPointerContainer<NetworkEntity>::CreateMemberPointer(&NetworkEntity::field1)); vect.push_back(MemberPointerContainer<NetworkEntity>::CreateMemberPointer(&NetworkEntity::field2)); vect.push_back(MemberPointerContainer<NetworkEntity>::CreateMemberPointer(&NetworkEntity::field3)); NetworkEntity net; vect[0].Set(net, 5); }