{"QuestionId": 19138259, "AnswerCount": 3, "Tags": "", "CreationDate": "2013-10-02T13:38:23.013", "AcceptedAnswerId": "19138744", "Title": "how to copy some part of the list to a new list in TCL?", "Body": "

I have a list as the following:

\n\n
set list1 {1,2,3,4,5,6,7,8,9}\n
\n\n

how to copy three elements of it to another list every time?

\n\n

for example after copy:

\n\n
listc1 is {1,2,3}\nlistc2 is {4,5,6}\nlistc3 is {7,8,9}\n
\n", "Lable": "No"} {"QuestionId": 19177738, "AnswerCount": 1, "Tags": "", "CreationDate": "2013-10-04T09:26:36.170", "AcceptedAnswerId": "19178462", "Title": "Custom directive with templateUrl and ng-repeat", "Body": "

I've been reseaching this issue for hours, and finally i reproduced it on plunker.

\n\n

Here's my issue:

\n\n

When a customized directive which using external resource as template is combined with ng-repeat, the view didn't render correctly while model changed.

\n\n

In my example, clicking link will replace the model, but old data hasn't been cleaned.

\n\n

And if i using template: 'stringTemplate' instead of templateUrl: 'urlToTemplate', it just works fine.\nStill no idea if it's a bug or something...

\n\n

Partial code:

\n\n
angular.module('test', [])\n    .run(function($rootScope) {\n        $rootScope.topics = [{\n            content: 'Click here to change reply',\n            replys: [{\n                content: 'Reply test...',\n            }]\n        }];\n    })\n    .directive('topic', function() {\n        return {\n            replace: true,\n            restrict: 'E',\n            templateUrl: 'topic.htm',\n            link: function(scope) {\n                scope.reply = function(input) {\n                    scope.topic.replys = [{ content: '\"Reply test...\" should be replaced, but it\\'s not!' }];\n                }\n            }\n        };\n    })\n    .directive('reply', function() {\n        return {\n            replace: true,\n            restrict: 'E',\n            // template: '<div><div ng-bind=\"reply.content\"></div></div>' //this works fine\n            templateUrl: 'reply.htm' // same content\n        };\n    });\n
\n", "Lable": "No"} {"QuestionId": 19211999, "AnswerCount": 6, "Tags": "", "CreationDate": "2013-10-06T17:56:20.000", "AcceptedAnswerId": "19231862", "Title": "Showing a UIProgressView inside or on top of a UINavigationController's UINavigationBar", "Body": "

I want to have an UIProgressView to show a progress on the bottom of a navigation bar (just like when sending an iMessage or text message in iOS 7).\nBut I need this consistently on every table view view of my navigation controller.\nSo for me it was clear: I have to add this to the UINavigationController.\nBut the problem is, it's not possible to add an UIProgressView to the UINavigationController.\nSo I tried out two things:

\n\n

1st I tried to add it to UINavigationController's view programmatically. But the problem was to position the UIProgressView and to make it look good when changing device rotation.

\n\n

The 2nd thing I tried is to add the UIProgressView to every UITableView, but then I really have to do this for every view. Also it doesn't look good, because it is not on top of the navigation bar but beneath it. But the main reason why I didn't like the 2nd solution is because the ProgressViews go and come with their TableView, so you don't have a static one but changing ones.

\n\n

After this, I don't have any idea to do this, so I ask you\u2026 does anyone have an idea how to do this?

\n\n

That's how it should look like:\n\"enter

\n", "Lable": "No"} {"QuestionId": 19492682, "AnswerCount": 3, "Tags": "", "CreationDate": "2013-10-21T10:59:02.330", "AcceptedAnswerId": null, "Title": "create an array with just 2 bit for each cell in C++", "Body": "

I want create an array that each cell of it just have 2 bit in C++. is there any way to do this?

\n\n

there is some method for creating bit array, but they allot just one bit to each cell.

\n", "Lable": "No"} {"QuestionId": 19624632, "AnswerCount": 2, "Tags": "", "CreationDate": "2013-10-27T22:54:05.700", "AcceptedAnswerId": "19624863", "Title": "How do I in-place modify each element of a 1D Array?", "Body": "

I have a 1D eigen array (Eigen::Array<double,Dynamic,Dynamic>) of doubles, and I want to modify each element in the array in place. However, I'm not really sure how to do this. I'm considering this:

\n\n
Eigen::Array<double,Eigen::Dynamic,Eigen::Dynamic> arr1D;\n// ...\n\n// Threshold function:\narr1D.unaryExpr([](double& elem)\n{\n    elem = elem < 0.0 ? 0.0 : 1.0;\n}\n);\n
\n\n

But this seems like a bit of a hack because the Eigen Reference examples only give examples of .unaryExpr where it is used with a functor that returns a value (and then the whole method just returns a different array). In my case, I was hoping to avoid the need for creating a new array.

\n\n

I'm new to Eigen so I thought I might be missing something here, input is appreciated.

\n\n

EDIT: I understand that I can replace the above simply with arr1D = arr1D >= 0.0, but please note that this is just an example

\n", "Lable": "No"} {"QuestionId": 19700567, "AnswerCount": 2, "Tags": "", "CreationDate": "2013-10-31T07:27:24.397", "AcceptedAnswerId": "19700748", "Title": "Mysql table data not inserted?", "Body": "

my problem is that the value in array \"Session name\" can't be insert into table.Into the array of 'session name[]' value cannot insert into the table row.the code is as given below.please help me to solve my problem.

\n\n
if(isset($_POST['submit']))\n{\n    if(isset($_POST['type']))\n    {\n        $prid=clean($_POST['type']);\n    }\n\n    if(isset($_POST['Introduction']))\n    {\n    $Introduction=clean($_POST['Introduction']);\n    }\n\n    if(is_array($_POST['Sessionname']))\n    {\n        $Sessionname=$_POST['Sessionname'];\n        $sscount=count($Sessionname);   \n    }\n\n    if(is_array($_POST['duration']))\n    {\n        $duration=$_POST['duration'];\n        $durcount=count($duration); \n    }\n\n\n\n\n        for($i = 0;$i<=$durcount; $i++)\n        {\n\n            if($i==0)\n            {\n    $sql=\"INSERT INTO packages(prid,session_name,duration) VALUES \n    (\n    '$prid',\n    '$Introduction',\n    '$duration[$i]'\n    )\";\n\n            }\n        else if($i>0)\n                {\n                    $j=$i-1;\n\n                        for($j = 0;$j<=$sscount; $j++)\n                        {\n\n    $sql=\"INSERT INTO packages(prid,session_name,duration) VALUES \n    (\n    '$prid',\n    '$Sessionname[$j]',\n    '$duration[$i]'\n    )\";\n\ni want output in my table is like below :\n\n\npkid  prid       session_name          duration\n\n 1      1    Introduction Session     15 minutes\n 2      1           Session2          45 minutes\n 3      1           Session3          30 minutes\n 4      1           Session4           5 minutes\n
\n", "Lable": "No"}