I'm having the problem that ctags takes me to a forward declaration allot of times instead of to the actual definition of the function.
Any way to get around that?
This is a question that originated from this question by Jamie.
I thought I'll check Dougman's answer. What's happening here? A restore?
select created from dba_users where username = 'SYS';
select min(created) FROM dba_objects;
select created from v$database;
CREATED
-------------------------
10-SEP-08 11:24:44
MIN(CREATED)
-------------------------
10-SEP-08 11:24:28
CREATED
-------------------------
18-DEC-09 15:49:00
Created from v$database is more than one year later than creation date of user SYS and SYS' objects.
I want to capitalize the first character of a string, and not change the case of any of the other letters. For example:
this is a test - This is a test
the Eiffel Tower - The Eiffel Tower
/index.html - /index.html
I'm looking for a way to determine if/when a <select> element's menu is open. I don't need to force it to open or close, just figure out if it's open or closed at a given time.
I can listen to events for focus/blur, mouseup/mousedown, etc., but I don't think I can reliably figure out the state of the menu from those events. For example, mousedown followed by mouseup could mean the user clicked and dragged to a selection and released (in which case the menu is now closed) or clicked and released to open the menu (in which case the menu is open). It also seems likely that the specific behavior of dropdown menus is browser-dependent.
I know I could do this if I roll my own dropdown menu, but I prefer to use <select>.
Is there a reliable way to find out if a dropdown menu is open? Or is this something that Javascript can't know?
Hey all, got a little problem here and can't figure out what I am doing wrong. I am trying to animate a UIView up and down repeatedly. When I start it, it goes down correctly and then back up but then immediately shoots to the "final" position of the animation. Code is as follows:
UIImageView *guide = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]];
guide.frame = CGRectMake(250, 80, 30, 30);
[self.view addSubview:guide];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:2];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationBeginsFromCurrentState:YES];
guide.frame = CGRectMake(250, 300, 30, 30);
[UIView setAnimationRepeatCount:10];
[UIView commitAnimations];
Thanks in advance!
Completion on class members which are STL containers is failing.
Completion on local objects which are STL containers works fine.
For example, given the following files:
// foo.h
#include <string>
class foo {
public:
void
set_str(const std::string &);
std::string
get_str_reverse( void );
private:
std::string str;
};
// foo.cpp
#include "foo.h"
using std::string;
string
foo::get_str_reverse ( void )
{
string temp;
temp.assign(str);
reverse(temp.begin(), temp.end());
return temp;
} /* ----- end of method foo::get_str ----- */
void
foo::set_str ( const string &s )
{
str.assign(s);
} /* ----- end of method foo::set_str ----- */
I've generated the tags for these two files using:
ctags -R --c++-kinds=+pl --fields=+iaS --extra=+q .
When I type temp. in the cpp I get a list of string member functions as expected. But if I type str. omnicppcomplete spits out "Pattern Not Found".
I've noticed that the temp. completion only works if I have the using std::string; declaration.
How do I get completion to work on my class members which are STL containers?
Hello fellow software developers.
I want to distribute a program which is scriptable by embedding the Python interpreter.
What I don't want is that the user has to install Python first.
So I'm looking for a solution where I distribute only the following components:
my program executable and its libraries
the Python library (dll/so)
a ZIP-file containing all necessary Python modules and libraries.
How can I accomplish this? Do you have a step-by-step recipe for me?
The solution should be suitable for both Windows and Linux.
Thanks in advance.
I'm trying to insert a TH as the first column. But so far always put it at the end of all columns. Any help will be appreciate it. Thanks
var someNode = document.createElement("th");
someNode.innerHTML = "Hello";
var sp = document.getElementById("table").getElementsByTagName("thead")[0].getElementsByTagName("tr")[0];
var ref = document.getElementById("table").getElementsByTagName("thead")[0].getElementsByTagName("tr")[0].getElementsByTagName("th")[0];
sp.insertBefore(someNode,ref);
I'd like some advice on how to best refactor this controller. The controller builds a page of zones and modules. Page has_many zones, zone has_many modules. So zones are just a cluster of modules wrapped in a container.
The problem I'm having is that some modules may have some specific queries that I don't want executed on every page, so I've had to add conditions. The conditions just test if the module is on the page, if it is the query is executed. One of the problems with this is if I add a hundred special module queries, the controller has to iterate through each one.
I think I would like to see these module condition moved out of the controller as well as all the additional custom actions. I can keep everything in this one controller, but I plan to have many apps using this controller so it could get messy.
class PagesController < ApplicationController
# GET /pages/1
# GET /pages/1.xml
# Show is the main page rendering action, page routes are aliased in routes.rb
def show
#-+-+-+-+-Core Page Queries-+-+-+-+-
@page = Page.find(params[:id])
@zones = @page.zones.find(:all, :order => 'zones.list_order ASC')
@mods = @page.mods.find(:all)
@columns = Page.columns
# restful params to influence page rendering, see routes.rb
@fragment = params[:fragment] # render single module
@cluster = params[:cluster] # render single zone
@head = params[:head] # render html, body and head
#-+-+-+-+-Page Level Json Conversions-+-+-+-+-
@metas = @page.metas ? ActiveSupport::JSON.decode(@page.metas) : nil
@javascripts = @page.javascripts ? ActiveSupport::JSON.decode(@page.javascripts) : nil
#-+-+-+-+-Module Specific Queries-+-+-+-+-
# would like to refactor this process
@mods.each do |mod|
# Reps Module Custom Queries
if mod.name == "reps"
@reps = User.find(:all, :joins => :roles, :conditions => { :roles => { :name => 'rep' } })
end
# Listing-poc Module Custom Queries
if mod.name == "listing-poc"
limit = params[:limit].to_i < 1 ? 10 : params[:limit]
PropertyEntry.update_from_listing(mod.service_url)
@properties = PropertyEntry.all(:limit => limit, :order => "city desc")
end
# Talents-index Module Custom Queries
if mod.name == "talents-index"
@talent = params[:type]
@reps = User.find(:all, :joins => :talents, :conditions => { :talents => { :name => @talent } })
end
end
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @page.to_xml( :include => { :zones => { :include => :mods } } ) }
format.json { render :json => @page.to_json }
format.css # show.css.erb, CSS dependency manager template
end
end
# for property listing ajax request
def update_properties
limit = params[:limit].to_i < 1 ? 10 : params[:limit]
offset = params[:offset]
@properties = PropertyEntry.all(:limit => limit, :offset => offset, :order => "city desc")
#render :nothing => true
end
end
So imagine a site with a hundred modules and scores of additional controller actions. I think most would agree that it would be much cleaner if I could move that code out and refactor it to behave more like a configuration.
I have a POST controller action that returns a partial view. Everything seems really easy. but. I load it using $.ajax(), setting type as html. But when my model validation fails I thought I should just throw an error with model state errors. But my reply always returns 500 Server error.
How can I report back model state errors without returning Json with whatever result. I would still like to return partial view that I can directly append to some HTML element.
Edit
I would also like to avoid returning error partial view. This would look like a success on the client. Having the client parse the result to see whether it's an actual success is prone to errors. Designers may change the partial view output and this alone would break the functionality. So I want to throw an exception, but with the correct error message returned to the ajax client.
I need to change the dojo namespace to something else. I found this stackoverflow post, but it refers to a dojo documentation page that no longer exists. Below is something I tried based on this page, but didn't work:
<html
<head
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js" djConfig="scopeMap: [[ 'dojo', 'newns' ]]"</script
<script
newns.addOnLoad(function(){
console.debug("hello world");
});
</script
</head
<body
</body
</html
Help!
I have a few (hopefully) simple questions about aggregate roots in domain driven design:
Is it okay to have an aggregate root as a property of another aggregate root?
Is it okay to have a given entity inside two or more aggregate roots?
My final question is a bit more involved. I have a website that has a few entities that really belong to a "website" aggregate root. They are 'News', 'Products', and 'Users'. There isn't a 'Website' table in the database, but a 'Website' seems like a good aggregate root for these three entities.
How is this usually achieved?
Thanks!
Every time I start Visual Studio 2008, the first time I try to run the project I get the error CS0006 The metadata file ... could not be found. If I do a rebuild of the complete solution it works.
Some information about the solution:
I'm building in debug mode and Visual Studio complains about not finding dll:s in the release folder.
The projects Visual Studio complains about are used by many other projects in the solution.
I have changed the default output path of all projects to a ......\build\debug\ProjectName and ......\build\release\ProjectName respectively. (Just to get all build files in one directory)
I have the same problem with a another solution.
The solution was created from scratch.
There are 9 projects in the solution. One WPF and 8 class libraries using dotnet 3.5.
Any ideas on what is causing this problem?
Hello, I am using djano-cms for my site, but instead of language alias /en/ /de/ I need to use another domain. I would like to avoid running multiple django instances, and instead I would like to use lighttpd redirects if possible.
I would like requests coming to domain2.com getting data from domain.com/en . The best would be if the user entering:
domain2.com/offer got transparently data from domain.com/en/offer
Tried many solutions with url.redirect, url.rewrite but none seems to work as desired.
Also tried with: http://stackoverflow.com/questions/261904/matching-domains-with-regex-for-lighttpd-mod-evhost-www-domain-com-domain-com but that didn't work.
Please help. This is my lighttpd configuration.
$HTTP["host"] == "^domain2\.com" {
url.redirect = ("^/(.*)" => "http://domain.com/en/$1")
}
$HTTP["host"] =~ "^domain\.com" {
server.document-root = "/var/www/django/projects/domain/"
accesslog.filename = "/var/log/lighttpd/domain.log-access.log"
server.errorlog = "/var/log/lighttpd/www.domain-error.log"
fastcgi.server = (
"/domain-service.fcgi" => (
"main" => (
"socket" => "/tmp/django-domain.sock",
"check-local" => "disable",
)
),
)
alias.url = (
"/media/" => "/var/www/django/projects/domain/media/",
)
url.rewrite-once = (
"^(/site_media.*)$" => "$1",
"^(/media.*)$" => "$1",
"^/favicon\.ico$" => "/media/favicon.ico",
"^(/.*)$" => "/domain-service.fcgi$1",
}
Thanks
As programmers, we've all put together a really cool program or pieced together some hardware in an interesting way to solve a problem. Today I was thinking about those hacks and how some of them are deprecated by modern technology (for example, you no longer need to hack your Tivo to add a network port). In the software world, we take things like drag-and-drop on a web page for granted now, but not too long ago that was a pretty exciting hack as well.
One of the neatest hardware hacks I've seen was done by a former coworker at a telecom company years ago. He had a small portable television in his office and he would watch it all day long while working. To get away with it, he wired a switch to the on/off that was activated via his foot under his desk.
What's the coolest hardware or software hack you've personally seen or done? What hack are you working on right now?
Hi all,
when I try to copy any file with scp on Mac OS X Snow Leopard from another machine I get this error:
scp [email protected]:/home/me/file.zip .
Password:
...
---> Couldn't open /dev/null: Permission denied
this is the output of "ls -l /dev/null":
crw-rw-rw- 1 root wheel 3, 2 May 14 14:10 /dev/null
I am in the group wheel, and even if I do "sudo scp..." it doesn't work. It's driving me crazy, do you have any suggestion?
Thanx!
Hello,
In the project I'm working on I have got a list List<Item> with objects that Is saved in a session. Session.Add("SessionName", List);
In the Controller I build a viewModel with the data from this session
var arrayList = (List<Item>)Session["SessionName"];
var arrayListItems= new List<CartItem>();
foreach (var item in arrayList)
{
var listItem = new Item
{
Amount = item.Amount,
Variant= item.variant,
Id = item.Id
};
arrayListItems.Add(listItem);
}
var viewModel = new DetailViewModel
{
itemList = arrayListItems
}
and in my View I loop trough the list of Items and make a form for all of them to be able to remove the item.
<table>
<%foreach (var Item in Model.itemList) { %>
<% using (Html.BeginForm()) { %>
<tr>
<td><%=Html.Hidden(Settings.Prefix + ".VariantId", Item .Variant.Id)%>
<td> <%=Html.TextBox(Settings.Prefix + ".Amount", Item.Amount)%></td>
<td> <%=Html.Encode(Item.Amount)%> </td>
<td> <input type="submit" value="Remove" /> </td>
</tr>
<% } %>
<% } %>
</table>
When the post from the submit button is handeld the item is removed from the array and post back exactly the same viewModel (with 1 item less in the itemList).
return View("view.ascx", viewModel);
When the post is handled and the view has reloaded the value's of the html.Hidden and Html.Textbox are the value's of the removed item. The value of the html.Encode is the correct value. When i reload the page the correct values are in the fields. Both times i build the viewModel the exact same way.
I cant find the cause or solution of this error. I would be very happy with any help to solve this problem
Thanx in advance for any tips or help
We are trying to use a basic @OneToMany relationship:
@Entity
@Table(name = "PARENT_MESSAGE")
public class ParentMessage {
@Id
@Column(name = "PARENT_ID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer parentId;
@OneToMany(fetch=FetchType.LAZY)
private List childMessages;
public List getChildMessages() {
return this.childMessages;
}
...
}
@Entity
@Table(name = "CHILD_MSG_USER_MAP")
public class ChildMessage {
@Id
@Column(name = "CHILD_ID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer childId;
@ManyToOne(optional=false,targetEntity=ParentMessage.class,cascade={CascadeType.REFRESH}, fetch=FetchType.LAZY)
private ParentMessage parentMsg;
public ParentMessage getParentMsg() {
return parentMsg;
}
...
}
ChildMessage child = new ChildMessage();
em.getTransaction().begin();
ParentMessage parentMessage = (ParentMessage) em.find(ParentMessage.class, parentId);
child.setParentMsg(parentMessage);
List list = parentMessage.getChildMessages();
if(list == null) list = new ArrayList();
list.add(child);
em.getTransaction().commit();
We receive the following error. Why is OpenJPA concatenating the table names to APP.PARENT_MESSAGE_CHILD_MSG_USER_MAP? Of course that table doesn't exist.. the tables defined are APP.PARENT_MESSAGE and APP.CHILD_MSG_USER_MAP
Caused by:
org.apache.openjpa.lib.jdbc.ReportingSQLException:
Table/View
'APP.PARENT_MESSAGE_CHILD_MSG_USER_MAP'
does not exist. {SELECT t1.CHILD_ID,
t1.PARENT_ID, t1.CREATED_TIME,
t1.USER_ID FROM
APP.PARENT_MESSAGE_CHILD_MSG_USER_MAP
t0 INNER JOIN
APP.CHILD_MSG_USER_MAP t1 ON
t0.CHILDMESSAGES_CHILD_ID =
t1.CHILD_ID WHERE
t0.PARENTMESSAGE_PARENT_ID = ?}
[code=30000, state=42X05]
I'm looking to do some sentence analysis (mostly for twitter apps) and infer some general characteristics. Are there any good natural language processing libraries for this sort of thing in Ruby?
Similar to http://stackoverflow.com/questions/870460/java-is-there-a-good-natural-language-processing-library but for Ruby. I'd prefer something very general, but any leads are appreciated!
I'm trying to port a library that uses ucontext over to a platform which supports pthreads but not ucontext. The code is pretty well written so it should be relatively easy to replace all the calls to the ucontext API with a call to pthread routines. However, does this introduce a significant amount of additional overhead? Or is this a satisfactory replacement. I'm not sure how ucontext maps to operating system threads, and the purpose of this facility is to make coroutine spawning fairly cheap and easy.
So, question is: Does replacing ucontext calls with pthread calls significantly change the performance characteristics of a library?
Ok I'm stumped on this one.
I've got a ASMX web service up and running. I can browse to it (~/Webservice.asmx) and see the .NET generated page and test it out.. and it works fine.
I've got a page with a Script Manager with the webservice registered... and i can call it in javascript (Webservice.Method(...)) just fine.
However, I want to use this Webservice as part of a jQuery Autocomplete box. So I have use the url...? and the Webservice is never being called.
Here's the code.
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class User : System.Web.Services.WebService {
public User () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string Autocomplete(string q)
{
StringBuilder sb = new StringBuilder();
//doStuff
return sb.ToString();
}
web.config
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
And the HTML
$(document).ready(function() {
User.Autocomplete("rr", function(data) { alert(data); });//this works
("#<%=txtUserNbr.ClientID %>").autocomplete("/User.asmx/Autocomplete"); //doesn't work
$.ajax({
url: "/User.asmx/Autocomplete",
success: function() { alert(data); },
error: function(e) { alert(e); }
}); //just to test... calls "error" function
});
What's the best choice when trying to mask a texture
like ColorSplash or other apps like iSteam, etc?
I started learning OPENGL ES like... 4 days ago (I'm a total
rookie) and tried the following approach:
1) I created a colored texture2D, a grayscale version of the first
texture and a third texture2D called mask
2) I also created a texture2D for the brush... which is grayscale and
it's opaque (brush = black = 0,0,0,1 and surroundings = white =
1,1,1,1). My intention was to create an antialiased brush with smooth
edges but i'm fine with a normal one right now
3) I searched for masking techniques on the internet and found this
tutorial ZeusCMD - Design and Development Tutorials : OpenGL ES Programming Tutorials - Masking
about masking. The tutorial tells me to use blending to achieve
masking... first draw colored, then mask with
glBlendFunc(GL_DST_COLOR, GL_ZERO) and then grayscale with
glBlendFunc(GL_ONE, GL_ONE) ... and this gives me something close to
what i want... but not exactly what i want. The result is masked but
it's somehow overbright-ed
4) For drawing to the mask texture i used an extra frame buffer object (FBO)
I'm not really happy with the resulting image (overbright-ed picture)
nor with the speed achieved with this method. I think the normal way
was to draw directly to the grayscale (overlay) texture2D affecting
only it's alpha channel in the places where the brush hits. Is there a
fast way to achieve this? I have searched a lot and never got an
answer that's clear and understandable. Then, in the main draw loop I
could only draw the colored texture and then blend the grayscale ontop
with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).
I just want to learn to use OPENGL ES and it's driving me nuts because i can't get it to work properly. An advice, a link to a tutorial would be much appreciated.
Hi, i simply want to load a .BMP file and get the Bitmap object in 24bit RGB format (or 32bit in RGB format).
All methods I tried return a Bitmap/Image object with PixelFormat = Format32bppArgb. Even if of course BMPs don't have alpha.
new Bitmap(System.Drawing.Image.FromFile(fileName, true));
new Bitmap(fileName);
I currently solve the problem by copying the first object to another in memory bitmap at 24bit RBG.
Is there a single method to do it?
Thanks
I'm having some trouble reading files with Indy from a site that has WordPress installed.
It appears that the site is configured to redirect all hits to sitename/com/wordpress.
Can I use HandleRedirect to turn that off so I can read files from the root folder?
What is the normal setting for this property? Any downsides to using it for this purpose?
(Edit: it appears that my problem may be caused by Windows cacheing of a file I've accessed before through Indy. I'm using fIDHTTP.Request.CacheControl := 'no-cache'; is that adequate?