pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
29,600,147
0
How to get total number of hours between two dates in javascript? <p>I am in a situation where I need to find out the total hour difference between two date objects but the thing is dates aren't present in the actual format.</p> <p><code>Date 1: 6 Apr, 2015 14:45</code><br> <code>Date 2: 7 May, 2015 02:45</code></p> <p>If it would have been in standard format, simply I would have been used below method: <code>var hours = Math.abs(date1 - date2) / 36e5;</code></p> <p>I am not sure how do I get the hour difference here... please help.</p>
19,204,442
1
nested dictionary get keys sorted by values <p>I'm using a dictionary that has nested dictionaries:</p> <pre><code>dicc={ 'a': {'a1': 1 }, 'b':{'b1':2 }, 'c':{'c1':3 } } # This is an example. I have lots of other keys and values. </code></pre> <p>I need to get the keys ordered by the values. For example, getting <code>c,b,a</code> values: I will work on them in this order; first I need to use <code>c</code> to do other operations then <code>b</code> then <code>a</code>.</p> <p>I used this to get the max value but I need all the values and use them in order mayor to minor:</p> <pre><code>valores=list(diccionario.values()) claves= list(diccionario.keys()) value_= claves[valores.index(max(valores))] </code></pre> <p>edit: i need to get c,b,a sorted on this order and without using a b c , because c has the highest c1 value etc.. ok that works to sort a dict in reverse way but lets say i have this data:</p> <p>1000 10 20 7 2 0</p> <p>1001 3 30 3 5 0</p> <p>1002 3 10 5 3 0</p> <p>1003 7 22 3 1 0</p> <p>second column is a prior, all this is stored into a dictionary the main keys are 1000,1001,1002,1003, the rest are values, i want to get 1000,1003,1002,1001 (this last have same prior) on this order, </p>
15,913,829
0
<p>Your <code>getPhrase</code> should look like this:</p> <pre><code>std::string getPhrase() { std::string result; std::cout &lt;&lt; "Enter phrase: "; std::getline(std::cin, result); return result; } </code></pre> <p>Then:</p> <pre><code>int main() { std::string phrase = getPhrase(); // ... } </code></pre>
16,700,408
0
<p>If you really want to use NodeList, you can do this:</p> <pre><code>nList.item(i).setNodeValue(a.item(i).getNodeValue()); </code></pre> <p>The better way to do it is just with a List as cmbaxter suggested, though.</p> <pre><code>List&lt;Node&gt; nodes = new ArrayList&lt;Node&gt;(); </code></pre>
614,075
0
<p>This <a href="http://cbcg.net/talks/rubyidioms/" rel="nofollow noreferrer">slideshow</a> is quite complete on the main Ruby idioms, as in:</p> <ul> <li><p>Swap two values: </p> <p><code>x, y = y, x</code></p></li> <li><p>Parameters that, if not specified, take on some default value</p> <p><code>def somemethod(x, y=nil)</code></p></li> <li><p>Batches up extraneous parameters into an array</p> <p><code>def substitute(re, str, *rest)</code></p></li> </ul> <p>And so on...</p>
26,363,844
0
<p>As pointed out by @user3894601, the problem was solved by using the original cable, and using a USB adapter.</p>
13,077,956
0
<p>First let my say that I have not used APScheduler myself yet, and have next to no knowledge about running Python servers (or anything else really) on Windows and IIS. <br> So I can only guess here, but it seems clear that your problem is related to APScheduler in a way. I could imagine that something goes wrong in a thread that APScheduler uses for your background tasks, and the hanging thread brings down your whole application, due to the GIL (global interpreter lock in Python). This could for example happen when your thread(s) run into some kind of race condition. Maybe it happens that processing starts before the previous iteration has finished processing. Or you get a really big backlog, and that leads to problems when processing starts.</p> <p>Anyway, I think task queues are much better suited for background processing in web applications, because they run separately and out of the context of your web server. You can schedule a task as soon as it's triggered by some user action, and it will be processed as soon as a worker is available, and not be deferred until a certain point in time.<br> I would recommend to give <a href="http://celeryproject.org/" rel="nofollow">Celery</a> a try, but there are also other solutions available, many based on Redis.</p> <p>Celery is really powerful, and has advanced features like periodic tasks and crontab style schedules - so you can probably use it to do what you are doing using APScheduler now.</p> <p>This looked very helpful for setting up Celery under Windows: <a href="http://mrtn.me/blog/2012/07/04/django-on-windows-run-celery-as-a-windows-service/" rel="nofollow">http://mrtn.me/blog/2012/07/04/django-on-windows-run-celery-as-a-windows-service/</a> <br> This may also prove helpful: <a href="http://stackoverflow.com/questions/9378932/how-to-create-celery-windows-service">How to create Celery Windows Service?</a> <br>Note: I haven't tried any of these myself, since I use Linux if I have a choice.</p> <p>It's probably also possible to get APScheduler to work correctly, but I think it will be much easier to use Celery, because if a problem occurs in a worker you will be able to debug it much easier than a problem occuring in a background thread. Celery can also be configured to automatically send you email in case of an error.</p>
25,440,559
0
<pre><code> if($query = $this-&gt;mod_reports-&gt;registered_customers_bod()){ $data['records'] = $query ; }else{ $data['records'] = new stdClass(); // change here } </code></pre> <p>the reason behind the error is when no record is found from db your <code>$data['records']</code> is a <strong>String</strong> and which is surely <code>Invalid argument for foreach()</code></p> <p>and instead of <code>isset($records)</code> in view use <code>empty($records)</code></p> <p>and put else in view <strong>EDIT</strong></p> <pre><code>$arr = (array)$records; if(!empty($arr)){ $i = 1; $delivered_qty_total = 0; foreach($records as $row) { ?&gt; &lt;tr&gt; &lt;td&gt;&lt;?php echo $i++; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row-&gt;cus_id; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row-&gt;cus_name; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row-&gt;cus_email; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row-&gt;cus_phone; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row-&gt;cus_mobile; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row-&gt;cus_addr_city; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $row-&gt;user_status; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo gmdate("Y/m/d", $row-&gt;user_timestamp); ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt; } else { echo "No records found";} </code></pre>
13,917,119
0
<p><a href="http://xamarin.com/mac" rel="nofollow">Xamarin.Mac</a>: an open source library for building Cocoa applications on OSX using C# and .NET.</p> <p>You can dig into the <a href="https://github.com/xamarin/xamarin-macios" rel="nofollow">source code</a> and read the <a href="https://developer.xamarin.com/guides/mac/getting_started/hello,_mac/" rel="nofollow">documentation</a>.</p>
19,366,842
0
<p>You need only to vector of vector of string:</p> <pre><code>vector&lt;vector&lt;string&gt; &gt; table((int)('z' - 'a')); string str; while (cin &gt;&gt; str) { table[tolower(str[0]) - 'a'].push_back(str); } </code></pre> <p>To clarify:</p> <ul> <li><code>table</code> is of length 26 (which is the result of <code>'z' - 'a'</code>), since we have 26 alpha chars.</li> <li>Each of the 26 elements is a vector of strings.</li> <li>When we put the read string, we put it in an index relative to its first char.</li> </ul> <p>For example: "all" => `tolower(str[0] - 'a') = 0</p> <p>About your code:</p> <pre><code>class index_table { public: index_table() { table.resize(128);} void insert(string &amp; ); // Don't need second param private: class entry { //Subclass string word; // vector&lt;int&gt; is not needed } vector&lt; vector &lt;entry &gt; &gt; table; // Don't need list type }; void index_table::insert(string &amp; s) { if (s.size() == 0) return; else table[(int)(s[0])].push_back(s); // (int)(s[0]) bring ASCII code } </code></pre>
20,459,887
0
Format specifies type 'int' but the argument has type 'UIViewContentMode' <p>I am getting a warning in Xcode:</p> <blockquote> <p>Format specifies type 'int' but the argument has type 'UIViewContentMode'</p> </blockquote> <p>I have a method that I am using to resize an <code>UIImage</code> as follows:</p> <pre><code>- (UIImage *)resizedImageWithContentMode:(UIViewContentMode)contentMode bounds:(CGSize)bounds interpolationQuality:(CGInterpolationQuality)quality { CGFloat horizontalRatio = bounds.width / self.size.width; CGFloat verticalRatio = bounds.height / self.size.height; CGFloat ratio; switch (contentMode) { case UIViewContentModeScaleAspectFill: ratio = MAX(horizontalRatio, verticalRatio); break; case UIViewContentModeScaleAspectFit: ratio = MIN(horizontalRatio, verticalRatio); break; default: [NSException raise:NSInvalidArgumentException format:@"Unsupported content mode: %d", contentMode]; } ... </code></pre> <p><code>UIViewContentMode</code> seems to reference an Integer so I am not sure on this warning:</p> <pre><code>typedef NS_ENUM(NSInteger, UIViewContentMode) { UIViewContentModeScaleToFill, UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparent UIViewContentModeScaleAspectFill, ... </code></pre> <p>How can I get rid of this warning it seems to be incorrect? Is the <code>NSLog</code> in the exception correct? </p>
33,555,804
0
<p>Looks like this was my fault. Hopefully this might help someone else.</p> <p>My normal drawable was actually in the drawable-nodpi folder, not drawable. I guess that was somehow overriding the v21 folder version.</p>
4,346,563
0
Sharepoint 2010 Built-In Web Service - How to Delete File and/or Folder <p>Is there a built-in SP 2010 web service for deleting a file/folder in a doc library?</p>
10,424,733
0
<h1>Updated</h1> <p>Google has released <a href="https://developers.google.com/maps/documentation/javascript/places-autocomplete" rel="nofollow">Google Places Autocomplete</a> which resolves exactly this problem.</p> <p>At the bottom of a page throw this in there:</p> <pre><code>&lt;script defer async src="//maps.googleapis.com/maps/api/js?libraries=places&amp;key=(key)&amp;sensor=false&amp;callback=googPlacesInit"&gt;&lt;/script&gt; </code></pre> <p>Where <code>(key)</code> is your API key.</p> <p>We've set our code up so you mark some fields to handle typeahead and get filled in by that typeahead, like:</p> <pre><code>&lt;input name=Address placeholder=Address /&gt; &lt;input name=Zip placeholder=Zip /&gt; </code></pre> <p>etc</p> <p>Then you initialize it (before the Google Places API has loaded typically, since that's going to land async) with:</p> <pre><code>GoogleAddress.init('#billing input', '#shipping input'); </code></pre> <p>Or whatever. In this case it's tying the address typeahead to whatever input has name=Address in the #billing tag and #shipping tag, and it will fill in the related fields inside those tags for City, State, Zip etc when an address is chosen.</p> <p>Setup the class:</p> <pre><code>var GoogleAddress = { AddressFields: [], //ZipFields: [], // Not in use and the support code is commented out, for now OnSelect: [], /** * @param {String} field Pass as many arguments as you like, each a selector to a set of inputs that should use Google * Address Typeahead via the Google Places API. * * Mark the inputs with name=Address, name=City, name=State, name=Zip, name=Country * All fields are optional; you can for example leave Country out and everything else will still work. * * The Address field will be used as the typeahead field. When an address is picked, the 5 fields will be filled in. */ init: function (field) { var args = $.makeArray(arguments); GoogleAddress.AddressFields = $.map(args, function (selector) { return $(selector); }); } }; </code></pre> <p>The script snippet above is going to async call into a function named <code>googPlacesInit</code>, so everything else is wrapped in a function by that name:</p> <pre><code>function googPlacesInit() { var fields = GoogleAddress.AddressFields; if ( // If Google Places fails to load, we need to skip running these or the whole script file will fail typeof (google) == 'undefined' || // If there's no input there's no typeahead so don't bother initializing fields.length == 0 || fields[0].length == 0 ) return; </code></pre> <p>Setup the autocomplete event, and deal with the fact that we always use multiple address fields, but Google wants to dump the entire address into a single input. There's surely a way to prevent this properly, but I'm yet to find it.</p> <pre><code>$.each(fields, function (i, inputs) { var jqInput = inputs.filter('[name=Address]'); var addressLookup = new google.maps.places.Autocomplete(jqInput[0], { types: ['address'] }); google.maps.event.addListener(addressLookup, 'place_changed', function () { var place = addressLookup.getPlace(); // Sometimes getPlace() freaks out and fails - if so do nothing but blank out everything after comma here. if (!place || !place.address_components) { setTimeout(function () { jqInput.val(/^([^,]+),/.exec(jqInput.val())[1]); }, 1); return; } var a = parsePlacesResult(place); // HACK! Not sure how to tell Google Places not to set the typeahead field's value, so, we just wait it out // then overwrite it setTimeout(function () { jqInput.val(a.address); }, 1); // For the rest, assign by lookup inputs.each(function (i, input) { var val = getAddressPart(input, a); if (val) input.value = val; }); onGoogPlacesSelected(); }); // Deal with Places API blur replacing value we set with theirs var removeGoogBlur = function () { var googBlur = jqInput.data('googBlur'); if (googBlur) { jqInput.off('blur', googBlur).removeData('googBlur'); } }; removeGoogBlur(); var googBlur = jqInput.blur(function () { removeGoogBlur(); var val = this.value; var _this = this; setTimeout(function () { _this.value = val; }, 1); }); jqInput.data('googBlur', googBlur); }); // Global goog address selected event handling function onGoogPlacesSelected() { $.each(GoogleAddress.OnSelect, function (i, fn) { fn(); }); } </code></pre> <p>Parsing a result into the canonical street1, street2, city, state/province, zip/postal code is not trivial. Google differentiates these localities with varying tags depending on where in the world you are, and as a warning, there are places for example in Africa that meet none of your expectations of what an address looks like. You can break addresses in the world into 3 categories:</p> <ul> <li><p>US-identical - the entire US and several countries that use a similar addressing system</p></li> <li><p>Formal addresses - UK, Australia, China, basically developed countries - but the way their address parts are tags has a fair amount of variance</p></li> <li><p>No formal addresses - in undeveloped areas there are no street names let alone street numbers, sometimes not even a town/city name, and certainly no zip. In these locations what you really want is a GPS location, which is not handled by this code.</p></li> </ul> <p>This code only attempts to deal with the first 2 cases.</p> <pre><code>function parsePlacesResult(place) { var a = place.address_components; var p = {}; var d = {}; for (var i = 0; i &lt; a.length; i++) { var ai = a[i]; switch (ai.types[0]) { case 'street_number': p.num = ai.long_name; break; case 'route': p.rd = ai.long_name; break; case 'locality': case 'sublocality_level_1': case 'sublocality': d.city = ai.long_name; break; case 'administrative_area_level_1': d.state = ai.short_name; break; case 'country': d.country = ai.short_name; break; case 'postal_code': d.zip = ai.long_name; } } var addr = []; if (p.num) addr.push(p.num); if (p.rd) addr.push(p.rd); d.address = addr.join(' '); return d; } /** * @param input An Input tag, the DOM element not a jQuery object * @paran a A Google Places Address object, with props like .city, .state, .country... */ var getAddressPart = function(input, a) { switch(input.name) { case 'City': return a.city; case 'State': return a.state; case 'Zip': return a.zip; case 'Country': return a.country; } return null; } </code></pre> <h1>Old Answer</h1> <p>ArcGis/ESRI has a limited typeahead solution that's functional but returns limited results only after quite a bit of input. There's a demo here:</p> <p><a href="http://www.esri.com/services/disaster-response/wildlandfire/latest-news-map.html" rel="nofollow">http://www.esri.com/services/disaster-response/wildlandfire/latest-news-map.html</a></p> <p>For example you might type 1600 Pennsylvania Ave hoping to get the white house by the time you type "1600 Penn", but have to get as far as "1600 pennsylvania ave, washington dc" before it responds with that address. Still, it could have a small benefit to users in time savings.</p>
17,577,084
0
<p>Assuming your constraint name in table <code>two</code> is <code>two_ibfk_1</code> , you can see the name of the constraint with this command :<br> SHOW CREATE TABLE <code>two</code>;</p> <p>so the command would be to delete the constraint first, and then recreate it after it was modified</p> <pre><code>ALTER TABLE two DROP FOREIGN KEY two_ibfk_1; ALTER TABLE one MODIFY COLUMN `id` int(10) NOT NULL auto_increment; ALTER TABLE two MODIFY COLUMN `one_id` int(10) NOT NULL ; ALTER TABLE two ADD CONSTRAINT FOREIGN KEY (`one_Id`) REFERENCES `one` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; </code></pre> <p>FYI, the second command to modify table <code>two</code> can not be set as auto_increment, because the primary is is column <code>id</code></p>
13,657,929
0
<p>SQLite has no general mechanism to execute commands conditionally. However, in triggers, you can use a <code>WHEN</code> condition on the entire trigger:</p> <pre><code>CREATE TRIGGER test_for_broj_goluba AFTER UPDATE OF majka ON unos_golub BEGIN UPDATE unos_golub SET broj_goluba=NEW.majka WHERE broj_goluba=OLD.majka; END; CREATE TRIGGER test_for_majka AFTER UPDATE OF majka ON unos_golub WHEN NEW.majka &lt;&gt; '' BEGIN UPDATE unos_golub SET majka=NEW.majka WHERE majka=OLD.majka; END; </code></pre> <p>(The first <code>UPDATE</code> is the same in both cases and thus does not need a <code>WHEN</code>.)</p>
20,941,177
0
<p>Modern PAAS systems favour building an image for each customer, creating versioned copies of both software and configuration. This follows the "<a href="http://12factor.net/build-release-run">Build, release, run</a>" recommendation of the 12 factor app website:</p> <ul> <li><a href="http://12factor.net/">http://12factor.net/</a></li> </ul> <p>An docker based example is <a href="http://deis.io/">Deis</a>. It uses Heroku build packs to customize the software application environment and the environment settings are also baked into a docker image. At run-time these images are run by chef on each application server.</p> <p>This approach works well with Docker, because images are easy to build. The challenge I think is managing the docker images, something the <a href="http://blog.docker.io/2013/07/how-to-use-your-own-registry/">docker registry</a> is designed to support.</p>
17,535,616
0
Qt TabStop color troubles <p>In my application i have an annoying white rectangle on tabstop controls. I tried to look in stylesheets but myitem:tabstop style don't do anything. Is there any way i can somehow change tabstop color/or make it another form.</p>
31,268,069
0
<p>It is just formatting the output in your client.</p> <p>For example, in SQL*Plus set <strong>numformat</strong>:</p> <pre><code>SQL&gt; set numformat 999.99 SQL&gt; SELECT CAST((600.2) AS NUMERIC(28,2)) FROM DUAL; CAST((600.2)ASNUMERIC(28,2)) ---------------------------- 600.20 </code></pre> <p>You could also use <strong>TO_CHAR</strong>, but use it only to display, for any number arithmetic you should leave the number as it is.</p> <pre><code>SQL&gt; select to_char(600.2, '000.00') from dual; TO_CHAR ------- 600.20 </code></pre>
1,541,418
0
<p>The other option that you have, depending on what you're trying to do, is to host the CLR in your application which allows you to more tightly integrate the C# code than is possible by going through COM. You can read an overview of doing this in this <a href="http://msdn.microsoft.com/en-us/magazine/cc163567.aspx" rel="nofollow noreferrer">MSDN Magazine article</a>.</p>
36,879,653
0
<p>The manifest in the examples directory just needs that one line with "include cowsayings::cowsay".</p> <p>There are two tasks that have to happen with puppet, "defining" classes and "declaring" them. The <code>cowsayings/manifests/cowsay.pp</code> contains the definition, but you need to actually declare the class in order to make something happen.</p> <p>That's what <code>puppet apply cowsayings/examples/cowsay.pp</code> does, it declares the class.</p>
38,482,517
0
Kentico 9 cms:cmsTextBox placeholder localization <p>I've duplicated the search box webpart so i can make changes. I'm trying to add a localization string to the placeholder attribute.</p> <p>This isn't working:</p> <pre><code>&lt;cms:CMSTextBox ID="txtWord" runat="server" EnableViewState="false" MaxLength="1000" ProcessMacroSecurity="false" placeholder="&lt;%= CMS.Helpers.ResHelper.GetString("kff.Search--PlaceHolderCopy")%&gt;" /&gt; </code></pre> <p>nor does this:</p> <pre><code>&lt;cms:CMSTextBox ID="txtWord" runat="server" EnableViewState="false" MaxLength="1000" ProcessMacroSecurity="false" placeholder='&lt;%= CMS.Helpers.ResHelper.GetString("kff.Search--PlaceHolderCopy")%&gt;' /&gt; </code></pre> <p>I have a JS Snippet that does work, but i'm hoping to avoid copy in JS files.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code> var $searchField = $('.searchTextbox'); if ($('body').hasClass('ENCA')) { // search field placeholder copy $searchField.attr('placeholder', 'Search For Stuff'); } else { $searchField.attr('placeholder', 'Recherche'); }</code></pre> </div> </div> </p> <p>Can I add the localization string to the server tag, or should it be done in the code behind. I'm not sure the best location in the code behind for this either, I can't see a Page_Load block. </p>
9,353,133
0
<p>Right click on the file choose "properties" and set "content" as for the "Build Action"<br> .JSON is not known to VS2010 web application file types You can change the behavior of vS2010 by <a href="http://blog.andreloker.de/post/2010/07/02/Visual-Studio-default-build-action-for-non-default-file-types.aspx" rel="nofollow">editing the registry</a> </p>
41,020,612
0
Is there a way to use PouchDB Inspector to inspect a remote device? <p>I am using PouchDB with an Ionic APP, I debug it using Chrome and looking into the console. I would like to inspect the device pouchDB database like I do in chrome with the localhost version with <a href="https://pouchdb.com/guides/databases.html#debugging" rel="nofollow noreferrer">PouchDB Inspector</a></p> <p>Is there a way to do this? I do not see anything when I enter the PouchDB Inspector while in Chrome -> Inspect Remote Devices</p>
18,218,236
0
<p><s>Just found a project called: <strong>ProxyApi</strong> </p> <blockquote> <p>ProxyApi is a library that automatically creates JavaScript proxy objects for your ASP.NET MVC and WebApi Controllers.</p> </blockquote> <p>GitHub: <a href="https://github.com/stevegreatrex/ProxyApi">https://github.com/stevegreatrex/ProxyApi</a></p> <p>Blog: <a href="http://blog.greatrexpectations.com/2012/11/06/proxyapi-automatic-javascript-proxies-for-webapi-and-mvc/">http://blog.greatrexpectations.com/2012/11/06/proxyapi-automatic-javascript-proxies-for-webapi-and-mvc/</a></s></p> <p>ProxyApi generated invalid JavaScript for my solution which contained over a hundred separate WebAPI actions. This is probably because ProxyApi does not cover all WebApi features such as custom ActionName attributes. Moreover the ProxyApi library is a bit on the bulky side to my taste. There has to be a more efficient way to do this...</p> <p>So I decided to take a look at the ASP.NET WebAPI source code and it turns out WebAPI has self-describing functionality built into it. You can use the following code from anywhere in your ASP.NET solution to access WebAPI metadata:</p> <pre><code>var apiExplorer = GlobalConfiguration.Configuration.Services.GetApiExplorer(); </code></pre> <p>Based on the output from <code>apiExplorer.ApiDescriptions</code>, I rolled my own metadata provider:</p> <pre><code>public class MetadataController : Controller { public virtual PartialViewResult WebApiDescription() { var apiExplorer = GlobalConfiguration.Configuration.Services.GetApiExplorer(); var apiMethods = apiExplorer.ApiDescriptions.Select(ad =&gt; new ApiMethodModel(ad)).ToList(); return PartialView(apiMethods); } public class ApiMethodModel { public string Method { get; set; } public string Url { get; set; } public string ControllerName { get; set; } public string ActionName { get; set; } public IEnumerable&lt;ApiParameterModel&gt; Parameters { get; set; } public ApiMethodModel(ApiDescription apiDescription) { Method = apiDescription.HttpMethod.Method; Url = apiDescription.RelativePath; ControllerName = apiDescription.ActionDescriptor.ControllerDescriptor.ControllerName; ActionName = apiDescription.ActionDescriptor.ActionName; Parameters = apiDescription.ParameterDescriptions.Select(pd =&gt; new ApiParameterModel(pd)); } } public class ApiParameterModel { public string Name { get; set; } public bool IsUriParameter { get; set; } public ApiParameterModel(ApiParameterDescription apiParameterDescription) { Name = apiParameterDescription.Name; IsUriParameter = apiParameterDescription.Source == ApiParameterSource.FromUri; } } } </code></pre> <p>Use this controller in conjunction with the following view:</p> <pre><code>@model IEnumerable&lt;Awesome.Controllers.MetadataController.ApiMethodModel&gt; &lt;script type="text/javascript"&gt; var awesome = awesome || {}; awesome.api = { metadata: @Html.Raw(Json.Encode(Model)) }; $.each(awesome.api.metadata, function (i, action) { if (!awesome.api[action.ControllerName]) { awesome.api[action.ControllerName] = {}; } awesome.api[action.ControllerName][action.ActionName] = function (parameters) { var url = '/' + action.Url; var data; $.each(action.Parameters, function (j, parameter) { if (parameters[parameter.Name] === undefined) { console.log('Missing parameter: ' + parameter.Name + ' for API: ' + action.ControllerName + '/' + action.ActionName); } else if (parameter.IsUriParameter) { url = url.replace("{" + parameter.Name + "}", parameters[parameter.Name]); } else if (data === undefined) { data = parameters[parameter.Name]; } else { console.log('Detected multiple body-parameters for API: ' + action.ControllerName + '/' + action.ActionName); } }); return $.ajax({ type: action.Method, url: url, data: data, contentType: 'application/json' }); }; }); &lt;/script&gt; </code></pre> <p>The controller will use the <code>ApiExplorer</code> to generate metadata about all available WebAPI actions. The view will render this data as JSON and then execute some JavaScript to transform this data to actual executable JavaScript functions. </p> <p>To use this little bit of magic, insert the following line in the head of your Layout page <strong>after</strong> your jQuery reference.</p> <pre><code>@Html.Action(MVC.Metadata.WebApiDescription()) </code></pre> <p>From now on, you can make your WebAPI calls look like this:</p> <pre><code>// GET: /Api/Notes?id={id} awesome.api.Notes.Get({ id: id }).done(function () { // .. do something cool }); // POST: /Api/Notes awesome.api.Notes.Post({ form: formData }).done(function () { // .. do something cool }); </code></pre> <p>This simple proxy will automatically distinguish query string parameters from request body parameters. Missing parameters or multiple body-parameters will generate an error to prevent typo's or other common WebAPI development errors.</p>
8,030,932
0
<p>If you find yourself repeating similar code in multiple projects, it might be a good idea to extract the portions that are repeated into a library of reusable code in hopes of avoiding repeating yourself in the future. </p> <p>This is unlikely to lead to fully general reusable implementations of design patterns.</p>
19,017,802
0
<p><code>file.log</code> is the input file here. I've used Endoro's techniques but with some small changes.</p> <pre><code>@echo off setlocal enabledelayedexpansion ( echo Disk State Raw_Capacity User_Capacity for /f "usebackq delims=" %%a in ("file.log") do ( set "line=%%a" if /i "!line:Disk:=!" neq "!line!" &lt;nul set/p"=!line:*Disk:=! " if /i "!line:State=!" neq "!line!" &lt;nul set/p"=!line:*State:=! " if /i "!line:Raw=!" neq "!line!" &lt;nul set/p"=!line:*Capacity:=! " if /i "!line:User=!" neq "!line!" &lt;nul set/p"=!line:*Capacity:=!"&amp;echo( ) )&gt;"output file.txt" </code></pre>
24,294,991
0
<p>I don't think that Python is going to give you a strong guarantee that it won't actually read the entire file when you use <code>f.seek</code>. I think that this is too platform- and implementation-specific to rely on Python. You should use Windows-specific tools that give you a guarantee of random acess rather than sequential. </p> <p><a href="http://support.microsoft.com/kb/150700" rel="nofollow">Here's a snippet of Visual Basic</a> that you can modify to suit your needs. You can define your own record type that's two 64-bit integers long. Alternatively, you can use a <a href="http://msdn.microsoft.com/en-us/library/ee433613.aspx" rel="nofollow">C# FileStream object</a> and use its <code>seek</code> method to get what you want. </p> <p>If this is performance-critical software, I think you need to make sure you're getting access to the OS primitives that do what you want. I can't find any references that indicate that Python's <code>seek</code> is going to do what you want. If you go that route, you need to test it to make sure it does what it seems like it should. </p>
25,838,407
0
<p>In my case the issue was solved only after refreshing .htaccess file in drupal root folder. You can take the source here: <a href="https://github.com/drupal/drupal/blob/7.x/.htaccess" rel="nofollow">https://github.com/drupal/drupal/blob/7.x/.htaccess</a></p>
21,402,494
0
<p>There is a dedicated option for that in the queue configuration. You can set a "Prolog" or "Epilog" script that will be executed before and after the job respectively. See <code>man queue_conf</code> or <a href="http://gridscheduler.sourceforge.net/htmlman/htmlman5/queue_conf.html" rel="nofollow">http://gridscheduler.sourceforge.net/htmlman/htmlman5/queue_conf.html</a>.</p>
13,640,979
0
<p>After successful login via facebook save user id into a global variable or in app properties. I will prefer app properties because unless the user will logout from facebook the uid will remain in the app properties i-e</p> <pre><code>Ti.App.Properties.setString('uid', Ti.Facebook.uid); </code></pre> <p>so when you use your app back just check the uid first.</p> <pre><code>var fb_id = Ti.App.Properties.getString('uid'); if(fb_id){ // your code } </code></pre> <p>and when you logout clear the variable with '' or null.</p>
1,598,220
0
<p>The trick is to left join on album permissions which means every album will be selected and if there is a permission record associated with it, that record will be selected too.</p> <p>Then just add a where clause that says either the album must not be private, or a permission record should exist.</p> <pre><code>SELECT Albums.Album_ID, Albums.Name, Albums.Private FROM Albums LEFT JOIN AlbumPermissions ON Albums.Album_ID = AlbumPermissions.Album_ID AND AlbumPermissions.User_ID = 5 WHERE Albmums.private == 'no' OR AlbumPermissions.ID IS NOT NULL </code></pre>
29,440,294
0
<p>Try the following:</p> <pre><code>SELECT myTable1.* FROM myTable1 JOIN (SELECT myTable2.* FROM myTable2) b ON myTable1.myRef = b.myRef WHERE col2 = 1 ORDER BY b.col3 ASC </code></pre> <blockquote> <p>If your <em>WHERE</em> statement is referecing <em>col2</em> correctly, this approach should work just fine.</p> </blockquote>
31,174,994
0
How can i make my sub-menu show and hide when click on main item? <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$('.slideout-menu li').click( function() { $(this).children('.mobile-sub-menu').show(); }, function() { $(this).children('.mobile-sub-menu').hide(); }); </code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>.slideout-menu { position: absolute; top: 100px; left: 0px; width: 100%; height: 100%; background: rgb(248, 248, 248); z-index: 1; } .slideout-menu .slideout-menu-toggle { position: absolute; top: 12px; right: 10px; display: inline-block; padding: 6px 9px 5px; font-family: Arial, sans-serif; font-weight: bold; line-height: 1; background: #222; color: #999; text-decoration: none; vertical-align: top; } .slideout-menu .slideout-menu-toggle:hover { color: #fff; } .slideout-menu ul { list-style: none; font-weight: 300; border-top: 1px solid #dddddd; border-bottom: 1px solid #dddddd; } .slideout-menu ul li { /*border-top: 1px solid #dddddd;*/ border-bottom: 1px solid #dddddd; } .slideout-menu ul li a { position: relative; display: block; padding: 10px; color: #999; text-decoration: none; } .slideout-menu ul li a:hover { background: #aaaaaa; color: #fff; } .slideout-menu ul li a i { position: absolute; top: 15px; right: 10px; opacity: .5; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt; &lt;div class="slideout-menu"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;MANUALS&lt;/a&gt; &lt;ul class="mobile-sub-menu"&gt; &lt;li&gt;&lt;a href="#"&gt;1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;1&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;NEWS&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;SPARE PART&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Photo Gallery&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;WHERE TO BUY&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;SUPPORT&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;EDIT BOOK&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;</code></pre> </div> </div> </p> <p>I add some sub-item under MANUALS main item. What can I do to make its sub-menu hide and show when I click on its parent main item?</p> <p>I try to write some jQuery code but right now only can hide the item but cannot let it show again. Is something wrong on my jQuery code?</p>
4,569,656
0
<p>django test client uses default base url:</p> <p><a href="http://testserver/" rel="nofollow">http://testserver/</a></p> <p>which makes your test url /accounts/register/ into:</p> <p><a href="http://testserver/accounts/register/" rel="nofollow">http://testserver/accounts/register/</a></p> <p>so you should add 'testserver' in django sites.site model as a base url. maximum recursion depth exceed because django client did'nt find 'testserver' as a domain in sites.site</p>
19,364,504
0
<p>If you are using an unpatched .net 4.5. Microsoft broke the <code>.CanExecute</code> event.</p> <p><a href="http://connect.microsoft.com/VisualStudio/feedback/details/753666/net-4-0-application-commands-canexecute-not-updating-in-4-5" rel="nofollow">http://connect.microsoft.com/VisualStudio/feedback/details/753666/net-4-0-application-commands-canexecute-not-updating-in-4-5</a></p> <p>If you are using the <code>RelayCommand</code> from <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090030" rel="nofollow">http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090030</a> and are not raising the CanExecuteChanged event when redoStack changes.</p>
5,875,419
0
<p>you cannot pass an argument to the handler - since you are not the one calling the handler. The handler will be called from somewhere outside your control.</p> <p>you register a handler either with a call to <code>signal</code> or <code>sigaction</code> .</p> <p>hth</p> <p>Mario</p>
8,351,087
0
<p>Based on comments from @kapep I realized what I needed is actually a compression library that will do this work for me.</p> <p>I stumbled across an <a href="http://code.google.com/p/calista/source/browse/trunk/AS3/src/calista/util/LZW.as?r=3" rel="nofollow">LZW compression class within a package called Calista</a> which works great.</p> <p>I did notice that the compression was really slow, which is understandable, but if there are any suggestions for something quicker I'm open to them.</p>
19,942,706
0
<p>Your first call to <code>hadoop fs -ls</code> is a relative directory listing, for the current user typically rooted in a directory called <code>/user/${user.name}</code> in HDFS. So your <code>hadoop fs -ls</code> command is listing files / directories relative to this location - in your case <code>/user/Li/</code></p> <p>You should be able to assert this by running a aboolute listing and confirm the contents / output match: <code>hadoop fs -ls /user/Li/</code></p> <p>As these files are in HDFS, you will not be able to find them on the local filesystem - they are distributed across your cluster nodes as blocks (for real files), and metadata entries (for files and directories) in the NameNode.</p>
2,040,985
0
NSString function <p>I get a null return when i try out my NSString function.</p> <pre><code>//Track.m static NSString* trackUrl; //static NSString* getTrackNumberUrl; @implementation Track - (NSString*)trackUrl { return @"http://site.com/?a="; } - (NSString*)setTrackNumberUrl:(NSString*)trackNumberUrl { if (trackUrl != trackNumberUrl) { return [trackUrl stringByAppendingFormat:trackNumberUrl]; } return @"Error no trackNumber"; } - (NSString*)getTrackNumberUrl:(NSString*)trackNumber { return [[[self alloc] setTrackNumberUrl:trackNumber] autorelease]; } @end </code></pre> <p>MainView.m, just to show the return answer in NSlog</p> <pre><code>- (NSString *) trackNumber{ return [track getTrackNumberUrl:@"86147224549XX"]; } - (void)drawRect:(CGRect)rect { NSLog(trackNumber); } </code></pre> <p>I get a null return answer? Have i miss something? Thanks.</p> <p>Edit some in Track.m</p> <pre><code>- (NSString*)setTrackNumberUrl:(NSString*)trackNumberUrl { if (trackUrl != trackNumberUrl) { return [trackUrl stringByAppendingString:trackNumberUrl]; } return @"Error no trackNumber"; } - (NSString*)getTrackNumberUrl:(NSString*)trackNumber { return [[[Track alloc] setTrackNumberUrl:trackNumber] init]; } </code></pre> <p>This is how it should work.</p> <p>getTrackNumberUrl --> setTrackNumberUrl --> trackUrl (return) --> setTrackNumberUrl + trackNumber --> getTrackNumberUrl (trackNumberUrl = trackUrl + trackNumber)</p> <hr> <p>I have this code to set reference to Track</p> <pre><code>@class Track; @interface MainView : UIView { Track *track; } @property (nonatomic, retain) IBOutlet Track *track; </code></pre> <p>Well if don't should use self alloc, what should i use?</p>
20,195
0
<p>Steve, I had to migrate my old application the way around, that is PgSQL->MySQL. I must say, you should consider yourself lucky ;-) Common gotchas are:</p> <ul> <li>SQL is actually pretty close to language standard, so you may suffer from MySQL's dialect you already know</li> <li>MySQL quietly truncates varchars that exceed max length, whereas Pg complains - quick workaround is to have these columns as 'text' instead of 'varchar' and use triggers to truncate long lines</li> <li>double quotes are used instead of reverse apostrophes</li> <li>boolean fields are compared using IS and IS NOT operators, however MySQL-compatible INT(1) with = and &lt;> is still possible</li> <li>there is no REPLACE, use DELETE/INSERT combo</li> <li>Pg is pretty strict on enforcing foreign keys integrity, so don't forget to use ON DELETE CASCADE on references</li> <li>if you use PHP with PDO, remember to pass a parameter to lastInsertId() method - it should be sequence name, which is created usually this way: [tablename]_[primarykeyname]_seq</li> </ul> <p>I hope that helps at least a bit. Have lots of fun playing with Postgres!</p>
39,792,138
0
<p>Here is my code which will first load the image from the cache if the cache for that file exists, then update the cache file. If it doesn't exist, then load it from the internet(url).</p> <pre><code>Picasso.with(getApplicationContext()).load(headerUserObject.getParseFile("profilePicture").getUrl()) .placeholder(R.color.placeholderblue).networkPolicy(NetworkPolicy.OFFLINE) // try to load the image from cache first .into(((ImageView) findViewById(R.id.profile_picture)), new Callback() { @Override public void onSuccess() { //cache file for this url exists, now update the cache for this url if(networkAvaialable()) // if internet is working update the cache file Picasso.with(getApplicationContext()).invalidate(headerUserObject.getParseFile("profilePicture").getUrl()); } @Override public void onError() { // if cache file does not exist load it from the internet Picasso.with(getApplicationContext()).load(headerUserObject.getParseFile("profilePicture").getUrl()) .placeholder(R.color.placeholderblue) .into(((ImageView) findViewById(R.id.profile_picture))); } }); </code></pre>
3,318,619
0
<p>I don't think you can do this with an attribute. It makes more sense to have the Competition class validate entries.</p> <pre><code>public class Competition { public bool AnswersAreCorrectFor(CompetitionEntry entry) { // check answers } // ... } </code></pre>
29,888,084
0
Post in Spring Rest not working <p>This is the first time I am using REST with Spring, before this I always used JAX RS with Guice implementation.</p> <p>Anyways here is my Controller</p> <pre><code>@Controller @Api(value = "Redis Data Structures Service", description = "Spring REST Controller that handles all the HTTP requests for the Redis Data Structures Service.", position = 1) @ManagedResource(description = "Redis Data Structures Service REST Controller") @RestController @EnableAutoConfiguration @EnableSwagger @RequestMapping("/datastructures/v1") public class MyResource{ @RequestMapping(value = "/process", method = RequestMethod.POST, produces = "application/json", consumes="application/json") public ResponseEntity&lt;Operation&gt; batch(@RequestBody Operation operation) throws JSONException{ //this is just for testing operation.operationId = 123; return new ResponseEntity&lt;Operation&gt;(operation, HttpStatus.OK); } } </code></pre> <p>Here is the Pojo of Operation class:</p> <pre><code>public class Operation{ public int operationId; //get &amp; set } </code></pre> <p>Here is the rest call I am calling from Advance Rest Client Google chrome extension:</p> <pre><code>PATH : &lt;server:port&gt;/datastructures/v1/process/ BODY : { "operationId":10 } METHOD : POST CONTENT TYPE : application/json </code></pre> <p>And on calling this is the exception I am getting, </p> <pre><code>Required request body content is missing....with stack trace </code></pre> <p>Here is the stacktrace <a href="http://pastebin.com/9v5BSq7k" rel="nofollow">click here</a></p> <p>its really frustrating that this much simple call is killing the app, :) . Please help, thanks in advance</p>
2,481,556
0
superfish to use jquery ui theme framework? <p>was wondering if there is a way to make <a href="http://users.tpg.com.au/j_birch/plugins/superfish/" rel="nofollow noreferrer">superfish</a> using jquery ui theme framework, if that isn't possible right now, what practice can be applied to make superfish using jqueryui styles.</p> <p>Thanks for your valuable input.</p> <p>Michael</p>
40,649,234
0
<p>Ever heard of loopback Operation hooks?</p> <p><a href="https://loopback.io/doc/en/lb2/Operation-hooks.html" rel="nofollow noreferrer">https://loopback.io/doc/en/lb2/Operation-hooks.html</a></p> <p>use the <code>before save</code> hook or <code>after save</code> hook on a model to do what ever you want.</p> <p>they have an example, you can try it out</p>
20,847,884
0
<p>You'll find the <code>$locationChangeStart</code> is an event you can listen for to detect for a route change.</p> <p>Try something like</p> <pre><code>$rootScope.$on('$locationChangeStart', function (event, next, current) { /* do some verification */ }); </code></pre> <p><code>$route.reload()</code> will prevent the route change from going through.</p> <p>The distinction between user clicking back or changing the url etc will not make a difference. As browsers don't reload any resources when you alter the url past the <code>#</code> it's all still contained in your angular logic. This means all these methods should trigger the <code>$locationChangeStart</code> event.</p> <p>@Jon pointed out that the <code>$route</code> service will definitely be of use to you. the <code>.reload()</code> method will prevent the route change from completing but there is much more you can do with the <code>$route</code> service if you look into it - see <a href="http://docs.angularjs.org/api/ngRoute.$route" rel="nofollow">documentation</a>.</p>
29,032,872
0
<p>Instead of doing so much of work as mentioned by <a href="http://stackoverflow.com/a/26454325/1576416">Muzikant</a> and like <a href="http://stackoverflow.com/a/29058430/1576416">this answer</a></p> <pre><code> getSupportActionBar().setDisplayShowHomeEnabled(false); getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.WHITE)); LayoutInflater mInflater = LayoutInflater.from(this); View mCustomView = mInflater.inflate(R.layout.action_bar_home, null); getSupportActionBar().setCustomView(mCustomView); getSupportActionBar().setDisplayShowCustomEnabled(true); Toolbar parent =(Toolbar) mCustomView.getParent();//first get parent toolbar of current action bar parent.setContentInsetsAbsolute(0,0);// set padding programmatically to 0dp </code></pre> <p>You have to add only the last two lines of code to solve your problem.</p> <p>I hope this might help you and anyone else.</p> <blockquote> <p><strong>UPDATE:</strong> After making some research on it, i found that this solution will not work in some cases. The left side gap (HOME or BACK) will be removed with this but the right side gap (MENU) will remain as is. Below is the solution in these cases.</p> </blockquote> <pre><code>View v = getSupportActionBar().getCustomView(); LayoutParams lp = v.getLayoutParams(); lp.width = LayoutParams.MATCH_PARENT; v.setLayoutParams(lp); </code></pre> <p>Add these four lines to above code, so that the right side gap is also removed from support action bar. </p>
36,875,469
0
clang templated use of __attribute__((vector_size(N))) <p>I create an application which make use of a SSE4.1 vector instructions. To better manage the vector types I've created templated helper struct vector_type as follows:</p> <pre><code>template &lt;class T, int N&gt; struct vector_type { typedef T type __attribute__((vector_size(sizeof(T)*N))); using single_element_type = T; static constexpr int size = N; typedef union { type v; T s[N]; } access_type; // some other implementation }; </code></pre> <p>This compiles perfectly with g++. Unfortunately the clang++ (I use clang++ in version 3.6) complains that <code>'vector_size' attribute requires an integer constant</code>. I'm perfectly aware that this is a well known issue of clang, which is submitted as a Bug 16986. My question is rather is there a way to workaround the problem. I came up with the code:</p> <pre><code>template &lt;class T, int ASize&gt; struct vector_type_impl; template &lt;&gt; struct vector_type_impl&lt;int,16&gt; { typedef int type __attribute__((vector_size(16))); }; template &lt;class T, int N&gt; struct vector_type: vector_type_impl&lt;T, N*sizeof(T)&gt; { using type = typename vector_type_impl&lt;T, N*sizeof(T)&gt;::type; using single_element_type = T; static constexpr int size = N; typedef union { type v; T s[N]; } access_type; // some other implementation }; </code></pre> <p>But I can't believe there is no better way to do it.</p>
25,347,762
0
<p>The border between these two are getting ever so thinner.</p> <p>Application servers exposes business logic to a client. So its like application server comprises of a set of methods(not necessarily though, can even be a networked computer allowing many to run software on it) to perform business logic. So it will simply output the desired results, not HTML content. (similar to a method call). So it is not strictly HTTP based.</p> <p>But web servers passes HTML content to web browsers (Strictly HTTP based). Web servers were capable of handling only the static web resources, but the emergence of server side scripting helped web servers to handle dynamic contents as well. Where web server takes the request and directs it to the script (PHP, JSP, CGI scripts, etc.) to CREATE HTML content to be sent to the client. Then web server knows how to send them back to client. BECAUSE that's what a web server really knows.</p> <p>Having said that, nowadays developers use both of these together. Where web server takes the request and then calls a script to create the HTML, BUT script will again call an application server LOGIC (e.g. Retrieve transaction details) to fill the HTML content.</p> <p>So in this case both the servers were used effectively. </p> <p>Therefore .... We can fairly safely say that in nowadays, in most of the cases, web servers are used as a subset of application servers. BUT theatrically it is NOT the case.</p> <p>I have read many articles about this topic and found <a href="http://www.javaworld.com/article/2077354/learn-java/app-server-web-server-what-s-the-difference.html">this</a> article quite handy.</p>
2,115,265
0
HTML 5 - Who, What, Where <p>I am looking at HTML5 information at W3. Some of the new functionality seems interesting.</p> <p>Which browsers support it?</p> <p>How can I ensure that I am using HTML 5?</p> <p>Is there a way to be told that "there is an HTML 5 command you should be using" if I use something in HTML 4 or what not?</p> <p>HTML 5 Canvas is supposed to allow a lot of Flash type functionality no?</p>
6,008,722
0
<p>It's a little complicated at the mentioned blog, I've used a similar but simplier way. You do need 3 star images (red_star_full.png, red_star_half.png and red_star_empty.png) and one xml, that's all.</p> <p>Put these 3 images at res/drawable.</p> <p>Put there the following ratingbar_red.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@android:id/background" android:drawable="@drawable/red_star_empty" /&gt; &lt;item android:id="@android:id/secondaryProgress" android:drawable="@drawable/red_star_half" /&gt; &lt;item android:id="@android:id/progress" android:drawable="@drawable/red_star_full" /&gt; &lt;/layer-list&gt; </code></pre> <p>and, finally, tell your ratingbar definition to use this, i.e.</p> <pre><code>&lt;RatingBar android:progressDrawable="@drawable/ratingbar_red"/&gt; </code></pre> <p>That's it.</p>
28,738,736
0
<p>Based on your example, you are trying to delete all files present within some folder. Instead of iterating over all the files of the folder, and delete each file individually, the better way is to use <a href="https://docs.python.org/2/library/shutil.html" rel="nofollow">shutil.rmtree()</a>. It will recursively delete all the files for the given path (similar to <code>rm -r /path/to/folder</code> in unix).</p> <pre><code>import shutil shutil.rmtree('/path/to/folder') </code></pre>
6,928,926
0
What advantages are gained by using namespaces in javascript? <p>Apart from not cluttering the global namespace and gaining the ability to encapsulate code in private members, is there any benefit?</p>
5,546,916
0
<p>If I execute the query with an AND, even then , both the tables are accessed</p> <p>SET STATISTICS IO ON IF EXISTS (SELECT * from master..spt_values where [name] = 'rpcc') and EXISTS(SELECT * from master..spt_monitor where pack_sent = 5235252) PRINT 'Y' </p> <p>Table 'spt_monitor'. Scan count 1, logical reads 1, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'spt_values'. Scan count 1, logical reads 17, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.</p>
38,372,578
0
Storm 1.0.1 Worker error on submitting topology <p>I am getting the error below (worker.log) when submitting a topology to Storm 1.0.1 (despite the error, the topology <strong>does get submitted</strong> and <strong>appears</strong> in the Storm UI):</p> <pre><code>o.a.s.d.worker [ERROR] Error on initialization of server mk-worker java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) ~[?:1.8.0_91] at java.lang.Thread.start(Thread.java:714) ~[?:1.8.0_91] at org.apache.storm.timer$mk_timer.doInvoke(timer.clj:77) ~[storm-core-1.0.1.jar:1.0.1] at clojure.lang.RestFn.invoke(RestFn.java:457) ~[clojure-1.7.0.jar:?] at org.apache.storm.daemon.worker$mk_halting_timer.invoke(worker.clj:244) ~[storm-core-1.0.1.jar:1.0.1] at org.apache.storm.daemon.worker$worker_data$fn__8190.invoke(worker.clj:293) ~[storm-core-1.0.1.jar:1.0.1] at org.apache.storm.util$assoc_apply_self.invoke(util.clj:930) ~[storm-core-1.0.1.jar:1.0.1] at org.apache.storm.daemon.worker$worker_data.invoke(worker.clj:268) ~[storm-core-1.0.1.jar:1.0.1] at org.apache.storm.daemon.worker$fn__8450$exec_fn__2461__auto__$reify__8452.run(worker.clj:611) ~[storm-core-1.0.1.jar:1.0.1] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_91] at javax.security.auth.Subject.doAs(Subject.java:422) ~[?:1.8.0_91] at org.apache.storm.daemon.worker$fn__8450$exec_fn__2461__auto____8451.invoke(worker.clj:609) ~[storm-core-1.0.1.jar:1.0.1] at clojure.lang.AFn.applyToHelper(AFn.java:178) ~[clojure-1.7.0.jar:?] at clojure.lang.AFn.applyTo(AFn.java:144) ~[clojure-1.7.0.jar:?] at clojure.core$apply.invoke(core.clj:630) ~[clojure-1.7.0.jar:?] at org.apache.storm.daemon.worker$fn__8450$mk_worker__8545.doInvoke(worker.clj:583) [storm-core-1.0.1.jar:1.0.1] at clojure.lang.RestFn.invoke(RestFn.java:512) [clojure-1.7.0.jar:?] at org.apache.storm.daemon.worker$_main.invoke(worker.clj:771) [storm-core-1.0.1.jar:1.0.1] at clojure.lang.AFn.applyToHelper(AFn.java:165) [clojure-1.7.0.jar:?] at clojure.lang.AFn.applyTo(AFn.java:144) [clojure-1.7.0.jar:?] at org.apache.storm.daemon.worker.main(Unknown Source) [storm-core-1.0.1.jar:1.0.1] 2016-07-14 11:48:29.568 o.a.s.util [ERROR] Halting process: ("Error on initialization") java.lang.RuntimeException: ("Error on initialization") at org.apache.storm.util$exit_process_BANG_.doInvoke(util.clj:341) [storm-core-1.0.1.jar:1.0.1] at clojure.lang.RestFn.invoke(RestFn.java:423) [clojure-1.7.0.jar:?] at org.apache.storm.daemon.worker$fn__8450$mk_worker__8545.doInvoke(worker.clj:583) [storm-core-1.0.1.jar:1.0.1] at clojure.lang.RestFn.invoke(RestFn.java:512) [clojure-1.7.0.jar:?] at org.apache.storm.daemon.worker$_main.invoke(worker.clj:771) [storm-core-1.0.1.jar:1.0.1] at clojure.lang.AFn.applyToHelper(AFn.java:165) [clojure-1.7.0.jar:?] at clojure.lang.AFn.applyTo(AFn.java:144) [clojure-1.7.0.jar:?] at org.apache.storm.daemon.worker.main(Unknown Source) [storm-core-1.0.1.jar:1.0.1] </code></pre> <p>Also found this entry in the supervisor.log:</p> <pre><code>o.a.s.util [WARN] Worker Process ea92e1b7-c870-4b4c-b0a6-00272f27f521:# There is insufficient memory for the Java Runtime Environment to continue. </code></pre> <p>However, "free -m" command suggests enough free memory.</p> <p>Further messages seem to suggest that the worker fails to start and supervisor.log then starts logging INFO message "{id of worker process} still hasn't started" multiple times.</p>
14,299,821
0
<p>Another way to do this would be to use OpenGL. (I think LWJGL would allow it in Java.) You could upload a 1D texture containing the straight to gamma corrected table, and then write a glsl shader that applied the gamma table to your pixels. Not sure how that would fit in with your current processing model, but I use it to process 1920x1080 HD RGBA frames in real-time all the time.</p>
31,926,023
0
<p>A self join joins a table to itself. The <code>employee</code> table might be joined to itself in order to show the manager name and the employee name in the same row.</p> <p>An inner join joins any two tables and returns rows where the key exists in both tables. A self join can be an inner join (most joins are inner joins and most self joins are inner joins). An inner join can be a self join but most inner joins involve joining two different tables (generally a parent table and a child table).</p>
24,512,586
0
<p>A possible solution posted by <strong>Eugene Kazakov</strong> <a href="http://jmeter.512774.n5.nabble.com/Using-Python-or-Ruby-from-Jmeter-td5716088.html" rel="nofollow">here</a>:</p> <blockquote> <p>JSR223 sampler has good possibility to write and execute some code, just put jython.jar into /lib directory, choose in "Language" pop-up menu jython and write your code in this sampler.</p> </blockquote> <p><a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=47511" rel="nofollow">Sadly there is a bug in Jython, but there are some suggestion on the page.</a></p> <p><a href="https://www.google.com/search?q=jython%20jmeter" rel="nofollow">More here.</a></p>
37,565,288
0
ReactiveCocoa bi-directional bind in UITableViewCell <p>I've got <code>UITableView</code> with server list. The possible actions are:</p> <ul> <li>add server </li> <li>delete server</li> <li>save data (current server list)</li> </ul> <p>Each <code>UITableViewCell</code> contains 2 <code>UITextField</code> with server name and server url.</p> <p>There is also validation required which disables addButton if ANY <code>textfield</code> is empty (user can edit any visible record with server name/url)</p> <p>So far I managed to bind viewModel with <code>textfields</code> so editing <code>textfield</code> fills the model data. The problem is with opposite direction. When I delete row using code below </p> <pre><code>- (void)removeCellAtIndexPath:(NSIndexPath *)indexPath { [self.viewModel.tempServerList removeObjectAtIndex:indexPath.row]; if (![self.viewModel.tempServerList count]) { self.buttonAdd.enabled = YES; } [self.tableView beginUpdates]; [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; [self.tableView endUpdates]; } </code></pre> <p>And add again new cell, it is already filled with previous (deleted) data. Possible workaround is custom init method + settings the text fields empty. Is is another way to bind it bi-directional <code>TextField</code> with model?</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ServerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[[ServerTableViewCell class] description]]; RACSignal *nameSignal = [cell.textFieldServerName.rac_textSignal takeUntil:cell.rac_prepareForReuseSignal]; RACSignal *urlSignal = [cell.textFieldServerURL.rac_textSignal takeUntil:cell.rac_prepareForReuseSignal]; RAC([self.viewModel.tempServerList objectAtIndex:indexPath.row], name) = nameSignal; RAC([self.viewModel.tempServerList objectAtIndex:indexPath.row], url) = urlSignal; [[[RACSignal combineLatest:@[nameSignal, urlSignal] reduce:^(NSString *name, NSString *url) { for (ServerDataModel *serverData in self.viewModel.tempServerList) { if (!serverData.name.length || !serverData.url.length) { return @NO; } } return @YES; }] takeUntil:cell.rac_prepareForReuseSignal] subscribeNext:^(NSNumber *x) { self.buttonAdd.enabled = x.boolValue; }]; cell.delegate = self; cell.indexPath = indexPath; return cell; } </code></pre>
30,871,442
0
Are values "ok", false, true, null, 123 valid JSON <p>Are following strings a valid JSON?</p> <p><code>"ok"</code></p> <p><code>false</code></p> <p><code>true</code></p> <p><code>null</code></p> <p><code>123</code></p> <p>If not why do standard javascript <code>JSON.parse</code> method allow to use this values as valid JSON?</p> <p>I sometimes use this values when implementing JSON REST APIs, and faced with that objective-c frameworks doesn't parse this values.</p>
30,405,754
0
<p>your bootstrap goes in your phpunit.xml config file.</p> <p>So it would look something like:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;phpunit bootstrap="bootstrap.php" colors="true"&gt; &lt;/phpunit&gt; </code></pre> <p>and when you run your test you run it with</p> <pre><code>phpunit --configuration=phpunit.xml </code></pre> <p>For reference: The <a href="https://phpunit.de/manual/current/en/appendixes.configuration.html" rel="nofollow">phpunit.xml config section</a> in the manual.</p>
39,296,011
0
<p>Well, whenever you make calls towards google libraries, costs you time.</p> <p>Which means that if you manage to somehow get these 2 lines out of the loop, you will most likely succeed. </p> <pre><code>var toCopy = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("FINAL").getRange(3, 3, data1Length - 2, data1LengthHorizontal - 2); //HardCoded Starting Point toCopy.setValues(results); </code></pre> <p>Inside the loop try to work only with arrays, remember indexes, line rows, etc. and then call <code>getRange</code> and <code>setValues</code> <strong>outside</strong> the loop, according to the data you saved inside the loop.</p>
22,943,329
0
Inputing a selection from an array c# <p>Hi there I'm very new to C# so please bear with me if my question has a very obvious answer.</p> <p>I am trying to write a code that displays an array of options to the user with a number to select the option. The user then selects their option and the code will display their selection from the array. </p> <p>So for example </p> <pre><code>Select 1 for apples Select 2 for oranges Select 3 for pears Please Enter your Selection : </code></pre> <p>I keep typing a for loop to display my area but I cannot get my program to read the input from the array this is what I have so far </p> <pre><code>static void Main(string[] args) { string[] fruit = [3] fruit[0]=("apples"); fruit[1]=("oranges"); fruit[2]=("pears"); for (int i = 0; i &lt; fruit.length; i++) { Console.WriteLine("Enter {0} to select {1}", i, fruit[i]); } string choice = Console.ReadLine(); int i = int.Parse(choice); Console.WriteLine("You have selected {0} which is {1}", i, fruit[i]); Console.ReadLine(); } </code></pre> <p>This gives me an error and if I place this within the for loop then the program does not display me all my options.</p>
208,208
0
<p>I would definitely first try out Webstart. We've had lots of success launching even the early Eclipse RCP apps using Webstart, and you can probably not get more funky classloading issues than with the OSGI framework (Eclipse Equinox). </p> <p>Could you perhaps give some more detail in your question about you classloading approach?</p> <p>Regarding the GC and other VM settings: these are easy to specify in your JNLP (Java Network Launching Protocol) files used by Webstart for launching apps.</p>
22,423,277
0
how to close smooth-box master jquery image by Esc button? <p>I have used the following..can some one help me?</p> <pre><code>.on("click",".sb-cancel",function(e){$(".smoothbox").fadeOut("slow",function(){$(".smoothbox").remove()}) </code></pre>
2,761,489
0
SVN - Retrieve history of item "replaced into" existing directory <p>I created a branch from my SVN trunk. In the branch, another developer deleted a directory, but then readded it with the same files. When I merged the changes from the branch back into the trunk (using TortoiseSVN), this directory had a "replace into" message. I unfortunately merged those in (none of these files in the branch had changed, but since it was deleted and added, it showed up as a change). Now, the history for those files only goes back to the time it was readded in the branch. I have the old history in a tag from before the merge, but it is a pain to have to go to that to get the history.</p> <p>Is there a way to update the files to get the history back into the trunk? Even if I merge the tag into the trunk, would it actually update the full history? I have a feeling it would just merge any file changes, not the history.</p>
39,354,953
0
Trouble merging the Columns in XSLT <p>I have a XML and i am transforming it into HTML using XSLT. The current table structure is as below.</p> <pre><code> |-------------------------| |type |name |age | |data |john |28 | |comment |pass | | |-------------------------| </code></pre> <p>I am trying to merge the cell of row where col0='comment' in just two TD. First TD for 'comment' and second TD for 'pass'. I will add colspan =2 in second TD.</p> <p>I am trying to generate the following table structure from below Code. (The td with Pass will have colsapn=2)</p> <pre><code>|-------------------------| |type |name |age | |data |john |28 | |comment |pass | |-------------------------| </code></pre> <p>The XML sample data is as follows.</p> <pre><code>&lt;Form&gt; &lt;Log&gt; &lt;col0&gt;type&lt;/col0&gt; &lt;col1&gt;name&lt;/col1&gt; &lt;col2&gt;age&lt;/col2&gt; &lt;/Log&gt; &lt;Log&gt; &lt;col0&gt;data&lt;/col0&gt; &lt;col1&gt;john&lt;/col1&gt; &lt;col2&gt;28&lt;/col2&gt; &lt;/Log&gt; &lt;Log&gt; &lt;col0&gt;comment&lt;/col0&gt; &lt;col1&gt;passed&lt;/col1&gt; &lt;col2&gt;&lt;/col2&gt; &lt;/Log&gt; &lt;/Form&gt; </code></pre> <p>I am using the below XSLT code to do the transformation. But its not generating the expected result. This part of the bigger XML so i am putting the required code only.</p> <p>The code is as follows. I have removed the other part of the code which is of no use related to the issue.</p> <pre><code>&lt;xsl:for-each select="Form"&gt; -- Another code for Log position 1 &lt;xsl:apply-templates select="Log[position() &gt; 1]" mode="LogsData" /&gt; &lt;/xsl:for-each&gt; &lt;xsl:template match="Form/*" mode="LogsData"&gt; &lt;xsl:choose&gt; &lt;xsl:when test="name()='col0' and text()='Comments'"&gt; &lt;tr&gt; &lt;td&gt; &lt;b&gt; &lt;xsl:value-of select="name() = 'col0' and text()='comment'"/&gt; &lt;/b&gt; &lt;/td&gt; &lt;td&gt; &lt;xsl:for-each select="*[starts-with(name(), 'col')]"&gt; &lt;xsl:value-of select="." /&gt; &lt;/xsl:for-each&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;tr&gt; &lt;xsl:for-each select="*[starts-with(name(), 'col')]"&gt; &lt;xsl:choose&gt; &lt;xsl:when test="name() = 'col0'"&gt; &lt;td&gt; &lt;b&gt; &lt;xsl:value-of select="." disable-output-escaping="yes"/&gt; &lt;/b&gt; &lt;/td&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;td&gt; &lt;xsl:value-of select="." disable-output-escaping="yes"/&gt; &lt;/td&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:for-each&gt; &lt;/tr&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:template&gt; </code></pre> <p>The result is not generating as expected. The table is still coming the way it was. Separate TD for each comment data. I just want two TD in Comment section. First TD with "Comment" in it and second TD with all the other values of columns other then col0. Kindly help me to fix the issue. </p>
1,704,216
0
<p>You realize Python doesn't do true multi-threading as you would expect on a multi-core processor:</p> <p><a href="http://en.wikipedia.org/wiki/Global_Interpreter_Lock" rel="nofollow noreferrer">See Here</a> <a href="http://en.wikipedia.org/wiki/Python_%28programming_language%29" rel="nofollow noreferrer">And Here</a></p> <p>Don't expect those 10 things to take 1 second each. Besides, even in true multi-threading there is a little overhead associated with the threads. I'd like to add that this isn't a slur against Python.</p>
20,928,193
0
<p>I ran into the same issue tonight, and it turned out I needed image/jpeg and image/jpg</p> <pre><code> validates_attachment :avatar, :styles =&gt; { :medium =&gt; "300x300", :thumb =&gt; "100x100" }, :content_type =&gt; { :content_type =&gt; "image/jpg", :content_type =&gt; "image/jpeg", :content_type =&gt; "image/png" }, :size =&gt; { :in =&gt; 0..1.megabytes } </code></pre> <p>It worked when just trying /^image/ but I like being specific.</p>
34,704,666
0
<p>That is because <code>3,3</code> converted to a double using the <code>InvariantCulture</code> yields <code>33</code>. It does not make the output to become in the <code>InvariantCulture</code>, since the numeric data type double has nothing to do with a specific culture. Only the <em>textual representation</em> does.</p> <p>So <code>3,3</code> is not a valid value for a string to be converted to a double. It removes the <code>,</code> and converts to <code>33</code>. <code>3.3</code> would be a valid value to be converted to <code>3.3d</code>. So you have to use another culture, probably <code>it-IT</code> as in your debug view, to convert the value <code>3,3</code> to a <code>double</code> of <code>3.3d</code>.</p>
37,652,378
0
Local passport authorization on different ports <p>I have a node.js application running on port 5000, where I use passport.js as authorization. I authorize users from a post request, where I use a custom callback:</p> <pre><code>this.router.post('/member/login', (req, res, next) =&gt; { passport.authenticate('local', (err, member, info) =&gt; { if (err) res.json(400).json({message: "An error ocurred"}); if (!member) { console.log("No member found!"); return res.status(409).json({message: "No member found!"}) } req.logIn(member, (err) =&gt; { if (err) { console.log(err); return res.status(400).json({message: "An error ocurred"}); } return res.json(member); }); })(req, res, next); }); </code></pre> <p>This works fine, but when I develop local I have a frontend Angular2 application, which runs on a different port (4200), so in my development I am not possible to get the authorized user: req.user is undefined. I use express-session to store the authorized user.</p> <p>When I deploy I bundle both applications up together, so everything works. </p> <p>Does anyone have a good and simple solution for this issue? Again it's only in development I have this problem.</p>
27,211,898
0
Setting up relay host for zimbra <p>I would like to configure Smtp for my mail server to send out mail to external server. I followed <a href="http://wiki.zimbra.com/wiki/Outgoing_SMTP_Authentication" rel="nofollow">this link</a> and confused of what exactly the relay mail should be, <code>zmprov ms server.domain.com zimbraMtaRelayHost mailrelay.example.com</code> I did not know what should be use to replay for <code>mailrelay.example.com</code>. If my mail domain is <code>mail.domain.com</code> so can I set up for relay host as <code>wiki.domain.com</code>?</p>
1,088,855
0
Suggestions for uploading very large (> 1GB) files <p>I know that such type of questions exist in SF but they are very specific, I need a generic suggestion. I need a feature for uploading user files which could be of size more that 1 GB. This feature will be an add-on to the existing file-upload feature present in the application which caters to smaller files. Now, here are some of the options</p> <ol> <li>Use HTTP and Java applet. Send the files in chunks and join them at the server. But how to throttle the n/w.</li> <li>Use HTTP and Flex application. Is it better than an applet wrt browser compatibility &amp; any other environment issues?</li> <li>Use FTP or rather SFTP rather than HTTP as a protocol for faster upload process</li> </ol> <p>Please suggest.</p> <p>Moreover, I've to make sure that this upload process don't hamper the task of other users or in other words don't eat up other user's b/w. Any mechanisms which can be done at n/w level to throttle such processes?</p> <p>Ultimately customer wanted to have FTP as an option. But I think the answer with handling files programmatically is also cool.</p>
40,387,374
0
<p>Your code works fine unless you make sure that your parent element has a height greater than zero - otherwise your <code>.main</code> element will have no height either.</p> <p>Also make sure that the file path to your image is correct. You can use the developer tools of your browser to check the height of your container and the image url.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>html, body { width: 100%; height: 100%; } .main { min-height: 100%; width: 100%; position: relative; background-image: url(//placehold.it/500); background-repeat: no-repeat; background-size: cover; display: block; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="main"&gt;&lt;/div&gt;</code></pre> </div> </div> </p>
20,961,651
0
Mercurial Log Graph Complications <p>Okay - I'm definitely learning a lot about Mercurial and version control systems more and more as I use them, but I'm really confused about why my local copies of one of my repositories (call it project-alpha) on three machines I use (machine 1, machine 2, and machine 3) are different. Notably, they do not share the same tip.</p> <p>I was hoping somebody could explain this to me, and in addition offer some explanation as to how I may avoid having to "merge" branches altogether (which is how this complication came up in the first place). It would be awesome if somebody could provide an example of how certain circumstances will force me to "merge" on one machine, whereas on another it is perfectly fine without.</p> <p>For clarification, I am including the </p> <pre><code>hg log --graph </code></pre> <p>commands for each of the three machines I am using (but only where they begin to differ, since it's a long project I'm working on). </p> <p><strong>Machine 1</strong></p> <pre><code>@ changeset: 88:e8aafce5753a | tag: tip | user: Your Name &lt;&gt; | date: Mon Jan 06 15:30:15 2014 -0500 | summary: | o changeset: 87:5d76250aad71 | user: Your Name &lt;&gt; | date: Mon Jan 06 11:32:53 2014 -0500 | summary: | o changeset: 86:4788926f4dc9 |\ parent: 84:caf2a2a127e0 | | parent: 85:682beb5c2a22 | | user: Your Name &lt;&gt; | | date: Thu Jan 02 12:52:17 2014 -0500 | | summary: | | | o changeset: 85:682beb5c2a22 | | parent: 83:bde4e46678d8 | | user: Your Name &lt;&gt; | | date: Thu Jan 02 12:38:45 2014 -0500 | | summary: | | o | changeset: 84:caf2a2a127e0 | | parent: 82:729da698a926 | | user: Your Name &lt;&gt; | | date: Tue Dec 17 15:44:17 2013 -0500 | | summary: | | | o changeset: 83:bde4e46678d8 |/ user: Your Name &lt;&gt; | date: Wed Jan 01 22:20:54 2014 -0500 | summary: | o changeset: 82:729da698a926 | user: Your Name &lt;&gt; | date: Mon Dec 16 12:41:54 2013 -0500 | summary: </code></pre> <p><strong>Machine 2</strong></p> <pre><code>@ changeset: 88:e8aafce5753a | tag: tip | user: Your Name &lt;&gt; | date: Mon Jan 06 15:30:15 2014 -0500 | summary: | o changeset: 87:5d76250aad71 | user: Your Name &lt;&gt; | date: Mon Jan 06 11:32:53 2014 -0500 | summary: | o changeset: 86:4788926f4dc9 |\ parent: 83:caf2a2a127e0 | | parent: 85:682beb5c2a22 | | user: Your Name &lt;&gt; | | date: Thu Jan 02 12:52:17 2014 -0500 | | summary: | | | o changeset: 85:682beb5c2a22 | | user: Your Name &lt;&gt; | | date: Thu Jan 02 12:38:45 2014 -0500 | | summary: | | | o changeset: 84:bde4e46678d8 | | parent: 82:729da698a926 | | user: Your Name &lt;&gt; | | date: Wed Jan 01 22:20:54 2014 -0500 | | summary: | | o | changeset: 83:caf2a2a127e0 |/ user: Your Name &lt;&gt; | date: Tue Dec 17 15:44:17 2013 -0500 | summary: | o changeset: 82:729da698a926 | user: Your Name &lt;&gt; | date: Mon Dec 16 12:41:54 2013 -0500 | summary: </code></pre> <p><strong>Machine 3</strong></p> <pre><code>o changeset: 89:e8aafce5753a | tag: tip | user: Your Name &lt;&gt; | date: Mon Jan 06 15:30:15 2014 -0500 | summary: | o changeset: 88:5d76250aad71 | user: Your Name &lt;&gt; | date: Mon Jan 06 11:32:53 2014 -0500 | summary: | o changeset: 87:4788926f4dc9 |\ parent: 83:caf2a2a127e0 | | parent: 85:682beb5c2a22 | | user: Your Name &lt;&gt; | | date: Thu Jan 02 12:52:17 2014 -0500 | | summary: | | +---@ changeset: 86:eab05f7f7ab6 | |/ parent: 83:caf2a2a127e0 | | parent: 85:682beb5c2a22 | | user: Your Name &lt;&gt; | | date: Thu Jan 02 12:52:31 2014 -0500 | | summary: | | | o changeset: 85:682beb5c2a22 | | user: Your Name &lt;&gt; | | date: Thu Jan 02 12:38:45 2014 -0500 | | summary: | | | o changeset: 84:bde4e46678d8 | | parent: 82:729da698a926 | | user: Your Name &lt;&gt; | | date: Wed Jan 01 22:20:54 2014 -0500 | | summary: | | o | changeset: 83:caf2a2a127e0 |/ user: Your Name &lt;&gt; | date: Tue Dec 17 15:44:17 2013 -0500 | summary: | o changeset: 82:729da698a926 | user: Your Name &lt;&gt; | date: Mon Dec 16 12:41:54 2013 -0500 | summary: </code></pre> <p>Let me first start off by saying that I understand there are some differences simply due to the fact that some changes were pushed on some machines and pulled on others. Machine 1 and 2 are the primary ones I use, and it clearly doesn't differ too much. What I'm concerned about is Machine 3, which currently has 3 heads, and an additional changeset (89 instead of 88). I'm a bit confused as to what is happening, how I can fix this, and I would appreciate knowing exactly what I did to cause this so that I may avoid this type of behavior next time. Thanks in advance!</p>
9,579,300
0
mysql high read & write <p>I've been reading about high read or write but what about both, what would be your advice? In my case a high number of people are writing data and another set of people are reading it straight after, this is all web based and there are no pattern to determine who is writing or reading. Also because the data are changing several time per second they can't be cache, but the "cache size" could be increase to avoid mysql to issue I/O all the time. </p> <p>One of the idea would be to use mysql cluster, but the data will have to be write to all nodes at the same time, what would be the impact in term of performance. </p> <p>Seeking for advices. </p>
20,892,772
1
Pygame: Drawing a circle after input <p>this seemed like a really simple code, this is why I'm even more confused that it won't work. I'm creating a game that draws different lines of a picture and, after each shape, asks the user what it could be. My problem is that it won't even draw the first circle once I have the input()-part included, but without the input, it works perfectly fine. </p> <pre><code>import pygame, sys from pygame.locals import * pygame.init() screen = pygame.display.set_mode((1000, 600)) pygame.display.set_caption('PyDoodle') clock= pygame.time.Clock() clock.tick(30) #importing background pictures: backPimg = pygame.image.load('Wood.jpg') backPimg = pygame.image.load('Paper.jpg') backWx = 0 backWy = 0 backPx = 250 backPy = 0 screen.blit(backWimg, (backWx, backWy)) screen.blit(backPimg, (backPx, backPy)) #colors black = (0, 0, 0) #solutions snowman = ('snowman'.capitalize(), 'snow man'.upper(), 'snowman', 'snow man') #MAIN GAME while True: for event in pygame.event.get() if event.type == QUIT: pygame.quit() sys.exit() pygame.display.update() #DRAWING #1: SNOWMAN #circle 1 - the part that's getting on my nerves pygame.draw.circle(screen, black, (500,400), 70, 2) guess1 = raw_input('Your guess:\n') </code></pre> <p>It'd be really nice if you could have a look at it, maybe you have some suggestions.</p>
24,556,501
0
<p>That's because you incorrectly calculating percentage for columns <code>margin</code> and <code>width</code>.</p> <p>Since you use <a href="http://www.w3schools.com/cssref/css3_pr_box-sizing.asp" rel="nofollow"><code>box-sizing: border-box;</code></a> on <code>section#hp-cols</code>, the inner width for the section with <code>10px</code> padding in both side is <strong><code>1120px</code></strong>, <em>not</em> <strong><code>1140px</code></strong>. If you use <code>width: 31.57894%;</code> (<code>360px</code> divided by <code>1140px</code>) for your column, it would give you columns with <strong><code>353px</code> wide</strong> <em>instead of</em> <strong><code>360px</code></strong> (since <code>31.57894%</code> of <code>1120px</code> is <code>353px</code>).</p> <p>The solution is to recalculate all percentage value, and use 1120 as divider. It should be like this.</p> <pre><code>section#hp-cols { padding: 0 .89285714%; /* 10px / 1120px */ } section#hp-cols ul li { width: 32.1428571%; /* 360px / 1120px */ } section#hp-cols ul li:nth-child(2) { margin: 0 1.78571429%; /* 20px / 1120px */ } </code></pre> <p>Here is the <a href="http://jsfiddle.net/cuplizian/7Aq74/" rel="nofollow"><strong>fiddle</strong></a> and <a href="http://fiddle.jshell.net/cuplizian/7Aq74/show/light/" rel="nofollow"><strong>full demo</strong></a> of fluid width page. I also made <a href="http://jsfiddle.net/cuplizian/J8EJ6/" rel="nofollow">fiddle</a> and <a href="http://fiddle.jshell.net/cuplizian/J8EJ6/show/light/" rel="nofollow">demo</a> of fixed width page for comparison.</p> <p>Hope it helps :)</p>
9,889,616
0
<p>It appears the ruby-mysql gem supports this: <a href="https://github.com/tmtm/ruby-mysql/blob/master/lib/mysql.rb#L406-419" rel="nofollow">https://github.com/tmtm/ruby-mysql/blob/master/lib/mysql.rb#L406-419</a></p> <p>I assume it is processing this correctly. It says 'execute', but in reality it appears to simply be fetching the next set of results from a query that was already executed.</p> <pre><code> # execute next query if multiple queries are specified. # === Return # true if next query exists. def next_result return false unless more_results check_connection @fields = nil nfields = @protocol.get_result if nfields @fields = @protocol.retr_fields nfields @result_exist = true end return true end </code></pre> <p>There is reference to it here too: <a href="http://zetcode.com/db/mysqlrubytutorial/" rel="nofollow">http://zetcode.com/db/mysqlrubytutorial/</a> (Under 'Multiple Statements')</p>
31,768,951
0
<p>You need to modify the control template so the fill goes in the right place.</p>
36,246,699
0
Google map geocode places <p>So I am working with google maps on a project I need to get lat&amp;lng from a place name (not city but a, lets say, caffee in a city, or a mall in a city). So I went with this code</p> <pre><code>var geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': 'SCC, Sarajevo'}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { alert("location : " + results[0].geometry.location.lat() + " " +results[0].geometry.location.lng()); $("#pretragaBarInput").val("location : " + results[0].geometry.location.lat() + " " +results[0].geometry.location.lng()); } else { alert("Something got wrong " + status); } }); </code></pre> <p>(SCC is a mall in Sarajevo) But I dont get the exact lat&amp;lng from the place but rather lat&amp;lng from the city center. I've tried with other places but got the exact same coords that point to the city center</p> <p>P.s. This is just a debug script to see if its working...</p>
28,769,588
0
Trouble with textboxes losing focus in Visual Basic .net <p>Recently I got an assignment to make a very basic Sudoku-game in Visual Basic. To make this I am using Visual Studio Ultimate 2013 Update 4 with the .NET Framework. </p> <p>I have gotten to the point where I can check which one out of many textboxes has focus. With this also change the backgroundColor of the corresponding textbox. I have done this using this by using this method:</p> <p><code>Private Sub TextBox_GotFocus() Handles TextBox1.GotFocus, TextBox2.GotFocus, TextBox3.GotFocus Me.ActiveControl.BackColor = Color.Aquamarine End Sub </code></p> <p>To Color it back to white when any of the textboxes lost focus I used this:</p> <p><code>Private Sub TextBox_LostFocus() Handles TextBox1.LostFocus, TextBox2.LostFocus, TextBox3.LostFocus Me.ActiveControl.BackColor = Color.White End Sub </code></p> <p><strong>Now My Questions Are:</strong></p> <ol> <li>Why does the Application crash when I close it? And how do I fix this?</li> </ol> <p>(It Gives a NullReferenceException when being closed)</p> <ol start="2"> <li>Is this even a proper way to accomplish what I want? Or is there something more efficient?</li> </ol>
14,222,373
0
<p>The XDR-object of InternetExplorer currently is not supported by jQuery, you'll need a plugin like <a href="https://gist.github.com/1114981" rel="nofollow"><strong>jquery.xdomain.js</strong></a></p> <p>But there is another issue: the timezone-API requires the HTTPS-protocoll , when the document that requests the API doesn't use HTTPS, it will still fail in IE.</p> <p>But you may use a serverside proxy-script that fetches the result from the timezone-API and delivers it to jQuery</p>
20,897,489
0
Running JQuery Async - Not interrupting site load <p>I have the following code. It slows my site down - I know because when I comment it out it cuts around 2 seconds of the load time. How can I tell jquery (I'm using jquery) to load this whenever it has time? there is no rush... anytime is fine so long as it doesn't impact the site load:</p> <pre><code>&lt;div id="indexButtonFacebookDIV" class="indexFooterButtonsDIV"&gt; &lt;div id="fb-root"&gt;&lt;/div&gt; &lt;script&gt;(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&amp;appId=192869610731913"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));&lt;/script&gt; &lt;div class="fb-like" data-href="&lt;?php echo "$index-&gt;facebook\n";?&gt;" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false" data-font="verdana"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id="indexButtonGooglePlusDIV" class="indexFooterButtonsDIV"&gt; &lt;div class="g-plusone" data-size="tall" data-annotation="none"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); &lt;/script&gt; &lt;/div&gt; &lt;div id="indexButtonTwitterDIV" class="indexFooterButtonsDIV"&gt; &lt;a href="https://twitter.com/share" class="twitter-share-button" data-url="&lt;?php echo "$index-&gt;twitter\n";?&gt;" data-dnt="true"&gt;Tweet&lt;/a&gt; &lt;script&gt;!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");&lt;/script&gt; &lt;/div&gt; </code></pre> <p>I tried using head.js script but I couldn't get it to async the load... </p> <p>thankyou</p>
9,752,320
0
Repeatedly check the login status of the user? <p>I would like to regularly check the status of the logged in user. My method is as follows but I am unsure as to whether this is the best way to go about it.</p> <pre><code>window.fbAsyncInit=function(){ FB.init({ appId:'123', status:true, cookie:true, xfbml:true, channelUrl:'file', oauth:true }); setInterval(function(){ FB.getLoginStatus(function(a){ // do something },300000); }); } </code></pre> <p><strong>I am aware of the 'subscribe' functions but I am not really sure what they are for. If these are suitable then I will consider using them but I need to have a clearer picture of what they do and how often. I have read the documentation and they simply say that it attaches a handler. This is not very detailed!! What does it attach a handler to!!??</strong></p> <p>Additionally, if I want to call FB.getLoginStatus outside of the 'fbAsyncInit' function, is this possible?</p> <p>Any help much appreciated.</p>
11,607,782
0
<p>You can open google maps with intent giving your starting point and end point.</p> <pre><code>Intent navigation = new Intent(Intent.ACTION_VIEW, Uri .parse("http://maps.google.com/maps?saddr=" + Constants.latitude + "," + Constants.longitude + "&amp;daddr=" + latitude + "," + longitude)); startActivity(navigation); </code></pre> <p>This opens any maps application. Means a browser or google maps application. If you just want google maps and get rid of the dialog you can give the intent a hint as to which package you want to use.</p> <p>Before the <code>startActivity()</code> add this:</p> <pre><code>intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); </code></pre>
15,522,958
0
Google Plus Login API not working on production server <p>I have implemented the google plus api on development server and it works fine. I used the same code on production server. But after requesting the permission it takes a long time to return to my site and login.</p> <p>Can anyone please let me know what might be the cause. I have used oauth2.</p> <p>Below is the code I am using</p> <pre><code>&lt;?php session_start(); require_once 'googleplus/src/Google_Client.php'; require_once 'googleplus/src/contrib/Google_Oauth2Service.php'; class Webpage_UserGPlusLogin extends Webpage { public function __construct() { $temp_redirect = $_SESSION['RETURN_URL_AFTERLOGIN']; $this-&gt;title = 'User Account'; $client = new Google_Client(); $client-&gt;setApplicationName(WEBSITE_NAME); $client-&gt;setClientId(GOOGLE_PLUS_CLIENT_ID); // Client Id $client-&gt;setClientSecret(GOOGLE_PLUS_CLIENT_SECRET); // Client Secret $client-&gt;setRedirectUri(GOOGLE_PLUS_REDIRECT_URI); // Redirect Uri set while creating API account $client-&gt;setDeveloperKey(GOOGLE_PLUS_DEVELOPER_KEY); // Developer Key $oauth2 = new Google_Oauth2Service($client); if (isset($_GET['code'])) { $client-&gt;authenticate($_GET['code']); $_SESSION['token'] = $client-&gt;getAccessToken(); $redirect = GOOGLE_PLUS_REDIRECT_URI; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); // Redirects to same page return; } if (isset($_SESSION['token'])) { $client-&gt;setAccessToken($_SESSION['token']); } if (isset($_REQUEST['logout'])) { unset($_SESSION['token']); $client-&gt;revokeToken(); } if(!isset($_SESSION['email_address_user_account'])) // Check if user is already logged in or not { if ($client-&gt;getAccessToken()) { $user = $oauth2-&gt;userinfo-&gt;get(); // Google API call to get current user information $email = filter_var($user['email'], FILTER_SANITIZE_EMAIL); $img = filter_var($user['picture'], FILTER_VALIDATE_URL); $googleuserid = $user['id']; $given_name = $user['given_name']; $family_name = $user['family_name']; // The access token may have been updated lazily. $_SESSION['token'] = $client-&gt;getAccessToken(); // If email address is present in DB return user data else insert user info in DB $this-&gt;result = UserAccount::gplus_sign_up($email, $googleuserid, $given_name, $family_name); // Create new user object. $this-&gt;user_account = new UserAccount($this-&gt;result['id'],$this-&gt;result['email_address'],$this-&gt;result['password'],$this-&gt;result['confirmation_code'],$this-&gt;result['is_confirmed'], $this-&gt;result['first_name'], $this-&gt;result['last_name']); $_SESSION['gplus_email_address'] = $email; $_SESSION['gplus_first_name'] = $given_name; $_SESSION['gplus_last_name'] = $family_name; $_SESSION['gplus_id'] = $googleuserid; $_SESSION['gplus_profile_pic'] = $img; $_SESSION['email_address_user_account'] = $email; } else { $authUrl = $client-&gt;createAuthUrl(); } } if(isset($temp_redirect)) header("Location:".$temp_redirect); else header("Location:/"); } } </code></pre> <p>Thanks in advance</p>
31,753,262
0
How does calling this function (without a definition) work? <p>So I am trying to get to grips with someone's code (and cannot contact them) and I do not understand why they do this. They call a function in main like this:</p> <pre><code>LOG_AddFunction(); </code></pre> <p>This function is defined in a header file like this:</p> <pre><code>#define LOG_AddFunction() LOG_Add(LOG_TYPE_NORMAL, "%s()", __FUNCTION__) </code></pre> <p>Then LOG_Add is defined in the same header file:</p> <pre><code>extern int LOG_Add(LOG_TYPE eType, const char *pcText, ...); </code></pre> <p>There does not seem to be any ultimate definition of the LOG_AddFunction function and I do not understand why the code calls it. Can someone shed some light on this please?</p>
13,758,098
0
<p>Just Before Exporting make the paging function of the gridview as false, so that all the rows are called on demand.</p>
6,020,209
0
<p>I believe the problem is that with a key of <code>lang.mail.layout.greeting</code>, Freemarker treats each part between the <code>.</code>s as a <a href="http://freemarker.sourceforge.net/docs/dgui_quickstart_datamodel.html" rel="nofollow">hash</a> i.e. a container variable that can have <em>subvariables</em>. So it attempts to get the object referenced by <code>lang</code> from the data-model and then attempts to get the variable referenced by <code>mail</code> from <code>lang</code>. In your case, however, there is no such object, hence the error.</p> <p><a href="http://freemarker.sourceforge.net/docs/dgui_template_exp.html" rel="nofollow">The documentation has this to say about variable names</a>:</p> <blockquote> <p>In this expression the variable name can contain only letters (including non-Latin letters), digits (including non-Latin digits), underline (_), dollar ($), at sign (@) and hash (#). Furthermore, the name must not start with digit.</p> </blockquote> <p>You might make use of the <a href="http://freemarker.sourceforge.net/docs/dgui_template_exp.html#dgui_template_exp_var_hash" rel="nofollow">alternative syntax to get data from a hash</a> (as long as the expression evaluates to a string)</p> <pre><code>&lt;p&gt;${lang["mail.layout.greeting"]} ${user.firstname},&lt;/p&gt; </code></pre>
26,405,090
0
<p>Here's some code I threw together to handle the problem in access</p> <p>It puts error checking in all subs, but not functions. subs have to have a parent form (ACCESS), or alternatively, you have to put the form name in manually. subs that are continued over more than one line will be mercilessly whacked.</p> <p>The two subs have to be at the bottom of a module. </p> <ul> <li><strong>globalerror</strong> is your error management routine</li> <li><strong>CleaVBA_click</strong> changes your VBA code, adds line #s to everything</li> </ul> <p>globalerror looks at a boolean global <strong>errortracking</strong> to see if it logs everything or only errors</p> <p>There is a table ErrorTracking that has to be created otherwise just comment out from 1990 to 2160</p> <p>When running, it removes then adds line numbers to everything in the project, so your error message can include a line #</p> <p>Not sure if it works on anything other than stuff I've coded.</p> <p>Be sure to run and test on a copy of your VBA, because it literally rewrites every line of code in your project, and if I screwed up, and you didn't back up, then your project is broken.</p> <pre><code> Public Sub globalerror(Name As String, number As Integer, Description As String, source As String) 1970 Dim db As DAO.Database 1980 Dim rst As DAO.Recordset 1990 If errortracking Or (Err.number &lt;&gt; 0) Then 2000 Set db = CurrentDb 2010 Set rst = db.OpenRecordset("ErrorTracking") 2020 rst.AddNew 2030 rst.Fields("FormModule") = Name 2040 rst.Fields("ErrorNumber") = number 2050 rst.Fields("Description") = Description 2060 rst.Fields("Source") = source 2070 rst.Fields("timestamp") = Now() 2080 rst.Fields("Line") = Erl 2100 rst.Update 2110 rst.Close 2120 db.Close 2130 End If 2140 If Err.number = 0 Then 2150 Exit Sub 2160 End If 2170 MsgBox "ERROR" &amp; vbCrLf &amp; "Location: " &amp; Name &amp; vbCrLf &amp; "Line: " &amp; Erl &amp; vbCrLf &amp; "Number: " &amp; number &amp; vbCrLf &amp; "Description: " &amp; Description &amp; vbCrLf &amp; source &amp; vbCrLf &amp; Now() &amp; vbCrLf &amp; vbCrLf &amp; "custom message" 2180 End Sub Private Sub CleanVBA_Click() Dim linekill As Integer Dim component As Object Dim index As Integer Dim str As String Dim str2a As String Dim linenumber As Integer Dim doline As Boolean Dim skipline As Boolean Dim selectflag As Boolean Dim numstring() As String skipline = False selectflag = False tabcounter = 0 For Each component In Application.VBE.ActiveVBProject.VBComponents linekill = component.CodeModule.CountOfLines linenumber = 0 For i = 1 To linekill str = component.CodeModule.Lines(i, 1) doline = True If Right(Trim(str), 1) = "_" Then doline = False skipline = True End If If Len(Trim(str)) = 0 Then doline = False End If If InStr(Trim(str), "'") = 1 Then doline = False End If If selectflag Then doline = False End If If InStr(str, "Select Case") &gt; 0 Then selectflag = True End If If InStr(str, "End Select") &gt; 0 Then selectflag = False End If If InStr(str, "Global ") &gt; 0 Then doline = False End If If InStr(str, "Sub ") &gt; 0 Then doline = False End If If InStr(str, "Option ") &gt; 0 Then doline = False End If If InStr(str, "Function ") &gt; 0 Then doline = False End If If (InStr(str, "Sub ") &gt; 0) Then If InStr(component.CodeModule.Lines(i + 1, 1), "On Error GoTo error") &lt;&gt; 0 Then GoTo skipsub End If str2a = component.CodeModule.Name index = InStr(str, "Sub ") ' sub str = Right(str, Len(str) - index - 3) ' sub ' index = InStr(str, "Function ") ' function ' str = Right(str, Len(str) - index - 8) 'function index = InStr(str, "(") str = Left(str, index - 1) varReturn = SysCmd(acSysCmdSetStatus, "Editing: " &amp; str2a &amp; " : " &amp; str) DoEvents If (str = "CleanVBA_Click") Then MsgBox "skipping self" GoTo selfie End If If str = "globalerror" Then MsgBox "skipping globalerror" GoTo skipsub End If component.CodeModule.InsertLines i + 1, "On Error GoTo error" i = i + 1 linekill = linekill + 1 component.CodeModule.InsertLines i + 1, "error:" i = i + 1 linekill = linekill + 1 component.CodeModule.InsertLines i + 1, "Call globalerror(Me.Form.Name &amp; """ &amp; "-" &amp; str &amp; """, Err.number, Err.description, Err.source)" i = i + 1 linekill = linekill + 1 component.CodeModule.InsertLines i + 1, " " i = i + 1 linekill = linekill + 1 If (str = "MashVBA_Click") Then MsgBox "skipping self" MsgBox component.CodeModule.Name &amp; " " &amp; str GoTo selfie End If Else If skipline Then If doline Then skipline = False End If doline = False End If If doline Then linenumber = linenumber + 10 numstring = Split(Trim(str), " ") If Len(numstring(0)) &gt;= 2 Then If IsNumeric(numstring(0)) Then str = Replace(str, numstring(0), "") End If End If component.CodeModule.ReplaceLine i, linenumber &amp; " " &amp; str End If End If skipsub: Next i selfie: Next varReturn = SysCmd(acSysCmdSetStatus, " ") MsgBox "Finished" End Sub </code></pre>
2,755,289
0
In NetBeans IDE 6.1 how can I get icons for my custom GUI components in the GUI editor? <p>While this is by no means really important, I was just wondering if the community knows how to put icons for my custom GUI components that show up in the NetBeans GUI designer.</p> <p>What I did was make several Swing components. Then I use the menu options to add them to the GUI palette, but they show up with "?" icons. It would be nice if they showed up with icons similar to swing components such as <code>JButton</code>, especially for components which are subclassed from Swing components.</p>
36,354,311
0
Any Server/Client model for Android? <p>I developed an offline dictionary application in android that has local db built in sqlite shipped with it during installation. But the problem is that how to can I update, delete, add new record in the local db of application whenever it connects to the internet? Is there any specific protocol, technique, pattern or model?</p>
16,339,861
0
Application failed when changing user cession windows 7 <p>I have an application witch run on local admin account with MFC and user interface. When i change logon windows 7 cession, Application failed.</p> <p>How can i keep the application alive when changing windows cession?<br> Thanks for your help!</p>
9,072,763
0
JQuery-- how do i move (not revert) a draggable div to another div when i do an action? <p>how do i move (not revert) a draggable div to another div which is a droppable when i do an action? for example how do i move a draggable div from div-A to div-B if i click a button?</p>
30,595,916
0
<p>The way the HTML the generated is different than just a different container. It also gives you some convenience default settings etc.I'd say it would be good if you have to group fields rather than arbitrary components. To quote ExtJS documentation:</p> <p>"A container for grouping sets of fields, rendered as a HTML fieldset element. The title config will be rendered as the fieldset's legend.</p> <p>While FieldSets commonly contain simple groups of fields, they are general Containers and may therefore contain any type of components in their items, including other nested containers. The default layout for the FieldSet's items is 'anchor', but it can be configured to use any other layout type.</p> <p>FieldSets may also be collapsed if configured to do so; this can be done in two ways:</p> <p>Set the collapsible config to true; this will result in a collapse button being rendered next to the legend title, or: Set the checkboxToggle config to true; this is similar to using collapsible but renders a checkbox in place of the toggle button. The fieldset will be expanded when the checkbox is checked and collapsed when it is unchecked. The checkbox will also be included in the form submit parameters using the checkboxName as its parameter name."</p>
7,721,397
0
How to make Proguard ignore external libraries? <p>I want to use Proguard mainly for obfuscation reasons.</p> <p>My problem is that I have three libraries, Twitter4J and two signpost libraries. These libraries caused errors when I tried to create an signed APK. To get over this I put the following in the <code>proguard.config</code> file...</p> <pre><code>-dontwarn org.apache.commons.codec.binary.** -dontwarn org.slf4j.** -dontwarn com.sun.syndication.io.** -dontwarn com.sun.syndication.feed.synd.* </code></pre> <p>While this got rid of the errors in the console, when i loaded my signed APK onto my mobile phone it instantly crashed. The DDMS said this was due to a class not found in Twitter4J. </p> <p>Getting rid of the <code>"dontwarns"</code> above did not help. Neither did adding <code>dontshrink dontoptimise</code>.</p> <p>I would like Proguard to completely ignore the libraries (as they are open source anyway). Is this possible?</p>
15,575,986
0
<p>It should not be an infinite loop.</p> <p>The celery.chord_unlock task checks if the chord subtasks have finished to call the merge callback task. If not it schedules itself to check again in a second. The moment your chord tasks are completed you will no longer see those messages in the log.</p> <p>EDITED: you can revoke the chord_unlock task to stop the loop</p> <pre><code>celery.control.revoke('32ba5fe4-918c-480f-8a78-a310c11d0c3a') </code></pre>
38,845,763
0
Why get error from kendo ui when run the asp.net mvc application? <p>I'm beginner in asp.net mvc use the kendo UI and add it to my project but when i run the my application get this error:<br/> <a href="https://i.stack.imgur.com/oAwf8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oAwf8.png" alt="enter image description here"></a> <br/> How can i solve that problem?thanks.</p>