I have a blog built with Ruby, but I frequently blog about Objective-C topics.
I thus need a Ruby library that can take Objective-C source code strings and produce syntax-highlighted HTML output.
For Ruby source strings, I am happily using the syntax gem - http://syntax.rubyforge.org/ - but I can't find an Objective-C tokenizer for this library.
Is there an open source tokenizer available, or another library which can do this in Ruby?
If all else fails, all I've found is a PHP library (GeSHi) which claims to have Obj-C support, and I'll have to install PHP on my host, write a janky shell exec based invocation of it. I would love to avoid this. Thanks!
Well, you can just use a command line tool to do this and the best possible solution is surely Pygments, and if you're running on a Linux hosting you probably have Python installed already.
Just call it from the command line and store the output somewhere.
A little digging on Google led me to this gem, Highlight, which supports Objective-C. There are a few other Ruby gems listed here.
Related
I'm using NixOS as the distro on WSL (via the excellent setup provided by Trundle: https://github.com/Trundle/NixOS-WSL) and I'd like to install the racket package. If I run nix-shell -p racket, it dutifully downloads (or uses the previously downloaded) the pre-built binary and I can use it just fine. But if I add racket to the environment.systemPackages list in configuration.nix and try to nixos-rebuild test, it starts trying to build things from source. It fails when it gets to gtk (presumably because WSL2 doesn't yet support graphical applications).
Why the difference in behavior? Is there a way I can convince NixOS to use the pre-built racket when filling out the systemPackages? Happy to post my configuration.nix if it would help the diagnosis, though it's really not much of a departure from Trundle's.
I am working on choosing and adopting a static site generator.
My understanding is that Jekyll is the most popular one. I learned that Jekyll is based on Ruby language.
I do not have any experience with Ruby and it is not on my Career path. I am very much a .NET and C# developer.
Do I need to know Ruby in order to use Jekyll efficiently? Or should I compromise and adopt a less popular static site generator that is based on .NET platform?
Update after having good answers here and some research
I think we have good response and answers here. Thank you #2583rk and #deveth0
However, I am discouraged by the fact that Jekyll disregards Windows and does not provide official support for it. Windows is quite a popular desktop OS and ignoring it does not look good for a tool that usually (and practically) runs on a "non-server" or desktop environment (It does generates files run on servers though)
I am going to give Pretzel a try as it has all the benefits of Jekyll plus more.
There is no need for Ruby understanding. Most task just require a basic or deeper knowledge of markdown and liquid, but both are easy to learn.
Only if you want to build plugins, you'll need Ruby.
I switched my blog over to Jekyll earlier this year with no background in Ruby and, for the most part, it hasn't been a problem. Jekyll is a simple and straightforward solution with some good documentation; you can find a lot of examples online on how to setup it up properly and use plugins without knowing too much about Ruby.
I've been using Jekyll on a Windows laptop without any issues. There's a separate set of instructions for getting it up and running on Windows here. You need to install a package manager called Chocolatey, then install ruby using choco install ruby -y and then you can install Jekyll using gem install jekyll. There's some more detailed information on the link for specific things like encoding, auto-generation, etc.
Jekyll works fine on Windows. Half my doc team is using Jekyll with Windows. Here's a tutorial on installing Jekyll on Windows.
This earlier SO question suggests mysql.connector, which is what I am actually using. However, as noted in a comment to the accepted answer in the aforementioned question, this is not a standard python module.
My problem: whenever my ISP upgrades to a newer Python version, I have to notice the crashes and bug them to install mysql.connector for me.
I could explicitly call for an older version of Python 3.x. However, all other things being equal, I'd like to use the latest Python, and it seems like MySQL is just such a standard of standards that there really should be a standard Python 3 library for it. Is there? I'm not doing anything fancy with the database (or with python), so basic functionality is o.k.
Just use a venv and isolate yourself from ISP python upgrades:
pyvenv ./mysqlvenv
./mysqlvenv/bin/pip install mysql-connector-python --allow-external mysql-connector-python
install your other dependencies using ./mysqlvenv/bin/pip install foo and Bob's your uncle.
I have configured pycharm 2 to work with my pyramid project.
It says it can not find sqlalchemy and pyramid libraries and puts a red line under them. This is really annoying because I do not have autocomplete for these libraries.
But all my other libraries int virtual environment are being recognized in the project. I have double checked and the libraries are there in the virtualenv.
I have just moved from PyDev where it was working really fine. Any ideas on what I might have missed out?
Please ensure that you have followed this guide, Using PyCharm with Pyramid.
If you still have issues, please follow up.
Also note that JetBrains has released PyCharm 3 with two versions, a free Community Edition and a Professional Edition.
Under Preferences -> Project Interpter -> Python Interpreters
Make sure the pycharm library is on the path. PyCharm is usually good at recognizing new modules, but you can manually tweak them here. You might be able to install SQLAlchemy and Pyramid directly from PyCharm now, as they've added additional support for them in the new v3 of the IDE.
Try PyCharm 3 , it has support for Pyramid Framework.
Does anybody know where to get a MySQL libraries compiled for the arm iPhone architecture?
Or how to cross-compile MySQL for arm?
Thanx
Here's how I did it:
1) Download the source code version of Connector/C from MySQL
2) Download cmake (if you have macports installed, type "sudo port install cmake")
3) Get toolchain files from http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake
4) In the toolchain file for the simulator, remove one architecture from the line containing CMAKE_OSX_ARCHITECTURES
5) If you want to build for the simulator, copy the missing headers in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/usr/include/netinet/ (ip.h and in_system.h) from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/usr/include/netinet
6) Create a directory called "compiled_library" somewhere, eg on your Desktop
7) Call cmake like this:
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/iphone-toolchain-file -DCMAKE_INSTALL_PREFIX=/path/to/compiled_library -DHAVE_FDATASYNC:INTERNAL=0
8) Note that if you want to run cmake a 2nd time, you might have to delete the cache file first
9) type make install
10) Now you have the compiled library in /path/to/compiled_library. Copy the header file directory and libmysql.a to your xcode project via "Add existing files...". The library should be automtically added to the linker stage.
11) WOOHOO. Use the mysql C API.
12) If this is too much work, I'm currently writing a MySQL wrapper framework for the iPhone. I will publish it sometime in the next ten years and put a link here.
EDIT:
Someone else created an Objective C Wrapper for the MySQL client library: http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/
do you need client or server libraries? Anyway, since OS X supports unix scripts you should at least try build using "regular Unix" approach:
client:
http://dev.mysql.com/doc/refman/5.1/en/connector-c-building.html
server:
http://dev.mysql.com/doc/refman/5.1/en/installing-source.html
You can use Kumulos 'Hookup' http://www.kumulos.com/2011/07/06/introducing-hookup/ feature to build a suite of web services for your MySQL database.
Basically you define your different web services in the online control panel, then it builds all the Objective-C code and server side code.
I believe this is the easiest way to achieve your goals, and probably a lot better than using a direct Objective-C MySQL library.
This worked for me:
https://github.com/thrivesmart/just-mysql-example-mac-app-objective-c-xcode/issues/1
No compilation needed
Just use that LIB and replace the lib with the other repo!
I don't believe you can run MySQL on the iPhone. As Ben pointed out SQLite is built into the iPhone and you can use Core Data to manage structured data.