Search Results

Search found 302 results on 13 pages for 'andreas bonini'.

Page 6/13 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Determining whether values can potentially match a regular expression, given more input

    - by Andreas Grech
    I am currently writing an application in JavaScript where I'm matching input to regular expressions, but I also need to find a way how to match strings to parts of the regular expressions. For example: var invalid = "x", potentially = "g", valid = "ggg", gReg = /^ggg$/; gReg.test(invalid); //returns false (correct) gReg.test(valid); //returns true (correct) Now I need to find a way to somehow determine that the value of the potentially variable doesn't exactly match the /^ggg$/ expression, BUT with more input, it potentially can! So for example in this case, the potentially variable is g, but if two more g's are appended to it, it will match the regular expression /^ggg$/ But in the case of invalid, it can never match the /^ggg$/ expression, no matter how many characters you append to it. So how can I determine if a string has or doesn't have potential to match a particular regular expression?

    Read the article

  • The Coolest Parts of Windows API

    - by Andreas Rejbrand
    I have noticed that there are quite a few community wikis about "Tips & Tricks" or "Hidden Features" in programming languages and APIs here at Stack Overflow. But I could not find any about my own personal favourites: Win32 API and Delphi. Therefore I start my "own" CW about Win32 API. There are (at least) two kinds of Win API users: those that have been brought up using Windows API in C/C++, and those that have been brought up using some level of abstraction above the Windows API. I belong to the latter category, being brought up using Delphi's VCL. But over the last five years, I have become increasingly interested in the underlaying API of the Windows operating system, and today I work a lot with it. Depending on which category a programmer belongs to, he (or possibly she) will think that different things are "cool" in the Windows API. For instance, whereas a VCL-brought up developer might think it it very cool to var errIcon: HICON; begin errIcon := LoadIcon(0, IDI_ERROR); DrawIcon(Canvas.Handle, 10, 10, errIcon), a programmer brought up using Windows API in C will not be as impressed. But no matter how you are "brought up": what are the coolest "tricks" in Windows API? I start by listing a few of my own favourites, some of which are more "cool" than "useful", though: LoadIcon and MessageBeep can load/play system default icons and sounds. Open the CD tray: mciSendString('Set cdaudio door open wait', nil, 0, 0); Fade out the screen (Windows Vista and later) and turn of the monitor: SendMessage(Application.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 2); GetWindowDC(GetDesktopWindow) returns the DC of the desktop.

    Read the article

  • how to change strip.text labels in ggplot with facet and margin=TRUE

    - by Andreas
    I have looked here but still can't figure it out. How do I change the strip.text.x labels in a ggplot with faceting? Specifically I am using facet_grid with margins. The strip.text label for the margin is "(all)" - but since I am in a non-english speaking country I would rather write "Total" or something similar in my native tongue. opts(stip.text.x=c(levels(facetvariabel,"Total")) does not work. Any ideas? Example (not really the best dataset for this - but I guess it will work) ggplot(cars, aes(x=dist))+geom_bar()+facet_grid(.~speed, margin=T)

    Read the article

  • Notify user on database change? JavaScript/AJAX

    - by Andreas Carlbom
    Yo. I'm really quite new to this whole JavaScript business, not to mention AJAX, so I was thinking if you guys could help me out with a conundrum. Basically, what I want is for the user to be notified upon a change in a value of a MySQL table. How should I go about that? Should I use jQuery, or can I slap something together myself? Thankful for any and all replies.

    Read the article

  • GetVersionEx Not Working on Windows 7?!

    - by Andreas Rejbrand
    On my Windows 7 system, the GetVersionEx Windows API function returns "6.0", indicating Windows Vista, when it should return "6.1". If it matters, I used the following Delphi code: function winver: string; var ver: TOSVersionInfo; begin ver.dwOSVersionInfoSize := SizeOf(ver); if GetVersionEx(ver) then with ver do result := IntToStr(dwMajorVersion) + '.' + IntToStr(dwMinorVersion) + '.' + IntToStr(dwBuildNumber) + ' (' + szCSDVersion + ')'; end; and the string "6.0.6002 (Service Pack 2)" was returned. Isn't this highly odd?

    Read the article

  • Flex TextArea leading invalid

    - by Andreas
    Hi, When I set leading to 0 with Verdana (and others to) for a Flex TextArea I get strange results: fontsize - space between baselines 8 - 10 (125%) 10 - 12 (120%) 12 - 14 (117%) 14 - 17 (121%) 16 - 18 (113%) 18 - 22 (122%) 20 - 25 (125%) 25 - 31 (124%) shouldn't all of these be the same (should only be 100%)? Or least follow a pattern, because I can't se any. :( When i set leading to 0, the space between my baselines should be the same as the font size/height. This is not the case here. How do I know how to get the space between the baseline to be equal to the height of the font?

    Read the article

  • Specifying a no-indent for a list, with LaTeX

    - by Andreas Grech
    I have the following: This is just normal text... \begin{enumerate} \item First Item ?\\\\ This is the text of the first item \item Second Item ?\\\\ This is the text of the second item \end{enumerate} Which renders the following: This is just normal text... 1. First Item ? This is the text of the first item 2. Second Item ? This is the text of the second item I want to specify that the text of the items has no indentation. Basically, I want it to be rendered like such: This is just normal text... 1. First Item ? This is the text of the first item 2. Second Item ? This is the text of the second item How can I specify this form of no indentation?

    Read the article

  • stringstream problem - vector iterator not dereferencable

    - by andreas
    Hello I've got a problem with the following code snippet. It is related to the stringstream "stringstream css(cv.back())" bit. If it is commented out the program will run ok. It is really weird, as I keep getting it in some of my programs, but if I just create a console project the code will run fine. In some of my Win32 programs it will and in some it won't (then it will return "vector iterator not dereferencable" but it will compile just fine). Any ideas at all would be really appreciated. Thanks! vector<double> cRes(2); vector<double> pRes(2); int readTimeVects2(vector<double> &cRes, vector<double> &pRes){ string segments; vector<string> cv, pv, chv, phv; ifstream cin("cm.txt"); ifstream pin("pw.txt"); ifstream chin("hm.txt"); ifstream phin("hw.txt"); while (getline(cin,segments,'\t')) { cv.push_back(segments); } while (getline(pin,segments,'\t')) { pv.push_back(segments); } while (getline(chin,segments,'\t')) { chv.push_back(segments); } while (getline(phin,segments,'\t')) { phv.push_back(segments); } cin.close(); pin.close(); chin.close(); phin.close(); stringstream phss(phv.front()); phss >> pRes[0]; phss.clear(); stringstream chss(chv.front()); chss >> cRes[0]; chss.clear(); stringstream pss(pv.back()); pss >> pRes[1]; pss.clear(); stringstream css(cv.back()); css >> cRes[1]; css.clear(); return 0; }

    Read the article

  • What Source Code License to use for your project?

    - by Andreas Grech
    I am starting this question to try and make a central point developers can use to choose what Source Code License to use for their projects. What I am looking for out of this question are the following for the Licenses: A short description of the License What type of projects should this License be used for Examples of existing projects that use this License Some of the Licenses that I have in mind are the following: Apache License 2.0 Artistic License/GPL Eclipse Public License 1.0 GNU General Public License v2 GNU General Public License v3 GNU Lesser General Public License MIT License Mozilla Public License 1.1 New BSD License

    Read the article

  • custom php library with pear local installation

    - by andreas
    Hello i wish to be able to deploy a PHP web application along with a local installation of PEAR. To be more specific, i am trying to find a way to do a 'per-application' or local installation of PEAR if this is possible. For example: The application 'MyApplication' is located in: /var/www/applications/myapplication The php library is located in: /var/www/applications/myapplication/library I am looking for a way to do a per-application installation of PEAR since not all applications are managed by me (and i want to control which PEAR packages are installed and when). I found some tutorials for a local PEAR installation (on a shared host) but i don't know if my scenario fits the one for a local PEAR installation. Any thoughts/help appreciated.

    Read the article

  • jitter if multiple outliers in ggplot2 boxplot

    - by Andreas
    I am trying to find a suitable display to illustrate various properties within and across school classes. For each class there is only 15-30 data points (pupils). Right now i am leaning towards a whisker-less boxplot, showing only 1.,2. and 3. quartile + datapoints more then e.g. 1 population SD +/- the sample median. This I can do. However - I need to show this graph to some teachers, in order to gauge what they like most. I'd like to compare my graph with a normal boxplot. But the normal boxplot looks the same if there is only one outlier, or e.g. 5 outliers at the same value. In this case this would be a deal-breaker. e.g. test <-structure(list(value = c(3, 5, 3, 3, 6, 4, 5, 4, 6, 4, 6, 4, 4, 6, 5, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 4, 5, 6, 6, 4, 3, 5, 4, 6, 5, 6, 4, 5, 5, 3, 4, 4, 6, 4, 4, 5, 5, 3, 4, 5, 8, 8, 8, 8, 9, 6, 6, 7, 6, 9), places = structure(c(1L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 1L), .Label = c("a", "b"), class = "factor")), .Names = c("value", "places"), row.names = c(NA, -60L), class = "data.frame") ggplot(test, aes(x=places,y=value))+geom_boxplot() Here there are two outliers at ("a",9) - but only one "dot" shown. So my question: How to jitter the outliers. And - what kind of display would you suggest for this kind of data?

    Read the article

  • var undefined = true;

    - by Andreas Grech
    I'm doing some experimenting with this malicious JavaScript line: var undefined = true; Every uninitialized variable in JavaScript has the value of undefined which is just a variable that holds the special value of 'undefined', so the following should execute the alert: var undefined = true, x; if (x) { alert('ok'); } But it doesn't, and my question is why? On further experimentation, I tried the following: var undefined = true, x = undefined; if (x) { alert('ok'); } This time, the alert is executed. So my question is...since in the first snippet x holds undefined (because it is not initialized), why didn't the alert execute? The strange thing is that when explicitly stating that x is undefined (x = undefined), the alert executed...

    Read the article

  • Using interface classes and non-virtual interface idiom in C++

    - by andreas buykx
    Hi all, In C++ an interface can be implemented by a class with all its methods pure virtual: class IFoo { public: virtual void method() = 0; }; Now I want to implement this interface by a hierarchy of classes: class FooBase : public IFoo // implement interface IFoo { public: void method(); // calls methodImpl; private: virtual void methodImpl(); }; For the class hierarchy I would like to use the non-virtual interface (NVI) idiom, to deny derived classes the possibility of overriding the common behavior implemented in FooBase::method(), but it seems that all derived classes have the opportunity to override the FooBase::method() because it is declared in the interface class. Is my observation correct? And if so are there other options to both use interface classes and the NVI idiom?

    Read the article

  • Session management with OpenID, in ASP.NET

    - by Andreas Grech
    I am currently playing with DotNetOpenAuth to make an ASP.NET (C#) website use OpenID instead of the normal login-password routine for user and session handling. Up till now, I have added the DotNetOpenAuth.dll into my project and tried a test login page with the following: <rp:OpenIdLogin ID="OpenIdLogin1" runat="server" /> When I run the page, I enter a valid myopenid url and the website redirects to the myopenid page, where I enter my password, and upon success, it returns back to my default.aspx, due to the following in my web.config: <authentication mode="Forms"> <forms defaultUrl="/Default.aspx" loginUrl="~/Login.aspx"/> </authentication> Now that the user is "logged in", how can handle my session? At the moment, I don't know how I can, for example, check if the session is still alive or how to terminate the session. My basic question is, how can I manage the session once the user is authenticated with OpenID ?

    Read the article

  • URLRewriter.net with multiple querystring separated by /

    - by Andreas Strandfelt
    I have been looking around the site a bit, but I didn't find any replies on how to do it the way I want. What I want is an URL like this: www.example.com/Projects/"querystring1 - text only"/"querystring2 - 4 digits only"/ to show the page with this URL: www.example.com/Projects.aspx?Region=querystring1&Zip=querystring2 What I have been trying is the following: <rewrite url="~/Leje-og-udlejning-arbejdskraft/(.+)/(.+)" to="~/Workers.aspx?Region=$1&amp;zip=$2"/> But it just takes both of them as one querysting and put them in the Region-querystring.

    Read the article

  • How to Disable the Move System Menu Item?

    - by Andreas Rejbrand
    In Microsoft Windows, this works: mnu := GetSystemMenu(h, false); EnableMenuItem(mnu, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED); But this does not work: mnu := GetSystemMenu(h, false); EnableMenuItem(mnu, SC_MOVE, MF_BYCOMMAND or MF_GRAYED); Hence I know how to disable the "Close" system menu item of a window, but not the "Move" item. How do I do that? Update Of course one alternative to using the very nice function EnableMenuItem, is to use SetMenuItemInfo: FillChar(info, sizeOf(info), 0); with info do begin cbSize := sizeOf(info); fMask := MIIM_STATE; fState := MFS_GRAYED; end; SetMenuItemInfo(mnu, SC_MOVE, false, info); But this again works perfectly for SC_CLOSE, but not at all for SC_MOVE!

    Read the article

  • searching for a programming platform with hot code swap

    - by Andreas
    I'm currently brainstorming over the idea how to upgrade a program while it is running. (Not while debugging, a "production" system.) But one thing that is required for it, is to actually submit the changed source code or compiled byte code into the running process. Pseudo Code var method = typeof(MyClass).GetMethod("Method1"); var content = //get it from a database (bytecode or source code) SELECT content FROM methods WHERE id=? AND version=? method.SetContent(content); At first, I want to achieve the system to work without the complexity of object-orientation. That leads to the following requirements: change source code or byte code of function drop functions add new functions change the signature of a function With .NET (and others) I could inject a class via an IoC and could thus change the source code. But the loading would be cumbersome, because everything has to be in an Assembly or created via Emit. Maybe with Java this would be easier? The whole ClassLoader is replacable, I think. With JavaScript I could achieve many of the goals. Simply eval a new function (MyMethod_V25) and assign it to MyClass.prototype.MyMethod. I think one can also drop functions somehow with "del" Which general-purpose platform can handle such things?

    Read the article

  • Why differs floating-point precision in C# when separated by parantheses and when separated by state

    - by Andreas Larsen
    I am aware of how floating point precision works in the regular cases, but I stumbled on an odd situation in my C# code. Why aren't result1 and result2 the exact same floating point value here? const float A; // Arbitrary value const float B; // Arbitrary value float result1 = (A*B)*dt; float result2 = (A*B); result2 *= dt; From this page I figured float arithmetic was left-associative and that this means values are evaluated and calculated in a left-to-right manner. The full source code involves XNA's Quaternions. I don't think it's relevant what my constants are and what the VectorHelper.AddPitchRollYaw() does. The test passes just fine if I calculate the delta pitch/roll/yaw angles in the same manner, but as the code is below it does not pass: X Expected: 0.275153548f But was: 0.275153786f [TestFixture] internal class QuaternionPrecisionTest { [Test] public void Test() { JoystickInput input; input.Pitch = 0.312312432f; input.Roll = 0.512312432f; input.Yaw = 0.912312432f; const float dt = 0.017001f; float pitchRate = input.Pitch * PhysicsConstants.MaxPitchRate; float rollRate = input.Roll * PhysicsConstants.MaxRollRate; float yawRate = input.Yaw * PhysicsConstants.MaxYawRate; Quaternion orient1 = Quaternion.Identity; Quaternion orient2 = Quaternion.Identity; for (int i = 0; i < 10000; i++) { float deltaPitch = (input.Pitch * PhysicsConstants.MaxPitchRate) * dt; float deltaRoll = (input.Roll * PhysicsConstants.MaxRollRate) * dt; float deltaYaw = (input.Yaw * PhysicsConstants.MaxYawRate) * dt; // Add deltas of pitch, roll and yaw to the rotation matrix orient1 = VectorHelper.AddPitchRollYaw( orient1, deltaPitch, deltaRoll, deltaYaw); deltaPitch = pitchRate * dt; deltaRoll = rollRate * dt; deltaYaw = yawRate * dt; orient2 = VectorHelper.AddPitchRollYaw( orient2, deltaPitch, deltaRoll, deltaYaw); } Assert.AreEqual(orient1.X, orient2.X, "X"); Assert.AreEqual(orient1.Y, orient2.Y, "Y"); Assert.AreEqual(orient1.Z, orient2.Z, "Z"); Assert.AreEqual(orient1.W, orient2.W, "W"); } } Granted, the error is small and only presents itself after a large number of iterations, but it has caused me some great headackes.

    Read the article

  • How to find specific/local files via CMake

    - by Andreas Romeyke
    Hello, I have a problem with a locally installed library. In my project there is the xmlrpc++0.7-library: myproject/ +-- xmlrpc++0.7/ +-- src/ I want that CMake fallbacks using the local xmlrpc++0.7 directory if not found otherwise. Two problems, the first one, find_path() or find_library() does not work with local dir. I used a workaround testing if variables processed by find_xxx() are empty or not. If empty I set them manually. The cmake generates the Makefile without errors now. But if I want to compile the project via make, the c++ compiler returns "error: XmlRpc.h: file not found". The file XmlRpc.h lies in myproject/xmlrpc++0.7/src and if I compile all them manually it works fine. Here is my CMakeLists.txt. I am very happy if anyone could me point to the right solution to use cmake under conditions described above. --- CMakeLists.txt --- project(webservice_tesseract) cmake_minimum_required(VERSION 2.6) set(CMAKE_INCLUDE_CURRENT_DIR ON) # find tesseract find_path(TESSERACT_INCLUDE_DIR tesseract/tesseractmain.h /opt/local/include /usr/local/include /usr/include ) find_library(TESSERACT_LIBRARY_DIR NAMES tesseract_main PATHS /opt/local/lib/ /usr/local/lib/ /usr/lib ) message(STATUS "looked for tesseract library.") message(STATUS "Include file detected: [${TESSERACT_INCLUDE_DIR}].") message(STATUS "Lib file detected: [${TESSERACT_LIBRARY_DIR}].") add_library(tesseract STATIC IMPORTED) set_property(TARGET tesseract PROPERTY IMPORTED_LOCATION ${TESSERACT_LIBRARY_DIR}/libtesseractmain.a ) #find xmlrpc++ message(STATUS "cmake home dir: [${CMAKE_HOME_DIRECTORY}].") set(LOCAL_XMLRPCPLUSPLUS ${CMAKE_HOME_DIRECTORY}/xmlrpc0.7++/) message(STATUS "xmlrpc++ local dir: [${LOCAL_XMLRPCPLUSPLUS}].") find_path(XMLRPCPLUSPLUS_INCLUDE_DIR XmlRpcServer.h ${LOCAL_XMLRPCPLUSPLUS}src /opt/local/include /usr/local/include /usr/include ) find_library(XMLRPCPLUSPLUS_LIBRARY_DIR NAMES XmlRpc PATHS ${LOCAL_XMLRPCPLUSPLUS} /opt/local/lib/ /usr/local/lib/ /usr/lib/ ) # next lines are an ugly workaround because cmake find_xxx() does not find local stuff if (XMLRPCPLUSPLUS_INCLUDE_DIR) else (XMLRPCPLUSPLUS_INCLUDE_DIR) set(XMLRPCPLUSPLUS_INCLUDE_DIR ${LOCAL_XMLRPCPLUSPLUS}src) endif (XMLRPCPLUSPLUS_INCLUDE_DIR) if (XMLRPCPLUSPLUS_LIBRARY_DIR) else (XMLRPCPLUSPLUS_LIBRARY_DIR) set(XMLRPCPLUSPLUS_LIBRARY_DIR ${LOCAL_XMLRPCPLUSPLUS}) endif (XMLRPCPLUSPLUS_LIBRARY_DIR) message(STATUS "looked for xmlrpc++ library.") message(STATUS "Include file detected: [${XMLRPCPLUSPLUS_INCLUDE_DIR}].") message(STATUS "Lib file detected: [${XMLRPCPLUSPLUS_LIBRARY_DIR}].") add_library(xmlrpc STATIC IMPORTED) set_property(TARGET xmlrpc PROPERTY IMPORTED_LOCATION ${XMLRPCPLUSPLUS_LIBRARY_DIR}/libXmlRpc.a ) #### link together include_directories(${XMLRPCPLUSPLUS_INCLUDE_DIR} ${TESSERACT_INCLUDE_DIR}) link_directories(${XMLRPCPLUSPLUS_LIBRARY_DIR} ${TESSERACT_LIBRARY_DIR}) add_library(simpleocr STATIC simple_ocr.cpp) add_executable(webservice_tesseract webservice.cpp) target_link_libraries(webservice_tesseract xmlrpc tesseract simpleocr)

    Read the article

  • What does O(log n) mean exactly?

    - by Andreas Grech
    I am currently learning about Big O Notation running times and amortized times. I understand the notion of O(n) linear time, meaning that the size of the input affects the growth of the algorithm proportionally...and the same goes for, for example, quadratic time O(n2) etc..even algorithms, such as permutation generators, with O(n!) times, that grow by factorials. For example, the following function is O(n) because the algorithm grows in proportion to its input n: f(int n) { int i; for (i = 0; i < n; ++i) printf("%d", i); } Similarly, if there was a nested loop, the time would be O(n2). But what exactly is O(log n)? For example, what does it mean to say that the height of a complete binary tree is O(log n)? I do know (maybe not in great detail) what Logarithm is, in the sense that: log10 100 = 2, but I cannot understand how to identify a function with a logarithmic time.

    Read the article

  • XML Node replacement in Actionscript 3

    - by Andreas
    Hi, A couple of days ago I asked a question about how to replace and edit values in an xml file with c#. The question got a great answer. Now I wonder how to do this in Actionscript and if there is an as simple way as in c#. The question can be found here: http://stackoverflow.com/questions/2856459/advanced-replace-in-c Thanks

    Read the article

  • which scope should a DAO typically have.

    - by Andreas Petersson
    its out of question that a dao will not hold any state. however, for easiest access to the class, is it better to use prototype( = new every time) or singleton? simple object creation is cheap for dao's.. it typically only holds a sessionfactory, accessing the object from a list of singletons may be equally expensive. clarfication: the focus of this question is, if there is a common convention to the scoping of daos.

    Read the article

  • Where to find great proxy servers for testing GeoIP services?

    - by Andreas
    We would like to test a GeoIP-Service. Therefore we need to go to the site with an IP from another country. There are a lot of free proxy lists like http://nntime.com/proxy-country/ The problem with them is, that only the CoDeen-Proxies are working. But with CoDeen you can't select your country of origin (the same as with TOR). You get redirected to a random proxy in the network. Where to find good proxy server for testing the GeoIP Services? Free proxy servers would be great, but if they cost something small that doesn't matter.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >