Sign Up | Sign In

clistctrl subitem (report view)

How to get selected or clicked clistctrl subitem (report view) ?

What is your "best friend" as a programmer?

What is the one "thing" (physical object, tool, software package, person, etc.) that is most indispensible to you as a programmer?

I will get the ball rolling by stating that I have long considered a whiteboard to be a programmer's best friend.

(marked community wiki)

Subtraction without minus sign

How can i do subtraction of integers in C without using either the unary or binary '-' operator?

Or can we do the same for other data types like float/double?

Development speed in Zend Framework

How fast is development with Zend Framework? As a newbie I would like to know rough estimates to know whether I am already quick or need to pump something up.

E.g. it possibly would take me a day to write a basic forum app in PHP, with messages/post new/reply/search forms. What would it take for something like this for a knowledgeable ZF developer?

Interesting fact is that as I know ZF Developers mention less applications developed by them and more are talking about months, not days. How true is that?

P.S. How about admin forms? They can double the developmen time needed. WIth web apps you generally have to accompany most user-available tables/data with forms to edit it in the admin screen. Are there solutions to speed up creation of admin forms? Can you create form in ZF and make some admin mode for the same form?

Java Swing or Java Qt?

Can someone with extensive experience with both Qt and Java Swing please discuss whether you would use Swing or Qt under Java, and why?

Secondly, what is the business impact of using Qt? Is it reasonably popular or will I have a hard time finding experienced Qt developers? Are there any other business impacts I should be aware of?

UPDATE: I am more interested in the technical and business impacts of Swing vs Qt than the license type/fee since in my case the cost is not a concern.

How do I run HTML Tidy from Python without extra libraries?

How do I run HTML Tidy from Python without extra libraries?

Delphi: Show window without activation

I struggle to show a second form above the main form without loosing focus.

I have tried ShowWindow(second.handle, SW_SHOWNOACTIVATE), but the mainform looses focus. If I set Visible := false on the second window, the call to ShowWindow does not activate the second form, but the windows is empty when shown...

Does anyone have a good recipe for this?

UPDATE: What I'm trying to accomplish, is a notification-window that will show up at some event, and then disappear again. It's crucial that the main window do not lose focus, since that would interrupt the user.

MPMoviePlayerController + done button

Hi,

I have added some images on a view. Each image is meant for showing a video. That is when the user touches an image, the video corresponding to that image will be played.

The problem is when the Done button ( MPMoviePlayerController's ) is clicked, the movie which is being shown is stopped and the control goes back to the previous screen and at this point of time application freezes for a while(say 2secs) then comes back to working condition. why is this strange behavior happens. Gimme some ideas

Bazaar VCS with Eclipse?

I tried to use Bazaar VCS with Eclipse recently, and somehow the checkout seems to take forever, and when I try and cancel the progress, Eclipse freezes and then I have to terminate the process.

Here is basically what I did : I downloaded bazaar latest windows installer from http://bazaar-vcs.org/ I installed it. I also installed the Bzr for Eclipse plugin in Eclipse. Then under Windows > Preferences > Team > Bazaar I added the path to bzr.exe Now, it told me that plugin bzr-xmloutput was not found, so I added it to Bazaar plug-ins. So everything worked fine for a while, it let me Apply those settings to Bazaar.

Then I went to File > New > Project > Bazaar > Checkout as a project > URL of repo And then it freezes?

Can anyone point out what might be wrong? Or any alternatives/tutorials for the same?

Thanks a lot,

Should one add a programming quiz to the job advertisement?

At our company, we are looking for good Java programmers, that the one and only requirement and that's written in our job advertisement. Since we need more people to handle all the work that's coming up, within this and the next year, we want to hire people. The problem is, most of the candidates are not as good as we want them to be. Maybe some of them think they are good and simply underestimate the task. Maybe some know that they are not the best, but try it anyway, because all the job advertisements read like everybody is looking for a 25 year old übergeek with ten years work experience and a master in computer engineering. However, 80 - 90 % of the interviews are deflating and we can't offer them a job.

The question is: how do we make clear, we are seriously looking for some good programmer? If you not understood OO or not really know how synchronized works, you the wrong man for the job. Or: how do we increase the quality of the applications/candidates?

I suggested to include one or two programming questions in the advertisement, but my colleagues don't think this would be a good idea. In fact, Joel also don't think it is for the same reasons, as you can read here:

I’ve frequently heard the suggestion of including a programming quiz of some sort in the application procedure. This does work, in the sense that it reduces the number of applications you get, but it doesn’t work, in the sense that it doesn’t really improve the quality.

I'm not sure if Joel means the same thing I do. I don't want the candidate to send the answers in, I just want to show him what he have to know to get the job. He should decide for himself. I think this is more precise than arguing about what a good programmer is. Otherwise, it is like asking How would you rank your java skills from 1 - 10 instead of doing a test.

So, what do you guys think? Should one add a programming quiz to the job advertisement? Why / why not?

SQL Server 2008 HTML E-Mails

I use SQL Server 2008 to send out e-mails for notifications on certain events. The only problem with this is that the text will always be plain text. I don't suppose there's a way to send out formatted HTML tables of data using DB Mail? For example with the following:

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'User',
@recipients   = @EmailList,
@subject      = 'Subject',
@body         = @ErrBody

Clone detectors

Anyone know some good clone detectors?

I'm searching for examples and algorithms on how they work to study them.

A clone detector is a program that detect repeated code in the src file.

An example of a clone detector I already found, was this for eclipse: http://www.cs.mcgill.ca/~swevo/clonetracker/

But I'm really interested is in documentation about how the algorithms they use works.

Can anyone show me some links?

For the reference i just found this one, seems to be cool: http://pmd.sourceforge.net/cpd.html

Automate Photoshop to insert text from file

We have a webapplication that is delivered in several languages.

I need a way to change text in a textlayer in an automated way. I know there will be glitches because of the different length of words. But it would help to have the text in the file anyway.

preg_replace function

Hi, I am using preg_replace() function to replace xml data. whenever tha data to be replaced has slashes '//' it gives

<b>Warning</b>:  preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Unknown modifier '/'

i am using the function like this...

 preg_replace ("/$rep_text/", "$txt[$i]", $ad['metadata']);

where $rep_text is my text to be replaced which is

http://www.dfgdf.com

and $txt[$i] is the replacement text.. but it gives me the above error... someone please help me with this..

How can I stop Visual Studio from validating App.config

I want to test my application in the case where the user has messed up the config file.

To clarify: this is for a quick-and-dirty one time test, using the IDE. I'm not using unit testing for this project.

My specific test case is where an un-escaped double-quote character has made its way into a value text.

When I try to do this with the App.config, Visual Studio fails with a build error (MSB3249).

It appears that the only way to do it is by manual editing of files after the build has completed.

For the record, the following code is what I ended up using:

        // Seemingly spurious use of ConfigurationManager forces validation of config file,
        // failures of which can be trapped an handled.
        try
        {
            string ignore = System.Configuration.ConfigurationManager.AppSettings["ProductName"];
        }
        catch (System.Configuration.ConfigurationException)
        {
            MessageBox.Show("Could not understand configuration file. Please fix it and try again.",
                "Configuration File Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
        }

BizTalk 2006 R2 EDI

Hi guys,

I have an working orchestration in place to process X12 messages. Now I need to expose the orchestration as a webservice (ASMX) that accepts a text input (the X12 message) and returns the text response (the X12 response). If I try to use the wizard, the generated webservice will expose the inner XML representation of the X12 request and not the its original plain text representation.

In short, I want to be able to connect to a webservice (ASMX and not a WCF service), send a X12 request (plain text) and get the appropriate response (also plain text).

I've seen examples of this using WCF, but none with a simple webservice. Can you give me a hand with this?

Thanks!

jQuery portlet and dialog box problem

Dear All,

I create sortable element and attach an on-click event on every portlet to open dialog box, but when i open (drag more portlet to the main dashboard), and click the setup link (on the header of the portlet) the alert() (i setup for testing purpose) always fire for every portlet on the main dashboard, why is this happen ?

Below is the code i use to setup the sortable wich receive element from another sortable (you can see the elements on the left side).

You can see some screenshoot on this url : http://wildanm.wordpress.com/2009/03/25/ofc-reloading-problem-on-jquery-sortable-elements/

if you need the HTML markup i will post also later ..

Btw, i'm new in jQuery ..

Thanks!

$(function() {
   var param ; //additional param to the a portlet ; later
   var title = ""; //title for prototyping only

   $("#maincontent .column").sortable({
       connectWith: ['#maincontent .column'],
       opacity: 0.6,
       scroll: false,
       handle : ".portlet-header",
       receive: function(event, ui) {
         var id = $(ui.item).attr('id');
         var chartId = 'chart-'+id ;

         $("#"+id+" > .portlet-content").flash({
             data: '/swf/open-flash-chart.swf',
             id: chartId,
             name: 'chart-'+id,
             expressInstall: true ,
             flashvars: { 
               'data-file': '/chart/'+id
             },
         })

         $("#"+id).find("span").removeClass("ui-icon ui-icon-arrow-4-diag");
         $("#"+id).addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
            .find(".portlet-header")
            .addClass("ui-widget-header ui-corner-all")
            .prepend('<span class="ui-icon ui-icon-close"></span>')
            .prepend('<span class="ui-icon ui-icon-wrench"></span>')
            .prepend('<span class="ui-icon ui-icon-plusthick"></span>')
            .end()
            .find(".portlet-content");

            $("#maincontent .column .portlet-header .ui-icon-plusthick").click(function() {
            $(this).toggleClass("ui-icon-minusthick");
            $(this).parents(".portlet:first").find(".portlet-content").toggle();
            });

            $("#maincontent .column .portlet-header  .ui-icon-wrench").click(function() {
$("#dialog").css("visibility","visible");
                //dialog         
 alert($(this).parent('div').attr('id'));
                $("#dialog").dialog({ 
bgiframe: true,
autoOpen: false,
height: 400,
width:300,
modal: true,
buttons: {
'Update Chart': function() {
            title = $("#title").val();
            url = "/chart/"+id+"?title="+title+'&id='+id ;
              $.getJSON(url,function(data) { jsonData = data ; reloadJsonData() }) ;
  function reloadJsonData() {
    data = JSON.stringify(jsonData) ;
    tmp = findSWF(chartId);
    tmp.load(data);
  }
  $(this).dialog('close');
},
Cancel: function() {
$(this).dialog('close');
}
},
close: function() {
//allFields.val('').removeClass('ui-state-error');
}
});
                $('#dialog').dialog('open');
            });


            $("#maincontent .column .portlet-header  .ui-icon-close").click(function() {
            $(this).parents(".portlet:first").remove();
            });               
            //resize();         
       },

       start: function(event, ui) {
       },
       stop: function(event, ui) { 
         // Here's the trick:

         $("#maincontent .column").each(function() {
           //alert($(this).sortable("toArray"));
           //$(this).resizable();
         })
       }
     })


$("#maincontent .column .portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
.find(".portlet-header")
.addClass("ui-widget-header ui-corner-all")
.prepend('<span class="ui-icon ui-icon-close"></span>')
.prepend('<span class="ui-icon ui-icon-plusthick"></span>')
.end()
.find(".portlet-content");

$("#maincontent .column .portlet-header .ui-icon").click(function() {
$(this).toggleClass("ui-icon-minusthick");
$(this).parents(".portlet:first").find(".portlet-content").toggle();
});

$("#maincontent .column .portlet-header  .ui-icon-close").click(function() {
$(this).parents(".portlet:first").remove();
});


$("#maincontent .column").disableSelection();

});

   function findSWF(movieName) {
        if (navigator.appName.indexOf("Microsoft")!= -1) {
            return window[movieName];
        } else {
            return document[movieName];
        }
    }

Update :

Thanks Kyle for the answer,

After re-examining my code and try the change you propose, i think the main issue is how we can we tell the dialog box his parent element (which portlet his come from). On the code above, after i click the update button, the portlet affected is always the first portlet that i drop to the main area .., i hope my explanation is clear enough for you .., thanks !

Btw, here is the markup of a single portlet :

<div id="gambarTigaSatu" class="portlet ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" style="opacity: 1;">
        <div class="portlet-header ui-widget-header ui-corner-all">
               <span class="ui-icon ui-icon-plusthick"/>
               <span class="ui-icon ui-icon-wrench" id="setup-gambarTigaSatu"/>
               <span class="ui-icon ui-icon-close"/>
               <span class=""/>SDM yang Terlibat Kegiatan Penelitian dan Pengabdian Masyarakat (Valid)
       </div>

       <div class="portlet-content">
              <object width="320" height="180" data="/swf/open-flash-chart.swf" type="application/x-shockwave-flash" style="vertical-align: text-top;"  
    name="chart-gambarTigaSatu" id="chart-gambarTigaSatu"><param value="data-file=/chart/gambarTigaSatu" name="flashvars"/>
             </object>
       </div>
</div>

The ui-icon-wrench id is added automatically, it's for testing only for now, i try to traverse the dom, and get the id of the object element from there. The object element also generated automatically using swfobject, u can see to code above .. (Btw, the comment on the answer is limited to 300 char, so I post here)

Update :

Problem solved ..., now i just have to cleaning up the code

Best Regards,

Wildan

VMWare ESXi Server 3.5

I am trying to install VMWare ESXi 3.5 on a DELL GX280 machine which has SATA configurations. As ESXi doesn't support SATA, i am not able to proceed.

I could able to install on IDE (which is also not supported) by making some changes. Is there a way to install on SATA as well??

Please let me know if anyone has tried it.

Thanks, Shwetha

How to extract the schema of an Access (.mdb) database?

I am trying to extract the schema of an .mdb database, so that I can recreate the database elsewhere.

How can I pull off something like this?

Readfile(); max speed

I think somewhere I read about limiting the readfile(); function speed but I can not find it again, so I'm asking you:

Is there any way to limit the speed that readfile(); reads files?

For instance: readfile('this.zip',30000); to limit it to 30000 bits per second or similar?

Thank you

Why the splash window can't show before the App launch?

I want to show a splash Screen before the App launch. First I make the SplashWindow subclassing the NSWindow, the code is :

- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
{
    self = [super initWithContentRect:contentRect
                            styleMask:NSBorderlessWindowMask
                              backing:NSBackingStoreBuffered
                                defer:NO];
    [self setBackgroundColor: [NSColor clearColor]];
    [self setLevel: NSStatusWindowLevel];
    [self setAlphaValue:1.0];
    [self setOpaque:NO];
    [self setHasShadow: YES];
    return self;
}

and then in the awake from nib in the main app controller:

loadWindow = [[NSWindow alloc] initWithContentRect:[loadWindow frame] 
                                         styleMask:NSBorderlessWindowMask 
                                           backing:NSBackingStoreBuffered
                                             defer:YES];
[loadWindow setContentView:theView];
[loadWindow setHasShadow:YES];
[loadWindow setLevel:NSStatusWindowLevel];
[loadWindow makeKeyAndOrderFront:self];

and then I let the loadWindow closed after 3 secondes, I used the method [loadWindow orderOut:self],but when the splash window closed , the mainwinow didn't show . what am I missing? My App is a multi_Documents . and in the mainMenu.nib there was one window(loadwindow),in IB I have connected up the loadWindow outlet in the main controller.

I have also connected the view and image.

and I changed another way : in the delegate method applicationWillFinishLaunching: I orderFront the loadWindow, in the method applicationDidFinishLaunching: I orderOut the loadWindow after 3 seconds, but the mainWindow didn't show too.Somebody can give some advice or codes the result the problem? Thank you very much!

Dialog not available within 60 seconds

I am trying to use Dialog handler twice in a function. For first time it executes well but on second time it hangs the system with dialog box open and showing Ok and Cancel butoon but never able to click it. Also it times out with an error "Dialog not available within 60 seconds"

Dim cdhPopup As ConfirmDialogHandler 
cdhPopup = New ConfirmDialogHandler() 
If (ie.Button(Find.ById("btnDelete")).Exists) Then
    'Cancel the booking '
    ie.AddDialogHandler(cdhPopup) 
    ie.Button(Find.ById("btnDelete")).ClickNoWait() 
    cdhPopup.WaitUntilExists() 
    cdhPopup.OKButton.Click() 
    ie.WaitForComplete() 'Wait for page to finish loading '
Else 
    Assert.Fail("Could not found the Cancel Button") 
End If

Using this at 2 places in my code, First time it executes fine and second time within same function it gives dialog not available whereas it is available error.

Questions every good .NET developer should be able to answer?

My company is about to hire .NET developers. We work on a variety of .NET platforms: ASP.NET, Compact Framework, Windowsforms, Web Services. I'd like to compile a list/catalog of good questions, a kind of minimum standard to see if the applicants are experienced. So, my question is:

What questions do you think should a good .NET programmer be able to respond?

I'd also see it as a checklist for myself, in order to see where my own deficits are (there are many...).

alt text

*UPDATE: It want to make clear that we're not testing only for .NET knowledge, and that problem solving capabilities and general programming skills are even more important to us.

Online Interactive Shells for PHP, Perl

Python shell and Ruby Shell are available for quick verification/checking.

How do you run PHP to verify a small code snippet other than installing a heavy Apache server locally? Does it have any interactive consoles like the ones of Ruby and Python mentioned above?

What about Perl and other languages?

I emphasize: Is there a way to do it online?

Flow controlling macros with 'goto'

Yes, two hated constructs combined. Is it as bad as it sounds or can it be seen as a good way to control usage of goto and also provide a reasonable cleanup strategy?

At work we had a discussion about whether or not to allow goto in our coding standard. In general nobody wanted to allow free usage of goto but some were positive about using it for cleanup jumps. As in this code:

int func()
{
   char* p1 = malloc(16);
   if( !p1 )
      goto err_cleanup;

   char* p2 = malloc(16);
   if( !p2 )
      goto err_cleanup;

 goto norm_cleanup;

 err_cleanup:

   if( p1 )
      free(p1);

   if( p2 )
      free(p2);

   return -1;

 norm_cleanup:
   return 0;
}

The abovious benefit of such use is that you don't have to end up with this code:

int func()
{
   char* p1 = malloc(16);
   if( !p1 ){
      return -1;
   }

   char* p2 = malloc(16);
   if( !p2 ){
      free(p1);
      return -1;
   }

   char* p3 = malloc(16);
   if( !p3 ){
      free(p1);
      free(p2);
      return -1;
   }

   return 0;
}

Especially in constructor-like functions with many allocations this can sometimes grow very bad, not the least when someone has to insert something in the middle.

So, in order to be able to use goto, but still clearly isolate it from being used freely, a set of flow controlling macros was created for handling the task. Looks something like this (simplified):

#define FAIL_SECTION_BEGIN int exit_code[GUID] = 0;
#define FAIL_SECTION_DO_EXIT_IF( cond, exitcode ) if(cond){exit_code[GUID] = exitcode; goto exit_label[GUID];}
#define FAIL_SECTION_ERROR_EXIT(code) exit_label[GUID]: if(exit_code[GUID]) int code = exit_code[GUID];else goto end_label[GUID]
#define FAIL_SECTION_END end_label[GUID]:

We can use this as follows:

int func()
{
   FAIL_SECTION_BEGIN
   {
      char* p1 = malloc(16);
      FAIL_SECTION_DO_EXIT_IF( !p1, -1 );

      char* p2 = malloc(16);
      FAIL_SECTION_DO_EXIT_IF( !p2, -1 );

      char* p3 = malloc(16);
      FAIL_SECTION_DO_EXIT_IF( !p3, -1 );
   }
   FAIL_SECTION_ERROR_EXIT( code )
   {
      if( p3 ) 
         free(p3);

      if( p2 ) 
         free(p2);

      if( p1 ) 
         free(p1);

      return code;
    }
    FAIL_SECTION_END

  return 0;

It looks nice, and comes with many benefits, BUT, are there any drawbacks we should be thinking about before rolling this out into development? It is after all very flow controlling and goto:ish. Both are discouraged. What are the arguments for discouraging them in this case?

Thanks.

How does Java store Unicode characters with code points above 0xFFFF?

Java stores characters in a 16-bit type char, which will be able store up to 216 = 65,536 different characters.

While looking at the Unicode site, I noticed that there are some characters with code points above 0xFFFF (e.g. Gothic letters). While I doubt I will ever have to port my software to a Gothic-reading audience, I'm interested to know how Java supports such characters - if at all.

svn update not working in post commit

I am trying to implement a post-commit hook to update a working copy. As far as i can figure out the post commit hook is being runned ( i wrote something in a file to test it out ) but the update command was not runned

At first i did

cd /home/user/working/copy
svn update

but that didn't work, then i read you have to give the full path to svn:

cd /home/user/working/copy
/usr/bin/svn update

but still it failed to work.

I changed permisions to 777 and have runned the script in an empty enviroment ... and it works.

Are you doing MDA (Model Driven Architecture) right now? If so, what tools do you use, and how is it working out?

Model Driven Architecture is the idea that you create models which express the problem you need to solve in a way that is free of any (or at least most) implementation technologies, and then you generate implementation for one or more specific platforms. The claim is that working at a higher level of abstraction is far more powerful and productive. In addition, your models outlive technologies (so you still have something when your first language / platform becomes obsolete that you can use for your next generation solution). Another key claimed benefit is that much of the boilerplate and "grunt work" can be generated. Once the computer understands the semantics of your situation, it can help you more.

Some claim this approach is 10 times more productive, and that it is the way we will all be building software in 10 years.

However, this is all just theory. I am wondering what the outcomes are when the rubber meets the road. Also, the "official" version of MDA is from the OMG, and seems very heavy. It is heavily based on UML, which might be considered good or bad depending on who you ask (I'm leaning towards "bad").

But, in spite of those concerns, it is hard to argue with the idea of working at a higher level of abstraction and "teaching" the computer to understand the semantics of your problem and solution. Imagine a series of ER models which simply express truth, and then imagine using those to generate a significant portion of your solution, first in one set of technologies and then again in another set of technologies.

So, I'd love to hear from people who really are doing MDA right now ("official" or not). What tools are you using? How is it working out? How much of the theoretical promise have you been able to capture? Do you see a true 10X effectiveness increase?

OpenMicroBlogging-library for Java?

Can anyone recommend to me a library to communicate via OpenMicroBlogging? It should be in Java and Open Source.

Rails' collection_select helper method and the "Create item" option at the end

Is it possible to add an <option> at the end of a <select> created with the collection_select helper method?

Right now I have

f.collection_select(:category_id , @categories, :id, :name, {:prompt => 'Please select a category'})

which generates

<select id="product_category_id" name="product[category_id]">
  <option value="">Please select a category</option>
  <option value="7">category one</option>
  <option value="8">category 2</option>
</select>

and what I would like is

<select id="product_category_id" name="product[category_id]">
  <option value="">Please select a category</option>
  <option value="7">category one</option>
  <option value="8">category 2</option>
  <option value="new">..or create a new one</option>
</select>

Is this possible or should I just loop through the collection and generate the options manually?

Top Questions - Stack Overflow


©2008 Second AI - Advertising - Submit Rss Feeds - Download - About Second AI