Search Results

Search found 311 results on 13 pages for 'erik'.

Page 7/13 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Horrible WPF performance!

    - by Erik
    Why am i using over 80% CPU when just hovering some links? As you can see in the video i uploaded: http://www.youtube.com/watch?v=3ALF9NquTRE the CPU goes to 80% CPU when i move my mouse over the links. My style for the items are as follows <Style x:Key="LinkStyle" TargetType="{x:Type Hyperlink}"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Foreground" Value="White" /> </Trigger> </Style.Triggers> <Setter Property="TextBlock.TextDecorations" Value="{x:Null}" /> <Setter Property="Foreground" Value="#FFDDDDDD"/> <Setter Property="Cursor" Value="Arrow" /> </Style> Why?

    Read the article

  • Rails 3 memory issue

    - by Erik
    Hello! I'm developing a new site based on Ruby on Rails 3 beta. I knew this might be a bad idea considering it's just beta, but I still thought it might work. Now though I'm having HUGE problems with Rails consuming huge ammounts of memory. For my application today it consumes about 10 mb per request and it doesn't seem to release it either. So I thought this might be because of bloat in my application and thus I created a test app just to compare. For my test app I just generated a model with a scaffold and then created about 20 records on this model. I then went to the index page and hit refresh and I could immediately see memory taking off! Less than my app but still about 1-3 mb per request. I'm working in OSX Leopard, with Ruby 1.8.7, Rails 3.0.0.beta and a SQLLite db for development. Does anyone recognize my problem? I would really appreciate some help here. :/ Thanks!

    Read the article

  • Is it possible to distribute STDIN over parallel processes?

    - by Erik
    Given the following example input on STDIN: foo bar bar baz === qux bla === def zzz yyy Is it possible to split it on the delimiter (in this case '===') and feed it over stdin to a command running in parallel? So the example input above would result in 3 parallel processes (for example a command called do.sh) where each instance received a part of the data on STDIN, like this: do.sh (instance 1) receives this over STDIN: foo bar bar baz do.sh (instance 2) receives this over STDIN: qux bla do.sh (instance 3) receives this over STDIN: def zzz yyy I suppose something like this is possible using xargs or GNU parallel, but I do not know how.

    Read the article

  • Finding distance to the closest point in a point cloud on an uniform grid

    - by erik
    I have a 3D grid of size AxBxC with equal distance, d, between the points in the grid. Given a number of points, what is the best way of finding the distance to the closest point for each grid point (Every grid point should contain the distance to the closest point in the point cloud) given the assumptions below? Assume that A, B and C are quite big in relation to d, giving a grid of maybe 500x500x500 and that there will be around 1 million points. Also assume that if the distance to the nearest point exceds a distance of D, we do not care about the nearest point distance, and it can safely be set to some large number (D is maybe 2 to 10 times d) Since there will be a great number of grid points and points to search from, a simple exhaustive: for each grid point: for each point: if distance between points < minDistance: minDistance = distance between points is not a good alternative. I was thinking of doing something along the lines of: create a container of size A*B*C where each element holds a container of points for each point: define indexX = round((point position x - grid min position x)/d) // same for y and z add the point to the correct index of the container for each grid point: search the container of that grid point and find the closest point if no points in container and D > 0.5d: search the 26 container indices nearest to the grid point for a closest point .. continue with next layer until a point is found or the distance to that layer is greater than D Basically: put the points in buckets and do a radial search outwards until a points is found for each grid point. Is this a good way of solving the problem, or are there better/faster ways? A solution which is good for parallelisation is preferred.

    Read the article

  • Django FileField not saving to upload_to location

    - by Erik
    I have an Attachment model that has a FileField in a Django 1.4.1 app. This FileField has a callable upload_to parameter which, per the Django docs should be called when the form (and therefore the model) is saved. When I run FormTest below, the upload_to callable is never called and the file therefore does not appear in the location provided by the upload_to method. What am I doing wrong? Notice that in the passing tests in ModelTest (also below), the upload_to method works as expected. Test: from core.forms.attachments import AttachmentForm from django.test import TestCase import unittest from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.storage import default_storage def suite(): return unittest.TestSuite( [ unittest.TestLoader().loadTestsFromTestCase(FormTest), ] ) class FormTest(TestCase): def test_form_1(self): filename = 'filename' f = file(filename) data = {'name':'name',} file_data = {'attachment_file':SimpleUploadedFile(f.name,f.read()),} form = AttachmentForm(data=data,files=file_data) self.assertTrue(form.is_valid()) attachment = form.save() root_directory = 'attachments' upload_location = root_directory + '/' + attachment.directory + '/' + filename self.assertTrue(attachment.attachment_file) # Fails self.assertTrue(default_storage.exists(upload_location)) # Fails Attachment Model: from django.db import models from parent_mixins import Parent_Mixin import uuid from django.db.models.signals import pre_delete,pre_save from dirtyfields import DirtyFieldsMixin def upload_to(instance,filename): return 'attachments/' + instance.directory + '/' + filename def uuid_directory_name(): return uuid.uuid4().hex class Attachment(DirtyFieldsMixin,Parent_Mixin,models.Model): attachment_file = models.FileField(blank=True,null=True,upload_to=upload_to) directory = models.CharField(blank=False,default=uuid_directory_name,null=False,max_length=32) name = models.CharField(blank=False,default=None,null=False,max_length=128) class Meta: app_label = 'core' def __str__(self): return unicode(self).encode('utf-8') def __unicode__(self): return unicode(self.name) @models.permalink def get_absolute_url(self): return('core_attachments_update',(),{'pk': self.pk}) # def save(self,*args,**kwargs): # super(Attachment,self).save(*args,**kwargs) def pre_delete_callback(sender, instance, *args, **kwargs): if not isinstance(instance, Attachment): return if not instance.attachment_file: return instance.attachment_file.delete(save=False) def pre_save_callback(sender, instance, *args, **kwargs): if not isinstance(instance, Attachment): return if not instance.attachment_file: return if instance.is_dirty(): dirty_fields = instance.get_dirty_fields() if 'attachment_file' in dirty_fields: old_attachment_file = dirty_fields['attachment_file'] old_attachment_file.delete() pre_delete.connect(pre_delete_callback) pre_save.connect(pre_save_callback) Attachment Form: from ..models.attachments import Attachment from crispy_forms.helper import FormHelper from crispy_forms.layout import Div,Layout,HTML,Field,Fieldset,Button,ButtonHolder,Submit from django import forms class AttachmentFormHelper(FormHelper): form_tag=False layout = Layout( Div( Div( Field('name',css_class='span4'), Field('attachment_file',css_class='span4'), css_class='span4', ), css_class='row', ), ) class AttachmentForm(forms.ModelForm): helper = AttachmentFormHelper() class Meta: fields=('attachment_file','name') model = Attachment class AttachmentInlineFormHelper(FormHelper): form_tag=False form_style='inline' layout = Layout( Div( Div( Field('name',css_class='span4'), Field('attachment_file',css_class='span4'), Field('DELETE',css_class='span4'), css_class='span4', ), css_class='row', ), ) class AttachmentInlineForm(forms.ModelForm): helper = AttachmentInlineFormHelper() class Meta: fields=('attachment_file','name') model = Attachment UPDATE I also do testing on the Attachment model class with these unit tests -- which all pass: from core.models.attachments import Attachment from core.models.attachments import upload_to from django.test import TestCase import unittest from django.core.files.storage import default_storage from django.core.files.base import ContentFile def suite(): return unittest.TestSuite( [ unittest.TestLoader().loadTestsFromTestCase(ModelTest), ] ) class ModelTest(TestCase): def test_model_minimum_fields(self): attachment = Attachment(name='name') attachment.attachment_file.save('test.txt',ContentFile("hello world")) attachment.save() self.assertEqual(str(attachment),'name') self.assertEqual(unicode(attachment),'name') self.assertTrue(attachment.directory) # def test_model_full_fields(self): # attachment = Attachment() # attachement.save() def test_file_operations_basic(self): root_directory = 'attachments' filename = 'test.txt' attachment = Attachment(name='name') attachment.attachment_file.save(filename,ContentFile('test')) attachment.save() upload_location = root_directory + '/' + attachment.directory + '/' + filename self.assertEqual(upload_to(attachment,filename),upload_location) self.assertTrue(default_storage.exists(upload_location)) def test_file_operations_delete(self): root_directory = 'attachments' filename = 'test.txt' attachment = Attachment(name='name') attachment.attachment_file.save(filename,ContentFile('test')) attachment.save() upload_location = upload_to(attachment,filename) attachment.delete() self.assertFalse(default_storage.exists(upload_location)) def test_file_operations_change(self): root_directory = 'attachments' filename_1 = 'test_1.txt' attachment = Attachment(name='name') attachment.attachment_file.save(filename_1,ContentFile('test')) attachment.save() upload_location_1 = upload_to(attachment,filename_1) self.assertTrue(default_storage.exists(upload_location_1)) filename_2 = 'test_2.txt' attachment.attachment_file.save(filename_2,ContentFile('test')) attachment.save() upload_location_2 = upload_to(attachment,filename_2) self.assertTrue(default_storage.exists(upload_location_2)) self.assertFalse(default_storage.exists(upload_location_1))

    Read the article

  • A Django form for entering a 0 to n email addresses

    - by Erik
    I have a Django application with some fairly common models in it: UserProfile and Organization. A UserProfile or an Organization can both have 0 to n emails, so I have an Email model that has a GenericForeignKey. UserProfile and Organization Models both have a GenericRelation called emails that points back to the Email model (summary code provided below). The question: what is the best way to provide an Organization form that allows a user to enter organization details including 0 to n email addresses? My Organization create view is a Django class-based view. I'm leading towards creating a dynamic form and an enabling it with Javascript to allow the user to add as many email addresses as necessary. I will render the form with django-crispy-forms. I've thought about doing this with a formset embedded within the form, but this seems like overkill for email addresses. Embedding a formset in a form delivered by a class-based view is cumbersome too. Note that the same issue occurs with the Organization fields phone_numbers and locations. emails.py: from django.db import models from parent_mixins import Parent_Mixin class Email(Parent_Mixin,models.Model): email_type = models.CharField(blank=True,max_length=100,null=True,default=None,verbose_name='Email Type') email = models.EmailField() class Meta: app_label = 'core' organizations.py: from emails import Email from locations import Location from phone_numbers import Phone_Number from django.contrib.contenttypes import generic from django.db import models class Organization(models.Model): active = models.BooleanField() duns_number = models.CharField(blank=True,default=None,null=True,max_length=9) # need to validate this emails = generic.GenericRelation(Email,content_type_field='parent_type',object_id_field='parent_id') legal_name = models.CharField(blank=True,default=None,null=True,max_length=200) locations = generic.GenericRelation(Location,content_type_field='parent_type',object_id_field='parent_id') name = models.CharField(blank=True,default=None,null=True,max_length=200) organization_group = models.CharField(blank=True,default=None,null=True,max_length=200) organization_type = models.CharField(blank=True,default=None,null=True,max_length=200) phone_numbers = generic.GenericRelation(Phone_Number,content_type_field='parent_type',object_id_field='parent_id') taxpayer_id_number = models.CharField(blank=True,default=None,null=True,max_length=9) # need to validate this class Meta: app_label = 'core' parent_mixins.py from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from django.db import models class Parent_Mixin(models.Model): parent_type = models.ForeignKey(ContentType,blank=True,null=True) parent_id = models.PositiveIntegerField(blank=True,null=True) parent = generic.GenericForeignKey('parent_type', 'parent_id') class Meta: abstract = True app_label = 'core'

    Read the article

  • How to retrieve a IMAP body with the right charset?

    - by Erik
    Hi Guys, I'm trying to make an "IMAP fetch" command to retrieve the message body. I need to pass/use the correct charset, otherwise the response will come with special characters. How can I make the IMAP request/command to consider the charset I received in the BODYSTRUCTURE result??

    Read the article

  • to Imagemagick PHP exec

    - by Erik Smith
    I found a very helpful post on here about cropping images in a circle. However, when I try to execute the imagemagick script using exec in PHP, I'm getting no results. I've checked to make sure the directories have the correct permissions and such. Is there a step I'm missing? Any insight would be much appreciated. Here's what my script looks like: $run = exec('convert -size 200x200 xc:none -fill daisy.jpg -draw "circle 100,100 100,1" uploads/new.png'); Edit: Imagemagick is installed.

    Read the article

  • Super wide, but not so tall, bitmap?

    - by Erik Karlsson
    Howdy folks. Is there any way to create a more space/resource efficient bitmap? Currently i try to render a file, approx 800 px high but around 720000px wide. It crashes my application, presumebly because of the share memory-size of the bitmap. Can i do it more efficient, like creating it as an gif directly and not later when i save it? I try to save a series of lines/rectangles from a real world reading, and i want it to be 1px per 1/100th of a second. Any input? And btw, i never manage to ogon using google open id : /

    Read the article

  • Storing a remote path by name in Hg

    - by Erik Vold
    In git I can git remote add x http://... then git pull x how can I do this in hg? I was told to add the following to .hgrc: [paths] x = http://... so I added the above to /path/to/repo/.hgrc then tried hg pull x and got the following error: abort: repository x not found! where x was mozilla and http:// was http://hg.mozilla.org/labs/jetpack-sdk/

    Read the article

  • Gravatar XML-RPC request problem in Objective-C

    - by Erik
    Hi all, I'm trying to incorporate some Gravatar functionality using its XML-RPC API in an iPhone app I'm writing. I grabbed the Cocoa XML-RPC Framework by Eric Czarny (http://github.com/eczarny/xmlrpc) and it works well when I tested it with some of the Wordpress methods. However, when I try to use the Gravatar API, I always receive a response of "Error code: -9 Authentication error". I think I'm constructing the request correctly, but I've been wracking my brain and can't seem to figure it out. Maybe someone has some experience with this API or can see what I'm doing wrong. Here's the call: <?xml version="1.0"> <methodCall> <methodName>grav.addresses</methodName> <params> <param><value><string>PASSWORD_HERE</string></value></param> </params> </methodCall> Again, the Cocoa XML-RPC Framework worked like a dream with Wordpress, but it's choking on the Gravatar API for some reason. Thanks for your help.

    Read the article

  • Polymorphic association in reverse

    - by Erik
    Let's say that I have two models - one called Post and one other called Video. I then have a third model - Comment - that is polymorphically associated to to each of these models. I can then easily do post.comments and video.comments to find comments assosciated to records of these models. All easy so far. But what if I want to go the other way and I want to find ALL posts and videos that have been commented on and display these in a list sorted on the date that the comment was made? Is this possible? If it helps I'm working on Rails 3 beta.

    Read the article

  • JScrollPanel without scrollbars

    - by Erik Itland
    I'm trying to use a JScrollPanel to display a JPanel that might be too big for the containing Jpanel. I don't want to show the scrollbars (yes, this is questionable UI design, but it is my best guess of what the customer wants. We use the same idea other places in the application, and I feel this case have given me enough time to ponder if I can do it in a better way, but if you have a better idea I might accept it an answer.) First attempt: set verticalScrollBarPolicy to NEVER. Result: Scrolling using mouse wheel doesn't work. Second attempt: set the scrollbars to null. Result: Scrolling using mouse wheel doesn't work. Third attempt: set scrollbars visible property to false. Result: It is immidiately set visible by Swing. Fourth attempt: inject a scrollbar where setVisible is overridden to do nothing when called with true. Result: Can't remember exactly, but I think it just didn't work. Fifth attempt: inject a scrollbar where setBounds are overridden. Result: Just didn't look nice. (I might have missed something here, though.) Sixth attempt: ask stackoverflow. Result: Pending. Scrolling works once scrollbars are back.

    Read the article

  • Invalid binary. A pre-release beta version of the SDK was used to build the application.

    - by erik
    Yesterday I submitted an app to the iphone dev center, no problems at all. Today I did some changes to another existing app and was greeted by the following message when I uploaded my binary: The binary you uploaded was invalid. A pre-release beta version of the SDK was used to build the application. I googled the message and didn't find anything at all. I also tried but failed to update another app, same message there. I have not changed anything in between (that I know) and I have certainly not installed or downgraded my SDK. Building for iPhone 3.0..

    Read the article

  • How to begin working with git?

    - by Erik Escobedo
    I'm a Ruby on Rails developer and want to use Git for my next project, but I'm not pretty sure how to begin learning this. I have too much basic questions like "Can I run my app from the repository?", or "Can I make a rollback in the live site?" Any help will be apreciated.

    Read the article

  • Tomcat on Windows x64 using 32-bit JDK

    - by Erik
    Hoping someone can help. The rub: I can't get Tomcat 5.5 to start as a windows service on 64-bit windows using a 32-bit JDK. the details: I've been running Tomcat 5.5 on Windows Server 2008 (x64) as a service for some time using a 64-bit JDK. I'm being forced to install a 32-bit JDK on this 64-bit machine so I can make use of the Java JAI libraries (no 64-bit JAI version). I have to run Tomcat using this 32-bit JDK. I can run Tomcat using the 32-bit JDK if I start it using /bin/startup.bat Problem is, it will not start as a windows service. I'm using the Tomcat bundled procrun executables. Has anyone had success starting Tomcat as a service using a 32-bit JDK on a 64-bit machine? Thanks for your expertise.

    Read the article

  • C# - Possible to use Subinacl or something else (an api maybe?) from C# code?

    - by Svein Erik
    I've created a program in C# which creates users and adds them to groups, everything is working fine. But I also want to create a "home folder", which is on another server, and the share will be like this: 81file01/users/username. And of course set the rights of the folder to the newly created AD-user. Now we're using a vb-script to do this, and this part is done with Subinacl, but is there a way to do this through my c# code? I'm using .net 3.5 by the way :)

    Read the article

  • Change C# sorting behaviour

    - by Erik
    Lets say i have the strings abc_ and abc2_. Now, normally when sorting i C# abc2_ would come after abc_, leaving the result: abc_ abc2_ I am using this to sort, if it matters: var element = from c in elements orderby c.elementName ascending select c; How can i change this? I want abc_ to come last. Reversing is not an option because the list is contains more than two elements.

    Read the article

  • Image processing with barehands-ruby

    - by Erik Escobedo
    I want to know how to open and manipulate a simple image file in Ruby language. I don't need to do any advanced stuff, just things like open(), get_pixel() and put_pixel() and I don't wanna use any gem for doing that, but just to know the barehands-ruby way.

    Read the article

  • LaTeX table too wide. How to make it fit?

    - by Erik B
    I just started to learn latex and now I'm trying to create a table. This is my code: \begin{table} \caption{Top Scorers} \begin{tabular}{ l l } \hline \bf Goals & \bf Players\\ \hline 4 & First Last, First Last, First Last, First Last\\ 3 & First Last\\ 2 & First Last\\ 1 & First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last, First Last\\ \hline \end{tabular} \end{table} The problem is that the table is wider than the page. I was hoping that it would automatically fit to the page like normal text does, but it didn't. How do I tell latex to make the table fit to the page?

    Read the article

  • WPF Skin Skinning Security Concerns

    - by Erik Philips
    I'm really new to the WPF in the .Net Framework (get that out of the way). I'm writing an application where the interface is very customizable by simply loading .xaml (at the moment a Page element) files into a frame and then mapping the controls via names as needed. The idea is to have a community of people who are interested in making skins, skin my application however they want (much like Winamp). Now the question arises, due to my lack of Xaml knowledge, is it possible to create malicious Xaml pages that when downloaded and used could have other embedded Iframes or other elements that could have embed html or call remote webpages with malicious content? I believe this could be the case. If this is the case then I two options; either I have an automated process that can remove these types of Xaml files by checking it’s elements prior to allowing download (which I would assume would be most difficult) or have a human review them prior to download. Are there alternatives I’m unaware of that could make this whole process a lot easier?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13  | Next Page >