Daily Archives

Articles indexed Sunday June 13 2010

Page 21/73 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Select-all checkboxes in a FORM_TAG

    - by Horace Ho
    In a form_tag, there is a list of 10 to 15 checkboxes: <%= check_box_tag 'vehicles[]', car.id %> How can I select-all (put a tick in every single) checkboxes by RJS? Thanks EDIT: Sorry I didn't make my question clear. What I meant to ask is how to add a "Select/Un-select All" link in the same page to toggle the checkboxes.

    Read the article

  • Delphi components you can't live without

    - by Warren P
    Most Delphi developers have a list of Delphi components they wouldn't live without. Not including anything that ships with Delphi (standard VCL or included third-party software like Rave or Indy), what are the components you can't live without, be they commercial or open-source? One component or product name per answer, please. Please do not post duplicates.

    Read the article

  • youtube - video upload failure - unable to convert file - encoding the video wrong?

    - by Anthony
    I am using .NET to create a video uploading application. Although it's communicating with YouTube and uploading the file, the processing of that file fails. YouTube gives me the error message, "Upload failed (unable to convert video file)." This supposedly means that "your video is in a format that our converters don't recognize..." I have made attempts with two different videos, both of which upload and process fine when I do it manually. So I suspect that my code is a.) not encoding the video properly and/or b.) not sending my API request properly. Below is how I am constructing my API PUT request and encoding the video: Any suggestions on what the error could be would be appreciated. Thanks P.S. I'm not using the client library because my application will use the resumable upload feature. Thus, I am manually constructing my API requests. Documentation: http://code.google.com/intl/ja/apis/youtube/2.0/developers_guide_protocol_resumable_uploads.html#Uploading_the_Video_File Code: // new PUT request for sending video WebRequest putRequest = WebRequest.Create(uploadURL); // set properties putRequest.Method = "PUT"; putRequest.ContentType = getMIME(file); //the MIME type of the uploaded video file //encode video byte[] videoInBytes = encodeVideo(file); public static byte[] encodeVideo(string video) { try { byte[] fileInBytes = File.ReadAllBytes(video); Console.WriteLine("\nSize of byte array containing " + video + ": " + fileInBytes.Length); return fileInBytes; } catch (Exception e) { Console.WriteLine("\nException: " + e.Message + "\nReturning an empty byte array"); byte [] empty = new byte[0]; return empty; } }//encodeVideo //encode custom headers in a byte array byte[] PUTbytes = encode(putRequest.Headers.ToString()); public static byte[] encode(string headers) { ASCIIEncoding encoding = new ASCIIEncoding(); byte[] bytes = encoding.GetBytes(headers); return bytes; }//encode //entire request contains headers + binary video data putRequest.ContentLength = PUTbytes.Length + videoInBytes.Length; //send request - correct? sendRequest(putRequest, PUTbytes); sendRequest(putRequest, videoInBytes); public static void sendRequest(WebRequest request, byte[] encoding) { Stream stream = request.GetRequestStream(); // The GetRequestStream method returns a stream to use to send data for the HttpWebRequest. try { stream.Write(encoding, 0, encoding.Length); } catch (Exception e) { Console.WriteLine("\nException writing stream: " + e.Message); } }//sendRequest

    Read the article

  • Acer Aspire 5719 with Windows XP does not boot

    - by Sri
    Hi, I have an Acer Aspire 5710 which came pre-loaded with Windows Vista. O/S has been changed to Win SXP SP2 and was working fine till today. The laptop starts up and then hangs (does not reach till the Windows screen). Have tried the following Repair with XP CD. Re-install with XP CD (In both cases the error "No hard disk" is displayed.) Tried F5/F8 to boot with other options. Guess the hard-disk is not being recognised. The 160 Gb SATA disk is shown as IDE0 in the Phoenix Bios. There is no floppy drive. Any suggestions. Thanks, Sri.

    Read the article

  • Custom base class for workflow activity , how to declare dependecy property ?

    - by Ajax2020
    Generally we derive custom activity from Activity or CompositeActivity class, i want to have my custom base class for all activities : like public class BusinessActivity : Activity { } then my custom activities will derive from BusinessActivity . The quetions is if i want ErrorMessageProperty and RetryCountProperty as dependency properties then in the BusinessActivity how to declare third param in Register method like public static DependencyProperty RetryCountProperty = DependencyProperty.Register("RetryCount", typeof(int), typeof(**BusinessActivity**)); What will happen if i derive from BusinessActivity class ?

    Read the article

  • Read number from text file using C++ stream

    - by Yongwei Xing
    Hi all I have a text file like below 2 1 2 5 10 13 11 12 14 2 0 1 2 99 2 200 2 1 5 5 1 2 3 4 5 1 0 0 0 I want to read file line by line, and read the umbers from each line. I know how to use the stream to read a fixed field line, but what about the non-fixed line? Best Regards,

    Read the article

  • Using persistent and non-persistent connection together in a PHP MySQL app

    - by cappuccino
    There are parts of my app where a persistent connection is required, in particular the parts where every hour maybe 30,000 select requests are made by many different users, this is causing my mysql server to max out on the 100 connection limit, and i really don't want to increase it since 100 connections already seems like alot. So for the parts of the application where reading and selecting is the case I want to switch to persistent connections. The other parts where data is being modified is usually done through a transaction, and the general rule is never to use persistent connections for transactions according to the php documentation. So I would like to keep this on non-persistent connections. My question is, am i able to use persistent and non-persistent connections together in the same app, the same script etc? I am using PHP 5.2+, MySQL 5+ (InnoDB tables) and the Zend Framework 10.6+

    Read the article

  • Problems setting vertical scrollbar value in a datagrid (old one, not the better DataGridView).

    - by user365581
    I need to save the selected row and the vertical scrollBar's position after a refresh. This is how I do it: int currRow = myGrid.CurrentRowIndex; int vScrollPos = ((ScrollBar)myGrid.Controls[1]).Value // some code that refreshes the data among other things myGrid.CurrentRowIndex = currRow; // this sets the property myGrid.Select(currRow); // this selects in UI (both commands required) ((ScrollBar)myGrid.Controls[1]).Value = vScrollPos; Here's my problem: The grid always jumps to a place where the selected row is at the bottom. setting the current row makes it happen - similar to EnsureVisible of newer grid implementations. But after that there's the vScrollBar repositioning - and it just doesn't work right. In debug I see that the scroll bar value gets updated. In the UI, if I hit the down/up arrow on the scrollbar it suddenly jumps to the right place - But if I don't click anything the grid is just in the wrong position. I tried refreshing the grid/scroll bar to force a redraw, but it doesn't help. The actual grid position is just not in sync with the vertical ScrollBar's value. Any ideas?

    Read the article

  • PDF to LaTex Linux

    - by Mawnster
    I know how make a pdf from LaTex. Is there a way to extract the LaTex from a PDF I created earlier? How about if someone sends me a PDF and I like the formatting. Can I extract the LaTex from it?

    Read the article

  • why it throws java.lang.classCastException

    - by matin1234
    Hi this is my class and I want to sort my stack but it will throw an exception please help me thanks! public class jj { public static void main(String[] args){ Stack<Integer> s = new ImplimentingAStackUsingAnArrayOfAGivenSizeN(5); s.push(1); s.push(3); s.push(5); s.push(2); s.push(4); Collections.sort((List<Integer>) (s)); System.out.println(s); while (!s.isEmpty()) { System.out.println(s.pop()); } } } the stack traces: run: Exception in thread "main" java.lang.ClassCastException: datastructurechapter5.ImplimentingAStackUsingAnArrayOfAGivenSizeN cannot be cast to java.util.List at datastructurechapter5.jj.main(jj.java:24) `Collections.sort((List<Integer>) (s));` Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds)

    Read the article

  • Python: slow read & write for millions of small files

    - by Jami
    I am building directory tree which has tons of subdirectories and files. The total directory count is somewhere along 256^32 subdirectories with 256 files in each end which are only a few bytes long. I did this so I would have fast access to these files (since i'm not searching and i'm just directly accessing then via a known file path) I have a python script that builds this filesystem and reads & writes those files. The problem is that when I reach more than 1Gb of total filesize, the read and write methods become extremely slow. Here's the function I have that reads the contents of a file (the file contains an integer string), adds a certain number to it, then writes it back to the original file. def addInFile(path, scoreToAdd): num = scoreToAdd try: shutil.copyfile(path, '/tmp/tmp.txt') fp = open('/tmp/tmp.txt', 'r') num += int(fp.readlines()[0]) fp.close() except: pass fp = open('/tmp/tmp.txt', 'w') fp.write(str(num)) fp.close() shutil.copyfile('/tmp/tmp.txt', path) I previously tried performing linux console commands but it was slower. I copy the file to a temporary file first then access/modify it then copy it back because i found this was faster than directly accessing the file. I think the cause of the slowdown is because there're tons of files. performing this function 1000 times sometimes reach 1 minute now, but before (when there were only a few files, 1000 calls was performed for only less than 1 second) How do you suggest I fix this?

    Read the article

  • How can I create a WebBrowser control (ActiveX / IWebBrowser2) without a UI?

    - by wangminhere
    I cannot figure out how to use the WebBrowser control without having it create a window in the taskbar. I am using the IWebBrowser2 ActiveX control directly because I need to use some of the advanced features like blocking downloading JAVA/ActiveX/images etc. That apparently is not available in the WPF or winforms WebBrowser wrappers (but these wrappers do have the ability to create the control with no UI) Here is my code for creating the control: Type webbrowsertype = Type.GetTypeFromCLSID(Iid_Clsids.CLSID_WebBrowser, true); m_WBWebBrowser2 = (IWebBrowser2)System.Activator.CreateInstance(webbrowsertype); m_WBWebBrowser2.Visible = false; m_WBOleObject = (IOleObject)m_WBWebBrowser2; int iret = m_WBOleObject.SetClientSite(this); iret = m_WBOleObject.SetHostNames("me", string.Empty); tagRECT rect = new tagRECT(0, 0, 0, 0); tagMSG nullMsg = new tagMSG(); m_WBOleInPlaceObject = (IOleInPlaceObject)m_WBWebBrowser2; //INPLACEACTIVATE the WB iret = m_WBOleObject.DoVerb((int)OLEDOVERB.OLEIVERB_INPLACEACTIVATE, ref nullMsg, this, 0, IntPtr.Zero, ref rect); IConnectionPointContainer cpCont = (IConnectionPointContainer)m_WBWebBrowser2; Guid guid = typeof(DWebBrowserEvents2).GUID; IConnectionPoint m_WBConnectionPoint = null; cpCont.FindConnectionPoint(ref guid, out m_WBConnectionPoint); m_WBConnectionPoint.Advise(this, out m_dwCookie); This code works perfectly but it shows a window in the taskbar. If i omit the DoVerb(OLEDOVERB.OLEIVERB_INPLACEACTIVATE) call, then Navigating to a webpage is not working properly. Navigate() will not download everything on the page and it never fires the DocumentComplete event. If I add a DoVerb(OLEIVERB_HIDE) then I get the same behavior as if I omitted the DoVerb(OLEDOVERB.OLEIVERB_INPLACEACTIVATE) call. This seems like a pretty basic question but I couldn't find any examples anywhere.

    Read the article

  • Multiple conditions with CASE statements

    - by Pavan Reddy
    I need to query some data. here is the query that i have constructed but which isn't workig fine for me. For this example I am using AdventureWorks database. SELECT * FROM [Purchasing].[Vendor] WHERE PurchasingWebServiceURL LIKE case // In this case I need all rows to be returned if @url is '' or 'ALL' or NULL when (@url IS null OR @url = '' OR @url = 'ALL') then ('''%'' AND PurchasingWebServiceURL IS NULL') //I need all records which are blank here including nulls when (@url = 'blank') then (''''' AND PurchasingWebServiceURL IS NULL' ) //n this condition I need all record which are not like a particular value when (@url = 'fail') then ('''%'' AND PurchasingWebServiceURL NOT LIKE ''%treyresearch%''' ) //Else Match the records which are `LIKE` the input value else '%' + @url + '%' end This is not working for me. How can I have multiple where condition clauses in the THEN of the the same CASE? How can I make this work?

    Read the article

  • Checking jQuery AJAX Request Status

    - by mTuran
    Hi, i do 2 different ajax request via jQuery and i have to check the other one is active or not. How can i do that ? one of example from my ajax requests: active_project_categories_ajax = $.ajax( { url: "/ajax/get_skill_list", dataType: 'json', ...... }); i need something like that: active_project_categories_ajax.status()

    Read the article

  • FlashBuilder 4 and Zend Framework error

    - by sig
    I am trying to use adobe flash builder 4 with a php service. I had it set up an older macbook running leopard, but just tried to set it up on my new laptop running snow leopard. I did all the same steps.. set the Flex Server to be PHP, set the web root and url. Then I go to Data-Connect To PHP and point it to a php file I have in my web root. It says it needs to install Zend, and claims it does so successfully, but then when I try to continue, I get an error. I don't understand.. this same setup works on my older laptop. (Yes, I checked the amf.production was false) Unable to retrieve operations and entities from the file Make sure that Zend Framework is installed correctly and the parameter "amf.production" is not set to true in the amf_config.ini file located in the project output folder. false), true);$default_config-merge(new Zend_Config_Ini($configfile, 'zendamf'));$default_config-setReadOnly();$amf = $default_config-amf;// Store configuration in the registryZend_Registry::set("amf-config", $amf);// Initialize AMF Server$server = new Zend_Amf_Server();$server-setProduction($amf-production);if(isset($amf-directories)) { $dirs = $amf-directories-toArray(); foreach($dirs as $dir) { // get the first character of the path. // If it does not start with slash then it implies that the path is relative to webroot. Else it will be treated as absolute path $length = strlen($dir); $firstChar = $dir; if($length = 1) $firstChar = $dir[0]; if($firstChar != "/"){ // if the directory is ./ path then we add the webroot only. if($dir == "./"){ $server-addDirectory($webroot); }else{ $tempPath = $webroot . "/" . $dir; $server-addDirectory($tempPath); } }else{ $server-addDirectory($dir); } }}// Initialize introspector for non-productionif(!$amf-production) { $server-setClass('Zend_Amf_Adobe_Introspector', '', array("config" = $default_config, "server" = $server)); $server-setClass('Zend_Amf_Adobe_DbInspector', '', array("config" = $default_config, "server" = $server));}// Handle requestecho $server-handle();

    Read the article

  • Does the type in this KVC validation method matter?

    - by dontWatchMyProfile
    For example, in the docs a KVC-style validation method is implemented like this: -(BOOL)validateAge:(id *)ioValue error:(NSError **)outError They used id* as the type for ioValue. Since that's not part of the method signature, I wonder if it would hurt to do something like: -(BOOL)validateAge:(NSNumber *)ioValue error:(NSError **)outError Is this still fine with KVC?

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >