I am using Eclipse 3.4. I want to be able to put a breakpoint in a line of code that's in a jar for which I dont have the source code and no source code is available. How can I do this?
Hi,
There is a table Item like,
code,name
01,parent1
02,parent2
0101,child11
0102,child12
0201,child21
0202,child22
Create a java object and hbm xml to map the table.The Item.parent is a Item whose code is equal to the first two character of its code :
class Item{
string code;
string name;
Item parent;
List<Item> children;
.... setter/getter....
}
<hibernate-mapping>
<class name="Item" table="Item">
<id name="code" length="4" type="string">
<generator class="assigned" />
</id>
<property name="name" column="name" length="50" not-null="true" />
<!--====================================== -->
<many-to-one name="parent" class="Item" not-found="ignore"></many-to-one>
<bag name="children"></bag>
<!--====================================== -->
</class>
</hibernate-mapping>
How to definition the mapping relationship?
Thanks!
Some .net-framework interfaces and attributes become obsolete and deprecated since new framework version appears. I am warned that such code may be removed or become unpredictable in next versions but have you ever faced the situation when you were forced to refactor code because code came uncompilable or start to behave weird? What was you biggest refactoring?
Or maybe Microsoft always continued to support api's once they were published?
Thank you in advance!
I'm writing some terrible, terrible code, and I need a way to put a free() in the middle of a statement. The actual code is:
int main(){
return printf("%s", isPalindrome(fgets(malloc(1000), 1000, stdin))?"Yes!\n":"No!\n") >= 0;
// leak 1000 bytes of memory
}
I was using alloca(), but I can't be sure that will actually work on my target computer. My problem is that free returns void, so my code has this error message:
error: void value not ignored as it ought to be
The obvious idea I had was:
int myfree(char *p){
free(p);
return 0;
}
Which is nice in that it makes the code even more unreadable, but I'd prefer not to add another function.
I also briefly tried treating free() as a function pointer, but I don't know if that would work, and I don't know enough about C to do it properly.
Note: I know this is a terrible idea. Don't try this at home kids.
I've found this strange behavior with VS2005 C++ compiler. Here is the situation:
I cannot publish the code, but situation is very simple.
Here is initial code: it work perfectly
class Foo {
public:
Foo(Bar &bar) { ... }
}
The constructor implementation stores a reference, setup some members... indeed nothing special.
If I change the code in the following way:
class Foo {
public:
Foo(const Bar &bar) { ... }
}
I've added a const qualifier to the only constructor routine parameter.
It compiles correctly, but the compiler outputs a warning saying that the routine Foo::Foo will cause a stackoverflow (even if the execution path doesn't construct any object Foo); effectively this happens.
So, why the code without the const parameter works perfectly, while the one with the const qualifier causes a stackoverflow? What can cause this strange behavior?
After reading many introductions, starting guides, and documentation on SVN, I still cannot figure out where is my versioning data stored. I mean physically. I have over 3 GB of code checked in, and the repo is just a few MB large. This is still Voodoo for me. And, as a coder, I don't really believe in Magic.
EDIT :
A contributor stated that not all the code was stored in the repo, is that true ? I mean, if I delete my local working copy I still can get back my source code for the repository...
If so, I still can't understand how such a compression can occur on my code...
I was looking over some code the other day and I came across:
static {
...
}
Coming from C++, I had no idea why that was there. Its not an error because the code compiled fine. What is this "static" block of code?
So, I previously asked this question:
http://stackoverflow.com/questions/2820234/can-someone-help-me-compare-using-f-over-c-in-this-specific-example-ip-address
I was looking at the posted code and I was wondering if this code could be written without it producing a warning:
let [|a;b;c;d|] = s.Split [|'.'|]
IP(parseOrParts a, parseOrParts b, parseOrParts c, parseOrParts d)
Is it possible to do something for the match _ pattern ot ignore? Without adding in something like Active Patterns? i want to keep the code as simple as possible... can I do this without drastically changing this code?
NOTE: Warning is as follows
Warning Incomplete pattern matches on this expression. For example, the value '[|_; _; _; _; _|]' may indicate a case not covered by the pattern(s).
I have a a user control which contains sevral other user controls. I am using MVVM. Each user control has a corresponding VM. How do these user controls send information to each other. I want to avoid writing any code in the xaml code behind. Particularly I am interested in how the controls (inside the main user control) will talk to each other and how will they talk to the container user control.
EDIT:
I know that using events-delegates will help me solve this issue. But, I want to avoid writing any code in xaml code-behind.
Hallo,
first I want to say that I hope this doesn't look like I am lazy but I have some trouble understanding a piece of code from the following project.
http://kigg.codeplex.com/
I was going through the source code and I noticed something that would be usefull for my own little project I am making. In their BaseController they have the following code:
private static readonly Type CurrentUserKey = typeof(IUser);
public IUser CurrentUser
{
get
{
if (!string.IsNullOrEmpty(CurrentUserName))
{
IUser user = HttpContext.Items[CurrentUserKey] as IUser;
if (user == null)
{
user = AccountRepository.FindByClaim(CurrentUserName);
if (user != null)
{
HttpContext.Items[CurrentUserKey] = user;
}
}
return user;
}
return null;
}
}
This isn't an exact copy of the code I adjusted it a little to my needs. This part of the code I still understand. They store their IUser in HttpContext.Items. I guess they do it so that they don't have to call the database eachtime they need the User object.
The part that I don't understand is how they maintain this object in between requests. If I understand correctly the HttpContext.Items is a per request cache storage.
So after some more digging I found the following code.
internal static IDictionary<UnityPerWebRequestLifetimeManager, object> GetInstances(HttpContextBase httpContext)
{
IDictionary<UnityPerWebRequestLifetimeManager, object> instances;
if (httpContext.Items.Contains(Key))
{
instances = (IDictionary<UnityPerWebRequestLifetimeManager, object>) httpContext.Items[Key];
}
else
{
lock (httpContext.Items)
{
if (httpContext.Items.Contains(Key))
{
instances = (IDictionary<UnityPerWebRequestLifetimeManager, object>) httpContext.Items[Key];
}
else
{
instances = new Dictionary<UnityPerWebRequestLifetimeManager, object>();
httpContext.Items.Add(Key, instances);
}
}
}
return instances;
}
This is the part where some magic happens that I don't understand. I think they use Unity to do some dependency injection on each request? In my project I am using Ninject and I am wondering how I can get the same result.
I guess InRequestScope in Ninject is the same as UnityPerWebRequestLifetimeManager? I am also wondering which class/method they are binding to which interface? Since the HttpContext.Items get destroyed each request how do they prevent losing their user object?
Anyway it's kinda a long question so I am gradefull for any push in the right direction.
Kind regards,
Pickels
Hey Guys,
Im starting with a csv varible of column names. This is then exploded into an array, then counted and tossed into a for loop that is supposed to create another array.
Every time I run it, it goes into this endless loop that just hammers away at my browser...until it dies. :(
Here is the code..
$columns = 'id, name, phone, blood_type';
<code>
$column_array = explode(',',$columns);
$column_length = count($column_array);
//loop through the column length, create post vars and set default
for($i = 0; $i <= $column_length; $i++)
{
//create the array iSortCol_1 => $column_array[1]...
$array[] = 'iSortCol_'.$i = $column_array[0];
}
</code>
What I would like to get out of all this is a new array that looks like so..
<code>
$goal = array(
"iSortCol_1" => "id",
"iSortCol_2" => "name",
"iSortCol_3" => "phone",
"iSortCol_4" => "blood_type"
);
</code>
What is machine learning ?
What does machine learning code do ?
When we say that the machine learns, does it modify the code of itself or it modifies history (database) which will contain the experience of code for given set of inputs?
Has anyone seen an editor/IDE that shows WYSIWYG comments inside the code? I have seen some that show the docs of an element in a separated tab/windows, but not together with code. For example, a JavaDoc comment would be much clearer and easier to edit if it had no tags and could be edited like a snippet from a normal text document.
/**
* Writes <code>Hello world!</code> to the <b>standard output</b>.
* @seealso showGoodbye
*/
public static void showHello() {
Could be something like this:
/*
Writes Hello world! to the standard output.
See also: showGoodbye()
*/
public static void showHello() {
but, editable, of course.
And for anyone who happens to have some knowledge/experience with open IDEs like Eclipse, Netbeans, etc.: would it be too hard to implement this?
I am helping someone with some software they are selling. I am contributing code for free.
The code that I wrote uses open source licenses and i have included them with the source code.
Which software license can i put my code under? I would like to totally give the software to them for free.
Please ask questions if there are issues O_o.
Update: The library which is included is under Apache License, Version 2.0. Sorry for not including before.
I have some projects which I have ceased their development a long time ago but still get code access requests for. I'm currently providing zipped packages from my personal web site. I think zipped packages are far from being useful (e.g. can't read code right away, can't provide url's to individual source files, can't fork easily, lifetime is dependent on my own web page's).
I want that archaic code to be present on the net regardless I keep my web page up or not. I saw the question "What's the best open source hosting site?". However, most sites request the project "to be active", Codeplex for instance. I didn't go through EULA's of all providers to see if they allow abandoned projects.
Are there elephant's graveyards for old code without activity restrictions? Which one would you pick, why?
Hi,
I want to mix audio files of different size into a one single .wav file.
There is a sample through which we can mix files of same size
[(http://www.modejong.com/iOS/#ex4 )(Example 4)].
I modified the code to get the mixed file as a .wav file.
But I am not able to understand that how to modify this code for unequal sized files.
If someone can help me out with some code snippet,i'll be really thankful.
I need some help to understand how this code was obfuscated. The code is:
<a id="suggest" href="#" ajaxify="/ajax/social_graph/invite_dialog.php?class=FanManager&node_id=108463912505356" class=" profile_action actionspro_a" rel="dialog-post">Suggest to Friends</a>
And the obfuscation is:
\x3c\x61\x20\x69\x64\x3d\x22\x73\x75\x67\x67\x65\x73\x74\x22\x20\x68\x72\x65\x66\x3d\x22\x23\x22\x20\x61\x6a\x61\x78\x69\x66\x79\x3d\x22\x2f\x61\x6a\x61\x78\x2f\x73\x6f\x63\x69\x61\x6c\x5f\x67\x72\x61\x70\x68\x2f\x69\x6e\x76\x69\x74\x65\x5f\x64\x69\x61\x6c\x6f\x67\x2e\x70\x68\x70\x3f\x63\x6c\x61\x73\x73\x3d\x46\x61\x6e\x4d\x61\x6e\x61\x67\x65\x72\x26\x61\x6d\x70\x3b\x6e\x6f\x64\x65\x5f\x69\x64\x3d\x31\x30\x38\x34\x36\x33\x39\x31\x32\x35\x30\x35\x33\x35\x36\x22\x20\x63\x6c\x61\x73\x73\x3d\x22\x20\x70\x72\x6f\x66\x69\x6c\x65\x5f\x61\x63\x74\x69\x6f\x6e\x20\x61\x63\x74\x69\x6f\x6e\x73\x70\x72\x6f\x5f\x61\x22\x20\x72\x65\x6c\x3d\x22\x64\x69\x61\x6c\x6f\x67\x2d\x70\x6f\x73\x74\x22\x3e\x53\x75\x67\x67\x65\x73\x74\x20\x74\x6f\x20\x46\x72\x69\x65\x6e\x64\x73\x3c\x2f\x61\x3e","\x73\x75\x67\x67\x65\x73\x74
Now I used unescape on the above obfuscated code to read it. What I want to know is what exactly was used to obfuscate the code like that? Basically, I need to customize the readable code to the same obfuscation.
Any help would be greatly appreciated.
I was just wondering, what could possibly be the largest amout of code possible to write a Hello, World! program, without repeating code, without any whitespace, as few newlines as possible, whitout code that doesn't need to be there, and not written in 'Shakespeare'?
Programming language doesn't matter ^^
HI,
I am running a few modules of vba
code, when in the middle the code
crashes as access reaches its max size
of 2gb. But if i compress the database
at that point it is only 200 mb so is
it possible to compress the database
at regular intervals while the code is
running .
thanks
tksy
Has any one got a working code sample for mpoauthconnection.
I had checkout source from code.google.com/p/mpoauthconnectio.
But selecting MPAouthTestApp gives the following error.
target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphonesimulator' platform
Please help me to solve the error or can anyone provide me with a sample working code for mpoauthconnection.
My email id is [email protected]
I am new to eclipse and wanted to do the following;-
1) how to use my custom build commands with eclipse. Till now I only saw make all?I use a shell script for building my project, how can I use that in eclipse environment.
2) When I create a new project with the existing source code, it doesn't add the files, without building the code and if code fails to build (because I generally don't have make all). How to resolve this issue
I'm writing a login form, and it converts the given password to an MD5 hash with md5($password), then matches it to an already-hashed record in my database. I know for sure that the database record is correct in this case. However, it doesn't log me in and claims the password is incorrect.
Here's my code:
$password = mysql_real_escape_string($_POST["password"]);
...more code...
$passwordQuery = mysql_fetch_row(mysql_query(("SELECT password FROM users WHERE email = '$userEmail'")));
...some code...
elseif(md5($password) != $passwordQuery)
{
$_SESSION["noPass"] = "That password is incorrect.";
}
...more code after...
I tried pulling just the value of md5($password) and that matched up when I visually compared it. However, I can't get the comparison to work in PHP. Perhaps it is because the MySQL record is stored as text, and the MD5 is something else?
Hello friends,
I am using blackberry using java eclips
I have a lengthy of code in single class.so I need to divide code into different classess(need to implement methode in diffferent classes), how to write code in diff classes and how to access diiferent classes methodes in a single class. Can you please give me suggesion.
I'm doing programming of a softcore processor, Nios II from Altera, below is the code in one of the tutorial, I manage to get the code working by testing it on the hardware (DE2 board), however, I could not understand the code.
#define Switches (volatile char *) 0x0003000
#define LEDs (char *) 0x0003010
void main()
{ while (1)
*LEDs = *Switches;
}
What I know about #define is that, it is either used to define a constant, or a macro, but
why in the above code, there are casting like, (char *) 0x0003010, in #define?
why the 2 constants, Switches and LEDs act like a variable instead of a constant?
Thanks in advance !
I have a large Flex project with two Applications in it. A lot of code is shared between these Applications. However, the smaller of the Applications does not require much of the code that the larger one does. I'm trying to ensure that code that isn't required by the smaller application isn't getting compiled into it.
Is there an easy way for me to determine which files within my project are being compiled into a particular Application?