Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

How to solve "detected dubious ownership in repository" when "directory = *" does not seem to have any effect

The issue

This week me and my team started to get a weird git message

fatal: detected dubious ownership in repository [directory]

that basically did not allow us to pull nor push changes.

 

The simple solution that did not work

Most of the issues seemed Windows related and I was on Kubuntu, but I assumed that the operating system would not be a point of interest, which, in the end, proved to be correct.

All solutions pointed to the execution of a simple command

git config --global --add safe.directory [directory]

which would, simply, add the [directory] to the ~/.gitconfig file and that would mark the [directory] as being trusted and thus solving the issue. A more simple approach would be using * as the [directory], basically saying any directory.

And that was the road that I took. But with no success. I even tried --system instead of --global which would set that configuration at the system level (in /etc directory) instead of the making it only available to the user.

I ended up with a ~/.gitconfig file like this:

[user]
       email = m6@blogger.com
       name = M6
[safe]
       directory = *

But nothing seemed to work.


The suspicious directory

Early on, I did notice something weird. The [directory] presented in the solutions referred to local paths, but the [directory] I was getting was the repository server path.

If it was a local issue, the [directory] would be something like /home/m6/work/repo_project but I was getting /var/git/repo_project, which only exists on the repository server.

While doing the investigation, I did came across with a project that was working fine! This raised my doubts about that local ~/.gitconfig file being if any use since the that particular repository worked fine with, or without that file being present on the system.


The solution

I logged on the repository server and checked that my user had a ~/.gitconfig file present with the directory parameter pointing precisely to the path of the only project that was working fine.

I changed the value *, which means any path, gave it a try and suddenly the problem was solved for me.

I checked with my team and since the server is solely dedicated to be a git repository server, most of the people do not have a real home in the system since they do not have the need to work on the server.

The solution for the team users that do not have a home was to create a dummy /home/gitdummy directory, create a .gitconfig file holding

[safe]
       directory = *

and finally change the users home in the /etc/passwd file pointing it to /home/gitdummy.


Summary

In short, if you run into this issue and the straight forward solution does not seem to work for you as it did not for me, check where the path is located, enter on that system and add

[safe]
       directory = *

to the ~/.gitconfig file of your user.

If you run into a transversal issue affecting all users of that system, just apply that solution to all of them.

If the users do not have a home on that system, create a dummy home and point the users home to it.


./M6

XAMPP & Skype Conflict

I've just found out that, in my Windows 7Skype and XAMPP have a conflict.
Apache cannot start if Skype is running because it states that port 80 is already in use. When configured to port 8080, Apache does not start because port 443 is in use.

The solution?
Terminate Skype, start Apache, start Skype.

Weird...

./M6

Fetching Lines From Big Files

Today I had a DB2 bulk loading problem. I got a couple of rejected records on a 2G+ file. These kind of files are too big to be manipulated with conventional text editors, and even text editors that can handle such files are, usually, not very fast.
Since I was in Windows, I've open th MSYS shell, changed into the correct directory and typed
cat -n STPRRIMH.S.ULD.U110115.UN | grep 1943664 > MH.txt
This is an instantiation of a more generic command
cat -n < file > | grep < line >
In a few seconds I had a new file containing exactly the information I needed.

Serious developers can't really live without Unix/Linux tools on their machines...

./M6

Interpreting DB2 JDBC error messages

Every time I use DB2 on a data migration project I get awkward DB2/JDBC errors, no matter if I'm using DB2 on Windows, Unix or iSeries AS/400.
Part of the problem is that the error messages come in Portuguese, making the debug task a lot harder since it's almost impossible to find decent help by searching through the error messages. The other part of the problem is that this leaves me the SQL error codes, which sometimes are unclear and makes me waste time.
Here's an example of a common problem that I usually have:
com.ibm.db2.jcc.b.rg: [jcc][t4][102][10040][3.50.152] Non-atomic batch failure. The batch was submitted, but at least one exception occurred 
on an individual member of the batch.
Use getNextException() to retrieve the exceptions for specific batched elements.

com.ibm.db2.jcc.b.pm: Error for batch element #1: The current
transaction was rolled back because of error "-289".. SQLCODE=-1476,
SQLSTATE=40506, DRIVER=3.50.152

com.ibm.db2.jcc.b.SqlException: [jcc][103][10843][3.50.152]
[...] ERRORCODE=-4225, SQLSTATE=null
Following DB2 official documentation:
  • SQLCODE=-1476 means that the current transaction was rolled back because of error.
  • SQLSTATE=40506 means that the current transaction was rolled back because of an SQL error, which is basically the same as the SQLCODE above.
  • ERRORCODE=-4225 means an error occurred when data was sent to a server or received from a server, which is totally useless.
