GVKun编程网logo

php-openID不适用于Yahoo(php openid)

9

对于想了解php-openID不适用于Yahoo的读者,本文将提供新的信息,我们将详细介绍phpopenid,并且为您提供关于android–findViewById不适用于包含?、android:p

对于想了解php-openID不适用于Yahoo的读者,本文将提供新的信息,我们将详细介绍php openid,并且为您提供关于android – findViewById不适用于包含?、android:popupBackground不适用于上下文菜单、c# – ELMAH适用于本地机器,但不适用于生产、c# – SmtpClient.Send不适用于linux环境的有价值信息。

本文目录一览:

php-openID不适用于Yahoo(php openid)

php-openID不适用于Yahoo(php openid)

我正在尝试使用PHP-openid库在我的网站中实现openID.
其包中的基本消费者示例不适用于Google和Yahoo.
我在这里找到了Google解决方案:
Example usage of AX in PHP OpenID
但它仍不适用于雅虎! .
我怎么能让它有效?
哇它现在解决了!!!!!

我追踪了这些功能,发现了问题.那就是….
在我使用的“try_auth.PHP”文件中

"$attribute[] = Auth_OpenID_AX_AttrInfo::make('http://axschema.org/contact/email',2,1,'email');"

从提供商处获取用户电子邮件.它可以在Google上运行正常,因为Google会忽略’2′(请求的电子邮件地址数),但在Yahoo!它生成[count.email] => 2为它(在getSignednS函数中)和在Yahoo响应中没有count.email的条目.它导致在Yahoo的getSignednS中返回null.
我变了

"$attribute[] = Auth_OpenID_AX_AttrInfo::make('http://axschema.org/contact/email','email');"

"$attribute[] = Auth_OpenID_AX_AttrInfo::make('http://axschema.org/contact/email','email');"

它现在工作正常,并返回我们要求的两个提供商!

大声笑…

android – findViewById不适用于包含?

android – findViewById不适用于包含?

我有一个像:

<include
    android:id="@+id/placeHolder"
    layout="@layout/test" />

include布局看起来像(test.xml):

<?xml version="1.0" encoding="utf-8"?>

<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/outer"
    ... >

    <ImageView
        android:id="@+id/inner"
        ... />
</FrameLayout>

我似乎无法在运行时找到id =“inner”的内部ImageView:

ImageView iv = (ImageView)findViewById(R.id.inner);
if (iv == null) {
    Log.e(TAG, "Not found!");
}

我应该能找到它吗?似乎因为它使用“include”,正常的findViewById方法不起作用.

———-更新—————-

所以我可以找到分配给include的id:

View view = findViewById(R.id.placeHolder); // ok

但我找不到任何一个像id的孩子:

view.findViewById(R.id.outer); // nope
view.findViewById(R.id.inner); // nope

如果我尝试直接搜索它们,就像原来一样:

findViewById(R.id.outer); // nope
findViewById(R.id.inner); // nope

是不是只是在运行时剥离了元素?

谢谢

解决方法:

尝试检索< include />然后在那里搜索

确保您的根与包含的XML文件中的根元素具有相同的ID

<include
    android:id="@+id/outer"
    layout="@layout/test" />

然后使用以下方法检索“内部”内容:

FrameLayout outer = (FrameLayout)findViewById(R.id.outer);

ImageView iv = (ImageView)outer.findViewById(R.id.inner);
if (iv == null) {
    Log.e(TAG, "Not found!");
}

android:popupBackground不适用于上下文菜单

android:popupBackground不适用于上下文菜单

为什么我的styles.xml代码成功更改了操作栏溢出菜单的背景颜色,但无法更改我的应用程序中上下文菜单的背景颜色?

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <!--<item name="android:actionBarStyle">@style/DarkActionBar</item> -->

</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">

    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    <item name="android:popupMenuStyle">@style/MyPopupMenu</item>
    <item name="android:itemTextAppearance">@style/MyCustomMenuTextAppearance</item>

</style>

