Monday, February 21, 2011

.NET TransactionScope on Oracle

Hello, we are using DAAB and TransactionScope on Oracle. Our application manage all the connection to only 1 database. This type of implementation it seems to need "Oramts.dll". Is there a way of using your DAAB and TrasnsactionScope without MTS?

Thanks!

From stackoverflow
  • No. The DAAB code has a bunch of calls into stuff that is supported in MTS.

Bind Dictionary to ItemsControl in C#/WPF

Hello,

I'm trying to bind KeyValuePair Elements from a Dictionary to a ItemsControl. My Dictionary has 15 Elements and the following code shows me 15 TextBoxes:

    <WrapPanel Name="PersonsWrapPanel" Grid.Row="0">
            <ItemsControl ItemsSource="{Binding Persons}" >
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel Orientation="Horizontal" Width="auto">
                        </WrapPanel>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                            <TextBox Text="{Binding Value.Text}"></TextBox>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </WrapPanel>

Unfortunately without any TextBox content (which would be Key or Value). Any ideas?

Thanks for any help!

Cheers

From stackoverflow
  • Perhaps try binding directly to the values of the dictionary:

    ItemsSource="{Binding Persons.Values}"
    

    If I am understanding your XAML properly, each object in the dictionary has a field called "Text" to which you are trying to bind. If so and you make the above changes, you will need to change your DataTemplate as well:

    <TextBox Text="{Binding Text}" />
    

    See this article for more info. HTH.

  • I solved it by using this line:

      <TextBox Text="{Binding Value, Mode=OneWay}"></TextBox>
    

    The code on http://www.dev102.com/2008/03/07/binding-a-wpf-control-to-a-dictionary/ doesn't seem to work.

    Thanks for the answer Malcolm!

    Cheers

Graduate Courses on Large Scale Web Applications

I recently came across Erlang, the programming language, and I've become interested in developing large scale real-time browser based web-applications. I'd like to know if there are any graduate courses, anywhere in the US, which will teach me about writing scalable web-aplications or something similar.

From stackoverflow
  • Personally I think you are in the best place right now to learn about "writing scalable web-applications". Nobody is better to learn from than the people who have done it.

    I would just start trying to write a web application and ask questions about area's as you go.

  • Writing scalable web applications, like many things, is a bit of a dark art in some respects. Not all techniques are well documented, and the Internet is very young in terms of powerhouses of servers running applications. You must first understand the theory of distributed application architectures and their problems (bottlenecks, concurrent state). Then apply this to the application platform you are using. In this case Erlang, where alot works out of the box anyway.

    1. Learn the language
    2. Know what you want to build
    3. How have others done similar?
    4. Get Coding

    In terms of scalability ... their is general theory and then application. Different apps will require different approaches which heavily depend on the platform used too.

    The best thing to do is get building and read about the theory as you go along. It will be a steep curve. Also look at case studies.

  • I recommend visiting Highscalability.com.

    They focus on breaking down issues that large-scale websites have had and how they are being solved.

string to hex value

Is there any java utility to convert string to hex value (integer) ?

From stackoverflow
  • Your question is a little ambiguous, I think.

    If you have a hex string (e.g. "ab10"), then you can use

    int i = Integer.valueOf(s, 16).intValue();
    
  • When you have a string starting with 0x or #

    Integer.decode(hexStr);
    

    is the goal

    Or

    Integer.parseInt(hexString, 16);
    
    penguru : This is what i need, thanx.. Integer i = Integer.decode("0xA"); System.out.println(i); output : 10
  • Is this what you are looking for?

    Integer.toHexString(Integer.parseInt(String));
    
  • Try some of the methods of the Integer class:

    Integer.toHexString(Integer.parseInt(myString, 10))
    

    This assumes that your original string is an integer base ten.

Wrapping Web-Services for COM

I have zero experience with COM. I actually never thought, I'll need to do something with COM, thinking it's something that I luckily managed to avoid. Oh, well.

I need to create a wrapper for Web Services, which could be used from COM. I was hoping, that it's a solved problem, but failed to find an easy solution (for example: just generating a wrapper from WSDL).

A sidenote: Apparently, I also can't use .NET Framework (I could solve my problem easily with the help of COMVisible attribute, right?), unless I'll prove, that it's not that hard to install it on hundreds of machines. Proving that seems easier than my other alternatives at the moment. Today is a weird day.

From stackoverflow
  • You can call a Web Service from just about anywhere, including VB6 and COM.

    If you can create an XMLHTTP60 COM object, here's an SO answer that shows you how to use it: What is the best way to consume a web service from VB6?

  • Take a look at Python; it's almost trivial to create a COM server from Python (compared to most of the non-MS languages, at least), and it makes as good a COM client as any other language.

    If your Web service isn't already written, it's also fairly easy to write them in Python as well.

tutorial on database design using dbDesigner or other tool?

Is there any tutorial on how to do a database design using dbDesigner or any other tool.

From stackoverflow

Is Rails enviroment the prerequisite for cruisecontrol.rb

I have no rails enviroment but I want to use cruisecontrol.rb as my Continous Integration enviroment.

After following the instrcution from http://cruisecontrolrb.thoughtworks.com/documentation/getting_started and then

./cruise start

I got the error here: (sorry, but the formatter is better than posting it here directly) http://pastebin.ca/1487868

It seems the CC.rb is doing some data migration/backup work when start up, and I could resolve this by comment out corresponding code :

#cruisecontrolrb / db / migrate / 002_move_custom_files_to_directory_in_user_home.rb         
DATA_ROOT = ARGV[0]
RAILS_ROOT = File.expand_path(".")     
if File.directory? 'projects'          
  #mv 'projects', DATA_ROOT + '/projects'  #comment out this line, it will work perfect fine
else
  mkdir_p DATA_ROOT + '/projects'
end

I debuged a litter bit and foud when above code excuting, the DATA_ROOT and Dir.pwd are ~/.cruise. So

mv 'projects', DATA_ROOT + '/projects' would become 
mv ~/.cruise/projects ~/.cruise/projects which is obvious not correct

What would you recommend to solve this? To redfine DATA_ROOT to what even place I want? Thanks.

From stackoverflow
  • There are several ways around this, the easiest is probably to create a cruise_config.rb file in the root of your project. It should look something like this :

    Project.configure do |project|
      project.rake_task = "spec"
    end
    

    just replace "spec" with whatever rake task you have. if you're not using rake (say you're using ant) you can instead do something like this :

    Project.configure do |project|
      project.build_command = "ant test"
    end
    

    just replace "ant test" with command line command that will return 0 if successful and 1 otherwise. (ant, make, rake, all do this)

    pierr : Jeremy, I was OK with gettting build result. The problem is migrating fail when start up.

iPod Library access in iPhone OS 3.0

One of the new developer features in version 3.0 of the iPhone OS allows users to select music from their own library to listen to within applications via the MPMediaPickerController class.

Is there a way to make the media picker appear in landscape mode for applications that support this device orientation?

From stackoverflow
  • It won't rotate correctly, even if you set shouldAutorotateToInterfaceOrientation. Confirmation of this comes from a blog:

    "I'll make a really long story really short by noting that this little bastard is hardwired for portrait use. I could get it into various stages of landscape, but when the orientation was rotated correctly, the touch inputs and drags weren't. If I could get the sizing right, then the orientation was wrong. And so on. I even cashed in one of my Apple developer tech support incidents looking for a solution (they confirmed my conclusion about the portrait limitation)."

    http://hunter.pairsite.com/blogs/20090628/

  • The MPMediaPickerController class supports portrait mode only. This class does support subclassing. The view hierarchy for this class is private; do not modify the view hierarchy.

Teradata locks - How to know if a table is locked ?

Is there a way to know if a table is locked and what kind of lock is currently on a table? I was hoping for something through the DBC tables in teradata, but I can't find any reference to anything like this. I have normal user access and the DBA is no help. Thanks.

From stackoverflow
  • AFAIK only DBA utilities are available to determine the type of lock on a table.

    With only user-level rights you can do something like the following (from here):

    Lock Table dbName.myTable for Access nowait
    Select * from dbName.myTable;
    

    And according to the master himself (Geoffrey Rommel):

    If the table is locked, you will get error 7423, "Object already locked and NOWAIT. Transaction Aborted."

    Carlos A. Ibarra : I would think you have to use FOR WRITE instead of FOR ACCESS, since FOR ACCESS will succeed even if the table is locked for write.
    Adam Bernier : @Carlos: thank you for adding that info.
    bogertron : This may be getting into the nit picky area, but if you are concerned about performance, you might want to replace the * with (top 1 1). It will prevent a full table retrieval from happening.

AJAXify site

Hello,

I have legitimate reasons to do what I am trying to explain. I have an existing site say abc.com which has regular pages etc. everything written in php. Now I would like to AJAXify the site i.e. when a user clicks on a link, it should fetch the link using AJAX and replace the page contents. This is the easy part and I can achieve it using jQuery get function.

Now the problem comes when the user bookmarks the page. I can use hash tags to specify if the user is on another page, but instead of using javascript to fetch the new page again, is it possible to fetch it directly using PHP when the page is called.

Can you please give me an outline on how to achieve the above. This functionality is similar to what Facebook has.

Thankyou for your time.

From stackoverflow
  • The best way to do this is to have one index.php that loads all other pages based on the URL parts after it. For instance:

    http://www.example.com/index.php/reports/employees/hoursWorked

    In this case index.php will run, it can see what's being requested is is the hours worked report, and load that content. The problem is, if index.php then loads all other content after that using AJAX, the URL in the browser will never change.

    One way around that problem would be to put a "Link to this page" link on every page that contains that form of URL for users to bookmark.

  • Well you can use one of these tools or roll your own. Uses window.location.hash along with other tricks.

  • It's a fairly simply process of (1) Parsing the hash tag, and (2) Loading the content via Ajax as you normally would.

    If you load more content when the user clicks on the page, just be sure to always correctly modify the hash tag to reflect what's on the page.

    Here's a quick example to play around with. Click on a name and note the hash tag. The relevant Javascript looks like this :

    // Go straight to content if it's in the hash.
    $(document).ready(function(){
       load_story_from_hash();
    });
    
    // Call this function whenever user clicks on a hash link
    function set_hash(hash){
       window.location.hash = hash;
       load_story_from_hash()
    }
    
    // Actually load content based on the hash in the URL
    function load_story_from_hash(){
    
       var hash = window.location.hash;
       hash = hash.replace(/^#/, '');
    
       if (hash) {
    
          $('#post_container').load(hash+'.html', {}, function(){
             $.scrollTo('#post_container', 1000);
          });
    
       }
    
    }
    
    Alec Smart : in your example, when i use the back and forward buttons it does not remember the previous state.
  • The answer is no, you can't get the value of the URL hash server side. See How to get Url Hash (#) from server side.

    You'll have to get the hash value client-side and make an extra request.

    Simon Scarfe : This is the crux of the question, that value needs to be retrieved onDocumentReady, and then used to activate the relevant ajax funkiness.
  • jQuery History is my preferred choice. It can be found here: http://www.balupton.com/projects/jquery-history/ Provide cross browser support, binding to hashes, overloading hashes, all the rest.

    There is also an Ajax extension for it called jQuery Ajaxy, allowing it to easily upgrade your webpage into a proper Ajax application without need for server side changes and remaining SEO and JS-Disabled friendly: http://www.balupton.com/projects/jquery-ajaxy/

    This is the solution chosen by such sites as http://wbhomes.com.au/ and http://www.balupton.com

    Overall they are both well documented, supported and feature rich. They've also won a bounty question here http://stackoverflow.com/questions/3205900/how-to-show-ajax-requests-in-url/3276206#3276206

Hiding flash component scrollbars using object/param syntax

Hi all, I'm not sure if this is possible (complete non-flash developer speaking), but we have a 3rd party component that we want to only show a certain topleft hand portion of.

I've tried limiting the size of the HTML object container as:

<object type="application/x-shockwave-flash" width="600" height="415" data="<url>">
    <param name="movie" value="<url>" />
    <param name="wmode" value="transparent" />
    <param name="allowscriptaccess" value="always" />
    <param name="quality" value="high" />
    <param name="flashvars" value="<vars>" />
</object>

So limiting it to 600x415, but this causes horizontal and vertical scrollbars as part of the flash component to appear. Is there any standard way to override this behaviour?

Thanks.

From stackoverflow
  • if the scrollbars are "inside" the flash itself you best bet (if you can't change the flash application) is to make the containing div smaller instead of the actual flash embed, effectively masking out the part you want.

C# reportviewer control export programatically

Hi, does anyone know if you can programatically save a report shown in a reportviewer control in c#?

When a report is shown there are export to buttons and i would like to automate the saving to PDF function.

From stackoverflow

How Do I Change the render behavior of my custom control from being a span

When writing a custom control it always rendered as an HTML span element. How can I change it for example to a div?

From stackoverflow
  • Derive your control from WebControl as follows:

    public class MyCustomControl : WebControl {
        public MyCustomControl() : base(HtmlTextWriterTag.Div) {}
    }
    

    That is, use the base class constructor that accepts the tag to use.

How to connect Calendar control with existing Membership system in ASP.NET?

Hi,

I have a built-in Membership system in ASP.NET and I handle member data with Profiles in web.config.

I would like to add an Event Calendar where a member could add notes to any day he wants but I don't know how to integrate the Calendar control with the existing Membership system.

I can't query a database because I don't handle member login credentials manually, Login control does that for me so I would have to connect the Calendar with the existing ASPNETDB.MDF Membership database but I'm clueless.

From stackoverflow

BindingList memory leak

Hi All

My application uses a custom List that inherits from Bindinglist which is then bound to all the UI controls. The list is a collection of baseobjects which implements INotifyPropertyChanged. I suspected a memory leak and profiled my application using memprofiler which confirmed that that all my lists are never disposed and that they are clinging on because they are subscribed to the propertyChanged eventhandlers of the bindinglist.

Here is the sample of my objects

public abstract class BaseObject:IDataErrorInfo,INotifyPropertyChanged,ICloneable
{
private Guid _Id = Guid.NewGuid();
public virtual Guid ID
{
 get { return this._Id; }
 set { this._Id = value;  this.OnPropertyChange(new 
                           PropertyChangedEventArgs(propertyName)); }
}

[field:NonSerialized]
public virtual event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChange(PropertyChangedEventArgs e)
{
 if (this.PropertyChanged != null) this.PropertyChanged(this, e);
} 
}

[Serializable]
public class BaseList<T> :BindingList<T>,ICloneable where T:BaseObject
{
public new void Add(T item)
{    
 <Custom code>
 base.Add(item);
     }

public new void Remove(T item)
{
 <Custom Code>
 base.Remove(item);
     }
}

Here is the allocation stack from the profiler

[Skipped frame(s)]
mscorlib!System.MulticastDelegate.CombineImpl( Delegate )
mscorlib!System.Delegate.Combine( Delegate, Delegate )
<AppName>.Data!<AppName>.Data.BaseObject.add_PropertyChanged( 
              PropertyChangedEventHandler )

[Skipped frame(s)]
System!System.ComponentModel.BindingList<T>.InsertItem( int, T )
mscorlib!System.Collections.ObjectModel.Collection<T>.Add( T )
<AppName>.Data.BaseList<T>.Add( T ) BaseList.cs
<AppName>.UI.Forms.Form1.GetData() Form1
<AppName>.UI.Forms.Form1.Initialize() Form1
<AppName>.UI.Forms.Form1.RunAsyncComplete() Form1

Can someone help me in getting the lists disposed.

Thanks all

From stackoverflow
  • Henk, you were right. The problem was not with the code I mentioned, instead I have narrowed it down to delegates which are preventing my form from being disposed. I am working on a sample to replicate the problem which I will upload to the site. Thanks

  • Did you get any solution to the problem?

    abatishchev : It should be a comment, not an answer. Please delete your answer and post a comment instead.

Can I use the Windows Mobile 6 SDK to develop Windows Mobile 5 Applications

I would like to develop applications for a scanner running Windows Mobile 5.

The MSDN site says to download the latest SDK (the Windows Mobile 6 Professional SDK). Will this work or should I download an earlier SDK for Windows Mobile 5?

From stackoverflow
  • In short: "Yes".

Extend jquery plugin to check negative numbers

I use a jquery validation plugin and I need to add some extra checking, but I can't edit the main file. How I can do this?

From stackoverflow
  • You can add your own validation methods with addMethod function

    nazmul hasan : need more documentation
    nazmul hasan : Thanks, thank you very much......
  • yes i get the solution just taking this i got the solution ,, greaterThanZero is the class name of field to be checked

    jQuery.validator.addMethod("greaterThanZero", function(value, element) { console.log(element); return this.optional(element) || /^\d*.{0,1}\d+$/.test(value); }, "* Amount must be greater than zero");

shlex alternative for Java

Is there a shlex alternative for Java? I'd like to be able to split quote delimited strings like the shell would process them. For example, if I'd send :

one two "three four"
and perform a split, I'd like to receive the tokens
one
two
three four

From stackoverflow
  • Look at Apache Commons Lang:

    org.apache.commons.lang.text.StrTokenizer should be able to do what you want:

    new StringTokenizer("one two \"three four\"", ' ', '"').getTokenArray();
    

How can I test Apple Push Notification Service without an iPhone?

Is it possible test the Apple Push Notification Services without an iPhone application? (Creating an emulator on windows?)

If isn't, how could I test that? Is there a free sample application compiled to do that?

I created the Server provider, but I need test the functionallity.

From stackoverflow
  • Sorry to say, but you'll need to find some hardware to test this functionality.

    Push notifications are not available in the simulator. They require a provisioning profile from Itunes Connect, and thus are required to be installed on a device. That also means you'll probably have to be accepted into the apple iPhone developer program and pay your $99.

    On the bright side, with the iPhone 0S 3.0 update, you can test this functionality on any device, including the first gen iPhones.

  • The simulator does not do Push Notifications.

    And to push from a server, you have to have device(s) to push to as well as your app on that device.

    The token contains the app identity as well as the device ID.

Experiences with LINQ2xsd ?

I am looking for more advanced alternatives to xsd.exe.

I am just about to start a fairly simple project and decided to try using LINQ2XSD. The project has now been released as open source to CodePlex.

I'm just wondering how many people have attempted to use it, if there are any 'dealbreakers' or critical bugs in there.

I downloaded the project from CodePlex, compiled it and managed to successfully create some classes. The two slightly annoying things that strike me off the bat are :

Archaic class names with 'LocalType' at the end:

  new MyFile.MyOrdersLocalType.MyOrderLocalType.BillingDetailsLocalType();

Needing to specify the type of every attribute in the XSD to avoid the error :

  Xml type 'xdt:anyAtomicType' does not support Clr type 'String'.

I get this even though the attribute was generated in C# as a string object. It just can't put it into the XML document as it is defined as 'xsd:anyAtomicType'.

Those two points are moot though compared to any overall feedback people might have. It seems like there are very few visitors to that CodePlex site which is a shame as it seems to me to be much more useful than LINQ2XML for the projects I'm working on.

See also: Is LINQ2XSD Dead?

From stackoverflow
  • I've tried it and have had excellent results against the NHibernate and Linq To SQL xsd schemas to create statically typed mapping files, and to manipulate them programmatically. This was using the 0.2 alpha release, and it all seemed to work fine. I did rename some of the generated classes.

    Simon_Weaver : the renaming was due to all this 'BillingDetailsLocalType' stuff?

How Much Does Source Code Cost? Range?

I have taken a job selling a customized "online workplace management application."

Our clients' businesses work around the application. Our clients track their time (which is how they get paid), finances and work documents through the application we provide and give their clients access to their interests throught the application. Our clients range from 2 users to 500 users. Each user probably processes 200 files per year and generates a fee for each file in the range of $500-$2500 per file.

The application has been refined over a period of years and has cost around a million to develop.

Does anyone know what range something like this sells for (source code, add-ons such as support and hosting)? I am trying to wrap my head around it as my background is not in software development.

From stackoverflow
  • As chance would have it, Jeff wrote an article about software pricing just 2 days ago. It's mainly about merket segmentation, but you may want to do that as well. Perhaps even more interesting is Joel's piece that Jeff links to.

    All in all, I'd say the gist is that there are no hard and fast rules. It all depends on your market. i.e. how much clients can pay, how much they're willing to pay, how many clients are there, and how unique your product is (or how it differs from competing products in features, quality and price).

    Software pricing isn't really much different from pricing other products, except for two things:

    • Per-unit (variable) cost is very low (for boxed versions) or zero (for internet distribution). This can make it extremely profitable when you manage to sell large volumes (Microsoft), but it also can make it hard to justify the price to customers when you have to spread the high fixed costs over a small volume (try selling custom software to small businesses).
    • There often are competing products that cost nothing.
    Marc Gravell : per-unit cost isn't necessarily zero just because you distribute it on the internet; you still have to host the downloads, maintain the site that handles distribution (as opposed to your product), etc...
    Michael Borgwardt : None of that is really per-unit, except for the actual download bandwidth, which is going to be negligible from most products. If you're actually maxing out the server and have to get a new one I guess you could say it's scaling up with the number of units, but at that point, you'll be talking about millions of downloads, i.e. also negligible per-unit price.
    Moo : Sure, per-unit cost is low or nothing but only when you discount the typically high cost of producing quality software. Software doesn't magically come into existence, there is a value to the effort taken to produce it.
    Michael Borgwardt : @Moo: yes, of course - but those are fixed costs. My point was exactly that software is very different from most other products because there is such a large difference there. Editing to clarify...

Center LI elements in a CSS menu in IE?

I need to center a CSS menu that has an unknown width. I found a solution. By setting the UL tag to display:table or display:inline-table the LI elements can be aligned in the center.

This solution did not work in IE. Is there another solution that will work in IE, with only HTML / CSS?

If you want a good look at my code i've pasted it here.

From stackoverflow
  • How about this? Works for me on IE6, IE7, Firefox.

    Markup:

    <div id='menu-centered'>
        <ul>
            <li><a href="">My first item</a></li>
            <li><a href="">My second item</a></li>
            <li><a href="">My third item</a></li>
            <li><a href="">My fourth item</a></li>
            <li><a href="">My fifth item</a></li>
        </ul>
    </div>
    

    CSS:

    #menu-centered {
        background-color: #0075B8;
        padding: 10px;
        margin: 0;
    }
    
    #menu-centered ul {
        text-align: center;
        padding: 0;
        margin: 0;
    }
    
    #menu-centered li {
        display: inline;
        list-style: none;
        padding: 10px 5px 10px 5px;
    }
    
    #menu-centered a {
        font: normal 12px Arial;
        color: #fff;
        text-decoration: none;
        padding: 5px;
        background: #57a8d6;
    }
    
    #menu-centered a:hover {
        background: #5fb8eb;
    }
    

    The key to the whole thing was basically doing text-align: center; on the <ul> element. You also never really want to do stuff like display: table; - it's just hackish and as you found out doesn't work on all browsers. Since this way avoids floating you also don't need to have the clear element in there, although you could have removed that anyways by adding overflow: auto; to the <ul>. Hope it helps.

  • see how the boxy menu works. you can find it in tahSin's gaRAge. Thanks.

Can Failure to Access the URL in an XML Schema or Document Cause my Application to Fail?

I'm usng this: http://schemas.microsoft.com/cdo/configuration/smtpauthenticate

The schema is down? My software doesn't work anymore. Gives me a message: Can't access to CDO Message. I'm using Framework 1.1 with mail send authentication and failed.

Anyone have solution?

From stackoverflow
  • This is a reference name, not a resolvable URI. It's just used as a string representing some value, and your software doesn't actually fetch anything from there.

    URIs are used as names because they are convenient, but it's often confusing because it appears that there should be something at the other end.

    There should be more inner exceptions detail that explains the cause of the problem; could you post those?

    Try following the instructions here for some possible solutions.

  • Just to be very clear: those things in an XML document that look like a URL, and that you see in:

    xmlns="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
    

    or

    xmlns:cdo="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
    

    Those are not URLs. They do not mean that .NET is going to access a location on the Internet when you are using the document. In particular, it is impossible for one of these things (which are called XML Namespaces, by the way), to be the cause of your problem.

    As lavinio said above, post the complete exception and maybe you'll get some help. You should put a try/catch block around the code having the problem, catch the exception in, for instance, "ex", then post the result of ex.ToString().

double type array use in J2ME

I have use Double type array, it works in Emulator but showing error in mobile, what is the problem??

