input
stringlengths
51
42.3k
output
stringlengths
18
55k
Get prepared statements list in mysql <p>As <a href="https://dev.mysql.com/doc/refman/5.5/en/sql-syntax-prepared-statements.html" rel="nofollow">this</a> document says prepared statements are server side statements like functions or procedures (correct me if I'm wrong).</p> <p>But I have some trouble finding defined p...
<p>The doc says</p> <blockquote> <p>A prepared statement is specific to the session in which it was created. If you terminate a session without deallocating a previously prepared statement, the server deallocates it automatically.</p> </blockquote> <p>So Prepared Statements get deleted automtically after the sessio...
SQL get time values between a time range <p>I have to calculate all the time values which are between a particular start time and end time on the basis of a particular time interval on a date in stored procedure in SQL.</p> <p>I have 4 parameters for my stored procedure.</p> <pre><code>@date_value nvarchar(1000),//da...
<pre><code>Declare @date_value nvarchar(1000)='2016-10-09', @starttime TIME(0)= '08:00', @endtime TIME(0) = '13:00', @interval INT = '20' ;With cte(stime) as ( SELECT cast(cast( @date_value as datetime) + CONVERT(CHAR(8), @starttime, 108) as time) union all select cast(dateadd(minute,@interval,stime) as time) f...
How to wait on sequelize executing a findOne <p>I've got a route using Sequelize.js</p> <pre><code>app.get('/api/users/:username', (req, res) =&gt; { const foundUser = getUserByUsername(req.params.username); console.log(`foundUser = ${foundUser}`); return res.send(foundUser); }); </code></pre> <p>the getUserByU...
<pre><code>app.get('/api/users/:username', (req, res) =&gt; { getUserByUsername(req.params.username, function(err, result){ const foundUser = result; console.log(`foundUser = ${foundUser}`); res.send(foundUser); }); }); const getUserByUsername = function(username, callback) { Viewer.findOne({ where: {username} })...
Python - Concatenating <p>I'm going crazy with the following code which should be really easy but doesn't work :/</p> <pre><code>class Triangulo_String: _string = '' _iteraciones = 0 _string_a_repetir = '' def __init__(self, string_a_repetir, iteraciones): self._string_a_repetir = string_a_re...
<p>The relevant bit is in this part:</p> <pre><code>for i in range(0, self._iteraciones, 1): self._string = self._string_a_repetir + self._string + '\n' </code></pre> <p>Let’s go through the iterations one by one:</p> <pre><code># Initially _string = '' _string_a_repetir = '*' _iteraciones = 3 # i = 0 _string...
How to select string between characters? <p>I made this table:</p> <p>Table (Websites)</p> <pre><code>WebsiteID | WebsiteName 2324442 'http://www.samsung.com/us/' 2342343 'https://www.microsoft.com/en-au/windows/' 3242343 'http://www.apple.com/au/iphone/' </code></pre> <p>And I want to be able to <code>S...
<p>You can use <code>SUBSTRING_INDEX()</code> :</p> <pre><code>SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(websiteName, '//', -1), '/', 1) FROM table </code></pre>
How to send PUT request with a file and an array of data in Laravel <p>I am programing a web app using Laravel as API and Angularjs as frontend. I have a form to update product using PUT method with a array of informations and a file as product image. But I couldn't get the input requests in the controller, it was empt...
<p>Try this method:</p> <pre><code>public update(Request $request, $id) { $request-&gt;someVar; $request-&gt;file('someFile'); // Get variables into an array. $array = $request-&gt;all(); </code></pre> <p>Also, make sure you're using <code>Route::put</code> or <code>Route::resource</code> for your ro...
add another timer on already running loop <p>Given the following program - </p> <pre><code>#include &lt;iostream&gt; #include &lt;uv.h&gt; int main() { uv_loop_t loop; uv_loop_init(&amp;loop); std::cout &lt;&lt; "Libuv version: " &lt;&lt; UV_VERSION_MAJOR &lt;&lt; "." &lt;&lt; UV_VERSION_MI...
<p>You are right that loop needs to be stopped before it can register a new handle. It cannot be achieved by calling <code>uv_stop</code> function right after <code>uv_run</code>, because <code>uv_run</code> needs to return first. It can be achieved for example by stopping it using a handle callback. Here is quite sill...
Swift Storyboard List view Not Working? <p>Been following tutorials online to create a scrollable list view in the storyboard.</p> <p>I have done the following</p> <p>View Controller --> Scroll View --> Content View</p> <p>The scroll view is constrained to the View controller. The content view width is constrained t...
<p>try to remove the height constraint for the scrollview, and fix it to the bottom of your parent view.</p>
VS2015 with sdl2 error : "#using needs c++/cli mode enabled" <p>I've been trying to follow lazy foo's productions tutorial on sdl2 and I keep on running into the same issue. I made a template that links to the correct files and all and it worked for a while. But now when I create a project and include iostream for exam...
<p>Don't confuse <code>#include</code>, <code>using</code> and <code>#using</code>. </p> <p><code>#using</code> is used to import class libraries in C++/CLI, which is something you won't ever need unless you work with .NET libraries (but then usually you are better off just using C#, unless you are writing interop cod...
How to customize the payload section of the JWT response <p>What do I need to do to customize the <code>url(r'^auth/login/', obtain_jwt_token)</code> view to allow me to add data to the JWT token</p> <p>I have a django-rest-framework API that is used by independent web applications. What I want is to return to the web...
<p><strong>JWT_RESPONSE_PAYLOAD_HANDLER</strong> Responsible for controlling the response data returned after login or refresh. Override to return a custom response such as including the serialized representation of the User.</p> <p>Defaults to return the JWT token.</p> <p>Example:</p> <pre><code>def jwt_response_pa...
autocomplete jQuery.noConflict <p>I want to add a new autocomplete input to an existing page, that already uses a bundled version of jQuery. Therefore I need to use <code>jQuery.noConflict()</code>.</p> <p>Outside of this page my code works fine, but on the existing page I don't know how to get it to work.</p> <p>I a...
<p>Sorry, but I did also e few changings to the code. So here is how I get it to work:</p> <pre><code>&lt;script src="https://code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt; &lt;script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="https://code.jquery.com/u...
Display:none or visibility:hidden on body element on page load - does it affect SEO? <p>I am building a web page and I do some JS calculations and styling to make fancy things. However, I am stuck with <a href="https://en.wikipedia.org/wiki/Flash_of_unstyled_content" rel="nofollow">FOUC</a>. First I call the required ...
<p>As long as you are not hiding keywords or spamming with content there should be no issue. </p> <p>For more you can check this topic on <a href="https://productforums.google.com/forum/?hl=en#!category-topic/webmasters/crawling-indexing--ranking/9IJHC83yge8" rel="nofollow">Google Webmaster Central</a> forum:</p> <b...
Passing data from activity to fragment causes "ScrollView can host only one direct child" error <p>I am making an app using <a href="http://www.androidhive.info/2014/07/android-custom-listview-with-image-and-text-using-volley/" rel="nofollow">this</a> tutorial. I made some changes in my code, ie I wanted to get data fr...
<p>you are adding your fragment to your sliding tab view. you wrote :</p> <pre><code>fragmentTransaction.replace(R.id.sliding_tabs, restaurantsFragment); </code></pre> <p>tab layout is a child of horizontal scrollview see documentation: <a href="https://developer.android.com/reference/android/support/design/widget...
OR condition in css for screen width and parent div width, . Media query based on parent element width <p>How to write media query based on screen width and parent element width .</p> <p>currently i create a <code>php</code> plugin which generate some <code>html</code> output . That <code>html</code> out put is respon...
<p>You can add css attribues with jQuery too.</p> <pre><code>if (width&lt;450){ $(".mydiv").css({ height: '450px', backgroun: '#000', position: 'absolute' }) } // or ... $(".mydiv").parent().css .... </code></pre>
Problems with swedish letters MySQL and LAMP <p>I have struggled with this some time. I could not get it to work.</p> <p>On the url <a href="http://course.easec.se/problem.pdf" rel="nofollow">http://course.easec.se/problem.pdf</a> I have put together what I have done so far!</p> <p>Any suggestions?</p> <pre><code>&l...
<p>Directly below</p> <p><code>$conn = new mysqli($servername, $username, $password, $dbname);</code></p> <p>add</p> <p><code>$conn-&gt;set_charset("utf8");</code></p> <p>Note: In addition you should also make sure that the charset of your HTML (in the <code>&lt;head&gt;</code> tag) is set to <code>utf-8</code>, li...
Software Architecture: OpenGL Shader creation and compilation <p>I'm about to refactor some parts of a rendering engine, and wonder if a shader should really know it's OpenGL context. Currently, each shader has a bind() and compileShader() method - which do nothing else but call the OpenGL context for the actual task. ...
<p>When it comes to OpenGL and OOP programming no clear cut answers can be given. Due to the way the OpenGL API mixes global state, certain object types confined to a single context and other object types shareable among multiple contexts it's very difficult, if not impossible to perfectly map OpenGL into a OOP model.<...
Java construrctor with string params <p>How can I extract attributes values from the string parameter ?</p> <pre><code>public class Pays{ public Pays(String paysDescriptions) { //implementation } } pays= new Pays("p1:Europe:France, p2:Amerique:Canada"); </code></pre> <p><strong>Edit:</strong></p> <p>I g...
<p>You should try using <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String)" rel="nofollow">String.split(String regex)</a> API.</p> <ol> <li>Break the parameter <code>paysDescriptions</code> using comma(<code>,</code>) as <code>regex</code>, then</li> <li>Break the individua...
Why won the if statement execute? <p>I wrote a simple program in Java which writes a word backwards. Trying to check if "hello" works. In <code>if</code>-statement I'm checking that string is equal to "olleh". Could anyone see why the if statement won't execute.</p> <pre><code>public class MyProgram { public stat...
<p>If you will initialize <code>y</code> variable to empty string instead of space your if-statement will execute and print "nice". Also you do not need a <code>temp</code> string as you don't use it. You probably want to return you reverted string back (alternatively you can make your method void and remove the return...
Vulnerabity Libpng library <p>I'm using this library for scanning and cropping images but after publishing my apk in the google console developer I get this alert and the apk is rejected :</p> <blockquote> <p>Libpng library The vulnerabilities were fixed in libpng v1.0.66, v.1.2.56, v.1.4.19, v1.5.26 or higher. Y...
<p>try this sollution i found it on OpenCV site:</p> <p><a href="http://answers.opencv.org/question/98805/need-update-opencv-manager-apk-for-google-play-warning/" rel="nofollow">http://answers.opencv.org/question/98805/need-update-opencv-manager-apk-for-google-play-warning/</a></p>
loading log4j.properties for log4j2 <p>please check the attached image of project structure, let me know if i positioned log4j2.properties right. also have a look at versions of jars I am using. I wrote a simple program to print logs on console. in order to achieve this I wrote log4j2.properties file as follows.</p> <...
<p>Without any feedback on the error you are getting, I can guess that one of the problems is with the file name. You should specify the absolute path to your log4j2.properties file when you are setting the system property:</p> <pre><code>System.setProperty("log4j.configurationFile","/absolute/path/to/log4j2.propertie...
Read characters with scanf("%c, &ch); <p>I must enter characters with white spaces between them. For example, + / 8 7 - 9 '\n' (when I press Enter) Then I write them in an array of characters and in it have something like this: +/89-9.</p> <p>How can I skip these white spaces?</p> <p>I tried to write something, but i...
<p>You were fairly close</p> <pre><code>scanf(" %c", &amp;ch); </code></pre> <p>From the <a href="http://en.cppreference.com/w/cpp/io/c/fscanf" rel="nofollow">docs</a>:</p> <blockquote> <p>whitespace characters: any single whitespace character in the format string consumes all available consecutive whitespace ch...
Can't figure out why my switch isn't working. Seems to not be recognizing the cin input <p>I'm confused as to why my switch won't work, even though I have it set to an integer value. I'm going to be adding more to the program later; just right now trying to initiate options from the menu using a switch.</p> <p>My swit...
<p>A space is required between the word <code>case</code> and the actual value for each of the cases. So <code>case1</code> should actually be <code>case 1</code>. So for your code, this:</p> <pre><code> case1: /*...*/ case2: /*...*/ case3: /*...*/ </code></pre> <p>Should be changed to this:</p> <pre><code> ca...
Unique index or primary key violation while trying to map Map<Integer,String> in hibernate <p>i am using H2 embedded db and Hibernate 5. I am trying trying to map a HashMap in hibernate this way:</p> <pre><code>@Entity public class TestMapping { @Id @GeneratedValue private Long id; @ElementCollection...
<p>This seems to be a problem H2. This man had similar problem: <a href="http://h2-database.narkive.com/nDbNwitd/h2-unique-index-or-primary-key-violation-primary-key-on-page-index-error" rel="nofollow">http://h2-database.narkive.com/nDbNwitd/h2-unique-index-or-primary-key-violation-primary-key-on-page-index-error</a></...
Accessing localserver through Android <p>I have this code:</p> <pre><code> @Override public void onCreate(Bundle savedInstanceState) { try { super.onCreate(savedInstanceState); InetAddress ip; mWebview = new WebView(this); mWebview.getSettings().setJavaScriptEnabled(true); ...
<p>You don't have to dynamically request for your server's IP. Or do you? What you can do is get the static IP address of your server (by checking your server's IP configuration) and change to this</p> <p><code>mWebview .loadUrl("http://your.ip.address.here/Lab4/Task1/index.php");</code></p> <p>and remove your</p> <...
gulp sass relative paths <p>sass gives an error message</p> <pre><code>Error: File to import not found or unreadable: helpers/mixins.scss Parent style sheet: .../temp/styles/all.scss on line 1 of temp/styles/all.scss &gt;&gt; @import 'helpers/mixins.scss'; ^ </code></pre> <p>at this point, the code looks li...
<p>In your gulp file you can declare sass paths, eg.</p> <pre><code>var sassPaths = [ 'node_modules/bootstrap/scss', 'node_modules/fotorama' ]; </code></pre> <p>These are relative to your gulp file. </p> <p>Then set include paths inside your list of sass arguments</p> <pre><code>.pipe(sass({ errLogToConsole...
how to convert DateTime format [2016-10-05 11:58:04] using DateTime::createFromFormat <p>i am trying to display a stored DateTime with this format [2016-10-05 11:58:04]. What i want to do is, display the stored date into this readable format [Wed, Oct 10, 2016].</p>
<p>you can use the method <code>format</code> to choose what to display :</p> <pre><code>&lt;?php $d = DateTime::createFromFormat("Y-m-d H:i:s", "2016-10-05 11:58:04"); var_dump($d-&gt;format("c")); </code></pre> <p>look the help here : <a href="http://php.net/datetime.format" rel="nofollow">http://php.net/datetime....
MySQL fetch_assoc() shows 1 less result <p>i have a table like below:</p> <pre><code>hub dep A B A C B D B E B F E G </code></pre> <p>i use mysql select to get query and my code is like below:</p> <pre><code>$sql = "SELECT dep FROM handd WHERE hub='B'"; $result = $conn-&gt;query( $sql ); ...
<pre><code> $row = $result-&gt;fetch_assoc(); </code></pre> <p>This line stores the result of 'B D'. It actually should be:</p> <pre><code> $sql = "SELECT dep FROM handd WHERE hub='B'"; $result = $conn-&gt;query( $sql ); while($row = $result-&gt;fetch_assoc()) { echo "id: " . ...
Some "train" columns aren't present in "test" <p>everyone.</p> <p>I have a problem. I have to realize a kNN classification on R using LOO. I've found packages "knncat" and "loo" for this. And I've written the code(without LOO):</p> <pre><code>library(knncat) x &lt;- c(1, 2, 3, 4) y &lt;- c(5, 6, 7, 8) train &lt;- dat...
<p>Well, there are some problems with your approach and <code>knncat</code>:</p> <ol> <li>You have to specify class labels for the <code>train</code> and <code>test</code> data sets and set <code>classcol</code> accordingly. </li> <li>Only class labels which appear in train must be present in test. </li> <li>The colum...
How to use MetaTrader4.Manager.Wrapper to create an account and change password? <p>How to use MT4 ManageAPI to create an account and change password? Can you show me a demo?</p> <p>Thank you very much!</p>
<p>UserRecordNew method should be used to create new user and UserPasswordSet to update password:</p> <pre><code> using (var mt = new ClrWrapper (new ConnectionParameters { Login = 123456, Password = "managerPassword", Server = "serverIp:serverPort" })) { var user = new UserRecord { Group...
How to calculate sum with two variables? <p>I'm trying to express a fuction with two variables, e.g:</p> <p><img src="http://i.stack.imgur.com/hUIdJ.jpg" alt="Fuction"></p> <p>where <code>S(i,j)</code> is a matrix, <code>j=1:100</code>, <code>i=1:50</code>.</p> <p>The denominator part is easy</p> <pre><code>for j=1...
<p>First of all, in matlab you dont need the loop to get the sum for the denominator.</p> <p><code>sum()</code> can get the dimension along which you wish to sum over as the second input argument. second, in order to get the other expression you simply need to creat a temporary matrix for the multiplication in your ma...
Laravel 5 Eloquent ORM select where - array as parameter <p>I'm getting grade_id from the database:</p> <p><code>$grade_id = DB::table('grades')-&gt;where('teacher_id',$teacher_id)-&gt;select('grade_id')-&gt;get();</code></p> <p>and then I want to use that grade_id array in the where eloquent clause so I run</p> <pr...
<p>Depending on laravels version your <code>$grade_id</code> is either an array or a collection of objects. What you need is an array or a collection of values. You can achieve that using the <code>pluck()</code> method insted of <code>select()</code> like IzzEps suggested.</p> <p>But you can get the same result by p...
Maximum recursion depth exceeded in python <p>I am trying to make power function by recursion. But I got run time error like Maximum recursion depth exceeded. I will appreciate any help!! Here is my code.</p> <pre><code> def fast_power(a,n): if(n==0): return 1 else: if(n%2==0): retur...
<p>You should use <code>n // 2</code> instead of <code>n / 2</code>:</p> <pre><code>&gt;&gt;&gt; 5 // 2 2 &gt;&gt;&gt; 5 / 2 2.5 </code></pre> <p>(At least in python3)</p> <p>The problem is that once you end up with floats it takes quite a while before you end up at <code>0</code> by dividing by <code>2</code>:</p> ...
AggregateByKey fails to compile when it is in an abstract class <p>I'm new to both Scala and Spark, so I'm hoping someone can explain why aggregateByKey fails to compile when it is in an abstract class. This is about the simplest example I can come up with:</p> <pre><code>import org.apache.spark.{SparkConf, SparkCont...
<p>If you change:</p> <pre><code>abstract class AbstractKeyCounter[K] { </code></pre> <p>To:</p> <pre><code>abstract class AbstractKeyCounter[K : ClassTag] { </code></pre> <p>This will compile.</p> <p><strong>Why</strong>? <code>aggregateByKey</code> is a method of <code>PairRDDFunctions</code> (your <code>RDD</co...
understanding file input output <p>hi i have some problem understanding my lecture material and thought maybe someone here can help me understand it a bit better </p> <p>this is the example i have in lecture</p> <pre><code>private void readFileExample (String inFilename){ FileInputStream fileStrm = null; Inpu...
<p>It doesn't matter how you input file name. </p> <p>It can go like this: <strong>String fileName = new String("myFileName");</strong></p> <p>or the way you have: </p> <p><strong>Scanner sc = new scanner (system.in);</strong></p> <p><strong>filename = sc.nextline();</strong></p> <p>Then after you set the fileName...
I want to catch the exception when I assign a varchar string to numeric variable <p><strong>My code is as below</strong>:</p> <pre><code>set serveroutput on; declare a number(3); alta exception; pragma exception_init (alta, -06550); begin a:=&amp;numberl; dbms_output.put_line(a); excepti...
<p>I guess you want to catch ORA-06502</p> <pre><code>declare a number(3); alta exception; pragma exception_init (alta, -06502); begin a:=&amp;numberl; dbms_output.put_line(a); exception when alta then dbms_output.put_line('this is your exception'); end; </code></pre>
how to repopulate a form in codeigniter <p>I am trying to repopulate a codeigniter form, when I click the submit button the form input disappears. I have tried to use the set value function but its not working, I am auto loading the form helper. </p> <p>form view </p> <pre><code> &lt;?php $attributes= array('id'=&gt;...
<p>The problem is in this block of code</p> <pre><code>} else { $data = array('reg_errors'=&gt; validation_errors()); $this-&gt;session-&gt;set_flashdata($data); redirect('User/index'); } </code></pre> <p>You cannot use redirect with form_validation in this way and retain the instance of <code>form_validation...
making a text document a numeric list <p>I am trying to automatically make a big corpus into a numeric list. One number per line. For example I have the following data:</p> <pre><code>Df.txt = In the years thereafter, most of the Oil fields and platforms were named after pagan “gods”. We love you Mr. Brown. Chad...
<p>You already do kinda have numeric line # associations with the vector (it's indexed numerically), but…</p> <pre><code>text_input &lt;- 'In the years thereafter, most of the Oil fields and platforms were named after pagan “gods”. We love you Mr. Brown. Chad has been awesome with the kids and holding down the ...
How to stop div collapsing over other html content <p>I've been trying to code a website to have the main section fill 100% of the screen on all devices (i.e. the logo, navbar, slider and quote fill the whole screen, then you scroll down and the next section is 'Contact Me'). On my laptop screen and iPhone 6 it looks c...
<p>You have this CSS rule in there:</p> <pre><code>.firstSection { height: 100%; width: 100%; background-color: #EDF4ED; } </code></pre> <p>Change <code>height</code> to <code>min-height</code> in there and add <code>height: 100%</code> to <code>body</code>:</p> <pre><code>.firstSection { min-height:...
How to get list of all music in specific directory and all subdirectories using MediaStore <p>What I need is to get result like from this code</p> <pre><code>ContentResolver musicResolver = getActivity().getContentResolver(); Uri musicUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; Cursor musicCursor = musi...
<pre><code> searchpath = "%" + yourpath + "%";// looking for path string ContentResolver musicResolver = mContext.getContentResolver(); Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; Cursor musicCursor = null; try { musicCursor = musicResolver.query(uri, new String[]{ ...
How to add SharePoint Online PowerShell to Visual Studio Code and Cmder <p>I installed <strong>SharePoint Online PowerShell</strong> to interact with Office 365 sites, I would like SharePoint Online PowerShell to be added as an option to <strong>Visual Studio Code</strong> terminal and also how to add it to <strong>Cmd...
<p>For <a href="https://code.visualstudio.com/" rel="nofollow">Studio Code</a> install <a href="https://github.com/PowerShell/PowerShell/blob/master/docs/learning-powershell/using-vscode.md" rel="nofollow"><code>PowerShell Extension</code></a> which provides PowerShell language support for Visual Studio Code.</p> <p>O...
UWP support for opengl <p>guys. I have a opengl library written in c++. I know that I can use Angle but because of this I will need to code in C++ my whole app. Is there a way to use c++ opengl in UWP and still use C# as a main language?</p>
<blockquote> <p>Is there a way to use c++ opengl in UWP and still use C# as a main language?</p> </blockquote> <p>ANGLE is currently the only way to get the OpenGL API to run in UWP. More details please reference <a href="https://social.msdn.microsoft.com/Forums/en-US/ae97534f-8f48-4bf9-ae7e-2c7a12e75190/uwp-opengl-...
CSS width property for image <p>I want a 1200x300 resolution image on my webpage with width equal to the screen size and a height of 500px. My code doesn't seem to work. This is my CSS: </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <...
<p><strong>Try this:</strong></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.fix img{ width:100%; height:500px; }</code></pre> <pre class="snippet-code-html lang...
Really simple Java code not working <p>I am an absolute beginner to programming and I've started with java. I wrote this code and I just don't know what's wrong with it.</p> <pre><code>public class multiples3and5 { public static void main(String[] args) { for (int mult3 = 0; mult3 &lt; 1000; mult3 += 3); ...
<p>You didn't start your code block properly. At the end of the <code>for</code> loop declaration, you put a semicolon instead of an opening curly bracket <code>{</code>. Without code, this just looped through and removed the <code>mult3</code> variable from the scope, because it was declared for the loop.</p> <p>This...
Bean Annotation to override XML definition - Spring <p>My spring-boot application has another library project included as a dependency. This library project has a spring.xml file where a number of beans defined. One of these beans has another external dependency injected which I don't need in my project. Hence this is ...
<p>Define a bean in your local java config with the same name and type as the one inherited in the spring.xml file. </p> <p>Annotate your bean with <a href="http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/annotation/Primary.html" rel="nofollow">@Primary</a> which will make yours used ...
TypeError: Cannot read property 'plugins' of undefined for cordovaLocalNotification plugin <p>I am developing hybrid application by using ionic platform. I am implementing cordovalocalnotification features but it prompt out with cannot read property 'plugins' of undefined. The following is my code. Anyone can help me t...
<p>Use <code>window.cordova.plugins</code> instead of <code>cordova.plugins</code></p> <pre><code>if (window.cordova &amp;&amp; window.cordova.plugins.Keyboard) { //cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); window.cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); } </code></pre>
How to extract strings from a file in PHP <p>I have a txt file.</p> <p>source.txt:</p> <pre><code>test.com,Test www.cnn.com,CNN twitter.com,Twitter </code></pre> <p>I want to print it like</p> <p>Output:</p> <pre><code>&lt;a target="_blank" href="http://test.com"&gt;Test&lt;/a&gt; &lt;a target="_blank" href="http:...
<pre><code>// explode file by end off line $array = explode("\n", file_get_contents('/home/source.txt')); // here $array[0] should be "test.com,Test" // lets loop foreach($array as $item) { // now create array from our line of text $data = explode(",", $item); // output echo '&lt;a target="_blank" h...
How to compare each value returned by web_reg_save_param function with another parameter in Load Runner <p>I am working on Load Runner 12.53. I have one web_reg_save_param function with ORDINAL as below: web_reg_save_param("paramname","LB=","RB=","ORDINAL=ALL",LAST); It will return some vales lets say my parameter nam...
<p>see C function <strong>strcmp()</strong> and loadrunner function <strong>lr_eval_string()</strong></p>
Page name as a php variable <p>I am working on a project that requires me to redirect the user to a php page. And the name of the page to be redirected to is stored as a php variable.This is what I tried. Suppose <code>$var</code> is the name of the php file. I want to do something like this,</p> <pre><code>if(conditi...
<p>You simply need to follow string concatenation here. Try this:</p> <pre><code>if (condition) { header("Location: ".$var.".php"); } </code></pre> <p>Refer to <a href="http://php.net/manual/en/language.operators.string.php" rel="nofollow">String Operators</a></p>
why does the debug mode not work well when using R-Devel? <p>I am trying to test the new R-Devel using Rstudio and I see there are some issues with the debugging mode like:</p> <ul> <li>green arrow is missing</li> <li>Traceback is dim</li> </ul> <p>is there a reason for this?</p>
<p>There are some known issues with RStudio and the latest versions of R-devel, due to a change in the memory layout of some internal C structures in R used by RStudio for the debugger.</p> <p>Unfortunately, the changes required to accommodate this have not yet landed in RStudio.</p>
Windows batch script to rename files that have random names? <p>I need to make windows batch script to rename files that have random names. I have a folder with thousand .txt files, their names are completely random, I want to rename first 5 files in that folder to <code>file1.txt, file2.txt,file3.txt, file4.txt,file5....
<p>Is this okay?</p> <pre><code>@ECHO OFF (SET f=C:\Test) IF /I "%CD%" NEQ "%f%" PUSHD "%f%" 2&gt;NUL||EXIT/B SET "i=5" FOR %%A IN (*.txt) DO CALL :SUB "%%A" EXIT/B :SUB IF %i% GTR 0 REN %1 File%i%.txt SET/A i-=1 </code></pre> <p>Just change line two if your stated directory path\name has changed.</p>
Need help writing an SQL query for a select statement <p>I need help with an SQL query. I want to show lines from my test_related_orders table where the current user id equals the user_id in my test_related_orders table and where order_unlock_time (from my table) is &lt;= acutal timestamp. Until here all works fine. B...
<p>First problem to solve is getting the order number from the post_title so that you can compare the values in your inner join. A primitive way of doing this, assuming the order number is always in form AA-DDDD-DDD would be</p> <pre><code>SELECT right(post_title, 11) as posts_order_number </code></pre> <p>As you've ...
How to set a single color to values bigger than 0 but smaller than 1? <p>I have a matrix of nxn, for example: </p> <pre><code>[ 0 1 1 ; 0.2 1 0.1; 0 0.4 0] </code></pre> <p>I want to visualize my matrix and I want:</p> <ul> <li>All values = 1 to be black</li> <li>All values between 0 and 1 (0 &lt; va...
<p>The following solution builds color map, and use <code>ind2rgb</code> to create RGB image: </p> <ul> <li>Convert A to "indexed image" (expand by 256, and round) - indexed image elements must be integers. </li> <li>Create color map meeting range conditions.</li> <li>Use <code>ind2rgb</code> for converting X to RGB...
How to group set of time under distinct date from csv file <p>hi i have just gotten a set of time and date data from csv file using regex:</p> <pre><code>datePattern = re.compile(r"(\d+/\d+/\d+\s+\d+:\d+)") for i, line in enumerate(open('sample_data.csv')): for match in re.finditer(datePattern, line): date...
<p>Try this regex:</p> <pre><code>r"(\d+/\d+/\d+)\s+(\d+:\d+)" </code></pre> <p><a href="https://repl.it/DrqS/2" rel="nofollow">Python code</a> follows, I have used dictionary of lists for such grouping</p> <pre><code>import re datePattern = re.compile(r"(\d+/\d+/\d+)\s+(\d+:\d+)") dateDict =dict() for i, li...
Restrict Access To Certain File From Other Programs And Users While Running <p>I am in process of building an app which writes data continuously to a file. When I start the program the file is created and starts being written to. <br> However I noticed that <strong>sometimes</strong> if I have Windows Explorer open, ac...
<p>You can change the last parameter from <code>System.IO.FileShare.ReadWrite</code> to <code>System.IO.FileShare.None</code>.</p> <p>That locks the file in <code>location</code> exclusively as long as this stream is open and no other app can read, modify or delete that file except your own <code>FileStream</code>.</p...
Sql Exception in count query with joins <p>I have a problem with following code</p> <pre><code>public long findDataCount(EntityUiBean entityUIBean){ long count = 0; StringBuffer sql = new StringBuffer(); sql.append("select count(a.id) from") .append(" entity_listing a left oute...
<p>You have <code>WITH</code> keyword in place of <code>AND</code> (I took the query from your <em>stack trace</em>)</p> <pre><code>SELECT Count(a.id) FROM entity_listing a LEFT OUTER JOIN relation_master d ON d.entity_id = a.id, entity_location b LEFT OUTER JOIN city_master ...
Android Updating A TextView From A Different Activity <p>I'm new to android and not 100% certain I have the terminology of my question correct, but here it is.</p> <p>I have a layout that has a <code>TextView</code> that I want to reflect a setting. The problem I am facing is that the Setting page ("customsignalsetup"...
<p>put this line like this so you will get the updated value everytime. </p> <pre><code>@Override public void onResume() { super.onResume(); // Always call the superclass method first CustLabel.setText("Custom (" + settings.getString("CustomSignalUnit", "").toString() + ") ="); } </code></pre>
gwtbootstrap3 with them adminLTE <p>how can I to integrate this theme in may project? now, i've the simple bootstrap3 but I like to change.</p> <p> Yay buttons!</p> <pre><code> &lt;b:Button&gt;Some button&lt;/b:Button&gt; &lt;b:Button type="DANGER" size="LARGE"&gt;Dangerous button&lt;/b:Button&gt; &lt;...
<p>The GWT Bootstrap 3 project has theming instructions in the <a href="https://gwtbootstrap3.github.io/gwtbootstrap3-demo/#setup" rel="nofollow">Setup section</a>.</p>
SCCM 2012 Perquisite Check "SQL Server service running Account Error" <p>Getting """SQL Server service running Account Error"</p> <p>Description as provided "The logon account for the SQL Server service cannot be a local user account, NT SERVICE\ or LOCAL SERVICE. You must configure the SQL Server service to use a v...
<p><strong>1. Install using at least SQL server standard version instead</strong></p> <p>You have installed SQL server Express which is not supported for CAS/Primary site installation. Please use at least SQL server standard instead. For more details about SQL server 2012 requirement, please see below:</p> <p><a href...
How to reuse jquery function <p>Hey guys I have a problem with re-using code:</p> <pre><code>YT_ready(function() { $("iframe[id]").each(function() { var identifier = this.id; var frameID = getFrame(identifier); if (frameID) { //If the frame exists players[frameID] = new YT.Player(, { ...
<p>Try this:</p> <pre><code>var handler=function(thi) { $("iframe[id]").each(function() { var identifier = thi.id; var frameID = getFrame(identifier); if (frameID) { //If the frame exists players[frameID] = new YT.Player(, { events: { 'onStateChange': onPla...
not getting the right value onclick <p>I have a slider and two buttons for left and right I have tow event handlers for each button as I'll show you in the code bellow. </p> <p>when I click and wait for the transition to be completed, everthing works fine, but when I click fast consecutive clicks ,I'm getting float n...
<p>You may use the <a href="https://api.jquery.com/animated-selector/" rel="nofollow">:animated</a> selector as first line in your event listeners to test if the container div is running animation:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet...
Firefox link color flickers when using transition with :hover and :visited <p>I'm testing the following code in Firefox 49.0 (under Linux Mint):</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css pretty...
<p>This seems to be a Firefox bug, the transitions are not handled correctly.</p>
how to add menu items <p>Like the older version of android studio menu is not pre generated. So I tried and added some code of my own. But unfortunately I am unable to add menu items. So need some help:(</p> <p>MainActivity:</p> <pre><code>package com.buckydroid.materialapp; import android.support.v7.app.ActionBarAc...
<p>Change your code in MainActivity.java</p> <p>from</p> <pre><code> @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main_menu, menu); return true; } </code></pre> <p>T...
Unknown Class X in Interface Builder File <p>I am working with Xcode 7 and swift.</p> <p>I am trying to connect a label that is on a Collection View prototype cell to my code. I know to do this, I have to make a subclass of UICollectionViewCell and put it in that class instead of the view controller, which I did. I ru...
<p>With a little tinkering I got it to work. For some reason Xcode was not compiling the subclass it the UIViewContoller. I simply moved the subclass out of the view controller class (making the subclass a class), and everything worked fine. </p>
Overfitting after first epoch <p>I am using convolutional neural networks (via Keras) as my model for facial expression recognition (55 subjects). My data set is quite hard and around 450k with 7 classes. I have balanced my training set per subject and per class label.</p> <p>I implemented a very simple CNN architectu...
<p>It could be that the task is easy to solve and after one epoch the model has learned enough to solve it, and training for more epochs just increases overfitting.</p> <p>But if you have balanced the train set and not the test set, what may be happening is that you are training for one task (expression recognition on...
how do i make a standalone C# form application with data storage(without SQL)? <p>i am trying to make an C# form application which will store some data like id, name, date and contact no. i have done it using MS SQL server's local connectivity. the problem is it requires MS SQL Server installed on my other PC or else i...
<p>as rene suggested You can use local files to store your data. most of the time i use configuration file (*.ini).</p> <p>please read more about ini files in the below wiki link </p> <p><a href="https://en.wikipedia.org/wiki/INI_file" rel="nofollow">ini file info</a></p> <p>hope this helps</p>
All Hive functions fail <p>I honestly don't know what is going on. Everything fails except basically <code>SHOW DATABASES</code>. </p> <p>Nothing on this page (below) even works. Everything gives me a NoViableAltException. This is both in Hive and Beeline CLI. </p> <p><a href="https://cwiki.apache.org/confluence/disp...
<p>Just add SELECT.</p> <pre><code>SELECT from_unixtime(unix_timestamp()); SELECT DATEDIFF('2000-03-01', '2000-01-10'); </code></pre>
Django: How to properly make shopping cart? ( Array string field ) <p>Lately I've been needing to create a server-side shopping cart for my website that can have products inside. I could add cart and product in session cookies, but I prefer to add it to my custom made User model, so it can stay when the user decides to...
<p>I'd suggest using DB relationships instead of storing a string or an array of strings for this problem.</p> <p>If you solve the problem using DB relationships, you'll need to use a <a href="https://docs.djangoproject.com/es/1.10/topics/db/examples/many_to_many/" rel="nofollow">ManyToManyField</a>.</p> <pre><code>c...
Why Javascript in-built methods/functions are written in C/C++ and not JS syntax <p>This question is in reference to this old question <a href="http://stackoverflow.com/questions/10289182/where-can-i-find-javascript-native-functions-source-code">Where-can-i-find-javascript-native-functions-source-code</a></p> <p>The a...
<p>As pointed out in the comments, you have a fundamental misunderstanding of how JavaScript works.</p> <p>JavaScript is a <em>scripting</em> language, in the purest sense of that term, i.e. it is meant to script a <em>host environment</em>. It is meant to be embedded in a larger system (in this case, a web browser wr...
Format vs. Concatenate URLs <p>I recently came across tutorial code like this:</p> <pre><code># Constant strings for OAuth2 flow # The OAuth authority authority = 'https://login.microsoftonline.com' # The token issuing endpoint token_url = '{0}{1}'.format(authority, '/common/oauth2/v2.0/token') </code></pre> <p>Is t...
<p>To join url use the appropriate method:</p> <pre><code>import urllib authority = 'https://login.microsoftonline.com' token_url = urllib.basejoin(authority, '/common/oauth2/v2.0/token') </code></pre>
Update Fragment UI from Service or BroadcastReceiver if Fragment is visible <p><strong>TL;DR</strong> </p> <p>I need to update a fragment's UI(toggleButton) when it is visible on screen from a running Service.</p> <p><strong>Background</strong></p> <p>I have a <code>toggleButton</code> on a Fragment(named homeFragme...
<p>Use a broadcast reciver and register it in your fragment</p> <p>You can call Broadcast reciver by using below code inside ur service </p> <pre><code>Intent intent = new Intent(); intent.putExtra("extra", cappello); intent.setAction("com.my.app"); sendBroadcast(intent); </code></pre> <p>In your Fragment implement...
iOS: App doesn't work after a while (parallel installation of Xcode 8) <p>I used XCode 7.3 for a long time and have developed a game for my wife. Today when recompiling and starting it on the iPhone I get an error:</p> <pre><code>dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib Referenced from: /private/v...
<p><em>posting this answer from my comment</em></p> <blockquote> <p>1) Make sure only one of the Xcodes is open at a time. </p> <p>2) Do a clean (command shift k), and clean the build folder (option command shift k).</p> </blockquote>
GTX with maven project creation <p>im trying to create a maven project with GTX. Im following this tutorial: <a href="https://www.youtube.com/watch?v=5QPOAXLGB2Y" rel="nofollow">https://www.youtube.com/watch?v=5QPOAXLGB2Y</a>, but i get error after I create project:</p> <pre><code>Failed to read artifact descriptor fo...
<p>You are using the commercial version of Sencha GXT (4.0.2). In this case you need credentials to log in the repository. I think, that's your problem.</p> <p>More informations can be found here: <a href="http://docs.sencha.com/gxt/4.x/getting_started/maven/Maven.html" rel="nofollow">http://docs.sencha.com/gxt/4.x/ge...
Which functions should I use to url safe search redirect <p>I have a search input, and a redirection function in jQuery, which redirects users when they hit enter to search.</p> <pre><code>&lt;input type=text class=searcher&gt; </code></pre> <pre class="lang-js prettyprint-override"><code>$(".searcher" ).keypress(fun...
<p>You don't even need JavaScript.</p> <pre><code>&lt;form action="http://www.example.com/" method="get"&gt; &lt;input type="search" name="q" minlength="3" /&gt; &lt;/form&gt; </code></pre> <p>The browser will take care of <em>everything</em> here. Even submitting the form: when a form contains only one input ele...
Basic Method Calling - Max Integer <p>I have one public method and the method receives two numbers for example 2 and 7, how do I make it so that the method answers with the largest number i.e 7</p> <pre><code>public class Test { public static void main(String[] args) { int max(int x ,int y) { int x = 2; ...
<p>You could use Java's methods...</p> <p>More practically: Java has a library called Math. Math has a static function that gives the max number between two numbers.</p> <pre><code>Math.max(firstNum, secondNum); </code></pre> <p>You can use this.</p>
Arraysort f# not giving wanted type <p>I've created a function that sorts an array by converting it to a list first (might be a little silly, but that's my solution whatsoever). Anyways, it doesn't show up with the type like other similar sort functions does. I'd like it to look like <code>sort : (’a [] -&gt; ’a []...
<p>First step, remove all type annotation ; you normally put it only when needed (ie when inference can't determine things without a little help) Second step use function inside module (here Array module) that way (among other things) inference can determine what is the array using the signature of those functions</p> ...
C# - text file with matrix - divide all entries <p>I have a <strong>text</strong> file with a 1122 x 1122 matrix of precipitation measurements. Each measurement is represented with 4 decimal digits. Example lines look like this:</p> <p>0.0234 0.0023 0.0123 0.3223 0.1234 0.0032 0.1236 0.0000 ....</p> <p>(and this 1122...
<p>Assuming the files are well-formed, you should essentially be able to process them a character at a time without needing to create any arrays or do any complicated string parsing.</p> <p>This snippet shows the general approach:</p> <pre><code>string s = "12.4567 0.1234\n"; // just an example decimal d = 0; foreach...
Transfer JavaScript to jquery not working <p>I collect a script to display facebook type multiply chat box. In this JavaScript code I used a Iframe to load chat page. But now a want to avoid iframe, and I am not enough knowledge about JavaScript. </p> <p>So have any way to load my chat page by JavaScript for this scri...
<p>I didn't closely analyse your code, but I did notice this:</p> <pre><code>$("&lt;div&gt;&lt;/div&gt;").attr('id',id).append('&lt;div class="popup-box chat-popup cy'+id+'" id="'+ id +'"&gt;&lt;div class="popup-messages"&gt;&lt;div id="iFrame1" name="CmainFrame" width="100%" height="249" style="overflow:hidden" class...
python: numpy-equivalent of list.pop? <p>Is there a numpy method which is equivalent to the builtin <code>pop</code> for python lists? popping obviously doenst work on numpy arrays, and I want to avoid a list conversion.</p>
<p>There is no <code>pop</code> method for NumPy arrays, but you could just use basic slicing (which would be efficient since it returns a view, not a copy):</p> <pre><code>In [104]: y = np.arange(5); y Out[105]: array([0, 1, 2, 3, 4]) In [106]: last, y = y[-1], y[:-1] In [107]: last, y Out[107]: (4, array([0, 1, 2,...
Forgot Password Form <p>I want to add a Forgot Password form for when the user clicks Forgot Password. I already have one in PHP. I am using a MySQL database. </p> <p>Should it go to the Forgot Password Activity? </p> <p>Can anyone help me or have a sample code?</p>
<p>To send an email, you can use this:</p> <pre><code>Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/html"); intent.putExtra(Intent.EXTRA_EMAIL, "emailaddress@emailaddress.com"); intent.putExtra(Intent.EXTRA_SUBJECT, "Subject"); intent.putExtra(Intent.EXTRA_TEXT, "I'm email body."); startActivity...
If statement condition where element equals element <p>I am testing a web page that contains a table. You can click a "Create new" link to add records to the grid. Once "Create New" is clicked, a dialog appears with some text boxes, another grid and a Cancel and Save button. You can then click a link to add a record to...
<p>Use the <code>Equals()</code> method for your scenario. <code>==</code> will not work for this. you need to check it as <code>if(button.Equals(SaveOrganizationBtn))</code>. The result for this will be <code>true</code>, if it is the same object else it will return false.</p> <p>I hope, it will help you.</p>
Reading data from a text file into a struct with different data types c# <p>I have a text file that stores data about cars, its call car.txt. I want to read this text file and categorize each of the sections for each car. Ultimately I want to add this information into a doubly linked list. So far everything I have trie...
<p>You are reading the file line by line with <code>ReadLine</code>, and trying to split a single line with a line ending. This will result in an array with just one element (E.G. "BMW")</p> <p>You can either read the whole file and then split by lines or just assume that each line will contain some data.</p> <p>The ...
Background black when programmatically setting activity background <p>I have a fullscreen activity, for which I want to programmatically set the background. I have four different images in my drawable folder, and each time the activity is created, I want to randomly choose one for the background. Here is my code:</p> ...
<p>Don't get view via <code>LayoutInflater</code>, if your <code>Activity</code> has xml layout and you called <code>setContentView(int resId)</code> you just find your root view and set background.</p> <pre><code>FrameLayout layout = (FrameLayout) findViewById(...); layout.setBackgroundResource(images[rand.nextInt(im...
IdentityServer4 and Web API .NET 4.6.2 <p>Is there a OWIN middleware that can work with a standard .NET 4.6.2 (not Core) framework to valide tokens coming from IdentityServer4. </p> <p>Something like <a href="https://github.com/IdentityServer/IdentityServer4.AccessTokenValidation" rel="nofollow">https://github.com/Id...
<p>Even though the project README.md says <code>OWIN Middleware to validate access tokens from IdentityServer v3</code>. It should in theory still work with IDS4 tokens:</p> <p><a href="https://github.com/IdentityServer/IdentityServer3.AccessTokenValidation" rel="nofollow">https://github.com/IdentityServer/IdentitySer...
Cannot communicate between fragment and activity <p>I have a dialogFragment where there's an edit text. I would like to pass the text to the parent activity, when the positive button of the dialog is clicked, but it doesn't seem to call the method of the interface implemented in the activity. Code: DialogFragment</p> ...
<p>I tried your code and it works in my case. Displays both log messages when clicked on positive button. Compare my code with yours and see if there is anything different:</p> <p>Activity:</p> <pre><code>public class DialogFragmentActivity extends AppCompatActivity implements MyDialogFragment.onFileTypedListener { ...
Function EVP_aes_256_ctr not found when compiling with OpenSSL on a Mac <p>I've been trying to compile some files using the "make" command on a directory. However, I keep getting this error:</p> <pre><code>Sammys-MacBook-Pro:p1 AlphaMale$ make gcc -L/usr/local/lib/ -o kem-enc ske.o rsa.o kem-enc.o prf.o -lcrypto -lssl...
<p>The error message is (in the relevant part):</p> <pre><code>Undefined symbols for architecture x86_64: "_EVP_aes_256_ctr", referenced from: _ske_encrypt in ske.o _ske_decrypt in ske.o </code></pre> <p>telling you that the function <code>EVP_aes_256_ctr</code> is not found in the version of OpenSSL th...
Transform JSON array and assign to single value case class with Play JSON <p>Given the following JSON object:</p> <pre><code>{realtime-accesses: [ {realtime-access: { level: 2 marketID: 1 }}, {realtime-access: { level: 4 marketID: 3 }} ] } </code></pre> <p>I want a Scal...
<p>The reason why it doesn't work is that <code>Format[A]</code> does not have a functor. When you call <code>map</code> on it with a function <code>A =&gt; B</code> you are getting back <code>Reads[B]</code> not a <code>Format[B]</code>. </p> <pre><code>val format1: Format[List[Map[String, Map[String, Int]]]] = (__ \...
How to edit and read specific lines of a text document with a Batch script <p>I am writing a Batch text adventure at the moment, and I am attempting to find a way to make a world save and also save the various bits of armor and the statistics they have onto a text document. I am at a loss for how to do this, and I was ...
<p>Depending on how you have the script setup. If you are having the info set as variables like %armor% or w.e you can use set out. Here is an example,</p> <pre><code>@Echo Off set /p armor= Set "out=C:\users\*your login name*\Desktop" &gt; "%out%\YourFileName.txt" %armor% </code></pre> <p>Then whatever the armor...
CoreData iCloud changes not saved <p>I m making an app with CoreData and iCloud integration. I went through the <a href="https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/UsingCoreDataWithiCloudPG/UsingSQLiteStoragewithiCloud/UsingSQLiteStoragewithiCloud.html#//apple_ref/doc/uid/TP4001...
<p>I was actually trying to use two databases whereas I should have used configurations to separate entities saved to the cloud and those saved locally. </p> <p>For those who wants more information on CoreData with iCloud i suggest to go through this <a href="https://developer.apple.com/videos/play/wwdc2012/227/" rel=...
What is the purpose of repository when service classes can do the same? <p>Normally I put the logic in the service classes without using repository, for example, something like this:</p> <pre><code>namespace App\ProjectName\Profile; use App\User; class AccountService { private $userModel; public function __...
<p>From DDD (Domain Driven Design) the responsibility of a repository is to take care of loading, storing, modifying and deleting an entity on the designated data storage (which may or may not be a database -- it may even be a remote server or just a file).</p> <p>A service, on the other hand, has (or should have) a v...
PHP ftp_put fails with "Warning: ftp_put (): PORT command successful" <p>File is created on the FTP server, but its always 0 bytes large. Please give me a solution so that the file upload will working success. </p> <p>I keep getting this warning:</p> <blockquote> <p>Warning: ftp_put (): PORT command successful in C...
<p>PHP defaults to the active FTP mode. The active mode hardly ever works these days due to ubiquitous firewalls/NATs/proxies.</p> <p>You almost always need to use the passive mode.</p> <p>For that call the <a href="http://php.net/manual/en/function.ftp-pasv.php" rel="nofollow"><code>ftp_pasv</code></a> after the <co...
Why does it say that the tree is null even though I inserted values? <p>I am trying to work on a binary search tree program. This is my main program. Every time I try to print Inorder traversal of the values I inserted into the tree, the printInorder function says that it's empty or null. I'm aware that the root is ini...
<p>Your <code>insert</code> function calls <code>createTree</code> to assign a new instance to the <code>p</code> variable, but you don't assign this variable to the <code>root</code> variable in your <code>main</code> function, so <code>root</code> remains <code>NULL</code> after the function returns (i.e. <code>root ...
I want to change an email address in Word VBA <p>In Word I would like to search the active document for @yahoo.com and replace all instances with newName@gmail.com. When I use the *@yahoo.com to find it the replace command erases all of the document before the @yahoo.com</p> <pre><code> Sub kiffin() With S...
<p>The wildcard <code>*</code> is clearly too greedy in this case, and the limited wildcard/regex support available in Word's Find functionality may not be suited for identifying individual email addresses. (Note: Word, nor RegEx is an expertise of mine).</p> <p>If the email addresses in the Word Document are given as...
Caesar Cipher Program <pre><code>def caesar_cipher(message): alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] newmessage = "" for letter in message: if letter in alphabet: positionnumber = alphab...
<pre><code>def caesar_cipher(message): alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] newmessage = "" for letter in message: if letter in alphabet: positionnumber = alphabet.index(letter) + 13 position = po...
Datatable values comparison <p>I want to get value from my datatable which has two columns. Name and OrderTime. I want to subtract corresponding value from time in a text box. I am referring to datatable values using following code. I can get result in </p> <pre><code>string First = (mydatabaseDataSet.Tables[0].Rows[1...
<p>Ok so i solved the problem. Thanks for your feedback guys!</p> <pre><code>private void comboBox_suburb_SelectedIndexChanged(object sender, EventArgs e) { SqlConnection con = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\WoolsValley\documents\visual studio 2015\Pr...
Search for address using SWIFT <p>In my app I need the user to enter his home address, but I can't get any way that the addresses that are shown are only in the users region, and are full addresses, like <code>225e 57th st, NY, New York</code>.</p> <p>I want to give the user all the listed options on a tableview, and ...
<p>You can define a <a href="https://developer.apple.com/reference/mapkit/mklocalsearchcompleter" rel="nofollow">local search completer</a>:</p> <pre><code>var completer = MKLocalSearchCompleter() </code></pre> <p>And then supply the query fragment:</p> <pre><code>completer.delegate = self completer.region = MKCoord...
Setting up Environment Variable for GCP <p>I read <a href="https://developers.google.com/identity/protocols/application-default-credentials" rel="nofollow">this</a> article but I still don't understand how I have to set up the environment variable with the <code>.json</code> file with the credentials. Do I have to ente...
<p>You can do either: the key part is that the environmental variable must be present for the SDK to pick up in the code that you're running. You could set it programmatically in Python (<a href="http://stackoverflow.com/questions/5971312/how-to-set-environment-variables-in-python">example</a>) or in your terminal (<a ...
Alternate adding and subtracting a number java <p>Here's my current code: </p> <pre><code>Scanner input = new Scanner(System.in); int n, sum = 0; System.out.println("Enter n:"); n = input.nextInt(); for (int i = 1; i &lt;= n; i++) { if (i % 2 == 0){ sum-=input.nextInt(); } else { sum+=input.nex...
<p>You were almost there:</p> <pre><code>for (int i = 1; i &lt;= n; i++) { if (i &gt; 2 &amp;&amp; i % 2 != 0){ sum-=input.nextInt(); } else { sum+=input.nextInt(); } } </code></pre> <p>The first two numbers contribute to the result with the "plus" sign, their sign does not alternate, henc...
Is it possible to use component (like jButton) as an argument in a function? <p>If I am using the exact same lines of code for multiple buttons, can I use a component (in this case button) as an argument for a function instead of using a variable? That will make my work so much easier. If I have something like this:</p...
<p>It is. The attempt you made is the way to do this.</p> <pre><code>public void buttonFunction(JButton something){ something.setText("something"); something.setBackground(Color.BLACK); something.setForeground(Color.WHITE); } </code></pre> <p>All you need to do is call this function after you created the ...
Spark 2.0 DataSets groupByKey and divide operation and type safety <p>I am very much pleased with Spark 2.0 DataSets because of it's compile time type safety. But here is couple of problem that I am not able to work out, I also didn't find good documentation for this.</p> <p><strong>Problem #1 - divide operation on ag...
<p>The first problem can be resolved by using typed columns all the way down (<code>KeyValueGroupedDataset.agg</code> expects <code>TypedColumn(-s)</code>) You can defined aggregation result as:</p> <pre class="lang-scala prettyprint-override"><code>val eight = lit(8.0) .as[Double] // Not necessary val sumByEight...
tkinter won't quit when I press quit button, it just changes location <p>This is the code and when I run it the quit button doesn't work:</p> <pre class="lang-py prettyprint-override"><code>def quit2(): menu.destroy() def menu1(): menu=Tk() global menu play=Button(menu, text='play', command =main) ...
<p>You use <code>while True</code> so after you close window <code>while True</code> opens new window.</p> <p>Use last line <code>menu1()</code> without <code>while True</code></p> <p><strong>EDIT:</strong></p> <pre><code>from tkinter import * def quit2(): menu.destroy() def menu1(): global menu menu ...