Daily Archives

Articles indexed Friday April 2 2010

Page 31/105 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • calculate period between two monthcalender in C#

    - by Hashim Al-Arab
    I have two monthcalender in C# win application , and I need to calculate the period between then. I need how many day between two or three month or also years I need how many month between tow different years. When I use : monthcalender.selectstart.month; this command just calculate the different between months in same year, but when move to next year the value be negative. and same for days, I use : monthcalender.selectstart.dayofyear;

    Read the article

  • SQL Server Replication Agent priority

    - by Wikser
    Every hour a server replicates SQL server data with some external web server. During this time, which takes about 2-5minutes, the database seriously slows down. Colleagues, which work with the front end applications of that on another terminal server, even regularly start complaining. The databases are also synchroniously mirrored (via SQLServer mirroring, no replication) to a third server. Note that 99% of the data is replicated outgoing, so the server should rarely need to update its data. As the (merge and transactional) replication tasks are not time-critical, I would like to reduce their priority or somehow slow them down, so they don't affect the database performance that much. How would you implement that?

    Read the article

  • Getting Correct Edition of Office 2007 from Serial Key

    - by Lloyd Sparkes
    I have been asked by a Client to refresh one of their Machines. To do this i managed to get Windows XP Setup to run in Repair mode, and while in setup i ran a serial key grabber, which grabbed the key for Office 2007 The only thing is that the key grabber didnt tell me what edition of Office 2007 was installed. I have aqquired a number of ISO's for the different editions (Home & Student, Standard, Professional, Ultimate) but the key doesnt work in any of them. Is there a way to get the edition from the Serial Key, or is there a generic ISO that will install any edition depending on the Serial Key?

    Read the article

  • Can I create a variable with JavaScript that PHP can recognize?

    - by zeckdude
    I have a series of PHP statements that I only want to run if javaScript is enabled. if($js_enabled == 'yes') { //Run a series of PHP statements } My problem is that I want to create that $js_enabled variable with javaScript. Therefore, if javaScript is enabled, the variable will be created and the PHP statements will be run, but if javaScript is not enabled, the variable will never be created and the PHP statements will not run. How can I create a variable with JavaScript that PHP can recognize?

    Read the article

  • What type of data is this JavaScript code!?

    - by SolidSnakeGTI
    Hello, Well, I'm completely new to JavaScript. Can you please tell me what type of data is this JavaScript code: var options = { sourceLanguage: 'en', destinationLanguage: ['hi', 'bn', 'fa', 'gu', 'kn', 'ml', 'mr', 'ne', 'pa', 'ta','te','ur'], shortcutKey: 'ctrl+g', transliterationEnabled: true }; I've reviewed JavaScript arrays, but it doesn't seem to be a traditional array. Still don't know if it's some kind of arrays or another data type!! Additionally, is there any way to set individual elements to that data type such as setting array elements individually. Thanks in advance

    Read the article

  • firefox: getting access to the list of tabs/windows to restore on startup

    - by robb
    Sometimes ffox fails to restore the previously open tabs/windows. This might be happening when some of the urls to be opened are no longer reachable (e.g. behind a vpn) or after the underlying OS (Windows) has been forcibly restarted (e.g. to complete an automated patch installation). Anyway, after restarting, can this list of urls be recovered somehow? Say for example, I was daft enough to have clicked on "start new session". Can I still get access to the old list of open urls? There is the browser history of course, but it contains a lot of stuff - the urls that were open when ffox last exited are not obvious. It would be neat if they were marked in some way - tagged for example. .robb

    Read the article

  • When to release a class with delegates

    - by Stefan Mayr
    A quick question to delegates. Lets say, CLASSA has a delegate defined: @protocol MyDelegate -(void) didFinishUploading; @end In CLASSB I create an instance of CLASS A -(void) doPost { CLASSA *uploader = [[CLASSA alloc] init]; uploader.delegate = self; // this means CLASSB has to implement the delegate uploader.post; } and also in CLASSB: -(void)didFinishUploding { } So when do I have to release the uploader? Because when I release it in doPost, it is not valid anymore in didFinishUploading. Thanks

    Read the article

  • JQuery, bind same function to 3 different textbox's keyup event

    - by Miral
    I have 3 textboxes and on the keyup event for all the 3 I want to call the same function? In the below code, I am tring to bind 'keyup' event to 'CalculateTotalOnKeyUpEvent' function to textbox named 'compensation', but it doesn't work $("#compensation") .bind("keyup",CalculateTotalOnKeyUpEvent(keyupEvent)); function CalculateTotalOnKeyUpEvent(keyupEvent) { var keyCode = keyupEvent.keyCode; if (KeyStrokeAllowdToCalculateRefund(keyCode)) { CalculateTotalRefund(); } }; Thanks..

    Read the article

  • algorithm for python itertools.permutations

    - by zaharpopov
    Can someone please explain algorithm for itertools.permutations routine in Python standard lib 2.6? I see its code in the documentation but don't undestand why it work? Thanks Code is: def permutations(iterable, r=None): # permutations('ABCD', 2) --> AB AC AD BA BC BD CA CB CD DA DB DC # permutations(range(3)) --> 012 021 102 120 201 210 pool = tuple(iterable) n = len(pool) r = n if r is None else r if r > n: return indices = range(n) cycles = range(n, n-r, -1) yield tuple(pool[i] for i in indices[:r]) while n: for i in reversed(range(r)): cycles[i] -= 1 if cycles[i] == 0: indices[i:] = indices[i+1:] + indices[i:i+1] cycles[i] = n - i else: j = cycles[i] indices[i], indices[-j] = indices[-j], indices[i] yield tuple(pool[i] for i in indices[:r]) break else: return

    Read the article

  • Optional Parameters and Named Arguments in C# 4 (and a cool scenario w/ ASP.NET MVC 2)

    - by ScottGu
    [In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu] This is the seventeenth in a series of blog posts I’m doing on the upcoming VS 2010 and .NET 4 release. Today’s post covers two new language feature being added to C# 4.0 – optional parameters and named arguments – as well as a cool way you can take advantage of optional parameters (both in VB and C#) with ASP.NET MVC 2. Optional Parameters in C# 4.0 C# 4.0 now supports using optional parameters with methods, constructors, and indexers (note: VB has supported optional parameters for awhile). Parameters are optional when a default value is specified as part of a declaration.  For example, the method below takes two parameters – a “category” string parameter, and a “pageIndex” integer parameter.  The “pageIndex” parameter has a default value of 0, and as such is an optional parameter: When calling the above method we can explicitly pass two parameters to it: Or we can omit passing the second optional parameter – in which case the default value of 0 will be passed:   Note that VS 2010’s Intellisense indicates when a parameter is optional, as well as what its default value is when statement completion is displayed: Named Arguments and Optional Parameters in C# 4.0 C# 4.0 also now supports the concept of “named arguments”.  This allows you to explicitly name an argument you are passing to a method – instead of just identifying it by argument position.  For example, I could write the code below to explicitly identify the second argument passed to the GetProductsByCategory method by name (making its usage a little more explicit): Named arguments come in very useful when a method supports multiple optional parameters, and you want to specify which arguments you are passing.  For example, below we have a method DoSomething that takes two optional parameters: We could use named arguments to call the above method in any of the below ways: Because both parameters are optional, in cases where only one (or zero) parameters is specified then the default value for any non-specified arguments is passed. ASP.NET MVC 2 and Optional Parameters One nice usage scenario where we can now take advantage of the optional parameter support of VB and C# is with ASP.NET MVC 2’s input binding support to Action methods on Controller classes. For example, consider a scenario where we want to map URLs like “Products/Browse/Beverages” or “Products/Browse/Deserts” to a controller action method.  We could do this by writing a URL routing rule that maps the URLs to a method like so: We could then optionally use a “page” querystring value to indicate whether or not the results displayed by the Browse method should be paged – and if so which page of the results should be displayed.  For example: /Products/Browse/Beverages?page=2. With ASP.NET MVC 1 you would typically handle this scenario by adding a “page” parameter to the action method and make it a nullable int (which means it will be null if the “page” querystring value is not present).  You could then write code like below to convert the nullable int to an int – and assign it a default value if it was not present in the querystring: With ASP.NET MVC 2 you can now take advantage of the optional parameter support in VB and C# to express this behavior more concisely and clearly.  Simply declare the action method parameter as an optional parameter with a default value: C# VB If the “page” value is present in the querystring (e.g. /Products/Browse/Beverages?page=22) then it will be passed to the action method as an integer.  If the “page” value is not in the querystring (e.g. /Products/Browse/Beverages) then the default value of 0 will be passed to the action method.  This makes the code a little more concise and readable. Summary There are a bunch of great new language features coming to both C# and VB with VS 2010.  The above two features (optional parameters and named parameters) are but two of them.  I’ll blog about more in the weeks and months ahead. If you are looking for a good book that summarizes all the language features in C# (including C# 4.0), as well provides a nice summary of the core .NET class libraries, you might also want to check out the newly released C# 4.0 in a Nutshell book from O’Reilly: It does a very nice job of packing a lot of content in an easy to search and find samples format. Hope this helps, Scott

    Read the article

  • NSMutableObject from existing custom class

    - by A.S.
    Hello there. I have an existing class that has methods to deserialise from XML in my code. Now I need to create correct CoreData model from that class. It's objects will be created not only from CoreData storage but also by deserializing XML (somehow like instance->title = [[NSString stringWithUTF8String: (const char *)subNode->children->content] retain; ) without saving to CoreData, and sometimes I need to save it. What is the correct steps to modify existing class to do that except of adding CoreData framework and making my class an NSManagedObject instead of NSObject? Class sample: @interface TSTSong : NSManagedObject<NTSerializableObject> { NSString *identifier; NSString *title; float length; NSURL *previewURL; NSString *author; NSURL *coverURL; NSString *appStoreId; BOOL isPurchased; NSURL *bannerURL; NSDecimalNumber *priceValue; NSLocale *priceLocale; } P.S. I'm noob, so I'f I'm doing smth. wrong - please let me know. Sorry for my english.

    Read the article

  • How to use WSDL2Java generated files?

    - by vikasde
    I generated the .java files using wsdl2java found in axis2-1.5. Now it generated the files in this folder structure: src/net/mycompany/www/services/ The files in the services folder are: SessionIntegrationStub and SessionIntegrationCallbackHandler. I would like to consume the webservice now. I added the net folder to the CLASSPATH environment variable. My java file now imports the webservice using: import net.mycompany.www.services; public class test { public static void main(String[] args) { SessionIntegrationStub stub = new SessionIntegrationStub(); System.out.println(stub.getSessionIntegration("test")); } } Now when I try to compile this using: javac test.java I get: package net.mycompany.www does not exist. Any idea?

    Read the article

  • What language has the longest "Hello world" program?

    - by Kip
    In most scripting languages, a "Hello world!" application is very short: print "Hello world" In C++, it is a little more complicated, requiring at least 46 non-whitespace characters: #include <cstdio> int main() { puts("Hello world"); } Java, at 75 non-whitespace characters, is even more verbose: class A { public static void main(String[] args) { System.out.print("Hello world"); } } Are there any languages that require even more non-whitespace characters than Java? Which language requires the most? Notes: I'm asking about the length of the shortest possible "hello world" application in a given language. A newline after "Hello world" is not required. I'm not counting whitespace, but I know there is some language that uses only whitespace characters. If you use that one you can count the whitespace characters.

    Read the article

  • Model-binding an object from the repository by several keys

    - by Anton
    Suppose the following route: {region}/{storehouse}/{controller}/{action} These two parameters region and storehouse altogether identify a single entity - a Storehouse. Thus, a bunch of controllers are being called in the context of some storehouse. And I'd like to write actions like this: public ActionResult SomeAction(Storehouse storehouse, ...) Here I can read your thoughts: "Write custom model binder, man". I do. However, the question is How to avoid magic strings within custom model binder? Here is my current code: public class StorehouseModelBinder : IModelBinder { readonly IStorehouseRepository repository; public StorehouseModelBinder(IStorehouseRepository repository) { this.repository = repository; } public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { var region = bindingContext.ValueProvider.GetValue("region").AttemptedValue; var storehouse = bindingContext.ValueProvider.GetValue("storehouse").AttemptedValue; return repository.GetByKey(region, storehouse); } } If there was a single key, bindingContext.ModelName could be used... Probably, there is another way to supply all the actions with a Storehouse object, i.e. declaring it as a property of the controller and populating it in the Controller.Initialize.

    Read the article

  • how to clear the 'double right click ' on google-map-v3..

    - by zjm1126
    this is my code, and I can't remove the mousedown eventlistener : //*********** double right click ********/ var c =0 ; function time(event){ if(event.button == 2){ c++; setTimeout(cc, 600); } if (c >1){ alert('ok i get it') } } //$('#map_canvas')[0].mousedown(time); $('#map_canvas')[0].addEventListener('mousedown', time, false); //$("map_canvas").unbind() //$('map_canvas')[0].onmousedown=function(){};//this can't be clear the event $('map_canvas')[0].removeEventListener('mousedown', time, false); function cc(){ c=0; } //*********** double right click ********/

    Read the article

  • LaTeX book class: Twosided document with wrong margins

    - by fgysin
    I am trying to write my thesis in latex... Cannot get the layout straight though :? I'm using the following document class: \documentclass[11pt,a4paper,twoside,openright]{book} My problem is: on the odd numbered pages there is a big margin right, and a small margin left - it should be the other way round... (for binding & stuff) I am a little puzzled by this - am I just to stupid to see the obvious? The odd page numbers appear on the 'right' page of a bound document, so there needs to be a larger margin left for bindin. Right? Why does LaTeX not behave like this? Here is the full code to produce a small Tex file that shows my problem: \documentclass[11pt,a4paper,twoside,openright]{book} \begin{document} \chapter{blah} Lorem ipsum ius et accumsan tractatos, aliquip deterruisset cu usu. Ea soleat eirmod nostrud eum, est ceteros similique ad, at mea tempor petentium. At decore neglegentur quo, ea ius doming dictas facilis, duo ut porro nostrum suavitate. \end{document}

    Read the article

  • OnContextMenu() not working in view class

    - by Anu
    Hi, i have a popup menu for contextmenu.And i wrote the function for each menu in CMainframe. I have OnContextMenu() in each view class and in one dialog class.Its works fine in Dialog class.But not in View class.Codings are below: CMainframe funciton: void CMainFrame::OnUpdateFptrend(CCmdUI* pCmdUI) { ((CMainFrame *)AfxGetMainWnd())->SendMessage(WM_COMMAND,ID_TRENDVIEW,NULL); } void CMainFrame::OnUpdateFptuning(CCmdUI* pCmdUI) { ((CMainFrame *)AfxGetMainWnd())->SendMessageWM_COMMAND,ID_TUNINGVIEW,NULL); } Dialog class Contextmenu: void CFacePlate::OnContextMenu(CWnd* pWnd, CPoint point) { CMenu mnuPopup; mnuPopup.LoadMenu(IDR_FPMENU); CRect rBarRect; rBarRect.left = rBarRect.top = 0; rBarRect.right = 1000;rBarRect.bottom = 300; CMenu *mnuPopupMenu = mnuPopup.GetSubMenu(0); ASSERT(mnuPopupMenu); if( rBarRect.PtInRect(point) ) mnuPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this); } View class: void CGroupView::OnContextMenu(CWnd* pWnd, CPoint point) { CMenu mnuPopup; mnuPopup.LoadMenu(IDR_FPMENU); CRect rBarRect; rBarRect.left = rBarRect.top = 0; rBarRect.right = 1150;rBarRect.bottom = 390; CMenu *mnuPopupMenu = mnuPopup.GetSubMenu(0); ASSERT(mnuPopupMenu); if( rBarRect.PtInRect(point) ) mnuPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this); } When i press popup menu from Faceplate(Dialogclass),it goes to Mainframe function.At the same time when i press menu from any view class,it doesnot go to Mainframe function.Why its like that?

    Read the article

  • Eclipse, the AVR Plugin, and Arduino

    - by bitrex
    I'm attempting to compile Arduino code in the Eclipse IDE using WinAVR and the AVR IDE plugin, and I'm running into one major stumbling block - when I try to compile the code I get the following error: /usr/bin/sh: g++: command not found make: *** [main.o] Error 127 Yeah, I bet not...I'm using Windows Vista. I have the paths to WinAVR's avr-g++ all set correctly in the preferences tab, does anyone know why it might be doing this?

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >