In C, pointers can be cast to a void*, which needs an explicit cast in C++. The following is illegal in C++, but legal in C:
void* ptr;
int* intptr = ptr;
Adding an explicit cast makes this work, but can cause further issues.
Now open the document using OpenXML, you must add an imagePart that references the picture object to the MainDocumentPart object by using a file stream, and get the ID of the image
string temp;
MainDocumentPart mainPart = document.MainDocumentPart;
ImagePart ima...
Now you have a reference of the image. Insert the image into the shapes in the template document. To do this, you will have to use some LINQ to iterate through the document and get a reference to all the shapes in the document. The wps:spPr element you see in the above XML code is the xml element fo...
In Spark (scala) we can get our data into a DataFrame in several different ways, each for different use cases.
Create DataFrame From CSV
The easiest way to load data into a DataFrame is to load it from CSV file. An example of this (taken from the official documentation) is:
import org.apache.spar...
It's possible to specify several type constraints for generics using the where clause:
func doSomething<T where T: Comparable, T: Hashable>(first: T, second: T) {
// Access hashable function
guard first.hashValue == second.hashValue else {
return
}
// Access compa...
Here we give an example of ISP violation and then refactor that violation. Without talking unnecessary things let's jump into the code.
ISP violation :
public interface IMessage{
IList<string> ToAddress {get; set;}
IList<string> BccAddresses {get; set;}
string MessageBody {get; s...
When using the .get() method whatever is in the entry widget will be converted into a string. For example, regardless of the type of input(It can be a number or sentence), the resulting outcome will be a string. If the user types 4 the output will be "4" as in a string. To get an int from ...
In this example 2000 bytes will be transfered using DMA, Transmit Half Complete and Transmit Complete interrupts achieving the best performance.
The first half of the transmit buffer is loaded with new data by the CPU in the Transmit Half Complete interrupt callback while the second half of the buf...
Tkinter support .ppm files from PIL(Python Imaging Library), .JPG, .PNG and .GIF.
To import and image you first need to create a reference like so:
Image = PhotoImage(filename = [Your Image here])
Now, we can add this image to Button and Labels like so using the "img" callback:
Lbl ...
Sometimes, you need to override one or more attributes of a particular Data Access Class (DAC) field just for a particular screen, without changing the existing behavior for other screens.
Replacing All Attributes
Suppose the original DAC field attributes are declared as shown below:
public class...
Design Patterns provide solutions to the commonly occurring problems in software design. The design patterns were first introduced by GoF(Gang of Four) where they described the common patterns as problems which occur over and over again and solutions to those problems.
Design patterns have four ess...
Service that is used for communication:
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
@Injectable()
export class ComponentCommunicationService {
private componentChangeSource = new Subject();
private newDateCreationSource = new Subject<Date&...
The TestProducerfrom this example produces Integerobjects in a given range and pushes them to its Subscriber. It extends the Flowable<Integer> class. For a new subscriber, it creates a Subscription object whose request(long) method is used to create and publish the Integer values.
It is impor...
Step1 Message Flow:
[![enter image description here][1]][1]
Step 2: Databse Connector Configuration
For this you need mysql-connector-java-5.1.40-bin.jar .
Right click on Project -->build Path--> Add external archieve and add the jar(without jar it cannot be connected)
Enter all the value...
Create session with User & Sign In to QuickBlox Chat
// Initialise Chat service
QBChatService chatService = QBChatService.getInstance();
final QBUser user = new QBUser("garrysantos", "garrysantospass");
QBAuth.createSession(user, new QBEntityCallback<QBSession>()...
How to find documents created 60 seconds ago
seconds = 60
gen_time = datetime.datetime.today() - datetime.timedelta(seconds=seconds)
dummy_id = ObjectId.from_datetime(gen_time)
db.CollectionName.find({"_id": {"$gte": dummy_id}})
If you're in a different timezone, y...
Suppose you had an array:
pair = ['Jack','Jill']
And a method that takes two arguments:
def print_pair (a, b)
puts "#{a} and #{b} are a good couple!"
end
You might think you could just pass the array:
print_pair(pair) # wrong number of arguments (1 for 2) (ArgumentError)
Si...