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?
I'm creating a WPF application that uses a custom object to populate all the controls. The constructor of that object is initiated by an EventHandler that waits for an API. The problem I'm having is when I try to access any information from that object using a button for example, it returns an error saying "The calling thread cannot access this object because a different thread owns it". I'm assuming this is because the EventHandler creates a new thread which doesn't allow the MainThread to have access to it. Any ideas on how to get around this?
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
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?
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 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!
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
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 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!
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!
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?
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?
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.
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?
I understand that this is highly specific to the concrete application, but I'm just wondering what's the general opinion, or at least some personal experiences on the issue.
I have an aversion towards the 'open session in view' pattern, so to avoid it, I'm thinking about simply fetching everything small eagerly, and using queries in the service layer to fetch larger stuff.
Has anyone used this and regretted it? And is there maybe some elegant solution to lazy loading in the view layer that I'm not aware of?
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
});
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?
I'm new to Rails and feeling my way, but this has me stumped.
I moved some constants to a separate module ie:
module Fns
Fclick = "function() { alert(\"You clicked the map.\");}\n"
...
end
then in my controller added:
require "fns"
class GeomapController < ApplicationController
def index
fstring = Fns::Fclick
...
end
but when I run the server I get:
uninitialized constant Fns::Fclick
what am I missing?
I'm having a problem with a Delphi Pro 6 application that I wrote on my Windows XP machine when it runs on Windows 7. I don't have Windows 7 to test yet and I'm trying to see if Windows 7 might be the source of the trouble. Is there a fundamental difference between the way Windows 7 handles threads compared to Windows XP? I am seeing things happen out of sequence in my error logs on Windows 7 and it's causing problems. For example, objects that should have been initialized are uninitialized when running on Windows 7, yet those objects are initialized on Windows XP by the time they are needed.
Some questions:
1) Are there any core differences that could cause threads/processes to behave differently between the two operating system versions?
2) I know this next question may seem absurd, but does Windows 7 attempt to split/fork threads that aren't split/forked on Windows XP?
3) And lastly, are there any known issues with FPU handling that can cause XP programs trouble when run on Windows 7 due to operational differences in wait state handling or register storage, or perhaps something like Exception mask settings, etc?
4) Any 32-bit versus 64-bit issues that could be creating trouble here?
-- roschler
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
say ive got a matrix that looks like:
[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
how can i make it on seperate lines:
[[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]]
and then remove commas etc:
0 0 0 0 0
And also to make it blank instead of 0's, so that numbers can be put in later, so in the end it will be like:
_ 1 2 _ 1 _ 1
(spaces not underscores)
thanks
I have a class which calls getaddrinfo for DNS look ups. During testing I want to simulate various error conditions involving this system call. What's the recommended method for mocking system calls like this? I'm using Boost.Test for my unit testing.
Recently I have noticed a number of questions on SO that look something like this:
I am writing a small program to keep a
list of the songs that I keep on my
ipod. I'm thinking about writing it
as a 3-tier MVC Ruby on Rails web
application with TDD, DDD and IOC,
using a factory pattern to create the
classes and a singleton to store my
application settings. Do you think
I'm taking the right approach?
Do you think that we're handing novice programmers a very sharp knife and telling them, "Don't cut yourself with this"?
NOTE: Despite the humorous tone, this is a serious (and programming-related) question.
Do you use a global, catchall namespace for all of your extension methods, or do you put the extension methods in the same namespace as the class(es) they extend?
Or do you use some other method, like an application or library-specific namespace?
EDIT: I ask because I have a need to extend System.Security.Principal.IIdentity, and putting the extension method in the System.Security.Principal namespace seems to make sense, but I've never seen it done this way.