input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Weird A appearing when I animate an button in html <p>I have a button in html that and I have it so that once the user hovers over the button the text of the button will move to one side and arrows will appear on the other side. However for some reason when I hover over it a funny "A" with a little hat appears. This ha... | <p>This problem is most likely caused by some discrepancy between the character encoding used in your style sheet, and the character encoding used when rendering your web page.</p>
<p>The <code>»</code> character is known as Code Point <a href="http://www.fileformat.info/info/unicode/char/bb/index.htm" rel="nofollow"... |
Class path contains multiple SLF4J bindings <p>I tried to debug my project but got this </p>
<pre><code>SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/storm/lib/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home... | <p>You have 2 sources of dependencies for storm one from /usr/local/storm/lib/ directory and the second from maven which cause multiple binding for sl4j.<br>
Try using just one source of dependencies.</p>
|
How do I need to change My OnClickListener to stop the currentSound and start the new One OnClick <p>Hello I´m right now doing a free course at Udacity to build a translation app.
And there was the task, to get the ListItem of the ArrayList to play a Sound onClick. They said you could do this alone or with the tutoria... | <p>I changed the code in the onClick Method and in the releaseMediaPlayer method. Now the playing sound stops and the new sound starts if I click two times on the play Icon.</p>
<pre><code>public void releaseMediaPlayer() {
// If the media player is not null, then it may be currently playing a sound.
if (play ... |
Iterate over Multidimensional Arry for specific values <p>I am trying to iterate over my multidimensional array to get the index of the selected value for each nested array. For instance, when I run my loop, I am comparing $income to see if it is between the 'Ranges'of each array. When the 'Range' is found I want to ta... | <p>I was able to figure it out thanks to this forum. <a href="https://www.codecademy.com/en/forum_questions/556d9d0ad3292f03fb000558" rel="nofollow">https://www.codecademy.com/en/forum_questions/556d9d0ad3292f03fb000558</a>. Here is my new code. </p>
<pre><code>function incomeTax($income){
foreach(TAX_RATES as $lv... |
How to send custom sound push notification with OneSignal? <p>I am wondering how to send custom sound notification with <code>OneSignal</code>. Unfortunately their docs only cover the sending through the dashboard: <a href="https://documentation.onesignal.com/docs/customize-notification-sounds" rel="nofollow">link</a><... | <p>Ok, seems like <code>"ios_sound": "sound.wav"</code> does the job:</p>
<p><a href="https://documentation.onesignal.com/reference#page-create-notification" rel="nofollow">https://documentation.onesignal.com/reference#page-create-notification</a></p>
|
SQL injection and other vulnerabilities <p>I've written my very first php script.
Now I have several questions:</p>
<ol>
<li>Is it vulnerable to sql injection?</li>
<li>Are there other vulnerabilities?</li>
<li>How do I fix these?</li>
<li>How can I detect those myself in the future?</li>
</ol>
<p>The script:</p>
<p... | <p>It is generally rather difficult to judge the security of a system when only a snippet of code has been supplied. However, this isn't really the place for code reviews like that anyway. So, this is from what I can see.</p>
<p>SQL Injection wise, yes. You are vulnerable. Firstly, you are using the famously insecure ... |
add filter to replace part of a string <p>What would be the correct way to add a filter to replace part of a string in an echo?</p>
<p>The function is this:</p>
<pre><code>function woocommerce_template_loop_product_title() {
echo '<h3>' . get_the_title() . '</h3>';
}
</code></pre>
<p>I tried to imple... | <p><code>function</code> should <code>return</code> value so you can use it or <code>echo</code> value directly:</p>
<pre><code>add_filter( 'woocommerce_template_loop_product_title', 'product_title_mod');
// option 1
function product_title_mod($str) {
return str_replace("h3","h2",$str);
}
// option 2
function pr... |
Based on the object corresponding values should be taken using xslt <p><strong><em>INPUT XML</em></strong></p>
<pre><code> <root>
<file1>
<commodity>
<units>1</units>
<obj>mango</obj>
</commodity>
<co... | <p>Try it this way:</p>
<p><strong>XSLT 1.0</strong></p>
<pre><code><xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:key name="cat" match="category" use="object" />
<xsl:template match="/... |
I don't see any use of flyweight pattern. Is it really useful? <p>To apply flyweight pattern, we need to divide Object property into intrinsic and extrinsic properties. Intrinsic properties make the Object unique whereas extrinsic properties are set by client code and used to perform different operations. </p>
<p>But ... | <p>Sometimes, patterns are not obvious but it doesn't mean they are useless. And I'm afraid you understood the flyweight pattern incorrectly. </p>
<p>The main idea is to minimize memory use by sharing same objects which have already been used before. Usually, there is a data structure internally which is responsible f... |
How to specify command line args and liker of linux assembly used in scons? <p>I'm writing assembly language, program like this:</p>
<pre><code>.data
.equ b,3
.text
.globl _start
_start:
movl $2,%ebx
movl $b,%ecx
movl $1,%eax
int $0x80
</code></pre>
<p>I compile it under ubuntu 64bit version. I wish to get a 32bit ve... | <p>For passing flags to the assembler, ASFLAGS should work.</p>
<p>For passing flags to linker, LINKFLAGS should work</p>
<p>For setting which executable to use for linker, LINK (or SHLINK) should do the trick.</p>
<p>All these are listed in the manpage: <a href="http://scons.org/doc/production/HTML/scons-man.html" ... |
PHP OOP Query Does Not Insert a New Row Into DB <p>I'm working on a custom CMS using PHP OOP and now I have faced a really bad issue ! Basically I have a form like this:</p>
<pre><code><form role="form" method="POST" action="">
<div class="box-body">
<div class="form-group">
&... | <p>Your <code>INSERT</code> statement won't be prepared for binding. Just remove the <code>'</code> before and after the <code>?</code>s. Like so:</p>
<pre><code>$ins = $this->db->prepare("INSERT INTO menu_nav (menu_name, menu_items) VALUES (?, ?)");
... |
How to detect css background url <p>I want to make swipe effect to change background image but it stuck!</p>
<p>This is my code:</p>
<pre><code>
$('#AAA').swipeleft(function() {
var BG = document.getElementById("AAA").style.backgroundImage;
if (BG = "url('../Image/002.jpg')") {
$('#AAA').css('backgroun... | <p>Your conditions should contain == operator. Not a single =. You want to compare those values, not assign.</p>
|
Sync react-router with mobx state <p>Is there any way, how can I store react-router state (location, params, etc.) into my appState object as observable property? I am looking for something similar to <a href="https://github.com/reactjs/react-router-redux" rel="nofollow">react-router-redux</a>.</p>
| <p>The typical way to do this is to update the store representing your navigation state in the <code>componentWillMount</code> hooks of the routed components. When you do this a lot it doesn't feel really "clean" in the long run. For that reason we ended up not using react-router at all, and just parse routes ourselves... |
Bootstrap, Arrays, Large dataset, vba <p>I'm trying to create a bootstrap in VBA using arrays and it is not working. I have a data set of two stocks with data in columns B and C:</p>
<pre><code>16/08/2016 79.84 70.87
15/08/2016 80.26 71.79
12/08/2016 80.22 71.7
11/08/2016 80.56 71.98
10/08/2016 80.55 71... | <p>use arrays</p>
<p>your narrative is not so clear to me as to your exact goal, but you can start from this:</p>
<pre><code>Option Explicit
Sub bstrap2()
Dim start As Double
Dim dataSet As Variant
start = Timer
With Worksheets("Boostrap")
dataSet = Application.Transpose(.Range("B1:B" & ... |
I want MPLAB to reset and continue running after a software RESET instruction in debug mode <p>When running Release code, when the MicroChip PIC code program executes a RESET instructions, the processor is reset, it is in a well defined state, and execution starts from the beginning.</p>
<p>When running in the Debug m... | <p>My solution is to declare a routine as follows, called whenever I want a software reset. The NOP has a breakpoint placed on it, so when <code>vReset()</code> is called, the debugger halts, and I can use MPLABX's reset function (Debug|Reset) to restart the processor myself. The routine executes normally for a release... |
Determine the adjacency of two fibonacci number <p>I have many fibonacci numbers, if I want to determine whether two fibonacci number are adjacent or not, one basic approach is as follows:</p>
<ol>
<li>Get the index of the first fibonacci number, say i1</li>
<li>Get the index of the second fibonacci number, say i2</li... | <p><strong>No need to find the index of both number.</strong></p>
<p>Given that the two number belongs to Fibonacci series, if their difference is greater than the min. number among them then those two are not adjacent. Other wise they are. </p>
<p>Because Fibonacci series follows following rule: </p>
<pre><code>F(n... |
Access web browser tabs programatically | Swift 3 <p>Is it possible to access the open tabs of Safari or Google Chrome? A URL would be good or the title of the tab or both? </p>
<p>The purpose of the app then the user could specify some websites and add labels to them and the app would measure how much is spent on tho... | <p>Use an AppleScript to get the title and the URL of each tab.</p>
<p>You can use <code>NSAppleScript</code> in Swift to run an AppleScript.</p>
<p>An example (<strong>Safari</strong>)</p>
<pre><code>let myAppleScript = "set r to \"\"\n" +
"tell application \"Safari\"\n" +
"repeat with w in windows\n" +
... |
How to dynamically change variable in php <p>I have a token for a specific ID number which is 494</p>
<pre><code>$url = api.pipedrive.com/v1/deals/494/products?start=0&api_token=7ecb71622dadd2faae2732bfe73b09381150c967;
</code></pre>
<p>I want to change the number 494 to any number.</p>
<p>I've made an illogical... | <p>You are using '+' operator to concatenate. Which sums two variable.
You need to use concatenation operator ('.') not '+'</p>
<pre><code>$url = $url.$id.$api;
</code></pre>
|
Wavefront OBJ Model Not Rendering - OpenGL C++ <p>I can't seem to render an OBJ model using <strong>glDrawElements</strong> in C++. </p>
<p>Here is my code:</p>
<pre class="lang-cpp prettyprint-override"><code>#include <iostream>
#include <stdio.h>
#include <vector>
#include <fstream>
#include... | <p>You posted a lot of code, so there could potentially be more errors than the ones pointed out below. Also, even once you load and render your object correctly, it can still not show up for various reasons, e.g. because the coordinates are outside the view volume.</p>
<p>From a quick look, I saw two errors in the co... |
PHP Function Cannot be Run More Than Once <p>I'm working with a custom PHP script that interacts with the Wordpress database and I've bumped into a small issue.</p>
<p>I've written a function that I would like to be able to run multiple times with different variable values sent to it each time it is run, the function ... | <p>Regarding creating functions inside other functions in PHP, you should read this SO Q&A: </p>
<p><strong><a href="http://stackoverflow.com/questions/1631535/function-inside-a-function">Function inside a function.?</a></strong></p>
<p>Like it says, you can do it, but it won't behave as expected. An excerpt from... |
With Client REQUEST_ENTITY_PROCESSING set to CHUNKED I lose documents <p>I have a REST web service that runs on Jetty. I want to write a Java client that chunks along a huge batch of documents to that rest service using the same web connection.</p>
<p>I was able to establish an Iterator based streaming approach here:<... | <p>closing this out - i was accidentally closing the stream early so it was really missing docs <em>at the end</em> which gave me the hint to wait until the blocking queue was empty before shutting down executors. </p>
|
Sed command to strip pattern when found and add it between square [] to following lines until new one is found <p>This is my starting point. </p>
<pre><code>#CHECK THISOUT
------EXAMPLE 1------ ; http://www.idontneed.com
Google ; http://www.google.com
Yahoo ; http://www.yahoo.com
------EXAMPLE 2------ ; http://idontca... | <p>Perl to the rescue!</p>
<pre><code>perl -ne 'if (/^(------.*------) ;.*/) { $h = $1 }
elsif ($h) { print "[$h] $_" }
else {print}' < input > output
</code></pre>
<ul>
<li><code>-n</code> reads the input line by line</li>
<li>if a line contains the patters, it's stored in the <code>$h</co... |
Clangs C++ Module TS support: How to tell clang++ where to find the module file? <p>In his <a href="https://youtu.be/h1E-XyxqJRE?t=45m15s" rel="nofollow">talk</a> at CppCon, Richard Smith mentioned that even though the Module TS support is currently work in progress, it can already be used. So I build clang 4.0 from sv... | <p>You can compile it as follows:</p>
<pre><code>clang++ -std=c++1z -fmodules-ts --precompile -o myclass.pcm myclass.cppm
clang++ -std=c++1z -fmodules-ts -fmodule-file=myclass.pcm -o modules_test main.cpp
</code></pre>
<p>However, this can't be how it's meant to work since you'd manually need to encode the dependenc... |
Store a integer and floating point number from a .dat file in C language <p>Thanks for your kindly attention. I have a .dat file as the format below:</p>
<pre><code>3 10.9
1 2.1
(empty line)
10 10.05
10 200
</code></pre>
<p>For each line, I want to store the first number(integer) into variable a, and store the second... | <p>You're reading your input with 2 "concurrent" routines: <code>fgetc</code> (read a character) and <code>fscanf</code> (read formatted input). The <code>fgetc</code> part consumes the characters in a wrong way.</p>
<p>I suppose you called it because you wanted to check if end of file was reached but that's not the c... |
How do you get data from QTableWidget that user has edited (Python with PyQT) <p>I asked a similar question before, but the result didn't work, and I don't know why.
Here was the original code:</p>
<pre><code>def click_btn_printouts(self):
self.cur.execute("""SELECT s.FullName, m.PreviouslyMailed, m.nextMail, m.le... | <p>It is always difficult to answer without a minimal working example, so I produced one myself and put the suggestion from the <a href="http://stackoverflow.com/questions/39742199/how-do-i-get-the-information-that-the-user-has-changed-in-a-table-in-pyqt-with-p">other post</a> in, modifying it, such that it outputs the... |
Getting error 500 after authentication only on Azure with ASP.NET Core <p>I've been developing an application on ASP.NET Core (.NET v4.6.1) with Entity Framework Core. I'm using the default user authentication that comes with the EF projects. It has been working great for the past few months I've been developing it and... | <p>Okay so I found the problem after a lot of debugging and publishing - It turns out that for whatever reason the VS 2015 publishing wizard does not automatically create an SQL server & DB as part of the new publish wizard, nor does the webapp or Azure itself ever make mention of needing to set this up manually an... |
emberjs set deeply nested undefined key <p>I have a model with a property response, containing a json with various keys and nesting levels</p>
<p>I can bind an input field to a one level missing key, but not more</p>
<p>for example if after loading the model </p>
<pre><code>model.response = { key1: { c1: 12} }
</cod... | <p>We used <code>setUnknownProperty</code> (or <code>unknownProperty</code>) in one of our projects. We didn't make it recursive, it just provides one level of unknown property. (That was enough for us.) So developers can generate crud screens quickly as such:</p>
<pre><code>{{our-input-component "item.x" label=(t "in... |
I want to change my fields name in joomla <p>i have created site based on joomla probem which are facing is that i want to change the name of field in user registration form
C:\wamp\www\Joomla\components\com_users\views\profile\tmpl
but its not working..</p>
<p><a href="http://i.stack.imgur.com/QMbW8.png" rel="nofoll... | <p>Changing ini files isn't the best way because You will lose those changes after an upgrade. Better way is to use Languages Overrides - great native Joomla feature.</p>
<p>You can find it in <strong>Extensions -> Languages -> Overrides</strong>.</p>
<p>Then choose New from top left menu and try to find your label t... |
JavaScript string comparison fails in Node <p>I'm comparing two strings. For some reason no matter how I try to compare them, it appears as if they're not equal but they are.</p>
<pre><code>logger.trace("eval Str: "+util.inspect(evalStr));
logger.trace("Is next():" + evalStr == "next()");
logger.trace("Is next():" + e... | <p>The problem is the <code>+</code> in the <code>trace</code> calls, you're not comparing what you think you're comparing. You want to add explicit <code>()</code> so you're grouping the way you want to group:</p>
<pre><code>logger.trace("Is next():" + (evalStr == "next()"));
// Note --------------------^------------... |
Setting up firebase <p>I want to setup Firebase UI on Android Studio (version 2.1.3). I want to import com.firebase.ui.* but i cant. I have added the following lines to my build.gradle </p>
<pre><code>compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompa... | <p>Have you tried </p>
<pre><code>compile 'com.firebaseui:firebase-ui:0.2.0'
</code></pre>
<p>Because i think you got the wrong gradle link</p>
|
Java main method defination <p>Is this main method ok ?why should we use String[] args</p>
<pre><code>Public Static void main(){
System.out.println("Hello Word");
}
</code></pre>
| <p>The right main method in java is like this:</p>
<pre><code>public static void main(String[] args)
{
//write your code here
}
</code></pre>
<p>The string array is used for command line arguments.</p>
|
Swift: Update UIView using multipeer connectivity <p>I am writing an app using multipeer connectivity framework. One of my device will prepare a list of UIView items and send to the other device. When the other device receive the list, it place it on the view and display. </p>
<p>However, I found that the device can r... | <p>It may possible sub views are back in Hierarchy of views. you can even check this with <strong>Debug view hierarchy</strong> (3D view) as per below image. </p>
<p><a href="http://i.stack.imgur.com/JidS3.png" rel="nofollow"><img src="http://i.stack.imgur.com/JidS3.png" alt="Debug view hierarchy"></a></p>
<p>If your... |
For loop to evaluate accuracy doesn't execute <p>So I've the following numpy arrays.</p>
<ul>
<li>X validation set, X_val: (47151, 32, 32, 1)</li>
<li>y validation set (labels), y_val_dummy: (47151, 5, 10) </li>
<li>y validation prediction set, y_pred: (47151, 5, 10)</li>
</ul>
<p>When I run the code, it seems to tak... | <p>You're main problem is that you're generating a massive number of very large lists for no real reason</p>
<pre><code>for i in range(X_val.shape[0]):
# this line generates a 47151 x 5 x 10 array every time
pred_list_i = [y_pred_array[i] for y_pred in y_pred_array]
</code></pre>
<p>What's happening... |
How to show text on bottom of the image (another div element)? <p>How to show text on bottom of the image (another div element) ?</p>
<pre><code><style type="text/css">
.right{
float: left;
width: 60%;
padding-left: 5px;
}
.left{
float: left;
width: 40%;
max-width: 303px;
}
</style>
<... | <p>So are you looking something like this one- <a href="https://jsfiddle.net/tjbaezid/wk5vskat/2/" rel="nofollow">LiveFiddle</a>
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code> ... |
Hibernate 5 Search with Grails 3 <p>I am using Grails 3.1.4 and I want use Hibernate-Search for full text search of my entities.</p>
<p>In my build.gradle I have included Hibernate 5 and Hibernate Search </p>
<pre><code>compile "org.hibernate:hibernate-core:5.0.9.Final"
compile "org.hibernate:hibernate-ehcache:5.0.9.... | <p>as a coincidence, I am currently porting the old Grails 2 Hibernate Search plugin to be compatible with Grails 3.1.x and Hibernate 5. The original author is up to merge my PR as soon as I create it.
I just finished the development if you want to give it a try:</p>
<p><a href="https://github.com/lgrignon/grails-hib... |
Not printing to file java <p>I am trying to log what my program is doing. Currently I'm using PrintWriter but all it produces is a blank txt file. Can someone please correct my code if possible or give any suggestions.</p>
<pre><code> public class Log {
public static void log(String string){
if(string != null) ... | <p>You have to flush the PrintWriter to get data written in the file</p>
<pre><code>PrintWriter out = new PrintWriter(new FileWriter("log.txt"));
out.println("log ".concat(string));
out.flush();
</code></pre>
<p>If you're done with writing into file you should close the PrintWriter which will also cause data to be wr... |
Swift 3 Error: "Use of unresolved identifier 'cell'" <p>I have a problem in Xcode8/Swift3. I have a UITableView in a UIViewcontroller and I get the Error: <code>Use of unresolved identifier 'cell'</code>.</p>
<p>The code of the <code>ViewContoller.swift</code> is:</p>
<pre><code>import UIKit
class WOWViewController:... | <p>Use the <code>let</code> keyword:</p>
<pre><code> let cell = self.tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! THISTableViewCell
</code></pre>
|
Does Python's distutils set include paths for frameworks (osx) when compiling extensions? <p>I've been working on an extension module for Python but in OSX Sierra it no longer finds headers belonging to the frameworks I'm linking to. It always found them before without any special effort. Has something changed lately r... | <p>I have to pass <code>cc -F /Library/Frameworks</code> for clang 7.2.0 and 8.0.0. Then it can find the headers.</p>
|
A cleaner code? <p>The question is:
Write function d2x() that takes as input a nonnegative integer n (in the standard decimal representation) and an integer x between 2 and 9 and returns a string of digits that represents the base-x representation of n. </p>
<p>I wrote the code below and it's working, however it's mes... | <p>Recursive-way.</p>
<pre><code>def d2x(n, b):
return str(n) if n < b else d2x(int(n / b), b) + str(n % b)
</code></pre>
|
How use controller variable inside a AngularJs directive <p>How use controller variable inside a directive . I used <strong>popoverHtml</strong> inside scope in directive but when i add type like this type not work :</p>
<p>like this : scope: { popoverHtml:'@', type: @ },</p>
<p>my html is :</p>
<pre><code> good <... | <p>You cannot send <code>type</code> as <code>@</code> binding to the directive, if you want to use it inside <code>ng-class</code>. If you do changes to <code>type</code> in main controller, they will not be reflected in <code>ng-class</code> inside the directive. Take look <a href="http://stackoverflow.com/questions/... |
Remove DOM in react.js, <p>How do I remove the item when user clicked x? pass the id to parent and use filter()? In jquery I can just use remove() and that's about it. Very new to react, need guidance.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
<div class="snip... | <p>If you are creating a stateless component and passing props as argument, you can't use 'this.props'</p>
<pre><code>const RenderItem = (props) => {
return(
<ul id="todo">
{props.items.map((item,i) =>
<li className='list-group-item' data-id={item.id} key={i}>
... |
My Error parsing data org.json.JSONException: End of input at character 0 of <p>It return exception when I run the php script.
Here is my java class</p>
<pre><code>public class ShowAllQuestions extends ListActivity {
int cntChoice;
ArrayList<String> selected;
Button getChoice;
// Progress Dialo... | <p>From the description of the error, it looks like PHP returned empty JSON data. I am sure that you have already checked the table to make sure that the queried data exists in the table. </p>
<p>Are you able to check PHP log files? Can you run that PHP script (or a portion of it) on the server from command line so th... |
Time string to milliseconds <p>Okay, I have the following scenario: if I have a string, for example 5d6m9s, how would I make Java recognize that as 5 days, 6 minutes and 9 seconds, and then adding that onto the current milliseconds to get the milliseconds in 5 days, 6 minutes, and 9 seconds. Would substringing be the b... | <h1>ISO 8601</h1>
<p>If not homework, then use the standard <a href="https://en.wikipedia.org/wiki/ISO_8601" rel="nofollow">ISO 8601</a> formats rather than devising your own.</p>
<p>The ISO 8601 standard includes the format <code>PnYnMnDTnHnMnS</code> for a span of time not attached to the timeline. The <code>P</cod... |
CodenameOne How to use resource file of GUI Designer <p>I just created a small test app using CodenameOne without the GuiDesigner. Now I tried to create a UI with the Designer using IntelliJ Idea IDE.
I did the following: </p>
<ul>
<li>Right-click on <code>src</code> package: New -> Codename One Container.
This result... | <p>The designer includes <a href="http://www.codenameone.com/blog/using-the-new-gui-builder.html" rel="nofollow">the old GUI builder and not the new one</a>. I would suggest avoiding it as we are putting all of our resources into the new GUI builder which has a more familiar approach to GUI design using XML and one sou... |
css code partially working? <p>I am trying to design an resume using Html,CSS.while doing this getting error on color display,and change in size. i am sending my zip file with full implementation . There is one image name sample,this is the required resume to be design?kindly help me for this.</p>
<p>Html code given b... | <h1>image path in HTML</h1>
<p>you should not use backslashes in image paths:</p>
<h2>Wrong:</h2>
<pre><code><img src="image\mobile.png">
</code></pre>
<h2>Wright:</h2>
<pre><code><img src="image/mobile.png">
</code></pre>
|
Remove an object when on mobile <p>for my site I have this login screen with a footer on the bottom.
The page is optimized for a desktop monitor and the site itself is already optimized for both pc and mobile, so I don't want to go through the trouble of creating a new mobile version. </p>
<p>I'm not super good at wo... | <p>Use CSS <code>@media</code>:</p>
<pre><code>/* From 0 to 992px Device Width */
@media (max-width: 992px) {
#footer {
display: none;
// Other styles here
}
}
</code></pre>
|
AngularJS simple clock component <p>As I'm currently trying to make a smart mirror system based on angularJS, I started making a clock component as basic. Having done a bit of angular before, but not using component structure, I decided to give that a shot.</p>
<p>The angularJS <a href="https://docs.angularjs.org/tuto... | <p>The issue here is not with <code>$interval</code> but with the localized scoping of <code>this</code>.</p>
<p><code>this</code> is a unique identifier in JavaScript, that is scoped to the particular function that calls it. In the code presented here, <code>this</code> is pointing to the <code>clock()</code> functi... |
ZK Message Box Confirmation <p>I'm using ZK and found some strange behavior. The code:</p>
<pre><code>@Listen("onClick = button#load")
public void load() {
int result = Messagebox.show("Are you sure to execute Load?", "Execute?",
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
log.debug("Resu... | <p>Which version of ZK are you using?</p>
<p>The javadoc says :</p>
<blockquote>
<p>@return the button being pressed (one of {@link #OK}, {@link #CANCEL},
{@link #YES}, {@link #NO}, {@link #ABORT}, {@link #RETRY}, and {@link #IGNORE}). </p>
<p>Note: if the event processing thread is disabled, it always ret... |
Calling read syscall from assembly (x86/64) yields segmentation fault (compiler construction) <p>I am building a compiler for a C-like language, and i'm trying to link a basic "void readString(int, char*)" function implemented in assembly, with assembly generated by my compiler. </p>
<p>The compiled c-like file is</p>... | <p>Ok, as @David Hoelzer suggested i checked again the way "readString" grabs the arguments from the stack and they were reversed in order! </p>
<p>So the first lines of reads.asm will become</p>
<pre><code>_readString:
push rbp
mov rbp, rsp
push rdi
push r... |
Bootstrap 3 accordion menu: Stop the panel open from also opening the page <p>I am developing an Angular JS 1.5 app using Booststrap components. I have an accordion menu on the sidebar which is based upon this:</p>
<p><a href="http://bootsnipp.com/snippets/QXqM1" rel="nofollow">http://bootsnipp.com/snippets/QXqM1</a>
... | <p>Well thanks for the overwhelming response ;-)</p>
<p>I found a solution: Instead of using href for the sub menu titles I now use data-target. Bootstrap interprets data-target and this way Angular JS routing does not get invoked.</p>
<p>In this way the menus can be opened and closed without impact the view. the hre... |
Recursively visiting an `std::variant` using lambdas and fixed-point combinators <p>I would like to visit a <em>"recursive"</em> <code>std::variant</code> using lambdas and overload-creating functions <em>(e.g. <code>boost::hana::overload</code>)</em>. </p>
<hr>
<p>Let's assume I have a variant type called <code>my_v... | <p>Let's pick a simpler example. We want to implement <code>gcd</code> using the fix-point combinator. First go might be something like:</p>
<pre><code>auto gcd = bh::fix([](auto self, int a, int b) {
return b == 0 ? a : self(b, a%b);
});
std::cout << gcd(12, 18);
</code></pre>
<p>This fails to compile wit... |
Is it possible to get the original size of the class/struct before compiler align it? <p>I am looking for a way to get the orginal size of a struct/class before the compiler aligned it ( more clearly let's say the sum of the member fields of the struct/class ) like this :</p>
<pre><code>struct Foo{
char c;
// th... | <p>No. C++ does not offer that functionality. In future, when one of the many reflection proposals will make their way into Standard, you might be able to get sizes of all members. However it is essentually pointless and it is impossible to do what you want. Here is why:</p>
<p>1) In your example <code>struct {char; i... |
How to show Android SeekBar progressChanged value inside SeekBar thumb? <p>I want to show the value of the current progress point in the thumb of an Android SeekBar. This is what I have tried so far:</p>
<pre><code>SeekBar progBar = (SeekBar)FindViewById(Resource.Id.seekBar1);
progBar.ProgressChanged += (objec... | <pre><code>Drawable d = ContextCompat.GetDrawable(this, Resource.Drawable.thumb);
Canvas c = new Canvas();
Bitmap bitmap = Bitmap.CreateBitmap(d.IntrinsicWidth, d.IntrinsicHeight, Bitmap.Config.Argb8888);
c.SetBitmap(bitmap);
d.SetBounds(0, 0, d.IntrinsicWidth, d.IntrinsicHeight);
... |
how to convert decimal to any UTF8 character? <p>I have to write a program in c# which would take a decimal integer as an input and convert/encode it to a UTF8 character and output it. For example:
<br>input: 960
<br>output: Ï</p>
<p>i wrote this much using various code snippets i found on the internet:</p>
<pre><co... | <p>960 - is UTF16 or UTF32 code of your symbol:</p>
<pre><code>BitConverter.GetBytes(960);
{byte[4]}
[0]: 192
[1]: 3
[2]: 0
[3]: 0
Encoding.UTF32.GetBytes("Ï")
{byte[4]}
[0]: 192
[1]: 3
[2]: 0
[3]: 0
Encoding.BigEndianUnicode.GetBytes("Ï")
{byte[2]}
[0]: 3
[1]: 192
Encoding... |
scala creating key value pairs from textfile with multiple entries for values <p>How to create key value pairs in the following format? </p>
<p>Sample Input in a <code>textfile</code>: </p>
<blockquote>
<p>X: a b c</p>
<p>Y: f g </p>
</blockquote>
<p>I want the output to be key value pairs and stored in an <c... | <p>First split using <code>:</code> and then using <code>\\s+</code></p>
<pre><code>val textFile = sc.textFile("hdfs://...")
textFile.flatMap { line => {
val Array(label, rest) = line split ":"
val items = rest.trim.split("\\s+")
items.map(item => (label.trim -> item))
}}
</code></pre>
|
How do I use multiple post_types with WP_Query? <p>I have created custom fields, and am using WP_Query to output them. I have a "visibility section" and "credibility section", with custom post types for each set up in the ACF plugin. My visibility section is working perfectly, but I need to figure out how to add my cre... | <blockquote>
<p>You can pass multiple <code>post_type</code> using <strong>array</strong> in <code>WP_Query</code> argument.</p>
</blockquote>
<pre><code>$args = array(
'post_type' => array( 'visibility_section', 'credibility_section')
);
$query = new WP_Query( $args );
</code></pre>
<p><hr>
Reference:</p>
... |
Replacing the existing MainWindow with a new window with Python, PyQt, Qt Designer <p>I'm new to Python GUI programming I'm have trouble making a GUI app. I have a main window with only a button widget on it. What i want to know is how to replace the existing window with a new window when an event occurs (such as a but... | <p>You probably don't want to actually create and delete a bunch of windows, but if you really want to, you could do it like this</p>
<pre><code>def doSomething(self):
# Code to replace the main window with a new window
window = OtherWindow()
window.show()
self.close()
</code></pre>
<p>The in the <cod... |
OpenGL why send only one model matrix if two models in scene? <p>Im seeing that i must send 1 MVP matrix to the vert shader, but don't i need to send multiple model matrices if i have more then 1 model in my scene?</p>
<p>For example, if i have 2 teapots, each with a different model matrix that has been translated, ro... | <p>Suppose you want to render two teapots with different transformations each. There are two choices:</p>
<ul>
<li><p><strong>Pass the transformation through a uniform.</strong> You will have to set the uniform, render one teapot, update the uniform and render the teapot again. </p></li>
<li><p><strong>Pass the transf... |
Duplicate results in Xpath and not CSS selectors in scrapy <p>So I am playing around with scrapy through the <a href="https://doc.scrapy.org/en/latest/intro/tutorial.html" rel="nofollow">tutorial</a>. I am trying to scrape the text, author and tags of each quote in the <a href="http://quotes.toscrape.com/page/1/" rel="... | <p>Try <code>.//</code> instead of <code>//</code> for your relative searches e.g. </p>
<p><code>print quote.xpath(".//*[@class='text']/text()").extract()</code></p>
<p>When you use <code>//</code>, although you're searching from <code>quote</code>, it takes this to mean an absolute search so its context is still the... |
populate an ArrayCollection dynamically flex <p>I'm trying to populate an <code>ArrayCollection</code> with a <code>json data</code> in order to use it as a <code>dataprovider</code> for a <code>LineChart</code>.
I tried to use the following code however it wouldn't work.</p>
<pre><code>jsonData= (com.adobe.serializat... | <p>This test application works. It uses a stripped down version of your json data. But processes it the same. I also use a different JSON decoder.</p>
<p>The only thing I can think of is that your createDate function is faulty. I used a simple version to demonstrate everything should work as expected.</p>
<pre><code>... |
How to get Monday 00:00 of current week? Swift 3 <p>I'm trying to return Monday 00:00 from my date. This is my code:</p>
<pre><code>func getMonday(myDate: Date) -> Date {
let cal = Calendar.current
let comps = cal.dateComponents([.weekOfYear, .yearForWeekOfYear], from: myDate)
let beginningOfWeek = cal.... | <p>Your code returns the <em>first day</em> in the given week, that may be
a Sunday or Monday (or perhaps some other day), depending on your locale.</p>
<p>If you want Monday considered to be the first weekday then set</p>
<pre><code>cal.firstWeekDay = 2
</code></pre>
<p>If you want the Monday of the given week, ind... |
Better way to add logging or a method that needs to occur in every function? <p>Is there a better way to log or add a method calls to a series of functions without explicitly adding in the function calls?</p>
<p>For example I have a class like:</p>
<pre><code>public class MyClass
{
public void DoStuff()
{
doSomethin... | <p>Use AOP (Aspect Oriented Programming) to inject logging into your code transparently at compile time.</p>
<p>PostSharp is an AOP library for .Net and it uses reflection Attributes to allow you to put markers (aspects) in your code, then a pre-compiler locates those markers and replaces them with the actual code.</p... |
Replace() a string in an array <p>I'm using catNames[2] as a reference point to both be written as is for the viewer to see on the web page, and to make id's for other things bellow.</p>
<p>Thanks!!</p>
<pre><code>var catNames = ["Mittens", "Humperdink", "Ramen & Noodle", "Pampers", "Sing-song"];
var nameCo... | <p>.replace doesn't work this way.</p>
<p>Use:</p>
<p>var nameCoded = catNames.splice(2, 1, encodeURI(catNames[2]));</p>
<p>This allows the old string to be removed and replaced with the desired content.</p>
|
I Can't Convert These to Uppercase <p>In my code i'am trying to test for if the array element is a number and if its a number then set it to itself and go to the next part of the array. If it isnt a number then check if the letter is capital. If its capital set it to the capital value of it in the object and if it isnt... | <p>You should assign <code>y</code> to <code>ina[i]</code> at some point, which currently is not happening. Furthermore you apply <code>y.toUpperCase()</code> when <code>y</code> is already upper case.</p>
<p>I would also suggest to drop the <code>isNaN</code> test. It seems better to test whether the character has a ... |
Is there any way to allow for scrolling in for cells in a tableviewcontroller using storyboards in Xcode with Objective-c? <p>I have a standard tableview/coredata set up that fills (my own class defined) cells with users data as they enter it in. The only problem is, once there are too many cells to fit on the screen, ... | <p>I feel really stupid right now, but i do have the answer if anyone else comes across the same "problem". It turns out that scrolling is automatically enabled and while you cannot scroll down just from swiping down on the touchpad (macbook), actually clicking while scrolling down using the touchpad allows for scrolli... |
Display ListViewItem at Bottom <p>I have a simple ListBox inside a SplitView pane with 4 ListBoxItems in it like this.</p>
<pre><code> <SplitView.Pane>
<ListBox SelectionChanged="ListBox_SelectionChanged" Name="mListBox" Width="250" HorizontalAlignment="Stretch">
<ListBo... | <p>The easiest solution to keep your UI styled similar to what you have now, is just use a second ListBox and place it at the bottom (using a Grid).</p>
<pre><code><SplitView.Pane>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition He... |
Access chrome/firefox image cache <p>Is there a way to tap into Chrome or Firefox's native cache to see what images have been stored by the browser? My app renders the same image at various different widths, and sometimes I would like to use an image at a certain width without having to make another network call to get... | <h3>No. Would you like to let others to search your temporary images folder?</h3>
<p>What you would like to do ist already done by Browsers. If an image already cached, browsers do not make any new request from server.</p>
|
Update a file with Google Drive API V3 <p>how can I replace the content of the file referenced by <strong>fileId</strong> with a new content in <strong>java.io.File newFileContent</strong>. The following function update the content of the file with an empty content</p>
<pre><code>public static void updateDriveFile(Dri... | <p>You should use a combination of FileContent class and update() method with three arguments as shown in the <a href="https://developers.google.com/drive/v2/reference/files/update#examples" rel="nofollow">example</a> below :</p>
<pre><code>import com.google.api.client.http.FileContent;
import com.google.api.services.... |
querying dates in mysql returning nothing? <p>I am trying to query a database table that has values like so</p>
<pre><code>id = 1
tablename = 1 (bigint)
timestampstart = 2011-08-06 13:54:17 (timestamp)
timestampend = 2011-08-06 14:54:17 (timestamp)
</code></pre>
<p>so I'm using this function to try to return the data... | <p>Make use of <code>UNIX_TIMESTAMP()</code> function in your <code>SELECT</code> query to compare the timestamps. Your query should be like this:</p>
<pre><code>SELECT `tablename`
FROM `datas`
WHERE UNIX_TIMESTAMP(timestampstart) <= UNIX_TIMESTAMP('$timestamp')
AND UNIX_TIMESTAMP(timestampend) >= UNIX_TIMEST... |
Android canvas drawRect colour always shows as grey? <p>I'm creating a custom view on Android, but the rendered colour is always grey no matter how I try to change it.</p>
<pre><code>private void init() {
Resources res = mContext.getResources();
float density = res.getDisplayMetrics().density;
... | <p>I seem to have got my required result by changing</p>
<pre><code> mRectPaintPrimary.setColor(mPrimaryColor);
</code></pre>
<p>to </p>
<pre><code> mRectPaintPrimary.setColor(getResources().getColor(mPrimaryColor));
</code></pre>
<p>Or even better</p>
<pre><code> mRectPaintPrimary.setColor(ContextCompat.... |
Display group with minimum average SQL Server <p>I need to create a query which returns the group/s with minimum average value of a column.</p>
<p>Can you please give me an idea on how to do that?
Thanks in advance</p>
| <pre><code> Select Groupname,avg(column) as average
into #temptable
from tablename
group by groupname
Declare @lowvalue INT
select @lowvalue = top 1 [average] from #temptable order by average
select * from #temptable where average = @lowvalue
drop #temptable
<... |
ValueError in computing precision using scikit-learn <pre><code>from sklearn.metrics import precision_score
precision_score(expected, predicted)
</code></pre>
<p>where expected is <code>array([ 4., 3.])</code></p>
<p>and predicted is <code>array([ 2., 4.])</code></p>
<p>I get the foll. error: <code>*** ValueError... | <p>You need the <code>average</code> parameter for <em>multiclass</em> labels.</p>
<p>Else you would need to set <code>pos_label</code> as one of the class labels in both arrays i.e. 2, 3 or 4:</p>
<pre><code>>>> # score for all classes
>>> precision_score(expected, predicted, average=None)
array([ ... |
beginner in OOP in c++, assignment issues <p>This is my first major assignment in OOP in C++.
for my header I have been given the following class definition:</p>
<pre><code>using namespace std;
class Fraction
{
public:
Fraction(void);
Fraction(int aN, int aD);
int getNumerator();
int getDenominator(... | <p>a) It's clear that your method Fraction::adder must return another Fraction object like this:</p>
<pre><code>...
return Fraction(resultingNumeratorHere, resultingDenominatorHere);
</code></pre>
<p>b) Definitely. You have to implement the arithmetics in the cpp</p>
|
What are alternate ways of passing blocks only when block was given? <p>Or simply, how could this code be written in a less repeating version? Or maybe more efficiently?</p>
<pre><code>if block_given?
render(*options, &block)
else
render(*options)
end
</code></pre>
| <p>Use block parameter. It handles both situations.</p>
<pre><code>def foo(*options, &block)
bar(*options, &block)
end
</code></pre>
<p>Example:</p>
<pre><code>def bar(*options)
p options
p yield if block_given?
end
foo(1)
# >> [1]
foo(2) { 'hello' }
# >> [2]
# >> "hello"
</code></p... |
Start new instance of a project using a button in form <p>I have a solution that contains 32 projects, one of which is a Windows form and the others are console applications. In the Windows form I have a combo box that its items are the names of the console application projects with a button.
Now, my problem is that h... | <p>In your button click event, add the following lines, assuming cmbConsoleApps contains the file names of the console applications.</p>
<pre><code>System.Diagnostics.Process.Start(cmbConsoleApps.Text);
</code></pre>
<p>More information about executing applications:
<a href="https://msdn.microsoft.com/en-us/library/h... |
Using jQuery to search for JavaScript assigned values to an object <p>I know this question is a duplicate, but I haven't been able to find anything about it because I can't seem to phrase the right question.</p>
<p>I am working with MapBox.js and created a marker that has a button in its popup message that lets you de... | <p>I looked at the MapBox.js, as it is new to me. It looks very interesting. I tried to understand the problem you have.</p>
<p>But, first, let me respond to the simplified sample code you posted. Better to make sure that jQuery has loaded, before you use it.</p>
<pre><code>$(function() {
});
</code></pre>
<p>The fo... |
how to import scripts as modules in ipyhon? <p>So, I've two python files:</p>
<p>the 1st "m12345.py"</p>
<pre><code>def my():
return 'hello world'
</code></pre>
<p>the 2nd "1234.py":</p>
<pre><code>from m12345 import *
a = m12345.my()
print(a)
</code></pre>
<p>On ipython I try to exec such cmds:</p>
<pre><cod... | <p>First off, if you use the universal import (<code>from m12345 import *</code>) then you just call the <code>my()</code> function and not the <code>m12345.my()</code> or else you will get a </p>
<blockquote>
<p>NameError: name 'm12345' is not defined</p>
</blockquote>
<p>Secondly, you should add the following sni... |
why git reset is not working? <p>This is so problematic, I have just git pull something and then it says there is local change.... I changed nothing... I tried reset hard but it is not useful... Anyone help?</p>
<pre><code>MacBook-Pro$ git reset --hard
HEAD is now at b89fcff the latest code in AWS to identify all diff... | <p>Performing <code>git reset --hard</code> will only affect those files, Git knows about; those that are currently tracked by Git.</p>
<p>When you take the output of <code>git status</code> as a reference, what <code>git reset --hard</code> affects are only those files for which Git has detected modifications which ... |
My app is crashing with navigation drawer <p>I am developing an app in which I have a one time opening activity (named "logIn") followed by my main_activity. With the help of some blogs I was trying to implement a navigation drawer in my main_activity (named "Chats").</p>
<p>my Chats.java file :</p>
<pre><code>public... | <p><code>setContentView()</code> is only called in your <code>else</code> part of the if-else statement. That means if your logic goes into the <code>if</code> part, it will start a new activity like u did BUT it will keep going since you don't finish the activity. </p>
<p>After the if-else, you are doing <code>findVi... |
member function to get the sum in oracle <p>I have a type called <code>sell_type</code> defined as</p>
<pre><code>CREATE OR REPLACE TYPE sell_type AS OBJECT (
dname VARCHAR (50),
car_model VARCHAR(20),
make VARCHAR (20),
price NUMBER (10,2),
MEMBER FUNCTION total_sales RETURN NUMBER
);
/
</code></p... | <p>Summing is an aggregation, a <em>set</em> function. A Type is a single thing; it is not possible for a Type instance to execute an aggregation across all the instances of its peers.</p>
<p>If you want to do such a thing you would need to declare a new type, with a signature like this:</p>
<pre><code>CREATE OR REPL... |
How to transform a user input in rails 4? <p>I am creating an app where users could enter their name that will be returned as chemical symbols (when matching).</p>
<p>So I managed to do in the console like:</p>
<pre><code>symbols = {
"ac" => "Ac",
"al" => "Al",
"am" => "Al",
"br" => "Br",
"ba" => ... | <p>Yes, the method can stay in the model.</p>
<p>Short one: </p>
<pre><code>@convertor.get_chemical(@convertor.name)
</code></pre>
<p>would work but this is not a right way to do that.</p>
<p>Correct way would be to change the method in <code>Convertor</code> class to not accept any arguments, since it is an instan... |
make one checkbox enable all others purely with javascript <p>I'm really struggling with this. I want to use Jquery for this but it's not allowed unfortunately.
So for a little exercise I need to let one checkbox check enable all other checkboxes. No it doesn't need to check them but just enable them.
Here is my HTML c... | <p>Give all of your checkboxes the same class, <del>then assign every checkbox but one the <code>disabled</code> attribute.</del>*</p>
<h3>EDIT</h3>
<p>*No need to hardcode the <code>disabled</code> attribute, the demo has the capability to programmatically change the state of the checkboxes now.</p>
<p>I added a Ja... |
Python: How to connect to a server database? <p>Which modules would you recommand for connecting a SQL database on the server and how to install and use them?</p>
<p>I'm developing with Python and PyQt5 an application which needs results from a server database.</p>
| <p>I suppose it depends on what database you're looking to use. If you're using mysql you might want to check out <a href="https://github.com/PyMySQL" rel="nofollow">https://github.com/PyMySQL</a> . I have been using it and seems to be working out quite nicely. </p>
|
Sublime text 2 HTML autocomplete with ">" character <p>When using Notepad++, I used to simply type <code><div></code> (without pressing <code>tab</code> or anything) and the software would instantly add the closing tag like this : <code><div></div></code>, setting the cursor position between the two t... | <p>In sublime text 2 .. you can type </p>
<pre><code> <d and then a enter
</code></pre>
<p>and you obtain </p>
<pre><code><div></div>
</code></pre>
|
Using joins & then using only a subquery? <p>Okay so I'm doing some SQL revision and I am supposed to do a query to "use a join and not using a subquery, list the publishers who publish psychology books." and came up with this:</p>
<pre><code>SELECT DISTINCT p.pub_name, t.category
FROM publishers p
INNER JOIN titles t... | <p>You can use an IN clause:</p>
<pre><code>SELECT
p.pub_name
FROM
publishers p
WHERE
p.pub_id IN (SELECT pub_id FROM titles t WHERE t.category = 'psychology)
</code></pre>
<p>Alternatively an EXISTS clause which is a little more complex but typically performs better:</p>
<pre><code>SELECT
p.pub_... |
Trouble running .Java file <p>I have a <code>.java</code> file known as "Warning.java" and its location is "C:\Users\chaos\Desktop\NEO-HACK" and I'm trying to run it using "C:\ProgramData\Oracle\Java\javapath\java.exe" but everytime I try to open the file I get an error message saying </p>
<blockquote>
<p>"Error: Co... | <p>You have to compile the code to a .class file before you run. You don't <em>run</em> .java files.</p>
<p>Please go through the <a href="https://docs.oracle.com/javase/tutorial/getStarted/cupojava/index.html" rel="nofollow">Hello World tutorial</a> thoroughly.</p>
|
What data structure is used in apps for modifiable lists? <p>In some apps you have lists of items where you can move items around, delete items, add or insert items, etc.</p>
<p>Normally I'd say an ArrayList would work but apparently a lot of operations are linear time.</p>
<p>Is there a better data structure most pe... | <p>If your priority is inserting and/or removing elements from a collection that maintains an arbitrary order, the the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html" rel="nofollow"><code>LinkedList</code></a> class bundled with Java meets that need. You can very quickly insert or remove a... |
create php variable from string <p>Hello i have a script that extract company names from a string. I want that the extracted names to be converted to php variable. So for example first result Real Coffee Sweeden must be converted to <code>$RealCoffeeSweeden = 0</code> so i can assign a value to it</p>
<pre><code> $tes... | <p>You can try it this way </p>
<pre><code> $my_array = explode("\n", $test);
foreach($my_array as $key => $value {
$my_string = explode(':', $value)
${str_replace(' ','', $my_string[1])} = $my_string;
echo $$my_string;
}
</code></pre>
|
How can I call a class function inside a class using middleclass in Lua <p>I've been trying to figure out how to call a class function inside another class function in Lua, but the way I thought would work doesn't.</p>
<pre><code>local class = require 'libs.middleclass'
local Level = class('Level')
function Level:in... | <p>So Egor answered the question, but did so in the comments. Anyway all I had to do was use self instead of self.Level. Thanks Egor.</p>
|
MySQL Two Queries Producing One Value <p>I need to make a query that selects from two different tables. Basically, I only want to select the rows from the <code>dates</code> table that have no pending orders in the <code>orders</code> table.</p>
<p>For example, the <code>dates</code> table has the values of July 1, Ju... | <p>could be this what you are looking for (i don't know your schema so for the join i have used a column named key</p>
<pre><code>$sql = "SELECT *
FROM dates
LEFT JOIN orders on (dates.date = orders.date and orders.status not in ('PEN','BO', 'FBO'))
WHERE DATEDIFF(CURDATE(), dates.date) &... |
sum values of jtextfields in one jtextfields <p>I want to find the sum of the jtextfields (sht1 to sht13) and put the result in llog jtextfield, but it wont work if i dont put values in every jtextfield (sht1 to sht13)
how can i fix my code so that it takes only the values of the jtextfields that i choose to put valu... | <p>Suggestions:</p>
<ul>
<li>Put your JTextFields into an <code>ArrayList<JTextField></code></li>
<li>In the code above, use a for loop to iterate through this list.</li>
<li>Inside the loop, parse the field. If the parse fails, ignore the NumberFormatException -- but most importantly, don't try to add any resul... |
Print the string, if string in the line ends with specific characters <p>How do I print every string that ends on 'je' in a line</p>
<p>For example : </p>
<pre><code>for line in sys.stdin:
for string in line:
if string ends with 'je':
print string
</code></pre>
<p>And only if the string ends ... | <p>Assuming that your string name dosent allow '?,.' at all, it should work.</p>
<pre><code>for line in sys.stdin:
for string in line:
string = string.strip('.,?')
if string.endswith('je'):
print(string)
</code></pre>
|
How do I use toString to retrieve my information in my class and how do I get my method to calculate the "GPA" in this class? <p>My question is how do I get the gpa that I have listed in my constructor class to compile. Every time I try to compile it, I get a .class expected error. I'm rather new to java so please forg... | <p>calcGpa method can be something like this:</p>
<pre><code>public double calcGpa(double points, int classes)
{
gpa = points / classes;
return gpa;
}
</code></pre>
<p>and for change the toString method you can override it. something like this:</p>
<pre><code>@Override
public String toString() {
... |
Buttons disappear when ad loads <p>I coded an app with some buttons. One of them shows an interstitial Ad by pressing it. When I close the ad all the buttons on the view disappear. How can I fix that?</p>
<pre><code>//Collection Sound
var boomSound = NSURL(fileURLWithPath: Bundle.main.path(forResource: "135936__br... | <p>This is called each time view appear on screen, not when it loads. Move that code inside ViewDidLoad method</p>
<pre><code>//When view is loaded
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
BT6.isHidden = true
BT5.isHidden = true
BT4.isHidden = true
BT3.isHidden ... |
Getting and assigning values to Java arrays? <p>I'm currently learning Java and I've just beginned so my knowledge of it is not very good.
I have a problem with a program I wrote that calculates the first 100 values of the <a href="https://en.wikipedia.org/wiki/Fibonacci#Fibonacci_sequence" rel="nofollow"> Fibonacci s... | <p><a href="https://en.wikipedia.org/wiki/Fibonacci_number" rel="nofollow">Fibonacci number</a> is the sum of the previous 2 numbers:</p>
<p><code>fibonacci(n) = fibonacci(n - 1) + fibonacci(n - 2)</code></p>
<p>So it can be evaluated very nice using recursion:</p>
<pre><code>private static long fibonacci(int n) {
... |
Common ID between Google Drive API and Google Picasa API <p>Google Picasa API and Google Drive API let us access our photos. I would like to use these two APIs in one application but these two APIs don't seem to give common photos ID.
Does anybody know a solution to make sure that a Picasa photo and a Drive file target... | <p>As far as I know, <code>ViewId</code> is an ID common to Google Drive and Google Picasa and this ID can be used or it's equivalent class with <a href="https://developers.google.com/picker/docs/" rel="nofollow">Google Picker API</a>. </p>
<p>With this API, you can create a <code>Picker</code> object using a <code>Pi... |
How do I create a video background screen for my android app? <p>I want to create an intro view activity for my android app that displays a full video background (mp4) and has two buttons for a user to login or register. how would I go about doing this in android studio? I'm fairly new to making android apps.</p>
| <p>Put a <code>VideoView</code> inside <code>RelativeLayout</code> with layout_width and layout_height = "match_parent" in your xml. When you use RelativeLayout, you can place buttons in front of the VideoView.</p>
<p>This <a href="http://stackoverflow.com/questions/3263736/playing-a-video-in-videoview-in-android">li... |
Why is my "try" statement not working? <p>I'm trying to ensure input is numeric, like so:</p>
<pre><code>def fetchtime(stopnum):
try:
val = int(stopnum)
except ValueError:
return "Stop numbers must be numeric!"
n = []
data = "?stopid={}".format(stopnum)+"&format=json"
content =... | <p>Try creating a seprate method of checking the input, like so. </p>
<pre><code>def turn_number(val):
try: # try to see if the input is a string and if it is all numbers
if val.isdecimal():
return int(val) # if it is then just turn it to an integer
else:
return 0 # you can ... |
Limits of hashes comparisons <p>I'm storing hash codes in a file, one hash per line.</p>
<p>When I have a new hash code, I open the file and check if
the hash code already exists and if it doesn't exist,
I save it to that file.</p>
<pre><code>f = open("hashes.txt", "w")
hashes = f.readlines()
hash_code = "ff071fdf1e0... | <p>I would do this:</p>
<pre><code>class Hashes(object):
def __init__(self, filename):
self.filename = filename
with open(filename, 'rt') as f: # read the file only once
self.hashes = set(line.strip() for line in f)
def add_hash(self, hash):
if hash not in self.... |
What is Document class in ace editor <p>Hello guys what is Document in Ace editor I can't get it , am reading the documentation and it keep says Document class please explain here is an example</p>
<pre><code>createEditSession(Document | String text, TextMode mode)
</code></pre>
<p>The Documentation is really poor an... | <p>document class is <a href="https://github.com/ajaxorg/ace/blob/master/lib/ace/document.js" rel="nofollow">https://github.com/ajaxorg/ace/blob/master/lib/ace/document.js</a>, normally you would call createEditSession with a string or array of strings.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.