Search Results

Search found 123 results on 5 pages for 'vlad nicula'.

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

  • Downloading file with Python results in only 4.1kB

    - by Vlad Ogay
    I'm using simple code: import urllib2 response = urllib2.urlopen("http://www.mysite.com/getfile/4355") output = open('myfile.zip','wb') output.write(response.read()) output.close() The web-server is IIS + ASP.NET MVC 4 It returns FileResult wrapping a zip-file with "application/octet-stream" content-type. The problem is that downloaded zip file is broken - only 4.1kB size, where it must be 24kB. When I type the url adress in web-browser directly - it downloads and opens fine. Could you please, suggest, what's wrong with my Python code?

    Read the article

  • gps orientation in android

    - by klaus-vlad
    Hi I know that the function Location.getBearing() returns the bearing if any when in move public void onLocationChanged(Location lastLocation) { int bearing=lastLocation.getBearing() } ,so now bearing might be , 170 degrees..but, I'd like to know if there is anything in android that will give me the direction of the orientation (ex for 170 degrees , the direction is : SSE south, south east)

    Read the article

  • How to validate a form with jQuery?

    - by vlad
    I tried to find the answer in other questions but actually nothing worked -.- Somehow I hate JavaScript ... Anyway! My Code looks like: function validate() { if ($(":input").length == 0) { $(":input").addClass("notvalid"); return false; } else { $(":input").removeClass("notvalid"); return true; } return true; } $(":input").blur(validate()); $(":input").keyup(validate()); $("#customForm").submit(function(){ if(validate()){ return true; } else { return false; } }); I just want to test every tag to be not empty. The test should be done when the focus is lost or after every key type. And of course after the submit button has been clicked. It doesn't work. Firefox error console says something like: unknown pseudoclass or pseudoelement 'input'. What does this mean?

    Read the article

  • download file exception handling

    - by klaus-vlad
    Hi, In my application I download several critical files from a server, and I want to write some code that handles the case where the a file download didn't complete for a reason or other ,to retry downloading it at next startup. The function that downloads a file at a time however throws only MalformedURLException and IOException , but if these exceptions are thrown that means that the download didn't even begin. How should I arrange things so I can treat the case where a download failed , even if it began ? download(String file) throws MalformedURLException ,IOException { }

    Read the article

  • installing opencv for python issues

    - by vlad
    I'm running OS X Leopard. I followed this site to install it. Trying to run any demo script, I now get "No module named opencv.cv", which is obviously stopping me from doing any programming. I am running python 2.5.1 (yes, I know it's kind of old). Why would this be, and how can I solve it? Thanks

    Read the article

  • Simple wave generator with SDL in c++

    - by Vlad Popescu
    i am having problems understanding how the audio part of the sdl library works now, i know that when you initialize it, you have to specify the frequency and a callback<< function, which i think is then called automatically at the given frequency. can anyone who worked with the sdl library write a simple example that would use sdl_audio to generate a 440 hz square wave (since it is the simplest waveform) at a sampling frequency of 44000 hz? thanks in advance

    Read the article

  • c++ builder TClientWinSocket simbol substitution

    - by Vlad
    I have the following problem. I have to send a text telegram over tcp/ip to a host device. Telegram should be terminated using 0x1A (CTRL-Z) character. But when I send it, host told me that there is a wrong symbol in the telegram. When I terminate a telegram with 32 (0x20) everything is ok. I look the transfered data using WireShark and I see that when I send 0x1A it is substituted with 0x16, when I send 32 (0x20) as a terminator it is somehow substituted with 0x1A. Can you explain it please. P.S. I am working on windows 7, using c++builder xe2. Thanks, Vladimir

    Read the article

  • Game logic dynamically extendable architecture implementation patterns

    - by Vlad
    When coding games there are a lot of cases when you need to inject your logic into existing class dynamically and without making unnecessary dependencies. For an example I have a Rabbit which can be affected by freeze ability so it can't jump. It could be implemented like this: class Rabbit { public bool CanJump { get; set; } void Jump() { if (!CanJump) return; ... } } But If I have more than one ability that can prevent it from jumping? I can't just set one property because some circumstances can be activated simultanously. Another solution? class Rabbit { public bool Frozen { get; set; } public bool InWater { get; set; } bool CanJump { get { return !Frozen && !InWater; } } } Bad. The Rabbit class can't know all the circumstances it can run into. Who knows what else will game designer want to add: may be an ability that changes gravity on an area? May be make a stack of bool values for CanJump property? No, because abilities can be deactivated not in that order in which they were activated. I need a way to seperate ability logic that prevent the Rabbit from jumping from the Rabbit itself. One possible solution for this is making special checking event: class Rabbit { class CheckJumpEventArgs : EventArgs { public bool Veto { get; set; } } public event EventHandler<CheckJumpEvent> OnCheckJump; void Jump() { var args = new CheckJumpEventArgs(); if (OnCheckJump != null) OnCheckJump(this, args); if (!args.Veto) return; ... } } But it's a lot of code! A real Rabbit class would have a lot of properties like this (health and speed attributes, etc). I'm thinking of borrowing something from MVVM pattern where you have all the properties and methods of an object implemented in a way where they can be easily extended from outside. Then I want to use it like this: class FreezeAbility { void ActivateAbility() { _rabbit.CanJump.Push(ReturnFalse); } void DeactivateAbility() { _rabbit.CanJump.Remove(ReturnFalse); } // should be implemented as instance member // so it can be "unsubscribed" bool ReturnFalse(bool previousValue) { return false; } } Is this approach good? What also should I consider? What are other suitable options and patterns? Any ready to use solutions? UPDATE The question is not about how to add different behaviors to an object dynamically but how its (or its behavior) implementation can be extended with external logic. I don't need to add a different behavior but I need a way to modify an exitsing one and I also need a possibiliity to undo changes.

    Read the article

  • "loading" div automatically appended when using cordova (phonegap)

    - by Vlad Ioffe
    I am using cordova for mobile app development on android platform. I have this html code in www/index.html file: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="en" /> <script src="cordova-2.2.0.js" type="text/javascript"></script> <script src="jquery/jquery.js" type="text/javascript"></script> <script src="jquery.mobile/jquery.mobile-1.1.0.js" type="text/javascript"></script> <script src="JS/main.js" type="text/javascript"></script> <link rel="stylesheet" href="CSS/main.css"/> </head> <body id="body" class="body"> <div id="box" class="bodyBlack"> </div> </body> </html> I don't know why but when I am running this app (also when just opening on pc browser) i am having this div appended at the bottom of the page: <div ui-loader ui-corner-all ui-body-a ui-loader-default> <span ui-loader ui-corner-all ui-body-a ui-loader-default></span> <h1>loading</h1> Why and from where dose it getting from? how I am preventing it to do so? Thanks!!!

    Read the article

  • 'Previous' Button in HTML/PHP

    - by vlad
    Hi there, I thought hours about that problem but I didn't come to any conclusion. My problem here is that I need a 'Previous' Button added to a form. The user should fill out a formular that is splitted up in 13 parts. Every part is an own formular having a 'Next' button for submitting everything to a database and redirecting to the next page. How do I integrate a 'Previous' button there? ... I don't if it might be usefull for you to know that I'm using cakePHP, and well I'm pretty new to it.

    Read the article

  • Scroll to a position in a listView

    - by klaus-vlad
    Hi, I have a long listView that the user scrolls around and then returns to the previous menu . What I want is that when the user opens this list View again the list to be scrolled to where the it was previously left. Any ideas on how this can be achieved ?

    Read the article

  • Linq-to-XML explicit casting in a generic method

    - by vlad
    I've looked for a similar question, but the only one that was close didn't help me in the end. I have an XML file that looks like this: <Fields> <Field name="abc" value="2011-01-01" /> <Field name="xyz" value="" /> <Field name="tuv" value="123.456" /> </Fields> I'm trying to use Linq-to-XML to get the values from these fields. The values can be of type Decimal, DateTime, String and Int32. I was able to get the fields one by one using a relatively simple query. For example, I'm getting the 'value' from the field with the name 'abc' using the following: private DateTime GetValueFromAttribute(IEnumerable<XElement> fields, String attName) { return (from field in fields where field.Attribute("name").Value == "abc" select (DateTime)field.Attribute("value")).FirstOrDefault() } this is placed in a separate function that simply returns this value, and everything works fine (since I know that there is only one element with the name attribute set to 'abc'). however, since I have to do this for decimals and integers and dates, I was wondering if I can make a generic function that works in all cases. this is where I got stuck. here's what I have so far: private T GetValueFromAttribute<T>(IEnumerable<XElement> fields, String attName) { return (from field in fields where field.Attribute("name").Value == attName select (T)field.Attribute("value").Value).FirstOrDefault(); } this doesn't compile because it doesn't know how to convert from String to T. I tried boxing and unboxing (i.e. select (T) (Object) field.Attribute("value").Value but that throws a runtime Specified cast is not valid exception as it's trying to convert the String to a DateTime, for instance. Is this possible in a generic function? can I put a constraint on the generic function to make it work? or do I have to have separate functions to take advantage of Linq-to-XML's explicit cast operators?

    Read the article

  • How to control a webView

    - by klaus-vlad
    Hi, In one of my xml layouts I use an webview (besides other TextViews) for which I call loadUrl("myURL") to display the content from a url. The desired effect is to have displayed in a screen all the other textViews , and below them the content of web page. However when the webview loads the URL , it starts a new activity and displays the content in that activity, which is not what I need. Any ideas on how I could force the described behavior ? Later edit: I have succeed to have layout with several views mixed, one of them being the webview .Also I have succeed to obtain the described above behavior. But only after I setted a WebView client with setWebViewClient(WebViewClient); . Now I'd like to know why does it work like this only after a webViewClient is set ?

    Read the article

  • WINSDK: Determining whether an arbitrary pid identifies a running process on Windows

    - by Vlad Romascanu
    Attempting to implement a poor man's test of whether a process is still running or not (essentially an equivalent of the trivial kill(pid, 0).) Hoped to be able to simply call OpenProcess with some minimal desired access then test for either GetLastError() == ERROR_INVALID_PARAMETER or GetExitCodeProcess(...) != STILL_ACTIVE. Nice try... Running on Windows XP, as administrator: HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); if (!hProc) { DWORD dwLastError = GetLastError(); } ...fails miserably with dwLastError == ERROR_ACCESS_DENIED when pid is owned by a different (not SYSTEM) user. Moreover, if pid was originally owned by a different user but has since terminated, OpenProcess also fails with ERROR_ACCESS_DENIED (not ERROR_INVALID_PARAMETER.) Do I have to use Process32First/Process32Next or EnumProcesses? I absolutely do not want to use SeDebugPrivilege. Thanks, V

    Read the article

  • Building IronRuby WPF GUIs

    - by Vlad
    This may be a silly question but I was under the impression that it was possible to use IronRuby and MS Visual Studio 2010 together to sort of build interfaces\edit XAML in one window and code ruby in the other? Is this only possible to do with C#, Basic and C++ ? I've browsed SO and seen some IronRuby snippets like this one: button1.click do |sender, args| MessageBox.show("Hello World!") end So it stands to reason you can create GUIs somehow, but is the visual gui creator not available for ironruby?

    Read the article

  • application resources after update

    - by klaus-vlad
    Hi, I have a curiosity about application updates . What happens after such a process with the resources supposing that the update needs different resources than the ones the old version used ? Are they overwritten ?( like overwrite string.xml) or the old resources are deleted and replaced with the new ones ?

    Read the article

  • UTC date and time

    - by klaus-vlad
    Hi, How can I obtain the current UTC time and date using a gps location changed lsitener ? public void onLocationChanged(Location lastLocation) { lastLocation.getTime() }

    Read the article

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