Monday, February 21, 2011

Error : Implementation for method missing (Delphi Prism)

I wrote my method: LangChange

type
  MainForm = partial class(System.Windows.Forms.Form)       
  private
      ...
      method LangChange();
protected
    method Dispose(disposing: Boolean); override;
  public    
    constructor;
  end;
implementation
...
method LangChange();
begin
...    
end;

However,I have an error Error 1 (PE33) Implementation for method "Compiler.MainForm.LangChange" missing What is wrong?Help please!

From stackoverflow
  • LangChange is a method of the class MainForm so the implementation of the method should be

    method MainForm.LangChange();
    begin
    end;
    

What is the difference between deploying to com+/MTS using regsvr32?

We have a legacy VB6 component that was com+/MTS and is used by asp classic. Staff is having trouble with deployment.

Would there be any harm in just using regsvr32 to register the DLL, which will be used by IIS?

Alternatively---I won't touch COM+ with a 10 foot pole--so is there a suitable one line command to register a VB6 component with COM+/MTS using a 11 foot pole? My google fu is failing me.

From stackoverflow
  • Problems that I can see:

    • With regsvr32 registering your component will run with the same privileges IUSR have. If the component need privileges to connect to the DB or touch the file system, it might fail.
    • The component might expect the MTS enviroment (as transactions)

    I don't know any suitable command line, being doing it drag-droping the component.

Upgrading EntLib 4.1 to 5 with Oracle.DataAccess.Client

Hello, I am upgrading a project from EntLib 4.1 to EntLib 5. I've skimmed through the Migration Guide, changed all the references and updated all the config files to point to EntLib 5. All worked fine accept Oracle database access. With the config file:

<configuration>
  <configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
  </configSections>
  <dataConfiguration defaultDatabase="prod">
    <providerMappings>
      <add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data"
        name="Oracle.DataAccess.Client" />
    </providerMappings>
  </dataConfiguration>
  <connectionStrings>
    <add name="prod" connectionString="Data Source=dev;User Id=dev;Password=dev;"
      providerName="Oracle.DataAccess.Client" />
  </connectionStrings>
</configuration>

which worked with 4.1 all calls to DatabaseFactory.CreateDatabase() fails with:

System.InvalidOperationException: The type Database cannot be constructed. You must configure the container to supply this value.

If I replace Oracle.DataAccess.Client with the Microsoft System.Data.Oracleclient it all works again, but is not full of ODP.net lovelyness. Does anyone know how to get this to work with EntLib 5?

Cheers, Mlk

From stackoverflow
  • It seams that the Oracle Installer will sometimes forget about the database provider factory which is installed in the machine.config. To fix this the following needs to be put in either the app.config or the machine.condig.

    <system.data>
    <DbProviderFactories>
    <add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client"
    description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
    </system.data>
    

    I think this working in EntLib4 is that EntLib4 uses the previous version of the Oracle client (10.2.0.1 I think. Oracle numbering is odd).

  • More on setting up entlib at http://w3mentor.com/learn/asp-dot-net-c-sharp/c-asp-net/microsoft-enterprise-library-caching-block/

How to redirect multiple folders to the reflecting subdomain with .htaccess

Hi,

i tried redirecting some folders to the subdomains with the same names as the folders. I tried this way but it didn't work:

RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(test1|test2)(.*?)$ http://$1.domain.com$2 [R=301,L]

I guess the problem is that the alternation of folders doesn't return a result that i can get into $1, right?

I'm not a PCRE expert so andy help would be appreciated.

From stackoverflow
  • Try with this:

    RewriteCond %{REQUEST_URI} ^/yoursub
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^(.*)$ http://yoursub.domain.com/$1 [L]
    

    The 2 lines in the middle will prevent redirecting if that folder or file exists. To remove file and folder exception, comment out that 2 lines, and stay with this only:

    RewriteCond %{REQUEST_URI} ^/yoursub
    RewriteRule ^(.*)$ http://yoursub.domain.com/$1 [L]
    
    : Probably my question wasn't clear enough: I want to redirect different folders to different subdomains. The subdomains have the same name as the folders and i'd like to have only one rewrite for all of them. Example: /test -> test.domain.com Example2: /dog -> dog.domain.com
    CuSS : why don't you configure out the apache insted of rewrite? http://www.howtoforge.com/forums/showthread.php?t=23

