Sketchup ruby definitionlist load method error: Invalid component file - ruby

When I create a script file and load it from the console with:
load '//192.168.0.0/Mağaza/script.rb'
I get 'Invalid component file' error for:
someModel = Sketchup.active_model.definitions.load '//192.168.0.0/Mağaza/Definitions/model.skp'
But when running the code directly in console, it works.
Any idea why?

DefinitionList.load is a completely different method from Ruby's load.
To load a component from a URL you need to use model.definitions.load_from_url:
http://www.sketchup.com/intl/en/developer/docs/ourdoc/definitionlist#load_from_url

After two days, I figured out that the problem was the encoding of 'ğ' in the folder name (mağaza). I tried ANSI and UTF-8 encoding in my script file but nothing changed. But when print the path name in the console, it turned out that the character was not encoding properly.

Related

I cant make a dynamic image path in pdf

I've been trying to display an image in a fpdf file, it only works when I specify the exact location of the image. Can I make it dynamic?
Heres sample line of code:
$this->Image('fpdf/img/logo1.png',10,6,30);
and it works when I turn this way:
D:\Installed Apps\New
folder\XAMPP\htdocs\votingsystem\application\views\admin\senior\fpdf\img\logo1.png',10,6,30);
I want to transfer it to another laptop, I'm afraid it wont work.
I always get this error:
Message: fopen(fpdf/img/logo1.png): failed to open stream: No such
file or directory
I use code igniter as framework.
You can use multicell option in fpdf. I use this below code in php to it working.
`
define('ASSETS_URL','Your url or path to image file');
$yaxix = $pdf->GetY();
$xaxix = $pdf->GetX();
$pdf->MultiCell(50,10.5,$pdf->Image(ASSETS_URL.'/img/your-image-name.jpg',$xaxix,$yaxix+5,50)."\nAuthorised Signatory",1,'C',FALSE);
`
In this case you only have to change constants.

Why does require_relative() return a "cannot load such file -- album" error message when "lib/artist" is passed as argument?

I am trying to load a file into IRB. My working directory is my project's root folder, which has a lib folder. The lib folder has album.rb and artist.rb. When I call require_relative("lib/album") or require("./lib/album") it returns "true". When I call require_relative("lib/artist") or require("./lib/artist"), it always returns the error message, "cannot load such file -- album". It seems as if it can only look for album.rb. What is causing this?
require only lets you include a library once. Try switching it around, and doing require_relative 'lib/artist' first after reloading IRB. It should work.

codeigniter custom config file calling config data

i've a file # /config/form_validation.php
i've another file # /config/ion_auth.php
i tried to get the 'ion_auth data' in form_validation but failed:
'rules'=>'required|min_length['.$this->config->item('min_password_length', 'ion_auth').']'
error Message: Undefined property: CI_Loader::$config
If i change it to this, all works well.
'rules'=>'required|min_length[3]'
It seems that i cannot call the data from another config file at the current config file.
How to overcome this problem or is this a system limitation?
it seems you create form at wrong place, try to get main controller first:
$CI =$ get_instence();
'rules'=>'required|min_length['.$CI->config->item('min_password_length', 'ion_auth').']'

Loading ruby files in different directory? Error "cannot load such file"

It requires going up in to a parent directory then another parent, then going in a different child > child > thefile.rb.
I've looked through a few posts and all of them seem to be if the files are in pretty much the same directory.
At the moment I have
load '../../lib/classes/X.rb'
load '../../lib/classes/Y.rb'
load '../../lib/modules/Z.rb'
Everytime I get the error "cannot load such file"
Is there anything I'm missing here?
It's worth trying to load the files in irb first to see if you've got syntax or anything incorrect. I just tried writing nearly exactly the same as you (directory names are different) but it all worked fine.
irb(main):002:0> load '../../Work/Z.rb'
=> true

Perl::WSDL. Generated methods in different directory than script

I am trying to write a script for using with op5/nagios.
What it tries to do is to connect to database an get a value there, and then send a request to a webservice and match the response from the webservice with the value from the database.
Now writing the script wasn't the problem. The problem arrises when trying to run it from OP5.
When including the interface to script I use the following syntax
use MyInterfaces::PortalServicesImplService::PortalServicesImplPort;
This works just fine when I execute the script located on the same level as "MyInterfaces".
The problem is that the script itself is located in the folder /opt/plugins/custom/SOAP where both the script and the folders generated by wsdl2perl.pl is located. However when OP5 executes the script is does so from the folder /opt/monitor.
So I tried to include the "PortalServicesImplPort" using this syntax
use lib "/opt/plugins/custom/SOAP/MyInterfaces/PortalservicesImplServices/PortalServicesImplPort
The code compiles but when trying to run it I get an error message saying
Can't locate object method "new" via package "MyInterfaces::PortalServicesImplService::PortalServicesImplPort" (perhaps you forgot to load "MyInterfaces::PortalServicesImplService::PortalServicesImplPort"?)
Am I doing something wrong when importing methods from another location or doesn't SOAP::WSDL support placing the auto generated files in a different directory from where you are executing the script?
Seems I managed to solve this myself by adding use lib "/opt/plugins/custom/SOAP

Resources