Search Results

Search found 7 results on 1 pages for 'thad'.

Page 1/1 | 1 

  • fluentnhibernate and nhibernate validator version error

    - by Thad
    We have a project using FluentNibernate to map the entities. Now I need to add some format validation to these maps. For Nullable, Length and such we are currently using the mappings. I added NHibernate Validator to the project, but received a compile time error about needing NHibernate version 2.1.2.4000. So I upgraded to that version just to get a run-time error stating that it could not find NHibernate 2.1.0.4000. Could I write extension methods to do the validation using FluentNibernate? Do I have to recompile both using the same version of NHibernate? The preferred method would be to use a release of these. Any other device would appreciated.

    Read the article

  • constructor injection using Autofac 2 and Named Registration

    - by Thad
    I am currently attempting to remove a number of .Resolve(s) in our code. I was moving along fine until I ran into a named registration and I have not been able to get Autofac resolve using the name. What am I missing to get the named registration injected into the constructor. Registration builder.RegisterType<CentralDataSessionFactory>().Named<IDataSessionFactory>("central").SingleInstance(); builder.RegisterType<ClientDataSessionFactory>().Named<IDataSessionFactory>("client").SingleInstance(); builder.RegisterType<CentralUnitOfWork>().As<ICentralUnitOfWork>().InstancePerDependency(); builder.RegisterType<ClientUnitOfWork>().As<IClientUnitOfWork>().InstancePerDependency(); Current class public class CentralUnitOfWork : UnitOfWork, ICentralUnitOfWork { protected override ISession CreateSession() { return IoCHelper.Resolve<IDataSessionFactory>("central").CreateSession(); } } Would Like to Have public class CentralUnitOfWork : UnitOfWork, ICentralUnitOfWork { private readonly IDataSessionFactory _factory; public CentralUnitOfWork(IDataSessionFactory factory) { _factory = factory; } protected override ISession CreateSession() { return _factory.CreateSession(); } }

    Read the article

  • Render Html from a lambda in MVC

    - by Thad
    I have the following code to generate a list and will allow developers to customize the output if needed. <% Html.List<MyList>(item => item.Property).Value(item => return "<div>" + item.Property + "<br/>" + item.AnotherProperty + "</div>").Render() %> This is not ideal, how can I allow the developers to add the html similar to other controls. <% Html.List<MyList>(item => item.Property).Value(item => %> <div><%=item.Property%><br/><%=item.AnotherProperty%></div><%).Render() %> This way is much cleaner and standard with the rest of mvc.

    Read the article

  • Translate SQL to NHibernate Query

    - by Thad
    I have a SQL query that I would like to translate to nhibernate criteria, but I have not found a way to generate the MatchCount field. I tried adding it using a sqlprojection but I could not find a place to set the parameters. SELECT (CASE WHEN LEFT([FirstName], LEN(@Text0)) = @Text0 OR LEFT([FirstName], LEN(@Text1)) = @Text1 OR LEFT([FirstName], LEN(@Text2)) = @Text2 THEN 1 ELSE 0 END + CASE WHEN LEFT([LastName], LEN(@Text0)) = @Text0 OR LEFT([LastName], LEN(@Text1)) = @Text1 OR LEFT([LastName], LEN(@Text2)) = @Text2 THEN 1 ELSE 0 END + CASE WHEN LEFT([PreferredName], LEN(@Text0)) = @Text0 OR LEFT([PreferredName], LEN(@Text1)) = @Text1 OR LEFT([PreferredName], LEN(@Text2)) = @Text2 THEN 1 ELSE 0 END) AS MatchCount , * FROM [client].[Individual] WHERE ( [FirstName] LIKE @Text0 + '%' OR [FirstName] LIKE @Text1 + '%' OR [FirstName] LIKE @Text2 + '%' OR [LastName] LIKE @Text0 + '%' OR [LastName] LIKE @Text1 + '%' OR [LastName] LIKE @Text2 + '%' OR [PreferredName] LIKE @Text0 + '%' OR [PreferredName] LIKE @Text1 + '%' OR [PreferredName] LIKE @Text2 + '%' ) ORDER BY (CASE WHEN LEFT([FirstName], LEN(@Text0)) = @Text0 OR LEFT([FirstName], LEN(@Text1)) = @Text1 OR LEFT([FirstName], LEN(@Text2)) = @Text2 THEN 1 ELSE 0 END + CASE WHEN LEFT([LastName], LEN(@Text0)) = @Text0 OR LEFT([LastName], LEN(@Text1)) = @Text1 OR LEFT([LastName], LEN(@Text2)) = @Text2 THEN 1 ELSE 0 END + CASE WHEN LEFT([PreferredName], LEN(@Text0)) = @Text0 OR LEFT([PreferredName], LEN(@Text1)) = @Text1 OR LEFT([PreferredName], LEN(@Text2)) = @Text2 THEN 1 ELSE 0 END) DESC And yes, this is a ugly statement. Hate having a sql statement in the middle of everthing. Note: There is paging involved and I would prefer not returning all the data to the app server before cutting it down.

    Read the article

  • How to make controls "tabable" when loaded from plugin in Cocoa app?

    - by Randall
    I have an application thad loads in plugins that have their own UI. There is an IBOutlet called ContainerView in my AppDelegate. When the plugin loads, it puts its own view (that is stored in a xib in the plugin bundle) into the Container view like so [ContainerView addSubview:viewFromPlugin]; When the view loads, everything is fine but when I press tab the only controls that get any focus are ones outside of the ContainerView and none of them inside it get focus. I've tried setting the container view as the initialFirstResponder and I've tried hooking up the nextKeyView from the last button in the tab order to the ContainerView. Thanks.

    Read the article

  • Managing Instances in Python

    - by BeensTheGreat
    Hello, I am new to Python and this is my first time asking a stackOverflow question, but a long time reader. I am working on a simple card based game but am having trouble managing instances of my Hand class. If you look below you can see that the hand class is a simple container for cards(which are just int values) and each Player class contains a hand class. However, whenever I create multiple instances of my Player class they all seem to manipulate a single instance of the Hand class. From my experience in C and Java it seems that I am somehow making my Hand class static. If anyone could help with this problem I would appreciate it greatly. Thank you, Thad To clarify: An example of this situation would be p = player.Player() p1 = player.Player() p.recieveCard(15) p1.recieveCard(21) p.viewHand() which would result in: [15,21] even though only one card was added to p Hand class: class Hand: index = 0 cards = [] #Collections of cards #Constructor def __init__(self): self.index self.cards def addCard(self, card): """Adds a card to current hand""" self.cards.append(card) return card def discardCard(self, card): """Discards a card from current hand""" self.cards.remove(card) return card def viewCards(self): """Returns a collection of cards""" return self.cards def fold(self): """Folds the current hand""" temp = self.cards self.cards = [] return temp Player Class import hand class Player: name = "" position = 0 chips = 0 dealer = 0 pHand = [] def __init__ (self, nm, pos, buyIn, deal): self.name = nm self.position = pos self.chips = buyIn self.dealer = deal self.pHand = hand.Hand() return def recieveCard(self, card): """Recieve card from the dealer""" self.pHand.addCard(card) return card def discardCard(self, card): """Throw away a card""" self.pHand.discardCard(card) return card def viewHand(self): """View the players hand""" return self.pHand.viewCards() def getChips(self): """Get the number of chips the player currently holds""" return self.chips def setChips(self, chip): """Sets the number of chips the player holds""" self.chips = chip return def makeDealer(self): """Makes this player the dealer""" self.dealer = 1 return def notDealer(self): """Makes this player not the dealer""" self.dealer = 0 return def isDealer(self): """Returns flag wether this player is the dealer""" return self.dealer def getPosition(self): """Returns position of the player""" return self.position def getName(self): """Returns name of the player""" return self.name

    Read the article

  • How to implement wait(); to wait for a notifyAll(); from enter button?

    - by Dakota Miller
    Sorry for the confusion I posted the Worng Logcat info. I updated the question. I want to click Start to start a thread then when enter is clicked i want the thad to continue and get the message and handle the message in the thread then output it to the main thread and update the text view. How would i start a thread to wait for enter to be pressed and get the bundle for the Handler? Here is my Code: public class MainActivity extends Activity implements OnClickListener { Handler mHandler; Button enter; Button start; TextView display; String dateString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); enter = (Button) findViewById(R.id.enter); start = (Button) findViewById(R.id.start); display = (TextView) findViewById(R.id.Display); enter.setOnClickListener(this); start.setOnClickListener(this); mHandler = new Handler() { <=============================This is Line 31 public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); Bundle bundle = msg.getData(); String string = bundle.getString("outKey"); display.setText(string); } }; } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.enter: Message msgin = Message.obtain(); Bundle bundlein = new Bundle(); String in = "It Works!"; bundlein.putString("inKey", in); msgin.setData(bundlein); notifyAll(); break; case R.id.start: new myThread().hello.start(); break; } } public class myThread extends Thread { Thread hello = new Thread() { @Override public void run() { // TODO Auto-generated method stub super.run(); Looper.prepare(); try { wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } Handler Mhandler = new Handler() { @Override public void handleMessage(Message msg) { // TODO Auto-generated method stub super.handleMessage(msg); Bundle bundle = msg.getData(); dateString = bundle.getString("inKey"); } }; Looper.loop(); Message msg = Message.obtain(); Bundle bundle = new Bundle(); bundle.putString("outKey", dateString); msg.setData(bundle); mHandler.sendMessage(msg); } }; } } Here is the logcat info: 06-27 00:00:24.832: E/AndroidRuntime(18513): FATAL EXCEPTION: Thread-1210 06-27 00:00:24.832: E/AndroidRuntime(18513): java.lang.IllegalMonitorStateException: object not locked by thread before wait() 06-27 00:00:24.832: E/AndroidRuntime(18513): at java.lang.Object.wait(Native Method) 06-27 00:00:24.832: E/AndroidRuntime(18513): at java.lang.Object.wait(Object.java:364) 06-27 00:00:24.832: E/AndroidRuntime(18513): at com .example.learninghandlers.MainActivity$myThread$1.run(MainActivity.java:77)

    Read the article

1