Error when connecting to hello world yesod example on Windows 8 - yesod

I start the executable (after building it with cabal) and it says "Application launched, listening on port 3000." Next I connect to it with my web browser and the console says "threadWaitRead requires -threaded on Windows, or use System.IO.hWaitForInput." The web browser never connects. Not sure what this is actually recommending I do to resolve the problem.
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses,
TemplateHaskell, OverloadedStrings #-}
import Yesod
data HelloWorld = HelloWorld
mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
|]
instance Yesod HelloWorld
getHomeR :: Handler RepHtml
getHomeR = defaultLayout [whamlet|Hello World!|]
main :: IO ()
main = warpDebug 3000 HelloWorld

The problem has probably been introduced here : http://hdiff.luite.com/cgit/warp/commit?id=1.3.1.1
Enforce cabal to use the 1.3.1 version of warp and things should work as expected. It still requires to be linked with -threaded, in my experience.

I'm not sure how you're compiling the executable, but using -threaded sounds like it would solve the problem, e.g.:
ghc --make hello-yesod.hs -threaded
hello-yesod.exe

Related

Omnet++ (Eclipse IDE?) crashes when running INET projects - EXCEPTION_ACCESS_VIOLATION in opplibs.dll

Currently working with Omnet++ and INET on my bachelors thesis. I managed to work just fine, however since a few weeks my Omnet IDE starts crashing either when trying to run a simulation, or just after a few minutes when opening normally.
I've already reinstalled the entire Omnet++ and Inet package, as if it were entirely new. After this reinstall, the IDE doesn't seem to crash by itself anymore, and I'm able to run non INET simulations. However, still, after trying to run a INET simulation the program crashes immediatly.
Here's an error similar to all the ones I get, usually with just few differences:
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006848962e, pid=14676, tid=0x0000000000001f98
#
# JRE version: Java(TM) SE Runtime Environment (8.0_102-b14) (build 1.8.0_102-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.102-b14 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [opplibs.dll+0xc962e]
#
opplibs.dll is in every single one of these error messages. But even a reinstalled opplibs has not fixed the issue. I'm really at a wits end and need pointers. Thank you.
AFAIK this project have its repository on github - https://github.com/omnetpp/omnetpp
so it's the best place to ask for it. Simply go to "Issues" bookmark and search for your issue or create new one.
You can also look there for similiar issues: Possible causes of Java VM EXCEPTION_ACCESS_VIOLATION?
I managed to figure out the mistake in this part.
Inside my .ini file, I was calling
tkenv-plugin-path = ../../../etc/plugins , however due to a change in my file structure that path was no longer correct. This was throwing the EXCEPTION_ACCESS_VIOLATION without any further error message.

QNX gdb server to debug a application

Nowdays I use qnx gdb server to debug a application, but there are some amazing things happend.
There are lots of files in my project, for examples
src/a.c src/b.c src/c.c
include/a.h include/b.h include/c.h
using Makefile, I generate a libso file named libtest.so and a executable file name helloworld.
I scp the libtest.so and helloworld to target machine, and the path is /home/user/myapp/ and set PATH well, and I can run helloworld in target machine
Attention there is a fun name Display() fun in the libtest.so, and there is a fuction named myfun() in the include/c.h(at line 5), and myfun will call Dislpay() function:
myfun(){Display();}
When I use qnx gdb server , the step is as follows:
1. ntoaarch64-gdb
2. file helloworld
3. target qnx IP:PORT
4. upload helloworld /home/user/helloworld
5. b c.h:5
6. r
It call stop at breakpoint myfun(), but when I run step or stepi command,
it can not step into Display() function, and I run disassemblecommand,
it show 0x100cd5e0 <Display#plt>, There is no disassembly content about Display function, I seemed be omitted!
There are any worng or missing step when I debug this application, who can help my, I have speed five days... Thank a lot
By the way, I think is a gdb server question instead of a qnx gdb server question.
but when I run step or stepi command, it can not step into Display() function
This is somewhat expected with lazy dynamic symbol resolution. Note that if you call myfun again, you should be able to step into Display without problems.
The best solution is to set a break Display.
Alternatively, you could use export LD_BIND_NOW=1 before running helloworld, or link the binary with -Wl,-z,now to disable lazy symbol binding.

x11vnc on embedded raspberry QT5 app

