Wednesday, April 18, 2012

listen to the Internet Explorer download event

I need to write an application in C# and VS2010 that can listen to the download event from Internet Explorer and capture the file URL to add it to a certain database.



My only problem is on how to implement an interface that actually captures that event.



What would I need in order to build or implement such functionality?



Looking for functionality as the "Free download manager or FDM software", each time you start a download on Internet Explorer, a "FDM" window pops up containing the URL of the download.





Python Base64 string shorter than Botan Base64 string

I've managed to get AES/Rijndael [256bit key / 128bit block size] symmetric encryption working: encrypt with pycrypto and decrypting with Botan in C++.



However, when I try to base64 encode the encryption result in python, the resulting string is shorter than the same string generated by Botan using a Base64_Encoder. Example:



Botan Base64:




zjjxmJf5KPs183I/EvC+JuNbOdmbm4bWyhLsdZI8fuVUnKQAeSj0ivmKIYu7HBjM7gLgLV+xtSKcsCeQD7Gy4w==




Py-3k Base64:




zjjxmJf5KPs183I/EvC+JuNbOdmbm4bWyhLsdZI8fuVUnKQAeSj0ivmKIYu7HBjM




You can see that the strings are exactly the same up until the 64 character mark. If I try to decrypt the Python base64 string in Botan it complains about "not enough input".



How do I get the Python base64 string to be acceptable by Botan?



-- EDIT --
When decoding the Botan base64 encoded string in Python:



Botan Decoded:[b'\xce8\xf1\x98\x97\xf9(\xfb5\xf3r?\x12\xf0\xbe&\xe3[9\xd9\x9b\x9b\x86\xd6\xca\x12\xecu\x92<~\xe5T\x9c\xa4\x00y(\xf4\x8a\xf9\x8a!\x8b\xbb\x1c\x18\xcc\xee\x02\xe0-_\xb1\xb5"\x9c\xb0\'\x90\x0f\xb1\xb2\xe3']
Botan Encoded:[b'zjjxmJf5KPs183I/EvC+JuNbOdmbm4bWyhLsdZI8fuVUnKQAeSj0ivmKIYu7HBjM7gLgLV+xtSKcsCeQD7Gy4w==']


Thus, the Python pycrypto result:



Encryption result: b'\xce8\xf1\x98\x97\xf9(\xfb5\xf3r?\x12\xf0\xbe&\xe3[9\xd9\x9b\x9b\x86\xd6\xca\x12\xecu\x92<~\xe5T\x9c\xa4\x00y(\xf4\x8a\xf9\x8a!\x8b\xbb\x1c\x18\xcc'

Base64 encoded: b'zjjxmJf5KPs183I/EvC+JuNbOdmbm4bWyhLsdZI8fuVUnKQAeSj0ivmKIYu7HBjM


Python seems to be "omitting" something. But what?



-- EDIT 2 --



When I try to base64decode & decrypt the pycrypto result, Botan throws this:



Botan exception caught: Buffered_Operation::final - not enough input


So pycrypto is not producing "enough" output such that it can be decrypted by Botan.



-- EDIT 3 ---
Code examples:



Python: changed sensitive info.



import sys
import base64
import binascii
from Crypto.Cipher import AES

plaintext = "097807897-340284-083-08-8034-0843324890098324948"

hex_key = b'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
key = binascii.unhexlify( hex_key )
hex_iv = b'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
iv = binascii.unhexlify( hex_iv )

aes_enc_bytes = AES.new(key, AES.MODE_CBC, iv).encrypt( plaintext )
aes_enc = base64.encodebytes(aes_enc_bytes )

print( "Encrypted:[{}]".format( aes_enc ) )

aes_dec = AES.new(key, AES.MODE_CBC, iv).decrypt( binascii.a2b_base64( aes_enc ) )
print( "Decrypted:[{}]".format( aes_dec ) )


C++ (Qt + Botan)



