Search Results

Search found 129 results on 6 pages for 'andrey s petrov'.

Page 4/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • NHibernate: inserting additional calculated column

    - by Andrey Shchekin
    What would be your approach with NHibernate to do the following: When Comment is inserted into DB, and its property Text is inserted into column Text (due to a mapping), insert into column TextHash a hash of this property value. It seems trivial if I map TextHash, but how should I do this without mapping it? I do not need it in the domain model, its a DB-level optimization (I would use computed HashBytes if not for the length limit).

    Read the article

  • Code editor with autocomplete

    - by Andrey
    I need to create a code editor for my own simple language: className.MethodName(parameterName = 2, ... ) I've created the appropriate grammar and autogenerate parser using ANTLR tool. Now I would like to have an autocomplete for class, method, variables and parameter names. This list should be context dependent, f.e. for "class." it should display methods and for "class.Method(" - parameters. I was going to parse the text and display the list depending on in which node the cursor is. The problem is that for incomplete code like "aaa.bbb(" the parser produces an error instead of a syntax tree. Any idea how to solve this problem? Maybe I'm on the wrong way and I shouldn't parse code to display autocomplete?

    Read the article

  • Html.DropDownListFor() in Mozilla Firefox

    - by Andrey
    I'm rendering a drop down list using Html.DropDownListFor() extension. The markup I get is as follows: select id="NationalityId" name="NationalityId" option value="" /option option selected="selected" value="1"Estonian /option option value="2"Russian /option option value="3"Ukranian /option option value="4"Belorussian /option option value="5"Swedish /option option value="6"Dutch /option /select As you can see, option with value==1 is selected. But in Firefox 3.6.3 it doesn't display as selected, empty string (first option - value == "") is displayed instead. IE7 and Chrome render the page right - the option is selected. Does anybody know what is going on? How do I get this around?

    Read the article

  • MVVM (ICommand) in Silverlight

    - by Andrey Khataev
    Hello! Please, don't judge strictly if this question was discussed previously or indirectly answered in huge nearby prism and mvvm blogs. In WPF implementation of RelayCommand or DelegateCommand classes there is a such eventhandler /// <summary> /// Occurs whenever the state of the application changes such that the result of a call to <see cref="CanExecute"/> may return a different value. /// </summary> public event EventHandler CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } but in SL subset of namespaces there are no CommandManager class. And this is where I'm stuck. I haven't yet found an workaround for this in MVVM adoptation for SL (PRISM is so complex for me yet). Different simple HelloWorldMVVM apps don't deal with at all. Thanks in advance and sorry for my English -)

    Read the article

  • What is a data structure for quickly finding non-empty intersections of a list of sets?

    - by Andrey Fedorov
    I have a set of N items, which are sets of integers, let's assume it's ordered and call it I[1..N]. Given a candidate set, I need to find the subset of I which have non-empty intersections with the candidate. So, for example, if: I = [{1,2}, {2,3}, {4,5}] I'm looking to define valid_items(items, candidate), such that: valid_items(I, {1}) == {1} valid_items(I, {2}) == {1, 2} valid_items(I, {3,4}) == {2, 3} I'm trying to optimize for one given set I and a variable candidate sets. Currently I am doing this by caching items_containing[n] = {the sets which contain n}. In the above example, that would be: items_containing = [{}, {1}, {1,2}, {2}, {3}, {3}] That is, 0 is contained in no items, 1 is contained in item 1, 2 is contained in itmes 1 and 2, 2 is contained in item 2, 3 is contained in item 2, and 4 and 5 are contained in item 3. That way, I can define valid_items(I, candidate) = union(items_containing[n] for n in candidate). Is there any more efficient data structure (of a reasonable size) for caching the result of this union? The obvious example of space 2^N is not acceptable, but N or N*log(N) would be.

    Read the article

  • Multiblog engine for asp.net

    - by Andrey
    I know, different forms of this questions were asked on this site multiple times, but I haven't seen a single answer that would satisfy my need. I need a ASP.NET based blogging engine that wouul use SQL Server as a back end and allow multiple independet blogs in one app instance. I'm writing a community website for major bank and blogging is the piece I'm not sure about. Answers to other questions include a broad spectrum from BlogEngine.NET (doesn't support multiple blogs) to CommunityServer (a beast! blogging is just asmall piece of it). I don't want to install a full-blown CRM and just use blogging, I want a blogging engine. I don't mind to buy a commercial one but I can't find one. I'm pretty much stuck, and any ideas are highly appreciated!

    Read the article

  • Dropdown sorting in django-admin

    - by Andrey
    I'd like to know how can I sort values in the Django admin dropdowns. For example, I have a model called Article with a foreign key pointing to the Users model, smth like: class Article(models.Model): title = models.CharField(_('Title'), max_length=200) slug = models.SlugField(_('Slug'), unique_for_date='publish') author = models.ForeignKey(User) body = models.TextField(_('Body')) status = models.IntegerField(_('Status')) categories = models.ManyToManyField(Category, blank=True) publish = models.DateTimeField(_('Publish date')) I edit this model in django admin: class ArticleAdmin(admin.ModelAdmin): list_display = ('title', 'publish', 'status') list_filter = ('publish', 'categories', 'status') search_fields = ('title', 'body') prepopulated_fields = {'slug': ('title',)} admin.site.register(Article, ArticleAdmin) and of course it makes the nice user select dropdown for me, but it's not sorted and it takes a lot of time to find a user by username.

    Read the article

  • What is the best practice for mvc2 confirm password field?

    - by Andrey
    I have asked a similar question recently but getting no answers i am taking a step back with a more broad approach. I am looking to create a confirm password field using asp.net MVC2 that works on the client. All my other client validation is done with MicrosoftMvcValidation.js by just adding the Html.EnableClientValidation(); call. Some of my considerations. Should the confirm password be part of the model object? Using that approach i have created server side validation by creating my own model binder. Are there any projects out there that have done this?

    Read the article

  • Why calling ISet<dynamic>.Contains() compiles, but throws an exception at runtime?

    - by Andrey Breslav
    Please, help me to explain the following behavior: dynamic d = 1; ISet<dynamic> s = new HashSet<dynamic>(); s.Contains(d); The code compiles with no errors/warnings, but at the last line I get the following exception: Unhandled Exception: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'System.Collections.Generic.ISet<object>' does not contain a definition for 'Contains' at CallSite.Target(Closure , CallSite , ISet`1 , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1) at FormulaToSimulation.Program.Main(String[] args) in As far as I can tell, this is related to dynamic overload resolution, but the strange things are (1) If the type of s is HashSet<dynamic>, no exception occurs. (2) If I use a non-generic interface with a method accepting a dynamic argument, no exception occurs. Thus, it looks like this problem is related particularly with generic interfaces, but I could not find out what exactly causes the problem. Is it a bug in the compiler/typesystem, or legitimate behavior?

    Read the article

  • Reducing a set of non-unique elements via transformations

    - by Andrey Fedorov
    I have: 1) a "starting set" of not-necessarily-unique elements, e.x. { x, y, z, z }, 2) a set of transformations, e.x. (x,z) = y, (z,z) = z, x = z, y = x, and 3) a "target set" that I am trying to get by applying transformations to the starting set, e.x. { z }. I'd like to find an algorithm to generate the (possibly infinite) possible applications of the transformations to the starting set that result in the target set. For example: { x, y, z, z }, y => x { x, x, z, z }, x => z { z, x, z, z }, x => z { z, z, z, z }, (z, z) => z { z, z, z }, (z, z) => z { z, z }, (z, z) => z { z } This sounds like something that's probably an existing (named) problem, but I don't recognize it. Can anyone help me track it down, or suggest further reading on something similar?

    Read the article

  • How to set margin for inner controls of WrapPanel

    - by Andrey Tagaew
    Hi Guys! I'm new in WPF and have a question. Here is an example that I'm using: <Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <StackPanel> <WrapPanel Orientation="Horizontal" > <Button Content="test1" Margin="10,0" Padding="10,10" /> <Button Content="test2" Margin="10,0" Padding="10,10" /> <Button Content="test3" Margin="10,0" Padding="10,10" /> <Button Content="test4" Margin="10,0" Padding="10,10" /> <Button Content="test5" Margin="10,0" Padding="10,10" /> </WrapPanel> </StackPanel> As you can see, my wrap panel has several buttons. Each button has the same margin and padding. The question is, is there a way of setting margin and padding for wrap panel, so each element inside the wrap panel may use it values? This make the code shorter and let me specify Margin and Padding only one time instead of setting it for each control in the panel. Thank you!

    Read the article

  • ScheduledExecutorService throwable lost

    - by Andrey
    Hello, Consider I scheduled a Runnable for periodic execution with ScheduledExecutorService and there occurs some system Error like OutOfMemory. It will be silently swallowed. scheduler.scheduleWithFixedDelay(new Runnable() { @Override public void run() { throw new OutOfMemoryError(); // Swallowed } }, 0, delay, TimeUnit.SECONDS); Is it normal? Why doesn't it propagate to the container? What is the correct way to handle such errors? Thanks!

    Read the article

  • What data is actually stored in a B-tree database in CouchDB?

    - by Andrey Vlasovskikh
    I'm wondering what is actually stored in a CouchDB database B-tree? The CouchDB: The Definitive Guide tells that a database B-tree is used for append-only operations and that a database is stored in a single B-tree (besides per-view B-trees). So I guess the data items that are appended to the database file are revisions of documents, not the whole documents: +---------|### ... | | +------|###|------+ ... ---+ | | | | +------+ +------+ +------+ +------+ | doc1 | | doc2 | | doc1 | ... | doc1 | | rev1 | | rev1 | | rev2 | | rev7 | +------+ +------+ +------+ +------+ Is it true? If it is true, then how the current revision of a document is determined based on such a B-tree? Doesn't it mean, that CouchDB needs a separate "view" database for indexing current revisions of documents to preserve O(log n) access? Wouldn't it lead to race conditions while building such an index? (as far as I know, CouchDB uses no write locks).

    Read the article

  • JavaScript: Very strange behavior with assigning methods in a loop

    - by Andrey
    Consider this code below: <a href="javascript:void(-1)" id="a1">a1</a> <a href="javascript:void(-1)" id="a2">a2</a> <script type="text/javascript"> var buttons = [] buttons.push("a1") buttons.push("a2") var actions = [] for (var i in buttons) { actions[buttons[i]] = function() { alert(i) } } var elements = document.getElementsByTagName("a") for (var k = 0; k < elements.length; k++) { elements[k].onclick = actions[elements[k].id] } </script> Basically, it shows two anchors, a1 and a2, and I expect to see "1" and "2" popping up in an alert when clicking on corresponding anchor. It doesn't happen, I get "2" when clicking on either. After spending an hour meditating on the code, I decided that it probably happens because dynamic onclick methods for both anchors keep the last value of "i". So I change that loop to for (var i in buttons) { var local_i = i.toString() actions[buttons[i]] = function() { alert(local_i) } } hoping that each dynamic function will get its own copy of "i" with immediate value. But after this change I get "1" popping up when I click on either link. What am I doing wrong? It's a huge show stopper for me.

    Read the article

  • Video encoding by servlet with MEncoder

    - by Andrey
    Hello. I was developing an application for video encoding on the server and got a problem with encoding video with MEncoder. This decoder doesn't work correctly when runned by a command line with Runtime.getRuntime().exec(“D:\mencoder\mnc\mencoder.exe video1.avi -o outvideo1.flv -of lavf -oac mp3lame -lameopts abr:br=64 -srate 22050 -ovc lavc -lavcopts vcodec=flv:vbitrate=300:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=320:240,harddup -quiet”) ; The decoder launches and works in windows console with my parameters, but when it's run from a servlet it just hangs in process list and doesn't do anything before the web-server is stopped. When trying to use decoder from a simple java applcation, it runs correctly. Thanks for help.

    Read the article

  • Inversion of control domain objects construction problem

    - by Andrey
    Hello! As I understand IoC-container is helpful in creation of application-level objects like services and factories. But domain-level objects should be created manually. Spring's manual tells us: "Typically one does not configure fine-grained domain objects in the container, because it is usually the responsibility of DAOs and business logic to create/load domain objects." Well. But what if my domain "fine-grained" object depends on some application-level object. For example I have an UserViewer(User user, UserConstants constants) class. There user is domain object which cannot be injected, but UserViewer also needs UserConstants which is high-level object injected by IoC-container. I want to inject UserConstants from the IoC-container, but I also need a transient runtime parameter User here. What is wrong with the design? Thanks in advance! UPDATE It seems I was not precise enough with my question. What I really need is an example how to do this: create instance of class UserViewer(User user, UserService service), where user is passed as the parameter and service is injected from IoC. If I inject UserViewer viewer then how do I pass user to it? If I create UserViewer viewer manually then how do I pass service to it?

    Read the article

  • Browser graphics: Java Applet vs Flash vs anything else?

    - by Andrey
    Hello! We sell photoalbums which our customers create theirselves using a client album editor program (for Windows). Now we are going to develop an online program so customers could create their albums in the browser: upload photos and edit them. This is going to be a rich browser application with full graphics support. The problem is what technology to use? Our server application is build in Java and we think about Java Applets so that we could reuse some Java-code. We are also not very familiar with Flash. But some people say that Flash is preferred. Maybe there're some modern technologies now? SVG or some Google technologies (like GWT but with graphics support) or something? What do you think? Thanks in advance!

    Read the article

  • How do I translate a ISO 8601 datetime string into a Python datetime object?

    - by Andrey Fedorov
    I'm getting a datetime string in a format like "2009-05-28T16:15:00" (this is ISO 8601, I believe) one hack-ish option seems to be to parse the string using time.strptime and passing the first 6 elements of the touple into the datetime constructor, like: datetime.datetime(*time.strptime("2007-03-04T21:08:12", "%Y-%m-%dT%H:%M:%S")[:6]) I haven't been able to find a "cleaner" way of doing this, is there one?

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >