cycle

Macro to cycle through and allocate data to members of structs incorrectly recognises struct member as pointer

浪子不回头ぞ 提交于 2019-12-13 14:44:13
问题 My problem is that atoi is converting a string's hexadecimal memory address to decimal, instead of what's contained within the string. It is doing this during a macro. Why is it interpreting struct->member as a pointer, when the macro definition makes it an int? Pseudocode below: if (struct.member == int)? struct.member = atoi(data) : struct.member = data; The aim of this section of the program is to retrieve data from a .csv file containing information about a structs attributes. I can take

itertools cycle in vigenere cipher causing problems with spaces python

流过昼夜 提交于 2019-12-13 05:20:59
问题 In my code for vigenere cipher I use cycle from itertools to cycle through the key word. This works great until I use spaces in the message as it encrypts the space therefore making the encryption wrong. Here is the code. message = input('enter message: ') keyword = input('enter keyword: ') def chr_to_int(char): return 0 if char == 'z' else ord(char)-96 def int_to_chr(integer): return 'z' if integer == 0 else chr(integer+96) def add_chars(a, b): return int_to_chr(( chr_to_int(a) + chr_to_int

Jquery Cycle: pagerAnchorBuilder not working with LiveQuery

一个人想着一个人 提交于 2019-12-13 03:39:02
问题 Hope u people will be fine. I am using jquery cycle plugin togther with livequery. It is working fine except pagerAnchorBuilder. Any body know how to fix this problem. Jquery Cycle Code is following: $j('ul.slider-thumbs').livequery(function() { $j(this).cycle({ fx: 'fade', speed: 750, timeout: 0, cleartype: true, next: '.slider-nav span.control-next a', prev: '.slider-nav span.control-prev a', pager: 'ul.slider-pagination', pagerAnchorBuilder: pagerFactory }); function pagerFactory(idx,

Finding all cycles in directed graphs of length <= k

岁酱吖の 提交于 2019-12-13 00:53:08
问题 Is there a way of modifing the algorithm in Finding all cycles in undirected graphs to consider edges as directed and only cycles of length <= k ? 回答1: I reply by myself static void Main(string[] args) { int k = 4; for (int i = 0; i < graph.GetLength(0); i++) for (int j = 0; j < graph.GetLength(1); j++) { findNewCycles(new int[] { graph[i, j] },k); } foreach (int[] cy in cycles) { string s = "" + cy[0]; for (int i = 1; i < cy.Length; i++) s += "," + cy[i]; Console.WriteLine(s); } } static

Jquery Cycle Resize

那年仲夏 提交于 2019-12-12 15:33:20
问题 I am trying to get Jquery Cycle to resize. So far I have been partly successful, it resizes but the slide transition is buggy... I can't understand why? Here's the whole page http://dl.dropbox.com/u/8847353/Jai_Sandhu_Design_Portfolio/index.html I've managed to get the slideshow to resize following this article over at Sitepoint. By using slideResize: false in the javascript and assigning !important tags to the % width and % height of the CSS, the slideshow resizes according to the percentage

Cycle2 Carousel active slide in center

筅森魡賤 提交于 2019-12-12 12:32:50
问题 I am using Cycle2 with a carousel pager, in the same way as this demo: http://jquery.malsup.com/cycle2/demo/caro-pager.php Currently the active slide in the demo is on the left unless you are on the last few slides. What I would like is: for the active slide to start on the left, on slide 1 then when slide 2 is clicked, the thumbnails don't move but the second thumbnail shows as active. When slide 3 is clicked, the thumbnails don't move but the third thumbnail (in the middle) becomes active).

Cycles in c++ like in python (range-based for)

六眼飞鱼酱① 提交于 2019-12-12 11:42:07
问题 What is the easiest way to do cycles in c ++ like in python? for i in range(10): #or range(4, 10, 2) etc foo(i) I mean something simple and one-line like this for(auto i: range(10)) //or range(4, 10, 2) or range(0.5, 1.0, 0.1) etc foo(i); but not like this: std::vector<int> v(10); std::iota(begin(v), end(v), 0); for(auto i: v) { foo(i); } Or this for(auto i: []{vector<size_t> v(10); return iota(begin(v), end(v), 0), v;}() ) { foo(i); } Of course, it is not difficult to use these examples or

Pythonic way of copying an iterable object

青春壹個敷衍的年華 提交于 2019-12-12 08:54:16
问题 For a small project I'm working on I need to cycle through a list. For each element of this cycle I have to start another cycle through the same list, with the former element as first element of the new cycle. For example I'd like to be able to produce something like this: 1, 2, 3, 4, 1, 2, 3, 4, 1, ... 2, 3, 4, 1, 2, 3, 4, 1, 2, ... 3, 4, 1, 2, 3, 4, 1, 2, 3, ... 4, 1, 2, 3, 4, 1, 2, 3, 4, ... 1, 2, 3, 4, 1, 2, 3, 4, 1, ... ... I thought that copying a itertools.cycle after each .next()

Relational database design cycle

三世轮回 提交于 2019-12-12 05:03:54
问题 I have the following database design: I want to add a new table named Task, which would have a one-to-many relationship with a Project(Project will have one or more tasks and particular task will belong to only one project). Next users will also be assigned to different tasks in a project(basically User table needs another many to many relationship with a Task, but that creates a loop in the design). Is this a good practice or should I avoid making loops in a design? 回答1: Next users will also

Take three elements at a time from array

有些话、适合烂在心里 提交于 2019-12-12 03:47:57
问题 I have an array composed by nine elements: var ar = ['a','a','a','a','a','a','a','a','a']; I need to control three elements at a time by a function that returns a true or false. If the first returns true, the others do not have to execute in order to obtain just one true result. var one = fun(ar.slice(0, 3)); if (one != false) document.write(one); var two = fun(ar.slice(3, 6)); if (two != false) document.write(two); var three = fun(ar.slice(6, 9)); if (three != false) document.write(three);