Search Results

Search found 163 results on 7 pages for 'pedro sardinha u94410'.

Page 5/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • net c# lock statement in data access layer

    - by Pedro Rivera
    I saw a code where they have the data access layer like this: public class CustomerDA{ private static readonly object _sync = new object(); private static readonly CustomerDA _mutex = new CustomerDA(); private CustomerDA(){ } public CustomerDA GetInstance(){ lock(_sync){ return _mutex; } } public DataSet GetCustomers(){ //database SELECT //return a DataSet } public int UpdateCustomer(some parameters){ //update some user } } public class CustomerBO{ public DataSet GetCustomers(){ //some bussiness logic return CustomerDA.GetInstance().GetCustomers(); } } I was using it, but start thinking... "and what if had to build a facebook like application where there are hundreds of thousands of concurrent users? would I be blocking each user from doing his things until the previous user ends his database stuff? and for the Update method, is it useful to LOCK THREADS in the app when database engines already manage concurrency at database server level?" Then I started to think about moving the lock to the GetCustomers and UpdateCustomer methods, but think again: "is it useful at all?"

    Read the article

  • Is there any modern command-line based text editor?

    - by Pedro Morte Rolo
    A command line in a text editor is a wonderful feature. It allows the user to explore the editor's functionality and learn it's shortcuts in a textual way. It's much faster than using the mouse, and it is much easier to memorise "shortcuts" this way. Emacs and VI provide this, though, emacs and vi are not "modern". By "modern", I mean one that is original built to cope with the modern de-facto standards of selecting, copying, pasting, cutting, undoing, redoing and auto-completing. Cream/vi or EmacsCUE are not valid options, since there are loads of things built over them that conflict with the mentioned stuff. Is there any alternative?

    Read the article

  • Compression Array of Bytes

    - by Pedro Magalhaes
    Hi, My problem is: I want to store a array of bytes in compressed file, and then I want to read it with a good performance. So I create a array of bytes then pass to a ZLIB algorithm then store it in the file. For my surprise the algorithm doesn't work well., probably because the array is a random sample. Using this approach, it will will be ber easy to read. Just copy the stream to memory, decompress them and copy it to a array of bytes. But i need to compress the file. Do I have to use a algorithm, like RLE, for compresse the byte array? I think that I can store the byte array like a string and then compress it. But i think I am going to have a poor performance on reading data. Sorry for my poor english. Thanks

    Read the article

  • how to know what files or folder are changed before do commit

    - by Pedro
    My problem is how to know what files or folder are changed before do commit. I can add all the new files in my working copy before do commit, and the repository changes, but if for example i delete one file of the working copy i dont know the way to add this change before do commit. When you use the tortoise for example before do commit the program shows all the changes of the working copy and you can choose what changes commit and what changes dont. There is some way to do this usin sharp svn?? thanks for your answer!!!

    Read the article

  • Symfony2 Entity to array

    - by Adriano Pedro
    I'm trying to migrate my flat php project to Symfony2, but its coming to be very hard. For instance, I have a table of Products specification that have several specifications and are distinguishables by its "cat" attribute in that Extraspecs DB table. Therefore I've created a Entity for that table and want to make an array of just the specifications with "cat" = 0... I supose the code is this one.. right? $typeavailable = $this->getDoctrine() ->getRepository('LabsCatalogBundle:ProductExtraspecsSpecs') ->findBy(array('cat' => '0')); Now how can i put this in an array to work with a form like this?: form = $this ->createFormBuilder($product) ->add('specs', 'choice', array('choices' => $typeavailableArray), 'multiple' => true) Thank you in advance :) # Thank you all.. But now I've came across with another problem.. In fact i'm building a form from an existing object: $form = $this ->createFormBuilder($product) ->add('name', 'text') ->add('genspec', 'choice', array('choices' => array('0' => 'None', '1' => 'General', '2' => 'Specific'))) ->add('isReg', 'choice', array('choices' => array('0' => 'Material', '1' => 'Reagent', '2' => 'Antibody', '3' => 'Growth Factors', '4' => 'Rodents', '5' => 'Lagomorphs'))) So.. in that case my current value is named "extraspecs", so i've added this like: ->add('extraspecs', 'entity', array( 'label' => 'desc', 'empty_value' => ' --- ', 'class' => 'LabsCatalogBundle:ProductExtraspecsSpecs', 'property' => 'specsid', 'query_builder' => function(EntityRepository $er) { return $er ->createQueryBuilder('e'); But "extraspecs" come from a relationship of oneToMany where every product has several extraspecs... Here is the ORM: Labs\CatalogBundle\Entity\Product: type: entity table: orders__regmat id: id: type: integer generator: { strategy: AUTO } fields: name: type: string length: 100 catnumber: type: string scale: 100 brand: type: integer scale: 10 company: type: integer scale: 10 size: type: decimal scale: 10 units: type: integer scale: 10 price: type: decimal scale: 10 reqcert: type: integer scale: 1 isReg: type: integer scale: 1 genspec: type: integer scale: 1 oneToMany: extraspecs: targetEntity: ProductExtraspecs mappedBy: product Labs\CatalogBundle\Entity\ProductExtraspecs: type: entity table: orders__regmat__extraspecs fields: extraspecid: id: true type: integer unsigned: false nullable: false generator: strategy: IDENTITY regmatid: type: integer scale: 11 spec: type: integer scale: 11 attrib: type: string length: 20 value: type: string length: 200 lifecycleCallbacks: { } manyToOne: product: targetEntity: Product inversedBy: extraspecs joinColumn: name: regmatid referencedColumnName: id HOw should I do this? Thank you!!!

    Read the article

  • Jquery Close/Open Multiple Toggles

    - by Pedro
    Hi, I have the toggle in my menu Working successfully for the two links that I have within it. Because the top link once toggled covers the other link, there is no problem. But since the link beneath it leaves the top link exposed, a user could click that and now have two toggled items open and pretty much stacked on top of each other. Is there a way for me to check if the other toggled item is open and if so, close it? Thanks! <div class="parents-toggle"> <a href="#" id="customize-toggle">Customize</a><br/> <div class="menu-toggle hidden" id="customize-menu"> <div class="menu-toggle-one"> <h3>Background</h3> <ul> <li><a href="#">Dark Wood</a></li> <li><a href="#">Wallpaper</a></li> <li><a href="#">Bricks</a></li> <li><a href="#">Planks</a></li> <li><a href="#">Default</a></li> </ul> </div> <div class="menu-toggle-two"> <h3>Layout</h3> <ul> <li><a href="#">Grid</a></li> <li><a href="#">List</a></li> <li><a href="#">Full</a></li> </ul> </div> </div> </div> <a href="/submit/">Submit video</a><br/> <div class="parents-toggle"> <a href="#" id="channels-toggle">Channels</a> <div class="menu-toggle hidden" id="channels-menu"> <div class="menu-toggle-one"> <ul> <li><a href="#">Automotive</a></li> <li><a href="#">Comedy</a></li> <li><a href="#">Movies</a></li> <li><a href="#">Weather</a></li> </ul> </div> <div class="menu-toggle-two"> <ul> <li><a href="#">Business</a></li> <li><a href="#">Commercials</a></li> <li><a href="#">Music</a></li> <li><a href="#">Technology</a></li> </ul> </div> </div> </div> </div> <script> $("#customize-toggle").click(function () { $("#customize-menu").toggle(); }); $("#channels-toggle").click(function () { $("#channels-menu").toggle(); }); </script>

    Read the article

  • [Wordpress MU] Changing the uploads directory

    - by Pedro Reis
    Hi, I've looked everywhere and while there is solutions to change the uploads directory for all the blogs by changing this line in the wp-settings.php: define( "BLOGUPLOADDIR", WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" ); I can't find a way of changing the directory for each blog individually, something like: define( "BLOGUPLOADDIR", WP_CONTENT_DIR . "/blogs.dir/{$blog_name}/files/" ); But I have no idea how could I get the name of the blog from within the wp-settings.php as you can't use get_bloginfo('name'); outside of the template. Anybody with a solution for this?

    Read the article

  • iframe height not taken into account by IE8

    - by Pedro
    Hi guys, I'm building a dummy widget for a iGoogle/Netvibes like portal. This is a "Google Maps" widget, as it only renders a map centered on a specific location. The widget looks good in all browsers but IE8, in which the height I specify to the <div> that contains the map is not taken into account. Here's the interesting part of the code: <body onload="initialize()" > <div id="map_canvas" style="height:400px; width: 100%;"></div> </body> I have no control on the portal, so the only thing I can modify is the widget itself. I also tried to set the height for the <body>, but same thing. Any idea on why it's not working in IE? Thanks!

    Read the article

  • Fseek on C problem

    - by Pedro
    i'm testing this code, but doesn't work, it always says that an error occurred :S int main(int argc, char **argv) { FILE *file_pointer; file_pointer = fopen("text.txt","r"); if(fseek(file_pointer, 0, -1)) { puts("An error occurred"); } else { char buffer[100]; fgets(buffer, 100, file_pointer); puts("The first line of the file is:"); puts(buffer); } fclose(file_pointer); return 0; }

    Read the article

  • Changing url of background image

    - by João Pedro
    I'm doing this interface where I have a lot of buttons that are just a li with a background image like this #menu ul.icons li.nove { background-image:url(images/edit-menu/icons/undo.png); background-size:contain; display:block; margin-top:29px; } <ul class="icons"> <li class="um"></li> <li class="dois"></li> <li class="tres"></li> <li class="quatro"></li> <li class="cinco"></li> <li class="seis"></li> <li class="sete"></li> <li class="oito"></li> <li class="nove"></li> <li class="dez"></li> </ul> I need to create a code where I change the background image of the button when the user clicks it, to show that button its activated, I just need to change url(images/edit-menu/icons/ to url(images/edit-menu/select/ and keep the same filename. I need a way to do this dynamically so I won't have to do it for each of the 10 buttons. Hope I was clear, thanks in advance

    Read the article

  • How to change object positions in an android layout?

    - by Pedro Santos
    Hi, I'm currently working on a very simple aplication, and I intended to make it change the visual aspect depending on the screen size. The application just has 6 buttons like this: http://www.freeimagehosting.net/uploads/e1efb4c4d0.jpg I'm using the AbsoluteLayout, and changing the x and y of the buttons with the methods offsetLeftAndRight and offsetTopAndBottom. I'm not changing the layout of the buttons in the xml file, so the all start in the same place. However, if I use this methods inside the onClickMethod they sometimes appear where I want them, sometimes don't (can't figure out why), but if i use them in the onCreate method, nothing happens. Can someone point me in the right direction? Thanks

    Read the article

  • Decompiling an old Program

    - by Pedro Laranjeiro
    Hi. I have been asked to update a program written in 1987 in Delphi (I guess). I have no documentation about this program only a few side notes the programmer took that don't make too much sense to make. The cd show this files: Size | Filename - 19956 VP.DTA - 142300 VP.LEX - 404 VP.NDX - 126502 VP.RCS - 131016 VP.SCR - 150067 VP.XEL - 101791 vp.exe Is anyone of this files a database? If so can I access it's data? I tried several code decompilers but they show a message saying it was not a Win32 compatible application. The program run in MS-DOS. Is it possible to obtain the source code? Can I use this code in any way to build a new application? Thanks Update01: I can run the program in MSDOS. The program conjugate verbs and shows an example sentence where the verb can be used. The GUI is a little bit confusing and there is no help menu so I can't see all the capabilities of the program.

    Read the article

  • Facebook SSO authorize in safari but not in facebook app

    - by Pedro Calero
    My problem: I has developed an app with Facebook SSO in my iPhone/iPad. It was working OK. But I have changed the certificate of my app (so now it has new app ID). I also have changed the "iOS pack ID" property in Facebook: I deleted the old app ID and I added the new one. But now my app doesn't do the Facebook SSO when Facebook app is installed. It does it OK when Facebook app is not installed and it uses Safari. I have read this question and this question that say the problem is the "iOS pack ID" and app ID don't match. I have checked it a lot of times, and it is the same. I have put the old app ID in the "iOS pack ID" property of Facebook, but it still doesn't work. I don't know if Facebook take a time to check if my app ID is valid, and how they show the result. I have been a lot of time with this issue. It seem like the problem is the iOS pack ID is not exactly the app ID, but it is not the problem: they are exactly the same. Thank you very much.

    Read the article

  • why does Visual Studio not enforce try-catch-block implementation?

    - by Pedro
    Coming from Eclipse/Java, I noticed that in VisualStudio/C# it is not mandatory to care about Exceptions. While Eclipse forces the user to implement a try-catch-block or to add a throws declaration, this is not the case in Visual Studio. What is the reason Visual Studio doesn't inform about unhandled exceptions? Can I configure Visual Studio to force me to implement try-catch-blocks, or at least add a compiler-warning?

    Read the article

  • In what circumstances are instance variables declared as '_var' in 'use fields' readonly?

    - by Pedro Silva
    I'm trying to understand the behavior of the fields pragma, which I find poorly documented, regarding fields prefixed with underscores. This is what the documentation has to say about it: Field names that start with an underscore character are made private to the class and are not visible to subclasses. Inherited fields can be overridden but will generate a warning if used together with the -w switch. This is not consistent with its actual behavior, according to my test, below. Not only are _-prefixed fields visible within a subclass, they are visible within foreign classes as well (unless I don't get what 'visible' means). Also, directly accessing the restricted hash works fine. Where can I find more about the behavior of the fields pragma, short of going at the source code? { package Foo; use strict; use warnings; use fields qw/a _b __c/; sub new { my ( $class ) = @_; my Foo $self = fields::new($class); $self->a = 1; $self->b = 2; $self->c = 3; return $self; } sub a : lvalue { shift->{a} } sub b : lvalue { shift->{_b} } sub c : lvalue { shift->{__c} } } { package Bar; use base 'Foo'; use strict; use warnings; use Data::Dumper; my $o = Bar->new; print Dumper $o; ##$VAR1 = bless({'_b' => 2, '__c' => 3, 'a' => 1}, 'Foo'); $o->a = 4; $o->b = 5; $o->c = 6; print Dumper $o; ##$VAR1 = bless({'_b' => 5, '__c' => 6, 'a' => 4}, 'Foo'); $o->{a} = 7; $o->{_b} = 8; $o->{__c} = 9; print Dumper $o; ##$VAR1 = bless({'_b' => 8, '__c' => 9, 'a' => 7}, 'Foo'); }

    Read the article

  • In what circumstances are instance variables declared as '_var' in 'use fields' private?

    - by Pedro Silva
    I'm trying to understand the behavior of the fields pragma, which I find poorly documented, regarding fields prefixed with underscores. This is what the documentation has to say about it: Field names that start with an underscore character are made private to the class and are not visible to subclasses. Inherited fields can be overridden but will generate a warning if used together with the -w switch. This is not consistent with its actual behavior, according to my test, below. Not only are _-prefixed fields visible within a subclass, they are visible within foreign classes as well (unless I don't get what 'visible' means). Also, directly accessing the restricted hash works fine. Where can I find more about the behavior of the fields pragma, short of going at the source code? { package Foo; use strict; use warnings; use fields qw/a _b __c/; sub new { my ( $class ) = @_; my Foo $self = fields::new($class); $self->a = 1; $self->b = 2; $self->c = 3; return $self; } sub a : lvalue { shift->{a} } sub b : lvalue { shift->{_b} } sub c : lvalue { shift->{__c} } } { package Bar; use base 'Foo'; use strict; use warnings; use Data::Dumper; my $o = Bar->new; print Dumper $o; ##$VAR1 = bless({'_b' => 2, '__c' => 3, 'a' => 1}, 'Foo'); $o->a = 4; $o->b = 5; $o->c = 6; print Dumper $o; ##$VAR1 = bless({'_b' => 5, '__c' => 6, 'a' => 4}, 'Foo'); $o->{a} = 7; $o->{_b} = 8; $o->{__c} = 9; print Dumper $o; ##$VAR1 = bless({'_b' => 8, '__c' => 9, 'a' => 7}, 'Foo'); }

    Read the article

  • How to make cross-domain AJAX calls to Google Maps API?

    - by Pedro
    Hi everyone, I'm trying to make a jQuery $.getJSON call to the Google Maps Geocoding webservice, but this doesn't work because of cross-domain security issues. I haven't been able to figure it out online, but I've read a bit about Google Javascript API or JSONP, but so far no clear answer... Could anyone enlight me? Thanks!

    Read the article

  • Is there any "modern" text editor with command-line?

    - by Pedro Morte Rolo
    A command line in a text editor is a wonderful feature. It allows the user to explore the editor's functionality and learn it's shortcuts in a textual way. It's much faster than using the mouse, and it is much easier to memorise "shortcuts" this way. Emacs and VI provide this, though, emacs and vi are not "modern". By "modern", I mean one that is original built to cope with the modern de-facto standards of selecting, copying, pasting, cutting, undoing, redoing and auto-completing. Cream/vi or EmacsCUE are not valid options, since there are loads of things built over them that conflict with the mentioned stuff. Is there any alternative? (I do not intend to use the "modern" term as derrogatory. I love both Emacs and VI, but I hate their keyboard shortcut baggage.) (please do not advertise Vim and Emacs, that's not answering the question. I am asking for alternatives)

    Read the article

  • Load image from server on a UIImageView in phone

    - by Pedro Narvaez
    Hi.. I'm having a problem loading a remote image into a UIImageVIew... It just doesn't show the image, may be i'm missing something... I also use the described here but with the same results How to load image from remote server on the UIImageView in iphone? Can someone help me? This is the code i'm using Im getting the data from a xml and on the image element I have the full path [[detailViewController detailImage] setImage:[UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: [NSString stringWithFormat:@"%@", [[promoList objectAtIndex: promoIndex] objectForKey: @"image"]] ]]] ]; With this code the image are displayed correctly [[detailViewController detailImage] setImage:[UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: @"http://localhost/promos/preview/1.jpeg"]] ]];

    Read the article

  • C programing fopen

    - by Pedro
    #include <stdio.h> #include <stdlib.h> typedef struct aluno{ char cabecalho[60]; char info[100]; int n_alunos; char dados[100]; char curso[100]; int numero; char nome[100]; char e_mail[100]; int n_disciplinas; int nota; }ALUNO; void cabclh(ALUNO alunos[],int a){ FILE *fp; int i; for(i=0;i<100;i++){ fp=fopen("trabalho.txt","r"); } if(fp==NULL){ printf("Erro ao abrir o ficheiro\n"); } while(!feof(fp)){ fgets(alunos[i].cabecalho,100,fp); printf("%s\n",alunos[i].cabecalho); } } fclose(fp); } what is wrong here? main: int main(int argc, char *argv[]){ ALUNO alunos[100]; int aluno; int b; cabclh(aluno,b); system("PAUSE"); return 0

    Read the article

  • How can I pipe two Perl CORE::system commands in a cross-platform way?

    - by Pedro Silva
    I'm writing a System::Wrapper module to abstract away from CORE::system and the qx operator. I have a serial method that attempts to connect command1's output to command2's input. I've made some progress using named pipes, but POSIX::mkfifo is not cross-platform. Here's part of what I have so far (the run method at the bottom basically calls system): package main; my $obj1 = System::Wrapper->new( interpreter => 'perl', arguments => [-pe => q{''}], input => ['input.txt'], description => 'Concatenate input.txt to STDOUT', ); my $obj2 = System::Wrapper->new( interpreter => 'perl', arguments => [-pe => q{'$_ = reverse $_}'}], description => 'Reverse lines of input input', output => { '>' => 'output' }, ); $obj1->serial( $obj2 ); package System::Wrapper; #... sub serial { my ($self, @commands) = @_; eval { require POSIX; POSIX->import(); require threads; }; my $tmp_dir = File::Spec->tmpdir(); my $last = $self; my @threads; push @commands, $self; for my $command (@commands) { croak sprintf "%s::serial: type of args to serial must be '%s', not '%s'", ref $self, ref $self, ref $command || $command unless ref $command eq ref $self; my $named_pipe = File::Spec->catfile( $tmp_dir, int \$command ); POSIX::mkfifo( $named_pipe, 0777 ) or croak sprintf "%s::serial: couldn't create named pipe %s: %s", ref $self, $named_pipe, $!; $last->output( { '>' => $named_pipe } ); $command->input( $named_pipe ); push @threads, threads->new( sub{ $last->run } ); $last = $command; } $_->join for @threads; } #... My specific questions: Is there an alternative to POSIX::mkfifo that is cross-platform? Win32 named pipes don't work, as you can't open those as regular files, neither do sockets, for the same reasons. 2. The above doesn't quite work; the two threads get spawned correctly, but nothing flows across the pipe. I suppose that might have something to do with pipe deadlocking or output buffering. What throws me off is that when I run those two commands in the actual shell, everything works as expected. Point 2 is solved; a -p fifo file test was not testing the correct file.

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >