filePath = "file.csv"
data = np.genfromtxt(filePath)
Many options are supported, see official documentation for full list:
data = np.genfromtxt(filePath, dtype='float', delimiter=';', skip_header=1, usecols=(0,1,3) )
Reading invalid UTF-8
When reading UTF-8 encoded data, it is important to be aware of the fact the UTF-8 encoded data can be invalid or malformed. Such data should usually not be accepted by your program (unless you know what you are doing). When unexpectedly encountering malformed data, different ...
The arrayref for @foo is \@foo. This is handy if you need to pass an array and other things to a subroutine. Passing @foo is like passing multiple scalars. But passing \@foo is a single scalar. Inside the subroutine:
xyz(\@foo, 123);
...
sub xyz {
my ($arr, $etc) = @_;
print $arr-&g...
To unregister from Remote Notifications programatically you can use
Objective-C
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
Swift
UIApplication.sharedApplication().unregisterForRemoteNotifications()
this is similar to going into the setting of your phone and manual...
To create a Swift Package, open a Terminal then create an empty folder:
mkdir AwesomeProject
cd AwesomeProject
And init a Git repository:
git init
Then create the package itself. One could create the package structure manually but there's a simple way using the CLI command.
If you want to ...
Here we will be checking out the latest copy of our project's code, run the tests and will make the application live.To achieve that, follow below steps:
Open Jenkins in browser.
Click the New Job link.
Enter project name and select the Build a free-style software project link.
Click on Ok but...
// filename is a string with the full path
// true is to append
using (System.IO.StreamWriter file = new System.IO.StreamWriter(filename, true))
{
// Can write either a string or char array
await file.WriteAsync(text);
}
Information about the database connections
SELECT
a.mon$attachment_id as Attachment_ID,
a.mon$server_pid as Server_PID,
case a.mon$state
when 1 then 'active'
when 0 then 'idle'
end as State,
a.mon$attachment_name as Database_Name,
...
Darken
#demo {
@refcolor: #f0b9b8;
background: @refcolor;
border: 1px solid darken(@refcolor, 25%);
}
The above code makes use of the darken() function to set the border color as a shade that is 25% darker than the reference color (which is also the background color).
Less compiler ca...
lessc [options] <source> [destination]
The above command is used to compile Less files in the command line. Options are the various settings that the compiler should use either during compilation or after compilation. Options include -x or --compress for compressing or minifying the output ...
Print out all list names and the item count.
$site = Get-SPSite -Identity https://mysharepointsite/sites/test
foreach ($web in $site.AllWebs)
{
foreach ($list in $web.Lists)
{
# Prints list title and item count
Write-Output "$($list.Title), Items: $($list.ItemCoun...
Get-SPFeature -Site https://mysharepointsite/sites/test
Get-SPFeature can also be run on web scope (-Web <WebUrl>), farm scope (-Farm) and web application scope (-WebApplication <WebAppUrl>).
Get all orphaned features on a site collection
Another usage of Get-SPFeature can be to find ...
Suppose that you had started an interactive rebase:
git rebase --interactive HEAD~20
and by mistake, you squashed or dropped some commits that you didn't want to lose, but then completed the rebase. To recover, do git reflog, and you might see some output like this:
aaaaaaa HEAD@{0} rebase -i (...
Those that are using TortioseGit UI click Right Mouse on the file (or folder) you want to ignore -> TortoiseGit -> Delete and add to ignore list, here you can choose to ignore all files of that type or this specific file -> dialog will pop out Click Ok and you should be done.
In order to execute a block of code over an over again, loops comes into the picture. The for loop is to be used when a block of code is to executed a fixed number of times.
For example, in order to fill an array of size n with the user inputs, we need to execute scanf() for n times.
C99
#include...
If we have a Model as following,
from django.db import models
from django.contrib.auth.models import User
class UserModuleProfile(models.Model):
user = models.OneToOneField(User)
expired = models.DateTimeField()
admin = models.BooleanField(default=False)
employee_id = models...
Partial classes provide a clean way to separate core logic of your scripts from platform specific methods.
Partial classes and methods are marked with the keyword partial. This signals the compiler to leave the class "open" and look in other files for the rest of the implementation.
// E...
flatMap is similar to map. The difference is described by the javadoc as follows:
This method is similar to map(Function), but the provided mapper is one whose result is already an Optional, and if invoked, flatMap does not wrap it with an additional Optional.
In other words, when you chain a...