Categories
Mastering Development

Evaluate a simple mathematical expression with limited tools, no arrays, and no library functions

Here’s a question from the last year’s first "Intro to programming" exam at my uni: Using the getchar() function read an input sequence consisting of numbers, + and – signs. The output should be the result of those arithmetical operations. For example, if the input is 10+13-12+25-5+100, the output should be 131. Now, given that […]

Categories
Ask Engineering Software Engineering

What is a “function returning type” in C?

C11 standard says 6.3.2.1 Lvalues, arrays, and function designators A function designator is an expression that has function type. Except when it is the operand of the sizeof operator, 65) or the unary & operator, a function designator with type ‘‘function returning type’’ is converted to an expression that has type ‘‘pointer to function returning […]

Categories
Cryptocurrency Ethereum Mastering Development

How to solve the problem: java.lang.RuntimeException: Error processing transaction request: VM Exception while processing transaction: stack underflow

I generated JAVA wrapper solidity code. I am trying to deploy my contract on our local Ethereum blockchain and and get the following error: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access […]

Categories
Mastering Development

Removing the last digit of an inputted integer

I was able to reverse the integer inputted using a nested for-loops, but I am unable to remove the last digits when going down through the rows. (I don’t want to use string-to-number, arrays, or functions.) My code: #include <stdio.h> #include <math.h> int main() { int number; printf("enter a number"); scanf("%d", &number); for(int j = […]

Categories
User Help

What is the best online excercise IDE to use for Beginners C++ course? [closed]

I’m an instructor that’s about to start teaching C++ to beginners next week. So far, the poll in the class leans towards medium skillset in programming (meaning they programmed before but never in C++. Based on my past experience, I believe an online IDE would be the best approach for grading seamlessly whilst also providing […]

Categories
CMS Mastering Development Wordpress

By using WordPress Function Alter Mysql Data

I’ve create one custom table, with ID and Description. I would like to use wordpress function to change the Description’s values by refer to the ID if user purchase woocommerce item.. I try to read the API, but I don’t know if I doing this right. add_action( ‘woocommerce_order_status_completed’, ‘send_custom_data’ ); function send_custom_data( $order_id ) { […]

Categories
Mastering Development

Lottery winning chance exercise

So I have a problem that I’m stuck on it since 3 days ago. You want to participate at the lottery 6/49 with only one winning variant(simple) and you want to know what odds of winning you have: -at category I (6 numbers) -at category II (5 numbers) -at category III (4 numbers) Write a […]

Categories
Mastering Development

Execute a C program from within another C program as if it was a function call (in Windows)?

Is it possible call a separate C program (.exe file) within a C program, like if it was a function? I would like to be able to pass arguments of any kind (like any other function) to this separate program, and get the return value (so it can be used in the host program). I […]

Categories
Mastering Development

Properties of objects in JavaScript

Can I safely assume that in any implementation of JavaScript, 1.) for any object generated by the var obj = { … }; construct, obj[s] is undefined for any string s unless obj[s] has been explicitly set by my own code? 2.) if typeof obj === ‘object’ (and obj does not stem from some global, […]

Categories
CMS Mastering Development Wordpress

Cookies are blocked due to unexpected output if I try to insert a row in the database with the action wp_login

Here’s my problem: class printSecurity { protected $accessTable; protected $wpdb; protected $constant_name_prefix = ‘PRNSEC_’; public function __construct() { define( $this->constant_name_prefix .’ROOTDIR’, plugin_dir_path(__FILE__) ); add_action( ‘admin_menu’, array( $this, ‘printSecurityMenu’ ) ); add_action( ‘wp_login’, array( $this, ‘last_login’ ), 10, 2 ); } public static function get_user_ip_address() { if( !empty( $_SERVER[‘HTTP_CLIENT_IP’] ) ){ $ip = $_SERVER[‘HTTP_CLIENT_IP’]; } else […]