From stackoverflow
  • What error are you seeing?

  • What handset are You using. To use floating point numbers Your handset needs to support CLDC-1.1

  • make sure the handset that you have provisioned to is capable of cldc 1.1 which is needed for floating point numbers, you can change how the emulator behaves in its settings to represent a cldc 1.0 device if that is what you are building for

How can I determine the memory footprint of a session variable?

Also, web.config - please explain.

<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" 
cookieless="false" timeout="120"/>

We are using inproc mode and we used the 20 session variable in our web application. We need to know each variables Occupying the memory spaces.

From stackoverflow
  • From George Shepherd's ASP.NET FAQ at http://www.syncfusion.com/faq/aspnet/web_c9c.aspx

    36.37 Is there any way to know how much memory is being used by session variables in my application?

    No
    

    However, you can make an educated guess. The number of bytes in your strings, plus the number of bytes taken up by your other session variables (8 for an int, etc.), times the number of concurrent user sessions.

    It follows that your session variables need to be as small as possible. The smaller your session state is, the better the site will scale.

  • You could change your backing store to SQL Server and look at the size of SessionItemShort or SessionItemLong to get an idea of what the serialized size of the data is. Probably not exact, but should be close.

How do I Debug a SingleFileGenerator/ Custom Tool?

I am building a Custom Tool code generator using the Visual Studio SDK and basing it on the SingleFileGenerator example.

My question is how to enter debug mode on this code? I can currently add my custom tool to a file in Visual Studio but it errors out, I'd like to be able to debug this code if possible.

From stackoverflow
  • You need to debug Visual Studio, you can either do it by attaching to a running session (Tools\Attach To Process) or by setting Visual Studio (devenv.exe) to be your startup project of the Custom Tool Project.

Windows Mobile 6 Version Compatibility

Does a CAB file that was developed with the Windows Mobile 6 SDK deploy and run on Windows Mobile 6.1 and 6.5?

From stackoverflow
  • Yes.

    In fact if you don't use any new WM6 API's, it will also install and run on WM5.

  • Applications written for WinMo 6.0 will run on 6.1 (and 6.5).

    As for the CAB file itself, it depends on what information was given in the INF file used when generating it. The CEDevice section has VersionMin and VersionMax fields that could be used to narrow the deployment scope to just WinMo 6.0 if desired.

    The default version settings in a Smart Device CAB project in Studio, however, is broad enough to allow both.

ASP.net and CustomModelBinder and a prefix

With the default ModelBinder and its attribute Bind we can set a prefix like this:

public ActionResult Save([Bind(Prefix="test")] Person p)) {

}

I have a CustomModelBinderAttribute which returns a bespoke ModelBinder:

public ActionResult Save([PersonBinderAttribute(Prefix="test2")] Person p)) {

}

How do I access the value of Prefix from within my bespoke model binder?

From stackoverflow
  • I don't believe you can. I'd declare the prefix as a constant at the top of the Controller and just use that.

    private const string c_prefix = "test2";
    public ActionResult Save([PersonBinderAttribute(Prefix=c_prefix)] Person p)) {
        var prefix = c_prefix;
    }
    

    It is my understanding that anything you declare in the Attribute can only be used by the Attribute.

    ListenToRick : I can access the value in the controller! Its within the modelbinder I was stumped with. Its fairly easy to implement however - just add a prefix property to PersonBinderAttribute and then pass the value to the modelbinder as its created - however I was hoping that the framework natively supported prefix annotations for customer binders. It doesnt appear to.
    kim3er : I see where you are coming from. I actually did something similar yesterday with ActionFilterAttribute's, but didn't make the connection with your question.

get the position of a value in a column

How do I get the position of a given value inside a table column. I need to get the column number.

From stackoverflow
  • In psuedo-code:

    • For each through the column column collection in the result set.
    • When you find the value, note the index number

    This assumes one row only.

    You can't do this in T-SQL: only a client language such as .net or Java

  • One option is to query the ColID column from syscolumns for your table [ select [name],[colid] from dbo.syscolumns where [id] = object_id('tablename') ]. Note that I'm not sure if this is guaranteed to be sequential or if gaps could appear if a column is dropped.

