dimensions

Data warehouse for AD dates

老子叫甜甜 提交于 2019-12-03 08:28:22
We're creating a historic archive for a world history database and we need a date lookup table which references all dates in AD. How to go about creating the values for this table - from 1AD to 2011 as YYYY/MM/DD? Database is MySQL. Problems: I'm using Excel to pre-populate the dates, then import into MySQL as: YYYY/MM/DD but Excel doesn't recognize years like 0007, 0008, etc so I can't auto-copy cells to generate dates. I have to manually do it and this will take days to go from 1AD to year 2011 as YYYY/MM/DD. Leap years were introduced on 1752. If I programmatically generates dates how do I

how to obtain a CCSprite's width and height in cocos2d for iphone

三世轮回 提交于 2019-12-03 06:38:21
问题 That's the question xD Given an instance of a CCSprite in cocos2d in iphone, what method can I use to obtain the image width and height? 回答1: The CCSprite class has a bounding box property that's a CGRect: CCSprite *sprite = [CCSprite spriteWithFile: @"file.png"]; int width = [sprite boundingBox].size.width; I added a width and height methods to my CCSprite subclass. -(CGFloat) width { return [self boundingBox].size.width; } -(CGFloat) height { return [self boundingBox].size.height; } 回答2:

getDimension()/getDimensionPixelSize() - mutliplier issue

喜你入骨 提交于 2019-12-03 05:31:44
So I have android 2.3.5 device which is NORMAL/HDPI. I have a dimens.xml in my project: ... <dimen name="gameresult_congrats_label_msg_textSize">20sp</dimen> ... this file is absolutely identical in values-normal/values-hdpi and so on folders. In my first activity app shows me that value using: Toast.makeText(this, "textSize is "+getResources().getDimensionPixelSize(R.dimen.gameresult_congrats_label_msg_textSize), Toast.LENGTH_SHORT).show(); and it displays 30. I Tried also: Toast.makeText(this, "textSize is "+getResources().getDimension(R.dimen.gameresult_congrats_label_msg_textSize), Toast

Set text size in .xml or programmatically

巧了我就是萌 提交于 2019-12-03 04:53:34
I have variable at dimens.xml <resources> <dimen name="btn_text_size">12sp</dimen> </resources> And i can use it in layout file: <TextView android:textSize="@dimen/btn_text_size" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/dialog_tags_complete" /> or programmatically tagButton.setTextSize(c.getResources().getDimension(R.dimen.tag_text_size)); But this 2 methods give different results. I know that getDimension are based on the current DisplayMetrics associated with the resources. But what should i do to make this 2 ways looks the same?

C++/Size of a 2d vector

别说谁变了你拦得住时间么 提交于 2019-12-03 04:52:18
How do I find the size of a 2 dimensional vector? So far I have the following code which doesn't compile. #include <iostream> #include <vector> using namespace std; int main() { vector < vector <int> > v2d; for (int x = 0; x < 3; x++) { for (int y = 0; y < 5; y++) { v2d.push_back(vector <int> ()); v2d[x].push_back(y); } } cout<<v2d[0].size()<<endl; cout<<v2d[0][0].size()<<endl; return 0; } Shamim Hafiz To get the size of v2d , simply use v2d.size() . For size of each vector inside v2d , use v2d[k].size() . Note: for getting the whole size of v2d , sum up the size of each individual vector, as

Accessing image dimensions on an ImageField in a Django template?

扶醉桌前 提交于 2019-12-03 04:49:57
I have ImageField in my model and I'm able to display the image in a template. However, how do I retrieve the image's height and width? bradley.ayers See the documentation for ImageField . In addition to the special attributes that are available for FileField, an ImageField also has height and width attributes. So just do the following: <img src="{{ image.url }}" width="{{ image.width }}" height="{{ image.height }}"/> In my case, for the width and height fields to work, I need to set the width_field and height_field of the ImageField E.g. class Product(models.Model): image = models.ImageField

Cesium的Property机制总结[转]

我的梦境 提交于 2019-12-03 04:40:39
https://www.jianshu.com/p/f0b47997224c 前言 Cesium官方教程中有一篇叫《空间数据可视化》( Visualizing Spatial Data )。该文文末简单提到了Cesium的Property机制,然后话锋一转,宣告此教程的第二部分将重点讲解Property机制。但是呢,第二部分还没有写好,说在等待的过程中,可以先看下Cesium对影像和地形的支持。。 可以看官方教程中的说法,如下图所示: Cesium说教程的第二部分说Property的。。 于是,我苦等了一年啦。。官方教程的第二部分还是没能看到。。毕竟这是Cesium官方推荐使用的Entity API中最重要的部分之一。。居然这么久了也不给更新下。。 我想还是自己总结一下得好。。 为什么要用Property? 还是举个例子来说吧。 比如我想在地球上的某个位置加一个盒子,可以这样写代码: // 创建盒子 var blueBox = viewer.entities.add({ name : 'Blue box', position: Cesium.Cartesian3.fromDegrees(-114.0, 40.0, 300000.0), box : { dimensions : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0),

Can I hide an image button on a layout, (dimensions and background) until a call to set visible?

▼魔方 西西 提交于 2019-12-03 03:50:52
I have a hidden image button in one of my xmls layouts, with a background set to a drawable image. I set the visibility to invisible, as I only want the image to display every once in a while. The problem is, even if the drawable isn't shown, the image button still takes us space - Is there a way to hide the background image, and make it's dimensions 0 until I call on it to be shown in my main class? Thanks! Edit: So in my xml, how would I write that? <ImageButton android:id="@+id/myimage" android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content"

TypeError: Invalid dimensions for image data when plotting array with imshow()

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: For the following code # Numerical operation SN_map_final = (new_SN_map - mean_SN) / sigma_SN # Plot figure fig12 = plt.figure(12) fig_SN_final = plt.imshow(SN_map_final, interpolation='nearest') plt.colorbar() fig12 = plt.savefig(outname12) with new_SN_map being a 1D array and mean_SN and sigma_SN being constants, I get the following error. Traceback (most recent call last): File "c:\Users\Valentin\Desktop\Stage M2\density_map_simple.py", line 546, in <module> fig_SN_final = plt.imshow(SN_map_final, interpolation='nearest') File "c:\users

need concept to understand declaration of array in system verilog

匿名 (未验证) 提交于 2019-12-03 01:42:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am always confusing while declaring an array and Array Querying Function in SystemVerilog. Can you explain me in details for given example: Example-1 integer matrix [ 7 : 0 ][ 0 : 31 ][ 15 : 0 ]; // 3-dimensional unpacked array of integers i am confuse in size // and dimension of given array for 1 and 2 dimension its easy to // understand but for 3 and 4-dimension its little bit confusing... Example-2 //bit [1:5][10:16] foo [21:27][31:38]; Example-3 //module array(); bit [ 1 : 5 ][ 10 : 16 ] foo1 [ 21 : 27 ][ 31 : 38 ], foo2 [ 31