How to get CPU type?
How do i determine the CPU type of a local computer?
I am trying to launch a runtime process, but the executable is tuned for the cpu. the executables are tuned for the cpu from the gcc docs:
http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
What would be the best way to approach this situation? As far as i know java doesnt have any way of returning a CPU type
perfect. thank you guys a bunch.
this is my code so far to get the Family and Model which so far works in linux and windows.
any suggestions for mac? i'm going to test out the system environment variables but i doubt it will be there
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Map;
public class CPU {
private final String os = System.getProperty("os.name");
public static void main(String[] args) {
CPU c = new CPU();
System.out.println("Family: " + c.getFamily());
System.out.println("Model: " + c.getModel());
public int getFamily() {
if (os.startsWith("Windows")) {
Map<String, String> env = System.getenv();
String pid = env.get("PROCESSOR_IDENTIFIER");
return Integer.parseInt(pid.substring(pid.indexOf("Family ") + 7, pid.indexOf(" Model")).trim());
} else if (os.equals("Linux")) {
String[] command = {
"cat",
"/proc/cpuinfo"
ProcessBuilder pb = new ProcessBuilder(command);
try {
Process p = pb.start();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = br.readLine();
while (line != null) {
if (line.startsWith("cpu family")) {
return Integer.parseInt(line.substring(line.indexOf("cpu family\t: ") + 13).trim());
line = br.readLine();
} catch (IOException e) {
e.printStackTrace();
return 0;
public int getModel(){
if (os.startsWith("Windows")) {
Map<String, String> env = System.getenv();
String pid = env.get("PROCESSOR_IDENTIFIER");
return Integer.parseInt(pid.substring(pid.indexOf("Model ") + 6, pid.indexOf(" Stepping")).trim());
} else if (os.equals("Linux")) {
String[] command = {
"cat",
"/proc/cpuinfo"
ProcessBuilder pb = new ProcessBuilder(command);
try {
Process p = pb.start();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = br.readLine();
while (line != null) {
if (line.startsWith("model")) {
return Integer.parseInt(line.substring(line.indexOf("model\t\t: ") + 9).trim());
line = br.readLine();
} catch (IOException e) {
e.printStackTrace();
return 0;
}
Similar Messages
-
How to get data type of variable in program..
Hi ABAP Guru.
I need to know how to get data type of variable or any structure field.. because I got short dump when use command REPLACE ALL OCCURANCE ... with variable/structure field that has data type I or P, I think it should be used with data type CHAR only, So I need to check the data type first.
Please give me your advice
Thank you all.
Nattapash C.data : v_value type i,
v_char(10) type c.
v_value = 10.
move v_value to v_char.
REPLACE ALL OCCURRENCES of '#' from v_char....
Best regards,
Prashant -
How to get wage type for every time record
Hi Pros,
I am using DS 0CA_TS_IS_1, it includes report time type (0REPTT), but not have wage type. in CATSDB, I fied fields for attendance/absence type and wage type. but not every time record has wage type. can you please tell me how to get wage type for every time record? what is relation between reporting time type, attendance/absence type and wage typs?Hello,
Can you talk to your HR/T&E functional consultant if they populate these values in CATSDB table using standard way or if there are custom fields that are in CATSDB OR any other table which can be used to meed the requirements
Thanks
Abhishek Shanbhigue -
How to get File type icon for files store on Amazons3
Hi,
i want to know about how to get file type icons for files that we store on Amazons3.i am a devloper ,i want to make gui for accessing amazons3.
so ,i want to know about how to get file type icons for files that we store on Amazons3.
thanx in advance.hi,
have u heard amazon simple storage service,that provides storage space for
storing files, i am a devloper,i want to know the files that we store on amazon,how we can get file type icon for that files.
i want to sample code in java for this.
thanx in advance. -
Urgent : how I get tree type group total result
hi master
sir now system give me this type for result
PARENT ACCID DRBAL CRBAL
K1
K11
11 K1101 46291132
11 K1102 13182173
11 K1103 23784045
11 K1104
11 K1105
11 K1106
11 K1107 10001795
11 K1108 9083529
11 K1109
11 K1110 4224350
11 K1111
11 K1112 6696832
11 K1113 7963381
11 K1114 742766
1 K12
12 K1201 1486082
12 K1202
12 K1203
1 K13
13 K1301
1301 K130101
1301 K130102
1301 K130103
1301 K130104 1977616
1301 K130105
1301 K130106 736266
1301 K130107 396673
1301 K130108 42751
1301 K130109 298362
1301 K130110 187696
1301 K130111 537
1301 K130112 942
1301 K130113 987
1301 K130114 1272
1301 K130115 40000
13 K1302
1302 K130201
1302 K130202
1302 K130203
1302 K130204
1302 K130205 259941
13 K1303
1303 K130301
1303 K130302
1303 K130303 177716
13 K1304
1304 K130401
1304 K130402
1304 K130403
1304 K130404
1304 K130405
1304 K130406 809719
1304 K130407
1304 K130408 1786091
13 K1305
1305 K130501
1305 K130502
13 K1306
1306 K130601
13 K1311
1311 K131101 788780
K2
2 K21
21 K2101
2101 K210101
2101 K210104
21 K2102
2102 K210201
2102 K210202
22 K2205
2205 K220501
2205 K220502
220502 K22050201
220502 K22050202
220502 K22050203
220502 K22050204
22 K2206
2206 K220601
2206 K220602
but sir i need this type of result
PARENT ACCID DRBAL CRBAL
GROUP NAME K1
GROUP NAME K11
11 K1101 46291132
11 K1102 13182173
11 K1103 23784045
11 K1104
11 K1105
11 K1106
11 K1107 10001795
11 K1108 9083529
11 K1109
11 K1110 4224350
11 K1111
11 K1112 6696832
11 K1113 7963381
11 K1114 742766
TOTAL
1 K12
TOTAL
GROUP NAME
12 K1201 1486082
12 K1202
12 K1203
TOTAL
1 K13
13 K1301
1301 K130101
1301 K130102
1301 K130103
1301 K130104 1977616
1301 K130105
1301 K130106 736266
1301 K130107 396673
1301 K130108 42751
1301 K130109 298362
1301 K130110 187696
1301 K130111 537
1301 K130112 942
1301 K130113 987
1301 K130114 1272
1301 K130115 40000
13 K1302
1302 K130201
1302 K130202
1302 K130203
1302 K130204
1302 K130205 259941
13 K1303
1303 K130301
1303 K130302
1303 K130303 177716
13 K1304
1304 K130401
1304 K130402
1304 K130403
1304 K130404
1304 K130405
1304 K130406 809719
1304 K130407
1304 K130408 1786091
13 K1305
1305 K130501
1305 K130502
13 K1306
Sir I need total group by group father group total and child group total
Please help me how I get tree type group total resultHi master
thankyou for your reply
Sir,
i know and you see my working i get code form master table and get detal amount form other table
I have two table see table
Acctab Baltab
PARENT PCID
CHILD title
PCID amount
I need heretical result use this type of query but not success
please see my query and give me idea how I get here full tree
select test.child,test.pcid,baltab.pcid from (select acctab.child,acctab.parent,acctab.pcid
from acctab
start with acctab.parent is null
connect by prior acctab.child= acctab.parent) test,baltab
where test.pcid=baltab.pcid ;
CHILD PCID PCID
1 1 1
2 2 2
3 3 3
11 111 111
12 112 112
13 113 113
21 221 221
22 222 222
23 223 223
31 331 331
32 332 332
33 333 333
but I need this type result
CHILD PCID
1 1
11 111
12 112
13 113
2 2
21 221
22 222
23 223
3 3
31 331
32 332
33 333 -
Reg: how to get notification type QMART
Hi experts,
how to get notification type QMART
BAPI_DOCUMENT_GETLIST2..
regards,
ramesh..Hi
Get the same from <b>QMEL table
Master table is TQ80
and texts are TQ80_T</b>
Reward points if useful
Regards
Anji -
How to get the type of answer in a workitem?
Hi Experts,
I am building a report to get the users responsible for the approval of SCs and POs, in this report I need to get the type of answer given by the approver, if they have rejected, approved or partial rejected / approved the object.
When I look at the container of the workitem I can get the agent responsible for the action and the dates, but I need your help to determine the type of answer. I believe I can get this information from the approval state, no? But I am getting a lot of different approval states: 0, 1, 3, 4, 10, 11 and 15. Can you provide me some guidance? I am new to workflows and I am stuck in this point.
I am using SRM 5.0 and n-step approval workflow.
Thanks in advance,
FranciscoI'm not an SRM expert, but from a pure workflow point you can read the output of a workitem. So, check how your workflow is built and then see what values are returned in the corresponding return fields. Explore the workitem structure in the log.
-
How to Get File type in webdynpro abap
Hi,
I am using File Upload UI element of webdynpro ABAP to upload data into SAP table. I want that the file type should only be tab delimited. How to get the file type to validate the same.
Regards,
Dhiraj Mehtahi,
just follow the link :
http://help.sap.com/saphelp_40b/helpdata/en/2a/fa02b7493111d182b70000e829fbfe/content.htm
Hope this will help u!!!
thanks & regards,
punit raval. -
How to get the type of numeric
Hi,
I would like to know how getting the type of a numeric data programmatically. (DBL, SDL, I16, I32,etc.)
This property is defined by selecting "Type of data" in the property's window of a numeric data; then by clicking on "representing".
I tried to find the solution by using a property node then accessing to the property called 'representing".
Without success, it seems this function is not available.
Is anyone would know the solution.
Thanks by advance,
pr93There are several solutions.
The 7.x version of the Flatten To String function had an additional output called "type string" which was actually an array of numbers. This array would tell you that information. OpenG has a VI that will tell you the datatype from this array. It's called "Get TDEnum From TD" and is in the LabVIEW Data Tools library. You can use VI Package Manager to easily install OpenG libraries.
If you have a control you could use a reference and then use the "Get Type of Control" VI from the <vi.lib>\Utility\GetType.llb library.
You could convert th"e numeric value to a variant and then use the "Get Type of Variant" VI from the <vi.lib>\Utility\GetType.llb library. -
how can i get cpu id as a string in labview.
actually i am trying to make my VI computer specific .
so i need help is getting tthe cpu id in my vi
regards
Regardsthanks for the reply .....
but i can some one tell me how to get processor ID or mac adderss or hard disk serial number anything whihc i can use to make my vi run to sepcific computer
regards
Regards -
How to get SAPGUI type (wingui or java) from an ABAP program
Hi everyone,
I am looking for a way to determine the sapgui type; that is if it is a wingui or javagui, from an abap program.
I know how to get the gui version with
CL_GUI_FRONTEND_SERVICES=>GET_GUI_VERSION
call and I also know how to get the platform with
CL_GUI_FRONTEND_SERVICES=>GET_PLATFORM
I simply want to determine if a certain sapgui running on a windows pc is a wingui or a javagui.
Any ideas?
Thanks,
MenelaosOk, I finally found it myself!
It is the function module:
RSAN_WB_TEST_GET_GUI_TYPE
at least on a 640 release.
Can I award me points?
Menelaos -
How to get file type within SPFile
Hi,
I have a document library and I would like to get the type of document so it can be displayed for the user
Currently I have this code
foreach (SPListItemVersion version in item.Versions)
if (version.Level == SPFileLevel.Published)
string fileicon = version.ListItem.File.IconUrl;
string filetype = version.ListItem.File.Item.ContentType.Name;
string filesize = (version.ListItem.File.Length / 1024).ToString();
string filetitle = version.ListItem.File.Item.Title;
string filepath = version.ListItem.File.ServerRelativeUrl;
Within the code I get the "ListItem.File.Item.ContentType.Name" and this always returns "Document" even if its a Word Document, Spreadsheet, jpg or PDF.
I really want to display, Document, spreadsheet, pdf, etc etc
How do I get this property??
Thanks
MarcYou can use the ListItem.File.Name property to get the full file name including the extension, you could then parse this to get just the extension and determine the file type based on that.
Note that when parsing the file name, if you try to do it by splitting the filename using the period symbol "." as the seperator you will need to allow for file names which contain multiple period symbols. You may be able to use the System.IO.FileInfo class to help, it has an instance property 'Extension' which should take care of that for you, though getting an SPFile into a FileInfo object may be more hassle than just writing your own quick parser, I haven't tried it. -
How to get the type of org.omg.CORBA.Any ?
Hi there
My q is: how can I get the type of an Any object?
Please have a look at the following code:
ORB orb = ORB.init();
org.omg.CORBA.Any anytest = orb.create_any();
anytest.insert_string("mystring");
TypeCode tc = anytest.type();
Now how can I get back that the type is String??
Regards
BrianHi,
Try using anytest.type().kind().value() -> should yield TCKind._tk_string. See the javadoc for more info.
I think that the only way to check types is by comparing the codes; as far as I know there is no easy way to get the equivalent Java Class object or so. But I could be wrong on that one.
Best,
Guy -
How to get storage type of XMLType through OCI
How can you get the storage type of an XMLType through OCI? An XMLType column can be created as BINARY, CLOB, or OBJECT RELATIONAL type, is there any way to get this information through OCI? SQLPlus seems to know how to detect these types with the DESCRIBE command, is it possible to get this information programmatically?
SQL> describe T_SRC_XML_COL_CLOB_UTF8;
Name Null? Type
COL1 NOT NULL NUMBER(8)
COL2 SYS.XMLTYPE
SQL> describe T_SRC_XML_COL_BINARY;
Name Null? Type
COL1 NOT NULL NUMBER(8)
COL2 SYS.XMLTYPE STORAGE BINARY
SQL> describe T_SRC_XML_COL_OBJECT;
Name Null? Type
COL1 NOT NULL NUMBER(8)
COL2 SYS.XMLTYPE(XMLSchema "http:
//www.oracle.co
m" Element "Parent") STORAGE
Object-relational TYPE "Par
ent808_T"Hi,
Here's one possible (simplified) way to determine this (assumes all handles allocated, etc):
- get a describe handle for table via OCIDescribeAny
- get parameter handle via OCIAttrGet on the describe handle
- get number of columns in table via OCIAttrGet on the parameter handle
- get column list handle via OCIAttrGet on the parameter handle
- loop for the number of columns
- use OCIAttrGet to get the column data type
- use OCIAttrGet to get if the column is a specific storage type
Here's what the part to determine if the columns is a specific storage type would look like:
** determine if storage type is binary for this xmltype column
rc = OCIAttrGet((void *) p_col,
OCI_DTYPE_PARAM,
(void *) &colstorage,
(ub4 *) 0,
(ub4) OCI_ATTR_XMLTYPE_BINARY_XML,
p_err);If the column is declared to have binary xml storage then colstorage will be set to 1 after the call, 0 if not.
OCI_ATTR_XMLTYPE_BINARY_XML is from oci.h (as well as OCI_ATTR_XMLTYPE_STORED_OBJ)
Perhaps that will be enough to get you what you need.
Regards,
Mark -
JAXB:How to get the type of an element
Hi
I am working with JAXB 2and i am using a custom ValidationEventHandler to validate my xml document:The issue I have is that when my document isn't valid,i would like to get the error node and its type(string,date...)
I tryed node.getNodeType() but it return if the node is ATTRIBUTE_NODE,TEXT_NODE....
public boolean handleEvent(ValidationEvent ve) {
if (ve.getSeverity()==ValidationEvent.FATAL_ERROR ||
ve .getSeverity()==ValidationEvent.ERROR){
ValidationEventLocator locator = ve.getLocator();
org.w3c.dom.Node node=locator.getNode();
System.out.println("ERROR element type:"+node.getNodeType());
return true;
}How could i get the type(String,Date,Integer...) of the node in error?
Edited by: riadhhwajdii on Aug 14, 2010 4:20 AMAs you already mention that is not resolved before the annotation processing stage
[ http://openjdk.java.net/groups/compiler/doc/compilation-overview/index.html]
So, you probably need to produce your own analysis code or better reuse the compiler's own code if that turns out to be easy (no clue). I reckon it is better if you avoid modifying the compiler itself as it will make much more difficult to maintain and deploy your (more than a) processor.
Sorry if you already tough about this.
Edited by: discretoboy on Apr 7, 2009 3:20 PM
Maybe you are looking for
-
Customer PO at item level needs to be populated to existing Z report
Hi All, Just would like your confirmation on the below requirement. Requirement: Already there is existing Z open sales orders report is availble for which we need to add the below mentioned line item PO into the output of the report.Business manuall
-
Can two Motorola E815s sync up to one family address book?
Hey all, thanks for looking. Apologies if this is an obvious RTFM issue, but I can't find talk of it anywhere. There must be many couples with two cell phones who could/would share the same address book via bluetooth. Will our iBook G4 with Bluetooth
-
I previously use an apple id called *** @hotmail.co.uk, I have tried to reset and even changed the id on the settings on my phone but each time I try to update an apple apps , I keep getting the same old ID on my phone. What do I do? <Email Edited by
-
Change string value by adding a transaction key in T156
Hello expert, My client want to add the transaction key BSX in the string value used for the code movement 261 k (good issue of supplier consignment stock). SAP Active Global Support respond that changes of value string for standard movement types ar
-
Header files not being included in JNI
I've written a java program which interfaces with some C code.In the c code i use certain functions which are defined in a header file that i include in the same c file.The problem i have ,is that the compiler shows an error when it comes across one