TSQL Features in SQL 2008 Vs SQL 2005

What are the advanced Features With SQL2008 over SQL2005 Particularly with TSQL

From stackoverflow
  • The big one for me, although it's not really T-SQL related, is intellisense. About time too :)

    As for the language...

    T-SQL finally got shortcut assignment in 2008:

    SET @var *= 1.18
    

    The MERGE statement allows all sorts of modification goodness, based on the results of joining tables together.

    There are a bunch of GROUP BY enhancements, like GROUPING SETS, and operations on cubes.

    There are new datatypes to play with

    • hierarchyid, useful in self-referencing datasets
    • date and time can be treated separately
    • geography and geometry, for GIS systems and other geographical applications

    There are a few others too. See the official new features page for more.

  • Hi

    There are new features like-

    • Compound Assignment Operators i.e. +=, -= etc.
    • Increased size support for user defined data types.
    • Four new date and time data types.

    It is all covered here - http://technet.microsoft.com/en-us/library/cc721270.aspx

    cheers

  • There is Standard way to insert many rows with single INSERT statement:

    INSERT INTO Tab VALUES (...,...,...), (...,...,...), ... (...,...,...)

AIR: sync gui with data-base?

I am going to be building an AIR application that shows a list (about 1-25 rows of data) from a data-base. The data-base is on the web. I want the list to be as accurate as possible, meaning as soon as the data-base data changes, the list displayed in the app should update asap. I do not know of anyway that the air application could be notified when there is a change, I am thinking I am going to have to poll the data-base at certain intervals to keep an up to date list. So my question is, first is there any way to NOT have to keep checking the data-base? or if I do keep have to keep checking the data-base what is a reasonable interval to do that at?

Thanks.

From stackoverflow
  • What you're talking about is "push" and there are ways to do it, but they're very complicated and probably not worth it for what you're talking about. If you're so inclined, you can check out Comet and it's associated technologies.

    I would recommend just polling every 30 seconds. The poll interval really depends on the data though. If it's lifetime home runs, then 30 seconds is a bit much, if it's a chat client or something, that's probably not enough.

IE: Toolbar vs Explorer Bar

I created an IE Toolbar via C#. When I go to IE 8, I see my creation listed under View > Toolbars as I expected. But it also appears under View > Explorer Bars I don't think this is a good thing. The Google Toolbar, for example, appears only under Toolbars. Thanks for whatever help anyone can give.

From stackoverflow
  • You need to register your object only in the places that you want it to appear. I'm willing to bet that you built your toolbar off someone else's demo, so you'll need to adjust the demo to match your goals.

    http://www.codeproject.com/csharp/dotnetbandobjects.asp

    : Thank you! Btw, I hope you aren't speaking of building on someone's demo as a bad thing. Thanks again!

inline editing with jquery

Hi,

Are there any guidelines on doing 'inline' editing with jqeury?

I know I am not using the correct term here, but basically you click on a some text and dynamically the area changes to an editable input box with a submit button.

Is there any built in capabilities with jquery?

From stackoverflow
  • jQuery has nothing built-in as far as I know, but check out Jeditable, which is a jQuery plugin.

  • You can do something like this:

    <input type="text" value="someText" id="editableText" class="hideBorder"/>
    
    $('#editableText').toggle(function() {
                 $(this).removeClass('hideBorder');
              }, function() {
                 $(this).addClass('hideBorder');
              });
    
    .hideBorder {
     border: 0;
    }
    

How do I set the selected value in an ASP.NET Drop Down List?

I'm using an ASP.NET dropdown. I want to set the selected element using an ID (Id) which is stored in the DataValue field.

ddlTest.DataValueField = "Id";    
ddlTest.DataTextField = "Name";
ddlTest.DataSource = searchResultList;
ddlTest.DataBind();

But all I can see is the SelectedIndex property which isn't the correct thing. How do I set by value?

From stackoverflow
  • After it's bound you can set the SelectedValue property to the correct id.

  • If you need the text of the selected item then you can use

    dropdwonlistID.SelectedItem.Value // selecting value of the selected item
    dropdwonlistID.SelectedItem.Text // selecting displayed text of the selected item
    
  • ddlTest.selectedValue = [whatever value you want to set];