Search Results

Search found 144 results on 6 pages for 'alexey petrushin'.

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

  • Is it undefined behavior in the case of the private functions call in the initializer list?

    - by Alexey Malistov
    Consider the following code: struct Calc { Calc(const Arg1 & arg1, const Arg2 & arg2, /* */ const ArgN & argn) : arg1(arg1), arg2(arg2), /* */ argn(argn), coef1(get_coef1()), coef2(get_coef2()) { } int Calc1(); int Calc2(); int Calc3(); private: const Arg1 & arg1; const Arg2 & arg2; // ... const ArgN & argn; const int coef1; // I want to use const because const int coef2; // no modification is needed. int get_coef1() const { // calc coef1 using arg1, arg2, ..., argn; // undefined behavior? } int get_coef2() const { // calc coef2 using arg1, arg2, ..., argn and coef1; // undefined behavior? } }; struct Calc is not completely defined when I call get_coef1 and get_coef2 Is this code valid? Can I get UB?

    Read the article

  • Good Haskell coding standards

    - by Alexey Romanov
    Could someone provide a link to a good coding standard for Haskell? I've found this and this, but they are far from comprehensive. Not to mention that the HaskellWiki one includes such "gems" as "use classes with care" and "defining symbolic infix identifiers should be left to library writers only."

    Read the article

  • How do I set up Scala plugin for NetBeans to copy the Scala runtime library?

    - by Alexey Romanov
    Versions: NetBeans 6.8, Scala Kit 0.16.1 When I compile my project, I get the following output: init: deps-jar: Compiling 2 source files to F:\MyProgramming\NorvigSpellChecker\build\classes compile: Created dir: F:\MyProgramming\NorvigSpellChecker\dist Building jar: F:\MyProgramming\NorvigSpellChecker\dist\NorvigSpellChecker.jar Not copying the libraries. To run this application from the command line without Ant, try: java -jar "F:\MyProgramming\NorvigSpellChecker\dist\NorvigSpellChecker.jar" jar: BUILD SUCCESSFUL (total time: 3 seconds) Of course, the libraries should be copied, so I can't actually run it by using this command line. I don't see any options to copy the library in the project configuration. The plugin uses Ant for building, but I don't have any experience with it; presumably it should be easy enough to tell Ant to copy the libraries. Here is build-impl.xml, what should I do in build.xml?

    Read the article

  • Performance implications of finalizers on JVM

    - by Alexey Romanov
    According to this post, in .Net, Finalizers are actually even worse than that. Besides that they run late (which is indeed a serious problem for many kinds of resources), they are also less powerful because they can only perform a subset of the operations allowed in a destructor (e.g., a finalizer cannot reliably use other objects, whereas a destructor can), and even when writing in that subset finalizers are extremely difficult to write correctly. And collecting finalizable objects is expensive: Each finalizable object, and the potentially huge graph of objects reachable from it, is promoted to the next GC generation, which makes it more expensive to collect by some large multiple. Does this also apply to JVMs in general and to HotSpot in particular?

    Read the article

  • Is there a way to force ContourPlot re-check all the points on the each stage of it's recursion algorithm?

    - by Alexey Popkov
    Hello, Thanks to this excellent analysis of the Plot algorithm by Yaroslav Bulatov, I now understand the reason why Plot3D and ContourPlot fail to draw smoothly functions with breaks and discontinuities. For example, in the following case ContourPlot fails to draw contour x^2 + y^2 = 1 at all: ContourPlot[Abs[x^2 + y^2 - 1], {x, -1, 1}, {y, -1, 1}, Contours -> {0}] It is because the algorithm does not go deeply into the region near x^2 + y^2 = 1. It "drops" this region on an initial stage and do not tries to investigate it further. Increasing MaxRecursion does nothing in this sense. And even undocumented option Method -> {Refinement -> {ControlValue -> .01 \[Degree]}} does not help (but makes Plot3D a little bit smoother). The above function is just a simple example. In real life I'm working with very complicated implicit functions that cannot be solved analytically. Is there a way to get ContourPlot to go deeply into such regions near breaks and discontinuities?

    Read the article

  • Custom onsynctopreference for XUL textbox

    - by Alexey Romanov
    I wanted to enable custom shortcuts in my Firefox extension. The idea is that the user just focuses on a textbox, presses key combination, and it's shown in the textbox and saved to a preference. However, I couldn't get it to work. With this XUL <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css" type="text/css"?> <!DOCTYPE window SYSTEM "chrome://nextplease/locale/nextplease.dtd"> <prefwindow id="nextpleaseprefs" title="&options.title;" buttons="accept, cancel" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <prefpane id="nextplease.general" label="&options.general.title;" image="chrome://nextplease/skin/Sound Mixer.png"> <preferences> <preference id="nextkey" name="nextplease.nextkey" type="int"/> </preferences> <vbox flex="1"> <hbox align="center"> <label value="&options.general.nextKey;" /> <textbox id="nextkey" flex="1" editable="false" onkeyup="return nextplease.handleKeySelection(this, event);" preference-editable="true" preference="nextkey" onsynctopreference="alert('syncing'); return nextplease.syncKeySelector(this);"/> </hbox> </vbox> </prefpane> <script type="application/x-javascript" src="chrome://nextplease/content/nextpleaseCommon.js" /> <script type="application/x-javascript" src="chrome://nextplease/content/nextpleaseOptions.js" /> </prefwindow> the event in onkeyup works. But when I click the OK button, I don't see a "syncing" alert. Why isn't onsynctopreference working? Is it impossible to have custom onsynctopreference attribute for a textbox?

    Read the article

  • SWT: cleaning up before application exit

    - by Alexey Romanov
    What is the best way for an SWT application to clean up resources before application exit? I see two options: 1) Add a DisposeListener to main window (or better, to the Display). Will it get run if an uncaught exception happens? 2) Use a shutdown hook. Any problems to be aware of there which aren't mentioned in Design of the Shutdown Hooks API?

    Read the article

  • What Java/Scala or .NET web frameworks support modify source code and instantly run workflow e.i. wi

    - by Alexey
    As far as I can see the key advantage of dynamic languages like Ruby or Python over Java/Scala/C# etc is "hot" applying of your changes to source code to the running application. What are the frameworks for JVM or .NET that support the same workflow - apply changes to configuration and source code on the fly? Can they also watch changes to custom configurations and notify application? Note: Frameworks for dynamic languages on JVM/.NET like Grails or Compojure are out of scope here.

    Read the article

  • Improving MVP in Scala

    - by Alexey Romanov
    The classical strongly typed MVP pattern looks like this in Scala: trait IView { } trait Presenter[View <: IView] { // or have it as an abstract type member val view : View } case class View1(...) extends IView { ... } case object Presenter1 extends Presenter[View1] { val view = View1(...) } Now, I wonder if there is any nice way to improve on it which I am missing...

    Read the article

  • Scala methods ending in _=

    - by Alexey Romanov
    I seem to remember Scala treating methods ending in _= specially, so something like this: object X { var x: Int = 0; def y_=(n : Int) { x = n }} X.y = 1 should call X.y_=(1). However, in 2.8.0 RC1, I get an error message: <console>:6: error: value y is not a member of object X X.y = 1 ^ Interestingly, just trying to call the method without parentheses fails as well: scala> X.y_= 1 <console>:1: error: ';' expected but integer literal found. X.y_= 1 ^ Am I misremembering something which does actually exist or did I just invent it out of whole cloth?

    Read the article

  • Flex 4: Component move event

    - by alexey
    I have a CustomTextInput component based on TextInput (Spark) component. The instance of this class is placed on a popup window (TitleWindow). How can I capture the popup move (dragging the title) event inside CustomTextInput implementation? MoveEvent.MOVE event of the CustomTextInput itself doesn't work. Of course, I can't access the parent popup window inside the component implementation, because it's a common component that can be used not only on the popup windows.

    Read the article

  • Creating a Type object corresponding to a generic type

    - by Alexey Romanov
    In Java, how can I construct a Type object for Map<String, String>? System.out.println(Map<String, String>.class); doesn't compile. One workaround I can think of is private Map<String, String> dummy() { throw new Error(); } Type mapStringString = Class.forName("ThisClass").getMethod("dummy", null).getGenericReturnType(); Is this the correct way?

    Read the article

  • Scala Hoogle equivalent?

    - by Alexey Romanov
    Hoogle allows you to search many standard Haskell libraries by either function name, or by approximate type signature. I find it very useful. Is there anything like Hoogle for Scala? Search in ScalaDoc 2 only finds types and packages by name.

    Read the article

  • What is CTabFolderPageManager?

    - by Alexey Romanov
    This Eclipse bug mentions something called CTabFolderPageManager, which seems like it could be useful for me. However, searching for CTabFolderPageManager doesn't give any results. Is it a future feature for SWT (given that the bug report is from 2007, this would be surprising)? Or did I just fail at searching for it?

    Read the article

  • Facebook social reading plugin for Wordpress?

    - by Alexey
    As you know, a lot of bigger news websites have intorduced "social readers" for Facebook (e.g. https://apps.facebook.com/wpsocialreader/), which log what the user has read into the activity stream ("Michael read..."). Is it possible to integrate similar functionality into a Wordpress blog? Are the relevant API's open? Are there any plugins available? Thanks. UPD: http://trac.ahwebdev.fr/projects/facebook-awd The plugin seems to do the trick. Will have to try it out!

    Read the article

  • Problems applying texture to a triangle strip using glTexCoordPointer

    - by Alexey
    Hi, I'm writing a pretty simple piece of code which should draw a plane. The plane must have two different textures on its sides, like if it was a book page. I'm trying to achieve this by doing this: glFrontFace(GL_CCW); glBindTexture(GL_TEXTURE_2D, textures[kActiveSideLeft]); glVertexPointer(3, GL_FLOAT, 0, vertexCoordinates); glTexCoordPointer(2, GL_FLOAT, 0, textureCoordinates); glDrawArrays(GL_TRIANGLE_STRIP, 0, (2 * kHorizontalSegmentsCount + 4) * kVerticalSegmentsCount); glFrontFace(GL_CW); glBindTexture(GL_TEXTURE_2D, textures[kActiveSideRight]); glVertexPointer(3, GL_FLOAT, 0, vertexCoordinates); glTexCoordPointer(2, GL_FLOAT, 0, textureCoordinates); glDrawArrays(GL_TRIANGLE_STRIP, 0, (2 * kHorizontalSegmentsCount + 4) * kVerticalSegmentsCount); textures[] array contains 2 GLuint textures which specify appropriate textures. vertexCoordinates and textureCoordinates contain vertexes and texture coordinates respectively ((2 * kHorizontalSegmentsCount + 4) * kVerticalSegmentsCount) equals 15 and that's exactly how many elements I have in the arrays I set up opengl like this: glEnable(GL_DEPTH_TEST); glClearDepthf(1.0f); glDepthFunc(GL_LEQUAL); glClearColor(0.0, 1.0, 1.0, 1.0); glEnable(GL_TEXTURE_2D); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); What happens is when I run it front side of the plane looks Ok, but it appears like if texture coordinates weren't applied to the back side. It appears like texture on the back side is just tiled and not connected to vertexes by any means. Any idea what am I doing wrong? Or any idea about what can I do to debug this problem? Thanks.

    Read the article

  • Running a method after the constructor of any derived class

    - by Alexey Romanov
    Let's say I have a Java class abstract class Base { abstract void init(); ... } and I know every derived class will have to call init() after it's constructed. I could, of course, simply call it in the derived classes' constructors: class Derived1 extends Base { Derived1() { ... init(); } } class Derived2 extends Base { Derived2() { ... init(); } } but this breaks "don't repeat yourself" principle rather badly (and there are going to be many subclasses of Base). Of course, the init() call can't go into the Base() constructor, since it would be executed too early. Any ideas how to bypass this problem? I would be quite happy to see a Scala solution, too.

    Read the article

  • Class name to view path

    - by Alexey Poimtsev
    Hi, I have a RoR application and model SomeModel. I have views for this model and I want to know - is there any method to get the view's path? Of course I can use for this model instance m = SomeModel.new v = m.class.class_name.pluralize.downcase It's working, but maybe you know a better way? :)

    Read the article

  • Why `is_base_of` works with private inheritance?

    - by Alexey Malistov
    Why the following code works? typedef char (&yes)[1]; typedef char (&no)[2]; template <typename B, typename D> struct Host { operator B*() const; operator D*(); }; template <typename B, typename D> struct is_base_of { template <typename T> static yes check(D*, T); static no check(B*, int); static const bool value = sizeof(check(Host<B,D>(), int())) == sizeof(yes); }; //Test sample class B {}; class D : private B {}; //Exspression is true. int test[is_base_of<B,D>::value && !is_base_of<D,B>::value]; Note that B is private base. Note that operator B*() is const. How does this work? Why this works? Why static yes check(D*, T); is better than static yes check(B*, int); ?

    Read the article

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