Wednesday, May 16, 2012

Javascript How to call a function when we choose Stay on Page in Chrome

Please check my code in Chrome Browser, if you hit refresh you will be prompted with 2 options.





  1. Leave This Page and

  2. Stay on This Page




When I click the 2. Stay on this page button it must activate my custom function displayMsg()



Can any one provide me solution?



<script type="text/javascript">
function displayMsg() {
alert('my text..');
}
</script>
<script type="text/javascript">
window.onbeforeunload = function(evt) {
var message = 'Please Stay on this page and we will show you a secret text.';
if (typeof evt == 'undefined') {
evt = window.event;
}
if (evt) {
evt.returnValue = message;
return message;
}
trace(evt);
}
</script>




Simple file upload with php and ExtJs not working

I need the simplest solution for uploading file from Ext application with php. I'm a total php newbie, so I don't get the errors I'm recieving and can only guess what's causing them. On the frontend side I have a simple form :



Ext.create('Ext.form.Panel', {
width: 300,
renderTo: Ext.getBody(),
frame: false,
title: 'File Upload Form',
bodyPadding: '10 10 0',

defaults: {
anchor: '100%',
allowBlank: false,
msgTarget: 'side',
labelWidth: 50
},

items: [{
xtype: 'filefield',
id: 'form-file',
emptyText: 'Select mpp file',
fieldLabel: 'File',
name: 'mpp-file',
buttonText: '',
buttonConfig: {
iconCls: 'upload-icon'
}
}],
buttons: [{
text: 'Upload',
handler: function(){
var form = this.up('form').getForm();
if(form.isValid()){
form.submit({
url: 'msp-load.php',
waitMsg: 'Loading data...',
success: function(fp, o) {
msg('Success', 'Data from .mpp file loaded ');
}
});
}
}
}]
})


The msp-upload.php looks as follows :



<?
if(isset($_FILES)){
$file_tmp = $_FILES['mpp-file']['tmp_name'];
$file_name = $_FILES['mpp-file']['name'];
$file_size = $_FILES['mpp-file']['size'];

//echo ($file_tmp.", ".$file_name.", ".$file_size);

if(is_uploaded_file($file_tmp)) {
if(move_uploaded_file($file_tmp, "tmp/$file_name")){
echo '{success: true}';
} else {
echo '{success: false}';
}
} else{
echo '{success: false}';
}
}
?>


After clicking 'Upload' I get :



uncaught exception: Ext.JSON.decode():
You're trying to decode an invalid JSON String:
<br> <b>Warning</b>: move_uploaded_file(tmp/MSP1.mpp) [<a href="function.move-uploaded-file">function.move-uploaded-file</a>]: failed to open stream: No such file or directory in <b>/Library/WebServer/Documents/examples/MSProject_import/msp-load.php</b> on line <b>10</b><br>
<br> <b>Warning</b>: move_uploaded_file() [<a href="function.move-uploaded-file">function.move-uploaded-file</a>]: Unable to move '/private/var/tmp/phpJVDktB' to 'tmp/MSP1.mpp' in <b>/Library/WebServer/Documents/examples/MSProject_import/msp-load.php</b> on line <b>10</b><br> {success: false}



Where does this : 'No such file...' error come from? It can't find the uploaded file, or something else? My server user has admin privileges so it's not about permissions.



I'm using built-in OSX 10.7 server with PHP 5.3.6 . No errors in the error.log .





How to search through sub views of navigation bar

I have a small question...How to search through the sub views of navigation bar.My thought is to change the font size if navigation title....





Why is there a red line next to my logo?

I have an odd redline next to my logo, and I can't for the life of me work out why.



Take a look:
http://www.pdf-explode.com.au/index.php



Here's the red line I'm talking about:
http://www.bounceapp.com/66618




  • I've tried looking at all the borders, there's no red.

  • searched through backgrounds, no red.

  • inspector can't inspect it.

  • it's not in the image



Let me know if you can find it.



Thanks



Jason





Adding icons beside tabs - Editing jquery / jsfiddle

whould you please take a look at this jsfiddle :
http://jsfiddle.net/VictorVelarde/DbCgt/



i want to add a small icons (links) and pic in the ul ( gray header ) next to the tabs.
but i could't edit the fiddle. also I'm not sure how to do it exactly.





hex string to character in python

i have a hex string like:



data = "437c2123"


i want to convert HEX to CHARACTER according to the ASCII table
the result should be like:



data_con = "C|!#"


Can anyone tell me how to do this?
Any suggestion will be appreciated. Thanks.





deleting text only after comment(--)

My project is currently spposd to delete all thetext after the -- signs, as it represents a comment.
my code now is deleting all the text in the text in the text file, een before the comment.



here is my code so far:



static void Main( string[] args )
{
string line = null;
string line_to_delete = "--";
string desktopLocation = Environment.GetFolderPath( Environment.SpecialFolder.Desktop );
string text = Path.Combine( desktopLocation, "tim3.txt" );
string file = Path.Combine( desktopLocation, "tim4.txt" );

using (StreamReader reader = new StreamReader( text ))
{
using (StreamWriter writer = new StreamWriter( file ))
{
while (( line = reader.ReadLine() ) != null)
{
if (string.Compare( line, line_to_delete ) == 0)
File.WriteAllText( file, File.ReadAllText( text ).Replace( line_to_delete, "" ) );
continue;
}
}


how can i specify that it must only delete the te
Thanks





Get jQuery from masterpage working on contentpage

I have a problem that my jQuery don't load or something when i'm on the contentpages.



When i click on the link that should load the jquery, it only works at my startpage (Default.aspx). And when i click at the same link that is placed in my footer on any other contentpage, nothing happens. So i guess something is wrong with the paths or the loading of my scripts.



I'm not so familiar with jQuery so hopefully someone can help me.



Here is my scripts in the masterpage .



<script type="text/javascript" src="../fancybox/jquery.fancybox-1.3.4.pack.js"</script>

<link href="../fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">

$(document).ready(function () {

$(".inline").fancybox({
'hideOnContentClick': true,
'titlePosition': 'inside',
'transitionIn': 'none',
'transitionOut': 'none'
});

});
</script>


And this is what it calls, the footer in my masterpage.



<div id="footer"><a class="inline" href="#data">Viktor Nilsson</a></div>

<div style="display:none">
<div id="data">
Kontakta Viktor Nilsson<br />
Tel: 00000<br />
Email: aaa@hello.com <br /><br />
</div></div>




Server side video converter

I am setting up a CMS built in PHP, and now i need to add a part where the user can convert a video from FLV to MP4 format. I have searched for scripts and solutions but nothing works. I was ready to pay for the software but "Aviberry" software costs $5000 and "sothinkmedia" does not work properly on Linux servers. If anyone has something that will work for sure I would appreciate all suggestions.





Change Group Name in Crystal Reports to non-Database Value using Formula

I am looking to change the group names in a crystal report to a specified text value not located within the database.



e.g. i have a 'status' field that can either be 'i' or 'a'. I would like these to display as 'inactive' or 'active' in the group headings. The code i currently have in the 'Use a formula as group name' is:



stringvar newGroupName;
if (groupname = "I") THEN newGroupName:= "Inactive" ELSE
if (groupname = "A") THEN newGroupName:= "Active" ELSE
newGroupName:= groupName;
newGroupName


However this says i am passing too few arguments for the groupName reserved word.



Have looked on the net but have not found anything for defining non database names using the groupname function. Any help greatly appreciated.





Dependency Issue with Gemfiles and Webrick

I've been trying to configure webrick to use SSL on all pages of my application.



I added



gem 'rack-ssl', :require => 'rack/ssl'


to my gem file and



config.middleware.insert_before ActionDispatch::Static, "Rack::SSL"
config.force_ssl = true


to my /config/application.rb file. And I configured webrick to use my self signed certificate by modifying my /script/rails file to looke like so



require 'rubygems'
require 'rails/commands/server'
require 'rack'
require 'webrick'
require 'webrick/https'

module Rails
class Server < ::Rack::Server
def default_options
super.merge({
:Port => 3001,
:environment => (ENV['RAILS_ENV'] || "development").dup,
:daemonize => false,
:debugger => false,
#:pid => File.expand_path("tmp/pids/server.pid"),
:config => File.expand_path("config.ru"),
:SSLEnable => true,
:SSLVerifyClient => OpenSSL::SSL::VERIFY_PEER,
:SSLPrivateKey => OpenSSL::PKey::RSA.new( File.open("home/sureweb/rubystuff/server.cert.key").read),
:SSLCertificate => OpenSSL::X509::Certificate.new(File.open("home/sureweb/rubystuff/server.cert.crt").read),
:SSLCACertificateFile => 'home/sureweb/rubystuff/server.crt',
:SSLCertName => [["CN", WEBrick::Utils::getservername]]
})
end
end
end

APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'


But every time I run rails s I get a message saying



You have already activated activesupport 3.2.3, but your Gemfile requires activesupport 3.0.12. Using bundle exec may solve this. (Gem::LoadError)


Normally I could solve this by removing the version 3.2.3 but I have numerous other gems that depend on it so that is not an option. Is there another way to get this working?





PHP file includes inside function, need to retain global variables. (Trying to wrap HTML comments)

In an attempt to speed up my workflow and help the back end guys with integration (I'm a front end dev) I'm attempting to extend the file includes function by wrapping comments around each file include to output it's filename:



function include_module($path) {
echo "\n\n<!-- MODULE: ".basename($path, '.php')." -->\n";
include($path);
echo "\n<!-- /MODULE: ".basename($path, '.php')." -->\n\n";
}
include_module('form-controls.php');


However this results in the loss of access to any variables set outside the function. I know I can do:



global $var


But that will only give me access to $var (I'm aware I could do $var['var1'], etc), is there any way to do 'global all' or can anyone think of a different approach to wrap the comments?



Cheers :)





Compiler Error Message: CS0433: The type '_Default' exists in both path abc and prq

My application works fine whenever i run under VS 2010. When I upload it on a server andi run from IIS it gives Complie error : CS0433:
'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\~\App_Web_dzybh5am.DLL' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\~\App_Web_znctdhjf.DLL'



Error:



Line 146:    
Line 147: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 148: public class default_aspx : global::_Default, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {
Line 149:
Line 150: private static bool @__initialized;


A quick search on google revealed that deleting those temporary files solved the problem. Is it useful to delete those temporary files, will it affect my application in future ?



I just want to know should I delete all files from temporary folder.





Set `scheduledend` on Appointment to null with Javascript

I'm writing javascript on Appointment form and need to clear scheduledend DateTime field.



Tried the obvious way, but it did not work.



Xrm.Page.getAttribute('scheduledstart').setValue(null);
Xrm.Page.getAttribute('scheduledend').setValue(null); // Both do nothing


How do make DateTime field blank?





PHP Word Censor help, censor word based on a criteria using regex

Hi all im trying to build a regular expression which will sustain the following criteria.



Word to be censored in this example "view".
Character to be used after censor: "%", since "*" mess up my post formatting.



Examples of word use:

view

views

preview

I went to see the great view

The view was great wasn't it.



Example after word censor:

%%%%

views

preview

I went to see the great %%%%

The %%%% was great wasn't it.



Here is some code I have:



$string = preg_replace_callback('/\s*'. preg_quote($word, '\\') .'\s*/is', 'bbcode_callback_censored', $string);


Trouble is this matches everything right now since i use "*" in the regex ater "\s". Any ideas what I could do to fulfill my criteria?





Force Logoff from - BASIC "Active Directory" Authentication

how can i force the user to be logged off the IIS Active Directory Authentication?



clearing the session does not seem to do it, and it's not a complete log off unless i close ALL my browser windows..



is it even possible to do via code?



Thank you!





LAR import failure on Liferay 6 with Weblogic 10.3

I am trying to export pages as LAR from one community and trying to import this LAR into another community.
Bascially we wanted to export LAR from one environment and import into other environments.
During the import we are getting the following exception.
We are using the following configuration:
Liferay 6 Enterprise Edition installed on Weblogic 10.3
JDK 1.6
Unix Environment



Screen Error:
An error occurred while accessing the requested resource.



http://myserver.com:7003/en_GB/group/control_panel/manage?p_auth=Za3nNCBU&p_p_id=156&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&doAsGroupId=12401&refererPlid=10165&_156_struts_action=%2Fgroup_pages%2Fimport_pages&_156_backURL=&_156_groupId=12401&_156_privateLayout=false



Caused by: java.lang.NoClassDefFoundError: org/dom4j/Element
at org.jaxen.dom4j.DocumentNavigator.getChildAxisIterator(DocumentNavigator.java:231)
at org.jaxen.expr.iter.IterableChildAxis.namedAccessIterator(IterableChildAxis.java:98)
at org.jaxen.expr.DefaultNameStep.evaluate(DefaultNameStep.java:180)
at org.jaxen.expr.DefaultLocationPath.evaluate(DefaultLocationPath.java:140)
at org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:102)
at org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:674)
at org.jaxen.BaseXPath.selectNodes(BaseXPath.java:213)
at org.jaxen.BaseXPath.selectSingleNode(BaseXPath.java:234)
at org.dom4j.xpath.DefaultXPath.selectSingleNode(DefaultXPath.java:159)
at org.dom4j.tree.AbstractNode.selectSingleNode(AbstractNode.java:185)
at com.liferay.portal.xml.NodeImpl.selectSingleNode(NodeImpl.java:211)
at com.liferay.portal.lar.LayoutImporter.importLayout(LayoutImporter.java:818)
at com.liferay.portal.lar.LayoutImporter.importLayouts(LayoutImporter.java:346)
at com.liferay.portal.service.impl.LayoutLocalServiceImpl.importLayouts(LayoutLocalServiceImpl.java:706)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:86)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:60)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:60)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:60)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:93)
at $Proxy96.importLayouts(Unknown Source)
at com.liferay.portal.service.impl.LayoutServiceImpl.importLayouts(LayoutServiceImpl.java:300)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:86)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:60)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:60)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:60)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:93)
at $Proxy97.importLayouts(Unknown Source)
at com.liferay.portal.service.LayoutServiceUtil.importLayouts(LayoutServiceUtil.java:173)
at com.liferay.portlet.communities.action.ImportPagesAction.processAction(ImportPagesAction.java:62)
at com.liferay.portal.struts.PortletRequestProcessor.process(PortletRequestProcessor.java:174)
at com.liferay.portlet.StrutsPortlet.processAction(StrutsPortlet.java:190)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:653)
at com.liferay.portlet.InvokerPortletImpl.invokeAction(InvokerPortletImpl.java:689)
at com.liferay.portlet.InvokerPortletImpl.processAction(InvokerPortletImpl.java:361)
at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:840)
at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:629)
at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:240)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:170)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:516)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:493)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:199)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:240)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:75)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:500)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:248)
at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:136)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:301)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:199)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:113)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
at com.liferay.portal.servlet.filters.etag.ETagFilter.processFilter(ETagFilter.java:55)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:240)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:75)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:500)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:248)
at com.liferay.portal.servlet.I18nServlet.service(I18nServlet.java:102)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:80)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:207)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:184)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:164)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:164)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:75)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
... 6 more





appent text to input field

Is there any way to append a text to input field?



So lets say instead of:



<input type="text" id="val" name="val" value="http://" style="width: 140px;" />


with "http://" already written, have a "http://" added automatically when someone types an address, and if someone types full url "http://www.****.com" the http should not be added so it's not doubled.



Any one has any ideas? I can't use php.





JQuery AJAX append to appended element

I am using RoR with AJAX to create posts. So I need an ability to add an 'answers' by previous id.

Every time submit button clicked following code being called



$("<%= selector %>").append("<div id='<%= newanswer %>'><%= escape_javascript(render('answer_layout')) %></div>");


where

selector looks like this #answer-12

newanswer would be #answer-13



First time it works as suggested, but when I click submit second time I need to use already appended #answer-13 div to append newly #answer-14, and it doesn't work. I understand that document doesn't know about first appended element, but have no idea how to resolve this issue. Thanks for any help.





Linking to libcrypto for Leopard?

I am using Mac OS X 10.6 SDK and my deployment target is set to Mac OS 10.5. I'm linking to libcrypto (AquaticPrime requires this) and found out that my app doesn't launch on Leopard. The error is



dyld: Library not loaded: /usr/lib/libcrypto.0.9.8.dylib



I've tried the following workarounds but none of them work:




  • Linking directly to libcrypto.0.9.7.dylib (the 10.6 SDK refuses to link directly with libcrypto.0.9.7.dylib.

  • Copying the 10.5 SDK's version of libcrypto.0.9.7.dylib to the 10.6 lib directory and try t link with it (this time the link process succeeded but in Leopard the app still tries to lookup the non-existent libcrypto.0.9.8.dylib file and thus won't launch).

  • Copying libcrypto.0.9.7.dylib from a Mac OS X 10.5.8 installation and link with it (the link was successful but the app still looks for libcrypto.0.9.8.dylib).



Is there a way to link to this library and still use the 10.6 SDK?



Thanks.





Try to add a scrollpane to a JTable component

I try to make a scrollbar on my JTable, but it not works. I have a JTable with 21 rows and 5 columns. I have a scrollpane object, and I constructs this like



public Targy_felv() {

JScrollPane scrollPane;
JFrame frame = new JFrame();
frame.setVisible(true);
frame.setSize(600, 300);
table = new JTable();
Object o[] = new Object[]{"Tárgynév", "Oktató", "Kredit", "Félév", "Tárgykód"};
table.setModel(new DefaultTableModel(get_Tárgyak(), o));
scrollPane = new JScrollPane();
scrollPane.getViewport().add(table);
frame.add(table);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}




Design an algorithm to find all pairs of integers within an array which sum to a specified value?

Design an algorithm to find all pairs of integers within an array which sum to a specified value ?



It was not an assignment question. I had tried this problem using Hash table to store entry for sum of array elements but it is not the efficient solution and so want to know what are thoughts of other stackoverflow readers on it.



Thanks.





SVN Commit error: Can't open file txn-current-lock Permission denied

I can do checkouts, update and such. But when I try to commit changes, svn gives me the following error:



Can't open file '/svn/p/pokemonium/code/db/txn-current-lock': Permission denied



I am using Windows 7 x64 SP1 with latest version of TortoiseSVN.
UAC is off, my account has read and write access, etc.



I can commit fine to other svn repositorys.





how do I use the grep --include option for multiple file types?

When I want to grep all the html files in some directory, I do the following



grep --include="*.html" pattern -R /some/path



which works well. The problem is how to grep all the html,htm,php files in some directory?



From this post, it seems that I can do the following



grep --include="*.{html,php,htm}" pattern -R /some/path



But sadly, it would not work for me.

FYI, my grep version is 2.5.1.





Regex validate sequence

I've a sequence of comma separated words like x1,x2,x3.... Some words in this sequence maybe optional i.e the sequence x1,x3,x4,x6 is valid with x2 and x5 being optional, and the rest of the words being mandatory. The above sequence can be repeated for maximum of n number of times.



For ex, the sequence of words x1,x2,x3 can be repeated maximum of 3 times with x2 being optional, the following is a valid sequence: x1,x3,x1,x2,x3,x1,x3



How do I validate the above using a regex pattern?



I tried something like
(,{0,1}x1,(x2,){0,1}x3,{0,1}){3}
But the above will work for all multiples of three, if I use {1,3} then any amount of repetitions will match because they're multiples of 1 {1,3}.





Sort a PHP array of Array based on a column value

