pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
16,213,675
0
<p>If you are looking at searching for a string in any of the items in a string array, then you can use <code>array.find(&lt;T&gt;)</code> method. See more here: <a href="http://msdn.microsoft.com/en-IN/library/d9hy2xwa%28v=vs.90%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-IN/library/d9hy2xwa%28v=vs.90%29.aspx</a></p>
26,030,682
0
<p><code>raw_input()</code> takes the input as string. In your <code>if</code> condition you are compering a string with a integer. make your <code>if</code> like this,</p> <pre><code>if float(bN[-1]) == 1: print "The binary number was odd so your number will contain 2 decimals" print "The number is now %.2f" % float(aN) elif float(bN[-1]) == 0: print "The binary number was even so your number will contain 1 decimal" print "The number is now", bN[0:3] </code></pre> <p>If you want to print 2 digits after the decimal point, you can follow this approach.</p>
533,541
0
<p>One use could be dynamic control generation based on information that is only available from the bound data item at the time it is bound the Repeater.</p>
37,448,709
0
ActivityCompat.requestPermission not showing dialog when called inside onMenuItemClick <p>Hi i´m calling ActivityCompat.requestPermission inside my onMenuItemClick to grant the WRITE_EXTERNAL_STORAGE permission . However , ActivityCompat.requestPermissions is not executed .</p> <p>My target is API 23 </p> <p>I have defined in my manifest </p> <pre><code>&lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/&gt; </code></pre> <p>and here is my code which i call inside the onMenuItemClick </p> <pre><code> case R.id.id_captura: if (ContextCompat.checkSelfPermission(ChatActivity.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { dispatchTakePictureIntent(); } else { if (ActivityCompat.shouldShowRequestPermissionRationale(ChatActivity.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) { } else { ActivityCompat.requestPermissions(ChatActivity.this, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, WRITE_EXTERNAL_STORAGE_CTE ); } } break; </code></pre> <p>And here is my onRequestPermissionsResult</p> <pre><code>@Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case WRITE_EXTERNAL_STORAGE_CTE: { if (grantResults.length &gt; 0 &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED) { dispatchTakePictureIntent(); } else { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this).setTitle("Permissions").setMessage("Permissions not granted ").setPositiveButton("Accept", null); alertDialog.show(); } return ; } } } </code></pre> <p>Aditionally I defined </p> <pre><code>private final int WRITE_EXTERNAL_STORAGE_CTE = 1; </code></pre>
28,317,348
0
<p>Given your requirements, this block looks wrong to me:</p> <pre><code>if(array[i] % 2 !=0 &amp;&amp; array[i] % 5 ==0){ odd++; } </code></pre> <p>You're incrementing a counter, but you're not creating a sum of odd numbers. Nor are you printing it. Try this:</p> <pre><code>int total = 0; if ( array[i] % 2 != 0 &amp;&amp; array[i] % 5 != 0) { // it's an odd number total += array[i]; } System.out.println("Total: " + total); </code></pre>
26,003,632
0
RoR - print count after group_by <p>In my Ruby on Rails application, I want to print a count result after I grouped my records in database and I get something like that :</p> <pre><code>{1=&gt;6} </code></pre> <p>In my database there is 6 records, all with the same <code>user_id</code>.</p> <p>Here is my code :</p> <pre><code>Whatever.group(:user_id).count(:user_id) </code></pre> <p>I just want to print <strong>1</strong> how to do this. I tried with <code>distinct</code> and <code>uniq</code> without any success...</p>
5,732,436
0
ISerializable and DataContract <p>Using WCF In Silverlight services, typically we want to use the DataContract and Datamember attributes to opt into what we want to have serialized. This is what we send to and from the client. For most things this has never been a problem.</p> <p>However, I have a few classes I am trying to share with my silverlight app, 'mature' classes, that I would like to send to the client full of data. These classes implement ISerializable which, doesn't like to play nice with the WCF service when I update.</p> <p>I need to leave the ISerializable attribute on there because it is being used else where is some older code. Currently the way I see it is my best option being to have a new class to transfer the data through, if at all possible I would prefer not to have to write a class just for transfering the data but I am thinking that is what I am going to have to do.</p> <p>Any Ideas on what I could do to get this to serialize through a service and still be able to keep the ISerializable tag on there?</p>
18,732,752
0
LLDB: How to inspect unordered_map <p>Most other STL containers print fine, but <code>unordered_map</code> is a mess. </p> <p>I use <code>operator &lt;&lt;</code> for prints, but this isn't about printing, this is about when I am crashed and I want to print out my hash from the LLDB prompt.</p> <p>I cannot call something like <code>call cout &lt;&lt; var</code> because that does not work. </p> <p>Is there no solution other than e.g. linking a template function that itself uses <code>cout &lt;&lt;</code>? Would that even work? (I am trying, but it does not work because I have to know ahead of time what the template parameter types will be for it to generate and link the code for them)</p>
15,411,666
0
<p>Use <a href="http://support.microsoft.com/kb/268343" rel="nofollow">umdh.exe</a></p> <blockquote> <p>The user-mode dump heap (UMDH) utility works with the operating system to analyze Windows heap allocations for a specific process.</p> </blockquote>
12,766,011
0
A Better Way To Make My Parallel.ForEach Thread Safe? <p>I would like to make the following code thread-safe. Unfortunately, I have tried locking at various levels within this code with no success. The only instance I can seem to achieve thread-safety is to place a lock around the entire loop which effectively makes the Parallel.ForEach no faster (possibly even slower) than just using foreach. The code is relatively/almost safe with no locking. It only seems to show slight variations in the summation of the geneTokens.Value[-1] keys and gtCandidates.Value[-1] keys about once out of every 20 or so executions. </p> <p>I realize that Dictionary is not thread-safe. However, I cannot change this particular object to a ConcurrentDictionary without taking a major performance hit downstream. I would rather run this part of the code with a regular foreach than change that particular object. However, I am using ConcurrentDictionary to hold the individual Dictionary objects. I have also tried making this change, and it does not solve my race issue.</p> <p><strong>Here are my Class level variables:</strong> </p> <pre><code>//Holds all tokens derived from each sequence chunk public static ConcurrentBag&lt;sequenceItem&gt; tokenBag = new ConcurrentBag&lt;sequenceItem&gt;(); public BlockingCollection&lt;sequenceItem&gt; sequenceTokens = new BlockingCollection&lt;sequenceItem&gt;(tokenBag); public ConcurrentDictionary&lt;string, int&gt; categories = new ConcurrentDictionary&lt;string, int&gt;(); public ConcurrentDictionary&lt;int, Dictionary&lt;int, int&gt;&gt; gtStartingFrequencies = new ConcurrentDictionary&lt;int, Dictionary&lt;int, int&gt;&gt;(); public ConcurrentDictionary&lt;string, Dictionary&lt;int, int&gt;&gt; gtCandidates = new ConcurrentDictionary&lt;string, Dictionary&lt;int, int&gt;&gt;(); public ConcurrentDictionary&lt;string, Dictionary&lt;int, int&gt;&gt; geneTokens = new ConcurrentDictionary&lt;string, Dictionary&lt;int, int&gt;&gt;(); </code></pre> <p><strong>Here is the Parallel.ForEach:</strong></p> <pre><code>Parallel.ForEach(sequenceTokens.GetConsumingEnumerable(), seqToken =&gt; { lock (locker) { //Check to see if the Sequence Token is a Gene Token Dictionary&lt;int, int&gt; geneTokenFreqs; if (geneTokens.TryGetValue(seqToken.text, out geneTokenFreqs)) { //The Sequence Token is a Gene Token *****************Race Issue Seems To Occur Here**************************** //Increment or create category frequencies for each category provided int frequency; foreach (int category in seqToken.categories) { if (geneTokenFreqs.TryGetValue(category, out frequency)) { //increment the category frequency, if it already exists frequency++; geneTokenFreqs[category] = frequency; } else { //Create the category frequency, if it does not exist geneTokenFreqs.Add(category, 1); } } //Update the frequencies total [-1] by the total # of categories incremented. geneTokenFreqs[-1] += seqToken.categories.Length; ****************************************************************************** } else { //The Sequence Token is NOT yet a Gene Token //Check to see if the Sequence Token is a Gene Token Candidate yet Dictionary&lt;int, int&gt; candidateTokenFreqs; if (gtCandidates.TryGetValue(seqToken.text, out candidateTokenFreqs)) { *****************Race Issue Seems To Occur Here**************************** //Increment or create category frequencies for each category provided int frequency; foreach (int category in seqToken.categories) { if (candidateTokenFreqs.TryGetValue(category, out frequency)) { //increment the category frequency, if it already exists frequency++; candidateTokenFreqs[category] = frequency; } else { //Create the category frequency, if it does not exist candidateTokenFreqs.Add(category, 1); } } //Update the frequencies total [-1] by the total # of categories incremented. candidateTokenFreqs[-1] += seqToken.categories.Length; ***************************************************************************** //Only update the candidate sequence count once per sequence if (candidateTokenFreqs[-3] != seqToken.sequenceId) { candidateTokenFreqs[-3] = seqToken.sequenceId; candidateTokenFreqs[-2]++; //Promote the Token Candidate to a Gene Token, if it has been found &gt;= //the user defined candidateThreshold if (candidateTokenFreqs[-2] &gt;= candidateThreshold) { Dictionary&lt;int, int&gt; deletedCandidate; gtCandidates.TryRemove(seqToken.text, out deletedCandidate); geneTokens.TryAdd(seqToken.text, candidateTokenFreqs); } } } else { //create a new token candidate frequencies dictionary by making //a copy of the default dictionary from gtCandidates.TryAdd(seqToken.text, new Dictionary&lt;int, int&gt;(gtStartingFrequencies[seqToken.sequenceId])); } } } }); </code></pre>
12,795,302
0
PHP Check duplicate data and Execute if not <p>I had a trouble with my PHP Msyql Check data. Source will be see below :</p> <pre><code>$cek_saldo=mysql_num_rows(mysql_query ("SELECT badge_id, bulan, jns_saldo FROM t_saldo WHERE badge_id='$badge_id' AND bulan='Januari' AND jns_saldo='Tabungan Wajib'")); if ($cek_saldo &gt; 0) { include ("manage_saldo.php"); echo "&lt;div class='emp'&gt;Saldo already added.&lt;/div&gt;"; } else { Save query data. } </code></pre> <p>I example :<br> jns_saldo is "Tabungan Wajib"<br> Badge ID is 165520<br> Bulan is Januari</p> <p>So if the example data same with in the table, then give the message "Saldo already added.". If not, PHP execute to else statement, that's save the data.</p>
27,712,919
1
SQLAlchemy: order_by(None) for joinedload subclause queries? <p>We are using SQLAlchemy 0.9.8 on Python 2.7.7 and Postgres 9.3.</p> <p>We have a query that uses joinedloads to fully populate some Recipe objects using a single query. The query creates a large SQL statement that takes 20 seconds to execute - too long. Here's the <a href="http://pastebin.com/raw.php?i=ETNDAeAa" rel="nofollow">rendered SQL statement on Pastebin</a>. </p> <p>The rendered SQL has an ORDER BY clause that Postgres explain says is the source of 99% of the time spent on this query. This appears to come from the relationship in the ORM model, which has an order_by clause.</p> <p>However, we don't care about the order the results are returned for this query - we only care about the order when looking at a single object. If I remove the ORDER BY clause at the end of the rendered SQL statement, the query executes in less than a second - perfect.</p> <p>We tried using .order_by(None) on the query, but that seems to have no effect. The ORDER BY seems to be related to the joinedloads, because if change the joinedloads to lazyloads, they go away. But we need the joinedloads for speed.</p> <p>How can I get SQLAlchemy to omit the ORDER BY clauses? </p> <hr> <p>FYI, here's the query:</p> <pre><code>missing_recipes = cls.query(session).filter(Recipe.id.in_(missing_recipe_ids)) if missing_recipe_ids else [] </code></pre> <p>Here's an excerpt from the ORM class:</p> <pre><code>class Recipe(Base, TransactionalIdMixin, TableCacheMixin, TableCreatedModifiedMixin): __tablename__ = 'recipes' authors = relationship('RecipeAuthor', cascade=OrmCommonClass.OwnedChildCascadeOptions, single_parent=True, lazy='joined', order_by='RecipeAuthor.order', backref='recipe') scanned_photos = relationship(ScannedPhoto, backref='recipe', order_by="ScannedPhoto.position") utensils = relationship(CookingUtensil, secondary=lambda: recipe_cooking_utensils_table) utensil_labels = association_proxy('utensils', 'name') </code></pre> <p>Our query() method looks something like this (some more joinedloads omitted):</p> <pre><code>@classmethod def query(cls, session): query = query.options( joinedload(cls.ingredients).joinedload(RecipeIngredient.ingredient), joinedload(cls.instructions), joinedload(cls.scanned_photos), joinedload(cls.tags), joinedload(cls.authors), ) </code></pre>
39,766,084
0
<p>In <a href="https://www.npmjs.com/package/xlsx" rel="nofollow">documentation</a> it says: <em>The raw data is the only thing guaranteed to be saved. Formulae, formatting, and other niceties may not be serialized (pending CSF standardization)</em> under <strong>writing options</strong> section.</p>
33,685,724
0
Is it possible to draw a line chart using birt framework? <p>I would like to create a line chart in my rcp application.is it possible to plot a line chart dynamically using birt.</p>
26,901,643
0
<p>I'm guessing that you are not just using view source, but are instead using the Firefox Developer Tools Browser Inspector? This is done because there has to be an end to each tag so the inspector is explicitly showing this end point.</p>
4,073,352
1
Django + alwaysdata.com Noob Question <p>I'm learning Django and working on sample sites.. I registered at alwaysdata but am unable to view the site after I go 'manage.py runserver' in the SSH (this is after I've created the project and navigated to the appropriate directory, of course).</p> <p>I appreciate any help.</p> <p>Thanks</p>
5,592,167
0
<p>I'd start with this:</p> <pre><code>... List&lt;ISomething&gt; instances = new List&lt;ISomething&gt;({new SomeType1(), new SomeType2(),...}); ... List&lt;ISomething&gt; PopulateItemRows() { itemRows = new HashSet&lt;ISomething&gt;(); foreach(ISomething instance in instances) { itemRows.UnionWith(instance.Collection()); } } </code></pre>
34,886,699
0
<p>I found the solution, for anybody who cares.</p> <p>I changed the command to execute a call to a batch script which then called the print command.</p> <pre><code>var directory = process.env['USERPROFILE'] + '\\Downloads\\'; var command = 'start cmd.exe /C ' + __dirname + '\\print.bat ' + directory + imageName + ' "EPSON TM-C3500"'; exec(command, {}, function(error, stdout, stderr){}); </code></pre> <p>But then the batch script wasn't working... why? I don't know. I do know that adding a TIMEOUT 0 in the batch script fixed it.</p> <pre><code>TIMEOUT 0 rundll32 C:\\Windows\\System32\\shimgvw.dll ImageView_PrintTo /pt %* </code></pre>
9,572,158
0
<p>These are all comments:</p> <pre><code>// // .............. //.............. // ////////////// //////////////// /// /// .............. </code></pre> <p>since the comment extends from the <code>//</code> to the end of the line.</p> <p><strong>Edited to add:</strong> Of course, there are various contexts where neither <code>//</code> nor <code>///</code> introduces a comment. For example:</p> <pre><code>'///' &lt;-- this is a string "///" &lt;-- this is a string (same as previous) /[///]/ &lt;-- this is a regular expression (same as /\//) /* /// */ &lt;-- this is a comment delimited by /*...*/ /\///3 &lt;-- this is /\// divided by 3, i.e., not-a-number </code></pre>
15,433,674
0
how to make a current website responsive? <p>I want to make my current website responsive. It's a huge dynamic website and I do not want to make a separate website for mobile or change the <code>&lt;Doctype&gt;</code> or <code>&lt;html&gt;</code>. Is it possible to insert a script that changes the <code>&lt;Doctype&gt;</code> and <code>&lt;html&gt;</code> tags if a website is accessed via a mobile?</p>
26,920,502
0
<p>Just in case your list contains other types than strings:</p> <pre><code>a=[10,11,12] preamb='My Pre\n' postam='My Pos' Text=preamb for i in a: Text += str(i)+'\n' Text+=postam print Text </code></pre> <p>Result:</p> <pre><code>My Pre 10 11 12 My Pos </code></pre>
951,776
0
<p>You'll find that many open-source projects follow the <a href="http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html" rel="nofollow noreferrer">directory structure used by Maven</a>. In this setup your application source code is kept in src/main/java, application resources, including properties files, in src/main/resources, and other config files in src/main/config. Files related to unit tests use a similar directory structure; src/test/java and src/test/resources.</p> <p>Personally I tend to use this layout because of its widespread use. I also keep an "etc" directory beneath the project root to house files that aren't directly related to the application. For example, I keep configuration files for PMD and Checkstyle in etc.</p>
2,171,520
0
<p>what you need is cscope,which can create database with those files specified by you. You need to tell cscope which files you want to build tags with. This link may help: <a href="http://cscope.sourceforge.net/cscope_vim_tutorial.html" rel="nofollow noreferrer">cscope_vim</a></p> <p>But cscope+vim cannot update tags automatically; you need to update yourself or get it done with some shell script.</p>
4,287,997
0
<p>The most obvious tool would be SQL Profiler. It will monitor every SQL statement, and thus every data change, that gets sent to the server and show you metrics about that statement, the account under which the statement was executed and a host of other pieces of information and it comes free with most SQL Server versions. If you only want to see data changes, you can add filters to only show Insert, Update and Delete statements.</p> <p>If what you are trying to do is compare two databases to see what data is different between them, then I'd recommend something like Red-Gate's Data Compare (no I do not work for them). It is not free but invaluable for this type of column value by column value comparison.</p>
32,289,995
0
<p>You can do this the way mentioned by Pawel or if you really need to use the control object:</p> <pre><code>control: { '[reference=table1]': { click: 'clickButton' }, }, </code></pre>
18,397,314
0
<p>in you delete.php file :</p> <pre><code>if(isset($_GET['id']) &amp;&amp; $_GET['id'] != null &amp;&amp; $_GET['id'] != ""){ require_once 'function.php'; $myFunction = new myFunctionClass(); $myFunction-&gt;DoMyDeleteLogic($_GET['id']); // protect data from get before //or static class MyFunctionClass::DoMyDeleteLogic($_GET['id']); } else{ echo('datas missing...'); //put a throw exception } </code></pre>
17,933,357
0
<p>AFAIK, it is not possible to have Sonar use the Checkstyle definitions from the repository. Is <em>is</em>, however, possible to have Sonar use the current Checkstyle suppression filter from the repository.</p> <p>As for the rules definitions, I think you will have to maintain them in Sonar, and when anything is changed, also change the copy in the repository which is used by eclipse-cs. This is redundant, but at least it affects only one person - the rest of the team can reap the benefits. This approach also enables intentional differences, e.g. when some Eclipse-specific issue is checked (say, something concerning source folders, which don't exist in Sonar).</p> <p>The path to the suppressions filter file can be <a href="http://stackoverflow.com/q/8623006/1005481">configured in Sonar</a> to refer to the location where your stuff is checked out for Sonar analysis. So that part can be maintained in the repository without any redundancy.</p>
4,114,670
0
<p>another approach</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { List&lt;string&gt; list = new List&lt;string&gt;(); list.Add("Bread"); list.Add("Cheeze"); list.Add("Wine"); list.Add("Beer"); list.Add("Waffles"); GridView1.DataSource = list; GridView1.DataBind(); GridView1.Columns.Add(new BoundField()); } </code></pre>
37,047,991
0
pusher realtime user online status through webhooks <p>I am working on an android app where I have done some realtime applications using pusher. I read about pusher webhooks and I couldn't quite understand the concept when I read it <a href="https://pusher.com/docs/webhooks" rel="nofollow">Here </a>. I want to implement the online status to my contacts and I read about it that it can be done with webhooks <a href="https://support.pusher.com/hc/en-us/articles/204113596-Showing-who-s-online-with-a-large-number-of-users" rel="nofollow">here</a>. Please can anyone explain the concept and usage of webhooks and how can I implement online status using it.</p>
30,426,727
1
How to avoid program freezing when connecting to server <p>I have a little script which filters those domain names which are not registred yet. I use pywhois module. The problem is that it suddenly freeze and do nothing after several (sometimes hundreds) of requests. I think it is not a ban because I can run the program right after freeze and it works.</p> <p>I would like to avoid this freezing. My idea is to count runtime of the function and if the time cross some line (for example 10 seconds) it repeats the code. </p> <p>Do you have any advice how to avoid the freezing? Or the better way to check domains?</p> <p>Here is the code:</p> <pre><code>for keyword in keywords: try: details = pythonwhois.get_whois(keyword+'.com') except Exception as e: print e continue if 'status' not in details.keys(): print 'Free domain!' print keyword </code></pre>
27,635,450
0
<p>The "if" statement should be typed in lowercase. Check your indents also, it might be problem on them.</p>
8,714,302
0
<p>You can pass data by creating a Bundle and adding it to the Intent object, then retrieving the Intent and reading the Bundle data in afterwards. Something like this will create a simple Bundle:</p> <pre><code>Bundle b = new Bundle(); b.putString("address", addressTV.getText().toString()); //can be whatever address string you want intent.putExtras(b); </code></pre>
11,087,496
0
How to pick out/trim part of a string using Shell <p>I am trying to trim this, which is stored in a variable called $line.</p> <pre><code>[2012-06-18 10:37:09,026 (there is a lot of text after this, i just cut it out) </code></pre> <p>I am new to shell scripting and this is the code that i have</p> <pre><code>errortime= $line | cut -c2-10; </code></pre> <p>it is giving me an error, what is the correct code to pull the date out of the variable $line.</p>
9,296,727
0
How to create an archive list in php? <p>I am creating my companies blog and would like to know how to go about creating an archive page where the reader can click on the month/year and display all blog posts for that time period.</p> <p>I see this very often on blogs these days and would like to know how I can myself create it.</p> <p>It will look something like this:</p> <ul> <li>July 2012</li> <li>June 2012</li> <li>March 2012</li> </ul> <p>Obviously I would want the list created dynamically by referencing the time field in my blog table, but where to start?</p> <p>Is there any documentation on how to implement this? </p> <p>I am creating my own blog from scratch.</p>
40,225,978
0
how to connect SQL server db with windows authentication from eclipse db perspective <p>How to connect SQL server db 2008 with windows authentication from eclipse db perspective.</p> <p>I don't have permission to put sqlserver .dll file on java library path or system 32 or even to set path to machine.</p> <p>So I try to do that using some modification on eclipse.ini file. I try to add -Djava.library.path="sql server.dll" on eclipse.ini after -vm line but still it is throwing driver is not configured for Integrated Security.</p>
11,713,855
0
<p>Found the answer:</p> <ol> <li>The repeater had nothing to do with the problem.</li> <li><p>In Default.aspx, I needed to register the control by name rather than by namespace.</p> <pre><code>&lt;%@ Register TagPrefix="a" Namespace="nestedcontroltest" Assembly="nestedcontroltest" %&gt; </code></pre> <p>Needs to be changed to</p> <pre><code>&lt;%@ Register TagPrefix="a" TagName="MyControl" Src="~/MyControl.ascx" %&gt; </code></pre></li> </ol> <p>And then the control gets initialized properly, even when it's in the repeater. Perhaps a bug in ASP.net, or perhaps I needed to use the full assembly name? Regardless, thanks for all your help guys.</p>
18,250,356
0
Building SpiderMonkey with Cygwin <p>I need to build SpiderMonkey so that I can use it with emscripten. I succeeded in building version 1.8 (using the hack from here: <a href="http://pmelson.blogspot.fr/2007/12/building-didier-stevens-spidermonkey-in.html" rel="nofollow">http://pmelson.blogspot.fr/2007/12/building-didier-stevens-spidermonkey-in.html</a>). But unfortunately version 1.8 lacks JSON support and apparently that came into existance with version 1.8.1.</p> <p>Unfortunately I don't see any 1.8.1 tag/branch in CVS and I cannot use version 1.8.5 because the above hack no longer works with that version.</p> <p>Any ideas for getting this to work in Cygwin?</p>
6,913,326
0
How can I make my component to detect the mouse position? <p>I want to write a little component which shows me on which control mouse is currently over. When it spot the choosen control it should fire the messaage (for example).</p> <p>But I don't know what should I do to form to get the position of the mouse all the time. This is what I've got:</p> <pre><code> TMouseOverControl = class(TComponent) private fActive: Boolean; fControl: TWinControl; public constructor Create(AOwner: TComponent); override; procedure Loaded; override; procedure SpotIt; published property Active: Boolean read fActive write fActive; property Control: TWinControl read fControl write fControl; // when mouse is over this control show me the message end; constructor TMouseOverControl.Create(AOwner: TComponent); begin // nothing interesting here // don't have control property here - so overrided the loaded method inherited; end; procedure TMouseOverControl.Loaded; begin inherited; // TForm(Owner).Mo.... := SpotIt.... // what should i do to make it work? end; procedure TMouseOverControl.SpotIt; begin // IsMouseOverControl is easy to implement // http://delphi.about.com/od/delphitips2010/qt/is-some-delphi-tcontrol-under-the-mouse.htm if IsMouseOverControl(Control) then ShowMessage('Yep, U got it!'); end; </code></pre> <p>Any ideas?</p>
13,377,784
0
Can't find the file path which created by myself in android source code <p>I am testing something.</p> <p>I created <strong>assets</strong> folder in packages/apps/Camera/ and added the <strong>test.txt</strong> file in the folder.</p> <p>But when I accessed the file in the <strong>onCreate()</strong> method according the following code fragment, I found I can't get the file.</p> <pre><code> File file = new File("/assets/test.txt"); BufferedReader reader = null; try { Log.v("jerikc","read the file"); reader = new BufferedReader(new FileReader(file)); String tempString = null; int line = 1; while ((tempString = reader.readLine()) != null) { Log.v("jerikc","line " + line + ": " + tempString); line++; } reader.close(); } catch (IOException e) { Log.v("jerikc","exception"); e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e1) { } } } </code></pre> <p>The log were :</p> <p><em>V/jerikc (3454): read the file</em></p> <p><em>V/jerikc (3454): exception</em></p> <p>I think I add the wrong path.("/assets/test.txt") . So what's the right path?</p> <p><strong>Some other informations:</strong></p> <p>Where my real code is a Util Class, there isn't the context. If I add the context, the code structure will have a big change. </p> <p>Thanks.</p>
29,701,202
0
Displaying big numbers in xtable properly <p>I know it might seem as a trivial question but I tried really hard to find solution and it was impossible. Assume I have a data frame like this where one column contatins big numbers:</p> <pre><code>Id Value 1 2158456456456.78 2 123354554.24 3 72323211215.77 </code></pre> <p>I want to put that data frame into latex document using function xtable but I don't want the table to display the numbers like above but in a formatted way like this:</p> <pre><code>Id Value 1 2 158 456 456 456.78 2 123 354 554.24 3 72 323 211 215.77 </code></pre> <p>Any ideas?</p>
24,074,638
0
XML DTD parent object same with child object <p>For an example. inside my xml</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;!DOCTYPE expression SYSTEM "task3-1.dtd"&gt; &lt;expression&gt; &lt;left-bracket&gt;(&lt;/left-bracket&gt; &lt;expression&gt; &lt;left-bracket&gt;(&lt;/left-bracket&gt; &lt;expression&gt; &lt;number&gt;24&lt;/number&gt; &lt;operation&gt;+&lt;/operation&gt; &lt;number&gt;24&lt;/number&gt; &lt;/expression&gt; &lt;right-bracket&gt;)&lt;/right-bracket&gt; &lt;operation&gt;*&lt;/operation&gt; &lt;number&gt;5&lt;/number&gt; &lt;/expression&gt; &lt;right-bracket&gt;)&lt;/right-bracket&gt; &lt;operation&gt;-&lt;/operation&gt; &lt;number&gt;6&lt;/number&gt; &lt;/expression&gt; </code></pre> <p>When i try to run the dtd, it's always error that: The element "expression" has invalid child element 'number'. List of possible elements expected: 'left-bracket'</p> <pre><code>&lt;!ELEMENT expression (left-bracket+,right-bracket,operation,number+)&gt; &lt;!ELEMENT left-bracket (#PCDATA)&gt; &lt;!ELEMENT right-bracket (#PCDATA)&gt; &lt;!ELEMENT operation (#PCDATA)&gt; &lt;!ELEMENT number (#PCDATA)&gt; </code></pre>
9,307,014
0
Assign a value to a variable with DataStore fields value <p>I need to declare a variable TeacherName that will receive its value from the DataStore field 'NameT'</p> <pre><code>var storeTeacher = new Ext.data.JsonStore({ id: 'IDstoreTeacher', url: 'teacher.php', method: 'POST', baseParams:{task: "TEACHERNAME", parametar: idTeacher}, root: 'rows', fields: [{name: 'NameT', type: 'string', mapping: 'teacher_name'}], autoLoad: true }); var TeacherName = NameT; </code></pre> <p>But in Firebug I always get the following error message: "Uncaught ReferenceError: NameT is not defined"</p>
5,791,211
0
How do I extract Rails view helpers into a gem? <p>I have a set of rails view helpers that I use regularly, and would like to package them up into a gem, such that I could just put a line in my Gemfile, and have the helpers accessible from my views.</p> <p>I have created gems before using Bundler, and Jeweler, however, I'm not all all clear on how to organize the Rails view helpers in a gem, and include them into rails.</p> <p>I would appreciate any pointers, or links to up-to-date tutorials on how to do this for Rails 3</p> <p>Thanks</p> <p>Just to clarify: The question isn't on "how to create a gem". Its "how to package view helpers in a gem, so I can use them in Rails"</p> <p>Edit 2: I also agree with the poster below.. A rails engine is waay too much overkill for this kind of (hopefully simple) requirement</p>
19,463,130
0
how to know how many object type="file" there are in a jsp <p>i'm created a form to upload images into a blob field of a mysql database.</p> <p>In a servlet i get the imagine inside a type="file" field in a jsp page.</p> <pre><code> Part filePart = request.getPart("Name_of_the_FILE_fields"); </code></pre> <p>Now i want to allow user to upload more images at the same time, so i put in my jsp page a lot of type="file" field.</p> <p>I thought that i could do something like this </p> <pre><code> Part filePart[] =request.getParameterValues("Name_of_the_FILE_fields"); </code></pre> <p>but of course this is not the right way to do it.</p>
33,647,062
0
<p>I believe that Modelsim has change the default value of the log parameter of the assertions on the new versions.</p> <p>In the previous versions, it seems that the default configuration of the assertions was with the log option enabled, but in the 10.4 all assertions are not logged when testbench is loaded, and when an assertion is triggered it is reported but it is not registered at the assertions panel (View – Coverage -- Assertions)</p> <p>I fix this error invoking the logging function of the assertions:</p> <p>assertion fail -log on -recursive /</p> <p>It seems that invoking this command at the start of the sequence is enough to enable the logging process and it fix the problems with the assertions count command.</p>
14,210,141
0
How to get the saved value form my custom form field type in joomla? <p>I have created my custom form field for a module.However, it work will but when ever i get back to the module i don't know what is the previous value or the saved value, because i didn't make it selected there. </p> <pre><code>&lt;?php // Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access'); jimport('joomla.form.formfield'); class JFormFieldSlidercategory extends JFormField { protected $type = 'Slidercategory'; // getLabel() left out public function getInput() { $db = JFactory::getDBO(); $query = $db-&gt;getQuery(true); $query-&gt;select('id,title'); $query-&gt;from('#__h2mslider_categories'); $db-&gt;setQuery((string)$query); $messages = $db-&gt;loadObjectList(); $options =''; if ($messages) { foreach($messages as $message) { $options .= '&lt;option value="'.$message-&gt;id.'" &gt;'.$message-&gt;title.'&lt;/option&gt;'; } } $options = '&lt;select id="'.$this-&gt;id.'" name="'.$this-&gt;name.'"&gt;'. '&lt;option value="0" &gt;--select a category--&lt;/option&gt;'. $options. '&lt;/select&gt;'; return $options ; } } </code></pre> <p>I need the function that return me the saved value.</p>
6,200,641
0
<p>There doesn't seem to be a specific download that provides these symbols, however Visual Studio Professional and higher (I'm unsure about Express editions) ships with the debug information in the following location:</p> <blockquote> <p>&lt;path to VS install&gt;\VC\lib</p> </blockquote> <p>which on most machines is:</p> <blockquote> <p>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib</p> </blockquote> <p>I would have expected these symbols to have been picked up auto-magically by VS, but I had to manually add them to my symbol path by doing:</p> <blockquote> <ul> <li>Debug->Options and Settings->Symbol</li> <li>Click the folder icon to add a symbol folder </li> <li>Provide the path C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib </li> <li>Check the box next to it to enable it</li> <li>Click 'Load All Symbols'</li> <li>Click 'OK'</li> </ul> </blockquote>
2,468,860
0
<p><strong>Read This:</strong> </p> <blockquote> <p><a href="http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&amp;productId=1&amp;postId=1104" rel="nofollow noreferrer">http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&amp;productId=1&amp;postId=1104</a></p> </blockquote> <pre><code>&lt;script type="text/javascript"&gt; try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {} &lt;/script&gt; </code></pre> <p>OR try CSS way</p> <pre><code>html { filter: expression(document.execCommand("BackgroundImageCache", false, true)); } </code></pre> <p>hope this help!</p>
18,513,710
0
<p>you can use this, is quite good, it contains almost all what you need to know.</p> <p><a href="http://www.cs.rutgers.edu/~decarlo/428/glman.html" rel="nofollow">http://www.cs.rutgers.edu/~decarlo/428/glman.html</a></p>
39,627,458
0
<p>You have several problems with your code. The simple things first:</p> <ul> <li><code>starting_Month</code> and <code>starting_Day</code>. Caps only belong in class names, e.g. <code>class MyClass:</code>.</li> <li><code>datetime</code> has a <code>.date()</code> function that returns just the date.</li> <li><p>string formatting is <em>way</em> nicer than concatenation. Compare:</p> <pre><code>'{}-{}-{}'.format(year, starting_month, starting_day) </code></pre> <p>to what you have.</p></li> <li>You <em>have</em> the answer commented out - <code>print((d1-d2).days * 24 * 60)</code>. Just change that up: <code>print((date1-date2).days)</code></li> <li><p>You could actually just use math here:</p> <pre><code>pills_left = initial_pill_count - (daily_intake * number_of_days) </code></pre></li> </ul> <p>Putting this all together, here's how you should have written this:</p> <pre><code>from datetime import datetime # Just convert to int when you get the input. Also, only one space # before input. leftover_pill_count = int(input('How many pills do you have left? ')) new_pill_count = int(input('How many pills did you get? ')) daily_pill_intake = int(input('How many pills do you take every day? ')) # And one space before input! start_date = input('Starting date (YYYY-MM-DD): ') end_date = input('End date (YYYY-MM-DD): ') # Using the same format multiple places? Use a variable! # that way you only have to change it once :) date_fmt = '%Y-%m-%d' start_date = datetime.strptime(start_date, date_fmt) end_date = datetime.strptime(end_date, date_fmt) # `end-start`, always. Or you could use `abs(start-end)`, # but don't do that. total_days = (end_date-start_date).days initial_pill_count = leftover_pill_count + new_pill_count # Here's how the loop *should* look loop_pills_left = initial_pill_count for i in range(total_days): loop_pills_left -= daily_pill_intake print(loop_pills_left) # Or you could approach it mathematically! math_end_count = initial_pill_count - (daily_pill_intake * total_days) # Let's just make sure that both approaches get us the same answer, though assert math_end_count == loop_pills_left, 'If this fails, we got our math wrong' pills_left = loop_pills_left # String formatting is *much* nicer than concatenation. print('Taking {} pills per day you should have {} pills left.' .format(daily_pill_intake, pills_left)) </code></pre>
38,794,707
0
<p>Use <code>x.fill(1)</code>. Make sure to return it properly as <code>fill</code> doesn't return a new variable, it modifies <code>x</code></p>
6,790,341
0
Including process execution time into shell prompt <p>Is it possible to include the execution time of the just finished process - the output of the 'time' command - into the command prompt? We use zsh on linux and bash (msys) on windows machines so it would be nice to know how to do it in both.</p>
35,956,089
0
<p>I had the same problem. I solved it using Auth:login($array). Change your code to </p> <pre><code>public function postLogin(Request $request) { $this-&gt;validate($request, [ 'email' =&gt; 'required|email', 'password' =&gt; 'required' ]); $data = $request-&gt;input(); if(Auth::login($data)){ return redirect('/dashboard'); } return redirect()-&gt;back()-&gt;with(['fail' =&gt; 'Could not Login']); } </code></pre>
36,091,830
0
Connect all UI Elements to one outlet at once, swift <p>Using Swift 2 and XCode 7.2.1, is there a way to connect all of the UI Elements (buttons and labels) to one outlet? I feel like this would be done by doing CMD-A on all your elements then control-dragging to your code, but this only hooks up one of the selected elements to the outlet.</p>
31,817,022
0
<p>Create a promise for each of the tasks that should execute in series. Then it should be simple chaining of the promises in the required order.</p>
14,699,954
0
<p>It's the expression builder syntax for ASP.NET, have a look at this question for more information <a href="http://stackoverflow.com/questions/7934160/asp-net-syntax">asp.net &lt;%$ ... %&gt; syntax</a></p>
20,259,706
0
<p>You could easily put the lazy load logic within the viewmodel that holds your <code>PImage1</code> property. Your property would need to return an ImageSource. </p> <pre><code>private ImageSource _source; public ImageSource PImage1 { get { if (_source == null) { using (var storage = IsolatedStorageFile.GetUserStoreForApplication()) { if (storage.FileExists("Image.jpg")) { var bitmap = new BitmapImage(); bitmap.SetSource(storage.OpenFile("Image.jpg", FileMode.Open)); _source = bitmap; return _source; } } LoadImage(); } return _source; } set { _source = value; OnPropertyChanged("PImage1"); } } </code></pre> <p>Inside the LoadImage method, you'll make a request to get your image, save it to local storage, and then set the PImage1 property. Make sure to set the property on the UI thread</p> <pre><code>private void LoadImage() { // make a request to get the image. // Use your flavor of choice, WebRequest, HttpClient, WebClient Stream image = GetImageFromMyFavoriteHttp; using (var storage = IsolatedStorageFile.GetUserStoreForApplication()) { using (var file = storage.CreateFile("Image.jpg")) { image.CopyTo(file); } } Deployment.Current.Dispatcher.BeginInvoke(() =&gt; { var bitmap = new BitmapImage(); bitmap.SetSource(image); Image = bitmap; }); } </code></pre>
31,127,333
0
<p>You can copy the original list by slicing it:</p> <pre><code>a = [1, 2, 3] b = a[:] </code></pre> <p>Or using the built in list list() funtion:</p> <pre><code>b = list(a) </code></pre> <p>You could also use list comprehension in place of your nested for loops:</p> <pre><code>b = [[i if i else 1 for i in j] for j in a] </code></pre>
2,522,163
0
<p>Referencing a javascript file from a different domain is no problem. This is not cross site scripting, it's simply a cross site HTTP request. This is used a lot, e.g. by Google's JavaScript API Loader.</p>
23,713,810
0
<p>you need to change this </p> <pre><code> &lt;input type="hidden" name="id" value='&lt;?php $id?&gt;'&gt; </code></pre> <p>to</p> <pre><code> &lt;input type="hidden" name="id" value='&lt;?php echo $id?&gt;'&gt; </code></pre> <p>(or)</p> <pre><code> &lt;input type="hidden" name="id" value='&lt;?=$id?&gt;'&gt; </code></pre>
37,593,518
0
Angular :: Kendo UI Grid :: Pagination style <p>I want to change the pagination style of Kendo Grid. Currnetly it display number in round box. I want to display in Square box. I am using Angular 1.5.5 and Kendo UI for it.</p> <p><a href="http://i.stack.imgur.com/UwxUr.png" rel="nofollow">The Kendo UI Grid having pagination style in round box, I need in Square box</a></p> <p>How to do that?</p>
22,917,984
0
<p>If you dont see the device in the Devices lists:</p> <p>First, you need to make sure USB debugging is enabled on your device. Settings->DeveloperOptions: Turn on debugging and enable USB debugging. Ideally, you will install the USB drivers from google, and it will work fine: <a href="http://developer.android.com/tools/extras/oem-usb.html#InstallingDriver" rel="nofollow">http://developer.android.com/tools/extras/oem-usb.html#InstallingDriver</a>. There are some cases that new installation may mess up the device connection. You may want to try these:</p> <ol> <li>It may lost the connection, so you can try:</li> </ol> <blockquote> <pre><code> adb kill-server adb start-server adb devices </code></pre> </blockquote> <ol> <li><p>Updating to new tools may mess up the settings: Go to Storage Options and try to set as Media(MTP) or Camera(PTP) connection. Swtiching to one of them will help</p></li> <li><p>Revoke authorizations, disable usb debugging and then enable</p></li> </ol>
21,245,070
0
<p>It looks like so long as there is <em>at least one character</em> between the <code>div</code>s in the raw markup, the spacing is correct. This workaround worked for me:</p> <pre><code>div.grid div.column Item 1 . div.column Item 2 . div.column Item 3 . div.column Item 4 . div.column Item 5 </code></pre> <p>Since the <code>font-size</code> of <code>.grid</code> is <code>0</code>, the periods are not visible.</p>
35,903,511
0
AngularJS - Allow a calculated input to be editable <p>I have a basic addition calculator that looks like this:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html ng-app&gt; &lt;head&gt; &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"&gt; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;input type="number" ng-model="input1" /&gt; + &lt;input type="number" ng-model="input2" /&gt; = &lt;input type="number" ng-model="input1 + input2" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Which looks like this:</p> <p>2 + 3 = 5</p> <p>I now have a requirement to make the third input editable and when changed it changes the value in the first input so that the numbers add up. So in the above example, supposing I change 5 to 6 it will look like this:</p> <p>3 + 3 = 6</p> <p>But because the model of the third input is a calculation I can't edit it. Please can someone advise how can I make it so that all three inputs are editable and yet still perform the required calculation?</p>
17,942,533
0
<pre><code>$_SESSION['userName'] = 'oneUser'; $activities = array(); $activityKeys = array('ID','name','spaces','date'); function getActivities() { global $activities,$activityKeys; $activities = array(); $contents = file('activity.txt'); foreach($contents as $line) { $activity = explode(':',$line); $data = array_combine($activityKeys,explode(',',$activity[0])); $users = isset($activity[1]) ? array_filter(explode(',',trim($activity[1]))) : array(); $activities[$data['ID']] = compact('data','users'); } } getActivities(); function userInActivity($activityID) { global $activities; return in_array($_SESSION['userName'],$activities[$activityID]['users']); } function saveActivities() { global $activities; $lines = array(); foreach($activities as $id =&gt; $activity) { $lines[$id] = implode(',',$activity['data']).':'.implode(',',array_filter($activity['users'])); } return file_put_contents('activity.txt',implode("\r\n",$lines)) !== false; } function bookActivity() { global $activities; if(isset($_POST['book'])) { $unbook = false; $bookID = intval($_POST['book']); if($bookID &lt; 0) { //If a negative ID has been submitted, that means we are "unbooking" $unbook = true; $bookID = abs($bookID); //Set the ID back to the normal, positive value } if($unbook) { $users = $activities[$bookID]['users']; $userKey = array_search($_SESSION['userName'],$users); array_splice($activities[$bookID]['users'],$userKey,1); } else { $activities[$bookID]['users'][] = $_SESSION['userName']; } saveActivities(); } } bookActivity(); function activityList($form=true) { global $activities; if($form === true) echo '&lt;form action="" method="post"&gt;'; ?&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;?php $firstKey = @array_shift(array_keys($activities)); foreach(array_keys($activities[$firstKey]['data']) as $index =&gt; $column) { echo '&lt;th&gt;'.$column.'&lt;/th&gt;'; } ?&gt; &lt;th&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;?php foreach($activities as $activity) { echo '&lt;tr&gt;'; $id = $activity['data']['ID']; $activity['data']['spaces'] = $activity['data']['spaces']-count($activity['users']); foreach($activity['data'] as $item) { echo '&lt;td&gt;'.$item.'&lt;/td&gt;'; } $booked = userInActivity($id,$_SESSION['userName']); $buttonText = $booked ? 'Unbook' : 'Book'; $val = $booked ? -$id : $id; echo '&lt;td&gt;&lt;button type="submit" name="book" value="'.$val.'"&gt;'.$buttonText.'&lt;/button&gt;&lt;/td&gt;'; echo '&lt;/tr&gt;'; } ?&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;?php if($form === true) echo '&lt;/form&gt;'; } ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;Activities&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;?php activityList(); ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
3,404,654
0
<p>For this problem you can use the STL's transform method to solve it:</p> <pre><code>std::string str = "simple"; std::transform(str.begin(), str.end(), str.begin(), std::tolower); </code></pre>
11,711,717
0
Xml Parsing to android ListView Using IBM example <p>Im trying to make a Manga Rss-Reader app using the XmlPullParser that was used in <a href="http://www.ibm.com/developerworks/xml/tutorials/x-androidrss/index.html" rel="nofollow">this IBM example</a>. I have taken the IBM source code and only changed the feedURL to "http://fandom.com/rss/new/manga" and the PUB_DATE string in all files has been changed to PUBDATE instead. Still I cant get the app to run correctly.</p> <p>For reference I have renamed the source Otaku as I plan to use it as the base for a new app. It's supposed to show this Rss feed as a ListView but I dont understand where the problem lies. I happen to be logcat illiterate :(. my log cat states:</p> <pre><code>07-29 13:24:17.963: E/Trace(670): error opening trace file: No such file or directory(2) 07-29 13:24:18.113: W/ActivityThread(670): Application com.mypacks.activities.otaku is waiting for the debugger on port 8100... 07-29 13:24:18.133: I/System.out(670): Sending WAIT chunk 07-29 13:24:18.133: I/dalvikvm(670): Debugger is active 07-29 13:24:18.333: I/System.out(670): Debugger has connected 07-29 13:24:18.333: I/System.out(670): waiting for debugger to settle... 07-29 13:24:18.533: I/System.out(670): waiting for debugger to settle... 07-29 13:24:18.733: I/System.out(670): waiting for debugger to settle... 07-29 13:24:18.943: I/System.out(670): waiting for debugger to settle... 07-29 13:24:19.171: I/System.out(670): waiting for debugger to settle... 07-29 13:24:19.386: I/System.out(670): waiting for debugger to settle... 07-29 13:24:19.646: I/System.out(670): waiting for debugger to settle... 07-29 13:24:19.857: I/System.out(670): waiting for debugger to settle... 07-29 13:24:20.089: I/System.out(670): debugger has settled (1518) 07-29 13:24:20.753: I/AndroidNews(670): ParserType=XML_PULL 07-29 13:24:20.903: E/AndroidNews(670): android.os.NetworkOnMainThreadException 07-29 13:24:20.903: E/AndroidNews(670): java.lang.RuntimeException: android.os.NetworkOnMainThreadException 07-29 13:24:20.903: E/AndroidNews(670): at com.mypacks.internals.otaku.XmlPullFeedParser.parse(XmlPullFeedParser.java:57) 07-29 13:24:20.903: E/AndroidNews(670): at com.mypacks.internals.otaku.MessageList.loadFeed(MessageList.java:77) 07-29 13:24:20.903: E/AndroidNews(670): at com.mypacks.internals.otaku.MessageList.onCreate(MessageList.java:33) 07-29 13:24:20.903: E/AndroidNews(670): at android.app.Activity.performCreate(Activity.java:5008) 07-29 13:24:20.903: E/AndroidNews(670): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 07-29 13:24:20.903: E/AndroidNews(670): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 07-29 13:24:20.903: E/AndroidNews(670): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 07-29 13:24:20.903: E/AndroidNews(670): at android.app.ActivityThread.access$600(ActivityThread.java:130) 07-29 13:24:20.903: E/AndroidNews(670): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 07-29 13:24:20.903: E/AndroidNews(670): at android.os.Handler.dispatchMessage(Handler.java:99) 07-29 13:24:20.903: E/AndroidNews(670): at android.os.Looper.loop(Looper.java:137) 07-29 13:24:20.903: E/AndroidNews(670): at android.app.ActivityThread.main(ActivityThread.java:4745) 07-29 13:24:20.903: E/AndroidNews(670): at java.lang.reflect.Method.invokeNative(Native Method) 07-29 13:24:20.903: E/AndroidNews(670): at java.lang.reflect.Method.invoke(Method.java:511) 07-29 13:24:20.903: E/AndroidNews(670): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 07-29 13:24:20.903: E/AndroidNews(670): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 07-29 13:24:20.903: E/AndroidNews(670): at dalvik.system.NativeStart.main(Native Method) 07-29 13:24:20.903: E/AndroidNews(670): Caused by: android.os.NetworkOnMainThreadException 07-29 13:24:20.903: E/AndroidNews(670): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117) 07-29 13:24:20.903: E/AndroidNews(670): at java.net.InetAddress.lookupHostByName(InetAddress.java:385) 07-29 13:24:20.903: E/AndroidNews(670): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) 07-29 13:24:20.903: E/AndroidNews(670): at java.net.InetAddress.getAllByName(InetAddress.java:214) 07-29 13:24:20.903: E/AndroidNews(670): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:70) 07-29 13:24:20.903: E/AndroidNews(670): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:50) 07-29 13:24:20.903: E/AndroidNews(670): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:341) 07-29 13:24:20.903: E/AndroidNews(670): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87) 07-29 13:24:20.903: E/AndroidNews(670): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) 07-29 13:24:20.903: E/AndroidNews(670): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315) 07-29 13:24:20.903: E/AndroidNews(670): at libcore.net.http.HttpEngine.connect(HttpEngine.java:310) 07-29 13:24:20.903: E/AndroidNews(670): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289) 07-29 13:24:20.903: E/AndroidNews(670): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239) 07-29 13:24:20.903: E/AndroidNews(670): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273) 07-29 13:24:20.903: E/AndroidNews(670): at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168) 07-29 13:24:20.903: E/AndroidNews(670): at com.mypacks.internals.otaku.BaseFeedParser.getInputStream(BaseFeedParser.java:36) 07-29 13:24:20.903: E/AndroidNews(670): at com.mypacks.internals.otaku.XmlPullFeedParser.parse(XmlPullFeedParser.java:19) 07-29 13:24:20.903: E/AndroidNews(670): ... 16 more 07-29 13:24:21.173: I/Choreographer(670): Skipped 44 frames! The application may be doing too much work on its main thread. 07-29 13:24:21.223: D/gralloc_goldfish(670): Emulator without GPU emulation detected. </code></pre>
36,188,041
0
Bootstrap CSS Woes <p>Having trouble with a website I'm making at the moment. I'm using bootstrap and on one particular page using basic bootstrap css something just won't line up.</p> <p>My code is as follows :-</p> <pre><code>&lt;section id="aboutUs"&gt; &lt;div class="container"&gt; &lt;div class="row"&gt; &lt;div class="col-xs-12 col-sm-12 col-md-6 col-lg-6"&gt; &lt;img style="width: 500px; height: 288.31775700934577px;" src="/media/1010/macbook-front.png?width=500&amp;amp;height=288.31775700934577" alt="" rel="1255" data-id="1255" /&gt; &lt;br /&gt; &lt;/div&gt; &lt;div class="col-xs-12 col-sm-12 col-md-6 col-lg-6"&gt; &lt;h3&gt;Passion is what we stand for&lt;/h3&gt; &lt;p&gt;Manta Ray bonytail chub. Russian sturgeon yellow tang cichlid creek chub--Siamese fighting fish poacher--sablefish bichir? Bonnetmouth gray eel-catfish luminous hake frogfish rohu, eel tope snake eel clown loach northern squawfish Australian prowfish, wrymouth.&lt;/p&gt; &lt;br /&gt; &lt;blockquote&gt; &lt;p&gt;Good is the enemy of great&lt;/p&gt;Innova Tamashi &lt;/blockquote&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="col-lg-12"&gt; &lt;hr /&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="col-xs-12 col-sm-12 col-md-4 col-lg-4"&gt; &lt;h3&gt;Who we are&lt;/h3&gt; &lt;p&gt;Enjoy smooth graphics and timeless design with Innova. Elements of different trends are blended into a special mix.&lt;/p&gt; &lt;/div&gt; &lt;div class="col-xs-12 col-sm-12 col-md-4 col-lg-4"&gt; &lt;h3&gt;What we do&lt;/h3&gt; &lt;p&gt;Enjoy smooth graphics and timeless design with Innova. Elements of different trends are blended into a special mix.&lt;/p&gt; &lt;/div&gt; &lt;div class="col-xs-12 col-sm-12 col-md-4 col-lg-4"&gt; &lt;h3&gt;Why we do it&lt;/h3&gt; &lt;p&gt;Enjoy smooth graphics and timeless design with Innova. Elements of different trends are blended into a special mix.&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;/section&gt; </code></pre> <p>The issue is that in the last row (which contains the 'Who we are', 'What we do') the div's all appear out of line as can be seen <a href="http://4ourbusiness.azurewebsites.net/about-us/" rel="nofollow">here</a>. I can't figure out why it's doing it as they should be all in line from what I can tell. Any ideas guys?</p>
33,387,379
0
<p>You could try to use </p> <pre><code>date('H:i:s:u', $date); </code></pre> <p>Notice that H is hour, s is second, i is minute, and u is microseconds.</p> <p>Hope it helps.</p>
2,911,455
0
<p>I'm a fan of:</p> <pre><code>%w{An Array of strings} #=&gt; ["An", "Array", "of", "Strings"] </code></pre> <p>It's sort of funny how often that's useful.</p>
27,490,902
0
How to launch an Android App when it is not running <p>I am interested in figuring out how to launch an Android App when it is not running. Lets assume the app is already installed on the user's device, but the app is not running. When the user accesses a particular wifi network, I'd like the app to be launched automatically.</p> <p>How can this be accomplished? Would you recommend to use an Android Service that is running in the background to launch the app? Does the Android Service run in the background at all times? Would this put a heavy load on the phone to constantly check for the status of the Wifi connection?</p> <p>Thank you! Natalie</p>
39,998,537
0
Most appropriate way to store/retrieve User Input in a eCommerce iOS application? <p>I'm a bit confused with <code>Sqlite</code>, <code>Core Data</code>, <code>NSUserDefaults</code>and <code>PropertyList</code>. I know what is what, but not a very clear idea of about where to appropriately use them. </p> <p>I know that there are lots of tutorials, but I'm good at learning through situation based understanding. So kindly do help me to understand this in the situation that I'm facing right now and to make use of the available options wisely.</p> <p>I'm working on an ECommerce iOS (native) application, where I'm highly dependent on <code>API's</code> for data display. Now I'm in need of recording user's review for a product and send it over through an API.</p> <p>ie. I have three components, <code>rating title</code>, <code>rating value</code>(for that title) and another <code>rating title ID</code>. I'm defining with an example, I need to store multiple rows with details,</p> <pre><code>Components Data to be stored **Title** - Quality | Value | Price | | **Rating** - 2 | 3 | 1 | | **TitleID** - 10 | 11 | 12 </code></pre> <p>Like this, there will be so many entries, i.e, the number of <code>components</code> differs for various users, for some users, there might be more than three components, which must be saved &amp; send through an API. So how should I save these data? which is the <code>RIGHT</code> way to save these data temporarily?</p>
16,976,002
0
<p>You can use any <a href="http://en.wikipedia.org/wiki/YAML" rel="nofollow">YAML</a> parsing library, look <a href="http://stackoverflow.com/questions/365155/parse-yaml-files-in-c-c">here</a> for example.</p>
36,749,392
0
Using VBA To Delete Thousands of Checkboxes <p>Somehow 10s of thousands of checkboxes were created in some spreadsheets that we have. I'm not sure how this happened but we cannot open the sheets in Excel 2010 only in Excel 2003 because of it. I wrote some VBA script to go through and delete the extra checkboxes and it works for most of the files. But, some files seem to have way more checkboxes than others and the script dies with an Out of Memory error. This is my script:</p> <pre><code>Sub ProcessFiles() Dim Filename, Pathname, LogFileName As String Dim wb As Workbook Dim fso As Object Set fso = CreateObject("Scripting.FileSystemObject") Set log = fso.OpenTextFile("Z:\Temp\Fix.log", 8, True, 0) PrintLog ("*** Beginning Processing ***") Pathname = "Z:\Temp\Temp\" Filename = Dir(Pathname &amp; "*.xls") Do While Filename &lt;&gt; "" PrintLog ("Opening " &amp; Pathname &amp; Filename) Set wb = Workbooks.Open(Pathname &amp; Filename) DoWork wb PrintLog ("Saving file " &amp; Pathname &amp; Filename) wb.Close SaveChanges:=True Filename = Dir() Loop log.Close End Sub Sub DoWork(wb As Workbook) Dim chk As CheckBox Dim c As Integer With wb Worksheets("Vessel &amp; Voyage Information").Activate PrintLog ("Getting count of checkboxes") c = ActiveSheet.CheckBoxes.Count PrintLog (c &amp; " checkboxes found") If (c &lt;= 43) Then PrintLog ("Correct # of checkboxes. Skipping...") Else c = 0 For Each chk In ActiveSheet.CheckBoxes If Not (Application.Intersect(chk.TopLeftCell, Range("D29:D39")) Is Nothing) Then chk.Delete c = c + 1 End If Next PrintLog ("Deleted " &amp; c &amp; " checkboxes.") End If End With End Sub Public Sub PrintLog(argument As String) If Not log Is Nothing Then log.WriteLine Format(Now(), "yyyy-MM-dd hh:mm:ss") &amp; ": " &amp; argument End If End Sub </code></pre> <p>The script fails at the <code>c = ActiveSheet.CheckBoxes.Count</code> in <code>DoWork</code> or, if I comment that line out, then at the <code>For Each chk In ActiveSheet.CheckBoxes</code>. I am guessing that calling <code>ActiveSheet.CheckBoxes</code> gathers up all the checkboxes and there are too many so it dies.</p> <p>Is there a way to step through each checkbox on a worksheet without using <code>ActiveSheet.CheckBoxes</code>?</p>
33,712,033
0
the formulaire html and php/pdo <p>can someone help me please I search from a week and the page post Notice: Undefined index: username in C:\Program Files\EasyPHP-DevServer-14.1VC9\data\localweb\test.php on line 17</p> <p>Notice: Undefined index: password in C:\Program Files\EasyPHP-DevServer-14.1VC9\data\localweb\test.php on line 19</p> <p>Notice: Undefined index: email in C:\Program Files\EasyPHP-DevServer-14.1VC9\data\localweb\test.php on line 21</p> <p>and i don't find the problem in the code and please explaine i want to learn thank you </p> <pre><code>'&lt;form action="test.php" method="post"&gt; &lt;input placeholder="username" type="text" name="username" &gt;&lt;/input&gt; &lt;input placeholder="password"type="password" name="password" &gt;&lt;/input&gt; &lt;input placeholder="email"type="email" name="email" &gt;&lt;/input&gt; &lt;input type="submit" value="OK"/&gt;&lt;/input&gt; &lt;/form&gt; &lt;?php $dsn = 'mysql:dbname=guyideas;host=localhost'; $user = 'root'; $password = ''; $dbh = new PDO($dsn, $user, $password); $username = $_GET['username']; $password = $_GET['password']; $email = $_GET['email']; $stmt = $dbh-&gt;exec('INSERT INTO `guyideas`.`users` (`username`, `password`, `email`) VALUES ("'.$username.'", "'.$password.'","email");'); ?&gt;' </code></pre>
13,623,723
0
How do you log an uncaught exception in Java? <p>My client is testing my beta phase Java application on a data that he cannot provide me with (privacy reasons). Although I implemented the handling of most exceptions, application crashes on rare occasions.</p> <p>Can I log the stacktrace of an uncaught exception to a file so that tester can provide me with it(e.g. <code>NullPointerException</code>)?</p>
24,864,680
0
iOS UITableView contents not visible <p>In a VC I have 2 tableViews - 1 main and other is added in a drop down menu. From drop down menu TableView "<code>ddTableView</code>", I have added 5 <code>cells</code> in Storyboard itself as prototype cells. Each <code>cell</code> contains an <code>image</code> and a <code>Label</code>. Have also set identifier for each <code>cell</code>. Have also set Accessory Type as "Disclosure Indicator" for each <code>cell</code> of <code>ddTableView</code>. </p> <p>DataSource and Delegate for mainTV is set to the VC and delegate for ddTableView is set the VC. As the rows are added within the storyboard, I didn't set any datasource for <code>ddTableView</code> in my <code>VC</code>. I managed my delegate methods like this :-</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (tableView == ddTableView) { // RETURNS NIL ??? UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; NSLog(@"CELL Identifier = %@", cell.reuseIdentifier); return cell; } else { } } -(void )tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (tableView == ddTableView) { UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; NSLog (@" CELL Clicked of - %@", cell.reuseIdentifier); } } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (tableView == ddTableView) return 44; else return 60; } -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (tableView == ddTableView) return 5; else return [chatMsgsArr count]; } </code></pre> <p>It does call respective delegate method. For <code>cellForRowAtIndexPath</code> it returns cell as nil. Why so ? And on execution, I don't see any contents of the table view - table is blank. I changed the bg color of image and text color also, but yet nothing is seen on execution. </p> <p>Why so ? Where I may be going wrong ? </p>
25,836,757
0
How can I configure my Grunt.js file to copy a directory without a particular subdirectory during the build? <p>Given that the Gruntfile is located in parent/aurora/Gruntfile.js,</p> <p>I'd like to configure Grunt to do the following when the build command is executed:</p> <ul> <li>copy the entire project directory into parent/build/aurora EXCEPT /parent/aurora/node_modules</li> <li>once the directory haas been copied, create a zip file and delete the directory</li> </ul> <p><a href="https://github.com/antonpug/aurora/blob/master/Gruntfile.js" rel="nofollow">https://github.com/antonpug/aurora/blob/master/Gruntfile.js</a> </p>
12,334,694
0
<p>Baseline-shift is not supported in IE9, IE10, and Firefox, see:</p> <p><a href="http://msdn.microsoft.com/en-us/library/gg558060(v=vs.85).aspx">http://msdn.microsoft.com/en-us/library/gg558060(v=vs.85).aspx</a> https://bugzilla.mozilla.org/show_bug.cgi?id=308338</p> <p>If you're acually trying to display formulas, a better fit would be MathML embedded within SVG, see:</p> <p><a href="http://www.maths-informatique-jeux.com/international/mathml_with_other_standards/index.php">http://www.maths-informatique-jeux.com/international/mathml_with_other_standards/index.php</a></p> <p>If you want a quickfix for the example you provided, you can emulate baseline-shift with <code>dy</code>...</p> <pre><code>&lt;svg xmlns="http://www.w3.org/2000/svg" version="1.1"&gt; &lt;g&gt; &lt;text x = "10" y = "25" font-size = "20"&gt; &lt;tspan&gt; e = mc &lt;tspan dy ="-10"&gt;2&lt;/tspan&gt; &lt;/tspan&gt; &lt;tspan x = "10" y = "60"&gt; T &lt;tspan dy="10"&gt;i+2&lt;/tspan&gt; &lt;tspan dy="-10"&gt;=T &lt;/tspan&gt; &lt;tspan dy="10"&gt;i&lt;/tspan&gt; &lt;tspan dy="-10"&gt;+ T&lt;/tspan&gt; &lt;tspan dy="10"&gt;i+1&lt;/tspan&gt; &lt;/tspan&gt; &lt;/text&gt; &lt;/g&gt; &lt;/svg&gt; </code></pre> <p>​http://jsfiddle.net/UQ5Dp/</p>
40,096,834
0
<blockquote> <pre><code>CryptoPP::Base64Decoder decoder; decoder.Put((byte*)nonce.data(), nonce.size()); std::vector&lt;uint8_t&gt; bytes(decoder.MaxRetrievable(),0); decoder.Get(&amp;bytes[0],bytes.size()); </code></pre> </blockquote> <p>Call <code>MessageEnd</code>:</p> <pre class="lang-cxx prettyprint-override"><code>Base64Decoder decoder; decoder.Put((byte*)nonce.data(), nonce.size()); decoder.MessageEnd(); vector&lt;uint8_t&gt; bytes(decoder.MaxRetrievable(),0); decoder.Get(&amp;bytes[0],bytes.size()); </code></pre> <p>Ditto:</p> <pre class="lang-cxx prettyprint-override"><code>Base64Encoder encoder; encoder.Put(digest, 20); encoder.MessageEnd(); string hash64(encoder.MaxRetrievable(), 0); encoder.Get((byte*)hash64.data(), hash64.size()); </code></pre> <p>Also see <a href="http://www.cryptopp.com/wiki/Base64Encoder#Missing_Data" rel="nofollow">Base64Encoder | Missing Data</a> and <a href="http://www.cryptopp.com/wiki/Base64Decoder#Missing_Data" rel="nofollow">Base64Decoder | Missing Data</a> on the Crypto++ wiki.</p> <hr> <blockquote> <p>Nor indeed can I duplicate the result using any other approaches, like a full C# test bed using all of the .NET crypto resources.</p> </blockquote> <p>I don't know C# as well as Crypto++, so I can't help with a C# example that works as expected with ONVIF authentication.</p> <hr> <p>Here's the result I get:</p> <pre class="lang-none prettyprint-override"><code>$ g++ test.cxx -I. ./libcryptopp.a -o test.exe $ ./test.exe tuOSpGlFlIXsozq4HFNeeGeFLEI= </code></pre> <p>And the <code>cat test.cxx</code>:</p> <pre class="lang-cxx prettyprint-override"><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt; #include "base64.h" #include "sha.h" std::string nonce = "LKqI6G/AikKCQrN0zqZFlg=="; std::string dt = "2010-09-16T07:50:45Z"; std::string pwd = "userpassword"; int main(int argc, char* argv[]) { CryptoPP::Base64Decoder decoder; decoder.Put((byte*)nonce.data(), nonce.size()); decoder.MessageEnd(); std::vector&lt;uint8_t&gt; bytes(decoder.MaxRetrievable(),0); decoder.Get(&amp;bytes[0],bytes.size()); CryptoPP::SHA1 hash; byte digest[CryptoPP::SHA1::DIGESTSIZE]; hash.Update(bytes.data(), bytes.size()); hash.Update((const byte*)dt.c_str(), dt.size()); hash.Update((const byte*)pwd.c_str(), pwd.size()); hash.Final(digest); CryptoPP::Base64Encoder encoder; encoder.Put(digest, 20); encoder.MessageEnd(); std::string hash64(encoder.MaxRetrievable(), 0); encoder.Get((byte*)hash64.data(), hash64.size()); std::cout &lt;&lt; hash64 &lt;&lt; std::endl; return 0; } </code></pre>
8,818,569
0
why such a difference in file contents C# <p>My intention is to write a <code>byte[]</code> to a file. Code snippet is below:</p> <pre><code>byte[] stream = { 10, 20, 30, 40, 60 }; for (int i = 0; i &lt; 2; i++) { FileStream aCmdFileStream = new FileStream(@"c:\binarydata.txt", FileMode.Append, FileAccess.Write, FileShare.None); StreamWriter aStreamWriter = new StreamWriter(aCmdFileStream); for (int ii = 0; ii &lt; stream.Length; ii++) { aStreamWriter.Write(stream[ii]); aStreamWriter.WriteLine(); aStreamWriter.BaseStream.Write(stream,0,stream.Length); } aStreamWriter.Close(); } </code></pre> <p>Output of this code snippet</p> <pre><code>(&lt; (&lt; (&lt; (&lt; (&lt;10 20 30 40 60 (&lt; (&lt; (&lt; (&lt; (&lt;10 20 30 40 60 </code></pre> <p>When <code>StreamWriter.Write()</code> is used it dumps the values which are stored in array. But <code>StreamWriter.BaseStream.Write(byte[],int offset, int length)</code>, the values are totally different. What is the reason for this?</p>
24,033,536
0
<pre><code>^example\.com </code></pre> <p>this regex will test if the string is starting with example.com</p>
16,119,538
0
<p>I think the closest thing to what you seem to want is a <em>Hierarchical Recordset</em> in ADO. These can go multiple levels deep, or just two levels (a Recordset contining Chapter fields) as in your request:</p> <blockquote> <p>Regardless of which way the parent Recordset is formed, it will contain a chapter column that is used to relate it to a child Recordset. If you wish, the parent Recordset may also have columns that contain aggregates (SUM, MIN, MAX, and so on) over the child rows. Both the parent and the child Recordset may have columns which contain an expression on the row in the Recordset, as well as columns which are new and initially empty.</p> <p>You can nest hierarchical Recordset objects to any depth (that is, create child Recordset objects of child Recordset objects, and so on).</p> <p>You can access the Recordset components of the shaped Recordset programmatically or through an appropriate visual control.</p> </blockquote> <p>The key to this is using the Data Shaping Service, an OLEDB Provider which "rides on top of" your underlying Provider (even if only the local Cursor Service Provider <em>implied</em> when using client-side cursors).</p> <p>Some description and a crude example can be found in the <a href="http://support.microsoft.com/kb/196029" rel="nofollow">How To Create Hierarchical Recordsets Programmatically</a> Support article.</p> <p>More details and reference material can be found at <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms676186%28v=vs.85%29.aspx" rel="nofollow">Data Shaping</a>, including the SQL-like language used to define Shape commands.</p> <hr> <p>Or are you asking about <em>paged</em> Recordsets, as in <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms681431%28v=vs.85%29.aspx" rel="nofollow">PageSize Property (ADO)</a> instead?</p>
5,344,637
0
<p>It looks like the selector you are choosing (<code>removeAnimation:</code>) and the method you are showing (<code>method:</code>) are not named the same.</p> <p>An easier approach would be to do something like this:</p> <pre><code>-(void)viewDidLoad { UIImage *first = [UIImage imageNamed:@"panda1.png"]; animation = [[UIImageView alloc] initWithImage:first]; animation.animationImages = [NSArray arrayWithObjects: first, [UIImage imageNamed:@"panda2.png"], [UIImage imageNamed:@"panda3.png"], nil]; animation.animationRepeatCount = 4; animation.animationDuration = 2; [animation startAnimating]; [self.view addSubview:animation]; [self performSelector:@selector(removeAnimation) withObject:nil afterDelay:8.0]; //for loading the image at start up NSString *urlAddress = @"http://projects.seng.uvic.ca/most_recent.php"; NSURL *url = [NSURL URLWithString:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; //load the request in the UIWebView [webView loadRequest:requestObj]; } - (void)removeAnimation { [animation removeFromSuperview]; [animation release]; } </code></pre> <p>Hello, I'm a Panda.</p>
16,250,339
0
<p>I am aware of two approaches:</p> <ul> <li><p><code>subplot('position',[left bottom width height])</code> function allows to position a subplot anywhere in normalized coordinate frame. </p></li> <li><p>convert the figure to <code>*.eps</code> format and remove the space manually in some <a href="http://www.osalt.com/corel-draw" rel="nofollow">graphic software</a>. This is best if you just need to prepare one figure for publication purposes.</p></li> </ul>
36,779,978
0
<p>Well, it tries to link a static library into a dynamic one, and that static library (/opt/lib/python-3.5/lib/libpython3.5m.a) isn't suitable for that (compiled w/o -fPIC what makes it impossible to use it in a shared library). recompile that library with the flag (or simply supply one properly compiled) and re-try with Blender BPY.</p> <p>I've just checked, Ubuntu-14.04 didn't have python-3.5 in the official repos, but there's a bunch of dedicated PPAs. But since it's the end of April of 16, it'd better to switch your apt sources.list to Xenial and update the system to the next LTS, if you feel brave, or just python if you don't :)</p>
9,956,784
0
<p>You call <code>to_i</code>, you get integer.</p> <p>Try calling <code>to_f</code>, you should get a float.</p> <p>For more string conversion methods, <a href="http://ruby-doc.org/core-1.9.3/String.html#method-i-to_c">look here</a>.</p>
25,654,501
0
URL redirection using powerdns and lua scripting <p>I am building an internal whitelist browsing filter server for a business. It is 95% operational. PowerDNS intercepts the DNS request and the LUA script correctly determines if the URL is whitelisted. The problem lies in the blacklist block page ... all I get is PAGE CANNOT BE DISPLAYED. The LUA script is getting to this line but the actual redirect never occurs:<br> return 0, {{qtype=pdns.A, content="1.2.3.4"}}<br> The 1.2.3.4 is where I put the actual IP of the PowerDNS server itself. Apache is not detecting that anything is getting to the server over port 80. If I navigate to 1.2.3.4 I do get the block page so I know apache is configured correctly and I have ServerAlias set to * to accept all domains. Thanks in advance.</p>
3,061,309
0
<p>Thought I should reword my answer.</p> <p>The built-in massages are good for light damage (extra whitespace, no closing slashes, etc). I would certainly try and get away with these before getting any more involved.</p> <p>You can <a href="http://www.crummy.com/software/BeautifulSoup/documentation.html#Sanitizing%20Bad%20Data%20with%20Regexps" rel="nofollow noreferrer">pass in your own massages</a> and I would suggest you extend the default set:</p> <pre><code>import copy, re myMassage = [(re.compile('&lt;!-([^-])'), lambda match: '&lt;!--' + match.group(1))] myNewMassage = copy.copy(BeautifulSoup.MARKUP_MASSAGE) myNewMassage.extend(myMassage) BeautifulSoup(badString, markupMassage=myNewMassage) # Foo&lt;!--This comment is malformed.--&gt;Bar&lt;br /&gt;Baz </code></pre> <p>You're probably better off doing it this way as it all goes into one parsing pot, gaining BeautifulSoups optimisations... Although the runtime performance is probably pretty similar.</p>
40,921,084
0
<p>you've mixed quoting</p> <pre><code> job: "find /opt/app/log/ -maxdepth 1 \( -name '*out.*[0-9]' -o -name '*.log.[0-9]' \) -type f -size +100M -exec tar -czf {}.tar.gz {} \;" </code></pre> <p>this should be better</p>
36,564,777
0
Extracting filter responses from Caffe model <p>I am having trouble trying to visualize the filter responses in a Caffe neural network using PyCaffe. <a href="http://nbviewer.jupyter.org/github/BVLC/caffe/blob/master/examples/00-classification.ipynb" rel="nofollow">This tutorial</a> has good instructions as to viewing the filters themselves, but not to visualize their responses on images. I had thought that the <code>data</code> blob after a convolutional layer would contain the responses, but that tutorial appears to demonstrate that it in fact contain the filters. How do I see these intermediate responses in the network?</p> <p>I am also curious as to how to extract the raw filter kernel. For example, I want to take the parameters from a 7x7x512 filter in Caffe and port it into MATLAB for use as a convolutional filter there. This way, rather than requiring me to run the network to delve into the filters being learned, I can use MATLAB to view the responses on my images. (In my case, this is preferable because I am running my Caffe network on a server with limited graphics while I have MATLAB on my local machine.)</p>
18,177,694
0
<p>This error can happen if you have two jars that contains the same class names, e.g. I had two library: jsr311-api-1.1.1.jar, and jersey-core-1.17.1.jar, both containing the class javax.ws.rs.ApplicationPath. I removed jsr311-api-1.1.1.jar and it worked fine.</p>
19,515,477
0
angular-ui datepicker does not allow format dd.MM.yyyy when entered into the input field <p>I think the best way to describe this problem is to steer you to the Plunk:</p> <p><a href="http://plnkr.co/edit/cRO5UgAyZx5SHJSKrzg7?p=preview" rel="nofollow">http://plnkr.co/edit/cRO5UgAyZx5SHJSKrzg7?p=preview</a></p> <p>The angular-ui datepicker doesn't like us Europeans! Start by selecting a date in the datepicker. Let's say it's the 25th October (at least the day should be greater than 12). You see that the datepick-format has been set to dd.MM.yyyy and this is relfected in the date set in the input field. Now change the year. This is not shown in the datepicker. However, if you enter the date in the format MM.dd.yyyy, all is well.</p> <p>I've added the angular-locale_de-de.js, which seems to be working as can be seen in the spelling of Oktober. So why can't I enter a date in the European [correct-and-logical-day-before-month] format?</p>
12,188,569
0
How to find average of a col1 grouping by col2 <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/10748253/idiomatic-r-code-for-partitioning-a-vector-by-an-index-and-performing-an-operati">Idiomatic R code for partitioning a vector by an index and performing an operation on that partition</a><br> <a href="http://stackoverflow.com/questions/12185319/how-to-calculate-median-of-profits-for-a-particular-country">How to calculate median of profits for a particular country</a> </p> </blockquote> <p>I am trying to find average of a column by using another column in R.It's so easy to do it in SQL but not able to find proper functions and implement them.Here is some sample data as below.</p> <pre><code>data("Forbes2000", package = "HSAUR") head(Forbes2000) ## rank name country category sales profits assets marketvalue ## 1 1 Citigroup United States Banking 94.71 17.85 1264.03 255.30 ## 2 2 General Electric United States Conglomerates 134.19 15.59 626.93 328.54 ## 3 3 American Intl Group United States Insurance 76.66 6.46 647.66 194.87 ## 4 4 ExxonMobil United States Oil &amp; gas operations 222.88 20.96 166.99 277.02 ## 5 5 BP United Kingdom Oil &amp; gas operations 232.57 10.27 177.57 173.54 ## 6 6 Bank of America United States Banking 49.01 10.81 736.45 117.55 </code></pre>
17,871,501
0
<pre><code>$data = file_get_contents('yourfile.txt'); echo '&lt;textarea&gt;', htmlspecialchars($data), '&lt;/textarea&gt;'; </code></pre> <p>The <a href="http://php.net/manual/en/function.file-get-contents.php" rel="nofollow"><code>file_get_contents()</code></a> loads the data, and then you just need to echo it. Using <a href="http://php.net/manual/en/function.htmlspecialchars.php" rel="nofollow"><code>htmlspecialchars()</code></a> takes care of escaping any of the data, as needed in the context of HTML.</p>
8,672,222
0
How to remove duplicated data <p>I've got a database my_table <code>[id,first,second,third]</code> with a lot of entries and want to delete duplicate data of entries <code>[first,second,third]</code>.</p> <p>so that no duplicate for <code>first</code> and no duplicate for <code>second</code> and no duplicate for <code>third</code> just any duplicate on each then will be deleted.</p> <pre><code>id first second third 1 addy any robert 2 addy kevin steve 3 jack ben adam </code></pre> <p>here i will remove duplicate for <code>first</code> so remove <code>2 addy kevin steve</code></p>
16,535,273
0
IEnumerable<T> with dynamic generic - C# <p>I am trying to achieve following, is it possible?</p> <pre><code>Type T = Type.GetType("EntityName") IEnumerable&lt;T&gt; entities = BaseRepository.GetEntities(searchCriteria) as IEnumerable&lt;T&gt;(); </code></pre>
40,119,204
0
With Javascript, How do I call a methods within another methods <pre><code>var hangman = { random: Math.floor((Math.random() * 3)), word_bank: ["hello", "bye", "hey"], select: "", guess: "", wins: 0, loss: 0, dashs: [], split: [], correct_letter: [], replace_dash: [], alphabet:['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' ], select_word: function() { this.select = this.word_bank[this.random]; }, dash: function() { for (var i = 0; i &lt; this.select.length; i++) { if (this.select[i] == " ") { this.dashs.push("&amp;nbsp;"); } else { this.dashs.push("_"); } } }, split: function() { this.split = this.select.split(""); }, correct_i: function() { for (var i = this.select.length - 1; i &gt;= 0; i--) { if (this.split[i] == this.guess) { this.correct_letter.push(i) } } }, replace_dash: function(){ for (var i = 0; i &lt; this.correct_letter.length; i++) { this.dash[this.correct_letter[i]] = this.guess; } }, board_set: function(){ this.select_word(); this.dash(); this.split(); this.correct_letter = []; this.replace_dash = []; }, play_game: function(){ this.board_set(); console.log(hangman.dashs); console.log(hangman.split); var alphabet = this.alphabet; var gameboard = $("#game"); gameboard.html("&lt;p&gt;Game Board&lt;/p&gt;" + this.dashs.join(" ")); document.onkeyup = function(e){ this.guess = String.fromCharCode(e.keyCode).toLowerCase(); if (alphabet.indexOf(this.guess) &gt;= 0) { this.correct_i(); this.replace_dash(); console.log(correct_i); console.log(replace_dash); gameboard = $("#game"); gameboard.html("&lt;p&gt;Game Board&lt;/p&gt;" + this.dashs.join(" ")); } } } }; hangman.guess = "e"; </code></pre> <hr> <p>Within the play_game() I am trying to call the other methods within this method, but it keeps saying that the methods I am calling are not defined. I have tried to do:</p> <pre><code>hangman.correct_i(); hangman.replace_dash(); </code></pre> <p>and that doesn't work either.</p>
3,763,480
0
<p>You're defining the same function signature many times. The different <code>throw()</code> qualifiers are not enough to disambiguate the functions.</p> <p>The <code>throw()</code> qualifier simply means that the specified function is only expected to throw the types listed in the parenthesis following the qualifier. However, this does not actually prevent the function from throwing. Rather, if the function actually <em>does</em> throw any unlisted types, your program will terminate. </p>
782,732
0
<p>Your boss wants to insult you, but sadly doesn't know what he is talking about. People "still stuck inside the Windows programming world" are generally using SourceSafe, or perhaps something really expensive like ClearCase.</p> <p>Subversion was developed with the goal of being a functional replacement for CVS, a goal which it pretty much succeeds at. Its probably OK to still use CVS if you are working an old project that already has CVS history. However, if you have a choice you should use SVN instead.</p> <p>That being said, you still at the end of the day are stuck with something built around CVS's workflow. The latest generation of revision control systems are much different. For instance, <a href="http://en.wikipedia.org/wiki/Distributed_revision_control" rel="nofollow noreferrer">distributed revision control systems</a> have far better tools for anyone who might ever have to access sources remotely (does your company have branch sites?) </p>