GVKun编程网logo

在不使用join命令的情况下联接列表中的元素(不能使用join命令合并的对象)

21

这篇文章主要围绕在不使用join命令的情况下联接列表中的元素和不能使用join命令合并的对象展开,旨在为您提供一份详细的参考资料。我们将全面介绍在不使用join命令的情况下联接列表中的元素的优缺点,解

这篇文章主要围绕在不使用join命令的情况下联接列表中的元素不能使用join命令合并的对象展开,旨在为您提供一份详细的参考资料。我们将全面介绍在不使用join命令的情况下联接列表中的元素的优缺点,解答不能使用join命令合并的对象的相关问题,同时也会为您带来#homework 如何在不使用 add() 的情况下入队和在 Java 中不使用 remove() 的情况下出队?、angularjs – 如何在不使用jQuery的情况下获取指令中的元素css?、mysql-是否可以在不使用关系的情况下联接原则ORM中的表?、php – 如何通过在不使用J安装管理器的情况下复制文件来安装Joomla 2.5组件的实用方法。

本文目录一览:

在不使用join命令的情况下联接列表中的元素(不能使用join命令合并的对象)

在不使用join命令的情况下联接列表中的元素(不能使用join命令合并的对象)

我需要在 不使用join命令的情况下加入 列表中的元素,因此例如,如果我有列表:

[12,4,15,11]

输出应为:

1241511

到目前为止,这是我的代码:

def lists(list1):    answer = 0    h = len(list1)    while list1 != []:        answer = answer + list1[0] * 10 ** h        h = h - 1        list1.pop(0)    print(answer)

但是,最后,答案最终125610是错误的。

我认为逻辑还可以,但是我找不到问题?

答案1

小编典典

如果您只想打印数字而不是return实际数字int

