我正在使用一组类的接口.我不过是因为我想对于任何一个问题,visibility
在接口被允许(即:public
,protected
和private
).
我需要父方法只受保护,我需要子方法是私有的,但我得到错误说
致命错误:接口方法的访问类型Baz :: qux()必须在<带Baz/Bar>的文件中省略."
我尝试在接口中指定其他可见性方法Baz
并删除public
,但它们都失败了.
有没有办法可以通过界面来做到这一点?如果没有,那么有没有办法可以宣布它abstract
,我也尝试过,但失败了.
interface Baz
{
public function qux();
}
class Bar implements Baz
{
protected function qux()
{
//do foo
}
}
class Foo extends Bar implements Baz
{
private function qux()
{
parent::qux();
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用jQuery UI Autocomplete和一些AJAX(数据直到他们停止输入后才被拉出).我想这样做,一旦找到数据,自动完成将随后弹出作为搜索结果.这是有效的,但是只有当我再次开始输入时(直到我输入才会触发下拉列表,因为直到我停止输入后它才被初始化).
我的代码:
var availableTags = [
"Perl",
"PHP",
"Python",
"Ruby"
];
$('input#mainSearchBox').autocomplete({
source: availableTags,
minLength: 0
});
$('input#mainSearchBox').data('autocomplete').menu.active;
Run Code Online (Sandbox Code Playgroud)
最后一部分是尝试激活自动完成,但失败了.
很长一段时间以来,我一直在尝试破解ASP .ASPXAUTH cookie并使用PHP解密它.我的理由是巨大的,我需要这样做,没有其他选择.到目前为止,在PHP中我成功地设法从这个cookie中读取数据,但是在加密时我似乎无法做到这一点.无论如何,这里......
首先,您需要更改服务器Web.config文件(保护需要设置为Validation):
<authentication mode="None">
<forms name=".ASPXAUTH" protection="Validation" cookieless="UseCookies" timeout="10080" enableCrossAppRedirects="true"/>
</authentication>
Run Code Online (Sandbox Code Playgroud)
然后在同一个域的PHP脚本中,您可以执行以下操作来读取数据,这是一个非常基本的示例,但是证明:
$authCookie = $_COOKIE['_ASPXAUTH'];
echo 'ASPXAUTH: '.$authCookie.'<br />'."\n";//This outputs your plaintext hex cookie
$packed = pack("H*",$authCookie);
$packed_exp = explode("\0",$packed);//This will separate your data using NULL
$random_bytes = array_shift($packed_exp);//This will shift off the random bytes
echo print_r($packed_exp,TRUE); //This will return your cookies data without the random bytes
Run Code Online (Sandbox Code Playgroud)
这会分解cookie,或者至少是未加密的数据:
既然我知道我可以获取数据,我从Web.config中删除了'protection ="validation"'字符串,我尝试使用PHP mcrypt解密它.我尝试了无数的方法,但这是一个很有希望的例子(失败了)......
define('ASP_DECRYPT_KEY','0BC95D748C57F6162519C165E0C5DEB69EA1145676F453AB93DA9645B067DFB8');//This is a decryption key found in my Machine.config file (please note this is forged for example) …
Run Code Online (Sandbox Code Playgroud) 我目前使用SwiftMailer库发送电子邮件,但遗憾的是它仅用于发送,而不是接收.我想知道...是否有类似的库通过IMAP连接到电子邮件帐户并阅读电子邮件(IE让我能够循环通过电子邮件).我知道这里有一组PHP IMAP函数:http://us3.php.net/manual/en/book.imap.php
但我的问题是,是否有人知道用于接收/查看所有电子邮件的替代图书馆或IMAP包装类?
事先谢谢,我真的找不到任何东西.
我正在使用ArchLinux,我正在尝试安装OpenEdge进度驱动程序,以便我可以通过PHP访问它.我已经安装了unixodbc软件包和驱动程序,但是当我通过isql或PHP测试连接时,我得到了同样的错误......
# isql -3 SUBS2A
[01000][unixODBC][Driver Manager]Can't open lib '/usr/dlc/odbc/lib/pgoe1023.so' : file not found
[ISQL]ERROR: Could not SQLConnect
Run Code Online (Sandbox Code Playgroud)
混乱的事情是"/usr/dlc/odbc/lib/pgoe1023.so"目前存在,我甚至从"/ usr/dlc"中对它进行了符号链接.
以下是我的.ini文件......
ODBC.INI
[SUBS2A]
Description = ODBC Driver for Progress
Driver = /usr/dlc/odbc/lib/pgoe1023.so
FileUsage = 1
Run Code Online (Sandbox Code Playgroud)
odbcinst.ini(我删除了一些凭据,因为它无关紧要)
[ODBC-test]
Description = SUBS2A
Driver = SUBS2A
Server = 192.168.1.2
Port = 4000
APILevel=1
ConnectFunctions=YYN
CPTimeout=60
DriverODBCVer=03.60
FileUsage=0
SQLLevel=0
UsageCount=1
ArraySize=50
DefaultLongDataBuffLen=2048
DefaultIsolationLevel= READ COMMITTED
StaticCursorLongColBuffLen=4096
Run Code Online (Sandbox Code Playgroud)
编辑添加更多信息......
他们似乎都是32位,除了我不知道我在做什么.
[root@Crux etc]# file /usr/bin/isql
/usr/bin/isql: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically …
Run Code Online (Sandbox Code Playgroud) 可能重复:
PHP:'或'语句失败:如何抛出新的异常?
在PHP中,在各种MySQL连接教程的新手中特别受欢迎,你总能做到这样的事情......
<?php
foo() or die('foo() failed!');
?>
Run Code Online (Sandbox Code Playgroud)
但是如果我尝试这样的事情就会失败......
<?php
foo() or throw new Exception('AHH!');
?>
Run Code Online (Sandbox Code Playgroud)
像这样......
"解析错误:语法错误,意外'投'(T_THROW)......"
有谁知道怎么做类似的事情?我必须在"或"之后设置一个变量吗?
我需要一直从Github拉出来,我有一个密码,但这很痛苦,所以我经常跑...
ssh-agent bash
ssh-add ~/.ssh/id_rsa
<prompt and give passphrase>
Run Code Online (Sandbox Code Playgroud)
这适用于会话,但即使在我退出之后,我希望它能在下次我PuTTY时保存密码.所以我安装了钥匙串,但是我操作它太愚蠢了.我试过这个......
/usr/bin/keychain ~/.ssh/id_dsa
Run Code Online (Sandbox Code Playgroud)
它说它添加了我的密码,但它不起作用:(
我如何调用钥匙串,以便为Git保存我的密码?
编辑:抱歉在stackoverflow上发布它,它在技术上确实与编程有关,因为它与Git有关,但我很抱歉没有在SuperUser上发布它.
我正在尝试打开一个文件,其中包含我的C#正在运行的Web目录中的一些数据.基本上只是把它变成一个字符串.我试着做以下......
string email = File.ReadAllText("/orderforms/email_templates/file_to_include.txt");
Run Code Online (Sandbox Code Playgroud)
我不确定这是否是正确的方法,但似乎存在路径问题,整个路径将根据其运行的Web服务器而改变.
这是目录设置......
/Classes/Page.ascx.cs (the page that tries to read the text from the
file)
/orderforms/<one of multiple pages execute the above class here or in a sub directory
/orderforms/email_templates/file_to_include.txt
/orderforms/email_templates/file_to_include2.txt
Run Code Online (Sandbox Code Playgroud)
我应该使用什么路径和函数将文件的所有内容读取到字符串?
谢谢
是否有可能使用jQuery自动完成,以便如果有'source:'值可用,但它们与您输入的内容不匹配,那么只需一次显示所有源?
IE,给定以下代码,如果我输入"菠萝",你如何显示所有编程语言而不是它们?
<script>
$(function() {
var availableTags = [
"JavaScript",
"Perl",
"PHP",
"Python",
"Ruby"
];
$( "#tags" ).autocomplete({
source: availableTags
});
});
</script>
<input type="text" id="tags" />
Run Code Online (Sandbox Code Playgroud) 我正在使用SiteCore,我需要使用PHP脚本通过该API或SQL数据库从软件中提取一些数据.我说两者都有可能的原因是因为即使数据库稍后改变,这对我也没关系.
无论如何...
我正在尝试从特定问题中提取任何数据字段.到目前为止,这是我的SOAP代码,它连接到服务等,但返回不是我需要的...
try
{
$client = new SoapClient('http://localhost:8083/sitecore/shell/webservice/service.asmx?WSDL');
$credentials = array('Password' => 'mypassword','Username' => 'sitecore\myusername');
$Current_Issue = array(
'id' => '{043B69BA-3175-4184-812F-C925CE80324E}',
//'language' => 'en',
//'version' => '1',
//'allFields' => 'true',
'databaseName' => 'web',
'credentials' => $credentials
);
$response = $client->GetItemMasters($Current_Issue);
print_r($response);
}
catch(SoapFault $e)
{
echo $e->getMessage();
}
catch(Exception $e)
{
echo $e->getMessage();
}
Run Code Online (Sandbox Code Playgroud)
这是我的输出:
stdClass Object
(
[GetItemMastersResult] => stdClass Object
(
[any] => <sitecore xmlns=""/>
)
)
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.如果有人知道我可以使用的示例SQL查询,那么它将与替代方法一样有用.
谢谢
php ×4
asp.net ×3
javascript ×2
jquery ×2
.net ×1
abstract ×1
ajax ×1
api ×1
archlinux ×1
autocomplete ×1
bash ×1
boolean ×1
c# ×1
email ×1
email-client ×1
encryption ×1
exception ×1
function ×1
imap ×1
interface ×1
jquery-ui ×1
keychain ×1
linux ×1
mcrypt ×1
odbc ×1
oop ×1
openedge ×1
progress-db ×1
rijndael ×1
search ×1
sh ×1
sitecore ×1
soap ×1
sql-server ×1
ssh ×1
swiftmailer ×1
try-catch ×1
unixodbc ×1