Daily Archives

Articles indexed Thursday April 15 2010

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

  • Upload an image using class.upload.php via AJAX, display image in form using jQuery

    - by Benjamin
    I am using class.upload.php to handle an image upload from a form that submits employee details to a MySQL database. class.upload.php does EXACTLY what I want it to do, resize the image and rename it - what I am now trying to accomplish is to upload via Ajax after the user selects the file and then display it in the form while they continue entering details. How would this best be accomplished with jQuery?

    Read the article

  • How to extend WPF hit testing zone for a Path object.

    - by user275587
    Wpf hit testing is pretty good but the only method I found to extend the hit zone is to put a transparent padding area around your object. I can't find any method to add a transparent area arround a Path object. The path is very thin and I would like to enable hit testing if the user clicks near the path. I can't find any method to extend the path object with a transparent area like the image below : I tried to used a partially transparent stroke brush but I ran into the problem described here : http://stackoverflow.com/questions/1412833/how-can-i-draw-a-soft-line-in-wpf-presumably-using-a-lineargradientbrush I also tried to put an adorner over my line but because of WPF anti-aliasing algorithms, the position is way off when I zoom in my canvas and interfere with other objects hit-testing in a bad way. Any suggestion to extend the hit testing zone would be highly appreciated. Thanks, Kumar

    Read the article

  • Using python to write text files with DOS line endings on linux

    - by gaumann
    I want to write text files with DOS/Windows line endings '\r\n' using python running on Linux. It seems to me that there must be a better way than manually putting a '\r\n' at the end of every line or using a line ending conversion utility. Ideally I would like to be able to do something like assign to os.linesep the separator that I want to use when writing the file. Or specify the line separator when I open the file.

    Read the article

  • iPhone or Android?

    - by tunnuz
    According to a recent article iPhone has gained a better appeal than Android among programmers. I'm quite a newbie to Java and a complete profane to ObjectiveC, in your opinion, in which one of the two could I have a try?

    Read the article

  • Eclipse: Is it possible to have CDT and Java IDE together

    - by hhafez
    Hi I have an Eclipse CDT enviroment up and running and customised just the way I like it. I'm also going to be heavily dealing with java soon and I don't want to install a seperate version of Eclipse just to get the java features as I'll be switching between C-C++-ADA-Java quite often so I'd wont the one IDE to support all languages. At the moment I've got C/C++ and Ada working together (CDT + GNAT workbench). How can I get the Eclipse Java IDE with out installing eclipse from scratch again. Thanks

    Read the article

  • Having a problem getting my ActionListeners, Handlers, and GUI to communicate.

    - by badpanda
    So I am trying to get my GUI to work. When I run the code below, it does nothing, and I'm sure I'm probably just doing something dumb, but I am completely stuck... public void actionPerformed(ActionEvent e){ UI.getInstance().sS++; if((UI.getInstance().sS %2) != 0){ UI.getInstance().startStop.setName("STOP"); UI.getInstance().change.setEnabled(false); }else if(UI.getInstance().sS%2 == 0){ UI.getInstance().startStop.setName("START"); UI.getInstance().change.setEnabled(true); } } public void setStartListener(StartHandler e){ this.startStop.addActionListener(e); } sS is an int that increments every time the button startStop is clicked. change is also a button.

    Read the article

  • Why is MySQL with InnoDB doing a table scan when key exists and choosing to examine 70 times more ro

    - by andysk
    Hello, I'm troubleshooting a query performance problem. Here's an expected query plan from explain: mysql> explain select * from table1 where tdcol between '2010-04-13:00:00' and '2010-04-14 03:16'; +----+-------------+--------------------+-------+---------------+--------------+---------+------+---------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+--------------------+-------+---------------+--------------+---------+------+---------+-------------+ | 1 | SIMPLE | table1 | range | tdcol | tdcol | 8 | NULL | 5437848 | Using where | +----+-------------+--------------------+-------+---------------+--------------+---------+------+---------+-------------+ 1 row in set (0.00 sec) That makes sense, since the index named tdcol (KEY tdcol (tdcol)) is used, and about 5M rows should be selected from this query. However, if I query for just one more minute of data, we get this query plan: mysql> explain select * from table1 where tdcol between '2010-04-13 00:00' and '2010-04-14 03:17'; +----+-------------+--------------------+------+---------------+------+---------+------+-----------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+--------------------+------+---------------+------+---------+------+-----------+-------------+ | 1 | SIMPLE | table1 | ALL | tdcol | NULL | NULL | NULL | 381601300 | Using where | +----+-------------+--------------------+------+---------------+------+---------+------+-----------+-------------+ 1 row in set (0.00 sec) The optimizer believes that the scan will be better, but it's over 70x more rows to examine, so I have a hard time believing that the table scan is better. Also, the 'USE KEY tdcol' syntax does not change the query plan. Thanks in advance for any help, and I'm more than happy to provide more info/answer questions.

    Read the article

  • How to get all active parameters in ASP.NET MVC (2)

    - by SztupY
    Hi! I was wondering whether there is a way to create an ActionLink or similar, that changes only a few parameters of the actual query, and keeps all the other parameters intact. For example if I'm on an URL like http://example.com/Posts/Index?Page=5&OrderBy=Name&OrderDesc=True I want to change only the Page, or OrderBy parameter and keep all other parameters the same, even those I don't yet know of (like when I want to add a Search parameter or something similar too). The header of my current action looks like this: public ActionResult Index(int? Page, string OrderBy, bool? Desc) and I'm only interested in the values that this controller "eats". I want however that when I extend this action (for example with a string Search parameter) the links should work the same way as before. Here is what I did already: Create a new RouteValueDictionary and fill it with everything from RouteData.Values Problem: This only fills the parameters that are used in the Routing, so all other optional parameters (like Page) to the controller are lost Add everything from HttpContext.Request.QueryString to the previous dictionary This is what I am currently using Problem: It might have some junk stuff, that the Controller didn`t ask for, and it doesn't work if the page was loaded using POST. You also don't have any ModelBindings (but this isn't much of a problem, because we are re-sending everything anyway) Use HttpContext.Request.Params Problem: this has too much junk data which imho one shouldn't add to a RouteValueDictionary that is passed to an ActionLink So the questions: Is there an RVD that has all the data that was passed to the Controller and was used by it? Is this solution good, or are there any caveats I didn't think about (mainly in the context of changing a few query parameters while keeping the others intact)? Is there a way to filter out the "junk" data from the Params object?

    Read the article

  • How to Create Deterministic Guids

    - by desigeek
    In our application we are creating Xml files with an attribute that has a Guid value. This value needed to be consistent between file upgrades. So even if everything else in the file changes, the guid value for the attribute should remain the same. One obvious solution was to create a static dictionary with the filename and the Guids to be used for them. Then whenever we generate the file, we look up the dictionary for the filename and use the corresponding guid. But this is not feasible coz we might scale to 100's of files and didnt want to maintain big list of guids. So another approach was to make the Guid the same based on the path of the file. Since our file paths and application directory structure are unique, the Guid should be unique for that path. So each time we run an upgrade, the file gets the same guid based on its path. I found one cool way to generate such 'Deterministic Guids' (Thanks Elton Stoneman). It basically does this: private Guid GetDeterministicGuid(string input) { //use MD5 hash to get a 16-byte hash of the string: MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider(); byte[] inputBytes = Encoding.Default.GetBytes(input); byte[] hashBytes = provider.ComputeHash(inputBytes); //generate a guid from the hash: Guid hashGuid = new Guid(hashBytes); return hashGuid; } So given a string, the Guid will always be the same. Are there any other approaches or recommended ways to doing this? What are the pros or cons of that method?

    Read the article

  • PHP4 No Error When Missing Method is Called

    - by INTPnerd
    I have come across an annoying problem while writing some PHP4 code. I renamed the method of a class but I forgot to rename it where it was being called from. The annoying part is it was hard to track down where the problem was because no error was triggered. The script simply aborted leaving the web page partially rendered. Is it normal for this not to trigger an error or is there something wacky going on here? If this is normal is there a way to force this kind of thing to cause an error?

    Read the article

  • why doesn't IE8 refresh textbox right away?(Jquery)

    - by AndrewSmith
    I have 3 radio buttons and one textbox in my page. These 3 radio controls represent corresponding choice and among them, the third one enables textbox that is disabled by default. If user clicks any one from the first twos after clicking the third, the textbox will be emptied(if user input any) and disabled again. The problem is, in IE, the textbox isn't emptied not until I click back once again on the said textbox. I've used jquery val methods as well as attr but nothing seems to work. You can see my code as follows. The very same code works just fine in Mozilla. I'm not sure why IE is having problem. m.bind_eventform = function(){ $('input[name=poster]').change(function(){ if($('input[name=poster]:checked').val()==2) $('#poster_other').removeAttr('disabled'); else if(!($('#poster_other').is(':disabled'))) { $('#poster_other').attr('disabled','disabled'); $('#poster_other').attr('value',''); //this one doesn't work $('#poster_other').val(''); //as well as this one } }); }; $(document).ready(m.bind_eventform);

    Read the article

  • How to migrate project from RCS to CVS?

    - by Norman Ramsey
    I have a 20-year-old project that I would like to migrate from RCS to git, without losing the history. All web pages suggest that the One True Path is through CVS. But after an hour of Googling and trying different scripts, I have yet to find anything that successfully converts my RCS project tree to CVS. I'm hoping the good people at Stackoverflow will know what actually works, as opposed to what is claimed to work and doesn't. (I searched Stackoverflow using both the native SO search and a Google search, but if there's a helpful answer in the database, I missed it.) Things that don't work that I still remember: The rcs-to-cvs script that ships in the contrib directory of the CVS sources The rcs-fast-export tool at http://git.oblomov.eu/rcs-fast-export The rcs2cvs script found in a document called "CVS-RCS- HOW-TO Document for Linux"

    Read the article

  • Reverse engineer an ORM

    - by Oren Mazor
    Given a [mysql] database with a given schema, is it possible to generate an ORM interface for it? doesn't matter if its php, python or perl. in other words, I have a database and I have to ask it a few questions. while I could just craft a bunch of SQL queries (okay, several dozen), this is way more interesting to think about. is this a valid question, even? I have no design background with ORMs, but I've used a few (django's, symfony's, etc).

    Read the article

  • Error with masterpage

    - by Raphyboy
    Hi, i'm creating a brand new masterpage with VS2010 Beta 2 and I get this warning (that causes me errors in the content pages): Validation (XHTML 1.0 Transitional): Content is not supported outside 'script' or 'asp:content' regions. The masterpage's code : <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Bob.master.cs" Inherits="TShirtFactory.Web.All.Core.lib.masterpage.Bob" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <div> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </form> </body> </html> As you can see, it's the default masterpage generated code. I get the warning when I hover the tag at top. Does anybody have an idea of what's going on ? Thank you

    Read the article

  • Ideas for a C/C++ library

    - by Mohit Deshpande
    I thought one of the best ways to familiarise myself with C/C++, is to make a helpful library. I was maybe thinking like a geometry library, like to calculate areas, surface area, etc. It would be useful in game programming. Or maybe an algebra library, like for different formulas like the distance formula, quadratic formula, etc. Or maybe like a standard library for very simple functions, like calculating the number of items in an array.

    Read the article

  • Query Months help

    - by StealthRT
    Hey all i am in need of some helpful tips/advice on how to go about my problem. I have a database that houses a "signup" table. The date for this table is formated as such: 2010-04-03 00:00:00 Now suppose i have 10 records in this database: 2010-04-03 00:00:00 2010-01-01 00:00:00 2010-06-22 00:00:00 2010-02-08 00:00:00 2010-02-05 00:00:00 2010-03-08 00:00:00 2010-09-29 00:00:00 2010-11-16 00:00:00 2010-04-09 00:00:00 2010-05-21 00:00:00 And i wanted to get each months total registers... so following the example above: Jan = 1 Feb = 2 Mar = 1 Apr = 2 May = 1 Jun = 1 Jul = 0 Aug = 0 Sep = 1 Oct = 0 Nov = 1 Dec = 0 Now how can i use a query to do that but not have to use a query like: WHERE left(date, 7) = '2010-01' and keep doing that 12 times? I would like it to be a single query call and just have it place the months visits into a array like so: do until EOF theMonthArray[0] = "total for jan" theMonthArray[1] = "total for feb" theMonthArray[2] = "total for mar" theMonthArray[3] = "total for apr" ...etc loop I just can not think of a way to do that other than the example i posted with the 12 query called-one for each month. This is my query as of right now. Again, this only populates for one month where i am trying to populate all 12 months all at once. SELECT count(idNumber) as numVisits, theAccount, signUpDate, theActive from userinfo WHERE theActive = 'YES' AND idNumber = '0203' AND theAccount = 'SUB' AND left(signUpDate, 7) = '2010-04' GROUP BY idNumber ORDER BY numVisits; The example query above outputs this: numVisits | theAccount | signUpDate | theActive 2 SUB 2010-04-16 00:00:00 YES Which is correct because i have 2 records within the month of April. But again, i am trying to do all 12 months at one time (in a single query) so i do not tax the database server as much when compared to doing 12 different query's... UPDATE I'm looking to do something like along these lines: if NOT rst.EOF if left(rst("signUpDate"), 7) = "2010-01" then theMonthArray[0] = rst("numVisits") end if if left(rst("signUpDate"), 7) = "2010-02" then theMonthArray[1] = rst("numVisits") end if etc etc.... end if Any help would be great! :) David

    Read the article

  • Tracking changes in Entity Framework 4.0 using POCO Dynamic Proxies across multiple data contexts.

    - by Rob Packwood
    I started messing with EF 4.0 because I am curious about the POCO possibilities... I wanted to simulate disconnected web environment and wrote the following code to simulate this: Save a test object in the database. Retrieve the test object Dispose of the DataContext associated with the test object I used to retrieve it Update the test object Create a new data context and persist the changes on the test object that are automatically tracked within the DynamicProxy generated against my POCO object. The problem is that when I call dataContext.SaveChanges in the Test method above, the updates are not applied. The testStore entity shows a status of "Modified" when I check its EntityStateTracker, but it is no longer modified when I view it within the new dataContext's Stores property. I would have thought that calling the Attach method on the new dataContext would also bring the object's "Modified" state over, but that appears to not be the case. Is there something I am missing? I am definitely working with self-tracking POCOs using DynamicProxies. private static void SaveTestStore(string storeName = "TestStore") { using (var context = new DataContext()) { Store newStore = context.Stores.CreateObject(); newStore.Name = storeName; context.Stores.AddObject(newStore); context.SaveChanges(); } } private static Store GetStore(string storeName = "TestStore") { using (var context = new DataContext()) { return (from store in context.Stores where store.Name == storeName select store).SingleOrDefault(); } } [Test] public void Test_Store_Update_Using_Different_DataContext() { SaveTestStore(); Store testStore = GetStore(); testStore.Name = "Updated"; using (var dataContext = new DataContext()) { dataContext.Stores.Attach(testStore); dataContext.SaveChanges(SaveOptions.DetectChangesBeforeSave); } Store updatedStore = GetStore("Updated"); Assert.IsNotNull(updatedStore); }

    Read the article

  • DROP TABLE fails for temp table

    - by StarBright
    I have a client application that creates a temp table, the performs a bulk insert into the temp table, then executes some SQL using the table before deleting it. Pseudo-code: open connection begin transaction CREATE TABLE #Temp ([Id] AS int) bulk insert 500 rows into #Temp UPDATE [OtherTable] SET [Status]=0 WHERE [Id] IN (SELECT [Id] FROM #Temp) AND [Group]=1 DELETE FROM #Temp WHERE [Id] IN (SELECT [Id] FROM [OtherTable] WHERE [Group]=1) INSERT INTO [OtherTable] ([Group], [Id]) SELECT 1 as [Group], [DocIden] FROM #Temp DROP TABLE #Temp COMMIT TRANSACTION CLOSE CONNECTION This is failing with an error on the DROP statement: Cannot drop the table '#Temp', because it does not exist or you do not have permission. I can't imagine how this failure could occur without something else going on first, but I don't see any other failures occurring before this. Is there anything that I'm missing that could be causing this to happen?

    Read the article

  • Have minimized windows with a unique icon/color?

    - by JB
    Are there any programs or way to get a specific icon or any icon for that matter into a minimized window? The reason why I ask is that I hate having 3 or more windows of the same program minimized on my taskbar using the same icon. When I want to open up the program i'm not sure which window to activate. -edit I'm asking for a program to do this for me, not a programming technique

    Read the article

  • Visual Studio 2010 and .NET Framework 4 Training Kit April 2010 Release

    - by Harish Pavithran
    The Visual Studio 2010 and .NET Framework 4 Training Kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2010 features and a variety of framework technologies including: C# 4 Visual Basic 10 F# Parallel Extensions Windows Communication Foundation Windows Workflow Windows Presentation Foundation ASP.NET 4 Windows 7 Entity Framework ADO.NET Data Services Managed Extensibility Framework Visual Studio Team System This version of the Training Kit works with Visual Studio 2010 and .NET Framework 4.  Here is the link enjoy www.microsoft.com/downloads/details.aspx

    Read the article

  • double-click to run .sh file

    - by Delirium tremens
    GUI: I changed the permissions of an sh file, so that I can read, write and execute it. I double-clicked it, selected run in Terminal, but it didn't run. I double-clicked it, selected run, but it didn't run. Command-Line: bash *filename* runs it sh *filename* runs it The file content is: #!/bin/bash # get dirsyncpro home DIRSYNCPRO_HOME="$(dirname $0)" # start programm and pass any parameters java -Xmx512M -jar "$DIRSYNCPRO_HOME/dirsyncpro.jar" $* Works in this person's computer: http://www.knowliz.com/2008/08/how-to-installrun-sh-file-in-linux.html What's going on?

    Read the article

  • Sorting an array in descending order in Ruby.

    - by Waseem
    Hi, I have an array of hashes like following [ { :foo => 'foo', :bar => 2 }, { :foo => 'foo', :bar => 3 }, { :foo => 'foo', :bar => 5 }, ] I am trying to sort above array in descending order according to the value of :bar in each hash. I am using sort_by like following to sort above array. a.sort_by { |h| h[:bar] } However above sorts the array in ascending order. How do I make it sort in descending order? One solution was to do following: a.sort_by { |h| -h[:bar] } But that negative sign does not seem appropriate. Any views?

    Read the article

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