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

Hi,
Within Javascript below, I cannot update value into tb_pass. Why?
                    var name = this.$content.find('.name').val();
                    var newname = this.$content.find('.newname').val();
                    var status = this.$content.find('.status');
                    if (name == "") {
                        $.alert("Invalid password and please enter one valid password!");
                        return false;
                    }
                    if (name == newname) {
                        // status.val(scorePassword(name));
                        //$.alert('Valid Password is entered!');
                        var pass_val = document.getElementById("tb_pass").value;
                        pass_val = name;
						...
                <asp:Textbox ID="tb_pass"
                    width="310px"
                    Style='display:none;visibility:hidden;'
                    Font-Names="標楷體" 
                    Font-Size="11pt" 
                    Font-Bold="true"
                    ForeColor="Black"
                    runat="server" />
					...

Open in new window

0
Hi, I am monitoring weather status remotely. I am intend to use Huawei E303F -usb dongle to push data. I did try sakis3g, doesn't help auto-connection after restart. please do assist me how to set internet connection automatically after restart and network down.
0
hi,

I am new to swagger
https://swagger.io/swagger-ui/

what it does to applciation and how to integrate and get it.

please advise
0
hi,

I am going through below link

https://maven.apache.org/settings.html


what is importance of below entries and their sub entries

1. proxies
2. servers
3. mirrors
4. profiles has repositories and has internal and snapshot there

if i have say 4 projects in 4 workspaces with 4 settings.xmls how do i refer all of them in eclipse ?
say
workspace_1 should point to project_1 with settigs1.xml
similary
workspace_2 should point to project_2 with settigs2.xml
workspace_3 should point to project_3 with settigs3.xml
workspace_4 should point to project_4 with settigs4.xml

please advise
0
I'm looking to make a specific graph layout from a specific **format** of **Python** data, but where the **data may be text, string, or another Python object**.

It has to be able to do it on the **fly**, and make visual formatting decisions based on whether the data is "the same" (regardless of numerically, text or another Python object).

It doesn't matter if Excel is used to make the image (*.xls or .csv) or ```matplotlib```or anything else.

***The coloring in the cells*** is based on whether the items within ```{1:"A", 2:"A"}```are **equivalent** (not the same object). **Green** for ```True```, **red** for ```False```. For example: ```"A" == "A"``` (as in the preceding sentences), or ```(10/5) == (20/10)```, or ```["A", 1, <test object at 0x1052c9b70>] == ["A", 1, <test object at 0x1052c9b70>]``` would all be green.

The text that appears in the cells is just the \__str__ representation of the object.

EDIT: I'm not so much looking for someone to do the work for me, but a recommendation of which tool (```XLS```, ```matplotlib```, ```whathaveyou```) would be best suited - and maybe a link to a tutorial on how to do some of those more difficult features (like the cell coloring).

I.e. ...
   
    {
        1000:{
              "Sample1":{1:"A", 2:"A"},
              "Sample2":{1:"A", 2:"A"},
              "Sample3":{1:"A", 2:"A"},
              },

        1001:{
              "Sample1":{1:"A", 2:"A"},
              "Sample2":{1:"A", 2:"A"},…
0
Hi,

From what I know, if you are documenting a data structure (e.g. JSON) with embedded objects, you might have something like this for the data schema tables:

DISCLAIMER: In the real world, I doubt you'd have a full (e.g.) doctor object embedded in the prescription object. More likely, you'd have a record number for patient, doctor, drug, but the below is useful for this example. :)

PRESCRIPTION OBJECT
Date
Time
Rx Number
Patient Object
Doctor Object
Drug Object
Directions
etc.


You'd then have tables for the aforementioned objects, which themselves could contain objects:
DOCTOR OBJECT
LastName
FirstName
IdNumbers Object
Address
etc.

And in turn...
ID NUMBERS OBJECT
Licence
DEA
NPI
-----------
Now, to the question. I'm documenting an API where some of the embedded objects contain only one field/object. To use the above example, something like:

PRESCRIPTION OBJECT (as before: contains many fields/objects)

DOCTOR OBJECT (Contains one object)
IdNumbers Object

ID NUMBERS OBJECT (Contains one field)
License

Per the above, would I be overdoing it to have separate data tables for these objects containing only one field/object? If so, I'd need to find a clean way to embed everything in the parent table.

Thanks!
Steve
0
The following example makes use of JSONObject and JSONArray where JSONObject is a java.util.Map and JSONArray is a java.util.List, so you can access them with standard operations of Map or List.

import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.parser.ParseException;
import org.json.simple.parser.JSONParser;

class JsonDecodeDemo {

   public static void main(String[] args){
	
      JSONParser parser = new JSONParser();
      String s = "[0,{\"1\":{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}}]";
		
      try{
         Object obj = parser.parse(s);
         JSONArray array = (JSONArray)obj;
			
         System.out.println("The 2nd element of array");
         System.out.println(array.get(1));
         System.out.println();

         JSONObject obj2 = (JSONObject)array.get(1);
         System.out.println("Field \"1\"");
         System.out.println(obj2.get("1"));    

         s = "{}";
         obj = parser.parse(s);
         System.out.println(obj);

         s = "[5,]";
         obj = parser.parse(s);
         System.out.println(obj);

         s = "[5,,2]";
         obj = parser.parse(s);
         System.out.println(obj);
      }catch(ParseException pe){
		
         System.out.println("position: " + pe.getPosition());
         System.out.println(pe);
      }
   }
}
On compiling and executing the above program, the following result will be generated −

The 2nd element of array
{"1":{"2":{"3":{"4":[5,{"6":7}]}}}}

Field "1"

Open in new window

0
import org.json.simple.JSONObject;

class JsonEncodeDemo {

   public static void main(String[] args){
      JSONObject obj = new JSONObject();

      obj.put("name", "foo");
      obj.put("num", new Integer(100));
      obj.put("balance", new Double(1000.21));
      obj.put("is_vip", new Boolean(true));

      System.out.print(obj);
   }
}
On compiling and executing the above program the following result will be generated −

{"balance": 1000.21, "num":100, "is_vip":true, "name":"foo"}

Open in new window


what above example doing
is it encoding jsonobject to java object?
i see output also seems like json to me?
Following is another example that shows a JSON object streaming using Java JSONObject −

import org.json.simple.JSONObject;

class JsonEncodeDemo {

   public static void main(String[] args){
	
      JSONObject obj = new JSONObject();

      obj.put("name","foo");
      obj.put("num",new Integer(100));
      obj.put("balance",new Double(1000.21));
      obj.put("is_vip",new Boolean(true));

      StringWriter out = new StringWriter();
      obj.writeJSONString(out);
      
      String jsonText = out.toString();
      System.out.print(jsonText);
   }
}
On compiling and executing the above program, the following result is generated −

{"balance": 1000.21, "num":100, "is_vip":true, "name":"foo"}

Open in new window


how above one is differen from first one?
0
hi,

i am looking at below link

http://www.onjava.com/pub/a/onjava/2005/03/02/commonchains.html

How this apache chain related to spring and rest web serives. Any good examples around this to understand end to end flow. why we need chain of beans?

when  i try to download apache chain says
http://commons.apache.org/proper/commons-chain/downloads.html

says
Not Found

The requested URL /proper/commons-chain/downloads.html was not found on this serve


please advise
0
int y=10;
float x=y/100;
System.out.println(x)

Open in new window

i expected above result 0.1 but getting 0.0 wonder why?


int y=10;
int x=y/100;
System.out.println(x)

Open in new window

why above is 0?
please advise
0
hi,

what are differences between
@PathParam,@QueryParam,@FormParam and @Provider,@Consumes,@Produces

when we use which one.

any end to end examples on these rest web service concepts
please advise
0
I am trying to set me context menu right click location to open whenever the user clicks on my control (Me.GridSpread). It always seem to open on right click of the context control itself on the upper menu button area.

Private Sub frmSearch_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
        If e.Button = Windows.Forms.MouseButtons.Right Then
            SearchContextMenu.Show(Me.GridSpread, New System.Drawing.Point(0, 200))
        End If
    End Sub

Open in new window

0
hi,

i was reading as below

Throw generic Error Messages − A web service method should use HTTP error messages like 403 to show access forbidden etc.

What HTTP Status Code 201 states?
It means, CREATED, when a resource is successful created using POST or PUT request. Return link to newly created resource using location header.

What HTTP Status Code 204 states?
It means, NO CONTENT, when response body is empty for example, a DELETE request.
i see 200 UNKNOWN No body returned for response




What HTTP Status Code 304 states?
It means, NOT MODIFIED, used to reduce network bandwidth usage in case of conditional GET requests. Response body should be empty. Headers should have date, location etc.



What HTTP Status Code 400 states?
It means, BAD REQUEST, states that invalid input is provided e.g. validation error, missing data


What HTTP Status Code 401 states?
It means, FORBIDDEN, states that user is not having access to method being used for example, delete access without admin rights.



What HTTP Status Code 409 states?
It means, CONFLICT, states conflict situation while executing the method for example, adding duplicate entry.




any good example to test above http status codes?

using post when i tried to create a resourece i got 200 though not 201.

i searched in code for 200 or 201 to change but never found them?
where these numbers are coming from if not from code?
0
hi,

I was reading as below

No sensitive data in URL − Never use username, password or session token in URL , these values should be passed to Web Service via POST method.

how POST protect data?
i was not clear.

please advise
0
Hi,

I was reading as below

Session based authentication − Use session based authentication to authenticate a user whenever a request is made to a Web Service method.

how to do   Session based authentication .

any sample end to end example on this relating to web services ?
0
hi,
i was reading as below
What is the difference between PUT and POST operations?
PUT and POST operation are nearly same with the difference lying only in the result where PUT operation is idempotent and POST operation can cause different result.
i was not clear. what it mean by post can cause different results?

please advise
0
I was reading as below
https://www.tutorialspoint.com/restful/restful_security.htm

Restriction on Method Execution − Allow restricted use of methods like GET, POST and DELETE methods. The GET method should not be able to delete data.

how to use get to delete a data?
is that is possible even though that is not recommended?
please advise
0
hi,

i was reading as below
https://www.tutorialspoint.com/restful/restful_statelessness.htm

what is the meaning of below

Consider the following URL −

https://localhost:8080/UserManagement/rest/UserService/users/1

If you hit the above url using your browser or using a java based client or using Postman, result will always be the User XML whose Id is 1 because the server does not store any information about the client.

<user>
   <id>1</id>
   <name>mahesh</name>
   <profession>1</profession>
</user>

how result with id 1 is related to statelessness.

since we created new user it created with id 1 and while retrieving we get same value right.

please advise
0
hi,

i am trying below example
https://www.tutorialspoint.com/restful/restful_first_application.htm

when i added project to tomcat 8.5 in eclipse and trying to start tomcat i am getting below error

Server Tomcat v8.5 Server at localhost failed to start.
are these below 3 same jar or different jars?

\jaxrs-ri-2.17\jaxrs-ri\api
\jaxrs-ri-2.17\jaxrs-ri\ext
\jaxrs-ri-2.17\jaxrs-ri\lib
jaxrs-ri seems jar right which has api and ext and lib within that?

i downloaded that and added from below site
http://www.java2s.com/Code/Jar/j/Downloadjaxrsapijar.htm
it seems to have 2.0 version not 2.17 as mentioned in site?
where i can get exact version jar?
where i can see exact error trace of tomcat?

please advise
tomcatStartErr.png
0
hi,

i was reading below that rest webservices put is for creating
https://www.tutorialspoint.com/restful/restful_introduction.htm

I remember reading some where POST is for create and PUT is to update.

can you please advise which HTTP method for which?

Sr.No.      HTTP Method      URI      Operation      Operation Type
1      GET      /UserService/users      Get list of users      Read Only
2      GET      /UserService/users/1      Get User with Id 1      Read Only
3      PUT      /UserService/users/2      Insert User with Id 2      Idempotent
4      POST      /UserService/users/2      Update User with Id 2      N/A
5      DELETE      /UserService/users/1      Delete User with Id 1      Idempotent
6      OPTIONS      /UserService/users      List the supported operations in web service      Read Only
why it says operation type for POST is N/A where as put is idempotent. what it means?

for working on rest examples why we need both below entries


<dependency>
                  <groupId>javax.ws.rs</groupId>
                  <artifactId>javax.ws.rs-api</artifactId>
                  <version>2.0.1</version>
            </dependency>
            <dependency>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-rt-rs-service-description</artifactId>
                  <version>3.0.0-milestone1</version>
            </dependency>


below is fine
<groupId>javax.ws.rs</groupId>
                  <artifactId>javax.ws.rs-api</artifactId>

but why we need cxf as below as well in pom.xml?
0
i was reading below link
http://gopaldas.org/webservices/soap/webservice-is-stateful-or-stateless-rest-soap/

what it mean  by

rest web services stateless and allow caching
how stateless allows to cache webservice responses?
how caching is related to statelessness of http?
please advise
0
hi,

how to import ant project in eclipse. please advise

maven project is simple just say import as existing maven project under file but for Ant shows import build file but if i select that build.xml is missing and putting some weird name to project as well.

please advise
0
debugging HashMap in eclipse shows as below in variables tab for HashMap

{a=3, x=1, y=1}

instead of showing as below
{a:3, x:1, y:1}

which is right convention why eclipse shows in different convention. Does not matter as long as i see key then value separated by some special character like : or = or $ etc?
please advise
0
what is difference between below threee HashMap declarations

1.HashMap<String,Integer> map=new HashMap<String,Integer>();
2.Map<String,Integer> map=new HashMap<String,Integer>();
3.HashMap<String,int> map=new HashMap<String,int>();

why i cannot pass primitive to generics?
please advise
0
I've got a cron job that runs 4 times a day which uses a simple shell script to perform a mysql_dump then tar the file (DB_BACKUP-2017-11-18.55.25.tgz) and place it in a directory.

#!/bin/bash

backup_file="/share/CACHEDEV1_DATA/Web/SQL/vcal.sql"
backup_dir="/share/CACHEDEV1_DATA/Web/SQL/SQL_Backup"
tar_name=`date +%Y-%m-%d.%M.%S`

# Dump MySQL Database
/usr/local/mysql/bin/mysqldump --user="user" --opt vcal > /share/CACHEDEV1_DATA/Web/SQL/vcal.sql

# Backup MySQL Dump File
/bin/tar -czPf $backup_dir/"DB_BACKUP-"$tar_name.tgz $backup_file

exit 0

Open in new window


I'm trying to figure out a way to have the script delete backups which are older than 4 days.
Ideally, I'd like to be left with 16 files (4 are created per day) at any given time

Any suggestions?

Thank you for looking :)

Ken
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.