Daily Archives

Articles indexed Thursday May 20 2010

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

  • How to generate semi transparent shapes in php using gdlib

    - by fabbrillo
    Hi, this is the script i made // Create image $img = imagecreatetruecolor($w, $h); // Transparent image $white = imagecolorallocate($img,255,255,255); imagefilledrectangle($img,0,0,$w,$h,$white); imagecolortransparent($img, $white); //imagealphablending( $img, true ); //imagesavealpha( $img, true ); // Shape color $bgColor = imagecolorallocatealpha($img, 100, 250, 250, 70); imagefilledrectangle($img, 15, 20, 50, 100, $bgColor); imagefilledrectangle($img, 10, 25, 60, 100, $bgColor); imagepng($img, 'file.png'); the problem is the rectangles are transparent among them but not with the background i mean, i need to create a transparent image with a semi transparent shape inside any suggestions? thanks for your help

    Read the article

  • Make a jqGrid moveable

    - by Dave
    As it appears that jqGrid is based on the jQuery dialog, is it possible to make it movable (like a dialog)? I've been able to put it inside of a dialog but it looks odd with two title bars and such. I'd "think" that the necessary class could be added to it to make it movable but I'm still fairly new at both jQuery and jqGrid.

    Read the article

  • Differences & Similarities Between Programming Paradigms

    - by DaveDev
    Hi Guys I've been working as a developer for the past 4 years, with the 4 years previous to that studying software development in college. In my 4 years in the industry I've done some work in VB6 (which was a joke), but most of it has been in C#/ASP.NET. During this time, I've moved from an "object-aware" procedural paradigm to an object-oriented paradigm. Lately I've been curious about other programming paradigms out there, so I thought I'd ask other developers their opinions on the similarities & differences between these paradigms, specifically to OOP? In OOP, I find that there's a strong focus on the relationships and logical interactions between concepts. What are the mind frames you have to be in for the other paradigms? Thanks Dave

    Read the article

  • Passing row from UIPickerView to integer CoreData attribute

    - by Gordon Fontenot
    I'm missing something here, and feeling like an idiot about it. I'm using a UIPickerView in my app, and I need to assign the row number to a 32-bit integer attribute for a Core Data object. To do this, I am using this method: -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { object.integerValue = row; } This is giving me a warning: warning: passing argument 1 of 'setIntegerValue:' makes pointer from integer without a cast What am I mixing up here? --EDIT 1-- Ok, so I can get rid of the errors by changing the method to do the following: NSNumber *number = [NSNumber numberWithInteger:row]; object.integerValue = rating; However, I still get a value of 0 for object.integerValue if I use NSLog to print it out. object.integerValue has a max value of 5, so I print out number instead, and then I'm getting a number above 62,000,000. Which doesn't seem right to me, since there are 5 rows. If I NSLog the row variable, I get a number between 0 and 5. So why do I end up with a completely different number after casting the number to NSNumber?

    Read the article

  • python histogram one-liner

    - by mykhal
    there are many ways, how to code histogram in Python. by histogram, i mean function, counting objects in an interable, resulting in the count table (i.e. dict). e.g.: >>> L = 'abracadabra' >>> histogram(L) {'a': 5, 'b': 2, 'c': 1, 'd': 1, 'r': 2} it can be written like this: def histogram(L): d = {} for x in L: if x in d: d[x] += 1 else: d[x] = 1 return d ..however, there are much less ways, how do this in a single expression. if we had "dict comprehensions" in python, we would write: >>> { x: L.count(x) for x in set(L) } but we don't have them, so we have to write: >>> dict([(x, L.count(x)) for x in set(L)]) however, this approach may yet be readable, but is not efficient - L is walked-through multiple times, so this won't work for single-life generators.. the function should iterate well also through gen(), where: def gen(): for x in L: yield x we can go with reduce (R.I.P.): >>> reduce(lambda d,x: dict(d, x=d.get(x,0)+1), L, {}) # wrong! oops, does not work, the key name is 'x', not x :( i ended with: >>> reduce(lambda d,x: dict(d.items() + [(x, d.get(x, 0)+1)]), L, {}) (in py3k, we would have to write list(d.items()) instead of d.items(), but it's hypothethical, since there is no reduce there) please beat me with a better one-liner, more readable! ;)

    Read the article

  • SCM Error: 155007 on Xcode with Subversion

    - by Mark Szymanski
    HI, I am on Mac OS X 10.6.3 with Xcode 3.2.2 (iPhone SDK) and whenever I try to commit an entire project (this project has not been committed yet and there is nothing in the root svn directory) it gives me the error: Error: 155007 (Path is not a working copy directory) Description: 'PATH TO PROJECT (for privacy)' is not a working copy if it helps the SVN hosting is being provided by Codehesion (NOT an advertisement in any way :P) Thanks in advance!

    Read the article

  • HRESULT of 0x806D0005 from Microsoft's Dia2Lib

    - by Aeolien
    I'm trying to read a PDB file into a C# application. When I call loadDataFromPdb or loadAndValidateDataFromPdb with a file that I know exists, I get an HRESULT of 0x806D0005. Unfortunately, I have no idea what that means. I have the list of possible results [here](http://msdn.microsoft.com/en-us/library/2008hf0e(v=VS.80).aspx) but I'm afraid I can't conclusively determine the problem. Does anybody know what I'm doing wrong? Or at least a method of checking what that corresponds to? Exception: System.Runtime.InteropServices.COMException (0x806D0005): Exception from HRESULT: 0x806D0005 at Dia2Lib.DiaSourceClass.loadDataFromPdb(String pdbPath) Code Sample: public static void LoadSymbolsForModule(uint baseAddress, uint size, uint timeStamp, DM_PDB_SIGNATURE signature) { IDiaDataSource m_source = new DiaSourceClass(); //m_source.loadAndValidateDataFromPdb(signature.path, ref signature.guid, 0, signature.age); m_source.loadDataFromPdb(signature.path); IDiaSession m_session; m_source.openSession(out m_session); m_session.loadAddress = baseAddress; modules.Add(new Module(baseAddress, size, m_session)); } Thanks in advance, guys. This problem has been killing me all day.

    Read the article

  • Is 'donation' considered as commerical?

    - by Horace Ho
    I want to port an open source program to iPhone, the license prohibited any commercial use of the code. I emailed the author and he sent back an email saying freeware is ok. Of course I cannot (should not) charge anything on top of the code. Still, I want to get compensation for my work on UI design, graphics and integration work. So I wonder: Is donation (via PayPal) OK for my case? Is in-app purchase OK? i.e. the program is free, the user has the option to buy addition theme graphics? Thanks

    Read the article

  • How Best to Replace Ugly Queries and Dynamic PL/SQL with C#?

    - by Mike
    Hi, I write a lot of one-off Oracle SQL queries (in Toad), and sometimes they can get complex, involving lots of unions, joins, and subqueries, and sometimes requiring dynamic SQL. That is, sometimes SQL queries require set based processing along with significant procedural processing. This is what PL/SQL is custom made for, but as a language it does not begin to compare to C#. Now and then I convert a PL/SQL procedure to C#, and am always amazed at how much cleaner and easier to both read and write the C# version is. The C# program might for example construct a SQL query string piece by piece and/or run several queries and process them as needed. The C# version is usually much faster as well, which must mean that I'm not very good at PL/SQL either. I do not currently have access to LINQ. My question is, how best to package all these little C# programs, which are really just mini reports, that is, replacements for ugly SQL queries? Right now I'm actually using NUnit to hold them, and calling each report a [Test], even though they aren't really tests. NUnit just happens to provide a convenient packaging framework.

    Read the article

  • Which languages support *recursive* function literals / anonymous functions?

    - by Hugh Allen
    It seems quite a few mainstream languages support function literals these days. They are also called anonymous functions, but I don't care if they have a name. The important thing is that a function literal is an expression which yields a function which hasn't already been defined elsewhere, so for example in C, &printf doesn't count. EDIT to add: if you have a genuine function literal expression <exp>, you should be able to pass it to a function f(<exp>) or immediately apply it to an argument, ie. <exp>(5). I'm curious which languages let you write function literals which are recursive. Wikipedia's "anonymous recursion" article doesn't give any programming examples. Let's use the recursive factorial function as the example. Here are the ones I know: JavaScript / ECMAScript can do it with callee: function(n){if (n<2) {return 1;} else {return n * arguments.callee(n-1);}} it's easy in languages with letrec, eg Haskell (which calls it let): let fac x = if x<2 then 1 else fac (x-1) * x in fac and there are equivalents in Lisp and Scheme. Note that the binding of fac is local to the expression, so the whole expression is in fact an anonymous function. Are there any others?

    Read the article

  • sigsetjmp and siglongjmp inside signal handler

    - by EpsilonVector
    How do I: sigsetjmp inside the handler and then return from the handler such that the signal will be unmasked once I siglongjmp back to this point? In pseudo code this is sort of the function that I have: signal_handler(){ if(sigsetjmp(env[i++])) return; else siglongjmp(env[i]); } It's supposed to be the context switch code for user threads in Linux.

    Read the article

  • How can I start nginx via upstart ?

    - by Chiggsy
    Background: DISTRIB_ID=Ubuntu DISTRIB_RELEASE=10.04 DISTRIB_CODENAME=lucid DISTRIB_DESCRIPTION="Ubuntu 10.04 LTS" I've built nginx, and I'd like to use upstart to start it: nginx upstart script from the site: description "nginx http daemon" start on runlevel 2 stop on runlevel 0 stop on runlevel 1 stop on runlevel 6 console owner exec /usr/sbin/nginx -c /etc/nginx/nginx.conf -g "daemon off;" respawn I get "unknown job" when i try to use initctl to run it, which I just learned apparently means there is an error, ( what's wrong with "Error" to describe errors?) Can someone point me in the right direction ? I've read the documentation , as it is, and it seems kind of sparse for a SysV init replacement... but whatever just need to add this job to the list, run it, and get on with what's left of my life... Any tips? EDIT: initctl version init (upstart 0.6.5)

    Read the article

  • Align child element to bottom with CSS

    - by alex
    I have a form input, and the label spans multiple lines, and I want the corresponding checkbox to appear at the bottom (last line of the label element). Here is what I was playing with CSS .standard-form { width: 500px; border: 1px solid red; } .standard-form .input-row { overflow: hidden; margin-bottom: 0.8em; } .standard-form label { width: 25%; float: left; } .standard-form .input-container { width: 70%; float: right; } .standard-form .checkbox .input-container { display: table-cell; height: 100%; vertical-align: text-bottom; } HTML <form class="standard-form"> <div class="input-row checkbox" id="permission"> <label for="input-permission"> Do I hereby grant you permission to do whatever tasks are neccessary to achieve an ideal outcome? </label> <div class="input-container"> <input type="checkbox" id="input-permission" name="permission" value="true" /> </div> </div> </form> It is also online at JSbin. Is there any way to do this? I notice that div.input-container isn't expanding, which is the old multi column problem with CSS. I thought I could get this going with display: table-cell and vertical-align: bottom but I haven't been able to do it yet. I don't mind that IE6/7 won't render it correctly.

    Read the article

  • First Time Architecturing?

    - by cam
    I was recently given the task of rebuilding an existing RIA. The new RIA that I've designed is based on Silverlight, with a WCF service to connect to MS SQL Server. This is my first time doing something like this, so I'm not sure how to design the entire thing. Basically, the client can look through graphs of "stocks" (allowing the client to choose different time periods, settings, etc). I've written the whole application essentially, but I'm not sure how to put it together. The graphs are supposed to be directly based on the database, and to create the datapoints on the graph, some calculations need to be done (not very expensive ones). The problem I'm having is to decide where to put the calculations (client or serverside? Or half and half?) What factors should I look for to help me decide where the calculations should be done? And how can I go about optimizing this (caching, etc)? Obviously this is a very broad subject, so I'm not expecting an immediate answer, but any help/pointing in the right direction/resources would be appreciated.

    Read the article

  • Code coverage tools that can be used on .NET 4.0 assemblies

    - by Tim Duncan
    We use Xunit.net as our unit test framework for use on our .NET4 assemblies. We have it integrated into our TFS 2010 team builds quite successfully. I now want to add code coverage to the nightly builds as well. Does anyone have a list of coverage tools that work on 4.0 assemblies and could be integrated into our automated builds?

    Read the article

  • How does Photoshop (Or drawing programs) blit?

    - by user146780
    I'm getting ready to make a drawing application in Windows. I'm just wondering, do drawing programs have a memory bitmap which they lock, then set each pixel, then blit? I don't understand how Photoshop can move entire layers without lag or flicker without using hardware acceleration. Also in a program like Expression Design, I could have 200 shapes and move them around all at once with no lag. I'm really wondering how this can be done without GPU help. I don't think super efficient algorithms could justify that? Thanks

    Read the article

  • Idiomatic ruby for temporary variables within a method

    - by Andrew Grimm
    Within a method, I am using i and j as temporary variables while calculating other variables. What is an idiomatic way of getting rid of i and j once they are no longer needed? Should I use blocks for this purpose? i = positions.first while nucleotide_at_position(i-1) == nucleotide_at_position(i) raise "Assumption violated" if i == 1 i -= 1 end first_nucleotide_position = i j = positions.last while nucleotide_at_position(j+1) == nucleotide_at_position(j) raise "Assumption violated" if j == sequence.length j += 1 end last_nucleotide_position = j Background: I'd like to get rid of i and j once they are no longer needed so that they aren't used by any other code in the method. Gives my code less opportunity to be wrong. I don't know the name of the concept - is it "encapsulation"? The closest concepts I can think of are (warning: links to TV Tropes - do not visit while working) Chekhov'sGun or YouHaveOutlivedYourUsefulness. Another alternative would be to put the code into their own methods, but that may detract from readability.

    Read the article

  • flex data provider not working if XML has single node value or less

    - by Rees
    hello, i get this error when i retrieve an XML that only has 1 node (no repeating nodes) and i try to store in an ArrayCollection. -When I have MORE than 1 "name" nodes...i do NOT get an error. My test show that XMLListCollection does NOT work either. TypeError: Error #1034: Type Coercion failed: cannot convert "XXXXXX" to mx.collections.ArrayCollection. this error occurs as the line of code: myList= e.result.list.name; Why can't ArrayCollection work with a single node? I'm using this ArrayCollection as a dataprovider for a Component -is there an alternative I can use that will take BOTH single and repeating nodes as well as work as a dataprovider? Thanks in advance! code: [Bindable] private var myList:ArrayCollection= new ArrayCollection(); private function getList(e:Event):void{ var getStudyLoungesService:HTTPService = new HTTPService(); getStuffService.url = "website.com/asdf.php"; getStuffService.addEventListener(ResultEvent.RESULT, onGetList); getStuffService.send(); } private function onGetList(e:ResultEvent):void{ myList= e.result.list.name; }

    Read the article

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