Tuesday, April 24, 2012

OSX + Terminal.app + Emacs + make command key operate as meta

I'm on OSX Lion



I running emacs inside of Terminal.app



I want command-x to result in M-x (and in general, command -> M)



I have tried the following solution and they're not what I want:





What I want, is only inside of Terminal.app (or only inside of emacs), to bind the command key to meta. How do I achieve this?





Changing DIV colors using hover and click in JQuery

Could someone please help. I have these two:



I would like the text to change to lightgreen when hovering, white when not hovering, and red when clicked.



$(".music").hover(
function() {
$(this).css('color','lightgreen');
},
function() {
$(this).css('color', 'white');
}
);

$(".music").click(function () {
$('#result').load('album_list_index.php');
$(this).css({ 'color': 'red', 'font-size': '100%' });
});


Thank you in advance



AC



NOTE: ok im sorry i did not make myself clear.



I need the div to be white when not mousedover
I need it to be gree when mouseover
And i need it to be red when clicked, and remain red until another button is clicked.





java replaceAll(regex, replacement) regex command

Hello I would like to know if anyone knows the regex command to remove the following



 name = 


from the following



 name = wlr


leaving only



 wlr


these details are taken from a txt file but the name = part can appear multiple times



so I was thinking something like this would work but it doesnt work properly



 String file_name = newLine3.replaceAll("name = ", "");


Any help appreciated
Thanking You





Assigning Created Joomla User to the Current User

I've created a Joomla plugin for facebook which lets facebook users to login.
Also, I'm creating new user when they first login through faceobok.



I want to set the current user object to the created user.
is it possibile in Joomla? How?



Thanks





Cell Array appending

I have this doubt.. I need to append the array of string in Matlab. Please suggest me how to do it..



I would like to append the string column wise on each iteration..



Here is a small code snippet which i am handling



<CODE>:
for_loop
filename = 'string';
name=[name; filename]
end


Thanks
Kiran





lock screen sometime not display android

i created lock screen application.. Sometimes it give me a problem. problem is that some time default lock screen display rather than my lock screen and some time directly home screen display. i donot know where is the problem. please give me suggestion about this.



LockScreenActivity:
Use
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();



and create ScreenReceiver:
ACTION_SCREEN_OFF
ACTION_SCREEN_ON
ACTION_BOOT_COMPLETED



Refer this link: http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/



in manifeast file : declare service and receiver and permission



The problem is in BroadcastReceiver when
if (recievedIntent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
//call activity
}else if (recievedIntent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
}
but the activity call after screen on.. so what is missing or what is problem.. why it is happn pls rply.





Cross Domain SSO with DotenetOpenAuth

I have integrated DotenetOpenAuth to login using google account.

Its working perfect.
Can i achieve this with it ?

Once user logged in site1.com if user browse to site2.com the user get automatically logged in.





how to get data from json?

I have controller



var subCategories = m_listsRepository.GetSubCategories(id);
var items = subCategories.Select(x=>new MyDataNameAndId(){Id = x.Value, Name = x.Text});
return Json(items);


And ajax:



$.ajax({
url: urlString,
type: 'POST',
data: JSON.stringify({ id: districtId }),
dataType: 'json',
contentType: 'application/json',
cache: 'false',
success: function (data) {
alert("success");
$.each(data, function (key, MyDataNameAndId) {
alert(key);//== 0
alert(MyDataNameAndId);// then throws
$('select#ChangeOnsubCategoryId').append('<option value="0">Select One</option>');

$.each(MyDataNameAndId, function (index, manager) {
$('select#ChangeOnsubCategoryId').append(
'<option value="' + manager.Id + '">'
+ manager.Name +
'</option>');
});
});
}
});


what am I doing wrong?



UPDATE:
Controller is worked.
alert("success"); - is show
alert(key); - is show 0
alert(MyDataNameAndId); - not show.
I need generate in 'select#ChangeOnsubCategoryId' options from select#ChangeOnsubCategoryId



How do this? this understand?



I do not know how to show what passed json



json string:



[{"Id":"53","Name":"??????"}]




Where is the webkit framework in lion

I am trying to add webkit framework to Xcode,
steps I followed is



