Daily Archives

Articles indexed Friday December 24 2010

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

  • Uploadify: Passing a form's ID as a parameter with scriptData

    - by Matt
    I need the ability to have multiple upload inputs on one page (potentially hundreds) using Uploadify. The upload PHP file will be renaming the uploaded file based on the ID of the input button used to submit it, so it will need that ID. Since I will be having hundreds of upload buttons on one page, I wanted to create a universal instantiation, so I did this using the class of the forms rather than the ID of the forms. However, when one of the inputs is clicked, I would like to pass the ID of that input as scriptData to the PHP. This is not working; PHP says 'formId' is undefined. Is there a good way get the ID attribute of the form input being used, and passing it to the upload PHP? Or is there a completely different and better method of accomplishing this? Thank you in advance!! <script type="text/javascript"> $(document).ready(function() { $('.uploady').uploadify({ 'uploader' : '/uploadify/uploadify.swf', 'script' : '/uploadify/uploadify.php', 'cancelImg' : '/uploadify/cancel.png', 'folder' : '/uploadify', 'auto' : true, // LINE IN QUESTION 'scriptData' : {'formId':$(this).attr('id')} }); }); </script> </head> The inputs look like this: <input id="file_upload1" class="uploady" name="file_upload" type="file" /> <input id="file_upload2" class="uploady" name="file_upload" type="file" /> <input id="file_upload3" class="uploady" name="file_upload" type="file" />

    Read the article

  • Copy constructor called even when returning by reference?

    - by Johnyy
    Hi, I am testing the return of local objects by reference. My original test went well but something else happens unexpected. #include <iostream> using namespace std; class MyInt { public: MyInt(int i){ value = new int(i); } ~MyInt(){ delete value; } int getValue(){ return *value; } MyInt(const MyInt &b){ cout<<"Copy"<<endl; } private: int* value; }; MyInt& returnref(){ MyInt a(10); cout<<"Returning from returnref()"<<endl; return a; } int main(){ MyInt a = returnref(); cout<<a.getValue()<<endl; return 0; } My console prints "Returning from ..." then "Copy" then a random value. My understanding of pass by reference is that it does not need to make any copy. Why is it not doing what I expected?

    Read the article

  • XNA 2D mouse picking

    - by Corndog
    I'm working on a simple 2D Real time strategy game using XNA. Right now I have reached the point where I need to be able to click on the sprite for a unit or building and be able to reference the object associated with that sprite. From the research I have done over the last three days I have found many references on how to do "Mouse picking" in 3D which does not seem to apply to my situation. I understand that another way to do this is to simply have an array of all "selectable" objects in the world and when the player clicks on a sprite it checks the mouse location against the locations of all the objects in the array. the problem I have with this approach is that it would become rather slow if the number of units and buildings grows to larger numbers. (it also does not seem very elegant) so what are some other ways I could do this. (Please note that I have also worked over the ideas of using a Hash table to associate the object with the sprite location, and using a 2 dimensional array where each location in the array represents one pixel in the world. once again they seem like rather clunky ways of doing things.)

    Read the article

  • Opening of the spWeb.ContentTypes gives SOAP Exception 0x80004004

    - by mdi
    Hi everybody! I have the code which going through the sharepoint contenttypes and changes needed field display names. On my local server everything works fine, but on the client side it gives me an error: Microsoft.SharePoint.SPException: Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)) --- System.Runtime.InteropServices.COMException (0x80004004): Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)) at Microsoft.SharePoint.Library.SPRequestInternalClass.OpenWebInternal(String bstrUrl, Guid& pguidID, String& pbstrRequestAccessEmail, UInt32& pwebVersion, String& pbstrServerRelativeUrl, UInt32& pnLanguage, UInt32& pnLocale, String& pbstrDefaultTheme, String& pbstrDefaultThemeCSSUrl, String& pbstrAlternateCSSUrl, String& pbstrCustomizedCssFileList, String& pbstrCustomJSUrl, String& pbstrAlternateHeaderUrl, String& pbstrMasterUrl, String& pbstrCustomMasterUrl, String& pbstrSiteLogoUrl, String& pbstrSiteLogoDescription, Object& pvarUser, Boolean& pvarIsAuditor, Int32& plSiteFlags) at Microsoft.SharePoint.Library.SPRequest.OpenWebInternal(String bstrUrl, Guid& pguidID, String& pbstrRequestAccessEmail, UInt32& pwebVersion, String& pbstrServerRelativeUrl, UInt32& pnLanguage, UInt32& pnLocale, String& pbstrDefaultTheme, String& pbstrDefaultThemeCSSUrl, String& pbstrAlternateCSSUrl, String& pbstrCustomizedCssFileList, String& pbstrCustomJSUrl, String& pbstrAlternateHeaderUrl, String& pbstrMasterUrl, String& pbstrCustomMasterUrl, String& pbstrSiteLogoUrl, String& pbstrSiteLogoDescription, Object& pvarUser, Boolean& pvarIsAuditor, Int32& plSiteFlags) --- End of inner exception stack trace --- at Microsoft.SharePoint.Library.SPRequest.OpenWebInternal(String bstrUrl, Guid& pguidID, String& pbstrRequestAccessEmail, UInt32& pwebVersion, String& pbstrServerRelativeUrl, UInt32& pnLanguage, UInt32& pnLocale, String& pbstrDefaultTheme, String& pbstrDefaultThemeCSSUrl, String& pbstrAlternateCSSUrl, String& pbstrCustomizedCssFileList, String& pbstrCustomJSUrl, String& pbstrAlternateHeaderUrl, String& pbstrMasterUrl, String& pbstrCustomMasterUrl, String& pbstrSiteLogoUrl, String& pbstrSiteLogoDescription, Object& pvarUser, Boolean& pvarIsAuditor, Int32& plSiteFlags) at Microsoft.SharePoint.SPWeb.InitWebPublic() at Microsoft.SharePoint.SPWeb.get_ServerRelativeUrl() at Microsoft.SharePoint.SPWeb.get_Url() at Microsoft.SharePoint.SPContentTypeCollection.FetchCollection() at Microsoft.SharePoint.SPContentTypeCollection..ctor(SPWeb web, Boolean bAll) at Microsoft.SharePoint.SPWeb.get_ContentTypes() the code is below: SPWebApplication webApp = SPWebService.ContentService.WebApplications[someGuid]; foreach (SPSite spSite in webApp.Sites) { using (SPWeb spWeb = spSite.RootWeb) { try { foreach (SPContentType spContentType in spWeb.ContentTypes) { ... }}}.. Could anybody provide me with workaround or with the reason of the problem.

    Read the article

  • Hooking thread exit

    - by mackenir
    Is there a way for me to hook the exit of managed threads (i.e. run some code on a thread, just before it exits?) I've developed a mechanism for hooking thread exit that works for some threads. Step 1: develop a 'hook' STA COM class that takes a callback function and calls it in its destructor. Step 2: create a ThreadStatic instance of this object on the thread I want to hook, and pass the object a managed delegate converted to an unmanaged function pointer. The delegate then gets called on thread exit (since the CLR calls IUnknown::Release on all STA COM RCWs as part of thread exit). This mechanism works on, for example, worker threads that I create in code using the Thread class. However, it doesn't seem to work for the application's main thread (be it a console or windows app). The 'hook' COM object seems to be deleted too late in the shutdown process and the attempt to call the delegate fails. (The reason I want to implement this facility is so I can run some native COM code on the exiting thread that works with STA COM objects that were created on the thread, before it's 'too late' (i.e. before the thread has exited, and it's no longer possible to work with STA COM objects on that thread.))

    Read the article

  • How can I disable mouse click event system wide using C#?

    - by mazzzzz
    Hey guys, I have a laptop with a very sensitive touch pad, and wanted to code a small program that could block the mouse input when I was typing a paper or something. I didn't think it would be hard to do, considering everything I've seen on low-level hooks, but I was wrong (astounding, right?). I looked at a few examples, but the examples I've seen either block both keyboard and mouse, or just hide the mouse. Any help with this would be great.

    Read the article

  • uninitialized constant OpenSSL::Digest::SHA1 in rails 3 and ubuntu

    - by Anand Agrawal
    Hi All, I am trying to integrate restful_authentication plugings into my rails 3 application. I integrated this in windows, but while trying to integrate it to ubuntu I am facing an error "uninitialized constant OpenSSL::Digest::SHA1" I googled for the solution but still unsuccessful. I am unable to load the file, "require Digest/SHA1" Now, i tried to run console screen. and tried to check the Digest file by putting print statement, this gives false, while in the irb it returns true. If anyone has come across such problem

    Read the article

  • Recommendations for a free GIS library supporting raster images

    - by gspr
    Hi. I'm quite new to the whole field of GIS, and I'm about to make a small program that essentially overlays GPS tracks on a map together with some other annotations. I primarily need to allow scanned (thus raster) maps (although it would be nice to support proper map formats and something like OpenStreetmap in the long run). My first exploratory program uses Qt's graphics view framework and overlays the GPS points by simply projecting them onto the tangent plane to the WGS84 ellipsoid at a calibration point. This gives half-decent accuracy, and actually looks good. But then I started wondering. To get the accuracy I need (i.e. remove the "half" in "half-decent"), I have to correct for the map projection. While the math is not a problem in itself, supporting many map projection feels like needless work. Even though a few projections would probably be enough, I started thinking about just using something like the PROJ.4 library to do my projections. But then, why not take it all the way? Perhaps I might aswell use a full-blown map library such as Mapnik (edit: Quantum GIS also looks very nice), which will probably pay off when I start to want even more fancy annotations or some other symptom of featuritis. So, finally, to the question: What would you do? Would you use a full-blown map library? If so, which one? Again, it's important that it supports using (and zooming in and out with) raster maps and has pretty overlay features. Or would you just keep it simple, and go with Qt's own graphics view framework together with something like PROJ.4 to handle the map projections? I appreciate any feedback! Some technicalities: I'm writing in C++ with a Qt-based GUI, so I'd prefer something that plays relatively nicely with those. Also, the library must be free software (as in FOSS), and at least decently cross-platform (GNU/Linux, Windows and Mac, at least). Edit: OK, it seems I didn't do quite enough research before asking this question. Both Quantum GIS and Mapnik seem very well suited for my purpose. The former especially so since it's based on Qt.

    Read the article

  • how can I exit from a php script and continue right after the script?

    - by Samir Ghobril
    Hey guys, I have this piece of code, and when I add return after echo(if there is an error and I need to continue right after the script) I can't see the footer, do you know what the problem is? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en" > <head> <title>Login | JM Today </title> <link href="Mainstyles.css" type="text/css" rel="stylesheet" /> </head> <body> <div class="container"> <?php include("header.php"); ?> <?php include("navbar.php"); ?> <?php include("cleanquery.php") ?> <div id="wrap"> <?php ini_set('display_errors', 'On'); error_reporting(E_ALL | E_STRICT); $conn=mysql_connect("localhost", "***", "***") or die(mysql_error()); mysql_select_db('jmtdy', $conn) or die(mysql_error()); if(isset($_POST['sublogin'])){ if(( strlen($_POST['user']) >0) && (strlen($_POST['pass']) >0)) { checklogin($_POST['user'], $_POST['pass']); } elseif((isset($_POST['user']) && empty($_POST['user'])) || (isset($_POST['pass']) && empty($_POST['pass']))){ echo '<p class="statusmsg">You didn\'t fill in the required fields.</p><br/><input type="button" value="Retry" onClick="location.href='."'login.php'\">"; return; } } else{ echo '<p class="statusmsg">You came here by mistake, didn\'t you?</p><br/><input type="button" value="Retry" onClick="location.href='."'login.php'\">"; return; } function checklogin($username, $password){ $username=mysql_real_escape_string($username); $password=mysql_real_escape_string($password); $result=mysql_query("select * from users where username = '$username'"); if($result != false){ $dbArray=mysql_fetch_array($result); $dbArray['password']=mysql_real_escape_string($dbArray['password']); $dbArray['username']=mysql_real_escape_string($dbArray['username']); if(($dbArray['password'] != $password ) || ($dbArray['username'] != $username)){ echo '<p class="statusmsg">The username or password you entered is incorrect. Please try again.</p><br/><input type="button" value="Retry" onClick="location.href='."'login.php'\">"; return; } $_SESSION['username']=$username; $_SESSION['password']=$password; if(isset($_POST['remember'])){ setcookie("jmuser",$_SESSION['username'],time()+60*60*24*356); setcookie("jmpass",$_SESSION['username'],time()+60*60*24*356); } } else{ echo'<p class="statusmsg"> The username or password you entered is incorrect. Please try again.</p><br/>input type="button" value="Retry" onClick="location.href='."'login.php'\">"; return; } } ?> </div> <br/> <br/> <?php include("footer.php") ?> </div> </body> </html>

    Read the article

  • Using PHP Frameworks to get Web 2.0 or Ajax and Other Special Features

    - by user504958
    I'm still struggling to understand when or how to use a framework such as Zend or Yii. Here's some of the features I'm going to need on my next project and I don't understand frameworks well enough to know where the framework fits into the picture. I won't say exactly what the project is but think about something like Yelp or Merchant Circle, on a smaller scale of course - a directory project. It will contain a search box and links to all and/or popular categories. 1) Autosuggest in Search box. (I already know how to do this using jQuery) 2) Analyze the search terms entered into the search box to determine if they misspelled a word. Offer to correct the misspelling or automatically correct the word and show relevant results. 3) Offer items, links, or ads that are related to their search term. 4) Allow users to determine which fields are shown. 5) Allow users to sort the results however they choose. 6) Allow editing of records on a grid/list view. Post form without refreshing the page. Delete or Add records without going to a different page or reloading the current page.

    Read the article

  • BES IT Policy: Radio disabled after device startup?

    - by DaveJohnston
    Can anyone tell me which BES IT policy option controls the radio being disabled when the device first starts up. I have been given an IT policy which when applied to a user causes the radio on the device to be off by default when it starts up, requiring the user to activate it every time (after entering his password). When the default policy is applied this does not happen, so it is an option in the IT policy that has caused it. Does anyone know which of the options this is?

    Read the article

  • Can you link to a good MySQL dumper PHP script?

    - by Ivan
    I need to migrate a website to another host. I have only FTP server access and MySQL name+pass (the MySQL server's IP I was provided is 127.0.0.1, and there's neither PhpMyAdmin nor SSHell to use). A web app run there can access the DB using credentials I know and localhost server. So I'd need a PHP script, that will correctly dump all the available databases of the MySQL server so that they can be imported on the new server. Can you recommend a good one?

    Read the article

  • EasyVPN client Access mutiple subnet behind cisco 5510

    - by zatrac
    I need help with the following scenario Main network ASA 5510 (one inside 192.168.10.1 connection and one outside connection). This ASA 5510 connect to switch 3570 with 3 VLANS configured (192.168.10.0, 10.10.11.0, 10.10.12.0). On the remote site I have ASA5505 ( 10.10.13.0) connected to this ASA5510 through EZVPN, but all it can see is the 192.168.10.0 subnet. What do I need to do to get the subnet 10.10.13.0 to see all 3 internal subnets.

    Read the article

  • why is drop box syncing so freakishly slowly in my linux virtual machine?

    - by Bec
    i am setting up a linux virtual machine (windows 7 64 bit host, ubuntu 64 bit guest, using virtual box) and i just installed drop box and set it to sync. I've only got about 2Gb in there so i figured it should take just an afternoon, but it's going at about 0.5 kB/second and says it will take about 60 days. I usually get about 200 kB/second in the host OS, and downloading straight from the dropbox website through firefox in the ubuntu VM i get about that, but sync is really slow. any tips?

    Read the article

  • How do I wait for all other threads to finish their tasks?

    - by Mike
    I have several threads consuming tasks from a queue using something similar to the code below. The problem is that there is one type of task which cannot run while any other tasks are being processed. Here is what I have: while (true) // Threaded code { while (true) { lock(locker) { if (close_thread) return; task = GetNextTask(); // Get the next task from the queue } if (task != null) break; wh.WaitOne(); // Wait until a task is added to the queue } task.Run(); } And this is kind of what I need: while (true) { while (true) { lock(locker) { if (close_thread) return; if (disable_new_tasks) { task = null; } else { task = GetNextTask(); } } if (task != null) break; wh.WaitOne(); } if(!task.IsThreadSafe()) { // I would set this to false inside task.Run() at // the end of the non-thread safe task disable_new_tasks = true; Wait_for_all_threads_to_finish_their_current_tasks(); } task.Run(); } The problem is I don't know how to achive this without creating a mess.

    Read the article

  • Facebook session query

    - by Hunter
    Since I have just started working with Facebook's api I had a few questions regarding Facebook sessions. In the index of my iFrame app I have the user establish a new sessions and set the $me and $uid variables as displayed in their example. However, when my app navigates to a new page should I create a new session and redeclare these variables or is there some way to grab those values from the already declared session? Thanks

    Read the article

  • Upload images to a specific Facebook Album

    - by Imran Naqvi
    Hi stackoverflow, i can create an album using facebook graph api by posting data to http://graph.facebook.com/PROFILE_ID/albums it returns an id, which is not the album id. I confirmed it in two ways by going to that album, aid is different than what id i received and by posting http://graph.facebook.com/{ALBUM_ID_I_RECIEVED/photos, but the photo is never published to newly created album instead it is published to a default application album. I need to know the real album id so that i can upload images to newly created album. Please Help

    Read the article

  • c# .net framework subtracting time-span from date

    - by smkngspcmn
    I want to subtract a time-span from a date-time object. Date is 1983/5/1 13:0:0 (y/m/d-h:m:s) Time span is 2/4/28-2:51:0 (y/m/d-h:m:s) I can use the native DateTime and TimeSpan objects to do this, after converting years and months of the time-span to days (assuming a 30 day month and a ~364 day year). new DateTime(1981,5,1,13,0,0).Subtract(new TimeSpan(878,13,51,0)); With this i get the result: {12/4/1978 11:09:00 PM} But this is not exactly what i expected. If i do this manually (assuming a 30 day month) i get 1981/0/3-10:9:0 This is pretty close to what i'm after except i shouldn't get 0 for month and year should be 1980. So can someone please show me how i can do this manually and avoid getting a 0 month value? Also why do i get a completely different value when i use native classes?

    Read the article

  • RegEx for the <li></li> tags

    - by Abu
    Hi All, i am working on the C# WinForm application. In that application, i have snippet like this: <ul> <li>abc <li>bbc <li>xyz <li>pqr </li></li></li></li> </ul> but, i want to get output like.. <ul> <li>abc</li> <li>bbc</li> <li>xyz</li> <li>pqr</li> </ul> Is there any method using which this thing can be done? Can anybody suggest me any RegEx for this problem? Thanks. Regards.

    Read the article

  • Parsing: How to make error recovery in grammars like " a* b*"?

    - by Lavir the Whiolet
    Let we have a grammar like this: Program ::= a* b* where "*" is considered to be greedy. I usually implement "*" operator naively: Try to apply the expression under "*" to input one more time. If it has been applied successfully then we are still under current "*"-expression; try to apply the expression under "*" one more time. Otherwise we have reached next grammar expression; put characters parsed by expression under "*" back into input and proceed with next expression. But if there are errors in input in any of "a*" or "b*" part such a parser will "think" that in position of error both "a*" and "b*" have finished ("let's try "a"... Fail! OK, it looks like we have to proceed to "b*". Let's try "b"... Fail! OK, it looks like the string should have been finished...). For example, for string "daaaabbbbbbc" it will "say": "The string must end at position 1, delete superflous characters: daaaabbbbbbc". In short, greedy "*" operator becomes lazy if there are errors in input. How to make "*" operator to recover from errors nicely?

    Read the article

  • sorting extendeddatatable in richfaces

    - by user414597
    Hello All, does anyone know how exactly the default sorting works in richfaces datatable columns? (using sortby) My problem is that once a sort has been performed, the new data order is never preserved in my backing's bean data model (which makes me wonder where is this new order now stored?), that is the actual datamodel always contains just the original data.. So if say user goes to a another page and returns to what should be sorted data (using back button) , the data displays as original, not sorted.. Has anyone come across this? also, is there a way to do server side sorting, i.e. call my own sort method upon clicking the header..? many thanks for any advice!

    Read the article

  • How should I capture clickstream data?

    - by editor
    I'd like to start using clickstream analysis to improve a dynamic site's user experience. I'd like to rule out two options: parameterizing URLs (index.php?src=http://www.example.com) and immediate database logging. The former makes pretty ugly URLs and isn't great for SEO and the latter might slow down page render when there are lots of concurrent users. Assuming these aren't viable options, I think I'm left with doing an asynchronous POST to a server side script that runs a database query and returns a 204 (no data) response. Is this the best option for capturing clickstream data?

    Read the article

  • Accessing the calling object into ajax response... (not the ajax call)

    - by Nishchay Sharma
    I have an object of type Application (defined by me). Whenever an object of this type is created, it automatically loads a php file say "start.php" using jquery ajax and assign the response to a div say "Respo". Now what i want is to access the Application object from that Respo div. Unfortunately, i have no clue how to do this... in my ajax call: function Application(options) { ....... var appObj=this; $.ajax({ url:appObj.location, //Already defined success:function(data) { $("#respo").html(data); } }); } Now in my Respo division i want to access that Application object... I tried: alert(this) but it resulted in an object of DOMWindow... i tried editing success function as: function Application(options) { ....... var appObj=this; $.ajax({ url:appObj.location, //Already defined success:function(data) { $("#respo").html("<script type='text/javascript'>var Self="+appObj+"</script>"); $("#respo").html(data); } }); } But i ended nowhere. :( Although if i assign "var Self='nishchay';" then alerting Self from start.php gives nishchay but i am not able to assign the calling object of Application type to the Self variable. It is the only way I cud think of. :\ Please help me... actually my object has some editing functions to control itself - its look and feel and some other options. I want the code loaded by object to control the object itself. Please help me.. Thanks in advance. Nishchay

    Read the article

  • PHP strtotime without leap-years

    - by Christian Sciberras
    With regards to this thread, I've developed a partial solution: function strtosecs($time,$now=null){ static $LEAPDIFF=86400; $time=strtotime($time,$now); return $time-((date('Y',$time)-1968)/4*$LEAPDIFF); } The function is supposed to get the number of seconds given a string without checking leap-years. It does this calculating the number of leap-years 1970 [(year-1986)/4], multiplying it by the difference in seconds between a leap-year and a normal year (which in the end, it's just the number of seconds in a day). Finally, I simply remove all those excess leap-year seconds from the calculated time. Here's some examples of the inputs/outputs: // test code echo strtosecs('+20 years',0).'=>'.(strtosecs('+20 years',0)/31536000); echo strtosecs('+1 years',0).'=>'.(strtosecs('+1 years',0)/31536000); // test output 630676800 => 19.998630136986 31471200 => 0.99794520547945 You will probably ask why am I doing a division on the output? It's to test it out; 31536000 is the number of seconds in a year, so that 19.99... should be 20 and 0.99... should be a 1. Sure, I could round it all and get "correct" answer, but I'm worried about the inaccuracies.

    Read the article

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