Search Results

Search found 1489 results on 60 pages for 'peter'.

Page 39/60 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • How to get the position of a record in a table (SQL Server)

    - by Peter Siegmann
    Following problem: I need to get the position of a record in the table. Let's say I have five record in the table: Name: john doe, ID: 1 Name: jane doe, ID: 2 Name: Frankie Boy, ID: 4 Name: Johnny, ID: 9 Now, "Frankie Boy" is in the third position in the table. But How to get this information from the SQL server? I could count IDs, but they are not reliable, Frankie has the ID 4, but is in the third position because the record with the ID '3' was deleted. Is there a way? I am aware of ROW_RANK but it would be costly, because I need to select basically the whole set first before I can rank row_rank them. I am using MS SQL Server 2008 R2.

    Read the article

  • HAML-like syntax for non-HTML documents?

    - by Peter
    I love using HAML for HTML documents. It has clean syntax that's much more attractive than ERB. It works perfectly for HTML documents. What about for non-HTML? Such as, for example, an email or text document with certain automatically-substituted components? I've been falling back to ERB, but don't like the heavy syntax compared to HAML. Is there any way to use HAML for ordinary documents without having divs and html elements appear when % and . start a line? Or is there some alternative to both HAML and ERB that I should investigate?

    Read the article

  • Passing information safely between Wicket and Hibernate in long running conversations

    - by Peter Tillemans
    We are using Wicket with Hibernate in the background. As part of out UI we have quite long running conversations spanning multiple requests before the updated information is written back to the database. To avoid getting hibernate errors with detached objects we are now using value objects to transfer info from the service layer to Wicket. However we now end up with an explosion of almost the same objects : e.g. Answer (mapped entity saved in hibernate) AnswerVO (immutable value object) AnswerModel (A mutable bean in the session domain) IModel wrapped Wicket Model and usually this gets wrapped in a CompoundPropertyModel This plumbing becomes exponentially worse when collections to other objects are involved in the objects. There has to be a better way to organize this. Can anyone share tips to make this less onerous? Maybe make the value objects mutable so we can remove the need for a seaprate backing bean in Wicket? Use the entity beans but absolutely make dead-certain they are detached from hibernate. (easier said than done)? Some other tricks or patterns?

    Read the article

  • Glob() filesearch, question

    - by Peter
    Hi, a little question. I have this code, which is works perfect for files, but If am trying search on a directory name, the result is blank. How I can fix that? <?php function listdirs($dir,$search) { static $alldirs = array(); $dirs = glob($dir."*"); foreach ($dirs as $d){ if(is_file($d)){ $filename = pathinfo($d); if(eregi($search,$filename['filename'])){ print "<a href=http://someurl.com/" . $d .">". $d . "</a><br/>"; } }else{ listdirs($d."/",$search); } } } $path = "somedir/"; $search= "test"; listdirs($path,$search); ?> somedir/test/ result: blank (I want: /somedir/test/) somedir/test/test.txt result: OK I want to search also in the directory names, how I can do that?

    Read the article

  • iPhone app works hundreds of times, then crashes from memory error on startup, then never works unti

    - by peter
    I have a Cocos2d/openGL iPhone game. It's a universal app and I'm dealing with an occasional but nasty error on the iPad. We are loading a lot of textures up front (3 2048x2048 textures). I'm working on reducing this up front load, but what worries me is I really don't understand the root cause of this crash that permanently breaks the app. This is the deal: 1. App works fine for hundreds of plays on the iPad 2. Eventually (I'm guessing due to other programs using up some memory and not letting go or whatever) the app starts crashing on startup. It just closes again in the middle of loading. 3. The App will now never work again on that iPad, closing immediately every time, until the iPad is restarted. Obviously my app is demanding too much memory up front to work reliably every time, I get that. What I don't get is why when it fails once, it has failed forever until the iPad is restarted. Can anyone explain what is going on here? EDIT: forgot to add organizer crash lags just say low memory, like this every time (I changed my app name to MyAppName below). Again, I know it's low memory, but why does it stay low memory until restart?: Incident Identifier: E7A2507C-3FB1-4E3B-B315-09F094236541 CrashReporter Key: 0fda9d667f2c6073f20a76809aa25438b6854d15 OS Version: iPhone OS 3.2 (7B367) Date: 2010-04-30 16:59:44 -0400 Free pages: 437 Wired pages: 17228 Purgeable pages: 0 Largest process: MyAppName Processes Name UUID Count resident pages MyAppName <6307ce41802850944baa78d29224fa7f> 22385 (jettisoned) (active) mediaserverd <ea8bac28b06fe3980fdd44b5caceb563> 242 DTMobileIS <a0f651e43881e66f50f8a95abea72921> 5826 notification_pro <4c9a7ee0a5bbe160465991228f2d2f2e> 67 syslog_relay <4ceaed776d2df957fa130712f4ef21d0> 66 notification_pro <4c9a7ee0a5bbe160465991228f2d2f2e> 67 notification_pro <4c9a7ee0a5bbe160465991228f2d2f2e> 67 afcd <4f3c9566e33b4463f05603d990584e5d> 72 ptpd <83de0f774bd6553d513ae9e19b0f9b56> 181 syslogd <66247e305d5c0bf6f1ce1cc950653263> 81 lsd <a4d852c1c8da2b3d231bdc90887b52ba> 130 iapd <a8534cbde4b90ad5915dd26ab03ff3e3> 204 notifyd <5e9d5bee7c3eae1c8b494c79eb11406e> 71 BTServer <64e4a6ea6b1240db2331e05a29caa862> 108 CommCenter <97bf297944ac4bde19bcee96dd23bd5f> 181 SpringBoard <c7a5904c12db7b14334a4edaa4cabaa9> 5339 (active) configd <aca9fa3380322669164fd6b1a3864300> 373 fairplayd.K48 <2d997ffca1a568f9c5400ac32d8f0782> 84 locationd <dd1ea88105c62173908ce767db5c4d37> 599 mDNSResponder <820560222d47a1f2a0dce98a7f8a9721> 108 lockdownd <497fd54c79a680bf29f5d9320f514613> 303 MobileStorageMou <c277b79c2157c4dc5cfc5c3ca35bd5f2> 69 launchd <66972eee4d865c4383b33d985d22994b> 98 **End**

    Read the article

  • Anybody Know of any Tools to help Analysing .NET Trace Log Files?

    - by peter
    I am developing a C# .NET application. In the app.config file I add trace logging as shown, <?xml version="1.0" encoding="UTF-8" ?> <configuration> <system.diagnostics> <trace autoflush="true" /> <sources> <source name="System.Net.Sockets" maxdatasize="1024"> <listeners> <add name="MyTraceFile"/> </listeners> </source> </sources> <sharedListeners> <add name="MyTraceFile" type="System.Diagnostics.TextWriterTraceListener" initializeData="System.Net.trace.log" /> </sharedListeners> <switches> <add name="System.Net" value="Verbose" /> </switches> </system.diagnostics> </configuration> Are there any good tools around to analyse the log file that is output? The output looks like this, System.Net.Sockets Verbose: 0 : [5900] Data from Socket#8764489::Send DateTime=2010-04-07T03:22:40.1067012Z System.Net.Sockets Verbose: 0 : [5900] 00000000 : 4D 49 4D 45 2D 56 65 72-73 69 6F 6E 3A 20 31 2E : MIME-Version: 1. DateTime=2010-04-07T03:22:40.1067012Z System.Net.Sockets Verbose: 0 : [5900] 00000060 : 65 3A 20 37 20 41 70 72-20 32 30 31 30 20 31 35 : e: 7 Apr 2010 15 DateTime=2010-04-07T03:22:40.1067012Z System.Net.Sockets Verbose: 0 : [5900] 00000070 : 3A 32 32 3A 34 30 20 2B-31 32 30 30 0D 0A 53 75 : :22:40 +1200..Su DateTime=2010-04-07T03:22:40.1067012Z System.Net.Sockets Verbose: 0 : [5900] 00000080 : 62 6A 65 63 74 3A 20 5B-45 72 72 6F 72 5D 20 45 : bject: [Error] E DateTime=2010-04-07T03:22:40.1067012Z System.Net.Sockets Verbose: 0 : [5900] 00000090 : 78 63 65 70 74 69 6F 6E-20 69 6E 20 53 79 6E 63 : xception in Sync DateTime=2010-04-07T03:22:40.1067012Z System.Net.Sockets Verbose: 0 : [5900] 000000A0 : 53 65 72 76 69 63 65 20-28 32 30 30 38 2E 30 2E : Service (2008.0. DateTime=2010-04-07T03:22:40.1067012Z System.Net.Sockets Verbose: 0 : [5900] 000000B0 : 33 30 34 2E 31 32 33 34-32 29 0D 0A 43 6F 6E 74 : 304.12342)..Cont DateTime=2010-04-07T03:22:40.1067012Z Is there anything that can take the output shown above (my output is a text file 100mb in size), group together packets, and help out with finding particular issues I would like to hear about it. Thanks.

    Read the article

  • Joomla - output ' instead of \'

    - by Peter Perhác
    Hello there, all of my Joomla site's contents shows apostrophes as \' instead of just '. Now my head is spinning from looking at all the million places where individual components and joomla itself does add/remove slashes and deals with magic quotes and all of this... I also found that one can rather easily write one's own OutputFilter for the patTemplate, so I thought maybe I would just do a str_replace of all \' to '. Doesn't sound right. How to deal with these apostrophes?

    Read the article

  • fastest way to crawl recursive ntfs directories in C++

    - by Peter Parker
    I have written a small crawler to scan and resort directory structures. It based on dirent(which is a small wrapper around FindNextFileA) In my first benchmarks it is surprisingy slow: around 123473ms for 4500 files(thinkpad t60p local samsung 320 GB 2.5" HD). 121481 files found in 123473 milliseconds Is this speed normal? This is my code: int testPrintDir(std::string strDir, std::string strPattern="*", bool recurse=true){ struct dirent *ent; DIR *dir; dir = opendir (strDir.c_str()); int retVal = 0; if (dir != NULL) { while ((ent = readdir (dir)) != NULL) { if (strcmp(ent->d_name, ".") !=0 && strcmp(ent->d_name, "..") !=0){ std::string strFullName = strDir +"\\"+std::string(ent->d_name); std::string strType = "N/A"; bool isDir = (ent->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !=0; strType = (isDir)?"DIR":"FILE"; if ((!isDir)){ //printf ("%s <%s>\n", strFullName.c_str(),strType.c_str());//ent->d_name); retVal++; } if (isDir && recurse){ retVal += testPrintDir(strFullName, strPattern, recurse); } } } closedir (dir); return retVal; } else { /* could not open directory */ perror ("DIR NOT FOUND!"); return -1; } }

    Read the article

  • Simple neon optimization in Android

    - by Peter
    In my Android application, I use a bunch of open source libraries such as libyuv, libvpx, libcrypto, libssl, etc. Some of them come with Android.mk. For others, I hand-crafted Android.mk. The code is built only for arm for now. Here is my Application.mk: APP_ABI := armeabi-v7a APP_OPTIM := release APP_STL := gnustl_static APP_CPPFLAGS := -frtti I am looking for way to generate binaries that are optimized for neon. Browsing the net, I found the following setting that someone is using in his Android.mk: LOCAL_CFLAGS += -mfloat-abi=softfp -mfpu=neon -march=armv7 I wonder if I simply put this setting in Application.mk, will it automatically get applied across all the libraries? A step before each library is built is the following: include $(CLEAR_VARS) Is it better to include LOCAL_CFLAGS directive after this line (instead of including it in Application.mk)? Finally, why doesn't ndk-build automatically optimize for neon when it sees armabi in Application.mk? Regards.

    Read the article

  • Eclipse script for commit on close?

    - by Peter Nguyen
    Hi, I was wondering how to create a Eclipse script (Eclipsemonkey) to commit the current project on closing of Eclipse? You can listen to commands such as "org.eclipse.ui.file.save" (on file save) etc. but what's the command for editor closing? And how can you call a commit action?

    Read the article

  • Django and mod_python intermittent error?

    - by Peter
    I have a Django site at http://sm.rutgers.edu/relive/af_api/index/. It is supposed to display "Home of the relive APIs". If you refresh this page many times, you can see different renderings. 1) The expected page. 2) Django "It worked!" page. 3) "ImportError at /index/" page. If you scroll down enough to ROOT_URLCONF part, you will see it says 'relive.urls'. But apparently, it should be 'af_api.urls', which is in my settings.py file. Since these results happen randomly, is it possible that either Django or mod_python is working unstably?

    Read the article

  • How to detect if a LINQ enumeration is materialized?

    - by Peter Lillevold
    Is there some way of detecting whether an enumerable built using LINQ (to Objects in this case) have been materialized or not? Other than trying to inspect the type of the underlying collection? Specifically, since enumerable.ToArray() will build a new array even if the underlying collection already is an array I'm looking for a way of avoiding ToArray() being called twice on the same collection.

    Read the article

  • PHP regular expression for positive number with 0 or 2 decimal places

    - by Peter
    Hi I am trying to use the following regular expression to check whether a string is a positive number with either zero decimal places, or 2: ^\d+(\.(\d{2}))?$ When I try to match this using preg_match, I get the error: Warning: preg_match(): No ending delimiter '^' found in /Library/WebServer/Documents/lib/forms.php on line 862 What am I doing wrong?

    Read the article

  • How to replace the nth column/field in a comma-separated string using sed/awk?

    - by Peter Meier
    assume I have a string "1,2,3,4" Now I want to replace, e.g. the 3rd field of the string by some different value. "1,2,NEW,4" I managed to do this with the following command: echo "1,2,3,4" | awk -F, -v OFS=, '{$3="NEW"; print }' Now the index for the column to be replaced should be passed as a variable. So in this case index=3 How can I pass this to awk? Because this won't work: echo "1,2,3,4" | awk -F, -v OFS=, '{$index="NEW"; print }' echo "1,2,3,4" | awk -F, -v OFS=, '{$($index)="NEW"; print }' echo "1,2,3,4" | awk -F, -v OFS=, '{\$$index="NEW"; print }' Thanks for your help!

    Read the article

  • Python proper use of __str__ and __repr__

    - by Peter
    Hey, My current project requires extensive use of bit fields. I found a simple, functional recipe for bit a field class but it was lacking a few features I needed, so I decided to extend it. I've just got to implementing __str__ and __repr__ and I want to make sure I'm following convention. __str__ is supposed to be informal and concice, so I've made it return the bit field's decimal value (i.e. str(bit field 11) would be "3". __repr__ is supposed to be a official representation of the object, so I've made it return the actual bit string (i.e. repr(bit field 11) would be "11"). In your opinion would this implementation meet the conventions for str and repr? Additionally, I have used the bin() function to get the bit string of the value stored in the class. This isn't compatible with Python < 2.6, is there an alternative method? Cheers, Pete

    Read the article

  • build an API service in Django

    - by Peter
    Hi all, I want to build an API service using Django. A basic workflow goes like this: First, an http request goes to http://mycompany.com/create.py?id=001&callback=http://callback.com. It will create a folder on the server with name 001. Second, if the folder does not exist, it will be created. You get response immediately in XML format. It will look like: <?xml version="1.0" encoding="UTF-8"?> <response> <status> <statusCode>0</statusCode> <message>Success</message> </status> <group id="001"/> </response> Finally, the server will do its job (i.e. creating the folder). After it is done, the server does a callback to the URL provided. Currently, I use return render_to_response('create.xml', {'statusCode': statusCode, 'statusMessage': statusMessage, 'groupId': groupId, }, mimetype = 'text/xml') to send the XML response back. I have an XML template which has statusCode, statusMessage, groupId placeholders. <?xml version="1.0" encoding="UTF-8"?> <response> <status> <statusCode>{{ statusCode }}</statusCode> <message>{{ statusMessage }}</message> </status> {% if not statusCode %} <group id="{{ groupId }}"/> {% endif %} </response> But in this way I have to put step 3 before step 2, because otherwise step 3 will not be executed if it is after return statement. Can somebody give me some suggestions how to do this? Thanks.

    Read the article

  • How to allow click-through and a cursor in a background app while not taking the active appearance a

    - by Peter Hosey
    Here are my goals: My application displays an overlay window above all applications' window. The user can draw in the overlay window. The mouse cursor changes to a specific cursor while in the overlay window. The application that has the active appearance before summoning the overlay window still has it while the overlay window is up and usable. The user does not need to click on the overlay window to activate it before they can draw. Drawing in the window does not steal the active appearance away from the application that has it. With LSUIElement, I get #1, #2, #3, and #5. With LSBackgroundOnly, I get #1, #2, #4, and #6. How can I satisify all of these goals without installing an event tap and processing the mouse events myself? Things I've tried: [NSApp preventWindowOrdering] in mouseDown: [NSApp activateIgnoringOtherApps:YES] in applicationWillFinishLaunching: [myWindow orderFront:nil] in applicationWillFinishLaunching: [myWindow makeKeyAndOrderFront:nil] in applicationWillFinishLaunching: [myWindow orderFrontRegardless] in applicationWillFinishLaunching: [myWindow makeMainWindow] in applicationWillFinishLaunching: (this caused failure of point 4 even with LSBackgroundOnly) SetThemeCursor in applicationWillFinishLaunching: (With LSUIElement) Implementing canBecomeMainWindow in my NSPanel subclass to return NO Except where otherwise noted, none of these made any difference. So, with LSUIElement, goals #4 and #6 remain; with LSBackgroundOnly, goals #3 and #5 remain. Any suggestions?

    Read the article

  • Implementing Multitasking on an iPhone/iOS4 Web App

    - by Peter Watts
    I am looking to build a web app that implements background audio and fast app switching. These features work out of the box, when run as regular Safari web pages, but as soon as you add the web-app-capable tag, and try to run in full screen mode, this functionality breaks. I did some testing and even the most basic web app will reload every time when you switch back to it. And seeing as it's a web app, we can't exactly implement the multitasking API. Has anyone found a work around? This isn't a deal-breaker, as you can just avoid full screen mode, but then you also lose the ability to use your own icon in the app switch tray. Perhaps this explains a lack of full screen mode in YouTube's new web app....

    Read the article

  • How do I swallow the dropdown behavior inside an Expander.Header?

    - by Peter Seale
    Hello, I would like to prevent an Expander from expanding/collapsing when users click inside the header area. This is basically the same question as Q 1396153, but I'd appreciate a more favorable answer :) Is there a non-invasive way to do this? I am not sure exactly how to attach behavior to the Expander.Header content to prevent mouseclicks. I'm willing to float in content outside the expander itself via a fixed grid layout, but I'm not keen on the solution. Ideas? XamlPad sample XAML: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Expander> <Expander.Header><TextBlock>When I click this text, I don't want to trigger expansion/collapse! Only when I click the expander button do I want to trigger an expand/collapse!</TextBlock></Expander.Header> <Grid Background="Red" Height="100" Width="100" > </Grid> </Expander> </Page>

    Read the article

  • Forcing Kernel::method_name to be called in Ruby

    - by Peter
    I want to add a foo method to Ruby's Kernel module, so I can write foo(obj) anywhere and have it do something to obj. Sometimes I want a class to override foo, so I do this: module Kernel private # important; this is what Ruby does for commands like 'puts', etc. def foo x if x.respond_to? :foo x.foo # use overwritten method. else # do something to x. end end end this is good, and works. but, what if I want to use the default Kernel::foo in some other object that overwrites foo? Since I've got an instance method foo, I've lost the original binding to Kernel::foo. class Bar def foo # override behaviour of Kernel::foo for Bar objects. foo(3) # calls Bar::foo, not the desired call of Kernel::foo. Kernel::foo(3) # can't call Kernel::foo because it's private. # question: how do I call Kernel::foo on 3? end end Is there any clean way to get around this? I'd rather not have two different names, and I definitely don't want to make Kernel::foo public.

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >