Posts

deadlock - Handle NHibernate Transaction Errors -

The use of our application (which NHibernate and ASP.NET MVC), the stress placed NHibernate transaction errors under trials Throws a lot. The main types are: The transaction is not connected or disconnected Route updates or deletions by any other transaction (or unsaved-value mappings) ) The transaction (process ID 177) was locked on lock resources with other resources and was chosen as a deadlock victim. Run the transaction again. Can someone help me identify the cause of exception 1? I know that I have to handle other exceptions in my code. Does anyone point me to resources that can help me handle these errors in a efficient way? Q How do we manage sessions and transactions? A. For each server request we are using Autofack, we create a new request container in which the session is in the container lifetime, we activate the transaction when we activate the session. When the request is complete, we do the transaction. In some cases, the transaction may be huge. To simpli...

if statement - What are good programming questions to exercise the use of "if ... else" in Python? -

What would be a good set of programming practices that will help in knowing the use of dragon newbies "if ..." ? Looking at a date (year, month, day), find the next date. Most listeners did not have much risk of programming before, and I'm eager to use them to think about "if ... otherwise ..." And all else, in due time). It is hard for people who are programming for years to get "to get" Does it seem to start with nothing, I can clear anything with the need for more than 5 link codes. You have to decide on the order in which user input, output, if, for the second, while, file, etc. When they cover, they already know how to get some user input? Print some output? For code loop? Arithmetic on integer? Determine whether a number is divisible by another number or not? The answer to these questions limits your examples for IF. I suggest before making output, Arithmetic, For, Divisibility (Modulus), User input. Then I can print probl...

.net - DataSet and XmlDataDocument -

What is the importance of using XMlDataDocument with a dataset? It is a bit confusing to me whether anyone interpreted the significance of this Can do? Thanks From MSDN: XMLDocumentation is a close relationship with the dataset class, which provides relational views of weighted XML data. Any changes made to the XmlDataDocument are reflected in the dataset and vice versa. Therefore, This does not mean that you need it, or you have to use it. Also note that this class seems to be obsolete in .Net 4.0 . Go here for some

c# - CS0133 "The expression being assigned to 'identifier' must be constant" - what's the reason behind that? -

With many C ++ backgrounds I have been used to write the following: Const int count = ...; // Some non-trivial stuff here (int i = 0; i i ++) {...} and I hope the same works fine in C # Will do However ... byte [] buffer = new byte [4]; Const int count = buffer.Length; produces error CS0133: the expression being assigned to 'count' should be continuous . I do not get this. Why is it invalid? int is a value type, is not it? Why can not I specify a price and can not make variable changes in this way? Because const in C ++ in const is more const ;) indicates continuous expression of compilation-time in C #, const . This will be similar to this C ++ code: enum {count = buffer.Length; } Because buffer. Length is evaluated on runtime, it is not a continuous expression, and therefore it will generate a compilation error. There is a readable keyword in C # which is slightly more like C ++'s const . (It is still very limited, and there ...

java - Spring MVC: Insert values into all my ModelAndView s -

I have a mid-sized spring application and I add key / value pairs to all the models and scenes in cross cutting fashion I want to include (like AOP). Inspiration is to add all the pages (configuration values, build numbers, etc.). What is the easiest way to do this? I prefer without AOP but I am ready to use it if necessary. You have several options here. / Write a custom handler interceptor , and override the posthand () method, supply your data to ModelAndView . If your data is static, you can use it in ViewResolver in attributes to UrlBasedViewResolver . This is useful only for real string-based configs that you can put in your beans file. With a @ModelAttribute a method has been commented in your controller. Any object returned from such annotated methods is automatically added to the model. This will be done only for those requests managed by the @Requestmapping -annotated methods in that controller class.

c++ - Textarea for Cario:OpenGL -

Is the Sher Textarea class closed which uses serio (targeting OpenGL) as a renderer? By Textarea I mean a multilingual text field with word vap and width and height barriers. The code using this class is written in C ++. A solution is to use the binding of Cairo. Using it can be really misleading, so here is an essential requirement. If you want you can create classes around it. #include & lt; Pango / pangocairo.h & gt; // pango context PangoContext * pangoContext = pango_font_map_create_context (pango_cairo_font_map_get_default ()); // Layouts and attributes PangoLayout * pangoLayout = pango_layout_new (pangoContext); Pango_layout_set_wrap (pangoLayout, PANGO_WRAP_WORD_CHAR); Pango_layout_set_width (pangoLayout, maxWidth * PANGO_SCALE); Pango_layout_set_height (PageLout, MaxHit * PANGO_SCALE); // set the font PangoFontDescription * fontDesc = pango_font_description_from_string ("Verdana 10"); Pango_layout_set_font_description (pangoLayout, fontDesc); Pa...

c++ - How to retrieve the HD vendor/serial using Windows API -

I'm talking about the physical disk drive, no volume / segmentation / logical drive . That's because - GetVolumeInformation function is not applicable in my case. To be precise: I am working directly with the disk which has not yet split. I open it a handle via CreateFile function: hDisk = CreateFile (_T ("\\\. \ ... PHYSICALDRIVE0"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ I FILE_SHARE_WRITE, NOUL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL); I can read / write directly to disk using this handle. There is also the possibility of querying different disk properties using the DeviceIoControl function. Although I can not find a way to query disc vendor / serial properties, which are visible in Device Manager. Take a look at the source code DFP_RECEIVE_DRIVE_DATA to DeviceIoControl . is the idea to use