Search Results

Search found 157 results on 7 pages for 'alexey romanov'.

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

  • Objects in JavaScript defined and undefined at the same time (in a FireFox extension)

    - by Alexey Romanov
    I am chasing down a bug in a FireFox extension. I've finally managed to see it for myself (I've only had reports before) and I can't understand how what I saw is possible. One error message from my extension in the Error Console is "gBrowser is not defined". This by itself would be surprising enough, since the overlay is over browser.xul and navigator.xul, and I expect gBrowser to be available from both. Even worse is the actual place where it happens: line 101 of nextplease.js. That is, inside the function isTopLevelDocument, which is only called from onContentLoaded, which is only called from onLoad here: gBrowser.addEventListener(this.loadType, function (event) { nextplease.loadListener.onContentLoaded(event); }, true); So gBrowser is defined in onLoad, but somehow undefined in isTopLevelDocument. When I tried to actually use the extension, I got another error: "nextplease is not defined". The interesting thing is that it happened on lines 853 and 857. That is, inside the functions nextplease.getNextLink = function () { nextplease.getLink(window.content, nextplease.NextPhrasesMap, nextplease.NextImagesMap, nextplease.isNextRegExp, nextplease.NEXT_SEARCH_TYPE); } nextplease.getPrevLink = function () { nextplease.getLink(window.content, nextplease.PrevPhrasesMap, nextplease.PrevImagesMap, nextplease.isPrevRegExp, nextplease.PREV_SEARCH_TYPE); } So nextplease is somehow defined enough to call these functions, but isn't defined inside them. Finally, executing typeof(nextplease) in Execute JS returns "object". Same for gBrowser. How can this happen? Any ideas?

    Read the article

  • Self-type mismatch in Scala

    - by Alexey Romanov
    Given this: abstract class ViewPresenterPair { type V <: View type P <: Presenter trait View {self: V => val presenter: P } trait Presenter {self: P => var view: V } } I am trying to define an implementation in this way: case class SensorViewPresenter[T] extends ViewPresenterPair { type V = SensorView[T] type P = SensorPresenter[T] trait SensorView[T] extends View { } class SensorViewImpl[T](val presenter: P) extends SensorView[T] { presenter.view = this } class SensorPresenter[T] extends Presenter { var view: V } } Which gives me the following errors: error: illegal inheritance; self-type SensorViewPresenter.this.SensorView[T] does not conform to SensorViewPresenter.this.View's selftype SensorViewPresenter.this.V trait SensorView[T] extends View { ^ <console>:13: error: type mismatch; found : SensorViewPresenter.this.SensorViewImpl[T] required: SensorViewPresenter.this.V presenter.view = this ^ <console>:16: error: illegal inheritance; self-type SensorViewPresenter.this.SensorPresenter[T] does not conform to SensorViewPresenter.this.Presenter's selftype SensorViewPresenter.this.P class SensorPresenter[T] extends Presenter { ^ I don't understand why. After all, V is just an alias for SensorView[T], and the paths are the same, so how can it not conform?

    Read the article

  • Good articles to read on SSL and HTTPS?

    - by Igor Romanov
    I had a problem with accepting invalid SSL certificate in my iPhone program. That problem is solved now, however I came to understanding that I have very abstract idea on how exactly the whole thing is working: how web browser is verifying that received certificate is really for host it communicates to and not faked by same party in the middle? if browser talks to some 3rd party (CA?) to do certificate check? and many other questions... Would someone please recommend good source of information with in-depth enough description of how all parts click together?

    Read the article

  • How to make iPhone application accept incorrect server certificate but only specific one?

    - by Igor Romanov
    I need to work with private HTTPS API and client has incorrect certificate on the host. Certificate is for www.clienthost.com and I'm working with api.clienthost.com. So I need to connect via HTTPS to api.clienthost.com ignoring incorrect certificate but still make sure it is the one for www.clienthost.com and not something else. I found this answer: http://stackoverflow.com/questions/933331/how-to-use-nsurlconnection-to-connect-with-ssl-for-an-untrusted-cert and it seems to solve half of my problem but I'm trying to figure out how to still check certificate for host is one I expect to see and not different.

    Read the article

  • Changing order of children of an SWT Composite

    - by Alexey Romanov
    In my case I have two children of a SashForm, but the question applies to all Composites and different layouts. class MainWindow { Sashform sashform; Tree child1 = null; Table child2 = null; MainWindow(Shell shell) { sashform = new SashForm(shell, SWT.NONE); } // Not called from constructor because it needs data not available at that time void CreateFirstChild() { ... Tree child1 = new Tree(sashform, SWT.NONE); } void CreateSecondChild() { ... Table child2 = new Table(sashform, SWT.NONE); } } I don't know in advance in what order these methods will be called. How can I make sure that child1 is placed on the left, and child2 on the right? Alternately, is there a way to change their order as children of sashform after they are created? Currently my best idea is to put in placeholders like this: class MainWindow { Sashform sashform; private Composite placeholder1; private Composite placeholder2; Tree child1 = null; Table child2 = null; MainWindow(Shell shell) { sashform = new SashForm(shell, SWT.NONE); placeholder1 = new Composite(sashform, SWT.NONE); placeholder2 = new Composite(sashform, SWT.NONE); } void CreateFirstChild() { ... Tree child1 = new Tree(placeholder1, SWT.NONE); } void CreateSecondChild() { ... Table child2 = new Table(placeholder2, SWT.NONE); } }

    Read the article

  • Cross-platform GUI toolkits with WPF-style composition capabilities

    - by Alexey Romanov
    A huge advantage of WPF over, say, WinForms is its composability. To quote Programming WPF: One level up, WPF provides its “content model,” which allows any control to host any group of other controls. You don’t have to build special BitmapButton or IconComboBox classes; you put as many images, shapes, videos, 3D models, or whatever into a Button (or a ComboBox, ListBox, etc.) as suit your fancy. Are there any cross-platform GUI frameworks (preferably with Java bindings) out there which also let you do this?

    Read the article

  • SWT Composite consructor throws IllegalArgumentException on a non-null argument

    - by Alexey Romanov
    This piece of code (in Scala) val contents = { assert(mainWindow.detailsPane != null) new Composite(mainWindow.detailsPane, SWT.NONE) } throws an exception: Exception occurred java.lang.IllegalArgumentException: Argument not valid at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.widgets.Widget.error(Unknown Source) at org.eclipse.swt.widgets.Widget.checkParent(Unknown Source) at org.eclipse.swt.widgets.Widget.<init>(Unknown Source) at org.eclipse.swt.widgets.Control.<init>(Unknown Source) at org.eclipse.swt.widgets.Scrollable.<init>(Unknown Source) at org.eclipse.swt.widgets.Composite.<init>(Unknown Source) at main.scala.NodeViewPresenter$NodeViewImpl.<init>(NodeViewPresenter.scala:41) According to the documentation, IllegalArgumentException should only be thrown when the parent is null, but I am checking for that. detailsPane is a CTabFolder. Can anybody say why this could happen?

    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

  • 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

  • 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

  • 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

  • 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 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

  • 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

  • Writing functions of tuples conveniently in Scala

    - by Alexey Romanov
    Quite a few functions on Map take a function on a key-value tuple as the argument. E.g. def foreach(f: ((A, B)) ? Unit): Unit. So I looked for a short way to write an argument to foreach: > val map = Map(1 -> 2, 3 -> 4) map: scala.collection.immutable.Map[Int,Int] = Map(1 -> 2, 3 -> 4) > map.foreach((k, v) => println(k)) error: wrong number of parameters; expected = 1 map.foreach((k, v) => println(k)) ^ > map.foreach({(k, v) => println(k)}) error: wrong number of parameters; expected = 1 map.foreach({(k, v) => println(k)}) ^ > map.foreach(case (k, v) => println(k)) error: illegal start of simple expression map.foreach(case (k, v) => println(k)) ^ I can do > map.foreach(_ match {case (k, v) => println(k)}) 1 3 Any better alternatives?

    Read the article

  • Scala: getting the name of the class the trait is mixed in

    - by Alexey Romanov
    Given an instance of a class, we can obviously return its name: trait MixedInClassDiscovery { val className = this.getClass.getName } class AClass extends MixedInClassDiscovery { ... this.className // returns "AClass" ... } But this way uses reflection, once for every instance of AClass. Can the same be done once for every class, instead? One solution which comes to mind is to mix it into companion objects instead of classes themselves.

    Read the article

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