Daily Archives

Articles indexed Tuesday April 20 2010

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

  • sizeof(class) c++

    - by badkya
    How is it possible for sizeof(class) to return two different values depending on context? The class itself should have the same size right irrespective of where I ask this question? I see a smaller value when querying class size from main() and another when I query class size from an extended class.

    Read the article

  • howto hide outline on a form

    - by justjoe
    i have to design a form with an input inside it. i use background image on the input so it would look like a button. so every time somebody click it, then it would send $POST, a behavior i want to achieve. But the problem is about the outline around the form. The outline show when we click the form. It's minor, but it would be great to make the form (or input) lost it outline. i test it using Firefox 3.6 and flock. Both of them show the outline behavior that i want to avoid

    Read the article

  • How should objects be in a Java game.

    - by Gabriel A. Zorrilla
    EDIT: i just deleted the entire post and reformulated the question to be more generic. I want to do a simple strategy game: map, units. Map: one class. Units: another class, self drawn. Simple questions: How does an unit should redraw itself on the map. A unit should be a JPanel or similar Swing component (just to be able to manage them as an entity with its own mousehandlers) or can be another thing, without neglecting the fact that it should be an autonomous object with its own action handlers and fields. Is this map-units model correct of a simple game that would help me to learn in a fun way Java and OOP fundamentals. Thats it!

    Read the article

  • How to ensure/determine that a post is coming from an specific application running on an iPhone/iTou

    - by wgpubs
    Building an iPhone OS application that will allow users to anonymously post information to a web application (in my particular case it will be a Rails based site) ... and I want to ensure that I only accept posts that originate from a specific application running on an iPhone/iTouch. How is this best accomplished? (btw, if your answer applies to Android please feel free to post it here as well as I'm curious to know if the techniques are the same or vary). Thanks

    Read the article

  • how to change the value to a name depending on case

    - by ZeroSoul13
    i've created a select button with 3 option <%= f.label :prioridad %><br/> <%= f.select :prioridad, options_for_select([['Alta', 1], ['Medio', 2], ['Baja', 3]]) %> The value gets inserted to the DataBase but when i display it i see the number op the option selected (which is correct). What i would like to know is how i can change that so on the index the user can see the name and not the value: def convertidor case llamada.prioridad when prioridad == '1' puts "Alta" when prioridad == '2' puts "Media" else puts "Baja" end end This didn't worked. Regars

    Read the article

  • BackgroundColor of UITableViewCellStyleSubtitle labels ??!?

    - by P5ycH0
    I am trying to create a table with an image as a background. To achieve this, I started out with the background: self.view.backgroundColor = [UIColor groupTableViewBackgroundColor]; This resulted in a background image which appears in tablecells as well. That is not something I want, so I tried to set the cell's backgroundColor: cell.backgroundColor = [UIColor whiteColor]; This had no effect at all !!!. Hmmm strange. So I tried this: UIView *backgroundView = [[UIView alloc] init]; backgroundView.backgroundColor = [UIColor whiteColor]; cell.backgroundView = backgroundView; [backgroundView release]; This works almost. The only problem left is that the textLabel & the detailTextLabel still show the background behind them. Setting the backgroundColor on those labels to white doesn't do anything either. How do I proceed? Where do I go wrong? I am trying to achieve a tableView like the worldClock app has.

    Read the article

  • 4K sectors: Why are hard drives moving to 4096 byte sectors, vs. 512 byte sectors? Are 4K sectors a

    - by Chris W. Rea
    I've noticed that some Western Digital hard drives are now sporting 4K sectors, that is, the sectors are larger: 4096 bytes vs. the actual de facto standard of 512 bytes. So: What's the big deal with 4K sectors? Is it marketing hype, or a real advantage? Why should somebody building a new PC care, or not, about 4K sectors? Why is this transition taking place now? Why didn't it happen sooner? Are there things to look out for when buying a 4K sector hard drive? e.g. incompatibility? Anything else we should know about 4K sectors?

    Read the article

  • PHP - Plus sign with GET query

    - by Nate Shoffner
    I have a PHP script that does basic encryption of a string through the method below: <?php $key = 'secretkey'; $string = $_GET['str']; if ($_GET['method'] == "decrypt") { $output = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($string), MCRYPT_MODE_CBC, md5(md5($key))), "\0"); } if ($_GET['method'] == "encrypt") { $output= base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))); } echo $output; ?> An example of a URL to encrypt a string would look like this: Encrypt.php?method=encrypt&str=the quick fox Which would return this as the encrypted string: LCuT/ieVa6cl3/4VtzE+jd9QPT3kvHYYJFqG6tY3P0Q= Now to decrypt the string all you have to do is change the "method" query to "decrypt", like so: Encrypt.php?method=decrypt&str=LCuT/ieVa6cl3/4VtzE+jd9QPT3kvHYYJFqG6tY3P0Q= The only problem is that when that encrypted string is decrypted it returns this: ¬ƒ§rYV}̳5Äš·nßì(ñïX8Þ;b I have narrowed down the problem to the plus sign that is in the encrypted string. PHP's GET method seems to translate a plus sign into a blank space. I have searched this bug and found out that it has already been filed here. I have tried different methods listed on that page and others with no success. The closest I got is by using this: $fixedstring = str_replace(" ", "+", $string); and then using $fixedstring in the encryption methods, the problem is, upon decryption, all blank spaces are converted to plus signs. Any ideas?

    Read the article

  • How can I stop rails validating xml?

    - by Andrei T. Ursan
    I'm submitting to a rails webservice the following message: xmlPostData = "<message> <message-text>" + MESSAGE_WITH_XML + "</message-text> <name>" + subject + "</name> <f1>" + toPhone + "</f1> <f2>" + fromPhone + "</f2> </message>"; The problem is the the field with contain a text with XML data, is a workaround but I need to be able to submit that xml to the db and get it from there. Can I stop rails validating and replacing my xml in json format? this is how it looks: --- !map:HashWithIndifferentAccess smil: !map:HashWithIndifferentAccess head: !map:HashWithIndifferentAccess layout: !map:HashWithIndifferentAccess root_layout: !map:HashWithIndifferentAccess height: &quot;600&quot; background_color: white width: &quot;800&quot; type: text/smil-basic-layout body: !map:HashWithIndifferentAccess par: !map:HashWithIndifferentAccess text: !map:HashWithIndifferentAccess left: &quot;33&quot; begin: &quot;33&quot; dur: &quot;33&quot; val: 34343434343434343aaaaaaa height: &quot;33&quot; width: &quot;33&quot; top: &quot;33&quot; And this is the ruby method from the rails webservice: # POST /messages # POST /messages.xml def create @message = Message.new(params[:message]) respond_to do |format| if @message.save flash[:notice] = 'Message was successfully created.' format.html { redirect_to(@message) } format.xml { render :xml => @message, :status => :created, :location => @message } else format.html { render :action => "new" } format.xml { render :xml => @message.errors, :status => :unprocessable_entity } end end end Is a workaround but for the moment this has to work ...

    Read the article

  • DynamicObject and WCF support

    - by rboarman
    Hi, I was wondering if anyone has had any luck getting a DynamicObject to serialize and work with WCF? Here’s my little test: [DataContract] class MyDynamicObject : DynamicObject { [DataMember] private Dictionary<string, object> _attributes = new Dictionary<string, object>(); public override bool TryGetMember(GetMemberBinder binder, out object result) { string key = binder.Name; result = null; if (_attributes.ContainsKey(key)) result = _attributes[key]; return true; } public override bool TrySetMember(SetMemberBinder binder, object value) { _attributes.Add(binder.Name, value); return true; } } var dy = new MyDynamicObject(); var ser = new DataContractSerializer(typeof(MyDynamicObject)); var mem = new MemoryStream(); ser.WriteObject(mem, dy); The error I get is: System.Runtime.Serialization.InvalidDataContractException was unhandled Message=Type 'ElasticTest1.MyDynamicObject' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute. Consider marking the base type 'System.Dynamic.DynamicObject' with DataContractAttribute or SerializableAttribute, or removing them from the derived type. Any suggestions? Thanks, Rick

    Read the article

  • Why is C++ fwrite() producing larger output in release?

    - by waffleShirt
    I recently wrote an implementation of the Canonical Huffman compression algorithm. I have a 500kb test file that can be compressed to about 250kb when running the debug and release builds from within Visual Studio 2008. However when I run the release build straight from the executeable the test file only compresses to about 330kb. I am assuming that something is going wrong when the file is written using fwrite(). I have tested the program and confirmed that uncompressing the files always produces the correct uncompressed file. Does anyone know why this could possibly be? How could the same executeable file be producing different sized outputs based on where it is launched from?

    Read the article

  • Forcing file redirection on x64 for a 32-bit application

    - by Paul Alexander
    The silent redirection of 64-bit system files to their 32-bit equivalents can be turned off and reverted with Wow64DisableWow64FsRedirection and Wow64RevertWow64FsRedirection. We use this for certain file identity checks in our application. The problem is that in performing some of theses tasks, we might call a framework or Windows API in a DLL that has not yet been loaded. If redirection is enabled at that time, the wrong version of the dll may be loaded resulting in a XXX is not a valid Win32 application error. I've identified the few API calls in question and what I'd like to do force the redirection on for the duration of that call then revert it back - just the opposite of the provided Win32 APIs. Unfortunately these calls do not provide any sort of WOW64 compatibility flag like some of the registry methods do. The obvious alternative is to use Wow64EnableWow64FsRedirection, pass TRUE for Wow64FsEanbledRedirection. However there are a variety of warnings about the use of this method and a note that it is not compatible with Disable/Revert combo methods that have replaced it. Is there a safe way to force redirection on for a give Win32 call? The docs state the redirection is thread specific so I've considered spinning up a new thread for the specific call with appropriate locks and waits, but I was hoping for a simpler solution.

    Read the article

  • Perl: Exporting variables in a subclass

    - by Jonathan
    I have a base class like this: package MyClass; use vars qw/$ME list of vars/; use Exporter; @ISA = qw/Exporter/; @EXPORT_OK = qw/ many variables & functions/; %EXPORT_TAGS = (all => \@EXPORT_OK ); sub my_method { } sub other_methods etc { } --- more code--- I want to subclass MyClass, but only for one method. package MySubclass; use MyClass; use vars qw/@ISA/; @ISA = 'MyClass'; sub my_method { --- new method } And I want to call this MySubclass like I would the original MyClass, and still have access to all of the variables and functions from exporter. However I am having problems getting the Exporter variables from the original class, MyClass, to export correctly. Do I need to run exporter again inside the subclass? That seems redundant and unclear. Example file: #!/usr/bin/perl use MySubclass /$ME/; -- rest of code But I get compile errors when I try to import the $ME variable. Any suggestions?

    Read the article

  • FormEditor receiving NULL IEditorInput object

    - by Gabriel Parenza
    Hi, I have extended IEditorInput class to define my own IEditorInput object. Furthermore, I have extended FormEditor class. I have view where I am displaying my application objects. Whenever user double clicks on items on view, I intend to display more details for this application object on the editor, which is a FormEditor. Problem I am facing is that I am receiving IEditorInput object as NULL inside extended FormEditor class. Can someone please tell me what I am doing wrong? Code: CustomFormEditor extends FormEditor CustomEditorInput extends IEditorInput In View class: PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new CustomEditorInput("test"),"editor.id"); Thanks, Gaurav.

    Read the article

  • Strings exported from a module have changed line breaks

    - by Jesse Millikan
    In a DrScheme project, I'm using a MrEd editor-canvas% with text% and inserting a string from a literal in a Scheme file. This results in an extra blank line in the editor for each line of text I'm trying to insert. I've tracked this down to the apparent fact that string literals from outside modules are getting extra line breaks. Here's a full example. The editor is irrelevant at this point, but it displays the result. ; test-literals.ss (module test-literals scheme (provide (all-defined-out)) (define exported-string "From another module with some more line breaks. ")) ; editor-test.ss (module editor-test scheme (require mred "test-literals.ss") (define w (instantiate frame% ("Editor Test" #f) )) (define c (instantiate editor-canvas% (w) (line-count 12) (min-width 400))) (define editor (instantiate text% ())) (send c set-editor editor) (send w show #t) (send editor erase) (send editor insert "Some text with some line breaks. ") (send editor insert exported-string)) And the result in the editor is Some text with some line breaks. From another module with some more line breaks. I've traced in and figured out that it's changing Unix line breaks to Windows line breaks when strings are imported from another module, but these display as double line breaks. Why is this happening and is there a way to stop it other than changing every imported string?

    Read the article

  • Setting background image for QPushButton

    - by Surjya Narayana Padhi
    Hi Geeks, I am struggling to set an background image for an QPushButton. No Success till now. Following is my code. appsWidget::appsWidget(QWidget *parent) :QWidget(parent) { QPushButton *button1 = new QPushButton("SETTINGS",this); QPushButton *button2 = new QPushButton("TEST",this); QPushButton *button3 = new QPushButton("IE",this); button1->setStyleSheet("background-image:url(config.png)"); -> No success qDebug("appWidget initialized."); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(button1); layout->addWidget(button2); layout->addWidget(button3); this->setLayout(layout); connect(button1,SIGNAL(clicked()),this,SLOT(setClickIndex1())); connect(button2,SIGNAL(clicked()),this,SLOT(setClickIndex2())); connect(button3,SIGNAL(clicked()),this,SLOT(setClickIndex3())); } The image I am using in the stylesheet is located in the same project folder. Do anybody has any solution?

    Read the article

  • How to display two grids in same page using jquery?

    - by kumar
    hello friends, I have this code to display jquery grid <div> <%= Html.Trirand().JQGrid(Model.OrdersGrid, "JQGrid1") %> </div> Server side I have this code.. using System; using System.Collections.Generic; using System.Linq; using System.Web; using Trirand.Web.Mvc; using System.Web.UI.WebControls; namespace JQGridMVCExamples.Models { public class OrdersJqGridModel { public OrdersJqGridModel() { OrdersGrid = new JQGrid { Columns = new List<JQGridColumn>() { new JQGridColumn { DataField = "OrderID", Width = 50 }, new JQGridColumn { DataField = "OrderDate", Width = 100, DataFormatString = "{0:d}" }, new JQGridColumn { DataField = "CustomerID", Width = 100 }, new JQGridColumn { DataField = "Freight", Width = 75 }, new JQGridColumn { DataField = "ShipName" } }, Width = Unit.Pixel(640) }; OrdersGrid.ToolBarSettings.ShowRefreshButton = true; } public JQGrid OrdersGrid { get; set; } } } This is displaying only one grid... I I want to display two grids that Is how to display other grid in Same page? that is can I do like this? <div> <%= Html.Trirand().JQGrid(Model.OrdersGrid, "JQGrid1") %> </div> <div> <%= Html.Trirand().JQGrid(Model.OrdersGrid, "JQGrid2") %> </div> in the same page.. if yes how to handle the Sever side grid? bec Server side grid columns are differnt from jqGrid1 and Jqgrid2,,,, On Row Click on JQGrid1 I need to display JqGrid2. Please can anyone help me out about this.. Thanks

    Read the article

  • How to combine mvc2 client side validation with other client side validation?

    - by Andrey
    I have a page using mvc2 with client side validation. The client side validation is provided by Microsoft Ajax mvc validation script. This does very well to validate all fields that are related to the model. I also have fields that are never sent to the server such as the confirm password value, and the accept agreement. For these fields i need pure client side validation. I created the javascript to do this, but am now having a hard time integrating the two validatiosn together. I was hoping that i could do something like add another error to an array, or set the page manually to not valid to make sure that the user cannot submit. Basically follow the same approach that i would with normal asp.net validation. I can't find anything like that. In all examples validators are discussed that are connected to parts of the model. What is my best approach here?

    Read the article

  • What is the most efficient way to display decoded video frames in Qt?

    - by Jason
    What is the fastest way to display images to a Qt widget? I have decoded the video using libavformat and libavcodec, so I already have raw RGB or YCbCr 4:2:0 frames. I am currently using a QGraphicsView with a QGraphicsScene object containing a QGraphicsPixmapItem. I am currently getting the frame data into a QPixmap by using the QImage constructor from a memory buffer and converting it to QPixmap using QPixmap::fromImage(). I like the results of this and it seems relatively fast, but I can't help but think that there must be a more efficient way. I've also heard that the QImage to QPixmap conversion is expensive. I have implemented a solution that uses an SDL overlay on a widget, but I'd like to stay with just Qt since I am able to easily capture clicks and other user interaction with the video display using the QGraphicsView. I am doing any required video scaling or colorspace conversions with libswscale so I would just like to know if anyone has a more efficient way to display the image data after all processing has been performed. Thanks.

    Read the article

  • London-based IT Training company seeks developers interested in achieving Microsoft Certifications

    IT Training company MCP Guru, based near Canary Wharf, looking to fill last available places on several Microsoft courses.All certifications available. Learners can study in-class, at work or at home, on weekdays and weekends, day or night.All instructors possess several years software and web development experience, and all are fully licensed.Individual learners get 30% discount, groups of 2 or more get 50% discount.Hurry! Last few places remaining! Offer ends April 30th.Contact Jatinder at [email protected] you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • DotNetNuke 5.4 Released

    Another month, another release of DotNetNuke! Check out version 5.4.0 that was just released a few hours ago. Joe Brinkman has a full blog post about the release here The two biggest things are some features that were added into DNN 5.3 Professional Edition...(read more)...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Single-player pong game

    - by Jam
    I am just starting out learning pygame and livewires, and I'm trying to make a single-player pong game, where you just hit the ball, and it bounces around until it passes your paddle (located on the left side of the screen and controlled by the mouse), which makes you lose. However, I keep getting the error: "Cannot have more than on Screen object", which I can find no references to online really, and I can't make sense of it. I want to eventually make the game more complicated, but I need to make it work first. Help please! Here's the code so far: from livewires import games games.init(screen_width=640, screen_height=480, fps=50) class Paddle(games.Sprite): image=games.load_image("paddle.bmp") def __init__(self): super(Paddle, self).__init__(image=Paddle.image, y=games.mouse.y, left=0) self.score=games.Text(value=0, size=25, top=5, right=games.screen.width-10) games.screen.add(self.score) def update(self): self.y=games.mouse.y self.check_collide() def check_collide(self): for ball in self.overlapping_sprites: self.score.value+=1 self.score.right=games.screen.width-10 ball.handle_collide() class Ball(games.Sprite): image=games.load_image("ball.bmp") speed=1 def __init__(self, x, y=90): super(Ball, self).__init__(image=Ball.image, x=x, y=y, dx=Ball.speed, dy=Ball.speed) def update(self): if self.left<0: self.end_game() self.destroy() def handle_collide(self): if self.right>games.screen.width: self.dx=-self.dx if self.bottom>games.screen.height or self.top<0: self.dy=-self.dy def ball_destroy(self): self.destroy() def main(): background_image=games.load_image("background.bmp", transparent=False) games.screen.background=background_image the_ball=Ball() games.screen.add(the_ball) the_paddle=Paddle() games.screen.add(the_paddle) games.mouse.is_visible=False games.screen.event_grab=True games.screen.mainloop() main()

    Read the article

  • How do I handle a POST request in Perl and FastCGI?

    - by Peterim
    Unfortunately, I'm not familiar with Perl, so asking here. Actually I'm using FCGI with Perl. I need to 1. accept a POST request - 2. send it via POST to another url - 3. get results - 4. return results to the first POST request (4 steps). To accept a POST request (step 1) I use the following code (found it somewhere in the Internet): $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/; if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { print ("some error"); } @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%(..)/pack("C", hex($1))/eg; $FORM{$name} = $value; } The content of $name (it's a string) is the result of the first step. Now I need to send $name via POST request to some_url (step 2) which returns me another result (step 3), which I have to return as a result to the very first POST request (step 4). Any help with this would be greatly appreciated. Thank you.

    Read the article

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