I need to start a VNC server (x11vnc) in my Raspberry pi 3. It's running without X-server (Raspbian Lite). My app (C++ QT 5) writes directly to Linux framebuffer.
Following to some instructions in Qt creator forum, I've done some progress.
At this moment I can start a x11vnc server, connect to Raspberry via a regular VNC client and use my app with mouse and keyboard.
YES, IT'S WORKING.
BUT... If I change the Raspberry resolution (raspi-config) to something different from 1280x720, I don't know why, I can't see the screen perfectly. The VNC client shows a distorted display, like the image bellow.
(And, unfortunately I can't set a fixed resolution)
This is my actual settings to start x11vnc:
x11vnc -permitfiletransfer -nopw -rawfb +/dev/fb0 -forever -noxrecord -noxfixes -noxdamage -xrandr -bg -shared -pipeinput UINPUT:accel=0.7,reset=0 -cursor none -nodragging
I already tried to start with -clip 1280x720+0+0, -geometry 1280x720 and -scale 1280x720, (with other values too) but had the same problem. =/
And I start my application like this:
my-app -platform linuxfb
Both are started with root user.
If someone have an idea of how to fix this, please tell me know! Thanks!

Use a C++ compiled code within a R Shiny app in shinyapp.io

I have developed a ShinyApp that is built around a C++ program. In short, what the app does is :
provides a nice interface to setup the parameters (in a text file) for the C++ app
runs the C++ compiled code using the system(...) command
displays the output of the C++ code using ggplot2
The C++ compiled code is stored into the www folder. Locally it works fine, but when I load the app to the shinyapp website (I have a free subscription), I got the following error:
sh: 1: ./a.out: Permission denied
with a.out being my compile c++ code. Any idea if
I am doing something wrong?
It is possible call a compiled c++ code within shinyapp.io?
This is a super old question, but since I stumbled on it looking for an answer for my identical problem, I would share what worked for me.
I didn't try the .bat suggestion mentioned in the comments, because that seemed to be tied to Windows OS and Shiny uses Linux.
Instead, I used R's Sys.chmod() function. In your case, if you are calling system("a.out"), before that line, put Sys.chmod("a.out", mode="777"). Note that you may want to look more into what chmod does with regards to permissions. But the code would look like:
// ...
Sys.chmod("a.out", mode="777")
system("a.out")
// ... remaining code

Can not compile to a native executable with Clozure CL on OS X 10.10 Yosemite

I have created a simple hello world (hello.lisp) ,code:
(defun main ()
(format t "Hello,World"))
, program to test CCL's native executable compilation. I proceed to compile and load buffer from the CCL GUI (using version Clozure Common Lisp Version 1.10-store-r16266 (DarwinX8664)).
When i test it:
? (main)
Hello,World
NIL
?
It finds the main function. When i proceed to compile it with: (save-application "/tmp/h" :toplevel-function #'main :prepend-kernel t), it proceeds with the operation and CCL exits.
The file is created and is arround ~56MB. When i try to run it though I get the following output:
Error: There is no applicable method for the generic function:
#
when called with arguments:
(# :NOTE-CURRENT-PACKAGE #)
While executing: #, in process toplevel(6).
Error: There is no applicable method for the generic function:
#
when called with arguments:
(# :BREAK-OPTIONS-STRING T)
While executing: #, in process toplevel(6).
Error: There is no applicable method for the generic function:
#
when called with arguments:
(# :BREAK-OPTIONS-STRING T)
While executing: #, in process toplevel(6).
Error: There is no applicable method for the generic function:
#
when called with arguments:
And the errors proceed. What do I do wrong? Is it a bug?
Thank you
I found the keywords :note-current-package and :break-options-string in the cocoa-ide of the sources. Since prepend-kernel t prepends the kernel that was used in the current session, it seems that you would include the cocoa-ide startup in your application. However, the methods dispatching on those keywords only dispatch on ´ns-application`s, which your new application seems not to be.
The solution might be to prepend a kernel without cocoa-ide, either by loading your code into a non-GUI image, or by using the pathname of such a kernel for the :prepend-kernel argument.
To create executables of Clozure CL on Mac OS X:
for non-GUI applications, you need to install Clozure CL from the repository: Installing Clozure CL. You need to download CCL from there. This version comes with an executable Lisp (kernel + image), which hasn't the GUI loaded.
for GUI applications you need to use the Application Builder. The corresponding function is ccl::build-application. GUI applications on Mac OS X need some infrastructure, which is created then. Note that CCL comes with a example application in ccl/examples/cocoa/currency-converter/. Personally I would also prefer to use CCL from the repository - it's usually a bit newer than the version in the Mac Application store.