Ranjith wrote a new blog post: How to convert List to long[] or vise versa? 4 months, 1 week ago
There is no automatic conversion from array of primitive type to array of their boxed reference types or vise versa. You have to iterate for each data. Converting List<Long> to long output = new long; int index = 0; for(Long val : input) { indexess = val; index++; } Converting long input = getSomeLongs(); // Assume some [...]
Ranjith wrote a new blog post: How to use Enum in C? 4 months, 2 weeks ago
In C and C++, enum types can be used to set up collections of named integer constants. Consider a set of all days. #define Sunday 0 #define Monday 1 #define Tuesday 2 #define Wednesday 3 #define Thursday 4 #define Friday 5 #define Saturday 6 The above lines can be replaced by:
enum AllDays{Sunday, Monday, Tuesday, [...]
Ranjith wrote a new blog post: How to use bool in c? 4 months, 2 weeks ago
There is no bool data type in C. In C99 standerd version, the boolean variable has been added as _Bool. Additionally, a new header stdbool.h has been added for compatibility reasons. This header allows programmers to use boolean types in the same way, as in C++ language. To use bool in C, we can use [...]
Ranjith wrote a new blog post: Predict the output or error(s) of the following c code 8 months, 2 weeks ago
void main()
{
int const * p=5;
printf("%d",++(*p));
}
Compiler error: Cannot modify a constant value.
Explanation:
p is a pointer to a “constant integer”. But we tried to change the value of the “constant integer”.
Ranjith wrote a new blog post: How to resize image using php? 8 months, 2 weeks ago
Here is a simple script to resize the given image. This requires PHP5, GD library.
First download the file and include to your code.
Usage example:
resizeImage(200, 200, 'crop');
// *** 3) Save image
$resizeObj -> saveImage('sample-resized.jpg', 100);
?>
Ranjith wrote a new blog post: How to Extract or Unzip files from a .zip file using PHP 8 months, 2 weeks ago
Here is the simple code which will extract a zip file. Here we are using pclzip.lib file to extract files. You no need to install any other library to your server. First download pclzip.lib file. Now use the below code to extract your zip file.
unzip | electrofriends.com extract() == 0) { echo 'Error : ' . [...]
Ranjith wrote a new blog post: How to upload image to database using PHP/MySQL 8 months, 3 weeks ago
Here is the simple code to upload files to a particular folder also this will make an entry in database. For example if you are making user registration, this code can be used to store user photo. Use the same user table to store user image. In this code we have used “file_tbl” table to store [...]
Ranjith wrote a new blog post: How to convert Digits or numbers to word using PHP? 8 months, 3 weeks ago
Here is the code to convert digits to word using PHP Example: 564 : five hundred sixty four
0) $str = $ones . " hundred"; // do ones and tens if ($y 0) return convertTri($r, $tri+1).$str; else return $str; } // returns the number as an anglicized string function convertNum($num) { $num = (int) $num; // [...]
Ranjith wrote a new blog post: How to get image source from file using PHP 8 months, 3 weeks ago
Use preg_match_all to get the image source from your file.
PHP code:
< ?php
$content='Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industrys standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type…
Ranjith wrote a new blog post: How to send enquiry or feedback mail using PHP script 8 months, 3 weeks ago
The PHP mail() function is used to send emails from inside a script. Syntax: mail(to,subject,message,headers,parameters) Here is an example of PHP feedback-form which you can directly publish on your website. The example below sends a message to a specified e-mail address. This PHP form includes Name, Email ID, Phone No, Subject, Message. Here…[Read more]
Ranjith wrote a new blog post: How static variable and static functions will work? 8 months, 3 weeks ago
The keyword static can be used in three major contexts: inside a function, inside a class definition, and in front of a global variable inside a file making up a multifile program. The use of static inside a function is the simplest. It simply means that once the variable has been initialized, it remains in [...]
Ranjith wrote a new blog post: What is the difference between calloc and malloc? 8 months, 3 weeks ago
1. calloc allocates a block of memory for an array of elements of a certain size. By default the block is initialized to 0. The total number of memory allocated will be (number_of_elements * size). malloc takes in only a single argument which is the memory required in bytes. malloc allocated bytes of memory and not blocks of memory [...]
Ranjith wrote a new blog post: What is function pointer and how to use function pointer? 8 months, 3 weeks ago
A function pointer is a variable which is used to hold the starting address of a functions and the same can be used to invoke a function. It is also possible to pass address of different functions at different times thus making the function more flexible and abstract. So the function pointers can be used [...]
Ranjith wrote a new blog post: JNI Part 5: JNI Arrays 9 months ago
JNI Index Part 1: Introduction and “Hello World” application Part 2: JNI: Visual Studio setup for DLL Project Part 3: Mapping Types and Passing Arguments Part 4: JNI Strings Part 5: JNI Arrays Part 6: JNI Objects Part 7: JNI Arrays of Objects Part 8: JNI Exceptions Part 9: JNI FAQ Part 5: JNI Arrays Arrays have dimension. An…[Read more]
Ranjith wrote a new blog post: JNI Part 4: JNI Strings 9 months ago
JNI Index Part 1: Introduction and “Hello World” application Part 2: JNI: Visual Studio setup for DLL Project Part 3: Mapping Types and Passing Arguments Part 4: JNI Strings Part 5: JNI Arrays Part 6: JNI Objects Part 7: JNI Arrays of Objects Part 8: JNI Exceptions Part 9: JNI FAQ Part 4: JNI Strings The jstring type represents…[Read more]
Ranjith wrote a new blog post: JNI Part 3: Passing Arguments and Mapping Types 9 months ago
JNI Index Part 1: Introduction and “Hello World” application Part 2: JNI: Visual Studio setup for DLL Project Part 3: Mapping Types and Passing Arguments Part 4: JNI Strings Part 5: JNI Arrays Part 6: JNI Objects Part 7: JNI Arrays of Objects Part 8: JNI Exceptions Part 9: JNI FAQ Passing Arguments and Getting Results The…[Read more]
Ranjith wrote a new blog post: How to convert a jstring to a C-style string or vice versa? 9 months ago
The jstring type represents strings in the Java virtual machine, and is different from the regular C string type (a pointer to characters, char *). So we cannot use a jstring as a normal C string. We must use the appropriate JNI functions to convert jstring objects to C/C++ strings. The JNI supports conversion both [...]
Ranjith wrote a new blog post: How to align or format codes in Visual Studio? 9 months, 1 week ago
This is very simple in Visual Studio. Follow the below steps. Select the code you want to re-format. Press Ctrl-K Press Ctrl-F The key combination Ctrl-K + Ctrl-F only works on selected text, so make sure you select the code you want to re-format before using it. You can easily reformat the entire code by [...]
Ranjith wrote a new blog post: JNI Part 2: Visual Studio setup for DLL Project 9 months, 1 week ago
JNI Index Part 1: Introduction and “Hello World” application Part 2: JNI: Visual Studio setup for DLL Project Part 3: Mapping Types and Passing Arguments Part 4: JNI Strings Part 5: JNI Arrays Part 6: JNI Objects Part 7: JNI Arrays of Objects Part 8: JNI Exceptions Part 9: JNI FAQ Part 2: JNI: Visual Studio setup for DLL Project …[Read more]
Ranjith wrote a new blog post: How to set Feedburner email notification excerpts instead of full text 9 months, 2 weeks ago
When you setup feedburner to your wordpress blog you will receive complete post as a newsletter. Which may decrees your website page visit. Instead of this you can configure excerpt to send. So that receivers will click the link to read full article. To configure open wordpress ‘reading’ option under settings tab. As shown in below [...]
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Submit #Terms of Use
Copyright©2011 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com | Powered by Dhyeya