>>> a = [12,4,15,11]>>> print(*a, sep='''')1241511

#homework 如何在不使用 add() 的情况下入队和在 Java 中不使用 remove() 的情况下出队?

#homework 如何在不使用 add() 的情况下入队和在 Java 中不使用 remove() 的情况下出队?

如何在不使用 add 的情况下入队

通过使用 .offer()

如何在不使用remove的情况下出队

通过使用 .poll()

换句话说,你正在做。

我已经将“球”出列,但是当我调用队列中的元素而不是“鞋子”时它会弹出

当然。你把鞋子放在抽屉里。然后,您将球放入抽屉,从而将鞋子移到橱柜的后面。然后,你打开抽屉,取出你的手能接触到的第一个东西,那就是球。

现在抽屉里只放了鞋子。

,

入队使用 offer(),出队使用 poll()。

你做得对。

但队列遵循 FIFO(先进先出)。

    beverages.offer("shoes");

[“鞋子”]

    beverages.offer("ball"); 

["鞋子","球"]

    beverages.peek();

一开始就给你“鞋子”。

    beverages.poll();

这将删除第一个元素,即“鞋子”。

现在,饮料 = ["ball"]。

angularjs – 如何在不使用jQuery的情况下获取指令中的元素css?

angularjs – 如何在不使用jQuery的情况下获取指令中的元素css?

我尝试使用指令和spin.js(不使用jQuery)使用AngularJS编写加载器.

我知道AngularJS有自己的jQuery lite.但是我无法从指令中的element获取宽度.

基本上我需要获得按钮宽度(内部指令)

我到目前为止尝试过:

element[0].width  // < - error
angular.element(element[0]).css('width')  // < - undefined

开始了:

在Plunker演示

HTML

<button type="submit" loader left="5" ng-click="loadData()" >Load Data</button>

JS

var app = angular.module('plunker',[]);

app.controller('MainCtrl',function($scope,stockData,$timeout) {


  $scope.loadData = function(){

    $scope.init();

            stockData.query()
                        .then(function (result) {
                        $timeout(function () {
                            $scope.data = result.data;

                            $scope.stop();
                            return result.data;
                        },3000);
                    },function (result) {
                        alert("Error: No data returned");
                    });   
               }
      });


app.directive('loader',['$parse','stockData','$timeout',function ($parse,$timeout) {

    return {
        restrict: 'A',link: function (scope,element,attr) {

            var spinner;

             var opts = {
                lines: 13,// The number of lines to draw
                length: 3,// The length of each line
                width: 2,// The line thickness
                radius: 7,// The radius of the inner circle
                corners: 1,// Corner roundness (0..1)
                rotate: 0,// The rotation offset
                direction: 1,// 1: clockwise,-1: counterclockwise
                color: '#000',// #rgb or #rrggbb or array of colors
                speed: 1.3,// Rounds per second
                trail: 60,// Afterglow percentage
                shadow: false,// Whether to render a shadow
                hwaccel: false,// Whether to use hardware acceleration
                className: 'spinner',// The CSS class to assign to the spinner
                zIndex: 2e9,// The z-index (defaults to 2000000000)
                top: 'auto',// Top position relative to parent in px
                left: 'auto' // Left position relative to parent in px
            };


               target = element[0];

              scope.init = function(){
               attr.$set('disabled',true);


             if(attr['left'] != undefined){

               var left_ = parseInt(attr['left']);

             console.log(element[0].width); // < - error
             console.log(angular.element(element[0]).css('width')); // < - undefined


               if(left_ >= 0){
                 //opts.left = element.width() + parseInt(attr['left']);
               }
               else{
                // opts.left =  -element.width()/2  + parseInt(attr['left']);
               }
             }  

               spinner = new Spinner(opts).spin(target);
            }; 

            scope.stop =  function(){
              attr.$set('disabled',false);
              spinner.stop();
            };
        }
    };
}]);


app.factory('stockData',['$http','$q',function ($http,$q) {

    var factory = {
        query: function () {
             // dummy call
            var data = $http.get('http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22YHOO%22)%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json');
            var deferred = $q.defer();
            deferred.resolve(data);
            return deferred.promise;
        }

    }
    return factory;
}]);

谢谢,

使用元素[0] .offsetWidth

.css(‘width’)将是未定义的,因为你没有任何定义宽度的内联CSS,而.width是一个jQuery的东西.

如果jQuery不可用,angular.element使用’jqLit​​e’,它只提供功能的子集.计算的CSS样式不是其中之一(由于性能影响,won’t be any time soon).

如果没有jQuery here,你可以做一些不错的参考

mysql-是否可以在不使用关系的情况下联接原则ORM中的表?

mysql-是否可以在不使用关系的情况下联接原则ORM中的表?

假设有两个表.

Table X--
Columns:
     id         x_value

Table Y--
Columns:
     id        x_id      y_value

现在,我不想在学说类中定义关系,并且我想使用像这样的查询使用这两个表来检索一些记录:

Select x_value from x,y where y.id="variable_z" and x.id=y.x_id;

我无法弄清楚如何在准则orm中编写这样的查询

编辑:

表结构:

表格1:

CREATE TABLE IF NOT EXISTS `image` (
  `id` int(11) NOT NULL AUTO_INCREMENT,`random_name` varchar(255) NOT NULL,`user_id` int(11) NOT NULL,`community_id` int(11) NOT NULL,`published` varchar(1) NOT NULL,PRIMARY KEY (`id`)
 ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=259 ;

表2:

  CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,`city` varchar(20) DEFAULT NULL,`state` varchar(20) DEFAULT NULL,`school` varchar(50) DEFAULT NULL,PRIMARY KEY (`id`)
 ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ;

查询我正在使用:

        $q = new Doctrine_Rawsql();

        $q  ->select('{u.*},{img.*}')
        ->from('users u LEFT JOIN image img ON u.id = img.user_id')
        ->addComponent('u','Users u')
        ->addComponent('img','u.Image img')
        ->where("img.community_id='$community_id' AND img.published='y' AND u.state='$state' AND u.city='$city
        ->orderBy('img.id DESC')
        ->limit($count+12)  
        ->execute();        

我得到的错误:

 Fatal error: Uncaught exception 'Doctrine_Exception' with message 'Couldn't find class
 u' in C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Table.PHP:290 Stack trace: #0 
 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Table.PHP(240): Doctrine_Table-   >initDeFinition() #1 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Connection.PHP(1127): 
Doctrine_Table->__construct('u',Object(Doctrine_Connection_MysqL),true) #2 
C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Rawsql.PHP(425): Doctrine_Connection-
>getTable('u') #3 C:\xampp\htdocs\fanyer\doctrine\models\Image.PHP(33):    Doctrine_Rawsql-
>addComponent('img','u.Image imga') #4   C:\xampp\htdocs\fanyer\community_images.PHP(31): 
  Image->get_community_images_gallery_filter(4,'AL','ALBERTVILLE') #5 {main} thrown      in 
    C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Table.PHP  on line 290
最佳答案
尝试这样的事情:—

$q = new Doctrine_Rawsql();
$this->related_objects = $q->
        select('{o.name}')->
        from('tagset t1 JOIN tagset t2 ON t1.tag_id = t2.tag_id AND t1.object_id != t2.object_id JOIN object o ON t2.object_id = o.id')->
        addComponent('o','Object o')->
        where('t1.object_id = ?',$this->object->id)->
        groupBy('t2.object_id')->
        orderBy('COUNT(*) DESC')->
        execute();

php – 如何通过在不使用J安装管理器的情况下复制文件来安装Joomla 2.5组件

php – 如何通过在不使用J安装管理器的情况下复制文件来安装Joomla 2.5组件

在Joomla 2.5上安装自定义组件时一切正常.如果我只是将组件的内容复制并粘贴到相应的文件夹/ components / com_mycomponent中而不安装它,则目录结构变得相同,但在请求时找不到组件.

我假设组件需要安装才能工作.我的问题是如何在不实际安装组件的情况下模拟此安装.那么我怎么能告诉Joomla在components目录中复制了一个组件.

我需要能够创建测试组件并开发它们,而无需在平台上实际安装它们,直到它们准备就绪.

提前致谢.

解决方法:

从Joomla的下拉菜单中选择Extensions→Extension Manager!管理员面板.然后在出现的Extension Manager屏幕中选择discover菜单项.

正如它在Joomla文档手册中所说:发现搜索Joomla!已卸载扩展的安装目录.找到的所有未安装的扩展程序都将显示在扩展程序列表中.缓存搜索结果,以便在后续访问此屏幕时继续显示它们.“

这是实际manual page的链接.

希望这可以帮助.

斯托扬

关于在不使用join命令的情况下联接列表中的元素不能使用join命令合并的对象的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于#homework 如何在不使用 add() 的情况下入队和在 Java 中不使用 remove() 的情况下出队?、angularjs – 如何在不使用jQuery的情况下获取指令中的元素css?、mysql-是否可以在不使用关系的情况下联接原则ORM中的表?、php – 如何通过在不使用J安装管理器的情况下复制文件来安装Joomla 2.5组件等相关知识的信息别忘了在本站进行查找喔。

本文标签: