I am trying to deploy an Rmarkdown document to RPubs. Required data are in subfolder /Data of the directory where the app is located. Previous errors were solved by loading some (but, mysteriously, not all) libraries on separate lines ('library(). Now, it says deployment is successful, but the website https://yettas.shinyapps.io/ShinyVEST-lite/ returns:
'Error: Error: An error has occurred. Check your logs or contact the app author for clarification.' Unlike previous attempts, I do not see an Error explicitly listed in the logs (see below). I am not sure what to look for other than the word 'Error'.
Thank you in advance for your help!
2022-11-07T15:57:05.864726+00:00 shinyapps[7537976]: 176:
signalCondition 2022-11-07T15:57:05.864730+00:00 shinyapps[7537976]:
175: signal_abort 2022-11-07T15:57:05.864734+00:00 shinyapps[7537976]:
174: abort 2022-11-07T15:57:05.864742+00:00 shinyapps[7537976]: 173:
h 2022-11-07T15:57:05.864759+00:00 shinyapps[7537976]: 172:
.handleSimpleError 2022-11-07T15:57:05.864763+00:00
shinyapps[7537976]: 171: between 2022-11-07T15:57:05.864771+00:00
shinyapps[7537976]: 170: mask$eval_all_filter
2022-11-07T15:57:05.864774+00:00 shinyapps[7537976]: 168:
filter_eval 2022-11-07T15:57:05.864777+00:00 shinyapps[7537976]:
167: filter_rows 2022-11-07T15:57:05.864780+00:00 shinyapps[7537976]:
166: filter.data.frame 2022-11-07T15:57:05.864787+00:00
shinyapps[7537976]: 165: NextMethod 2022-11-07T15:57:05.864797+00:00
shinyapps[7537976]: 164: stopifnot 2022-11-07T15:57:05.864828+00:00
shinyapps[7537976]: 163: .re_sf 2022-11-07T15:57:05.864838+00:00
shinyapps[7537976]: 162: filter.sf 2022-11-07T15:57:05.864842+00:00
shinyapps[7537976]: 161: filter 2022-11-07T15:57:05.864871+00:00
shinyapps[7537976]: 160: select 2022-11-07T15:57:05.864876+00:00
shinyapps[7537976]: 159: mutate 2022-11-07T15:57:05.864888+00:00
shinyapps[7537976]: 158: %!>(MISSING)%!(NOVERB)
2022-11-07T15:57:05.864906+00:00 shinyapps[7537976]: 157:
new.get.data 2022-11-07T15:57:05.864915+00:00 shinyapps[7537976]:
156: %!>(MISSING)%!(NOVERB) 2022-11-07T15:57:05.864927+00:00
shinyapps[7537976]: 155: eval 2022-11-07T15:57:05.864943+00:00
shinyapps[7537976]: 154: eval 2022-11-07T15:57:05.864966+00:00
shinyapps[7537976]: 153: eval_with_user_handlers
2022-11-07T15:57:05.864971+00:00 shinyapps[7537976]: 148:
evaluate_call 2022-11-07T15:57:05.864975+00:00 shinyapps[7537976]:
147: evaluate::evaluate 2022-11-07T15:57:05.864997+00:00
shinyapps[7537976]: 146: evaluate 2022-11-07T15:57:05.865006+00:00
shinyapps[7537976]: 143: eng_r 2022-11-07T15:57:05.865018+00:00
shinyapps[7537976]: 142: block_exec 2022-11-07T15:57:05.865037+00:00
shinyapps[7537976]: 141: call_block 2022-11-07T15:57:05.865059+00:00
shinyapps[7537976]: 140: process_group.block
2022-11-07T15:57:05.865071+00:00 shinyapps[7537976]: 137:
process_file 2022-11-07T15:57:05.865091+00:00 shinyapps[7537976]:
136: knitr::knit 2022-11-07T15:57:05.865096+00:00 shinyapps[7537976]:
135: 2022-11-07T15:57:05.865109+00:00 shinyapps[7537976]:
130: 2022-11-07T15:57:05.865113+00:00 shinyapps[7537976]:
114: doc 2022-11-07T15:57:05.865142+00:00 shinyapps[7537976]: 113:
renderUI 2022-11-07T15:57:05.865149+00:00 shinyapps[7537976]: 112:
func 2022-11-07T15:57:05.865165+00:00 shinyapps[7537976]: 99:
renderFunc 2022-11-07T15:57:05.865171+00:00 shinyapps[7537976]: 98:
output$reactivedoc 2022-11-07T15:57:05.865190+00:00
shinyapps[7537976]: 17:
2022-11-07T15:57:05.865194+00:00 shinyapps[7537976]: 15:
2022-11-07T15:57:05.865219+00:00 shinyapps[7537976]:
13: fn 2022-11-07T15:57:05.865227+00:00 shinyapps[7537976]: 8:
retry 2022-11-07T15:57:05.865245+00:00 shinyapps[7537976]: 7:
connect$retryingStartServer 2022-11-07T15:57:05.865250+00:00
shinyapps[7537976]: 6: eval 2022-11-07T15:57:05.865269+00:00
shinyapps[7537976]: 5: eval 2022-11-07T15:57:05.865273+00:00
shinyapps[7537976]: 4: eval 2022-11-07T15:57:05.865297+00:00
shinyapps[7537976]: 3: eval 2022-11-07T15:57:05.865323+00:00
shinyapps[7537976]: 2: eval.parent
2022-11-07T15:57:05.865339+00:00 shinyapps[7537976]: 1: local
I am using a standalone ATmega328P with two piezo elements to generate some music.
I have defined some constants with the frequencies of the music notes.
Then I defined a struct which contains the note for the first and the second piezo and the length of the note.
Then I made more arrays of these structs to describe each songs.
The problem is that this way I run out of memory quickly. I tried to store the arrays of structs in the PROGMEM, to avoid this problem. I tried to use a small library called PROGMEM_readAnything, the memcpy_P() or the pgm_read_word() and pgm_read_byte() functions, but in all cases I get the same problem.
As I loop through the array of NOTES it skips some of the elements, while reads and plays the others correctly. It always skips the same elements, and not just random ones.
I even tried to change the microcontroller, thinking that certain parts of the chip may have been damaged by something, but uploading the same sketch I got the same results, so the microcontroller is probably intact.
Here is the code:
#include <Tone.h>
#include <avr/pgmspace.h>
// Define the notes frequency
#define G2 98
#define Gs2 104
#define Ab2 104
#define A2 110
#define As2 116
//... and so on with many other music notes ...
#define Fs7 2960
#define Gb7 2960
#define G7 3136
//Rest
#define R 0
typedef struct {
int n1;
int n2;
byte units;
} NOTES;
Tone buzzer1;
Tone buzzer2;
int myTempo = 100;
// Walkyrie
const NOTES walkyrie[] PROGMEM = {
{Fs3, Fs4, 2},
{B3, B4, 3},
{Fs3, Fs4, 1},
{B3, B4, 2},
{D4, D5, 6},
{B3, B4, 6},
{D4, D5, 3},
{B3, B4, 1},
{D4, D5, 2},
{Fs4, Fs5, 6},
{D4, D5, 6},
{Fs4, Fs5, 3},
{D4, D5, 1},
{Fs4, Fs5, 2},
{A4, A5, 6},
{A3, A4, 6},
{D4, D5, 3},
{A3, A4, 1},
{D4, D5, 2},
{Fs4, Fs5, 6},
{R, 0, 4},
{A3, A4, 2},
{D4, D5, 3},
{A3, A4, 1},
{D4, D5, 2},
{Fs4, Fs5, 6},
{D4, D5, 6},
{Fs4, Fs5, 3},
{D4, D5, 1},
{Fs4, Fs5, 2},
{A4, A5, 6},
{Fs4, Fs5, 6},
{A4, A5, 3},
{Fs4, Fs5, 1},
{A4, A5, 2},
{Cs5, Cs6, 6},
{Cs4, Cs5, 6},
{Fs4, Fs5, 3},
{Cs4, Cs5, 1},
{Fs4, Fs5, 2},
{As4, As5, 6}
};
void playSong()
{
// We store the frequency of the second piezo in this variable
int secondFreq = 0;
Serial.println(sizeof(walkyrie)/sizeof(walkyrie[0]));
// Walk through the array of music
for(int i = 0; i < sizeof(walkyrie)/sizeof(walkyrie[0]); i++)
{
int n1;
int n2;
byte units;
// Only play if it is not a rest
if (walkyrie[i].n1 > 0)
{
n1 = pgm_read_word(&(walkyrie[i].n1));
n2 = pgm_read_word(&(walkyrie[i].n2));
units = pgm_read_byte(&(walkyrie[i].units));
Serial.print("Row ");
Serial.print(i);
Serial.print(": Frequency 1: ");
Serial.print(n1);
Serial.print(" Frequency 2: ");
Serial.print(n2);
Serial.print(" Units: ");
Serial.println(units);
// Play the note of the first piezo
buzzer1.play(n1, (units*myTempo));
// If the frequency of the second piezo is 0, we play the same note
// as the first, else the note set for the second one
if (n2 == 0)
{
secondFreq = n1;
}
else {
secondFreq = n2;
}
buzzer2.play(secondFreq, (units*myTempo));
}
// Then we wait for the note to end plus a little, between two notes
delay((units*myTempo) + 10);
}
}
void setup() {
Serial.begin(9600);
buzzer1.begin(11);
buzzer2.begin(12);
}
void loop()
{
playSong();
}
I added some lines to see in serial monitor what happens. It reads the correct length...
The output of the serial monitor is the following:
41 (correct length)
Row 1: Freq1: 247 Freq2: 499 Units: 3 (row 0 - the first note is already missing)
Row 2: Freq1: 185 Freq2: 370 Units: 1
Row 3: Freq1: 247 Freq2: 499 Units: 2 (row 4 missing)
Row 5: Freq1: 247 Freq2: 499 Units: 6 (row 6-7 missing)
Row 8: Freq1: 294 Freq2: 587 Units: 2
Row 9: Freq1: 370 Freq2: 740 Units: 6
Row 10: Freq1: 294 Freq2: 587 Units: 6
Row 11: Freq1: 370 Freq2: 740 Units: 3
Row 12: Freq1: 294 Freq2: 587 Units: 1
Row 13: Freq1: 370 Freq2: 740 Units: 2
Row 14: Freq1: 440 Freq2: 880 Units: 6
Row 15: Freq1: 220 Freq2: 440 Units: 6 (row 16-17 missing)
Row 18: Freq1: 294 Freq2: 587 Units: 2
Row 19: Freq1: 370 Freq2: 740 Units: 6
Row 20: Freq1: 0 Freq2: 0 Units: 4
Row 21: Freq1: 220 Freq2: 440 Units: 2
Row 22: Freq1: 294 Freq2: 587 Units: 3
Row 23: Freq1: 220 Freq2: 440 Units: 1
Row 24: Freq1: 294 Freq2: 587 Units: 2
Row 25: Freq1: 370 Freq2: 740 Units: 6
Row 26: Freq1: 294 Freq2: 587 Units: 6
Row 27: Freq1: 370 Freq2: 740 Units: 3
Row 28: Freq1: 294 Freq2: 587 Units: 1
Row 29: Freq1: 370 Freq2: 740 Units: 2
Row 30: Freq1: 440 Freq2: 880 Units: 6
Row 31: Freq1: 370 Freq2: 740 Units: 6
Row 32: Freq1: 440 Freq2: 880 Units: 3
Row 33: Freq1: 370 Freq2: 740 Units: 1
Row 34: Freq1: 440 Freq2: 880 Units: 2
Row 35: Freq1: 554 Freq2: 1109 Units: 6
Row 36: Freq1: 277 Freq2: 554 Units: 6
Row 37: Freq1: 370 Freq2: 740 Units: 3
Row 38: Freq1: 277 Freq2: 554 Units: 1
Row 39: Freq1: 370 Freq2: 740 Units: 2
Row 40: Freq1: 466 Freq2: 932 Units: 6
Why does it happen? Or is there a better, more efficient way of solving this problem?
In this line, you check the data, but you haven't done a 'pgm_read_word()' to actually get the data from the flash memory:
if(walkyrie[i].n1 > 0)
If, by accident, you get a non-zero value, then you correctly read the values from flash, but otherwise, you skip that row.
Further evidence:
Row 20: Frq1: 0 Frq2: 0 Units: 4
Here, n1 is zero, but that test should have skipped the row.
Also, the logic for a 'rest' is a little off. Right now, you don't read the units for the duration of the rest, so it's using the previous value (from a played note).
I think I'd get all three values first, and then check them.
I'd also encode the frequencies into a byte, and use a look-up table to convert the "key number" into a frequency (like MIDI key numbers). Your array of structs will be a little smaller that way. Maybe turn on the __packed__ (whatever) attribute also, to avoid the padding between the entries -- if saving flash space matters (then you could get more songs in there!)
Sounds fun! Good luck!
When I do (0x7fffffff | 0x8000000) I am getting 0xffffffffffffffff instead of the expected 0xffffffff. What am I missing?
Some sample code and output to illustrate my question.
Code:
#include <iostream>
using namespace std;
int main()
{
unsigned long long val = 0;
for (int i = 0; i < 64; i++) {
val |= 0x1 << i;
cout << i << ": " << std::hex << val << std::dec << endl;
}
return 0;
}
Output:
0: 1
1: 3
2: 7
3: f
4: 1f
5: 3f
6: 7f
7: ff
8: 1ff
9: 3ff
10: 7ff
11: fff
12: 1fff
13: 3fff
14: 7fff
15: ffff
16: 1ffff
17: 3ffff
18: 7ffff
19: fffff
20: 1fffff
21: 3fffff
22: 7fffff
23: ffffff
24: 1ffffff
25: 3ffffff
26: 7ffffff
27: fffffff
28: 1fffffff
29: 3fffffff
30: 7fffffff
31: ffffffffffffffff
32: ffffffffffffffff
33: ffffffffffffffff
34: ffffffffffffffff
35: ffffffffffffffff
36: ffffffffffffffff
37: ffffffffffffffff
38: ffffffffffffffff
39: ffffffffffffffff
40: ffffffffffffffff
41: ffffffffffffffff
42: ffffffffffffffff
43: ffffffffffffffff
44: ffffffffffffffff
45: ffffffffffffffff
46: ffffffffffffffff
47: ffffffffffffffff
48: ffffffffffffffff
49: ffffffffffffffff
50: ffffffffffffffff
51: ffffffffffffffff
52: ffffffffffffffff
53: ffffffffffffffff
54: ffffffffffffffff
55: ffffffffffffffff
56: ffffffffffffffff
57: ffffffffffffffff
58: ffffffffffffffff
59: ffffffffffffffff
60: ffffffffffffffff
61: ffffffffffffffff
62: ffffffffffffffff
63: ffffffffffffffff
Firstly your code does not do what you say in your title/question; I have edited the title.
The problem is 1 << 31. If you have 32-bit int (which apparently you do, judging by the results), this cause arithmetic overflow. In C++14 this is implementation-defined behaviour; prior to C++14 it causes undefined behaviour. Reference.
Usually the implementation-defined behaviour will be to generate the int with the sign bit set and the other bits unset. In 2's complement this value is INT_MIN. You then perform arithmetic between an unsigned long long and an int. This is defined as: the int is converted to unsigned long long.
Converting signed integers to unsigned is done by wrapping it around (modular arithmetic) modulo ULLONG_MAX+1. So the result of (unsigned long long)INT_MIN is a very large positive number, in fact 0xFFFFFFFF80000000. (To check this, add 0x80000000 to it to get 0).
So you are actually doing 0x7FFFFFFF | 0xFFFFFFFF80000000 which gives the observed result.
Later on it gets worse: 1 << 32 and larger causes undefined behaviour due to shifting by the whole width of the type.
To fix this, change 0x1 in your code to 1ull. The you will be shifting an unsigned long long, instead of an int.
because of sign extension val is an unsigned long long. But val is not what you are shifting. You are shifting 0x1, an int, then extending it to long long for the '|='
0 WTFCrash assertions.cpp 345 0x10f50517
1 WTF::OwnPtr::operator-> ownptr.h 72 0xffbc8cd
2 WebCore::BitmapTextureImageBuffer::updateContents texturemapperimagebuffer.cpp 62 0x109cb865
3 WebCore::TextureMapperTile::updateContents texturemappertile.cpp 70 0x109cfdb5
4 WebCore::TextureMapperTiledBackingStore::updateContents texturemappertiledbackingstore.cpp 147 0x109c1831
5 WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded graphicslayertexturemapper.cpp 624 0x103b852e
6 WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly graphicslayertexturemapper.cpp 444 0x103b79b4
7 WebCore::GraphicsLayerTextureMapper::flushCompositingState graphicslayertexturemapper.cpp 591 0x103b78c7
8 WebCore::GraphicsLayerTextureMapper::flushCompositingState graphicslayertexturemapper.cpp 596 0x103b796f
9 WebCore::GraphicsLayerTextureMapper::flushCompositingState graphicslayertexturemapper.cpp 596 0x103b796f
10 WebCore::GraphicsLayerTextureMapper::flushCompositingState graphicslayertexturemapper.cpp 596 0x103b796f
11 WebCore::GraphicsLayerTextureMapper::flushCompositingState graphicslayertexturemapper.cpp 596 0x103b796f
12 WebCore::GraphicsLayerTextureMapper::flushCompositingState graphicslayertexturemapper.cpp 596 0x103b796f
13 WebCore::RenderLayerCompositor::flushPendingLayerChanges renderlayercompositor.cpp 399 0x1010ef84
14 WebCore::FrameView::flushCompositingStateForThisFrame frameview.cpp 937 0xffda850
15 WebCore::FrameView::paintContents frameview.cpp 3613 0xffdd1a0
16 QWebFrameAdapter::renderRelativeCoords qwebframeadapter.cpp 539 0xfb0787c
17 QWebFrame::render qwebframe.cpp 644 0x60e96a96
18 QWebFrame::render qwebframe.cpp 655 0x60e96a54
19 QWebView::paintEvent qwebview.cpp 833 0x60ea34e8
20 QWidget::event qwidget.cpp 8114 0x778e9b5c
21 QWebView::event qwebview.cpp 732 0x60ea30dc
22 QApplicationPrivate::notify_helper qapplication.cpp 3500 0x778a1dde
23 QApplication::notify qapplication.cpp 3465 0x7789fdbe
24 QCoreApplication::notifyInternal qcoreapplication.cpp 935 0x66412d04
25 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 240 0x66528938
26 QWidgetPrivate::drawWidget qwidget.cpp 5151 0x778ef4f1
27 QWidgetBackingStore::doSync qwidgetbackingstore.cpp 1180 0x778b2a74
28 QWidgetBackingStore::sync qwidgetbackingstore.cpp 1027 0x778b0f40
29 QWidgetPrivate::syncBackingStore qwidget.cpp 1693 0x778f13e1
30 QWidget::event qwidget.cpp 8252 0x778e9ee2
31 QWebView::event qwebview.cpp 732 0x60ea30dc
32 QApplicationPrivate::notify_helper qapplication.cpp 3500 0x778a1dde
33 QApplication::notify qapplication.cpp 3465 0x7789fdbe
34 QCoreApplication::notifyInternal qcoreapplication.cpp 935 0x66412d04
35 QCoreApplication::sendEvent qcoreapplication.h 237 0x6641c0d9
36 QCoreApplicationPrivate::sendPostedEvents qcoreapplication.cpp 1539 0x66413ce6
37 QCoreApplication::sendPostedEvents qcoreapplication.cpp 1397 0x664117c2
38 QWindowsGuiEventDispatcher::sendPostedEvents qwindowsguieventdispatcher.cpp 88 0x5223bf1
39 qt_internal_proc qeventdispatcher_win.cpp 423 0x664aa392
40 _InternalCallWinProc USER32 0x77467834
41 UserCallWinProcCheckWow USER32 0x77467a9a
42 DispatchMessageWorker USER32 0x7746988e
43 DispatchMessageW USER32 0x774698f1
44 QEventDispatcherWin32::processEvents qeventdispatcher_win.cpp 757 0x664aac85
45 QWindowsGuiEventDispatcher::processEvents qwindowsguieventdispatcher.cpp 80 0x5223b1c
46 QEventLoop::processEvents qeventloop.cpp 137 0x6640eb8c
47 QEventLoop::exec qeventloop.cpp 212 0x6640ed82
48 MainWindow::waitForLoad mainwindow.cpp 345 0xe10fd2
49 MainWindow::thread mainwindow.cpp 460 0xe0729b
50 MainWindow::on_GoButton_clicked mainwindow.cpp 99 0xe04b32
51 MainWindow::qt_static_metacall moc_mainwindow.cpp 72 0xe2f5a8
52 MainWindow::qt_metacall moc_mainwindow.cpp 100 0xe2f53b
53 QMetaObject::metacall qmetaobject.cpp 309 0x6641ede0
54 QMetaObject::activate qobject.cpp 3695 0x6645da56
55 QMetaObject::activate qobject.cpp 3546 0x6645d411
56 QAbstractButton::clicked moc_qabstractbutton.cpp 294 0x77d4809b
57 QAbstractButtonPrivate::emitClicked qabstractbutton.cpp 544 0x779f6657
58 QAbstractButtonPrivate::click qabstractbutton.cpp 536 0x779f5bdb
59 QAbstractButton::mouseReleaseEvent qabstractbutton.cpp 1141 0x779f5042
60 QWidget::event qwidget.cpp 7962 0x778e957c
61 QAbstractButton::event qabstractbutton.cpp 1098 0x779f4ba1
62 QPushButton::event qpushbutton.cpp 682 0x77ab6f1b
63 QApplicationPrivate::notify_helper qapplication.cpp 3500 0x778a1dde
64 QApplication::notify qapplication.cpp 3067 0x7789e5ee
65 QCoreApplication::notifyInternal qcoreapplication.cpp 935 0x66412d04
66 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 240 0x66528938
67 QApplicationPrivate::sendMouseEvent qapplication.cpp 2540 0x778a3123
68 QWidgetWindow::handleMouseEvent qwidgetwindow.cpp 505 0x779249f1
69 QWidgetWindow::event qwidgetwindow.cpp 180 0x77923c0e
70 QApplicationPrivate::notify_helper qapplication.cpp 3500 0x778a1dde
71 QApplication::notify qapplication.cpp 2953 0x7789dfb7
72 QCoreApplication::notifyInternal qcoreapplication.cpp 935 0x66412d04
73 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 240 0x66528938
74 QGuiApplicationPrivate::processMouseEvent qguiapplication.cpp 1701 0x10c82af
75 QGuiApplicationPrivate::processWindowSystemEvent qguiapplication.cpp 1502 0x10ca1d9
76 QWindowSystemInterface::sendWindowSystemEvents qwindowsysteminterface.cpp 579 0x10acad1
77 QWindowsGuiEventDispatcher::sendPostedEvents qwindowsguieventdispatcher.cpp 89 0x5223c01
78 qt_internal_proc qeventdispatcher_win.cpp 423 0x664aa392
79 _InternalCallWinProc USER32 0x77467834
80 UserCallWinProcCheckWow USER32 0x77467a9a
81 DispatchMessageWorker USER32 0x7746988e
82 DispatchMessageW USER32 0x774698f1
83 QEventDispatcherWin32::processEvents qeventdispatcher_win.cpp 757 0x664aac85
84 QWindowsGuiEventDispatcher::processEvents qwindowsguieventdispatcher.cpp 80 0x5223b1c
85 QEventLoop::processEvents qeventloop.cpp 137 0x6640eb8c
86 QEventLoop::exec qeventloop.cpp 212 0x6640ed82
87 QCoreApplication::exec qcoreapplication.cpp 1188 0x66411312
88 QGuiApplication::exec qguiapplication.cpp 1437 0x10c6e78
89 QApplication::exec qapplication.cpp 2746 0x7789dab9
90 main main.cpp 10 0xe02c18 91 WinMain qtmain_win.cpp 131 0xe3145a
92 __tmainCRTStartup crtexe.c 528 0xe30872
93 WinMainCRTStartup crtexe.c 377 0xe3063d
94 BaseThreadInitThunk KERNEL32 0x772f919f
95 __RtlUserThreadStart ntdll 0x7771a8cb
96 _RtlUserThreadStart ntdll 0x7771a8a1
It outputs
QPainter::begin: Paint device returned engine == 0, type: 2 ASSERTION
FAILED: m_ptr
c:\work\build\qt5_workdir\w\s\qtwebkit\Source\WTF\wtf/OwnPtr.h(72) :
WTF::OwnPtr::operator ->
In function
bool MainWindow::waitForLoad(QWebView& view)
{
QEventLoop loopLoad;
QTimer timer;
QObject::connect(&view, SIGNAL(loadFinished(bool)), &loopLoad, SLOT(quit()));
QObject::connect(&view, SIGNAL(loadFinished(bool)), &timer, SLOT(stop()));
QObject::connect(&timer, SIGNAL(timeout()), &loopLoad, SLOT(quit()));
timer.start(timeout);
loopLoad.exec();
if(timer.isActive())
{
timer.stop();
view.stop();
return false;
}
return true;
}
On the line "loopLoad.exec();"
Please help me. What's wrong with my code? Or how to fix that? I ready to disable any user-controls, css, images and ect. Advise me how to make it work
I know the answer! To fix this problem, enable autoload images!
My project.clj file looks like this
(defproject cljs-template "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.4.0-beta4"]
[noir-cljs "0.3.0"]
[fetch "0.1.0-alpha2"]
[noir "1.3.0-beta2"]
[org.clojure/core.cache "0.5.0"]
[com.datomic/datomic "0.1.3142"
:exclusions [org.slf4j/slf4j-nop org.slf4j/slf4j-log4j12]]
[ch.qos.logback/logback-classic "1.0.1"]]
:plugins [[lein-swank "1.4.3"]]
;:cljsbuild {:builds [{}]}
:main ^{:skip-aot true} cljs-template.server)
and my /src/cljs_template/server.clj begins as the following:
(ns cljs-template.server
(:require [noir.server :as server]
[noir.cljs.core :as cljs]
[cljs-template.tree :as tree])
(:use [datomic.api :only [db q] :as d]))
I then start up swank, run (in-ns 'cljs-template.server) within it, move my cursor to the end of the (ns) function call, and attempt to run the (ns) method using Ctrl-x Ctrl-e. When I do so, I get the following error.
No message.
[Thrown class java.lang.ExceptionInInitializerError]
Restarts:
0: [QUIT] Quit to the SLIME top level
1: [CAUSE1] Invoke debugger on cause org.apache.lucene.index.IndexWriterConfig [Thrown class java.lang.ClassNotFoundException]
Backtrace:
0: (Unknown Source) java.lang.Class.forName0
1: Class.java:247 java.lang.Class.forName
2: RT.java:2030 clojure.lang.RT.loadClassForName
3: RT.java:417 clojure.lang.RT.load
4: RT.java:398 clojure.lang.RT.load
5: core.clj:5386 clojure.core/load[fn]
6: core.clj:5385 clojure.core/load
7: RestFn.java:408 clojure.lang.RestFn.invoke
8: core.clj:5200 clojure.core/load-one
9: core.clj:5237 clojure.core/load-lib
10: RestFn.java:142 clojure.lang.RestFn.applyTo
11: core.clj:602 clojure.core/apply
12: core.clj:5271 clojure.core/load-libs
13: RestFn.java:137 clojure.lang.RestFn.applyTo
14: core.clj:602 clojure.core/apply
15: core.clj:5352 clojure.core/require
16: RestFn.java:436 clojure.lang.RestFn.invoke
17: fulltext_index.clj:4 datomic.fulltext-index/loading
18: (Unknown Source) datomic.fulltext_index__init.load
19: (Unknown Source) datomic.fulltext_index__init.<clinit>
20: (Unknown Source) java.lang.Class.forName0
21: Class.java:247 java.lang.Class.forName
22: RT.java:2030 clojure.lang.RT.loadClassForName
23: RT.java:417 clojure.lang.RT.load
24: RT.java:398 clojure.lang.RT.load
25: core.clj:5386 clojure.core/load[fn]
26: core.clj:5385 clojure.core/load
27: RestFn.java:408 clojure.lang.RestFn.invoke
28: core.clj:5200 clojure.core/load-one
29: core.clj:5237 clojure.core/load-lib
30: RestFn.java:142 clojure.lang.RestFn.applyTo
31: core.clj:602 clojure.core/apply
32: core.clj:5271 clojure.core/load-libs
33: RestFn.java:137 clojure.lang.RestFn.applyTo
34: core.clj:602 clojure.core/apply
35: core.clj:5352 clojure.core/require
36: RestFn.java:703 clojure.lang.RestFn.invoke
37: db.clj:4 datomic.db/loading
38: (Unknown Source) datomic.db__init.load
39: (Unknown Source) datomic.db__init.<clinit>
40: (Unknown Source) java.lang.Class.forName0
41: Class.java:247 java.lang.Class.forName
42: RT.java:2030 clojure.lang.RT.loadClassForName
43: RT.java:417 clojure.lang.RT.load
44: RT.java:398 clojure.lang.RT.load
45: core.clj:5386 clojure.core/load[fn]
46: core.clj:5385 clojure.core/load
47: RestFn.java:408 clojure.lang.RestFn.invoke
48: core.clj:5200 clojure.core/load-one
49: core.clj:5237 clojure.core/load-lib
50: RestFn.java:142 clojure.lang.RestFn.applyTo
51: core.clj:602 clojure.core/apply
52: core.clj:5271 clojure.core/load-libs
53: RestFn.java:137 clojure.lang.RestFn.applyTo
54: core.clj:602 clojure.core/apply
55: core.clj:5352 clojure.core/require
56: RestFn.java:703 clojure.lang.RestFn.invoke
57: query.clj:4 datomic.query/loading
58: (Unknown Source) datomic.query__init.load
59: (Unknown Source) datomic.query__init.<clinit>
60: (Unknown Source) java.lang.Class.forName0
61: Class.java:247 java.lang.Class.forName
62: RT.java:2030 clojure.lang.RT.loadClassForName
63: RT.java:417 clojure.lang.RT.load
64: RT.java:398 clojure.lang.RT.load
65: core.clj:5386 clojure.core/load[fn]
66: core.clj:5385 clojure.core/load
67: RestFn.java:408 clojure.lang.RestFn.invoke
68: core.clj:5200 clojure.core/load-one
69: core.clj:5237 clojure.core/load-lib
70: RestFn.java:142 clojure.lang.RestFn.applyTo
71: core.clj:602 clojure.core/apply
72: core.clj:5271 clojure.core/load-libs
73: RestFn.java:137 clojure.lang.RestFn.applyTo
74: core.clj:602 clojure.core/apply
75: core.clj:5352 clojure.core/require
76: RestFn.java:421 clojure.lang.RestFn.invoke
77: api.clj:6 datomic.api/loading
78: (Unknown Source) datomic.api__init.load
79: (Unknown Source) datomic.api__init.<clinit>
80: (Unknown Source) java.lang.Class.forName0
81: Class.java:247 java.lang.Class.forName
82: RT.java:2030 clojure.lang.RT.loadClassForName
83: RT.java:417 clojure.lang.RT.load
84: RT.java:398 clojure.lang.RT.load
85: core.clj:5386 clojure.core/load[fn]
86: core.clj:5385 clojure.core/load
87: RestFn.java:408 clojure.lang.RestFn.invoke
88: core.clj:5200 clojure.core/load-one
89: core.clj:5237 clojure.core/load-lib
90: RestFn.java:142 clojure.lang.RestFn.applyTo
91: core.clj:602 clojure.core/apply
92: core.clj:5271 clojure.core/load-libs
93: RestFn.java:137 clojure.lang.RestFn.applyTo
94: core.clj:604 clojure.core/apply
95: core.clj:5363 clojure.core/use
96: RestFn.java:408 clojure.lang.RestFn.invoke
97: NO_SOURCE_FILE:1 cljs-template.server/eval1941[fn]
98: NO_SOURCE_FILE:1 cljs-template.server/eval1941
99: Compiler.java:6465 clojure.lang.Compiler.eval
100: Compiler.java:6455 clojure.lang.Compiler.eval
101: Compiler.java:6431 clojure.lang.Compiler.eval
102: core.clj:2795 clojure.core/eval
103: core.clj:532 swank.core/eval782[fn]
104: MultiFn.java:163 clojure.lang.MultiFn.invoke
105: basic.clj:54 swank.commands.basic/eval-region
106: basic.clj:44 swank.commands.basic/eval-region
107: basic.clj:73 swank.commands.basic/eval968[fn]
108: Var.java:401 clojure.lang.Var.invoke
109: (Unknown Source) user/eval1937
110: Compiler.java:6465 clojure.lang.Compiler.eval
111: Compiler.java:6431 clojure.lang.Compiler.eval
112: core.clj:2795 clojure.core/eval
113: core.clj:100 swank.core/eval-in-emacs-package
114: core.clj:256 swank.core/eval-for-emacs
115: Var.java:409 clojure.lang.Var.invoke
116: AFn.java:167 clojure.lang.AFn.applyToHelper
117: Var.java:518 clojure.lang.Var.applyTo
118: core.clj:600 clojure.core/apply
119: core.clj:107 swank.core/eval-from-control
120: core.clj:330 swank.core/spawn-worker-thread[fn]
121: AFn.java:159 clojure.lang.AFn.applyToHelper
122: AFn.java:151 clojure.lang.AFn.applyTo
123: core.clj:600 clojure.core/apply
124: core.clj:326 swank.core/spawn-worker-thread[fn]
125: RestFn.java:397 clojure.lang.RestFn.invoke
126: AFn.java:24 clojure.lang.AFn.run
127: Thread.java:662 java.lang.Thread.run
I then press 0 to close the stacktrace, and press Ctrl-x Ctrl-e on the (ns) call again, now my error is:
Could not initialize class datomic.api__init
[Thrown class java.lang.NoClassDefFoundError]
Restarts:
0: [QUIT] Quit to the SLIME top level
Backtrace:
0: (Unknown Source) java.lang.Class.forName0
1: Class.java:247 java.lang.Class.forName
2: RT.java:2030 clojure.lang.RT.loadClassForName
3: RT.java:417 clojure.lang.RT.load
4: RT.java:398 clojure.lang.RT.load
5: core.clj:5386 clojure.core/load[fn]
6: core.clj:5385 clojure.core/load
7: RestFn.java:408 clojure.lang.RestFn.invoke
8: core.clj:5200 clojure.core/load-one
9: core.clj:5237 clojure.core/load-lib
10: RestFn.java:142 clojure.lang.RestFn.applyTo
11: core.clj:602 clojure.core/apply
12: core.clj:5271 clojure.core/load-libs
13: RestFn.java:137 clojure.lang.RestFn.applyTo
14: core.clj:604 clojure.core/apply
15: core.clj:5363 clojure.core/use
16: RestFn.java:408 clojure.lang.RestFn.invoke
17: NO_SOURCE_FILE:1 cljs-template.server/eval6292[fn]
18: NO_SOURCE_FILE:1 cljs-template.server/eval6292
19: Compiler.java:6465 clojure.lang.Compiler.eval
20: Compiler.java:6455 clojure.lang.Compiler.eval
21: Compiler.java:6431 clojure.lang.Compiler.eval
22: core.clj:2795 clojure.core/eval
23: core.clj:532 swank.core/eval782[fn]
24: MultiFn.java:163 clojure.lang.MultiFn.invoke
25: basic.clj:54 swank.commands.basic/eval-region
26: basic.clj:44 swank.commands.basic/eval-region
27: basic.clj:73 swank.commands.basic/eval968[fn]
28: Var.java:401 clojure.lang.Var.invoke
29: (Unknown Source) cljs-template.server/eval6288
30: Compiler.java:6465 clojure.lang.Compiler.eval
31: Compiler.java:6431 clojure.lang.Compiler.eval
32: core.clj:2795 clojure.core/eval
33: core.clj:100 swank.core/eval-in-emacs-package
34: core.clj:256 swank.core/eval-for-emacs
35: Var.java:409 clojure.lang.Var.invoke
36: AFn.java:167 clojure.lang.AFn.applyToHelper
37: Var.java:518 clojure.lang.Var.applyTo
38: core.clj:600 clojure.core/apply
39: core.clj:107 swank.core/eval-from-control
40: core.clj:330 swank.core/spawn-worker-thread[fn]
41: AFn.java:159 clojure.lang.AFn.applyToHelper
42: AFn.java:151 clojure.lang.AFn.applyTo
43: core.clj:600 clojure.core/apply
44: core.clj:326 swank.core/spawn-worker-thread[fn]
45: RestFn.java:397 clojure.lang.RestFn.invoke
46: AFn.java:24 clojure.lang.AFn.run
47: Thread.java:662 java.lang.Thread.run
What am I doing wrong? How do I get datomic working in my emacs using swank/slime.
Turns out I was executing the wrong command.
I was running lein deps and getting the following error.
...
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.datomic -DartifactId=datomic -Dversion=0.1.3157 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.datomic -DartifactId=datomic -Dversion=0.1.3157 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.apache.maven:super-pom:pom:2.0
2) com.datomic:datomic:jar:0.1.3157
I saw that the README file in the downloaded datomic code also contained mention of adding datomic to my mvn. Naturally (here comes the stupid part) I assumed that they sort of said the same thing.
lein will tell you that you should execute
mvn install:install-file -DgroupId=com.datomic -DartifactId=datomic -Dversion=0.1.3157 -Dpackaging=jar -Dfile=/path/to/file
the README says you should execute
mvn install:install-file -DgroupId=com.datomic -DartifactId=datomic -Dfile=datomic-${DATOMIC-VERSION}.jar -DpomFile=pom.xml
Did you notice that the README instructions also includes a pom.xml file? Neither did I! Yeah, that is important.
Anyway, be sure to also include the pom.xml file. If you were trying to add datomic 0.1.3157 to your mvn repository, you would execute the following in the datomic directory you downloaded.
mvn install:install-file -DgroupId=com.datomic -DartifactId=datomic -Dfile=datomic-0.1.3157.jar -DpomFile=pom.xml
I posted a working project here
my usual suspect in debugging swank problems are:
is leiningen up to date
the version of lein-swank
version of emacs (Emacs 24, I have found to be much more reliable)
leftover old dependencies in the lib dir
EDIT: the correct way to get the datomic jar is as Stephen Cagle says, copied from his comment below:
mvn install:install-file -DgroupId=com.datomic -DartifactId=datomic -Dfile=datomic-${DATOMIC-VERSION}.jar