pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
16,848,971
0
<p>The issue that I was having was a result of a bug involved with the sorting method implemented in Magento when ordering the total calculations. A more in-depth explanation and solution can be found at the following stack overflow thread.</p> <p><a href="http://stackoverflow.com/questions/9194281/sort-algorithm-magento-checkout-totals-sorted-wrongly-causing-wrong-shipping-ta">Sort algorithm: Magento checkout totals sorted wrongly causing wrong shipping tax calculation</a></p>
18,040,148
0
The Web server does not appear to have the FrontPage server extensions installed and iis6 <p>I wanted to publish my website from visual studio but i got The Web server does not appear to have the FrontPage server extensions installed" error;first I tried to install frontpage but because i didn't have microsoft share point in my administrative tools list and as here said:<a href="http://stackoverflow.com/questions/5858811/frontpage-server-extensions-install-problem">here</a>,I tried to install webdav 7.5 version,(I believed my iis version was 7)but it gives me error that iis version 7 needs webdav version 7.5!!! I have googled it and tried so many links more or less(because I couldn't find some parts of them in my computer),I tried enabling webdav and ... such as:<a href="http://www.petenetlive.com/KB/Article/0000293.htm" rel="nofollow">this</a>and <a href="http://www.iis.net/learn/install/installing-publishing-technologies/installing-and-configuring-webdav-on-iis" rel="nofollow">this</a> but none helped.so I thought maybe I am going wrong,so due to this:<a href="http://stackoverflow.com/questions/18039941/determination-of-windows-server-and-iis">which is my own question</a>,i think maybe i am using windows server 2003 and iis6,so i googled to install frontpage for iis6,<a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/2c522246-8450-408d-b907-197dfa0fdbb6.mspx?mfr=true" rel="nofollow">from here</a>,but I don't have such a thing "FrontPage 2002 Server Extensions" in turn windows features on or off,so what should I do?please help me to get out of this hell,should I upgrade iis6 to iis7?please help,i will be so thankful. by the way my os is windows 7 64 bit,and I use visual studio 2010.</p>
33,556,000
0
<pre><code>JTextField textField = new JTextField(10); one.add(textField, BorderLayout.PAGE_START); one.add(f, BorderLayout.CENTER); </code></pre> <p>The default layout manager for a frame is the BorderLayout, so you need to add tomponens to a different area of the layout. Read the section from the Swing tutorial on <a href="http://docs.oracle.com/javase/tutorial/uiswing/layout/border.html" rel="nofollow">How to Use BorderLayout</a> for more information and examples. The tutorial also has examples of other layout managers and will show you how to better design your class.</p> <p>The tutorial also has a section on <code>Custom Painting</code> your should read because you also should set the preferred size of your custom painting panel.</p>
33,525,605
0
<p>This type of player is connected via Media Transfer Protocol (MTP) Looks like you need <a href="https://pypi.python.org/pypi/PyMTP" rel="nofollow">PyMTP</a> Good luck.</p>
28,979,855
0
Triggering a function with a dropdown - Functions and Scripts for Google Sheets <p>Thanks for the support so far. </p> <p>I've had a look but available information seems a little different to what I'm looking for so I'd very much appreciate a few pointers.</p> <p>Sheet I'm working on: <a href="https://docs.google.com/spreadsheets/d/1K8QhVKWSsvHTFKDHNv3ySb5bcaU9I7tczIZvIkegbw0/edit#gid=1778672780" rel="nofollow">https://docs.google.com/spreadsheets/d/1K8QhVKWSsvHTFKDHNv3ySb5bcaU9I7tczIZvIkegbw0/edit#gid=1778672780</a></p> <p><strong>What I'd like to achieve:</strong> On the Sheet 'Pharma' When B1 dropdown is set to 'Pharma', I want the table to display all data for Pharma industry.</p> <p>I.e., When B1 = Pharma, I want the function in A3 to run (=query({Sanshiro!A1:O; Suil!A1:O; Yujiro!A1:O;Josh!A1:O}, "select * where Col2 contains 'Pharma'",0))</p> <p>Is there a way to do this with just functions or do I have to use a script such as onEdit?</p> <p>e.g. something along the lines of </p> <pre><code>=if (B2 = 'Pharma', run =query({Sanshiro!A1:O; Suil!A1:O; Yujiro!A1:O;Josh!A1:O}, "select * where Col2 contains 'Pharma'",0) </code></pre> <p>Can anyone point me in the right direction?</p> <p>Thank you in advance!!</p>
14,275,235
0
Checkbox loses focus with FocusManager.IsFocusScope="True" <p>I see strange behavior with my <code>CheckBox</code> and its focus/tab order.</p> <p>First some "working" code:</p> <pre><code>&lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition /&gt; &lt;RowDefinition /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Button Grid.Row="0" Width="100" Height="25"/&gt; &lt;TabControl Grid.Row="1" &gt; &lt;!--TabItem Header="tabItem1" Name="tabItem1"--&gt; &lt;TabItem Header="tabItem1" Name="tabItem1" FocusManager.IsFocusScope="True"&gt; &lt;ScrollViewer&gt; &lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition /&gt; &lt;RowDefinition /&gt; &lt;RowDefinition /&gt; &lt;RowDefinition /&gt; &lt;/Grid.RowDefinitions&gt; &lt;TextBox Grid.Row="0" /&gt; &lt;TextBox Grid.Row="1"/&gt; &lt;CheckBox Grid.Row="2" Content="Test" /&gt; &lt;TextBox Grid.Row="3"/&gt; &lt;/Grid&gt; &lt;/ScrollViewer&gt; &lt;/TabItem&gt; &lt;/TabControl&gt; &lt;/Grid&gt; </code></pre> <p>If you try this, the tab order works fine - as long as you do not check the CheckBox. If I check the CheckBox it loses focus and the next tab press sets the focus to the Button.</p> <p>If I remove <code>FocusManager.IsFocusScope="True"</code> all works fine.</p> <p>My question is this behavior wanted or a bug?</p>
29,034,193
0
Using Row_Number of SQL Server in Linq <p>I have a table with data like</p> <pre><code>Date Users ------------------ 01/03/2015 25 02/03/2015 28 04/03/2015 36 07/03/2015 45 08/03/2015 47 </code></pre> <p>I had created a table valued function in Sql Server using Row_Number which gave me output like below which I used for further processing</p> <pre><code>Date Users UsersAdded ---------------------------------- 01/03/2015 25 0 02/03/2015 28 3 04/03/2015 36 8 07/03/2015 45 9 08/03/2015 47 2 </code></pre> <p>However, I need to do the same thing in Linq now but it does not has the Row_Number function. I had a look at <a href="http://stackoverflow.com/questions/17788400/how-do-i-translate-a-query-that-uses-row-number-into-linq">How do I translate a query that uses ROW_NUMBER() into linq?</a> but that is not related to my query. </p> <p>My query in SQL had Rownum upon the date field and query was</p> <pre><code>select date, Users, (T1.Users - isnull(T2.Users,0)) as UsersAdded from tableuser T1 join tableuser T2 on T1.Rownum = (T2.RowNum +1) </code></pre> <p>I am new to LINQ so don't even know how to start on this query. Any help would be appreciated.</p>
2,960,573
0
<p>Do it in your base/parent <code>&lt;system.web&gt;</code> section.</p>
38,256,215
0
<p>You can create bindings that set a flag on button press, and release the flag on button release. You can set a binding on mouse motion that colors the item under the cursor when the flag is set. </p> <p>It would look something like this:</p> <pre><code>class Example(object): def __init__(self, parent): ... self._dragging = False ... self.canvas.bind("&lt;ButtonPress-1&gt;", self.on_click) self.canvas.bind("&lt;B1-Motion&gt;", self.on_move) self.canvas.bind("&lt;ButtonRelease-1&gt;", self.on_release) def on_click(self, event): self._dragging = True self.on_move(event) def on_move(self, event): if self._dragging: items = self.canvas.find_closest(event.x, event.y) if items: rect_id = items[0] self.canvas.itemconfigure(rect_id, fill="red") def on_release(self, event): self._dragging = False </code></pre>
12,645,201
0
<p>When the page is done loading, intercept the links :</p> <pre><code>Dim olink As HtmlElement Dim olinks As HtmlElementCollection = WB1.Document.Links For Each olink In olinks olink.AttachEventHandler("onclick", AddressOf LinkClicked) Next </code></pre> <p>Then add a function :</p> <pre><code>Private Sub LinkClicked(ByVal sender As Object, ByVal e As EventArgs) If txtAddress.Enabled = True Then Dim link As HtmlElement = WB1.Document.ActiveElement Dim url As String = link.GetAttribute("href") MsgBox("Link Clicked: " &amp; link.InnerText &amp; vbCrLf &amp; "Destination: " &amp; url) WB1.Navigate(url, False) End If End Sub </code></pre>
32,680,229
0
How to make estimated value based on amount of text? <p>I'm trying to make a social media app and the amount of text in a post will differ greatly, so I can't just set the overall estimated height to one number. How would I go about setting the estimated height according to the amount of text in each cell? </p>
21,690,055
0
<h2>Upgrading Python (or any package)</h2> <pre><code>$ sudo apt-get update $ sudo apt-get upgrade python </code></pre> <h2>Using Python</h2> <pre><code>$ python Python 2.7.4 (default, Sep 26 2013, 03:20:26) [GCC 4.7.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; print "bacon" bacon &gt;&gt;&gt; </code></pre>
19,107,177
0
<p>The compiler says when you call the function, the argument list is <code>(C2DRender *, CPoint, float, int, float, float)</code>. But there is no exact match for the call. </p> <p>There are two candidates, </p> <pre><code>void CTexture::RenderRotate(C2DRender *,CPoint,FLOAT,BOOL,DWORD,FLOAT,FLOAT) </code></pre> <p>and void CTexture::RenderRotate(C2DRender *,CPoint,FLOAT,DWORD,FLOAT,FLOAT)</p> <p>You can say, <code>int</code> can be converted to <code>BOOL</code> or <code>DWORD</code> to match one of the candidates but the compiler considers both are equally good. So it can not decide and ask for your clarification. </p>
32,545,216
0
<p>I think you hit a fairly common pitfall. When you use dual-y you need to change <code>vAxis</code> to <code>vAxes</code>. Other than that, looks ok.</p> <p>Thanks for using angular-google-chart, by the way!</p>
6,279,376
0
<p>I'm not sure if this is actually going to be a problem, but it's likely this could come up during replication.</p> <p>If you want to prevent it from coming up, you should look into the <a href="http://www.couchbase.org/sites/default/files/uploads/all/documentation/couchbase-api-db.html#couchbase-api-db_db-purge_post" rel="nofollow">/db/_purge</a> command. This command will remove references to deleted documents, and you can specify a single document ID to affect.</p>
33,745,261
0
How do I aggregate fragment URLs when viewing content pageviews? <p>I'm using the Google Analytics dashboard. </p> <p>I'm viewing pageviews for individual pages (Behavior > Site Content > All Pages).</p> <p>I'm seeing results like the example below.</p> <pre><code>page title page views ------------------------------ /blog/a.html 1000 /blog/b.html 500 /blog/c.html 100 /blog/a.html#yo 20 /blog/a.html#sup 10 /blog/b.html#foo 5 </code></pre> <p>I want to aggregate the results so that they just tell me the total amount of views per page. So, <code>/blog/a.html</code> would have 1030, <code>/blog/b.html</code> would have 505.</p>
13,291,854
0
<p>I've dealt with this issue before. I recommend making two classes for distance. One that has the imperial measures and one that has the metric measures. Then, you can convert back and forth between them easily, with the obvious caveat that you lose precision when you do.</p> <p>Here's an example of an imperial distance class, with inches as the base unit of measure.</p> <pre><code> public class ImperialDistance { public static readonly ImperialDistance Inch = new ImperialDistance(1.0); public static readonly ImperialDistance Foot = new ImperialDistance(12.0); public static readonly ImperialDistance Yard = new ImperialDistance(36.0); public static readonly ImperialDistance Mile = new ImperialDistance(63360.0); private double _inches; public ImperialDistance(double inches) { _inches = inches; } public double ToInches() { return _inches; } public double ToFeet() { return _inches / Foot._inches; } public double ToYards() { return _inches / Yard._inches; } public double ToMiles() { return _inches / Mile._inches; } public MetricDistance ToMetricDistance() { return new MetricDistance(_inches * 0.0254); } public override int GetHashCode() { return _inches.GetHashCode(); } public override bool Equals(object obj) { var o = obj as ImperialDistance; if (o == null) return false; return _inches.Equals(o._inches); } public static bool operator ==(ImperialDistance a, ImperialDistance b) { // If both are null, or both are same instance, return true if (ReferenceEquals(a, b)) return true; // if either one or the other are null, return false if (ReferenceEquals(a, null) || ReferenceEquals(b, null)) return false; // compare return a._inches == b._inches; } public static bool operator !=(ImperialDistance a, ImperialDistance b) { return !(a == b); } public static ImperialDistance operator +(ImperialDistance a, ImperialDistance b) { if (a == null) throw new ArgumentNullException(); if (b == null) throw new ArgumentNullException(); return new ImperialDistance(a._inches + b._inches); } public static ImperialDistance operator -(ImperialDistance a, ImperialDistance b) { if (a == null) throw new ArgumentNullException(); if (b == null) throw new ArgumentNullException(); return new ImperialDistance(a._inches - b._inches); } public static ImperialDistance operator *(ImperialDistance a, ImperialDistance b) { if (a == null) throw new ArgumentNullException(); if (b == null) throw new ArgumentNullException(); return new ImperialDistance(a._inches * b._inches); } public static ImperialDistance operator /(ImperialDistance a, ImperialDistance b) { if (a == null) throw new ArgumentNullException(); if (b == null) throw new ArgumentNullException(); return new ImperialDistance(a._inches / b._inches); } } </code></pre> <p>And here's a metric class with meters as the base unit:</p> <pre><code>public class MetricDistance { public static readonly MetricDistance Milimeter = new MetricDistance(0.001); public static readonly MetricDistance Centimeter = new MetricDistance(0.01); public static readonly MetricDistance Decimeter = new MetricDistance(0.1); public static readonly MetricDistance Meter = new MetricDistance(1.0); public static readonly MetricDistance Decameter = new MetricDistance(10.0); public static readonly MetricDistance Hectometer = new MetricDistance(100.0); public static readonly MetricDistance Kilometer = new MetricDistance(1000.0); private double _meters; public MetricDistance(double meters) { _meters = meters; } public double ToMilimeters() { return _meters / Milimeter._meters; } public double ToCentimeters() { return _meters / Centimeter._meters; } public double ToDecimeters() { return _meters / Decimeter._meters; } public double ToMeters() { return _meters; } public double ToDecameters() { return _meters / Decameter._meters; } public double ToHectometers() { return _meters / Hectometer._meters; } public double ToKilometers() { return _meters / Kilometer._meters; } public ImperialDistance ToImperialDistance() { return new ImperialDistance(_meters * 39.3701); } public override int GetHashCode() { return _meters.GetHashCode(); } public override bool Equals(object obj) { var o = obj as MetricDistance; if (o == null) return false; return _meters.Equals(o._meters); } public static bool operator ==(MetricDistance a, MetricDistance b) { // If both are null, or both are same instance, return true if (ReferenceEquals(a, b)) return true; // if either one or the other are null, return false if (ReferenceEquals(a, null) || ReferenceEquals(b, null)) return false; return a._meters == b._meters; } public static bool operator !=(MetricDistance a, MetricDistance b) { return !(a == b); } public static MetricDistance operator +(MetricDistance a, MetricDistance b) { if (a == null) throw new ArgumentNullException("a"); if (b == null) throw new ArgumentNullException("b"); return new MetricDistance(a._meters + b._meters); } public static MetricDistance operator -(MetricDistance a, MetricDistance b) { if (a == null) throw new ArgumentNullException("a"); if (b == null) throw new ArgumentNullException("b"); return new MetricDistance(a._meters - b._meters); } public static MetricDistance operator *(MetricDistance a, MetricDistance b) { if (a == null) throw new ArgumentNullException("a"); if (b == null) throw new ArgumentNullException("b"); return new MetricDistance(a._meters * b._meters); } public static MetricDistance operator /(MetricDistance a, MetricDistance b) { if (a == null) throw new ArgumentNullException("a"); if (b == null) throw new ArgumentNullException("b"); return new MetricDistance(a._meters / b._meters); } } </code></pre> <p>And here's a test method that exemplifies the usage.</p> <pre><code>[TestMethod] public void _5in_Equals_12_7cm() { var inches = new ImperialDistance(5); var cms = new MetricDistance(MetricDistance.Centimeter.ToMeters() * 12.7); var calcCentimeters = Math.Round(inches.ToMetricDistance().ToCentimeters(), 2, MidpointRounding.AwayFromZero); var calcInches = Math.Round(cms.ToImperialDistance().ToInches(), 2, MidpointRounding.AwayFromZero); Assert.AreEqual(cms.ToCentimeters(), 12.7); Assert.AreEqual(calcCentimeters, 12.7); Assert.AreEqual(inches.ToInches(), 5); Assert.AreEqual(calcInches, 5); } </code></pre> <p>You can also add extension methods </p> <pre><code>public static MetricDistance Centimeters(this Int32 that) { return new MetricDistance(MetricDistance.Centimeter.ToMeters() * that); } [TestMethod] public void _100cm_plus_300cm_equals_400cm() { Assert.AreEqual(100.Centimeters() + 300.Centimeters(), 400.Centimeters()); } </code></pre> <p>You can use this simple strategy for weights, temperatures, liquid measures, etc.</p>
9,011,260
0
Thinking Sphinx: Another index error <p>While indexing I get this error:</p> <pre><code>indexing index 'qtl_table_core'... ERROR: index 'qtl_table_core': sql_range_query: 'soybase.qtl_table.QTLName' isn't in GROUP BY (DSN=mysql://_www:***@xxxxxxx/soybase). </code></pre> <p>My model:</p> <pre><code>class QtlTable &lt; ActiveRecord::Base .... define_index do indexes :QTLID, :sortable =&gt; true indexes :QTLName, :sortable =&gt; true end </code></pre> <p>development.sphinx.conf</p> <pre><code>indexer { } searchd { listen = 127.0.0.1:1234 log = /usr/home/benjamin/qtl/log/searchd.log query_log = /usr/home/benjamin/qtl/log/searchd.query.log pid_file = /usr/home/benjamin/qtl/log/searchd.development.pid } source qtl_table_core_0 { type = mysql sql_host = xxxxxxxxxxxxxx sql_user = _www sql_pass = sql_db = soybase sql_query_pre = SET NAMES utf8 sql_query_pre = SET TIME_ZONE = '+0:00' sql_query = SELECT SQL_NO_CACHE `qtl_table`.`QTLID` * CAST(1 AS SIGNED) + 0 AS `QTLID` , `qtl_table`.`QTLID` AS `QTLID`, `qtl_table`.`QTLName` AS `QTLName`, `qtl_table`.`QTLID` AS `sphinx_internal_id`, 0 AS `sphinx_deleted`, 1786069111 AS `class_crc`, IFNULL(`qtl_table`.`QTLID`, '') AS `QTLID_sort`, IFNULL(`qtl_table`.`QTLName`, '') AS `QTLName_sort` FROM `qtl_table` WHERE (`qtl_table`.`QTLID` &gt;= $start AND `qtl_table`.`QTLID` &lt;= $end) GROUP BY `qtl_table`.`QTLID` ORDER BY NULL sql_query_range = SELECT IFNULL(MIN(`QTLID`), 1), IFNULL(MAX(`QTLID`), 1) FROM `qtl_table` sql_attr_uint = sphinx_internal_id sql_attr_uint = sphinx_deleted sql_attr_uint = class_crc sql_attr_str2ordinal = QTLID_sort sql_attr_str2ordinal = QTLName_sort sql_query_info = SELECT * FROM `qtl_table` WHERE `QTLID` = (($id - 0) / 1) } index qtl_table_core { source = qtl_table_core_0 path = /usr/home/benjamin/qtl/db/sphinx/development/qtl_table_core charset_type = utf-8 min_infix_len = 1 enable_star = 1 } index qtl_table { type = distributed local = qtl_table_core } </code></pre>
6,387,757
0
<pre><code>select Data.* from Data inner join Page on (Data.PageID=Page.PageID) where Data.PageID=1 order by if(Page.OrderByMethod='Most Recent Data First', now()-DataDate, if(Page.OrderByMethod='Most Recent Data Last', DataDate-now(), DataName) ); </code></pre>
32,193,371
0
<p>R is very LisP-like. The symbol <code>[</code> is actually a function. When you write <code>mylist[1]</code>, what is actually happening "under the hood" is that items (only one in this instance) inside the flanking square brackets are extracted and passed to the <code>[</code> function as second and possibly third arguments, along with 'mylist` as the first object, so it becomes:</p> <pre><code> `[`(mylist, 1) # that will also succeed if you type it at the command line </code></pre> <p>Both <code>sapply</code> and <code>lapply</code> have a trailing triple-dots argument. So the series of items being passed to <code>[</code> as it first arguments are just the values inside <code>fileNameSplit</code>'s sublists and the <code>1</code> is being recycled as a second argument, and you therefore get the first item in each of those sublists. It's a series of calls like:</p> <pre><code> `[`(mylist[[1]], 1) # as the first one with 2,3, ... in the [[.]] for succeeding calls </code></pre> <p>Because you used <code>sapply</code> the value gets passed to simplify2array and comes back to you as a vector-result, instead of the list that would have been returned had you just used <code>lapply</code>.</p>
119,346
0
<p>It's just personal preference really, and has to do with the layout of your python modules.</p> <p>Let's say you have a module called <code>erikutils</code>. There are two ways that it can be a module, either you have a file called <em>erikutils.py</em> on your <code>sys.path</code> or you have a directory called <em>erikutils</em> on your <code>sys.path</code> with an empty <em><code>__init__.py</code></em> file inside it. Then let's say you have a bunch of modules called <code>fileutils</code>, <code>procutils</code>, <code>parseutils</code> and you want those to be sub-modules under <code>erikutils</code>. So you make some .py files called <em>fileutils.py</em>, <em>procutils.py</em>, and <em>parseutils.py</em>:</p> <pre><code>erikutils __init__.py fileutils.py procutils.py parseutils.py </code></pre> <p>Maybe you have a few functions that just don't belong in the <code>fileutils</code>, <code>procutils</code>, or <code>parseutils</code> modules. And let's say you don't feel like creating a new module called <code>miscutils</code>. AND, you'd like to be able to call the function like so:</p> <pre><code>erikutils.foo() erikutils.bar() </code></pre> <p>rather than doing</p> <pre><code>erikutils.miscutils.foo() erikutils.miscutils.bar() </code></pre> <p>So because the <code>erikutils</code> module is a directory, not a file, we have to define it's functions inside the <em><code>__init__.py</code></em> file.</p> <p>In django, the best example I can think of is <code>django.db.models.fields</code>. ALL the django *Field classes are defined in the <em><code>__init__.py</code></em> file in the <em>django/db/models/fields</em> directory. I guess they did this because they didn't want to cram everything into a hypothetical <em>django/db/models/fields.py</em> model, so they split it out into a few submodules (<em>related.py</em>, <em>files.py</em>, for example) and they stuck the made *Field definitions in the fields module itself (hence, <em><code>__init__.py</code></em>).</p>
17,606,006
0
<p>For someone directed here from google :</p> <p>If your JRE crashes after you run the java tutorials then most probably you have the python Bindings installed as well (cv2.so) . You will have to re-make OpenCV without those bindings </p> <p><code>cmake -DBUILD_SHARED_LIBS=OFF -D BUILD_NEW_PYTHON_SUPPORT=NO</code></p> <p>That solved the problem for me.</p>
14,439,127
0
<p>Save them as UTC time and then convert them to local time when loading to the UI.</p>
6,803,195
0
<p>For those who installed direct from the official installer, just adding the host to the command works with no path changes:</p> <pre><code>psql -h localhost -U postgres </code></pre>
7,797,950
0
<p>South's main concern is handling issues regarding changes in relational db schemas. This is not required in a non-rel db, where smart coding practices and simple scripts can handle migrations as an online operation.</p> <p>See also:</p> <ul> <li><a href="http://code.google.com/appengine/articles/update_schema.html" rel="nofollow">http://code.google.com/appengine/articles/update_schema.html</a></li> <li><a href="http://code.google.com/p/appengine-mapreduce/" rel="nofollow">http://code.google.com/p/appengine-mapreduce/</a></li> </ul> <p>Keep in mind that many Django field types are <a href="http://www.allbuttonspressed.com/projects/djangoappengine#field-types" rel="nofollow">supported by djangoappengine</a>. This means you can use <a href="https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-dumpdata" rel="nofollow"><code>dumpdata</code></a> on your sql project to save your data to files and later use <a href="https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-loaddata" rel="nofollow"><code>loaddata</code></a> in your new project to load it into your models.</p> <p>If you need further processing, you can create a small script that copies data from the old models to the new models.</p>
30,798,732
0
Trouble accumulating data from specific time interval last year <p>I'm trying to accumulate an amount from a SQL query. The inputs <code>@STARTDATE</code> and <code>@ENDDATE</code> is a datetime type (YYYYMMDD).<br> So the Case statements check if the date of the verification is between the specific dates.</p> <p>Some explanations of the Case statements: Works fine:<br> CURRENT_YEAR_ACC, accumulates the current years amounts of verifications from the beginning of the year to @ENDDATE</p> <p>CURRENT_YEAR_MONTHS, the accumulated amounts between @STARTDATE and @ENDDATE.</p> <p>PREVIOUS_YEAR_MONTH, last years accumulated amounts between @STARTDATE -1 yr and @ENDDATE -1 yr.</p> <p>Does not work: </p> <p>PREVIOUS_YEAR_ACC, should calculate beginning of last year (20XX-01-01) to the @ENDDATE -1yr. </p> <p>Here I get the same value as PREVIOUS_YEAR_MONTH</p> <pre><code> sum (RAW_DATA.CURRENT_YEAR_MONTH) as PERIOD_I_AR, sum (RAW_DATA.PREVIOUS_YEAR_MONTH) as PERIOD_FG_AR, sum (RAW_DATA.CURRENT_YEAR_ACC) as ACK_I_AR, sum (RAW_DATA.PREVIOUS_YEAR_ACC) as ACK_FG_AR from (SELECT rehuv.[KD1] as VST_nr, rekod.BEN as VST_ben, rehuv.KONTO as Konto_nr, rektk.KONTO_BEN as Konto_ben, lresk.LEV_NR as LEV_nr, rehuv.TEXT as LEV_ben, rehuv.VER_DATUM as DATUM, case when rehuv.VER_DATUM &gt; = dateadd (month, - datepart (month, @STARTDATE) + 1, @STARTDATE) and rehuv.VER_DATUM &lt; = @ENDDATE then rehuv.BELOPP else 0 end as CURRENT_YEAR_ACC, case when rehuv.VER_DATUM &gt; = dateadd (YEAR, - 1, dateadd (MONTH, - datepart (MONTH, @STARTDATE) + 1, @STARTDATE)) and rehuv.VER_DATUM &lt; = DATEADD (year, - 1, @ENDDATE) then rehuv.BELOPP else 0 end as PREVIOUS_YEAR_ACC, case when rehuv.VER_DATUM &gt; = @STARTDATE and rehuv.VER_DATUM &lt; = @ENDDATE then rehuv.BELOPP else 0 end as CURRENT_YEAR_MONTH, case when rehuv.VER_DATUM &gt; = DATEADD (year, - 1, @STARTDATE) and rehuv.VER_DATUM &lt; = DATEADD (year, - 1, @ENDDATE) then rehuv.BELOPP else 0 end as PREVIOUS_YEAR_MONTH FROM [FTG0001].[dbo].[REHUV] </code></pre>
5,298,680
0
can't connect to oracle from win 2008 R2 <p>i can't connect to oracle from windows 2008 R2 (connect from visual studio)</p> <p>i have installed oracle client x64 , but still can't connect </p> <blockquote> <p>“Oracle client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation”</p> </blockquote> <p>also i tried to connect trough ODBC but i couldn't</p> <p>any ideas please</p>
24,045,905
0
<p>To do that you need a third table which contains EmployeeID and ProjectID. Mark both IDs as primary key. You have to do a double join if you want to select them though but it's the best way to handle it.</p>
30,161,188
0
<p>You can try using following code, have written a sample code ,</p> <pre><code>foreach (GridViewRow row in GridView1.Rows) { Label lblFname = (Label)row.FindControl("lblFname"); Label lblFaName = (Label)row.FindControl("lblFaName"); Label lblLName = (Label)row.FindControl("lblLName"); DropDownList ddl_att = (DropDownList)row.FindControl("ddlDesignation"); DropDownList ddl_rmk = (DropDownList)row.FindControl("ddlRemark"); dataInsert(lblFname.Text,lblFaName.Text,ddl_att.SelectedValue); } public void dataInsert(string First_name,string Father_name,string Attendance) { using (SqlConnection con = new SqlConnection(conn.ConnectionString)) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "yourInsertQuery"; cmd.Connection = con; cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@First_name", First_name); cmd.Parameters.AddWithValue("@Father_name", Father_name); cmd.Parameters.AddWithValue("@Attendance", Attendance); ... ... con.Open(); cmd.ExecuteNonQuery(); } con.Close(); } } </code></pre> <p>Also you can save data into datatable and if your DataTable schema and table schema are matched, then using <code>SqlBulkCopy</code> you can do bulk insert into your database.</p>
104,979
0
<p>As Baltimark said, this is basically a Linear programming problem. If only the coefficients for the shippers (1 for included, 0 for not included) were not (binary) integers for each leg, this would be more easily solveable. Now you need to find some (binary) integer linear programming (ILP) heuristics as the problem is NP-hard. See <a href="http://en.wikipedia.org/wiki/Linear_programming#Integer_unknowns" rel="nofollow noreferrer" title="Wikipedia on integer linear programming">Wikipedia on integer linear programming</a> for links; on my linear programming course we used at least <a href="http://en.wikipedia.org/wiki/Branch_and_bound" rel="nofollow noreferrer" title="Branch and bound">Branch and bound</a>.</p> <p>Actually now that I think of it, this special case is solveable without actual ILP as the amount of days does not matter as long as it is &lt;= 5. Now start by choosing the cheapest carrier for first choice (Conway 5:1000). Next you choose yet again the cheapest, resulting 8 days and 4000 currency units which is too much so we abort that. By trying others too we see that they all results days > 5 so we back to first choice and try the second cheapest (FedEx 2:3000) and then ups in the second and fedex in the last. This gives us total of 4 days and 9000 currency units.</p> <p>We then could use this cost to prune other searches in the tree that would by some subtree-stage result costs larger that the one we've found already and leave that subtree unsearched from that point on. This only works as long as we can know that searching in the subtree will not produce a better results, as we do here when costs cannot be negative.</p> <p>Hope this rambling helped a bit :). </p>
7,307,959
0
<p>Use UIGestureRecognizer <a href="http://www.icodeblog.com/2010/10/14/working-with-uigesturerecognizers/" rel="nofollow">this link</a> follow to gesture </p> <p>And add your table in one UIView after apply your gesture logic on UIView. </p> <p>It may be helpful for you..</p>
19,622,238
0
<p>Your cast is wrong, it should be <code>((B) a).methodX()</code></p>
40,883,708
0
<p>By adding <code>config.skip_image_loading</code> to configuration, I was able to solve the issue.</p>
19,259,252
0
<p>You're not loading jQuery itself. You need to load jQuery before you load jQuery Mobile. jQuery Mobile is not jQuery and does not include jQuery.</p> <p>jQuery Mobile is like jQuery UI: it's essentially a jQuery plugin, and you have to load jQuery before you can load a plugin.</p>
12,845,415
0
<p>You can build your predicate format dynamically to test only non-nil attributes. More on that <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Predicates/Articles/pCreating.html#//apple_ref/doc/uid/TP40001793-SW3" rel="nofollow">here</a>. Also consider making your search diacritic-insensitive (adding a 'd' to your CONTAINS statement). Take "Škoda" for example. You want people to find it with "skoda" as well.</p>
10,988,486
0
AutoMapper resolver not passing expected type <p>Given the following classes and resolver, why am I getting this error? I don't see why ProductAddModel is being passed in at all.</p> <blockquote> <p>AutoMapper.AutoMapperMappingException was unhandled by user code<br> Message=Value supplied is of type System.Decimal but expected AuctionCMS.Framework.Models.Admin.ProductAddModel. Change the value resolver source type, or redirect the source value supplied to the value resolver using FromMember.</p> </blockquote> <p>Types:</p> <pre><code> public class Currency { public Int64 Value { get; set; } // Spot saved for currency type and any other extra properties } public class Product { public Currency Price { get; set; } public Currency ReservePrice { get; set; } } public class ProductAddModel { public Decimal Price { get; set; } public Decimal ReservePrice { get; set; } } </code></pre> <p>Resolver code:</p> <pre><code>public class DecimalToCurrencyValueResolver : ValueResolver&lt;decimal, Currency&gt; { #region Overrides of ValueResolver&lt;decimal,Currency&gt; protected override Currency ResolveCore(decimal source) { return new Currency() { Value = (Int64)((decimal)source) * 1000 }; } #endregion } public class CurrencyToDecimalValueResolver : ValueResolver&lt;Currency, decimal&gt; { #region Overrides of ValueResolver&lt;decimal,Currency&gt; protected override decimal ResolveCore(Currency source) { return (decimal)source.Value * 1000; } </code></pre> <p>Mapping code:</p> <pre><code> Mapper.CreateMap&lt;ProductAddModel, Product&gt;() .ForMember(x =&gt; x.Price, opt =&gt; opt.ResolveUsing&lt;DecimalToCurrencyValueResolver&gt;()) .ForMember(x =&gt; x.ReservePrice, opt =&gt; opt.ResolveUsing&lt;DecimalToCurrencyValueResolver&gt;()); Mapper.CreateMap&lt;Product, ProductAddModel&gt;() .ForMember(x =&gt; x.Price, opt =&gt; opt.ResolveUsing&lt;CurrencyToDecimalValueResolver&gt;()) .ForMember(x =&gt; x.ReservePrice, opt =&gt; opt.ResolveUsing&lt;CurrencyToDecimalValueResolver&gt;()); var model = new ProductAddModel(); var product = new Product(); Mapper.Map&lt;ProductAddModel, Product&gt;(model, product); </code></pre> <p>What am I doing wrong and is this approach the best way to handle simple transforms during the mapping process?</p> <p>Thanks!</p>
28,890,234
0
Ant ReplaceRegExp task changing a line it shouldn't <p>I was updating an xml file with a version/build number. It was working just fine but then a developer put in some new lines of code and for some reason one of those lines gets changed. Here is my regex:</p> <pre><code>`&lt;replaceregexp file="${basedir}Monitors\Invos\Trunk\InvosWPF\InvosSettings.xml" match="&amp;lt;ConfigurationVersion value=\&amp;quot;[0-9.]* " replace="&amp;lt;ConfigurationVersion value=\&amp;quot;${ver_bldnum}" byline="false"/&gt;` </code></pre> <p>Its messing with ChannelLabel2 value. Before the regex: <code>&lt;ChannelLabels&gt; &lt;ChannelLabel0 value="L"/&gt; &lt;ChannelLabel1 value="R"/&gt; &lt;ChannelLabel2 value="Sâ‚"/&gt; &lt;ChannelLabel3 value="Sâ‚‚"/&gt; &lt;/ChannelLabels&gt;</code></p> <p>After the regex: <code>&lt;ChannelLabels&gt; &lt;ChannelLabel0 value="L"/&gt; &lt;ChannelLabel1 value="R"/&gt; &lt;ChannelLabel2 value="Sâ‚?"/&gt; &lt;ChannelLabel3 value="Sâ‚‚"/&gt; &lt;/ChannelLabels&gt;</code></p> <p>Its inserting a ? for some reason. The only line I want it to change is:</p> <pre><code>`&lt;ConfigurationVersion value="1.0.0.92" /&gt;` </code></pre> <p>Thanks for any help or suggestions. </p>
32,158,217
0
Promise map and get current value of array <p>Below I have a regular promise bluebird map. What I'd like to achieve is a way to access the current value of the <code>arr</code>, to say that another way, I'd like to access <code>arr</code> from within the map with all of the preceding returned values. Because of this functionality I would also want the whole array to run linearly and in series (<code>{concurrency: 1}</code>).</p> <p>Is this a special kind of map? Does bluebird offer this natively?</p> <pre><code>var Promise = require('bluebird') var arr = ['alpha', 'beta', 'gamma'] Promise.map(arr, function (item) { console.log([item, arr]) return Promise.resolve(['x', item].join('+')) }, {concurrency: 1}) // logs: // [ 'alpha', [ 'alpha', 'beta', 'gamma' ] ] // [ 'beta', [ 'alpha', 'beta', 'gamma' ] ] // [ 'gamma', [ 'alpha', 'beta', 'gamma' ] ] // expected / desired: // [ 'alpha', [ 'alpha', 'beta', 'gamma' ] ] // [ 'beta', [ 'x+alpha', 'beta', 'gamma' ] ] // [ 'gamma', [ 'x+alpha', 'x+beta', 'gamma' ] ] </code></pre>
37,540,044
0
<p>solved this by using notepad:</p> <p>1) Save the Excel spreadsheet, as a Single Web Page. 2) Edit this page in (say) Notepad, by running the Find/Replace option. 3) Save this Notepad file, as an Excel File - Job done.</p> <p>*steps was found on the net</p>
24,184,820
0
<p>You can use the logical negation of <code>is.null</code> here. That can be applied over the list with <code>vapply</code>, and we can return the non-null elements with <code>[</code></p> <pre><code>(mylist &lt;- list(1:5, NULL, letters[1:5])) # [[1]] # [1] 1 2 3 4 5 # [[2]] # NULL # [[3]] # [1] "a" "b" "c" "d" "e" mylist[vapply(mylist, Negate(is.null), NA)] # [[1]] # [1] 1 2 3 4 5 # [[2]] # [1] "a" "b" "c" "d" "e" </code></pre>
21,369,555
0
<pre><code>&lt;form onSubmit= "formCheck()" type="POST" action="#" &gt; &lt;label for="name"&gt;Name:&lt;/label&gt; &lt;input type="text" name="name" id="name_input" onBlur="formCheck()"&gt; &lt;input type="checkbox" id="valid_name" name="valid_name" disabled&gt; &lt;button type="submit" value="Submit"&gt;Submit&lt;/button&gt; &lt;/form&gt; </code></pre> <p></p> <pre><code>function formCheck() { var val = document.getElementById('name_input').value; if(val!='') document.getElementById('valid_name').checked = true; else alert('Looks like you forgot your name!'); } </code></pre> <p>Fiddle: <a href="http://jsfiddle.net/dTc63/1/" rel="nofollow">http://jsfiddle.net/dTc63/1/</a></p> <p><em>(Just hit run again to try it the other way. POST doesn't work like normal in jsfiddle.)</em></p>
15,522,533
0
java - use of ternary operator <p>I got quite a large code with 4 different conditions which I tried to shorten using the conditional ternary operator as <a href="http://alvinalexander.com/java/edu/pj/pj010018" rel="nofollow">descibed here</a>. However, I can't manage the right syntax since I have more than 2 conditions. Could someone explain how to use the ternary operator in such case? My code goes below</p> <p>And no, I'm not asking to write code for me, I'm looking for an explanation of ternary operator use with multiple conditions</p> <pre><code> if (mp.getCurrentPosition() / 1000 / 60 &lt; 10 &amp;&amp; mp.getCurrentPosition() / 1000 % 60 &lt; 10) { tvTimeElapsed.setText("0" + Integer.toString(mp.getCurrentPosition() / 1000 / 60) + ":" + "0" + Integer.toString(mp.getCurrentPosition() / 1000 % 60)); } else if (mp.getCurrentPosition() / 1000 / 60 &lt; 10 &amp;&amp; mp.getCurrentPosition() / 1000 % 60 &gt;= 10) { tvTimeElapsed.setText("0" + Integer.toString(mp.getCurrentPosition() / 1000 / 60) + ":" + Integer.toString(mp.getCurrentPosition() / 1000 % 60)); } else if (mp.getCurrentPosition() / 1000 / 60 &gt;= 10 &amp;&amp; mp.getCurrentPosition() / 1000 % 60 &lt; 10) { tvTimeElapsed .setText(Integer.toString(mp.getCurrentPosition() / 1000 / 60) + ":" + "0" + Integer.toString(mp.getCurrentPosition() / 1000 % 60)); } else { tvTimeElapsed .setText(Integer.toString(mp.getCurrentPosition() / 1000 / 60) + ":" + Integer.toString(mp.getCurrentPosition() / 1000 % 60)); } </code></pre>
8,550,469
0
BindingSource remove current <p>I use BindingSource for deleting records in my forms:</p> <pre><code>try { BindingSource1.RemoveCurrent(); BindingSource1.EndEdit(); Table1TableAdapter.Update(dataSet01.Table1); } catch (Exception ex) { MessageBox.show(ex.Message); } </code></pre> <p>if record related to another,at first user see this record remove,but after that an error will arise. How can I prevent removing related record at first; so no error will be shown.</p>
14,874,445
0
Is the Monolithic God object in Javascript a performance concern? <h2>The way it is:</h2> <p>I have recently joined a webapp project which maintains, as a matter of standard, one single globally-available (ie, itself a property of <code>window</code>) object which contains, as properties or recursive sub-properties, all the functions and variables necessary to run the application — including stateful indicators for all the widgets, initialization aliases, generic DOM manipulation methods — <em>everything</em>. I would try to illustrate with simplified pseudo-code, but that defeats the point of my concern, which is that this thing is cyclopean. Basically nothing is encapsulated: everything single granular component can be read or modified from anywhere.</p> <h2>The way I'd like it:</h2> <p>In my recent work I've been the senior or only Javascript developer so I've been able to write in a style that uses functions, often immediately invoked / self-executing, for scoping discreet code blocks and keeping granular primitives as variables within those scopes. Using this pattern, everything is locked to its execution scope by default, and occasionally a few judiciously chosen getter/setter functions will be returned in cases where an API needs to be exposed.</p> <h2>…Is B more performant than A on a generic level?</h2> <p>Refactoring the code to functional parity from style A to style B is a gargantuan task, so I can't make any meaningful practical test for my assertion, but is the Monolithic God object anti-pattern a known performance monster compared to the scoped functional style? I would argue for B for the sake of legibility, code safety, and separation of concerns... But I imagine keeping everything in memory all the time, crawling though lookup chains etc would make it either an inherently performance-intensive exercise to access anything, or at least make garbage collection a very difficult task.</p>
32,411,174
0
<pre><code>function doTheStuff(a, b) { var bookstorname = localStorage.getItem(a) if (bookstorname == 1) { document.getElementById(b).setAttribute('checked','checked'); } if (bookstorname == 0) { document.getElementById(b).removeAttribute('checked','checked'); } } window.onload = function Equal() { doTheStuff('b1', 'box1'); doTheStuff('b2', 'box2'); } </code></pre> <p>?</p>
27,723,933
0
Opcache + Memcached Together <p>my environment </p> <p><code>ubuntu 14.04</code> , <code>php 5.5</code> , <code>nginx 1.76</code></p> <p>i am using both <code>opcache</code> and <code>xcache</code> concurrently </p> <pre><code>PHP 5.5.19-1+deb.sury.org~trusty+1 (cli) (built: Nov 19 2014 19:33:43) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies </code></pre> <p>can i use both opcache and memchached together .. i dont know whether this allowed or not ?</p> <p>suggestions invited ? ?</p>
511,899
0
<p>Check to see how fragmented your indexes are. At my company we have a nightly import process that trashes our indexes and over time it can have a profound impact on data access speeds. For example we had a SQL procedure that took 2 hours to run one day after de-fragmenting the indexes it took 3 minutes. we use SQL Server 2005 ill look for a script that can check this on MySQL. </p> <p>Update: Check out this link: <a href="http://dev.mysql.com/doc/refman/5.0/en/innodb-file-defragmenting.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.0/en/innodb-file-defragmenting.html</a></p>
35,260,469
0
How to validate a string is in YYYY-MM-DD form (C#) <p>Most of the ways I have seen on SO have involved validating a C# date object which is not what I want to do. For what I'm working on, the user will enter a string in a format for example, 1999-02-23. I would like to validate that the string they enter follows the format of YYYY-MM-DD. The solutions I have come up with seem overly complex. </p>
31,400,798
0
<p>I think your</p> <pre><code>"...VALUES('sheetname" + dt.Rows[0][j].ToString() + "' ) </code></pre> <p>should be</p> <pre><code>"...VALUES('sheetname', '" + dt.Rows[0][j].ToString() + "' ) </code></pre> <p>since you try to insert two values but you didn't seperate them with a comma.</p> <p>But as a better way, use <a href="http://blog.codinghorror.com/give-me-parameterized-sql-or-give-me-death/" rel="nofollow">parameterized queries</a>. This kind of string concatenations are open for <a href="http://en.wikipedia.org/wiki/SQL_injection" rel="nofollow">SQL Injection</a> attacks.</p> <pre><code>var command = new SqlCommand(@"INSERT INTO [Obj CA] (sheetname, [Rayon]) VALUES('sheetname', @rayon"), con); for (int i = 2; i &lt; dt.Rows.Count; i++) { for (int j = 1; j &lt; dt.Columns.Count; j += 3) { command.Parameters.Clear(); command.Parameters.AddWithValue("@rayon", dt.Rows[0][j].ToString()); command.ExecuteNonQuery(); } } </code></pre> <p>By the way, since I didn't know your column types, I used <code>AddWithValue</code> as an example but you don't. <a href="http://blogs.msmvps.com/jcoehoorn/blog/2014/05/12/can-we-stop-using-addwithvalue-already/" rel="nofollow">This method <em>may</em> generate unexpected results sometimes</a>. Use <code>Add</code> overload to specify your parameter type and it's size.</p> <p>Also I strongly suspect you should change your column definition order as well like <code>(sheetname, [Rayon])</code> in your <code>INSERT</code> statement.</p>
21,162,767
0
<p>How about this using LINQ inline:</p> <pre class="lang-cs prettyprint-override"><code>var results = (from kvp in dict from v in kvp.Value select new KeyValuePair&lt;AddressType, ContractType&gt;(kvp.Key, v)) .ToList(); </code></pre> <p>Don't know about the lambda syntax, though.</p>
10,030,375
0
<p>If the date_promised field is of a DATETIME type you can use -</p> <pre><code>SELECT date_promised, DATE_FORMAT(date_promised, '%m/%d/%Y') AS date_promised2 FROM erp_workorder AS t1 WHERE id_primary = 73135; </code></pre> <p>If the date_promised field contains a unix timestamp you can use -</p> <pre><code>SELECT date_promised, DATE_FORMAT(FROM_UNIXTIME(date_promised), '%m/%d/%Y') AS date_promised2 FROM erp_workorder AS t1 WHERE id_primary = 73135; </code></pre>
21,814,004
0
<p>If you want to send an SMS, in about 5 lines of code, you should look into Twilio. Incredibly easy to get started, only pay for what you use, nicely document rest api and best of all its is a proven/mature technology.</p> <p><a href="https://www.twilio.com/sms" rel="nofollow">https://www.twilio.com/sms</a></p>
12,744,730
0
<p>The "semi-convoluted" solution using <code>std::bind</code> as mentioned by Nicol Bolas is not so bad after all:</p> <pre><code>std::function&lt;void ()&gt; getAction(std::unique_ptr&lt;MyClass&gt;&amp;&amp; psomething) { return std::bind([] (std::unique_ptr&lt;MyClass&gt;&amp; p) { p-&gt;do_some_thing(); }, std::move(psomething)); } </code></pre>
39,621,578
1
Match multiple times a group in a string <p>i'am trying to use regular expression. I have this string that has to be matched</p> <pre><code> influences = {{hlist |[[Plato]] |[[Aristotle]] |[[Socrates]] |[[David Hume]] |[[Adam Smith]] |[[Cicero]] |[[John Locke]]}} {{hlist |[[Saint Augustine]] |[[Saint Thomas Aquinas]] |[[Saint Thomas More]] |[[Richard Hooker]] |[[Edward Coke]]}} {{hlist |[[Thomas Hobbes]] |[[Rene Descartes]] |[[Montesquieu]] |[[Joshua Reynolds]] |[[Sir William Blackstone|William Blackstone]]}} {{hlist |[[Niccolo Machiavelli]] |[[Dante Alighieri]] |[[Samuel Johnson]] |[[Voltaire]] |[[Jean Jacques Rousseau]] |[[Jeremy Bentham]]}} </code></pre> <p>I would like to extract from the text the following templates: </p> <pre><code>{{hlist .... }} </code></pre> <p>Instead, the following text has not to be matched:</p> <pre><code>main_interests = {{hlist |[[Music]] |[[Art]] |[[Theatre]] |[[Literature]]}} </code></pre> <p>I wrote this regex but it doesn't work</p> <pre><code>(?:^\|\s*)?(?:influences)\s*?=\s*?(?:(?:\s*\{\{hlist)\s*\|([\d\w\s\-()*—&amp;;\[\]|#%.&lt;&gt;·:/",\'!{}=•?’ á~ü°œéö$àèìòùÀÈÌÒÙáéíóúýÁÉÍÓÚÝâêîôûÂÊÎÔÛãñõÃÑÕäëïöüÿÄËÏÖÜŸçÇߨøÅ寿œ]*?)(?=\n))+ </code></pre> <p>I'm using python.</p>
6,984,033
0
Trying to print multiple result set .But list returns only object <p>This my query which i am trying get result from multiple table.</p> <pre><code> SQLQuery query = session.createSQLQuery("select t.id as ID, t.companyname as COMPANYNAME, e.fullname as FULLNAME, e.empid as EMPID, ca.dateallocated as DATEALLOCATED from bw_tempclientdetails t, bw_employee_details e, bw_clientallocation ca where e.empid=ca.empid and ca.companyname=t.companyname "); </code></pre> <p>But query.list returns only object in which i am unable to convert to string representation. Any solution?</p>
16,799,340
0
<p>You have your <code>Flag</code> set on <code>notificationIntent</code> instead of <code>Intent</code> for <code>ActivityB</code>. Change this</p> <pre><code> Intent i = new Intent(getActivity(), B.class); getActivity().startActivity(i); </code></pre> <p>to</p> <pre><code> Intent i = new Intent(getActivity(), B.class); i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) getActivity().startActivity(i); </code></pre> <p><a href="http://www.youtube.com/watch?v=XwGHJJYBs0Q" rel="nofollow">Google I/O Navigation</a> this link is very helpful in understanding how the stack works</p>
15,241,421
0
<p>If you getting <code>???myBean.myMsg</code> that means that it could not find <em>myBean.myMsg</em> string in your resource file...</p> <p>I guess you want to use the key inside the myBean.myMsg (and not the string <em>myBean.myMsg</em>)?</p> <p>In that case just remove the <code>''</code> that surrounds it</p> <pre><code>&lt;h:outputText value="#{resourceBundle[myBean.myMsg]}" /&gt; </code></pre> <p>Otherwise it will be used as a string and not as EL expression</p>
8,265,703
0
<p><a href="http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html" rel="nofollow">Cellperformance</a> states that strict aliasing is:</p> <blockquote> <p>[...] an assumption, made by the C (or C++) compiler, that dereferencing pointers to objects of different types will never refer to the same memory location (i.e. alias eachother.)</p> </blockquote> <p>This warning occurs when <code>-fno-strict-aliasing</code> and optimizations (<code>-O2</code> or higher) are enabled because the compiler needs to be much more conservative when its accessing (possibly) aliased memory. This leads to less optimizations - the compiler can't e.g. really be sure that elements doesn't overlap (see example in article posted above).</p> <p>This is not a warning you should worry about - the Boost developers are probably aware of this and have good reasons to why this is ok.</p>
11,954,305
0
Function to determine if two tables are related <p>Suppose I have 5 table schemas in memory as DataTables and one other DataTable that is a schema of the referential constraints between the other 5 tables.</p> <p>The 5 schema tables are related such that Table A contains a primary key column related to a foreign key in B. B also contains a primary key column related to a foreign key column in C, and C to D, but suppose A,B,C, and D are not directly or indirectly related to E.</p> <p>What sort of function would take in two datatables and return a boolean value indicating whether those tables were related or 'linked'.</p> <p><strong>What I'm Trying To Accomplish</strong></p> <p>Suppose I present a user with all of the columns in the 5 tables in a drag and drop style interface. I want the user to be able to build a query a graphically, but I will need to enable/disable certain columns based on whether or not they can even be returned in the same select statement.</p>
19,941,541
0
Local Gem Path For Development And Remote Git Repo For Production <p>I have a gem I'm working on locally which is used by a project.</p> <p>If I specify the gem's location using <code>path</code> in the , I can make a change and the project picks up the fresh code:</p> <pre><code>gem 'example', :path =&gt; "~/path/to/gems/example" </code></pre> <p>However, when I push to Heroku, bundling fails because Heroku can't access the gem source on my local machine.</p> <p>So I can push the gem source to a remote repo and point the gem source there:</p> <pre><code>gem 'example', :github =&gt; 'example/example', :branch =&gt; 'example_feature' </code></pre> <p>However I now need to push changes to this repo, then update the gem to get the fresh changes in my project:</p> <pre><code>$ cd ~/path/to/gems/example $ git c -a -m "Update gem" $ git push origin example_feature $ cd ~/path/to/projects/project $ gem update example </code></pre> <p>I can make this slightly less painful by setting a local override to my local repo:</p> <pre><code>$ bundle config local.example ~/path/to/gems/example </code></pre> <p>But I still need to add changed files to git, commit, then <code>$ gem update example</code> every time I change the gem source if I want fresh changes in my project.</p> <p><strong>Is there any way to have my project pick up local changes automatically (as it does when I use <code>path</code>), but still use the remote repo in production?</strong></p>
35,289,597
0
Excel 2010 Cell Validation - Grouped List <p>Is it possible (without the use of user forms, or form controls) to have a grouped validation list in-cell, where the group title cannot be selected. So for example:</p> <p><strong>Fruit</strong><br> Apple<br> Banana<br> <strong>Veg</strong><br> Potato<br> Carrot</p> <p>I feel like I've been searching for an absolute age now, and I'm getting no where fast. The reason I cannot use form controls as that there are 8 sheets, each with a few thousand rows (possible) and each entry must have this selection. I have done this before with dependant lists across multiple columns but I'd like to trim everything down.</p> <p>Any ideas? I don't want a clear cut solution if one exists, just a nudge in the right direction. Any help appreciated.</p>
24,727,029
0
X Code Objective-C: 2 duplicate symbols error <p>Hey I'm fairly new to Objective C. I ran into this error when adding some new buttons to my iPhone app I have been working on. Not exactly sure where the duplicates are present. If anyone could point me in the right direction that would be great thanks!</p> <p><strong>Error:</strong> </p> <blockquote> <p>duplicate symbol _OBJC_CLASS_$_Weights in: /Users/mflood7356/Library/Developer/Xcode/DerivedData/1RMCalculator-bciansmbawnkrwasgwtkbkdpvswt/Build/Intermediates/1RMCalculator.build/Debug-iphonesimulator/1RMCalculator.build/Objects-normal/x86_64/ViewController.o /Users/mflood7356/Library/Developer/Xcode/DerivedData/1RMCalculator-bciansmbawnkrwasgwtkbkdpvswt/Build/Intermediates/1RMCalculator.build/Debug-iphonesimulator/1RMCalculator.build/Objects-normal/x86_64/Weights.o duplicate symbol _OBJC_METACLASS_$_Weights in: /Users/mflood7356/Library/Developer/Xcode/DerivedData/1RMCalculator-bciansmbawnkrwasgwtkbkdpvswt/Build/Intermediates/1RMCalculator.build/Debug-iphonesimulator/1RMCalculator.build/Objects-normal/x86_64/ViewController.o /Users/mflood7356/Library/Developer/Xcode/DerivedData/1RMCalculator-bciansmbawnkrwasgwtkbkdpvswt/Build/Intermediates/1RMCalculator.build/Debug-iphonesimulator/1RMCalculator.build/Objects-normal/x86_64/Weights.o ld: 2 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)</p> </blockquote> <p><strong>Weights.m</strong></p> <pre><code>#import "Weights.h" @implementation Weights static Weights *instance = nil; +(Weights *)getInstance{ @synchronized(self){ if(instance==nil){ instance= [Weights new]; } } return instance; } static int totalWeight = 0; static int fortyFives = 0; static int thirtyFives = 0; static int twentyFives = 0; static int tens = 0; static int fives = 0; static int twoPointFives = 0; + (int)getTotalWeight { return totalWeight; } + (void)setTotalWeight:(int)newWeight { totalWeight = newWeight; [self computePlates]; } + (int)getFortyFives { return fortyFives; } + (void)setFortyFives:(int)newCount { fortyFives = newCount; } + (int)getThirtyFives { return thirtyFives; } + (void)setThirtyFives:(int)newCount { thirtyFives = newCount; } + (int)getTwentyFives { return twentyFives; } + (void)setTwentyFives:(int)newCount { twentyFives = newCount; } + (int)getTens { return tens; } + (void)setTens:(int)newCount { tens = newCount; } + (int)getFives { return fives; } + (void)setFives:(int)newCount { fives = newCount; } + (int)getTwoPointFives { return twoPointFives; } + (void)setTwoPointFives:(int)newCount { twoPointFives = newCount; } + (void)computePlates{ if(totalWeight &gt;= 45){ if(totalWeight == 45){ [self setFortyFives: 0]; [self setThirtyFives: 0]; [self setTwentyFives: 0]; [self setTens: 0]; [self setFives: 0]; [self setTwoPointFives: 0]; } else{ int workingWeight = totalWeight - 45; // Do 45s if(workingWeight &gt;= 90){ int plateCounter = 0; while(workingWeight &gt;= 90){ workingWeight = workingWeight - 90; plateCounter = plateCounter + 2; } NSLog(@"Number of 45s: %d", plateCounter); [self setFortyFives:plateCounter]; } else{ NSLog(@"Number of 45s: 0"); [self setFortyFives: 0]; } // Do 35s if(workingWeight &gt;= 70){ int plateCounter = 0; while(workingWeight &gt;= 70){ workingWeight = workingWeight - 70; plateCounter = plateCounter + 2; } NSLog(@"Number of 35s: %d", plateCounter); [self setThirtyFives:plateCounter]; } else{ NSLog(@"Number of 35s: 0"); [self setThirtyFives: 0]; } // Do 25s if(workingWeight &gt;= 50){ int plateCounter = 0; while(workingWeight &gt;= 50){ workingWeight = workingWeight - 50; plateCounter = plateCounter + 2; } NSLog(@"Number of 25s: %d", plateCounter); [self setTwentyFives:plateCounter]; } else{ NSLog(@"Number of 25s: 0"); [self setTwentyFives: 0]; } // Do 10s if(workingWeight &gt;= 20){ int plateCounter = 0; while(workingWeight &gt;= 20){ workingWeight = workingWeight - 20; plateCounter = plateCounter + 2; } NSLog(@"Number of 10s: %d", plateCounter); [self setTens:plateCounter]; } else{ NSLog(@"Number of 10s: 0"); [self setTens: 0]; } // Do 5s if(workingWeight &gt;= 10){ int plateCounter = 0; while(workingWeight &gt;= 10){ workingWeight = workingWeight - 10; plateCounter = plateCounter + 2; } NSLog(@"Number of 5s: %d", plateCounter); [self setFives:plateCounter]; } else{ NSLog(@"Number of 5s: 0"); [self setFives: 0]; } // Do 2.5s if(workingWeight &gt;= 5){ int plateCounter = 0; while(workingWeight &gt;= 5){ workingWeight = workingWeight - 5; plateCounter = plateCounter + 2; } NSLog(@"Number of 2.5s: %d", plateCounter); [self setTwoPointFives:plateCounter]; } else{ NSLog(@"Number of 2.5s: 0"); [self setTwoPointFives: 0]; } if(workingWeight &lt; 5 &amp;&amp; workingWeight != 0){ // Print something about not being exact? NSLog(@"Remaining Working Weight: %d", workingWeight); } } } else{ [self setFortyFives: 0]; [self setThirtyFives: 0]; [self setTwentyFives: 0]; [self setTens: 0]; [self setFives: 0]; [self setTwoPointFives: 0]; } } @end </code></pre> <p><strong>ViewController.m</strong></p> <pre><code>#import "ViewController.h" #import "Weights.h" #import "Weights.m" @interface ViewController () // Objects represent the text fields @property (strong, nonatomic) IBOutlet UITextField *weightField; @property (strong, nonatomic) IBOutlet UITextField *repsField; // Objectsrepresent the percentage buttons below the fields @property (strong, nonatomic) IBOutlet id nintyFiveResult; @property (strong, nonatomic) IBOutlet id nintyResult; @property (strong, nonatomic) IBOutlet id eightyFiveResult; @property (strong, nonatomic) IBOutlet id eightyResult; @property (strong, nonatomic) IBOutlet id seventyFiveResult; @property (strong, nonatomic) IBOutlet id seventyResult; @property (strong, nonatomic) IBOutlet id sixtyFiveResult; @property (strong, nonatomic) IBOutlet id sixtyResult; // Weight object used to perform the on bar calculation @property (strong, nonatomic) Weights *weightObj; // Labels represent the values on the second view @property (strong, nonatomic) IBOutlet UILabel *resultTitle; @property (strong, nonatomic) IBOutlet UILabel *fortyFivePlateLabel; @property (strong, nonatomic) IBOutlet UILabel *thirtyFivePlateLabel; @property (strong, nonatomic) IBOutlet UILabel *twentyFivePlateLabel; @property (strong, nonatomic) IBOutlet UILabel *tenPlateLabel; @property (strong, nonatomic) IBOutlet UILabel *fivePlateLabel; @property (strong, nonatomic) IBOutlet UILabel *twoFivePlateLabel; @end @implementation ViewController - (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.weightField.delegate = self; self.repsField.delegate = self; self.weightObj = [Weights getInstance]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return NO; } /* weightModified: This method is called when the weight field is modified. If the reps or weight value entered is equal to zero all of the percentage results will be changed to zero. If valid values are passed in both fields the percentages of weight will be calculated. */ - (IBAction)weightModified:(UITextField *)sender { NSLog(@"Weight Input Value: %@", sender.text); NSLog(@"Reps Input Value: %@", self.repsField.text); if([sender.text isEqualToString:@""] == false &amp;&amp; [self.repsField.text isEqualToString:@""] == false){ NSLog(@"Weight Modified in if statement."); // Gather reps and weight value int reps = 0; int weight = 0; weight = [sender.text intValue]; reps = [self.repsField.text intValue]; NSLog(@"Weight: %d", weight); NSLog(@"Reps: %d", reps); int nintyFiveInt = [self oneRepMax :0.95 :reps :weight]; int nintyInt = [self oneRepMax :0.9 :reps :weight]; int eightyFiveInt = [self oneRepMax :0.85 :reps :weight]; int eightyInt = [self oneRepMax :0.8 :reps :weight]; int seventyFiveInt = [self oneRepMax :0.75 :reps :weight]; int seventyInt = [self oneRepMax :0.7 :reps :weight]; int sixtyFiveInt = [self oneRepMax :0.65 :reps :weight]; int sixtyInt = [self oneRepMax :0.6 :reps :weight]; NSString *nintyFiveWeight = [NSString stringWithFormat:@"95%%: %d lbs", nintyFiveInt]; NSString *nintyWeight = [NSString stringWithFormat:@"95%%: %d lbs", nintyInt]; NSString *eightyFiveWeight = [NSString stringWithFormat:@"95%%: %d lbs", eightyFiveInt]; NSString *eightyWeight = [NSString stringWithFormat:@"95%%: %d lbs", eightyInt]; NSString *seventyFiveWeight = [NSString stringWithFormat:@"95%%: %d lbs", seventyFiveInt]; NSString *seventyWeight = [NSString stringWithFormat:@"95%%: %d lbs", seventyInt]; NSString *sixtyFiveWeight = [NSString stringWithFormat:@"95%%: %d lbs", sixtyFiveInt]; NSString *sixtyWeight = [NSString stringWithFormat:@"95%%: %d lbs", sixtyInt]; [self.nintyFiveResult setTitle:nintyFiveWeight forState:UIControlStateNormal]; [self.nintyResult setTitle:nintyWeight forState:UIControlStateNormal]; [self.eightyFiveResult setTitle:eightyFiveWeight forState:UIControlStateNormal]; [self.eightyResult setTitle:eightyWeight forState:UIControlStateNormal]; [self.seventyFiveResult setTitle:seventyFiveWeight forState:UIControlStateNormal]; [self.seventyResult setTitle:seventyWeight forState:UIControlStateNormal]; [self.sixtyFiveResult setTitle:sixtyFiveWeight forState:UIControlStateNormal]; [self.sixtyResult setTitle:sixtyWeight forState:UIControlStateNormal]; } else{ [self.nintyFiveResult setTitle:@"95%%: 0 lbs" forState:UIControlStateNormal]; [self.nintyResult setTitle:@"90%%: 0 lbs" forState:UIControlStateNormal]; [self.eightyFiveResult setTitle:@"85%%: 0 lbs" forState:UIControlStateNormal]; [self.eightyResult setTitle:@"80%%: 0 lbs" forState:UIControlStateNormal]; [self.seventyFiveResult setTitle:@"75%%: 0 lbs" forState:UIControlStateNormal]; [self.seventyResult setTitle:@"70%%: 0 lbs" forState:UIControlStateNormal]; [self.sixtyFiveResult setTitle:@"65%%: 0 lbs" forState:UIControlStateNormal]; [self.sixtyResult setTitle:@"60%%: 0 lbs" forState:UIControlStateNormal]; } } /* repsModified: This method is called when the weight field is modified. If the reps or weight value entered is equal to zero all of the percentage results will be changed to zero. If valid values are passed in both fields the percentages of weight will be calculated. */ - (IBAction)repsModified:(UITextField *)sender { if([sender.text isEqualToString:@""] == false &amp;&amp; [self.repsField.text isEqualToString:@""] == false){ NSLog(@"Reps Modified in if statement."); // Gather reps and weight value int reps = 0; int weight = 0; weight = [self.weightField.text intValue]; reps = [sender.text intValue]; NSLog(@"Weight: %d", weight); NSLog(@"Reps: %d", reps); int nintyFiveInt = [self oneRepMax :0.95 :reps :weight]; int nintyInt = [self oneRepMax :0.9 :reps :weight]; int eightyFiveInt = [self oneRepMax :0.85 :reps :weight]; int eightyInt = [self oneRepMax :0.8 :reps :weight]; int seventyFiveInt = [self oneRepMax :0.75 :reps :weight]; int seventyInt = [self oneRepMax :0.7 :reps :weight]; int sixtyFiveInt = [self oneRepMax :0.65 :reps :weight]; int sixtyInt = [self oneRepMax :0.6 :reps :weight]; NSString *nintyFiveWeight = [NSString stringWithFormat:@"95%%: %d lbs", nintyFiveInt]; NSString *nintyWeight = [NSString stringWithFormat:@"95%%: %d lbs", nintyInt]; NSString *eightyFiveWeight = [NSString stringWithFormat:@"95%%: %d lbs", eightyFiveInt]; NSString *eightyWeight = [NSString stringWithFormat:@"95%%: %d lbs", eightyInt]; NSString *seventyFiveWeight = [NSString stringWithFormat:@"95%%: %d lbs", seventyFiveInt]; NSString *seventyWeight = [NSString stringWithFormat:@"95%%: %d lbs", seventyInt]; NSString *sixtyFiveWeight = [NSString stringWithFormat:@"95%%: %d lbs", sixtyFiveInt]; NSString *sixtyWeight = [NSString stringWithFormat:@"95%%: %d lbs", sixtyInt]; [self.nintyFiveResult setTitle:nintyFiveWeight forState:UIControlStateNormal]; [self.nintyResult setTitle:nintyWeight forState:UIControlStateNormal]; [self.eightyFiveResult setTitle:eightyFiveWeight forState:UIControlStateNormal]; [self.eightyResult setTitle:eightyWeight forState:UIControlStateNormal]; [self.seventyFiveResult setTitle:seventyFiveWeight forState:UIControlStateNormal]; [self.seventyResult setTitle:seventyWeight forState:UIControlStateNormal]; [self.sixtyFiveResult setTitle:sixtyFiveWeight forState:UIControlStateNormal]; [self.sixtyResult setTitle:sixtyWeight forState:UIControlStateNormal]; } else{ [self.nintyFiveResult setTitle:@"95%%: 0 lbs" forState:UIControlStateNormal]; [self.nintyResult setTitle:@"90%%: 0 lbs" forState:UIControlStateNormal]; [self.eightyFiveResult setTitle:@"85%%: 0 lbs" forState:UIControlStateNormal]; [self.eightyResult setTitle:@"80%%: 0 lbs" forState:UIControlStateNormal]; [self.seventyFiveResult setTitle:@"75%%: 0lbs" forState:UIControlStateNormal]; [self.seventyResult setTitle:@"70%%: 0 lbs" forState:UIControlStateNormal]; [self.sixtyFiveResult setTitle:@"65%%: 0 lbs" forState:UIControlStateNormal]; [self.sixtyResult setTitle:@"60%%: 0 lbs" forState:UIControlStateNormal]; } } /* oneRepMax: This method is used to compute the one rep according to the values passed percent: represents the percentages displayed on the screen numReps: represents the number of reps in the reps field weightToLift: represents the number in the wieght field The method returns a float of the weight to be displayed on screen */ - (float)oneRepMax:(float) percent :(int) numReps :(int) weightToLift{ float r = (float) numReps; float w = (float) weightToLift; float div = r/ 30; return percent*w*div*10; } - (void) printResults:(int) percent :(int) weightOnBar :(Weights*) weightObject{ [self.resultTitle setText:[NSString stringWithFormat:@"%d%%: %d", percent, weightOnBar]]; } // Percentage Buttons - (IBAction)clickNintyFive:(id)sender { int weight = [self.weightField.text intValue]; int reps = [self.repsField.text intValue]; int nintyFiveInt = [self oneRepMax :0.95 :reps :weight]; [self printResults: 95: nintyFiveInt: _weightObj]; } - (IBAction)clickNinty:(id)sender { int weight = [self.weightField.text intValue]; int reps = [self.repsField.text intValue]; int nintyFiveInt = [self oneRepMax :0.9 :reps :weight]; [self printResults: 90: nintyFiveInt: _weightObj]; } - (IBAction)clickEightyFive:(id)sender { int weight = [self.weightField.text intValue]; int reps = [self.repsField.text intValue]; int nintyFiveInt = [self oneRepMax :0.85 :reps :weight]; [self printResults: 85: nintyFiveInt: _weightObj]; } - (IBAction)clickEighty:(id)sender { int weight = [self.weightField.text intValue]; int reps = [self.repsField.text intValue]; int nintyFiveInt = [self oneRepMax :0.8 :reps :weight]; [self printResults: 80: nintyFiveInt: _weightObj]; } - (IBAction)clickSeventyFive:(id)sender { int weight = [self.weightField.text intValue]; int reps = [self.repsField.text intValue]; int nintyFiveInt = [self oneRepMax :0.75 :reps :weight]; [self printResults: 75: nintyFiveInt: _weightObj]; } - (IBAction)clickSeventy:(id)sender { int weight = [self.weightField.text intValue]; int reps = [self.repsField.text intValue]; int nintyFiveInt = [self oneRepMax :0.7 :reps :weight]; [self printResults: 70: nintyFiveInt: _weightObj]; } - (IBAction)clickSixtyFive:(id)sender { int weight = [self.weightField.text intValue]; int reps = [self.repsField.text intValue]; int nintyFiveInt = [self oneRepMax :0.65 :reps :weight]; [self printResults: 65: nintyFiveInt: _weightObj]; } - (IBAction)clickSixty:(id)sender { int weight = [self.weightField.text intValue]; int reps = [self.repsField.text intValue]; int nintyFiveInt = [self oneRepMax :0.6 :reps :weight]; [self printResults: 60: nintyFiveInt: _weightObj]; } @end </code></pre>
37,329,114
0
R: Loop for importing multiple xls as df, rename column of one df and then merge all df's <p>The below is driving me a little crazy and I’m sure theres an easy solution.</p> <p>I currently use R to perform some calculations from a bunch of excel files, where the files are monthly observations of financial data. The files all have the exact same column headers. Each file gets imported, gets some calcs done on it and the output is saved to a list. The next file is imported and the process is repeated. I use the following code for this:</p> <pre><code>filelist &lt;- list.files(pattern = "\\.xls") universe_list &lt;- list() count &lt;- 1 for (file in filelist) { df &lt;- read.xlsx(file, 1, startRow=2, header=TRUE) *perform calcs* universe_list[[count]] &lt;- df count &lt;- count + 1 } </code></pre> <p>I now have a problem where some of the new operations I want to perform would involve data from two or more excel files. So for example, I would need to import the Jan-16 and the Jan-15 excel files, perform whatever needs to be done, and then move on to the next set of files (Feb-16 and Feb-15). The files will always be of fixed length apart (like one year etc) </p> <p>I cant seem to figure out the code on how to do this… from a process perspective, Im thinking 1) need to design a loop to import both sets of files at the same time, 2) create two dataframes from the imported data, 3) rename the columns of one of the dataframes (so the columns can be distinguished), 4) merge both dataframes together, and 4) perform the calcs. I cant work out the code for steps 1-4 for this!</p> <p>Many thanks for helping out</p>
29,221,582
0
laravel 4.2 liebig package work on localhost but fail in server cron job command <p>i want to fire some function to get news about football from rss i used laravel4.2 <a href="http://liebig%20package" rel="nofollow">https://github.com/liebig/cron</a> as that </p> <pre><code>Event::listen('cron.collectJobs', function() { Cron::add('football', '* * * * *', function() { //the controller of function $news=new News_feedController(); $news-&gt;football(); return 'success'; }); }); $report = Cron::run(); </code></pre> <p>it work correctly when i use cmd </p> <blockquote> <p>php artisan cron:run</p> </blockquote> <p>in my computer but when use the server cron job command </p> <blockquote> <ul> <li><ul> <li><ul> <li><ul> <li><ul> <li>/usr/bin/php /home/public_html/interestoo.com/artisan cron:run</li> </ul></li> </ul></li> </ul></li> </ul></li> </ul> </blockquote> <p>i don't find any change in </p> <blockquote> <p>cron_job</p> </blockquote> <p>table but find data in </p> <blockquote> <p>cron_manager</p> </blockquote> <p>table and the cron job function did not work i'm sure that the path </p> <blockquote> <p>/home/sfathy/public_html/interestoo.com/</p> </blockquote> <p>in command is true and does not find any reason for that problem any help please.</p>
13,150,137
0
<p>Peter has already answered your question still I would like to recommend not to use old SiteEdit object. You should update the template code as per Tridion UI 2012.</p>
5,740,510
0
<p>With that you can get latitude and longitude of an address. If you request this url and you use the address you want to find the coordinates you get 4 value as a response. You can use this function to get a Location object with lat and log of your address: </p> <pre><code>-(CLLocationCoordinate2D) addressLocation:(NSString *)address { NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&amp;output=csv", [address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]]; NSArray *listItems = [locationString componentsSeparatedByString:@","]; double latitude = 0.0; double longitude = 0.0; if([listItems count] &gt;= 4 &amp;&amp; [[listItems objectAtIndex:0] isEqualToString:@"200"]) { latitude = [[listItems objectAtIndex:2] doubleValue]; longitude = [[listItems objectAtIndex:3] doubleValue]; } else { //Show error } CLLocationCoordinate2D location; location.latitude = latitude; location.longitude = longitude; return location; } </code></pre> <p>You can find more help here: <a href="http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial" rel="nofollow">http://mithin.in/2009/06/22/using-iphone-sdk-mapkit-framework-a-tutorial</a></p>
13,080,783
0
<p>Because array is passed by reference, and other variables are local.</p>
24,427,845
0
Can not find a record by it's _id in mongoDB <p>I want to get a record by its <code>_id</code> like this:</p> <pre><code>db.user.find({_id : ObjectId("53a095aa4568cb1fef93f681")}) </code></pre> <p>As you can see the record exists:</p> <p><img src="https://i.stack.imgur.com/yjl8b.png" alt="mongoDB record by _id"></p> <p>I think my way is correct according to: </p> <ul> <li><a href="http://stackoverflow.com/questions/6867388/why-am-i-unable-to-find-a-record-by-id-in-mongodb">Why am I unable to find a record by _id in mongodb</a> </li> <li><a href="http://stackoverflow.com/questions/8233014/how-do-i-search-for-an-object-by-its-objectid-in-the-console">how do I search for an object by its ObjectId in the console?</a> </li> <li><a href="http://stackoverflow.com/questions/4176692/is-it-ok-to-use-mongos-object-id-as-its-unique-identifier-if-so-how-can-i-c">Is it ok to use Mongo&#39;s &quot;Object ID&quot; as its unique identifier? If so, how can I convert it to a string and look it up by string?</a> </li> </ul> <p>So what's wrong with my code? I'm using RoboMongo.</p>
3,783,507
0
<p>What version of Magento? And I'm assuming you're referring to the layered navigation? </p>
14,610,063
0
Solution for updating a record when you require a particular field Unique <p>I have a table </p> <pre><code>ProjectID ProjectName Project description </code></pre> <p>Project Name is required to be unique. To implement the unique logic, i am sending the name of the project name to Stored Procedure as </p> <pre><code>Create proc CheckName @Project Name as begin select count(ProjectName) where ProjectName=@Project Name </code></pre> <p>it return count to CS page and i check that as if(count>0) { //Add }</p> <p>This code works fine with addition. Now when i want to update the project description field, the check for Project Name again goes and it return Count 1 (which is obvious) and display Project Name already exist and i am not able to update other field of the table.</p> <p>What other Logic can be implemented to maintain the unique field in the table. Thanks for any assistance. </p>
21,558,094
0
Integration of legacy mySQL database into a new Django ORM powered data structure <p>We have a Django project on which we were working for the several past months, and it is basically the new, improved version of an old system that was powered by PHP and mySQL.</p> <p>Now I need to convert all of the old data from the mySQL tables, into the new Django - ORM based data structure. </p> <p>I've already created a new Django project name 'integration', and ran </p> <pre><code>pytohn django-admin.py inspectdb &gt; models.py </code></pre> <p>The result wasn't all that good, because we were using MyISAM DB engine, and there are no clear relations between the models.</p> <p>Also, the models are much different in their design, although the bottom line is the same(same data represented otherwise).</p> <p>The questions are:</p> <ol> <li><p>First of all, can this task theoretically be handled this way, purely by south migrations from here onward.</p></li> <li><p>How can I lose the nasty id(PK=true) column, and the database_name attribute in the Meta class from the output of inspect db without breaking it all.</p></li> <li><p>When preforming major changes to the models(several fields at a time, name, length and type altogether for each one), is there anyway to tell south explicitly which field is which, so the data in the existing columns will be migrated correctly?.</p></li> </ol> <p>Clearly this is my first integration project of this kind of scale, so sorry for all of the ignorant questions.</p> <p>What approach will you recommend?, any tools to help me out?.</p> <p>Is it better to go by Induction(from the bigger, more central object, to the smaller ones) or by deduction(the other way around)?.</p>
20,391,948
0
<p>Fiddler can not read HTTPS pages unless it is configured to decrypt them. Check the checkboxes below on the HTTPS tab in Fiddler's options.</p> <p><img src="https://i.stack.imgur.com/8EuWc.png" alt="Fiddler&#39;s HTTPS tab"></p> <p><a href="http://fiddler2.com/documentation/Configure-Fiddler/Tasks/DecryptHTTPS" rel="nofollow noreferrer">Details</a></p>
40,553,558
0
<p>Try to Pause music on <code>AudioManager.ACTION_AUDIO_BECOMING_NOISY</code> - it it comes before <code>AudioManager.ACTION_HEADSET_PLUG</code> (approx. about 1 sec). Something like:</p> <pre><code>IntentFilter filter = new IntentFilter(); filter.addAction(AudioManager.ACTION_HEADSET_PLUG); filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); registerReceiver(receiverHeadset, filter); </code></pre> <p>...</p> <pre><code>public class MusicIntentReceiver extends android.content.BroadcastReceiver { @Override public void onReceive(Context ctx, Intent intent) { if (intent.getAction().equals(AudioManager.ACTION_AUDIO_BECOMING_NOISY)) { // Pause music } else if (intent.getAction().equals(android.media.AudioManager.ACTION_HEADSET_PLUG)) { if(intent.getIntExtra("state",0)==1){ // 1 for plugged (if it becomes plugged) //Resume music } } } } </code></pre>
24,173,779
0
<p>I think the third sql statement should be:</p> <p>INSERT INTO [project_manager] (project_id, manager_id) SELECT project_id, @ID FROM [projects] WHERE project_name = @Name</p>
1,821,748
0
<p>Probably the simplest way to do that is to find out exactly what imagefile jQuery is using for the icons, and then modify that image file (or create your own) and drop it into place.</p>
15,511,511
0
How to use on the same content box 2 columns of vertical tabs? <p>How can I create a new column which is identical to the first column, and have it display one column to the right?</p> <p>I want the new column to have the same properties as the first column because I want to add more things to this tabs and only on 1 column they are ugly.</p> <p>Here is what I have tried: <a href="http://jsfiddle.net/26zQS/6/" rel="nofollow">http://jsfiddle.net/26zQS/6/</a></p> <pre><code>&lt;div class="verticalslider" id="textExample"&gt; &lt;ul class="verticalslider_tabs"&gt; &lt;li&gt;&lt;a href="#"&gt;Catedra de Limba si Literatura Romana&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Catedra de Matematica&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Catedra de Informatica&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Limba engleza&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Limba Germana&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;ul class="verticalslider_contents"&gt; &lt;li&gt; &lt;h2&gt;Catedra de Limba si Literatura Romana&lt;/h2&gt;&lt;/br&gt; &lt;p id="profesor"&gt; Popa Alina &lt;/br&gt; Nadia Pascu&lt;/br&gt; &lt;/p&gt; &lt;/li&gt; &lt;li&gt; &lt;h2&gt;Catedra de Matematica&lt;/h2&gt;&lt;/br&gt; &lt;p id="profesor"&gt; Ciubotariu Boer-Vlad &lt;/br&gt; Diaconu Ilie&lt;/br&gt; Gorcea Violin &lt;/br&gt; &lt;/p&gt; &lt;/li&gt; &lt;li&gt; &lt;h2&gt;informatica&lt;/h2&gt; &lt;p id="profesor"&gt; Wainblat Gabriela&lt;/br&gt; Nistor Ancuta&lt;/br&gt; &lt;/li&gt; &lt;li&gt; &lt;h2&gt;Limba Engleza&lt;/h2&gt; &lt;p id="profesor"&gt; Wainblat Gabriela&lt;/br&gt; Nistor Ancuta&lt;/br&gt; &lt;/li&gt; &lt;li&gt; &lt;h2&gt;Germana&lt;/h2&gt; &lt;p id="profesor"&gt; Wainblat Gabriela&lt;/br&gt; Nistor Ancuta&lt;/br&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>
40,893,859
0
<p>Something like the following should do what you want I think:</p> <pre><code>ResourceAccessor resourceAccessor = new FileSystemResourceAccessor(); Database db = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(yourJdbcConnection)); Liquibase liquibase = new Liquibase("data/filename", resourceAccessor, db); try (Writer writer = new OutputStreamWriter(System.out)) { liquibase.update((Contexts) null, writer); } </code></pre>
25,629,238
0
<p>I am also using On-Demand VPN in iOS 7 and I am not experiencing this issue </p> <h2>Suggestion 1:</h2> <p>It seems like buggy beta os version update to latest one and try that's enough.</p> <h2>Suggestion 2:</h2> <p>If the VPN server is down it may happen so make sure VPN sure in online and available.</p> <h2>Suggestion 3:</h2> <p>Review your mobile config xml for any bug below is part of my mobile config I use.</p> <pre><code>&lt;key&gt;OnDemandEnabled&lt;/key&gt; &lt;integer&gt;1&lt;/integer&gt; &lt;key&gt;OnDemandMatchDomainsAlways&lt;/key&gt; &lt;array&gt; &lt;string&gt;*&lt;/string&gt; &lt;string&gt;google.com&lt;/string&gt; &lt;/array&gt; &lt;key&gt;OnDemandMatchDomainsNever&lt;/key&gt; &lt;array/&gt; &lt;key&gt;OnDemandMatchDomainsOnRetry&lt;/key&gt; &lt;array/&gt; &lt;key&gt;OnDemandRules&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;Action&lt;/key&gt; &lt;string&gt;Connect&lt;/string&gt; &lt;/dict&gt; &lt;/array&gt; </code></pre> <p>Hope this helps.</p>
1,266,807
0
<p>I've come across this myself before. Adobe's documentation on <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=13_Working_with_XML_01.html" rel="nofollow noreferrer">Traversing XML structures</a> isn't exactly clear on the point.</p> <p>Their documentation states that if there is more than one element with a particular name you have to use array index notation to access it:</p> <pre><code>var testXML:XML = &lt;base&gt; &lt;book&gt;foo&lt;/book&gt; &lt;book&gt;bar&lt;/book&gt; &lt;/base&gt; var firstBook:XML = testXML.book[0]; </code></pre> <p>Then it goes on to say that if there is only one element with a particular name then you can omit the array index notation:</p> <pre><code>var testXML:XML = &lt;base&gt; &lt;book&gt;foo&lt;/book&gt; &lt;/base&gt; var firstBook:XML = testXML.book; </code></pre> <p>This means that when you try and force coercion to an Array type it doesn't work since it sees the single element as an XMLNode and not an XMLList.</p> <p>If you are lucky you can just check the number of children on your <code>&lt;my_claims&gt;</code> node and decide if you want to warp the single element in an <code>ArrayCollection</code> or if you can use the automatic coercion to work for multiple elements. </p>
10,474,653
0
<p>Use a switch-statement.</p> <pre><code>switch($color) { case "blue": // do blue stuff break; case "yellow": // do yellow stuff break; case "red": // do red stuff break; default: // if everything else fails... } </code></pre> <p>In case you want to do the same thing on all colors, just use the <code>||</code> (boolean or) operator.</p> <pre><code>if ($color == "blue" || $color == "red" || $color == "yellow") { // do stuff } </code></pre>
10,992,867
0
<blockquote> <p>The app seems to be correctly allowing users to log into the app and all, but it never posts anything to their feed despite having publish_stream set as a permission.</p> </blockquote> <p>Your app has to <em>actively</em> make a post … see <a href="https://developers.facebook.com/docs/reference/api/user/#feed" rel="nofollow">https://developers.facebook.com/docs/reference/api/user/#feed</a></p> <blockquote> <p>And then when I click "Go to App," it goes without requesting any kind of permission.</p> </blockquote> <p>Once again, you have to actively do that if you want it to happen. Or you could try <a href="https://developers.facebook.com/docs/opengraph/authentication/#referrals" rel="nofollow">authenticated referrals</a>, which will prompt the user to give permissions before entering your app in certain scenarios.</p>
29,581,758
0
<p>There are two reasons nothing happens:</p> <ol> <li>You add 0.5 to an int. An int represents <em>whole numbers</em>. So you basically add 0 at every increment of <code>angleHead</code></li> <li>After calling <code>glTranslatef()</code> you again call <code>glLoadIdentity()</code> which resets your translation in <code>glTranslatef()</code></li> </ol>
14,749,379
1
Multiple raw_input and searching <p>Because <em>programming</em> is one of my favorite hobbies I started a small project in python.</p> <p>I'm trying to make a nutritional calculator for daily routine, see the code below:</p> <pre><code># Name: nutri.py # Author: pyn my_dict = {'chicken':(40, 50, 10), 'pork':(50, 30, 20) } foods = raw_input("Enter your food: ") #explode / split the user input foods_list = foods.split(',') #returns a list separated by comma print foods_list </code></pre> <p>What I want to do: </p> <ol> <li>Get user input and store it in a variable</li> <li>Search the dictionary based on user input and return the asociated values if the keys / foods exists</li> <li>Sum these values in different nutritional chunks and return them, something like: You ate x protein, y carbs and z fat etc.</li> </ol> <p>Any ideas are welcome.</p>
18,878,229
0
<p>Just change to:</p> <pre><code>echo "info" | nc - w 30 IP 3031 </code></pre> <p>Many thanks !</p>
40,490,119
0
<p>I Solved my problem using this codes.</p> <p>PreviousIsNull({@Q3}) or {@Q3} &lt;> Previous({@Q3}) and PreviousIsNull({@E3}) or {@E3} &lt;> Previous({@E3});</p>
27,043,074
0
<p>Seems like the cleanest way in this example is to:</p> <ul> <li>Use a RelativeLayout</li> <li>Position the 2 adjacent views one below the other</li> <li>Align the FAB to the parent right/end and add a right/end margin</li> <li>Align the FAB to the bottom of the header view and add a <em>negative</em> margin, half the size of the FAB including shadow</li> </ul> <p>Example adapted from shamanland implementation, use whatever FAB you wish. Assume FAB is 64dp high including shadow:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"&gt; &lt;View android:id="@+id/header" android:layout_width="match_parent" android:layout_height="120dp" /&gt; &lt;View android:id="@+id/body" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@id/header" /&gt; &lt;fully.qualified.name.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignBottom="@id/header" android:layout_marginBottom="-32dp" android:layout_marginRight="20dp" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p><img src="https://i.stack.imgur.com/orN4Z.png" alt="FAB Layout example"></p>
37,649,592
0
<p>I am mentioning following steps these may be useful for you.</p> <p>Step 1:- If you are not in us and you want to use android pay then you should have a us registered email id (You can make us email id with help of gmail ) then you can download android pay .</p> <p>Step2: You can register you credit card in android pay now a days few credit cards are supported by android pay you can try with Visa, Master Card, American Express cards and other cards which support the android pay.</p> <p>Step 3: Implement following points <a href="https://developers.google.com/android-pay/diagrams" rel="nofollow">https://developers.google.com/android-pay/diagrams</a> . </p> <p>If you have some problem then comment me.</p>
9,370,182
0
<ol> <li>Missing semicolon after the array</li> <li>Not assigning or using the array in anything.</li> <li>Trying putting your array as the second parameter in the form create method.</li> </ol>
36,350,149
0
Apply specific margins to first and last element that are not siblings <p>I have specific type of boxes in my HTML that have, let's say <code>margin: 10px;</code> to all of them. They are displayed in a row on the page (using Bootstrap) and I want to remove the left margin of the first element and the right margin of the last element. I could use <code>:first-child</code> or <code>:first-of-type</code> and their respective <code>lasts</code> but the elements are not siblings and they do not have a common parent. The HTML looks something like this:</p> <pre><code>&lt;div class='container'&gt; &lt;div class='col-md-2'&gt; &lt;div class='MY-CUSTOM-BOX'&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class='col-md-5'&gt; &lt;div class='MY-CUSTOM-BOX'&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class='col-md-5'&gt; &lt;div class='MY-CUSTOM-BOX'&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><code>:first-of-type</code> applies to all boxes, not sure how to approach the <code>:first-child</code> because of the nested <code>divs</code>. Any ideas?</p>
14,068,192
0
Sensible filenaming in Amazon S3 <p>I'm working on a website which is starting to generate a large volume of user-uploaded photos, which are then converted into multi thumbnails of different sizes and stored. So far, these have been stored locally but I would like start storing and serving them via Amazon S3.</p> <p>I've read Amazon's bucket and file naming rules which are clear, but I am wondering if there are other practical best practices for future maintainability.</p> <p>Until now, I've been doing this:</p> <ul> <li>User with GUID 31928 uploads image.jpg at 12-01-15 15:38:44</li> <li>Thumbnail "small" gets stored as /s/28/19/3/31928/120115153844.jpg</li> </ul> <p>... where the the path is derived from the GUID and the image filename from the timestamp. This distributes files without creating massive folders, keeps everything sufficiently unique, and makes it possible for images to be matched against a GUID even manually. It's worked well so far.</p> <p>With S3, I'll probably be serving these images from a single bucket but as the bucket cannot contain sub-folders, I'm curious as to how other people are storing large volumes of images. For example:</p> <ul> <li>hash: 2fkoer983RoerWokfw.jpg</li> <li>guid_hash: 31928_2fkoer983RoerWokfw.jpg</li> <li>guid_size_hash: 31928_s_2fkoer983RoerWokfw.jpg</li> <li>... or something else?</li> </ul> <p>Am I over-thinking this? Any experience would be appreciated, thanks.</p>
38,970,802
0
working with temporary table in cakephp 3 <p>I'm working in CakePHP 3.2</p> <p>I have a table <code>Carts</code> to store products in cart when user is logged in with <code>user_id</code>.</p> <p>I want addToCart accessible to user without login too. But in this case I want to use temporary table to store the cart data and when user is logged in, transfer all data from temporary table to <code>carts</code> table and delete <code>temporary table</code>.</p> <p>How to work with temporary table in CakePHP 3 ? Is it a good practice to use temporary data for the same or is there any better alternative to this ?</p> <blockquote> <p>Edit 2</p> </blockquote> <p>Values to store in cookie/temp table</p> <pre><code>product_id seller_id seller_product_id quantity </code></pre> <p><strong>Associations</strong></p> <p><code>product_id</code> is foreign key to <code>products</code> table <code>seller_id</code> is foreign key to <code>sellers</code> table <code>seller_product_id</code> is foreign key to <code>seller_products</code> table</p> <p>product table is further associated with <code>product_attributes</code></p> <p>Currently using <code>carts</code> table with following columns</p> <pre><code>+-----------+-------------+----------+---------------------+--------+ | user_id | product_id | seller_id | seller_product_id |quantity | +-----------+-------------+----------+---------------------+--------+ </code></pre> <p>and this is what I'm doing to retrieve associated data</p> <pre><code>if (!empty($this-&gt;Auth-&gt;user('id'))) { $user_id = $this-&gt;Auth-&gt;user('id'); $g_cart = $this-&gt;Carts-&gt;find('all', [ 'conditions' =&gt; [ 'user_id' =&gt; $user_id, ], 'contain' =&gt; [ 'Products', 'SellerProducts', 'Sellers', 'CartAttributes' ] ]); $g_count = $g_cart-&gt;count(); if (!empty($g_cart)) { // foreach($g_cart as $g_c){debug($g_c);} foreach($g_cart as $g_c) { $total_cost += $g_c-&gt;quantity * $g_c-&gt;seller_product-&gt;selling_price; } } } </code></pre> <p>Hope I'm clear to you.</p>
35,760,802
0
<p>Quoting from <a href="http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454">RegEx match open tags except XHTML self-contained tags</a> :</p> <blockquote> <p>You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. [...] Regular expressions are a tool that is insufficiently sophisticated to understand the constructs employed by HTML. HTML is not a regular language and hence cannot be parsed by regular expressions. Regex queries are not equipped to break down HTML into its meaningful parts.</p> </blockquote> <p>The conclusion I case was the same as the author:</p> <blockquote> <p>Have you tried using an[sic] XML parser instead?</p> </blockquote> <p>Which is what you can do!</p> <p>Try this:</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var fragment = document.createDocumentFragment(); var elem = document.createElement('div'); fragment.appendChild(elem); elem.innerHTML = '&lt;svg viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg"&gt;&lt;circle cx="60" cy="60" r="50"/&gt;&lt;/svg&gt;'; alert(elem.getElementsByTagName('circle')[0].getAttribute('cx'));</code></pre> </div> </div> </p> <p>It should alert <code>60</code>.</p> <p>Javascript provides all the tools to mess with this. Just pretend that the string is HTML and you should be fine!</p> <hr> <p><strong>Note</strong>: that code is just an example! Addapting it to work properly is easily done in 5 minutes or less.</p>
37,730,379
0
PHP Framework that uses a widget concept <p>I am looking for a php framework based on sort of widget. i.e. every block you see on a page can be broken down into smaller parts called widgets and therefore be reused easily. Does anyone know of such a framework?</p> <p>So each widget would have an associated css file, javascript file, php file and template file.</p>
5,559,322
0
WCF Data Service authentication <p>-Is it possible to secure a WCF Data Service by using certificate-based authentication ?</p> <p>-Is there a resource that describes this process ?</p> <p>-Can we use Message security with a WCF Data service ?</p>
12,118,819
0
<p>My answer would be "Always."</p> <p>It's the emerging standard for categorizing all forms of information on the web. </p> <p>Raven Tools (no affiliation) has a schema.org microdata generator that's a good place to start:</p> <p><a href="http://schema-creator.org/product.php" rel="nofollow">http://schema-creator.org/product.php</a></p> <p>They have a couple stock schema templates on that page (look on the left column).</p>
8,923,312
0
<p>You can get more info of the Geometry String which is used by ImageMagick as in following: <a href="http://www.imagemagick.org/RMagick/doc/imusage.html" rel="nofollow">http://www.imagemagick.org/RMagick/doc/imusage.html</a></p>
39,545,320
0
<p>The issue appeared to be that the api has changed to require a user id not a username hit this api endpoint to get the id</p> <pre><code>http://api.soundcloud.com/users/{username}?client_id={someid} </code></pre> <p>Then use the id in the url instead and it works :D</p>
18,272,129
0
<p>use <a href="http://msdn.microsoft.com/en-us/library/tabh47cf.aspx" rel="nofollow">String.Split()</a></p> <pre><code>string str = "foobar~~some example text~~this is a string"; string[] _result = str.Split("~~", StringSplitOptions.None); </code></pre>
38,720,109
0
<p>Solved!</p> <p>So problem was that I had Drupal migrate module and it was configured to use second database (Drupal 6, from old site) on my VM only. On staging that second DB configurations was also wrong, but for some reason (I guess different PHP settings) it was not shooting that error. On live it was.</p> <p>And what I didn't know is that Drupal migrate module is connecting that second DB even if it's not used directly, i.e. when cache is cleared - have no idea why.</p>
7,199,157
0
Android app installs but doesn't show up in app tray <p>I'm building a time logging application and i have created the main layout. I tried to debug my application on my phone Samsung Galaxy S and it starts fine, but if i close it and want to run it again it's not in my app drawer. It shows up in Settings->Programs->Manage and in Recent when holding down the home button.</p> <p>Here is the manifest.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.doweb.timelog" android:versionCode="1"&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar"&gt; &lt;activity android:name="MainActivity" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN"&gt; &lt;category android:name="android.intent.category.LAUNCHER"&gt; &lt;/category&gt;&lt;/action&gt;&lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;uses-sdk android:minSdkVersion="8"&gt; &lt;/uses-sdk&gt; &lt;/manifest&gt; </code></pre>