小编krl*_*zlx的帖子

如何在另一个div的右上角创建三角形形状,看起来除以边框

我想在这张图片上创建形状:

形状

我在这张照片上创建了三角形,并将边距设置为右上角,但我不知道如何让它看起来像左边的div一样,如图所示.

我是否必须"剪切"左侧div以保持其灰色边框并且看起来与绿色三角形分开?

有什么想法怎么做?

编辑:

  1. 我在页面上使用固定导航栏,所以当我滚动如果div是位置:绝对,导航栏落在div后面.
  2. 绿色三角形和div的其余部分之间的空间应该是透明的,因为我使用图像作为页面背景

html css css-shapes

38
推荐指数
3
解决办法
4万
查看次数

如何验证Azure AD安全令牌?

以下代码告诉我Azure AD security token,我需要验证令牌是否有效.怎么做到这一点?

// Get OAuth token using client credentials 
string tenantName = "mytest.onmicrosoft.com";
string authString = "https://login.microsoftonline.com/" + tenantName;

AuthenticationContext authenticationContext = new AuthenticationContext(authString, false);

// Config for OAuth client credentials  
string clientId = "fffff33-6666-4888-a4tt-fbttt44444";
string key = "123v47o=";
ClientCredential clientCred = new ClientCredential(clientId, key);
string resource = "http://mytest.westus.cloudapp.azure.com";
string token;

Task<AuthenticationResult> authenticationResult = authenticationContext.AcquireTokenAsync(resource, clientCred);
token = authenticationResult.Result.AccessToken;
Console.WriteLine(token);
// How can I validate this token inside my service?                
Run Code Online (Sandbox Code Playgroud)

c# oauth azure oauth-2.0 azure-active-directory

20
推荐指数
3
解决办法
3万
查看次数

找不到适合指定文化或中性文化的资源

我创建了一个程序集,后来重命名了它.

然后我在调用时开始收到运行时错误:

toolsMenuName = resourceManager.GetString(resourceName);
Run Code Online (Sandbox Code Playgroud)

该resourceName变量是"enTools"在运行时.

找不到适合指定文化或中性文化的资源.确保在编译时将"Jfc.TFSAddIn.CommandBar.resources"正确嵌入或链接到程序集"Jfc.TFSAddIn"中,或者所有所需的附属程序集都是可加载和完全签名的.

代码:

string resourceName;
ResourceManager resourceManager = new ResourceManager("Jfc.TFSAddIn.CommandBar", Assembly.GetExecutingAssembly());

CultureInfo cultureInfo = new CultureInfo(_applicationObject.LocaleID);

if(cultureInfo.TwoLetterISOLanguageName == "zh")
{
     CultureInfo parentCultureInfo = cultureInfo.Parent;
     resourceName = String.Concat(parentCultureInfo.Name, "Tools");
}
else
{
     resourceName = String.Concat(cultureInfo.TwoLetterISOLanguageName, "Tools");
}

toolsMenuName = resourceManager.GetString(resourceName); // EXCEPTION IS HERE
Run Code Online (Sandbox Code Playgroud)

我可以看到项目中包含的CommandBar.resx文件,我可以打开它并在那里看到"enTools"字符串.似乎任何资源都不包含在程序集或资源中,但.NET无法解析名称.

.net c# resources localization exception-handling

16
推荐指数
3
解决办法
6万
查看次数

防止Firefox重新加载确认

我在可编辑的表格中显示某些记录.当用户在编辑弹出的记录时尝试重新加载表时,会警告有关未保存数据的记录.

function cancelProcess()
{
    if(noEditedRecords !=0)//number of edited records in the table
    {
        var processConfirmation = confirm("You've Edited "+ noEditedRecords +" Records. Are You sure to undo the Changes made?");

        if (processConfirmation ==true){
            window.onbeforeunload = null;
            window.location.reload();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

当他单击"确定"重新加载页面时,Firefox会提示为

要显示此页面,Firefox必须发送将重复之前执行的任何操作(例如搜索或订单确认)的信息.

在Chrome中打开同一页面时,不会出现此类提示.

我试图通过设置避免这种情况window.onbeforeunload = null;,但仍然会出现提示窗口.

我也试过改变Firefox配置:

browser.sessionstore.postdata

根据Mozilla支持页面中的建议将0更改为1.

但没有任何效果..如何阻止提示?

javascript firefox google-chrome onbeforeunload reload

16
推荐指数
2
解决办法
3万
查看次数

Visual Studio 2015中的项目加载失败

当我在Visual Studio 2010中打开.sln时,项目正在正确加载.但是当我使用Visual Studio 2015(Professional with Update 1)打开相同的解决方案时,项目没有加载错误(加载失败).如下所示:

项目未加载

任何人都可以为此提出解决方案吗?

c# visual-studio-2010 visual-studio visual-studio-2015

15
推荐指数
6
解决办法
4万
查看次数

在Laravel 5.2中调整图像大小

谁能帮助我如何在Laravel中实现调整大小的图像?

我只有这个代码:

if($request->hasFile('image')){
    if (Input::file('image')->isValid()) {
        $file = Input::file('image');
        $destination = base_path() . '/public/images/ServiceImages';
        $extension = Input::file('image')->getClientOriginalExtension();
        $fileName = rand(111,99999).'.'.$extension;

        if(!empty($data['Image'])){
            unlink($destination.$data['Image']);
        }

        $file->move($destination, $fileName);
        $service->image=$fileName;
    }
}
Run Code Online (Sandbox Code Playgroud)

php laravel-5.2

13
推荐指数
1
解决办法
4万
查看次数

如何从yii2查询打印转换后的SQL查询

我想打印查询:

$demo = Demo::find()->all();
Run Code Online (Sandbox Code Playgroud)

我想看看带有参数的转换SQL查询:

createCommand()->getRawSql();
Run Code Online (Sandbox Code Playgroud)

正在向我显示一条错误消息:

yii2在非对象上调用成员函数createCommand()

请帮我看一下实际的SQL查询.

yii2

13
推荐指数
3
解决办法
3万
查看次数

PHP Artisan Tinker不使用Laravel 5.4和PHP 7.0.1

我刚刚在我的Laravel项目5.4中添加了修补程序.当我尝试运行时:

php artisan tinker
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

PHP Warning:  Uncaught ErrorException: require(/home/abdullah/php_apps/website): failed to open stream: Success in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php:51
Stack trace:
#0 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(51): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'require(/home/a...', '/home/abdullah/...', 51, Array)
#1 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(51): require()
#2 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(33): Laravel\Tinker\ClassAliasAutoloader->__construct(Object(Psy\Shell), '/home/abdullah/...')
#3 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/Console/TinkerCommand.php(59): Laravel\Tinker\ClassAliasAutoloader::register(Object(Psy\Shell), '/home/abdullah/...')
#4 [internal function]: Laravel\Tinker\Console\TinkerCommand->handle()
#5 /home/abdullah/php_apps/website/vendor/laravel/framework/src/Illuminate/Contai in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php on line 51
PHP Fatal error:  Laravel\Tinker\ClassAliasAutoloader::__construct(): Failed opening required '/home/abdullah/php_apps/website' (include_path='.:/home/abdullah/.phpbrew/php/php-7.0.1/lib/php') in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php on line 51


  [Symfony\Component\Debug\Exception\FatalErrorException]                                                                                                                         
  Laravel\Tinker\ClassAliasAutoloader::__construct(): Failed opening required '/home/abdullah/php_apps/website' (include_path='.:/home/abdullah/.phpbrew/php/php-7.0.1/lib/php')  
Run Code Online (Sandbox Code Playgroud)

我试过给各种文件夹权限.还尝试将Tinker类添加到console/kernel.php.

php php-7 laravel-5.4 tinker

11
推荐指数
1
解决办法
905
查看次数

获取位置android Kotlin

我最近添加了获取位置功能.当我尝试显示经度和纬度时,它返回零.

这是我的LocationListener类:

inner class MylocationListener: LocationListener {
    constructor():super(){
        mylocation= Location("me")
        mylocation!!.longitude
        mylocation!!.latitude
    }

    override fun onLocationChanged(location: Location?) {
        mylocation=location
    }

    override fun onStatusChanged(p0: String?, p1: Int, p2: Bundle?) {}

    override fun onProviderEnabled(p0: String?) {}

    override fun onProviderDisabled(p0: String?) {}
}
Run Code Online (Sandbox Code Playgroud)

这是我的GetUserLocation函数:

fun GetUserLocation(){
    var mylocation= MylocationListener()
    var locationManager=getSystemService(Context.LOCATION_SERVICE) as LocationManager
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0.1f,mylocation)
}
Run Code Online (Sandbox Code Playgroud)

这是我的功能,以返回我的经度和纬度:

fun getLoction (view: View){
    prgDialog!!.show();

    GetUserLocation()

    button.setTextColor(getResources().getColor(R.color.green));
    textView.text = mylocation!!.latitude.toFloat().toString()
    Toast.makeText(this, mylocation!!.latitude.toFloat().toString(), Toast.LENGTH_LONG).show()
    Toast.makeText(this, mylocation!!.longitude.toFloat().toString(), Toast.LENGTH_LONG).show()

    prgDialog!!.hide()
} 
Run Code Online (Sandbox Code Playgroud)

android location kotlin

11
推荐指数
6
解决办法
3万
查看次数

从使用imagepng()创建的PNG获取Alpha

我试着获得alpha一个PNG.我正在这样做imagepng().我的问题是alpha只返回0.

我使用alpha制作PNG的代码

$x = 1;
$y = 1;
$gd = imagecreatetruecolor($x, $y); 
imagesetpixel($gd, 0,0, imagecolorallocatealpha($gd, 200,200,200,1));
imageAlphaBlending($gd, false);
imageSaveAlpha($gd, true);
imagepng($gd,"test.png");
imagedestroy($gd);
Run Code Online (Sandbox Code Playgroud)

我的阅读PNG alpha的代码

$im = imagecreatefrompng("test.png");
$rgb = imagecolorat($im, 0, 0);
$colors = imagecolorsforindex($im, $rgb);
$red = (int) $colors["red"]; 
$blue = (int) $colors["blue"];
$green = (int) $colors["green"]; 
$alpha = (int) $colors["alpha"]; // return only 0
Run Code Online (Sandbox Code Playgroud)

我不知道为什么它只返回0而不是1.

php png

10
推荐指数
1
解决办法
355
查看次数