Daily Archives

Articles indexed Monday March 8 2010

Page 12/124 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Sorting Arrays by More the One Value, and Prioritizing the Sort based on Column data.

    - by Mark Tomlin
    I'm looking for a way to sort an array (we call this a row), with an array of values (that I'll call columns). Each row has columns that must be sorted based on the priority of: timetime, lapcount & timestamp. Each column cotains this information: split1, split2, split3, laptime, lapcount, timestamp. laptime if in hundredths of a second. (1:23.45 or 1 Minute, 23 Seconds & 45 Hundredths is 8345.) Lapcount is a simple unsigned tiny int, or unsigned char. timestamp is unix epoch. The lowest laptime should be at the get a better standing in this sort. Should two peoples laptimes equal, then timestamp will be used to give the better standing in this sort. Should two peoples timestamp equal, then the person with less of a lapcount get's the better standing in this sort. By better standing, I mean closer to the top of the array, closer to the index of zero where it a numerical array. I think the array sorting functions built into php can do this with a callback, I was wondering what the best approch was for a weighted sort like this would be.

    Read the article

  • javascript arrays and type conversion inconsistencies

    - by ForYourOwnGood
    I have been playing with javascript arrays and I have run into, what I feel, are some inconsistencies, I hope someone can explain them for me. Lets start with this: var myArray = [1, 2, 3, 4, 5]; document.write("Length: " + myArray.length + "<br />"); for( var i in myArray){ document.write( "myArray[" + i + "] = " + myArray[i] + "<br />"); } document.write(myArray.join(", ") + "<br /><br />"); Length: 5 myArray[0] = 1 myArray[1] = 2 myArray[2] = 3 myArray[3] = 4 myArray[4] = 5 1, 2, 3, 4, 5 There is nothing special about this code, but I understand that a javascript array is an object, so properities may be add to the array, the way these properities are added to an array seems inconsistent to me. Before continuing, let me note how string values are to be converted to number values in javascript. Nonempty string - Numeric value of string or NaN Empty string - 0 So since a javascript array is an object the following is legal: myArray["someThing"] = "someThing"; myArray[""] = "Empty String"; myArray["4"] = "four"; for( var i in myArray){ document.write( "myArray[" + i + "] = " + myArray[i] + "<br />"); } document.write(myArray.join(", ") + "<br /><br />"); Length: 5 myArray[0] = 1 myArray[1] = 2 myArray[2] = 3 myArray[3] = 4 myArray[4] = four myArray[someThing] = someThing myArray[] = Empty String 1, 2, 3, 4, four The output is unexpected. The non empty string "4" is converted into its numeric value when setting the property myArray["4"], this seems right. However the empty string "" is not converted into its numeric value, 0, it is treated as an empty string. Also the non empty string "something" is not converted to its numeric value, NaN, it is treated as a string. So which is it? is the statement inside myArray[] in numeric or string context? Also, why are the two, non numeric, properities of myArray not included in myArray.length and myArray.join(", ")?

    Read the article

  • Convert the uploaded files to specific file format which can not download

    - by Avinash
    Hi, I have a problem regarding to prevent download and saving of uploaded files. My users can upload multiple files types like doc, pdf, ppt,etc.... This all file types are easily download if any one have url. So what is the better way to prevent the download of the file. Or i convert the uploaded files to some specific format which can not download easily (e.g flash).. I am running on php and mysql. Thanks Avinash

    Read the article

  • HTML to RTF Converter for .NET

    - by nickyt
    I've already seen lots of posts on the site for RTF to HTML and some other posts talking about some HTML to RTF converters, but I'm really trying to get a full breakdown of what is considered the most widely used commercial product, open source product or if people recommend going home grown. Apologies if you consider this a duplicate question, but I'm trying to create a product matrix to see what is the most viable for our application. I also think this would be helpful for others. The converter would be used in an ASP.NET 2.0 application (we're upgrading to 3.5 shortly but still sticking with WebForms) using SQLServer 2005 (soon 2008) as the DB. From reading a few posts, SautinSoft appears to be popular as a commercial component. Are there other commercial components that you'd recommend for converting HTML to RTF? Price does matter, but even if it's a little on the expensive side, please list it. For open source, I read that OpenOffice.org can be run as a service so that it can convert files. However, this appears to be only Java based. I imagine, I'd need some kind of interop to use this? What .NET open source components, if any, are out there for converting HTML to RTF? For home grown, is an XSLT the way to go with XHTML? If so, what component do you recommend for generating XHTML? Otherwise, what other home grown avenuses do you recommend. Also, please note that I currently don't care so much about RTF to HTML. If a commercial component offers this and the price is still the same, fine, otherwise please don't mention it.

    Read the article

  • Using Tkinter in python to edit the title bar

    - by Dan
    I am trying to add a custom title to a window but I am having troubles with it. I know my code isn't right but when I run it, it creates 2 windows instead, one with just the title tk and another bigger window with "Simple Prog". How do I make it so that the tk window has the title "Simple Prog" instead of having a new additional window. I dont think I'm suppose to have the Tk() part because when i have that in my complete code, there's an error from tkinter import Tk, Button, Frame, Entry, END class ABC(Frame): def __init__(self,parent=None): Frame.__init__(self,parent) self.parent = parent self.pack() ABC.make_widgets(self) def make_widgets(self): self.root = Tk() self.root.title("Simple Prog")

    Read the article

  • Revision Control For Windows CE

    - by Nathan Campos
    I have a HP Jornada 720 with Windows CE 3, called Handheld PC 2000. And as a good developer, I want to turn it into a fully-featured Scheme development environment. I already have Pocket Scheme on it, but now I need a revision control for my pocket development environment. Then I want to know: Where I can get it?

    Read the article

  • Modularizing web applications

    - by Matt
    Hey all, I was wondering how big companies tend to modularize components on their page. Facebook is a good example: There's a team working on Search that has its own CSS, javascript, html, etc.. There's a team working on the news feed that has its own CSS, javascript, html, etc... ... And the list goes on They cannot all be aware of what everyone is naming their div tags and whatnot, so what's the controller(?) doing to hook all these components in on the final page?? Note: This doesn't just apply to facebook - any company that has separate teams working on separate components has some logic that helps them out. EDIT: Thanks all for the responses, unfortunately I still haven't really found what I'm looking for - when you check out the source code (granted its minified), the divs have UIDs, my guess is that there is a compilation process that runs through and makes each of the components unique, renaming divs and css rules.. any ideas? Thanks all! Matt Mueller

    Read the article

  • Access Home Network Server via External Address

    - by Dominic Barnes
    For the last few months, I've been using a server on my home network for basic backups and hosting some small websites. Up until this past week, I've been using Comcast (cable) as an ISP and now that I've moved into an apartment, I'm using AT&T. (DSL) I've set up dynamic DNS and I can verify it works externally. However, I can't seem to access the public address from within the local network. Is there something DSL does differently from Cable that makes this frustration possible?

    Read the article

  • Screen capture of USB connected CE device

    - by Sorskoot
    Does anyone know if there's a tool to capture a video from a CE device (like this)? I used the Windows CE Remote Zoom-in to capture stills, but for presentation purposes I would like to show moving images. The devices is connected a pc using USB. I've tried using a webcam, but I have to move the device around all the time to scan products.

    Read the article

  • Problem with tomcat and getLocalHost exception

    - by xain
    I'm running a Linux server named S1 in a "cloud" server, and when tomcat 6.0.24 starts, I get the exception: org.apache.catalina.connector.Connector pause SEVERE: Protocol handler pause failed java.net.UnknownHostException: S1: S1 at java.net.InetAddress.getLocalHost(InetAddress.java:1353) at org.apache.jk.common.ChannelSocket.unLockSocket(ChannelSocket.java:485) Which then leads to: ERROR ehcache.Cache - Unable to set localhost. This prevents creation of a GUID. Cause was: Sjira1: S1 java.net.UnknownHostException: S1: S1 at java.net.InetAddress.getLocalHost(InetAddress.java:1353) at net.sf.ehcache.Cache.<clinit>(Cache.java:143) My hosts file is: 127.0.0.1 localhost localhost.localdomain (valid-ip-address) S1 S1.(valid domain name) ping S1 and S1.(valid domain name) return valid ip address nslookup S1.(valid domain name) returns valid ip address nslookup S1 throws ** server can't find S1: NXDOMAIN Any ideas about how to fix this ? Thanks

    Read the article

  • Prevent app from auto-launching in OS X - what are ALL the places to look?

    - by Justin Searls
    An app on a Mac that automatically launches on boot and I don't want it to. The app itself offers no way to prevent this. Rather than identify the app, I figured it would be nice to use this question as an opportunity to identify all the places such an app could hide. Here's where I've looked so far, and I still haven't found it: Accounts - Login Items Dock - Open at Login launchd - Cycled through each tab of agents & daemons in Lingon Other ideas?

    Read the article

  • What is the best answer for: "my Internet is not working"?

    - by Maciek Sawicki
    Hi, I look for work in IT Support. One of interview questions is: what would you first say if user call You and tell my Internet is not working? I think about it a lot and still don't know what is correct answerer nor what answer my future employer expects. My choice would be something like: What part of Internet? (but more polite). For example I could ask for opening web page that works on my PC. Please give only serious answers. If You want BOFH or "The website is down" style answers I can create separate question for that.

    Read the article

  • Calibrate Screen Measurements / Scaling in Mac OS X

    - by orphu
    Is there a way to adjust the scaling of items on the screen in Mac OS X so they are 1 to 1 with the real world? I.E. When I'm working with a line in illustrator that is 5 inches long, and the zoom is 100%, I'd like the actual size of the line on screen to be 5 inches. I've dug into the System Preferences but can't seem to find anything related to this. I'm using Snow Leopard on a 24" iMac

    Read the article

  • Carbonite has taken over my iMac

    - by Larry Rothfork
    I used Carbonite to back up 75GB on my iMac. I also created a folder on my iMac to copy files to, from an external hard drive and then use Carbonite to back up from there. And THEN thinking I had everything safely backed up and, in order to make room on my hard drive I DELETED some of those files, and instead of increasing disk space..my disk space has shrunk to 2GB... I know, I know..you can't use Carbonite like that, but now I have two questions. 1) What is the explanation for the decrease in disk space even though I have deleted about 20GB of those backed up files from my hard drive? It must have something to do with the way Carbonite references backed up files, And 2) Is there a way to extricate myself from this situation?

    Read the article

  • Why is my implementation of the Sieve of Atkin overlooking numbers close to the specified limit?

    - by Ross G
    My implementation either overlooks primes near the limit or composites near the limit. while some limits work and others don't. I'm am completely confused as to what is wrong. def AtkinSieve (limit): results = [2,3,5] sieve = [False]*limit factor = int(math.sqrt(lim)) for i in range(1,factor): for j in range(1, factor): n = 4*i**2+j**2 if (n <= lim) and (n % 12 == 1 or n % 12 == 5): sieve[n] = not sieve[n] n = 3*i**2+j**2 if (n <= lim) and (n % 12 == 7): sieve[n] = not sieve[n] if i>j: n = 3*i**2-j**2 if (n <= lim) and (n % 12 == 11): sieve[n] = not sieve[n] for index in range(5,factor): if sieve[index]: for jndex in range(index**2, limit, index**2): sieve[jndex] = False for index in range(7,limit): if sieve[index]: results.append(index) return results For example, when I generate a primes to the limit of 1000, the Atkin sieve misses the prime 997, but includes the composite 965. But if I generate up the limit of 5000, the list it returns is completely correct.

    Read the article

  • how to change file permissions in postfix ?

    - by Zdanozdan
    Hi, In the postfix main.cf I have configured service to invoke external php script. smtp inet n - - - - smtpd -o content_filter=myservice:www-data myservice unix - n n - 1 pipe flags=Rq user=me null_sender= argv=/home/me/my_script.php so far so good, my_script.php is executed. It creates the file my_file.txt in home dir. However I can only manage -rw------- 1 me www-data 16 2009-10-11 19:35 my_file.txt How do I add 'r' permissions for www-data group ?

    Read the article

  • Mac - Flash file not loaded in independent flash player

    - by Mugdha
    Hi, I am working on an independent application to play flash files on Mac. I have already done the same for Linux, and it works flawlessly but on mac for some reason flash is not drawing to my window. It is not throwing any kind of error too. I am using Flash player 10, that would mean that I am using the Core Graphics drawing model. I am able to send mouse events to flash and wrote a sample plugin to check if there was a problem in the context that I was sending, but my sample plugin draws properly to the window. I am getting a call for NPN_InvalidateRect twice and as a response I send an update Event back to flash. I drew a dummy rectangle to check that my context is correct. I have flipped the context to make the origin as top left corner. On doing right click on the debug version of the flash player it shows the following message: "Movie not loaded..." Can anyone give me any idea why is the content not being drawn? I would really appreciate the help, as I have been struggling with it for more than a month now. Here is a small log of the interaction that I have with flash: NPN_UserAgent Called NPN_GetValue Called with variable NPNVWindowNPObject; return NULL NPN_GetValue Called with variable NPNVWindowNPObject; return NULL NPN_GetValue Called with variable NPNVSupportsWindowless; return true NPN_SetValue Called for Variable - NPPVpluginTransparentBool; return true NPN_GetValue Called with variable NPNVsupportsCoreGraphicsBool; return true NPN_SetValue Called for Variable - NPNVpluginDrawingModel NPP_SetWindow (CoreGraphics): 0, window=0xebaa90, context=0xe4c930, window.x:0 window.y:22 window.width:480 window.height:270 NPP_HandleEvent(activateEvent) accepted:0 isActive: 1 NPP_HandleEvent(updateEvt) accepted: 1 NPN_UserAgent Called NPN_GetURLNotify Called with URL - javascript:top.location+"flashplugin_unique" NPN_GetValue Called with variable NPNVWindowNPObject; return NULL NPP_NewStream URL=/Users/mjain/Desktop/clock.swf MIME=application/x-shockwave-flash error=0 NPP_WriteReady responseURL=/Users/mjain/Desktop/clock.swf bytes=268435455 NPN_InvalidateRect Called NPP_Write responseURL=/Users/mjain/Desktop/clock.swf bytes=9925 total-delivered=9925/9925 NPP_WriteReady responseURL=/Users/mjain/Desktop/clock.swf bytes=268435455 NPP_DestroyStream responseURL=/Users/mjain/Desktop/clock.swf error=0 NPP_HandleEvent(updateEvt) accepted: 1 NPN_InvalidateRect Called NPP_HandleEvent(updateEvt) accepted: 1 NPP_NewStream URL=javascript:top.location+"flashplugin_unique" MIME=text/plain error=0 NPP_WriteReady responseURL=javascript:top.location+"flashplugin_unique" bytes=16000 NPN_UserAgent Called NPP_Write responseURL=javascript:top.location+"flashplugin_unique" bytes=52 total-delivered=52/52 NPP_WriteReady responseURL=javascript:top.location+"flashplugin_unique" bytes=16000 NPP_DestroyStream responseURL=javascript:top.location+"flashplugin_unique" error=0 NPP_URLNotify responseURL=javascript:top.location+"flashplugin_unique" reason=0 Thanks Mugdha.

    Read the article

  • sql database connection on remote server

    - by arti pathak
    i create my web site on asp.net and i create database in sql using inbuilt it in visual studio i use step to create database 1.right click on solution explorer then add newSqldatabase then ok then if i connect it by coding then it will work on my local PC but actuall i am making website so i want to store it on my web server then if i load databse file (.mdf) file in my web server where my all files are loaded then it is showing it error "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)" so please help me and send me all step how i create database and what coding i use to connect on remote server....... Thank You......

    Read the article

  • jquery accordion - set input focus for active accordion?

    - by KnockKnockWhosThere
    *Nevermind... figured it out... * did it like this: $("#accordion").accordion({ header:'h3', active: '#section1', autoheight: false, clearstyle: true, }).bind("change.ui-accordion", function(event,ui) { $("#text1").focus(); }); I've got an accordion all set up, and each div has a form within it. I'm just trying to figure out how to set the focus on an input field depending on which one is open... /* accordion */ $("#accordion").accordion({ header:'h3', active: '#section1', autoheight: false, clearstyle: true }); Basically, I want to set the cursor in the first input field for whichever section is open. The actual forms are much bigger, so I condensed it enormously... <div id="accordion"> <h3 id="section1"><a href="#">Section 1/a></h3> <div> <form id="form1" action="form.php" method="post"> <fieldset class="inside"> <input type="text" name="text1" id="text1" size="50" value="Default text" /> <input class="open" type="button" value="Submit" name="submit1" /> </fieldset> </form> </div><!--/div--> <h3 id="section2"><a href="#">Section 2</a></h3> <div> <form id="form2" action="form.php" method="post"> <fieldset class="inside"> <input type="text" name="text2" id="text2" size="50" value="Submit" /> <input class="open" type="button" value="Submit" name="submit2" /> </fieldset> </form> </div><!--/div--> <h3 id="section3"><a href="#">Section 3</a></h3> <div> <form id="form3" action="form.php" method="post"> <fieldset class="inside"> <input type="text" name="text3" id="text3" size="50" value="Submit" /> <input class="open" type="button" value="Submit" name="submit3" /> </fieldset> </form> </div><!--/div-->

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >