Search Results

Search found 868 results on 35 pages for 'mad coder'.

Page 29/35 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • How to get faster graphics in KVM? VNC is painfully slow with Haiku OS guest, Spice won't install and SDL doesn't work

    - by Don Quixote
    I've been coming up to speed on the Haiku operating system, an Open Source clone of BeOS 5 Pro. I'm using an Apple MacBook Pro as my development machine. Apple's BootCamp BIOS does not support more than four partitions on the internal hard drive. While I can set up extended and logical partitions, doing so will prevent any of the installed operating systems from booting. To run Haiku directly on the iron, I boot it off a USB stick. Using external storage is also helpful because I am perpetually out of filesystem space. While VirtualBox is documented to allow access to physical drives, I could not actually get it to work. Also VirtualBox can only use one of the host CPU's cores. While VB guests can be configured for more than one CPU, they are only emulated. A full build of the Haiku OS takes 4.5 under VB. I had the hope of reducing build times by using KVM instead, but it's not working nearly as well as VirtualBox did. The Linux Kernel Virtual Machine is broken in all manner of fundamental ways as seen from Haiku. But I'm a coder; maybe I could contribute to fixing some of those problems. The first problem I've got is that Haiku's video in virt-manager is quite painfully slow. When I drag Haiku windows around the desktop, they lag quite far behind where my mouse is. It's quite difficult to move a window to a precise position on the screen. Just imagine that the mouse was connected to the window title bar with a really stretchy spring. Also Haiku's mouse lags quite far behind where I have moved it. I found lots of Personal Package Archives that enable Spice from QEMU / KVM at the Ubuntu Personal Package Arhives. I tried a few of the PPAs but none of them worked; with one of them, the command "add-apt-repository" crashed with a traceback. There is a Wiki page about Spice, but it says that it only works on 64-bit. My Early 2006 MacBook Pro is 32-bit. Its Apple Model Identifier is MacBookPro1,1; these use Core Duos NOT Core 2 Duos. I don't mind building a source deb for 32-bit if I can expect it to work. Is there some reason that Spice should be 64-bit only? Does it need features of the x86_64 Instruction Set Architecture that x86 does not have? When I try using SDL from virt-manager, the configuration for Local SDL Window says "Xauth: /home/mike/.Xauthority". When I try to start my guest, virt-manager emits an error. When I Googled the error message, the usual solution was to make ~/.Xauthority readible. However, .Xauthorty does not exist in my home directory. Instead I have a $XAUTHORITY environment variable. There is no way to configure SDL in virt-manager to use $XAUTHORITY instead of ~/.Xauthority. Neither does it work to copy the value of $XAUTHORITY into the file. I am ready to scream, because I've been five fscking days trying to make KVM work for Haiku development. There is a whole lot more that is broken than the slow video. All I really want to do for now is speed up my full builds of Haiku by using "jam -j2" to use both cores in my CPU. I may try Xen next, but the last time I monkeyed with Xen it was far, far more broken than I am finding KVM to be. Just for now, I would be satisfied if there were some way to use my USB stick as a drive in VirtualBox. VB does allow me to configure /dev/sdb as a drive, but it always causes a fatal error when I try to launch the guest. Thank You For Any Advice You Can Give Me. -

    Read the article

  • Make your TSQL easier to read during a presentation

    - by Jonathan Allen
    SQL Server Management Studio 2012 has some neat settings that you can use to help your presentations at a SQL event better for the attendees if you are willing to spend a few minutes making some settings changes. Historically, I have been reluctant to make changes to my SSMS settings as it is such a tedious process and it’s not 100% clear that what you think you are changing is actually what gets changed. With SSMS 2012 this has become a lot easier and a lot less risky. In any session that involves TSQL there is a trade off between the speaker having all the code on screen and the attendees being able to read any of what is on screen. You (the speaker) might be able to read this when you are working on the code but plenty of your audience wont be able to make head or tail of it. SSMS 2012 has a zoom facility that can help: but don’t go nuts … Having the font too big means you will be scrolling a lot and the code will again be rendered unreadable. There is more though but you need to take a deep breath and open the Tools menu and delve into the SSMS options. In previous versions of SSMS this is a deep, dark and scary place where changing values can be obscure and sometimes catastrophic to the UI when you get back to the code editor. First things first, we set out as a good DBA and save our current (and presumably acceptable) SSMS configuration. From the import and Export Settings you can set up a file to hold all of the settings that you currently have. The wizard will open and ask you to pick an option. This time around choose to export settings. hit next and next again and then name your settings profile in the final step of the wizard and then click Finish. Once this is done then you can change whatever you like and always get back to this configuration in a couple of clicks. So what can you change to make for a good experience? Well there are plenty of things that can be altered but don’t go too mad and change too many things without taking a look at the results for every item on the list above you can change font, size, weight, colour, background colour etc. etc. but consider what you are trying to achieve and take it slowly. I have seen presenters with their settings set to have a yellow highlight and black font rather than the default pale blue background and slightly darker font so to achieve that select Text Editor and then select “Selected Text” in the Display Items listbox. As you change things the Sample area give you an idea of what effect you are going to have. Black and yellow is the colour combination with the highest contrast – that’s why bees and wasps# are that colour. What next? how about increasing the default font for your demo scripts? This means that any script you open and any new ones that you start will take on this font. No more zooming (or forgetting to) in the middle of sessions. now don’t forget to save this profile – follow the same steps as above but give the profile a different name, something like PresentationBigFontHighContrast might be appropriate. Once you are done making changes, export the settings once more and then go into the Import Export wizard and import settings from the first profile you created. Everything will be back to normal. Now making changes to suit your environment can be done very easily and with confidence. * – and warning tape and safety signs and so forth – Health and Safety officers simply copy nature!

    Read the article

  • C# Dev Challenge Part 1 of n &ndash; Beginner Edition

    - by mbcrump
    I developed this challenge to test one’s knowledge of C Sharp. I am planning on creating several challenges with different skill sets, so don’t get mad if this challenge doesn’t well challenge you... I noticed that most people like short quizzes so this one only contains 5 questions. All of the challenges are clear and concise of what I am asking you to do. No smoke and mirrors here, meaning that none of the code has syntax errors. The purpose of this exercise is to test several OOP concepts and see how much of the C# language you really know. Question #1 – Lets start off Easy… Will the following code snippet compile successfully? What does this question test? - Can this compile without a namespace? Do you have to have an entry point of “static void Main()”? class Test { static int Main() { System.Console.WriteLine("Developer Challenge"); return 0; } } Answer (select text in box below): Yes, it will compile successfully. Question #2 – What is the value of the Console.WriteLine statements? What does this question test? – Do I understand reference types/value types? If a variable is declared with the @ symbol and its not a reserved keyword does the application compile successfully? using System; internal struct MyStruct { public int Value; } internal class MyClass { public int Value; } class Test { static void Main() { MyStruct @struct1 = new MyStruct(); MyStruct @struct2 = @struct1; @struct2.Value = 100; MyClass @ref1 = new MyClass(); MyClass @ref2 = @ref1; @ref2.Value = 100; Console.WriteLine("Value Type: {0} {1}", @struct1.Value, @struct2.Value); Console.WriteLine("Reference Type: {0} {1}", @ref1.Value, @ref2.Value); } } Answer (select text in box below): Value Type: 0 100 Reference Type: 100 100 Question #3 – What is the value of the Console.WriteLine statements? What does this question test? – Can 2 objects reference the same point in memory? using System; class Test { static void Main() { string s1 = "Testing2"; string t1 = s1; Console.WriteLine(s1 == t1); Console.WriteLine((object)s1 == (object)t1); } } Answer (select text in box below): True True Question #4 – What is the value of the Console.WriteLine statements? What does this question test? – How does the “Stack” work – LIFO or FIFO?   using System; using System.Collections; class Test { static void Main() { Stack a = new Stack(5); a.Push("1"); a.Push("2"); a.Push("3"); a.Push("4"); a.Push("5"); foreach (var o in a) { Console.WriteLine(o); } } } Answer (select text in box below): 5 4 3 2 1 Question #5 – What is the value of the Console.WriteLine statements? What does this question test? – Array and General Looping Knowledge. using System; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { int[] J_LIST = new int[5] { 1, 2, 3, 4, 5 }; int K = 10; int L = 5; foreach (var J in J_LIST) { K = K - J; L = K + 2 * J; Console.WriteLine("J = {0, 5} K = {1, 5} L = {2, 5}", J, K, L); } Console.ReadLine(); } } } Answer (select text in box below): J = 1 K = 9 L = 11 J = 2 K = 7 L = 11 J = 3 K = 4 L = 10 J = 4 K = 0 L = 8 J = 5 K = -5 L = 5 Stay Tuned for more challenges!

    Read the article

  • Entity System with C++ templates

    - by tommaisey
    I've been getting interested in the Entity/Component style of game programming, and I've come up with a design in C++ which I'd like a critique of. I decided to go with a fairly pure Entity system, where entities are simply an ID number. Components are stored in a series of vectors - one for each Component type. However, I didn't want to have to add boilerplate code for every new Component type I added to the game. Nor did I want to use macros to do this, which frankly scare me. So I've come up with a system based on templates and type hinting. But there are some potential issues I'd like to check before I spend ages writing this (I'm a slow coder!) All Components derive from a Component base class. This base class has a protected constructor, that takes a string parameter. When you write a new derived Component class, you must initialise the base with the name of your new class in a string. When you first instantiate a new DerivedComponent, it adds the string to a static hashmap inside Component mapped to a unique integer id. When you subsequently instantiate more Components of the same type, no action is taken. The result (I think) should be a static hashmap with the name of each class derived from Component that you instantiate at least once, mapped to a unique id, which can by obtained with the static method Component::getTypeId ("DerivedComponent"). Phew. The next important part is TypedComponentList<typename PropertyType>. This is basically just a wrapper to an std::vector<typename PropertyType> with some useful methods. It also contains a hashmap of entity ID numbers to slots in the array so we can find Components by their entity owner. Crucially TypedComponentList<> is derived from the non-template class ComponentList. This allows me to maintain a list of pointers to ComponentList in my main ComponentManager, which actually point to TypedComponentLists with different template parameters (sneaky). The Component manager has template functions such as: template <typename ComponentType> void addProperty (ComponentType& component, int componentTypeId, int entityId) and: template <typename ComponentType> TypedComponentList<ComponentType>* getComponentList (int componentTypeId) which deal with casting from ComponentList to the correct TypedComponentList for you. So to get a list of a particular type of Component you call: TypedComponentList<MyComponent>* list = componentManager.getComponentList<MyComponent> (Component::getTypeId("MyComponent")); Which I'll admit looks pretty ugly. Bad points of the design: If a user of the code writes a new Component class but supplies the wrong string to the base constructor, the whole system will fail. Each time a new Component is instantiated, we must check a hashed string to see if that component type has bee instantiated before. Will probably generate a lot of assembly because of the extensive use of templates. I don't know how well the compiler will be able to minimise this. You could consider the whole system a bit complex - perhaps premature optimisation? But I want to use this code again and again, so I want it to be performant. Good points of the design: Components are stored in typed vectors but they can also be found by using their entity owner id as a hash. This means we can iterate them fast, and minimise cache misses, but also skip straight to the component we need if necessary. We can freely add Components of different types to the system without having to add and manage new Component vectors by hand. What do you think? Do the good points outweigh the bad?

    Read the article

  • ASP.Net MVC2 DropDownListFor

    - by hermiod
    Hi all I am trying to learn MVC2, C# and Linq to Entities all in one project (yes, I am mad) and I am experiencing some problems with DropDownListFor and passing the SelectList to it. This is the code in my controller: public ActionResult Create() { var Methods = te.Methods.Select(a => a); List<SelectListItem> MethodList = new List<SelectListItem>(); foreach (Method me in Methods) { SelectListItem sli=new SelectListItem(); sli.Text = me.Description; sli.Value = me.method_id.ToString(); MethodList.Add(sli); } ViewData["MethodList"] = MethodList.AsEnumerable(); Talkback tb = new Talkback(); return View(tb); } and I am having troubles trying to get the DropDownListFor to take the MethodList in ViewData. When I try: <%:Html.DropDownListFor(model => model.method_id,new SelectList("MethodList","method_id","Description",Model.method_id)) %> It errors out with the following message DataBinding: 'System.Char' does not contain a property with the name 'method_id'. I know why this is, as it is taking MethodList as a string, but I can't figure out how to get it to take the SelectList. If I do the following with a normal DropDownList: <%: Html.DropDownList("MethodList") %> It is quite happy with this. Can anyone help?

    Read the article

  • NSTextField autocomplete

    - by Rasmus Styrk
    Does anyone know of any class or lib that can implement autocompletion to an NSTextField? I'am trying to get the standard autocmpletion to work but it is made as a synchronous api. I get my autocompletion words via an api call over the internet. What have i done so far is: - (void)controlTextDidChange:(NSNotification *)obj { if([obj object] == self.searchField) { [self.spinner startAnimation:nil]; [self.wordcompletionStore completeString:self.searchField.stringValue]; if(self.doingAutocomplete) return; else { self.doingAutocomplete = YES; [[[obj userInfo] objectForKey:@"NSFieldEditor"] complete:nil]; } } } When my store is done, i have a delegate that gets called: - (void) completionStore:(WordcompletionStore *)store didFinishWithWords:(NSArray *)arrayOfWords { [self.spinner stopAnimation:nil]; self.completions = arrayOfWords; self.doingAutocomplete = NO; } The code that returns the completion list to the nstextfield is: - (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index { *index = -1; return self.completions; } My problem is that this will always be 1 request behind and the completion list only shows on every 2nd char the user inputs. I have tried searching google and SO like a mad man but i cant seem to find any solutions.. Any help is much appreciated.

    Read the article

  • Python progression path - From apprentice to guru

    - by Morlock
    Hi all, I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been a the very core of all the major contributions I have made in the lab. (bash and R scripts have helped some too. My C++ capabilities are very not functional yet). I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code. What I would like to know from you is your answer to a kind of question I have seldom seen in this or other forums. Let me sum up what I do NOT want to ask first ;) I don't want to know how to QUICKLY learn Python Nor do I want to find out the best way to get acquainted with the language Finally, I don't want to know a 'one trick that does it all' approach. What I do want to know your opinion about, is: What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time. The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this: Read this (eg: python tutorial), pay attention to that kind of details Code for so manytime/problems/lines of code Then, read this (eg: this or that book), but this time, pay attention to this Tackle a few real-life problems Then, proceed to reading Y. Be sure to grasp these concepts Code for X time Come back to such and such basics or move further to... (you get the point :) This process depicts an iterative Learn/Code cycle, and I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field. Thanks a lot for sharing your opinions and good Python coding!

    Read the article

  • Is there a perfect algorithm for chess?

    - by Overflown
    Dear Stack Overflow community, I was recently in a discussion with a non-coder person on the possibilities of chess computers. I'm not well versed in theory, but think I know enough. I argued that there could not exist a deterministic Turing machine that always won or stalemated at chess. I think that, even if you search the entire space of all combinations of player1/2 moves, the single move that the computer decides upon at each step is based on a heuristic. Being based on a heuristic, it does not necessarily beat ALL of the moves that the opponent could do. My friend thought, to the contrary, that a computer would always win or tie if it never made a "mistake" move (however do you define that?). However, being a programmer who has taken CS, I know that even your good choices - given a wise opponent - can force you to make "mistake" moves in the end. Even if you know everything, your next move is greedy in matching a heuristic. Most chess computers try to match a possible end game to the game in progress, which is essentially a dynamic programming traceback. Again, the endgame in question is avoidable though. -- thanks, Allan Edit: Hmm... looks like I ruffled some feathers here. That's good. Thinking about it again, it seems like there is no theoretical problem with solving a finite game like chess. I would argue that chess is a bit more complicated than checkers in that a win is not necessarily by numerical exhaustion of pieces, but by a mate. My original assertion is probably wrong, but then again I think I've pointed out something that is not yet satisfactorily proven (formally). I guess my thought experiment was that whenever a branch in the tree is taken, then the algorithm (or memorized paths) must find a path to a mate (without getting mated) for any possible branch on the opponent moves. After the discussion, I will buy that given more memory than we can possibly dream of, all these paths could be found.

    Read the article

  • A couple of questions on exceptions/flow control and the application of custom exceptions

    - by dotnetdev
    1) Custom exceptions can help make your intentions clear. How can this be? The intention is to handle or log the exception, regardless of whether the type is built-in or custom. The main reason I use custom exceptions is to not use one exception type to cover the same problem in different contexts (eg parameter is null in system code which may be effect by an external factor and an empty shopping basket). However, the partition between system and business-domain code and using different exception types seems very obvious and not making the most of custom exceptions. Related to this, if custom exceptions cover the business exceptions, I could also get all the places which are sources for exceptions at the business domain level using "Find all references". Is it worth adding exceptions if you check the arguments in a method for being null, use them a few times, and then add the catch? Is it a realistic risk that an external factor or some other freak cause could cause the argument to be null after being checked anyway? 2) What does it mean when exceptions should not be used to control the flow of programs and why not? I assume this is like: if (exceptionVariable != null) { } Is it generally good practise to fill every variable in an exception object? As a developer, do you expect every possible variable to be filled by another coder?

    Read the article

  • InterIMAP, Viewing UNREAD IMAP mail and Downloading Attachments in C#

    - by Erika
    I was wondering if anyone can help me on this cause its driving me mad trying get this working I was working with the trail of mail.dll from http://www.lesnikowski.com/mail/ which is an extremely fantastic tool which unfortunately i cannot afford being a student (even though its around 150eur, its still very expensive to me :/) and this would be a small module in my thesis and my faculty cannot afford to buy these things for students either :/ so anyway I had to go for a free tool (so please dont suggest any non open source ones - trust me i have tried them ALL).. Well, i'm trying to explore InterIMAP, and for several hours have been trying to list unread emails from my gmail account but it just doesn't seem to be working. I can connect just fine but finding the unread emails seems to be no easy task.. I have tried countless approaches but non seem to give me unread emails in my inbox (I have loads of emails in my inbox and i just want the unread ones). Would someone please assist me? I have been trying to get this working for ages now, but documentation is rather lacking and my every attempt has resulted in a fail so far. Please help!! Some code i currently have: ` IMAPConfig config = new IMAPConfig("myhost", "username", "pass", true, true, ""); config.CacheFile = ""; IMAPClient client = null; try { client = new IMAPClient(config, null, 5); } catch (IMAPException e) { Console.WriteLine(e.Message); return; } Console.WriteLine(DateTime.Now.ToString()); IMAPFolder f = client.Folders["INBOX"]; IMAPSearchResult sResult = f.Search(IMAPSearchQuery.QuickSearchNew()); // <--- Gives me no results even though i do have unread messages!

    Read the article

  • BASH statements execute alone but return "no such file" in for loop.

    - by reve_etrange
    Another one I can't find an answer for, and it feels like I've gone mad. I have a BASH script using a for loop to run a complex command (many protein sequence alignments) on a lot of files (~5000). The loop produces statements that will execute when given alone (i.e. copy-pasted from the error message to the command prompt), but which return "no such file or directory" inside the loop. Script below; there are actually several more arguments but this includes some representative ones and the file arguments. #!/bin/bash # Pass directory with targets as FASTA sequences as argument. # Arguments to psiblast # Common db=local/db/nr/nr outfile="/mnt/scratch/psi-blast" e=0.001 threads=8 itnum=5 pssm="/mnt/scratch/psi-blast/pssm." pssm_txt="/mnt/scratch/psi-blast/pssm." pseudo=0 pwa_inclusion=0.002 for i in ${1}/* do filename=$(basename $i) "local/ncbi-blast-2.2.23+/bin/psiblast\ -query ${i}\ -db $db\ -out ${outfile}/${filename}.out\ -evalue $e\ -num_threads $threads\ -num_iterations $itnum\ -out_pssm ${pssm}$filename\ -out_ascii_pssm ${pssm_txt}${filename}.txt\ -pseudocount $pseudo\ -inclusion_ethresh $pwa_inclusion" done Running this scripts gives "<scriptname> line <last line before 'done'>: <attempted command> : No such file or directory. If I then paste the attempted command onto the prompt it will run. Each of these commands takes a couple of minutes to run.

    Read the article

  • How do I reference Django Model from another model

    - by user313943
    Im looking to create a view in the admin panel for a test program which logs Books, publishers and authors (as on djangoproject.com) I have the following two models defined. class Author(models.Model): first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) email = models.EmailField() def __unicode__(self): return u'%s %s' % (self.first_name, self.last_name) class Book(models.Model): title = models.CharField(max_length=100) authors = models.ManyToManyField(Author) publisher = models.ForeignKey(Publisher) publication_date = models.DateField() def __unicode__(self): return self.title What I want to do, is change the Book model to reference the first_name of any authors and show this using admin.AdminModels. #Here is the admin model I've created. class BookAdmin(admin.ModelAdmin): list_display = ('title', 'publisher', 'publication_date') # Author would in here list_filter = ('publication_date',) date_hierarchy = 'publication_date' ordering = ('-publication_date',) fields = ('title', 'authors', 'publisher', 'publication_date') filter_horizontal = ('authors',) raw_id_fields = ('publisher',) As I understand it, you cannot have two ForeignKeys in the same model. Can anyone give me an example of how to do this? I've tried loads of different things and its been driving me mad all day. Im pretty new to Python/Django. Just to be clear - I'd simply like the Author(s) First/Last name to appear alongside the book title and publisher name. Thanks

    Read the article

  • geocoder.getFromLocationName returns only null

    - by test
    Hello, I am going out of my mind for the last 2 days with an IllegalArgumentException error i receive in android code when trying to get a coordinates out of an address, or even reverse, get address out of longitude and latitude. this is the code, but i cannot see an error. is a standard code snippet that is easily found on a google search. public GeoPoint determineLatLngFromAddress(Context appContext, String strAddress) { Geocoder geocoder = new Geocoder(appContext, Locale.getDefault()); GeoPoint g = null; try { System.out.println("str addres: " + strAddress); List<Address> addresses = geocoder.getFromLocationName(strAddress, 5); if (addresses.size() > 0) { g = new GeoPoint((int) (addresses.get(0).getLatitude() * 1E6), (int) (addresses.get(0).getLongitude() * 1E6)); } } catch (Exception e) { throw new IllegalArgumentException("locationName == null"); } return g; } These are the permissions from manifest.xml file: <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> I do have the Google Api key declared too: <uses-library android:name="com.google.android.maps" /> From the code snippet above, geo coder is not null, neither is the address or appContext, and i stumble here: geocoder.getFromLocationName(strAddress, 5); I did a lot of google searching and found nothing that worked, and the most important info i found is this: ""The Geocoder class requires a backend service that is not included in the core android framework." Sooo, i am confuzed now. What do I have to call, import, add, use in code.... to make this work? I am using Google Api2.2, Api level 8. If somebody has found a solution for this, or a pointer for documentation, something that i didn't discover, please let us know. Thank you for your time.

    Read the article

  • Unable to cast type isse in silverlight

    - by prince23
    error once i clcik on the button i am getting this error. this is my code <sdk:DataGrid MinHeight="100" x:Name="dgCounty" AutoGenerateColumns="False" VerticalAlignment="Top" IsReadOnly="True" Margin="5,5,5,0" RowDetailsVisibilityChanged="dgCounty_RowDetailsVisibilityChanged" RowDetailsVisibilityMode="VisibleWhenSelected"> <sdk:DataGrid.Columns> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Content="+" Click="Button_Click"></Button> </DataTemplate> private void Button_Click(object sender, RoutedEventArgs e) { Button btnExpandCollapse = sender as Button; var Row = DataGridRow.GetRowContainingElement(sender as FrameworkElement); if (Row.DetailsVisibility == Visibility.Collapsed) { Row.DetailsVisibility = Visibility.Visible; } else { Row.DetailsVisibility = Visibility.Collapsed; } if (btnExpandCollapse.Content.ToString() == "+") { btnExpandCollapse.Content = "-"; } else if (btnExpandCollapse.Content.ToString() == "-") { btnExpandCollapse.Content = "+"; } } void dtg_RowDetailsVisibilityChanged(object sender, DataGridRowDetailsEventArgs e) { DataGrid RowDetails = e.DetailsElement as DataGrid if(RowDetails.YourDesiciveFlag = true) { } else { } } } working on this issue from past 3 days any idea how to solve this issue. just going mad on this issue. for expand /collpase in data grid in silverlight. let me know if you people can provide me any code that can solve my issue. thanks in advance prince

    Read the article

  • problem on ajax call

    - by praveen
    hi i am using mootools ajax request in my project. its works properly but when i make request for it aborted first time and second time request mad. consequently abortion of request increase by one at each click. my code is following function addStepConfiguration(id,mystrip,comment,error,submitid) { // alert(id+'\n'+mystrip+'\n'+comment+'\n'+error+'\n'+submitid.value); $(id).addEvent('submit', function(e) { e.stop(); this.set('send', { onRequest:function(html){ $(submitid).setStyle('display','none'); loading_Img(); }, onComplete: function(responseText) { $('loading_img').innerHTML = ''; SplittedResText = responseText.split("|"); s //alert(SplittedResText); if(SplittedResText[1]=='undefined') { $(error).innerHTML=SplittedResText[0]; $(submitid).setStyle('display','block'); } else { $(comment).innerHTML=SplittedResText[0]; $(mystrip).set('class',SplittedResText[1]); //$(image).setProperty('src',SplittedResText[2]); removeMsg.delay(20,'',error); removeMsg.delay(3000,'',comment); $(submitid).setStyle('display','block'); } } }); this.send(); }); }

    Read the article

  • MVC 2 Data annotations problem

    - by Louzzzzzz
    Hi. Going mad now. I have a MVC solution that i've upgraded from MVC 1 to 2. It all works fine.... except the Validation! Here's some code: In the controller: using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Security.Principal; using System.Web; using System.Web.Mvc; using System.Web.Security; using System.Web.UI; using MF.Services.Authentication; using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace MF.Controllers { //basic viewmodel public class LogOnViewData { [Required] public string UserName { get; set; } [Required] public string Password { get; set; } } [HandleError] public class AccountController : Controller { [HttpPost] public ActionResult LogOn(LogOnViewData lvd, string returnUrl) { if (ModelState.IsValid) { //do stuff - IsValid is always true } } } } The ModelState is always valid. The model is being populated correctly however. Therefore, if I leave both username and password blank, and post the form the model state is still valid. Argh! Extra info: using structure map for IoD. Previously, before upgrading to MVC 2 was using the MS data annotation library so had this in my global.asax.cs: ModelBinders.Binders.DefaultBinder = new Microsoft.Web.Mvc.DataAnnotations.DataAnnotationsModelBinder(); Have removed that now. I'm sure i'm doing something really basic and wrong. If someone could point it out that would be marvellous. Cheers

    Read the article

  • How do I get the Silverlight Add-On for Visual Studio 2010 and some example code?

    - by xarzu
    How do I get the Silverlight Add-On for Visual Studio 2010? And where can I find lots of example code? When the interent and html was new, one could find examples of how to build a website on a few trusted web sites. The same web sites might not be the best choice for looking for examples for Silverlight, I guess. What are the best web sites where you can look at examples -- and most importantly -- look at the source code of some examples of Silverlight? Back when MFC existed as a option that programmers might use to develop windows applications, a coder could look at a huge list of sample code and step through that code to find something that somewhat did what he was looking for and use that example code to build his own app. Is there anything like that for Silverlight? I have found the http://gallery.expression.microsoft.com/ Expression Blend Gallery and I have found the http://www.silverlight.net/community/samples/silverlight-samples/ Silverlight dot net community samples. I guess that will keep me busy for a while. Are there other sites? There are video instructions on MSDN's Channel9: http://channel9.msdn.com/tags/curso-silverlight-4/ Are there any videos in English? The video instructions look very good. Where is the links to the English versions? I was suggested this site for learning silverlight: http://channel9.msdn.com/learn/courses/Silverlight4/ This online documentation mentions "The Silverlight 4 Tools for Visual Studio 2010" which "is an add-on for Visual Studio 2010 that provides tooling for Microsoft Silverlight 4 and WCF RIA Services. It can be installed on top of either Visual Studio 2010 or Visual Web Developer 2010 Express" where can I find this? Is it shipped with Visual Studio 2010?

    Read the article

  • Making that move from junior > mid level

    - by dotnetdev
    Hi, Before I start, I know there is another thread about this very issue (http://stackoverflow.com/questions/2352874/moving-from-junior-developer-to-mid-level). I am in this very same situation, but of course every person and the company/employment-history is not the same. In my current company, I have not done one piece of coding from start to finish with the oversight of my manager and a Project Manager to manage the work/deadlines etc. I am basically an odd-jobs type of guy. The coding I do is on the side to whatever boring spreadsheet/word document I have to write. Very illogical that you're a coder and you're doing it in secret. In another job I had for 3 months (Was made redundant), it required 1 years experience, perhaps because of the fact I was the sole developer. It wasn't too hard, but then I was solely responsible and I learnt a lot from that. I had 2 other 3 months jobs (contracts), so I have been working for 1 year 9 months. I know found a job which I'm in the last stage for, which needs 3 years .NET experience and 2 years Sharepoint. How can I know if I am ready for this job? My current job has been going on for 1 year, but it doesn't mean squat apart from explaining how I have spent my time. It does not tell me what level I am at (apart from the huge skills gap I have opened up against my peers because I practise at home). So 1 year of doing nothing at work, but 1 year of doing loads at home. In fact, I take 1 week off and do more at home then in the company since I started. How can I know if I am ready for such a job? I am generally very confident given all I've achieved in coding, but I have no idea what a job with this sort of experience entails (what day-to-day-problems I would be facing). Is there any advice on how to handle this transition? Thanks

    Read the article

  • Calculating odds distribution with 6-sided dice

    - by Stephen
    I'm trying to calculate the odds distribution of a changing number of 6-sided die rolls. For example, 3d6 ranges from 3 to 18 as follows: 3:1, 4:3, 5:6, 6:10, 7:15, 8:21, 9:25, 10:27, 11:27, 12:25, 13:21, 14:15, 15:10, 16:6, 17:3, 18:1 I wrote this php program to calculate it: function distributionCalc($numberDice,$sides=6) { for ( $i=0; $i<pow($sides,$numberDice); $i++) { $sum=0; for ($j=0; $j<$numberDice; $j++) { $sum+=(1+(floor($i/pow($sides,$j))) % $sides); } $distribution[$sum]++; } return $distribution; } The inner $j for-loop uses the magic of the floor and modulus functions to create a base-6 counting sequence with the number of digits being the number of dice, so 3d6 would count as: 111,112,113,114,115,116,121,122,123,124,125,126,131,etc. The function takes the sum of each, so it would read as: 3,4,5,6,7,8,4,5,6,7,8,9,5,etc. It plows through all 3^6 possible results and adds 1 to the corresponding slot in the $distribution array between 3 and 18. Pretty straightforward. However, it only works until about 8d6, afterward i get server time-outs because it's now doing billions of calculations. But I don't think it's necessary because die probability follows a sweet bell-curve distribution. I'm wondering if there's a way to skip the number crunching and go straight to the curve itself. Is there a way to do this, so, for example, with 80d6 (80-480)? Can the distribution be projected without doing 6^80 calculations? I'm not a professional coder and probability is still new to me, so thanks for all the help! Stephen

    Read the article

  • AContext.data can be nil?

    - by waza123
    In this code, as you see on Connect, AContext.Data is filled with something TmyTThreadList = class(TThreadList) id: integer; end; var unique_id:integer; procedure TfrmTestIdTCPServer.IdTCPServerConnect(AContext: TIdContext); begin CS.Enter; try inc(unique_id); finally CS.Leave; end; AContext.Data := myTThreadList.Create; list := myTThreadList(AContext.Data).LockList; try myTThreadList(AContext.Data).id := my_unique_id; list.Add(myTThreadList(AContext.Data)); finally myTThreadList(AContext.Data).UnlockList; end; end; then on disconnect, coder is checking here for Acontext.Data < nil procedure TfrmTestIdTCPServer.IdTCPServerDisconnect(AContext: TIdContext); var begin if AContext.Data <> nil then begin The question is, why he is checking for nil ? Thanks. EDIT: I'm asking this, because when I do the same, onExecute I access AContext.Data , and sometimes (when in same time is connecting many clients) AContext.Data is empty, access violation appears.

    Read the article

  • OpenGL - drawing 2D polygons shapes with texture

    - by plonkplonk
    I am trying to make a few effects in a C+GL game. So far I draw all my sprites as a quad, and it works. However, I am trying to make a large ring appear at times, with a texture following that ring, as it takes less memory than a quad with the ring texture inside. The type of ring I want to make is not a round-shaped GL mesh ring (the "tube" type) but a "paper" 2D ring. That way I can modify the "width" of the ring, getting more of the effect than a simple quad+ring texture. So far all my attempts have been...kind of ridiculous, as I don't understand GL's coordinates too well (and I can't really understand the available documentation...I am just a designer with no coder help or background. A n00b, basically). glBegin(GL_POLYGON); for(i = 0;i < 360; i += 10){ glTexCoord2f(0, 0); glVertex2f(Cos(i)*(H-10),Sin(i)H); glTexCoord2f(0, HP); glVertex2f(Sin(i)(H-10),Cos(i)*(H-10)); glTexCoord2f(WP, HP); glVertex2f(Cos(i)H,Sin(i)(H-10)); glTexCoord2f(WP, 0); glVertex2f(Sin(i)*H,Cos(i)*H); } glEnd(); This is my last attempt, and it seems to generate a "sunburst" from the right edge of the circle instead of a ring. It's an amusing effect but definitely not what I want. Other results included the circle looking exactly the same as the quad textured (aka drawing a sprite literally) or something that looked like a pop-art filter, by working on this train of thought. Seems like my logic here is entirely flawed, so, what would be the easiest way to obtain such a ring? No need to reply in code, just some guidance for a non-math-skilled user...

    Read the article

  • Advice on coding Perl to work like PHP

    - by user272273
    I am first and foremost a perl coder, but like many, also code in PHP for client work, especially web apps. I am finding that I am duplicating a lot of my projects in the two languages, but using different paradigms (e.g. for handling cgi input and session data) or functions. What I would like to do is start to code my Perl in a way which is structured more like PHP, so that I a) am keeping one paradigm in my head b) can more quickly port over scripts from one to the other Specifically, I am asking if people could advise how you might do the following in perl? 1) Reproduce the functionality of $_SESSION, $_GET etc. e.g. by wrapping up the param() method of CGI.pm, a session library? 2) Templating library that is similar to PHP I am used to mixing my code and HTML in the PHP convention. e.g. i <h1>HTML Code here</h1> <? print "Hello World\b"; ?> Can anybody advise on which perl templating engine (and possibly configuration) will allow me to code similarly? 3) PHP function library Anybody know of a library for perl which reproduces a lot of the php inbuilt functions?

    Read the article

  • How do I create Twitter style URL's for my app - Using existing application or app redesign - Ruby o

    - by bgadoci
    I have developed a blog application of sorts that I am trying to allow other users to take advantage of (for free and mostly for family). I wondering if the authentication I have set up will allow for such a thing. Here is the scenario. Currently the application allows for users to sign up for an account and when they do so they can create blog posts and organize those posts via tags. The application displays no data publicly (another words, you have to login to see anything). To gain access you have to create an account and even after you do, you cannot see anyone else's information as the applications filters using the current_user method and displays in the /posts/index.html.erb page. This would be great if a user only wanted to blog and share it with themselves, not really what I am looking for. My question has two parts (hopefully I won't make anyone mad by not putting these into two questions) Is it possible for a particular users data to live at www.myapplication.com/user without moving everything to the /user/show.html.erb file? Is it possible to make some of that information (living at the URL) public but still require login for create and destroy actions. Essentially, exactly like twitter. I am just curious if I can get from where I am (using the current_user methods across controllers to display in /posts/index.html.erb) to where I want to be. My fear is that I have to redesign the app such that the user data lives in the /user/show.html.erb page. Thoughts?

    Read the article

  • How do I create Twitter style URLs for my app - Using existing application or app redesign - Ruby on

    - by bgadoci
    I have developed a blog application of sorts that I am trying to allow other users to take advantage of (for free and mostly for family). I wondering if the authentication I have set up will allow for such a thing. Here is the scenario. Currently the application allows for users to sign up for an account and when they do so they can create blog posts and organize those posts via tags. The application displays no data publicly (another words, you have to login to see anything). To gain access you have to create an account and even after you do, you cannot see anyone else's information as the applications filters using the current_user method and displays in the /posts/index.html.erb page. This would be great if a user only wanted to blog and share it with themselves, not really what I am looking for. My question has two parts (hopefully I won't make anyone mad by not putting these into two questions) Is it possible for a particular users data to live at www.myapplication.com/user without moving everything to the /user/show.html.erb file? Is it possible to make some of that information (living at the URL) public but still require login for create and destroy actions. Essentially, exactly like twitter. I am just curious if I can get from where I am (using the current_user methods across controllers to display in /posts/index.html.erb) to where I want to be. My fear is that I have to redesign the app such that the user data lives in the /user/show.html.erb page. Thoughts? UPDATE: I am using Clearance for authentication by Thoughtbot. I wonder if there is something I can set in the vendored gem path to represent the /posts/index.html.erb code as the /user/id code and replace id with the user name.

    Read the article

  • About my changes on php class... is there any bug in my changes ? I need help, thanks.

    - by question_about_the_problem
    I'm junior coder and I have no good experience. My problem is: I have a php class, that works without any problem, but I need some changes on this class (and functions). And i don't have fax machine right now to try. is there any bug in my changes ? Here is my changes text: 1.) Open the file xxx.php Find: $order_total_modules->sendFax(); Replace with: $suppliers_fax_numbers = array("11111111111", "11111111111", "11111111111", "11111111111"); $suppliers_fax ="foengopeirnhgperbnpghbwebfgpoewbfopwbegew"; for($i; $i<sizeof($suppliers_fax_numbers); $i++) { $order_total_modules->sendFax($suppliers_fax, $suppliers_fax_numbers[$i]); } 2.) Open the file xxx.php Find: function sendFax(){ if (is_array($this->modules)) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($class == 'order2fax' and $GLOBALS[$class]->enabled) { $GLOBALS[$class]->sendFax(); Replace with: function sendFax($suppliers_fax, $supplier_fax_number){ if (is_array($this->modules)) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($class == 'order2fax' and $GLOBALS[$class]->enabled) { $GLOBALS[$class]->sendFax($suppliers_fax, $supplier_fax_number); 3.) Open the file xxx.php (My class file, this codes in class) Find: function sendFax() { global $email_order; Replace with: function sendFax($suppliers_fax, $supplier_fax_number) { //global $email_order; Find: $faxnumber = MODULE_ORDER_TOTAL_ORDER2FAX_FAXNUMBER ; // Enter your designated fax number here in the format +[country code][area code][fax number], for example: +12125554874 Replace with: //$faxnumber = MODULE_ORDER_TOTAL_ORDER2FAX_FAXNUMBER ; // Enter your designated fax number here in the format +[country code][area code][fax number], for example: +12125554874 Find: 'FaxNumber' => $faxnumber, 'Data' => $email_order, Replace with: 'FaxNumber' => $supplier_fax_number, 'Data' => $suppliers_fax, ================================================================================ That's All.

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35  | Next Page >