size

emacs programmatically change window size

我与影子孤独终老i 提交于 2019-12-10 04:22:57
问题 I would like to implement automatic collapse of compilation buffer to small size (but not close at a delete windows), such that upon successful compilation to window is shrunk to minimum size. get-buffer-create returns a buffer. how can I shrink-window on window associated with that buffer? also, is there a way to store previous window size? It is my first foray into emacs lisp programming, thank you for your help. 回答1: I believe there are two ways to solve this problem. The first is to use

JSONArray的应用

半世苍凉 提交于 2019-12-10 04:02:23
从json数组中得到相应java数组,如果要获取java数组中的元素,只需要遍历该数组。 Java代码 /** * 从json数组中得到相应java数组 * JSONArray下的toArray()方法的使用 * @param str * @return */ public static Object[] getJsonToArray(String str) { JSONArray jsonArray = JSONArray.fromObject(str); return jsonArray.toArray(); } public static void main(String[] args) { JSONArray jsonStrs = new JSONArray(); jsonStrs.add(0, "cat"); jsonStrs.add(1, "dog"); jsonStrs.add(2, "bird"); jsonStrs.add(3, "duck"); Object[] obj=getJsonToArray(jsonStrs.toString()); for(int i=0;i<obj.length;i++){ System.out.println(obj[i]); } } 从json数组中得到java数组,可以对该数组进行转化

What's the equivalent “sizeWithFont: ” method for the Mac?

眉间皱痕 提交于 2019-12-10 03:43:51
问题 I'm familiar with sizeWithFont: for the iPhone. Now I'm trying to build an app for the Mac and need something like that, but I don't know how to do it :/ Here's why I need it: I've got a panel that displays some text, and I want to size it so that it just fits the content (a NSTextView ). How would you do it? 回答1: Take a look at NSString's sizeWithAttributes: . You'll have to create a dictionary of attributes; take a look at Apple's documentation for that. 来源: https://stackoverflow.com

jsonArray与java中数据转换

会有一股神秘感。 提交于 2019-12-10 03:37:48
从json数组中得到相应java数组,如果要获取java数组中的元素,只需要遍历该数组。 /** * 从 json 数组中得到相应 java 数组 * JSONArray下的 toArray() 方法的使用 * @param str * @return */ public static Object[] getJsonToArray(String str) { JSONArray jsonArray = JSONArray.fromObject(str); return jsonArray.toArray(); } public static void main(String[] args) { JSONArray jsonStrs = new JSONArray(); jsonStrs.add(0, "cat"); jsonStrs.add(1, "dog"); jsonStrs.add(2, "bird"); jsonStrs.add(3, "duck"); Object[] obj=getJsonToArray(jsonStrs.toString()); for(int i=0;i<obj.length;i++){ System.out.println(obj[i]); } } 从json数组中得到java数组,可以对该数组进行转化,如将JSONArray转化为String型

How do I restrict my app for only iPhone 6 and 6 Plus?

大兔子大兔子 提交于 2019-12-10 03:09:06
问题 CONTEXT I'm developing a Crossword game app that currently runs on iPad devices. Apple has recently released iPhone 6 and iPhone 6+ devices, which fortunately have a bigger screen and thus become eligibly to run my game (I have tested my game on a iPhone 5S device and if found that it was not pleasant to the user to run in such screen size). In this way, I decided to migrate my app to an Universal binary that would include support for iPhone 6, iPhone 6 Plus and iPad devices. QUESTION Is

How do I get graphviz to generate fixed sized subgraphs?

三世轮回 提交于 2019-12-10 02:06:39
问题 I've been struggling with this for a while and cannot seem to find a straight answer. I'm working with compound subgraphs in graphviz and cannot seem to find the right combination of settings to force two subgraphs to align with each other. Enclosed is a simple example to show the problem... digraph g { compound=true; subgraph cluster_top { graph [color=black, label="Top", rank=min]; nodeA; nodeB; nodeC cluster_top_DUMMY [shape=point style=invis] } subgraph cluster_service { graph [color

Defining the size of an array using a const int

为君一笑 提交于 2019-12-10 01:48:03
问题 When I try to run this, it gives me an error saying that the value in variable a isn't constant. That doesn't make sense to me because I explicitly made the variable a constant. Does the size of an array have to more constant than that? Meaning, only #define a 5 , or initializing it as int arr[5] or using malloc ? What is wrong with what I did? int main{ const int a = 5; int i; int arr [a]; for (i = 0; i < 5; i++) { arr[i] = i * 2; } printf("%d", arr[1]); return 0; } 回答1: In C, const should

Swift, Xcode - Increasing the size of a UISwitch

左心房为你撑大大i 提交于 2019-12-10 01:45:46
问题 I am making my app 'universal' (used on iPhone and iPad) and I have found ways of increasing the size of everything except for UISwitches. Is there a way of doing so? Any help is greatly appreciated. 回答1: According to this answer by the user mxg, just use the following code: mySwitch.transform = CGAffineTransformMakeScale(0.75, 0.75) Of course, you have to change mySwitch to whatever the name of your variable/IBOutlet is. 回答2: Swift 3 / 4: switch.transform = CGAffineTransform(scaleX: 0.75, y:

How can I get the byte size of std::wstring?

徘徊边缘 提交于 2019-12-10 01:36:31
问题 I am using std::wstring as my Unicode style string. Now I want to get the byte size of a wstring . If I use size() method of wstring , I just get the total number of chars in my wstring . But the byte should be size() * 2. Is there an official way to get this byte size? I don't want to use size() * 2 in my program..... I want to use in RegSetValueExW as last parameter. 回答1: Use str.size() * sizeof(wchar_t) or equivalent. In fact, I can't think of any other platform besides Windows that has 2

Measure size/length of singly linked list in Java?

亡梦爱人 提交于 2019-12-09 19:21:40
问题 I need help making the int size(); method for a singly linked list in Java. This is what I have so far, but it does not return the correct size of the list. public int size() { int size = 0; Node CurrNode = head; while(CurrNode.next != null) { CurrNode = CurrNode.next; size++; } return size; } Can someone help me implement this method in Java? 回答1: The biggest improvement you can make is to use Java Coding Convension and use camelCase local variables. You can write it like this. public int