I've got a plugin that is a bit heavy-weight. (Bullet, configured with Growl notifications.) I'd like to not enable it if I'm just running a rake task or a generator, since it's not useful in those situations. Is there any way to tell if that's the case?
I have some old MFC program using GDI heavily for drawing of texts and vectors. The program is scheduled to be rewritten in the future using DirectX/OpenGL. In the meantime, is there any library which acts as a simple wrapper that could replace GDI for one of these hardware accelerated APIs to improve performance?
final Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("image/jpeg");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" });
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "this is the test");
emailIntent.putExtra(Intent.EXTRA_TEXT, "testing time");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
Not sure how many people out there work with bar codes in their applications. I have been on a few projects that required bar codes to be programatically generated. Having seen this new Tag technology from Microsoft I am wondering if anyone has worked with MS Tag yet? Do you have some examples of programming against MS Tag?
Hi,
I've used the java compiler tree api to generate the ast for java source files. However, i'm unable to access th comments in the source files.
So far, i've been unable to a way to extract comments from source file .. is there a way using the compiler api or some other tool ?
Hi,
Was just wondering how do these sites (and many other softwares that generate flash movies from audio clips,images , docs) work ? how do they compile the media files(audio/image/vid) into a flv movie on the server ? Can the same be done using some open source tech.
Any info or hint or some direction where i'd get more info regarding this would be very helpful.
Thanks
For many methods in .NET, the exceptions they can potentially throw can be as many as 7-8 (one or two methods in XmlDocument, Load() being one I think, can throw this many exceptions).
Does this mean I have to write 8 catch blocks to catch all of these exceptions (it is best practise to catch an exception with a specific exception block and not just a general catch block of type Exception).
How do I use this information?
Thanks
Hi,
I want to change the maximum file upload size in my website, for this i'm going to add some code lines in my .htaccess file.
i have searched in google and i got the lines of code to add in .htaccess file. But i don't know exactly were to add that lines of code .
Below is the lines of code currently in my .htaccess file
code below
-FrontPage-
IndexIgnore .htaccess /.?? *~ *# /HEADER */README* */_vti*
order deny,allow
deny from all
allow from all
order deny,allow
deny from allenter code here
AuthName www.mysite.com
AuthUserFile /www/htdocs/domains/s11/01712/www.mysite.com/webdocs/_vti_pvt/service.pwd
AuthGroupFile /www/htdocs/domains/s11/01712/www.mysite.com/webdocs/_vti_pvt/service.grp
AddHandler php5-script .php
Here is the code to add
php_value post_max_size 50M
php_value upload_max_filesize 50M
how to add this lines of code in .htaccess file and where??
Please help me..
Thanks
For eclipse 3.5 / 3.6 and JQuery 1.4.2, what are the best practices for a development IDE?
(jquerywtp seems unmaintained, and aptana seems an overkill)
Is eclipse not the right tool for JQuery dev?
I'm really sorry if this sounds kinda dumb. I just finished reading K&R and I worked on some of the exercises. This summer, for my project, I'm thinking of re-implementing a linux utility to expand my understanding of C further so I downloaded the source for GNU tar and sed as they both seem interesting. However, I'm having trouble understanding where it starts, where's the main implementation, where all the weird macros came from, etc.
I have a lot of time so that's not really an issue. Am I supposed to familiarize myself with the GNU toolchain (ie. make, binutils, ..) first in order to understand the programs? Or maybe I should start with something a bit smaller (if there's such a thing) ?
I have little bit of experience with Java, C++ and python if that matters.
Thanks!
I have been experimenting with various uses of hierarchies like this and the differences between absolute and relative imports, and can't figure out how to do routine things with the package, subpackages, and modules without simply putting everything on sys.path. I have a two-level package hierarchy:
MyApp
__init__.py
Application
__init__.py
Module1
Module2
...
Domain
__init__.py
Module1
Module2
...
UI
__init__.py
Module1
Module2
...
I want to be able to do the following:
Run test code in a Module's "if main" when the module imports from other modules in the same directory.
Have one or more test code modules in each subpackage that runs unit tests on the modules in the subpackage.
Have a set of unit tests that reside in someplace reasonable, but outside the subpackages, either in a sibling package, at the top-level package, or outside the top-level package (though all these might end up doing is running the tests in each subpackage)
"Enter" the structure from any of the three subpackage levels, e.g. run code that just uses Domain modules, run code that just uses Application modules, but Application uses code from both Application and Domain modules, and run code from GUI uses code from both GUI and Application; for instance, Application test code would import Application modules but not Domain modules.
After developing the bulk of the code without subpackages, continue developing and testing after organizing the modules into this hierarchy.
I know how to use relative imports so that external code that puts MyApp on its sys.path can import MyApp, import any subpackages it wants, and import things from their modules, while the modules in each subpackage can import other modules from the same subpackage or from sibling packages. However, the development needs listed above seem incompatible with subpackage structuring -- in other words, I can't have it both ways: a well-structured multi-level package hierarchy used from the outside and also used from within, in particular for testing but also because modules from one design level (in particular the UI) should not import modules from a design level below the next one down.
Sorry for the long essay, but I think it fairly represents the struggles a lot of people have been having adopting to the new relative import mechanisms.
I am using SWFUpload v2.2.
In IE (8):
If I upload a very tiny file (16kb):
1) The file appears in the root directory where upload.aspx is located.
2) Page_Load on upload.aspx.cs is executed.
3) The file is actually processed by the Page_Load procedure, and the processed file is saved in the correct location.
If I upload a normal file (1.5 MB):
1) The file appears in the root directory where upload.aspx is located.
In Firefox (3.5.7):
No matter what size the file is, it:
1) The file appears in the root directory where upload.aspx is located.
I have maxRequestLength="30000" executionTimeout="3000" in the web.config just to be sure.
In the setting object for the constructor I have:
file_size_limit: "10 MB",
file_types: ".",
file_types_description: "All Files",
So my questions are:
How is the file getting saved in the root directory (and why)?
Why does Page_Load only execute when I am using IE and uploading very tiny files?
I am building a library to automatically create forms for Objects in the project that I am working on.
The codebase is in C#, and essentially we have a HUGE number of different objects to store information about different things. If I send these objects to the client side as JSON, it is easy enough to programatically inspect them to generate a form for all of the properties.
The problem is that I want to be able to create a simple way of enforcing permissions and doing validation on the client side. It needs to be done on a field by field level.
In javascript I would do this by creating a parallel object structure, which had some sort of { permissions : "someLevel", validator : someFunction } object at the nodes. With empty nodes implying free permissions and universal validation. This would let me simply iterate over the new object and the permissions object, run the check, and deal with the result.
Because I am overfamilar with the hammer that is javascript, this is really the only way that I can see to deal with this problem. My first implementation thus uses reflection to let me treat objects as dictionaries, that can be programatically iterated over, and then I just have dictionaries of dictionaries of PermissionRule objects which can be compared with.
Very javascripty. Very awkward.
Is there some better way that I can do this? Essentially a way to associate a data set with each property, and then iterate over those properties.
Or else am I Doing It Wrong?
Hi,
I have ELMAH set up for a webapp, logging exceptions to a SQL server.
I wish to have ELMAH send me an email too, but only when a specific exception is thrown (ie. MySpecialException).
ELMAH must still log all exceptions to SQL server.
I know you can do it programmatically in global.asax, but I'd prefer to use web.config.
So, how do I restrict ELMAH error mails to filter out everything but a specific exception type, using web.config?
I have an nHibernate querie issue that looks quite straight forward, but I can't seem to get my head around it!
I am creating some simple example classes to illustrate my problem:
public class Car {
public int Id { get; set; }
public IList<Interior> InteriorParts { get; set; }
}
public class Interior {
public int Id { get; set; }
public InteriorProducer Producer { get; set; }
}
public class InteriorProducer {
public int Id { get; set; }
}
Now to the query: I have the id of the InteriorProducer, but need to get a list of Cars where the interior have been produced by the interior producer.
So in a simple, pseudo SQL, it looks something like this:
select cars
where car.InteriorParts.Producer.Id = Id
I have a really hard time getting my head around this to create an nHibernate query.
Any Ideas?
Thanks
Hi all, i have a class with some method that depend by one parameter.
What is the best way to write this method?
Example:
First way
class Test{
var $code;
function Test($type){
if($type=="A"){
$this->code=create_function(/*some args and some code*/);
}
else if($type=="B"){
$this->code=create_function(/*some args and some code*/);
}
}
function use(/*some args*/){
return call_user_func($this->code,/*some args*/);
}
}
Second way
class Test{
var $type;
function Test($type){
$this->type=$type;
}
function use(/*some args*/){
if($this->type=="A"){
//some code
}
else if($this->type=="B"){
//some code
}
}
}
$test=new Test("A");
$test->use();
Which way you would choose?
Thanks.
I am reading Hibernate in Action and the author suggests to move business logic into our domain models (p. 306). For instance, in the example presented by the book, we have three entities named Item, Bid, and User and the author suggests to add a placeBid(User bidder, BigDecimal amount) method to the Item class.
Considering that usually we have a distinct layer for business logic (e.g. Manager or Service classes in Spring) that among other things control transactions, etc. is this really a good advice? Isn't it better not to add business logic methods to our entities?
Thanks in advance.
Obviously, I am a novice web designer. I'm using php and sql to do all the under-the-hood stuff, but I want a visually appealing as well as functional comment system. Right now I am just using HTML forms but they don't look very good. Should I be using javascript? Any tips to get me started?
Posting a video on tumblr.com allows you to just paste the URL of the video on youtube, vimeo, whatever and tumblr automatically does the embedding for you.
I assume that this would be nothing more than a mapping between an URL-regex and the belonging HTML construct for embedding the video. Or it is just parsing the response of the URL and getting the construct from there.
Is there already any utility, preferably in Java, for doing this? If not, how would you do it?
I have Made the CheckboxList like this?
<%foreach(ListItem m in bootcamp.STPs.ProjectManagement.Controllers.MemberController.JALLMembers()){%>
<label for=""><%= m.Text %></label>
<input id="Mana" type="checkbox" value="<%= m.Value %>" name="chkbx" />
<%}%>
How can I get the Values of selected checkboxes through ajax script in controller?
I am using Asp.net MVC?
I installed ruby-mbox by doing gem install ruby-mbox
Running this:
#!/usr/bin/ruby
require 'rubygems'
require 'mbox'
m = IO.read('test.eml')
puts m.size
m = Mbox.new(m)
puts m
produces this:
71309505
/Library/Ruby/Gems/1.8/gems/ruby-mbox-0.0.2/lib/mbox/mbox.rb:45:in `initialize': uninitialized constant Mbox::StringIO (NameError)
from r.rb:7:in `new'
from r.rb:7
I have proved that "m" is assigned a string containing the contents of the file, just before Mbox.new(m) is called.
It looks as though the Mbox::StringIO should have been defined by hasn't been.
What's going wrong here?
Ruby version:
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
(That's the default ruby installed on OS X 10.6.6)
var response = "{\"tree\":[{\"level1\":[{\"node\":{\"id\": 1,\"name\": \"paradox\",\"parent\": 0}}]},{\"level2\":[{\"node\":{\"id\": 2,\"name\": \"lucent\",\"parent\": 1}},{\"node\":{\"id\": 3,\"name\": \"reiso\",\"parent\": 1}}]},{\"level3\":[{\"node\":{\"id\": 4,\"name\": \"pessi\",\"parent\": 3}},{\"node\":{\"id\": 5,\"name\": \"misho\",\"parent\": 2}}]},{\"level4\":[{\"node\":{\"id\": 6,\"name\": \"hema\",\"parent\": 5}},{\"node\":{\"id\": 7,\"name\": \"iiyo\",\"parent\": 4}}]}]}";
var data = eval("(" + response + ")");
This is a dummy json response I am currently testing. Now how do I get the value of "name" in the 1st node of "level1" from the "tree"? Thanks
I have a menu click event that looks something like this....
Public Sub ToolbarManager_ToolClick(sender as Object, e as EventArgs)
Case "New"
CreateNewFile()
Case "Save"
SaveCurrentFile()
Case "Exit"
ExitApp()
Case.......
etc...
etc...
End Sub
This strikes me as being 'ugly' - but I'm unsure of the 'best' way or the most appropriate way to clean it up.