Monday, February 21, 2011

Rebuild solution in vs2008 without visual studio?

How can we Rebuild solution in vs2008 without visual studio?

From stackoverflow
  • Not sure I fully understand the question, but you can run MSBuild from the command line to rebuild most projects in a solution.

    MSBuild.exe Path\To\Solution.sln /t:Rebuild /p:Configuration=Release
    

    If you don't run from the Visual Studio command prompt, you can find MSBuild.exe for .NET 3.5 under

    • %FrameworkDir%\%Framework35Version% or
    • C:\Windows\Microsoft.NET\Framework\v3.5
    slugster : +1, you can invoke MSBuild directly on any project file, although you might have to make a customised MSBuild targets file or project file to replace the solution file. MSBuild is part of the .Net framework, so no VS is required.

back button wont work.. Iphone

Hi,

I have 2 page controls in my app, one for category and when i click details button of that category other page control comes. I have pushed the first view controller and used present modal view controller. Now a need to go back to the home page from the category page control but the view did load and view will appear wont work. That is where i have added my navigation bar programmatically. is there any way i can call them?

i am new to iphone programming. Please help me if you can....

Thankyou

From stackoverflow
  • You can use delegate.

    Set the object that created your new view controller as delegate. When you presenting your view controller add it to navigation bar. Setup your view controller with cancel/done buttons and set them up to pass the messages to delegate.

    When user selects cancel/done the delegate method is called. Delegate can then dismiss the view controller.

    See the example in View Controller programming guide for iPhone OS.

    You'll have to setup the buttons and call to delegate when you create your view controller.

  • If you have used "present model view controller"

    then you required to use "dismis model view controller" instead of using "pop view controller" for going back...

folder and files selection in .net

I want the control component which can provide access to all file sistem like a folder browser dialog but with supprot of which i can select many folders and file. whether there is already such a component in VS 2008 or made by third parties or should I create it myself?

From stackoverflow
  • I am decide to use System.Windows.Forms.TreeView

Do I still write String^ const in C++/CLI

In C++ it's recommended to have const-correctness everywhere. But since in .Net world, the string content cannot be changed, (new string will be created), do I still write String^ const?

From stackoverflow
  • No. Just pass a handle to a string directly: method(String^ string)

    AZ : ok, what if in a method, I want to define a const string, would it be better that I put const there so anyone else would know it's a not-changed string?

Freezing the header of composite report in PowerBuilder 6.5

Setup:

Using PowerBuilder 6.5.

I have a composite report (with a report header) which is created from two unrelated individual DataWindows.

Question:

In composite presentation style, how can I freeze (lock) composite report header along with the column headers in the top DataWindow?

E.g. When you scroll down the composite report, both of the headers should remain visible.

Thanks!

From stackoverflow
  • Composite reports are always presented in print preview mode, showing the report as an image of what is displayed on the page. You won't get frozen headers with this. Sorry.

    Good luck,

    Terry.

jQuery Slide Panel on Mouseover

How can I make this sliding panel example to slide down on mouseover and slide back in on mouseout instead of using the click function?

See the example here: http://www.webdesignerwall.com/demo/jquery/simple-slide-panel.html

$(".btn-slide").click(function(){
 $("#panel").slideToggle("slow");
 $(this).toggleClass("active"); return false;
});
From stackoverflow

Is the FPU control word setting per-thread or per-process?

I need to change the FPU control word from its default setting in a multithreaded application. Is this setting per-thread or per-process? Does it have different scopes under Mac OS X and Windows?

From stackoverflow
  • It is per-thread on Windows. Not sure about OS-X, surely it does.

    Beware the nastiness you can run into if you are using libraries that expect the control word to be set at the default. Almost all of them do.

Image control with pan and zoom ability

I am looking for a free .net winforms control which is able to display images. PictureBox isn't a solution because you have to implement all pan&zoom events yourself. The control should be able to display images like 4000x5000 pixels, have zoom and pan buttons.

From stackoverflow

Compiling Java code in terminal having a Jar in CLASSPATH

How can you compile the code using javac in a terminal by using google-collections in CLASSPATH?

Example of code trying to compile using javac in a terminal (works in Eclipse)

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
public class Locate {
   ...
   BiMap<MyFile, Integer> rankingToResult = HashBiMap.create();
   ...
}

Compiling in terminal

src 288 % javac Locate.java 
Locate.java:14: package com.google.common.collect does not exist
import com.google.common.collect.BiMap;
                                ^
Locate.java:15: package com.google.common.collect does not exist
import com.google.common.collect.HashBiMap;
                                ^
Locate.java:153: cannot find symbol
symbol  : class BiMap
location: class Locate
        BiMap<MyFile, Integer> rankingToResult = HashBiMap.create();
        ^
Locate.java:153: cannot find symbol
symbol  : variable HashBiMap
location: class Locate
        BiMap<MyFile, Integer> rankingToResult = HashBiMap.create();
                                                 ^
4 errors

My CLASSPATH

src 289 % echo $CLASSPATH 
/u/1/bin/javaLibraries/google-collect-1.0.jar
From stackoverflow
  •   javac -cp /u/1/bin/javaLibraries/google-collect-1.0.jar Locate.java
    

    or, new in Java 6, just let it scan the directory

      javac -cp '/u/1/bin/javaLibraries/*' Locate.java
    

Get products to display on custom Magento page

How can you get products to display on a custom Magento page? Naturally, this is not an uncommon question but nothing that I've seen has solved it for me. The common response is to put the following code in through the CMS editor:

{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage” template=”catalog/product/list.phtml”}}

Which just displays the message "There are no products matching the selection." on my page. Other websites advise reindexing the data through the Magento admin controls, clearing the Magento cache, and making sure products are set to a store, none of which helped in my case.

Anyone have any ideas?

From stackoverflow
  • You lost a most important thing is which category you want to display,look the following code

    {{block type="catalog/product_list" category_id="XX" name="home.catalog.product.list" alias="products_homepage” template=”catalog/product/list.phtml”}}
    
    Eric : Yeah, and it works that way but I want to display all products, not just products from a specific category. I've seen the code that I have in other places saying that it works.

Example for accessing Tcl functions from Python

I see that elmer makes it possible to run Python code from Tcl. But is it possible the other way around? Could anyone give an example in Python?

Update: by this I mean, being able to access Tcl objects, invoke Tcl functions, etc instead of simply running some Tcl code.

From stackoverflow
  • You can take a look at python tkinter standard module, it is a binding to Tk UI, but that executes Tcl code in the background.

    Colin Macleod : Eg. from Tkinter import *; root= Tk(); root.tk.eval('puts [array get tcl_platform]');
    Sridhar Ratnakumar : @Colin - as the question reads "being able to access Tcl objects, invoke Tcl functions, etc..", shouldn't your example be written as to get reference to that Tcl array in Python (instead of retrieving the string representation of what is printed)?
    Colin Macleod : Well I just added a quick comment to give you the idea. Also I suspect the Python<->Tcl communication will probably have to be at the level of passing commands and getting results as strings anyway, I wouldn't expect them to be able to share data structures.
  • This?

    import subprocess
    subprocess.Popen( "tclsh someFile.tcl", shell=True )
    
    Sridhar Ratnakumar : No, please read the clarification I just added to the question.
    Mike Graham : There is no need to use the shell in this case. `subprocess.Popen(["tclsh", "someFile.tcl"])` works fine.
  • While it might be possible in theory by providing some custom Python object types that wrap C level Tcl_Obj*'s transparently, the general case is just exchanging strings back and forth as Tcl's EIAS semantics can shimmer away every other internal representation freely.

    So yes, you could do better than strings, but its usually not worth it. Tkinter already has a few of the possible optimizations built in, so try to steal there...

JTable.setRowHeight prevents me from adding more rows

I'm working on a pretty simple Java app in order to learn more about JTables, TableModels, and custom cell renderers. The table is a simple table with 8 columns only with text in them. When you click on an "add" button, a dialog pops up and lets you enter the data for the columns.

Now to my problem. One of the columns (the last one) should allow for multiple lines of text. I'm already putting HTML into the field, but it is not wrapping. I did some research and looked into JTable#setRowHeight(). However, once I use setRowHeight, I can no longer add rows to the table. The data is put into the table model, but it does not show in the table. If I remove the setRowHeight line, then it adds data just fine.

Is there another step to adding data to my data model that I'm missing?

Thanks a lot!

From stackoverflow
  • You have to replace the cell editor. The default cell editor is a JTextField, I don't believe that allows for text wrap. A JTextArea or similar component would allow you to do that.

    As for setRowHeight() disallowing you from adding new rows, I've never heard that before. Can you provide more details? or at the very least the code you used? I'm not able to reproduce the results as I am able to continue to add new rows despite using setRowHeight().

    Brent Parker : Thanks for your reply. I figured it out. I needed to use fireTableDataChanged() when I add a new row. Thanks again for the reply!

What's up with IE this time? - Floats the entire content to the left and adds a gap in the menu.

You build it for FF, then you hack it for IE.

Take a look here: http://jbhstad.se/NicklasSandell/

Anyone knows what's up with IE? The menu seems to have a gap between for some reason, and the entire site is floated left?

Thanks in advance, -Nike

From stackoverflow
  • Dealing with cross-browser compatibility takes a ton of patience and attention to detail. The best advice I can give is to...

    1) Make sure IE is not running in Quirks mode. A lot of problems go away with the correct doc type.

    2) Make sure that your HTML is valid. Use the W3C validator for this.

    3) Understand how IE implements the box model.

    4) Familiarize yourself with the known IE bugs.

    5) Make yourself comfortable.

    Here's an article from Smashing which goes over this is some more detail.

    Good luck!

    Nike : As i'm pretty tired right now, i'm gonna get a few hours of sleep. I have a feeling the errors may be right in front of my eyes. I've been working with web development for, hmm, i'd say about three years now. I've still got a lot to learn, but i'm familiar with most IE bugs and such as i've been playing around with it a lot. Every time i make a website i encounter an IE bug of some sort. I'll go through the links anyways though, thanks.
    Nike : And by the way, i've already validated the page. And it gave me a doctype error, but only if i enter the direct url to the page. If i paste the HTML (as it's rendered), it comes out error-free.
    Slauma : Regarding point (3) (IE box model) it should be added that the article you linked is quite old and related to IE 5.5 and older. IE 6 (when in standard compliant mode) and later versions use the standard W3C box model.
    Thomas : @Slauma - you're absolutely right. Thanks.

Color palette reference for .Net foreground colors?

HI everyone,

Just looking for a website or pdf reference which has a color palette of the .NET (Visual Studio 2008) foreground colors? (E.g. like AliceBlue, AntiqueWhite, Cyan....)

From stackoverflow
  • Here is a link to one

Passing an NSDate

I'm new to the iPhone and objective-c and I am still trying to get my head around ownership of objects so bear with me.

I have a DOBViewController that has a datepicker on it. I have created a custom init method:

-(id)initWithInitialDate(NSDate *)initialDate;

Another view controller has a date instance declared (NSDate *dob) that holds a value. I would like to pass this to the DOBViewController so that it can scroll the datepicker to the passed value.

Here is the custom init method:

- (id)initWithInitialDate:(NSDate *)initialDate {
// Initialise ourselves
self = [super init];

// Set the date of the date picker
if (initialDate != nil) {
    datePicker.date = initialDate;
}
else {
    // Set it to today
    datePicker.date = [NSDate date];
}

return self;

}

This is how I am sending the dob NSDate object:

DOBViewController *dobViewController = [[DOBViewController alloc] initWithInitialDate:dob];

Where dob is a variable of type NSDate that is declared in the header file.

This doesn't seem to work as initialDate is always NULL. What am I doing wrong?

From stackoverflow
  • Your datePicker outlet isn't loaded yet by the time the init... method returns. You should save the NSDate into an instance variable, and then do the setting in a more appropriate method, like viewDidLoad.

    Garry : Perfect. Thanks!

WCF maxReceivedMessagesize and readerquotas

What is the fundamental difference between the two? On the server side on the service, I am using readerQuotas to accomodate large string lengths (Int32.MaxValue). What is the significance of maxReceivedMessagesize then?

From stackoverflow
  • maxReceivedMessagesize is the total size of the message.

    readerQuotas are the size of parts of the message for example the length of a string in the message.

    You need both of them so be set high enough for your message to go through, often the defaults will be OK.

Homemade fstat to get file size, always return 0 length.

Hello, I am trying to use my own function to get the file size from a file. I'll use this to allocate memory for a data structure to hold the information on the file.

The file size function looks like this:

long fileSize(FILE *fp){
    long start;
    fflush(fp);
    rewind(fp);
    start = ftell(fp);
    return (fseek(fp, 0L, SEEK_END) - start);
}

Any ideas what I'm doing wrong here?

From stackoverflow
  • Do

    fseek(fp, 0L, SEEK_END);
    return (ftell(fp) - start);
    

    instead of

    return (fseek(fp, 0L, SEEK_END) - start);
    

    because fseek return zero on success not the offset as you are expecting here.

    Fred : Thank you. *I guess I should have spent some more time reading the man page. :)
  • A few comments:

    • don't call fflush() - your stream might be a read stream, for which fflush() results in undefined behaviour

    • you don't have any error checking !

    • fseek() returns 0 for success - you need to call ftell() to get the length

    Change the code to this:

    long fileSize(FILE *fp)
    {    
        fseek(fp, 0L, SEEK_END);
        return ftell(fp);
    }
    
    Fred : Good suggestions, I'll take them with me. Thank you.
  • You need to call ftell after fseek. Try:

    long fileSize(FILE *fp){
      long start;
      fflush(fp);
      rewind(fp);
      start = ftell(fp);
      fseek(fp, 0L, SEEK_END);
      return ftell(fp);
    }
    

    There's no need to do a difference, so your first ftell is useless and you can get rid of it. I would use:

    long filezise(FILE *fp)
    {
      fseek(fp,OL,SEEK_END);
      // fseek(f, 0, SEEK_SET); - only if you want to seek back to the beginning
      return ftell(fp);
    }
    

    Also, make sure you open your file in binary mode.

    Fred : Thats great, I did not know you could do this. Thanks!

Disable the anchor tag.

I have one anchor tag. I want to disable it after once it clicked. I tried the following way.

  print "<script type='text/javascript'>parent.window.frames[2].document.getElementById('pagination').innerHTML+=\"<a href=# onclick='pageshow`($i);this.disabled=true'>$i</a>&nbsp;\"</script>";

Note: I don't want to disable the link. I want to disable the link operation. Like Google search page.

Eg: 1 2 3 4 5 Next

Here once I clicked the 1st page I can't click the same page again. Same thing I want.

From stackoverflow
  • <a href="…" onclick="this.removeAttribute('href');">
    
  • You can also disable the anchor tag by using the following way.

    <a href='URL' style='text-decoration:none;cursor: auto;' onClick='return false'>LINK</a>
    
  • Having reread the question…

    Google do not "Disable the link after it has been clicked".

    They just don't link to the current page. Their markup is appalling so I won't copy it, a simplified example (for page 2) would be:

    <ol>
      <li><a>1</a></li>
      <li>2</li>
      <li><a>3</a></li>
      <li><a>4</a></li>
    </ol>  
    
  • Javascript isn't the right way to do this, but I'll provide an answer for the heck of it:

    var links = document.getElementsByTagName('a'), link, children;
    for(var i = 0; i < links.length; i++) {
        link = links[i];
        if(link.href == window.location.href) {
            children = link.childNodes;
            for(var j = 0; j < children.length; j++) {
                link.parentNode.insertBefore(children[j], link);
            }
            link.parentNode.removeChild(link);
        }
    }
    

    Edit: I don't know if "he-double-hockey-sticks" is "foul language" on SO but if it is, this will be deleted mysteriously some months from now so I've used "heck" instead.

redirectToAction results in null model

I have 2 actions on a controller:

public class CalculatorsController : Controller
{
    //
    // GET: /Calculators/

    public ActionResult Index()
    {
        return RedirectToAction("Accounting");
    }


    public ActionResult Accounting()
    {
        var combatants = Models.Persistence.InMemoryCombatantPersistence.GetCombatants();
        Debug.Assert(combatants != null);
        var bvm = new BalanceViewModel(combatants);
        Debug.Assert(bvm!=null);
        Debug.Assert(bvm.Combatants != null);
        return View(bvm);
    }

}

When the Index method is called, I get a null model coming out. When the Accounting method is called directly via it's url, I get a hydrated model.

