Ocaml : exception Graphics.Graphic_failure("Xlib error: BadPixmap (invalid Pixmap parameter)") - ocaml

I've a problem with a little function in caml.
Here my function :
let show img =
let h = height img in
let w = width img in
open_graph (" "^string_of_int w^"x"^string_of_int h);
set_window_title "Seam Carving";
draw img;
if Graphics.key_pressed() then
match Graphics.read_key() with
| 'q' -> close_graph()
| _ -> ()
;;
When I clicked on the button 'q', I've this error :
Fatal error: exception Graphics.Graphic_failure("Xlib error: BadPixmap (invalid Pixmap parameter)") or segmentation fault.
Someone can to explain me the reason of a such error ? Thanks :)

There will be no reply to your question, as there is not enough information in it.
In general, if you experience a Segmentation Fault with OCaml, it is a MAJOR BUG, so you should fill a bug report on OCaml bug tracker, and upload a program reproducing the error.

Related

How to center align my display only item in Oracle APEX

I have display only item -> where I am printing error message of database with error code
Following is the name of my display only item : P1_NEW
My code :
Exception
when others then
v_code := SQLCODE;
v_errm := SQLERRM;
:P1_NEW := '<h1 style="text-align:center"> Database error occured </h1>' v_code || v_errm ;
But the issue here is my error code and error message not getting center align
Only my Database error occurred is getting center align
My need is to center align my custom text + error code + error message
Displaying some information to the user as part of a page but not as part of a form can be done with a region as well. Create a region of type "static" and reference your item with the &ITEM. syntax. This gives you a lot more control over the look and feel of the message.

I get a error message for something I din't write

Hello I try to make the player follow the mouse while the player points towards the mouse. For that to work I will need the position of the player. This is what I got so far
pos = pygame.mouse.get_pos()
xplayer_pos= player.get_rect().centerx
yplayer_pos= player.get_rect().centery
angle = 360-math.atan2(pos[1]-xplayer_pos[1],pos[0]-yplayer_pos[0])*180/math.pi
rotimage = pygame.transform.rotate(player,angle)
rect = rotimage.get_rect(center=(xplayer_pos,yplayer_pos))
screen.blit(rotimage,rect)
screen.blit(rotimage,pos)
pygame.display.update()
but I get this eror message
angle = 360-math.atan2(pos[1]-xplayer_pos[1],pos[0]-yplayer_pos[0])*180/math.pi
TypeError: 'int' object has no attribute '__getitem__'
I don't understand why I get this message cause in that lin I don't use anything like 'getitem'. thanks for your time.
player.get_rect().centerx is an integer. xplayer_pos[1] makes no sense. (__getitem__ refers to the [ ] operator.)

How to add a response to a button with Gtkmm

I am trying to add a response to a button in a Gtk::Dialog but I don't know why it does not work I try to type this :
button_quit(Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE)
but it does not work. Also, I tried to do with an other way like this :
button_quit.signal_clicked().connect([]() {Gtk::Main::quit();});
but when I clicked on the button I have this error :
(code:7199): Gtk-CRITICAL **: gtk_main_quit: assertion 'main_loops != NULL' failed
So if you know how to solve this it will be very helpful for me.
Thank you.
Use add_button.
Gtk::Dialog dialog;
auto button = dialog.add_button("Ok", Gtk::RESPONSE_CLOSE);
dialog.signal_response().connect([&](int response_id)
{
std::cout<<response_id<<std::endl;
});

Word Document in QAxWidget doesn't have scrollbars

I'm displaying a word document in QAxWidget.
QAxWidget *axWidget = new QAxWidget;
axWidget->setControl(changelogTempFile->fileName());
axWidget->setFixedSize(400,300);
axWidget->show();
However eventough the whole document does not fit in the viewport I have no scrollbars.
I even tried to use Frameset object to explicitly add scrollbars but it was in vain.
QAxObject *frame = ui->axW_singleChl_doc->querySubObject("Frameset");
if( frame )
frame->setProperty("FrameScrollbarType","wdScrollBarTypeYes");
I received following error message:
QAxBase: Error calling IDispatch member Frameset: Exception thrown by server
Code : 6027
Source : Microsoft Word
Description: Die Eigenschaft Document.Frameset ist nur verf?gbar, wenn Document.Type WdFrameset entspricht
Help : wdmain11.chm [25507]
Connect to the exception(int,QString,QString,QString) signal to catch this exception
Description translated means, that property Document.Frameset is only available if Document.type is WdFrameSet
How can this be achieved? Many thanks in advance,
James

cocos2d & CAShapeLayer objects

My class X is interited from CCLayer.
#interface X : CCLayer
Then in X, I added an instance variable of type CAShapeLayer.
CAShapeLayer *_Circle
I drew the Circle using UIBezierPath. Now if I try to add _circle to self, it gives me error:
[self addChild:_Circle];
[CAShapeLayer tag]: unrecognized selector sent to instance 0x916f7f0
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CAShapeLayer tag]:
unrecognized.
I also tried typecasting _Circle to (CCNode*) or (CCSprite*) but nothing helped.
Please advise.