Bài đăng

Đang hiển thị bài đăng từ Tháng 2, 2016

how to draw() the Form table....?

<p>when I submitting my form the data is stored, but I need to draw my formtable also..that data should update there...</p><p>this is my code..</p><div class="snippet" data-lang="js" data-hide="false"><div class="snippet-code"><pre class="snippet-code-js lang-js prettyprint-override"><br /><code>$('#AttributeSettingsForm').submitAjax({<br /> success: function(response) {<br /> try {<br /> if (response.error) {<br /> notifyError(response.error, '@ViewBag.Title');<br /> return;<br /> } else {<br /> Formtable.draw();<br /> notifySuccess(response.msg, '@ViewBag.Title');<br /> }<br /> } catch (e) {<br /> if (window.console)<br /> console.error(e);<br /><br /> notifyError('@G("InternalError")', '...

how to cross scripting on this html?

<div class="snippet" data-lang="js" data-hide="false"><div class="snippet-code"><pre class="snippet-code-html lang-html prettyprint-override"><br /><code></div><br /> </div><br /> </div><br /> </div><br /> <div class="col2-set addressbook"><br /> <div class="box"><br /> <div class="box-title"><br /> <h3>Address Book</h3><br /> <a href="http://ift.tt/1UjFqaH">Manage Addresses</a><br /> </div><br /> <div class="box-content"><br /> <div class="col-1"><br /> <h4>Default Billing Address</h4><br /> <a href="http://ift.tt/1QuZSPG">E...

htaccess to manually redirect to renamed "Main Page"

<p>Our site has something like this as our <code>.htaccess</code></p><pre><br /><code>RewriteEngine On<br />RewriteRule ^/wiki/Main_Page$ /wiki/Welcome_to_Our_Site [R]<br />RewriteRule ^/?wiki/?$ / [R]<br /><br />RewriteRule ^/?$ %{DOCUMENT_ROOT}/index.php?title=Welcome_to_Our_Site [L,QSA]<br />RewriteRule ^/?wiki(/.+)$ %{DOCUMENT_ROOT}/index.php [L]<br />RewriteRule ^/?w(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]<br /><br />RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f<br />RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d<br />RewriteRule ^/?images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2 [L,QSA,B]<br /><br />RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f<br />RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d<br />RewriteRule ^/?images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROO...

How to split a string, iterate over it, and output a joined version

<p>I'm working on a code for <code>caesar_cipher</code>. I am writing a method for encryption without making a <code>Caesar</code> class and defining other methods inside of it. The code I wrote is below:</p><pre><br /><code>def caesar(string, shift = 0)<br /> alphabet = ("a".."z").to_a<br /> letters = string.split("")<br /> blank = []<br /> letters.map do |letter|<br /> blank << alphabet[(alphabet.index(letter) + shift) % alphabet.length] <br /> end <br /> puts blank.join<br />end<br /></code><br /></pre><p>I get this error when putting in a string consisting of more than one word:</p><pre><br /><code>block in `caesar_cipher': undefined method `+' for nil:NilClass (NoMethodError)<br /></code><br /></pre><p>I understand <code>tr</...

Insert Array To Database With Angular JS

<p>I getting problem to insert array with php to database, php code:</p><pre><br /><code>$name = mysql_real_escape_string($data->name);<br />$address = mysql_real_escape_string($data->address);<br />$school = mysql_real_escape_string($data->school);<br />$year = mysql_real_escape_string($data->year);<br /><br />$qry = 'INSERT INTO users (name,address,school,year) values ("' . $name . '","' . $address . '","' . $school . '","' . $year . '")';<br /></code><br /></pre><p>angular js code:</p><pre><br /><code>$http({<br /> method : 'POST',<br /> url : 'post.php',<br /> data : {<br /> name : $scope.name,<br /> address: $scope.address,<br /> users : $scope.users<br /> }<br...

Javascript is unable to stop page loading

<p>I have a sign-up page having proper validation's every place. But whenever i click "Sign-Up" on a blank form. It shows the validation, but gets loaded. I want to stop the loading. How's that possible.</p><p>I am primarily checking on chrome, where i checked on settings, whether javascript is disabled or not, but it is enabled.</p><p>it's happening in an .cshtml page.</p><p>Feel free to ask any question</p><br /><h2>Click here view more answers <a href="http://ift.tt/1PUkVhE">http://ift.tt/1PUkVhE</a></h2>

Writing with Server in C++

<p>I am programming a server-client service, the client is in Java and the Server is in C++, but when I try to write by the Server to the Client, he does not sends the message, only when i close the socket, the server sends the message and the client reads it. Here is the Server Code:</p><pre><br /><code>#include<stdio.h><br />#include<stdlib.h><br />#include<sstream><br />#include<string><br />#include<netdb.h><br />#include<netinet/in.h><br />#include<string.h><br />#include<iostream><br />#include<sys/types.h><br />#include<sys/socket.h><br />#include<arpa/inet.h><br />#include<unistd.h><br /><br /><br />using namespace std;<br /><br />void doprocessing (int sock, int cliente);<br />void sendM(int socket,int client);<br /><br />int main(int argc, char *argv[]) {<br /...

How to query Where Datetime many time?

<p>I want query datetime many time. but i try query it's not work.</p><p><strong>Example</strong></p><p>Table cus_bill</p><pre><br /><code>Number Period<br />A-20160101 01/2015<br />A-20160410 04/2015<br />A-20160912 09/2015<br />A-20161020 10/2015<br />A-20161102 11/2015<br />A-20161219 12/2015<br /></code><br /></pre><p><strong>SQL</strong></p><pre><br /><code>SELECT v.*<br />FROM cus_bill v<br />WHERE TO_DATE('01/'||V.PERIOD,'DD/MM/YYYY') >= TO_DATE('01/'|| '10/2015','DD/MM/YYYY') <br />and TO_DATE('01/'||V.PERIOD,'DD/MM/YYYY') <= TO_DATE('01/'|| '12/2015','DD/MM/YYYY')<br />and V.PERIOD IN ('01/2015','09/2015') <br /></code><br /></pre><p>Bu...

Writing a test case for a Java program which takes user input in iterations to get to a final value

<p>Below is the java program to guess the number of Apples Tom has. Tom would type higher if he has higher number of apples than the guessed number and lower if it is lower. He will respond with none when the number guessed is correct. My task is to write a JUnit test case for this program. Since based on the user input the guessed number is either decremented or incremented until we reach the actual value it confuses me as to how to write a JUnit test case for this program</p><pre><br /><code> public static void main(String args[]){<br /> System.out.println("Guess the number of Apples Tom has");<br /> Scanner sc= new Scanner(System.in);<br /> int number=sc.nextInt();<br /> System.out.println("Tom, is it higher or lower?")<br /> String higherOrLower=sc.nextLine();<br /><br /> while(true){<br /> number= getValue(higherOrLower,number);<br /> ...

How to call Javascript function from server side asp.net

<p>I have a <code>Textbox</code> in <code>GridView</code> I want to change the Label.Text if the text in Textbox is changed. But I am not able call javascript function written in .cs page. Is there any mistake in <code>TbUnitCost_TextChanged</code> method.</p><p>This is my aspx page</p><pre><br /><code><ItemTemplate><br /> <asp:TextBox Style="text-align: right" ID="TbUnitCost" runat="server" Width="80px" Text='<%#Bind("Unit_Cost")%>' AutoPostBack="true" OnTextChanged="TbUnitCost_TextChanged" TextMode="Number"></asp:TextBox><br /> </ItemTemplate><br /></code><br /></pre><p>Code behind Page is as follows</p><pre><br /><code> protected void TbUnitCost_TextChanged (object sender, EventArgs e)<br /> {<br /> Gr...

What regex pattern will get me separately all letters in an array from the below file?

<p>What regex pattern will get me separately all strings in an array from the below file?</p><pre><br /><code>Table_name_1 {<br /> Columns {<br /> Name : col_1<br /> Type: varchar(20)<br /> Description : to store stuff<br /> }<br /> Index {<br /> Name : Index1<br /> Column: col_1<br /> }<br />}<br /></code><br /></pre><p>O/P:</p><pre><br /><code>[Table_name_1,Columns,Name:col_1,Type: varchar(20),Description : to store stuff,Index,Name : Index1,Column: col_1]<br /></code><br /></pre><br /><h2>Click here view more answers <a href="http://ift.tt/1LDz2Us">http://ift.tt/1LDz2Us</a></h2>

How to get logo & Title on same line via bootstrap

<p>I am using Bootstrap & want to get the logo on the left & title in the center. I have used the following code but not able to get the desired result. Please Guide.</p><pre><br /><code><div class="panel-heading"><a href="#"><br /><img src="Logo.png" width="10%" height="10%" alt=""><br /></a><br /><h1 align="center">Title</h1></div><br /></code><br /></pre><br /><h2>Click here view more answers <a href="http://ift.tt/1oZxsYn">http://ift.tt/1oZxsYn</a></h2>

Opening and Reading files fails

<p>I am currently trying to read a file and count the number of instances of a user-specified string in an input file and output them to another file,.</p><p>However when I try to open the file, <code>fopen</code> returns <code>NULL</code>. Here's what I have so far:</p><pre><br /><code>#include <stdio.h><br />#include <stdlib.h><br />#include <string.h><br /><br /><br />int main(int argc, char **argv)<br />{<br /> char in[50];<br /> char out[50];<br /> char target[50];<br /><br /> getIns(in,out,target);<br /> Search(in, out, target);<br /> //printf("string entered: %s\n%s\n%s", in, out, target);<br /><br /><br /><br /> return 0;<br />}<br /><br />int getIns(char *i, char *o, char *t)<br />{<br /> printf("please enter name of input...

How to add display:inline-block to jQuery fadeIn

<p>I'm running into an issue where I am attempting to get inline-block elements to <code>display: none</code> on page load, but then I want them to fadeIn one by one in their original <code>inline-block</code> form. However, when I do a normal jQuery <code>fadeIn</code> the elements display as block.</p><p>My jQuery is like this right now:</p><pre><br /><code>function blueBoxDelays(){<br /> $('.fadeBlock1').delay(200).fadeIn(500);<br /> $('.fadeBlock2').delay(400).fadeIn(500);<br />};<br /></code><br /></pre><p>CSS</p><pre><br /><code>.dark-blue-box, .light-blue-box {<br /> height: 50%;<br /> width: 25%;<br /> display: inline-block;<br /> /*display: none; ********I replaced the inline-block with this.<br /> vertical-align: top;<br /> padding: 0;<br /> ...

How can i convert .outerHTML to .text()

<p>I want to convert <code>item.outerHTML</code> to <code>.text()</code>, Actually I want to convert the html to text, now what do I do ?</p><pre><br /><code>$(imgAttr).each(function(index,item) {<br /> var valImg = $(item).attr("alt");<br /> if (typeof valImg == typeof undefined || valImg == "") { <br /> $(".url-res").append(item.outerHTML.text());<br /> }<br /></code><br /></pre><p>});</p><br /><h2>Click here view more answers <a href="http://ift.tt/1Qdwu4X">http://ift.tt/1Qdwu4X</a></h2>

Layout_weight does not work properly

<p>I have the followin xml where I want imageview and then two textview and then imageview again, but it does not work properly.</p><p>Here is what I planned to have:</p><p><a href="http://ift.tt/1WFogD5" rel="nofollow"><img src="http://ift.tt/1WFogD5" alt="enter image description here" /></a></p><p>Here is what I am getting:</p><p><a href="http://ift.tt/1OrGHoJ" rel="nofollow"><img src="http://ift.tt/1OrGHoJ" alt="enter image description here" /></a></p><pre><br /><code><LinearLayout<br /> android:layout_width="match_parent"<br /> android:layout_height="match_parent"<br /> android:layout_gravity="center_horizontal"<br /> android:orientation="horizontal"<br /> android:clickable="true"<br /...

Place a view over another view

<p>I have a custom toolbar in a separate file called <code>include_toolbar.xml</code>.</p><pre><br /><code><?xml version="1.0" encoding="utf-8"?><br /><android.support.v7.widget.Toolbar<br /> xmlns:android="http://ift.tt/nIICcg"<br /> xmlns:app="http://ift.tt/GEGVYd"<br /> android:id="@+id/include_toolbar"<br /> android:orientation="vertical"<br /> android:layout_width="match_parent"<br /> android:layout_height="wrap_content"<br /> android:background="?attr/colorPrimary"<br /> app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /><br /></code><br /></pre><p><a href="http://ift.tt/1WFogTt" rel="nofollow"><img src="http://ift.tt/1WFogTt" alt="enter image description here" />...

Change Position of div in javascript

<p>I want to Change Positioning of HTML div Via Javascript in my existing Script</p><p>Currently This My Existing Javascript is generating in front end.</p><pre><br /><code><div class="navbar navbar-inverse affix" id="SubMenu" style="top: 72px;"> <br /></code><br /></pre><p>But i want to make positioning to <code>top:8px</code></p><p>JavaScript is as Below.</p><pre><br /><code>// Sub-navbar affix on scroll<br />// ------------------------------------------------------------------------<br />if ($('#SubMenu').length) {<br /> $('#SubMenu').affix({<br /> offset: {<br /><br /> top: function() {<br /> return $('#SubMenu').parent().offset().top - $('#navbar-main-container').outerHeight();<br /> },<br /> ...

In Javascript, why are \b characters dropped in a .join()?

<p>In Javascript, why does this statement not equal <code>'\b,\b'</code>?</p><pre><br /><code>['\b', '\b'].join()<br />//=> ","<br /></code><br /></pre><p>According to MDN docs on <code>join</code>:</p><blockquote><p>If an element is undefined or null, it is converted to the empty string.</p></blockquote><p>So why is <code>\b</code> being evaluated as undefined/null?</p><p>Additionally, the<code>\b</code> is dropped from any string prepended with it, e.g:</p><pre><br /><code>['\btest', '\btest2'].join()<br />//=> "test,test2"<br /></code><br /></pre><p>Something crazy is going on.</p><br /><h2>Click here view more answers <a href="http://ift.tt/1VAVgfo">http://ift.tt/1V...

Implementing simple upvote downvote program

<p>I am using express.js and jQuery to create a basic upvote downvote program. Basically the voting buttons increment/decrement by one whenever pressed and the result of each button click is displayed below. Nothing happens when the buttons are clicked, not even a <code>Cannot POST /</code>. I am not sure what is causing the error. This is what my <code>main.js</code> file looks like:</p><pre><br /><code>$(document).ready(function(){<br />$("#up").click(function(){<br /> var up = $.post("/upvote", {changeBy: 1}, function(dataBack){<br /><br /> $("#upvote").text(dataBack);<br /> });<br /><br />});<br />$("#down").click(function(){<br /> var down = $.post("/downvote", {changeBy: 1},<br /> function(dataBack){<br /> $("#downvote").text(dataBack);<br /> });<br /><br /...

Removing duplicates from one column only

<p>So I would have something like this. Its the outcome a query into two tables.</p><pre><br /><code>+------------------+------------------------------------+<br />| character_name | title |<br />+------------------+------------------------------------+<br />| derp | a |<br />| derp | b |<br />| derp | c | <br />| herp | a |<br />| herp | b |<br />| herp | c |<br />+-------------------------------------------------------+<br /></code><br /></pre><p>and I want this</p><pre><br /><code>+------------------+------------------------------------+<br />| c...

mysql count from two tables and give combined count of string

<p>I have two tables where common column is location,i am looking for the count of the locations from both the tables and display a combined count.</p><pre><br /><code> Table-1 <br />+-------------+<br />| Location |<br />+-------------+<br />| USA |<br />| INDIA |<br />| UK |<br />| INDIA |<br />+-------------+<br /><br /> Table -2<br />+-------------+<br />| Location |<br />+-------------+<br />| INDIA |<br />| INDIA |<br />| USA |<br />+-------------+<br /></code><br /></pre><p>Here the count from table one is :</p><pre><br /><code>+-------------+--------+<br />| Location | COUNT |<br />+-------------+--------+<br />| USA | 1 |<br />| INDIA | 2 |<br />| UK | 1 |<br /...

When to Encapsulate in javascript?

<p>I have been developing websites using jQuery for 3 years now and I've recently gained interest in OOP in Javascript and I'm still starting to get my hands on OOP.</p><p>I read from this <a href="http://ift.tt/147bhlO" rel="nofollow">article</a>, and it says:</p><blockquote><p>Encapsulation ...(its methods and properties) are hidden from the rest of the application.</p></blockquote><p>but why would you wanna take the extra time to do that? When you are the programmer and you know you aren't gonna use that on another object anyway. Am I missing something imoportant here? I don't really see any need to do this on my current experiences. So when exactly to Encapsulate in Javascript?</p><br /><h2>Click here view more answers <a href="http://ift.tt/1oEilDS">http://ift.tt/1oEilDS</a></h2>

JQuery button click not registering

<p>I have created a mock twitter website that is supposed to generate more tweets once a button is clicked. I have created the button which is appended to the main section of the site but it seems that once it is clicked absolutely nothing happens. I have looked this over and over again making sure that my code is correct but I am afraid that I am just missing something. below is a my JQuery and CSS.</p><p>JQuery:</p><pre><br /><code> $(document).ready(function(){<br /> var $body = $('body');<br /> var $section = $('.main');<br /><br /> $section.html('');<br /><br /> //Returns a div with a time stamp for the tweet<br /> var createdTime = function(tweet){<br /><br /> return $('<div>', {text: tweet.created_at, id: 'dT'}).prop('outerHTML');<br /><br /> };<br /> //Returns the @handle as a link of...

what is the meaning of "int *(&arry)[10] = ptrs" and how to read it?

<p>I'm new to C++ and is trying to learn the concept of arrays. I know</p><pre><br /><code>int *ptrs[10]; <br /></code><br /></pre><p>has the meaning of ptrs is an array of ten pointers to int. So how about</p><pre><br /><code>int *(&arry)[10] = ptrs;<br /></code><br /></pre><p>I'm very confused by its many syntax so could someone please explain it to me what is its meaning and how to read it? It would be great someone can break it down and explain it in smaller parts. Thanks in advance for any help!</p><br /><h2>Click here view more answers <a href="http://ift.tt/1OrGHF8">http://ift.tt/1OrGHF8</a></h2>

Trying to loop a switch with an invalid input (C#)

<p>Anyway I don't know how I'm supposed to go about doing this... in my application I need to have the switch repeat itself if there's an invalid input. All the application does is exit as soon as I enter a different result. Here's my code:</p><pre><br /><code>string str = Console.ReadLine(); <br />char option = char.Parse(str);<br />//Need to repeat this switch:<br />switch (option)<br />{<br /> case 'N':<br /> Console.WriteLine("Creating New App...");<br /> break;<br /> case 'L':<br /> Console.WriteLine("Loading App...");<br /> break;<br /> case 'O':<br /> Console.WriteLine("Loading Options...");<br /> break;<br /> case 'Q':<br /> Console.WriteLine("Exiting Application...");<br /> System.Environment.Exit(1)...

unable to do http call

<p>I am trying to make a http call in mobile app using ionic framework.</p><p>Below is my UI:</p><pre><br /><code><ion-view title="Register"><br /> <ion-content overflow-scroll="true" padding="true" scroll="false" class="has-header has-footer" ng-controller="registerCtrl"><br /> <form class="list" name="regform" novalidate><br /> <ion-list><br /> <label class="item item-input" name="Number"><br /> <span class="input-label">Number</span><br /> <input type="tel" name="num" placeholder="" ng-model="user.ph_no" ng-minlength="10" ng-maxlength="10" required><br /> </label><br /> ...

SQL Update Multi Row At One Time

<pre><br /><code>mysql> SELECT * FROM options;<br />+----+------+---------+<br />| id | name | value |<br />+----+------+---------+<br />| 1 | aa | a value |<br />| 2 | bb | b value |<br />| 3 | cc | c value |<br />| 4 | dd | d value |<br />| 5 | ee | e value |<br />+----+------+---------+<br /></code><br /></pre><p>I have a options table.</p><p>I want to Update multi row in same query (with where case name).</p><p>suppose i update options.name <strong>aa</strong> and <strong>bb</strong> at one time. It's update like</p><pre><br /><code>+----+------+---------+<br />| id | name | value |<br />+----+------+---------+<br />| 1 | aa |aa value |<br />| 2 | bb |bb value |<br />+----+------+---------+<br /></code><br /></pre><p>I t...

Python split() method not working properly

<p>I want to use split() method for separating rupees and paise. In paise part it is showing 6 paise for 60 paise, 7 for 70 and so on.But if the paise is 44 it will show correctly.Is it not considering zero if it is at the end? [rupees and paise are Indian currency]</p><pre><br /><code>from num2words import num2words<br /><br />pre=405068.60<br />text1 = ''<br />text2 = ''<br />result1 = ''<br />result2 = ''<br />entire_num = int((str(pre).split('.'))[0])<br />decimal_num = int((str(pre).split('.'))[1])<br />print "Decimal number=%d" %decimal_num<br />text1=num2words(entire_num, lang='en_IN').capitalize()<br />text2=num2words(decimal_num, lang='en_IN')<br />result1=text1+' '+'rupees'<br />if(decimal_num>0):<br /> result2 = ' and '+text2+' paise'<br />print r...

Polymorphic inheritance

<p>I have a question about how to define a method from a subclass or a parent class. For example:</p><pre><br /><code>public class Thought<br />{<br /> //-----------------------------------------------------------------<br /> // Prints a message.<br /> //-----------------------------------------------------------------<br /> public void message()<br /> {<br /> System.out.println ("I feel like I'm diagonally parked in a " +<br /> "parallel universe.");<br /><br /> System.out.println();<br /> }<br />}<br /></code><br /></pre><p>And the child class is:</p><pre><br /><code>public class Advice extends Thought<br />{<br /> //-----------------------------------------------------------------<br /> // Prints a message. This method overrides the par...

Difference between : and :: in CSS [duplicate]

<div class="question-status question-originals-of-duplicate"><p>This question already has an answer here:</p><ul><li><a href="/questions/10181729/should-i-use-single-or-double-colon-notation-for-pseudo-elements" dir="ltr">Should I use single or double colon notation for pseudo-elements?</a> <span class="question-originals-answer-count">4 answers</span></li></ul></div><p>Hi just want to clear up my mind to use colon / pseudo class in css.</p><p>If I use</p><pre><br /><code>div:before {<br /> // some css styles<br />}<br /></code><br /></pre><p>OR</p><pre><br /><code>div::before {<br /> // some css styles<br />}<br /></code><br /></pre><p>Both works same. So what is the difference between single colon <code>:</code...

how to Debugging app using phone?

<p>My become unfortunately stopped when i am lunching on my android device and navigate to another page. so i want to debug myapp using my device.</p><h2>Here is my code</h2><p>public void onClick(View v) { BackgroundTask task=new BackgroundTask(Login.this); task.execute(); if(ss_deals != null) { Intent i_A = new Intent(this,Dashboard.class); i_A.putExtra("MESSAGE",msg ); startActivity(i_A); } }</p><p>private class BackgroundTask extends AsyncTask {</p><pre><br /><code> public BackgroundTask(Login activity) {<br /> dialog = new ProgressDialog(activity); <br /> objMS = new MyService();<br /> ss_deals = (SoapObject) objMS.getWebServiceResult("CheckLogin","",txtid.getText().toString(),txtPwd.getText().toString());<br /><br /> }<br /><br /> @Override<br /> protected void onPreExecute() {<br /...

If two objects are declared in a single line, in what order are they constructed?

<p>May be this is a basic question, but I couldn't find any relevant posts regarding it.</p><p>Let's say a class has been defined as</p><pre><br /><code>class A {<br />//.....<br />}<br /></code><br /></pre><p>and now I am creating two objects as</p><pre><br /><code>A a,b;<br /></code><br /></pre><p>I have the following query</p><p>In what order a and b created? Is it defined by the standard?</p><br /><h2>Click here view more answers <a href="http://ift.tt/1OrGF06">http://ift.tt/1OrGF06</a></h2>

C# MVC get .Distinct() data

<p>I have some data in SQL Server:</p><pre><br /><code>[<br /> {<br /> "code": 1,<br /> "name": "qweee",<br /> "IDNO": "ff2222"<br /> },<br /> {<br /> "code": 2,<br /> "name": "test2",<br /> "IDNO": "ff2222211"<br /> },<br /> {<br /> "code": 3,<br /> "name": "fsdfasdf",<br /> "IDNO": "ddaaa"<br /> },<br /> {<br /> "code": 4,<br /> "name": "qweee",<br /> "IDNO": "ff2222"<br /> },<br /> {<br /> "code": 5,<br /> "name": "123",<br /> "IDNO": "U120000005"<br /> }<br />]<br /></code><br />...

Read Access Violation (this-&gt;headPtr was 0xCDCDCDCD)

<p>Remove (T &item) is supposed to remove the headPtr and store that "item value" in "item" and return true, otherwise return false if no elements are in the queue. I get a "read access violation error" in this function. Here is the class and function definitions:</p><pre><br /><code>class SharedQueue {<br />public:<br /> SharedQueue();<br /> ~SharedQueue();<br /><br /> //Return true if the queue is empty<br /> bool IsEmpty() const;<br /><br /> //Enqueue the next item at the tail of the queue.<br /> void Add(T value);<br /><br /> //Dequeue the next queue element and store it in "item" variable. The function returns false if the queue is empty and no item can be retrieved.<br /> bool Remove(T &item);<br /> void Print();<br />private:<br /> struct QueueItem {<br /> T item;<br ...

Javascript return function issue returning object

<p>I'm using google npm package to return some search results in an angular service. I guess I don't understand anything because I can't seem to pass back the results from the google search function to my service to return it to my controller.</p><p>I'm trying to set the var results = google function return. That way I can parse the search into a json object and return it to my service and then return it to my controller for display.</p><p>the var results is always undefined</p><p>Console Output</p><pre><br /><code>RESULTS<br />search-service.js:43 undefined<br />controller.js:88 undefined<br />annyang-service.js:32 End undefined<br />search-service.js:22 [Object, Object, Object, Object, Object]<br />search-service.js:22 [Object, Object, Object, Object, Object]<br />search-service.js:22 [Object, Object, Object, Object, Object]<br />search-service.js:22 [Object, Ob...

How to go to first screen of application?

<p>I want to make a button, when I click this button, my application go to first screen.<br />My application used a lot of ways to go to screen (PageViewController, Push Navigation, present modal, ...).<br />Is there anyway to force switch to first screen and release all loaded screens?</p><br /><h2>Click here view more answers <a href="http://ift.tt/1L7MQM9">http://ift.tt/1L7MQM9</a></h2>

How std::transform and std::plus work together?

<p>I was reading C++ reference and came across std::plus function with an example. Which is pretty straight forward, its simply adds lhs and rhs. The code was:</p><pre><br /><code>#include <functional><br />#include <iostream><br /><br />int main()<br />{<br /> std::string a = "Hello ";<br /> const char* b = "world";<br /> std::cout << std::plus<>{}(a, b) << '\n';<br />}<br /></code><br /></pre><p>output: Hello world</p><p>I changed it to</p><pre><br /><code>#include <functional><br />#include <iostream><br /><br />int main()<br />{<br /> int a = 5;<br /> int b = 1;<br /> std::cout << std::plus<int>{}(a, b) << '\n';<br />}<br /></code><br /></pre><p>output : 6...

Compiling errors on homework

<p>I'm writing a program for my class and i'm getting compiling errors and I'm not sure why. I think it has something to do with my Test method.</p><pre><br /><code>public class Test1 {<br /><br /> public static void main(String[] args) {<br /><br /> String test;<br /><br /> public void Test(String s){<br /> text = s;<br /> }<br /><br /> Test test = new Test("ABC");<br /> System.out.println(test);<br /><br /> }<br />}<br /></code><br /></pre><br /><h2>Click here view more answers <a href="http://ift.tt/1UjwVMS">http://ift.tt/1UjwVMS</a></h2>

How to unify various date format?

<p>I need to accept either <code>DateTime</code> or <code>Date</code> information from a text file. The challenge is, this date information comes in any format each time. It can be in any format below.</p><pre><br /><code>20160131 23:30:15<br />31032016 23:30:15<br />2016/01/31 23:30:15<br />01/31/2016 23:30:15<br />31/01/2016 23:30:15<br />31.01.2016 23:30:15<br />31/01/2016 23:30<br />// ... more formats come with '-' separators as well and some similar format<br /></code><br /></pre><p>How can I unify these random formats into a <code>string</code> or even straight into <code>DateTime</code> ? Or is there any 3rd party library that can handle this scenario?</p><br /><h2>Click here view more answers <a href="http://ift.tt/1L7MTaK">http://ift.tt/1L7MTaK</a></h2>

Assignment help on arrays

<p>The Java assignment is to Prompt user for ten integers which are stored in an array, call a method passing the array and the method will display the values in both the original and reverse order.</p><p>I have tried every which way I know (from reading my class book and watching the lecture videos...) but I can not figure out how to write this code.</p><br /><h2>Click here view more answers <a href="http://ift.tt/1Q7xeoA">http://ift.tt/1Q7xeoA</a></h2>

JAVA: Program not detecting key presses using KeyListener

<p>I'm making a space shooter game in Java. I have it set to move up when I press the up key, but it is currently not working at all. I am using the <code>KeyPressed</code> method in the <code>KeyListener</code> interface. Here is my code. It is in 2 classes.</p><p>Game.java</p><pre><br /><code>package main;<br /><br />import java.awt.Canvas;<br />import java.awt.Color;<br />import java.awt.Graphics;<br />import java.awt.event.KeyEvent;<br />import java.awt.event.KeyListener;<br />import java.awt.image.BufferStrategy;<br />import java.awt.image.BufferedImage;<br />import java.io.IOException;<br /><br />import javax.imageio.ImageIO;<br />import javax.swing.JFrame;<br /><br />public class Game extends Canvas implements Runnable, KeyListener {<br /><br /> private static final long serialVersionUID = 1L;<br /> publ...

how to convert? C-string format of toStirng()

<p>Here is the function:</p><pre><br /><code>string toString(){<br /> string tmp;<br /><br /> char buf[80];<br /> if (*d != 1)<br /> sprintf_s(buf, "%d/%d", *n, *d);<br /> else sprintf_s(buf, "%d", *n);<br /> tmp = string(buf);<br /><br /> return tmp;<br />}<br /></code><br /></pre><p>need a c-string format of toString(), don't know how to do; plz help.. char *str();</p><br /><h2>Click here view more answers <a href="http://ift.tt/20RXAjx">http://ift.tt/20RXAjx</a></h2>

Endless recyclerview on load more scrolls to start of the list

<p>i have got onload more functionality in my app, but when i reach the end of list new items are loaded but the list automatically scrolls to the start of the list.</p><p>this is the onload function:</p><pre><br /><code> recyclerView.addOnScrollListener(new EndlessRecyclerOnScrollListener(mLayoutManager) {<br /> @Override<br /> public void onLoadMore(int current_page, int position) {<br /> // do something...<br /> Log.d("Yaeye!", "HElloyoyo");<br /> SuperHeroes superHero = listSuperHeroes.get(position);<br /><br /> Log.d("we want url", superHero.getImageUrl());<br /> imgoffset = superHero.getImageUrl();<br /> // Do something<br /> getData(0);<br /><br /> }<br /> });<br /></code...