Programming Languages-Other

19K

Solutions

19K

Contributors

A programming language is a formal constructed language designed to communicate instructions to a machine, particularly a computer. Thousands of different programming languages have been created, mainly in the computer field, and many more still are being created every year. The description of a programming language is usually split into the two components of syntax (form) and semantics (meaning). Some languages are defined by a specification document (for example, the C programming language is specified by an ISO Standard), while other languages (such as Perl) have a dominant implementation that is treated as a reference. Some languages have both, with the basic language defined by a standard and extensions taken from the dominant implementation being common.

Share tech news, updates, or what's on your mind.

Sign up to Post

0
Optimize your web performance
LVL 1
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Hi,
Where to adjust to have clear boundary to each record below?
http://my-friend.co/Test_rec4/Default.aspx?userid=mc23

Here are two records below and I expect to have one clear boundary to each record
16f.png
0
import java.util.*;
import java.util.stream.*;
public class X {
	public static void main(String[] args) {
		List<String> list = Arrays.asList("xxax", "xbxbx", "xxcx", "zzz");
		System.out.println(noX(list));
	}
	public static List<String> noX(List<String> strings) {
		return strings.stream().map(s -> s.replaceAll("x","")).collect(Collectors.toList());
    }	
}

Open in new window

in above program what are Collectors , stream, collect methods. And why map is used in this lamda functional examples
0
Hi,
I want to have thicker color to the list (row/record) below. Where to adjust?
http://my-friend.co/Test_rec4/Default.aspx?userid=mc23
0
I created a x64 context menu shell extension in C++, which works fine when I right click a file or folder in the file list. But when I right click on a directory in the directory tree on the left Windows Explorer crashes, with no error details.

Any idea what can cause this to happen only in the directory tree?
0
Hi,

http://codingbat.com/prob/p105967

I wrote my code as below and failing some tests
public List<String> noX(List<String> strings) {
   strings.replaceAll(x -> "");
  return strings;
}

Open in new window



Expected	Run		
noX(["ax", "bb", "cx"]) → ["a", "bb", "c"]	["", "", ""]	X	
noX(["xxax", "xbxbx", "xxcx"]) → ["a", "bb", "c"]	["", "", ""]	X	
noX(["x"]) → [""]	[""]	OK	
noX([""]) → [""]	[""]	OK	
noX([]) → []	[]	OK	
noX(["the", "taxi"]) → ["the", "tai"]	["", ""]	X	
noX(["the", "xxtxaxixxx"]) → ["the", "tai"]	["", ""]	X	
noX(["this", "is", "the", "x"]) → ["this", "is", "the", ""]	["", "", "", ""]	X	
other tests
		X	

Open in new window


how to fix and improve my code, please advise
0
Hi,

I am trying to double list numbers using functionala lamda programming


http://codingbat.com/prob/p117665
Given a list of integers, return a list where each integer is multiplied by 2.

doubling([1, 2, 3]) → [2, 4, 6]
doubling([6, 8, 6, 8, -1]) → [12, 16, 12, 16, -2]
doubling([]) → []

Open in new window


Solution:

public List<Integer> doubling(List<Integer> nums) {
  nums.replaceAll(n -> n * 2);
  return nums;
  
  // OR the equivalent java streams solution:
  // return nums.stream()
  //  .map(n -> n * 2)
  //  .collect(Collectors.toList());
}

Open in new window

i am trying to write a java a program to execute it in exclipse to see result in eclipise consoel

import java.util.List;

public class FuncProgDouble {
	public static void main(String[] args) {
		List<Integer> li=[1, 2, 3];
		System.out.println(doubling(li));
	}

	
	public static List<Integer> doubling(List<Integer> nums) {
	  nums.replaceAll(n -> n * 2);
	  return nums;
}

	
}

Open in new window


i am getting below compilation error.

Multiple markers at this line
      - Syntax error on token "]", } expected
      - Type mismatch: cannot convert from int[] to
       List<Integer>
      - Syntax error on token "[", { expected

canont i add primitives as below to Integer list


import java.util.ArrayList;
import java.util.List;

public class FuncProgDouble {
      public static void main(String[] args) {
            
            
            ArrayList<Integer> al=new ArrayList<Integer>();  
            al.add("1");  
            al.addAll("3");  
            al.addAll("8");  
            //al.add(1,"Sachin");
            
            //List<Integer> li=[1, 2, 3];
            System.out.println(doubling(al));
      }

      
      public static List<Integer> doubling(List<Integer> nums) {
        nums.replaceAll(n -> n * 2);
        return nums;
}

      
}

please advise
0
Hi,
To this
http://my-friend.co/Test_rec4/Default.aspx?userid=mc23

I want to ensure picture file would always appear at the place highlighted below (that is at end of the row/record). What to adjust?

16d.png
0
Hi,
To the list of this

http://my-friend.co/Test_rec4/Default.aspx?userid=mc23

how to create click event to record/row, to further go to other URL?
0
Hi,
To relevant list below, to this

http://my-friend.co/Test_rec4/Default.aspx?userid=mc23

The picture file does not appear at the end of the row/record. What to adjust?
0
Industry Leaders: We Want Your Opinion!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Hi,
Using these codes (in the project),
        private static Cell InsertCellInWorksheet(string columnName, uint rowIndex, WorksheetPart worksheetPart)
        {
            Worksheet worksheet = worksheetPart.Worksheet;
            SheetData sheetData = worksheet.GetFirstChild<SheetData>();
            string cellReference = columnName + rowIndex;
            Row row;
            if (sheetData.Elements<Row>().Where(r => r.RowIndex == rowIndex).Count() != 0)
            {
                row = sheetData.Elements<Row>().Where(r => r.RowIndex == rowIndex).First();
            }
            else
            {
                row = new Row() { RowIndex = rowIndex };
                sheetData.Append(row);
            }
            if (row.Elements<Cell>().Where(c => c.CellReference.Value == columnName + rowIndex).Count() > 0)
            {
                return row.Elements<Cell>().Where(c => c.CellReference.Value == cellReference).First();
            }
            else
            {
                Cell refCell = null;
                foreach (Cell cell in row.Elements<Cell>())
                {
                    if (string.Compare(cell.CellReference.Value, cellReference, true) > 0)
                    {
                        refCell = cell;
                        break;
                    }
                }
                Cell newCell = new Cell() { CellReference = cellReference };
                row.InsertBefore(newCell, refCell);
                

Open in new window

0
Hi,
Is there one example to read each message, one by one, for one specific text string, within Sent folder of Outlook?
0
I have a python script that will construct a list of futures contracts for a specified symbol, exchange, and year window.  The script will download pricing information from Quandl for each contract in the strip.  This script works properly.

import pandas as pd
from pandas import ExcelWriter
import quandl

symbol = 'ES'
exchange = 'CME/'

start_year = 2015
end_year = 2016


#Constructs a list of futures contract codes for a particular symbol
#and timeframe.
futures = []
months = 'HMUZ'
for y in range(start_year, end_year+1):
    for m in months:
        futures.append("%s%s%s%s" % (exchange, symbol, m, y))

#Download the data from Quandl.
for f in futures:
    quandl.ApiConfig.api_key = "xxxx"  
    data = quandl.get(str(f))
    data = data.drop(data.columns[[3, 4, 7]], axis=1)

I have another python script that will create a continuous futures contract from 2 consecutive contracts in the futures strip.  It uses the perpetual method; identifying the roll date as the first day where volume of the far contract exceeds volume of near contract, and then adjusts the prices of the previous 4 sessions to roll date by weighting the near and far contracts in increments/decrements of 20%.  This script works properly.

import pandas as pd
from pandas import ExcelWriter
import quandl

#Get quandl futures data
quandl.ApiConfig.api_key = "xxxx"    
contract_near = quandl.get("CME/ESH2015")
contract_far = quandl.get("CME/ESM2015")

#Drop the columns …
0
Hi,
Further to this
https://www.experts-exchange.com/questions/29029100/Problem-to-show-list.html?anchor=a42174635¬ificationFollowed=190745230#a42174635

and I have ImageHandler.cs like
using System;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Data.OleDb;
using System.Xml;
using System.Globalization;
using System.Collections.Generic;
using System.Drawing;
using System.Text; // This was needed to make ASCIIEncoding function
using System.Security.Cryptography; // This was needed to make everything related to MD5 function
using System.Web.Services;

namespace Own_rec
{
    public class ImageHandler : IHttpHandler
    {
        /// <summary>
        /// You will need to configure this handler in the Web.config file of your 
        /// web and register it with IIS before being able to use it. For more information
        /// see the following link: http://go.microsoft.com/?linkid=8101007
        /// </summary>
        public void ProcessRequest(HttpContext context)
        {
            //string userId = string.Empty;
            int userId = 0;
            //-- get the ID from query string you get from <img src tag
            if (null != 

Open in new window

0
Hi,
Using these codes

        public static List<HouseData> GetHouseList()
        {
            List<HouseData> houseList = new List<HouseData>();
            using (SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["Mssqlconn3"].ConnectionString))
            {
                using (SqlCommand sqlCmd = new SqlCommand("SELECT house_name, address1, address2, price, price_curr, raised_by_user_id FROM house_tab", sqlConn))
                {
                    sqlConn.Open();
                    sqlCmd.CommandType = CommandType.Text;
                    SqlDataAdapter sqlAd = new SqlDataAdapter(sqlCmd);
                    DataTable sqlDt = new DataTable();
                    sqlAd.Fill(sqlDt);
                    sqlConn.Close();
                    if (null != sqlDt)
                    {
                        houseList = sqlDt
                                        .AsEnumerable()
                                        .Select(dataRow => new HouseData
                                        {
                                            house_name = dataRow.Field<string>("house_name"),
                                            address1 = dataRow.Field<string>("address1"),
                                            address2 = dataRow.Field<string>("address2"),
                                            price = dataRow.Field<decimal>("price"),
                                            price_curr = 

Open in new window

0
I am doing below challenge

http://codingbat.com/prob/p128270
public int[] front11(int[] a, int[] b) {
   //int[] z;
  if(a.length>0&&b.length>0){
 
 // z[0]=a[0];
 // z[1]=b[0];
 // return z;
   return new int[]{a[0],b[0]};
  }
   else if(a.length>=0&&b.length==0){
  // int[] z=new int[2];
  //z[0]=a[0];
  //z[1]=b[0];
  return new int[]{a[0]};
  }
  else if(a.length==0&&b.length>=0){
  // int[] z=new int[2];
 // z[0]=a[0];
 // z[0]=b[0];
 // return z;
   return new int[]{b[0]};
  }
  return new int[0];
  
}

Open in new window


i am failing one
how to improrve my code
Expected      Run            
front11([1, 2, 3], [7, 9, 8]) → [1, 7]      [1, 7]      OK      
front11([1], [2]) → [1, 2]      [1, 2]      OK      
front11([1, 7], []) → [1]      [1]      OK      
front11([], [2, 8]) → [2]      [2]      OK      
front11([], []) → []      ArrayIndexOutOfBoundsException: 0 (line:14)      X      
front11([3], [1, 4, 1, 9]) → [3, 1]      [3, 1]      OK      
front11([1, 4, 1, 9], []) → [1]      [1]      OK      
other tests
OK      
please advise
0
Hi,

I was working on below challenge again

http://codingbat.com/prob/p151359
public String withoutX2(String str) {
  
  if(str.length()==1&&str.charAt(0)=='x'){
    return "";
  }
  if(str.length()>=2){
  if ( str.charAt(0)=='x' && str.charAt(1)=='x' ){
  return str.substring(2);
  }else if(str.charAt(0)=='x'){
      return str.substring(1);
  }else if(str.charAt(1)=='x'){
      return str.substring(0,1)+str.substring(2);
  }
  }
  return str;
}

Open in new window

below code passes all tests
Expected      Run            
withoutX2("xHi") → "Hi"      "Hi"      OK      
withoutX2("Hxi") → "Hi"      "Hi"      OK      
withoutX2("Hi") → "Hi"      "Hi"      OK      
withoutX2("xxHi") → "Hi"      "Hi"      OK      
withoutX2("Hix") → "Hix"      "Hix"      OK      
withoutX2("xaxb") → "axb"      "axb"      OK      
withoutX2("xx") → ""      ""      OK      
withoutX2("x") → ""      ""      OK      
withoutX2("") → ""      ""      OK      
withoutX2("Hello") → "Hello"      "Hello"      OK      
withoutX2("Hexllo") → "Hexllo"      "Hexllo"      OK      
withoutX2("xHxllo") → "Hxllo"      "Hxllo"      OK      
other tests
OK      

But if i have input say z what would be output and my code fails in that scenario right

withoutX2("z") → z
public class WithoutX2 {

	public static void main(String[] args) {
		
		// TODO Auto-generated method stub
		System.out.println("Value is"+withoutX2("z"));//should get true but getting false
	}
	
	public static String withoutX2(String str) {
		  
		  if(str.length()==1&&str.charAt(0)=='x'){
		    return "";
		  }
		  if(str.length()>=2){
		  if ( str.charAt(0)=='x' && str.charAt(1)=='x' ){
		  return str.substring(2);
		  }else if(str.charAt(0)=='x'){
		      return str.substring(1);
		  }else if(str.charAt(1)=='x'){
		      return str.substring(0,1)+str.substring(2);
		  }
		  }
		  return str;
		}


}

Open in new window

0
I'm trying to read a string from a plain text file. The string contains the degree symbol(°). In the code ,it is read as ° (capital A circumflex accent and then the degree symbol). How can I just read the degree symbol?
I'm using Qt creator as the IDE and the language is FORTRAN 77
0
Hi,
I also want to capture values of M/C/O, on either Column 3 or 4 of Sheet5. How to adjust Scan_list4, of the attached file?
Columns-Map2.xlsm
0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

How to visualize call hierarchy in java using a pencil and paper all the way from beginning till end from UI to say model to controllers to dao to db calls etc including which object go in method and where the values changing etc in the new project

Please advise
0
Hi,
I am looking for String Format Method example using various date formats
https://www.javatpoint.com/java-string-format.

I found above link but no example there using the date format though like MMDDYYYY or YYYYMMDD etc to represent date?
please advise
0
I have a list of 493 peeople buried in section B of the local cemetery.  I know which “lot” in the section and which of the 12 grave sites in the particular lot they are buried in.  Using Inkscape, I have drawn the names of the dead people in sections C, CE, D, and E. I was going to draw this section too but is there any way to have inkscape do it automatically from a csv file of the name, lot, and grave site that I can easily make from the spreadsheet I already have?
0
Hi,

When i right click on junit test(say ProductWeightTest.java) and run as Junit test from eclipse i keep getting popup with error

error could not create the java virtual machine error a fatal exception has occurred. program will exit



when i run individual test (checkWeightLessthan10Lb) in above test ProductWeightTest.java  i keep getting initialization error in eclipse console.

i tried changing eclise .ini entries but still getting same error. please advise
0
when i run junit test class getting initializationError Runner: Junit 4

not sure why suddenly i am getting that error and how to resolve it.

please advise
0
Hi,

I have a setter method(setBeginDate) that changed by some one from calendar date object to String object.

now i have to change my unit test to reflect that by changing to String.

articleVisibleData.setBeginDate(setDateMonthYear(30, 1, 2015));

How i edit method above so that i get String

earlier method is

            public Calendar setDateMonthYear(int day, int month, int year) {
            Calendar cal = GregorianCalendar.getInstance();
            cal.clear();
            cal.set(Calendar.DAY_OF_MONTH, day);
            cal.set(Calendar.MONTH, month);
            cal.set(Calendar.YEAR, year);
            return cal;
      }

now i am trying like below but wont work


      public String setDateMonthYear(int day, int month, int year) {
            String str="";
            str= str.concatenate(date).concatenate(month).concatenate(year)
            return str;
      }


earlier from test case i used to call like

articleVisibleData.setDate(setDateMonthYear(30, 1, 2015));

please advise
0

Programming Languages-Other

19K

Solutions

19K

Contributors

A programming language is a formal constructed language designed to communicate instructions to a machine, particularly a computer. Thousands of different programming languages have been created, mainly in the computer field, and many more still are being created every year. The description of a programming language is usually split into the two components of syntax (form) and semantics (meaning). Some languages are defined by a specification document (for example, the C programming language is specified by an ISO Standard), while other languages (such as Perl) have a dominant implementation that is treated as a reference. Some languages have both, with the basic language defined by a standard and extensions taken from the dominant implementation being common.