Search Results

Search found 369 results on 15 pages for 'jonas anderson'.

Page 9/15 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Rspec - Rails - How to follow a redirect

    - by Jonas Söderström
    Does anyone know how to make rspec follow a redirect (in a controller spec)? (e.g test/unit has follow_redirect!) I have tried "follow_redirect!" and "follow_redirect" but only get undefined method `follow_redirect!' for #<Spec::Rails::Example::ControllerExampleGroup::Subclass_1:0xb6df5294>

    Read the article

  • Accessing E4X nodes having special characters in name without breaking binding chain in flex.

    - by Jonas
    I am using E4X to bind some values from xml in flex 3. There is a problem when xml tag's (or attribute's) name has special character in it: having xml content var xml:XML = <tag> <special-name att="val" /> </tag> special-name could not be accessed using xml.special-name.@att because it is interpreted as subtraction, on the other hand using square bracket notation xml['special-name'].@att breaks binding chain. Is there an elegant way to solve this (like special language syntax) without writing custom binding setters and listeners?

    Read the article

  • Excel 2010 Access to path is denied temp

    - by Chris Anderson
    I am using excel data reader to read data from an excel file. FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read); //1. Reading from a binary Excel file ('97-2003 format; *.xls) IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream); //2. Reading from a OpenXml Excel file (2007 format; *.xlsx) IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream); http://exceldatareader.codeplex.com/ This reads excel 1997-2003 format and excel 2007 format on my local machine and when we move it to our test server. However, when moved to production, it works for excel 97-2003 files, but when I try to read 2007 files I receive the following error: Access to the path 'C:\Documents and Settings\PORTALS03\ASPNET\LOCALS~1\Temp\TMP_Z129388041687919815' is denied. How is it possible that the 97-2003 excel file can be read but the 2007 files throw access is denied?

    Read the article

  • VB.NET switching from ADO.NET to LINQ

    - by Cj Anderson
    I'm VERY new to Linq. I have an application I wrote that is in VB.NET 2.0. Works great, but I'd like to switch this application to Linq. I use ADO.NET to load XML into a datatable. The XML file has about 90,000 records in it. I then use the Datatable.Select to perform searches against that Datatable. The search control is a free form textbox. So if the user types in terms it searches instantly. Any further terms that are typed in continue to restrict the results. So you can type in Bob, or type in Bob Barker. Or type in Bob Barker Price is Right. The more criteria typed in the more narrowed your result. I bind the results to a gridview. Moving forward what all do I need to do? From a high level, I assume I need to: 1) Go to Project Properties -- Advanced Compiler Settings and change the Target framework to 3.5 from 2.0. 2) Add the reference to System.XML.Linq, Add the Imports statement to the classes. So I'm not sure what the best approach is going forward after that. I assume I use XDocument.Load, then my search subroutine runs against the XDocument. Do I just do the standard Linq query for this sort of repeated search? Like so: var people = from phonebook in doc.Root.Elements("phonebook") where phonebook.Element("userid") = "whatever" select phonebook; Any tips on how to best implement?

    Read the article

  • How do you encrypt parts of a file separately using pgp?

    - by Collin Anderson
    I would like to encrypt credit card numbers on a web server as they come in using PGP. I would then like to be able to export all of the credit card numbers and other information in one file that can be easily decrypted using standard PGP software. Is it possible to take the encrypted credit card numbers and join them with other encrypted data and be able to decrypt the entire file? Basically is this true? D(E(x) + E(y)) = x + y Where '+' means string concatenation.

    Read the article

  • How should I store an Java Enum in JavaDB?

    - by Jonas
    How should I store an Java Enum in JavaDB? Should I try to map the enums to SMALLINT and keep the values in source code only? The embedded database is only used by a single application. Or should I just store the values as DECIMAL? None of these solutions feels good/robust for me. Is there any better alternatives? Here is my enum: import java.math.BigDecimal; public enum Vat { NORMAL(new BigDecimal("0.25")), FOOD(new BigDecimal("0.12")), BOOKS(new BigDecimal("0.06")), NONE(new BigDecimal("0.00")); private final BigDecimal value; Vat(BigDecimal val) { value = val; } public BigDecimal getValue() { return value; } } I have read other similar questions on this topic, but the problem or solution doesn't match my problem. Enum storage in Database field, Best method to store Enum in Database, Best way to store enum values in database - String or Int

    Read the article

  • Windows 7 dsound.dll load from dll crash

    - by Jonas Byström
    I'm getting a crash when loading dsound.dll from another DLL in Windows 7. The following code crashes: #include <Windows.h> #include <mmreg.h> #include <dsound.h> #include <assert.h> HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA pDSEnumCallback, LPVOID pContext); HMODULE hDsound; BOOL CALLBACK DSEnum(LPGUID a, LPCSTR b, LPCSTR c, LPVOID d) { return TRUE; } void CrashTest() { HRESULT hr; hDsound = LoadLibraryA("dsound.dll"); assert(hDsound); *(void**)&pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, "DirectSoundEnumerateA"); assert(pDirectSoundEnumerateA); hr = pDirectSoundEnumerateA(DSEnum, NULL); assert(!FAILED(hr)); } BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved) { if (ul_reason_for_call == DLL_PROCESS_ATTACH) { DisableThreadLibraryCalls(hModule); CrashTest(); } } with this error code: Unhandled exception at ... in ...: 0xC0000005: Access violation reading location 0x00000044. (it's always 0x44 for some reason). It works on Windows XP or when loading directly from the .exe (not from a separate DLL). Help!?! :)

    Read the article

  • Microsoft Azure compared to "regular" webhosting

    - by Jonas Cannehag
    Hi all, i have an idea of putting my blog on to Azure instead of a regular webhosting company. The only thing i cannot figure out is if that will be cheaper or not. The good part is the getting-knowledge of Azure but on the other hand it is my personal blog and i really don't wanna spend to much money on it. So do you have any idea of how the pricing works? I saw some calculator but didn't manage to understand the numbers. Thanks in advance

    Read the article

  • heterogeneous comparisons in python3

    - by Matt Anderson
    I'm 99+% still using python 2.x, but I'm trying to think ahead to the day when I switch. So, I know that using comparison operators (less/greater than, or equal to) on heterogeneous types that don't have a natural ordering is no longer supported in python3.x -- instead of some consistent (but arbitrary) result we raise TypeError instead. I see the logic in that, and even mostly think its a good thing. Consistency and refusing to guess is a virtue. But what if you essentially want the python2.x behavior? What's the best way to go about getting it? For fun (more or less) I was recently implementing a Skip List, a data structure that keeps its elements sorted. I wanted to use heterogeneous types as keys in the data structure, and I've got to compare keys to one another as I walk the data structure. The python2.x way of comparing makes this really convenient -- you get an understandable ordering amongst elements that have a natural ordering, and some ordering amongst those that don't. Consistently using a sort/comparison key like (type(obj).__name__, obj) has the disadvantage of not interleaving the objects that do have a natural ordering; you get all your floats clustered together before your ints, and your str-derived class separates from your strs. I came up with the following: import operator def hetero_sort_key(obj): cls = type(obj) return (cls.__name__+'_'+cls.__module__, obj) def make_hetero_comparitor(fn): def comparator(a, b): try: return fn(a, b) except TypeError: return fn(hetero_sort_key(a), hetero_sort_key(b)) return comparator hetero_lt = make_hetero_comparitor(operator.lt) hetero_gt = make_hetero_comparitor(operator.gt) hetero_le = make_hetero_comparitor(operator.le) hetero_ge = make_hetero_comparitor(operator.gt) Is there a better way? I suspect one could construct a corner case that this would screw up -- a situation where you can compare type A to B and type A to C, but where B and C raise TypeError when compared, and you can end up with something illogical like a > b, a < c, and yet b > c (because of how their class names sorted). I don't know how likely it is that you'd run into this in practice.

    Read the article

  • git crlf configuration in mixed environment

    - by Jonas Byström
    I'm running a mixed environment, and keep a central, bare repository where I pull and push most of my stuff. This centralized repository runs on Linux, and I check out to Windows XP/7, Mac and Linux. In all repositories I put the following line in my .git/config: [core] autocrlf = true I don't have the flag safecrlf=true anywhere. First time when I modify stuff on my one Windows machine (XP) there is no problem and when I look at the diff, it looks fine. But when I do the same on the other Windows machine (7), all lines are shown as changed but local line endings are \r\n as expected (when checked in a hex editor). The same applies to a MacOSX can. Sometimes I get the feeling that the different systems wrestle on line endings, but I can't be sure (I'm loosing track of all the times I change specific files). I didn't use to have the autocrlf set, but set the flag many months back. Could that be causing my current problems? Do I need to clone everything again to loose some old baggage? Or are there other things that needs configuring too? I tried git checkout -- . about a million times, but with no success.

    Read the article

  • .NET Regular Expression to split multiple words or phrases

    - by Cj Anderson
    I'm using the code below to take a string and split it up into an array. It will take: Disney Land and make it two separate elements. If the string contains "Disney Land" then it is one element in the array. Works great, however it adds some empty elements to the array each time. So I just iterate over the elements and remove them if they are empty. Is there a tweak to the code below that will prevent those empty elements from occurring? Private m_Reg As Regex m_Reg = New Regex("([^""^\s]+)\s*|""([^""]+)""\s*") Dim rezsplit = m_Reg.Split(criteria)

    Read the article

  • What are the DB smells?

    - by Jonas Byström
    We all know 'code smells', but what are the fundamental 'database smells'? I'm a DB n00b, but I'll give an example of something that I find fishy. It seems to me like when I have to join 6-8 tables together to optimize our loading that we have a DB smell? Or would that be a pretty 'normal' database layout? (Sure, early optimization is the root of all evil, but this seems to me like early pessimisation, not to mention the cumbersomeness?)

    Read the article

  • Browsers disagree about the text of a body element

    - by Charles Anderson
    My HTML looks like this: <html> <head> <title>Test</title> <script type="text/javascript" src="jQuery.js"></script> <script type="text/javascript"> function init() { var text = jQuery('body').text(); alert('length = ' + text.length); } </script> </head> <body onload="init()">0123456789</body> </html> When I load this in Firefox, the length is reported as 10. However, in Chrome it's 11 because it thinks there's a linefeed after the '9'. In IE it's also 11, but the last character is an escape. Meanwhile, Opera thinks there are 12 characters, with the last two being CR LF. If I change the body element to include a span: <body onload="init()"><span>0123456789</span></body> and the jQuery call to: var text = jQuery('body span').text(); then all the browsers agree that the length is 10. Clearly it's the body element that's causing the issue, but can anyone explain exactly why this is happening? I'm particularly surprised because the excellent jQuery is normally browser-independent.

    Read the article

  • PHP Modify the return of a loop over and over.

    - by Joshua Anderson
    Basically I want to do a php loop that base64_encodes its self 5 times. //For example i want to encode "test" which is "dGVzdA==" then we encode "dGVzdA==" which is "ZEdWemRBPT0=" then encode "ZEdWemRBPT0=" which is "WkVkV2VtUkJQVDA9" I can't figure out how to create a loop that modifies its self each time it runs. // this is what i had function enloop($dowork){ for ($i=1; $i&lt;=5; $i++) { returns base64_encode($dowork); } } enloop($code); //THIS SCRIPT DOES THIS Repeats the encode 5 times, lets say your encodign the word test for example the output would be dGVzdA==dGVzdA==dGVzdA==dGVzdA==dGVzdA==

    Read the article

  • Can't switch on designMode in Internet Explorer

    - by Charles Anderson
    The following code works in Firefox 3.6, but not in Internet Explorer 8: <html> <head> <title>Example</title> <script type="text/javascript"> function init() { alert(document.designMode); document.designMode = "on"; alert(document.designMode); } </script> </head> <body onload="init()"> </body> </html> In FF the alerts show 'off', then 'on'; in IE they're both 'Off'. What am I doing wrong?

    Read the article

  • Silverlight Unit Testing Framework running tests in external class library

    - by Jonas Follesø
    I'm currently looking into different options for unit testing Silverlight applications. One of the frameworks available is the Silverlight Unit Test Framework from Microsoft (developed primary by Jeff Wilcox, http://www.jeff.wilcox.name/2010/05/sl3-utf-bits/). One of the scenarios I'm looking into is running the same tests on both Silverlight 3 (PC) and Windows Phone 7. The Silverlight Unit Test Framework (SLUT) runs on both PC and phone. To prevent having to copy or link files I would like to put my tests into a shared test library, that can be loaded by either a WP7 application using the SLUT, or a Silverlight 3 application using SLUT. So my question is: will SLUT load unit tests defined in a referenced class library, or only in the executing assembly?

    Read the article

  • Jasper Reports - Do I need to add all libraries to my Build Path?

    - by Jonas
    I want to use Jasper Reports in my Java application. I use Eclipse. I have added jasperreports-3.7.2.jar to my Build Path in Eclipse, but when compiling I get many NoClassDefFoundError-exceptions, so I have to add those libraries too to my Build Path. Do I really need to copy all jar-libraries that Jasper Reports are using to my lib-directory and then add them to my Build Path in Eclipse, or is it any easier way to solve this? The libraris I'm talking about are those in Jaspers Report's lib-directory, i.e. commons-digerster-1.7.jar, commons-logging-1.0.4.jar and so on...

    Read the article

  • .NET --- Textbox control - wait till user is done typing

    - by Cj Anderson
    Greetings all, Is there a built in way to know when a user is done typing into a textbox? (Before hitting tab, Or moving the mouse) I have a database query that occurs on the textchanged event and everything works perfectly. However, I noticed that there is a bit of lag of course because if a user is quickly typing into the textbox the program is busy doing a query for each character. So what I was hoping for was a way to see if the user has finished typing. So if they type "a" and stop then an event fires. However, if they type "all the way" the event fires after the y keyup. I have some ideas floating around my head but I'm sure they aren't the most efficient. Like measuring the time since the last textchange event and if it was than a certain value then it would proceed to run the rest of my procedures. let me know what you think. Language: VB.NET Framework: .Net 2.0 --Edited to clarify "done typing"

    Read the article

  • Trying to not need two separate solutions for x86 and x64 program.

    - by Sean Anderson
    Hi all, I have a program which needs to function in both an x86 and an x64 environment. It is using Oracle's ODBC drivers. I have a reference to Oracle.DataAccess.DLL. This DLL is different depending on whether the system is x64 or x86, though. Currently, I have two separate solutions and I am maintaining the code on both. This is atrocious. I was wondering what the proper solution is? I have my platform set to "Any CPU." and it is my understanding that VS should compile the DLL to an intermediary language such that it should not matter if I use the x86 or x64 version. Yet, if I attempt to use the x64 DLL I receive the error "Could not load file or assembly 'Oracle.DataAccess, Version=2.102.3.2, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format." I am running on a 32 bit machine, so the error message makes sense, but it leaves me wondering how I am supposed to efficiently develop this program when it needs to work on x64. Thanks.

    Read the article

  • Converting convex hull to binary mask

    - by Jonas
    I want to generate a binary mask that has ones for all pixels inside and zeros for all pixels outside a volume. The volume is defined by the convex hull around a set of 3D coordinates (<100; some of the coordinates are inside the volume). I can get the convex hull using CONVHULLN, but how do I convert that into a binary mask? In case there is no good way to go via the convex hull, do you have any other idea how I could create the binary mask?

    Read the article

  • Python File Search Line And Return Specific Number of Lines after Match

    - by Simos Anderson
    I have a text file that has lines representing some data sets. The file itself is fairly long but it contains certain sections of the following format: Series_Name INFO Number of teams : n1 | Team | # | wins | | TeamName1 | x | y | . . . | TeamNamen1 | numn | numn | Some Irrelevant lines Series_Name2 INFO Number of teams : n1 | Team | # | wins | | TeamName1 | num1 | num2 | . where each section has a header that begins with the Series_Name. Each Series_Name is different. The line with the header also includes the number of teams in that series, n1. Following the header line is a set of lines that represents a table of data. For each series there are n1+1 rows in the table, where each row shows an individual team name and associated stats. I have been trying to implement a function that will allow the user to search for a Team name and then print out the line in the table associated with that team. However, certain team names show up under multiple series. To resolve this, I am currently trying to write my code so that the user can search for the header line with series name first and then print out just the following n1+1 lines that represent the data associated with the series. Here's what I have come up with so far: import re print fname = raw_input("Enter filename: ") seriesname = raw_input("Enter series: ") def findcounter(fname, seriesname): logfile = open(fname, "r") pat = 'INFO Number of teams :' for line in logfile: if seriesname in line: if pat in line: s=line pattern = re.compile(r"""(?P<name>.*?) #starting name \s*INFO #whitespace and success \s*Number\s*of\s*teams #whitespace and strings \s*\:\s*(?P<n1>.*)""",re.VERBOSE) match = pattern.match(s) name = match.group("name") n1 = int(match.group("n1")) print name + " has " + str(n1) + " teams" lcount = 0 for line in logfile: if line.startswith(name): if pat in line: while lcount <= n1: s.append(line) lcount += 1 return result The first part of my code works; it matches the header line that the person searches for, parses the line, and then prints out how many teams are in that series. Since the header line basically tells me how many lines are in the table, I thought that I could use that information to construct a loop that would continue printing each line until a set counter reached n1. But I've tried running it, and I realize that the way I've set it up so far isn't correct. So here's my question: How do you return a number of lines after a matched line when given the number of desired lines that follow the match? I'm new to programming, and I apologize if this question seems silly. I have been working on this quite diligently with no luck and would appreciate any help.

    Read the article

  • How can I clip strings in Java2D and add ... in the end?

    - by Jonas
    I'm trying to print Invoices in a Java Swing applications. I do that by extending Printable and implement the method public int print(Graphics g, PageFormat pf, int page). I would like to draw strings in columns, and when the string is to long I want to clip it and let it end with "...". How can I measure the string and clip it at the right position? Some of my code: Font headline = new Font("Times New Roman", Font.BOLD, 14); g2d.setFont(headline); FontMetrics metrics = g2d.getFontMetrics(headline); g2d.drawString(myString, 0, 20); I.e How can I limit myString to be max 120px? I could use metrics.stringWidth(myString), but I don't get the position where I have to clip the string. Expected results could be: A longer string that exc... A shorter string. Another long string, but OK

    Read the article

  • Python urllib.urlopen() call doesn't work with a URL that a browser accepts

    - by Charles Anderson
    If I point Firefox at http://bitbucket.org/tortoisehg/stable/wiki/Home/ReleaseNotes, I get a page of HTML. But if I try this in Python: import urllib site = 'http://bitbucket.org/tortoisehg/stable/wiki/Home/ReleaseNotes' req = urllib.urlopen(site) text = req.read() I get the following: 500 Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. What am I doing wrong?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15  | Next Page >