I need to sort the following array of array based on the value of ['sort_column']. Is there a direct php function that does this or I need to use a for loop? Please assist, my brain is not working at the moment. Thanks in anticipation of a response.



Array
(
[0] => Array
(
[sender_id] => 72
[sender_persona_id] => 92
[recipient_persona_id] => 40
[has_read] => 1
[sort_column] => 92
)

[1] => Array
(
[sender_id] => 84
[sender_persona_id] => 34
[recipient_persona_id] => 40
[has_read] => 1
[sort_column] => 34
)

[2] => Array
(
[sender_id] => 90
[sender_persona_id] => 40
[recipient_persona_id] => 34
[has_read] =>
[sort_column] => 34
)

[3] => Array
(
[sender_id] => 90
[sender_persona_id] => 40
[recipient_persona_id] => 34
[has_read] =>
[sort_column] => 34
)

[4] => Array
(
[sender_id] => 90
[sender_persona_id] => 40
[recipient_persona_id] => 92
[has_read] => 1
[sort_column] => 92
)

[5] => Array
(
[sender_id] => 90
[sender_persona_id] => 40
[recipient_persona_id] => 92
[has_read] => 1
[sort_column] => 92
)

[6] => Array
(
[sender_id] => 90
[sender_persona_id] => 40
[recipient_persona_id] => 92
[has_read] => 1
[sort_column] => 92
)

[7] => Array
(
[sender_id] => 90
[sender_persona_id] => 40
[recipient_persona_id] => 92
[has_read] => 1
[sort_column] => 92
)

)




General-purpose distributed scheduling library for Java

I'm looking for some general library for scheduling lots of tasks. The library has to provide ability to split tasks across nodes in cluster, perform load balancing and fault tolerance - so if some node goes down, the tasks for the node has to be distributed across remaining nodes.



I looked at the Hadoop - but look like it will work well for map-reduce tasks. In my case tasks are simply senders of notifications, checkers for object state etc.



Quartz seems to be great - but it's not clear how good is it when it comes down to dispatching events to nodes.



Any other options?





how to insert a count record column into an existing table

I need to count records from one table and insert that YTD total into a table that I am storing YTD summary totals.



Here is what I tried to do:



SELECT COUNT(members) as YTD_Members_CT FROM dbo.tblMembers
WHERE InputDate between '2011-10-01' and '2012-04-30'



Insert into dbo.YTDSummary (YTD_Members)
values (YTD_Members_CT)



The dbo.tblMembers contains my daily information that I wish to count. I am trying to store the count of members for the time period in another table. I can get the count to appear on the screen with a column name "YTD_Members_CT" but how do I get that count to insert into the other table called dbo.YTDSummary





PHP relative date filters in Drupal 7 view

I'm building a view in Drupal and am having an issue setting the filter criteria around a date.



I have a content type of "film of the week". It stores basic film attributes such as film name, director, guidance rating, starring, etc etc. It also has a date saying when the film starts as film of the week, and when it ends.



Currently, film of the week (Film A) runs from Tuesday through until the following Monday. the next Tuesday a new film (Film B) is displayed as film of the week.



When filtering using the operator "is equal to" and the relative end date "next Monday" I thought I would always get back the current film of the week. However, on a Monday I should see Film A as it still active but "next Monday" is the following week so I only see "Film B".



Any suggestions how I can say "if today is not Monday show me next Monday, otherwise show me today" in this context?



Thanks in advance.





Drupal 7 - image module and contrib module

I wrote a module with "image" in dependecies. But I can't use the functions in image.gd.php
Apache log:
Call to undefined function image_gd_save()



Can you help me?