selected the target,
went to the 'build phases' tab,
opened the 'Link binary with Libraries'
Use the + to add the library



But in MacOSX 10.7(Lion),I was not able to see webkit.framework in the framework list.



Any Ideas Where it resides?





Suggest a MySQL Query

I have a table with 3 fields.



ID    Name     ParentID     Active
1 A 0 1
2 B 0 1
3 C 2 1


Now, I want a query where if there is row with ParentID > 0 and active then the row with its parent id (2) is skipped.



Please suggest a single MySQL query to achieve this.



Thank you,
Khuram





Public action method 'undefined' could not be found on controller

I have a page with an ActionLink on it:



@Html.ActionLink(@UserResource.MoreResults, "RowList", routeValues, new { id = "LoadMoreLink", @class = "btn primary small" })


With the following jQuery:



$("#LoadMoreLink").live("click", function () {
// Ajax call to load new results
$.get($(this).attr("href"), function (response) {
...
});
return false;
});


So everytime the link is clicked, I intercept it and perform a GET with ajax. The first time (and only the first time), I got the error below:



enter image description here



Then the code is paused. If I press F5 I can continue without problem. I noticed also that if I breakpoint in this code, the code is processed 2 times. I mean every step (F10) execute each line of code 2 times.



This problem is very strange because I copy/paste this all the code from somewhere else where this problem didn't occurred.



Any idea? Thanks.





setting min date in jquery datepicker

Hi i want to set min date in my jquery datepicker to (1999-10-25) so i tried the below code its not working.



$(function () {
$('#datepicker').datepicker({
dateFormat: 'yy-mm-dd',
showButtonPanel: true,
changeMonth: true,
changeYear: true,
showOn: "button",
buttonImage: "images/calendar.gif",
buttonImageOnly: true,
minDate: new Date(1999, 10 - 1, 25),
maxDate: '+30Y',
inline: true
});
});


** if i change the min year to above 2002 than it will work fine but if i specify min year less than 2002{like above eexample 1999} it will show only up to 2002.can someone help me. i am using jquery-1.7.1.min.js and jquery-ui-1.8.18.custom.min.js.





Stylesheet for printing, background-color ignored

I create a table where I cycle between giving each tr the class "odd" and "even". In my stylesheet I've got this:




table tbody tr.odd {
background-color: #cccccc;
}


This works from the browser but not when printing. Everything else in my media stylesheet works except this background-color.



I have colors enabled for printing, I can print images with colors... so?





Using WebApi as a standalone project in one solution

If i want to use WebAPI as a service to connect to multiple databases on different servers and retrieve the data that my MVC application will use what is the best way to do it? I don't want do have ApiController(s) in the same project as my MVC project.





How to convert flat data array collection into hierarchical data structure in as3/flex?

I don't want to use GroupCollection and GroupCollection2 due to some reason. I need to do manually.



Please follow Stackoverflow this link for my exact scenario. How can do same with as3 with efficient way.



Thanks,
Raja.J





SQL report error on where help please

I have a report to check for duplicate "vouchers" but have got a little lost and getting an error. Have a look!



Declare @StartDate as  Datetime
Declare @EndDate as Datetime

set @StartDate = GetDate()-14
set @EndDate = GetDate()


SELECT *
FROM (SELECT dupl.TerminalID, dupl.Location, dupl.Country, dupl.VoucherNumber,
MIN(realdupl.vsTransDate)

AS FirstVoucher, MAX(realdupl.vsTransDate) AS LastVoucher

FROM
(SELECT vs.vsTermID AS TerminalID, cfg.cfgLocation AS Location,

cfg.cfgLocationCountry AS Country, vs.vsVoucherNum AS VoucherNumber, COUNT(*) as
NoOfVouchers
FROM

(SELECT vsTermID, vsVoucherNum, vsTransDate, vsReversalIndicator FROM
ProBatchHostDbSec.dbo.vatVouchers (NOLOCK)
)
AS vs
INNER JOIN TermConfig AS cfg WITH (NOLOCK)
ON vs.vsTermID = cfg.cfgTerminalID
WHERE vs.vsReversalIndicator = 0
AND cfg.cfgProductionTerminal = 'Y'
AND cfg.cfgLocationCountry = 'SG'
GROUP BY vs.vsTermID, cfg.cfgLocation,
cfg.cfgLocationCountry, vs.vsVoucherNum
HAVING COUNT(*) > 1
) AS dupl
INNER JOIN
(SELECT vsTermID, vsVoucherNum, vsTransDate, vsReversalIndicator FROM
ProBatchHostDbSec.dbo.vatVouchers

AND dupl.VoucherNumber = realdupl.vsVoucherNum
GROUP BY dupl.TerminalID, dupl.Location, dupl.Country, dupl.VoucherNumber
) AS temp

WHERE temp.FirstVoucher != temp.LastVoucher
AND temp.LastVoucher BETWEEN @StartDate AND @EndDate
ORDER BY temp.TerminalID, temp.LastVoucherdbo.vatVouchers --WITH (NOLOCK)
GROUP BY dupl.TerminalID, dupl.Location, dupl.Country, dupl.VoucherNumber
) AS temp