void botanDecryptor::decrypt()
{
Botan::SymmetricKey key( private_key );
Botan::InitializationVector iv( iv_value );
try
{
// Now decrypt...
Botan::Pipe dec_pipe(new Base64_Decoder, get_cipher("AES-256/CBC", key, iv, Botan::DECRYPTION));

dec_pipe.process_msg( ciphertext );

string decrypted = dec_pipe.read_all_as_string();

cout << "Decrypted:[" << decrypted << "]" << endl;
}
catch(Botan::Exception& e)
{
cout << "Botan exception caught: " << e.what() << endl;
return;
}


-- EDIT 4 --



I decided to try and decrypt the Botan encrypted, base64 encoded string in python and it worked, but it added a bunch of what looks like padding:



Decrypted:[b'097807897-340284-083-08-8034-0843324890098324948\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10']


I then proceeded to add that padding to my pycrypto result before base64 encoding to produce the following, which Botan refuses to decrypt ;(



zjjxmJf5KPs183I/EvC+JuNbOdmbm4bWyhLsdZI8fuVUnKQAeSj0ivmKIYu7HBjMEBAQEBAQEBAQ\nEBAQEBAQEA==


-- ANSWER --
(system wouldn't allow me to self answer for another 5 hours!)



I've finally schlepped through all the documentation and found the answer! One needs to specify what padding method is to be used for the mode. I specified NoPadding e.g.



Pipe dec_pipe(new Base64_Decoder, get_cipher("AES-256/CBC/NoPadding", key, iv, Botan::DECRYPTION));


and viola! The output matches the pycrypto exactly. For reference: [http://botan.randombit.net/filters.html][1]



[1]: Botan Docs: Cipher Filters





Perl to Pseudocode

So i'm trying to re-write a code in python (Im an undergrad and they need their perl code rewritten for python) and I have VERY limitted knowledge of Perl.
I've tried digging around and haven't really found much. So far I've worked parts of teh psuedocode.



Perl:



($colour =~ /^\\#/)


Psuedo:



The Variable Colour does not Equal... 


My problem is the last section, /^\\#/ would anyone be able to tell me what this means?
I have checked its not a variable used in the code. If its any help the code was designed to interact with GIMP.



Please and thankyou :)





toast message android

I am trying to pop up a toast message as long as the phone rings and destroy the toast them the call is rejected or answered.



In the OnReceive method I have something like this:



Bundle bundle=intent.getExtras();
final String state=bundle.getString(TelephonyManager.EXTRA_STATE);

if (state.equalsIgnoreCase(TelephonyManager.EXTRA_STATE_RINGING))
{
Toast toast= new Toast(context);
toast.show();

new CountDownTimer(3500,1000)
{

@Override
public void onFinish()
{
if (state.equalsIgnoreCase(TelephonyManager.EXTRA_STATE_IDLE)||
(state.equalsIgnoreCase(TelephonyManager.EXTRA_STATE_OFFHOOK))
{
toast.cancel();
}
else
{
toast.setDuration(Toast.LENGTH_LONG);
toast.show();
start();
}
}


The problem is that even after the call is hanged up the toast message keeps poping up. It's like the state is never in the HANG_UP or IDLE Mode.



What did I do wrong?





using either checkbox or textbox for an enum type

if I have this structure:



public class Parent
{
public string Name{get; set;}
public List<Child> Childs {get; set;}
}

public class Child
{
public string Name{get; set;}
public string Value{get; set;}
public enum ValueType {get; set;}
}

public enum ValueType
{
Int,
Boolean,
String
};

public class ParentFactory
{
public List<Parent> Parents {get; set;}

public ParentFactory()
{
Child child1 = new Child() {Name="Filter1", Value="1", ValueType=ValueType.String};
Child child2 = new Child() {Name="isExecuted", Value="true", ValueType=ValueType.Boolean};
Child child3 = new Child() {Name="Width", Value="10", ValueType=ValueType.Int};

Parent parent1 = new Parent(){Name="Adam", Childs = new List<Child>(){child1, child2}};
Parent parent2 = new Parent(){Name="Kevin", Childs = new List<Child>(){child3}};

Parents = new List<Parent>(){parent1, parent2};
}
}


I want to bind the object: ParentFactory parentFactory = new ParentFactory(); to ItemsControl:



<DockPanel>
<ItemsControl ItemsSource="{Binding Parents}">
</ItemsControl>
</DockPanel>

<Window.Resources>
<DataTemplate DataType="{x:Type Parent}">
<StackPanel Margin="2,2,2,1">
<Expander Header="{Binding Name}">
<ItemsControl ItemsSource="{Binding Childs}" />
</Expander>
</StackPanel>
</DataTemplate>
<DataTemplate DataType="{x:Type Child}">
<StackPanel>
<TextBox Grid.Column="0" Text="{Binding Name}" />
<TextBox Grid.Column="1" Text="{Binding Value}"/>
<TextBox Grid.Column="2" Text="{Binding ValueType}"/>
</StackPanel>
</DataTemplate>
</Window.Resources>


In the Stackpanel, there are one control: TextBox. However, I want it to be more dynamic: if the ValueType is a Boolean then use a Checkbox and else use a Textbox for the: .



Would it be possible? and if yes, how can I achieve them. could you please provide some code samples?





Implementation of long list selector in wp7

Is it necessary to use Grouping class for long list selector? In my application i am using a simple list control for holding a large amount of data. Now i feel some performance issues (memory and loading) issues with the ordinary list. So i decided to change my list to long list selector. My doubt is that is it possible to use same Item template and item source for implementing long list. In an example i found a grouping class. Does this grouping is necessary?? If no is the answer how i can implement this with my existing data. Thanks in advance .





jquery timeout-function never called on mouseenter mouseleave

I'm having a little problem with the setTimeout-function.



$(this) is every DOM-Element with a specific class.



When the mouse enters an elememt, and then leave it, there is no problem. But when the mouse leaves an element directly to another (within the 500ms timeout) the first element (that one, the mouse left from) never fades out.



So the new mouseenter-Event kind of prevent the timeOut to call the function.
Without the setTimeout-wrapper everything is just working fine.



Here's my code:



$(this).hover(methods['mouseenterManager'], methods['mouseleaveManager']);


/**
* manage mouseenter events
*/
mouseenterManager: function() {

clearTimeout(timer);

//create toolbar, if no toolbar is in dom
if ($(this).data("layouter").toolbar == undefined) {

//get bottom center of this element
pos_left = ($(this).width() / 2) + $(this).offset().left;
pos_top = $(this).height() + $(this).offset().top;

//create toolbar element
toolbar = $('<div style="display:none; left:' + parseInt(pos_left) + 'px; top:' + parseInt(pos_top) + 'px;" class="layouter_bar"><ul><li><a class="edit" href="javascript:;">Edit</a></li><li><a class="copy" href="javascript:;">Edit</a></li><li><a class="remove" href="javascript:;">Edit</a></li></ul></div>');

//bind this element to toolbar
toolbar.data("layouter", {
parent: $(this),
});

//bind toolbar to this element
data = $(this).data("layouter");
data.toolbar = toolbar;
$(this).data("layouter", data);

//bind this element to toolbar
data = toolbar.data("layouter");
data.parent = $(this);
toolbar.data("layouter", data);

element = $(this);
toolbar.mouseleave(function() {

toolbar = $(this);
timer = setTimeout(function() {
if (!toolbar.is(":hover") && !element.is(":hover")) {

toolbar.fadeOut("fast", function() {
$(this).remove();
});

data = element.data("layouter");
data.toolbar = undefined;
element.data("layouter", data);
}
}, 500);
});

//display the toolbar
$("body").append(toolbar);
toolbar.fadeIn("fast");
}
},


/**
* manage mouseleave events
*/
mouseleaveManager: function() {

toolbar = $(this).data("layouter").toolbar;
element = $(this);
if (toolbar != undefined) {
timer = setTimeout(function() {
if (!toolbar.is(":hover")) {

toolbar.fadeOut("fast", function() {
$(this).remove();
});

data = element.data("layouter");
data.toolbar = undefined;
element.data("layouter", data);
}
}, 500);
}
},

};?


Any ideas?



thank you!





What's the use case for __new__ method to return an object of a different type than its first arg?

The documentation implies that it's ok for __new__(cls, ...) to return an object of a type different than cls. It says in that case __init__() won't be called. It's not stated explicitly, but common sense or a simple test confirms that the resulting the object won't have type cls.



Why is this seemingly strange behavior allowed? What's the use case? It's clearly intentional.





Facebook App to Redirect to an external website

I am trying to get an App to redirect to an external website. I have found a company who has done it (See image). If you type in their name "Safarinow" the first result comes up which is an App. When you click the app you get redirected to "http://www.safarinow.com".



Would anyone know how to achieve this?



p.s. I am not actually a developer but rather a Social media manager so I have a limited understanding of coding etc. I have just been asked to find out how to do this for the lazy dev team.



Thanks in advance





checkout only a sub-folder in android source

I have downloaded the android sourcs from:
repo init -u http://android.git.kernel.org/platform/manifest.git -b android-4.0.1_r1



I had compiled the sources and changed sources under the external directory.



How do I sync uo my sources so that it is still the same as original sources of android-4.0.1_r1 but also without osing the compiled binaries?



Thanks





How to read and understand a monster exception (for example this one)

We are currently facing the problem that somewhere in our application a monstrous exception is generated. Since we are using Grails and the Spring Framework, the Exception is thrown somewhere in there.



There seems to be some endless loop, and the Exception Stack is getting longer and longer, everytime it is thrown again. I have no clue what in our code could have caused this, and I assume that it is just one of the usual misconfigurations or small errors, that sometimes make Grails fail dramatically.



I will try to outline the major parts of the exception here, but since a thrown exception uses 2 GB in the log, i can only show parts. Even vi is having trouble opening it, and it seems to be thrown until the Hard Disk memory is full.



First Line




2012-04-17 23:52:34,325 [http-8080-9] ERROR errors.GrailsExceptionResolver -
Unable to render errors view: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
[...]
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: Servlet execution threw an exception


:q:q!:q!Block that seems to repeat:




at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:99)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
at org.codehaus.groovy.grails.plugins.springsecurity.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:40)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.codehaus.groovy.grails.plugins.springsecurity.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:57)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:109)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:298)
at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:264)
at org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver.resolveException(GrailsExceptionResolver.java:120)
at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:987)
at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:319)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:99)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
at org.codehaus.groovy.grails.plugins.springsecurity.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:40)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.codehaus.groovy.grails.plugins.springsecurity.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:57)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:109)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:298)
at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:264)
at org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver.resolveException(GrailsExceptionResolver.java:120)
at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:987)
at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:319)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:99)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
at org.codehaus.groovy.grails.plugins.springsecurity.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:40)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.codehaus.groovy.grails.plugins.springsecurity.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:79)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:57)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:109)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:298)
at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:264)
at org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver.resolveException(GrailsExceptionResolver.java:120)
at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:987)
at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:319)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
[...]


