pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
6,481,649 | 0 | <ul> <li><a href="http://coderay.rubychan.de/download/gem" rel="nofollow">http://coderay.rubychan.de/download/gem</a></li> <li><a href="http://softwaremaniacs.org/soft/highlight/en/" rel="nofollow">http://softwaremaniacs.org/soft/highlight/en/</a></li> <li><a href="http://code.google.com/p/syntaxhighlighter/" rel="nofollow">http://code.google.com/p/syntaxhighlighter/</a></li> </ul> <p>The second one infact does automatic language detection and works completely in the client side.</p> |
40,804,959 | 0 | <p>Use the Microsoft Resolution of problems.</p> <p>Clean your Solution and Rebuild again.</p> |
28,959,016 | 0 | Why does this assignment and each loop return just 1 attribute and not the entire object I expect? <p>I have a method on my <code>Node</code> model that looks like this:</p> <pre><code> def users_tagged @node = self @tags = @node.user_tag_list @users = @tags.each do |tag| User.find_by email: tag end end </code></pre> <p>What I would like to happen is for the <code>@users</code> object to be a collection of <code>User</code> records, but it simply returns a list of email addresses.</p> <p>This is what this <code>Node</code> object looks like:</p> <pre><code>> n => #<Node id: 6, name: "10PP Form Video", family_tree_id: 57, user_id: 57, media_id: 118, media_type: "Video", created_at: "2015-03-09 20:57:19", updated_at: "2015-03-09 20:57:19", circa: nil, is_comment: nil> > n.user_tags => [#<ActsAsTaggableOn::Tag id: 4, name: "gerry@test.com", taggings_count: 1>, #<ActsAsTaggableOn::Tag id: 3, name: "abc@test.com", taggings_count: 1>] [135] pry(main)> n.user_tag_list => ["gerry@test.com", "abc@test.com"] </code></pre> <p>But when I try to execute that method, this is what I get:</p> <pre><code>> n.users_tagged ActsAsTaggableOn::Tag Load (0.5ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = $1 AND "taggings"."taggable_type" = $2 AND (taggings.context = 'user_tags' AND taggings.tagger_id IS NULL) [["taggable_id", 6], ["taggable_type", "Node"]] User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'gerry@test.com' LIMIT 1 User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'abc@test.com' LIMIT 1 => ["gerry@test.com", "abc@test.com"] </code></pre> <p>Why does it not return the entire record?</p> |
30,654,600 | 0 | <p>I looked up in several places and concluded that one option for fixing this issue was to call this action only from a hyperlink and include target="_self". I can still add a ng-click attribute on the hyperlink and call code in my angular controller. This is not quite what I wanted to do because I wanted to make the call from my angular controller instead of from the hyperlink, but it will work. </p> <p>The code I used is as follows:</p> <pre><code>using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) { @Html.AntiForgeryToken() <ul data-ng-controller="accountController as acctCtrl"> <li><a data-ng-click="acctCtrl.logout()" href="javascript:document.getElementById('logoutForm').submit()" target="_self">Log off</a></li> </ul> } </code></pre> |
34,366,110 | 0 | AltBeacon - reliability issues: "didExitRegion" is frequently called even if a beacon is right besides the android device <p><strong>Brief process of how AltBeacon works in the app:</strong></p> <ul> <li>Detect iBeacon of specified ids (UUID, major/minor id)</li> <li>Run a thread when "didEnterRegion" called (and keep running until the beacon is out of range)</li> <li>When "didExitRegion" called, wait 30 seconds before stop the thread (this is to assure that the beacon is definitely out of the range)</li> <li>Continue to run the thread when "didEnterRegion" called again during the 30 seconds delay and stop the thread, otherwise.</li> </ul> <p><strong>And I found some reliability problems:</strong></p> <blockquote> <ul> <li>"didExitRegion" is frequently called even when a iBeacon is right besides the app.</li> <li>Once "didExitRegion" is called, it takes several seconds, even more than a minute sometimes, to re-scan the iBeacon even with having a<br> very short scanning period setting.</li> </ul> </blockquote> <p>My objective is to run a thread until a beacon is definitely out of a range -- in other words, I would like to secure the high reliability of the app with iBeacon integration. </p> <p>Any suggestions? Am I missing something?</p> <p>Any insight from you will be greatly appreciated!</p> <p>Regards,</p> |
1,664,035 | 0 | <p>Your Processing code gets "sloppily" parsed and converted into JavaScript. Anything the parser doesn't understand just gets ignored, which means you can freely mix bits of JavaScript code in with your Processing and it will, in general, "just work".</p> <p>Have a look here for more information: <a href="http://processingjs.org/reference/articles/best-pratice" rel="nofollow noreferrer">http://processingjs.org/reference/articles/best-pratice</a></p> |
11,325,699 | 0 | Castle Windsor - How to map Named instance in constructor injection <p>maybe this is easy, but searching it on the internet already give me a head ache</p> <p>here is the problem:</p> <pre><code>interface IValidator { void Validate(object obj); } public class ValidatorA : IValidator { public void Validate(object obj) { } } public class ValidatorB : IValidator { public void Validate(object obj) { } } interface IClassA { } interface IClassB { } public class MyBaseClass { protected IValidator validator; public void Validate() { validator.Validate(this); } } public class ClassA : MyBaseClass, IClassA { //problem: validator should ValidatorA public ClassA(IValidator validator) { } } public class ClassB : MyBaseClass, IClassB { //problem: validator should ValidatorB public ClassB(IValidator validator) { } } public class OtherClass { public OtherClass(IClassA a, IClassB b) { } } //on Main var oc = container.Resolve<OtherClass>(); </code></pre> <p>Any idea? </p> <p><strong>EDIT</strong></p> <p>I registered <code>ValidatorA</code> and <code>ValidatorB</code> with <code>Named</code>, now the problem how Castle Windsor can inject those validator properly to the <code>ClassA</code> and <code>ClassB</code>, is there a way to do that? or is there any better solution?</p> <p>if there is someone think my class design is wrong please, i open for any advice. So far i think it correct. Yes, validator have specific configuration for specific Class. but there are reasons it is abstracted:</p> <ol> <li>Validator is a complex object, sometime should connect to database, so I MUST pass interface instead of implementation to constructor for unit testing reason.</li> <li>No way to use different interface for any of Validator, because the only method that i used is <code>Validate</code></li> <li>I think <code>MyBaseClass.Validate()</code> a common <strong>template method</strong> pattern isn't it?</li> </ol> |
33,384,335 | 0 | <p>If you need TransformGroup in your RenderTransorm, then StoryboardTargetProperty will be look like </p> <pre><code>RenderTransform.Children[0].Angle </code></pre> <p>If you leave only RotateTransform there, then it will be</p> <pre><code>RenderTransform.Angle </code></pre> <p>In both cases, as you see, we start searching property from <strong>RenderTransform</strong>. </p> |
31,677,972 | 0 | How to use Group By with AND in java codes <p>Trying to get values from my table but having problem with my snytaxes</p> <p>there is wrong type with "Group By" usage with "AND" any help will be apriciated</p> <pre><code>"SELECT " + C_CINSIYET + " FROM " + TABLE_COMPANYS + " WHERE " + C_MARKA + " = '" + companyMarka.getComp_marka() + "'" + " AND " + C_FIRMA + " = '" + companyMarka.getComp_name() + "' GROUP BY " + C_CINSIYET + "AND"+C_FIRMA; </code></pre> |
6,824,151 | 0 | <p>Go to check LibreOffice project (that already handles these archives), it has parts written in Java, and for sure you could find and use their mecanisms to check for corrupted files.</p> <p>I think you can get the code from here: </p> <p><a href="http://www.libreoffice.org/get-involved/developers/" rel="nofollow">http://www.libreoffice.org/get-involved/developers/</a></p> |
19,756,848 | 0 | <p>One option that I recommend is to use <a href="http://code.google.com/p/common-schema/" rel="nofollow">common_schema</a> and specifically functions <a href="http://common-schema.googlecode.com/svn/trunk/common_schema/doc/html/get_num_tokens.html" rel="nofollow"><code>get_num_tokens()</code></a> and <a href="http://common-schema.googlecode.com/svn/trunk/common_schema/doc/html/split_token.html" rel="nofollow"><code>split_token()</code></a>, this will help.</p> <p>Here a simple example of the use that you can adapt for your solution:</p> <pre class="lang-sql prettyprint-override"><code>/* CODE FOR DEMONSTRATION PURPOSES */ /* Need to install common_schema - code.google.com/p/common-schema/ */ /* Procedure structure for procedure `explode1` */ /*!50003 DROP PROCEDURE IF EXISTS `explode1` */; DELIMITER $$ CREATE PROCEDURE `explode1`(str varchar(65500), delim VARCHAR(255)) BEGIN DECLARE _iteration, _num_tokens INT UNSIGNED DEFAULT 0; DROP TEMPORARY TABLE IF EXISTS `temp_explode`; CREATE TEMPORARY TABLE `temp_explode` (`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `word` VARCHAR(200), PRIMARY KEY (`id`)); SET _num_tokens := (SELECT `common_schema`.`get_num_tokens`(str, delim)); WHILE _iteration < _num_tokens DO SET _iteration := _iteration + 1; INSERT INTO `temp_explode` (`word`) SELECT `common_schema`.`split_token`(str, delim, _iteration); END WHILE; SELECT `id`, `word` FROM `temp_explode`; DROP TEMPORARY TABLE IF EXISTS `temp_explode`; END $$ DELIMITER ; /* TEST */ CALL `explode1`('Lorem Ipsum is simply dummy text of the printing and typesetting', CHAR(32)); </code></pre> |
819,008 | 0 | <p>Looks like there is no solution to this problem. The bug is aknowleged by microsoft, but its still not fixed in SSRS2008.</p> <p>From the KB article (<a href="http://support.microsoft.com/kb/938943" rel="nofollow noreferrer">http://support.microsoft.com/kb/938943</a>)</p> <blockquote> <p>This behavior occurs because the Subreport control has an implicit KeepTogether property. By design, the KeepTogether property tries to keep content of a subreport on one page. Because of this behavior, the report engine creates blank space on the main report if the subreport does not fit on the same page as the main report. Then, the report engine creates the subreport on a new page.</p> </blockquote> <p>The work around that they list is essentially 'don't use subreports'</p> |
12,438,329 | 0 | <p>If you're load-balancing, you're going to want the additional license to be the for the same platform as your existing license, because the point of load-balancers is to divide the work between multiple identical systems.</p> <p>If you don't already have dependence on other Magento Enterprise Edition features, I would recommend against getting an Enterprise license if you are considering load-balancing. Because of the way Magento is licensed, you would require an additional Enterprise Edition license for each installation of Magento, and that includes each instance behind a load-balancer.</p> <p>If you are considering expanding your infrastructure to include multiple instances of Magento, it is probably best to contact a Magento sales rep, as they will have more-specific information about licensing restrictions, and may be able to negotiate a package which suits your specific needs.</p> |
30,922,393 | 0 | <p>Since you're already using jQuery why not go the simple jQuery way of getting the value? </p> <pre><code>$('#serverCount').val(); </code></pre> <p>So typically when I make an ajax call where I'm expecting JSON data back and I'm sending JSON to the server. I would do something like this;</p> <pre><code>$(function() { $('a#serverCount').bind('click', function() { $.ajax({ method: "POST", url: "/url/to/your/server/method", dataType: 'json', data: { serverCount: $('#serverCount').val() } }) .done(function(msgBackFromServer) { alert("Data Sent to server" + msgBackFromServer); }); }); }); </code></pre> <p>now you'll notice the url needs to be a method that can be hit on your server, some sort or page view that you have. I'm not familiar in Flask, but I would imagine it's similar to Django in some ways. </p> <p>Method POST is because your sending data. On your flask server, you should be able to receive JSON and parse it into a Python dictionary (or maybe there is some other flask specific tool). </p> <p>Your response from this view is what is passed back to the .done function of the ajax call. This could be whatever data you want it to be. It will come from flask. I'm sure flask can send it back as a JSON object or it could just be a string. If it's a JSON object you could access different parts of it with the . notation. Something like msgBackFromServer.title or msgBackFromServer.message etc...</p> |
16,392,971 | 0 | <p>If it takes this long because there are many files in that directory, you could copy the files one by one in a loop. To determine the progress, you could/should simply assume that copying each files takes the same amount of time.</p> <p>Note that you don't want to block the UI for this 7-10 seconds, so you need to copy on a separate non-main thread. Setting the progress bar, like all UI code, needs to be done on the mean thread using:</p> <pre><code>dispatch_async(dispatch_get_main_queue(), ^ { progressBar.progress = numberCopied / (float)totalCount; }); </code></pre> <p>The cast to <code>float</code> gives you slightly (depending on number of files) better accuracy, because a pure <code>int</code> division truncates the remainder.</p> |
27,808,752 | 0 | <p>Working example here: <a href="http://jsfiddle.net/0vts5291/" rel="nofollow">http://jsfiddle.net/0vts5291/</a></p> <p>HTML</p> <pre><code><section id=main> <!--populate with images from array--> <p id="photos" class="product_display"> </section> </code></pre> <p>JS</p> <pre><code>var imageArray = new Array(); imageArray[0]="images/coffee_prod_1.png"; imageArray[1]="images/coffee_prod_2.png"; imageArray[2]="images/coffee_prod_3.png"; imageArray[3]="images/coffee_prod_4.png"; imageArray[4]="images/coffee_prod_5.png"; imageArray[5]="images/coffee_prod_6.png"; imageArray[6]="images/coffee_prod_7.png"; //price array for products var priceArray = ["β¬11.90", "β¬12.90", "β¬13.90", "β¬14.90", "β¬15.90", "β¬16.90", "β¬17.90"]; function getImage() { var container = document.getElementById("photos"); for (var i = 0; i < imageArray.length; ++i) { var img = new Image(); img.src = imageArray[i]; img.className = "product_details"; img.name = priceArray[i]; img.title = priceArray[i]; container.appendChild(img); } } getImage(); </code></pre> |
38,369,240 | 0 | jQuery set current Date to input type="datetime-local" <p>I have the following html</p> <pre><code><input type="datetime-local" id="startDate"> </code></pre> <p>with the default format: <code>dd.mm.yyyy mm:hh</code></p> <p>I would like to set it`s default value to the current local time of my client with jQuery.</p> <p>So far I have tried different solutions on this page but nothing worked.</p> <p>For example</p> <pre><code>$("#startDate").val(new Date().getTime() / 1000 | 1); $("#startDate").val(new Date().toDateString()); </code></pre> <p>Can you please help me?</p> |
16,063,214 | 0 | crystal reports - datetime group header does not show time, only date. need to display date AND time <p>I have a crystal report that has a group that references a DATETIME column generated by a SQL Server stored procedure.</p> <p>When I right-click and Format the Group, the Format Editor displays a sample of the field's output, like so:</p> <blockquote> <p>Monday, March 01, 1999 1:23:45PM</p> </blockquote> <p>However, when I preview the report, it only shows as such:</p> <blockquote> <p>Monday, March 01, 1999</p> </blockquote> <p>I need it to display/sort by the time, as well. Once again, the DB column it points to is of type DATETIME.</p> <p>I am running CR 11.5 and SQL Server 2008R2.</p> <p>Any help would be appreciated.</p> |
10,842,479 | 0 | Current Location refers to programmatically identifying the GPS location of a device, such as an iPhone app requesting information about its current location to display in a map or find nearby places, for example. |
29,413,335 | 0 | <p>1) create a javascript <code>restaurant</code> class</p> <p>2) give the restaurant class a <code>distanceFrom(lat, long)</code> function</p> <p>3) adapt your factory to return <code>restaurant</code>s rather than <code>object</code>s</p> <p>4) sort list of <code>restaurant</code>s by the <code>distanceFrom</code> function</p> <pre><code>function Restaurant(name, lat, long) { this.name = name; this.lat = lat; this.long = long; this.distanceFrom = function(long_from, lat_from) { return calculateDistanceBetween(this.lat, this.long, lat_from, long_from); } } </code></pre> <p>usage:</p> <pre><code>var myPosition = { lat: 50.0123, long: 49.4321 }; var someRestaurant = new Restaurant('The food', 51.1231, 48.213312); var howFar = someRestaurant.distanceFrom(myPostion.lat, myPosition.long); </code></pre> <p>for a javascript sample of getting distance between two latitude/ logitude pairs, see here: <a href="http://stackoverflow.com/questions/27928/how-do-i-calculate-distance-between-two-latitude-longitude-points">How do I calculate distance between two latitude-longitude points?</a></p> |
18,397,793 | 0 | Read model per bounded context <p>i have a question related to read models in cqrs.</p> <p>Assume we have two bounded contexts: <strong>A</strong> and <strong>B</strong></p> <p>In context <strong>A</strong> we build a readmodel based on the events from context <strong>A</strong>. We have some kind of dao to access the readmodel in A.</p> <p>Now assume that <strong>B</strong> needs the same read model as <strong>A</strong>. As far as i understood, bounded context shouldn't depend on each other. </p> <p>So how can i use the model from A. I see three possiblities to solve this</p> <ol> <li><p>Create an API Module for the read model in A and use this in context B (Would be a dependency between A and B)</p></li> <li><p>Create an seperate read model in context B thats exactly the same as in A (Would result in code duplication)</p></li> <li><p>Create a service facade (REST or SOAP or whatever) in B that is accessible from A to provide the read model (possibly the service doesnt provide exactly the data needed)</p></li> </ol> |
23,313,921 | 0 | <p>The <code>activate</code> hook is executed when the router enters the route. The template must already be in scope in order to render an item into it. That being said, you can just render the application template first, then render the navbar/sidebar using the <code>renderTemplate</code> hook.</p> <pre><code>App.ApplicationRoute = Ember.Route.extend({ renderTemplate: function(){ this.render(); // render the application template this.render('nav',{ into: 'application', outlet: 'navigation'}); this.render('side',{ into: 'application', outlet: 'sidebar'}); } }); </code></pre> <p><a href="http://emberjs.jsbin.com/lemutisa/1/edit">http://emberjs.jsbin.com/lemutisa/1/edit</a></p> <p>Additionally you could do this all even easier using render in the template</p> <pre><code><script type="text/x-handlebars"> Appplication {{render 'nav'}} {{render 'side'}} <section id="content">{{outlet}}</nav> </script> </code></pre> <p><a href="http://emberjs.jsbin.com/lemutisa/2/edit">http://emberjs.jsbin.com/lemutisa/2/edit</a></p> |
1,345,050 | 0 | <pre><code>re.sub(r'^-+|-+$', lambda m: ' '*len(m.group()), '---ab---c-def--') </code></pre> <p>Explanation: the pattern matches 1 or more leading or trailing dashes; the substitution is best performed by a callable, which receives each match object -- so m.group() is the matched substring -- and returns the string that must replace it (as many spaces as there were characters in said substring, in this case).</p> |
16,184,726 | 0 | <p>The following code:</p> <pre><code>while(i < num_states) { <---------------------- HERE printf("state %d: %s\n", i, states[i]); i--; } </code></pre> <p>You are actually counting down and checking <strong>incorrect</strong> value.</p> <p>Must be:</p> <pre><code> while(i >= 0) </code></pre> <p>Here:</p> <pre><code>while(i < argc) { printf("arg %d: %s\n", i, argv[i]); i--; } </code></pre> <p>The same:</p> <pre><code>while(i >= 0) </code></pre> |
38,709,469 | 1 | No output file when running Python subprocess <p>I'm trying to run a SystemC (C++) executable in a Python script using subprocess.</p> <p>My issue is the following: my SystemC executable should generate an output file, but this is not happening. I'm sure of this because in the same Python script I call the subprocess I try to move the file that should be generated by my SystemC executable to another directory and always get the error:</p> <pre><code>IOError: [Errno 2] No such file or directory: '/home/jechiarelli/Dropbox/Mestrado/Codigos/Plataformas/tlmdt-traffic_genenerator/trace.vci' </code></pre> <p>Here's my code:</p> <pre><code>#!/usr/bin/python import os import sys import subprocess from shutil import move tgPath = '/home/jechiarelli/Dropbox/Mestrado/Codigos/Plataformas/tlmdt-traffic_genenerator/' sintSeriesPath = '/home/jechiarelli/Dropbox/Mestrado/Dados/series/aggregated_througput/sintetico/' vciPath = '/home/jechiarelli/Dropbox/Mestrado/Dados/vci/' tgExe = tgPath + 'simulation.x' tgOutput = tgPath + 'trace.vci' appName = sys.argv[1] inputs = [s for s in os.listdir(sintSeriesPath) if appName in s] for i in inputs: subprocess.call([tgExe, sintSeriesPath + i, i.split('agg')[-1]], shell = True) if 'mwm' in i: move(tgOutput, vciPath + 'tlmdt-tg-' + appName + '_mwm_' + i.split('agg')[-1] + '.vci') else: move(tgOutput, vciPath + 'tlmdt-tg-' + appName + '_arfima_' + i.split('agg')[-1] + '.vci') </code></pre> <p>Obs.: when I run the SystemC executable directly in the command line the output file is generated correctly. </p> |
19,111,947 | 0 | <p>There are double quotes in</p> <pre><code>$mail->Host = "smtp.gmail.com"; // SMTP server </code></pre> <p>Please remove the double quotes.</p> <pre><code>$mail->Host = 'smtp.gmail.com'; // SMTP server </code></pre> |
9,093,419 | 0 | Accessing a variable from a file through a file that is required in said first file <p>I have an osCommerce-shop where I need to access a variable from inside an included php-file. For the sake of simplicity here is a short example of what I am talking about without anything related to osCommerce:</p> <p>The file inside.php shows a picture and is only displayed on the homepage by being somehow required in index.php. Depending on what language has been selected it should show either picture 1 or 2. Currently only the first picture is displayed because I have no way of knowing which one should be used. Normally there is a $language_id variable which I can check if it is either 1 (english) or 2 (german). Unfortunately $language_id in inside.php is empty (or at least it looks like it) so I need a way to access the variable from index.php. Is there a way to do this without passing this variable or something like that? (Since it is a osCommerce-shop I am not sure how I could to that)</p> <p>I hope what I tried to explain is somewhat understandable, if not, please ask and I'll try to clarify.</p> |
40,928,579 | 0 | Count all same comma separated value in one column mysql <p>I have 2 table and there's a column which contains comma separated value and I want to count all same value of that column, here's the sample table:</p> <pre><code>Client table ID | Name | Procedure 1 | Joe | Samp1,Samp2 2 | Doe | Samp1,Samp2,Samp3 3 | Noe | Samp1,Samp2 Desire Output Summary table ( For Procedure ) ID | NAME | COUNT 1 | Samp1 | 3 2 | Samp2 | 3 3 | Samp3 | 1 </code></pre> <p>Now, do you have any idea or suggestion so i can make it happen ? like add new table or is this possible with single query ?</p> |
28,322,202 | 0 | <p>Just use the following intent :</p> <pre><code>Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("google.navigation:///?q=48.649469,-2.02579&mode=w")); startActivity(intent); </code></pre> <ul> <li>q=48.649469,-2.02579 : Saint-Malo latitude and longitude</li> <li>mode=w : walking</li> </ul> <p>Other modes available are :</p> <ul> <li>d for driving</li> <li>r for public transportations</li> <li>b for bicycling</li> </ul> |
39,980,114 | 0 | <p>PyCharm recognizes the limited scope of the variable (inside the function) and refactoring behaves slightly different in this case - the usual refactoring dialogue no longer opens up.</p> <p>The green background (in your example, the actual colour may differ depending on the color scheme and customisations) for all the variable's instances inside the function indicates pycharm is in this local refactoring mode. Just edit the variable name and you'll see all the variable instances being modified simultaneously. Press <kbd>Enter</kbd> when done and the green background disappears indicating that the local refactoring mode ended.</p> |
15,617,144 | 0 | <p>You either want to use <code>union all</code> or <code>cross join</code>. Use <code>union all</code> to get the results in two rows. Use <code>cross join</code> to get the results in two columns on the same row.</p> <p>Here is an example for the <code>cross join</code>:</p> <pre><code>select sumcep, sumcepout from (SELECT SUM(tutar) as sumcep FROM cepbank WHERE tarih >= DATE(NOW()) ) t cross join (SELECT SUM(tutar) as sumcepout FROM cepbank_out WHERE tarih >= DATE(NOW()) ) t2 </code></pre> |
11,581,124 | 0 | Is there any downside to specifying a very long font stack? <p>This is what I have:</p> <pre><code>body { font-family: Frutiger, "Frutiger Linotype", "Frutiger LT Std", Univers, Calibri, "Myriad Pro", Myriad, "DejaVu Sans Condensed", "Liberation Sans", "Nimbus Sans L", "Helvetica Neue", Helvetica, Arial, sans-serif; } </code></pre> <p>That's a whopping 14 fonts! Does using long font stacks like this one have a significant effect on page load time or performance, or is it always a good idea to include as many fonts as needed?</p> |
2,740,769 | 0 | <p>The mongodb-csharp driver is about to make a huge push regarding support for typedcollections which will include full Linq support. I think you'll find that it is easy to work.</p> <p>The other 2 projects are also steaming ahead. If you want .NET 4.0 support, simple-mongodb would be your best bet.</p> <p>NoRM has a whole bunch of committers who are all great coders, so no problem with it except it doesn't have an official release.</p> |
21,574,048 | 0 | <p>Using ObjectAnimator, This is a sample for scrolling to top :</p> <pre><code>public void scroolToTop() { int x = 0; int y = 0; ObjectAnimator xTranslate = ObjectAnimator.ofInt(mScrollView, "scrollX", x); ObjectAnimator yTranslate = ObjectAnimator.ofInt(mScrollView, "scrollY", y); AnimatorSet animators = new AnimatorSet(); animators.setDuration(1000L); animators.playTogether(xTranslate, yTranslate); animators.addListener(new AnimatorListener() { @Override public void onAnimationStart(Animator arg0) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animator arg0) { // TODO Auto-generated method stub } @Override public void onAnimationEnd(Animator arg0) { // TODO Auto-generated method stub } @Override public void onAnimationCancel(Animator arg0) { // TODO Auto-generated method stub } }); animators.start(); } </code></pre> |
27,794,643 | 0 | <p>That's not possible with <a href="http://www.primefaces.org/showcase/ui/input/manyCheckbox.xhtml" rel="nofollow"><code><p:selectManyCheckbox></code></a>. Your best bet is to just use a bunch of <a href="http://www.primefaces.org/showcase/ui/input/booleanCheckbox.xhtml" rel="nofollow"><code><p:selectBooleanCheckbox></code></a> components instead and change the model to be <code>Map<Entity, Boolean></code> instead of <code>List<Entity></code>. You can loop over it using <code><ui:repeat></code>.</p> <p>E.g. (normal XHTML variant; I am not going to advocate the Java <code>createComponent()</code> equivalent):</p> <pre><code><ui:repeat value="#{bean.entities}" var="entity"> <p:selectBooleanCheckbox value="#{bean.selection[entity]}" /> ... (you can put here image, label, anything) </ui:repeat> </code></pre> <p>with</p> <pre><code>private List<Entity> entites; private Map<Entity, Boolean> selection; @PostConstruct public void init() { entities = service.list(); selection = new HashMap<>(); // No need to prefill it! } </code></pre> <p>To check which ones are selected, loop over the map in action method:</p> <pre><code>List<Entity> selectedEntities = new ArrayList<>(); for (Entry<Entity, Boolean> entry : selection.entrySet()) { if (entry.getValue()) { selectedEntities.add(entry.getKey()); } } </code></pre> |
20,820,647 | 0 | <blockquote> <p>if you executing this query from your SSMS it means this other server is a linked server. then it should be no different to execute it from SSRS. </p> <p>Yes it is right you can only add one server to your data source of your dataset whether its a shared data source or embedded. </p> <p>But for instance if you have a data source pointing to say Server A when you executing queries which will be pulling data from Server A and also from server B you will Use fully Qualified name for the Objects from server B and two part name from server A. </p> <p>something like this ...</p> </blockquote> <pre><code>SELECT * FROM Schema.Table_Name A INNER JOIN [ServerNameB].DataBase.Schema.TableName B ON A.ColumnA = B.ColumnA </code></pre> <p><em>obviously <code>ServerB</code> has to be a <code>Linked Server</code>.</em></p> |
37,712,540 | 0 | Strange behavior of styles (Themes) in Android <p>I got this styles for my Android app:</p> <pre><code><resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:windowBackground">@color/background_new</item> <item name="android:textColorPrimary">@color/colorAccent</item> <item name="android:textColorHint">@color/colorAccentHint</item> <!-- Customize your theme here. --> </style> <style name="MyToolBar" parent="Widget.AppCompat.ActionBar"> <!-- Support library compatibility --> <item name="android:textColorPrimary">@color/colorAccent</item> <item name="android:textColorSecondary">@color/colorAccent</item> <item name="colorControlNormal">@color/colorAccent</item> </style> <!-- Custom searchView may be used or not--> <style name="SearchViewStyle" parent="Widget.AppCompat.SearchView"> <!-- Gets rid of the search icon --> <item name="searchIcon">@null</item> <!-- Gets rid of the "underline" in the text --> <item name="queryBackground">@null</item> <!-- Gets rid of the search icon when the SearchView is expanded --> <item name="searchHintIcon">@null</item> <!-- The hint text that appears when the user has not typed anything --> <!--<item name="closeIcon">@null</item> --> </style> <style name="MyCustomTabLayout" parent="Widget.Design.TabLayout"> <item name="tabTextAppearance">@style/MyCustomTabText</item> </style> <style name="MyCustomTabText" parent="TextAppearance.Design.Tab"> <item name="android:textSize">12sp</item> </style> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> <style name="NavDrawerTextStyle" parent="Base.TextAppearance.AppCompat"> <item name="android:textSize">12sp</item> </style> <style name="MyCheckBox" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorControlNormal">@color/colorPrimaryTransparent</item> <item name="colorControlActivated">@color/colorAccent</item> </style> <style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert"> <item name="colorAccent">@color/colorAccent</item> <item name="android:textColorPrimary">@color/colorAccent</item> <item name="android:background">@color/background1</item> <item name="android:buttonStyle">@style/MyApp.BorderlessButton</item> </style> <style name="MyApp.BorderlessButton" parent="@style/Widget.AppCompat.Button.Borderless"> <item name="android:textSize">12sp</item> </style> <style name="MyRadioButton" parent="Theme.AppCompat.Light"> <item name="colorControlNormal">@color/colorAccent</item> <item name="colorControlActivated">@color/colorAccent</item> </style> </code></pre> <p></p> <p>Normally i have transparent background on <strong>Toolbar</strong> of <strong>NavigationDrawler</strong> menu items click.</p> <p>But sometimes theme in my app changes to <strong>Holo theme</strong> , and i can figure it out when its happens , so when i press menu items in <strong>Toolbar</strong> or in <strong>NavigationDrawler</strong> their background become blue, like in <strong>Holo theme</strong></p> <p>Where i have mistake and why its happens?</p> |
34,193,879 | 0 | How can I use a condition in PDO object while a query <p>I am trying to Select Data With PDO (+ Prepared Statements) The following example uses prepared statements.</p> <p><a href="http://www.w3schools.com/php/showphpfile.asp?filename=demo_db_select_pdo" rel="nofollow">http://www.w3schools.com/php/showphpfile.asp?filename=demo_db_select_pdo</a></p> <p>I need to know how to make a condition to display only the LASTNAME = PETER. I tried like the below, but not working</p> <pre><code>$stmt = $conn->prepare("SELECT id, firstname, lastname FROM MyGuests WHERE lastname =PETER"); </code></pre> |
39,638,142 | 0 | <p>I think this is the expected behavior for the product. </p> <p>However still you can customize the store Jaggery app (which located in {EMM_HOME}/repository/deployment/server/jaggeryapps/store) and edit the page to match your requirement.</p> <p>Thanks.</p> |
38,215,852 | 0 | <p>Use <code>LANDINGPAGE</code> field in the <code>setExpressCheckout</code> call to specify the default user interface, either <code>Login</code> for account login payments, or <code>Billing</code> for credit card form page.</p> <p><em>Be noted that this field will not always work since the checkout layout has been redesigned, you may try with the redirection URL in this format to display the selected page:</em></p> <p><strong>Login checkout page (by default):</strong> <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXXXXX" rel="nofollow noreferrer">https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXXXXX</a></p> <p><strong>Credit card form page:</strong> <a href="https://www.paypal.com/webapps/xoonboarding?token=EC-XXXXXXXXXX" rel="nofollow noreferrer">https://www.paypal.com/webapps/xoonboarding?token=EC-XXXXXXXXXX</a></p> <p>*<code>token</code>=EC Token returned by <code>setExpressCheckout</code> call</p> <p><a href="https://i.stack.imgur.com/3MXqG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3MXqG.jpg" alt="enter image description here"></a></p> |
40,646,586 | 0 | <p>I think you cannot achieve this. Based on Django documentation it looks like use of binary fields is <a href="https://docs.djangoproject.com/en/dev/ref/models/fields/#binaryfield" rel="nofollow noreferrer">discouraged</a></p> <blockquote> <p>A field to store raw binary data. It only supports bytes assignment. Be aware that this field has limited functionality. For example, it is not possible to filter a queryset on a BinaryField value. It is also not possible to include a BinaryField in a ModelForm.</p> <p>Abusing BinaryField</p> <p>Although you might think about storing files in the database, consider that it is bad design in 99% of the cases. This field is not a replacement for proper static files handling.</p> </blockquote> <p>And based on a <a href="https://code.djangoproject.com/ticket/2495" rel="nofollow noreferrer">Django bug</a>, it is most likely impossible to achieve a <code>unique value</code> restriction on a binary field. This bug is marked as <code>wont-fix</code>. I am saying most likely impossible as I did not find evidence to confirm that binary field is stored as a <code>BLOB field</code> but the error does allude to it.</p> <blockquote> <p>Description </p> <p>When I used a field like this:<br> <code>text = models.TextField(maxlength=2048, unique=True)</code><br> it results in the following sql error when the admin app goes to make the table<br> <code>_mysql_exceptions.OperationalError: (1170, "BLOB/TEXT column 'text' used in key specification without a key length")</code><br> After a bit of investigation, it turns out that <code>mysql</code> refuses to use unique with the column unless it is only for an indexed part of the text field: </p> <pre><code>CREATE TABLE `quotes` ( \`id\` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `text` longtext NOT NULL , \`submitTS\` datetime NOT NULL, `submitIP` char(15) NOT NULL, `approved` bool NOT NULL, unique (text(1000)));</code></pre> <p>Of course 1000 is just an arbitrary number I chose, it happens to be the maximum my database would allow. Not entirely sure how this can be fixed, but I figured it was worth mentioning.</p> </blockquote> |
11,708,182 | 0 | <p>To output the results in a human readable form, as opposed to print_r, you could simply cycle through the results in a foreach loop;</p> <pre><code>foreach($balance_info as $key=>$value) { echo "$key: $value<br />"; } </code></pre> <p>Or for more specific naming, if you know what the columns are, using a <code>-></code> to access the objects properties and echo them out;</p> <pre><code>Client: <?php echo $balance_info->client_user_id; ?><br /> Balance: <?php echo $balance_info->available_credit; ?></br /> Time: <?php echo $balance_info->last_updated_time; ?> </code></pre> <p><a href="http://php.net/manual/en/sdo.sample.getset.php" rel="nofollow">http://php.net/manual/en/sdo.sample.getset.php</a></p> |
507,030 | 0 | <p>Using them without reading the "Effective STL" book by Scott Meyers. :) Really. This makes most of the stupid bugs go away.</p> |
22,206,267 | 0 | How do I store an auth key in iOS/Objective-C? <p>I'm working on an app that uses an auth key to validate the login session for many methods (like getFriends, for example). I'll be calling these methods in different view controllers to the one which manages logging in, so I need a way to store the auth_key which is returned upon login.</p> <p>Should I use a global variable? Also how is this best done? Is this what the "keychain" is for? Could you provide some resources for learning how to use the keychain?</p> <p>I'm a first year student so please don't assume much experience.</p> |
10,783,505 | 0 | android videoview fullscreen when click button <p>i want to show fullscreen the video when click a button. And then return old size teh video when run fullscreen!</p> <p>how can i do that?</p> <pre><code><LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_below="@+id/linearLayout1" android:gravity="center_horizontal" android:orientation="vertical" > <WebView android:id="@+id/Web" android:layout_width="fill_parent" android:layout_height="150dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="2dp" android:background="@drawable/screen_background" /> <VideoView android:id="@+id/videoView1" android:layout_width="264dp" android:layout_height="128dp" android:layout_marginTop="3dp" /> </code></pre> |
8,751,872 | 0 | Hibernate/JPA: map<Object, Enum> manytomany is it possible? <p>More specifically <code>(map<Course, Role>)((User) u).courses</code></p> <p>I have many <code>Course</code>s and many <code>User</code>s who have <code>Role</code>s in courses. A user might be staff in one course, and a student in another. </p> <p>I have User entities with ID and course entities with ID, and a Role Enum type </p> <p>I want a map belonging to user in order to query his role in a particular class:</p> <pre><code>public enum Role{ STUDENT, STAFF } public class User ... { ... @ElementCollection(targetClass=Role.class) @CollectionTable(name="COURSE_ROLE") @MapKeyJoinColumn(name="COURSE_ID") @Column(name="ROLE_NAME") @Enumerated(EnumType.STRING) private Map<Course, Role> courses; ... </code></pre> <p>I have looked at several resources. ProJPA has the following:</p> <pre><code>@Entity public class Department { @Id private int id; private String name; // ... @ElementCollection @CollectionTable(name="EMP_SENIORITY") @MapKeyJoinColumn(name="EMP_ID") @Column(name="SENIORITY") private Map<Employee, Integer> seniorities; // ... </code></pre> <p>if we consider a department as my user, and employee as my course this almost works, but I don't know how to handle the transition from their Integer to my Enum. </p> <p>Please help me with the semantics of this table definition with annotations.</p> <p>edit: To clarify, I had tried without the argument to ElementCollection(Role.class), and many other permutations of options but I don't feel I am grasping the situation. Currently, with this annotation combination I get an exception:</p> <pre><code>org.hibernate.MappingException: Could not determine type for: java.util.Map, at table: USER, for columns: [org.hibernate.mapping.Column(ROLE_NAME)] </code></pre> |
11,382,792 | 0 | Are std::map and std::set thread-safe? <p>I have a question: Are std::map and std::set thread-safe? I use this collections on my multithread applications and sometimes map and set works worng. </p> <p>Thanks!</p> <p><strong>upd. My code:</strong></p> <pre><code>std::map<int, unsigned long> ClientTable; int sendulong(int socket, char * data) //<--- Many threads uses this function { write(socket, ClientTable[socket]); //<--- ClientTable[[socket] <-- using of map } </code></pre> <p>How can i fix this code for thread safety? Thanks!</p> |
2,192,810 | 0 | <p>Eclipse has a VIM plugin. Eclipse runs on OS X</p> <p><a href="http://www.vimplugin.org/" rel="nofollow noreferrer">http://www.vimplugin.org/</a></p> <p>Also, I think the Komodo IDEs and editors have VIM bindings, but I have little experience with them. Apparently, they also run on OS X.</p> <p><a href="http://docs.activestate.com/komodo/4.4/vikeybind.html" rel="nofollow noreferrer">http://docs.activestate.com/komodo/4.4/vikeybind.html</a></p> |
433,153 | 0 | <p>If you're willing to go all Unix-centric, Cygwin comes with a version of <em>cron</em> that can be run as a service on Windows. Then, you could use a common <code>crontab</code> file across your platforms. See <a href="http://www.noah.org/ssh/cygwin-crond.html" rel="nofollow noreferrer">http://www.noah.org/ssh/cygwin-crond.html</a>.</p> |
22,222,148 | 0 | <p>I created the following one line solution avoiding multiple grep commands. </p> <pre><code>mysql -e "show databases;" | grep -Ev "Database|DatabaseToExclude1|DatabaseToExclude2" | xargs mysqldump --databases >mysql_dump_filename.sql </code></pre> <p>The -E in grep enables extended regex support which allowed to provide different matches separated by the pipe symbol "|". More options can be added to the mysqldump command. But only before the "--databases" parameter.</p> <p>Little side note, i like to define the filename for the dump like this ... </p> <pre><code>... >mysql_dump_$(hostname)_$(date +%Y-%m-%d_%H-%M).sql </code></pre> <p>This will automatically ad the host name, date and time to the filename. :)</p> |
32,471,401 | 0 | <p>This exception occurs when length of values you are inserting are larger than actual length of column you have specified for database table.</p> <p><strong>String or binary data would be truncated. The statement has been terminated.</strong></p> <p>Please check all column lengths and values you are inserting.</p> |
33,700,249 | 0 | Firebase Normalized Collection and Scroll not working <p>first the code</p> <pre><code>var baseRef = new $databaseFactory(); var childRegistration = baseRef.child("registrations/"); var childStudents = baseRef.child("students/"); $scope.scrollRef = new Firebase.util.Scroll(childRegistration,'registerDate'); var normRegisteredStudens = new Firebase.util.NormalizedCollection( [childStudents, "student"], [$scope.scrollRef, "registration"] ).select( "student.id", "student.avatarImg", "registration.registerDate", "registration.entryMethod" ).ref(); $scope.lastRegisteredStudents = $firebaseObject( normRegisteredStudens ); $scope.loadRegisteredStudents = function() { $scope.scrollRef.scroll.next(1); }; </code></pre> <p>data structure</p> <pre><code>"registrations" : { "STD32159500" : { "entryMethod" : "web", "registerDate" : 1447425200913 }, "STD32159501" : { "entryMethod" : "web", "registerDate" : 1447430433895 } "students" : { "STD32159500" : { "avatarImg" : "students/default-avatar-male.png", "id" : "STD32159500", }, "STD32159501" : { "avatarImg" : "students/default-avatar-female.png", "id" : "STD32159501", } </code></pre> <p>there is no error but i still no getting one by one registration value with the function "loadRegisteredStudents", instead of that, i get all results.</p> <p>i get this on load web</p> <pre><code>STD32159500: avatarImg: "students/default-avatar-male.png" entryMethod: "web" id: "STD32159500" registerDate: 1447425200913 STD32159501: avatarImg: "students/default-avatar-female.png" entryMethod: "web" id: "STD32159501" registerDate: 1447430433895 </code></pre> |
39,745,686 | 0 | Sort div array based on alphabets during appending Jquery <p>I am stuck in a place where I have to sort the list of names when moved those list on button click.</p> <pre><code>sort() </code></pre> <p>method works fine but clicking on the same button again creating duplicates!, which is not I need.</p> <p>Is there any way I can fix this. used below code too(which took from stackoverflow) even this is not working.</p> <pre><code>function SortByName(a, b) { var aName = a.name.toLowerCase(); var bName = b.name.toLowerCase(); return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0)); } var selectArr = selectedList.sort(SortByName); </code></pre> <p><strong>MY CODE</strong></p> <pre><code> $(document).on('click', '#buttonAdd', function (e) { var divCount = $('#SelectedEmployeeList').find('div').length; if (divCount === 0) { selectedList = []; // Clearing the list, to add fresh employee list. } $('#EmployeeList :selected').each(function (i, selected) { selectedList[$(selected).val()] = $(selected).text(); }); // Returning DOM node from collection. var empListNode = $("#SelectedEmployeeList")[0]; console.log(empListNode); while (empListNode.firstChild) { empListNode.removeChild(empListNode.firstChild); } for (var empID in selectedList) { $("#SelectedEmployeeList").append("<div class= EmpList id=" + empID + ">" + selectedList[empID] + " <span class='close'>&times;</Span> </div>"); } }); </code></pre> <p>This is the place where all sort should happen <code>#SelectedEmployeeList</code>.</p> <p>have shared the pics for references.</p> <p>Sort is happening correctly on the left like here :</p> <p><a href="https://i.stack.imgur.com/xK8Fk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xK8Fk.jpg" alt="enter image description here"></a></p> <p>after clicking on "Add All >> " items are moved but not sorted :</p> <p><a href="https://i.stack.imgur.com/00Azk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/00Azk.jpg" alt="enter image description here"></a></p> <p>any help will be appreciated.</p> <p>UPDATE 1 :</p> <p><a href="https://i.stack.imgur.com/zwezj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zwezj.jpg" alt="enter image description here"></a></p> |
21,565,139 | 0 | <p>What you have would work (if I understand you correctly) except that the class-selector begins with a dot (<code>.</code>) instead of a hash (<code>#</code> -- which selects by id, not class-name), so try:</p> <pre><code>jQuery("div:contains('myfield')").parent().find('.css_class').val('thisistheclass'); </code></pre> |
3,140,586 | 0 | <p>Why not create a symlink for your subdomain then reach images via sub.domain.com url?</p> |
22,661,763 | 0 | <p>You need to apply the <code>class=value</code> for the second <code><select></code> values . Check <a href="http://plnkr.co/edit/KmXvkhNU8dcEueiw8ksZ?p=preview" rel="nofollow"><strong>Working DEMO</strong></a></p> <pre><code><select class="form-control" id="color"> <option value="">choose options</option> <option value="27">Blomme</option> <option value="26">GrΓΈn</option> <option value="28">Syren</option> </select> <select class="form-control" id="size"> <option value="">choose options</option> <option value="27" class="27">XL</option> <option value="26" class="26">L</option> <option value="26" class="26">L</option> <option value="26" class="26">L</option> <option value="28" class="28">S</option> </select> </code></pre> |
11,443,305 | 0 | <p>If I understood correctly the purpose is to create an array with 10 "Apples" and another one with 5 "Balls"</p> <pre><code>$array = array ( array ("Apple", 10), array("Ball", 5) ); $newarray = array(); foreach($array as $key => $val){ $tmparray = null; for($i = 1; $i <= $val[1]; $i++){ $tmparray[$i] = $val[0]; } $newarray[] = $tmparray; } print_r($newarray); </code></pre> <p>output:</p> <pre><code>Array ( [0] => Array ( [1] => Apple [2] => Apple [3] => Apple [4] => Apple [5] => Apple [6] => Apple [7] => Apple [8] => Apple [9] => Apple [10] => Apple ) [1] => Array ( [1] => Ball [2] => Ball [3] => Ball [4] => Ball [5] => Ball ) ) </code></pre> |
4,885,569 | 0 | silverlight support in vs2010 <p>hi i need some clarification about silverlight. I want develop one silverlightapplication for win ce6.0. so that my question is visualstudio2010 .net framework will no support for wince. is silverlight will support in visual studio2005 and tel me the detailed description or links about that. </p> |
12,088,681 | 0 | The equivalent of cross apply and select top <p>I have table (script below):</p> <pre><code>use master go -- -- if db_id ( 'CrossApplyDemo' ) is not null drop database CrossApplyDemo go create database CrossApplyDemo go use CrossApplyDemo go -- if object_id ( 'dbo.Countries', 'U' ) is not null drop table dbo.Countries go create table dbo.Countries ( CountryID int, Country nvarchar(255) ) go -- insert into dbo.Countries ( CountryID, Country ) values ( 1, N'Russia' ), ( 2, N'USA' ), ( 3, N'Germany' ) , ( 4, N'France' ), ( 5, N'Italy' ), ( 6, N'Spain' ) go -- if object_id ( 'dbo.Cities', 'U' ) is not null drop table dbo.Cities go create table dbo.Cities ( CityID int, CountryID int, City nvarchar(255) ) go -- insert into dbo.Cities ( CityID, CountryID, City ) values ( 1, 1, N'Moscow' ), ( 2, 1, N'St. Petersburg' ), ( 3, 1, N'Yekaterinburg' ) , ( 4, 1, N'Novosibirsk' ), ( 5, 1, N'Samara' ), ( 6, 2, N'Chicago' ) , ( 7, 2, N'Washington' ), ( 8, 2, N'Atlanta' ), ( 9, 3, N'Berlin' ) , ( 10, 3, N'Munich' ), ( 11, 3, N'Hamburg' ), ( 12, 3, N'Bremen' ) , ( 13, 4, N'Paris' ), ( 14, 4, N'Lyon' ), ( 15, 5, N'Milan' ) go </code></pre> <p>I select cities groupping by countries, i can perform queries using two approaches:</p> <pre><code>-- using join: select * from CrossApplyDemo.dbo.Countries as countries inner join CrossApplyDemo.dbo.Cities as cities on cities.CountryID = countries.CountryID -- using apply select * from CrossApplyDemo.dbo.Countries as countries cross apply (select * from CrossApplyDemo.dbo.Cities as cities where cities.CountryID = countries.CountryID) as c; </code></pre> <p><strong>Is where any query without "cross apply" which can return the same result as "apply query" below? :</strong></p> <pre><code>select * from CrossApplyDemo.dbo.Countries as countries cross apply (select top(3) * from CrossApplyDemo.dbo.Cities as cities where cities.CountryID = countries.CountryID) as c; </code></pre> <p>the query:</p> <pre><code>select top(3) * from CrossApplyDemo.dbo.Countries as countries inner join CrossApplyDemo.dbo.Cities as cities on cities.CountryID = countries.CountryID </code></pre> <p>not work</p> |
40,116,636 | 0 | Android - WebView not saving input forms <p>I'm using a simple webView client in my android application, but, when the user log in, close the app and open app again the input forms not save the user information like webbrowser. How i solve it? I need when the user enter the 'username' the app save this like a webbrowser, if possible save the password too :)</p> <p>Thank in advance.</p> |
15,705,588 | 0 | <p>The log message "User 'admin' not found" seems pretty clear as a reason for authentication failure, when using the default schema. Why not just execute the command manually and see if it returns the user data?</p> <p>Also, whether the login screen is shown doesn't depend on whether you set "'authorities-by-username-query" or not. It only depends on whether what <code>intercept-url</code> values apply for the URL you request. The only exception would be if you have customized the access-denied behaviour (for an authenticated user with insufficient rights) to show the login page (not the case here).</p> <p>Your SQL exception is probably due to your custom table having the wrong column types. You need to end up with something compatible with the result set obtained from the standard schema. Better to stick with the default unless you have a good reason not to.</p> <p>Better still, forget about Oracle completely until you can get the basics working with a simple test database like HSQLDB.</p> |
15,709,365 | 0 | <p>In Python, string literals and numbers are separate types of object, and do not compare equal.</p> <pre><code>1 == "1" </code></pre> <p>returns False.</p> <p>You're iterating through your list of strings of numerals, but it's not a list of actual numbers.</p> <p>You can use the range() function (it's a python built-in) to generate a number list instead of typing it out by hand.</p> |
21,831,268 | 0 | <p>This can be done with <code>ismember</code>:</p> <pre><code>[lia,lib]=ismember(A,A(1,:)) h=hist(lib(lib>0),1:size(A,2)) </code></pre> |
26,514,501 | 0 | using max-n-of to control the number of arcs that link nodes? <p>Hi please could somebody write a snippet of sample code to show how I would use max-n-of nodes to control the number of incident nodes that a node has in a network? Any help would be greatly appreciated as I am new.</p> |
11,808,562 | 0 | <p>In my UIViewController subclass I have this method:</p> <pre><code>-(void)setEditing:(BOOL)editing animated:(BOOL)animated { [super setEditing:editing animated: animated]; // hide back button in edit mode [self.navigationItem setHidesBackButton:editing animated:YES]; } </code></pre> |
26,017,129 | 0 | <p>I know the question is old, but since I found it, others may find it as well. And then, the solution is five years older than this question.</p> <p>The solution is in fact simple and will be found quickly when trying to post this problem at the microsoft forums:</p> <p><a href="http://social.msdn.microsoft.com/Forums/en-US/0403c00e-008d-4eb2-a061-45e60664573e/how-can-i-get-smtp-address-to-an-organizer-with-ews?forum=exchangesvrdevelopment" rel="nofollow">http://social.msdn.microsoft.com/Forums/en-US/0403c00e-008d-4eb2-a061-45e60664573e/how-can-i-get-smtp-address-to-an-organizer-with-ews?forum=exchangesvrdevelopment</a></p> <p>Short summary:</p> <p>The organizer field does not contain an SMTP Address when retrieved with ExchangeService.FindAppointments, but it does if retrieved with ExchangeService.BindToItems or Appointment.Bind.</p> |
22,802,293 | 0 | <p>hi i have done many thing in xmpp from (<a href="http://xmpp.org/xmpp-protocols/xmpp-extensions/" rel="nofollow">http://xmpp.org/xmpp-protocols/xmpp-extensions/</a>) tutorial you can get example from bellow github links you can get many help from that </p> <p>(demo links: ) <a href="https://github.com/sesharim/ios-jabber-client" rel="nofollow">https://github.com/sesharim/ios-jabber-client</a></p> <p><a href="https://github.com/funkyboy/Building-a-Jabber-client-for-iOS" rel="nofollow">https://github.com/funkyboy/Building-a-Jabber-client-for-iOS</a></p> <p>(xmmp Project demo Link:)</p> <p><a href="https://github.com/chrisballinger/ChatSecure-iOS" rel="nofollow">https://github.com/chrisballinger/ChatSecure-iOS</a></p> <p>i hope it will help full you..</p> <p>you can get how to fetch old messages and user list and other detail from that above demo programs. </p> |
12,045,285 | 0 | <p>OP, perhaps you could think of it that CSS processes the first argument (#header, and #login) first, and only after that, then it processes the second argument (a in "#header a").</p> <p>So on the first process, it's made red, and then blue, but on the second process, it's overwritten to red, due to the "a" in the second argument.</p> |
1,796,617 | 0 | <p>My compiler has wistringstream -- this is all it is:</p> <p><code>typedef basic_istringstream<wchar_t> wistringstream;</code></p> |
40,899,763 | 0 | <p>It seems not.</p> <p>There's an open issue for this on GitHub: <a href="https://github.com/dotnet/roslyn/issues/6877" rel="nofollow noreferrer">https://github.com/dotnet/roslyn/issues/6877</a></p> |
32,991,909 | 0 | <p>Keep your code in a named <code>function</code> say - <code>changeSize</code> and call it in <code>document.ready</code> and <code>window.resize</code> as below:</p> <p><strong><a href="http://jsfiddle.net/Guruprasad_Rao/8TrTU/1628/" rel="nofollow">DEMO</a></strong></p> <pre><code>function changeSize(){ var fontSize = parseInt($("#container").width()/4)+"px"; $("#container span").css('font-size', fontSize); } $(document).ready(function() { changeSize(); $(window).resize(changeSize); }); </code></pre> <p>or just once in <code>document.ready()</code> as below:</p> <pre><code>$(document).ready(function() { $(window).resize(changeSize).trigger('resize'); }); </code></pre> |
22,753,351 | 0 | Comparisons with "Comparable" type variables in java? <p>I'm working on a University assignment, and I have to store elements in an array of the "Comparable" type. Eg: </p> <pre><code>protected Comparable storage[]; </code></pre> <p>The elements that will be stored in this array are going to be either all integers, or all strings, but they're obviously created with the "Comparable" type as opposed to being created as int, or String. </p> <p>What I'm having problems doing is comparing these values. At any given point, say the array is filled with "Comparable" elements that are actually integers, how can I compare them? I get that I have to use the compareTo() method, but what would the implementation look like? I've looked at the Java document online, and it has simply confused me even more. </p> <p>Just to summarize, at any given point, the array might have "Comparable" type elements that are actually all integers, or all the elements will be Strings that were also made with the "Comparable" type. There's no mixing and matching of the integer and Strings in the array, it's just one or the other. I want to know how I would make the compareTo() method so that I can easily compare two elements in the array, or any two "Comparable" elements for that matter, and return say a 1, -1, or 0 if one is greater/less than the other</p> <p>Would appreciate any help. I'm completely lost.</p> |
34,468,199 | 0 | <p>Try clearing the npm cache and try the npm install again. You can use the following to clear the npm cache.</p> <pre><code>npm cache clean <path to express-generator> </code></pre> <p>Sometimes you get this error even when you are on ssh, the npm registry might be configured to use a different registry for npm packages and that registry might not have a express-generator</p> |
29,882,710 | 0 | Saving list adapter data on Activity onStop() <p>I have this Activity with a List Fragment which loads data from server if adapter is empty. When i press the back button or go to another activity and back to this activity with Up button, the adapter is reset to empty.</p> <p>So how can i save the adapter data, so the activity doesn't have to load data from the server all the time? </p> <p>Thanks in advance!</p> <p>PS: Sorry i don't provide any code. I just want to know the logic.</p> |
21,457,790 | 0 | <p>You could use the encodeUri filter: <a href="https://github.com/rubenv/angular-encode-uri">https://github.com/rubenv/angular-encode-uri</a></p> <ol> <li><p>Add angular-encode-uri to your project:</p> <p><code>bower install --save angular-encode-uri</code></p></li> <li><p>Add it to your HTML file:</p> <p><code><script src="bower_components/angular-encode-uri/dist/angular-encode-uri.min.js"></script></code></p></li> <li><p>Reference it as a dependency for your app module:</p> <p><code>angular.module('myApp', ['rt.encodeuri']);</code></p></li> <li><p>Use it in your views:</p> <p><code><a href="#/search?query={{address|encodeUri}}"></code></p></li> </ol> |
1,540,095 | 0 | <p>I found <a href="http://stackoverflow.com/questions/273447/how-to-ignore-route-in-asp-net-forms-url-routing">How to ignore route in asp.net forms url routing</a> which might work for this, it uses the <a href="http://msdn.microsoft.com/en-us/library/system.web.routing.stoproutinghandler.aspx" rel="nofollow noreferrer">StopRoutingHandler</a> class, and as long as the requests to .php do run through the routing this will probably work.</p> <p>If the .php requests are not going through the routing handler then this probably wouldn't work.</p> |
35,008,864 | 0 | spray.json (scala): how to (de)serializing nested Option[JsNumber] <p>I am trying to (de)serialize the following code:</p> <pre><code>class EntityId(value: Long) extends MappedTo[Long] { override def toString = value.toString } object EntityId extends DefaultJsonProtocol { implicit object EntityIdJsonFormat extends RootJsonFormat[EntityId] { def write(entityId: EntityId) = JsNumber(entityId.value) def read(value: JsNumber) = value match { case JsNumber(entityIdLong) => new EntityId(entityIdLong.toLongExact) } } } case class Version(value: Long) extends MappedTo[Long] { def increment() = copy(value + 1) } object Version extends DefaultJsonProtocol { implicit object VersionJsonFormat extends RootJsonFormat[Version] { def write(version: Version) = JsNumber(version.value) def read(value: JsNumber) = value match { case JsNumber(version) => new Version(version.toLongExact) } } } /** * Trait for entities: all model classes that require an auto-incremental ID and optimistic locking. */ trait Entity[I <: EntityId] { def id: Option[I] def version: Option[Version] def created: Option[Instant] def modified: Option[Instant] def isPersisted = id.isDefined } object Entity extends DefaultJsonProtocol { ??????????????? } </code></pre> <p>(it is based on Blogimistic TypeSafe template).</p> <p>my problems starts with the nested part. Because in Entity the EntityId is optional, I cannot figure how to serialize and deserialize it. how should this be done?</p> |
12,638,439 | 0 | Sharing entity types across multiple edmx files <p>We are using Entity Framework 4 with the POCO Entity Generator. Until now we've just had one .edmx file but we're running into performance problems due to the current size of it (well over 100 entities). </p> <p>I understand we should be looking to break this into a series of .edmx files which is fine with one exception. We would want to somehow share certain entity types across two or more of these contexts. For example a User class is associated with numerous otherwise unrelated entities throughout our model.</p> <p>So is it possible to have, say, a security model with its own .edmx and namespace for generated POCOs, but use it in another .emdx? If not I'm concerned we'll have multiple classes modelling the same database table which will need to be updated in sync with the database. I'd say that would be unworkable. (We're using database-first).</p> <p>Obviously if I'm barking up the wrong tree do let me know! </p> |
4,074,533 | 0 | <p>I believe Instruments are not useful for any tracing in this case since the application crashes and then is auto-restarted (it's iPad/iPhone app), so all Intruments history is gone.<br> <br> I do not see much point instantiating NSMutableURLRequest as autoreleased object since it needs to be retained for the duration of async call spanning multiple idle loop cycles. NSURLConnection may retain it internally or not, but keeping an extra reference for safety should not hurt.<br> <br> The initialization code boils down to essentially the following: </p> <blockquote> <p>rq->url_encoded = [url_encode(rq->url) retain];<br> rq->http_url = [NSURL URLWithString:rq->url_encoded];<br> rq->http_request = [[NSMutableURLRequest alloc] initWithURL:rq->http_url];<br> [rq->http_request setHTTPMethod:@"GET"];<br> <br> NSArray* availableCookies = [rq->service.CookieJar cookiesForURL:rq->http_url];<br> NSDictionary* headers = [NSHTTPCookie requestHeaderFieldsWithCookies:availableCookies];<br> [rq->http_request setAllHTTPHeaderFields:headers];<br> rq->http_connection = [NSURLConnection alloc];<br> <br> [rq->http_connection initWithRequest:rq->http_request delegate:rq startImmediately:YES];</p> </blockquote> <p>The release procedure is that connectionDidFinishLoading calls [rq->http_connection cancel] and [rq autorelease], the latter eventually leading to:</p> <blockquote> <p>// [http_request autorelease];<br> // delayedAutoRelease(http_request);<br> [http_connection autorelease];<br> [http_url autorelease];<br> [url release];<br> [url_encoded release];<br> [response release];<br> </blockquote> <p>Note that [response release] just pairs previous [response retain] executed inside didReceiveResponse.</p> <p>If I leave first two lines commented out, NSURLRequest leaks with reference count 1 per Instruments, and this is the only leak observed.<br> Whenever I attempt to autorelease http_request whichever way as described above, a crash occurs.</p> |
10,821,762 | 0 | Using GDB for debugging netlink communication <p>I have a multi-threaded application that communicates with a kernel module using netlink sockets. One of the threads in user mode application works as a server and kernel module works as a client. Roughly the kernel code is as follows: </p> <pre><code>timeout = 3500; netlink_unicast(); wait: __set_current_state(TASK_INTERRUPTIBLE); timeout = schedule_timeout(timeout); __set_current_state(TASK_RUNNING); if (!timeout) { printk(KERN_ERR "No response received\n"); return -1; } if (message_status != UPDATED) { printk(KERN_ERR "Somebody woke us up before we got a reply. Time left %d\n", timeout); __set_current_state(TASK_INTERRUPTIBLE); goto wait; } </code></pre> <p>The <strong>message_status</strong> variable is updated in the netlink callback when the user mode application replies to this message. So basically the idea is to send a message and then wait at max timeout jiffies for the reply.</p> <p>Now, using gdb, if I add a break point in any function that is called by netlink server thread in user mode, the break point is never hit and the kernel log is flooded with messages like </p> <blockquote> <p>Somebody woke us up before we got a reply. Time left 3499</p> <p>Somebody woke us up before we got a reply. Time left 3499</p> <p>Somebody woke us up before we got a reply. Time left 3499</p> <p>Somebody woke us up before we got a reply. Time left 3499</p> <p>..</p> <p>..</p> <p>Somebody woke us up before we got a reply. Time left 3498</p> </blockquote> <p>Until I finally get </p> <blockquote> <p>No response received</p> </blockquote> <p>What is causing the kernel thread to wake up from the timeout and how should I debug the user mode code?</p> <p>PS: I am using 2.6.32-71.el6.x86_64 on RHEL 6.0</p> |
9,364,142 | 0 | <p>From the information you provide and from Matlab's documentation <code>strsplit</code> is not an intrinsic Matlab function. So the question for you is <em>Where have you installed the source of the strsplit function ?</em> When you've answered that for yourself use the <code>File | Set Path</code> menu.</p> |
1,623,554 | 0 | <p>In the help, if you search for "Template Libraries" it gives instructions on how to do it.</p> |
5,873,919 | 0 | <p>Think about the wasy jQuery handles selectors:</p> <pre><code># denotes an id: '#id' . denotes a class: '.class' : denotes a pseudo class: ':pseudo_class' </code></pre> <p>So when your doing your selection it is expanding to:</p> <pre><code>$("#j_idt23:txtNumber") </code></pre> <p>Meaning find an element with id = 'j_idt23' and pseudo class 'txtNumber' but txtNumber isnt a valid pseudo class, and jQuery is confused.</p> <p>Change it to something like <code>"j_idt23_txtNumber"</code></p> |
22,733,618 | 0 | Display Unity app in Cocoa View - OSX <p>I have a simple question: is it possible to display a Unity app inside a Cocoa View. I'm not talking about iOS. But MacOS.</p> <p>The problem is: Unity will create a single file for OSX, while under iOS you get the full project that you can modify and make it work.</p> <p>I hope someone had the chance to figure this out.</p> <p>TIA</p> |
23,430,629 | 0 | spring open jpa db2 error <p>My spring jpa poc is failing to get repository injected. Throwing an exception </p> <p>java.lang.IllegalArgumentException: Interface must be annotated with @org.springframework.data.repository.RepositoryDefinition!</p> <p>I am giving all my soruce code so that it can be identified by some one who went through this </p> <p>my app-context xml</p> <pre><code><?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:context="http://www.springframework.org/schema/context" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd"> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:persistenceUnitName="POC" p:packagesToScan="com.poc.accountant.orm" p:dataSource-ref="dataSource" p:jpaVendorAdapter-ref="openJpaVendor" /> <!-- p:persistenceXmlLocation="classpath*:persistence.xml" --> <bean id="openJpaVendor" class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter"> <property name="showSql" value="true"/> <property name="databasePlatform" value="org.apache.openjpa.jdbc.sql.DB2Dictionary" /> </bean> <bean id="jpaDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="jdbc/tepds"/> </bean> <jee:jndi-lookup id="dataSource" jndi-name="jdbc/tepds" resource-ref="true" cache="true" /> <!-- <context:component-scan base-package="com.poc.accountant.orm"/> --> <!-- <context:component-scan base-package="com.poc.accountant.reposotories" /> --> <jpa:repositories base-package="com.poc.accountant.reposotories"/> </beans> </code></pre> <p>my Entity class</p> <pre><code>package com.poc.accountant.orm; import java.io.Serializable; import java.util.Date; import javax.persistence.Table; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * @author Fryder * */ @Entity @Table(name = "POC.PUSHAPPS") public class PushApps implements Serializable { /** * generated serial version ID */ private static final long serialVersionUID = -6763892550710204820L; @Id @Column(name = "appid") @GeneratedValue(strategy = GenerationType.AUTO) private Long appid; @Column(name = "msgid") private String msgid; @Column(name = "severity") private String severity; @Column(name = "application") private String application; @Column(name = "source") private String source; @Column(name = "component") private String component; @Column(name = "enabled") private Boolean enabled; @Column(name = "appgroup") private Long appgroup; @Column(name = "last_err") @Temporal(TemporalType.TIMESTAMP) private Date lastErr; @Column(name = "last_err_sent") @Temporal(TemporalType.TIMESTAMP) private Date lastErrSent; //getters and setters stripped } </code></pre> <p>My repository class</p> <pre><code>package com.poc.accountant.reposotories; import java.util.List; import javax.annotation.Resource; import org.springframework.data.jpa.repository.JpaRepository; import com.poc.accountant.orm.PushApps; /** * @author Fryder * */ public interface PushAppsRepository extends JpaRepository<PushApps, Long> { List<PushApps> findByAppId(long appId); } </code></pre> <p>My error log</p> <pre><code>7 poc WARN [[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.Runtime - An error occurred while registering a ClassTransformer with PersistenceUnitInfo: name 'poc', root URL [file:/C:/Development/Src code and Artifacts/accountant-parent/accountant-web/target/classes/]. The error has been consumed. To see it, set your openjpa.Runtime log level to TRACE. Load-time class transformation will not be available. 10 poc INFO [[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.Runtime - OpenJPA dynamically loaded a validation provider. 167 poc INFO [[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.Runtime - Starting OpenJPA 2.0.1 641 poc TRACE [[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.jdbc.SQL - <t 8564204, conn 499> executing stmnt 502 SELECT CURRENT SCHEMA FROM SYSIBM.SYSDUMMY1 651 poc TRACE [[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] openjpa.jdbc.SQL - <t 8564204, conn 499> [10 ms] spent <May 2, 2014 10:12:41 AM EDT> <Warning> <HTTP> <BEA-101162> <User defined listener org.springframework.web.context.ContextLoaderListener failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pushAppsRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Interface must be annotated with @org.springframework.data.repository.RepositoryDefinition!. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pushAppsRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Interface must be annotated with @org.springframework.data.repository.RepositoryDefinition! at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) Truncated. see log file for complete stacktrace Caused By: java.lang.IllegalArgumentException: Interface must be annotated with @org.springframework.data.repository.RepositoryDefinition! at org.springframework.util.Assert.isTrue(Assert.java:65) at org.springframework.data.repository.core.support.AnnotationRepositoryMetadata.<init>(AnnotationRepositoryMetadata.java:48) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepositoryMetadata(RepositoryFactorySupport.java:173) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:207) at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:84) Truncated. see log file for complete stacktrace </code></pre> |
37,894,941 | 0 | Receive multiple JSONObject in one AsyncHttpClient request <p>I have a problem in my code. I just want to receive JSONObject from my server. here is a part of my php code after make the request</p> <pre><code>$obj = $result->fetchAll(PDO::FETCH_CLASS); foreach ($obj as $row) { $trouver = FALSE; if (stristr($row->type_of_event, $chaine_rechercher) !== FALSE) $trouver = TRUE; else if (stristr($row->name_of_event, $chaine_rechercher) !== FALSE) $trouver = TRUE; else if (stristr($row->description_of_event, $chaine_rechercher) !== FALSE) $trouver = TRUE; if ($trouver == TRUE){ $reponse["id"] = $row->id; $reponse["type_of_event"] = utf8_encode($row->type_of_event); $reponse["description_of_event"] = utf8_encode($row->description_of_event); echo(json_encode($reponse)); } } </code></pre> <p>But the problem is that in my onSuccess in Android code, just first JSONObject is received. here is a part of my android code</p> <pre><code>client.get("my_url", params, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject json_data) { try { int id = json_data.getInt("id"); String type = json_data.getString("type_of_event"); String description = json_data.getString("description_of_event"); id_list.add(id); type_list.add(type); description_list.add(description); ((SearchResultAdapter)getListAdapter()).notifyDataSetChanged(); } catch (JSONException e) { e.printStackTrace(); } } @Override public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { Toast.makeText(SearchActivity.this, "Echec de connexion", Toast.LENGTH_SHORT).show(); } }); </code></pre> <p>Can you help me ? Please.</p> |
28,120,057 | 0 | <p>That is correct, the data buffer for the original <code>A</code> is destroyed by MATLAB and a new buffer is created (the same <code>mxArray</code> structure address is reused presumably by copying the new one onto the original after deallocating the original array's data buffer). <strong>This is assuming you are <em>not</em> writing to <code>prhs[i]</code> in you MEX file!</strong></p> <p>You can see this with <code>format debug</code>. You will observed that the output <code>mxArray</code> has the same address, but it's data buffer has a different address, so it has clearly reallocated the output array. This suggests that the original buffer is deallocated or queued to be deallocated.</p> <p>Starting with the output for a change, of the file <code>testMEX.mexw64</code> that takes the first half of the input array's first row and copies it into a new array:</p> <pre> >> format debug >> A = rand(1,8) A = <b>Structure address = efbb890</b> m = 1 n = 8 <b>pr = 77bb6c40</b> pi = 0 0.2581 0.4087 0.5949 0.2622 0.6028 0.7112 0.2217 0.1174 >> A = testMEX(A) A = <b>Structure address = efbb890</b> m = 1 n = 4 <b>pr = 77c80380</b> pi = 0 0.2581 0.4087 0.5949 0.2622 </pre> <p>Note that <code>pr</code> is <strong>different</strong>, meaning that MATLAB has created a new data buffer. However, the <code>mxArray</code> "Structure address" is the same. So, at the minimum, the old data buffer will be deallocated. Whether or not the original <code>mxArray</code> structure is simply mutated or a new <code>mxArray</code> is created is another question (see below).</p> <hr> <p><strong>Edit:</strong> The following is some evidence to suggest that an entirely new <code>mxArray</code> is created and it is copied onto the old <code>mxArray</code></p> <p>Add the following two lines to the MEX function:</p> <pre><code>mexPrintf("prhs[0] = %X, mxGetPr = %X, value = %lf\n", prhs[0], mxGetPr(prhs[0]), *mxGetPr(prhs[0])); mexPrintf("plhs[0] = %X, mxGetPr = %X, value = %lf\n", plhs[0], mxGetPr(plhs[0]), *mxGetPr(plhs[0])); </code></pre> <p>The result is:</p> <pre> prhs[0] = EFBB890, mxGetPr = 6546D840, value = 0.258065 plhs[0] = <b>EFA2DA0</b>, mxGetPr = 77B65660, value = 0.258065 </pre> <p>Clearly there is <strong>a temporary <code>mxArray</code></strong> at EFA2DA0 containing the output (<code>plhs[0]</code>), and this <code>mxArray</code> header/structure is entirely copied onto the old <code>mxArray</code> structure (the one as <code>A</code> in the base MATLAB workspace). Before this copy happens, MATLAB surely deallocates the data buffer at <code>6546D840</code>.</p> <p><strong>testMEX.cpp</strong></p> <pre><code>#include "mex.h" void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { mxAssert(nrhs == 1 && mxGetM(prhs[0]) == 1, "Input must be a row vector."); double *A = mxGetPr(prhs[0]); size_t cols = mxGetN(prhs[0]); size_t newCols = cols / 2; plhs[0] = mxCreateDoubleMatrix(1, newCols, mxREAL); for (int i = 0; i < newCols; ++i) mxGetPr(plhs[0])[i] = A[i]; mexPrintf("prhs[0] = %X, mxGetPr = %X, value = %lf\n", prhs[0], mxGetPr(prhs[0]), *mxGetPr(prhs[0])); mexPrintf("plhs[0] = %X, mxGetPr = %X, value = %lf\n", plhs[0], mxGetPr(plhs[0]), *mxGetPr(plhs[0])); } </code></pre> |
11,726,888 | 0 | <p>This is why many agree that Singleton is an anti-pattern. You need multiple instances of the object, one for each locale. It's not a singleton. I like to say that Singleton is just a euphemism for global variables. You're basically allowing a global way to access the Locales.</p> <p><a href="http://accu.org/index.php/journals/337" rel="nofollow">Singleton - The anti pattern</a></p> |
22,432,515 | 0 | <p>You can put <code>ftplugin</code> directory with filetype-specific settings inside <code>.vim</code> directory</p> <pre><code>.vim βββ ftplugin βββ ruby.vim βββ markdown.vim </code></pre> <p>And keep your settings there. The are applied when file with corresponding filetype is opened.</p> <p>Also, you might need to have filetype detection(if not detected properly). You can put this to your <code>.vimrc</code></p> <pre><code>autocmd BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mkd,*.mkdn set ft=markdown </code></pre> <p>Or, put it into <code>ftdetect</code> directory</p> <pre><code>.vim βββ ftdetect βββ markdown.vim </code></pre> |
25,154,160 | 0 | <p>Unless I misunderstand your question, you can just open a file read only. Here is a simply example, without any checks.</p> <p>To get the file path from the user use this function: </p> <pre><code>Private Function get_user_specified_filepath() As String 'or use the other code example here. Dim fd As Office.FileDialog Set fd = Application.FileDialog(msoFileDialogFilePicker) fd.AllowMultiSelect = False fd.Title = "Please select the file." get_user_specified_filepath = fd.SelectedItems(1) End Function </code></pre> <p>Then just open the file read only and assign it to a variable:</p> <pre><code>dim wb as workbook set wb = Workbooks.Open(get_user_specified_filepath(), ReadOnly:=True) </code></pre> |
28,845,086 | 0 | <p>The error message you're seeing has nothing to do with the <code>constexpr</code> keyword per se.</p> <p>A string literal like "foo", as in:</p> <pre><code>somefunction("foo"); </code></pre> <p>The type of this string literal is <code>const char *</code>. The following statement:</p> <pre><code>char *const str = "foo"; </code></pre> <p>This tries to assign a <code>const char *</code> value to a <code>char *</code> value. The resulting <code>char *</code> value is non-mutable, constant, but by that time the error already occured: an attempt to convert a <code>const char *</code> to a <code>char *</code>.</p> <p>The <code>constexpr</code> keyword in your example is just a distraction, and has no bearing on the error.</p> |
5,667,848 | 0 | <p>Force <code>git push</code>:</p> <pre><code>git push origin +develop </code></pre> |
34,555,150 | 0 | <p>This one is using the <code>Picasso</code> library.</p> <pre><code>String url = "some url to your image"; ImageView thumbnail = (ImageView) findViewById(R.id.thumbnail); Picasso.with(context).load(url).into(thumbnail); </code></pre> |
1,127,131 | 0 | <pre>/question/how-do-i-bake-an-apple-pie /question/how-do-i-bake-an-apple-pie-2 /question/how-do-i-bake-an-apple-pie-...</pre> |
37,477,687 | 0 | FireBase Cloud Messaging Not Working <p>I am trying to use FireBase Cloud Messaging. I am receiving a token but its not getting any notifications from console. Here is my Manifest:</p> <pre><code> <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="careerage.jobseeker.app" android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1"> <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" /> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <android:uses-permission android:name="android.permission.READ_PHONE_STATE" /> <android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true"> <activity android:name=".MainActivity" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize"> <intent-filter android:label="@string/launcher_name"> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <service android:name=".TokenService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> </intent-filter> </service> <service android:name=".NotificationService"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT"/> </intent-filter> </service> </application> </code></pre> <p></p> <p>And My Code is almost the same as from the sample:</p> <pre><code>public class NotificationService extends FirebaseMessagingService { private void sendNotification(String messagebody) { Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 , intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.icon) .setContentTitle("Notified") .setContentText(messagebody) .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0 , notificationBuilder.build()); } private void sendSnackbar(String messagebody) { Toast.makeText(this,"Notified",Toast.LENGTH_LONG).show(); } @Override public void onMessageReceived(RemoteMessage remoteMessage) { Toast.makeText(this,"Message Received",Toast.LENGTH_LONG).show(); Log.d("Notification Received",remoteMessage.getNotification().getBody()); sendNotification(remoteMessage.getNotification().getBody()); sendSnackbar(remoteMessage.getNotification().getBody()); } } </code></pre> <p>I checked the Question here <a href="http://stackoverflow.com/questions/37351354/firebase-cloud-messaging-notification-not-received-by-device">Firebase cloud messaging notification not received by device</a> but still it is not working.</p> |
12,381,053 | 0 | <p>Thunderbird AddOns are extensions for the Mozilla Thunderbird email client. They are written mostly in XUL (a flavor of XML) and Javascript.</p> <hr> <h3>Useful links</h3> <ul> <li><a href="https://addons.mozilla.org/en/thunderbird/" rel="nofollow">Official website</a></li> </ul> <hr> <h3>Related tags</h3> <ul> <li><a href="/questions/tagged/thunderbird" class="post-tag" title="show questions tagged 'thunderbird'" rel="tag">thunderbird</a></li> </ul> |
22,859,855 | 0 | Drag and drop from list to canvas on windows phone with MVVM <p>I have an app where a user can manipulate around with elements chosen from a list, this is done by clicking the list element and the element is added to a canvas.</p> <p>During a user testing of the app. People found it not to be intuitive since they wanted drag and drop. I have found several links describing how to implement this for WPF, i.e. not for windows Phone. </p> <p>Trying to replicate the code from a <a href="http://code.msdn.microsoft.com/windowsdesktop/DragnDrop-from-ListBox-on-67273e33" rel="nofollow">msdn project</a> i ended up with problems that I cannot get the same information about the elements from DragEventArgs. </p> <p>So what I want to accomplish is user can drag an element in a listbox to a canvas. I have tried in the Viewmodel but missing information in DragEventArgs, like e.Data and e.Source. I have also tried in the xaml.cs file with no success.</p> <p>Any help is appreciated.</p> <p><strong>Idea</strong></p> <ul> <li>create a copy of your element when it's selected,</li> <li>add the copy as a child of your canvas,</li> <li>set the copy's x,y coordinates to match the selected element's location,</li> <li>CaptureMouse() on the copy.</li> </ul> <p>Of course on Windows Phone Manipulation delta should be used to move it instead of capture mouse. I am able to drag an element around inside the Canvas after it was added by a Click event. But I can't seem to get drag from list to work. The bullet points above is a method I have and are trying but without any success so far.</p> |
9,787,934 | 0 | Firewall blocking/unblocking a port <p>I have an app installed on a server with windows 2008 R2 OS and hosted it on port 8080 (used apache tomcat for this).. I'm able to access the app through the URL.. </p> <p>Now, the problem is that I'm unable to access the URL (I mean app) from any other LAN connected machines. </p> <p>After some exploration, I turned off the firewall of that server and I was able to access the app from other LAN connected machines..</p> <p>I came to know the problem i.e Firewall is blocking that port 8080..</p> <p>I can turn off the firewall, but it is not recommended right.. my requirement is to turn on the firewall and make this app accessible from any other LAN connected machine... I think I need to make that port open/something like that, but I don't have any idea regarding this.. no network admin is available as of now, so had to do it myself :( Kindly help me regarding this...</p> <p>Thanks in advance!! :)</p> <p>PS: I cannot download/install any other software's on that server, please suggest some way which can happen via command prompt/some settings to access that port from other LAN connected machines</p> |
11,389,251 | 0 | <p>If you're trying to use the general pattern of having ALPHANUMBER and ALPHA[NUMBER] refer to the same variable, you can't do it. The square bracket notation in Java refers to an element in an array, while the first is just a general identifier that can refer to a variable. </p> <p>In the specific case of creating two variables, one a direct reference and the other an element in an array, you can simply point <code>r[1] = r1</code> (as long as <code>r1</code> has been initialized). </p> |
944,953 | 0 | <p>You can certainly do this in C++ with the <a href="http://msdn.microsoft.com/en-us/library/aa387410.aspx" rel="nofollow noreferrer">Windows Media Format SDK</a>. </p> <p>I have only used WMFSDK9 myself. It contains a sample called UncompAVIToWMV, which may get you started. From the Readme:</p> <blockquote> <p>It shows how to merge samples for audio and video streams from several AVI files and either merge these into similar streams or create a new stream based on the source stream profile. It also shows how to create an arbitrary stream, do multipass encoding and add SMPTE time codes.</p> </blockquote> |