FAQ Database Discussion Community


java calendar add is not working

java,date,calendar,add
I used add method to add 3 days to calendar. but I found that It is not working correctly. Calendar.add(Calendar.DATE, 7); please let me know what is wrong. while(dateIdx < nowDate) { int tmpYear = startCal.get(Calendar.YEAR); int tmpMonth = startCal.get(Calendar.MONTH)+1; int tmpDay = startCal.get(Calendar.DAY_OF_WEEK); System.out.println(+tmpYear+tmpMonth+tmpDay+ "- "+tmpYear+tmpMonth+(tmpDay+6)); startCal.add(Calendar.DATE, 7); //used...

Ruby on Rails Hours and Minutes in Drop Down Menu

ruby-on-rails,ruby,drop-down-menu,add,edit
In my Ruby on Rails application I am building a cinema application and for the length of each movie I want to display the hours and minutes in a drop down menu on the _form.html.erb. At the minute I am using two text fields (one for hours and one for...

Want to add random string to identifier line in fasta file

perl,random,add,identifier,fasta
I want to add random string to existing identifier line in fasta file. So I get: MMETSP0259|AmphidiniumcarteCMP1314aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Then the sequence on the next lines as normal. I am have problem with i think in the format output. This is what I get: MMETSP0259|AmphidiniumCMP1314aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa CTTCATCGCACATGGATAACTGTGTACCTGACTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab TCTGGGAAAGGTTGCTATCATGAGTCATAGAATaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac It's added to every line....

Multiple NULL addition into a List in Java

java,list,concurrency,null,add
I have 2 lists and want to copy some element from one to another, i.e. there are old and new employees list I need to union 2 lists and delete the elements that include to the old list but not include in the new one. I could solve the part...

Add up numbers in files

java,file,add
I have a directory with a lot of files (~40,000), and each file has exactly two lines, each with a number. I want to add up all of the numbers in the entire directory; how do I do that fast and efficiently? I tried this, but it doesn't work, and...

Adding Array in Standard Deviation

java,arrays,add,standard-deviation
I'm doing Standard Deviation with 10 random numbers. I have to find the average of the 10 numbers. I then subtract the average and square it. I then have to find the average again and find the square root of the average. For example: 2, 4, 4, 4, 5, 5,...

Pandas: Find empty/missing values and add them to DataFrame

python,pandas,row,add
I have dataframe where column 1 should have all the values from 1 to 169. If a value doesnt exists, I'd like to add a new row to my dataframe which contains the said value (and some zeros). I can't get the following code to work, even tho there are...

Need to Add two varibles under same value in array

php,arrays,session,add,value
I have a cart system that uses array_push to add cart items to cart. The problem is that it doesn't add price of the item to array. How can I get it to add: Item - ItemPrice Item_2 - ItemPrice_2 Item_3 - ItemPrice_3 as a set. Not as a separate...

add up positions from css in javascript

javascript,css,add
I am trying to code a little game and therefore trying to move an object in a certain area. To get somewhat of a border I am trying to add up positions. However I will simplify this for you and this is what does not work: (in JS) parseInt( $('#w'+w...

Django : admin hide add button

django,button,admin,add
Is it possible to hide the "Add another" link but keep the "Save and continue editing" button to have the possibility to add other lines ?

Add Object to JPanel after button click

java,swing,jpanel,add,jscrollpane
I have created a JScrollPane with a JPanel inside it and I want to add JPanel/JLabel/Other objects after pressing the button. For example after three button presses I want to get something like this: I tried myJPane.add(testLabel) with testlabel.setBounds()but no result, I don't want to use GridLayout because of the...

adding an unknown number of numbers in java

java,add
I have the following code below: public class Classes { /** * @param args the command line arguments */ public static void main(String[] args) { int sum = add(10,20); System.out.println(sum); // TODO code application logic here } public static int add(int number,int number2){ int c = number + number2; return...

Trouble setting and adding array values javascript

javascript,forms,add,assign
I want to give each check box an integer value and then if the box is checked add the values and display the total in a text box with the ID="options". So far the code is not sending a value to the desired location. Any instruction on how to improve...

Javascript add data in multidimesional array

javascript,multidimensional-array,add
I'm trying to understand how to add a value into my array. It is multidimensional: var eventcontent = { '2015-05-02' : [{'title':'somethingtitle1','content':'somethingcontent1','something':'something1'},{'title':'somethingtitle2','content':'somethingcontent2','something':'something2'}], '2015-05-07' : [{'title':'somethingtitle7','content':'somethingcontent7','something':'something7'}], } How can I achieve adding the following data into the '2015-05-02'?...

Type mismatch: cannot convert from boolean to int java

java,arraylist,integer,add
I am have a little problem with small part of my code, it says "Type mismatch: cannot convert from boolean to int". Can someone please help me out. ArrayList<Integer> tower = new ArrayList<Integer>(); int Kilo = tower.add(1); int Jan tower.add(2); ...

How to add class if browser window is bigger than 768

javascript,jquery,class,add,window-resize
This has just been driving me bonkers. I've looked this up in several places and can't get it to work. All I want to do is add a "fancybox-iframe" class in a menu item (the last one, "contact us") as shown here, and so far, I can't get any code...

Pandas: adding multiindex Series/Dataframes containing lists

python,pandas,add,dataframes,series
How do I add / merge two multiindex Series/DataFrames which contain lists as elements (a port-sequence or timestamp-sequence in my case). Especially, how to deal with indices, which appear only in one Series/DataFrame? Unfortunately, the .add()-method allows only floats for the fill_value argument, not empty lists. My Data: print series1...

Having error for alter table to add constraint

sql,oracle,constraints,add,alter-table
I would like to add constraint to my table name Account, attribute name Type. In the Type, I want to add type of account eg: Saving, Credit Card, Home Loan, Personal Loan, Fixed Deposit, Current, iSaver. Here is my code: ALTER TABLE ACCOUNT ADD CONSTRAINT AccountCK_Type CHECK (TYPE IN('Saving','Credit Card','Home...

Scala classes and List

list,scala,class,add
So my short code snippet looks like the following: Source.fromFile(fileName).getLines().foldLeft(List[CsvEntry]())((csvList, currentLine) => currentLine match { case pattern(organisation,yearAndQuartal,medKF,trueOrFalse,name,money) => new CsvEntry(organisation,yearAndQuartal,medKF.toInt,trueOrFalse.toInt,name,money) :: csvList case default => csvList The "fileName" is only the Name of the file, but it doesn't matter for my question. And my csvList is defined like this: type...

Echoing data from MySQL

php,mysql,count,echo,add
I have a Table in MySQL that stores data as such: Name Amount Time Person 1 1 Time Person 2 1 Time Person 3 1 Time Person 1 1 Time Person 2 1 Time Person 3 1 Time Person 1 1 Time I want to echo these reults so they...

Making ArrayList Size equal to other Array Lists Available in Java

java,loops,arraylist,match,add
I have 2 ArrayLists of varying sizes. Example - Array1.size() = 10 Array2.size() = 5 I want at all times these arrays to have same size. Thus, I have another class to ensure this. But obviously, it isn't working for me. Please help! Below is that Class code - for...

Is it possible to add Properties to an Entity Context and therefore it's connected database table

c#,dynamic,entity-framework-6,add
I have fields that the customer can add or remove in a list on their application and need to therefor add them to the database / context for later use. For example I have a model first entity context dbContext and the model in question is Customers with properties id,...

Add and print multiple char in C [closed]

c,char,int,add,scanf
I'm creating a Dice Game, where the user rolls 3 dice and gets some random outputs (up to integer 6). My next step is to add those 3 values obtained and get its sum. How do I achieve this? Any suggestion would be helpful. Here's my source code: //Roll-a-dice Game!...

How do you create a sub-directory for a website?

website,add,webpage,subdirectory
I am likely just not searching this the right way, but I have no idea how to add a sub directory to a website, you know www.websitename/HOWDOIADDTHISPART I have my index.html set up but now I want to add pages and have made some with html but not sure how...

Putting several textfields into one arraylist

java,arrays,string,arraylist,add
I´m quite the noob when it comes to coding. I am about to create a programme where you can add the title (String), author (String), release year (int) and genre (String) of a book from writing it in textfields. These things are supposed to be saved in an arraylist. I...

can i do two times grouping in sql?

sql,group-by,case,add,mssql-jdbc
SELECT CASE WHEN "dbo"."ClaimDataFormat"."RELATION" = 'DAUGHTER' OR "dbo"."ClaimDataFormat"."RELATION" = 'SON' OR "dbo"."ClaimDataFormat"."RELATION" = 'SISTER' OR "dbo"."ClaimDataFormat"."RELATION" = 'FATHER' OR "dbo"."ClaimDataFormat"."RELATION" = 'MOTHER' OR "dbo"."ClaimDataFormat"."RELATION" = 'WIFE' OR "dbo"."ClaimDataFormat"."RELATION" = 'HUSBAND' THEN 'SPOUSE' ELSE 'SELF' END AS RELATION, sum("dbo"."ClaimDataFormat"."CLAIM_AMT") AS TOTAL_CLAIM_AMOUNT FROM "dbo"."ClaimDataFormat" GROUP BY "dbo"."ClaimDataFormat"."RELATION" The result...

Adding duplicate values to ArrayList

java,arraylist,duplicates,add
Stackoverflow. I'm trying to add 4 of each words in my ArrayList into the ArrayList itself. I have in my ArrayList two Strings. One is "java" and the other one is "Program". I'm trying to write a program that adds a total of 4 words of each word. Ex: I'm...

I'm trying to make the “merge function” work by writing a Callback.

javascript,function,callback,add,indices
I think my understanding of callbacks is pretty green. But this is what have so far and my function is only adding the first index in each array together. var merge = function(array1, array2, callback){ for (var i = 0; i < array1.length; i++) { return array1[i] + array2[i]; };...

add legend matlab plot

matlab,plot,add,legend
I have a matlab function myfunction(var1,var2) which gives me a plot with a legend. I would like to generate more plots with this function in one graph. This works so far i.e. for 2 plots in one graph with: myfunction(a,b) hold on myfunction(c,d) hold off The problem here is that...

How can I add an int (minutes) to LocalDateTime.now()?

java,int,add
I want to modify LocalDateTime.now() by adding a certain amount of minutes to it. How do I do that?

R: Adding new columns iteratively

r,iterator,add,col
I am trying to write a code which evaluates 3 columns of my dataframe rowwise and iteratively, and produces a new column with the minimum value found in the evaluation. Here's what my data looks like: mydata Jan Feb Mar Apr May Jun Jul Aug 1 .25 .50 .50 .25...

AngularJS - Adding Data doesn't work

angularjs,data,add,form-submit
I am new to angular and need some help ! Loading data from my .json file works fine and also the form preview works. But now I am not able to submit my form data ! I think it has something to do with the index of DAYS array ?...

Adding program doesn't work

python,binary,add,turing-machines
I'm trying to write a simple binary adding program in Python (I know Python can do it already, I'm just doing it to practice basic computing concepts). I got it to work pretty well, the only thing that is weird is that when one of the numbers is longer than...

adding field into Document with curl CouchDB

couchdb,field,add,couchdb-futon
I want to update or insert a filed in my document in CouchDB without a new rev number. Is that possible with curl ? For example like Futon. If i open a document with futon and add a new field or update a filed its done without a new revision...

add days to a date in a for-loop javascript

javascript,date,for-loop,add,days
My problem is: I want to go through an array, which has numbers in it. For each number I want to add this number as days to a certain date: var days= ["1", "3", "4"]; $.each(days, function(key,value){ var start = new Date(2015,01,08); var nextDay = new Date(start); console.log("start-day is:"+nextDay+ "...

How to add rowid to a table with increment but group by another column?

mysql,add,rowid
for example, i have a table1: +---------------------+---------------+ | StartTime | dIPaddr | +---------------------+---------------+ | 2014-04-09 09:47:53 | 0.210.208.240 | | 2014-04-09 09:47:53 | 0.210.208.240 | | 2014-04-09 09:47:55 | 0.210.208.240 | | 2014-04-09 08:39:55 | 0.210.243.93 | | 2014-04-09 08:39:57 | 0.210.243.93 | | 2014-04-09 08:40:00 | 0.210.243.93 | |...

JQuery: Create a div as parent and add existing elements to it

jquery,append,add,parent,children
I want to create a new div(row) which contains everytime 4 <a>(incl. the children of <a>) tags and starting before the first <a>tag. Here is how it looks right now: <div class="container" id="cont"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header">My Page Header</h1> </div> </div> <a>....</a> <a>....</a> <a>....</a> <a>....</a> <a>....</a> <a>....</a> <a>....</a>...

Java: Extending ArrayList have add() return Object

java,arraylist,add
When extending the ArrayList class you could also edit its methods, right? I would like to extend from ArrayList and have the add() method return an Object instead of boolean (or void). So I could do this: CustomObject o = objectList.add(new CustomObject("myObject")); This would be the class: public static class...

Jquery, using $.each, doesn't get the value of variable

jquery,select,add,each,options
I'm using Jquery to add some options to a select, but, the options are not always the same, so, I use a variable called materia to get the value of a previus select to know which options I should add. I dont know if Im explaining correctly, here's some code....

Symfony2 : Add method to an Entity

php,symfony2,entity,add
I would like to add a method to an Entity. This method returns X characters from the Entity's title, and i would like to print this title in my twig file. Is it possible ? twig : <ul class="nav nav-pills nav-stacked"> {% for blog in listBlogs %} <li> <a href="{{...

No VC/inc folder in my MSVS 2013 directory

add,fltk
I'm trying to add FLTK to MSVS 2013 and I'm copying the .lib files into vc/inc but I cannot find the folder anywhere. Under the Visual Studio 2013 folder all I have is ArchitectureExplorer, Backup Files, Code Snippets, Projects, Settings, StartPages, Templates, Visualizers What am I missing here? I'm sure...

trying to delete automatically added and sorted answers from a VBA textbox into excel cells

excel,vba,delete,duplicates,add
I have code that adds and that if an answer is provided based on a certain criteria it adds itself to a list. as i have been troubleshooting the rest of the program i have accrued a lot of answers that have been added. if i select the cells it...

Adding two numbers in base 10 on Assembler

algorithm,assembly,add,8086,proc
How can I add 2 numbers that their value is on base 16 and make the result on "base 10" on assembler. For example: "5h+5h=10h" - I know it's wrong, I just want it to be visually 10h And not: 5h+5h=Ah CODE: MOV AX,5h MOV BX,5h ADD AX,BX result: ax=Ah...

Error: add item to ArrayList

android,arraylist,add,logcat
Method of add gives error for ArrayList. It isn't adding. public List<String> arrayList; ... arrayList = new ArrayList<String>(); ... savenumberButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String str = numberText.getText().toString(); Integer cout = listView.getCount()+ 1; String str1 = cout.toString().concat("."+str); try { arrayList.add(listView.getCount(), str1); } catch (Exception e) { Log.w("Error",...

Java Iterators and Lists - add to 3rd list

java,list,iterator,add
I have two LinkedList and I want to add the Integeres from both into a third List. I'm trying to add the first element from the first list, then the first element from the second list etc. I need the final output to be [1, 6, 2, 7, 3, 8,...

Adding and setting new object in ArrayList at specific index (JAVA)

java,object,arraylist,set,add
I made some projects with ArrayList. They have same problem with adding new object. My goal is to add new Object at specific location. For instance, each index hold four strings. index 0: New York Times, 1234, New York, NY index 1: NBCPhiladelphia, X123, Philadelphia, PA index 2: FOX News,...

Is there a name for this add / plus type of button in Android app development? If so, how can I add it to my application?

android,button,add
In many popular apps I have seen the type of button below (this one is from Google Keep's mobile app). The "add" button is very intuitive and I'd like to add it to an app I am working on. What is the name of this type of button? I am...

How to add Node data and Link data dynamically in GoJS?

javascript,add,gojs
myDiagram.model = new go.GraphLinksModel( [ { key: "Alpha", color: "lightblue" }, { key: "Delta", color: "pink" } ], [ { from: "Alpha", to: "Alpha" }, { from: "Delta", to: "Alpha" } ]); I need to add more values dynamically, how should I do this?...

Add Numbers from TextView Android

android,textview,add
I need to pick a button, 'H' which represents the atomic element in periodic table, as many times as needed, and it has to add up the overall weight number, and display it in the mw_results. So far, I am only able to display it, for two times, as I...

Automatically add a row or a value below the last non-empty / used row

excel,vba,add,rows
In between the two 'table data download' sections, the number of rows of the first table is not fixed. How to add the VBA script to enable it to automatically add five rows immediately after the last used row of the first table, and then start the second table download?...

Add a new table row every 24 hours

php,html,table,row,add
my question is fairly simple as I am quite new to dynamic coding languages. Basically, I want to add a new table row to my table, every 24 hours. The new table row should be added at 00:00 every day and the table data is going to be a pre...

Add all buttons from my form to a list

c#,winforms,list,button,add
I have 86 buttons in my windows form. I have made a list of buttons in my code. Now I want to add all the buttons to the list. Is there a way to add al the buttons to the list in one time or do i need to add...

Cumulative sum of numeric vectors in list

r,vector,add,lapply,sapply
I hope someone will be able to help me on this problem. I have a list object that includes 48 vectors and each vector has a length of 2,000,000 observations in it. Here is a code that creates the same structure with only 100,000 items per vector: mtx_sim <- matrix(data...

Add items to ul and delete them

jquery,delete,add
I have a question! I want to add some list items to and unorderdlist with a click on a button. And i want to delete those items when i click on a button. This is what i have made.. i can add them but not delete them.. Can you guys...

add some hours to time with microseconds php

php,time,format,add,hour
HI I need to add 8 hours in the time which i have formatted like below $t = microtime(true); $micro = sprintf("%06d",($t - floor($t)) * 1000000); $d = new DateTime( date('Y-m-d H:i:s.'.$micro, $t) ); $d->format("Y-m-d H:i:s.u") // 2015-03-02 07:37:18.715271 i use this format because i need to show microseconds also....

JAVA: How to calculate sum of user-inputted numbers in a loop (numbers are stored in same variable)

java,loops,while-loop,sum,add
This code is part of a receipt-program. I looped it so that users can input item prices (20 item maximum). I need to print the sum of all item-prices. Note that all item-prices are stored into the same double variable newItemPrice. Is this even possible? If not, please give me...

Add Values in Form

javascript,html,forms,add,value
I've made a form with a few items. Each item has a value. Now my question is, how can I add the values from these items (when you check them) to the total value? See JSFiddle <form id="AddValuesForm" action=""> <fieldset id="AddValuesFormPart1"> <legend>Add Values</legend> <ul> <li> <ul id="AddValueList"> <li id="AddValueItem1"> <input...

Adding a large number with a small number in Python

python,python-2.7,add,largenumber
I wrote a program in python which the program has one number with high value (T) and another number with a low value (a). When I add them up, the small number is ignored due to its low value. How can I fix this problem. The part of my program...

SQL Invalid ALTER TABLE option

sql,oracle,datetime,add,alter-table
With the following SQL statement: ALTER TABLE USERS ADD LAST_LOGIN DATETIME() I am receiving the error below: Error report - SQL Error: ORA-01735: invalid ALTER TABLE option 01735. 00000 - "invalid ALTER TABLE option" *Cause: *Action: I cannot for the life of me understand why SQLDeveloper does not like the...

BigInteger addition always 0

java,add,biginteger,factorial
I have the following issue: when trying to add to a sum of BigIntegers the outcome remains 0. Here is the code: public void NumberOfOutcomes(int x, int y){ BigInteger first = BigInteger.valueOf(0); BigInteger second = BigInteger.valueOf(0); for(int i = 0; i <= (x / 2); i++){ first.add( fac(x - i).divide((fac(x...

Format value result in texbox. 580 to 0.58E

c#,textbox,numbers,format,add
how to format my result to something like that 580 to 0.58E in textbox4 here ?, i cannot find a solution. private void button1_Click(object sender, EventArgs e) { double c, moc, dlugosc, koszt; c = Convert.ToDouble(textBox1.Text); moc = Convert.ToDouble(textBox2.Text); dlugosc = Convert.ToDouble(textBox3.Text); koszt= c * moc * dlugosc; textBox4.Text =...

Add item to list in txt file using json (python)

python,json,list,file,add
I've only started python very recently and have a few questions about using json for adding items to a list in a file. My txt file contains the following string: [[1, 2, 3, 4], [5, 6, 7, 8]] I would like to use json to add a item to the...

Excel adding data based on current data

excel,excel-vba,data,add,condition
I'm trying to write a macro that i can run which will allow me to simply sort a range of orders into what i like to call categories. The basic idea is that we get orders through, and we generally have to print a different type of shipping label for...

JavaScript adding string to number instead of value

javascript,html,add
I recently had a problem with saving my game, and after some further fiddling around, I successfully got localStorage(); to work! Unfortunately, when you do refresh or reopen the game, a nasty bug occurs. The game I am trying to recreate is Cookie Clicker. The bug is as follows: if...