From stackoverflow
  • This is less an answer than a workaround. I am not sure why you are getting a null model as it looks like it should work. In fact, I can confirm the behavior you are seeing when I try it out myself. [EDIT: I discovered a flaw in my initial test code that was causing my own null model. Now that that is corrected, my test works fine using RedirectToAction.] If there is a reason for it, I don't know it off the top of my head.

    Now for the workaround...I assume that you are doing it this way since the default route sends all traffic to http://www.domain.com/Calculators to "Index". So why not create a new route like this:

    routes.MapRoute(
      "Accounting",
      "Calculators/{action}/",
      new { controller = "Calculators", action = "Accounting" }
    );
    

    This route specifies the default action to the Calculators controller will be "Accounting" instead of Index.

    Maslow : well the idea is that this is a temporary workaround until I have more calculators rather than just the one. adding a route is less maintainable to me than doing it in the controller and later changing the index controller when I have something better for it to do.
    Bradley Mountford : I can understand that. Plus, I have been able to get this to work in one of my own projects without any special configuration so this should be working for you as well. Is the Accounting view strongly typed (i.e. does it have something like Inherits="System.Web.Mvc.ViewPage" at the top)?
  • Hi,

    Your view for the Action Accounting expects a model. (the BalanceViewModel). The index action method does not have a instance of the BalanceViewModel.

    There are a number of ways you can solve this. In your View (aspx page) you can check for nulls...

    Or in the index action method, you create a new instance of a BalanceViewModel and store it in TempData, and then retrieve this in your view when your model is null.

    Or in your action method, you could also call return View("Accounting", new BalanceViewModel()) instead of using redirect to action.

    EDIT: Example Code - If you want to share this functinality, create a private method like this:

    public class CalculatorsController : Controller {
        // GET: /Calculators/
        public ActionResult Index() {
            return View(GetBalanceViewModel());
        }
    
        public ActionResult Accounting() {
            return View(GetBalanceViewModel());
        }
    
        private BalanceViewModel GetBalanceViewModel() {
            var combatants = Models.Persistence.InMemoryCombatantPersistence.GetCombatants();
            Debug.Assert(combatants != null);
            var bvm = new BalanceViewModel(combatants);
            Debug.Assert(bvm != null);
            Debug.Assert(bvm.Combatants != null);
            return bvm;
        }
    }
    

    Have you seen this Question?

    Maslow : why do I need to provide the model in the index action if all I want the index action to do is is hand off to another action?
    Dai Bok : if that is the case, have you tried just returning the result from accounting? something like: return Accounting(); in the index action method. (Just a guess, have not tried it my self yet)

Delegate Instantiation -Clarification

When i have delegate like

public delegate void PrintMe();

(1)
PrintMe a = delegate() { MessageBox.Show("Hello"); };
a();

(2)
PrintMe b = () => { MessageBox.Show("Hello"); };
b();

(3)
PrintMe c = new PrintMe(HelpMe);
c();

static void HelpMe()
{
   MessageBox.Show("Help Me");
}

for (1) and (2) I did not instatntiate the delegate it is directly pointing to anonymous methods.But as in the case of (3) I need to instatntiate the delegate and pass the static method.for case (3) can't i declare like PrintMe c= HelpMe(); ?.How does (1) and (2) work?

From stackoverflow
  • PrintMe c = HelpMe;
    
  • Thanks to the implicit conversion between method groups and delegates you can say

    (3)
    PrintMe c = HelpMe;
    

    i.e. without parenthesis

    : Oops ! How fool I am!
  • In (1) and (2) the compiler implicitly converts your lambda expression into a delegate.

    If you try to do

    PrintMe c= HelpMe();
    

    then you are telling the compiler to generate a call to HelpMe and assign the result of that call to c. Instead, you can do

    PrintMe c = HelpMe;
    

    Here, HelpMe occours as what is known as a method group (it is not just a method, because it may have overloads), which may be converted to a delegate if at least one method in the group fits the delegate.

How to make button on LinearLayout dynamically ?

Hi guys,

I am trying to make a button programmable way (no attributes on LinearLayout). In other words, button count on the View is dynamically.

How to make it ?

Thanks

From stackoverflow
  • Take a look at this article it demonstrates creation of Android UI in java code rather than using the declarative approach

    Samuh : You may also want to check this out: http://www.lacherstorfer.at/haris_blog/2008/03/android-howto-create-spinners.html

Can PHP array passed POST method to catch in ASP.NET MVC?

Can PHP array passed POST method to catch in ASP.NET MVC?

Query string: WebAccess/ArrayTest?val[]=1&val[]=2&val[]=3

I write: ActionResult ArrayTest (String[] val)

But this only works if the query string to remove the "[]"

From stackoverflow
  • (not an answer - but its difficult to explain this using a S.O. comment)

    You've rather confused things by suggesting that this is really anything to do with PHP. Also, you don't say which '[]' you removed to make it work. The unenlightened asp programmers out there might find it easier to understand:

    <form method='POST' action='something.asp'>
       <input type='text' name='val[]'>
       <input type='text' name='val[]'>
       <input type='text' name='val[]'>
       <input type='submit' value='go'>
    </form>
    

    Using some web development languages the data from each the three text fields is subsequently available in an array named 'val'. How to replicate this behaviour in asp.net?

    C.

  • The built in DefaultModelBinder in ASP.NET MVC can't handle rails/php/jquery1.4 style array posts (which is what you're referring to with val[]=1&val[]=2&val[]=3).

    You have to either create a custom modelbinder (google it, lots of examples) or adding indices inside the bracket like so:

    val[0]=1&val[1]=2&val[2]=3
    

    And the indices must not have any missing numbers.

    I have fixed this with a script that on submit of the form just adds the indices. i.e. in jQuery:

    $('form').find('input, select, textarea').attr('name', function(index, old) {
        return old.replace(/\[\]/, '[' + index + ']');
    });
    

What's a good resource for learning about the MVVM pattern?

I've recently joined a new team that uses the MVVM pattern with Silverlight 3.

Can anyone recommend a good resource for learning about this pattern?

Thanks,

E

From stackoverflow

How do i jump to a breakpoint within gdb?

Hey folks!

I'm new to gdb and I tried out the following: I set a breakpoint, which worked fine actually, but is there any possibility to jump immediately to that breakpoint without using "next" or "step". Using "next" or "step" takes really long to get to the final breakpoint. I wasn't able to find a faster way. Any help is preciated!

regards chris smullian

From stackoverflow
  • Just press c, it will continue execution until the next breakpoint.

    You can also disable intermediate breakpoints by using disable #breakpointnumber as stated here.

    Chris Smullian : that worked! the link contained useful information, thank you!

How to embed functionality into HTML email?

We want to let users click a thumbs up or thumbs down button from an HTML email, without causing the clicking to open a browser window.

Is there a way to essentially embed limited web functionality (i.e., clicking an icon, showing confirmation) within HTML emails?

Thanks!

From stackoverflow
  • The short answer is no, not reliably across email clients. Usually with something like this I'd embed an image that looked like your functional element and just have it link to a web page that has that functional element.

  • I'm afraid such functionality, while theoretically possible, wouldn't be very practical given that most email clients strip out or disable JavaScript in order to prevent malicious code execution or other security issues. Your best bet is to use an image that looks like the thumbs up or thumbs down and then links directly back to your website. The browser window will still need to be opened, but you'll at least achieve the main part of your goal.

How to UISlider with increments of 5

How do have my UISlider go from 1-100 by going by 5s?

From stackoverflow
  • Add a delegate like this:

    slider.continuous = YES;
    [slider addTarget:self
          action:@selector(valueChanged:) 
          forControlEvents:UIControlEventValueChanged];
    

    And in the valueChanged function set the value to the closest value that is divisible by 5.

    [slider setValue:((int)((slider.value + 2.5) / 5) * 5) animated:NO];
    
    Tyler29294 : Thanks works like a charm!
    Tuomas Pelkonen : Good. If it works like a charm, you could consider accepting my answer.

Forwarding Class Messages

I know that I can forward messages to instances of a class using -forwardInvocation:. Can I do the same for messages sent to a class object (as in +forwardInvocation:)?

From stackoverflow
  • Looks like I can.

Is there any web service for getting tidal information outside the US?

Has anyone come across a web service or plugin/code/calculation for getting information on tides - namely high and low tide times? I only need this information for one location (outside the US) but I need it on an ongoing basis so a web service that I can hit once a day or something would be ideal.

From stackoverflow
  • Check out NOAA Weather Service

    thor : As comment above, I'm looking for a service that covers outwith the US, thanks.

How to use ajax tabcontainer in formview?

How to add a tabcontainer in a formview template? I am sure i have a scriptmanager inside the page. but it keep compliaint "A ScriptManager is required on page to use ASP.NET AJAX Script Components. I have also tried move the ScriptManager inside the itemTemplate but same error.

From stackoverflow
  • Perhaps you are not using the ToolkitScriptManager?

    It's required for Ajax Toolkit components.

Delphi VCL "TaskDialog" problem in Windows 7

I'm developing an windows app on Delphi 2007 and I'm using "Ttaskdialog" component in it. Using windows XP it runs normally, but in Windows 7 I'm getting the following message:

TtaskDialog requires themes to be enabled

Any clues how to fix it?

From stackoverflow
  • To use TTaskDialog you need to enable themes in project options.

    In menu go to Project -> Options... then to Application and check the Enable runtime themes box.

    Hrukai Whoever : Thanks for the help, it fully helped my problem.

How does one iterate over a sequence in xquery by twos?

I want to iterate over a sequence in xquery and grab 2 elements at a time. What is the easiest way to do this?

From stackoverflow
  • I guess three options could be:

    for $item at $index in $items
      return
      if ($item mod 2 = 0) then
        ($items[$index - 1], $items[$index])
      else
        ()
    

    and another option might be to use mod and the index of the item:

    for $index in 1 to $items div 2
      return
      ($items[($index - 1)*2+1] , $items[($index)*2])
    

    or

    for $index in (1 to fn:count($items))[. mod 2 = 0]
      return
      ($items[$index - 1] , $items[$index])
    
  • for $item at $index in $items return ( if ($index mod 2 eq 0) then ( $items[xs:integer(xs:integer($index) - 1)], $items[xs:integer($index)] ) else () )

  • let $s := ("a","b","c","d","e","f")
    
    for $i in 1 to xs:integer(count($s) div 2)
    return
    <pair>
       {($s[$i*2 - 1],$s[$i*2])} 
    </pair>
    

    returns

    <pair>a b</pair>
    <pair>c d</pair>
    <pair>e f</pair>
    

Unknown Curl error

Hey i got small problem getting an unknown curl error from my script "curl_error(): 180 is not a valid cURL handle resource". Im not able to find any recourses about that error so maybe anyone has any experience with this.

Thanks already.

Heres the part which causes the error and exact log: PHP Warning: curl_error(): 180 is not a valid cURL handle resource on

if(curl_error($ch))  
{  
    curl_close($ch);  
    $resp = curl_error($ch); // Thats the line causing the error  
    error_log(date('Y M D h:s:m '). ":  $current error:  "  .curl_error($ch)."\n", 3, '../../usererrors/'.$username.'errors');  
    return $resp;  
}  
From stackoverflow
  • I must admit that the error was caused by calling curl_close before curl_error. So case closed hope someone got some help from this as well :)

How to store short date format to db?

I use Core Data and I want to store this formatted date to db, field type is date, how can I do this?

date formatted: 2010-10-31

I hope I explained my scenario. Sorry for my English. Greetings.

From stackoverflow
  • The real question here is why you would want to do this. It is best to store the NSDate as an NSDate, then apply any view changes you need on the fly with NSDateFormatter.

    However, so I can get some Rep Points, I will answer the question. You can store the pre-formatted date as an NSString, not an NSDate.

Best book for Magento 1.4.0.1

Hi, can any developer tell me the best book of Magento 1.4.0.1 for developer ?

From stackoverflow
  • As 1.4.0.1 is so recent, there are no books available that cover it specifically. The core system remains mostly the same, including the overall architecture, so you should be able to get a good grounding from books written for earlier versions.

    You can find a list of books here: http://www.magentocommerce.com/wiki/general/magento_books

  • Chris is right. 1.4 just recently came out. The bummer about buying books on Magento is that Magento is so frequently changing. You'll really never find yourself being able to have a Magento book stay fully up-to-date for very long. You just need to buy one and work around the udpates.

How to get instance of a service?

HI i am writing a service in wince. In the service i need to create a window. For creating window i need HINSTANCE. I can't get HINSTACE from DllMain> so How can i get the instance of the service?

From stackoverflow
  • Since you are not specifying the version of Windows CE you are using I will answer to the version I am familiar with - Windows CE 6.

    In Windows CE 6 you need to use the UIProxy to display a window in the driver code. Since a service is very similar to a driver I guess that the same method needs to be applied. (I have not tried this though).

    Read Bruce Eitman's blog about the UI Proxy to see how to do it: UI Proxy