<!-- Popup Menu Background Color styles -->
<!-- <style name="MyPopupMenu"  parent="@android:style/Widget.Holo.ListPopupWindow"> -->
<!-- <style name="MyPopupMenu"  parent="@android:style/Widget.PopupMenu"> -->
<style name="MyPopupMenu"  parent="@style/Widget.AppCompat.PopupMenu">
    <item name="android:popupBackground">@color/dark_gray</item> 
</style>
<!-- Popup Menu Text Color styles -->
<style name="MyCustomMenuTextAppearance">
    <item name="android:textColor">@color/white</item>
</style>

我已经坚持了几个小时,因此类似问题的SO解决方案都没有对我有用.

如果有帮助,这是我的Java代码,其中创建了上下文菜单:

@Override
public void onCreateContextMenu(ContextMenu menu,View v,ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu,v,menuInfo);

    AdapterView.AdapterContextMenuInfo info =
            (AdapterView.AdapterContextMenuInfo) menuInfo;
    String selectedWord = ((TextView) info.targetView).getText().toString();
    menu.setHeaderTitle(selectedWord);

    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.shopping_list_name_context,menu);
}

并且,为了完整性,这是我的上下文菜单xml,shopping_list_name_context.xml:

<item android:id="@+id/rename_shopping_list"
      android:icon="@drawable/ic_action_edit"
      android:title="@string/rename_shopping_list" />

<item android:id="@+id/empty_shopping_list"
      android:icon="@drawable/ic_action_discard"
      android:title="@string/empty_shopping_list" />

<item android:id="@+id/delete_shopping_list"
      android:icon="@drawable/ic_action_discard"
      android:title="@string/delete_shopping_list" />

并且,根据要求,这是我的AndroidManifest.xml的摘录:

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="21" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />    
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<supports-screens       
    android:smallScreens="true" 
    android:normalScreens="true" 
    android:largeScreens="true" 
    android:xlargeScreens="true" />

<permission
    android:name="com.example.myapp.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.example.myapp.permission.C2D_MESSAGE" />
<uses-permission android:name="com.android.vending.BILLING" />

<application
    android:name=".MyApplication"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name_short"
    android:theme="@style/AppTheme"
    android:largeHeap="true" >

解决方法

下面是上下文菜单中设置背景的代码,它就像魅力一样.

在styles.xml文件中放置以下代码:

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">

  <item name="android:itemBackground">@android:color/holo_green_dark</item>

</style>

c# – ELMAH适用于本地机器,但不适用于生产

c# – ELMAH适用于本地机器,但不适用于生产

设置简单,我使用ELMAH记录异常并向我发送电子邮件.在我的本地机器上一切正常,但是当我在生产服务器上进行更改时,错误不会被记录,我也没有收到电子邮件.

这是我本地机器上的web.config:

<?xml version="1.0"?>
<configuration>
    <configSections>
        <sectionGroup name="elmah">
            <section name="security" requirePermission="false"
                type="Elmah.SecuritySectionHandler,Elmah" />
            <section name="errorLog" requirePermission="false"
                type="Elmah.ErrorLogSectionHandler,Elmah" />
            <section name="errorMail" requirePermission="false"
                type="Elmah.ErrorMailSectionHandler,Elmah" />
            <section name="errorFilter" requirePermission="false"
                type="Elmah.ErrorFilterSectionHandler,Elmah" />
        </sectionGroup>
    </configSections>

    <elmah>
        <security allowRemoteAccess="0" />
        <errorLog type="Elmah.sqlErrorLog,Elmah"
            connectionStringName="MyDB" />
        <errorMail from="errors@mysite.com" to="myemail@mysite.com"
            subject="Error" smtpServer="localhost" smtpPort="25" 
            userName="user@mysite.com" password="mypassword" />
    </elmah>

    <connectionStrings>
        <add name="MyDB" connectionString="Data Source=.\sqlEXPRESS
            AttachDbFilename=|DataDirectory|\MyDB.mdf;
            Integrated Security=True;User Instance=True;
            MultipleActiveResultSets=True"
            providerName="System.Data.sqlClient" />
        <!--<add name="MyDB" connectionString="Server=mysite.com;
            Database=MyDB;User ID=user;Password=mypassword;
            Trusted_Connection=True;Integrated Security=False;
            MultipleActiveResultSets=True"
            providerName="System.Data.sqlClient" />-->
    </connectionStrings>

    <system.web>  
        <!--<httpHandlers>
            <add verb="POST,GET,HEAD" path="elmah.axd" 
                type="Elmah.ErrorLogPageFactory,Elmah" />
        </httpHandlers>-->
        <httpModules>
            <add name="ErrorLog" type="Elmah.ErrorLogModule,Elmah" />
            <add name="ErrorFilter" type="Elmah.ErrorFilterModule,Elmah" />
            <add name="ErrorMail" type="Elmah.ErrorMailModule,Elmah" />
        </httpModules>
    </system.web>

    <location path="Admin/Errors">
        <system.web>
            <httpHandlers>
                <add verb="POST,HEAD" path="elmah.axd"
                    type="Elmah.ErrorLogPageFactory,Elmah" />
            </httpHandlers>
        </system.web>
    </location>