When I run this I get an error "Incorrect syntax near the keyword 'WHERE'."
Wheres the incorrect syntax??



Thanks in advance!





Calling variable defined inside one function from another function. PYTHON 3.2.3

if I have this:



def oneFunction(lists):
category=random.choice(list(lists.keys()))
word=random.choice(lists[category])

def anotherFunction():
for letter in word: #problem is here
print("_",end=" ")


I have previously defined lists, so oneFunction(lists) works perfectly.



My problem is calling word in line 6. I have tried to define word outside the first function with the same word=random.choice(lists[category]) definition, but that makes word always the same, even if I call oneFunction(lists).



I want to be able to, every time I call the first function and then the second, have a different word.



Can I do this without defining that word outside the oneFunction(lists)?





Agile Vs Spiral Model for SDLC

I believe that Agile is nothing but another implementation of Spiral Model. I am a big supporter of Spiral (The spiral model is a software development process combining elements of both design and prototyping-in-stages, in an effort to combine advantages of top-down and bottom-up concepts) since its beginnings and have seen that lot of projects implement Spiral without knowing that they are operating in a Spiral world. Since the day Agile started gaining popularity the concept of spiral started getting overlooked a little bit. I am sure that for complex projects spiral is still the best alternative but I would like to get a better understanding of the similarities and differences between Agile and Spiral techniques. Can anyone explain their differences/similarities?





Is Port Redirection/Forwarding (i.e. 8443 -> 3389) for Windows Vista/Server 2008 possible with the built-in firewall?

Is it possible to execute port redirection/forwarding with the built-in firewall (or some other software) for Vista/Windows 2008?



I want to forward port 8443 to 3389 (HTTPS forwarded to Remote Desktop port) for RDP access to a server from places where the normal RDP port is blocked. I can do this with a hardware firewall at work, but I don't know if its possible to directly implement it with the built-in firewall for other computers without access to a hardware firewall.



I've tried a simple forwarding rule rinetd (http://www.boutell.com/rinetd) and PortTunnel (steelbytes.com) without success.



Any ideas/suggestions for how to implement this?





Firefox and Updatepanel

I have a problem with FireFox and ASP.NET UpdatePanel.
I have in a form a checkbox and an UpdatePanel. When I check the checkbox, an asp:panel which is into the UpdatePanel should become visible.



<asp:CheckBox ID="cbMoreOptions" runat="server" Text="plus d'options" AutoPostBack="True" OnCheckedChanged="cbOptions_CheckedChanged" /> 

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server" Visible="false">
sssssssss
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cbMoreOptions" EventName="CheckedChanged" />
</Triggers>
</asp:UpdatePanel>


Everything is working fine but not after I refresh the page while the checkbox is checked. If this is happening, the checkbox rest checked the page doesn't make postback more to the server. The firebug shows that the page gets a response and when I verify the its content I have en error 500 which tell that the information of the page is corrupt. All this is happening only in Firefox. In IE8 and Google Chrome everything is ok.



Does anybody have an idea how can I avoid this? It's a bug of Firefox?
All the weird comportment continues until I make enter into the URL textbox. Even if I make F5 nothing happens. What is the difference between F5 and enter into the URL? They shouldn't have the same result?



Thanks a lot.