Is it possible to use phyloc in SYBASE? If yes, How to use %%physloc%% in SYBASE? - sybase-ase

Is it possible to use phyloc in SYBASE?
If yes, how to use %%physloc%% in SYBASE?


PHP Namespaces, including a constant in a use statement [duplicate]

This question already has an answer here:
Can PHP namespaces contain variables?
5 answers
I'm trying to use a constant in a PHP Namespace Use statement:
define('API_VERSION', 'v201705');
I'd like to be able to use the constant above in the use statement below
use api\v201705\service;
I don't know if this is possible as the following obviously does't work:
use api\.API_VERSION.\service;
Can anyone suggest a different approach to using a constant in this scenario?
Any help would be appreciated.
The workaround I would use here is a just usage of class constants.
You don't need to override your autoloader
You can group constants semantically
"define" has global visibility, you don't need it in 99% of use cases.
You don't need to instantiate class in order to use class constants. Thus it's quite cheap operation.
namespace My;
class StaticConfig {
const VERSION = '1.2.3';
use My\StaticConfig;
echo StaticConfig::VERSION;
Actually, it's even not a workaround, it's quite common practice.

PHP: Alternative to putting “use Special\Library\SpecificClass” on top of each file

Let's say I included a library that has a class, with important constants. To access these constants I could:
1.) Either use "use"
use Special\Library\SpecificClass as SpecificClass;
$value = SpecificClass::MY_CONSTANT;
2.) Alternatively I can put the full path:
$value = Special\Library\SpecificClass::MY_CONSTANT;
But I am using this "SpecificClass" in hundreds of php files, so I like to define once that "SpecificClass" is by default "Special\Library\SpecificClass".
How can I do that?
You can use class_alias() for that:
class_alias('Special\Library\SpecificClass', 'SomeClass');
Now you can access the class from the root namespace with:
and if you are going to use it under a namespace:
use \SomeClass;
Note: Just make sure that you're using this with caution. It will make it harder to follow the code if you run into issues, since you then must know that it is an alias and where that alias was set. It's kind of an anti-pattern, if you ask me.

When needing to serialize EndpointDiscoveryMetadata, which wrapper to use: CD1, 11, or April2005?

Since EndpointDiscoveryMetadata itself is not serializable, there are 3 wrapper class provided to help to accomplish serializing it:
Which one should be used or does it matter? When would you use one over the other? Which is newer (or the latest version)?
Looks like EndpointDiscoveryMetadata11 is the most recent version.

Global constants in PHP : is it safer to use global or define and why?

I am designing a small website, that makes queries to a SQL database system, without using any CMS. What is the safest way to store the SQL authentication parameters, using a global $PASSWORD seems quite unsafe (having for instance shellshock-like security loopholes in mind). Is it safer to use define("PASSWORD","password") ?
Is this second method safer if one writes
If I use one of these methods, is it worth encrypting "password" and passing the crypt parameters with another method ? Any explanations and suggestions welcome !
is it safer to use global or define and why?
The answer is no according to me.because it reaches from a local to global scope.We should need to reply anything outside when we call the function.
The second thing is that using global means the function is dependend to the other scope..This can mess the things up
Please have a look here for a detailed explanation

DBIx Class Row virtual/non-persistent columns

Is it possible to add columns to a DBIx::Class::Row object that are virtual in that they are not saved to the database? I am looking for functionality like Rose::DB::Object provides through its non-persistent columns
Have you tried adding methods to the Result classes in your Schema? That might get you to the same place. The methods you add can't be used in ->search and won't be returned in ->get_columns, but depending on your use case, it may be enough.
I just had to look this up again as I had a need for it. You've probably got a solution already, but for others that come here looking:
Basically either use Moose and create an attribute, or add something like this to your schema:
__PACKAGE__->mk_group_accessors('simple' => qw/non_column_data/); # must use simple group