pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
1,031,034 | 0 | number of periods (custom) between two dates <p>I want to find out how many periods (custom) are there between two dates. Like how many weeks are between 1 july to 2nd Aug or how many half months are there between 2 nd Juy and 14 Dec, where in half month would be customizable whether it ends on 15th or 16th. </p> <p>IS there any library where this or something similar has been done? Not that its tricky but just want to know if such things exists.</p> |
6,391,003 | 0 | <p>You can't use paths like that in the extends tag. But you don't need to - assuming your <code>TEMPLATE_DIRS</code> setting is <code>root/pages</code>, you just do <code>extends "base.html"</code>.</p> |
13,802,201 | 0 | <p>When all your clipboard has is an string copied as text, you have to retrieve it as </p> <pre><code>Clipboard.GetText() </code></pre> <p>and to retrieve other types of objects you can use GetData()</p> |
40,504,105 | 0 | cat from file.csv with grep data <p>I have data in <code>file.csv</code>:</p> <pre><code>(...) 0000046;0000046;04688;29;1;52.1683;20.5567 0000046;0000046;04688;2A;1;52.1818;20.5639 0000046;0000046;04688;3;1;52.1785;20.5629 0000046;0000046;04688;4;1;52.1815;20.5638 0000046;0000046;04688;5;;52.1779;20.5635 0000046;0000046;04688;6;1;52.1813;20.5636 0000046;0000046;04688;7;;52.1777;20.5634 0000046;0000046;04688;8;;52.1810;20.5635 0000046;0000046;04688;9;1;52.1775;20.5631 0000046;0000046;05027;2;;52.1908;20.5660 0000046;0000046;05027;4;1;52.1907;20.5649 0000046;0000046;05527;1;1;52.1824;20.5636 (...) </code></pre> <p>I need to extract lines where the third field matches a given value. I tried</p> <pre><code>cat file.csv |grep 05027 </code></pre> <p>Unfortunately, this matches any line containing <code>05027</code> anywhere. How can I restrict to matching only on the third field?</p> |
31,939,505 | 0 | chef running resource only when a package is present <p>I want to unzip one file in chef recipe but I want to ensure that unzip package is install on that machine before I unzip it. How to do it in chef ?</p> <p>I tried below recipe but on machine where unzip package is install it simply don't execute it.</p> <pre><code>bash 'extract' do cwd '/home/norun/' code <<-EOH unzip wso2.zip EOH only_if { ::File.exists?('/home/norun/wso2.zip') } not_if { ::File.exists?('/home/norun/wso2as-5.2.1') } end apt_package 'unzip' do action :install notifies :run , 'bash[extract]', :immediately end </code></pre> <p>Thanks In Advance</p> |
32,916,639 | 0 | <p>So if you want a simpler route, instead of recreating an entirely new Cell, just assign the Accessory view to your own custom view which is your Calendar view. will automatically adjust everything. </p> <p>If you want to keep going the way you are now, just keep your custom cell but once again move your calendar into the accessory view. As long as you set its size first, it will be perfect.</p> |
31,811,539 | 0 | R Installing rCharts on R 3.2.1 <p>I had a little bit of trouble installing rCharts for R version 3.2.1. I have referenced a question that addresses an earlier version of R, but the solution did not work for me exactly. <a href="https://stackoverflow.com/questions/26517961/error-on-installing-rcharts-in-r-3-1-1-windows">[Link]</a></p> <p>It would appear that there wasn't a rCharts package for R that can be installed using the <code>install.packages()</code> command</p> |
6,047,463 | 0 | <p>Because the triple design doesn't prevent you from using a closure, while the alternative approach prevents you from <em>not</em> using closures. Sometimes the external-state design is the simpler approach.</p> <p>For instance, say that you're using a <code>for</code> loop to iterate which pages to display in the response to a RESTful query. With external-state-based loops, you can write a function that iterates pages based on a table representing the state-representational parameters of the query (which you construct from the URL once and reuse for several other functions). With triples, you can iterate with just those values without being forced to wrap it (and every other function like it) in a closure constructor.</p> |
7,631,308 | 0 | <p>Here you are 2 of my utils functions:</p> <pre><code> public static function convertUintToString( color:uint ):String { return color.toString(16); } public static function convertStringToUint(value:String, mask:String):uint { var colorString:String = "0x" + value; var colorUint:uint = mx.core.Singleton.getInstance("mx.styles::IStyleManager2").getColorName( colorString ); return colorUint; } </code></pre> |
22,820,181 | 0 | <pre><code>sed 's/\(rmd_ver=\).*[[:number:]]$/\1NEW_VAL/g' </code></pre> <p>you can replace NEW_VAL with the value you want to replace with.</p> |
21,938,921 | 0 | How to manipulate the output to a ItemsSource? <p>With this <a href="http://stackoverflow.com/questions/21863096/dont-get-deserialised-json-jsonnet-to-be-viewed">Previous Question</a> i was able too manage to show the output. I've reading alot of posts here on stackoverflow, but cant find the right solution for the next:</p> <p>How to manipulate the output too ItemsSource, because:</p> <pre><code>{"order_id":"12345678","itemList":["235724","203224","222224","222324","230021"],"amount":["65","50","10","25","42"]} </code></pre> <p>The number 235724 is also used within a IMG url and need to become like "235724 X 65" for a selectable listbox.</p> <p>Solution was:</p> <pre><code>ObservableCollection<CreateItem> pitems = new ObservableCollection<CreateItem>(); for (int i = 0; i < rootObject.itemList.Count; i++) { var itemsku = rootObject.itemList[i]; var amount = rootObject.amount[i]; pitems.Add(new CreateItem() { pTitle = itemsku + " X " + amount , pImage = new BitmapImage(new Uri(string.Format("http://image.mgam79.nl/indb/{0}.jpg", itemsku)))}); } MyListBox.ItemsSource = pitems; public class CreateItem { public string pTitle { get; set; } public ImageSource pImage { get; set; } } </code></pre> |
25,179,324 | 0 | <p>change</p> <pre><code>strcat(ipstr,&ipch); </code></pre> <p>to</p> <pre><code>strncat(ipstr, &ipch, 1); </code></pre> <p>this will force appending only one byte from <code>ipch</code>. <code>strcat()</code> will continue appending some bytes, since there's no null termination character after the char you are appending. as others said, strcat might find somewhere in memory <code>\0</code> and then terminate, but if not, it can result in segfault. <br><br> from manpage:</p> <pre><code>char *strncat(char *dest, const char *src, size_t n); </code></pre> <p>The strncat() function is similar to strcat(), except that</p> <ul> <li>it will use at most n characters from src; and</li> <li>src does not need to be null-terminated if it contains n or more characters.</li> </ul> |
39,679,434 | 0 | <p>I feel your process(mosquitto) have hit the maximum number of open file descriptors limit. Check your max open files by <code>ulimit -n</code>. Then increase the limit to max number of connections expected by you. E.g. For 10k connection it would be <code>ulimit -n 10000</code></p> <p>A note on ulimit(<a href="http://ss64.com/bash/ulimit.html" rel="nofollow">1</a>). It is only set for the current terminal and for persistent changes you will need to edit config files as per your Linux flavor( <em>/etc/security/limits.conf</em> + <em>/etc/pam.d/common-session*</em> on Ubuntu ). </p> |
40,152,435 | 0 | Select2 Show Currently Searched Value <p>I'm using <a href="https://select2.github.io/" rel="nofollow">Selec2</a> framework to do this with ajax call, i'm successfully implement this in my project but why when enter value to search it's showing current search value as selectable option, even when no result, i wan't to hide this. Any suggestion? thanks</p> <p>Showing curent search value and it's selectable: <a href="https://i.stack.imgur.com/bpj3j.png" rel="nofollow"><img src="https://i.stack.imgur.com/bpj3j.png" alt="enter image description here"></a></p> <p>Even when no result: <a href="https://i.stack.imgur.com/BHBAH.png" rel="nofollow"><img src="https://i.stack.imgur.com/BHBAH.png" alt="enter image description here"></a></p> <p>HTML:</p> <pre><code><select style='width:100%;' id='select-employee'></select> </code></pre> <p>JS:</p> <pre><code>$("#select-employee").select2({ theme: "bootstrap", placeholder: "Select employee...", minimumInputLength: 1, tags: [], ajax: { url: "getEmployee.php", dataType: "json", type: "POST", delay: 250, data: function(params) { return { term: params.term, page: params.page }; }, processResults: function(data, params) { params.page = params.page || 0; return { results: data.items, pagination: { more: (data.page == "1" ? true : false) } }; }, cache: true } }); </code></pre> |
1,429,831 | 0 | Saving data in rails session to use in form on next request <p>Let's say I have a table called positions (as in job positions). On the position show page I display all the detail about the job - awesome. At the bottom I need the prospective applicant to input their professional license # before continuing onto the next page which is the actual applicant creation form. I also need to take that license # and have it populate that field on the applicant form (again on the proceeding page).</p> <p>I realize there are a couple ways to do this. Possibly the more popular option would be to store that value in the session. I am curious how to do this in the simplest manner?</p> <p>My idea:</p> <ol> <li>Create a table specifically for license #'s.</li> <li>Add a small form on the position show page to create license # (with validation)</li> <li>Store newly created license in session - not sure what to put in which controller?</li> <li>On applicant creation form populate from session the license #.</li> </ol> <p>This would assume applicants only have one license.</p> <p>Thoughts?</p> <p>Appreciate the help!</p> |
20,237,644 | 0 | <p>Creating snapshots in VHD works by putting an overlay over the existing VHD image, so that any change get written into the overlay file instead of overwriting existing data. For reading the top-most data is returned: either the data from the overlay if that sector/cluster was already over-written, or from the original VHD file if it was not-yet over-written.</p> <p>The vhd-util command creates such an overlay-VHD-file, which uses the existing VHD image as its so-called "backing-file". It is important to remember, that the backing-file must never be changed while snapshots still using this backing-file exist. Otherwise the data would change in all those snapshots as well (unless the data was overwritten there already.)</p> <p>The process of using backing files can be repeated multiple times, which leads to a chain of VHD files. Only the top-most file should ever be written to, all other files should be handled as immutable.</p> <p>Reverting back to a snapshot is as easy as deleting the current top-most overlay file and creating a new empty overlay file again, which again expose the data from the backing file containing the snapshot. This is done by using the same command again as above mentioned. This preserves your current snapshot and allows you to repeat that process multiple times. (renaming the file would be more like "revert back to <strong>and</strong> delete last snapshot".)</p> <p><strong>Warning:</strong> before re-creating the snapshot file, make sure that no other snapshots exists, which uses this (intermediate) VHD file as its backing file. Otherwise you would not only loose this snapshot, but all other snapshots depending on this one.</p> |
13,614,770 | 0 | <p>I simply created Drupal nodes programmatically. Turned out to be easiest.</p> |
6,649,286 | 0 | <p>It depends, its ok for you to retain the variable in View Controller 2. Because each controller will be responsible for theirs variables. If instead, you assign your variable, even if you are using the variable in the second controller, it will be the first controller the responsible.</p> |
27,093,061 | 0 | android calender events handling library <p>Is there any open source library to add/remove/update calendar events in android devices? (android 2.3.x and above)</p> <p>I am looking at adding events "silently", meaning injecting them into the users calendar</p> |
30,315,780 | 0 | <p>Given your data (where the values are the same in the two columns if they are both there), then:</p> <pre><code>select distinct coalesce(a, b) from table t; </code></pre> <p>If that condition doesn't hold, then you need a <code>union</code>, which Giorgi's answer explains.</p> |
1,664,281 | 0 | <p>After the page has initialized, set the ddlFeeds.SelectedIndexChanged += null. You will need to do this on every load, irregardless of postback.</p> <p>A better plan would be to just eliminate the OnSelectedIndexChanged attribute from the ASPX template.</p> |
32,750,111 | 0 | <p>You can make the whole table read-only like this:</p> <pre><code> self.projectView.setEditTriggers(QAbstractItemView.NoEditTriggers) </code></pre> <p><strong>EDIT</strong>:</p> <p>If you also want to prevent copying of cells, you will need to kill the relevant keyboard shortcuts. Below is some example code that does that:</p> <pre><code>from PySide import QtGui, QtCore class Window(QtGui.QWidget): def __init__(self, rows, columns): super(Window, self).__init__() self.table = QtGui.QTableView(self) model = QtGui.QStandardItemModel(rows, columns, self.table) for row in range(rows): for column in range(columns): item = QtGui.QStandardItem('(%d, %d)' % (row, column)) model.setItem(row, column, item) self.table.setModel(model) self.table.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) layout = QtGui.QVBoxLayout(self) layout.addWidget(self.table) self.table.installEventFilter(self) def eventFilter(self, source, event): if (source is self.table and event.type() == QtCore.QEvent.KeyPress and event == QtGui.QKeySequence.Copy): return True return super(Window, self).eventFilter(source, event) if __name__ == '__main__': import sys app = QtGui.QApplication(sys.argv) window = Window(5, 5) window.setGeometry(600, 300, 600, 250) window.show() sys.exit(app.exec_()) </code></pre> |
17,739,042 | 0 | <blockquote> <p>Is there a better alternative to TortoiseSVN which can be used as a clinet?</p> </blockquote> <p>If you are using an IDE, check out plugins for working with version control systems. (a.k.a. Team Synchronization, Collaboration, etc.) Sometimes it can be real time saver.</p> |
20,018,771 | 0 | <p>Use a javascript function that uses innerHTML. </p> <p>For example:</p> <pre><code>function clickable(){ document.getElementById('clickable').innerHTML = "content"; } </code></pre> <p>Use onClick to call it </p> <pre><code><div id="click" onClick="javascript:clickable();">Click me!</div> </code></pre> <p>It's easier to explain with a js fiddle</p> <p>JSFiddle: <a href="http://jsfiddle.net/rJ3KS/" rel="nofollow">http://jsfiddle.net/rJ3KS/</a> </p> <p>Edit: I think this is what you want: <a href="http://jsfiddle.net/rJ3KS/1/" rel="nofollow">http://jsfiddle.net/rJ3KS/1/</a></p> |
1,249,037 | 0 | Resizing HBox width to fit content <p>I have an HBox with a fixed Width and Height and a Border. In that HBox I have a viewStack with a few different views. When the viewStack changes views, I want the HBox container to keep resizing to its content. Currently it stays at the fixed width. Is there any way to do that with an HBox setting?</p> |
28,079,643 | 0 | Rails 4 Bootstrap partial styling <p>I've been having trouble integrating bootstrap-sass into any of my Rails 4 projects. So far i'm only getting partial rendering of the bootstrap assets. I've resorted to using using the railstutorial.org in my search for bootstrap functionality. I'm using the ch5 (listing 5.4) source code yielding the following results:</p> <p>The classes btn-lg, btn-primary, and navbar-right classes are working. The page yields buttons and a partially structured navbar with the links to the right. However, the navbar classes for the most part are not working. The navbar has no 'inverse' styling, the entire div is washed out with no text styling whatsoever.</p> <p>I've been using 'rake assets:precompile' and restarting the server after every update to the assets pipeline.</p> <p><em>Gemfile</em> contains the following above the 'jquery-rails' gem</p> <pre><code>gem 'rails', '4.2.0' gem 'bootstrap-sass', '~> 3.3.3' gem 'sass-rails', '>= 3.2' </code></pre> <p>custom.css.scss</p> <pre><code>@import "bootstrap-sprockets"; @import "bootstrap" </code></pre> <p><em>application.html.erb</em></p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html> <html> <head> <title><%= full_title(yield(:title)) %></title> <%= stylesheet_link_tag "application", :media => "all" %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> <!--[if lt IE 9]> <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js"> </script> <![endif]--> </head> <body> <div class="navbar navbar-fixed-top navbar-inverse"> <div class="container"> <%= link_to "sample app", '#', id: "logo" %> <nav> <ul class="nav navbar-nav navbar-right"> <li><%= link_to "Home", '#' %></li> <li><%= link_to "Help", '#' %></li> <li><%= link_to "Log in", '#' %></li> </ul> </nav> </div> </div> <div class="container"> <%= yield %> </div> </body> </html></code></pre> </div> </div> </p> <p>Buttons in <em>home.hrml.erb</em></p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code><% provide(:title, "Home") %> <div class="center jumbotron"> <h1>Welcome to the Sample App</h1> <h2> This is the home page for the <a href="http://www.railstutorial.org/">Ruby on Rails Tutorial</a> sample application. </h2> <%= link_to "Sign up now!", '#', class: "btn btn-lg btn-primary" %> </div> <%= link_to image_tag("rails.png", alt: "Rails logo"), 'http://rubyonrails.org/' %></code></pre> </div> </div> </p> |
11,240,753 | 0 | <p>I found the solution, use replaceFilters outside from object (after declaration).</p> <pre><code>myns.test.util = { myOne: function(m) { return m; }, myTwo: function(m) { return m; }, processAllFunction: function(m) { for(var i=0; i<this.replaceFilters.length; i++) { if(typeof(this.replaceFilters[i])==='function') { m= this.replaceFilters[i](m); } } console.log(this.replaceFilters); return m; } }; myns.test.util.replaceFilters = [this.myOne, this.myTwo]; </code></pre> <p>with this method, I don't have problem with <code>this</code>.</p> |
26,172,001 | 0 | <p>Many answers here discuss the potential overflow issues of using <code>scanf("%s", buf)</code>, but the latest POSIX specification more-or-less resolves this issue by providing an <code>m</code> assignment-allocation character that can be used in format specifiers for <code>c</code>, <code>s</code>, and <code>[</code> formats. This will allow <code>scanf</code> to allocate as much memory as necessary with <code>malloc</code> (so it must be freed later with <code>free</code>).</p> <p>An example of its use:</p> <pre><code>char *buf; scanf("%ms", &buf); // with 'm', scanf expects a pointer to pointer to char. // use buf free(buf); </code></pre> <p>See <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fscanf.html" rel="nofollow">here</a>. Disadvantages to this approach is that it is a relatively recent addition to the POSIX specification and it is not specified in the C specification at all, so it remains rather unportable for now.</p> |
5,489,994 | 0 | <p>Well, there are already some solutions here but, just because it was fun:</p> <pre><code>$values = array( '/www/htdocs/1/sites/lib/abcdedd', '/www/htdocs/1/sites/conf/xyz', '/www/htdocs/1/sites/conf/abc/def', '/www/htdocs/1/sites/htdocs/xyz', '/www/htdocs/1/sites/lib2/abcdedd' ); function findCommon($values){ $common = false; foreach($values as &$p){ $p = explode('/', $p); if(!$common){ $common = $p; } else { $common = array_intersect_assoc($common, $p); } } return $common; } function removeCommon($values, $common){ foreach($values as &$p){ $p = explode('/', $p); $p = array_diff_assoc($p, $common); $p = implode('/', $p); } return $values; } echo '<pre>'; print_r(removeCommon($values, findCommon($values))); echo '</pre>'; </code></pre> <p>Output:</p> <pre><code>Array ( [0] => lib/abcdedd [1] => conf/xyz [2] => conf/abc/def [3] => htdocs/xyz [4] => lib2/abcdedd ) </code></pre> |
9,521,225 | 0 | How to suppress objective C analyser warning with categories <p>I'm using the static code analyser in objective C and I found that using categories to spread a big file in multiple files causes the following problem:</p> <pre><code>@interface TestClass : UIViewController @property (nonatomic, assign) UITableView* myTableView; @end @implementation TestClass @end @interface TestClass (someCategory) @end @implementation TestClass (someCategory) - (void) someMethod { // ... CGRect tableViewRect = CGRectMake( sectionRect.origin.x, sectionRect.origin.y + sectionRect.size.height + 1.0, sectionRect.size.width, tableViewHeight); myTableView = [[UITableView alloc] initWithFrame:(CGRect) tableViewRect style:(UITableViewStyle) UITableViewStylePlain]; [self.view addSubView: (UIView*) myTableView]; [myTableView release]; } @end </code></pre> <p>Problem # 1: Compiling TestClass(someCategory) gives me an error "use of undeclared identifier 'theArray'". -> Adding the prefix "self.myTableView" seems to fix the problem.</p> <p>Problem # 2: Once I have added the "self." prefix before "myTableView", the code analyser complains "incorrect decrement of the reference count of an object that is not owned at this point by the caller" ->I have seen this before in my code: easy to fix by removing the "self." prefix in other, non categorized classes.</p> <p>So I have a catch 22 situation! - I can't have a class category without prefixing the properties that I use with "self." - The code analyser gives me warnings because it does not seem to understand that my category owns an object that it allocates and frees.</p> <p>Fixing either of these two problems would work for me (a) finding a way to avoid specifying the ".self" prefix when referencing an attribute from my category implementation (b) finding a way to make the code analyser happy with the fact that I own "self.xxx" where "xxx" is a property of the class that I am categorizing.</p> |
40,208,611 | 0 | issue with creating a one dimensional array of structs in C <p>So the issue is for my project I have to pretty much create an inverse table page for my operating systems class. The TA wrote down some basic code to get started. To create the table, he said the table should be a struct that * includes metadata such as page size and the number of pages along the translation * table (that can be a 2-dimensional array, or a one-dimensional array of structs) so here is the code:</p> <pre><code>#include <stdio.h> #include <stdlib.h> #define N 500 struct invTablePage{ invTablePage page[N]; }; struct table { int numOfPages; int pageSize; int array[struct invTablePage]; }; void initInverted(struct invTablePage **invTable, int memSize, int frameSize); int translate(struct invTablePage *invTable, int pid, int page, int offset); void releaseInverted(struct invTablePage **invTable); </code></pre> <p>however when i compile the code it gives me this</p> <pre><code>error: expected expression before ‘struct’ error: array type has incomplete element type struct invTablePage page[N]; </code></pre> <p>I have tried using size of but that doesnt work. Apparently int array[struct invTablePage] can be done but i dont understand how that even is supposed to work if it makes more sense trying to get the size of the struct. As far as array type has incomplete element error, i am not sure about that one if i already declared my struct of type invTablePage so it should be working. Any help would be appreciated</p> |
36,769,578 | 0 | <p>We run in the same issue recently. The way to overcome this was to remove the Utility Project from the eclipse workspace, as dependecies were resolved via maven poms anyway.<br> After that, the client under <code>Java EE Tools > Remove EJB Client</code> (and thus in <em>ejb.dd.clientjar</em>) was set correctly.<br> Probably some bug similar to this <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=122274" rel="nofollow">https://bugs.eclipse.org/bugs/show_bug.cgi?id=122274</a>.</p> |
10,073,563 | 0 | <p>As a basic starting point, this is a popular framework:</p> <p><a href="http://expressjs.com/" rel="nofollow">http://expressjs.com/</a></p> <p>Here you will find some links to example applications:</p> <p><a href="http://stackoverflow.com/questions/3823403/node-js-web-application-examples-tutorials">Node.js Web Application examples/tutorials</a></p> <p><a href="https://github.com/heroku/facebook-template-nodejs" rel="nofollow">https://github.com/heroku/facebook-template-nodejs</a></p> <p><a href="http://stackoverflow.com/questions/9114176/open-source-node-js-and-express-projects">Open Source Node.js (and Express) projects</a></p> |
10,461,569 | 0 | <p>Add a CSS <code>white-space</code> property with value of <code>nowrap</code> to <code>.top_column1</code>.</p> <p>By the way, this can better be a 2-column table where the 1st column has a width of <code>100%</code> and the 2nd column contains those language buttons. Or just use a div and float the language buttons right.</p> |
7,726,609 | 0 | Create new node references for the node reference field <p>Is there a module besides <a href="http://drupal.org/project/noderefcreate" rel="nofollow">http://drupal.org/project/noderefcreate</a> that allows a full from to be popped up/embedded to create a new node reference from a node reference field?</p> |
17,185,675 | 0 | How to create divs with static size <p>I need some advices on how to create a website in a way that it will keep its size on every resolution.</p> <p>I've tried in many ways but I never made it work, and it's hard to understand responsive web design because I can't find it in my language. I just want some brief advices, and simple explanations about how to keep resolutions of content divs on different resolutions in CSS/HTML </p> <p><code><a href="http://jsfiddle.net/gW9vv/" rel="nofollow">Here's</a></code> what I've tried until now but it didn't work:</p> <p>There are just the codes without images, its just a way to see what I did wrong and what I should do.</p> |
23,315,569 | 0 | <p>First, you need to know <em>What is a string in C?</em>. A string is an array of non-zero bytes (<code>char</code>), usually printable characters, which terminate in a null (zero, represented by the character <code>'\0'</code>).</p> <p>Then, you need to know how a <code>for</code> loop works:</p> <pre><code>for ( initial condition ; test condition ; loop expression ) { // some code } // Code after the loop </code></pre> <p>The <code>for</code> loop will:</p> <ol> <li>Execute <em>initial condition</em></li> <li>Execute <em>test condition</em> and, if it's TRUE (non-zero) will execute <em>some code</em>. Otherwise, if it's FALSE (zero) it will EXIT the loop and go to the <em>Code after the loop</em>.</li> <li>Execute <em>loop expression</em></li> <li>Go to 2</li> </ol> <p>With the basics out of the way, let's look at the function given by the teacher:</p> <pre><code>int length(char *word) { int i; for (i = 0; word[i] != '\0'; i++) { { } } return i; } </code></pre> <p>The meat of the function is the <code>for</code> loop: It then goes through the <code>for</code> loop steps:</p> <ol> <li>Initially, <code>i</code> is set to <code>0</code>. <code>i</code> represents the index into the string (array of <code>char</code>).</li> <li>Check if <code>word[i] != '\0'</code> (in other words, if this is TRUE, then it's not the end of the string). There's no code inside the loop to execute, so we go right to step 3.</li> <li>The <em>loop expression</em> is executed, which is incrementing <code>i</code>, the string (<code>char</code> array) index, meaning we are now pointing to the next character in the string.</li> </ol> <p>If your word is, "cat", then the array is <code>{ 'c', 'a', 't', '\0' }</code>. So the loop steps will do this:</p> <ol> <li>Set <code>i</code> to <code>0</code>.</li> <li>Check <code>word[0] != '\0'</code>, which checks <code>'c' != '\0'</code>. This is TRUE because <code>'c'</code> is NOT equal to <code>'\0'</code>.</li> <li>Take <code>i++</code> (increment <code>i</code>), so now <code>i</code> is <code>1</code>.</li> <li>Check <code>word[1] != '\0'</code>, which checks <code>'a' != '\0'</code>. This is TRUE because <code>'a'</code> is NOT equal to <code>'\0'</code>.</li> <li>Take <code>i++</code> (increment <code>i</code>), so now <code>i</code> is <code>2</code>.</li> <li>Check <code>word[2] != '\0'</code>, which checks <code>'t' != '\0'</code>. This is TRUE because <code>'t'</code> is NOT equal to <code>'\0'</code>.</li> <li>Take <code>i++</code> (increment <code>i</code>), so now <code>i</code> is <code>3</code>.</li> <li>Check <code>word[3] != '\0'</code>, which checks <code>'\0' != '\0'</code>. This is FALSE because <code>'\0'</code> is equal to <code>'\0'</code>.</li> <li>The loop ends now because the <em>test condition</em> has become FALSE.</li> </ol> <p>What's the value of <code>i</code> at the end of the loop? It's <code>3</code>, which is the length of the string because we kept stepping through the string, one character at a time, incrementing <code>i</code> from <code>0</code> until we hit the spot after the last character of the string, which is <code>'\0'</code>.</p> <p>The function then returns <code>i</code>, the length of the string.</p> <p>HTH</p> |
1,606,965 | 0 | SQL Server Replication <p>What is difference between 3 type of replication? Is replication suitable for data archiving? What is the replication steps?</p> |
32,648,375 | 0 | <p>OK, I found a solution and I'll post it here to help others. <a href="http://www.tutorialforandroid.com/2010/11/drawing-with-canvas-in-android-saving.html" rel="nofollow">This is the link</a> that helped me, and this is the sample of code that I needed. (it was hard to find).</p> <pre><code> public void run() { Canvas canvas = null; while (_run){ try{ canvas = mSurfaceHolder.lockCanvas(null); if(mBitmap == null){ mBitmap = Bitmap.createBitmap (1, 1, Bitmap.Config.ARGB_8888);; } final Canvas c = new Canvas (mBitmap); c.drawColor(0, PorterDuff.Mode.CLEAR); commandManager.executeAll(c); canvas.drawBitmap (mBitmap, 0, 0,null); } finally { mSurfaceHolder.unlockCanvasAndPost(canvas); } } } </code></pre> <p>}</p> |
34,695,860 | 0 | BFS for pacman ghost <p>I've been several days with this problem. I've searched in this forum, and in google for a solution without any luck. My problem is I am not able to make a working BFS algorithm for managing the behaviour of a pacman ghost. I think I am ignoring something in the code. I'll paste the code here, if you can help me you'll be thanked :) pacman is number 2, and ghost is number 3.</p> <pre><code>Queue<Tile> path = new LinkedList<>(); Tile start = new Tile(canvas.g1.x, canvas.g1.y, 3); Tile end = new Tile(canvas.pacman.x, canvas.pacman.y, 2); start.distance = 1; path.add(start); while (!path.isEmpty()) { Tile current = path.remove(); System.out.println(path.size()); canvas.walls[current.y][current.x] = 0; if (canvas.walls[current.y][current.x] == canvas.walls[end.y][end.x]) { end = current; System.out.println("pacman found"); break; } ArrayList<Tile> list = adyacent(current); for (Tile c : list) { if (c.distance == 0) { c.distance = current.distance + 1; path.add(c); canvas.walls[c.y][c.x] = 20; for (Tile v : path) { System.out.println("x: " + v.x + " / y: " + v.y + " / distance: " + v.distance); } } } } int dist = end.distance; System.out.println("Recolection ended, size: " + dist); </code></pre> <p>The class Tile():</p> <pre><code>public class Tile { public int x; public int y; public int distance; public int personaje; public Tile(int x, int y, int personaje) { this.x = x; this.y = y; this.personaje = personaje; distance = 0; } } </code></pre> <p>and the method adyacent():</p> <p>in this method, the numbers I check are the ones with wall(each one with a diferent drawing))</p> <pre><code>public ArrayList<Tile> adyacent(Tile c) { ArrayList<Tile> surrounding = new ArrayList<>(); int ant; ant = canvas.walls[c.y][c.x + 1]; if ((ant != 7) && (ant != 8) && (ant != 9) && (ant != 11) && (ant != 12) && (ant != 13) && (ant != 14) && (ant != 15) && (ant != 16)) { surrounding.add(new Tile(c.x + 1, c.y, 3)); } ant = canvas.walls[c.y][c.x - 1]; if ((ant != 7) && (ant != 8) && (ant != 9) && (ant != 11) && (ant != 12) && (ant != 13) && (ant != 14) && (ant != 15) && (ant != 16)) { surrounding.add(new Tile(c.x - 1, c.y, 3)); } ant = canvas.walls[c.y + 1][c.x]; if ((ant != 7) && (ant != 8) && (ant != 9) && (ant != 11) && (ant != 12) && (ant != 13) && (ant != 14) && (ant != 15) && (ant != 16)) { surrounding.add(new Tile(c.x, c.y + 1, 3)); } ant = canvas.walls[c.y - 1][c.x]; if ((ant != 7) && (ant != 8) && (ant != 9) && (ant != 11) && (ant != 12) && (ant != 13) && (ant != 14) && (ant != 15) && (ant != 16)) { surrounding.add(new Tile(c.x, c.y - 1, 3)); } return surrounding; } </code></pre> <p>What I've observed is that it never reaches the System.out in which I return the size of the path. Also, where I see the size of the Queue, it seems right, but the System.out in which I see "x" and "y" and "distance" is bigger each time, much much bigger.</p> <p>I set that the checked tiles change it's color, changing the number which I've got in the array: 0 is floor, 20 is transparent green. And it remains in center, and beggins to work slower and slower.</p> <p>Forget to say that it never finds pacman :( thanks!</p> |
2,585,871 | 0 | <p>More interesting questions are : </p> <ol> <li><p>under what conditions will Stop() be executed on a different processor than Start()?<br> .<br> In most application scenarios, the answer is "none". </p></li> <li><p>under what conditions will the clock speed of a processor change during a measured interval?<br> .<br> In CPU-intensive benchmarks, "none". </p></li> </ol> |
2,225,392 | 0 | <p>This issue/topic is being discussed in depth at <a href="http://www.qcodo.com/forums/forum.php/3/4007/" rel="nofollow noreferrer">http://www.qcodo.com/forums/forum.php/3/4007/</a></p> |
22,179,955 | 0 | <p>When you have signed 16-bit samples, you should use a signed 16-bit data type for your buffer:</p> <pre><code>typedef short int s16; s16 *buffer = malloc(size_in_bytes); </code></pre> <p>(You should use <code>SND_PCM_FORMAT_S16</code> to get the endianness correct.)</p> <p>In the buffer, every four values are one frame.</p> <pre><code>for (i = 0; i < capture; i++) { ch1 = buffer[i * 4 + 0]; ch2 = buffer[i * 4 + 1]; ch3 = buffer[i * 4 + 2]; ch4 = buffer[i * 4 + 3]; // or use a loop over 0..3 ... } </code></pre> <p>Alternatively, if you want to access all the samples of one specific channel, go over the buffer in steps of four:</p> <pre><code>// for the first channel for (i = 0; i < capture; i++) { sample = buffer[i * 4 + 0]; ... } </code></pre> |
2,424,660 | 0 | <p>setAttribute is broken in IE7 and lower. </p> <p>Use</p> <pre><code>div.className = 'pano_img_cont' </code></pre> <p>instead.</p> <hr> <p>IE's implementation of setAttribute is effectively:</p> <pre><code>HTMLElement.prototype.setAttribute = function (attribute, value) { this[attribute] = value; } </code></pre> <p>… which is fine so long as the attribute name and the DOM property name are the same. <code>class</code>, however, is a reserved keyword in JS so the property is called <code>className</code> instead. This breaks in IE.</p> <p>If you set the property directly, it works everywhere.</p> |
29,575,715 | 0 | <p>this is not jboss problem , if you want the better performance Use Load Balancer to divide threads between servers. </p> |
31,206,901 | 0 | <p>You have used min-width: 969px on different secitons of this page layout. Header image is missing this min-width. Add it to .homeSlide .bcg</p> |
38,319,476 | 0 | <p>Here are a couple of tricks I found. Credit goes to Codemanx for the original solution of</p> <blockquote> <pre><code>array.sort(function() { return 1; }) </code></pre> </blockquote> <p>In Typescript, this can be simplified to just one line</p> <pre><code>array.sort(() => 1) </code></pre> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var numbers = [1,4,9,13,16]; console.log(numbers.sort(() => 1));</code></pre> </div> </div> </p> <p>Since this will be the future of JavaScript, I thought I'd share that.</p> <p>Here's another trick if your array only has 2 elements</p> <pre><code>array.push(array.shift()); </code></pre> |
5,950,061 | 0 | <pre><code>[NotMapped] public int ThreadsInBoard { get { ForumContextContainer ctx = new ForumContextContainer(); int thr = ctx.ThreadSet.Count(p => p.BoardID == this.BoardID); } } </code></pre> <p>assuming this class has the boardId property</p> |
17,778,646 | 0 | Hiding the RecognizerUI in Windows Phone 8 Apps <p>Is it possible to hide the RecognizerUI when using the Windows Phone 8 voice recognition?</p> <p>Basically, I want enable my app to start listening but to have the current page of my app still displayed. I would like my app to be listening all the time without the pop up.</p> <p>Is this at all possible?</p> <p>Thank you.</p> |
37,391,061 | 0 | <p>What you are doing here is creating an anonymous method that calls each service in turn and then executes that method in a parallel task. What you need is a task array.</p> <pre><code>List<Task> taskList = new List<Task>(); Task task1= Task.Factory.StartNew(() => var List1 = client1.GetList1();); Task task2= Task.Factory.StartNew(() => var List2 = client1.GetList2();); // and so forth taskList.Add(task1); taskList.Add(task2); Task.WaitAll(taskList.ToArray()); </code></pre> |
11,493,375 | 0 | Windows Service to run batch file, InstallUtil /i prevents service from starting? <p>I have a simple Windows service that calls a batch file to setup some processes on startup. Most of the batch file is fired correctly but InstallUtil /i fails to run as the Windows Service fails to start. (InstallUtil /u beforehand works though which I find strange) Here's some code for the windows service and the batch file:</p> <pre><code>namespace RecipopStartupService { public partial class Service1 : ServiceBase { public Service1() { InitializeComponent(); } protected override void OnStart(string[] args) { ProcessBatchFile(); } public void ProcessBatchFile() { Process process = new Process(); process.StartInfo.WorkingDirectory = "C:\\Webs\\AWS\\"; process.StartInfo.FileName = "C:\\Webs\\AWS\\setup.bat"; process.StartInfo.Arguments = ""; process.StartInfo.Verb = "runas"; process.StartInfo.UseShellExecute = false; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardOutput = false; process.Start(); System.IO.StreamReader myOutput = process.StandardOutput; process.WaitForExit(200000); if (process.HasExited) { string results = myOutput.ReadToEnd(); } } protected override void OnStop() { } } } </code></pre> <p>The batch file:</p> <pre><code>"C:\Program Files (x86)\Subversion\bin\SVN.exe" cleanup "C:\Webs\AWS\webs" "C:\Program Files (x86)\Subversion\bin\SVN.exe" cleanup "C:\Webs\AWS\apps" "C:\Program Files (x86)\Subversion\bin\SVN.exe" update "C:\Webs\AWS\webs" REM The following directory is for .NET 2.0 set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319 set PATH=%PATH%;%DOTNETFX2% echo Uninstalling MyService... echo --------------------------------------------------- InstallUtil /u "C:\Webs\AWS\apps\MyService.exe" echo --------------------------------------------------- echo Done. "C:\Program Files (x86)\Subversion\bin\SVN.exe" update "C:\Webs\AWS\apps" REM The following directory is for .NET 2.0 set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319 set PATH=%PATH%;%DOTNETFX2% echo Installing MyService... echo --------------------------------------------------- InstallUtil /i "C:\Webs\AWS\apps\MyService.exe" echo --------------------------------------------------- echo Done. NET START MyService </code></pre> <p>I've commented out various parts to determine what stops the service from starting. It's the InstallUtil /i section as I said previously.</p> <p>If someone could advise that'd be great.</p> <p>Thanks, Colin</p> |
5,703,828 | 0 | <p>Just to add to the Matt Ball's comment and CommonsWare's answer in the other question:</p> <p>I realized that there are a phones out there which play the shutter sound on their own. In this case, it seems to not be possible to disable the shutter sound.</p> |
24,884,399 | 1 | How to perform a simple signal backtest in python pandas <p>I want to perform a simple and quick backtest in pandas by providing buy signals as DatetimeIndex to check against ohlc quotes DataFrame (adjusted close price) and am not sure if I am doing this right.</p> <p>To be clear I want to calculate the cummulated returns of all swapping buy signals (and stock returns as well?) over the whole holding period. After that I want to compare several calculations via a simple sharpe function. Is this the right way to test a buy singal quick and easy in pandas?</p> <p>Any help is very appreciated!</p> <p>signals:</p> <pre><code>In [216]: signal Out[216]: <class 'pandas.tseries.index.DatetimeIndex'> [2000-08-21, ..., 2013-07-09] Length: 21, Freq: None, Timezone: UTC </code></pre> <p>ohlc:</p> <pre><code>In [218]: df.head() Out[218]: open high low close volume amount Date 2000-01-14 00:00:00+00:00 6.64 6.64 6.06 6.08 74500 4.91 2000-01-17 00:00:00+00:00 6.30 6.54 6.25 6.40 45000 5.17 2000-01-18 00:00:00+00:00 7.56 8.75 7.51 8.75 250200 7.07 </code></pre> <p>backtest:</p> <pre><code>analysis = pd.DataFrame(index=df.index) #calculate returns of adjusted close price analysis["returns"] = df['amount'].pct_change() #set signal returns to quote returns where there is a signal DatetimeIndex and ffill analysis["signal"] = nan analysis["signal"][signal] = analysis["returns"][signal] analysis["signal"] = analysis["signal"].fillna(method="ffill") #calculation of signal returns trade_rets = analysis["signal"].shift(1)*analysis["returns"] </code></pre> <p>expected result (values of buy_returns are not correct):</p> <pre><code>Out[2]: returns buy_returns Date 2000-08-21 00:00:00+00:00 -0.153226 -0.076613 2001-02-12 00:00:00+00:00 0.000000 0.000000 2002-10-29 00:00:00+00:00 0.246155 0.030769 2003-02-12 00:00:00+00:00 0.231884 0.014493 2003-03-12 00:00:00+00:00 1.548386 0.048387 </code></pre> <p>My question really is how do I have to calculate a returns Series to represent the strength of a provided buy signal (True/ False Series or Datetimeindex) in pandas? </p> |
26,430,204 | 0 | <p>There is a comment thread here: <a href="https://github.com/twbs/bootstrap/issues/2415" rel="nofollow">https://github.com/twbs/bootstrap/issues/2415</a> and NONE of the solutions work as smoothly as this.</p> <p><strong>SOURCE: <a href="http://timforsythe.com/blog/hashtabs/" rel="nofollow">http://timforsythe.com/blog/hashtabs/</a></strong></p> <h2>DEMO: <a href="https://jsbin.com/quvelo/2/" rel="nofollow">https://jsbin.com/quvelo/2/</a></h2> <p><em>This solution links to tabs outside, inside, and wherever you want with a regular url.</em></p> <pre><code> $(window).load(function() { // cache the id var navbox = $('.nav-tabs'); // activate tab on click navbox.on('click', 'a', function (e) { var $this = $(this); // prevent the Default behavior e.preventDefault(); // send the hash to the address bar window.location.hash = $this.attr('href'); // activate the clicked tab $this.tab('show'); }); // will show tab based on hash function refreshHash() { navbox.find('a[href="'+window.location.hash+'"]').tab('show'); } // show tab if hash changes in address bar $(window).bind('hashchange', refreshHash); // read has from address bar and show it if(window.location.hash) { // show tab on load refreshHash(); } }); </code></pre> <p>You put this js AFTER your bootstrap.js inside the functions where you call the tooltip or popover (for example). I have a bootstrap-initializations.js file loaded after bootstrap.min.js in my document.</p> <p><em>USAGE: The same as you would use to link to an anchor:</em></p> <pre><code><a href="mypage.html#tabID">Link</a> </code></pre> |
25,321,785 | 0 | <p>In your <code>for</code> loop, you created <code>var category</code> which is already a variable</p> <pre><code>$scope.browseCategories = function(category, moveTo) { //looping in order to create a new <ul> of children categories. var html = "<ul class='unstyled'>"; for (var I = 0; I < category.Children.length; ++I) { var category = category.Children[I]; ^^^^^^^^ </code></pre> <p>Try renaming that and see.</p> <p>This might do whatever you are trying to achieve. Hope that helps.</p> <p>But when you're doing it in angular, the best practice is to avoid any other libraries like jQuery and try to achieve it in the angular way. Angular is so powerful.</p> <p>See this SO post: <a href="http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background">How do I "think in AngularJS" if I have a jQuery background?</a></p> |
16,573,325 | 0 | <p>You can implement both schemes cache expiration by using CacheEntryChangeMonitor. Insert a cache item without information with absolute expiration, then create a empty monitorChange with this item and link it with a second cache item, where you will actually save a slidingTimeOut information.</p> <pre><code> object data = new object(); string key = "UniqueIDOfDataObject"; //Insert empty cache item with absolute timeout string[] absKey = { "Absolute" + key }; MemoryCache.Default.Add("Absolute" + key, new object(), DateTimeOffset.Now.AddMinutes(10)); //Create a CacheEntryChangeMonitor link to absolute timeout cache item CacheEntryChangeMonitor monitor = MemoryCache.Default.CreateCacheEntryChangeMonitor(absKey); //Insert data cache item with sliding timeout using changeMonitors CacheItemPolicy itemPolicy = new CacheItemPolicy(); itemPolicy.ChangeMonitors.Add(monitor); itemPolicy.SlidingExpiration = new TimeSpan(0, 60, 0); MemoryCache.Default.Add(key, data, itemPolicy, null); </code></pre> |
25,455,968 | 0 | <p>I use the following:</p> <pre><code>loadRData <- function(fileName){ #loads an RData file, and returns it load(fileName) get(ls()[ls() != "fileName"]) } d <- loadRData("~/blah/ricardo.RData") </code></pre> |
25,528,716 | 0 | <p>Found an answer here: <a href="http://stackoverflow.com/questions/4237660/why-does-the-visual-studio-conversion-wizard-2010-create-a-massive-sdf-database">Why does the visual studio conversion wizard 2010 create a massive SDF database file?</a></p> <p>It turns out this is the code browser database, and I can delete it </p> |
35,978,420 | 0 | I keep getting an undefined method for a class <p>I've been searching and searching but I cannot find anything to help me with this. I am building an app that allows you to schedule a meeting in a room. The error I'm receiving is </p> <pre><code>undefined method 'room_id' for #<Room:0x007fa25cc51128> </code></pre> <p>Here is where the error is occuring in my <code>application.html.erb</code>:</p> <pre><code><li><%= link_to "Schedule a Meeting", new_room_meeting_path(@user, @meeting, @room.room_id)%></li> </code></pre> <p>Here is my meetings controller:</p> <pre><code>class MeetingsController < ApplicationController before_action :authenticate_user! def new @meeting = Meeting.new @rooms = Room.all @room = Room.find(params[:room_id]) end def index @meetings = Meeting.all end def show @meeting = Meeting.find(params[:id]) @comments = @meeting.comments @room = Room.find(params[:id]) end def create @user = User.find(params[:user_id]) @meeting = @user.meetings.create(meeting_params) NotificationMailer.meeting_scheduled(@meeting).deliver_now if @meeting.save redirect_to root_path, flash: { notice: "Congratulations!!! Your meeting has been scheduled successfully!!!"} else render :new end end private def meeting_params params.require(:meeting).permit(:name, :start_time, :end_time, :user_id, :room_id) end end </code></pre> <p>Here is my Meeting model:</p> <pre><code>require 'twilio-ruby' class Meeting < ActiveRecord::Base belongs_to :user belongs_to :room has_many :comments validates_presence_of :user_id, :room_id, :name def meeting_author_email user.try(:email) end def self.send_reminder_text_message(body, phone) @account_sid = ENV['twilio_account_sid'] @auth_token = ENV['twilio_auth_token'] @from_phone_number = ENV['twilio_phone_number'] @twilio_client = Twilio::REST::Client.new(@account_sid, @auth_token) @twilio_client.account.messages.create( to: phone, from: @from_phone_number, body: body ) end def start_timestamp (start_time - 6.hours).strftime('%b %e, %l:%M %p') end def end_timestamp (end_time - 6.hours).strftime('%b %e, %l:%M %p') end end </code></pre> <p>The correct URI is: <code>/rooms/:room_id/meetings/new(.:format)</code></p> <p>I don't know what the problem is and it is really frustrating me. Any help would be greatly appreciated. I've searched over and over and have been unable to resolve this.</p> <p>Thanks.</p> |
3,601,004 | 0 | <pre><code>import re if re.search("string_1|string_2|string_n", var_strings): print True </code></pre> <p>The beauty of python regex it that it returns either a regex object (that gives informations on what matched) or None, that can be used as a "false" value in a test.</p> |
25,461,655 | 0 | <p>Your calling the wrong values in the view. It should be:</p> <pre><code>Email: {{ $email }} Password: {{ $password }} </code></pre> <p>As a side point - you should not be calling <code>Mail::pretend()</code> in your code. You should be configuring this as part of your environment setup, so that while in dev mode, the mail pretend is set to true, and in production it is set to false.</p> |
36,154,549 | 0 | <p>You can try these solutions:</p> <ol> <li>Try to create launch images(640*960 @2x.png & 640*1136 [email protected]) and set them into project properties for "Launche images source".</li> </ol> <p>or</p> <ol start="2"> <li>Create .xib file with active autolayout and set this file as "launch screen file".</li> </ol> |
31,314,457 | 0 | GL_UNPACK_SWAP_BYTES was not declared in this scope & others <p>So i'm trying to use the <code>glPixelStorei</code> methods from OpenGL ES 2.0 in an NDK plugin i'm writing. After some fiddling with the includes, I can get it doing most things i want. However, there is an ongoing issue with getting the defined macros like in the title to work. Currently, eclipse is producing errors like the title for each of the macros in the first arguments of each call below: </p> <pre><code>glPixelStorei( GL_UNPACK_SWAP_BYTES, GL_FALSE ); glPixelStorei( GL_UNPACK_LSB_FIRST, GL_TRUE ); glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 ); glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0); glPixelStorei( GL_UNPACK_SKIP_ROWS, 0); </code></pre> <p>However, it shows <code>glPixelStorei( GL_UNPACK_ALIGNMENT, 0);</code> as error-free and even tells me <code>GL_UNPACK_ALIGNMENT</code> has a value of (<code>0x0CF5</code>). It will build fine without the above lines, but they provide some necessary functionality, so fixing it is the priority.</p> <p>I have included: <code>#include <GLES2/gl2.h></code> and <code>#include <EGL/egl.h></code></p> <p>Am I missing an include for macro definitions or is this an issue with OpenGL ES? I noticed after looking at the header files, there are no definitions for the problem macros.</p> <p>I wasn't sure how best to word this issue so i do apologize if this has been asked before, but i was not able to find any questions on the topic.</p> |
21,320,562 | 0 | <p>it might be a bug of hibernate, If you read (load() a proxy instance) and then call delete and save on it . <a href="https://hibernate.atlassian.net/browse/HHH-8374" rel="nofollow">https://hibernate.atlassian.net/browse/HHH-8374</a></p> |
17,184,489 | 0 | <p>e.target points to the a link inside the li. you should use <code>e.target.parentElement.id</code></p> |
37,644,798 | 0 | Cannot resolve method ... after inserted app indexing by accident <p>If you Inserted app indexing API code by mistake and an error like "Cannot resolve method ... " is popping up but cannot reverse it.</p> |
36,406,052 | 0 | error LNK2019 : unresolved external symbol. Adding the reference seems to double the definitions <p>I am working with a library, which is used by an application. When I compile the library, no compilation error is shown, but when I try to compile the application, the linker error LNK2019 is thrown, mentioning a function which is not present in the library.</p> <p>This can mean two things : <li> either the library is not found <li> either the library is found but the mentioned function is not present.</p> <p>I have already tried to recompile the application after having moved the library, and then he complains that the library is not found, so surely he finds the library but not the function inside.</p> <p>Further in the "Error List" window, next to the linker error message, I see the following information in the "File" column: <code>library.lib(object_file.obj)</code>, which indicates that he knows where he should look for that function (the mentioned function is not present in "object_file.c").</p> <p>When I include a file, containing the definition of that function, and I re-compile the library, I receive the following warning message <code>warning LNK4006: "int function(arguments) already defined in other_source_file.obj; second definition ignored</code>, although in "other_source_file.c" that function is not there.</p> <p>So I'm wondering how this is possible: <li> A function is missing, but when I add it, it seems to be present two times. <li> How does the compiler/linker know where he should be looking for that particular function?</p> <p>You're right, people, without any source code excerpt it's very difficult to handle this question. The function I have issues with, is the function "EXT_snprintf", which is referred upon by the function "snprintf" as you can see here:</p> <pre><code>#define snprintf _EXT_snprintf_f extern int snprintf(char* str, size_t size, const char* format, ...); </code></pre> <p>I've found this piece of code in a header file, belonging to the library. I don't find any implementation of <code>_EXT_snprintf_f</code> anywhere.</p> <p>As for the language, I have found the "/TP" flag in both compilation settings, mentioning that the compiler needs to treat the library and the application as C++ sources. (I've removed the "C" tag from the question)</p> <p>Does anybody have an idea?<br/> Thanks</p> |
16,940,680 | 0 | What is Localizing SQL Repository Definitions in ATG? <p>I read the documents but i don't clearly understand what is explained in this link. Can somebody explain in detail what it is and What the author tries to explain in that little explanation?</p> <p>here is the link:</p> <p><a href="http://docs.oracle.com/cd/E23095_01/Platform.93/RepositoryGuide/html/s0901localizingsqlrepositorydefinitio01.html" rel="nofollow">http://docs.oracle.com/cd/E23095_01/Platform.93/RepositoryGuide/html/s0901localizingsqlrepositorydefinitio01.html</a></p> |
2,829,988 | 0 | Webview blank but content is there <p>I am having trouble displaying a webview. I have a webview inside a custom view. I load this custom view as a subview of the window, and then have an object controller linking a text field to the content of the web view. Once a page is loaded, it loads all the content, but it is visually white. You can click on links. If you go to a Youtube video you can listen to it, but it still displays nothing. To load the custom view I run:</p> <pre><code>PageViewController *page = [[PageViewController alloc] initWithNibName:@"PageView" bundle:nil]; [page loadView]; [view addSubview:[page view]]; </code></pre> <p>Then to load the page I have the following:</p> <pre><code>-(IBAction)connectURL:(id)sender { NSLog(@"connecting"); [webView setMainFrameURL:[sender stringValue]]; } </code></pre> <p>Where connectURL is bound to a text field.</p> |
6,342,952 | 0 | <p>Use the String.Split function, as others have suggested. This will split your string into an array of strings. Then, identify which string in the array is the 'vs' string. Take the value of the index prior to 'vs' and after 'vs'. For example:</p> <pre><code>string input = "Which teams have faced eachother? - use Red vs Blue format"; string[] inputArray = input.Split( ' ' ); int vsLocation = 0; for ( int i = 0; i < inputArray.Length; i++ ) { if ( inputArray[i] == "vs" ) { vsLocation = i; break; } } if ( vsLocation > 0) { string team1 = inputArray[vsLocation - 1]; string team2 = inputArray[vsLocation + 1]; } </code></pre> |
36,304,680 | 0 | <p>Instead of using INDIRECT, add the following formula to a cell in the second row </p> <pre><code>=FILTER(C1:C-B2:B,LEN(C1:C)) </code></pre> <p>The above formula will automatically fill out the rows where the column C has a value. It assumes that Column B and Column C will have only numeric values.</p> <p>If necessary, adjust the cell references according to the row where the numeric values starts.</p> |
27,074,010 | 0 | <pre><code>public void actionPerformed(ActionEvent e) { String[] outputBoxButtonsPressed = outputBox.getText().split( " "); System.out.println(Arrays.toString(outputBoxButtonsPressed)); int answer = 0; boolean firstOperatorBeenUsed = false; for (int buttonPressed = 0; buttonPressed < outputBoxButtonsPressed.length - 2; buttonPressed++) { if (outputBoxButtonsPressed[buttonPressed + 1].equals("+") && !firstOperatorBeenUsed) { answer = answer + Integer .parseInt(outputBoxButtonsPressed[buttonPressed]) + Integer .parseInt(outputBoxButtonsPressed[buttonPressed + 2]); System.out.println(answer); firstOperatorBeenUsed = true; } else if (outputBoxButtonsPressed[buttonPressed + 1] .equals("+") && firstOperatorBeenUsed) { answer = answer + Integer .parseInt(outputBoxButtonsPressed[buttonPressed + 2]); } if (outputBoxButtonsPressed[buttonPressed + 1].equals("-") && !firstOperatorBeenUsed) { answer = answer + Integer .parseInt(outputBoxButtonsPressed[buttonPressed]) - Integer .parseInt(outputBoxButtonsPressed[buttonPressed + 2]); System.out.println(answer); firstOperatorBeenUsed = true; } else if (outputBoxButtonsPressed[buttonPressed + 1] .equals("-") && firstOperatorBeenUsed) { answer = answer - Integer .parseInt(outputBoxButtonsPressed[buttonPressed + 2]); } if (outputBoxButtonsPressed[buttonPressed + 1].equals("x") && !firstOperatorBeenUsed) { answer = answer + Integer .parseInt(outputBoxButtonsPressed[buttonPressed]) * Integer .parseInt(outputBoxButtonsPressed[buttonPressed + 2]); System.out.println(answer); firstOperatorBeenUsed = true; } else if (outputBoxButtonsPressed[buttonPressed + 1] .equals("x") && firstOperatorBeenUsed) { answer = answer * Integer .parseInt(outputBoxButtonsPressed[buttonPressed + 2]); } if (outputBoxButtonsPressed[buttonPressed + 1].equals("÷") && !firstOperatorBeenUsed) { answer = answer + Integer .parseInt(outputBoxButtonsPressed[buttonPressed]) / Integer .parseInt(outputBoxButtonsPressed[buttonPressed + 2]); System.out.println(answer); firstOperatorBeenUsed = true; } else if (outputBoxButtonsPressed[buttonPressed + 1] .equals("÷") && firstOperatorBeenUsed) { answer = answer / Integer .parseInt(outputBoxButtonsPressed[buttonPressed + 2]); } } outputBox.setText(outputBox.getText() + " = " + answer); } </code></pre> <p>Is this new equals button handler which works perfectly with all buttons. Yay :D</p> |
21,223,514 | 0 | <p>This sequence of commands clones your GitHub repository (or any other repository if you change the URL) to <code>~/local-repos</code>, initializes an empty repository in <code>~/remote-repos.git</code> and pushes from <code>~/local-repos</code> to <code>~/remote-repos.git</code> all branches.</p> <pre><code>git clone 'https://github.com/nhnc-nginx/apache2nginx' ~/local-repos git init --bare ~/remote-repos.git cd ~/local-repos git remote add mirror-server ~/remote-repos.git git push --mirror mirror-server </code></pre> <p>Later you update tracking branches (and get new ones) in your <code>~/local-repos</code> with <code>git fetch origin</code> executed inside <code>~/local-repos</code>. You can mirror everything to <code>~/remote-repos.git</code> again with <a href="https://www.kernel.org/pub/software/scm/git/docs/git-push.html" rel="nofollow"><code>git push --mirror mirror-server</code></a>. If you want to push a single branch (e.g. <code>origin/gh-pages</code>), use <code>git push mirror-server origin/gh-pages</code>.</p> <p>Notice that <code>https://github.com/nhnc-nginx/apache2nginx</code> remote is named <code>origin</code> automatically. <code>git fetch origin</code> fetches accessible objects from <code>origin</code> repository and stores branches as tracking branches. Tracking branches are prefixed with the remote name (<code>origin</code> in this case). If you perform <code>git checkout gh-pages</code> and no <code>gh-pages</code> branch exists, Git performs <code>git branch --track gh-pages origin/gh-pages</code> before performing the checkout, which creates the <code>gh-pages</code> branch with upstream set to <code>origin/gh-pages</code>.</p> <p>This was probably the source of the errors your Git reported. You fetched just <code>origin/gh-pages</code> and tried to push non-existent <code>gh-pages</code> branch. As part of checkout, <code>gh-pages</code> was created, so push work then.</p> <p>Also notice that you are creating a mirror of your local repository, not <code>origin</code>. If you want to mirror your GitHub repository, you should execute <code>git fetch origin</code> inside the just created empty mirror with <code>git remote add origin 'https://github.com/nhnc-nginx/apache2nginx'</code>.</p> |
29,218,930 | 0 | Running XAMPP with Mysql instance already installed on local machine <p>I installed XAMPP on my local machine. I had previously installed MySQL along with Mysql Workbench. Couple of questions:</p> <ol> <li>Do I have to start the MySQL services in Xampp? </li> <li>what is my localhost IP address for connection in PHP?</li> </ol> <p>I am running Windows 7. I am new with this and I am trying to use CakePHP and Xampp for a project and I am not sure how the previous installation of Mysql may conflict with Xampp. Thank you.</p> |
24,232,428 | 0 | <p>I believe your problem is here:</p> <pre><code>Sub DoOneFolder(FF As Scripting.Folder) Dim F As Scripting.File Dim SubF As Scripting.Folder Dim WBc As Workbook Dim shtWBc As Object Set shtWBc = Sheets("QC Results") Dim shtBatchwbk As Object Dim lastrow As Long Set shtBatchwbk = ThisWorkbook.Sheets("QC Results") lastrow = shtBatchwbk.Range("A65536").End(xlUp).Row </code></pre> <p>Notice that <code>shtWBc</code> and <code>shtBatchwbk</code> are most likely assigned to the <em>exact same worksheet object</em>.</p> <p><code>shtBatchwbk</code> is assigned from <code>ThisWorkbook</code>, and unless you have other workbooks open/active at the time, then <code>shtWBc</code> is assigned from the <code>ActiveWorkbook</code>, which would be the same workbook, thus the exact same worksheet.</p> <p>The resolution would seem to be:</p> <pre><code> For Each F In FF.Files If (F.Name) Like "QC_results*" & ".xlsm" Then Set WBc = Workbooks.Open(F) Set shtWBc = WBc.Sheets("QC Results") '##### ASSIGN THIS WORKSHEET FROM THE NEWLY OPNEED WORKBOOk 'Get the last row: lastrow = shtBatchwbk.Range("A65536").End(xlUp).Row ' Copy QC results range into batch summary workbook shtWBc.Range("A4:SA11").Copy shtBatchwbk.Range("A" & lastrow) WBc.Close SaveChanges:=False Debug.Print F.Name End If Next F </code></pre> <p>Otherwise, revise your Q to provide more detail per Alexandre's comment.</p> <p><strong>UPDATE FROM COMMENTS</strong></p> <p>If you only need <em>values</em>, then this should be more reliable and faster than copy/paste. </p> <p>Instead of:</p> <pre><code>shtWBc.Range("A4:SA11").Copy shtBatchwbk.Range("A" & lastrow) </code></pre> <p>Do this:</p> <pre><code>shtBatchwbk.Range("A" & lastrow).Resize( _ shtWBc.Range("A4:SA11").Rows.Count, _ shtWBc.Range("A4:SA11").Columns.Count).Value = shtWBc.Range("A4:SA11").Value </code></pre> <p>And if you also want to copy formatting without doing the full "copy" because it sometimes changes/transposes numbers, etc., then you can add this as well:</p> <pre><code>shtWBc.Range("A4:SA11").Copy shtBatchwbk.Range("A" & lastrow).PasteSpecial xlPasteFormats </code></pre> |
12,601,802 | 0 | <p>You may try this regex:</p> <pre><code>/^http(s?)://((\w+\.)?\w+\.\w+|((2[0-5]{2}|1[0-9]{2}|[0-9]{1,2})\.){3}(2[0-5]{2}|1[0-9]{2}|[0-9]{1,2}))(/)?$/gm </code></pre> <p>It's a bit lengthy but it works both with abc.domain.com, domain.com and valid IP addresses. You can test it <a href="http://regexr.com?329bj" rel="nofollow">here</a>.</p> <p>It's split into a "text" part, <code>(\w+\.)?\w+\.\w+</code> that matches any text without spaces and with one or two dots in it, and a numeric part, <code>((2[0-5]{2}|1[0-9]{2}|[0-9]{1,2})\.){3}(2[0-5]{2}|1[0-9]{2}|[0-9]{1,2})</code> allowing four numbers between 0 and 255 separated by dots.</p> <p>Optionally, there can be a slash at the end.</p> <p>If you don't mean to allow domains composed by single characters (eg. a.b.c) but, say, at least like www.bit.ly (that is, with free prefix of 1 or more characters, "body" of three or more, and suffix of two or more), you can change the text part into:</p> <pre><code>(\w+\.)?\w{3,}\.\w{2,} </code></pre> <p>Reference: </p> <p><a href="http://RegExr.com?2ri07" rel="nofollow">http://RegExr.com?2ri07</a> (regex matching ip)</p> |
3,408,941 | 0 | <p><code>wmic</code> is a command-line wrapper for <strong>Windows Management Instrumentation (WMI)</strong> API. In .NET Framework, the <a href="http://msdn.microsoft.com/en-us/library/system.management.aspx" rel="nofollow noreferrer"><code>System.Management</code></a> namespace provides access to this API.</p> <p>The Visual Basic .NET equivalent of your command line is below. This code queries the <a href="http://msdn.microsoft.com/en-us/library/aa394372.aspx" rel="nofollow noreferrer"><code>Win32_Process</code></a> class instances corresponding to <em>mpc-hc.exe</em> and reads their <code>CommandLine</code> property:</p> <pre><code>Imports System.Management ... Dim searcher As New ManagementObjectSearcher( _ "SELECT * FROM Win32_Process WHERE Name='mpc-hc.exe'") For Each process As ManagementObject in searcher.Get() Console.WriteLine(process("CommandLine")) Next </code></pre> |
21,656,677 | 0 | <p>You can still use the <code>interval()</code> method, just ignore its result!</p> <pre><code>final Producer producer = ...; int n = ...; Observable<Object> obs = Observable.interval(n,TimeUnit.SECONDS) .map(new Func1<Integer,Object>() { @Override public Object call(Integer i) { return producer.readData(); } )); </code></pre> |
15,772,057 | 0 | <p>Only solution I found is to downgrade to CRM SDK version 1.0 (not 1.1 from current release). Then in VS 2010 works.</p> |
15,732,208 | 0 | <p>Further, it may interest you, the location where Google Drive stores offline docs in Android's file system.</p> <p><code>sdcard/android/data/com.google.android.apps.docs/</code></p> |
36,481,766 | 0 | Checking text as you write it <p>I am writing a function (in Python 3) which will allow someone to revise a set text.</p> <p>Set texts (in this situation) are pieces of text (I am doing the <em>Iliad</em>, for example) which you need to learn for an exam. In this function I am focusing on a user trying to learn the translation of the text off by heart.</p> <p>In order to do this, I want to write the translation in a text file, then the user can test themselves by writing it up, and the program will check whether each word is correct by checking it against the known, correct translation.</p> <p>I know I could simply use <code>input()</code> for this, but it is inadequate as the user would have to type the entire text, or small parts, at a time for this to work, and I want to correct as they type in order for them to remember their mistakes more easily.</p> <p>I have not written any code yet as how I write the rest of the program will depend on how I code this part.</p> |
14,409,383 | 0 | <pre><code>$arr = explode(':', $detailsSessionDuration); printf("%s Hrs %s Mins %s Secs", $arr[0], $arr[1], $arr[2]); </code></pre> |
12,264,142 | 0 | <p>Try to use regex pattern</p> <pre><code>/(?=.*?(?<!@ )(\b\w+\b)).*\(@.*\1.*\)/ </code></pre> <p>See <a href="http://ideone.com/QMzeC" rel="nofollow">this test code</a>.</p> |
33,565,354 | 0 | <p>The problem was IIS in 32-bit. Using 64-bit version solves the problem.</p> <p>P.S. Visual Studio has an option to use IIS-Express in 64-bit. You can also add to the registry:</p> <pre><code>reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebProjects /v Use64BitIISExpress /t REG_DWORD /d 1 </code></pre> <p>12.0 - Visual Studio 2013</p> |
27,982,432 | 1 | Flattening and unflattening a nested list of numpy arrays <p>There are many recipes for flattening a nested list. I'll copy a solution here just for reference: </p> <pre><code>def flatten(x): result = [] for el in x: if hasattr(el, "__iter__") and not isinstance(el, basestring): result.extend(flatten(el)) else: result.append(el) return result </code></pre> <p>What I am interested in is the inverse operation, which reconstructs the list to its original format. For example:</p> <pre><code>L = [[array([[ 24, -134],[ -67, -207]])], [array([[ 204, -45],[ 99, -118]])], [array([[ 43, -154],[-122, 168]]), array([[ 33, -110],[ 147, -26],[ -49, -122]])]] # flattened version L_flat = [24, -134, -67, -207, 204, -45, 99, -118, 43, -154, -122, 168, 33, -110, 147, -26, -49, -122] </code></pre> <p>Is there an efficient way of flattening, saving indices and reconstructing to its original format?</p> <p>Note that the list can be of arbitrary depth and may not have a regular shape, and will contain arrays of differing dimensions.</p> <p>Of course, the flattening function should be also changed to store the structure of the list and the shape of the <code>numpy</code> arrays.</p> |
8,857,572 | 0 | Prolog - Help fixing a rule <p>I have a database full of facts such as:</p> <pre><code>overground(newcrossgate,brockley,2). overground(brockley,honoroakpark,3). overground(honoroakpark,foresthill,3). overground(foresthill,sydenham,2). overground(sydenham,pengewest,3). overground(pengewest,anerley,2). overground(anerley,norwoodjunction,3). overground(norwoodjunction,westcroydon,8). overground(sydenham,crystalpalace,5). overground(highburyandislington,canonbury,2). overground(canonbury,dalstonjunction,3). overground(dalstonjunction,haggerston,1). overground(haggerston,hoxton,2). overground(hoxton,shoreditchhighstreet,3). </code></pre> <p>example: newcrossgate to brockley takes 2 minutes.</p> <p>I then created a rule so that if I enter the query istime(newcrossgate,honoroakpark,Z). then prolog should give me the time it takes to travel between those two stations. (The rule I made is designed to calculate the distance between any two stations at all, not just adjacent ones). </p> <pre><code>istime(X,Y,Z):- istime(X,Y,0,Z); istime(Y,X,0,Z). istime(X,Y,T,Z):- overground(X,Y,Z), T1 is T + Z. istime(X,Y,Z):- overground(X,A,T), istime(A,Y,T1), Z is T + T1. istime(X,Y,Z):- overground(X,B,T), istime(B,X,T1), Z is T + T1. </code></pre> <p>it seems to work perfectly for newcrossgate to the first couple stations, e.g newcrossgate to foresthill or sydenham. However, after testing newcrossgate to westcroydon which takes 26mins, I tried newcrossgate to crystalpalace and prolog said it should take 15 mins...despite the fact its the next station after westcroydon. Clearly somethings wrong here, however it works for most of the stations while coming up with a occasional error in time every now and again, can anyone tell me whats wrong? :S</p> |
31,934,022 | 0 | how to store sql lite database in android studio to device memory? <p>I am new to android . I would like to store and retrieve records in android studio . I am using embedded sql database in android studio . Data are inserted perfectly when my device is connected to studio. whenever, i run after disconnecting my device insertion is not performing . what is the problem ? please help me, what should i need to do? </p> |
29,302,209 | 0 | Binary searching in an array <p>This code searches for a number in an array by using the median. I have a problem with printing its position in the array. This code prints out the max value of the array. ex "234" "your number is on the the place 99999" "345" "your number is on the place 99998" and so on.</p> <pre><code>import java.util.Scanner; import java.util.Arrays; public class sok2 { public static void main(String[] args) { int ListaLength = 100001; //Säger hur lång listan ska vara. int [] array = new int[ListaLength]; for (int i = 0; i < ListaLength; i++) { array[i] = (int)(Math.random() * ((ListaLength - 1) + 1)); Arrays.sort(array); System.out.println("Skriv in numret du letar efter."); int element = new Scanner(System.in).nextInt(); boolean found = false; int min = 0; int max = array.length - 1; int median = max/2; while(! found && min <= max){ if(array[median] == element){ found = true; } if(array[median] < element){ min = median + 1; median = (min + max) / 2; } else if(array[median] > element){ max = median - 1; median = (max + min) / 2; } } // this is where i assume the problem is. System.out.println("Din siffra är på plats "+median); }}} </code></pre> |
32,184,523 | 0 | <p>I'm not sure if you can apply a LINQ Select statement on a DataTable and use the Trim() on the String class to achieve your goal. But as a Database Developer I would suggest acting on the SQL Query and use the Rtrim(Ltrim(field1)) AS field1 on your query to get rid of the spaces before the datatable.</p> |
12,559,705 | 0 | <p>Cairo uses pixman for everything that the backend can't draw itself, and for everything the image backend draws. So there is no way to disable it.</p> |
4,398,219 | 0 | <p>You'd need to execute the <code>lame</code> command in the shell anyway, so there is no use for this. If you need to kick the processing of from php, just execute the whole script from php.</p> |
2,819,368 | 0 | <p>Check out <a href="http://vimcolorschemetest.googlecode.com/svn/html/index-c.html" rel="nofollow noreferrer">http://vimcolorschemetest.googlecode.com/svn/html/index-c.html</a>, it has a HUGE list of colorschemes with previews. If you do not like C samples, there are samples with other programming languages, too: <a href="http://code.google.com/p/vimcolorschemetest/" rel="nofollow noreferrer">http://code.google.com/p/vimcolorschemetest/</a></p> |
14,720,321 | 0 | <p>Using Steve's suggestion above as a jumping off point and then reading some tutorials I was able to come up with a working script:</p> <pre><code>Sub UniformHeight() Dim SlideToCheck As Slide Dim ShapeIndex As Integer For Each SlideToCheck In ActivePresentation.Slides For ShapeIndex = SlideToCheck.Shapes.Count To 1 Step -1 SlideToCheck.Shapes(ShapeIndex).Top = 36 Next Next End Sub </code></pre> |
8,674,339 | 0 | <p>You are re-binding the drop down list (and therefore wiping out the 'SelectedValue') in your Page_PreRender method. Wrap the method in</p> <pre><code>protected void Page_PreRender(object sender, EventArgs e) { if( !IsPostBack){ //your current code } } </code></pre> <p>and it should work.</p> |
4,508,743 | 0 | jQuery doesn't return any API results in the Succes function of $.ajax() while using JSONP <p>I'm having a lot of trouble getting any results out of the JSONP datatype of the jQuery $.ajax() function. This is my jQuery code:</p> <pre><code> $('#show_tweets').click(function(){ $.ajax({ type: 'get', url: 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=jquery', dataType: 'jsonp', succes: function(data) { $.each(data, function() { $('<div></div>') .hide() .append('<img src="'+ this.profile_image_url +'"/>') .append('<p>'+ this.text +'</p>') .appendTo('#tweets_gallery') .fadeIn(); }) }, error: function() { alert('Iets gaat fout!!'); } }); }); </code></pre> <p>I've assigned the #show_tweets ID to a P tag. #tweets_gallery is an empty DIV. Now, I <strong>know</strong> I could also use the $.getJSON() function, but I just want to know how I can properly retrieve JSONP results with a <strong>$.ajax()</strong> request. I've clicked several times and it doesn't output anything. </p> <p>Thanks in advance!</p> |
6,047,724 | 0 | PDO fetchAll array to one dimensional <p>this may be a simple question but am struggling to understand how to solve it. I have a form which allows the user to select either "custom" or "all" staff" to assign to a job.</p> <p>If custom is selected the user selects staff by clicking each checkbox, I then insert these into a jobs table. This produces the array below (3, 1, 10 are the staff IDs)</p> <pre><code>Array ( [0] => 3 [1] => 1 [2] => 10 ) </code></pre> <p>If "all staff" is selected, I first query a select statement to get all the staff ID's from the staff table, and then insert these into the job table the same as above. However this produces the array :</p> <pre><code>Array ( [0] => Array ( [staffID] => 1 [0] => 1 ) [1] => Array ( [staffID] => 23 [0] => 23 ) [2] => Array ( [staffID] => 26 [0] => 26 ) [3] => Array ( [staffID] => 29 [0] => 29 ) ) </code></pre> <p>How can I convert the array above to the first array shown? </p> <p>I'm using the code below to query the database to get all the staff ID's and then inserting them.</p> <pre><code> $select = $db->prepare("SELECT staffID FROM staff"); if($select->execute()) { $staff = $select->fetchAll(); } for($i = 0; $i<count($staff); $i++) { $staffStmt = $db->prepare("INSERT INTO staffJobs (jobID, userID) VALUES (:jobID, :staffID)"); $staffStmt->bindParam(':jobID', $jobID, PDO::PARAM_INT); $staffStmt->bindParam(':staffID', $staff[$i], PDO::PARAM_INT); $staffStmt->execute(); } </code></pre> <p>The first array inserts fine, however the last array inserts zeros for the staffID.</p> <p>Any suggestions?</p> <p>Thanks =).</p> |
34,638,005 | 0 | <p>There is no penalty to using VMOVDQU when the address is aligned. The behavior is identical to using VMOVDQA in that case.</p> <p>As for "why" there may not be a single clear answer. It's <em>possible</em> that ICC does this deliberately so that users who later call <code>_do</code> with an unaligned argument will not crash, but it's also possible that it's simply emergent behavior of the compiler. Someone on the Intel compiler team could answer this question, the rest of us can only speculate.</p> |
26,288,949 | 0 | Is it possible to show an element just before entering a long running sync process? <p>This is a very simple use case. Show an element (a loader), run some heavy calculations that eat up the thread and hide the loader when done. I am unable to get the loader to actually show up prior to starting the long running process. It ends up showing and hiding after the long running process. Is adding css classes an async process?</p> <p>See my jsbin here:</p> <p><a href="http://jsbin.com/voreximapewo/12/edit?html,css,js,output" rel="nofollow">http://jsbin.com/voreximapewo/12/edit?html,css,js,output</a></p> |
25,849,693 | 0 | set supportedRuntime to .net 2.0 in VS 2010 projects <p>I am trying to set supportedRuntime for my vb.net project which i created using VS 2010. Then i tried setting supportedRuntime for a sample application containing only form. In .config i have specified as shown below</p> <pre><code><startup> <supportedRuntime version="v2.0.50727"/> <supportedRuntime version="v4.0.30319"/> </startup> </code></pre> <p>When I try to open exe it does not open. If i specify .net 4 first and then .net 2 in config then it works.</p> <p>If project is created in VS 2008 then above supportedRuntime option works properly.</p> <p>So what is the error actually? Can't i set supportedRuntime to 2.0 in config file?</p> |
29,888,151 | 0 | <p>This will work : </p> <pre><code><?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:id="@+id/linear1"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="text"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:id="@+id/linear2"> <RadioGroup android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/radioGroup1"> <RadioButton android:layout_width="wrap_content" android:id="@+id/radio0" android:layout_height="wrap_content" android:text="RadioButton" android:checked="true" /> <RadioButton android:layout_width="wrap_content" android:id="@+id/radio1" android:layout_height="wrap_content" android:text="RadioButton" /> <RadioButton android:layout_width="wrap_content" android:id="@+id/radio2" android:layout_height="wrap_content" android:text="RadioButton" /> <RadioButton android:layout_width="wrap_content" android:id="@+id/radio3" android:layout_height="wrap_content" android:text="RadioButton" /> </RadioGroup> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:id="@+id/linear3"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button1" android:text="Button" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2" android:text="Button" /> <Spinner android:id="@+id/spinner1" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout> </ScrollView> </code></pre> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.