The real useful information is hidden in the second error message, in the 'transaction was rolled back because of error "-289"' message. The key here is the -289 error.
This error means "Unable to allocate new pages in table space", and this is the real cause for such a big fuss.

One of my DB2 table spaces run out of space and all I get is a lot of fuss about a rollback that happened because of an error but the error itself is kind of hidden in the middle of the stack trace, all that is shown is a loose error code...
IBM has done it again, the cause of the error should be highlighted and perfectly visible and understood in order to know what really happened and fix the problem, but making the life easier for its users seems not to be IBM way.

./M6

Recovering from a bad Hard Disk Crash

Last time I've used my computer I burned a DVD Video with K3B and shutdown openSUSE as usual.

Yesterday, when I turned the computer on, it went directly into GRUB shell which allowed me to execute some commands with no real use to me.

Obviously something was wrong, and I though that it was the Master Boot Record (MBR) that got corrupted, as I've already have experienced before.
So I got the openSUSE installation disk and boot with it in order to fix the problem. I've requested the fix option from the menu but then something weird happened.
When scanning the hard disk, it displayed a message that there was something wrong and I would not be able to edit the disk partitions. I checked the partitions and the information seems to show that everything was OK.
I needed something else to see what was wrong with the hard disk and to fix it.

I grabbed an old Knoppix CD, version 3.3, the only one that I know that loads correctly on my Acer laptop (by the way, don't by an Accer if you wish to have Linux on a laptop), and checked the disks. This is not the first time I use Knoppix to save a system, it's actually one of my companion disks.
Knoppix automatically mounted both windows partitions correctly but the Linux EXT4 and Swap partitions were missing.
Now I start to get worried...

I got into a shell and checked the partitions with fdisk.
I detected the problem immediately: I had two partitions starting at the same cylinder! I even recall its number, 2086.
The second partition had an Id of f, which is awkward since the Id is a numeric value, and was marked as the boot partition. Using fdisk to see what my chances were of correcting this I realized that a drastic solution would probably be the only solution. When I deleted that second weird partition, the following partitions were gone to.

So, before I do something that I could regret latter, I checked the content of the Windows partitions to find out that if anything would go wrong I already had a backup of everything.
The data on the Linux partition seemed already lost, so I would have to settle for the backups.
On the other hand, I was still able to save everything from the Windows partitions, but that would be unecessary.

I finally decided what to do and how to do it.
I've deleted that second weird partition, defined the first partition as boot and saved the partition table.
I could have tried to recreate the partition table with fdisk, but since I had backups of everything, I just went for the full disaster scenario.

I then rebooted with the openSUSE installation disk, created a second partition, that I reserved to replace the lost second partition for Windows, and created a third one for Linux, where I installed openSUSE.

When openSUSE installation finished I've reboot and started Windows, which loaded just fine from the saved first partition. When Windows loaded, it was time to format that previous reserved second partition as NTFS.

The whole thing took me a couple of hours but I got both Windows and openSUSE up and running again. Today I'll restore the backups, which will probably take a couple hours more.

Moral of the story:
  1. Always have a Knoppix disk at hand.
  2. Backups are a tech best friend.

./M6

Reset Windows and Linux Passwords

I've just came across a fantastic tool for system administration.
Ever used a system that no one recalls the administration password?
Or have you ever inherited a system that the only person who administrated it retired?

This tool will certainly ease the trouble of resetting the administration password: Kon-Boot.

./M6

KDE on Windows

I've just installed the KDE on Windows and my XP is now a happier operating system.

I was looking for Amarok, since that's by far the player I love most, but the release I'm using, 4.3.00, seems not to have it yet.
Nevertheless, I've setup some packages and now I'm able to run things like Kate, Dolphin and KMahjongg .
I love Dolphin as a file manager, since it's philosophy is suited to my needs and usage.
Too bad the Shift+F4 in Dolphin and the terminal command in Kate does not call the DOS box like it calls a terminal in Linux.

This project is not in the final state, so there's not many applications and it can be unsuitable for daily use.
But this is a very cool project and I'll keep an eye on it and, when possible, I'll try to make some changes like using Dolphin, Amarok, Kate and other applications that I prefer to Windows alternatives.

Here's some pictures of some application running on my XP:

Dolphin running on Windows XP


Konqueror running on Windows XP


KWrite running on Windows XP


KDE system settings running on Windows XP

./M6

R Package with S4 Objects

I've finished the development of the (beta version) clustering algorithm on R for my MSc thesis and I'm releasing it for tests.

I've developed it mainly in Windows, but when it comes to the packaging part, I've switched to Linux. This is mainly because R packaging in Windows implies to install a lot of base Linux applications and tools on Windows. For those that wish to go that road, here's what you have to do: read Making tutorial about R Packages Under Windows: A Tutorial by Peter Rossi.
For everyone else, just boot your Linux.

Before I start, I took a look at Writting R Extensions. This is the first step for all that wish to build an R extension. A fast and easy way to know how to pack, is to read the An Introduction to the R package mechanism.

My implementation uses S4 objects, and that was a problem, since I had all kinds of warnings and errors during the package tests and installation. Here's the transcriptions of the post I've sent to the R-Help list asking for help:
Here's what I do:

*1.* in R console, I do and get:
> package.skeleton(name='remora')remora-package
Creating directories ...
Creating DESCRIPTION ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './remora/Read-and-delete-me'.
Warning messages:
1: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R", :
deparse of an S4 object will not be
source()able
2: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R", :
deparse of an S4 object will not be
source()able
3: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R", :
deparse of an S4 object will not be
source()able
4: In dump(internalObjs, file = file.path(code_dir,
sprintf("%s-internal.R", :
deparse of an S4 object will not be source()able


I don't know why I get these warnings. I've followed R
implementation rules and the S4 objects work fine.


*2.* Performing the 'R CMD build remora' command I get:

* checking for file 'remora/DESCRIPTION' ... OK
* preparing 'remora':
* checking DESCRIPTION meta-information ... OK
* removing junk files
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building 'remora_1.0.tar.gz'

And the remora_1.0.tar.gz file seems ok.

*
3.* Performing the 'R CMD check remora' command I get:

* checking for working pdflatex ...sh: pdflatex: not found
NO
* checking for working latex ...sh: latex: not found
NO
* using log directory '/home/fmm/thesis/R/src/remora.Rcheck'
* using R version 2.8.1 (2008-12-22)
* using session charset: UTF-8
* checking for file 'remora/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'remora' version '1.0'
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking for executable files ... OK
* checking whether package 'remora' can be installed ...
ERROR
Installation failed.
See '/home/fmm/thesis/R/src/remora.Rcheck/00install.out'
for details.

*4.* the log file contains:

* Installing *source* package 'remora'
...
**
R

**
data

** preparing package for lazy
loading
Error in parse(n = -1, file = file) : unexpected '<' at 745:
`.__C__remoraConfiguration` <- 746: <> -> code2LazyLoadDB
-> sys.source -> parse Execution halted
ERROR: lazy loading failed for package
'remora'
** Removing
'/home/fmm/thesis/R/src/remora.Rcheck/remora'
fmm@Darkmaster:~/thesis/R/src$ grep -i __C__remoraConfiguration *
fmm@Darkmaster:~/thesis/R/src$ grep -i __C__remoraConfiguration */*
remora.Rcheck/00install.out:745: `.__C__remoraConfiguration`
<- remoraConfiguration is a constructor for the
remoraConfiguration S4 object.
# # Class configuration definition.
# CLASS_REMORA_CONFIGURATION <- "remoraConfiguration" class_configuration
<- setClass(CLASS_REMORA_CONFIGURATION, representation(
number_clusters = "numeric", class_name = "character",
weighting_function="character", scale_variance="logical", s="numeric",
d="numeric", alfa="numeric", eta = "numeric", niter="numeric",
niter_changes="numeric", perform_sum="logical", verbose="logical"),
prototype = list(number_clusters=numeric(), class_name=character(),
weighting_function=character(), scale_variance=logical(),
s=numeric(), d=numeric(), alfa=numeric(), eta=numeric(), niter=numeric(),
niter_changes=numeric(), perform_sum=logical(), verbose=logical()))
# # Builds a Remora configuration object.
# # [...]
# remoraConfiguration <- function(number_clusters, class_name,
weighting_function = FUNCTION_REMORA_EUCLIDEAN,
scale_variance=TRUE, s_value = 0.001, d = 0.3, alfa = 0.9, eta = 0.01,
niter=-1, niter_changes=5, perform_sum = TRUE, verbose=FALSE)
{
result_configuration <- new(CLASS_REMORA_CONFIGURATION)
[...]
result_configuration
}

But, unfortunately, no help came from there...
I've never stopped the search for the answer, and I've finally found it. It's actually quite easy.
Instead of packing it from the current environment, I've just passed the package.skeleton the list of source files to build the package. Here's the small R script I've done to automate the packaging procedure for my "Remora" package:

cat('\nPacking Remora...\n')

file_lst <- character(5)
file_lst[1] <- '/home/m6/thesis/R/src/1_classes.r'
file_lst[2] <- '/home/m6/thesis/R/src/2_common.r'
file_lst[3] <- '/home/m6/thesis/R/src/3_model.r'
file_lst[4] <- '/home/m6/thesis/R/src/4_predict.r'
file_lst[5] <- '/home/m6/thesis/R/src/5_main.r'

package.skeleton(name = "remora", force = TRUE, namespace = TRUE,
code_files = file_lst)

cat('\nDone.\n')
Now it's time to go to the directory created, with the name of the package, from now on {package}, and edit the following files:
  • {package}/DESCRIPTION, the description of the package;
  • {package}/NAMESPACE, the list of functions and classes to export to the user;
  • {package}/man/{package}-package.Rd, the package help file, the \examples section must provide executable code, since R check command will execute this code;
  • {package}/man/{class_name}-class.Rd, the classes help files;
  • {package}/man/{function_name}.Rd, the functions help files;
All files under
/man/ are tex files and will be compiled to provide the functions help when invoked by the user.
It's only necessary to document the classes and functions that will be exported, i. e. exported in the
NAMESPACE file, since all the others will not be visible to the user. All the other .Rd files may be deleted.

After the package has been created, I've tested with the "R CMD check {package}
" command. My package name is "remora", so my command was "sudo R CMD check remora".
I had to run this command with the administration role, so I prefixed it with the
"sudo" command. I believe this is a characteristic of the Kubuntu distribution.

Finally I've build the package with the
"R CMD build {package}" command that created the tar.gz file for distribution.

To install it, just use the
"R CMD INSTALL {package}" command. I've entered R and it worked fine.
To uninstall just execute
"R CMD REMOVE {package}".

./M6

Windows on critical systems? Thanks, but no thanks.

By reading this post topic I bet you're thinking "Gees, one more Windows hater moron"...
Well, not quite.
I use Windows, Linux, Unix and, sometimes, even Mac. So give me some credit before calling me bad names, ok? :)

There's a desktop market dominant operating system (OS), it's Windows and that is a fact over a decade now.
If anyone had such an OS, and once the desktop market has been dominated, it is clear that the next step is taking control of other devices, like mobile devices. There's nothing wrong with that, since the mobile devices have OSs and GUIs that are designed for personal usage, so having a personal desktop like Windows running on them makes perfect sense.

So, there's Windows, an OS that has been designed for desktop computers and is meant to be used by people that know nothing about computers. Nevertheless, any Windows user is perfectly capable to use it and use it's applications, either games, office suites or web browser.

There has been some usages that proved to be "less intelligent", more or less harmful, like the BMW iDrive (that many users says it sucks, and it really sucks).

And there has been usages that have proven to be totally idiot, careless and even incompetent.
For does that are now thinking I'm being "unfair", I'll prove all I'm saying.

Imagine that someone thinks that it is a good idea to use an OS that, again, has been designed for desktop usage, and stuff it into critical systems, like, for instance, medical-device equipment used on an hospital.
For those that are not scared, think Automatic Updates rebooting after, silently, downloading and installing an update.
For those that still are not scared, think virus and worms.
Mix all that and here's what you got: a critical system that is vulnerable to virus and worms and that will reboot anytime it wishes.

If you're not scared yet, think of yourself lying on an operation table connected to a medical-device equipment running Windows, and its automatic update client has just download and installed the latest security patches. You know what comes next, don't you?...

Now, I bet you're thinking all that is necessary is to turn the automatic updates off.

Ok then, think of yourself lying on an operation table connected to a medical-device equipment running Windows that is infected with a virus or a worm because it does not have the latest security patches since the automatic updates are off. You know what comes next, don't you?...

For those that are skeptical about such scenario, I have really bad news for you: it has already happened at Sheffield hospitals.
This is not new and it's actually a trend for some years now.

Scared now?...

If this isn't an idiot, careless and incompetent usage of Windows, then I don't know what it is...
Windows on critical systems? Thanks, but no thanks.

./M6

Windows XP SP3 Installation Error

I was installing Service Pack 3 for Windows XP, Portuguese version, and I got this wierd message:

Este Service Pack requer a ligação à electricidade de rede antes de iniciar o programa de configuração.

Translated into english is something like "This Service Pack requires a connection of the machine to the electicity of the network before initializing the configuration program".
What is "a connection of the machine to the electricity of the network"? It does not make any sense!
After thinking a bit about this wierd message, I finally found out what the message ment: "the machime must me plugged into electricity". I was using a laptop and it was running on the battery, so SP3 refused to install.

The Portuguese internationalization team made e serious translation mistake, since the message does not make any sense, any sense at all, in Portuguese

./M6