Jump to content

wolph

Member
  • Posts

    68
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by wolph

  1. That's something you shouldn't do... the flow I would imagine: With every character that comes through the scriptfilter the script checks if a daemon is running and if not, starts the daemon. If the daemon is running, send a new job to the daemon and return the last result from the daemon (which is probably outdated). In the meanwhile, the daemon always processes the last request it gets and drops all other requests. Once it's done processing, wait for a set period (e.g. 10 seconds) and if no new request comes, exit. If someone is really interested in using this I can write up a python demo.
  2. Very true. The library I wrote is (for me at least) just a more advanced calculator with some unit conversions build in. Calculations similar to "2 * cos(pi)" are a regular occurance for me so for me it basically replaced the Alfred calculator It definitely depends on your use-case.
  3. I'm the author of the other converter and I have to say that there are a few tiny issues with the keywordless approach due to how Alfred works. The autocomplete (<tab>) is broken because it assumes that the number is the keyword. @David: just added that to my converter
  4. I usually just create a directory in my workspace directory (~/workspace/alfred-<workflow-name> for me) and move the files from the Alfred Workflows directory to the workspace directory. After that I replace the Alfred Workflow with a symlink (ln -Fs ~/workspace/alfred-<workflow-name> alfred-workflow-dir-with-uuid). Works perfectly Virtualenvs are a great advantage when you're using libraries, within Alfred there's no clean method (yet) to install Python libraries so a virtualenv has very little advantage. It's still not a bad idea but Alfred won't use it anyhow so there's little advantage either. The only advantage I can think of is that you can't accidently use locally installed libraries (if you install libraries outside of your virtualenvs). What gave you that idea? You can store functions in modules, files, classes or even within a function Giving a class is state is generally recommended, but because of the inheritance possibility it can be a good idea to use classes even when you're not using instances. I wonder though, why aren't you using an instance? Take a look at my alfred-convert project for example: https://github.com/WoLpH/alfred-converter From what you are describing I would recommend a making a "result = Result()" type of thing where that result object has the methods for storing the results until you output them. As for having separate classes for every data file... it all depends on your case of course. If the objects are virtually identical in definition and needed methods than I would just create a single class with multiple instances. But if they contain separate methods (or are expected to have separate methods in the future) than I would recommend having a base class with a simple inherited class for the specifics (i.e. "class SpecialFoo(Foo): pass").
  5. Personally I'd just start a background worker and push tasks to that. And make the worker always process and return the newest result. It depends on the language you're using though, with PHP that might be a bit of a pain to get working
  6. If you're willing to try again. I've included some icons in the output to make everything a bit clearer. Perhaps that helps
  7. Well... those onkyos have 2 options. The older ones just have the RS232 which you have to connect to your computer manually. Setting up that interface isn't that hard but it's a bit of work since accessing serial ports are os dependent and such. The newer ones (which I was referring to) have a network interface which you can send commands to. Basically, the old ones have ISCP support and the newer ones have EISCP as well (ISCP over ethernet). Truthfully... the protocol in the background doesn't make too much difference, even if it's a different brand the idea is the same. Might take different commands but should be pretty much the same If you can get your receiver wired up and responding to basic commands I can fix the rest. Here's a test: http://robotskirts.com/2012/04/28/controlling-onkyo-integra-receivers-via-rs-232/
  8. Anyone here with an Onkyo (or any other) receiver that would be interested in controlling the power, volume and other things with Alfred? I'm considering making a small workflow to control my receiver with Alfred since I usually use it to play music
  9. Can't say I saw the units library before I started writing this, that's indeed a lot better. I was previously trying to use the units library from Jason Cheatham which never worked the way I liked. The one thing I don't like about the units library is that it requires an internet connection, otherwise it just fails. By doing everything locally it always (on my system at least) return within 50ms making it fast enough for instant results. Either way, I think I've fixed all issues (although it's not as pretty as the units library). Perhaps I can merge some things with the units library, can't find any license information though.
  10. Yeah... it's nice to have accuracy but sometimes it's a bit much Right now it rounds to 6 decimal places so things like 4^.5 work without a problem but it doesn't lose precision for calculations like: (25/4)^.5
  11. The output can be improved indeed, for me it's a bit more convenient since it just converts it to any alternative measurement instead of just from a single one to another. Not really sure what the best solution for the output should be, right now all calculations are done with a precision of 28 places which is the default for the Decimal library. I could easily increase or decrease it upon demand. Perhaps I'll even make it configurable. I'll see if I can make the output slightly less messy by rounding things like 4^.5 As for functions, there's actually a workaround for mathematical functions, try this for example: "=sin(pi/2)-cos(2pi)"
  12. Alfred unit converter is a really fast smart calculator for Alfred with support for unit conversions to make it a bit comparable to the Google Calculator and Wolfram Alpha. If new units and/or other names for units should be added please let me know by creating an issue at:https://github.com/WoLpH/alfred-converter/issues Example queries Downloadable from Packal: http://www.packal.org/workflow/unit-converter 1m in cm # Just a simple conversion 2^30 byte # Using powers before conversion 5' # Converting units with special characters 20" # Like above 5 * cos(pi + 2) # Executing mathematical functions 5 * pi + 2 mm in m # Mathematical constants with unit conversion 1 * cos(pi/2) - sin(pi^2) # More advanced mathematical expressions ln(e^10) # Testing the ln(x) alias of log _e(x) log(e^10) # The normal log method 5+3^2" in mm # Testing math with unit conversion 1 + 2 / 3 * 4) mm^2 in cm^2 # Unbalanced paranthesis with unit conversion ((1 + 2 / 3 * 4) mm^2 in cm^2 # Unbalanced paranthesis the other way inf - inf # Not actually possible, but we backtrack to "inf" The list of units and conversions was downloaded from:http://w3.energistics.org/uom/poscUnits22.xml It returns results within 50 milliseconds making it fast enough to use the results instead of the standard alfred calculator. It supports more too Note: the parser automatically works when you start with a number or a ".". For all other cases (functions for example) it's best to just use "=". For example: "=ln(e^5)"
  13. Thanks, that works great Especially with the "spot c" feature!
  14. Very nice workflow Perhaps one nice addition would be to add support for wrapper scripts like tmx (here's my version: https://github.com/WoLpH/dotfiles/blob/master/bin/tmx) which automatically launches a new tmux session and activates your environment. Currently I'm just using it from the shell with this little zsh completion script to save me some typing: #compdef tmx local active_sessions all_sessions _active_sessions() { if [ -n "$(tmux ls 2>/dev/null)" ]; then active_sessions=($(tmux ls | awk -F ':' '{print $1}' | tr '\n' ' ')) fi } _all_sessions() { [ -d ~/workspace ] && all_sessions=($(ls -1 ~/workspace | sed -e 's/\.sparseimage.*//' | grep -v '\.' | grep -iE '[a-z0-9]*')) } _active_sessions _wanted active_sessions expl 'Active sessions' compadd -a active_sessions _all_sessions _wanted all_sessions expl 'All sessions' compadd -a all_sessions
  15. Really amazing plugin (extension), great work! Just wondering if there's any way to search for and within your own playlists? Also, are the next/previous commands implemented yet? That's actually the thing I use most. Right now I just have a separate workflow for that
  16. First of all, apologies for the slow response. I completely forgot to check and kind of assumed I would get a notification for updates You are indeed correct, the workflow is/was using a Script Filter, that must be the problem. As Nogorilla suggested though, clearing the knowledge did help quite a bit. Not that it solved it completely but it's so fast that it doesn't matter too much right now.
  17. As you can see in this little video (needed something to demonstrate) my workflow (the toggle wifi) shows up at the top about a second after the Wireless Diagnostics app shows at the top. This is quite annoying which regularly results me in accidently opening the wireless diagnostics instead of my toggle wifi workflow https://www.dropbox.com/s/khdd02ld4xkm90h/alfred_slow.mov Versions: Alfred v2.2 (243) OS X: 10.9.2, build 13C64
×
×
  • Create New...