Thursday, 3 October 2013

Use sharepoint credentials for sso with third party

Use sharepoint credentials for sso with third party

I was drowning in the information available on sharepoint sso, so I'm
asking this question to see if I want is even possible...
At the company I work at we use office 365/sharepoint and some other
programs/websites hosted elsewhere. One of those websites is a homemade
website to manage worked hours, schedules and stuff like that; this is the
website I'm trying to use the sharepoint credentials on.
The website is build in PHP, uses a mysql database and has it's own login
with your email address as user name. The thing I'm trying to do here is
automatically sign people in on this website if they're logged in on
sharepoint based on their email address.
Some additional info:
Not using Windows Azure
The website doesn't run on a Windows server
Is it possible to do this?

Wednesday, 2 October 2013

Making own java method for array length issue

Making own java method for array length issue

So I was asked in a quiz yesterday to make my own method for size of an
array of strings. I was told I couldnt use the .length shortcut. Here was
my attempt, is it right?
//doesn't receive array! because it's a datamember in the class already
public int sizeOfArray(){
int counter = 0;
while(arrayName != empty){
arrayName[counter];
counter ++;
}
return counter;
}

Add ProfileImage from users previously uploaded photos

Add ProfileImage from users previously uploaded photos

I have tried to do this but was unsuccessful. There's also no postings
covering this which is odd considering selecting Default photo is a option
for every social network. I have the CarrierWave gem and I want to set it
up so that the user can select their ProfileImage (default image) from
photos they have already uploaded. This photo would be used site wide.
It's like having an avatar, however the articles out there only show how
to upload a avatar as oppose to selecting a avatar from your uploaded
photos. I am sure this will be helpful to other people since this is a
common feature.
Photos controller:
def new
@photo = Photo.new
end
def create
@photo = Photo.new(params[:photo])
@photo.user = current_user
if @photo.save
flash[:notice] = "Successfully created photos."
redirect_to :back
else
render :action => 'new'
end
end
def edit
@photo = Photo.find(params[:id])
end
def update
@photo = Photo.find(params[:id])
if @photo.update_attributes(paramas[:photo])
flash[:notice] = "Successfully updated photo."
redirect_to @photo.gallery
else
render :action => 'edit'
end
end
def destroy
@photo = Photo.find(params[:id])
@photo.destroy
flash[:notice] = "Successfully destroyed photo."
redirect_to @photo.gallery
end
end
User model:
# It is setup so no gallery is created, and photos are associated with the
user.
private
def setup_gallery
Gallery.create(user: self)
end
Photo model:
attr_accessible :title, :body, :gallery_id, :name, :image,
:remote_image_url
belongs_to :gallery
has_many :gallery_users, :through => :gallery, :source => :user
belongs_to :user
mount_uploader :image, ImageUploader
LIMIT = 5
validate do |record|
record.validate_photo_quota
end
def validate_photo_quota
return unless self.user
if self.user.photos(:reload).count >= LIMIT
errors.add(:base, :exceeded_quota)
end
end
end

Notification of changes in files of a given type in a group of Github repositories

Notification of changes in files of a given type in a group of Github
repositories

I want to receive a notification (RSS, email, whatever) if anyone makes a
change on any .md file in a Github repository. I have many repositories to
watch. How can I do this?

Tuesday, 1 October 2013

java.lang.ClassNotFoundException: Class com.ibm.db2.jcc.DB2Driver not found in Worklight platform or project

java.lang.ClassNotFoundException: Class com.ibm.db2.jcc.DB2Driver not
found in Worklight platform or project

I try to test an sql adapter that connects to db2 but I get the following
result:
java.lang.ClassNotFoundException: Class com.ibm.db2.jcc.DB2Driver not
found in Worklight platform or project
here is my code:
<dataSourceDefinition>
<driverClass>com.ibm.db2.jcc.DB2Driver</driverClass>
<url>jdbc:db2://localhost:50000/WLTEST</url>
<user>db2admin</user>
<password>db2admin</password>
</dataSourceDefinition>
any idea what is going wrong?

django session lost when redirected from facebook oauth

django session lost when redirected from facebook oauth

I have a django app which is implementing Facebook oauth login.
Before an AnonymousUser, who has not yet been authenticated, is sent to
Facebook's oauth2, I store a token in the request.session.
Once the user log's in via facebook and is redirected back to our site,
the django session is lost. A new session key has been generated, the old
session key is removed from the db session store, and there is no data in
the session (so the original session token is missing). I can't figure out
why this is happening and need to get the original token?
I have the following in settings.py
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
SESSION_COOKIE_DOMAIN = '.mysite.com'
SESSION_COOKIE_SECURE = True
SESSION_EXPIRE_AT_BROWSER_CLOSE = False

No sound after exiting Rhythmbox party mode

No sound after exiting Rhythmbox party mode

After putting Rhythmbox into "party mode" I couldn't find a way to exit it
(a known bug), so I logged out and in again. After that my sound was gone.
Rebooting didn't fix the issue.
Note: Both my sound devices (laptop as well as my external speakers)
aren't working.
Edit: Reinstalling Rhythmbox and all its plugins didn't solve anything

Extracting a tar ball fails with "Cannot open: Not a directory"

Extracting a tar ball fails with "Cannot open: Not a directory"

I am trying to extract an tarball, I keep getting this error
tar: mediatek/custom/common/lk/lcm/bp101wx1_n/bp101wx1_n.c: Cannot open:
Not a directory
tar: mediatek/custom/common/lk/lcm/hsd070idw1/hsd070idw1.c: Cannot open:
Not a directory
tar: mediatek/custom/common/lk/lcm/nt35582/nt35582.c: Cannot open: Not a
directory
tar:
mediatek/custom/common/lk/lcm/r63311_fhd_dsi_vdo_sharp/r63311_fhd_dsi_vdo_sharp.c:
Cannot open: Not a directory
tar:
mediatek/custom/common/lk/lcm/otm9608_wvga_dsi_cmd/otm9608_wvga_dsi_cmd.c:
Cannot open: Not a directory
tar: mediatek/custom/common/lk/lcm/lg4571/lg4571.c: Cannot open: Not a
directory
tar:
mediatek/custom/common/lk/lcm/hx8363b_wvga_dsi_cmd/hx8363b_wvga_dsi_cmd.c:
Cannot open: Not a directory
tar:
mediatek/custom/common/lk/lcm/lg4573b_wvga_dsi_vdo_lh430mv1/lg4573b_wvga_dsi_vdo_lh430mv1.c:
Cannot open: Not a directory
tar: Exiting with failure status due to previous errors
The original file was a .zip file that contained a .tar.gz file, so I
first used unzip then I used pigz with the -d option to create the tar
file.
I extracted the tar file using tar with xf option.
The tar file is 3.8 GB if that matters