input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
CSV import to MySQL using PHP <p>Trying to update tables with PHP and CSV import to MySQL DB. And I need some help.</p>
<p>I have two tables: <strong>users</strong> and <strong>balance</strong>.</p>
<ol>
<li><p>users<br>
<strong>ID|user_login|</strong><br>
1 |name1 |<br>
2 |name2 |<br></p></li>
<li><p>balance... | <p>First you get the data from CSV file.</p>
<pre><code>$row = 1;
if (($handle = fopen("data.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
echo "<p> $num fields in line $row: <br /></p>\n";
$row++;
for ($c=0... |
Why isn't an implicit conversion from int to intBox working in Json.decode or default modelbinding? <p>EDIT: removed first part of the question, as it was misleading and not completely pertinent.</p>
<p>For various reasons, I've come to the point where I could really use the ability to box some of my Post body paramet... | <p>Figured it out.</p>
<p>This doesn't work:</p>
<pre><code>public class IntBox
{
public int Value;
public IntBox(int value)
{
Value = value;
}
public static implicit operator IntBox(int value)
{
return new IntBox(value);
}
}
</code></pre>
<p>This does work:</p>
<pre><c... |
How to get response as XML from webService response? <p>I have to create a method for getting webService response as <code>xml</code>. I know how to create with <code>Java</code> class but problem is getting response as <code>xml</code> from webService.</p>
<p>These webServices are soap based.</p>
<p>Thanks in advanc... | <p>I have just solve my problem. <code>HttpURLConnection</code> helps me. </p>
<p>The following code block show how I make poster for getting <code>xml</code> response in <code>java</code> like Mozilla Poster.</p>
<pre><code>public static void main(String[] args) {
try {
String uri = "http://test.com/Inte... |
Parse ecommerce product data via PHP <p>Given a webpage for example:</p>
<ul>
<li><a href="http://rads.stackoverflow.com/amzn/click/B014I8SSD0" rel="nofollow">https://www.amazon.com/AmazonBasics-High-Speed-HDMI-Cable-Standard/dp/B014I8SSD0/ref=pd_bxgy_23_img_2?ie=UTF8&psc=1&refRID=Y5T0HTXEAC6TVNH5H15Q</a></li>... | <p>Yes you can. It is called crawling/parsing. I would recommend <a href="http://simplehtmldom.sourceforge.net/" rel="nofollow">this</a> library, since laravel has a composer you can easily implement it to your project.</p>
|
Line break a <label> with CSS <p>I have multiple checkboxes in bootstrap columns that act as a filter for map markers. </p>
<p>I'm using an empty <code><div></code> element to display a colored square, then the actual checkbox, and last a <code><label></code> with the filter name.</p>
<pre><code><div c... | <p>You have to move the <code>.map-legend-box</code> inside your <code>label</code> and position it <code>absolute</code>. Then add a little bit of <code>padding-left</code> to make room for your <code>.map-legend-box</code>.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="... |
Oracle SubStr for Description field <p>Hello I need help with the following Scenario.</p>
<p>There is a table with Company_Cd, Company_Name and All I need is the first 2 words of from the Company name if it has more than 3 words and 1 word if it has 2 words </p>
<p>Example:</p>
<pre><code>Company_Cd Company_Name... | <p>You can use the instr function to find the 1st and 2nd occurence of space and then use substr accordingly:</p>
<pre><code>SELECT c.company_name,
(
CASE
WHEN instr(c.company_name,' ',1,2) >0 THEN SUBSTR(c.company_name, 1, instr(c.company_name,' ',1,2))
WHEN instr(c.company_name,' ',1,2) =0 AND i... |
Waterline + Sails.js: Sort documents without the sort field to end of results <p>I have a model Event.js:</p>
<pre><code>var Event = {
schema: true,
attributes: {
time: {
type: "datetime"
// There can be events which don't have 'time' field
}
// Some more fields,... | <p>Sails.js transform <code>null</code> fields into an "low value" attribute for sorting. There is two possible workarounds.</p>
<p>The first one, is using the <code>defaultsTo</code> attribute setting it to an invalid value like <code>"ǸA"</code>. But you cannot use <code>datetime</code> for validation and must crea... |
batch - execute command for every file with specific creation date <p>got this piece of code:</p>
<pre><code>forfiles /P %ParentFolder% /S /M %Format% /C "cmd /c %exeFile% @path"
</code></pre>
<p>executing some exe for every file matching format as parameter.</p>
<p><strong>any way to add "creation date" as a condit... | <p>This is not possible with <code>forfiles</code>, because, when the <code>/D</code> option is provided, it only regards the last modification date only (not even the modification time).</p>
<p>Unfortunately, there are no native commands for date/time maths, so I suggest to switch to a language that is capable of tha... |
String doesn't compare <p>I have a method where i compare two string, but they dont compare the right way. For example I have this:</p>
<pre><code>dropdown.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView adapter, View v, int i, long lng)... | <pre><code>String selectedValueId = selectedValue;
if (selectedValueId.equals("2459") || selectedValueId.equals("2460")) {
surveyArray[0].getQuestions()[i].getQuestion_order_id().equals("2");
myTextViews[j].setText(surveyArray[0].getQuestions()[1].getText());
}
if (selec... |
ios integration google drive and dropbox like naukri app <p>I am trying to implement an IOS application. The need of my application is to access the documents(pdf,photo etc) from DropBox & Google drive. I am new in iPhone development ,so i have no idea about access the document from DropBox & Google Drive.</p>
... | <p>Here are the API's that you would need to get started with Dropbox and Google Drive.</p>
<ol>
<li><p><a href="https://www.dropbox.com/developers-v1/core/sdks/ios" rel="nofollow">https://www.dropbox.com/developers-v1/core/sdks/ios</a></p></li>
<li><p><a href="https://developers.google.com/drive/ios/" rel="nofollow">... |
Parse pandas df column with regex extracting substrings <p>I have a pandas df containing a column composed of text like:</p>
<pre><code>String1::some_text::some_text;String2::some_text::;String3::some_text::some_text;String4::some_text::some_text
</code></pre>
<p>I can see that:</p>
<ol>
<li>The start of the text al... | <p>try this:</p>
<pre><code>In [136]: df.txt.str.findall(r'String\d+').str.join(', ')
Out[136]:
0 String1, String2, String3, String4
Name: txt, dtype: object
</code></pre>
<p>Data:</p>
<pre><code>In [137]: df
Out[137]:
... |
angular.min.js:6 Uncaught Error: [$injector:modulerr] in angularJS 1.5.6 <p>I am trying to load my own module, it worked with first module but facing error when I tried to add another module. See below files:</p>
<p><strong>app.js</strong></p>
<pre><code>var gcApp = angular.module('gcApp', [
'ui.router',
'gcA... | <p>Change </p>
<pre><code>var controllers = angular.module('gcApp.controllers', [
'login-controller',
'farmer-controller',
]);
</code></pre>
<p>to</p>
<pre><code>var controllers = angular.module('gcApp.controllers', [
'login-controller',
'farmer-controller'
]);
</code></pre>
<p>and also</p>
<pre>... |
Issues with a nested element's destruction <p>I created a form to allow a user to create an album via two scaffolded generation (one for the album, the other for the photos themselves). I'm trying to make a link where the user can see a "delete" button that would destroy the picture. There would be a small alert to con... | <p>The problem is that you are using <code>params[:id]</code> in your <code>AlbumController</code> as both the id of the album <em>and</em> the id of the photo:</p>
<pre><code>@album = Album.find(params[:id])
@photo = Photo.find(params[:id])
</code></pre>
<p>This doesn't make any sense, you will get nonsensical resul... |
org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [admin_pkey]; <p>I am able to insert data successfuly into mysql database, now I am switching my database into postgresql and I am having this challenge</p>
<pre><code>org.springframework.dao.DataIntegrityViolat... | <p>If you are changing your database then accordingly you should also change the hibernate configuration XML.<br>
Here goes the <code>hibernate.cfg.xml</code> : </p>
<pre><code><!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/h... |
How to update a field on .focusout()? <p>I would like, upon loosing focus on an <code><input></code> field, to perform a few operations on the value of this field, including changing the content itself (so that it is uppercase)</p>
<p>In the following <a href="http://codepen.io/WoJWoJ/pen/amyNJR" rel="nofollow">... | <p>Change text() to val() for field</p>
<pre><code>$("#name").val(name);
</code></pre>
|
npm start command gives error : http-server:command not found , code: ELIFECYCLE <p>I am new be to node js . started to set up node js project . </p>
<p>Got error when npm start command is used.</p>
<p>npm start</p>
<pre><code>> sigma@1.1.0 start /usr/local/UserProfile/TitanUI
> http-server -p 8080
sh: htt... | <p>Removed the node modules folder and ran "npm install" and "npm start" again. This solved the above error. Thanks!</p>
|
PHP cannot autoload classes <p>We used to include only classes that are stored in a <code>{project_root}/includes</code> folder. And we used autoload function to include classes we need in our apps. Now I wanted to use some library and I faced a problem:</p>
<p>1) Autoload:</p>
<pre><code>// {project_root}/includes/a... | <p>Try this autoload function instead :</p>
<pre><code>function __autoload($classname)
{
$filename = str_replace("\\", "/", $classname).".php";
include __DIR__."/$filename";
}
</code></pre>
<ul>
<li>It replaces <code>\</code> ... |
Laravel render dropdown list from related table under employee table <p>I have 2 tables. Employee table and Roles tables. In my employee.show blade I want to render the dropdown list of the role already assgined or available to assign. I am not using collective forms and am a little stuck as all tutorials use thse. </p... | <p>What you've done in your controller seems correct. Your view however should loop through the roles and create options for them. Bear in mind, that you've used <code>Role::pluck('role_name', 'id')</code>, which will return an array of <code>'id' => 'role_name'</code>.</p>
<p>You can decide which one is selected b... |
Nativescript: how to vertically align text inside Label on Android <p>The text inside label is vertically aligned by default on iOS, however on Android it's not. How to center it vertically on Android (I'm interested in centering text inside Label, not wrapping label inside any other layout to get the same effect)?</p>... | <p>Set the padding accordingly to the (width - font-size) / 2 (rough approximation may differ for smaller boxes where Capital or small letters has different center point)</p>
<p>e.g.</p>
<pre><code>Label {
width: 60;
height: 60;
border-radius: 30;
text-align:center;
background-color: aquamarine;
... |
Hapi.js -- Set X-Authorization header <p>I would like to implement X-Authorization to my routes in Hapi.js. So when I make a request, I will create a X-Auth header and I would like Hapi to check it before allowing some code execution:</p>
<p>Based on this code example from Hapi documentaiton, how Do I implement it?</p... | <p>You can use <code>headers</code> property of <code>request</code> object to get <code>X-Authorization</code> value. However, it should be <code>request.headers['x-authorization']</code> (all lowercase).</p>
<p>Please refer to <a href="http://hapijs.com/api#request-properties" rel="nofollow">http://hapijs.com/api#re... |
EasyMock and generic params <p>I'm trying to get to grips with EasyMock to mock some calls to Jersey client APIs...
I'm trying to mock a call to the following call Builder API: </p>
<pre><code><T> T post(Entity<?> entity, Class<T> responseType);
</code></pre>
<p>doing the following: </p>
<pre><cod... | <p>See <a href="http://easymock.org/user-guide.html#verification-expectations" rel="nofollow">EasyMock User Guide</a>:</p>
<blockquote>
<p>To match an actual method call on the Mock Object with an expectation, <code>Object</code> arguments are by default compared with <code>equals()</code>. </p>
</blockquote>
<p>Yo... |
AMP-html how to prevent lightbox close when user click on an input <p>I have a amp-lightbox and a form in it. </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code> <amp-l... | <p>Based from this <a href="https://www.ampproject.org/docs/reference/extended/amp-lightbox.html" rel="nofollow">documentation</a>, setting the <code>on</code> attribute on one or more elements within the lightbox and setting it's method to <code>close</code> will close the lightbox when the element is tapped or clicke... |
VB Script to remove a row from an excel file if it contains a particular data <p>I need to create a VB script that will remove a particular row from an excel file if that row contains a particular data separated by '/'. For example if a row contains data as 'NSV/PL' or 'OI/HJK' then that row should be deleted from the ... | <p>Please Try This</p>
<pre><code>excelfile = "Excel File Path Here" ' Example : C:\Documents\ExcelFile.xlsx
excelSheetName = "Sheet1"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExcel = CreateObject("Excel.Application")
Set book = objExcel.Workbooks.Open(excelfile)
Set sheet = book.Sheets(excelShe... |
java o remove duplicated id from a list with multi diferent column values <p>I have a problem to remove duplicated ID from a list with multi different column values. More precisely, I have a list of 'customers', including 1000 customers, each one has 2 columns, 'id', 'age'. In the list, the ID are duplicated, as the fo... | <p>Assuming that <strong>you don't use Java 8</strong>, it could be done by putting the content of your <code>list</code> into a temporary <code>map</code> to get rid of duplicates then creating back your <code>list</code> using from the <code>values</code> of the <code>map</code> as next:</p>
<pre><code>Map<String... |
Achieving multitasking by Threading in java <p>When using synchronization and join in java., how do we achieve multitasking? As multitasking is done using threading and join and synchronization execute one whole thread at a time and then the next thread comes.So why not say it a simple object invocation?</p>
| <p>Multi threading in simple terms implies more than one path of execution processing *independently (not 100% independent , as number of processor avavialbe and other factors ) of each other. </p>
<p>Syncronization in simple terms comes into picture when these seprate independent paths of execution needs to share a r... |
Elevation (shadow) to Android Widget <p>Has anyone had success adding <code>android:elevation</code> to an Android widget (i.e. subclass of AppWidgetProvider) root layout. It seems it is not do-able?</p>
<p>I am developing for Lollipop and <code>android:elevation</code> works fine if it is layout within an activity bu... | <p>Elevation didn't work with widget in my case too. I achieved it using <strong>cardview.</strong></p>
<p>Keep your full stuff of layout inside cardview</p>
<pre><code><android.support.v7.widget.CardView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInPare... |
Find last stored commited offset in low level consumer <p>Hi following is the code for my consumer, </p>
<pre><code> $conf->set('group.id','commonqueue2');
$conf->set('offset.store.method', 'broker');
$rk = new \RdKafka\Consumer($conf);
$rk->addBrokers($kafka_servers);
$topicConf = ... | <p>There are 2 methods to get the latest offsets:
1. From zookeeper Shell
By using the coomand get /consumers//offsets//num_of_partitions
For the help,use this link: <a href="https://cwiki.apache.org/confluence/display/KAFKA/Kafka+data+structures+in+Zookeeper" rel="nofollow">https://cwiki.apache.org/confluence/displ... |
Send SMTP email from cpanel <p>I am using godaddy shared hosting is there and of what i read that it's not possible to send emails using SMTP from a shared hosting is there any alternative way .. i am trying to send emails using codeigniter but it's not working at all</p>
<pre><code>$this->email->clear();
... | <p>Check: <a href="http://www.yetesoft.com/free-email-marketing-resources/godaddy-pop-smtp-server-settings/" rel="nofollow">GoDaddy POP and SMTP Server Settings</a></p>
<p>Check the library configuration email, and your hosting provider looking email accounts created, select and view a manual configuration.</p>
<p><a... |
Inserting logo image into application <p>I have been trying and trying whole day yesterday to insert my logo image in my application. But with no luck.
I was using ImageView and I was applying all advices from the Internet and I have builded over 50 APK to test it out, and every time it is a failure.</p>
<p>My image ... | <p>Try <code>android:src</code> insted of <code>app:srcCompat</code>.</p>
|
Self Segue & delegate weird behaviour <p>I have created a <em>Self Segue</em> from a Button to View Controller itself i.e, when button is clicked the view will go to itself.</p>
<p>I have a <code>Bool</code> variable <code>isSearch</code> declared in the View Controller:</p>
<pre><code>var isSearch! false
</code></pr... | <p>If you segue to the same viewController you're actually creating a new instance of that viewController and segueing to that. The way you have set up your delegate is that each view controller will be the delegate of itself so when you click the back button from your second viewController you're changing the <code>is... |
<option> value to <input> text value <p>I am trying to set a input box's value and text from a select element.</p>
<pre><code>var p = document.getElementById("pretestNameSelect");
var test = p.options[p.selectedIndex].value;
if (choice.toString() == "type0")
{
alert(test);
$(document.getElementById("type0")).s... | <p>You are mixing Jquery Selectors with DOM selectors. </p>
<p>You can use</p>
<pre><code>$('#pretestNameSelectHiddenTextQ0').val(test);
</code></pre>
<p>or </p>
<pre><code>document.getElementById('pretestNameSelectHiddenTextQ0').value = test;
</code></pre>
|
Yii2 get params from controller to _form in another view <p>Im have a problem in Yii.</p>
<p>Example:</p>
<p>There are CRUDs for Customers and for Joboffers. I want to click on a create button on the Customer-Index that redirect me to the Joboffer-Create-Form where the ID from the Employee wich i clicked on is access... | <p>You should use the function for returning the HTML code </p>
<pre><code> function ($url, $model, $key) {
// return the button HTML code
}
</code></pre>
<p>this way </p>
<pre><code> [
'class' => 'yii\grid\ActionColumn',
'template' => '{create}',
'contentOptions'=>['style'=... |
Getting Error If I Run Android Studio in Win 64 bit <p>I have a problem with Android Studio.</p>
<blockquote>
<p>Error:CreateProcess error=216, This version of %1 is not compatible
with the version of Windows you're running. Check your computer's
system information to see whether you need a x86 (32-bit) or x64
... | <blockquote>
<p>Error:CreateProcess error=216, This version of %1 is not compatible
with the version of Windows you're running. Check your computer's
system information to see whether you need a x86 (32-bit) or x64
(64-bit) version of the program, and then contact the software
publisher</p>
</blockquote>
<p>... |
Code First or Database First <p>We are re-writing our web applications( at least 3) and unifying our databases into one.
Now the question is do we go Code first or Database first. We will be using MVC 5 and SQL 2014. Any Pros and Cons other than just the preference would be high appreciated</p>
<p>Thank you</p>
| <p>Code-First gives you the opportunity to develop rich domain model which is not entirely affected by the database and EF. That is the principal benefit of starting with code.</p>
<p>It is generally possible to fit the model into existing database. That asks for a bit of imagination and compromises here and there.</p... |
Perform action when access token is generated <p><strong>Context</strong></p>
<p>Current <a href="http://docs.spring.io/spring-security/oauth/apidocs/index.html?org/springframework/security/oauth2/config/annotation/web/configuration/AuthorizationServerConfigurerAdapter.html" rel="nofollow">AuthorizationServerConfigure... | <p>Well, at then I found a way to attach in TokenStore (JwtTokenStore implementation).</p>
<pre><code>@Bean
public TokenStore tokenStore() {
JwtTokenStore store = new JwtTokenStore(accessTokenConverter()) {
@Override
public void storeAccessToken(OAuth2AccessToken token, OAuth2Authentication authent... |
Pointers in C. Need explanation for this tiny code <pre><code>#include <stdio.h>
int* func()
{
static int a = 5; /* line 5 */
printf("%d\n",++a);
return &a; /* line 7 */
}
int main(void)
{
int *b = func(); /* line 12 */
(*b)++;
func();
}
</code></pre>
<p>This is a code example of te... | <blockquote>
<p>Does the fact that integer is static(line 5) have to do anything with this? </p>
</blockquote>
<p>Yes. Otherwise returning a pointer to an automatic local variable will invoke undefined behavior. </p>
<p>The lifetime of a <code>static</code> local variable ends when the program terminates. So, its... |
Join a table with previous record of same table <p>I have a table with historic records, posted there by several triggers in a main table. I want to create a select statement on the history table where I have each record JOINed by their prior record (identified by the same LineID and the highest ActionDate) so I can ex... | <p>You can get a reference to the previous row using:</p>
<pre><code>select h.*,
(select h2.ActionDate
from history h2
where h2.LineId = h.LineId and h2.ActionDate < h.ActionDate
order by h2.ActionDate desc
limit 1
) as prev_ActionDate
from history h;
</code></pre>
<p>... |
Logical OR with a variable and a function definition as operands <p>I saw this line when I was reading a custom library created by a third party developers. What does this do in Javascript? Does it perform Logical OR on "modifier" and a return value from the function?</p>
<p>modifier = modifier || function( x ){ retur... | <p>It returns <code>modifier</code>, if it has a <a href="https://developer.mozilla.org/en-US/docs/Glossary/Truthy" rel="nofollow">truthy</a> value, like <code>function</code>. Otherwise it returns a function without calling it.</p>
|
ax 2012 - checking and unchecking of checkbox on form <p>I came across a problem with checking and unchecking the same record on form.
I have a form with list of records, depending on status on record you can see an active/inactive button. Logic for this is included in active method on data source. When i click checkbo... | <p>Thanks for add you code.</p>
<p>Ok, this is the button <code>ComplaintConfirm</code>?? if this is the botton in one part you compare <code>Complaints.ComplaintConfirmed == Complaints_ComplaintConfirmed.checked(false)</code></p>
<p><code>Complaints.ComplaintConfirmed</code> if a enum <code>NoYesId</code>?? if a <co... |
ITextPdf PdfWriter.getPageNumber() returns an extra page number <p>Looking into many Java code examples within my organization, on the internet, as well as examples from iTextPdf, there is a common pattern of subtracting 1 from the returned number of pages, for instance:
<em>numberOfPages = writer.getPageNumber() - 1; ... | <p>This answer is for iText 5 only; iText 7 uses a completely different approach.</p>
<ul>
<li>When you close a document in iText 5, iText always calls the <code>newPage()</code> method to finalize the last page in the document. The <code>newPage()</code> method also initializes a new page, but as no content can be ad... |
Is there extension for viewing navigation history in Visual studio? <p>Is there extension, that will remember all visited files, and show it? Visited positions also would be great.</p>
<p>For example:</p>
<ol>
<li>I opened MyFile1.cs. Extension remembered this.</li>
<li>I navigated to function HelloThere() in this fi... | <p>If you click on the little down arrow by the back button, the history that it'll go through is listed:</p>
<p><a href="http://i.stack.imgur.com/LlmkD.png" rel="nofollow"><img src="http://i.stack.imgur.com/LlmkD.png" alt="Picture of back button"></a></p>
|
Highcharts Horizontal stacked bar, reduce space between bar and x-axis <p>I have been working on a horizontal stacked bar in highchart. I need to remove the space between the x-axis and the bar in the chart.
You can get the details from this image:</p>
<p><img src="http://i.stack.imgur.com/RiE6P.jpg" alt="Image">. </... | <p>So, you had a lot of things out of place in your chart options.</p>
<p>Here's an example that uses this updated code to fill the space with the bar:</p>
<pre><code>"plotOptions": {
"series": {
"stacking": "percent",
"minPointLength": 1,
"pointPadding": 0,
"groupPadding": 0,
"c... |
java.lang.IllegalArgumentException: Too many pattern letters: m <p>I try to convert this string to java LocalDateTime</p>
<pre><code>String str = "2016-09-29 09:54:27.850373"
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.mmmmmm");
configActivityLog.acti... | <p>The <code>s</code> stands for seconds, while <code>S</code> stands for fractions of a second, see <a href="https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html" rel="nofollow"><em>Patterns for Formatting and Parsing</em></a>.</p>
<p>See a <a href="https://ideone.com/jPeRUg" rel="nofollo... |
node js spawn cut result <p>I have this code in <code>node js</code> that execute a <code>java program</code> and read the <code>stdout</code></p>
<pre><code>let javaRun = spawn('java', execParam);
javaRun.stdout.on('data', function (data) {
console.log(data.toString());
});
</code></pre>
<p>It wor... | <pre><code>const CONSOLELOGLIMIT = 8020;
let s = 0, f = CONSOLELOGLIMIT, part = ' ';
strData = data.toString();
while(part.length > 0) {
part = strData.substr(s, f);
console.log(part);
s = s + CONSOLELOGLIMIT;
f = f + CONSOLELOGLIMIT;
}
</code></pre>
|
Microsoft Access form with a circular reference equation <p>In the picture is my current access form. My issue is that I'm provided with yearly volume when I need average daily volume. I'd like to key in the yearly volume into the "Average Daily Volume" text box and after hitting tab or enter to move to "Industry Segme... | <p>This can be achieved using the AfterUpdate event of the textbox. In the AfterUpdate event, put something like this:</p>
<pre><code>Me.Average_Daily_Volume.Value = Me.Average_Daily_Volume / 252
</code></pre>
|
SQLite JOIN on zero if ID not in data set <p>I have two tables, "base" and "override", in a SQLite database I need to join together on base.ID and override.BaseID with the MIN(override.Priority). Override.BaseID can be '0', in which case means the override is "global" and applies to all base records unless an override... | <p>First get the rows with the smallest priority value for each base ID. (Using MIN() this way requires SQLite 3.7.11 or later.)</p>
<pre><code>SELECT ID,
BaseID,
MIN(Prority) AS Priority,
Authorized
FROM override;
</code></pre>
<p>Then filter out any of those rows that are invalid due to a glova... |
F# JQuery Ajax Post <p>I'm trying to make an <code>Ajax Post</code> to my <code>F# controller</code> so I can call a method, that will print and simple string. Eventually instead of string being displayed, information selected via a checkbox on the webpage will be inserted into a database.</p>
<p>I have been trying to... | <p>Changed the controller and the method</p>
<p>Controller:</p>
<pre><code>member this.PostInsertData (Insert : string) =
System.Diagnostics.Debug.WriteLine("Called method insert data into table")
Table.insertDataTest()
//http://localhost:48214/api/table/?InsertData
//^Link to post request
</code></... |
android: bugged Toolbar in secondary activity <p>I'm trying to implement a toolbar in my second activity. But i'm having troubles with it.</p>
<p><strong>Activity.java (AddActivity)</strong></p>
<pre><code>import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Tool... | <p>Solved, i added a new activity with the toolbar aready installed in the correct way (only in AndroidStudio 2.1+)</p>
|
php: CheckNullResponseAndThrowException - Response Null or Empty while adding record? <p>I am getting error while adding record of invoice in my application. It had worked while i added customer in same way.</p>
<p>Exception:</p>
<blockquote>
<p>v3-php-sdk-2.4.1/DataService/DataService.php - 587 -
CheckNullRespon... | <pre><code> I have solved this problem. Missing following required params:
at least one Line record
Line.DetailType
Line.Amount
Line.Description
at least one Line.SalesItemLineDetail
Line.SalesItemLineDetail.ItemRef
Line.SalesItemLineDetail.Quantity
Line.SalesItemLineDetail.UnitPrice... |
Change image source inside wpf listview DataTemplate <p>I have a listview in a wpf window as following </p>
<pre><code><ListView Name="lvInstructors" ItemsSource="{Binding Instructors}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
... | <p>Considering your xaml-Code:</p>
<pre><code><ListView Name="lvInstructors" ItemsSource="{Binding Instructors}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="3">
</UniformGrid>
... |
What's the difference between casting the type of a 32 bit address to (BYTE *) and (DWORD *) <p>My program runs on a 32bit Windows ,so the type of the address in the virtual memory space is <code>DWORD</code>. And I want to hook API by changing the address of the API in IAT . So , I get the base address of the image o... | <p>Pointer arithmetic is different according to the type of the value it points to.</p>
<p>If you cast the pointer to <code>DWORD</code>, adding 24 actually adds <code>24*sizeof(DWORD)</code> to your address.</p>
<p>When casting to <code>BYTE</code>, it just adds 24 to the address (<code>BYTE</code> is 1 byte)</p>
<... |
Backup and Restore Database android studio <p>I want to make backup and restore for the database in my app, so that when the users delete the application and reinstall it again they can recover their data.
What is the best way to do that in Android Studio? </p>
| <p>There are several types available in back up and restore to your db file like Google drive, drop box and one drive. if you want to do the back up from your local storage try below given code.</p>
<p>Backup code:</p>
<pre><code> public void backUp() {
try {
File sd = Environment.getExternalStorageDirec... |
Message after form submit in iFrame with Google Script doPost <p>I have a simple form inside an iFrame submitting to GAS Web App:</p>
<pre><code><form action="https://script.google.com/macros/s/AK...a4/exec" method="POST">
Name:<br>
<input type="text" name="name">
<br>
Email:<... | <p>As detailed in the <a href="https://developers.google.com/apps-script/reference/content/content-service" rel="nofollow">documentation</a>, use <code>createTextOutput(content)</code> method to create a new <a href="https://developers.google.com/apps-script/reference/content/text-output" rel="nofollow"><code>TextOutpu... |
2sxc: Listing working only with query in app? <p>I need to do a simple list of images. I tried to add a content module and make a new template with my custom content (image, title, url).</p>
<p>Here is the code of my template:</p>
<pre><code>@foreach(var Element in List) {
var Contenuto = Element.Content;
<div&... | <p>The <code>@foreach(element in List)</code> is an older syntax which still works, but the content-item is then found on <code>element.Content</code>. The rest is the same. </p>
<p>But: it would be better to loop through <code>Data["Default"]</code> as it gives a more consistent use of the items, which is also cohere... |
Not able to find any consumer group in Kafka while using Burrow <p>I am getting the following response when I hit /v2/kafka/local/consumer:</p>
<p>{
"error": false,
"message": "consumer list returned",
"consumers": [],
"request": {
"url": "/v2/kafka/local/consumer",
"host": "EN-NavneetJ",
"cluster": "local",
"group": ... | <p>The console consumer uses the old consumer and creates groups in ZooKeeper by default. Burrow assumes the new consumer and expects the groups to be in Kafka. </p>
<p>Check if you can run the console consumer with --new flag so it will use the new consumer and therefore work with Burrow.</p>
|
How to write a huge log in Javascript? <p>I need to log a huge number of events when running a .js file, and so far I've tried to use <code>console.log(data)</code> to record all the data, as then I can save from the browser log (I'm using Chrome).
However, I've run into the problem that there are so many log messages,... | <p>In the end, I used <code>File</code> and <code>Blob</code> to make a download link to the file that was saved when the log stopped, providing a download link:</p>
<pre><code>function fileOut(data) {
properties = {type: 'plain/text'};
try {
file = new File(data, "file.txt", properties);
} catch (e)... |
Wireshark dissector errors Ubuntu <p>I have a wireshark plugin code which compiles and generates .so files perfectly under Ubuntu 16. This dissector was written for wireshark 1.6 and the plugin runs perfectly under wireshark 1.6.</p>
<p>However when I try to use this plugin for wireshark 2(or any wireshark version hig... | <p>Your problem here is that emem was replaced with wmem starting with Wireshark 2.0. You can read more about wmem in Wireshark's <a href="https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob;f=doc/README.wmem;h=e00ad7c09b3c535cc769e612b1fc6a52dec00458;hb=HEAD" rel="nofollow">README.wmem</a> file. Naturall... |
Warnings repeated in storyboard after every restart of Xcode 8 for only one ViewController <p>I have more than twenty viewControllers. I recently updated to Xcode 8. All are fine except one. I solved but it always shows same warnings after every restart of Xcode.</p>
<p>see below screenshot:</p>
<p><a href="http://i.... | <p>I am struggling with these issues since June, when Xcode 8 was released in its second Beta. Once I update many frames to suggested constraints, issues come back again after restarting IDE.</p>
<p>Rather than reconstruction of my full storyboard (as this can be caused by setting constraints in older way), I always u... |
Interesting behaviour of malloc() <p>Here is a code I wrote for <code>GCC</code> compiler.</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
int main()
{
int *p;
p = (int *)malloc(9 * sizeof(char));
p[0] = 2147483647;
p[1] = 2147483647;
p[2] = 1025;
printf("%d, %d, %d, %d\n", s... | <pre><code> p = (int *)malloc(9 * sizeof(char));
</code></pre>
<p>What you are doing is <a class='doc-link' href="http://stackoverflow.com/documentation/c/364/undefined-behavior#t=201609291320373324655">undefined behavior</a> if size of integer is 4 bytes. Because you allocated 9 bytes and used 12.</p>
<p>Casting ... |
Find elements using innerText <p>I use this:</p>
<pre><code>document.querySelectorAll('div.pu-g div.pure-u div.des.3-mb-1 div.ng-spe span.ng-binding.ng-scope[contains(text(),'Stock')]')
</code></pre>
<p>but I receive this error:</p>
<pre><code>SyntaxError: missing ) after argument list
</code></pre>
<p>What I try t... | <p>Since element text is not an attribute, I don't think you can grab it with an attribute selector. You can however, filter the NodeList to return elements that <code>include</code> the word "Stock" in their <code>textContent</code>.</p>
<pre><code>const stocks = [...document.querySelectorAll("div.pu-g div.pure-u div... |
Convert a relational logical schema model(in oracle) into elasticsearch nosql logical schema less <p>Could you please suggest me how to do a schema design(nosql) in elasticsearch.
As per my requirement we have already 'relational logical schema' (which is oracle schema) but we are building new version of software which... | <p>I am new on Elasticsearch and I am not sure if I got your question, but I haven't created a schema on Elasticsearch I just converted my data for json format and indexed it.</p>
|
AngularJS change attribute values <p>I have rows in table which generate buttons dynamically</p>
<pre><code> <tr ng-repeat="task in task">
<td>{{task.Name}}</td>
<td>{{task.Comments}}</td>
<td>{{task.Project}}</td>
<td>{{task.Duration}}</td>
... | <p>By assigning the <code>editable</code> variable to the <code>task</code> object:</p>
<pre><code>$scope.editTask = function(task){
if(task.editable == "glyphicon glyphicon-trash")
task.editable="glyphicon glyphicon-floppy-save";
else
task.editable="glyphicon glyphicon-trash";
... |
Addition speed of numpy arrays with different contiguous-type <p>Numpy arrays are stored with different contiguous types (C- and F-). When using numpy.swapaxes(), the contiguous type gets changed. I need to add two multidimensional arrays (3d to be more specific), one of which comes from another array with swapped axes... | <p>These types (<code>F</code> and <code>C</code>) denote whether a matrix (or multi-dimensional array) is stored in column-major (<code>C</code> as in C language which uses column-major storage) or row-major (<code>F</code> as in Fortran language which uses row-major storage).</p>
<p>Both do not really vary in speed.... |
Vbscript - Multiple lines on vbs script email <p>I use the following code to send automatic emails, passing a parameter in them :</p>
<pre><code>Const schema = "http://schemas.microsoft.com/cdo/configuration/"
Const cdoBasic = 2
Const cdoSendUsingPort = 2
Dim oMsg, oConf
Dim sDateTimeStamp
Set args = WScript.Argume... | <p>Just adding a string concatenation character doesn't automatically insert a newline, you need to use one of the built in constants to define a newline</p>
<pre class="lang-vb prettyprint-override"><code>multi = "aaaaaa " & vbNewLine & _
"FROM NC301B " & vbNewLine & _
"WHERE EDIPROC like 'P30_'... |
com.google.cloud.dataflow.sdk.util.IllegalMutationException in DoFn converting to org.apache.hadoop.hbase.client.Put <p>I am trying to convert an object into a org.apache.hadoop.hbase.client.Put in a DoFn.
I keep getting this error:</p>
<pre><code>com.google.cloud.dataflow.sdk.util.IllegalMutationException: DoFn DataB... | <p>Sorry about your troubles. This is a bug in the cloud Bigtable connector. We fixed this for the upcoming 0.9.3 release.</p>
<p>You have two options to fix this:</p>
<ol>
<li>Upgrade to 0.9.3-SNAPSHOT. You'll need the repositories section from <a href="https://github.com/GoogleCloudPlatform/cloud-bigtable-exampl... |
Difference between specifying objects on 'this' and returning the objects itself in a function <p>I'm a total newbie to javascript. Was just wondering what is the difference between the following when using the controllerAs approach, and why the second approach doesn't work:</p>
<pre><code>angular.module("app")
... | <p>The function you register with <code>angular.module.controller</code> is not a <em>factory</em>, it's a <em>constructor</em>.</p>
<p>The second approach is more often used with Angular services.</p>
|
Reducing the size of the a-frame canvas to show other HTML elements <p>If this is possible, can I change the size of the aframe canvas in code?</p>
<p>I would like to display a form so that users can modify object parameters in the aframe scene. </p>
| <p>See this question. <a href="http://stackoverflow.com/questions/39754553/how-to-remove-fullscreen-styles-in-a-frame-reduce-canvas-size-or-scroll-a-page">How to remove fullscreen styles in A-Frame, reduce canvas size, or scroll a page with A-Frame scene?</a></p>
<p>You can use the <code>embedded</code> component to r... |
Php Dom Query - Get table line with td value <p>I'm trying to extract a table from a website but I get a trouble. I want to keep only the line by giving a <code><td></code> value.
I've tried this : </p>
<pre><code>$xpath->query("//html/body/div[2]/div[3]/div/div[2]/div/div/form/table/tr[3]/td/table/tr/td[@val... | <p>There are few errors in your query. </p>
<p>If you want the table node (which one?) then you should select that node, and not go deeper into cell level, so to get the second table from your examle:</p>
<pre><code>$xpath->query("//table/tr[3]/td/table[tr/td[text() = 'value']]");
</code></pre>
|
Permission to CocoaPods/Specs.git denied <p>Currently getting the following error when I'm trying to do a push.</p>
<pre><code>git:(swift3) git push --set-upstream origin swift3
remote: Permission to CocoaPods/Specs.git denied to paul301.
fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': The requested... | <p>I have the same bug I just change to cocoa pod to 1.0.1... </p>
<p>basically your <code>origin</code> have been changed to <code>https://github.com/CocoaPods/Specs.git</code></p>
<p>you can check with:</p>
<pre><code>â git:(new_version) git remote -vv
origin https://github.com/CocoaPods/Specs.git (fetch)
orig... |
VBA: Rearranging and Exporting an Array to an Excel Worksheet <p>My Problem is as follows:</p>
<ul>
<li><p>Table A is sorted after numbers of type X in the first column;
In each line several numbers of type Y may be associated with one number
of type X;
Numbers of type Y may be associated with different numbers... | <p><code>Range.Value</code> will already return a 2-D array if it contains multiple cells, and your nested loops assume that it has 2 dimensions. However, when you pass a multidimensional array to <code>Array()</code>, it flattens it to one dimension:</p>
<pre><code>myArr = Array(Sheets("MAT-EQ KUT").Range("C5:J1594"... |
javascript button shrinks on Click <p>When clicking the buttons they are shrinking. -How is it possible to prevent the shrinking ?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override">... | <p>The button does not shrink, it's just that the border is of a different colour than the background. Probably the border is of a light colour so on a white background it looks like it's shrinking.</p>
<p>A solution would be to set the border colour to the same colour as the background as in the code below:</p>
<p><... |
Validation for dynamic radio buttons Laravel 5 <p>I want to validate my dynamic radio inputs. I have this in my view
view.blade.php:</p>
<pre><code>echo "<span class='error'>".$errors->first('sar')."</span><td></tr>";
for($i=1; $i<11; $i++){
echo"<td>"; ?>
<input class='radio... | <p>make a Change with</p>
<pre><code>//valida pontas --
$this->validate($request, [
'sar.*' => 'required'
]);
</code></pre>
<p>This is for Laravel 5.2 or greater one</p>
|
IDE indicates that my if else statement is redundant and I need an explanation to why <p>I am a beginner in programming. The Netbeans IDE is indicating that the following if-else statement is redundant:</p>
<pre><code>public boolean x = false;
private void add_labelMouseClicked(java.awt.event.MouseEvent evt) { ... | <p>Just read through the second one. </p>
<p>This part is nice and simple - setting x</p>
<pre><code>x =
</code></pre>
<p>The next part of what is being set</p>
<pre><code>x == false
</code></pre>
<p>it is evaluating what x and checking if its false, if its false set x to true otherwise set x to false.</p>
<p>Si... |
How to increase the layout of text box in angular-2 material <p>In angular material 1 we are having layout property called <strong>flex-gt-xs</strong>.what is the <strong>equvalent to this in angular-2 material</strong> and if any one knows any usable <strong>links for layoute in angular-2 material</strong> please shar... | <p>Looking at their documentation it seems like this feature doesn't implemented yet: <a href="https://github.com/angular/material2" rel="nofollow">Angular material 2 documentation</a>
Look at that big table, and search for "layout" in the first column. It says: Not started.</p>
<p>You can use CSS3 flexbox to achieve ... |
Combining a SQL query result into another query - Join <p>I'd like to take a query result, specifically the RMA number (oe_line.order_no) from query1 and then use that result in the query2 where statement and then join both queries together. Here's my code;</p>
<pre><code>select *
from
(
SELECT
customer.customer_n... | <p>What I understand is something like this. Now the join you want isnt clear.</p>
<pre><code> SELECT *
FROM tableA
WHERE tableA.RMA = (SELECT RMA
FROM tableB
WHERE <somecondition>)
</code></pre>
|
What is causing this XCode 8/iOS 10 compiler warning? <p>I have updated my xcode 8 and running an old app which has been created in 7.3 by convering the swift codes in swift 3. But I am getting the message in log window as below:</p>
<pre><code> objc[19295]: Class PLBuildVersion is implemented in both /Applicatio... | <p>You have a class <code>PLBuildVersion</code> declared in your framework <code>AssetsLibraryServices</code> as well as in <code>PhotoLibraryServices</code>. Because class names are unique Xcode tells you that it will take one of those class declarations, but that it'll keep it a surprise, which one that is. ;)</p>
<... |
Open Crashlytics OSX App manually <p>I have implemented <code>Crashlytics</code> in my iOS app. But when i archive my app <code>Crashlytics</code> OSX app doesn't open.</p>
<p>My question is can we manually open the <code>Crashlytics</code> OSX App?</p>
| <p>Of course you can, actually <code>Crashlytics</code> is a part of <code>Fabric</code> ecosystem.<br>
Go to <code>Applications</code> folder find <code>Fabric</code> app and double click its icon.<br>
<a href="http://i.stack.imgur.com/Wo5ta.png" rel="nofollow"><img src="http://i.stack.imgur.com/Wo5ta.png" alt="enter ... |
Android Studio can't find my JSON file <p>I created a <code>raw</code> Android resource directory in <code>res</code> and added <code>cars.json</code> to it. It shows up on my package explorer. When I try to call</p>
<pre><code>File file = new File("raw/cars.json")
</code></pre>
<p>I get a FileNotFoundException. I've... | <p>To get a <strong>resource from the raw directory</strong> call <code>getResources().openRawResource(resourceName)</code>. </p>
<p>This will give you a <code>InputStream</code></p>
|
My WordPress site speed is very slow <p>I have a WordPress blog www.socialhungama.com
I hosted it on blue host. I have reason able users. But speed of my website is very slow. What I do to boost up my speed.</p>
| <p>I tried to open your site and was suspicious if anything at all was happening, so I captured the traffic to this site using Live HTTP Headers.</p>
<p><strong>144</strong> HTTP request seems like an awful lot to me - your site is also almost 8mb big. </p>
<p>Since loading 8mb usually doesn't take that long and sinc... |
How to connect string with a object method? <p>I have the following problems: I've got 20 files, that I need to fill based on user input. I have the list of strings, which is the list fields name used in all of the 20 files. Now, what I would like to do, is to run each of those strings against each form, so that if fie... | <p>The simpliest way to assign Value to Key is <code>Map</code>. </p>
<pre><code>Map<String, Function<T,R>> mapping;
</code></pre>
|
Rails - two forms in one (ShopifyAPI) <p>Part of the app i'm developing involves a form which has to create a product on the users shopify store and also create a row in my own database for an identical product (with a few extra bits of information). </p>
<p>Where i'm struggling is with the form itself, i can do this ... | <p>You can do like this:</p>
<pre><code>form_tag('/items/submit')
text_field_tag 'item_title'
tag("br")
text_field_tag 'item_profit'
tag("br")
tag("br")
<%= submit_tag 'Save' %>
</code></pre>
<p>Instead of tag("br"), you can directly use < br />.</p>
|
Select all records after the CHAR c <p>I have a column(char) with values between A and Z
I only want to select the records where the char is >= 'C'</p>
<p>Can anyone help me with this?
I tried >= 'C' but this didn't work. Also I couldn't find anything about this on the internet. So I thought it's a good question to as... | <p>You can use the <a href="http://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_ascii" rel="nofollow"><code>ascii</code></a> value for comparison.</p>
<pre><code>select * from tablename where ascii(colname) >= ascii('C')
</code></pre>
|
Using JavaScript to overlay multiple images in Google maps <p>I am wondering if there is a simple way to overlay images in Google Maps using JavaScript and 4 coordinate points. I've seen it done with three points but that doesn't work when your maps sit a bit diagonal on the landscape. I plan to build a database that w... | <p>You can use GrondOverlay </p>
<p>from google dev</p>
<blockquote>
<pre><code> historicalOverlay = new google.maps.GroundOverlay(
'https://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
imageBounds);
historicalOverlay.setMap(map);
</code></pre>
</blockquote>
<p>see this link for... |
The are errors arising in iOS apps with move to iOS 10 from earlier (8 or 9) iOS versions <p>It is a big sudden problem that came with iOS 10. There are several errors I and others report:</p>
<blockquote>
<p>< <em>on new project:</em> ></p>
<ol>
<li>The maximum number of apps for free development profiles... | <blockquote>
<p>I followed upon @Tommy suggestions by cutting more than fifty Apps licensed for 'developer'.</p>
<p>I as well watched WWDC16 presentation "What's New in Xcode App Signing".</p>
<p>These did address my issues 100% so far.</p>
</blockquote>
|
DataTemplate don't change Image <pre><code><DataTemplate>
<Image Name="ServerImageSetter" Source="{svg2Xaml:SvgImage ServerAdministrator2;component/Images/test1.svg}"/>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding ServerKindTrigger}" Value="0"... | <p>You are changing local fields and not the property, which is why it isn't triggering binding updates.</p>
<p>Change your switch/case assignment to assign ServerKindTrigger property.</p>
<pre><code>switch (_serverKind)
{
case Servers.test: ServerKindTrigger = 0;
</code></pre>
|
Decoupling a class which is used by the lots of subclasses <p>Hi I have a situation like that;</p>
<p><a href="http://i.stack.imgur.com/iQhgt.png" rel="nofollow"><img src="http://i.stack.imgur.com/iQhgt.png" alt="enter image description here"></a></p>
<p>I have different items in my design and all these items has som... | <p>You could introduce an interface (abstract class in C++) that <code>Character</code> would inherit. Let's call it <code>ItemUser</code>. The <code>Item#apply</code> signature would be changed so that it would take an object of <code>ItemUser</code> instead of <code>Character</code>. Now you are able to change the im... |
Angular 2 Testing: What's the correct way for async testing? <p>I have the following test in an angular 2 project with karma and jasmine:</p>
<pre><code>let a: any;
beforeEach(() => {
a = {};
setTimeout(() => {
a.test();
}, 1000);
});
it('should work with async and promise', async(() =>... | <p>The zone gets created <a href="https://github.com/angular/angular/blob/2.0.1/modules/%40angular/core/testing/async.ts#L41" rel="nofollow"><em>inside</em> the <code>async</code> method</a>. So your <code>setTimeout</code> (in the <code>beforeEach</code>) is not inside that zone. If you move the <code>setTimeout</code... |
how to write sql syntax to get greater than and less than values from given data? <p>I have a data in sql table column as below</p>
<pre><code>Range
1000000+
2000000+
100001-250000
10001-11000
10001-12500
1001-2000
1001-2500
11001-12000
12001-13000
12501-15000
13001-14000
14001-15000
15001-16000
15001-20000
15001-2500... | <p>If I understood the question correctly, you essentially want determine a count for the number of ranges which size is larger than 6000 and similarly which size is less than 6000.</p>
<p>You can create a CTE which splits the range string into a minimum and maximum values. Next you use a case statement to determine i... |
Flask return multiple variables? <p>I am learning Flash with Python. My python skills are okay, but I have no experience with web apps. I have a form that takes some information and I want to display it back after it is submitted. I can do that part, however I can only return one variable from that form even tho there ... | <p>Flask requires either a <code>str</code> or <code>Response</code> to be return, in you case you are attempting to return a <code>tuple</code>.</p>
<p>You can either return your <code>tuple</code> as a formatted <code>str</code></p>
<pre><code>return '{} {} {}'.format(firstname, lastname, cellphone)
</code></pre>
... |
how to sum in foreach loop in php <p>this is my code i want the sum of the fields but unable to do this any one can help in this regards </p>
<pre><code><?php
$hostname="localhost";
$username="root";
$password="";
$db = "usman";
$dbh = new PDO("mysql:host=$hostname;dbname=$db", $us... | <p>HAVING is a filter on grouped results, not a way to select anything</p>
<p>I would guess you need something like</p>
<pre><code>SELECT
leavetype,
count(*) as cnt
FROM ams
where empid= {$_SESSION['sess_user_id']}
and leavetype in ('Absent', 'Annual','Medical', 'Casual' , 'LWOP') -- if you want only certa... |
Is it possible to use/open a GUI in Eclipse Che? <p>I'm recently working with Eclipse Che and have the task to import a Java Project that opens a GUI in it (like a simple Swing/SWT Calculator).</p>
<p>I am using the Java CentOS Stack, importing the .jar files, etc. is no problem but I get the "No X11 DISPLAY variable ... | <p>You need to set the display variable. The way I did this was modify the run command to set it just before the other commands. </p>
<p>The command I used is:</p>
<pre><code>export DISPLAY=:0.0
</code></pre>
<p>Also note that this worked for a while for me but randomly stop working a few days back so please tell if... |
Cannot initialize an array of struct within a struct <p>I'm trying to create an RPG-esque inventory, my inventory contains a type 'sword' which is an array.
Here's the code for my sword struct:</p>
<pre><code>typedef struct
{
char weaponName[35];
int damage;
int rarity;
float price;
} sword;
</code><... | <p>You can't just start listing stuff inside braces and have the compiler magically figure out what you want. It doesn't work like that, except with initializers. Initializers, e.g.</p>
<pre><code>const sword excalibur = { "Excalibur!", INT_MAX, INT_MAX, FLT_MAX };
</code></pre>
<p>are different from assignment. With... |
Ionic image to a messaging application <p>I need you to click on an image in my application made with Ionic, I will me the possibility to send it by Whatsapp or any other messaging application installed on my mobile.
Can anyone help me as I get?
Thank you very much.</p>
| <p>You should implements this cordova plugin:</p>
<p><a href="https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin" rel="nofollow">Social Sharing plugin for Android, iOS</a></p>
<p>This plugin is supported also by ngCordova:</p>
<p><a href="http://ngcordova.com/docs/plugins/socialSharing/" rel="nofollow">... |
How to delete a line(input) in the list in Python <p>I have a text file which has multiple lines.</p>
<p>the line string format is [studentnumber, course, specialisation]</p>
<p>studentnumber as ID, course name, specialisation</p>
<p>how can i delete the line containing specific ID with user input</p>
<p>for exampl... | <p>Try something like:</p>
<pre><code>import re
id_to_delete = input('Enter ID u want to delete from file: ')
filename = 'test.txt'
get_id = re.compile(r'\d+')
with open(filename, 'r+') as f:
for idx, line in enumerate(f, 1):
line_id = get_id(line)
if line_id is not None and line_id.group() == id_t... |
Enhanced eCommerce, Single Page Application and Tag Manager <p>Our payment flow has just moved to a single page application, so we need to adjust how we're sending Enhanced eCommerce data to Google Analytics. We were receiving eCommerce data fine before the switch.</p>
<p>Our Google Analytics code is injected via Tag ... | <p>if its a single page application dont use send page view.</p>
<pre><code>window.ga("ec:addProduct", {
"id": product.id, // Product ID (string).
"name": product.name, // Product name (string).
"category": product.category, // Product catego... |
How to add more parameters to jquery ajax success and error functions <p>In a jquery ajax success/error function like this:</p>
<p>success:</p>
<pre><code>function (data, textStatus, jqXHR) {
}
</code></pre>
<p>error:</p>
<pre><code>function (jqxr, errorCode, errorThrown) {
}
</code></pre>
<p>Is there a way, I c... | <p>You must apply those variables outside the ajax call or you can use "context:" to pass the context which you will have those variables. What you are demonstrating above is not applicable.</p>
<p>UPDATE -</p>
<pre><code>var data = ["a", "b"];
$.ajax({
type: "GET",
dataType: "json",
conte... |
Upgrading Ember Web Application from 1.2.2 <p>The Ember web application currently in our production environment has the following versions. </p>
<ul>
<li>ember.js - 1.2.2 </li>
<li>ember.data - 0.13 </li>
</ul>
<p>I've found upgrade notes from ember 1.10 onwards in the following guide but the version of ember in o... | <p>I've done such a update a few months ago and here some notes:</p>
<p>First since you are on <code>1.x</code> I think you should directly jump to <code>1.13</code>. This should only break if you use private APIs. Then fix your deprecations and try to jump to the latest <code>2.x</code>.</p>
<p>However there should ... |
convert date in 2015-05-09T09:00:12.123462000 to unix timestamp in hive <p>I want to convert the date which is in '2015-05-09T09:00:12.123462000' format to the unix timestamp in hive. The UNIX_TIMESTAMP('2015-05-09T09:00:12.123462000') doesn't work. I am not sure how i can convert this. I need this to compare two dates... | <p>Your input uses the full <a href="https://en.wikipedia.org/wiki/ISO_8601" rel="nofollow">ISO 8601</a> format, with a "T" between date and time, and fractional seconds. Hive expects an SQL format <em>(i.e. with a space between date and time)</em> as seen in <a href="https://docs.oracle.com/javase/8/docs/api/java/sql/... |
Send an Embed Base64 Image in an email with C# in order to be decoded by gmail <p>I am trying to send an email which has embedded images in the body of the message. </p>
<p>The images are encoded as Base64 string. The contents looks as follows:</p>
<pre><code>"<p><span>My Name</span></p><im... | <p>If you want to attach an attachment to the mail which you send this is not the way. You should add the attachment to the MailMessage</p>
<pre><code>message.Attachments.Add(new Attachment(PathToAttachment));
</code></pre>
<p>If you have the attachment in base64 you should convert it to Stream and use the proper con... |
Sync Bitbucket server repository with another repositry <p>I had a repository hosted on bitbucket cloud which I copied to bitbucket server instance using
<a href="https://confluence.atlassian.com/bitbucketserver/importing-code-from-an-existing-project-776640909.html" rel="nofollow">https://confluence.atlassian.com/bit... | <p>You might try one of the <a href="https://marketplace.atlassian.com/search?q=mirror%20repository" rel="nofollow">mirroring/sync related add-ons</a> available on the Atlassian Marketplace. A couple of them are for outbound mirroring (pushing changes <em>to</em> a remote). I do know that ScriptRunner supports inbound ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.