Daily Archives

Articles indexed Tuesday June 25 2013

Page 14/20 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • SSIS Script Component, Allow Null values

    - by user2471943
    I have a SSIS package that I am programming and my script component won't allow null column inputs. I have checked the box to keep nulls in the flat file source component. My program is running well until my script component where I get the error "The column has a null value" (super vague, I know). The column currently throwing the error is an "int" valued column and is used for aggregations in my script. I could make the null values 0s or to say "NULL" but I'd prefer to just leave them blank. Any advice on how to handle this problem would be greatly appreciated! Thanks in advance! I am using SQL Server BIDS 2008.

    Read the article

  • nasm infinite loop with FPU

    - by Ben Ishak
    i'm trying to create a small nasm program which do this operation in floating point while(input <= 10^5) do begin input = input * 10 i = i - 1 end the equivilant program in nasm is as following section .data input: resd 1 n10: dd 0x41200000 ; 10 _start: mov eax, 200 ; eax = 200 ; extract eax -> Floating Point IEEE 754 and eax, 0x7f800000 shr eax, 23 sub eax, 127 mov dword [input], eax ; input = eax = 200 mov edx, 0x49742400 ; 10^5 ; %begin mov ecx, 0 ; i = 0 jmp alpha alpha: fld dword [input] cmp [input], edx ; input <= 10^5 jle _while jmp log2 _while: fld dword [n10] ; 10 fld dword [input] ; input fmul st0, st1 ; input * 10 fst dword [input] ; input = input dec ecx ; i = i - 1 jmp alpha the _while loop is iterating infinitely ecx / i gards always the same value = -4194304 (it is sepposed to be 0) and doesn't decrement

    Read the article

  • The backbone router isn't working properly

    - by user2473588
    I'm building a simple backbone app that have 4 routes: home, about, privacy and terms. But after setting the routes I have 3 problems: The "terms" view isn't rendering; When I refresh the #about or the #privacy page, the home view renders after the #about/#privacy view When I hit the back button the home view never renders. For example, if I'm in the #about page, and I hit the back button to the homepage, the about view stays in the page I don't know what I'm doing wrong about the 1st problem. I think that the 2nd and 3rd problem are related with something missing in the home router, but I don't know what is. Here is my code: HTML <section class="feed"> <script id="homeTemplate" type="text/template"> <div class="home"> </div> </script> <script id="termsTemplate" type="text/template"> <div class="terms"> Bla bla bla bla </div> </script> <script id="privacyTemplate" type="text/template"> <div class="privacy"> Bla bla bla bla </div> </script> <script id="aboutTemplate" type="text/template"> <div class="about"> Bla bla bla bla </div> </script> </section> The views app.HomeListView = Backbone.View.extend({ el: '.feed', initialize: function ( initialbooks ) { this.collection = new app.BookList (initialbooks); this.render(); }, render: function() { this.collection.each(function( item ){ this.renderHome( item ); }, this); }, renderHome: function ( item ) { var bookview = new app.BookView ({ model: item }) this.$el.append( bookview.render().el ); } }); app.BookView = Backbone.View.extend ({ tagName: 'div', className: 'home', template: _.template( $( '#homeTemplate' ).html()), render: function() { this.$el.html(this.template(this.model.toJSON())); return this; } }); app.AboutView = Backbone.View.extend({ tagName: 'div', className: 'about', initialize:function () { this.render(); }, template: _.template( $( '#aboutTemplate' ).html()), render: function () { this.$el.html(this.template()); return this; } }); app.PrivacyView = Backbone.View.extend ({ tagName: 'div', className: 'privacy', initialize: function() { this.render(); }, template: _.template( $('#privacyTemplate').html() ), render: function () { this.$el.html(this.template()); return this; } }); app.TermsView = Backbone.View.extend ({ tagName: 'div', className: 'terms', initialize: function () { this.render(); }, template: _.template ( $( '#termsTemplate' ).html() ), render: function () { this.$el.html(this.template()), return this; } }); And the router: var AppRouter = Backbone.Router.extend({ routes: { '' : 'home', 'about' : 'about', 'privacy' : 'privacy', 'terms' : 'terms' }, home: function () { if (!this.homeListView) { this.homeListView = new app.HomeListView(); }; }, about: function () { if (!this.aboutView) { this.aboutView = new app.AboutView(); }; $('.feed').html(this.aboutView.el); }, privacy: function () { if (!this.privacyView) { this.privacyView = new app.PrivacyView(); }; $('.feed').html(this.privacyView.el); }, terms: function () { if (!this.termsView) { this.termsView = new app.TermsView(); }; $('.feed').html(this.termsView.el); } }) app.Router = new AppRouter(); Backbone.history.start(); I'm missing something but I don't know what. Thanks

    Read the article

  • Re-order form fields on submit url

    - by user2521764
    I have a get form with several visible and hidden input fields. When the form is submitted, selected fileds with their values are appended to the url in the order they are placed in the form. Is there a way to re-order the parameters in the url using jQuery? Note that for the reasons of usability, I can not re-order the elements on the form itself. I know it beggs the question "why would I want to do it?", but the reason is that I will be hitting a static page, so the order of the parameters have to be exactly how they are in the static page url. For example, my form returns a url: http://someurl??names=comm&search=all&type=list while the static page has a url: http://someurl??search=all&type=list&names=comm A simplified form example is here: <form id="search_form" method="get" action="http://www.cbif.gc.ca/pls/pp/ppack.jump" > <h2>Choose which names you want to be displayed</h2> <select name="names"> <option value="comm">Common names</option> <option value="sci">Scientific names</option> </select> <h2>Choose how you want to view the results</h2> <input type="radio" name="search" value="all" id="complete" checked = "checked" /> <label for="complete" id="completeLabel">Complete list</label> <br/> <input type="radio" name="p_null" value="house" id="house" /> <label for="house" id="houseLabel">House plants only</label> <br/> <input type="radio" name="p_null" value="illust" id="illustrat" /> <label for="illustrat" id="illustratLabel">Plants with Illustrations</label> <br/> <input type="hidden" name="type" value="list" /> <input type="submit" value="Submit" /> </form> I can get form fields with values using $(#search_form).serializeArray() and massage the array like I want to, but I don't know how to set it back, i.e. modify the serialized values so that the submitted url has my order of parameters. I'm not even sure if this is the right way to go about it, so any pointers would be greatly appreciated.

    Read the article

  • jQuery - deferred versus promise

    - by fletchsod
    What is the difference between Deferred and Promise other than the jQuery versions? What should I use for my need? I only want to call the fooExecute(). I only need the fooStart() and fooEnd() to toggle the html div status for example. //I'm using jQuery v2.0.0 function fooStart() { /* Start Notification */ } function fooEnd() { /* End Notification */ } function fooExecute() { /* Execute the scripts */ } $('#button1').on('click', function() { var deferred1 = $.Deferred(); var promise1 = $.Promise(); deferred1.??? promise1.??? });

    Read the article

  • Twitter Bootstrap: How to make top fixed navbar stay in container and not stretch?

    - by Jryl
    I'm working with Twitter Bootstrap and the regular navbar you see in the guides: http://twitter.github.io/bootstrap/components.html#navbar I don't want the navigation to stretch all the way left or right but stay where I can see both sides just like in the guide. The only difference is it would be fixed to the top. I was wondering, how do I make this become a fixed navbar as if I was using the navbar-fixed-top class?

    Read the article

  • Regarding C typedef struct

    - by Bruce Duncan
    I have multiple instances of typedef struct box so box box1, box box2 etc. The members of the struct are length, width, height etc. typedef struct { int width; int height; } box; box box1; box box2; How can I create a function that operates on all the width members of each box instance? My confusion is how do I pass a pointer to a typedef struct member that works across all instances of box. I know how to pass a pointer to a specific instance member like box1.width but how to pass .width and then do box1.width=value; box2.width=value; box3.width=value; within the function?

    Read the article

  • Running Subprocess from Python

    - by Rohit
    I want to run a cmd exe using a python script. I have the following code: def run_command(command): p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) return p.communicate() then i use: run_command(r"C:\Users\user\Desktop\application\uploader.exe") this returns the option menu where i need to specify additional parameter for the cmd exe to run. So i pass additional parameters for the cmd exe to run. How do i accomplish this. I've looked at subprocess.communicate but i was unable to understand it

    Read the article

  • Better way to implement custom views in a listview with simpleadapter?

    - by jonaz
    I have a value called tags which is a comma separated list of words. I want to put this into nicely designed "tag-buttons". The below works. However the line ((LinearLayout) view).removeAllViews(); seems like an ugly fix for not adding the tags multiple times every time adapter.notifyDataSetChanged(); is called after i load more rows with a setOnScrollListener() Any suggestion to "best practice" here, or at least a more good looking solution? adapter = new SimpleAdapter(activity,data, R.layout.list_transactions, new String[] {"comment", "amount","date","tags","category"}, new int[] { R.id.comment, R.id.amount,R.id.date,R.id.tags_container,R.id.category } ); SimpleAdapter.ViewBinder binder = new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object object, String value) { //Log.d(TAG,"view.toString()= "+ view.toString()); if (view.getId() == R.id.tags_container) { String[] tags = value.split(","); ((LinearLayout) view).removeAllViews(); for (String tag : tags) { View v = createTagView(activity.getLayoutInflater(),tag); ((LinearLayout) view).addView(v); } return true; } return false; } };

    Read the article

  • How can I keep the the logic to translate a ViewModel's values to a Where clause to apply to a linq query out of My Controller?

    - by Mr. Manager
    This same problem keeps cropping up. I have a viewModel that doesn't have any persistent backing. It is just a ViewModel to generate a search input form. I want to build a large where clause from the values the user entered. If the Action Accepts as a parameter SearchViewModel How do I do this without passing my viewModel to my service layer? Service shouldn't know about ViewModels right? Oh and if I serialize it, then it would be a big string and the key/values would be strongly typed. SearchViewModel this is just a snippet. [Display(Name="Address")] public string AddressKeywords { get; set; } /// <summary> /// Gets or sets the census. /// </summary> public string Census { get; set; } /// <summary> /// Gets or sets the lot block sub. /// </summary> public string LotBlockSub { get; set; } /// <summary> /// Gets or sets the owner keywords. /// </summary> [Display(Name="Owner")] public string OwnerKeywords { get; set; } In my controller action I was thinking of something like this. but I would think all this logic doesn't belong in my Controller. ActionResult GetSearchResults(SearchViewModel model){ var query = service.GetAllParcels(); if(model.Census != null){ query = query.Where(x=>x.Census == model.Census); } if (model.OwnerKeywords != null){ query = query.Where(x=>x.Owners == model.OwnerKeywords); } return View(query.ToList()); }

    Read the article

  • Mocking HtmlHelper throws NullReferenceException

    - by Matt Austin
    I know that there are a few questions on StackOverflow on this topic but I haven't been able to get any of the suggestions to work for me. I've been banging my head against this for two days now so its time to ask for help... The following code snippit is a simplified unit test to demonstrate what I'm trying to do, which is basically call RadioButtonFor in the Microsoft.Web.Mvc assembly in a unit test. var model = new SendMessageModel { SendMessageType = SendMessageType.Member }; var vd = new ViewDataDictionary(model); vd.TemplateInfo = new TemplateInfo { HtmlFieldPrefix = string.Empty }; var controllerContext = new ControllerContext(new Mock<HttpContextBase>().Object, new RouteData(), new Mock<ControllerBase>().Object); var viewContext = new Mock<ViewContext>(new object[] { controllerContext, new Mock<IView>().Object, vd, new TempDataDictionary(), new Mock<TextWriter>().Object }); viewContext.Setup(v => v.View).Returns(new Mock<IView>().Object); viewContext.Setup(v => v.ViewData).Returns(vd).Callback(() => {throw new Exception("ViewData extracted");}); viewContext.Setup(v => v.TempData).Returns(new TempDataDictionary()); viewContext.Setup(v => v.Writer).Returns(new Mock<TextWriter>().Object); viewContext.Setup(v => v.RouteData).Returns(new RouteData()); viewContext.Setup(v => v.HttpContext).Returns(new Mock<HttpContextBase>().Object); viewContext.Setup(v => v.Controller).Returns(new Mock<ControllerBase>().Object); viewContext.Setup(v => v.FormContext).Returns(new FormContext()); var mockContainer = new Mock<IViewDataContainer>(); mockContainer.Setup(x => x.ViewData).Returns(vd); var helper = new HtmlHelper<ISendMessageModel>(viewContext.Object, mockContainer.Object, new RouteCollection()); helper.RadioButtonFor(m => m.SendMessageType, "Member", cssClass: "selector"); If I remove the cssClass parameter then the code works ok but fails consistently when adding additional parameters. I've tried every combination of mocking, instantiating concrete types and using fakes that I can think off but I always get a NullReferenceException when I call RadioButtonFor. Any help hugely appreciated!!

    Read the article

  • Website access per client and each client having multiple users Sample Application

    - by windson
    I'm interested in building a web application in .NET that is scalable to multiple Clients and each and every Client has users associated with them. Suppose that my website is xyz.com and I have 3 clients "abc", "klm", "pqr" and I want to give access to features of xyz.com under the link as follows www.xyz.com/abc www.xyz.com/klm www.xyz.com/pqr and Client abc has N users and I want to set 3 roles for every client's user role. Is there any sample application in .NET that support this kind of website access per client having multiple users? And If I use ASP.NET Membership will that be a suitable membership solution or Do I need to opt for any other type of Membership defined by my own or already available in open source market for .NET. Edit: All the clients will have same functionality. I would like to build a generic model for www.xyz.com/{whatever} so that in future if a new client want to register with me he/she just have to give client name and up on adding client name all the features avaiable to exising clients will be applicable.

    Read the article

  • "Cannot find the declaration of element 'beans'. at mvc-dispatcher-servlet.xml", but can when I copy, delete and re-paste?

    - by stevendao
    Running Maven, Eclipse, and Weblogic, when I try to Run As Server onto my local server, I get this error: "Cannot find the declaration of element 'beans'. at mvc-dispatcher-servlet.xml" Then, when I go back into the xml, select all, copy, delete, and paste, error goes away and I'm able to run the web app just fine on the server. Can anyone explain why? <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <context:component-scan base-package="src.srcc.sndao" /> <mvc:annotation-driven /> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix"> <value>/WEB-INF/view/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> </beans>

    Read the article

  • Strange menu issue

    - by Ber53rker
    Just started out with Orchard and trying to just make pages and menus. I'm running into an issue where on my home page my menu shows: Home, Fruit, Vegetable, Carrot. I want it to show just Home, Fruit, Vegetable and when I click the respective item it adds the proper tabs. It DOES do it with Banana. ie: When I click Fruit, it shows Banana in the menu. But it always shows Carrot for some reason! I have the following setup. Navigation -Main Menu --Home --Fruit --Vegetable -Fruit Menu --Banana -Vegetable Menu --Carrot Widgits > Navigation > Main Menu, Fruit Menu, Vegetable Menu (Fruit and Vegetable Menus are in their own respective layers.) Path Examples: /Fruit, /Fruit/Banana, /Vegetable, /Vegetable/Carrot Thanks in advance.

    Read the article

  • MVC Datatables Dialog Not staying where dialog opens

    - by Anthoney Hanks
    I have created a view that displays a datatable with a clickable link that opens a jQuery UI dialog box. The users wanted a search options (8 dropdowns to narrow the search) at top of page, followed by the datatable with the 100 viewable records. If I scroll down the datatable to the bottom viewable record, click the link to open the dialog box. The dialog opens relative to the link clicked, but the focus go back to the top of the page which causes the user to have scroll back down to the dialog box. Ok, I thought I would just set the focus to the dialog box. BUt it is being ignored which make me think that this is something within the MVC realm. I even tried to wrap the focus inside a ready function thinking it would be one of the last things process. When I define the dailog, it is pretty basic. I even tried to set the position attribute, but it did not change the problem. Has someone had this problem and can send me in the right direction? View building the datatable: <table id="navDatatables"> <tbody> @foreach (var detailsVM in Model.DetailsVMs) { <tr> <td class="standardTable"> <a href="#" onclick="return PVE_UseConfig.Options(@detailsVM.ConfigVersionId, @Model.UseConfigModeId);" class="smallLink">Options</a> </td> <td class="standardTable"> <a href="@Url.Content(@detailsVM.ViewerUrl)" target="_blank">@detailsVM.ConfigName</a> </td> <td class="standardTable">@detailsVM.ConfigType</td> <td class="standardTable">@detailsVM.ConfigVersionState</td> <td class="standardTable">@detailsVM.Organization</td> <td class="standardTable">@detailsVM.ProcessSet</td> <td class="standardTable">@detailsVM.ConfigVersionCaption</td> <td class="standardTable">@detailsVM.ConfigId</td> <td class="standardTable">@detailsVM.ConfigVersionId</td> <td class="standardTable">@detailsVM.ConfigOwnerName</td> <td class="standardTable">@detailsVM.ConfigVersionLastModified</td> </tr> } </tbody> </table> Dialog box code: Options: function (configVersionId, useConfigModeId) { var output = '#modalDialog1'; var postData = { configVersionId: configVersionId, useConfigModeId: useConfigModeId }; $('#modalDialog1').dialog("destroy"); $.ajax({ url: PVE_RootUrl + 'UseConfig/Options', type: 'POST', async: false, data: postData, success: function (result) { $(output).html(result); }, error: function (jqXHR, textStatus, errorThrown) { var text = jqXHR.responseText; var from = text.search("<body>") + 6; var to = text.search("</body>") - 7; $(output).html(text.substring(from, to)); } }); $(output).dialog({ title: "Configuration Options", modal: true, height: 550, width: 600, resizable: false, draggable: false }); },

    Read the article

  • Creating a consumer of a Web Service WSDL/SOAP

    - by Azzi
    I am attempting to write a Windows Desktop App (using WCF) that is a consumer of a web service. The application: Sends a SOAP message to a British Government Server to get an authentication token based on the arugments passed Retrieves a response from that server in the form of a string which contains the authentication token. I have a template of the SOAP message from the British Government, and a WSDL file for the service. What I have tried Add a service reference using the WSDL file. I received the following error: URI formats are not supported. Add a Web Reference using the URL of the service. I received the following error: The request failed with HTTP status 405: Method Not Allowed. Send the SOAP request using a POST. The Call to GetResponse() threw a 500 External Server Error. NOTE: I am using VS 2005 WSDL: <?xml version="1.0" encoding="utf-8"?> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/" xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:jms="http://www.openuri.org/2002/04/wsdl/jms/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s1="https://tpvs.hmrc.gov.uk/dpsauthentication" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="https://tpvs.hmrc.gov.uk/dpsauthentication"> <types> <s:schema elementFormDefault="qualified" targetNamespace="https://tpvs.hmrc.gov.uk/dpsauthentication" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns="https://tpvs.hmrc.gov.uk/dpsauthentication"> <s:element name="DPSrequestToken"> <s:complexType> <s:sequence> <s:element name="version" type="s:int"/> <s:element name="vendorID" type="s:string" minOccurs="0"/> </s:sequence> </s:complexType> </s:element> <s:element name="DPSrequestTokenResponse"> <s:complexType> <s:sequence> <s:element name="DPSrequestTokenResult" type="s:string" minOccurs="0"/> </s:sequence> </s:complexType> </s:element> </s:schema> </types> <message name="DPSrequestTokenSoapIn"> <part name="parameters" element="s1:DPSrequestToken"/> </message> <message name="DPSrequestTokenSoapOut"> <part name="parameters" element="s1:DPSrequestTokenResponse"/> </message> <portType name="dpsauthenticationSoap"> <operation name="DPSrequestToken"> <input message="s1:DPSrequestTokenSoapIn"/> <output message="s1:DPSrequestTokenSoapOut"/> </operation> </portType> <binding name="dpsauthenticationSoap" type="s1:dpsauthenticationSoap"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="DPSrequestToken"> <soap:operation soapAction="https://tpvs.hmrc.gov.uk/dpsauthentication/DPSrequestToken" style="document"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="dpsauthentication"> <port name="dpsauthenticationSoap" binding="s1:dpsauthenticationSoap"> <soap:address location="https://dps.ws.hmrc.gov.uk/dpsauthentication/service"/> </port> </service> </definitions> SOAP: <!-- v1.1 30/11/2007 --> <!-- 24/10/2011 - minor change to remove duplicated text from <Envelope> element. No impact on validation, therefore not re-versioned. --> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Header> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:UsernameToken> <wsse:Username>as advised by SDS team</wsse:Username> <wsse:Password>as advised by SDS team</wsse:Password> </wsse:UsernameToken> </wsse:Security> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:DPSrequestToken xmlns:m="https://tpvs.hmrc.gov.uk/dpsauthentication"> <m:version>1</m:version> <m:vendorID>your 4 digit vendorID</m:vendorID> </m:DPSrequestToken> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

    Read the article

  • Dynamic Data Extract Tools

    - by Kevin McGovern
    I've been searching around for a few weeks now for a tool that either is fully built or a direction of something I could build for dynamically extracting data via a web interface. Basically, what I'm looking for is a way to give users a list of all available data objects from our database and then let them pick ones from the list they'd like to view and set parameters then export the results to an excel file. Right now we're doing it purely with SQL statements but we have hundreds of objects so as you might imagine, those statements are really complex and prone to errors. It would be great if there was a tool available to do this or if someone had an idea of an easy way to organize this. Any help would be greatly appreciated. We've looked at BI tools like QlikView and Tableau but that is probably overkill for what we're trying to do. The open-source BI tools we've looked at seemed really primitive in their functionality. The other thing we looked at was MSAS (our DB is SQL Server) but I'd prefer something that was more database-agnostic and lived on a web server instead of on the database.

    Read the article

  • performance of large number calculations in python (python 2.7.3 and .net 4.0)

    - by g36
    There is a lot of general questions about python performance in comparison to other languages. I've got more specific example: There are two simple functions wrote in python an c#, both checking if int number is prime. python: import time def is_prime(n): num =n/2 while num >1: if n % num ==0: return 0 num-=1 return 1 start = time.clock() probably_prime = is_prime(2147483629) elapsed = (time.clock() - start) print 'time : '+str(elapsed) and C#: using System.Diagnostics; public static bool IsPrime(int n) { int num = n/2; while(num >1) { if(n%num ==0) { return false; } num-=1; } return true; } Stopwatch sw = new Stopwatch(); sw.Start(); bool result = Functions.IsPrime(2147483629); sw.Stop(); Console.WriteLine("time: {0}", sw.Elapsed); And times ( which are surprise for me as a begginer in python:)): Python: 121s; c#: 6s Could You explain where does this big diffrence come from ?

    Read the article

  • Selecting a sequence NEXTVAL for multiple rows

    - by stringpoet
    I am building a SQL Server job to pull data from SQL Server into an Oracle database through a linked server. The table I need to populate has a sequence for the name ID, which is my primary key. I'm having trouble figuring out a way to do this simply, without some lengthy code. Here's what I have so far for the SELECT portion (some actual names obfuscated): SELECT (SELECT NEXTVAL FROM OPENQUERY(MYSERVER, 'SELECT ORCL.NAME_SEQNO.NEXTVAL FROM DUAL')), psn.BirthDate, psn.FirstName, psn.MiddleName, psn.LastName, c.REGION_CODE FROM Person psn LEFT JOIN MYSERVER..ORCL.COUNTRY c ON c.COUNTRY_CODE = psn.Country MYSERVER is the linked Oracle server, ORCL is obviously the schema. Person is a local table on the SQL Server database where the query is being executed. When I run this query, I get the same exact value for all records for the NEXTVAL. What I need is for it to generate a new value for each returned record. I found this similar question, with its answers, but am unsure how to apply it to my case (if even possible): Query several NEXTVAL from sequence in one satement

    Read the article

  • Strange Puzzle - Invalid memory access of location

    - by Rob Graeber
    The error message I'm getting consistently is: Invalid memory access of location 0x8 rip=0x10cf4ab28 What I'm doing is making a basic stock backtesting system, that is iterating huge arrays of stocks/historical data across various algorithms, using java + eclipse on the latest Mac Os X. I tracked down the code that seems to be causing it. A method that is used to get the massive arrays of data and is called thousands of times. Nothing is retained so I don't think there is a memory leak. However there seems to be a set limit of around 7000 times I can iterate over it before I get the memory error. The weird thing is that it works perfectly in debug mode. Does anyone know what debug mode does differently in Eclipse? Giving the jvm more memory doesn't help, and it appears to work fine using -xint. And again it works perfectly in debug mode. public static List<Stock> getStockArray(ExchangeType e){ List<Stock> stockArray = new ArrayList<Stock>(); if(e == ExchangeType.ALL){ stockArray.addAll(getStockArray(ExchangeType.NYSE)); stockArray.addAll(getStockArray(ExchangeType.NASDAQ)); }else if(e == ExchangeType.ETF){ stockArray.addAll(etfStockArray); }else if(e == ExchangeType.NYSE){ stockArray.addAll(nyseStockArray); }else if(e == ExchangeType.NASDAQ){ stockArray.addAll(nasdaqStockArray); } return stockArray; } A simple loop like this, iterated over 1000s of times, will cause the memory error. But not in debug mode. for (Stock stock : StockDatabase.getStockArray(ExchangeType.ETF)) { System.out.println(stock.symbol); }

    Read the article

  • How can I set the order of the positive and negative buttons in AlertDialog?

    - by Micah Hainline
    Why I want to do this is another discussion entirely, but I need to figure out the best way to make all my alert dialogs have the positive button on the right side. Note that in version 3.0 and below the buttons normally appear as OK / Cancel and in 4.0 and above it is Cancel / OK. I want to force my application to use Cancel / OK in the simplest way possible. I have a lot of AlertDialogs in the application.

    Read the article

  • SqlDataAdapter.Fill suddenly taking a long time

    - by WraithNath
    I have an application with a central DataTier that can execute a query to a data table using an SQLDataAdapter. None of this code has changed but now all queries are taking at least 10x as long to execute a query returning even one record. The only difference is that I have been using the app in a VM but the issue has started mid way through using the application. eg, the speed issue has not manifested itself from the start of using the VM, rather half way through. Has anyone else had an issue with the SQL Data Adapter taking a long time to fill for no reason? executing the query in Management studio it runs in less than a second. Firewalls are disabled

    Read the article

  • Extending jQuery with jQuery.Extend

    - by Jalpesh P. Vadgama
    We all know that jQuery is a great JavaScript framework. It’s provide lots of functionalities and most used framework in programming world. But sometimes we need a functionality that does not provided by jQuery by default. At that time we need to extend jQuery. We can extend jQuery with jQuery.Extend  Method. You can get complete information from the following link. http://api.jquery.com/jQuery.extend/ It merges the contents of two or more objects together into the first object. More on my personal blog @www.dotnetjalps.com

    Read the article

  • Why Your Firefox 21 Crash ?

    - by Anirudha
    Originally posted on: http://geekswithblogs.net/anirugu/archive/2013/06/25/why-your-firefox-21-crash.aspxEvery new version of Firefox Come with new features. Recently people using Firefox 21 Reported that Their Firefox has crashed after click on X-close button. What is the problem ? Actually Firefox have trouble with “hardware acceleration”. You need to disable it. Try to go to  Tools > options > Browsing > uncheck the hardware acceleration. This is one of the problem in Firefox. If you have any kind of trouble then I recommended you to try https://support.mozilla.org/en-US/questions/new for get official help & support For Firefox

    Read the article

  • Career-Defining Moments

    - by Robz / Fervent Coder
    Originally posted on: http://geekswithblogs.net/robz/archive/2013/06/25/career-defining-moments.aspx Fear holds us back from many things. A little fear is healthy, but don’t let it overwhelm you into missing opportunities. In every career there is a moment when you can either step forward and define yourself, or sit down and regret it later. Why do we hold back: is it fear, constraints, family concerns, or that we simply can't do it? I think in many cases it comes to the unknown, and we are good at fearing the unknown. Some people hold back because they are fearful of what they don’t know. Some hold back because they are fearful of learning new things. Some hold back simply because to take on a new challenge it means they have to give something else up. The phrase sometimes used is “It’s the devil you know versus the one you don’t.” That fear sometimes allows us to miss great opportunities. In many people’s case it is the opportunity to go into business for yourself, to start something that never existed. Most hold back hear for a fear of failing. We’ve all heard the phrase “What would you do if you knew you couldn’t fail?”, which is intended to get people to think about the opportunities they might create. A better term I heard recently on the Ruby Rogues podcast was “What would be worth doing even if you knew you were going to fail?” I think that wording suits the intent better. If you knew (or thought) going in that you were going to fail and you didn’t care, it would open you up to the possibility of paying more attention to the journey and not the outcome. In my case it is a fear of acceptance. I am fearful that I may not learn what I need to learn or may not do a good enough job to be accepted. At the same time that fear drives me and makes me want to leap forward. Some folks would define this as “The Flinch”. I’m learning Ruby and Puppet right now. I have limited experience with both, limited to the degree it scares me some that I don’t know much about either. Okay, it scares me quite a bit! Some people’s defining moment might be going to work for Microsoft. All of you who know me know that I am in love with automation, from low-tech to high-tech automation. So for me, my “mecca” is a little different in that regard. Awhile back I sat down and defined where I wanted my career to go and it had to do more with DevOps, defined as applying developer practices to system administration operations (I could not find this definition when I searched). It’s an area that interests me and why I really want to expand chocolatey into something more awesome. I want to see Windows be as automatable and awesome as other operating systems that are out there. Back to the career-defining moment. Sometimes these moments only come once in a lifetime. The key is to recognize when you are in one of these moments and step back to evaluate it before choosing to dive in head first. So I am about to embark on what I define as one of these “moments.”  On July 1st I will be joining Puppet Labs and working to help make the Windows automation experience rock solid! I’m both scared and excited about the opportunity!

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20  | Next Page >