Ovi map for iphone

Hello i want to know is there any API for ovi map for iphone ?

From stackoverflow
  • Hi

    Is it possible to use ovi maps in iPhone. Meaning from is any api is available for using it in iPhone.

How to test if a string is inside a list of predinfined list of string in oracle pl/sql

I define a list a string which contains different country codes ( for example , USA ,CHINA ,HK ,JPN) How can I check that if a input variable equal to one of the country of the country list in pl/sql . I use the following code to test it but fail, how can I revise it?

declare country_list CONSTANT VARCHAR2(200) := USA,CHINA,HK,JPN; input VARCHAR2(200); begin input := 'JPN'; IF input IN (country_list) DBMS_OUTPUT.PUT_LINE('It is Inside'); else

     DBMS_OUTPUT.PUT_LINE('It is not  Inside');

END IF; end;

From stackoverflow
  • If you can guarantee that the input will not include the delimiter, you can do this:

    country_list := 'USA,CHINA,HK,JPN';
    
    input := 'JPN'; -- will be found
    IF INSTR(',' || country_list || ','
            ,',' || input || ',') > 0 THEN
       --found
    ELSE
       --not found
    END IF;
    
    input := 'HINA'; --will not be found
    IF INSTR(',' || country_list || ','
            ,',' || input || ',') > 0 THEN
       --found
    ELSE
       --not found
    END IF;
    

Submit an universal app as iPad only app to Apple

Hello, I created an universal app with the window template in xcode. Now I want submit just the iPad version of my app, because the iPhone version is not yet fully programmed.

How is this possible? What do I have to change? (target settings, info.plist, etc.?)

From stackoverflow
  • When you submit to Apple, you can choose to limit it to certain platforms during the upload process.

    hjd : This has changed recently. Instead of limiting the platform during upload you now define required features in your info.plist. These are combined to determine which devices your app supports. You can't set it manually in iTunes Connect any longer.
  • Two things. First is remember you have settings for active target, and project. I'm not sure which place things should be, but I made these on the target.

    Set 'Build Active Target Only' to true.
    Set 'Target Family Device' to iPad.

    You'll know this worked because the number of compilations will be cut in half, and when you upload to iTunes Connect it won't require an iPhone screen shot.

Why is setscheduler not forcing need resched

I noticed that in Linux kernel 2.4 setscheduler doesn't force need_resched. Why is that? is it just some convention, or does that happens somewhere else?

From stackoverflow
  • need_resched is invoked elsewhere in the system.

    The scheduler is markedly different in modern 2.6 kernels, and by many accounts much better. I personally wouldn't dive too deep into 2.4 unless its for historical curiosity.

How to travel into an ArrayOfXelement ?

Hi everyone,

I get an ArrayOfXelement for a result by a webservice. But now I wish to bind this data into a chart in Silverlight also I need to create a datatable.

My question is how to travel my ArrayOfXelement ? Any ideas ? Linq to XML ?

Regards.

Narglix

From stackoverflow
  • Are you looking for a foreach loop?

    : It's okay I found it : foreach (XElement el in tab.Nodes) ;-)

MSMQ private queue size limit

Hi,

I am trying to put messages in a private queue defined on my local computer, but the queue size cannot exceed 8 MB. I am getting an exception every time after that size is reached. The size for the specific queue is set at 10 GB. I am running Windows 7 Professional. Is there a limitation because of that?

From stackoverflow

LAN inter-process communication in C#?

What's the easiest way to implement lan interprocess communication? I need process on machine A be blocked until process on machine B send him just a simple string msg

Don't know if it is worth building a whole WCF project.

What Do you say?

From stackoverflow
  • Go WCF.

    Why creating something on your own, when there is this perfectly suited library? WCF can exactly what you need out of the box. It supports those synchronous blocking calls you need.

    Do yourself a favor and learn it, you will not regret.

  • I had thought there was a win32 "named" object that could be created, potentially able to serve this capability. I'm not spotting it on net searches though. Of course you could try to use the BCL socket mechanisms directly, blocking for a socket accept. You could also try .net remoting, though I'm not sure it would be more light-weight than WCF.

    Ultimately WCF might be best. If you use self-hosting, then I don't think it is as heavy-weight as you are thinking.

  • You can use MSMQ for message passing on LAN.

Psexec or WMI - new session every time?

Hi

Does someone know if if i run PSEXEC (or WMI) N times in the same program - does it open N new sessions? or does it uses the same session over and over again?

From stackoverflow
  • It will open a new session for every time you run it. (Well, unless you were somehow tricking it into running more than one command at a time with a command line like cmd.exe /c ipconfig /registerdns & echo DONE... but that is rather unlikely.)

    : lots of thanks. both WM and Psexec open new sessiosn? How do you know for sure? (I could google the answer...) Do you have a link for me? That would be helpful.
    ewall : Not sure I could find a link explaining it, but you could prove it in a moment by running a simple batch file with multiples of the same command... If you check `netstat -bov` (or similar) after running it, you will see 3 separate sessions.

How to share memory buffer across sessions in Django?

I want to have one party (or more) sends a stream of data via HTTP request(s). Other parties will be able to receive the same stream of data in almost real-time.

The data stream should be accessible across sessions (according to access control list).

How can I do this in Django? If possible I would like to avoid database access and use in memory buffer (along with some synchronization mechanism)

From stackoverflow

Is there a way to find out how many times a class has been instantiated in php?

I'm currently using this method:

class Foo {
    private static $num_instances = 0;

    function __construct() {
        self::$num_instances++;
    }
}

which seems to work, but I'm wondering if there's a built in way....

From stackoverflow
  • I would be surprised if there is one..
    In my opinion it would be an overhead, if it is always counting the amount of created instances.

  • You could use xdebug using the execution trace.

  • You can always check $GLOBALS and count the number of class instantiations.

    It wouldn't be pretty, and I would prefer to do it with a static property.

Subsonic 3 : get only certain columns

Hello,

I use : Subsonic 3, SQL Server 2008, Json.Net

Here is my problem :

I have a house table with id,lot number, address, location, ownerid and an owner table with id,name, description.

I'd like to get only the owner name and address of house where location is "San Francisco".

How can I do this with Subsonic?

My problem is I can only get a typed list or a datareader, I don't understand how to only get an array or a simple list.

What is the best solution? Create a custom class ? Create a View ? Anything else ?

My aim is to then serialize the data to send it back to my application, but serialization is seriously long because of the numerous relationships (My example here is simplified, there are indeed : house - owner - city - country etc.), whereas I need only 2 fields...

Thank you

From stackoverflow

Firefox-Addon: Restart and save all current tabs and windows

Hello guys / gals,

First off, this is my first attempt at writing an add-on. That being said, I am attempting to write an add-on that makes some configuration changes and needs to restart Firefox in order to have the changes take effect. I am currently restarting Firefox using the following code:

        var boot = Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(Components.interfaces.nsIAppStartup);  
    boot.quit(Components.interfaces.nsIAppStartup.eForceQuit|Components.interfaces.nsIAppStartup.eRestart);  

The problem is, it restarts and opens the browser window(s) to whatever the users homepage is currently set to. I want it to re-open all windows / tabs that were previously open before the restart (similar to what happens when you install a new add-on).

Anyone ever messed with this type of functionality before?

From stackoverflow

Does someone have used Network Emulator API exposed in VS 2010

Hi,

I have seen VS2010 exposing Network Emulator API. I have installed it and trying to use this API, but not able detect whether it is really running with this code or not. Sometime I have given wrong profile name but it does not throw any error. Please find below my piece of code. If some one have used it please help me.

IntPtr m_emulatorHandle = IntPtr.Zero; NetworkEmulationApi.LoadProfile(m_emulatorHandle, "300KB_WithLatency.xml"); NetworkEmulationApi.StartEmulation(m_emulatorHandle);

Thanks, Pritam

From stackoverflow
  • Hi All,

    I have solved this problem. After lot of binging I found Ivan post on this. If anyone want to see it please visit here

    Basically in VS2010 release version they have modified the earlier API and if we use Microsoft.VisualStudio.QualityTools.NetworkEmulation dll will solve all problems.

    Thanks, Pritam

The best way to do :not in jQuery?

Hi,

I have a menu in jQuery when you click on a link it opens up, but I want it so when you click somewhere else, anywhere else that is not the menu, it becomes hidden.

At the moment I'm binding a click event to

$(':not(#the_menu)')

But this seems like I'm binding a click event to the entire minus the menu, is there a more efficient way of doing something like this?

From stackoverflow
  • The best way to do this is with bubbling capture, like this:

    $(document).click(function() {
       //close menu
    })
    
    $("#the_menu").click(function(e) {
      e.stopPropagation();
    });
    

    How this works is every click bubbles (unless you stop it, usually by return false; or event.stopPopagation()), so whatever you click bubbles all the way up to DOM...if a click does that, we close the menu. If it came from inside the menu, we stop the bubble...so the click doesn't bubble up, triggering a close. This approach uses only 2 event handlers instead of 1 on everything but the menu, so very lightweight :)

    Nick Craver : Woops had "Propogation" in there, fixed
    Smickie : Wow, that's cool. Cheers. Need to check the event bubbling on all the browsers though, you know what there like. Have a bicky.
    Nick Craver : @Smickie - Luckily, jQuery normalizes the bubbling very well (with a *few* exceptions) so `click` works consistently. The big one to watch out for is `change` not bubbling correctly in IE, making `.live("change",..)` problematic.
  • Attach event to document's body ($(body)). Also attach another event to #the_menu that's block event propagation:

    $(document.body).click(function() {
         //close menu if opened
    });
    
    $("#the_menu").click(function(e) {
         //code heere
    
         e.stopPropagation();
    });
    
  • anything else than using

    $(':someselector')
    

    is more efficient in this case. That is the exact equivalent to

    $('*:someselector')
    

    and that is the universal selector that is beyond slow. So, I'd either specify the selector to

      $('div:not(#the_menu)')
    

    or even more specific. Another thing you could do is bind a click event to the document.body and check for the event.target.

    Kind Regards

    --Andy

  • How about binding the menu display to hovering over the element in which it is contained?

    $("#parentId").hover(
        function() { //!! on hovering in
            $("#targetId").attr("display","block") ;
        } ,
        function() { //!! on hovering out
            $("#targetId").attr("display","none") ;
        }
    ) ;
    

    If it fits your goal, this seems easier to maintain.

Position a UIView at the middle of a UITableView with CGRectZero frame

Hi,

I have a UITableViewController view a UITableView that I alloc/init with a frame of CGRectZero :

self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];

I want to add a view at the middle of the tableView (a loading view with a UIActivityIndicatorView and a UILabel), but I don't know how to position it, since I don't know the tableView frame.

x = (self.tableview.frame.size.width - loadingView.frame.size.width) / 2.0;
y = (self.tableview.frame.size.height - loadingView.frame.size.height) / 2.0;
[loadingView setCenter:CGPointMake(x, y)];

I did init my tableView with CGRectZero frame so it can take the whole place available on screen (which it did), but I thought its frame would update or something.

Any ideas ? Thanks !

From stackoverflow
  • I managed to estimate to frame programatically. I didn't mentionned that my tableView was between a navigationBar and a tabBar, so here is the code for this case :

    CGFloat x = self.navigationController.view.frame.size.width;
    CGFloat y = self.navigationController.view.frame.size.height -
                self.tabBarController.tabBar.frame.size.height;
    
    self.tableView = [[UITableViewController alloc] initWithFrame:CGRectMake(0.0, 0.0, x, y)];
    

    And the code posted above for the positionning of the loadingView works like a charm !

    I'm open ton better solutions, of course

  • If your View Controller is a UITableViewController then the frame of the table view is the same as the frame of the UIViewController.

    Why don't you put it in the center of the UIViewController's view?

    Assuming self is the UITableViewController:

    loadingView.center = self.view.center;
    
  • You could give your LoadingView a reference to the view it is to appear over. Then when it is about to be shown, it can check the frame of the view it is representing to center and match that view and add itself as a subview of the TableView's superview:

    - (void)show
    {
        self.center = targetView.center;
        [[targetView superview] addSubview:self];
    }
    

    Another option is to have the LoadingView use KVO to monitor the UITableView's frame and adjust it's own frame accordingly.

Various way to send data to the web server

Client Environment : Windows XP , Internet connection Available, PHP Not installed.

Server Environment : CentOS , Internet connection Available, PHP , MYsql installed.

Data are stored in files at client machine , suggest better ways to send data fetched from the file to the server. Normally i would be using HTTP request using Curl to send the data to the server but client machine doesnt have php installed.

What all are the ways to send data to the server and the comparisons?

Note: In client machine the data are to be taken from the file and to be sent in background as a daemon.

From stackoverflow
  • Unless you want to install some sort of software on the client machine to make the data available to the server, there is really no other simple way that I can think of other than writing a web app to upload the files (which may not be practical, and certainly requires manual labor).

    Otherwise, you could setup an sFTP server (or something that accomplishes the same thing) on the client machine, and use PHP to connect to the sFTP service on the client machine.

How do I draw my own submenu arrow in owner draw menus (and prevent windows from painting its arrow on top of mine)

Windows seems to draw the submenu arrow after I have done my painting in WM_DRAWITEM, how can I stop windows from drawing the arrow?

From stackoverflow

Detect AJAX requests in the browser (client side)

Is there a way to detect via JavaScript (client side) any AJAX requests that are occurring and even get the number of requests in progress?

The reason I ask: I have a global processing indicator in an application being worked on with several developers, some of whom neglect to start and stop the indicator when making AJAX requests.

Is there a way to detect this?

I know the best way to handle it would be to trigger something with the requests and when the requests complete, but I can't control the other developers or rewrite legacy code, so I'm looking for something I can inject in with JavaScript to detect requests.

From stackoverflow
  • I figured it out (using jQuery):

    $(document).ajaxStart(function() { /* start indicator */ });
    
    $(document).ajaxStop(function() { /* stop indicator */ });
    

groovy variable function

I'm not even sure about how to title this qn. But, hope there is an easy way to do it in dynamic language like groovy.

say I have a class Service, where I delegate the business logic. the methods in it are funA(), funB()... funX().

Now I have a controller class, where I call the service closure, which can be invoked like service.funA() . Now based on a variable (which can have values A, B ... X), I need to cal the correct service closure. Basically to avoid writing lot of if conditional statements. Something like service."fun+var"() would do. I'm not sure whether it is possible to substitute variable in closure (function)name. or any way by passing function (name) as a parameter...not sure

I think PHP has a similar feature http://php.net/manual/en/functions.variable-functions.php

thanks for any pointer..

From stackoverflow
  • Yes, this is possible. This should do what you want:

    service."fun${var}"()
    

    The correct title is dynamic method invocation.

    bsreekanth : Thank you so much.. worked great

In database table design, how does "Virtual Goods" affect table design -- should we create an instance of a virtual good?

When we design a database table for a DVD rental company, we actually have a movie, which is an abstract idea, and a physical DVD, so for each rental, we have a many-to-many table with fields such as:

  TransactionID   UserID    DvdID   RentedDate    RentalDuration   AmountPaid

but what about with virtual goods? For example, if we let a user rent a movie online for 3 days, we don't actually have a DVD, so we may have a table:

  TransactionID   UserID    MovieID   RentedDate   RentalDuration    AmountPaid

should we create a record for each instance of "virtual good"? For example, what if this virtual good (the movie) can be authorized to be watched on 3 devices (with 3 device IDs), then should we then create a virtual good record in the VirtualGoods table, each with a VirtualGoodID and then another table that has

  VirtualGoodID   DeviceID

to match up the movie with the DeviceIDs?

We can also just use the TransactionID as the VirtualGoodID. Are there circumstances where we may want to create a record to record this "virtual good" in a VirtualGoods table?

From stackoverflow
  • The answer depends on your exact requirements, and you haven't specified enough of those in this post. For example, is the online rental associated with the abstract DVD or the physical one? Do you rent just the recording of the DVD or do you reserve the physical DVD while it is rented online? From what you are saying do far, I don't think you need a 'virtual good' in addition to what you already have.

PowerShell and interactive external programs

Hi all

I'm attempting to write a PowerShell script that, among other things, runs two external programs, harvesting the output of one and providing it to the other.

The problem is that the second program is interactive and asks for:
- a password
- an option (1, 2, or 3)
- an option (Y or N)
- output of external program 1

Note also that this is on XP with PowerShell v1 and .net v2.0 (no I can't upgrade)

Any ideas how I would do this?

CC

From stackoverflow
  • Try to see if you can pass the options in via stdin e.g.:

    $prog1out = prog1
    "mypassword`r`n1`r`nY`r`n$prog1out" | prog2
    

    If that doesn't work, another way (kind of hackish and perhaps brittle) is to use SendKeys e.g.:

    [reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
    [windows.forms.sendkeys]::SendWait("mypassword`r`n")
    Start-Sleep -sec 1 # may need to vary this
    [windows.forms.sendkeys]::SendWait("1`r`n")
    # rinse and repeat
    

    Note that SendKeys works against the foreground window which might be a problem for you unless you can make sure the PowerShell prompt remains the foreground window.

Passing data between blocks using sinatra

Hi All

I'm trying to pass data between blocks using sinatra. For example:

@data = Hash.new
post "/" do
   @data[:test] = params.fetch("test").to_s
   redirect "/tmp"
end

get "/tmp" do
   puts @data[:test]
end

However whenever i get to the tmp block @data is nil and throws an error. Why is that?

From stackoverflow
  • The reason is because the browser actually performs two separate HTTP requests.

    Request: POST /
    Response: 301 -> Location: /tmp
    Request: GET /tmp
    Response: ...
    

    Two requests means two separate processes thus the @data instance variable is cleared once the first response is sent. If you want to preserve the information, you need to use cookies or sessions, otherwise pass the data in querystring

    post "/" do
       test = params[:test]
       redirect "/tmp?test=#{test}"
    end
    
    get "/tmp" do
       puts params[:test]
    end
    

Java-Maven: How to add manually a library to the maven repository?

I'm trying to generate a jasperReport, but I receive this:

net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'Times New Roman' is not available to the JVM. See the Javadoc for more details.

After searching on the net, I found that I need to add a jar to the classpath with the font. So, I create a jar file with the ttf files and now I want to add this as a dependency to my pom file.

So: I installed the file :

mvn install:install-file -Dfile=tf.jar -DgroupId=tf -DartifactId=tf -Dversion=1.0.0 -Dpackaging=jar

and in my pom, I added these lines:

 <dependency>
            <groupId>tf</groupId>
            <artifactId>tf</artifactId>
            <version>1.0.0</version>
        </dependency>

but I receive this: Dependency 'tf:tf:1.0.0' not found less

I checked the repository folder and the jar file is there, in ... tf\tf\1.0.0\

What I'm doing wrong?

From stackoverflow
  • The syntax of the command used to install your 3rd party jar looks identical to the reference (I would just also generate a pom by adding -DgeneratePom=true), the snippet to declare the dependency in your pom looks fine. What you're doing seems ok.

    Could you provide the exact trace?

    Aaron : After I add the -DgeneratePom=true, it worked. Thank you!
    Pascal Thivent : @Aaron Glad it's working (I don't think that not having a pom was blocking though).

Are there tools that would be suitable for maintaining a changelog for a Cabal Haskell package?

I'm working fast and furiously on a new Haskell package for compiler writers. I'm going through many minor version numbers daily, and the Haskell packaging system, Cabal, doesn't seem to offer any tools for updating version numbers or for maintaining a change log. (Logs are going into git but that's not visible to anyone using the package.) I would kill for something equivalent to Debian's uupdate or dch/debchange tools.

Does anyone know of general-purpose tools that could be used to increment version numbers automatically and add an entry to a change log?

From stackoverflow
  • To non-answer your question, I'm not aware of anything. This sounds like a good match for posting in the Haskell Proposals subreddit, since it seems like a pretty useful idea.

  • I use a very simple scheme to generate my CHANGELOG. I just ask darcs for it and include it in the extra-files section of my package's .cabal file. Though, this seems too simplistic for what you are asking. =)

    That said, you can go quite a bit farther and use a custom cabal Setup.(hs|lhs) that builds the CHANGELOG during cabal sdist out of your darcs or git repository's commit info (or out of whatever system you decide to use to track it)

    The Setup.lhs used by darcs does something very similar to include information on version numbers and number of applied patches since the last version. Look at the sdistHook and generateVersionModule machinery in Setup.lhs to get an idea of how this can be done.

    Norman Ramsey : I'm a frequent, compulsive committer, and I don't want my users to suffer through my RCS logs...

How can I highlight an image on an iPhone?

I have a photo displayed on an iPhone. I would like to lower brightness of the photo at first, and when the user touches the photo, I would like to raise the brightness of the rectangular region near where the user touched, like this:

www.cottagearts.net/tut_images/tut_cropping_pse_06.jpg

Could anyone point me to a simple way of doing this?

From stackoverflow
  • While you can't actually adjust the brightness of the screen, you can put a semi-transparent image on the screen. I'd paint everywhere but where the user touched with an color that is black, but has X transparency, which is exactly what that image is showing that you linked to.

  • I'm no expert, but I've been trying to do something similar. You could implement this with layers. As Malfist suggested, you could make a black layer with a certain opacity and may the clicked part of it fully transparent or somesuch. Another option would be to do some image processing. I found an article here that I think will handle my highlighting issue:

    http://arstechnica.com/apple/news/2009/03/iphone-dev-basic-image-processing-package.ars

cx_Oracle and output variables

I'm trying to do this again an Oracle 10 database:

cursor = connection.cursor()
lOutput = cursor.var(cx_Oracle.STRING)
cursor.execute("""
            BEGIN
                %(out)s := 'N';
            END;""",
            {'out' : lOutput})
print lOutput.value

but I'm getting

DatabaseError: ORA-01036: illegal variable name/number

Is it possible to define PL/SQL blocks in cx_Oracle this way?

From stackoverflow
  • Yes, you can do anonymous PL/SQL blocks. Your bind variable for the output parameter is not in the correct format. It should be :out instead of %(out)s

    cursor = connection.cursor()
    lOutput = cursor.var(cx_Oracle.STRING)
    cursor.execute("""
                BEGIN
                    :out := 'N';
                END;""",
                {'out' : lOutput})
    print lOutput
    

    Which produces the output:

    <cx_Oracle.STRING with value 'N'>
    
    Tim : Many thanks...I thought we'd tried that particular combination at some point, but we must have missed it!

C++ change sort method

Possible Duplicate:
C++ struct sorting

Is it possible to sort a vector in C++ according to a specified sorting method, like used in Java's Collections.sort that takes a Comparator?

From stackoverflow

w3wp versus mvsmon

Hi, I'm trying to figure out the difference between w3wp and msvsmon. Both seem to be remote debugging tools that run on the web server, and we can attach to them via Visual Studio to help in debugging live applications. Is this correct ? If so what are the differences between them ? many thanks.

From stackoverflow
  • w3wp is the w3 (www) worker process. This is what runs the website. This will allow remote debugging of websites.

    msvsmon is the remote debugger monitor, this is what actually allows remote debugging for all applications.

usercontrols inside panels

hi all

In my project i added a usercontrol to a panel.when i try to add a new usercontrol to my panel i want to check what is the name of the usercontrol placed in the panel before how to do it.

i have three different usercontrols, i assign it one by one to panel,before replacing the new one with the old one ,i want to find what is the old one inside the panel.

From stackoverflow
  • You can set the name like this:

    Panel pnl= new Panel();
    ...
    
    UserControl myControl = new UserControl();
    myControl.Name = "muUserControl";
    pnl.Controls.Add(myControl);
    
    
    
    foreach (Control ctrl in pnlUserControlContainer.Controls)
                    {
                        if (ctrl is UserControl)
                        {
                            Console.WriteLine(ctrl.Name);
                        }
                    }
    

does mysql stored procedures support data types like array, hash,etc?

i am creating a mysql function which takes in a varchar and change it to a int based on a mapping table.

select name, convert_to_code(country) from users where sex = 'male'

here, the convert_to_code() function takes in a country name (e.g. Japan, Finland..) and change it to country code which is an integer (e.g. 1001, 2310..) based on a mapping table called country_maping like below:

country_name (varchar) | country_code (int)
Japan                  | 1001
Finland                | 2310
Canada                 | 8756

currently, the stored function need to select country_code from country_mapping where country_name = country_name and return the query result. is that possible to create a hash data struct in SP to optimize the process so that it will not need to perform the query for each row matches the where clause.

thanks in advance!

From stackoverflow
  • You should just use the table as you're doing.

    If you create a covering index over those two columns, it should make it as efficient as possible.

JSON_Spirit: good examples of unpacking a JSON string?

Any good examples/tutorials of unpacking JSON strings with the C++ JSON_Spirit library?

Something that can traverse a json_spirit::Value object and pretty-print it would be ideal.

From stackoverflow

Detect if a hudson build is manually or schedule (periodically) invoked

Ive set up deployment in hudson. SVN > Build > copy to production. I need to set up a schedule build to test for build error which is running every hour or so. What i dont want is the schedules builds to deploy to production. Is it posible to detect, in nant, if the current build is a scheduled build or a manually started build. Or should i create a seperate project for the schedule build?

From stackoverflow
  • The cleanest option is to create a separate job for your scheduled build; you can then keep other artifacts like test results separated (since I assume your scheduled job will be running a different set of tests).

    If you're just running the scheduled job to look for build errors, this will also keep the checked-out code that you're building separate from the triggered builds, which will minimize the risk of the production builds getting polluted with artifacts created by the test build.

    hippie : good point. Thats what ill do.

System requirements for Cometd/Bayeux Usage on Android

Hi all,

I'm trying to implement a Cometd/Bayeux server on Android using iJetty. The Jetty implementation itself works just fine serving static pages along with servlets. I am trying to up the ante a bit and create a Bayeux application on the phone but I'm having some trouble. I can hit the page that has the dojo cometd scripts on it, but I am unable to subscribe to the channel. When I view firebug/chome developer tools, I see a series of posts/gets that last a couple of milliseconds (~14). However, when I run a cometd application on a normal machine, the posts/gets last several seconds (~14 seconds) before timing out and reopening the connection. This second scenario makes sense to me with my understanding of how continuation in HTTP works. So I'm thinking that something is not allowing those connections to hang open and prematurely returning a value and consequently closing the connection. I would post my source but I'm not sure what to post short of posting everything...(it is open source though so if you want to have a look it's at http://webtext-android.googlecode.com).

So my question is, does anybody think that there could be some underlying limitation imposed by the Android system that is preventing these servlets from working? Are there assumptions that are made by the Jetty Bayeux implementation with regards to the underlying system? Or is it more likely that somehow I have a bad implementation of the ContinuationCometdServelt? I should note that all of the posts/gets from the client return 200 OK messages so I'm not inclined to think that the Android system is simply terminating the connection.

I know this is a bit off the wall and I'm definitely trying to do something a bit out of the ordinary but any suggestions or tips would be greatly appreciated.

Thanks,

Chris

From stackoverflow
  • In case anybody discovers this and has similar problems (this applies to all cometd implementations regardless of host), I discovered that the issue was with using the Google js library. For some reason, the dojo scripts I was loading from Google (1.4) didn't have a valid implementation of cometd. I switched my dojo script to the one that was used by the jetty-1.6.23 example and it works perfectly.