Search Results

Search found 25 results on 1 pages for 'elazar leibovich'.

Page 1/1 | 1 

  • Replacing latex with unicode symbols

    - by Elazar Leibovich
    Often, during a conversation or an email, or at a forum, I would like to type some math, but I don't need full equation support. Unicode symbols should suffice. What I need is an easy way to type math related unicode symbols. Since I already know latex, it makes sense to use the latex symbol mnemonics to type the math symbols. What I currently did is to write an AutoHotKey script which automatically replaces \latexSymbol with the corresponding unicode symbol, using the "hotstrings" AutoHotKey feautres. However, the AutoHotKey hotstrings proved unstable for many strings. Having a couple of tens lines would cause AHK to fail recognizing the strings from time to time. Any other solution? (No, Alt+unicode number isn't convenient enough) Attached is my AHK script. The PutUni function is taken from here. ::\infty:: PutUni("e2889e") return ::\sum:: PutUni("e28891") return ::\int:: PutUni("e288ab") return ::\pm:: PutUni("c2b1") return ::\alpha:: PutUni("c991") return ::\beta:: PutUni("c992") return ::\phi:: PutUni("c9b8") return ::\delta:: PutUni("ceb4") return ::\pi:: PutUni("cf80") return ::\omega:: PutUni("cf89") return ::\in:: PutUni("e28888") return ::\notin:: PutUni("e28889") return ::\iff:: PutUni("e28794") return ::\leq:: PutUni("e289a4") return ::\geq:: PutUni("e289a5") return ::\sqrt:: PutUni("e2889a") return ::\neq:: PutUni("e289a0") return ::\subset:: PutUni("e28a82") return ::\nsubset:: PutUni("e28a84") return ::\nsubseteq:: PutUni("e28a88") return ::\subseteq:: PutUni("e28a86") return ::\prod:: PutUni("e2888f") return ::\N:: PutUni("e28495") return

    Read the article

  • hardware for pushing buttons

    - by Elazar Leibovich
    Many times I want my computer to interface old hardware. Such as radio, light switch, etc. This mostly involves pushing pressing and moving various buttons and switches. I don't want to buy new hardware I want my computer to interface the old hardware I already have. I thought about it and reached to the conclusion that what I need is a general purpose button-pusher hardware. I need a simple device I can interface by a computer and would be able to push most of the buttons we have in daily accessories, without damaging the button. Is there any such accessory availible?

    Read the article

  • Replacing latex with unicode symbols

    - by Elazar Leibovich
    Often, during a conversation or an email, or at a forum, I would like to type some math, but I don't need full equation support. Unicode symbols should suffice. What I need is an easy way to type math related unicode symbols. Since I already know latex, it makes sense to use the latex symbol mnemonics to type the math symbols. What I currently did is to write an AutoHotKey script which automatically replaces \latexSymbol with the corresponding unicode symbol, using the "hotstrings" AutoHotKey feautres. However, the AutoHotKey hotstrings proved unstable for many strings. Having a couple of tens lines would cause AHK to fail recognizing the strings from time to time. Any other solution? (No, Alt+unicode number isn't convenient enough) Attached is my AHK script. The PutUni function is taken from here. ::\infty:: PutUni("e2889e") return ::\sum:: PutUni("e28891") return ::\int:: PutUni("e288ab") return ::\pm:: PutUni("c2b1") return ::\alpha:: PutUni("c991") return ::\beta:: PutUni("c992") return ::\phi:: PutUni("c9b8") return ::\delta:: PutUni("ceb4") return ::\pi:: PutUni("cf80") return ::\omega:: PutUni("cf89") return ::\in:: PutUni("e28888") return ::\notin:: PutUni("e28889") return ::\iff:: PutUni("e28794") return ::\leq:: PutUni("e289a4") return ::\geq:: PutUni("e289a5") return ::\sqrt:: PutUni("e2889a") return ::\neq:: PutUni("e289a0") return ::\subset:: PutUni("e28a82") return ::\nsubset:: PutUni("e28a84") return ::\nsubseteq:: PutUni("e28a88") return ::\subseteq:: PutUni("e28a86") return ::\prod:: PutUni("e2888f") return ::\N:: PutUni("e28495") return

    Read the article

  • Bandwidth preserving browsing mode

    - by Elazar Leibovich
    I'm looking at some methods to browse the web, in situations where bandwidth is scarce (such as, flaky wifi connection, or mobile phone internet provider who overcharges the bandwidth). One thing that would save alot of bandwidth is not downloading images while browsing. This approach has two main drawbacks Sometimes a site's layout depends of images. There are some images you wish to see (thus disabling images downloading through firefox settings is not quite convenient). I'm looking therefor for a method that would allow me to Use some heuristic to find out which images are related to the website layout and allow them to be downloaded. Select a particular image from a website, download and display it. Maybe there's a firefox extension for that?

    Read the article

  • What is the impact of leaving a laptop in "sleep" mode (while on battery power)?

    - by Elazar Leibovich
    How much battery would leaving my laptop at "sleep" mode consume? is the consumption low enough so that it would be safe to leave the laptop sleeping at nights regularily and using it tommorow? What's the recommended period of time for which I should not turn it off, but let it sleep. (for example, if I'll use the computer in a minute - turning it off instead of making it to sleep will definitely not save battery due to the overhead of turning your computer on and off).

    Read the article

  • Open source alternative for "Intellitrace"

    - by Elazar Leibovich
    Microsoft has recently announced "Intellitrace", a killer feature for VS2010 IMHO. Basically it records all the instructions the program ran, and allows you to easily look through the execution log. Is there a similar feature for open source tools? Specifically such a feature for Java with Eclipse integration would be a nice thing to have.

    Read the article

  • Open source alternative for "Intellisense"

    - by Elazar Leibovich
    Microsoft has recently announced "Intellisense", a killer feature for VS2010 IMHO. Basically it records all the instructions the program ran, and allows you to easily look through the execution log. Is there a similar feature for open source tools? Specifically such a feature for Java with Eclipse integration would be a nice thing to have.

    Read the article

  • Functional way to get a matrix from text

    - by Elazar Leibovich
    I'm trying to solve some Google Code Jam problems, where an input matrix is typically given in this form: 2 3 #matrix dimensions 1 2 3 4 5 6 7 8 9 # all 3 elements in the first row 2 3 4 5 6 7 8 9 0 # each element is composed of three integers where each element of the matrix is composed of, say, three integers. So this example should be converted to #!scala Array( Array(A(1,2,3),A(4,5,6),A(7,8,9), Array(A(2,3,4),A(5,6,7),A(8,9,0), ) An imperative solution would be of the form #!python input = """2 3 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 0 """ lines = input.split('\n') print lines[0] m,n = (int(x) for x in lines[0].split()) array = [] row = [] A = [] for line in lines[1:]: for elt in line.split(): A.append(elt) if len(A)== 3: row.append(A) A = [] array.append(row) row = [] from pprint import pprint pprint(array) A functional solution I've thought of is #!scala def splitList[A](l:List[A],i:Int):List[List[A]] = { if (l.isEmpty) return List[List[A]]() val (head,tail) = l.splitAt(i) return head :: splitList(tail,i) } def readMatrix(src:Iterator[String]):Array[Array[TrafficLight]] = { val Array(x,y) = src.next.split(" +").map(_.trim.toInt) val mat = src.take(x).toList.map(_.split(" "). map(_.trim.toInt)). map(a => splitList(a.toList,3). map(b => TrafficLight(b(0),b(1),b(2)) ).toArray ).toArray return mat } But I really feel it's the wrong way to go because: I'm using the functional List structure for each line, and then convert it to an array. The whole code seems much less efficeint I find it longer less elegant and much less readable than the python solution. It is harder to which of the map functions operates on what, as they all use the same semantics. What is the right functional way to do that?

    Read the article

  • setTimeout(fun) with a single argument

    - by Elazar Leibovich
    The HTML5 specifications states that setTimeout can be run without the additional "timeout" argument which is supposed to say after how many milliseconds will the function "handler" be scheduled. handle = window . setTimeout( handler [, timeout [, arguments ] ] ) Schedules a timeout to run handler after timeout milliseconds. Any arguments are passed straight through to the handler. However, I failed to find anywhere which explains what happens when no "timeout" time period is set. An example usage is, the animation implementation int the Raphael library. animationElements[length] && win.setTimeout(animation);

    Read the article

  • comparing two angles

    - by Elazar Leibovich
    Given four points in the plane, A,B,X,Y, I wish to determine which of the following two angles is smaller ?ABX or ?ABY. I'd rather not use cos or sqrt, in order to preserve accuracy. In the case where A=(-1,0),B=(0,0), I can compare the two angles ?ABX and ?ABY, by calculating the dot product of the vectors X,Y, and watch it's sign. What I can do in this case is: Determine whether or not ABX turns right or left If ABX turns left check whether or not Y and A are on the same side of the line on segment BX. If they are - ?ABX is a smaller than ABY. If ABX turns right, then Y and A on the same side of BX means that ?ABX is larger than ?ABY. But this seems too complicated to me. Any simpler approach?

    Read the article

  • Greasemonkey script for inserting math in gmail

    - by Elazar Leibovich
    I wish an easy way to communicate mathematical equations with gmail. There's a javascript script called AsciiMath, which should translate Tex-like equations into standard mathML. I thought that it would be nice to use this script with GM. I thought that before sending the email, this script would convert all the TeX-like equations in your email to MathML. Thus the reader which is using FF (or IE with MathPlayer installed) would be able to easily read those equations. Ideally, I wish to somehow keep the original TeX-like equations in a plain-text message, so that it would be readable by plain text email clients, such as mutt. Obviously the weakest link here is the client software, which most likely doesn't support MathML. Still if my correspondent is using Firefox and some kind of webmail (which is pretty reasonable) - it should work. My question is, is it possible? Did anyone do that? Do you see any technical problems with this approach (gmail filtering the MathML, client not parsing it correctly etc.)? Any smarter ideas?

    Read the article

  • Deploying only changed part of a website with git to ftp (svn2web for git)

    - by Elazar Leibovich
    I'm having a website with many big images file. The source (as well as the images) is maintained with git. I wish to deploy that via ftp to a bluehost-like cheap server. I do not wish to deploy all the website each time (so that I won't have to upload too many unchanged files over and over), but to do roughly the following: In a git repository, mark the last deployed revision with a tag "deployed". When I say "deploy revision X", find out which files has changed between revision X and revision tagged as deploy, and upload just them. It is similar in spirit to svn2web. But I want that for DVCS. Mercurial alternative will be considered. It's a pretty simple script to write, but I'd rather not to reinvent the wheel if there's some similar script on the web. Capistrano and fab seems to know only how to push the whole revision, in their SCM integration. So I don't think I can currently use them.

    Read the article

  • graph library for scala

    - by Elazar Leibovich
    Is there a good library (or wrapper to Java library) for graphs, and/or graph algorithms in scala? This one seems to be quite dead. This is an example for the Dijkstra algorithm in scala, but I'm looking for a library a-la JGraphT.

    Read the article

  • Effects of the `extern` keyword on C functions

    - by Elazar Leibovich
    In C I did not notice any effect of the extern keyword used before function declaration. At first I thougth that when defining extern int f(); in a single file forces you to implement it outside of the files scope, however I found out that both extern int f(); int f() {return 0;} And extern int f() {return 0;} Compiles just fine, with no warnings from gcc. I used gcc -Wall -ansi, he wouldn't even accept // comments. Are there any effects for using extern before function definitions? Or is it just an optional keyword with no side effects for functions. In the latter case I don't understand why did the standard designers chose to litter the grammar with superfluous keywords. EDIT: to clarify, I know there's usage for extern in variables, but I'm only asking about extern in functions.

    Read the article

  • calculate intersection between two segments in a symmetric way

    - by Elazar Leibovich
    When using the usual formulas to calculate intersection between two 2D segments, ie here, if you round the result to an integer, you get non-symmetric results. That is, sometimes, due to rounding errors, I get that intersection(A,B)!=intersection(B,A). The best solution is to keep working with floats, and compare the results up to a certain precision. However, I must round the results to integers after calculating the intersection, I cannot keep working with floats. My best solution so far was to use some full order on the segments in the plane, and have intersection to always compare the smaller segment to the larger segment. Is there a better method? Am I missing something?

    Read the article

  • Duplicating custom nodes in JavaFX

    - by Elazar Leibovich
    As far as I understand, duplicating nodes in JavaFX should be done with the Duplicator.duplicate function. It works fine when duplicating nodes whose types are included in JavaFX library, for example def dup = Duplicator.duplicate(Rectangle{x:30 y:30 width:100 height:100}); dup.translateX = 10; insert dup into content; would insert a black rectangle to the scene. However if I define a new class in the following way: class MyRect extends Rectangle {} Or class MyRect extends CustomNode { override function create() {Rectangle{x:30 y:30 width:10 height:10}} } It gives me the following runtime error Type 'javafxapplication1.NumberGrid$MyRect' not found. Where of course javafxapplication1.NumberGrid are the package and file the MyRect class is in. This guy at Sun's forums had the same problem, but I don't see any answer in there. Or maybe I'm doing that the wrong way, and there's a better approach for duplicating custom nodes? update: Trying to duplicate Group worked, but trying to duplicate Stack yields the same error. According to the documentation, it's supposed to support all types supported in FXD including Node, but maybe it supports only some of Node's descendants?

    Read the article

  • Real life usage of the projective plane theory

    - by Elazar Leibovich
    I'm learning about the theory of the projective plane. Very generally speaking, it is an extension of the plane, which includes additional points which are defined as the intersection points of two parallel lines. In the projective plane, every two lines have an interesection point. Whether they're parallel or not. Every point in the projective plane can be represented by three numbers (you actually need less than that, but nevemind now). Is there any real life application which uses the projective plane? I can think that, for instance, a software which needs to find the intersections of a line, can benefit from always having an intersection point which might lead to simpler code, but is it really used?

    Read the article

  • printing long compilation lines with MS NMAKE

    - by Elazar Leibovich
    I have a legacy MS NMAKE Makefile I need to fix a few bugs in. There are some very long command lines I wish to debug that are being executed using the NMAKE trick of "inline files": dep: cmd @<<tmpfilename cmd_args.. << When changing the line to dep: echo cmd @<<tmpfilename cmd_args.. << NMAKE complains that the line is too long. Is there any other trick I can apply in order to view the command line NMAKE is actually executing?

    Read the article

  • A simple algorithm for polygon intersection

    - by Elazar Leibovich
    I'm looking for a very simple algorithm for computing the polygon intersection/clipping. That is, given polygons P, Q, I wish to find polygon T which is contained in P and in Q, and I wish T to be maximal among all possible polygons. I don't mind the run time (I have a few very small polygons), I can also afford getting an approximation of the polygons' intersection (that is, a polygon with less points, but which is still contained in the polygons' intersection). But it is really important for me that the algorithm will be simple (cheaper testing) and preferably short (less code). edit: please note, I wish to obtain a polygon which represent the intersection. I don't need only a boolean answer to the question of whether the two polygons intersect.

    Read the article

  • Functional programming approach for Java's input/output streams

    - by Elazar Leibovich
    I'm using Java's DataInputStream with scala to parse some simple binary file (which is very bad exprerience due to the lack of unsigned types, even in scala, but that's a different story). However I find myself forced to use mutable data structure, since Java's streams are inherently state preserving entities. What's a good design to wrap Java's streams with nice functional data structure?

    Read the article

  • Access inner function variables in Javascript

    - by Elazar Leibovich
    In many frameworks, internal function variables are used as private variables, for example Raphael = (function(){ var private = function(a,b) {return a+b;}; var public = function(a) {return private(a,a);} var object = {mult2:public}; return object; })(); here, we cannot access from the global namespace the variable named private, as it is an inner variable of the anonymous function in the first line. Sometimes this function is contains a big Javascript framework, so that it wouldn't pollute the global namespace. I need to unit tests some object Raphael uses internally (in the above example, I wish to run unit tests on the object private). How can I test them?

    Read the article

  • Resources for memory management in embedded application

    - by Elazar Leibovich
    How should I manage memory in my mission critical embedded application? I found some articles with google, but couldn't pinpoint a really useful practical guide. The DO-178b forbids dynamic memory allocations, but how will you manage the memory than? preallocate everything in advance and send a pointer to each function that needs allocation? Allocate it on the stack? Use a global static allocator (but then it's very similar to dynamic allocation)? Answers can be of the form of regular answer, reference to a resource, or reference to good opensource embedded system for example. clarification: The issue here is not whether or not memory management is availible for the embedded system. But what is a good design for an embedded system, to maximize reliability.

    Read the article

  • Preallocating memory with C++ in realtime environment

    - by Elazar Leibovich
    I'm having a function which gets an input buffer of n bytes, and needs an auxillary buffer of n bytes in order to process the given input buffer. (I know vector is allocating memory at runtime, let's say that I'm using a vector which uses static preallocated memory. Imagine this is NOT an STL vector.) The usual approach is void processData(vector<T> &vec) { vector<T> &aux = new vector<T>(vec.size()); //dynamically allocate memory // process data } //usage: processData(v) Since I'm working in a real time environment, I wish to preallocate all the memory I'll ever need in advance. The buffer is allocated only once at startup. I want that whenever I'm allocating a vector, I'll automatically allocate auxillary buffer for my processData function. I can do something similar with a template function static void _processData(vector<T> &vec,vector<T> &aux) { // process data } template<size_t sz> void processData(vector<T> &vec) { static aux_buffer[sz]; vector aux(vec.size(),aux_buffer); // use aux_buffer for the vector _processData(vec,aux); } // usage: processData<V_MAX_SIZE>(v); However working alot with templates is not much fun (now let's recompile everything since I changed a comment!), and it forces me to do some bookkeeping whenever I use this function. Are there any nicer designs around this problem?

    Read the article

1