</configuration>

我机器上的web.config与生产之间的唯一区别是正在使用的连接字符串.在我的机器上,我正在连接到.mdf文件.在生产时,我正在连接到外部数据库.

谁能看到我在这里做错了什么?

我正在使用C#和ASP.NET MVC 3

解决方法

你在生产中运行IIS7吗?在这里阅读我对类似问题的回答 Elmah,convert to .Net4 vs2010,run on server 2008,does not work

c# – SmtpClient.Send不适用于linux环境

c# – SmtpClient.Send不适用于linux环境

以下代码,在.net core 2环境中编写,适用于 Windows环境,但不适用于 Linux环境.

string host = "10.99.99.10";
int port = 25;
string userName = "user@user.com";
string password = "password";
string from = userName;

var client = new SmtpClient
{
    Host = host,Port = port,EnableSsl = false,DeliveryMethod = SmtpDeliveryMethod.Network,UseDefaultCredentials = false,Credentials = new NetworkCredential(userName,password)
};

MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress(from);
mailMessage.To.Add(userName);
mailMessage.Body = "This is test mail.";
mailMessage.Subject = "Testing";                
client.Send(mailMessage);

例外:发送邮件失败.

InnerExcepiton:

System.ComponentModel.Win32Exception (0x80004005): GSSAPI operation Failed with error - An invalid status code was supplied (UnkNown error).
   at System.Net.Security.NegotiateStreamPal.AcquireCredentialsHandle(String package,Boolean isServer,NetworkCredential credential)
   at System.Net.NTAuthentication.Initialize(Boolean isServer,String package,NetworkCredential credential,String spn,ContextFlagsPal requestedContextFlags,ChannelBinding channelBinding)
   at System.Net.Mail.SmtpNtlmAuthenticationModule.Authenticate(String challenge,Object sessionCookie,ChannelBinding channelBindingToken)
   at System.Net.Mail.SmtpConnection.SetContextAndTryAuthenticate(ISmtpAuthenticationModule module,ContextAwareResult context)
   at System.Net.Mail.SmtpConnection.GetConnection(String host,Int32 port)
   at System.Net.Mail.SmtpTransport.GetConnection(String host,Int32 port)
   at System.Net.Mail.SmtpClient.GetConnection()
   at System.Net.Mail.SmtpClient.Send(MailMessage message)

堆栈跟踪:

at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at MyProject.Helper.Utils.SendMail() in C:\Test\MyProject\MyProject.Helper\Utils.cs:line 146

Linux:Ubuntu 16.04.3 LTS

这是一个控制台应用程序.
为什么不在linux环境下工作?

解决方法

我认为这是一个代码错误,因为我有错误,但事实并非如此.当我在邮件服务器端给出中继权限时,我的问题就解决了.我认为它是在Windows环境中自动执行此操作.

关于php-openID不适用于Yahoophp openid的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于android – findViewById不适用于包含?、android:popupBackground不适用于上下文菜单、c# – ELMAH适用于本地机器,但不适用于生产、c# – SmtpClient.Send不适用于linux环境等相关内容,可以在本站寻找。

本文标签: