pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
21,438,253 | 0 | <p>VT-x inside VT-x cannot be done in VirtualBox.</p> <p>A (quite old) feature request about this functionality is here:</p> <p><a href="https://www.virtualbox.org/ticket/4032" rel="nofollow">https://www.virtualbox.org/ticket/4032</a></p> |
34,744,555 | 0 | <p>This is not supported out-of-the-box. The hint declared on the a relation is rarely used, more meant as a Foreign Key hint than a column hint. There are several options you can use to do this.</p> <p>The easiest is to use a post-generation .SQL script to add the clustered setting manually. This is described here: <a href="https://www.softfluent.com/documentation/StandardProducers_SQLServer_CustomScripts.html" rel="nofollow">How to: Execute custom T-SQL scripts with the Microsoft SQL Server producer</a>.</p> <p>You could also use the Patch Producer to remove the CLUSTERED word from the file once it has been created : <a href="https://www.softfluent.com/documentation/StandardProducers_PatchProducer.html" rel="nofollow">Patch Producer</a></p> <p>Otherwise, here is another solution that involves an aspect I've written as a sample here. You can save the following piece of XML as a file, and reference it as an aspect in your model.</p> <p>This aspect will add the CLUSTERED hint to primary keys of all Many To Many tables inferred from entities that have CLUSTERED keys. It will add the hint before the table scripts are created and ran, and will remove it after (so it won't end up in the <code>relations_add</code> script).</p> <pre><code><cf:project xmlns:cf="http://www.softfluent.com/codefluent/2005/1"> <!-- assembly references --> <?code @reference name="CodeFluent.Producers.SqlServer.dll" ?> <?code @reference name="CodeFluent.Runtime.Database.dll" ?> <!-- namespace includes --> <?code @namespace name="System" ?> <?code @namespace name="System.Collections.Generic" ?> <?code @namespace name="CodeFluent.Model.Code" ?> <?code @namespace name="CodeFluent.Model.Persistence" ?> <?code @namespace name="CodeFluent.Model.Code" ?> <!-- add global code to listen to inference steps --> <?code Project.StepChanging += (sender1, e1) => { if (e1.Step == ImportStep.End) // hook before production begins (end of inference pipeline) { var modifiedTables = ProjectHandler.AddClusteredHint(Project); // get sql server producer and hook on production events var sqlProducer = Project.Producers.GetProducerInstance<CodeFluent.Producers.SqlServer.SqlServerProducer>(); sqlProducer.Production += (sender, e) => { // determine what SQL file has been created // we want to remove hints once the table_diffs has been created, before relations_add is created string script = e.GetDictionaryValue("filetype", null); if (script == "TablesDiffsScript") { ProjectHandler.RemoveClusteredHint(modifiedTables); } }; } }; ?> <!-- add member code to handle inference modification --> <?code @member public class ProjectHandler { public static IList<Table> AddClusteredHint(Project project) { var list = new List<Table>(); foreach (var table in project.Database.Tables) { // we're only interested by tables inferred from M:M relations if (table.Relation == null || table.Relation.RelationType != RelationType.ManyToMany) continue; // check this table definition is ok for us if (table.RelationKeyColumns.Count < 1 || table.RelationRelatedKeyColumns.Count < 1) continue; // check clustered is declared on both sides string keyHint = GetSqlServerProducerHint(table.RelationKeyColumns[0].Property); string relatedKeyHint = GetSqlServerProducerHint(table.RelationKeyColumns[0].Property); if (keyHint.IndexOf("clustered", StringComparison.OrdinalIgnoreCase) < 0 || relatedKeyHint.IndexOf("clustered", StringComparison.OrdinalIgnoreCase) < 0) continue; // force hint now, we only need to do this on one of the keys, not all table.PrimaryKey.Elements[0].SetAttribute("hint", CodeFluent.Producers.SqlServer.Constants.SqlServerProducerNamespaceUri, "clustered"); // remember this table list.Add(table); } return list; } public static void RemoveClusteredHint(IEnumerable<Table> list) { foreach (var table in list) { table.PrimaryKey.Elements[0].RemoveAttribute("hint", CodeFluent.Producers.SqlServer.Constants.SqlServerProducerNamespaceUri); } } // helper method to read XML element's hint attribute in the SQL Server Producer namespace private static string GetSqlServerProducerHint(Node node) { if (node == null) return null; return node.GetAttributeValue<string>("hint", CodeFluent.Producers.SqlServer.Constants.SqlServerProducerNamespaceUri, null); } } ?> </cf:project> </code></pre> |
35,763,353 | 0 | <p>Try this</p> <pre><code>(\w+\.\w+) </code></pre> <p><a href="https://regex101.com/r/wK3cK7/1" rel="nofollow">https://regex101.com/r/wK3cK7/1</a></p> <p>Output:</p> <pre><code>MATCH 1 1. [13-26] `summary_t.dat` MATCH 2 1. [33-48] `pre_summary.csv` MATCH 3 1. [50-58] `data.dat` </code></pre> |
31,213,130 | 0 | IE8 breaks compatibility view if embedded as an activeX <p>Using it as a CDHTMLDialog from MFC, I noticed that for some sites (such as wikipedia.org) the embeded IE reports a <code>documentMode</code> property of 7, while using the IE app properly presents the <code>documentMode</code> property as 8. Same thing is true for IE11 too (<code>documentMode</code> property is 11 when launched standalone and 7 when used embedded). What's going on here ?</p> |
29,128,169 | 0 | Leaflet.draw prevent events <p>I have added the draw control to my Mapbox map and only have polygon enabled. I'm attempting to prevent the draw tool from going into draw mode if the user has not zoomed into a certain level. I have added a click event to the polygon button using it's class, but I cannot figure out what call I need to make to cancel the draw.</p> <pre><code>$('.leaflet-draw-draw-polygon').on('click', function (e) { if (map.getZoom() < 13) //Cancel draw else drawingPolygon = true; }); </code></pre> |
11,280,343 | 0 | How to plot family tree in R <p>I've been searching around how to plot a family tree but couldn't find something i could reproduce. I've been looking in Hadley's book about ggplot but the same thing.</p> <p>I want to plot a family tree having as a source a dataframe similar to this:</p> <pre><code>dput(head(familyTree)) structure( list( id = 1:6, cnp = c("11", NA, "22", NA, NA, "33"), last_name = c("B", "B", "B", NA, NA, "M"), last_name_alyas = c(NA, NA, NA, NA, NA, "M"), middle_name = c("C", NA, NA, NA, NA, NA), first_name = c("Me", "P", "A", NA, NA, "S"), first_name_alyas = c(NA, NA, NA, NA, NA, "F"), maiden_name = c(NA, NA, "M", NA, NA, NA), id_father = c(2L, 4L, 6L, NA, NA, 8L), id_mother = c(3L, 5L, 7L, NA, NA, 9L), birth_date = c("1986-01-01", "1963-01-01", "1964-01-01", NA, NA, "1936-01-01"), birth_place = c("City", "Village", "Village", NA, NA, "Village"), death_date = c("0000-00-00", NA, NA, NA, NA, "2007-12-23"), death_reason = c(NA, NA, NA, NA, NA, "stroke"), nr_brothers = c(NA, 1L, NA, NA, NA, NA), brothers_names = c(NA, "M", NA, NA, NA, NA), nr_sisters = c(1L, NA, 1L, NA, NA, 2L), sisters_names = c("A", NA, "E", NA, NA, NA), school = c(NA, "", "", NA, NA, ""), occupation = c(NA, "", "", NA, NA, ""), diseases = c(NA_character_, NA_character_, NA_character_, NA_character_, NA_character_, NA_character_), comments = c(NA_character_, NA_character_, NA_character_, NA_character_, NA_character_, NA_character_) ), .Names = c("id", "cnp", "last_name", "last_name_alyas", "middle_name", "first_name", "first_name_alyas", "maiden_name", "id_father", "id_mother", "birth_date", "birth_place", "death_date", "death_reason", "nr_brothers", "brothers_names", "nr_sisters", "sisters_names", "school", "occupation", "diseases", "comments"), row.names = c(NA, 6L), class = "data.frame" ) </code></pre> <p>Is there any way I can plot a family tree with ggplot? If not, how can i plot it using another package.</p> <p>The primary key is 'id' and you connect to other members of the family using "id_father" and "id_mother".</p> |
39,550,383 | 0 | How to execute a function after a group components did mount in reactjs? <p>Callback <code>componentDidMount</code> works perfectly when I am dealing with elements in that component, but I want to execute a function that deals with element of multiple components on a page, after a group of components been mounted. What is the best way I can do that?</p> |
20,952,596 | 0 | <h1>Remove drive letter:</h1> <pre><code>s/^\w\://; </code></pre> <h1>Convert / to space:</h1> <pre><code>s/\// /g; </code></pre> <p>Do you want to cut off the leading "/"? Use this RegEx as the first one:</p> <pre><code>s/^\w\:\///; </code></pre> |
19,068,923 | 0 | WP on GAE Insert Image in Post: "An error occurred in the upload. Please try again later." <p>I've been banging my head against a wall on this one. I'm running Wordpress on AppEngine and have everything working fine (<a href="https://developers.google.com/appengine/articles/wordpress?hl=en" rel="nofollow">followed the GAE install instructions</a>) except I can't insert an image into a post. I've installed the GAE WP plugin and have the cloud storage set up properly (which I know because the upload actually works and I can see the uploads when I go to Media > Library in the left nav in WP.</p> <p>Here's the error's I have in the logs for wp-admin/async-upload.php:</p> <pre><code>W 2013-09-28 12:05:02.529 PHP Notice: Undefined variable: types in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385 W 2013-09-28 12:05:02.529 PHP Warning: array_keys() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385 W 2013-09-28 12:05:02.529 PHP Warning: asort() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2231 W 2013-09-28 12:05:02.529 PHP Warning: Invalid argument supplied for foreach() in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2232 W 2013-09-28 12:05:02.529 PHP Notice: Undefined variable: icon in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4398 </code></pre> <p>And here's what I've got in the logs for wp-admin/admin-ajax.php:</p> <pre><code>W 2013-09-28 12:05:03.683 PHP Notice: Undefined variable: types in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385 W 2013-09-28 12:05:03.683 PHP Warning: array_keys() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385 W 2013-09-28 12:05:03.683 PHP Warning: asort() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2231 W 2013-09-28 12:05:03.683 PHP Warning: Invalid argument supplied for foreach() in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2232 W 2013-09-28 12:05:03.683 PHP Notice: Undefined variable: icon in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4398 W 2013-09-28 12:05:03.745 PHP Notice: Undefined variable: types in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385 W 2013-09-28 12:05:03.745 PHP Warning: array_keys() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385 W 2013-09-28 12:05:03.745 PHP Warning: asort() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2231 W 2013-09-28 12:05:03.745 PHP Warning: Invalid argument supplied for foreach() in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2232 W 2013-09-28 12:05:03.745 PHP Notice: Undefined variable: icon in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4398 W 2013-09-28 12:05:03.751 PHP Notice: Undefined variable: types in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385 W 2013-09-28 12:05:03.751 PHP Warning: array_keys() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385 W 2013-09-28 12:05:03.751 PHP Warning: asort() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2231 W 2013-09-28 12:05:03.751 PHP Warning: Invalid argument supplied for foreach() in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2232 W 2013-09-28 12:05:03.751 PHP Notice: Undefined variable: icon in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4398 W 2013-09-28 12:05:03.755 PHP Notice: Undefined variable: types in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385 W 2013-09-28 12:05:03.755 PHP Warning: array_keys() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4385 W 2013-09-28 12:05:03.756 PHP Warning: asort() expects parameter 1 to be array, null given in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2231 W 2013-09-28 12:05:03.756 PHP Warning: Invalid argument supplied for foreach() in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 2232 W 2013-09-28 12:05:03.756 PHP Notice: Undefined variable: icon in /base/data/home/apps/s~WPONGAE/wp.0000000000000000/wordpress/wp-includes/post.php on line 4398 </code></pre> <p>What am I missing here? Thanks for any help.</p> |
5,240,632 | 0 | <p>Use the delegated administration on IIS.</p> |
24,633,053 | 0 | I have a program that saves to a sharepoint directory but has intermittent errors <p>I have a program that saves to a SharePoint network directory (folder) but has intermittent errors</p> <p>E.g.:</p> <p>\sandbox2010\sites\mySite\myDirectory</p> <p>However, with no code change whatsoever, this will work/fail depending on whether the relevant network SharePoint directory (folder) is "awake" on the relevant server.</p> <p>Does anyone know a way to automate "awakening" of this network folder on the relevant server so the intermittent error goes away?</p> <p>Thanks!</p> |
15,326,074 | 0 | Need help in choosing Collection type <p>I need to return a file ID (<code>Integer</code>) and success or fail (<code>boolean</code>) values from a method. I have 3 options in my mind.</p> <p>One is to convert the both the values String and make the return type as <code>ArrayList</code>.</p> <p>The second option is to use the <code>HashMap</code>. Since those both values doesn't have any dependency I am not sure whether I can use this type or not.</p> <p>Third one is to convert both into String objects and return a comma separated string.</p> <p>Please suggest me which one is the better solution for me.</p> |
32,305,382 | 0 | <p>I had the same problem while handle a lot of data , it works with 5 because it renders the five elements that are visible on the screen but that gives prob with more elements. The thing is ..</p> <p>Sometimes RecyclerView and listView just skips Populating Data. In case of RecyclerView binding function is skipped while scrolling but when you try and debug the recyclerView adapter it will work fine as it will call onBind every time , you can also see the official google developer's view <a href="http://www.youtube.com/watch?v=wDBM6wVEO70" rel="nofollow">The World of listView</a>. Around 20 min -30 min they will explain that you can never assume the getView by position will be called every time. </p> <p>so, I will suggest to use</p> <p><a href="https://github.com/satorufujiwara/recyclerview-binder" rel="nofollow">RecyclerView DataBinder created by satorufujiwara.</a> </p> <p>or</p> <p><a href="https://github.com/yqritc/RecyclerView-MultipleViewTypesAdapter" rel="nofollow">RecyclerView MultipleViewTypes Binder created by yqritc.</a></p> <p>These are other Binders available if you find those easy to work around .</p> <p>This is the way to deal with MultipleView Types or if you are using large amount of data . These binders can help you just read the documentation carefully that will fix it, peace!!</p> |
2,795,213 | 0 | <p>Here is a way to extend transactional functionality to your typed dataset. You could alter this to include your special SQLCommand wrappers.</p> <p>In this example, I have a dataset called "dsMain" and a few direct queries in a "QueriesTableAdapter". I extend the partial class for the TableAdapter with a function that will create a transaction based on the first (0) connection and then apply it to every connection in the table adapter.</p> <pre><code>Namespace dsMainTableAdapters Partial Public Class QueriesTableAdapter Public Function CreateTransaction() As Data.IDbTransaction Dim oConnection = Me.CommandCollection(0).Connection oConnection.Open() Dim oTrans = oConnection.BeginTransaction() For Each cmd In Me.CommandCollection cmd.Connection = oConnection cmd.Transaction = oTrans Next Return oTrans End Function End Class End Namespace </code></pre> <p>You begin the transaction by calling the new function</p> <pre><code>Dim qa As New dsMainTableAdapters.QueriesTableAdapter Dim oTrans = qa.CreateTransaction() </code></pre> <p>Then you can call TableAdapter queries within your transaction</p> <pre><code>qa.Query1 qa.Query2 </code></pre> <p>When you are done with your queries you commit the transaction</p> <pre><code>oTrans.Commit() </code></pre> <p>You can do the same thing for any TableAdapter that was created for your datasets. If you have multiple TableAdapters that need to use the same transaction, then in addition to a "CreateTransaction" you should make a "SetTransaction" and have the Transaction be a parameter.</p> |
28,760,610 | 0 | By using protege can we store & retrieve data's like we doing it on relational database? <p>Hi I very new to semantic web and <code>Protege</code>.</p> <p>Can we store and retrieve data in <code>Protege</code> like we do in relational database? Or can we manipulate only models? if yes, do we need RDBMS for storing data and use <code>Protege</code> to manage the relationship?.</p> <p>Can we use protege as replacement for Mysql Database to store and retrieve information? </p> <p>OR I am completely wrong about what is protege?</p> |
3,955,200 | 0 | <p>UUID is a 128 bit value. The <code>CHAR(16) FOR BIT DATA</code> type reflects that it is bit data stored in character form for conciseness. I don't think <code>VARCHAR(16)</code> would work because it doesn't have the bit flag. The database would have to be able to convert the binary data to character data which deals with encoding and is risky. More importantly, it wouldn't buy you anything. Since a UUID is <em>always</em> 128 bits, you don't get the space savings from using <code>VARCHAR</code> over <code>CHAR</code>. So you might as well use the intended <code>CHAR(16) FOR BIT DATA</code>.</p> <p>With JDBC, I think you use the get/setBytes() method since it is dealing with small amounts of binary data. (Not positive, would have to try this)</p> <p>And no idea about the SQL Server part.</p> |
37,712,585 | 0 | <p>Assuming you want a height in pixels of 500, you can use this to get the intervals:</p> <pre><code>import math pixels = 500 offset = math.log(10) for x in range(10, 71, 10): print x, int(pixels * (math.log(x) - offset) / (math.log(70) - offset)) </code></pre> <p>This is the output:</p> <pre><code>10 0 20 178 30 282 40 356 50 413 60 460 70 500 </code></pre> <p>The pixel counts are just the differences between the start and end of each interval. Change 500 to fit your application.</p> |
40,873,634 | 0 | <p>Your code creates the <code>Breakout</code> object and sets its visibility: </p> <pre><code>Breakout bo = new Breakout(); bo.setVisible(true); </code></pre> <p>However, you never invoke any other methods. For example you may want to invoke a <code>run</code> method or a <code>main</code> method. You have to call those methods somehow in order to execute the code.</p> <p>Another option would be to add a listener to the <code>Breakout</code> class so that it executes your code when the window opens, something like this: </p> <pre><code>addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { //call a method that runs the program here! } }); </code></pre> |
11,400,317 | 0 | backside-visibility not working in IE10 - works fine in webkit <p>I'm building a simple pure-css 'card flip' animation, it <em>has</em> to work in IE10, but sadly what I've written doesn't.</p> <p><a href="http://jsfiddle.net/felixthehat/7FeEz/1/">jsFiddle demo here</a> or <a href="https://www.dropbox.com/s/kbp8rh0sbh49ixe/backside%20vis%20test%20case.zip">sample html zip here</a></p> <p>I can see that backside-visibility works in IE10 from <a href="http://ie.microsoft.com/testdrive/Graphics/hands-on-css3/hands-on_3d-transforms.htm">their demo here</a> so maybe I've just overlooked something stupid, maybe a fresh pair of eyes might help!</p> <p>Thanks in advance!</p> |
22,859,808 | 0 | Cross and sub domain tracking with Google Analytics Universal Tag <p>This is my first question on Stackoverflow. So apologies if I make a mistake...</p> <p>The challenge: I have a website (main.com), a sub-domain (sub.main.com) and 10 websites that send traffic, back and forth, to the main site and the sub domain. Let's call these sites site01.com, site02.com, site03.com,...,site10.com.</p> <p>My question: How do I implement Universal Tag so I can do cross-domain tracking between main.com, sub.main.com and site01.com, site02.com, site03.com,...,site10.com.</p> <p>I found instructions on how to do cross domain tracking for two sites. For example, on the main domain I will add the following code:</p> <pre><code>**<!-- Universal Analytics --> <script type="text/javascript"> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXXXXX-X', 'main.com', {'allowLinker': true}); ga('require', 'linker'); ga('linker:autoLink', ['site01.com']); ga('send', 'pageview'); </script>** </code></pre> <p>And on site01.com, I will add the code below:</p> <pre><code>**<!-- Universal Analytics --> <script type="text/javascript"> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXXXX-X', 'site01.com',{'allowLinker': true}); ga('send', 'pageview'); </script>** </code></pre> <p>I don't know how to modify the code to include all 10 sites (site01.com, site02.com, site03.com,...,site10.com as part of the cross domain tracking.</p> <p>Also, in relation to sub-domain tracking, I am guessing that the above code will also capture data from the sub-domain site (sub.main.com) with no issues.</p> <p>Any help will be greatly appreciated.</p> <p>Stratos.</p> |
32,733,242 | 0 | iOS 8/9 CalendarEvent predicateForEventsWithStartDate EndDate not working correctly? <p>Is it possible that the function: <code>predicateForEventsWithStartDate(startDate: NSDate, endDate: NSDate, calendars:[EKCalendar])</code> is not working as described in the documentation!? The enddate seems to work as expected, taking into account the day and the time of the date. But when retrieving the events for the predicate, events being on the startdate X (and later than the time of the start date) are never fetched. As soon as I set the startdate to 23:59 the previous day of X, all events of day X are fetched as expected. </p> <p>Has anybody experienced this behaviour? Or is the documentation not correct and this is the expected behavoir? </p> <p>Note: Tried on Iphone 6(iOS8) / Ipad mini 3(iOS8) / iPhone 5 (iOS 9)</p> <p>EDIT: here is the documentiation of the method:</p> <pre><code>func predicateForEventsWithStartDate(_ startDate: NSDate, endDate endDate: NSDate, calendars calendars: [EKCalendar]?) -> NSPredicate </code></pre> <p>Creates and returns a predicate for finding events in the event store that fall within a given date range.</p> <p><strong>startDate</strong><br> The start date of the range of events fetched.</p> <p><strong>endDate</strong> The end date of the range of events fetched.</p> <p><strong>calendars</strong><br> The calendars to search, as an array of EKCalendar objects. Passing nil indicates to search all calendars.</p> |
32,806,003 | 0 | <pre><code>var happyMood = document.getElementById("happy"); var sadMood = document.getElementById("sad"); happyMood.onclick = function () { var mainHeading = document.getElementById("heading"); mainHeading.innerHTML = "You have selected "; }; sadMood.onclick = function () { var mainHeading = document.getElementById("heading"); mainHeading.innerHTML = "You have selected " + sadMood; }; </code></pre> |
34,981,099 | 0 | <p>With an <a href="https://docs.python.org/3/reference/expressions.html#conditional-expressions" rel="nofollow"><code>if-else</code> conditional expression</a>:</p> <pre><code>predictedClassification = 1 if predictedClassification >= 0.5 else 0 </code></pre> <p>The result equals <code>1</code> if the expression is <code>True</code> and 0 otherwise.</p> <pre><code>predictedClassification = 10 predictedClassification = 1 if predictedClassification >= 0.5 else 0 print(predictedClassification) 1 </code></pre> |
11,378,482 | 0 | jQuery, I want an explanation. Why does this work? $($('div')) <p>I'm curious. This:</p> <pre><code>$('div'), this $($('div')), and this $($($('div')))... and so on </code></pre> <p>Seem to all work as selectors for HTML elements. Does anyone know why this works, and if there are any actual (besides redundancy), problems that arise when doing this?</p> <p><a href="http://jsfiddle.net/NpT2b/" rel="nofollow">http://jsfiddle.net/NpT2b/</a></p> |
33,051,328 | 0 | <p>As @piggybox already mentioned, it is not possible directly. But you can use Python/ Java SDK to do the copy on individual tables and simulate a transaction. </p> <p>If your tables are consumer facing and you do not want the data to be visible until all the tables are loaded, you can first load the data to staging tables and use a config table for the live status. Your Python/ Java script should keep polling this config table and as soon as the status is "ready/ good-to-go" for all the tables, you can do deep copy (insert as select) from the staging tables into the actual tables. These inserts will be DML so you can control them in a single transaction.</p> |
18,514,482 | 0 | Resizing Background Images Using Media Queries Working for Webpage but not Email <p>I am working on creating a responsive email template for a client. I'm trying to get text to appear over an image, so I am attempting to create a responsive email that will display text over a fluid background image (I know...background images, emails, not a good combo, but I'm going for it). </p> <p>I am able to get the code to work perfectly on a webpage (see here: <a href="http://testwes.site90.com/NaerbyggEmailTemplateTestStylingv3.html" rel="nofollow">http://testwes.site90.com/NaerbyggEmailTemplateTestStylingv3.html</a> ) however, when I send a test email (via Mailchimp) it seems the media queries are not picking up to change the background image, so the main background image (the picture of the house, paint, green etc.) does not change size, though the rest of my media query requests are working fine (text adjusting, icons moving around, even my header logo img resizes (not a background image of course). You can see an example of the code after the email is sent here: (<a href="http://us7.campaign-archive1.com/?u=9be35a6a6ef5bf6014d5f59fe&id=ac4b24cd76" rel="nofollow">http://us7.campaign-archive1.com/?u=9be35a6a6ef5bf6014d5f59fe&id=ac4b24cd76</a>). </p> <p>I am really looking for any way to incorporate editable text over a fluid image for email, and I figured I'd give background images a shot. If anyone has any advice for resizing background images via media queries for email, please help! </p> <p>Thanks, <br> Wes</p> |
3,558,020 | 0 | <p>The best way is to use a try/finally block</p> <pre><code>try { this.running = true; ... } finally { this.running = false; } </code></pre> <p>Real thread locks are only needed if this method is called from multiple threads. Given that it appears to be a paint event handler this is unlikely as controls are affinitized to a single thread.</p> |
10,684,079 | 0 | Outputting relevant input/output to a GUI, having received input in the console <p>I need to display some relevant information (like an introduction, yes/no questions and other questions) to a user via a gui, who then enters their response into the console. However, I cannot for the life of me think of or find a way to do this. How can I run the GUI but still allow input into the console? Here is some cut down code I have that shows what I'm trying to do. I'm doing this from a pps frame class that handles the container stuff. I just need to add buttons, text fields and later on action events.</p> <pre><code>public class gui extends XFrame { private JTextField[] textFieldsUneditable; public gui() { super(); textFieldsUneditable = new JTextField[10]; for(int i=0; i<textFieldsUneditable.length; i++) { textFieldsUneditable[i] = new JTextField(42); textFieldsUneditable[i].setEditable(false); add(textFieldsUneditable[i]); } revalidate(); repaint(); } public void paintComponent(Graphics g) { super.paintComponent(g); // code code code } </code></pre> <p>But what I have is other methods, of which I want to run and then output into these uneditable JTextFields using setText in the GUI after the user has responded in the console. I hope that makes sense!</p> |
11,884,355 | 0 | Processor serial number <p>I need PSN of CPU. I write code like</p> <pre><code>int info[4] = { -1 }; __cpuid(info, 1); int family = info[0] & 0xf00; int features = info[3] & 0xf000; std::stringstream psn_id; </code></pre> <p>How i get Processor serial number? Can anyone please help me. Thank you.</p> |
9,524,971 | 0 | <p>Disclaimer: I am still pretty new to puppet :)</p> <p>The key is to think of everything in terms of dependencies. For class dependencies, I like to use the Class['a'] -> Class['b'] syntax. Say you have a tomcat class that requires a jdk class which downloads/installs the sun jdk from oracle. In your tomcat class, you can specify this with</p> <p>Class['jdk'] -> Class['tomcat']</p> <p>Alternatively you can declare a class with a require meta parameter rather than using include.</p> |
21,388,154 | 0 | <p>Merge plays and pauses as a property and filter the interval stream with it.</p> <pre><code>var pauses = $('.pause').asEventStream('click').map(false); var plays = $('.plays').asEventStream('click').map(true); var isTicking = pauses.merge(plays).toProperty(true); var ticks = Bacon.interval(500).filter(isTicking); </code></pre> |
35,363,221 | 0 | <p>In your comments you stated that the <code>.jar</code> files are unzipping and not running on your friends' computers.</p> <p>This is usually caused by Java not being installed on their computers. They should get the <a href="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html" rel="nofollow">Java SE Runtime Environment from Oracle</a> and install it. Afterwards, the jar files can be run with a double-click.</p> <p>If your friends already have Java installed, they might have to fix their file associations (so <code>.jar</code> files no longer open with their ZIP tool).</p> |
17,088,541 | 0 | <p>A solution could be to explore the boundingbox from the text objects and generate a box yourself. Its not very convenient. Perhaps my example can be improved, transformations always confuse me a bit.</p> <pre><code>import matplotlib.patches as patches import matplotlib.pyplot as plt fig, axs = plt.subplots(1,1) t1 = axs.text(0.4,0.6, 'Hello world line 1', ha='center', color='red', weight='bold', transform=axs.transAxes) t2 = axs.text(0.5,0.5, 'Hello world line 2', ha='center', color='green', weight='bold', transform=axs.transAxes) t3 = axs.text(0.6,0.4, 'Hello world line 3', ha='center', color='blue', weight='bold', transform=axs.transAxes) fig.canvas.draw() textobjs = [t1,t2,t3] xmin = min([t.get_window_extent().xmin for t in textobjs]) xmax = max([t.get_window_extent().xmax for t in textobjs]) ymin = min([t.get_window_extent().ymin for t in textobjs]) ymax = max([t.get_window_extent().ymax for t in textobjs]) xmin, ymin = fig.transFigure.inverted().transform((xmin, ymin)) xmax, ymax = fig.transFigure.inverted().transform((xmax, ymax)) rect = patches.Rectangle((xmin,ymin),xmax-xmin,ymax-ymin, facecolor='grey', alpha=0.2, transform=fig.transFigure) axs.add_patch(rect) </code></pre> <p>You might want to add a small buffer etc, but the idea would stay the same.</p> <p><img src="https://i.stack.imgur.com/QHOWe.png" alt="enter image description here"></p> |
26,710,169 | 0 | <p>You probably don't have the access token at the time the request to 'me/feed' is sent. </p> <p>getLoginStatus does not only check if the user is authorized, it also refreshes the user session. that´s why it is important to do api calls after it is "connected". </p> <p>Try putting the call to FB.api inside getLoginStatus.</p> <p>This question is similar to the problem you're having:<a href="http://stackoverflow.com/questions/15812050/facebook-javascript-sdk-an-active-access-token-must-be-used-to-query-information?rq=1">Facebook javascript sdk An active access token must be used to query information about the current user</a></p> |
40,023,293 | 0 | <p>Change your formula for the following:</p> <pre><code>=INDIRECT(CONCATENATE("FAB!U",(1638+((ROW()-1)*43)))) </code></pre> <p>You will need to play with this to get the outcome you desire. Imagine the above was put into cell A1, 1638 is the first row in your question, add on 43 times the row you are on minus one. So first row is 1, minus 1 is 0, 0*43 is 0, so you are still left with 1638.</p> <p>Move to the second row and it is 1638, add your row 2, minus 1 gives you 1, 1 * 43 is 43, so you have 1638+43=1681.</p> <p>Concatenate just joins <code>FAB!U</code> with the outcome of that formula.</p> <p>Indirect makes it a cell reference.</p> <p>Try to understand and have a play before just putting sticking it in.</p> |
8,868,402 | 0 | <p>Twitter itself is running on Rails, and it has a <a href="https://dev.twitter.com/docs/api" rel="nofollow">REST API</a>. You could easily write your own solution with <a href="http://api.rubyonrails.org/classes/ActiveResource/Base.html" rel="nofollow">ActiveResource</a></p> <p>You can get started with the <a href="http://railscasts.com/?tag_id=19" rel="nofollow">ActiveResource videos on Railscasts</a></p> |
40,696,858 | 0 | CSS: select last element at specified depth (two-level menubar) <p>I have a multi level menu: menu line + some items may have a drop list. Items in menu line are separated by '|' and obviously the last item should not have it's border</p> <p>The problem is that <code>last-child</code> here captures the very last item in the last dropdown list and I need to capture menu line item (item3).</p> <p><a href="https://i.stack.imgur.com/lzRJz.png" rel="nofollow noreferrer">result</a></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>/* MENU */ div.menu { display: inline; } div.menu a { padding-left: 0.5em; padding-right: 0.5em; border-right: 1px solid lightgrey; font-size: 12pt; } div.menu a:last-child { border-right: 0px; } /*DROP DOWN*/ .dropdown { position: relative; display: inline; } .dropdown_content { display: none; z-index: 1; position: absolute; top: 1em; right: 0; background-color: #f9f9f9; white-space: nowrap; border-bottom: 1px solid lightgrey; } .dropdown_content a { padding: 0.2em; text-decoration: none; display: block; } .dropdown:hover .dropdown_content { display: block; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code><div class="menu"> <a href="">Item1</a> <a href="">Item2</a> <div class="dropdown"> <a class="dropbtn">Item3</a> <div class="dropdown_content"> <a href="">Subitem1</a> <a href="">Subitem2</a> </div> </div> </div></code></pre> </div> </div> </p> <p>I need pure CSS solution, please no JS<br> It should work on IE11<br> I suspect that maybe the menu html structure is not ideal too ... so maybe some different structure would automatically solve the issue. </p> <p>Thank in advance ! :)</p> |
36,841,116 | 0 | <p>Not really a solution but I ended up rebuilding my local dev server from scratch. The glob() function started working after that. So, something must have happened to mess things up.</p> |
6,769,705 | 0 | <p>Use <a href="http://jquery.com/" rel="nofollow">jQuery</a> and its hover and css methods</p> <pre><code>$('#quickstart').hover( function(){$('#visiblepanel').css('visibility','visible')}, function(){$('#visiblepanel').css('visibility','hidden')} ); </code></pre> |
11,041,953 | 1 | Many-to-one relationships ComboBox filtering <p>Experts!</p> <p>Having the following models.py </p> <pre><code>class Country(models.Model): name = models.CharField(max_length=50) def __unicode__(self): return self.name class Meta: verbose_name = 'Countries Uploaded' class Users(models.Model): name = models.CharField(max_length=50) cUsers = models.ForeignKey(Country) def __unicode__(self): return self.name class Meta: verbose_name = 'Users on a country' class GoalsinCountry(models.Model): Country = models.ForeignKey(VideoTopic) name = models.CharField(max_length=50) descr = models.TextField(blank=True, null=True) def __unicode__(self): return self.name class Meta: verbose_name = 'Goals Topic' </code></pre> <p>i would like to filter out the users that belongs to a particular country and not all see all users when choosing a country on the combobox, and be able to save this information to a sqlite3 db.</p> <p>if i add the following code below Country = Models.. gUser = models.ForeignKey(Users)</p> <p>Using the Django admin interface, will show all users, not filtering users based on the country they are.. Would this be possible to do with Django + Something else? is there any working example/Tutorial - like the northwind MS Tutorial?</p> <p>Thank you</p> |
14,997,937 | 0 | <pre><code>Include and require are identical, except upon failure: require will produce a fatal error (E_COMPILE_ERROR) and stop the script include will only produce a warning (E_WARNING) and the script will continue </code></pre> <p>You can understand with examle include("test.php"); echo "\nThis line will be print";</p> <p>Output :Warning: include(test.php): failed to open stream: No such file or directory in /var/www/........ This line will be print</p> <p>require("test.php"); echo "\nThis line will be print"; Warning: require(test.php): failed to open stream: No such file or directory in /var/www/....</p> |
40,864,785 | 0 | Calculate centroid of a set of coordinates on a PySpark dataframe <p>I have a dataframe similar to </p> <pre><code>+----+-----+-------+------+------+------+ | cod| name|sum_vol| date| lat| lon| +----+-----+-------+------+------+------+ |aggc|23124| 37|201610|-15.42|-32.11| |aggc|23124| 19|201611|-15.42|-32.11| | abc| 231| 22|201610|-26.42|-43.11| | abc| 231| 22|201611|-26.42|-43.11| | ttx| 231| 10|201610|-22.42|-46.11| | ttx| 231| 10|201611|-22.42|-46.11| | tty| 231| 25|201610|-25.42|-42.11| | tty| 231| 45|201611|-25.42|-42.11| |xptx| 124| 62|201611|-26.43|-43.21| |xptx| 124| 260|201610|-26.43|-43.21| |xptx|23124| 50|201610|-26.43|-43.21| |xptx|23124| 50|201611|-26.43|-43.21| +----+-----+-------+------+------+------+ </code></pre> <p>Where for each name I have a few different lat lon on the same dataframe. I would like to use the <code>shapely</code> function to calculate the centroid for each user:</p> <pre><code>Point(lat, lon).centroid() </code></pre> <p>This UDF would be able to calculate it:</p> <pre><code>from shapely.geometry import MultiPoint def f(x): return list(MultiPoint(tuple(x.values)).centroid.coords[0]) get_centroid = udf(lambda x: f(x), DoubleType()) </code></pre> <p>But how can I apply it to a list of coordinates of each user? It seems that a <a href="http://stackoverflow.com/questions/33502263/is-spark-sql-udaf-user-defined-aggregate-function-available-in-the-python-api">UDAF</a> on a group by is not a viable solution in this case.</p> |
19,938,877 | 0 | <p>I successfully round-trip a vanilla <code>http</code> call during a background task's callback, in production code. The <a href="https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSessionTaskDelegate_protocol/Reference/Reference.html#//apple_ref/occ/intfm/NSURLSessionTaskDelegate/URLSession%3atask%3adidCompleteWithError%3a" rel="nofollow">callback</a> is:</p> <pre><code>-[id<NSURLSessionTaskDelegate> URLSession:task:didCompleteWithError:] </code></pre> <p>You get about 30 seconds there to do what you need to do. <em>Any</em> async calls made during that time must be bracketed by </p> <pre><code>-[UIApplication beginBackgroundTaskWithName:expirationHandler:] </code></pre> <p>and the "end task" version of <a href="https://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/occ/instm/UIApplication/beginBackgroundTaskWithName%3aexpirationHandler%3a" rel="nofollow">that</a>. Otherwise, iOS will kill your process when you pop the stack (while you are waiting for your async process). </p> <p>BTW, don't confuse <code>UIApplication</code> tasks (I call them "app tasks") and <code>NSURLSession</code> tasks ("session tasks").</p> |
11,876,533 | 0 | <p>Some events can't be delegated using this method. 'focus' and 'blur' don't work, and in IE8 and lower 'change', 'submit' and 'reset' don't work either. It's actually in the <a href="http://backbonejs.org/docs/backbone.html#section-156" rel="nofollow">annotated source of Backbone</a> but for some reason not in <a href="http://backbonejs.org/#View-delegateEvents" rel="nofollow">the documentation</a>.</p> <p>JQuery's documentation actually states that the method that Backbone uses (<a href="http://api.jquery.com/delegate/" rel="nofollow">$.delegate</a>) is now superseded by <a href="http://api.jquery.com/on/" rel="nofollow">$.on</a> which is able to handle those kinds of events.</p> <p>So your options are:</p> <ul> <li>overload Backbone.View.delegateEvents to use $.on instead of $.delegate</li> <li>manually bind the events as shown by EndangeredMassa.</li> </ul> |
31,358,033 | 0 | <p>you can read <a href="http://developer.android.com/reference/android/widget/ImageView.html" rel="nofollow">this</a>. I think you are talking about this in xml:</p> <p><code>android:background</code> -> A drawable to use as the background, it could be just a color in HEX notation or a drawable. </p> <p><code>android:src</code> -> Sets a drawable as the content of this ImageView. </p> <p>However in java you can use <code>setImageDrawable(Drawable drawable)</code> for setting a drawable as the content of this ImageView.</p> |
28,318,371 | 0 | <ul> <li>If it crashes because of byte alignment it is your fault.</li> <li>boost uses <code>#pragma pack</code> for correctness</li> <li>Compiling with a different byte alignment produce a complete different assemby code, so you have to compile all libraries with the same alignment.</li> <li>If you have your boost project in visual the alignment is under <code>Properties-> C/C+1-> Code Generation -> Struct Member Alignment</code>. If you use another tool find how options are provided to the compiler and pass <code>/Zp1</code>(or <code>-Zp1</code>).</li> </ul> <p>There will be multiple functions used by boost which would require a specific byte alignment. These function may be from the boost framework itself or from microsoft libraries. The classic case will be atomic operations (ie like <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms683614(v=vs.85).aspx" rel="nofollow">InterlockedIncrement</a> ) which requires a minimum byte alignment. </p> <p>If there is a structure</p> <pre><code>struct { char c; int a; volatile int b; } </code></pre> <p>and <code>b</code> is used as atomic operand, The structure members alignment have to be guaranteed using <code>#pragma pack</code>. So boost use explicit <code>#pragma pack</code> for <strong>correctness</strong>.</p> |
23,151,299 | 0 | <p>this is the class :</p> <pre><code><?php class WebDirect_CustomPrice_Model_Sales_Quote_Item extends Mage_Sales_Model_Quote_Item { public function representProduct($product) { $parentResult = parent::representProduct($product); //if parent result is already false, we already have a different product, exit. if ($parentResult === false) { return $parentResult; } $itemProduct = $this->getProduct(); /* * do our check for 'same product' here. * Returns true if attribute is the same thus it is hte same product */ if ($product->getPrice() == $itemProduct->getPrice()) { return true; //same product } else { return false; //different product } } } </code></pre> |
20,405,246 | 0 | FactoryGirl creating factories objects on start <p>For some reason, when I run </p> <pre><code>rspec specs </code></pre> <p>The models defined on Factory girl are automatically created. I was expecting to create the objects with sentences like:</p> <pre><code>FactoryGirl.create(:user) </code></pre> <p>But I am having a lot of duplication problems due to this.</p> <p>Moreover, if I go to the rails console and I type:</p> <pre><code>require 'factory_girl_rails' </code></pre> <p>It inserts some records on my database.</p> <p>Is this expected behavior?</p> <p>UPDATE: The problem was on my factory (silly mistake). I was calling create method there.</p> <pre><code>FactoryGirl.define do factory :user do email "[email protected]" first_name "Myname" last_name "MyLast name" password "DoeDoe12" api_license FactoryGirl.create(:api_license) end end </code></pre> |
40,726,285 | 0 | <p>It is been a while since I fixed the issue but I thought I should write it here in case someone encounters a similar problem. </p> <p>There was not any bug, nor any memory leak in the code. The program works perfectly. The issue was that the process of creating new vectors was faster than than the one writing to the file. </p> <p>I solved it by having two separate threads to speed up the process. The first thread would create vectors and store them in a buffer. The second thread would take a vector from that buffer and write it.</p> |
31,160,113 | 0 | <p>add to payload</p> <pre><code>grant_type=authorization_code </code></pre> |
10,978,057 | 0 | <p>Clearly this operation is not thread-safe since, as you mentioned yourself, it involves several assembler instructions. In fact, openMP even has a special directive for this kind of operations.</p> <p>You will need the <code>atomic</code> pragma to make it, well, "atomic":</p> <pre><code>#pragma omp atomic totalTime += elapsedTime; </code></pre> <p>Note that <code>atomic</code> only works when you have a single update to a memory location, like an addition, increment, etc.</p> <p>If you have a series of instructions that need to atomic together you must use the <code>critical</code> directive:</p> <pre><code>#pragma omp critical { // atomic sequence of instructions } </code></pre> <p><strong>Edit</strong>: Here's a good suggestion from "snemarch": If you are repeatedly updating the global variable <code>totalTime</code> in a parallel loop you can consider using the <code>reduction</code> clause to automatize the process and also make it much more efficient:</p> <pre><code>double totalTime = 0; #pragma omp parallel for reduction(+:totalTime) for(...) { ... totalTime += elapsedTime; } </code></pre> <p>At the end <code>totalTime</code> will correctly contain the sum of the local <code>elapsedTime</code> values without need for explicit synchronization.</p> |
7,257,186 | 0 | <p>I see no problem using the second version. I usually use the second version, only using the first version if the sender may be more than one type of object. Then, if the method needs to know what type of object, the method can query the sender before casting the sender to a particular type. </p> <p>Even more frequently I find no need to access the sender, so I just use:</p> <pre><code>- (IBAction)buttonPressed { // Do something. } </code></pre> |
4,599,484 | 0 | requesting ajax via HttpWebRequest <p>I'm writing a simple application that will download some piece of data from a website then I can use it later for any purpose.</p> <p>The following is the request and response copied from Firebug as the browser did that. When you type <code>http://x5.travian.com.sa/ajax.php?f=k7&x=18&y=-186&xx=12&yy=-192</code> you will get a PHP file has some data. But when I make a request with <code>HttpWebRequest</code> I get wrong data (some unknown letters)</p> <p>Can anyone help me in that? Do I have to make some encodings or what?</p> <p><strong>Response</strong></p> <pre class="lang-none prettyprint-override"><code> 1. Server nginx 2. Date Tue, 04 Jan 2011 23:03:49 GMT 3. Content-Type application/json; charset=UTF-8 4. Transfer-Encoding chunked 5. Connection keep-alive 6. X-Powered-By PHP/5.2.8 7. Expires Mon, 26 Jul 1997 05:00:00 GMT 8. Last-Modified Tue, 04 Jan 2011 23:03:49 GMT 9. Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0 10. Pragma no-cache 11. Content-Encoding gzip 12. Vary Accept-Encoding </code></pre> <p><strong>Request</strong> </p> <pre class="lang-none prettyprint-override"><code> 1. Host x5.travian.com.sa 2. User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) 3. Gecko/20101203 Firefox/3.6.13 4. Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 5. Accept-Language en-us,en;q=0.5 6. Accept-Encoding gzip,deflate 7. Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 8. Keep-Alive 115 9. Connection keep-alive 10. Cookie CAD=57878984%231292375897%230%230%23%230; T3E=%3DImYykTN2EzMmhjO5QTM2QDN2oDM1ITOyoDOxIjM4EDN5ITM6gjO4MDOxIWZyQWMipTZu9metl2ctl2c6MDNxADN6MDNxADNjMDNxADNjMDNxADN; orderby_b1=0; orderby_b=0; orderby2=0; orderby=0 </code></pre> |
32,927,225 | 0 | Auth does not work on app engine <p>I'm trying to use the given authentication methods for app engine:</p> <pre><code>handlers: - url: /static static_dir: src/static - url: /admin/.* script: src.app login: admin - url: /client/.* script: src.app login: required - url: /.* script: src.app login: optional </code></pre> <p>But the authentication does not work when I navigate to <code>/client</code> or <code>/admin</code></p> |
5,275,518 | 0 | <p>Try using the internalChange and externalChange functions.</p> <p><a href="http://jsfiddle.net/5L6Ur/9/" rel="nofollow">http://jsfiddle.net/5L6Ur/9/</a></p> |
24,670,272 | 0 | <p>Each Ethernet frame starts with an Ethernet header, which contains destination and source MAC addresses as its first two fields. </p> |
19,254,165 | 0 | <p>IMHO, Hadoop all by itself won't be able to solve your problem. First of all Hadoop(HDFS to be precise) is a FS and doesn't provide columnar storage wherein you can query for a particular field. Data inside HDFS is stored as flat files and you have to traverse across the data in order to reach upto the point where the data of interest resides.</p> <p>Having said that, there are some workarounds, like making use of <strong><a href="http://hive.apache.org" rel="nofollow">Hive</a></strong>. Hive is another member of the Hadoop family which provides warehousing capability on top of your existing Hadoop cluster. It allows us to map HDFS files as Hive tables which can be queried conveniently. Also, it provides a SQL like interface to query these tables. But, Hive is not a good fit if you have real time needs.</p> <p>I feel something like <strong><a href="https://github.com/cloudera/impala" rel="nofollow">Imapala</a></strong> would be more useful to you which allows to query our BigData keeping the real-time-ness in mind.</p> <p>The reason for whatever I have mentioned above is that your use case requires more than just scalability provided by Hadoop. Along with the ability to distribute the load, your solution should be able to cater the needs you have specified above. It is more than just distributing your data over a group of machines and running raw querying over it. Your users would require <strong>real-time response</strong> along with the <strong>smart suggestions</strong> feature you have mentioned in your question.</p> <p>You actually need a smarter system than just a Hadoop cluster. Do have a look at <strong><a href="http://mahout.apache.org/" rel="nofollow">Apache Mahout</a></strong>. It is an awesome tool that provides the feature of <strong>Recommendation Mining</strong> and can be used with Hadoop easily. You can find more its home page. I will definitely help you in adding that <strong>smart suggestions</strong> feature to your system.</p> <p>You might wanna have a look at another tool of the Hadoop family, the <strong><a href="http://hbase.apache.org/" rel="nofollow">HBase</a></strong>, which is a distributed, scalable, big data store. It acts like a database, but it is not a relational database. It also runs on an existing Hadoop cluster and provides real-time random read/write capabilities. Read a bit about it and see if it fits somewhere.</p> <p>Last but not the least, it all depends on your needs. An exact decision can be made only after giving different things a try and doing a comparative study. We can just suggest you based on our experiences, but a fair decision can be made only after testing a few tools and finding which one fits best into your requirements :)</p> |
21,068,704 | 0 | <p>Your class variable cannot be private if you would like your child class to access it. Try protected instead and it should work!</p> |
2,563,348 | 0 | <p>Pretty much you want two different images of a star. One image is the plain white star and the other is the yellow (or whatever color) star that indicates it has been favorited. On the click event of the image, you just check which image is the src and then change it accordingly to match the necessary status of favorited or not. Then you run an ajax call to actually save the status to the database.</p> <ul> <li>The closest tutorial I found so far: <a href="http://www.9lessons.info/2009/09/favourite-rating-with-jquery-and-ajax.html" rel="nofollow noreferrer">http://www.9lessons.info/2009/09/favourite-rating-with-jquery-and-ajax.html</a></li> </ul> |
18,598,930 | 0 | <p>Arrays don't really have a concept of 'width' and 'height', the dimensions are arbitrary.</p> <p>It just so happens that the length of the array in first dimension is 12 and the length of the array in the second dimension is 6, so it's a 12x6 array. The fact that you and I conventionally think of the first dimension as 'width' and the second as 'height' is not relevant to the compiler.</p> |
9,558,502 | 0 | <p>First make sure the dll that failed to load is actually in the search path of your Application. If it is, run the <a href="http://www.dependencywalker.com/" rel="nofollow">Dependency Walker</a> on the dll that failed to load to see why it failed to load. Like the error message says it is possible that one of the dll's dependencies failed to load. For instance, a common mistake occurs if you deploy a debug version of your dll. It would work on your development machine since it most likely would have whaterver SDK you used already installed, but on a fresh machine it would fail to load because the debug dlls are not installed. The Dependency Walker will allow you to find this sort of problem.</p> |
10,820,629 | 0 | gimp command line <p>I am using gimp 2.6 in linux and would like to run a built in script from the command line (plugins > web > slice). Using the default options would be fine, or entering in them at the command line would be fine I don't really care. Just simply run the built-in script from the command line and then exit gimp. But I can't find a simple example anywhere online, all of them huge scripts with very steep learning curves. Could someone please give me an example of how to just run py-slice on an image and then exit the gimp?</p> |
31,034,921 | 0 | <p>Changing your code to this:</p> <pre><code>$(document).ready(function(){ var rightHeight = $('.rightcolumn').height(); var leftHeight = $('.leftcolumn').height(); if(leftHeight < rightHeight) { $('.leftcolumn').height(rightHeight); } }); </code></pre> <p>Seems to do the trick for safari. <a href="http://jsfiddle.net/p0070zb4/" rel="nofollow"><strong>See this fiddle</strong></a></p> |
25,513,402 | 0 | <p>The easiest solution is to create the project in the <strong>default location</strong> in the wizard. Then it just works (as of this writing, but it didn't use to). You can move it to wherever you want at that point.</p> <p><img src="https://i.stack.imgur.com/IFgya.png" alt="enter image description here"></p> <p>You <strong>can</strong> create it in a different folder but then you'll have to:</p> <ul> <li>Edit the modulePath entries in the descriptor.json files to remove the extra path (in my case changed com/test to com/).</li> <li>Remove the bad generated-source folders in the java build path.</li> <li>Add the correct generated-source folders into the java build path.</li> </ul> <p>Which is pointless but included here for completeness. I admit I don't know what I'm doing in the descriptor.json files but it fixed the problem for me.</p> |
30,200,471 | 0 | Mysql query to select records where the sum of a column's values is in a given variable range <p>I've been trying to write a query to select all records from a table where the sum of a column's values is between a variable range.</p> <p>Here's what I came up with so far:</p> <pre><code>$result = mysql_query(' SELECT * FROM table WHERE SUM(column) BETWEEN $Range1 AND $Range2 ORDER BY RAND()); </code></pre> <p>However when I try to loop through the above query with the mysql_fetch_object function it gives me a common error (The supplied argument is not a valid result).I've tried different ways of writing it but still come up short</p> <p>So I tried the query using aliases you guys provided but still get the same error.</p> <pre><code>$result = mysql_query(' SELECT column1, SUM(column2) AS Total FROM table GROUP BY column1 HAVING Total BETWEEN $Range1 AND $Range11 ORDER BY RAND()'); </code></pre> |
32,398,155 | 0 | PHP Sessions and Cookies set up <p>I want to learn something, that I couldn't find on the internet. I create a simple website, more like a simple web app, we the following structure.</p> <pre><code>index.php --> handles log In or Register home.php --> main state of website. </code></pre> <p>So basically I want when a user log in, the website will direct him to <code>home.php</code>. I did it already. But I get a really annoying bug. If I redirect bruteforce in <code>www.someexample.com/home.php</code>, the user can bypass the main log in screen. O.o<br> So I thought that if I can use a session checker to see if the user is log in or just a brute forcer -sorry about the bad term- the website will redirect him to log in screen. And if the user don't want every time to log in he can check a <code>Remember me</code> button to remember the session. So in the end I want to have two methods. one to check if a user is log in or not and the other to save his session even after if he close the computer until he poush the log out button.</p> <p>I have checked many articles on the web but I couldn't find how to start in my own project. Can you guys help me start of with a basic structure. i use MySql.</p> |
26,214,919 | 0 | <p>Design a UI and ask the user to supply the "email incoming/outgoing server settings", which you then store in a file, database, or <code>SharedPreferences</code> as appropriate.</p> |
25,538,711 | 0 | How to sort items for faster insertion in the MapDB BTree? <p>so I have a list of around 20 million key value pairs, and I'm storing the data in several MapDB's differently to see how it affects my programs performance, and for experiment sake.</p> <p>The thing is, it takes quite a lot of time to insert (in random order) 20 million key-value pairs into a mapdb. So, I would like to sort the list of key-value pairs I have so I can insert them faster, and thus build databases faster out of them.</p> <p>So, how would I go about this?</p> <p>I'd like to learn how to do this for MapDB's BTreeSet and BTreeMap, or, MapDBs that use single key-value pairs and MapDBs that have multiple values for a single key.</p> <p>EDIT: I forgot to mention, the key-value pairs are String objects.</p> |
28,211,541 | 0 | Swipe Function- Universal Device Compatibility issue during automation testing using appium <p>How should one use <strong>swipe/scroll</strong> for <strong>maven automation testing</strong> using <strong>appium</strong> so that it is <strong>compatible</strong> for all the devices? I tried using fixed coordinates and then converting them into percentages of the screen height and width, so that the corresponding coordinates are used for swipe in some other device, but i think because of the 5th parameter of the swipe function (swipe duration), it is not getting universal. What is the work around to achieve universal compatibility for swipe? </p> |
12,808,179 | 0 | Geocode results based on current location <p>In one of my activities i need to be able to do a geocoding (find a location by address String search). The problem is that my results are much too broad. When i search for "mcdonalds" i get results that are in different parts of the USA. How can i make it so a user can search for nearby restaurants (or any location) and the results will be within a certain distance? I basically need more precise results for my application. Here is a screenshot of whats happening: <img src="https://i.stack.imgur.com/T2naX.png" alt="enter image description here"></p> <pre><code>public class MainActivity extends MapActivity { HelloItemizedOverlay itemizedOverlay; List<Overlay> mapOverlays; Drawable drawable; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MapView myMap = (MapView) findViewById(R.id.mapview); myMap.setBuiltInZoomControls(true); MapController mc = myMap.getController(); mapOverlays = myMap.getOverlays(); drawable = this.getResources().getDrawable(R.drawable.androidmarker); itemizedOverlay = new HelloItemizedOverlay(drawable, this); //geopoints are cordinates in microdegrees or degrees * E6 GeoPoint point = new GeoPoint(34730300, -86586100); //GeoPoint point2 = locatePlace("texas", mc); //HelloItemizedOverlay.locatePlace("Texas", mc, myMap); //overlayitems are items that show the point of location to the user OverlayItem overlayitem = new OverlayItem(point, "Hola, Mundo!", "im in huntsville"); //OverlayItem overlayitem2 = new OverlayItem(point2, "Texas", "hi"); //itemizedoverlay is used here to add a drawable to each of the points itemizedOverlay.addOverlay(overlayitem); //itemizedOverlay.addOverlay(overlayitem2); //this adds the drawable to the map //this method converts the search address to locations on the map and then finds however many you wish to see. locatePlace("mcdonalds", mc, 5); mapOverlays.add(itemizedOverlay); //this animates to the point desired (i plan on having "point" = current location of the user) mc.animateTo(point); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } @Override protected boolean isRouteDisplayed(){ return false; } public void locatePlace(String locName, MapController mc, int numberToDisplay) { // code to make the google search via string work // i use the Geocoder class is used to handle geocoding and reverse-geocoding. So make an instance of this class to work with the methods included Geocoder geoCoder1 = new Geocoder(this, Locale.getDefault()); try { List<Address> searchAddresses = geoCoder1.getFromLocationName(locName, numberToDisplay); // gets a max of 5 locations if (searchAddresses.size() > 0) { //iterate through using an iterator loop (for loop would have been fine too) //Iterator<Address> iterator1 = searchAddresses.iterator(); for (int i=0; i < searchAddresses.size(); i++){ //while (iterator1.hasNext()){ //step1 get a geopoint GeoPoint tempGeoP = new GeoPoint( (int) (searchAddresses.get(i).getLatitude()*1E6), (int) (searchAddresses.get(i).getLongitude()*1E6) ); //step2 add the geopoint to the Overlay item OverlayItem tempOverlayItm = new OverlayItem(tempGeoP, locName, "this is " + locName); //step3 add the overlay item to the itemized overlay HelloItemizedOverlay tempItemizedOverlay = new HelloItemizedOverlay(drawable, this); // its breakking here......... tempItemizedOverlay.addOverlay(tempOverlayItm); //the itemized overlay is added to the map Overlay mapOverlays.add(tempItemizedOverlay); } } } catch (IOException e) { e.printStackTrace(); // Log.e("the error", "something went wrong: "+ e); }//finally {} } } </code></pre> <p>// here is the important code from the Itemized overlay class</p> <pre><code>public HelloItemizedOverlay(Drawable defaultMarker, Context context) { super(boundCenter(defaultMarker)); myContext = context; } public void addOverlay(OverlayItem overlay){ mOverlays.add(overlay); populate(); } </code></pre> <p>Thanks, Adam</p> <p>Here is some code after adjusting to Vishwa's comments:</p> <pre><code> // these 2 variables are my current location latitudeCurrent = 34730300; // make this dynamic later longitudeCurrent = -86586100; // make this dynamic later LLlatitude = (latitudeCurrent - 100000)/(1E6); //lowerleft latitude = original lat - (1)*degree/10 LLlongitude = (longitudeCurrent+ 100000)/(1E6);//lowerleft longitude = original longitude - (1)*degree/10 URlatitude = (latitudeCurrent + 100000)/(1E6); //upperright latitude = original + (1)*degree/10 URlongitude = (longitudeCurrent+ 100000)/(1E6); //upperright longitude = original longitude + (1)*degree/10 try { List<Address> searchAddresses = geoCoder1.getFromLocationName(locName, numberToDisplay, LLlatitude, LLlongitude, URlatitude, URlongitude); </code></pre> <p><img src="https://i.stack.imgur.com/jJc7p.png" alt="after creating a square of allowable results from the getfromlocationname()"></p> |
18,576,495 | 0 | <p>The easiest way could be using introtext and fulltext in K2.</p> <ol> <li><p>Go to K2 > Parameters > Advanced > Use one editor window for introtext & fulltext (<strong>YES</strong>).</p></li> <li><p>Make sure that introtext and fulltext are set to <strong>Show</strong> in the corresponding K2 category and/or item settings (Item view options in the right tabs).</p></li> <li><p>Verify that your K2 template (if a custom one) is showing both parts:</p></li> </ol> <p>This was taken from the original item.php K2 template.</p> <pre><code><?php if(!empty($this->item->fulltext)): ?> <?php if($this->item->params->get('itemIntroText')): ?> <!-- Item introtext --> <div class="itemIntroText"> <?php echo $this->item->introtext; ?> </div> <?php endif; ?> <?php if($this->item->params->get('itemFullText')): ?> <!-- Item fulltext --> <div class="itemFullText"> <?php echo $this->item->fulltext; ?> </div> <?php endif; ?> <?php else: ?> <!-- Item text --> <div class="itemFullText"> <?php echo $this->item->introtext; ?> </div> <?php endif; ?> </code></pre> |
31,412,755 | 0 | <p>Found new way to do it :</p> <h2>Objective-C</h2> <pre><code>- (void)didMoveToParentViewController:(UIViewController *)parent{ if (parent == NULL) { NSLog(@"Back Pressed"); } } </code></pre> <h2>Swift</h2> <pre><code>override func didMoveToParentViewController(parent: UIViewController?) { if parent == nil { println("Back Pressed") } } </code></pre> |
3,497,998 | 0 | why am I getting "integer expected" error in the Android manifest? <p>I think I've asked this before but I can't find the question now, and I don't think I got an answer. </p> <p>In the android manifest on the first line ""</p> <p>I'm getting an error marker (with a red X). When I mouse over the red x it says-</p> <p>"Manifest attribute 'minSdkVersion' is set to '2.1'. Integer is expected."</p> <p>does anyone know what could be causing this or how I might fix it? </p> <p>Thanks</p> |
4,760,995 | 0 | Get change commands without modifying collection <p>Probably a very poorly named title, but anyway...</p> <p>I am using the command pattern on a hierarchical data set. So basically I need a method that returns an object that <em>describes</em> the changes that will be made without actually changing the data. So for example:</p> <p>Object 1 -> Object 2 -> Object 3</p> <p>If I move object 1, it will cause a change in Object 2, which will cause a change in Object 3 because they depend on each other. So...I need a method to recursively go through the hierarchical collection and gather up the changes that are required to move Object 1 without actually modifying the collection. Halfway through the recursion it would be nice to be able to use something like Object1.Location, but it may already slated for change so I can't reliably use it.</p> <p>I feel like there are plenty of algorithms and such that need to do this type of "in place" modification. As a non-CS major I didn't learn much of this type of thing, so I don't really even know what search terms to look for to find a "solution". I put solution in quotes because I realize there probably isn't a direct solution for my problem, but I am merely looking for some good guidelines/examples of this being done to get my brain cranking.</p> <p>Can anyone provide some real-world examples of this type of thing being done? Thanks in advance.</p> |
10,908,550 | 0 | <p>Following are the under Microsoft Public License (Ms-PL) license and You might want to check out <a href="http://www.codeplex.com/quickgraph" rel="nofollow">QuickGraph</a>.</p></p> <p><a href="http://www.codeplex.com/NodeXL" rel="nofollow">NodeXL</a> might also be of interest (visualization library). It's WPF, but you can use a container to host it if you need WinForms.</p> <p>You can use check <a href="http://www.graphviz.org/" rel="nofollow">GraphViz</a> to generate this sort of graph. My app generates the <strong>.dot</strong> file that can then is then passed into GraphViz. It supports a load of file formats, such as bmp, jpg, png, pdf, svg etc etc.</p> <p>Reference:</p> <p><a href="http://www.dmoz.org/Science/Math/Combinatorics/Software/Graph_Drawing/" rel="nofollow">Open Source tools list</a><br> <a href="http://stackoverflow.com/questions/737771/c-sharp-graph-drawing-library">C# graph drawing library?</a><br> <a href="http://stackoverflow.com/questions/69275/drawing-a-web-graph">Drawing a Web Graph</a></p> <p>You could use <a href="http://quickgraph.codeplex.com/" rel="nofollow">QuickGraph</a> to easily model the graph programatically, then export it to <a href="http://quickgraph.codeplex.com/wikipage?title=Visualization%20Using%20Graphviz&referringTitle=Documentation" rel="nofollow" >GraphViz</a> or <a href="http://quickgraph.codeplex.com/wikipage?title=Visualization%20Using%20Glee&referringTitle=Documentation" rel="nofollow" >GLEE</a>, then render it to PNG.</p> |
21,764,770 | 1 | TypeError: got multiple values for argument <p>I read the other threads that had to do with this error and it seems that my problem has an interesting distinct difference than all the posts I read so far, namely, all the other posts so far have the error in regards to either a user created class or a builtin system resource. I am experiencing this problem when calling a function, I can't figure out what it could be for. Any ideas?</p> <pre><code>BOX_LENGTH = 100 turtle.speed(0) fill = 0 for i in range(8): fill += 1 if fill % 2 == 0: Horizontol_drawbox(BOX_LENGTH, fillBox = False) else: Horizontol_drawbox(BOX_LENGTH, fillBox = True) for i in range(8): fill += 1 if fill % 2 == 0: Vertical_drawbox(BOX_LENGTH,fillBox = False) else: Vertical_drawbox(BOX_LENGTH,fillBox = True) </code></pre> <p>Error message:</p> <pre><code> Horizontol_drawbox(BOX_LENGTH, fillBox = True) TypeError: Horizontol_drawbox() got multiple values for argument 'fillBox' </code></pre> |
22,071,604 | 0 | <p>I think it is due to a jar conflict or maybe some jars are missing. Maybe you are using some other jars (in your application) apart of the ones you have included within your glassfish. Try to run a simple Fusion Web App (ex: only one jsf in it) and see if it runs. If it doesn't work then you might consider trying another Glassfish or to reconfigure it. I am using Glassfish 3.1.2.2 without problems.</p> |
16,286,775 | 0 | A simple subtraction practice <p>I want to make a little game for my son to practice subtraction ( since he won't get off the computer !! ) . i have tried this code but my problem is that i want the first number to be always higher than the second number (cause that's wht they know so far ) ..this is my code :</p> <pre><code><?PHP $string = "1234567890"; $shuffled = str_shuffle($string); $shuffled2 = str_shuffle($string); $num1 = substr($shuffled, 0, 3); $num2=substr($shuffled2, 0, 3); if ($num2 > $num1) { some code here .. } else { echo "$num1<BR>"; echo "$num2<BR>"; $res= $num1-$num2; echo "$res<BR>"; } ?> </code></pre> <p>so what is the missing code here ..i was thinking (goto) back from my days of basic to run code from the beginning until condition if satisfied ..but i don't know if that works in PHP .. Or ...is there a way to put a condition on shuffle in the first place so it can always return the first number higher than the second number? </p> |
34,760,649 | 1 | How to use whoosh for searching keywords <p>Article Schema:</p> <p>Below is the article schema what I have created.</p> <pre><code>class ArticleSchema(SchemaClass): title = TEXT( phrase=True, sortable=True, stored=True, field_boost=2.0, spelling=True, analyzer=StemmingAnalyzer()) keywords = KEYWORD( commas=True, field_boost=1.5, lowercase=True) authors = KEYWORD(stored=True, commas=True, lowercase=True) content = TEXT(spelling=True, analyzer=StemmingAnalyzer()) summary = TEXT(spelling=True, analyzer=StemmingAnalyzer()) published_time = DATETIME(stored=True, sortable=True) permalink = STORED thumbnail = STORED article_id = ID(unique=True, stored=True) topic = TEXT(spelling=True, stored=True) series_id = STORED tags = KEYWORD(commas=True, lowercase=True) </code></pre> <p>Search Query</p> <pre><code>FIELD_TIME = 'published_time' FIELD_TITLE = 'title' FIELD_PUBLISHER = 'authors' FIELD_KEYWORDS = 'keywords' FIELD_CONTENT = 'content' FIELD_TOPIC = 'topic' def search_query(search_term=None, page=1, result_len=10): '''Search the provided query.''' if not search_term or search_term == '': return None, 0 if not index.exists_in(INDEX_DIR, indexname=INDEX_NAME): return None, 0 ix = get_index() parser = qparser.MultifieldParser( [FIELD_TITLE, FIELD_PUBLISHER, FIELD_KEYWORDS, FIELD_TOPIC], ix.schema) query = parser.parse(search_term) query.normalize() search_results = [] with ix.searcher() as searcher: results = searcher.search_page( query, pagenum=page, pagelen=result_len, sortedby=[sorting_timestamp, scores], reverse=True, terms=True ) if results.scored_length() > 0: for hit in results: search_results.append(append_to(hit)) return (search_results, results.pagecount) parser = qparser.MultifieldParser( [FIELD_TITLE, FIELD_PUBLISHER, FIELD_TOPIC], ix.schema, termclass=FuzzyTerm) parser.add_plugin(qparser.FuzzyTermPlugin()) query = parser.parse(search_term) query.normalize() search_results = [] with ix.searcher() as searcher: results = searcher.search_page( query, pagenum=page, pagelen=result_len, sortedby=[sorting_timestamp, scores], reverse=True, terms=True ) if results.scored_length() > 0: for hit in results: search_results.append(append_to(hit)) return (search_results, results.pagecount) return None, 0 </code></pre> <p>When I am trying the title search is working, but for author and keyword the search is not working. I am not able to understand what wrong I am doing here. I am getting data from api and then running the index. It's all working fine. But when I am searching through keywords like <code>authors</code> and <code>keywords</code> it's not working.</p> |
36,089,335 | 0 | <p>A workaround is to add the attribute statically in addition to the binding</p> <pre><code> <use xlink:href="" xlink:href$="[[replaceSVGPath(item)]]"></use> </code></pre> <p>Polymer has issues creating the attribute, if it already exists it can update it just fine.</p> |
29,514,565 | 0 | Subsetting sas data set without creating new data file, rather creating a new variable <p>I have 3 variables in my data set: <code>id</code>, <code>Time</code>, and <code>y1</code>. </p> <p>Now I want to create a new variable with the value of <code>y1</code> when <code>Time=1</code>.</p> <p>How can I do it?</p> |
23,578,715 | 0 | <p>Your while loop itterates over all lines and sets the current line to the routeName. Thats why you habe the last line in you string. What you could do is calling a break, when you habe read the first line oft the file. Then you will have the first line.</p> |
15,453,912 | 0 | Return car make by providing car model from XML file using .asmx web service <p>I am writing an .asmx web service to return all car makes matching a requested model from within an XML file.</p> <p>Using VB in ASP.net, can you suggest how I could:</p> <p>1) first find a match to the requested make, then 2) return all models?</p> <p>Below is a sample of the XML. Thanks!</p> <pre><code><cars> <car> <carmake>Acura</carmake> <carmodels> <carmodel>ILX</carmodel> <carmodel>MDX</carmodel> <carmodel>RDX</carmodel> </carmodels> </car> <car> <carmake>Aston Martin</carmake> <carmodels> <carmodel>DB9</carmodel> <carmodel>DBS</carmodel> <carmodel>Rapide</carmodel> </carmodels> </car> </cars> </code></pre> |
24,258,656 | 0 | <p>It's most likely a permissions problem - if you enabled error reporting or trapped errors in your code then you might be able to identify the problem yourself.</p> |
3,103,307 | 0 | <p><strong>Update: I think this solution is less good then the other one I posted above, but I am leaving it as an example of a solution - which is not so good :) *</strong></p> <p>Hi Rishard,</p> <p>It's a bit difficult with out some sample data to help.</p> <p>But it sound like you could reshape your data using "melt" and "cast" from the "reshape" package. Doing that will enable you to find where you have too few observation per subject, and then use that information to subset your data.</p> <p>Here is an example code of how this can be done:</p> <pre><code>xx <- data.frame(subject = rep(1:4, each = 3), observation.per.subject = rep(rep(1:3), 4)) xx.mis <- xx[-c(2,5),] require(reshape) num.of.obs.per.subject <- cast(xx.mis, subject ~.) the.number <- num.of.obs.per.subject[,2] subjects.to.keep <- num.of.obs.per.subject[,1] [the.number == 3] ss.index.of.who.to.keep <- xx.mis $subject %in% subjects.to.keep xx.to.work.with <- xx.mis[ss.index.of.who.to.keep ,] xx.to.work.with </code></pre> <p>Cheers,</p> <p>Tal</p> |
38,496,260 | 0 | <p>Just make your own class for display block.</p> <pre><code>.db{ display:block; } </code></pre> <p>Then on your jquery just toggle class.</p> <pre><code> $("button").click(function(){ $("#1").toggleClass('db'); }) </code></pre> |
28,900,440 | 0 | CustomComparator sort objects error <p>I keep getting the error </p> <pre><code>The method sort(List<T>, Comparator<? super T>) in the type Collections is not applicable for the arguments (List<InterfaceMessage>, Folder.CustomComparator) </code></pre> <p>on the code...</p> <pre><code>@Override public void sortByDate(boolean ascending) { Collections.sort(messageList, new CustomComparator()); } class CustomComparator implements Comparator<Message> { public int compare(Message message1, Message message2) { return message1.getDate().compareTo(message2.getDate()); } } </code></pre> <p>I'm trying to compare the dates within each object in a list to order them by their dates. I'm new to making a comparator but I have seen many examples which I've followed but mine doesn't seem to work? I know I haven't done anything with "ascending" yet, I just want to get the basic comparator working.</p> <p>Any help is appreciated, thank you :)</p> |
10,644,981 | 0 | <p>I don't think this will do you any good. AFAIK, there's no relationship between android.hardware.SensorEvent and com.sun.j3d.utils.behaviors.sensor.SensorEvent.</p> <p>From a brief look at the Android source code, it looks like there's simply no way to create your own SensorEvent object. This is a serious oversight on Google's part, if you ask me.</p> <p>Edit: Here's what I do. I write a method named sensorChanged(Sensor sensor, float[] values) to do all the work, and just call it from the regular onSensorChanged() method. Then, when I want to test sensor handling from within my app, I call sensorChanged() with whatever values I want. I might not be able to create a SensorEvent object, but this way I can still test my code.</p> |
21,656,732 | 0 | <p>I think it's supposed to be:</p> <pre><code>Document doc = Jsoup.connect("http://en.wikipedia.org/wiki/Main_Page").get(); Elements el = doc.select("div#mp-tfa"); System.out.println(el); </code></pre> |
32,381,835 | 0 | <p>Do you want to re-write the handler using lambda's? Could be something like the following</p> <pre><code><T> MessageConsumer<T> consumer(String address, Function<Message<T>, Void> function); </code></pre> <p>and instead of</p> <pre><code>doSomething.consumer("someString", new Handler<Message<JsonObject>>() { @Override public void handle(Message<JsonObject> event) { //do some code } }); </code></pre> <p>you could write</p> <pre><code>doSomething.consumer("someString", message -> null); </code></pre> |
27,911,326 | 0 | <p>WP8.1 map tile layers do not support opacity on their own. However you can add it by using a custom tile source. I have a code sample of how to do this here: <a href="https://code.msdn.microsoft.com/Adding-Opacity-and-WMS-cf6773f1" rel="nofollow">https://code.msdn.microsoft.com/Adding-Opacity-and-WMS-cf6773f1</a></p> |
15,814,315 | 0 | <p>I think it should be like <code>defaults: new { controller = "Content", action = "GetThumbnail" }</code>. <code>action =</code>, <code>not id =</code></p> <p>(Just posting as answer so it can be accepted as it satisfies the OP)</p> |
10,723,438 | 0 | <p>If you have <code>make</code> installed, the build rules that are built in will be enough to build your binaries.</p> <p>Just do <code>make hello</code> and you will get your binary. No need to explicitly call <code>gcc</code>.</p> |
7,938,348 | 0 | Is there a get_method() function in PHP? <p>In one class I call $this->view() which will be handled by its extended class. But how can I get the name of the method in the parent view();</p> <p>To make it somewhat clearer:</p> <pre><code><?php class UsersController extends Controller public function signup() { $this->view(); } } class Controller { public function view() { // How can I get 'signup' so that I can include 'views/Users/signup.php' } } ?> </code></pre> |
22,294,408 | 0 | Cannot update UI from other task in win forms? <p>I have four complex tasks running parallel, I want to update a rich textbox with the log file. The approximate program structure is as follows:</p> <pre><code>Sub buttonClick () complextask1 'code goes here complextask2 'code goes here complextask3 'code goes here complextask4 'code goes here end sub </code></pre> <p>The above four tasks updates a log file, which I have to display in a <code>RichTextbox</code> control. I tried with an infinite <code>while</code> loop, and updating the <code>textbox</code>, but my <code>UI</code> is getting hanged.</p> |
9,708,027 | 0 | Is it possible to define "virtual" default implemetation for getter-setter without preprocessor macros <p>It is possible to use template for default implemetation of getter-setter. </p> <p>For instance - <a href="http://www.kirit.com/C%2B%2B%20killed%20the%20get%20%26%20set%20accessors/A%20simple%20meta-accessor" rel="nofollow">http://www.kirit.com/C%2B%2B%20killed%20the%20get%20%26%20set%20accessors/A%20simple%20meta-accessor</a>. Most important, that if you decide to override default behaviour of such setter or getter, you can easly do this without need to change "client" code, because setter-getter calling syntax is same to calling methods, i.e.:</p> <pre><code>an_object.an_int( 3 ); int i = an_object.an_int(); </code></pre> <p>In both cases an_int can be object with operator() or method of an_object. After overriding re-compilation will be required in "client" code.</p> <p>But is it possible to define "virtual" default implemetation for getter-setter without preprocessor macros? i.e. important thing here is that during overide recompilation of "client" code is not needed. Of course it is possible to do with preprocessor, by I wonder, is there any more elegant solution?</p> <p>For my knowladge of C++03 is not possible, but maybe someone has some ideas, or maybe it is possible in C++11?</p> <hr> <p>Answer for "David Rodríguez - dribeas": something like this:</p> <pre><code>#define accessor(type,name) \ virtual type name() {return m_##name;} \ type m_##name; </code></pre> <p>It can be overrided in derived class without need of recompilation of "client" code.</p> |
35,905,632 | 0 | <p>You should use directives. In their definition, they have a link attribute which receives a function. This function is executed after the directive template is rendered in the DOM. So inside this function you can access any element inside the directive template.</p> <p>Remember: if you are going to do some DOM manipulation you should only execute it in the linker function of the directive that renders the DOM you're manipulating.</p> <p>You can learn more about creating custom directives in <a href="https://docs.angularjs.org/guide/directive" rel="nofollow">https://docs.angularjs.org/guide/directive</a></p> |
19,622,214 | 0 | <p>You need to call</p> <pre><code>call %ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat </code></pre> <p>in your command line window. This sets up a usable environment.</p> |
15,463,963 | 0 | <p>this example as been tested on Chrome 25 and Firefox 19. (<a href="http://jsfiddle.net/9ezyz/" rel="nofollow">http://jsfiddle.net/9ezyz/</a>)</p> <pre><code>function input_update_size() { var value = $(this).val(); var size = 12; // Looking for font-size into the input if (this.currentStyle) size = this.currentStyle['font-size']; else if (window.getComputedStyle) size = document.defaultView.getComputedStyle(this,null).getPropertyValue('font-size'); $(this).stop().animate({width:(parseInt(size)/2+1)*value.length},500); //$(this).width((parseInt(size)/2+1)*value.length); } $('input') .each(input_update_size) .keyup(input_update_size); </code></pre> |
5,073,435 | 0 | <p>While I'm not install expert, I've used Wix successfully. It's complicated to say the least.</p> <p>I don't see any of these products being mentioned that I've seen clients use successfully. </p> <p><a href="http://www.installaware.com/" rel="nofollow">http://www.installaware.com/</a> http://www.flexerasoftware.com/products/installshield.htm <a href="http://www.wise.com/Products/Installations/WiseInstallationStudio.aspx" rel="nofollow">http://www.wise.com/Products/Installations/WiseInstallationStudio.aspx</a></p> <p>All provide localization, file/app for double click association, Framework bootstrapping and target location to the best of my knowledge. InstallAware and Wise provide some form of autoupdate support.</p> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.