Any clues? Or should I just check the errors view again?





Unable to compile Android hello world on Netbeans

This is my very first post on this extremely helpful site!



After 30 minutes of Googling and discovering the very helpful automated search function as you type your question's name, I figured it's time I finally made an account and ask!



Alright, this is the first time I'm getting my hands dirty, and I saw hit with an error straight in my face, in the form of:



I understand some coding concepts, however I'm still extremely new and I'd like to learn what's causing this to happen from the helpful people on this site, thanks!



clean:
Deleting directory C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin
Deleting directory C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\gen
Creating output directories if needed...
Created dir: C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin
Created dir: C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin\res
Gathering info for AndroidApplication1...
Android SDK Tools Revision 19
Project Target: Google APIs
Vendor: Google Inc.
Platform Version: 2.3.3
API level: 10
------------------
Resolving library dependencies:
No library dependencies.

------------------
API<=15: Adding annotations.jar to the classpath.

------------------
WARNING: No minSdkVersion value set. Application will install on all Android versions.
Created dir: C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\gen
Created dir: C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin\classes
----------
Handling aidl files...
No AIDL files to compile.
----------
Handling RenderScript files...
No RenderScript files to compile.
----------
Handling Resources...
Generating resource IDs...
----------
Handling BuildConfig class...
Generating BuildConfig class.
Compiling 3 source files to C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin\classes
Converting compiled files and external libraries into C:\Users\User\Documents\NetBeansProjects\AndroidApplication1\bin\classes.dex...
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Error occurred during initialization of VM
Could not reserve enough space for object heap
C:\Program Files\Android\android-sdk\tools\ant\build.xml:818: The following error occurred while executing this line:
C:\Program Files\Android\android-sdk\tools\ant\build.xml:820: The following error occurred while executing this line:
C:\Program Files\Android\android-sdk\tools\ant\build.xml:832: The following error occurred while executing this line:
C:\Program Files\Android\android-sdk\tools\ant\build.xml:278: null returned: 1
BUILD FAILED (total time: 3 seconds)




Custom Vector Template - Strings

I am attempting to read in a list of strings from the keyboard to a custom vector template that I wrote, however for some unknown reason, the program ALWAYS crashes after the second or third input when I attempt to write to or read the vector object.



Note: The entire point of the assignment is to write your own custom vector class and I am not allowed to use any feature provided by the C++ STL, such as arrays.



edit: Everything works without fault if I make it an int or char vector, but it needs to do all 3.



main.cpp



#include <iostream>
#include "myvector.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string.h>

using namespace std;

int main()
{
myvector<string> vec;

string tmp;

while(1) {
cin >> tmp;
if(tmp=="q"){
break;
}
vec.push_back(tmp);
}

cout << "You have entered " << vec.size() << " elements. These are:" << endl;

for(int i=0;i<vec.size();i++) {
cout << vec[i] << endl;
}

return 0;
}


myvector.h



#ifndef MYVECTOR_H
#define MYVECTOR_H

#include <iostream>
#include <stdlib.h>
#include <string.h>

using namespace std;

template<class T>
class myvector
{
public:
myvector();
myvector(const myvector&);
~myvector();
void push_back(const T&);
int size();
T operator[](int);
myvector& operator=(const myvector&);
protected:
private:
int vsize,maxsize;
T* array;
void alloc_new();
};

template<class T>
myvector<T>::myvector()
{
maxsize=8;
array=(T *)malloc(maxsize*sizeof(T));

if (array == NULL) {
cout << "Memory failure";
}
vsize=0;
}

template<class T>
myvector<T>::myvector(const myvector& v)
{
maxsize=v.maxsize;
vsize=v.vsize;
array = (T *)malloc(maxsize*sizeof(T));
for(int i=0;i<v.vsize;i++) {
array[i]=v.array[i];
}
}

template<class T>
myvector<T>::~myvector()
{
free(array);
}

template<class T>
void myvector<T>::push_back(const T& i)
{
if(vsize>=maxsize) {
alloc_new();
}
array[vsize]=i; //CRASHES KEEP HAPPENING HERE I THINK
vsize++;
}

template<class T>
T myvector<T>::operator[](int i)
{
return array[i];
}

template<class T>
void myvector<T>::alloc_new()
{
maxsize=vsize*2;
T* tmp=(T *)malloc(maxsize*sizeof(T));
for(int i=0;i<vsize;i++) {
tmp[i]=array[i];
}
free(array);
array=tmp;
}

template<class T>
int myvector<T>::size()
{
return vsize;
}

template<class T>
myvector<T>& myvector<T>::operator=(const myvector& v)
{
if(this!=&v) {
maxsize=v.maxsize;
vsize=v.vsize;
delete[] array;
array = (T *)malloc(maxsize*sizeof(T));
for(int i=0;i<v.vsize;i++) {
array[i]=v.array[i];
}
}
return *this;
}

Display a popover view from dynamic prototype cells

I'm developing an Ipad app with a custom split view. In the master view I have a tableViewController. I add items in this one with an add button in the navigation bar. This button is linked (i work with storyboard) with a popover segue to an other tableViewController that contains a few cells to enter datas. A button "save" dismiss the popover view an add item in the list of the masterView. What I want to do next is link master view's prototype cells to an other view to enable the user to edit the selected item. I want to link this view with a popover segue (just like with the add button) and there's where is the problème : I get an red issue from xcode : Couldn't compile connection: => anchorView => > .



This a sample of my code that works fine. I would like to do pretty the same when I tap on a cell for editing.



The masterSplitView table



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"assetCell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
// Configure the cell...
AssetModel *myAssetModel = [self.arrayAsset objectAtIndex:indexPath.row];
cell.textLabel.text = myAssetModel.name;
// cell.textLabel.text = @"test";

return cell;

}

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{

if([segue.identifier isEqualToString:@"addAssetSegue"]){
AddAssetTVC *addAssetTVC = segue.destinationViewController;
addAssetTVC.delegate = self;

UIStoryboardPopoverSegue* popoverSegue = (UIStoryboardPopoverSegue*)segue;
[addAssetTVC setPopoverController:[popoverSegue popoverController]];

}

}

- (void) theSaveButtonOnTheAddAssetTVCWasTapped:(AddAssetTVC *)controller{
[controller.navigationController popViewControllerAnimated:YES];
[self reloadCache];
[self.tableView reloadData];
[self viewDidLoad];
}


And the save method of the add view :



- (IBAction)save:(id)sender{
[popoverController dismissPopoverAnimated:YES];
NSLog(@"Telling the ADDASSET Delegate that Save was tapped on the AddAssetTVC");

{...unrevelant coredata methods}

[self.delegate theSaveButtonOnTheAddAssetTVCWasTapped:self];
}


Thanks you for reading,



Alexandre





How to restrict SharePoint 2007 from resolving the disabled AD users?

I have been working on Selective Content Migration using "SharePoint Content Deployment Wizard" from CodePlex for a particular SPList.



The migrated data is displayed in a Custom List in SP2007, in which 2 fields Preparers & Approvers (columns) are of "People & Group" data type. These two columns displays the "Name (with Presence)" of People & Group type and I am able to click the user names to open the user details for all active AD users.



How ever, some of the users are disabled in Active Directory and we are unable to populate them in SharePoint. Due to which, they are not visible in the mentioned columns. Is there a way to restrict SharePoint from resolving the inactive / disabled AD users and continue to display them in the Preparers & Approvers column?



Also what is the option to display their Name (like Sriram Bala) in a seperate column for those who are inactive in AD? Meaning, those who are disabled in AD, their name without hyper link alone should be displayed in another column say Preparer Name or something like that. I tried to use Single Line Text datatype to get the People & Group value, but it didn't work.



Please suggest the possible option to achieve this.



Thanks,
Sriram





IRepository vs ISession

I have some Repository. Work with them is realized through an interface IRepository.

In sample project HomeController constructor realized with ISession. When I wrote this:



public class TestingController : Controller
{
private ISession session;

public TestingController(ISession session)
{
this.session = session;
}
//Some code here with this.session
}


It working well. When I decided to use IRepository:



public class TestingController : Controller
{
private IRepository repository;

public TestingController(IRepository repository)
{
this.repository = repository;
}
//Some code here with this.repository
}


It doesn't work in this method of other class WindsorControllerFactory:



protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)
{
if (controllerType == null)
{
throw new HttpException(404, string.Format("The controller for path {0} culd not found!", requestContext.HttpContext.Request.Path));
}

return (IController)this.kernel.Resolve(controllerType);
}


I have exception




Can't create component 'MvcApplication1.Controllers.ResultsController' as it has dependencies to be satisfied.



'MvcApplication1.Controllers.ResultsController' is waiting for the
following dependencies:
- Service 'dal.Repository.IRepository' which was not registered.




How to solve it?



P.S. Assembly dal.Repository is working. If I write everywhere new dal.Repository.Repository() instead of this.repository - it working.





Handling large classes

I've recently begun coding in Java in the past few months. I have a Matrix class that's becoming much too bloated with a lot of methods. I also have a SquareMatrix class that extends Matrix, and reduces some of the bloat.



What I've found is that alot of the methods in the Matrix class are relevant to matrices in general. It has all the basics, like addMatrix(Matrix), multiplyMatrix(Matrix), multiplyMatrix(float), then more complex methods like getGaussian(Matrix) or getLUDecomposition(Matrix).



What are my options in reducing the number of lines in my class Matrix?
Is it normal for a class to become extremely large? I don't think so...
Is this something I should have considered early on and refactoring is difficult? Or are there simple solutions?



Thank you!






Edit: After reading a couple of responses, I'm considering doing the following:



Utility class Matrix contains all common/basic methods for a matrix



Delegation classes (Helper/sub):



*Helper Class*
getGaussian(..), getLUFactorization(..), ...



Subclasses
(extends Matrix)
SquareMatrix, LowerTriMatrix, UpperTriMatrix, ...



Delegation seems similar to defining multiple .cpp files with headers in C++.
More tips are still welcome.






Edit2: Also, I'd prefer to refactor by properly designing it, not quickfixes. I hope it helps down the road for future projects, not just this one.





jstree not building the tree

I am trying to build a tree from an xml file using jstree. I followed the documentation and looks like it is not working. Here is my code:



<html>
<head>
<title>Demo</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="C:\Users\jstree\jstree_pre1.0_fix_1\jquery.jstree.js"></script>
<Script Language="JavaScript">
$(function () {

$("#demo2").jstree({

"xml_data" : {

"ajax" : {

"url" : "books.xml"

},

"xsl" : "nest"

},

"plugins" : [ "themes", "xml_data" ]

});
});

</Script>

</head>
<body>

</body>






Adding elements to ExpandableListView only using XMLs

I want to develop few sample screens (without functionality). I dont want to use much java code for that, i want to use only XMLs (either Strings.xml or Androidxmlfiles). In my flow i have an ExpandableListView to which i have to add some text items. Any one please help me. thanks in advance.





Displaying results of many sql queries without writing PHP code?

Sorry if this question might sound stupid to you guys, but am total newbie to programming, apart from knowing SQL, the thing is i have been given a MYSQL database containing various information about kids diseases and a web interface written in php to create reports from the database that can be accessed via the interface. there are almost 25 different variables that need to be computed in the report, i have written sql queries to compute all these values, but i don't know anything about PHP, if i have all these queries isn't there a way for me to combine all these sql queries to be display results on a webpage and come up with this report without writing PHP code?



Thanks for your



again very sorry if this is too basic.





Efficient data structure for GUIDs

I am in search of a data structure which enables me to quickly (prefarably O(1)-quickly) determine if a given GUID is a member of a Collection of GUIDs or not.



My current approach is to use a TDictionary with 0 as values.



While this works quickly, it seems to be a waste to use a Hashmap to rehash a GUID, which is by defintion considered to be unique, and to have the Dictionary handle values which are unneeded.



There must be a better solution for this, but I can't find one. Can you?





Use rails helper methods in database text

Using Rails 3.1.1



I am creating a travel guide that typically consist of "articles". In these articles I write about each place. Each article is about 500 words long and is saved as the attribute article.content in the database.



Now, I would prefer to be able to use Rails helper methods (i.e. from application_helper) and "link_to" within these articles. I can't use <%= %> simply because Rails will just interpret this as text in the article.



The main reason for me wanting to do so is to use smart internal linking (routes) and helper methods.



To clarify further:



Article is a model which has an content attribute.



a = Article.first
z = Article.last
a.content = "This is a long article where I want to place a smart link to z by using <%= link_to 'z article', article_path(z) %> and use my helper method largify so that I can <%= largify('this text') %> but I can't. What should I do?"
a.save


Is there a smart way of solving this?





C# alternative to Thread.Suspend() method

Thread.Suspend() method is obsolete as you know. I want to suspend thread immidiately when button click event comes. I used Thread.Suspend() and it works perfect but everyone suggest that using Thread.Suspend() method is not a good method to suspend the task. I used a flag to suspend the task but every time when a button click event comes, i have to wait to exit from task. I used Thread.IsAlive flag to wait the thread to exit but this method freezes form.



void ButtonClickEvent(object sender, ButtonClickEventArgs e)
{
TheadExitFlag = false;

if(MyThread != null)
{
while(MyThread.IsAlive);
//MyThread.Suspend();
}
}

void MyTask(void)
{
while(TheadExitFlag)
{
// some process
Thread.Sleep(5000);
}
}


How can i suspend the thread immidiately?





onhover how to get the image width and height using jquery

I am displaying in my webpage a number of images within a div the div and images are created dynamically with a looping.



I need to get the width and height of the each image by using the jquery without using id like this



 document.getElementById('Image/div id');


because there will a lot of images dynamically created by the loop depend upon the conditions
so, is there any way to get the height and width of the image when user hover/click the image



I struck with this for a long and been here finally hopes i get a solution





Make Twisted server reload my new changes

How do I make my Twisted server detect and reload changes in a source file? I would like it to behave like Django runserver.



I have checked around on the net and I have seen something to do with the Twisted "rebuild" module but I can't see a nice example on how to use it.





How to check if a web service is up and running without using ping?

How can i check if a method in a web service is workign fine or not ? I cannot use ping. I still want to check any kind of method being invoked from the web service by the client. I know it is difficult to generalize but there should be some way. Please contribute your ideas. :)





jQuery Mobile: How to customize button

How do I change the <a data-role="button"> button's background to my image? Also how can I add my custom icons on top of a button at left side?





App page not redirecting in IE

I have a facebook app which is basically a job app. The job headline is linked up to a job details page. The page opens perfectly in firefox, chrome and IE for me. But, one of our clients have pointed out that the page doesn't opens up in IE. What could be the possible reasons for this issue? If the page is refreshed, the the page comes up fine. Please find the linked for a screenshot...



https://myparichay.in/myparichay/images/image.png





Auto Collapse ActionBar SearchView on Soft Keyboard close

I am currently using an ActionBar menu item to display a SearchView in the action bar. When the search menu item is expanded the soft keyboard is displayed which is what I want. Now, when the user presses the back button to close the soft keyboard, I would also like to collapse the SearchView in the action bar.



I have tried implementing the following listeners OnKeyListener and OnFocusChangeListener on the MenuItem and the ActionView. I have also tried using OnBackPressed() in the Activity. None of the above detect when the back button is used to close the soft keyboard.



Any ideas?



I have implemented OnActionExpandListener to know when the SearchView is visible.





jQuery draggable table elements

jQuery's draggable functionality doesn't seem to work on tables (in FF3 or Safari). It's kind of difficult to envision how this would work, so it's not really surprising that it doesn't.



<html>
<style type='text/css'>
div.table { display: table; }
div.row { display: table-row; }
div.cell { display: table-cell; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://dev.jquery.com/view/tags/ui/latest/ui/ui.core.js"></script>
<script src="http://dev.jquery.com/view/tags/ui/latest/ui/ui.draggable.js"></script>
<script>
$(document).ready(function(){
$(".row").draggable();
});
</script>
<body>
<div class='table'>
<div class='row'>
<div class='cell'>Foo</div>
<div class='cell'>Bar</div>
</div>
<div class='row'>
<div class='cell'>Spam</div>
<div class='cell'>Eggs</div>
</div>
</div>
<table>
<tr class'row'><td>Foo</td><td>Bar</td></tr>
<tr class='row'><td>Spam</td><td>Eggs</td></tr>
</table>
</body>
</html>


I'm was wondering a) if there's any specific reason why this doesn't work (from a w3c/HTML spec perspective) and b) what the right way to go about getting draggable table rows is.



I like real tables because of the border collapsing and row height algorithm -- any alternative that can do those things would work fine.