Search Results

Search found 112 results on 5 pages for 'snake'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Python MySQLdb placeholders syntax

    - by ensnare
    I'd like to use placeholders as seen in this example: cursor.execute (""" UPDATE animal SET name = %s WHERE name = %s """, ("snake", "turtle")) Except I'd like to have the query be its own variable as I need to insert a query into multiple databases, as in: query = """UPDATE animal SET name = %s WHERE name = %s """, ("snake", "turtle")) cursor.execute(query) cursor2.execute(query) cursor3.execute(query) What would be the proper syntax for doing something like this?

    Read the article

  • Resources needed: Sort 2D array "graphically"

    - by aw
    I have a 2D array 1 2 3 4 5 6 7 8 9 and want to sort it like this Snake 1 2 3 8 9 4 7 6 5 Snake (different) 1 2 3 6 5 4 7 8 9 Rotated 1 4 7 2 5 8 3 6 9 Wipe (diagonal) 1 3 6 2 5 8 4 7 9 Well, you got it, all kinds of sorting. Searching the interweb for hours now. Any resources (specific language or pseudo code) on that greatly appreciated...

    Read the article

  • Windows zip error: Windows cannot complete the extraction. The destination file could not be created

    - by Snake Eyes
    I have a strange error in Windows 7 when I want to execute/open a file inside ZIP archive. I have two files: File1.dwg File2.dwg The archive is not corrupted ( I checked with 7zip utility ) When I double click on the any file inside ZIP (I opened ZIP with Windows Explorer), the error occured: Ok. If I open zip file with 7-zip or WinRAR every file could be opened(executed) without error and the AutoCAD is opened to see the dwg content. Why in Windows ZIP ? What points have I to see to manage/remove this error ? Thank you. UPDATE If I click Extract all from Windows ZIP, the error occured as unspecified error:

    Read the article

  • HyperV management through Windows 8

    - by Snake
    Consider the following setup: 1 Hypervisor 3 Clients (Server 2012 with AD, Server 2012, Windows 8). Now we can remote desktop into the Hypervisor and manage the VMs with the manager. This also works from the Server 2012 (I installed the manager there). But it doesn't work from the Windows 8 machine. All machines are in the same domain. Am I forgetting something? I followed this long page http://technet.microsoft.com/en-us/library/cc794756(v=ws.10).aspx But I find it so weird that it works for the same user on Windows Server 2012, but not on Windows 8.

    Read the article

  • AD - Using UserPrincipal.FindByIdentity and PrincipalContext with nested OU - C#

    - by Solid Snake
    Here is what I am trying to achieve: I have a nested OU structure that is about 5 levels deep. OU=Portal,OU=Dev,OU=Apps,OU=Grps,OU=Admin,DC=test,DC=com I am trying to find out if the user has permissions/exists at OU=Portal. Here's a snippet of what I currently have: PrincipalContext domain = new PrincipalContext( ContextType.Domain, "test.com", "OU=Portal,OU=Dev,OU=Apps,OU=Grps,OU=Admin,DC=test,DC=com"); UserPrincipal user = UserPrincipal.FindByIdentity(domain, myusername); PrincipalSearchResult<Principal> group = user.GetAuthorizationGroups(); For some unknown reason, the value user generated from the above code is always null. However, if I were to drop all the OU as follows: PrincipalContext domain = new PrincipalContext( ContextType.Domain, "test.com", "DC=test,DC=com"); UserPrincipal user = UserPrincipal.FindByIdentity(domain, myusername); PrincipalSearchResult<Principal> group = user.GetAuthorizationGroups(); this would work just fine and return me the correct user. I am simply trying to reduce the number of results as opposed to getting everything from AD. Is there anything that I am doing wrong? I've googled for hours and tested various combinations without much luck. Any help is appreciated. Thanks. Dan

    Read the article

  • Silverlight 4 WebRequest, SSL and Credentials

    - by Snake
    Hi, I've got the following code: public void StartDataRequest() { WebRequest.RegisterPrefix("https://", System.Net.Browser.WebRequestCreator.ClientHttp); WebClient myService = new WebClient { AllowReadStreamBuffering = true, UseDefaultCredentials = false, Credentials = new NetworkCredential("username", "password") }; myService.UseDefaultCredentials = false; myService.OpenReadCompleted += this.RequestCompleted; myService.OpenReadAsync(new Uri("Url")); } public void RequestCompleted(object sender, System.Net.OpenReadCompletedEventArgs e) { // ... } Now this works perfectly for, say, Twitter. But when I try to do it with another https service I get a security error. This is probably because the website I try to connect too does not have a crossdomain.xml. Is there a way to bypass this? Or does the file really needs to be there? Thanks.

    Read the article

  • Silverlight 4 toolkit, charting and lineSeries is null

    - by Snake
    Hi, I create a Silverlight Chart, with the Silverlight 4 toolkit, the April release. Consider the following chart: <Grid x:Name="LayoutRoot" Background="White"> <Charting:Chart Title="Chart to test" Name="MySuperChart"> <Charting:LineSeries x:Name="MyLineSeries" Title="Something" /> </Charting:Chart> </Grid> So far so good. I can access the Series in the chart by MySuperChart.Series[0] But when I try to reference MyLineSeries, it appears to be null. Full view

    Read the article

  • Visual Studio 2010: adding a service reference to a 2008 generated wsdl

    - by Snake
    Doesn't produce a app.config . In my team there is a guy who has Visual Studio 2008, he created a webservice. Then there is me, adding this webservice to a console project. Adding the service reference goes without problems but no valid app.config is generated. It's just empty <configuration> </configuration> When I disable 'reuse types' in my service reference it works but then I get an ambiguous error. Is this a bug? I found http://stackoverflow.com/questions/2159107/visual-studio-does-not-generate-app-config-content-when-add-service-reference this one, but there is no solution there, so I thought I bump the problem up again. Thanks

    Read the article

  • Visual Sourcesafe, sharing: commits to wrong location

    - by Snake
    I have a project under my management. It has the following structure: $/Code/MainSolution $/Code/Branches I want to branch the MainSolution in $/Code/Branches So I do it, (it works perfectly), I set a working folder for that project and do a 'get latest'. But when I open that solution in Visual Studio 2005 it identifies every file as new (+ sign in front of the file) and when I commit it it goes to $/Data/NameOfTheBranch Why does it do that? Why doesn't it follow MY rules?

    Read the article

  • WPF MVVM ViewModel constructor designmode

    - by Snake
    Right, I've got a main wpf window: <Window x:Class="NorthwindInterface.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ViewModels="clr-namespace:NorthwindInterface.ViewModels" Title="MainWindow" Height="350" Width="525"> <Window.DataContext> <ViewModels:MainViewModel /> </Window.DataContext> <ListView ItemsSource="{Binding Path=Customers}"> </ListView> </Window> And the MainViewModel is this: class MainViewModel : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged = delegate { }; public MainViewModel() { Console.WriteLine("test"); using (NorthwindEntities northwindEntities = new NorthwindEntities()) { this.Customers = (from c in northwindEntities.Customers select c).ToList(); } } public List<Customer> Customers { get;private set; } Now the problem is that in designermode I can't see my MainViewModel, it highlights it saying that it can't create an instance of the MainViewModel. It is connecting to a database. That is why (when I comment the code the problem is solved). But I don't want that. Any solutions on best practices around this?

    Read the article

  • Redirect user in php without revieling referer of page that redirected

    - by Snake
    How would I Redirect user in php without revieling referer of page that redirected I figured I'd simply do something like this :: ( code example 2 ) :: http://www.mustap.com/phpzone_post_62_how-to-bypass-the-referer-se with the Get method , Simple example of what im trying to do is redirect to google without the referer of the php page I am referred from. thanks

    Read the article

  • See return value in C#

    - by Snake
    Hi, Consider the following piece of code: As you can see we are on line 28. Is there any way to see the return value of the function at this point, without letting the code return to the caller function? Foo.Bar() is a function call which generates a unique path (for example). So it's NOT constant. In VB.NET it's possible by entering the function's name in the Watch, which will then threat it as a variable. But in C# this is not possible, any other tips? PS: rewriting is not an option.

    Read the article

  • Winforms, databinding, Listbox and textbox

    - by Snake
    Hi dear friends, I have a ListBox (MyListBox) on my screen, and a Textbox (MyTextBox). The ListBox is filled with a List(Of T), which are all custom items. Now I try to do this: The ListBox' datasource is the List(Of T). Now when an Item changes I want the textbox to be updated to a particular property of the selected item in my ListBox. In code this means: Me.MyListBox.DisplayMember = "SelectionName" Me.MyListBox.ValueMember = "Id" MyTextbox.DataBindings.Add(New Binding("Text", Me._listOfItems, "SelectedItem.Comment", True, DataSourceUpdateMode.OnPropertyChanged)) Me.MyListBox.DataSource = Me._listOfItems this does not work. But when I bind to SelectedValue instead of SelectedItem it works perfectly. The _listOfItems is declared as this: Dim _listOfItems As List(Of MyItem) = New List(Of MyItem)() Where MyItem is this: public class MyItem { public string SelectionName { get; set; } public int Id { get; set; } public string Comment { get; set; } } I tried overriding the ToString() in MyItem so that it would use that. But that doesn't work either. Anybody care to give it a try? Thanks! -Snakiej

    Read the article

  • Office 2003 interop problems, interface, method not found.

    - by Snake
    This problem is making me crazy. Actually I have multiple problems. First one: Why on earth are is there a _Worksheet and a Worksheetinterface in the Excel interop. They both look the same, except for some attributes on the methods. It's confusing! Second of all: my job today is making a VB.NET file more strict, by settings Option Strict On and Option Explicit On While it works for most files, I'm bumping into a problem. Here's a little code piece: Private _pivotTable As Excel.PivotTable With _pivotTable pvf = .AddDataField(pvc) End With PivotTable.AddDataField is defined on the MSDN page: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.pivottable.adddatafield(office.11).aspx When I check my local Interop dll w/ Reflector that method is NOT there. When I run the application, and step through it, the method just works. When I try to step INTO the method, I get an LateBound Exception. WTF? So the question is: why are the interfaces defined more than once (twice sometimes?). 2nd question. AddDataField trouble

    Read the article

  • COM interop, Office 2010 x64 and Visual Studio 2010.

    - by Snake
    Hi, I just installed Offic 2010 x64 on my Windows 7 x64 laptop. It already had Visual Studio 2010 on it. Now I try to add Microsoft.Office.Interop.Excel or something to the project, but it just can't find the project. When I try to open a project from the website of Microsoft (a sample of Office development) Visual Studio says that that kind of project is not supported. How is this possible? Is it a problem that I installed x64 of Office? Or is the problem Visual Studio 2010? Thanks

    Read the article

  • C#, weird optimization

    - by Snake
    Hi, I'm trying to read my compiled C# code. this is my code: using(OleDbCommand insertCommand = new OleDbCommand("...", connection)) { // do super stuff } But! We all know that a using gets translated to this: { OleDbCommand insertCommand = new OleDbCommand("...", connection) try { //do super stuff } finally { if(insertCommand != null) ((IDisposable)insertCommand).Dispose(); } } (since OleDbCommand is a reference type). But when I decompile my assembly (compiled with .NET 2.0) I get this in Resharper: try { insertCommand = new OleDbCommand("", connection); Label_0017: try { //do super stuff } finally { Label_0111: if ((insertCommand == null) != null) { goto Label_0122; } insertCommand.Dispose(); Label_0122:; } I'm talking about this line: if ((insertCommand == null) != null). True is not null, it never is, nor is false. So how is my object disposed properly? WTF? Thanks! -Kristof

    Read the article

  • jquery xml slideshow using ajax

    - by Codemaster Snake
    Hi all, I am trying to create a JQuery based slider using ajax to load images url from a xml file and then creating a html li list dynamically. Till now I am able to append and create DOM structure using Jquery. But I am not able to access the dynamically created list. I have also tried custom events using bind but not able to successfully implement it. Following is my jquery plugin code: (function($){ $.fn.genie = function(options) { var genie_dom = "<div class='genie_wrapper'><ul class='genie'></ul></div>"; var o, base; var genie_styles = "<style>.genie_wrapper{overflow:hidden}.genie{position: relative;margin:0;padding:0}.genie li {position: absolute;margin:0;padding:0}</style>"; var defaults = { width : '960px', height : '300px', background_color : '#000000', xml : 'genie.xml', speed : 1000, pause: 1000 }; base = $(this); o = $.extend(defaults, options); return this.each(function() { create_elements(); }); function create_elements() { $(base).html(genie_dom); $('head').append(genie_styles); $('.genie_wrapper').css({'background-color' : o.background_color, width : o.width, height: '300px', overflow: ''}); $.ajax({ type: "GET", url: o.xml, dataType: "xml", success: function(xml) { var slides = $(xml).find('slide'); var count = 0; $(slides).each(function(){ $('.genie').append('<li class="slide" id="slide'+count+'"><img src="' + $(this).text() + '" /></li>'); $('.genie li:last').css({'z-index' : count}); count++; }); } }); } } })(jQuery); In my html file: There is only one empty div to which I am calling my plugin like $(document).ready(function() { $('.slideshow').genie(); }); I have also tried using following everywhere in JS: $(".slide").bind("start_animation", function(e){ $(this).fadeOut(1000); alert($(this).html()); }); $(".slide").trigger("start_animation"); I want to animate li list using animate function, Can anyone please tell me how to implement it... It would be of great help... Regards, Neeraj Kumar EDIT: Can Anyone help me out please????

    Read the article

  • Replacing a unicode character in UTF-8 file using delphi 2010

    - by Jake Snake
    I am trying to replace character (decimal value 197) in a UTF-8 file with character (decimal value 65) I can load the file and put it in a string (may not need to do that though) SS := TStringStream.Create(ParamStr1, TEncoding.UTF8); SS.LoadFromFile(ParamStr1); //S:= SS.DataString; //ShowMessage(S); However, how do i replace all 197's with a 65, and save it back out as UTF-8? SS.SaveToFile(ParamStr2); SS.Free; -------------- EDIT ---------------- reader:= TStreamReader.Create(ParamStr1, TEncoding.UTF8); writer:= TStreamWriter.Create(ParamStr2, False, TEncoding.UTF8); while not Reader.EndOfStream do begin S:= reader.ReadLine; for I:= 1 to Length(S) do begin if Ord(S[I]) = 350 then begin Delete(S,I,1); Insert('A',S,I); end; end; writer.Write(S + #13#10); end; writer.Free; reader.Free;

    Read the article

  • Visual Studio 2010 debug minidump

    - by Snake
    Hi all, Consider the following code (written with Visual Studio 2010 and .NET 4.0) using System; namespace DumpTester { class Program { static void Main(string[] args) { int test = new Random().Next(); Console.WriteLine(test + new Random().Next()); Test(); } private static void Test() { throw new Exception(); } } } When running outside of Visual Studio you get this nice window of Microsoft Windows 7 that it is looking for a solution. Obviously, since this is my app, there is none. At that point I create a full dump file of my application with for example Process Explorer. I then open that dmp file from its location and try to debug. But whatever I try, it can't find the location of the source symbols. I tried putting the pdb next to the dump but it just doesn't find it. What am I doing wrong?

    Read the article

  • Windows Phone 7, download xml over ssl with authentication

    - by Snake
    Hi, I'm trying to download a file from my provider. The url is protected with basic username and password, and everything is sent over ssl. So I try to do this: WebClient proxy = new WebClient(); proxy.DownloadStringCompleted += (o, dscea) => System.Diagnostics.Debugger.Break(); proxy.Credentials = new NetworkCredential("username", "password"); proxy.DownloadStringAsync(new Uri("https://..../.../data.xml")); As you can see I try to validate. The data IS correct, and the code works when I try to download something from twitter. What am I forgetting to connect to this xml file?

    Read the article

  • Silverlight debugging, no list element view

    - by Snake
    When I'm debugging my Silverlight Appliction and I'm using a list internally I cannot hover over the list and see the items inside the list. I just see the RAW view of the list. If I want to see the items I have to write my own code which is tedious. Is this something normal to Silverlight? I DO have the correct list view when debugging in normal Console/WPF/... applications. Example: Silverlight: (link: click) See how there is no 'list view in the first example? And there in this one: And for non Silverlight: (link: click)

    Read the article

  • Dispose, when is it called?

    - by Snake
    Consider the following code: namespace DisposeTest { using System; class Program { static void Main(string[] args) { Console.WriteLine("Calling Test"); Test(); Console.WriteLine("Call to Test done"); } static void Test() { DisposeImplementation di = new DisposeImplementation(); } } internal class DisposeImplementation : IDisposable { ~DisposeImplementation() { Console.WriteLine("~ in DisposeImplementation instance called"); } public void Dispose() { Console.WriteLine("Dispose in DisposeImplementation instance called"); } } } The Dispose just never get's called, even if I put a wait loop after the Test(); invocation. So that quite sucks. I want to write a class that is straightforward and very easy to use, to make sure that every possible resource is cleaned up. I don't want to put that responsibilty to the user of my class. Possible solution: use using, or call Dispose myself(basicly the same). Can I force the user to use a using? Or can I force the dispose to be called? Calling GC.Collect(); after Test(); doesn't work either. Putting di to null doesn't invoke Dispose either. The Deconstructor DOES work, so the object get's deconstructed when it exits Test()

    Read the article

  • Game design flaw, need help investigating

    - by Snake
    I am not sure if I will be able to get help here but I would give it a shot. The problem is I dont know where the problem is. I have a cards game, in which when you "human" play by dragging a card, then at the end of card being dragged, a handler using postExecute is called with delay of 0.5 sec to start the next player in turn (which is a bot) The bot chooses the color and plays it and at the end of the animation (the card moving to the middle) a handler is started for the next bot and so on. Once the play reaches again to the human player, it waits for his touchs to drag the crad and start the cycle again. The problem that in production, sometimes I am getting errors. The error is resulting in somehow messing up the sequence which ends up with players having more cards than others. After investigation, I found that the transition from human to bot is the problem. Somehow, the transition is happening twice (meaning handler calling post execute twice and the bot is playing twice and everything is messed up). Its been mutliple months and I can't reproduce it (to fix it) and I cna't figure out why this is happeneing? ANY IDEA how I can go after it? How can I get more info about or how can I solve something like that? any pointer would help me

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >