小编Luk*_*ela的帖子

如何确定页面是否在嵌入式浏览器中打开

有没有一种方法可以告诉我的页面(确切地说是 javascript 代码)它不是在独立浏览器中运行,而是通过嵌入式浏览器(例如 WebView、Webbrowser 控件等)运行。

javascript webbrowser-control uiwebview android-webview

5
推荐指数
1
解决办法
1884
查看次数

如何将通用数字类型“T”转换为 CGFloat

我有一个通过泛型 T 类型接受数字类型的类,我希望能够将其转换为 ,CGFloat但它抛出:

无法使用类型为“(T)”的参数列表调用类型“CGFloat”的初始化程序

我必须在课堂上做什么才能成功转换它?

CGFloat(self.top) - 这就是它不喜欢的

'T' 类型定义如下:

protocol Numeric:Comparable, Equatable {
    //
    init(_ v:Float)
    init(_ v:Double)
    init(_ v:Int)
    init(_ v:UInt)
    init(_ v:Int8)
    init(_ v:UInt8)
    init(_ v:Int16)
    init(_ v:UInt16)
    init(_ v:Int32)
    init(_ v:UInt32)
    init(_ v:Int64)
    init(_ v:UInt64)
}
extension Float: Numeric {}
extension Double: Numeric {}
extension Int: Numeric {}
extension Int8: Numeric {}
extension Int16: Numeric {}
extension Int32: Numeric {}
extension Int64: Numeric {}
extension UInt: Numeric {}
extension UInt8: Numeric {}
extension …
Run Code Online (Sandbox Code Playgroud)

generics type-conversion swift

5
推荐指数
1
解决办法
1610
查看次数

片段isInLayout返回false

当片段应该从isInLayout方法返回true时?在我的情况下,它返回false但我可以看到片段和isVisible,并且isAdded返回true.

在我的活动onCreate方法我称之为:

FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
FragEventList listFrag = new FragEventList();
transaction.replace(R.id.fragment_container_1, listFrag, "list");
transaction.commit();
Run Code Online (Sandbox Code Playgroud)

这是布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:baselineAligned="false"
    android:orientation="horizontal"
    tools:context=".MainActivity" >

    <FrameLayout
        android:id="@+id/fragment_container_1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </FrameLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

稍后当Loader返回数据时我想将适配器传递给片段谎言:

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    Log.i(TAG, "onLoadFinished(Loader<Cursor> loader, Cursor data)");

    Log.i(TAG, "fragment="+getSupportFragmentManager().findFragmentByTag("list"));

    if (mAdapter != null && data != null) {
        mAdapter.swapCursor(data);

        FragEventList fragment = (FragEventList) getSupportFragmentManager().findFragmentByTag("list");

        if(fragment != null){
            Log.i(TAG, "in layout="+fragment.isInLayout());
            Log.i(TAG, "is added="+fragment.isAdded());
            Log.i(TAG, "is visible="+fragment.isVisible()); …
Run Code Online (Sandbox Code Playgroud)

android android-fragments

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

Identity下的版本和构建之间的区别

在目标中的XCode标识组下的常规属性中,我有版本和构建,新项目都包含相同的"1.0"值.

我已将其更改为:版本xyz,例如1.0.0,并且在构建中我使用的是在每个版本更改时重置为1的整数.

这是对的吗?我发现,当我准备Ad Hoc发行版时,iTunes显示构建版本的值作为版本让我困惑,我是否正确使用这些字段?

build version ios xcode5

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

将脚本放在Illustrator cs5.1中的脚本菜单下的位置

我有一个Illustrator CS5.1脚本,我想成为脚本菜单的一部分.我试过把它放在:

  1. C:\ Program Files\Adob​​e\Adob​​e Illustrator CS5.1\Presets\en_GB\Scripts \
  2. C:\ Program Files\Adob​​e\Adob​​e Illustrator CS5.1\Presets\en_GB\Scripts\myFolder
  3. C:\ Program Files\Adob​​e\Adob​​e Illustrator CS5.1\Presets \
  4. C:\ Program Files\Adob​​e\Adob​​e Illustrator CS5.1\Presets\myFolder

但所有这些尝试都失败了,我重启了Illustrator,有什么不对的?这适用于Windows 7.

javascript adobe-illustrator

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

如何在Illustrator CS5.1 +中创建画板对象的add方法所需的Rectangle对象?

我试图在java脚本的帮助下添加新的画板.我无法找到解决方案.adobe的脚本编写指南很差(不要使用更强的单词).

什么我正在尝试它返回错误:

错误1242:非法参数 - 参数1 - 预期的矩形值

当我使用artboard.artboardRect其他画板的价值然后它在同一个地方创建画板但我无法修改它(调整大小),这使得这个选项无用.

artboards.add(artboards[0].artboardRect);//works
artboards.add([0,0,200,50]);//Error 1200: an Illustrator error coccurred: 1346458189('PARAM')
var rect = artboards[0].artboardRect;
rect[0] = 0;
rect[1] = 0;
rect[2] = 200;
rect[3] = 50;
artboards.add(rect);//Error 1242: Illegal argument - argument 1 - Rectangle value expected
Run Code Online (Sandbox Code Playgroud)

javascript adobe-illustrator

3
推荐指数
1
解决办法
3625
查看次数

内容(网络视图)未填充应用程序窗口

我正在尝试电子创建网站的独立版本,我有这个main.js(摘录)

function createWindow() {
    // Create the browser window.
    mainWindow = new BrowserWindow({
        width: 800,
        height: 600,
        "min-width": 800,
        "min-height": 500,
        resize: true,
        "use-content-size": true
    });

    // and load the index.html of the app.
    mainWindow.loadURL('file://' + __dirname + '/index.html');

    // Open the DevTools.
    mainWindow.webContents.openDevTools();
    // Set Window Resizable
    mainWindow.isResizable(true);

    // Emitted when the window is closed.
    mainWindow.on('closed', function () {
        // Dereference the window object, usually you would store windows
        // in an array if your app supports multi windows, …
Run Code Online (Sandbox Code Playgroud)

javascript css webview electron

3
推荐指数
1
解决办法
2768
查看次数

如何使用 React Native 在默认键盘上方制作工具栏?

默认情况下,如何使用 React Native 在键盘上创建按钮?我的意思是本机键盘的按钮(不要更改键盘,只需添加上面的前缀) 在此处输入图像描述

javascript android ios react-native

3
推荐指数
1
解决办法
4475
查看次数

如何在史诗中获得以前的状态

史诗中有没有办法接收商店以前的状态?我觉得你不能,因为史诗站在Action -> Reducer -> Epic队列的末尾。

记住:当一个 Epic 收到一个动作时,它已经通过你的减速器运行并且状态更新了。

但也许有人会为我的问题提出一些解决方案:

我有一个处理下载 json 的史诗,然后将其存储在商店中。我认为另一部将检查已更改内容的史诗会很好地发送“新项目”通知,但为此我需要在商店更改之前访问状态:) 也许我应该在同一个史诗中执行此操作?

reactjs redux-observable rxjs6

3
推荐指数
1
解决办法
906
查看次数

在HttpEntity响应中呈现的字符不正确

我正在做的小应用程序接收一些带有UTF-8编码的XML,浏览器中的XML非常正确地呈现字符,而在Android中我有一些"垃圾",例如.WÅochy而不是Włochy或Dwójka而不是Dwójka.显然我做错了什么,任何人都可以帮我搞清楚吗?

最好的祝福

String response = EntityUtils.toString( resEntity ).trim();
Log.i( CLASS_NAME, "RESPONSE=" + response );
//This returns response with incorrectly rendered characters eg. WÅochy instead of W?ochy
Run Code Online (Sandbox Code Playgroud)

以下是发送POST请求并接收响应的代码,它在AsyncTask中运行:

protected Document doInBackground(ServiceQuery... queries)
{
    if ( m_sGateway == null ) return null;

    Document result = null;

    try
    {
        HttpClient client = new DefaultHttpClient();

        HttpPost post = new HttpPost( m_sGateway );

        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add( new BasicNameValuePair( "mdsXML", queries[0].getQueryString() ) );

        UrlEncodedFormEntity ent = new UrlEncodedFormEntity( params, HTTP.UTF_8 );
        post.setEntity( ent …
Run Code Online (Sandbox Code Playgroud)

android httpresponse utf-8 http-post character-encoding

2
推荐指数
1
解决办法
7499
查看次数

如何在取消时关闭滑动操作上下文菜单

我添加了滑动删除功能,使用

override func tableView(_ tableView: UITableView, 
        trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) 
         -> UISwipeActionsConfiguration?
Run Code Online (Sandbox Code Playgroud)

我正在通过解除/确认操作发出警报。一旦关闭,我想关闭滑动操作菜单。

    override func tableView(_ tableView: UITableView,
                            trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {

        let deleteClosure:UIContextualAction.Handler = {
            (action:UIContextualAction,
            view:UIView,
            completionHandler:(Bool) -> Void) in
            let alert = self.confirmDeletion({ _ in

                let row = indexPath.row;
                let removed = self.logList.remove(at: row);
                self.deleteLogEntry(removed);
                //
                tableView.reloadData();
                //

            }, declineBlock: {_ in
                tableView.reloadData();// this hides it but w/o animation
            });
            DispatchQueue.main.async {
                self.present(alert, animated: true, completion: nil);
            }
        }
        let deleteAction = UIContextualAction(style: .destructive, title: "Delete", …
Run Code Online (Sandbox Code Playgroud)

uitableview ios swift uiswipeactionsconfiguration

2
推荐指数
1
解决办法
1877
查看次数

任务控制选项 - 自定义条件 - 在先前失败或超时时运行任务

是否有一个选项可以设置自定义条件来测试上一个任务是否失败或超时?

目前,我正在使用Only when a previous task has failed当任务失败时有效的方法。如果任务超时,则不会将其视为错误并会跳过。

那么我需要一个自定义条件,例如or(failed(), timedout()). 是否可以?

语境

我们的任务遇到了这个间歇性问题npm install,我们无法找到原因,但它在下一次作业运行时得到解决,因此我们正在寻找重试功能。部分解决方案是复制npm install并使用控制选项,但它不适用于所有“失败”情况。@Levi Lu-MSFT 提供的解决方案似乎可以满足我们所有的需求(它会重试),但遗憾的是它没有解决问题,第二行重复任务也失败了。

错误示例:

20741 error   stack: 'Error: EPERM: operation not permitted, unlink \'C:\\agent2\\_work\\4\\s\\node_modules\\.staging\\typescript-4440ace9\\lib\\tsc.js\'',
20741 error   errno: -4048,
20741 error   code: 'EPERM',
20741 error   syscall: 'unlink',
20741 error   path: 'C:\\agent2\\_work\\4\\s\\node_modules\\.staging\\typescript-4440ace9\\lib\\tsc.js',
20741 error   parent: 's' }
20742 error The operation was rejected by your operating system.
20742 error It's possible that the file was already in use (by a …
Run Code Online (Sandbox Code Playgroud)

azure-devops azure-pipelines azure-pipelines-tasks azure-pipelines-yaml

2
推荐指数
1
解决办法
5347
查看次数

使用正则表达式替换替换函数

在objective-c(for ios)中,我希望在AS3中实现相同的目标:

var test:String = "Abba";
var reg:RegExp = /(a)|(b)/g;

var replacement:Function = function (...args):String
{
    var $1:String = args[1];//matched 'a'
    var $2:String = args[2];//matched 'b'
    if($1)
    {
        //replace a with -
        return "-";
    }
    if ($2)
    {
        //replace b with +
        return "+";
    }
    return null;
}

var result:String = test.replace(reg, replacement);//A++-
trace(test, result);//Abba A++-
Run Code Online (Sandbox Code Playgroud)

换句话说,我希望能够识别匹配的匹配组并相应地替换它,我正在寻找enumerateMatchesInString的示例:但找不到任何可以解决我的问题的东西.

regex replace objective-c ios nsregularexpression

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