repeat

R: repeat elements of a list based on another list

亡梦爱人 提交于 2019-12-10 19:03:04
问题 I have searched for this but in vain. the problem is I have two lists, first with the elements to be repeated for example my.list<-list(c('a','b','c','d'), c('g','h')) and the second list is the number of times each element is to be repeated repeat.list<-list(c(5,7,6,1), c(2,3)) I would like to create a new list in which each element in my.list is repeated based in repeat.list i.e. result: [[1]] [1] "a" "a" "a" "a" "a" "b" "b" "b" "b" "b" "b" "b" "c" "c" "c" "c" "c" "c" "d" [[2]] [1] "g" "g"

Texture repeating on quads OpenGL

人盡茶涼 提交于 2019-12-10 18:53:51
问题 I am writing a voxel engine and at the moment I am working on the Chunk-Rendering-System but I have a problem. It seems that the textures were repeated on the quads. There is this green line at the bottom of the grass blocks and I don't know why. This is the OpenGL-Render-Code: Texture texture = TextureManager.getTexture(block.getTextureNameForSide(Direction.UP)); texture.bind(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2d(0, 0); GL11.glVertex3f(0, 1, 0); GL11.glTexCoord2d(1, 0); GL11

Using a sprite sheet with createPattern()

烂漫一生 提交于 2019-12-10 18:14:20
问题 I can't seem to find any solid info on how to do this, so I'm wondering if someone can point me in the right direction. I have a large sprite sheet, let's call it textures.png. Each texture is 64x64 pixels and I need to be able to create patterns out of these textures. createPattern() is a great function but it seems to only take two arguments, the image source and whether to repeat it or not. This is fine if you are loading a single image for each texture, but I'm wondering how to do this

StateListDrawable and tiled bitmap

被刻印的时光 ゝ 提交于 2019-12-10 12:59:05
问题 This is my custom selector (StateListDrawable) <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/common_cell_background" /> <item android:state_pressed="true" android:drawable="@drawable/common_cell_background_highlight" /> <item android:state_focused="true" android:drawable="@drawable/common_cell_background_highlight" /> <item android:state_selected="true" android:drawable="@drawable/common_cell_background_highlight" /> </selector> Both,

Repeating notification

浪尽此生 提交于 2019-12-10 12:08:25
问题 I'm trying to set a notification that is repeated each day at a fixed hour. I'm able to set a notification by clicking on an item in a list (but that's not really interesting...) I've tried several things but I still can't make it appear automatically nor daily... Here is what I've done so far: public class main extends Activity implements PersonneAdapterListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

Three.js Repeat texture fail

ε祈祈猫儿з 提交于 2019-12-10 11:24:22
问题 I'm trying to make a simple floor texture, but it seems that wrapS and wrapT don't works. Look at the result: http://hpics.li/321350c var texture = THREE.ImageUtils.loadTexture( "Game/Texture/drytext.png" ); texture.wrapS = THREE.RepeatWrapping; texture.wrapT = THREE.RepeatWrapping; texture.repeat.set( 4, 4 ); var floorMaterial = new THREE.MeshBasicMaterial( { map: texture, side: THREE.DoubleSide }); var floorGeometry = new THREE.PlaneGeometry(20, 20, 10, 10); var floor = new THREE.Mesh

Finding unknown repeating patterns in a string consisting numbers

冷暖自知 提交于 2019-12-10 10:03:23
问题 I've been struggling with this for a week. I have a string like this: 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1..... What I need to find: 1 1 0 example 2: 1 1 2 0 2 2 1 0 1 1 2 0 2 2 1 0 1 1 2 0 2 2 1 0 1 1 2 0 2 2 1 0 .... What I need to find: 1 1 2 0 2 2 1 0 example 3: 1 1 2 3 1 0 1 1 2 3 1 0 1 1 2 3 1 0 1 1 2 3 1 0 1 1 2 3 1 0... 112310 etc. etc. My code as now: private string tekrarArama(double[] mods) { string part1 = ""; string part2 = ""; string patern = ""; int number1 = mods

Repeat a background brush in WPF

让人想犯罪 __ 提交于 2019-12-10 04:01:57
问题 and thank you. This question is very similar to this old, unanswered question here: How to paint notebook-like lines as TextBox background? However, it is not the same - not exactly. I would like to create a notepad, lined paper-like background but I am not not familiar with how to repeat a brush in XAML. How do you? EDIT Here's the solution as part of a TextBox: <TextBox TextBlock.LineHeight="20" TextBlock.LineStackingStrategy="BlockLineHeight" Padding="20,10,20,20" TextWrapping="Wrap">

Repeat same HTML code in several pages

大城市里の小女人 提交于 2019-12-10 03:52:34
问题 I have a really hard time searching for this, because I have no idea how to call it. I'll try to describe the process I want, and see if any of you know such an editor. I have a website that has the same html component repeated in them, for example, a menu. I can define how the menu looks with css, but I can't (as far as I know) add the same piece of html to every html page with a simple line. What I do, is copy the menu over to every place. If I change the menu, I need to do it all again. I

Repeat array to a certain length?

拈花ヽ惹草 提交于 2019-12-10 03:29:03
问题 I'm having an array for example with 4 elements array("a", "b", "c", d"); what is the fastest way to repeat this array to create a new array with a certain length, e.g 71 elements? 回答1: // the variables $array = array("a", "b", "c", "d"); $desiredLength = 71; $newArray = array(); // create a new array with AT LEAST the desired number of elements by joining the array at the end of the new array while(count($newArray) <= $desiredLength){ $newArray = array_merge($newArray, $array); } // reduce