Daily Archives

Articles indexed Saturday March 13 2010

Page 24/89 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Java: JGraphT: Iterate through nodes

    - by Rosarch
    I'm trying to iterate through all nodes, so I can print them out for graphviz. What is the best way to do that using the JGraphT library? public static void main(String[] args) { UndirectedGraph<String, DefaultEdge> g = new SimpleWeightedGraph<String, DefaultEdge>(DefaultEdge.class); String odp = "ODP"; String cck = "CCK"; String mfe = "MFE"; g.addVertex(odp); g.addVertex(cck); g.addVertex(mfe); g.addEdge(odp, cck); g.addEdge(odp, mfe); } Also, how do I add edge weights? Edit: This seems to work pretty well. But is there a better way? Set<DefaultEdge> edges = g.edgeSet(); for (DefaultEdge e : edges) { gv.addln(String.format("\"%s\" -> \"%s\"", g.getEdgeSource(e), g.getEdgeTarget(e))); }

    Read the article

  • Django unable to update model

    - by user292652
    i have the following function to override the default save function in a model match def save(self, *args, **kwargs): if self.Match_Status == "F": Team.objects.filter(pk=self.Team_one.id).update(Played=F('Played')+1) Team.objects.filter(pk=self.Team_two.id).update(Played=F('Played')+1) if self.Winner !="": Team.objects.filter(pk=self.Winner.id).update(Win=F('Win')+1, Points=F('Points')+3) else: return if self.Match_Status == "D": Team.objects.filter(pk=self.Team_one.id).update(Played=F('Played')+1, Draw = F('Draw')+1, Points=F('Points')+1) Team.objects.filter(pk=self.Team_two.id).update(Played=F('Played')+1, Draw = F('Draw')+1, Points=F('Points')+1) super(Match, self).save(*args, **kwargs) I am able to save the match model just fine but Team model does not seem to be updating at all and no error is being thrown. am i missing some thing here ?

    Read the article

  • Functional equivalent of if (p(f(a), f(b)) a else b

    - by oxbow_lakes
    I'm guessing that there must be a better functional way of expressing the following: def foo(i: Any) : Int if (foo(a) < foo(b)) a else b So in this example f == foo and p == _ < _. There's bound to be some masterful cleverness in scalaz for this! I can see that using BooleanW I can write: p(f(a), f(b)).option(a).getOrElse(b) But I was sure that I would be able to write some code which only referred to a and b once. If this exists it must be on some combination of Function1W and something else but scalaz is a bit of a mystery to me! EDIT: I guess what I'm asking here is not "how do I write this?" but "What is the correct name and signature for such a function and does it have anything to do with FP stuff I do not yet understand like Kleisli, Comonad etc?"

    Read the article

  • gem install mysql error on solaris

    - by qichunren
    [root@zhaoonline-data sbin]# gem install mysql Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /opt/ruby/bin/ruby extconf.rb checking for mysql_ssl_set()... no checking for rb_str_set_len()... no checking for rb_thread_start_timer()... no checking for mysql.h... yes gcc: language strconst not recognized gcc: conftest.c: linker input file unused because linking not done creating Makefile make gcc -I. -I. -I/opt/ruby/lib/ruby/1.8/i386-solaris2.10 -I. -DHAVE_MYSQL_H -D_FILE_OFFSET_BITS=64 -I/usr/sfw/include/mysql -xstrconst -mt -fPIC -g -O2 -c mysql.c gcc: language strconst not recognized gcc: mysql.c: linker input file unused because linking not done gcc -shared -o mysql_api.so mysql.o -L. -L/opt/ruby/lib -Wl,-R/opt/ruby/lib -L. -R/usr/sfw/lib -R/usr/sfw/lib/mysql -L/usr/sfw/lib -L/usr/sfw/lib/mysql -lmysqlclient -lz -lposix4 -lcrypt -lgen -lsocket -lnsl -lm -lrt -ldl -lcrypt -lm -lc gcc: mysql.o: No such file or directory * Error code 1 make: Fatal error: Command failed for target `mysql_api.so' Gem files will remain installed in /opt/ruby/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection. Results logged to /opt/ruby/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

    Read the article

  • pop3 mail box Send/Recieve log

    - by hamed
    hello every body i want to write a code for some application in order to connect to a pop3 mailbox and log the send and recieve transactions done on the mailbox even by other users, or even read the built in log file if there is?! and Then send some notifications in some way to An admin Account i dont know how to perform the action to write some (administration-Like) application to do this on the given pop3 mailbox , i have read some articles on MSExchange but ... Any help would be appreciated

    Read the article

  • Why do browser vendors make their own css properties?

    - by jitendra
    Why do browser vendors make their own css properties, even they know these will not pass the w3c validation? What is the purpose? Is for their own testing, or for web developers, or to demonstrate browser capabilities to the world and to the W3C organizations and to CSS development team of W3C? is it like a beta version of demonstration? if i use any browser specific for now can they remove that property's support from future versions.will i have to edit my css in future For example: https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions

    Read the article

  • Multi monitor windows positioning problem

    - by Peter Stegnar
    I need a good multi monitor tool mainly to gain control over the windows positioning. I have problem that closed window/application remembers at which monitors it was (closed). I have disconnect this monitor (this is often LCD TV) I have problem with this "remembering" windows/applications that was closed in LCD TV are out of sight when LCD TV is disconnected. What is the best practice to deal with this problem other that that not to close windows on this monitor)? Are there any good multi-monitor software to deal with this?

    Read the article

  • Volume control tools

    - by Stan
    Sometimes I feel watching some youtube in Chrome has very low volume even if I turn everything to 100%. Is there any tools can increase volume above the system's maximun? I know IndieVolume does, but that didn't support some of my applications. So try to look for some alternatives. thanks

    Read the article

  • Simulate Pivot Rotate Using Transform In SVG

    - by Dested
    I have a rectangle in SVG that I need to rotate on a pivot from a specific point. The best way I can see to do this is transform to the xy of the pivot, rotate the degree, and then transform again. The problem is the xy of the second transform. I assume its going to take cos and sin to some extent, just not sure where or why. * | | | would rotate -90degrees to *--- Maybe im looking at this the wrong way, can anyone clearify?

    Read the article

  • select top 50 records from sql

    - by air
    i have following database table name tbl_rec recno uid uname points ============================ 1 a abc 10 2 b bac 8 3 c cvb 12 4 d aty 13 5 f cyu 9 ------------------------- ------------------------- i have about 5000 records in this table. i want to select first 50 higher points records. i can't use limit statement as i am already using limit for paging. Thanks

    Read the article

  • [ADO.NET ERRROR]: CREATE DATABASE permission denied in database 'master'. An attempt to attach an au

    - by Mark Cidade
    Anyone seen this before? CREATE DATABASE permission denied in database 'master'. An attempt to attach an auto-named database for file C:\Documents and Settings\..\App_Data\HelloWorld.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. I'm asking on a friend's behalf. I've sent him these links: http://blog.benhall.me.uk/2008/03/sql-server-and-vista-create-database.html http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=702726&SiteID=1

    Read the article

  • Reading different data from a textfile delimited with semicolons in C.

    - by Chris_45
    How do one read different records of data that are separated with semicolons into an array in C? from textfile: Text One; 12.25; Text Two; 5; Text Three; 1.253 fopen ... for(i = 0; i < nrRecords; i++) { fscanf(myFile, " %[^;];", myRecords[i].firstText); /* Ok first text*/ fscanf(myFile, "%lf", &myRecords[i].myDouble1); /* But goes wrong with first double */ fscanf(myFile, " %[^;];", myRecords[i].secondText); fscanf(myFile, "%d", &myRecords[i].myInt1); fscanf(myFile, " %[^;];", myRecords[i].thirdText); fscanf(myFile, "%lf",&myRecords[i].myDouble2); } fclose...

    Read the article

  • Jquery toggle function that doesn't return false?

    - by Tom
    Hi, Is it possible to stop the automatic preventDefault() from applying in a simple Jquery toggle function? $(".mydiv").toggle( function () { $(this).addClass("blue"); }, function () { $(this).removeClass("blue"); } ); The above prevents elements inside the div from responding normally to the click. It doesn't have to be the toggle() function - anything that allows toggling a class on and off AND doesn't return false would be great. Thanks.

    Read the article

  • ComboBox Control using silverlight

    - by Aamir Hasan
    DropDown.zip (135.33 kb) LiveDemo Introduction In this article i am  going to explore some of the features of the ComboBox.ComboBox makes the collection visible and allows users to pick an item from the collection.After its first initialization, no matter if you bind a new datasource with fewer or more elements, the dropdown persists its original height.One workaround is the following:1. store the Properties from the original ComboBox2. delete the ComboBox removing it from its container3. create a new ComboBox and place it in the container4. recover the stores Properties5. bind the new DataSource to the newly created combobox Creating Silverlight ProjectCreate a new Silverlight 3 Project in VS 2008. Name it as ComboBoxtSample. Simple Data BindingAdd System.Windows.Control.Data reference to the Silverlight project. Silverlight UserControl Add a new page to display Bus data using DataGrid. Following shows Bus column XAML snippet:The ComboBox element represents a ComboBox control in XAML.  <ComboBox></ComboBox>ComboBox XAML        <StackPanel Orientation="Vertical">            <ComboBox Width="120" Height="30" x:Name="DaysDropDownList" DisplayMemberPath="Name">                <!--<ComboBox.ItemTemplate>                    <DataTemplate>                        <StackPanel Orientation="Horizontal">                            <TextBlock Text="{Binding Path=Name}" FontWeight="Bold"></TextBlock>                            <TextBlock Text=", "></TextBlock>                            <TextBlock Text="{Binding Path=ID}"></TextBlock>                        </StackPanel>                    </DataTemplate>                </ComboBox.ItemTemplate>-->            </ComboBox>        </StackPanel>   The following code below is an example implementation Combobox control support data binding     1 By setting the DisplayMemberPath property you can specify which data item in your data you want displayed in the ComboBox.    2 Setting the SelectedIndex allows you to specify which item in the ComboBox you want selected. Business Object public class Bus { public string Name { get; set; } public float Price { get; set; } }   Data Binding private List populatedlistBus() { listBus = new List(); listBus.Add(new Bus() {Name = "Bus 1", Price = 55f }); listBus.Add(new Bus() { Name = "Bus 2", Price = 55.7f }); listBus.Add(new Bus() { Name = "Bus 3", Price = 2f }); listBus.Add(new Bus() { Name = "Bus 4", Price = 6f }); listBus.Add(new Bus() { Name = "Bus 5", Price = 9F }); listBus.Add(new Bus() { Name = "Bus 6", Price = 10.1f }); return listBus; }   The following line of code sets the ItemsSource property of a ComboBox. DaysDropDownList.ItemsSource = populatedlistBus(); Output I hope you enjoyed this simple Silverlight example Conclusion In this article, we saw how data binding works in ComboBox.You learnt how to work with the ComboBox control in Silverlight.

    Read the article

  • Unable to start phpmyadmin ?

    - by madhup_25
    hi, I did installed xampp on my macbook a day before. It worked perfectly yesterday. But today when I try to start the phpmyadmin it gives the following error: Can't create/write to file '/var/folders/Uu/UuhwtR9xE3Ozsao8ttdIWU+++TI/-Tmp-/#sql1b5_8_0.MYI' (Errcode: 13) Can anybody tell the solution for this problem. Thanks, Madhup

    Read the article

  • Creating a network adapter - how hard is it?

    - by Vilx-
    I'm interested in building a little (commercial) device on top of Arduino. I want it to be able to interface with network. Network as in standard Ethernet, Cat5, RJ-45, etc. I know that there is an Ethernet Shield, but it costs even more than the Arduino itself, and it's pretty big. Naturally, I want my device to be as small and as cheap as possible. So I'm thinking about recreating an Ethernet module myself. The problem is - I haven't got any experience with Ethernet, nor do I have a good idea where to start looking. Thus I can't even say if my ideas are feasible. Ultimately I would like the device to have three ports - one for incoming signal, two for outgoing, so the device is essentially a little switch where it is plugged in itself as well. The switching capabilities need not be very fast - the volume of data will be low. 10Mbit is more than enough, can be even slower. If that is not possible, a single port for controlling the device itself will also do. Another possibility I'm considering is power line communications - sending information through power lines. That's another area I've no experience with. What hardware should I be looking at, and where can I find information about the necessary software? So - can anyone tell me if these ideas are feasible, and if yes - where should I start looking?

    Read the article

  • InstallShield 2010 - 1603 Fatal Error [Windows Installer] (Windows 7 Only)

    - by gtas
    Hi all, I created an MSI InstalScript Project where i deploy a web based (ASP.NET) precompiled project copying the files during installation in the \inetpub\wwwroot\projectnamefolder, creating an AppPool and the virtual dir of course in the IIS. The setup works great in windows XP Pro (SP3 i used). But soon as i try in Windows 7 (tried Ultimate and Home Premium) i get a -1603 Fatal Error during installation...Windows Installer Help (MSI.chm) or MSDN for more info.... Dying to fix this... [Edit] I think error occurs when trying to create the Application in the IIS. [FIXED] Enable 32 Bit Apllications needs to be true when creating Application Pools through InstallShield in a 64 bit OS!

    Read the article

  • How to configure web proxy for Jing

    - by Denis
    Jing is great. But it won't start unless it can phone the mother ship. My internet access is via corporate web proxy. Jing doesn't seem to offer any way of configuring its connection to the internet. You'd think it would just use the windows internet connection settings that work for browsing, but no dice. Anyone solve this problem? Maybe there are some configuration files or registry settings that would fix this? Thanks!

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >